/** * Configuration loader for Quoomb * Handles loading, parsing, and interpolating quoomb.config.json files */ import type { Database, SqlValue } from '@quereus/quereus'; /** * Plugin configuration from config file */ export interface PluginConfig { source: string; config?: Record; } /** * Quoomb configuration file format */ export interface QuoombConfig { $schema?: string; plugins?: PluginConfig[]; autoload?: boolean; } type JsonPrimitive = string | number | boolean | null; type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue; }; /** * Interpolate environment variables in a value. * Supports ${VAR_NAME} and ${VAR_NAME:-default} syntax. */ export declare function interpolateEnvVars(value: JsonValue, env?: Record): JsonValue; /** * Interpolate environment variables in a config object */ export declare function interpolateConfigEnvVars(config: QuoombConfig, env?: Record): QuoombConfig; /** * Convert a plugin's config object (as read from a config file or settings — * already JSON-compatible) into the `SqlValue`-typed config the plugin channel * carries. * * Nested objects/arrays are valid {@link SqlValue}s (the `JsonSqlValue` arm) and * are passed through **unchanged**, NOT flattened to JSON strings. Plugins * receive the structured config they declare (e.g. IndexedDB's * `cache: CacheOptions`). Flattening here would silently deliver a *string* to a * plugin that casts the value straight to an object, dropping the setting. * * This is the single encode step for the plugin config channel; the decode side * is the plugin reading `config.` directly, so the round-trip is symmetric. */ export declare function toPluginSqlConfig(config: Record | undefined): Record; /** * Load plugins from a config object. * Collects all load failures and throws an aggregate error when any plugins fail. * * NOTE: this is the shared direct-import config-load loop; the CLI (bin + repl) * calls it directly. The web app cannot reuse it because it must load plugins * through the Comlink worker (`api.loadModule`) rather than importing in-process, * so it re-implements the loop over that boundary — but shares the config→SqlValue * encoding via `toPluginSqlConfig` (the part that was actually duplicated and buggy). * Unifying the loop bodies too would force a worker-boundary dependency edge. */ export declare function loadPluginsFromConfig(db: Database, config: QuoombConfig, options?: { allowCdn?: boolean; env?: 'auto' | 'browser' | 'node'; }): Promise; /** * Validate a config object structure */ export declare function validateConfig(config: unknown): config is QuoombConfig; export {}; //# sourceMappingURL=config-loader.d.ts.map