Config API reference
Current emitted signatures and options for @db3.ai/app/config.
On this page
Source-backed MarkdownImports and examples
Import supported APIs from @db3.ai/app/config. These signatures come from the staged package used by consumers. Relative filenames in declarations describe type dependencies; they are not extra supported deep imports.
Use the guide for setup, executable examples, failure handling and ownership. A signature is not proof that every deployment or provider has been exercised.
Config and defineConfig
ts
export type ConfigValues = Record<string, unknown>;
/**
* Runtime configuration repository with dot-path reads.
*/
export declare class Config<TValues extends ConfigValues = ConfigValues> {
private readonly values;
/**
* Creates a config repository from a plain object.
*
* @param values - Config values to expose.
*/
constructor(values?: TValues);
/**
* Returns all config values.
*
* @returns Config object supplied to this repository.
*/
all(): TValues;
/**
* Reads a config value by dot path.
*
* @param path - Dot-separated config path.
* @returns Config value or undefined when the path is missing.
*/
get<TValue = unknown>(path: string): TValue | undefined;
/**
* Reads a config value by dot path with a fallback.
*
* @param path - Dot-separated config path.
* @param fallback - Value to return when the path is missing.
* @returns Config value or fallback.
*/
get<TValue>(path: string, fallback: TValue): TValue;
/**
* Returns true when a dot path exists in this config repository.
*
* @param path - Dot-separated config path.
* @returns True when the path exists.
*/
has(path: string): boolean;
}
/**
* Defines a typed config object without changing its runtime shape.
*
* @param values - Config values to preserve.
* @returns The same config values.
*/
export declare function defineConfig<TValues extends ConfigValues>(values: TValues): TValues;
Environment readers and parser overloads
ts
export type EnvSource = Record<string, string | undefined>;
export interface EnvReader {
(name: string): string | undefined;
<TDefault>(name: string, fallback: TDefault): string | TDefault;
required(name: string): string;
string(name: string): string | undefined;
string<TDefault>(name: string, fallback: TDefault): string | TDefault;
boolean(name: string): boolean | undefined;
boolean<TDefault>(name: string, fallback: TDefault): boolean | TDefault;
number(name: string): number | undefined;
number<TDefault>(name: string, fallback: TDefault): number | TDefault;
integer(name: string): number | undefined;
integer<TDefault>(name: string, fallback: TDefault): number | TDefault;
array(name: string): string[] | undefined;
array<TDefault>(name: string, fallback: TDefault): string[] | TDefault;
json<TValue = unknown>(name: string): TValue | undefined;
json<TValue = unknown, TDefault = TValue>(name: string, fallback: TDefault): TValue | TDefault;
}
/**
* Creates an env reader over a supplied source object.
*
* @param source - Environment-like key/value source.
* @returns Callable env reader with typed parsing helpers.
*/
export declare function createEnv(source?: EnvSource): EnvReader;
export declare const env: EnvReader;