import { defaults } from './defaults'; import { overrides, overridesReady } from './overrides'; import type { StacksOptions } from '@stacksjs/types'; /*.ts` file has loaded and the * `overrides` instance has been mutated in place. Use this in code paths * that *must* see the merged values — typically anything outside the * normal request flow (e.g. CLI commands, top-level boot scripts) where * the request hasn't yet hit a route handler that already awaited. * * Inside request handlers / routes you generally do *not* need to await * this: the router's `serverResponse()` only fires after `importRoutes()` * resolves, and `importRoutes()` indirectly awaits config (it reads * `app/Routes.ts`, which imports config). So the proxy returns merged * values for all "normal" request-time reads. * * @example * ```ts * import { config, awaitConfig } from '@stacksjs/config' * * // CLI / top-level script — config files may not be loaded yet * await awaitConfig() * console.log(config.ports.api) // guaranteed to be the user value * ``` */ export declare function awaitConfig(): Promise; /** * Resolves once `database` config has been read by `@stacksjs/database`'s * lazy initializer. Use it from boot scripts that need a live `db` handle * before the request loop starts. * * Why a separate signal: `overridesReady` only signals that `~/config/database.ts` * was *imported*, not that `@stacksjs/database` has actually wired up the * connection. Calling `db.selectFrom(...)` immediately after `overridesReady` * resolves can still race the connection setup. The database driver flips * this signal to `true` once it has a working connection. */ export declare function awaitDatabaseConfig(): Promise; /** * Called by `@stacksjs/database` once the connection is live. Internal — * users shouldn't need to invoke this directly. */ export declare function markDatabaseReady(): void; export declare function getConfig(): StacksOptions; export declare function determineAppEnv(): AppEnv; export declare const config: StacksOptions; // Per-section convenience exports. // // Caveat: these are *snapshots* taken at module-load time. ESM `export // const x = expr` evaluates `expr` once and binds `x` to that result — // there's no language-level way to make a named export re-evaluate // per access. So `import { ports } from '@stacksjs/config'` returns // whatever `config.ports` was when the config module first evaluated, // which is *before* `overridesReady` resolves and the user's // `config/*.ts` files land. // // These start as snapshots of the framework defaults (because the user's // `config/*.ts` haven't loaded yet — see `overridesReady`). Once the // async loader resolves we reassign each `let` binding so consumers of // `import { ports } from '@stacksjs/config'` see the merged value. // // ESM live bindings make this work: when an exporting module reassigns // a `let`-bound export, every importer immediately sees the new value // (no re-import needed). The earlier `export const x = config.x` form // captured the empty-default snapshot forever. // // Caveat: code that destructures (`const { ports } = config` or reads // at the top of a function) before `overridesReady` resolves still // gets the early snapshot. For correctness in that path, read off // the `config` proxy: `config.ports.api` always pulls live. export declare let ai: StacksOptions['ai']; export declare let analytics: StacksOptions['analytics']; export declare let app: StacksOptions['app']; export declare let auth: StacksOptions['auth']; export declare let realtime: StacksOptions['realtime']; export declare let cache: StacksOptions['cache']; export declare let cloud: StacksOptions['cloud']; export declare let cli: StacksOptions['cli']; export declare let dashboard: StacksOptions['dashboard']; export declare let database: StacksOptions['database']; export declare let dns: StacksOptions['dns']; export declare let docs: StacksOptions['docs']; export declare let email: StacksOptions['email']; export declare let errors: StacksOptions['errors']; export declare let featureFlags: StacksOptions['featureFlags']; export declare let git: StacksOptions['git']; export declare let hashing: StacksOptions['hashing']; export declare let library: StacksOptions['library']; export declare let logging: StacksOptions['logging']; export declare let notification: StacksOptions['notification']; export declare let payment: StacksOptions['payment']; export declare let ports: StacksOptions['ports']; export declare let queue: StacksOptions['queue']; export declare let security: StacksOptions['security']; export declare let saas: StacksOptions['saas']; export declare let searchEngine: StacksOptions['searchEngine']; export declare let server: StacksOptions['server']; export declare let services: StacksOptions['services']; export declare let filesystems: StacksOptions['filesystems']; export declare let team: StacksOptions['team']; export declare let ui: StacksOptions['ui']; declare type AppEnv = 'dev' | 'stage' | 'prod' | string; export * from './helpers'; export { defaults, overrides, overridesReady };