import { type JsonSchema, type PathSegment } from './json-schema-utils.js'; export type EnvReference = { /** name of the environment variable */ name: string; /** path of the value, starting with the setting key (e.g. ['authProviders', 'MyProvider', 'consumerSecret']) */ path: PathSegment[]; }; /** The variable name when the value is an environment variable reference. */ export declare function getEnvReferenceName(value: unknown): string | undefined; /** Formats a path like zod does: segments joined with dots. */ export declare function formatPath(path: PathSegment[]): string; export declare function getValueAtPath(value: unknown, path: PathSegment[]): unknown; /** Lists the environment variable references found in a value, depth first. */ export declare function findEnvReferences(value: unknown, path?: PathSegment[]): EnvReference[]; /** * The path of a value as the output masking sees it, relative to the setting: keys joined with dots, array indices * dropped so the field is masked in every item (e.g. ['customerPortal', 'portals', 0, 'adminUser'] -> 'portals.adminUser'), * except a last index, kept so only that item is masked (e.g. ['historyTracking', 0] -> '[0]'). */ export declare function toMaskingPath(path: PathSegment[]): string; /** What the output masking hides for one setting. */ export type EnvMasking = { /** paths of the values resolved from environment variables, see toMaskingPath() */ paths: string[]; /** resolved values: the strings, and the string leaves of JSON values, masked wherever the output shows them */ values: string[]; }; /** * Per setting key, the paths and the values to mask in the output. * @param resolved the result of resolveEnvReferences() */ export declare function buildEnvMasking(resolved: ResolvedEnvReferences): Map; export type ResolvedEnvReferences = { /** the settings with every reference replaced by the converted value */ settings: Record; references: EnvReference[]; }; /** * Replaces every `${NAME}` value of the settings with the environment variable NAME, * converted to the type the setting's JSON Schema expects at that place, and every escaped `$${NAME}` with the * literal text `${NAME}`. * Throws one error listing every unset, empty or unconvertible variable. * @param getSchema returns the inlined JSON Schema of a setting, or undefined for an unknown setting */ export declare function resolveEnvReferences(settings: Record, env: NodeJS.ProcessEnv, getSchema: (settingKey: string) => JsonSchema | undefined): ResolvedEnvReferences;