everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
39 lines • 1.69 kB
text/typescript
import { WorkspaceIdentity } from "./identity.mjs";
//#region src/db/binding.d.ts
/**
* Whether the current process is a drizzle-kit invocation whose command needs
* a live database. Mirrors drizzle-kit's CLI layout: `drizzle-kit <command> …`.
*/
declare function requiresDatabaseConnection(argv?: readonly string[]): boolean;
/**
* Materialize the environment a spawned tool needs to reach the binding's
* database: the canonical secret name mapped to the resolved URL. The process
* that resolves bindings (the CLI composition root) pushes this into spawned
* children so they never re-derive secrets from ambient state.
*/
declare function bindingEnv(binding: {
secretName: string;
url: string;
}): Record<string, string>;
/**
* Resolve the connection URL for a workspace identity.
*
* Resolution order:
* 1. the canonical secret in the provided environment
* 2. the canonical secret in the nearest `.env` walked up from the
* workspace directory (existing environment wins — values are not
* overridden, matching dotenv semantics)
* 3. loud failure when the drizzle-kit command needs a database
* 4. an in-memory pglite placeholder for commands that never connect
* (generate, check) and for non-drizzle-kit consumers
*
* This replaces the previous silent `pglite:` fallback that masked missing
* configuration as cryptic driver errors downstream.
*/
declare function resolveDatabaseUrl(identity: WorkspaceIdentity, options?: {
env?: Record<string, string | undefined>;
argv?: readonly string[];
}): string;
//#endregion
export { bindingEnv, requiresDatabaseConnection, resolveDatabaseUrl };
//# sourceMappingURL=binding.d.mts.map