cavi-ai/
@cavi-ai/api-clientv0.11.0 stable
GitHub ↗

@cavi-ai/api-client/core/env

Package subpath: ./core/env

GLOBAL_REPO_ROOT_KEY

Kind: variable

ts
export declare const GLOBAL_REPO_ROOT_KEY: "__CAVI_REPO_ROOT__";

HttpApiEnvSource

Kind: type

ts
export type HttpApiEnvSource = Record<string, string | undefined>;

HttpApiSurfaceConfig

Kind: type

ts
export type HttpApiSurfaceConfig = {
    baseUrl: string;
    authToken: string | null;
    clientId: string;
};

HttpSurfaceEnvAliases

Kind: type

ts
/** Fallback env-var names checked (in order) when the primary key is unset. */
export type HttpSurfaceEnvAliases = {
    baseUrl?: readonly string[];
    authToken?: readonly string[];
    clientId?: readonly string[];
};

HttpSurfaceEnvFallback

Kind: type

ts
/** Last-resort values used when neither the primary nor any alias env var is set. */
export type HttpSurfaceEnvFallback = {
    baseUrl: string;
    authToken?: string | null;
    clientId: string;
};

HttpSurfaceEnvKeys

Kind: type

ts
/** Primary env-var names for one HTTP surface. */
export type HttpSurfaceEnvKeys = {
    baseUrl: string;
    authToken: string;
    clientId: string;
};

HttpSurfaceEnvSpec

Kind: type

ts
export type HttpSurfaceEnvSpec = {
    keys: HttpSurfaceEnvKeys;
    aliases?: HttpSurfaceEnvAliases;
    fallback: HttpSurfaceEnvFallback;
};

REPO_ROOT_ENV_KEY

Kind: variable

ts
export declare const REPO_ROOT_ENV_KEY: "REPO_ROOT";

RepoRootEnv

Kind: type

ts
export type RepoRootEnv = Record<string, string | undefined>;

requireRepoRoot

Kind: function

ts
export declare function requireRepoRoot(options?: ResolveRepoRootOptions): string;

resolveHttpSurfaceConfigFromEnv

Kind: function

ts
/**
 * Resolve a single HTTP surface's config from an env bag.
 * Precedence per field: primary key → aliases → caller `defaults` → spec `fallback`.
 */
export declare function resolveHttpSurfaceConfigFromEnv(env: HttpApiEnvSource, spec: HttpSurfaceEnvSpec, options?: ResolveHttpSurfaceConfigOptions): HttpApiSurfaceConfig;

ResolveHttpSurfaceConfigOptions

Kind: type

ts
export type ResolveHttpSurfaceConfigOptions = {
    defaults?: Partial<HttpApiSurfaceConfig>;
    trimValues?: boolean;
    includeAliases?: boolean;
};

resolveRepoRoot

Kind: function

ts
export declare function resolveRepoRoot(options?: ResolveRepoRootOptions): string | null;

ResolveRepoRootOptions

Kind: type

ts
export type ResolveRepoRootOptions = {
    repoRoot?: string | null;
    env?: RepoRootEnv;
    globalRepoRoot?: string | null;
};