@carllee1983/dbcli 1.23.1 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.d.ts ADDED
@@ -0,0 +1,2797 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { z } from 'zod';
4
+
5
+ /**
6
+ * Database adapter type definitions and interfaces
7
+ * Defines the contract that all database adapters must implement
8
+ */
9
+ export type DatabaseSystem = "postgresql" | "mysql" | "mariadb" | "mongodb" | "redis" | "elasticsearch";
10
+ type SqlDatabaseSystem = Extract<DatabaseSystem, "postgresql" | "mysql" | "mariadb">;
11
+ type QueryableDatabaseSystem = Exclude<DatabaseSystem, SqlDatabaseSystem>;
12
+ /**
13
+ * Connection configuration for database adapters
14
+ */
15
+ export interface ConnectionOptions {
16
+ /** Database system type */
17
+ system: DatabaseSystem;
18
+ /** Database host address or hostname */
19
+ host: string;
20
+ /** Database port number */
21
+ port: number;
22
+ /** Database user name */
23
+ user: string;
24
+ /** Database password */
25
+ password: string;
26
+ /** Database name */
27
+ database: string;
28
+ /** MongoDB connection URI (optional, for MongoDB connections) */
29
+ uri?: string;
30
+ /** MongoDB auth database — used when building URI from host/port/user/password (default: 'admin') */
31
+ authSource?: string;
32
+ /** Connection timeout in milliseconds (default: 5000) */
33
+ timeout?: number;
34
+ /** Elasticsearch protocol (http or https) */
35
+ protocol?: "http" | "https";
36
+ /** Elasticsearch nodes for round-robin (optional) */
37
+ nodes?: string[];
38
+ /** Elasticsearch Cloud ID (optional) */
39
+ cloudId?: string;
40
+ /** Elasticsearch API Key (optional) */
41
+ apiKey?: string;
42
+ /** Elasticsearch CA Certificate Path (optional) */
43
+ caPath?: string;
44
+ /** Whether to reject unauthorized TLS connections (default: true) */
45
+ rejectUnauthorized?: boolean;
46
+ }
47
+ type SqlConnectionOptions = ConnectionOptions & {
48
+ system: SqlDatabaseSystem;
49
+ };
50
+ type QueryableConnectionOptions = ConnectionOptions & {
51
+ system: QueryableDatabaseSystem;
52
+ };
53
+ /**
54
+ * Schema information for a single column
55
+ */
56
+ export interface ColumnSchema {
57
+ /** Column name */
58
+ name: string;
59
+ /** Column data type */
60
+ type: string;
61
+ /** Whether column allows NULL values */
62
+ nullable: boolean;
63
+ /** Default value for column (if any) */
64
+ default?: string;
65
+ /** Whether column is primary key */
66
+ primaryKey?: boolean;
67
+ /** Foreign key reference if applicable */
68
+ foreignKey?: {
69
+ table: string;
70
+ column: string;
71
+ };
72
+ /** Whether column is auto-incremented */
73
+ autoIncrement?: boolean;
74
+ /** Column comment/description */
75
+ comment?: string | null;
76
+ /** Enum values if column is ENUM type */
77
+ enumValues?: string[];
78
+ /** MongoDB only: 0..1 fraction of sampled docs that contained this dot-path. Undefined for SQL. */
79
+ presence?: number;
80
+ /** MongoDB only: true when this dot-path matches a blacklist pattern. Undefined for SQL. */
81
+ redacted?: boolean;
82
+ }
83
+ /**
84
+ * Complete schema information for a table
85
+ */
86
+ export interface TableSchema {
87
+ /** Table name */
88
+ name: string;
89
+ /** Array of columns in the table */
90
+ columns: ColumnSchema[];
91
+ /** Approximate row count (if available) */
92
+ rowCount?: number;
93
+ /** Storage engine (PostgreSQL/MySQL) */
94
+ engine?: string;
95
+ /** Primary key column names */
96
+ primaryKey?: string[];
97
+ /** Foreign key constraints with metadata */
98
+ foreignKeys?: Array<{
99
+ name: string;
100
+ columns: string[];
101
+ refTable: string;
102
+ refColumns: string[];
103
+ }>;
104
+ /** Table indexes with column information */
105
+ indexes?: Array<{
106
+ name: string;
107
+ columns: string[];
108
+ unique: boolean;
109
+ }>;
110
+ /** Column count (used by listTables when full column details are not loaded) */
111
+ columnCount?: number;
112
+ /** Estimated row count in table */
113
+ estimatedRowCount?: number;
114
+ /** Type of table (table or view) */
115
+ tableType?: "table" | "view";
116
+ }
117
+ /**
118
+ * Connection error with categorized error code and troubleshooting hints
119
+ */
120
+ export declare class ConnectionError extends Error {
121
+ /** Error category code */
122
+ code: "ECONNREFUSED" | "ETIMEDOUT" | "AUTH_FAILED" | "ENOTFOUND" | "SQL_SYNTAX_ERROR" | "TABLE_NOT_FOUND" | "COLUMN_NOT_FOUND" | "UNKNOWN";
123
+ /** Array of actionable troubleshooting hints */
124
+ hints: string[];
125
+ constructor(
126
+ /** Error category code */
127
+ code: "ECONNREFUSED" | "ETIMEDOUT" | "AUTH_FAILED" | "ENOTFOUND" | "SQL_SYNTAX_ERROR" | "TABLE_NOT_FOUND" | "COLUMN_NOT_FOUND" | "UNKNOWN",
128
+ /** User-friendly error message */
129
+ message: string,
130
+ /** Array of actionable troubleshooting hints */
131
+ hints: string[]);
132
+ }
133
+ /**
134
+ * Result of a database query or command execution
135
+ */
136
+ export interface ExecutionResult<T> {
137
+ /** Array of result rows as objects (for SELECT queries) */
138
+ rows: T[];
139
+ /** Number of rows affected by the operation (for INSERT/UPDATE/DELETE) */
140
+ affectedRows: number;
141
+ /** Last inserted ID if applicable (for INSERT operations) */
142
+ lastInsertId?: number | string;
143
+ /** Convenience row count — used by formatters; mirrors rows.length on read paths */
144
+ rowCount?: number;
145
+ /** Column ordering for the rows, used by formatters that render tabular output */
146
+ columnNames?: string[];
147
+ /** Optional warnings — emitted today only by RedisAdapter (size guard / blacklist filter). */
148
+ warnings?: RedisWarning[];
149
+ }
150
+ type RedisWarning = {
151
+ code: "REDIS_SIZE_REWRITE";
152
+ command: string;
153
+ original: string[];
154
+ rewritten: string[];
155
+ } | {
156
+ code: "REDIS_SIZE_TRUNCATE";
157
+ command: string;
158
+ kept: number;
159
+ droppedAtLeast: number;
160
+ } | {
161
+ code: "REDIS_BLACKLIST_FILTERED";
162
+ count: number;
163
+ };
164
+ /**
165
+ * Database adapter interface - contract for all database implementations
166
+ * Defines methods that all database adapters must implement
167
+ */
168
+ export interface DatabaseAdapter {
169
+ /**
170
+ * Establish connection and verify credentials
171
+ * Throws ConnectionError with categorized error type on failure
172
+ * @throws {ConnectionError} If connection fails (server down, auth failed, timeout, etc.)
173
+ */
174
+ connect(): Promise<void>;
175
+ /**
176
+ * Close connection and release resources
177
+ * Should never throw; safe to call multiple times
178
+ * Handles cleanup gracefully even if already disconnected
179
+ */
180
+ disconnect(): Promise<void>;
181
+ /**
182
+ * Execute arbitrary SQL query with parameterized values
183
+ * Prevents SQL injection by using parameter binding
184
+ * @param sql Query string with parameter placeholders ($1, $2, etc. for PostgreSQL or ? for MySQL)
185
+ * @param params Array of parameter values in order
186
+ * @returns Execution result containing rows and metadata
187
+ * @throws {ConnectionError} If query execution fails
188
+ */
189
+ execute<T>(sql: string, params?: (string | number | boolean | null)[], options?: {
190
+ noLimit?: boolean;
191
+ }): Promise<ExecutionResult<T>>;
192
+ /**
193
+ * List all tables in the connected database
194
+ * Includes metadata such as row count and storage engine
195
+ * @returns Array of table schemas with basic information
196
+ * @throws {ConnectionError} If query fails
197
+ */
198
+ listTables(): Promise<TableSchema[]>;
199
+ /**
200
+ * Fetch complete schema for a single table
201
+ * Includes all columns with types and constraints
202
+ * @param tableName Name of table to inspect
203
+ * @param options Optional adapter-specific knobs (e.g. mongo `sampleSize`); SQL adapters ignore them.
204
+ * @returns Complete table schema including all column details
205
+ * @throws {ConnectionError} If query fails
206
+ */
207
+ getTableSchema(tableName: string, options?: {
208
+ sampleSize?: number;
209
+ sampleMethod?: "random" | "natural";
210
+ }): Promise<TableSchema>;
211
+ /**
212
+ * Test connection with lightweight probe query
213
+ * Executes SELECT 1 or equivalent to verify connection is alive
214
+ * @returns true if connection successful
215
+ * @throws {ConnectionError} If connection test fails
216
+ */
217
+ testConnection(): Promise<boolean>;
218
+ /**
219
+ * Get the database server version string
220
+ * @returns Raw version string from the server (e.g. "8.0.35", "15.4", "10.11.6-MariaDB")
221
+ * @throws {ConnectionError} If not connected or query fails
222
+ */
223
+ getServerVersion(): Promise<string>;
224
+ }
225
+ interface QueryableAdapter {
226
+ /**
227
+ * Establish connection and verify credentials
228
+ * Throws ConnectionError with categorized error type on failure
229
+ * @throws {ConnectionError} If connection fails (server down, auth failed, timeout, etc.)
230
+ */
231
+ connect(): Promise<void>;
232
+ /**
233
+ * Close connection and release resources
234
+ * Should never throw; safe to call multiple times
235
+ * Handles cleanup gracefully even if already disconnected
236
+ */
237
+ disconnect(): Promise<void>;
238
+ /**
239
+ * Execute arbitrary query with parameterized values
240
+ * Accepts JSON query strings for MongoDB operations
241
+ * @param query Query string (JSON format for MongoDB)
242
+ * @param params Array of parameter values in order
243
+ * @param options Optional execution controls (e.g. result-cardinality limit)
244
+ * @returns Execution result containing rows and metadata
245
+ * @throws {ConnectionError} If query execution fails
246
+ */
247
+ execute<T>(query: string, params?: unknown[], options?: {
248
+ limit?: number;
249
+ noLimit?: boolean;
250
+ }): Promise<ExecutionResult<T>>;
251
+ /**
252
+ * List all collections in the connected database
253
+ * Includes metadata such as document count
254
+ * @param options Optional filter for system indices
255
+ * @returns Array of collection info with basic information
256
+ * @throws {ConnectionError} If query fails
257
+ */
258
+ listCollections(options?: {
259
+ includeSystem?: boolean;
260
+ }): Promise<{
261
+ name: string;
262
+ documentCount?: number;
263
+ }[]>;
264
+ /**
265
+ * SQL-compatible collection listing for shared command surfaces.
266
+ * @param options Optional filter for system indices
267
+ */
268
+ listTables?(options?: {
269
+ includeSystem?: boolean;
270
+ }): Promise<TableSchema[]>;
271
+ /**
272
+ * SQL-compatible schema lookup for shared command surfaces.
273
+ * @param tableName Name of collection/table to inspect
274
+ * @param options Optional adapter-specific knobs (e.g. mongo `sampleSize`).
275
+ */
276
+ getTableSchema?(tableName: string, options?: {
277
+ sampleSize?: number;
278
+ sampleMethod?: "random" | "natural";
279
+ }): Promise<TableSchema>;
280
+ /**
281
+ * Test connection with lightweight probe query
282
+ * Executes a ping or equivalent to verify connection is alive
283
+ * @returns true if connection successful
284
+ * @throws {ConnectionError} If connection test fails
285
+ */
286
+ testConnection(): Promise<boolean>;
287
+ /**
288
+ * Get the database server version string
289
+ * @returns Raw version string from the server
290
+ * @throws {ConnectionError} If not connected or query fails
291
+ */
292
+ getServerVersion(): Promise<string>;
293
+ /**
294
+ * Insert a single document/row
295
+ * @param collection Collection or table name
296
+ * @param data Data object to insert
297
+ * @returns Execution result
298
+ */
299
+ insert(collection: string, data: Record<string, unknown>): Promise<ExecutionResult<unknown>>;
300
+ /**
301
+ * Update documents/rows matching filter
302
+ * @param collection Collection or table name
303
+ * @param filter Filter object
304
+ * @param update Update operations (e.g. {$set: ...})
305
+ * @returns Execution result
306
+ */
307
+ update(collection: string, filter: Record<string, unknown>, update: Record<string, unknown>): Promise<ExecutionResult<unknown>>;
308
+ /**
309
+ * Delete documents/rows matching filter
310
+ * @param collection Collection or table name
311
+ * @param filter Filter object
312
+ * @returns Execution result
313
+ */
314
+ delete(collection: string, filter: Record<string, unknown>): Promise<ExecutionResult<unknown>>;
315
+ }
316
+ interface BlacklistConfig {
317
+ /** Table names to block all operations on */
318
+ tables: string[];
319
+ /** Column names to omit per table: { tableName: [col1, col2] } */
320
+ columns: Record<string, string[]>;
321
+ }
322
+ interface RedisMaskRule {
323
+ /** Redis-native glob (e.g. "user:*"). */
324
+ keyPattern: string;
325
+ /** Hash field names to mask. Absent/empty → mask the whole value. */
326
+ fields?: string[];
327
+ }
328
+ interface BlacklistState {
329
+ /** Set of lowercase table names for O(1) case-insensitive lookup */
330
+ tables: Set<string>;
331
+ /** Map of table name -> Set of blacklisted column names */
332
+ columns: Map<string, Set<string>>;
333
+ }
334
+ /**
335
+ * Error thrown when an operation is blocked by blacklist rules
336
+ */
337
+ export declare class BlacklistError extends Error {
338
+ readonly tableName: string;
339
+ readonly operation: string;
340
+ constructor(message: string, tableName: string, operation: string);
341
+ }
342
+ /**
343
+ * Factory for creating database adapters
344
+ * Implements factory pattern to route to correct adapter based on system type
345
+ * Enables system-aware instantiation without coupling CLI commands to specific drivers
346
+ */
347
+ export declare class AdapterFactory {
348
+ static createSqlAdapter(options: SqlConnectionOptions): DatabaseAdapter;
349
+ static createQueryableAdapter(options: QueryableConnectionOptions): QueryableAdapter;
350
+ static createAdapter(options: SqlConnectionOptions): DatabaseAdapter;
351
+ static createAdapter(options: QueryableConnectionOptions): QueryableAdapter;
352
+ static createAdapter(options: ConnectionOptions): DatabaseAdapter | QueryableAdapter;
353
+ static createMongoDBAdapter(options: ConnectionOptions): QueryableAdapter;
354
+ static createRedisAdapter(options: ConnectionOptions, blacklistRules?: string[], maskRules?: RedisMaskRule[]): QueryableAdapter;
355
+ static createElasticsearchAdapter(options: ConnectionOptions): QueryableAdapter;
356
+ }
357
+ interface SqlConnectionConfig {
358
+ system: "postgresql" | "mysql" | "mariadb";
359
+ host: string | {
360
+ $env: string;
361
+ };
362
+ port: number | {
363
+ $env: string;
364
+ };
365
+ user: string | {
366
+ $env: string;
367
+ };
368
+ password: string | {
369
+ $env: string;
370
+ };
371
+ database: string | {
372
+ $env: string;
373
+ };
374
+ }
375
+ interface MongoDBConnectionConfig {
376
+ system: "mongodb";
377
+ uri?: string | {
378
+ $env: string;
379
+ };
380
+ host: string | {
381
+ $env: string;
382
+ };
383
+ port: number | {
384
+ $env: string;
385
+ };
386
+ user: string | {
387
+ $env: string;
388
+ };
389
+ password: string | {
390
+ $env: string;
391
+ };
392
+ database: string | {
393
+ $env: string;
394
+ };
395
+ }
396
+ interface RedisConnectionConfig {
397
+ system: "redis";
398
+ host: string | {
399
+ $env: string;
400
+ };
401
+ port: number | {
402
+ $env: string;
403
+ };
404
+ user: string | {
405
+ $env: string;
406
+ };
407
+ password: string | {
408
+ $env: string;
409
+ };
410
+ /** Redis logical DB index, kept as string for env-binding parity */
411
+ database: string | {
412
+ $env: string;
413
+ };
414
+ }
415
+ interface ElasticsearchConnectionConfig {
416
+ system: "elasticsearch";
417
+ protocol?: "http" | "https";
418
+ host: string | {
419
+ $env: string;
420
+ };
421
+ port: number | {
422
+ $env: string;
423
+ };
424
+ user: string | {
425
+ $env: string;
426
+ };
427
+ password: string | {
428
+ $env: string;
429
+ };
430
+ database: string | {
431
+ $env: string;
432
+ };
433
+ nodes?: string[];
434
+ cloudId?: string | {
435
+ $env: string;
436
+ };
437
+ apiKey?: string | {
438
+ $env: string;
439
+ };
440
+ caPath?: string;
441
+ rejectUnauthorized?: boolean;
442
+ }
443
+ type ConnectionConfig = SqlConnectionConfig | MongoDBConnectionConfig | RedisConnectionConfig | ElasticsearchConnectionConfig;
444
+ /**
445
+ * Permission level (coarse-grained access control)
446
+ */
447
+ export type Permission = "query-only" | "read-write" | "data-admin" | "admin";
448
+ interface Metadata {
449
+ createdAt?: string;
450
+ version: string;
451
+ }
452
+ interface DbcliConfig {
453
+ connection: ConnectionConfig;
454
+ permission: Permission;
455
+ schema?: Record<string, unknown>;
456
+ metadata?: Metadata;
457
+ blacklist?: BlacklistConfig;
458
+ }
459
+ type SqlStatementType = "SELECT" | "INSERT" | "UPDATE" | "DELETE" | "UNKNOWN";
460
+ interface QueryMetadata {
461
+ /** SQL statement type (SELECT, INSERT, UPDATE, DELETE) */
462
+ statement: SqlStatementType;
463
+ /** Number of rows affected by INSERT/UPDATE/DELETE operations */
464
+ affectedRows?: number;
465
+ /** Query execution time in milliseconds */
466
+ executionTimeMs?: number;
467
+ /** Security notification when columns were omitted due to blacklist */
468
+ securityNotification?: string;
469
+ }
470
+ /**
471
+ * Generic query result wrapper with rows and metadata
472
+ * Used to wrap database query results with structured metadata for AI parsing
473
+ * @template T - Type of individual row objects
474
+ *
475
+ * Example: SELECT query result
476
+ * ```typescript
477
+ * const result: QueryResult<{id: number; name: string}> = {
478
+ * rows: [{id: 1, name: 'Alice'}],
479
+ * rowCount: 1,
480
+ * columnNames: ['id', 'name'],
481
+ * columnTypes: ['integer', 'varchar'],
482
+ * executionTimeMs: 42,
483
+ * metadata: { statement: 'SELECT' }
484
+ * }
485
+ * ```
486
+ */
487
+ export interface QueryResult<T> {
488
+ /** Array of result rows */
489
+ rows: T[];
490
+ /** Total number of rows in result set */
491
+ rowCount: number;
492
+ /** Column names in order (matches Object.keys(rows[0]) for consistent ordering) */
493
+ columnNames: string[];
494
+ /** Optional: column data types (PostgreSQL: "integer", "varchar"; MySQL: "INT", "VARCHAR") */
495
+ columnTypes?: string[];
496
+ /** Optional: query execution time in milliseconds (only database execution, not formatting) */
497
+ executionTimeMs?: number;
498
+ /** Optional: metadata about query type and affected rows */
499
+ metadata?: QueryMetadata;
500
+ }
501
+ /**
502
+ * Manager class for loading and querying blacklist rules.
503
+ * Instantiate once per CLI invocation.
504
+ */
505
+ export declare class BlacklistManager {
506
+ private config;
507
+ private state;
508
+ private overrideEnabled;
509
+ constructor(config: DbcliConfig, overrideEnvValue?: string);
510
+ /**
511
+ * Deserialize config.blacklist JSON into efficient Set/Map structures.
512
+ * Case-insensitive table names (stored as lowercase).
513
+ * Case-sensitive column names.
514
+ *
515
+ * @returns BlacklistState with Set<string> for tables, Map<string, Set<string>> for columns
516
+ */
517
+ loadBlacklist(): BlacklistState;
518
+ /**
519
+ * Check if a table is blacklisted.
520
+ * Case-insensitive comparison.
521
+ *
522
+ * @param tableName Table name to check
523
+ * @returns true if the table is blacklisted
524
+ */
525
+ isTableBlacklisted(tableName: string): boolean;
526
+ /**
527
+ * Check if a specific column in a table is blacklisted.
528
+ * Table name is case-insensitive; column name is case-sensitive.
529
+ *
530
+ * @param tableName Table name
531
+ * @param columnName Column name
532
+ * @returns true if the column is blacklisted
533
+ */
534
+ isColumnBlacklisted(tableName: string, columnName: string): boolean;
535
+ /**
536
+ * Get all blacklisted column names for a specific table.
537
+ *
538
+ * @param tableName Table name
539
+ * @returns Array of blacklisted column names, or empty array if none
540
+ */
541
+ getBlacklistedColumns(tableName: string): string[];
542
+ /**
543
+ * Check if the blacklist override is enabled via environment variable.
544
+ * When true, all blacklist checks are bypassed.
545
+ *
546
+ * @returns true if DBCLI_OVERRIDE_BLACKLIST=true
547
+ */
548
+ canOverrideBlacklist(): boolean;
549
+ /**
550
+ * Get current blacklist state (for diagnostic purposes).
551
+ */
552
+ getState(): BlacklistState;
553
+ }
554
+ interface FilterColumnsResult {
555
+ filteredRows: Record<string, unknown>[];
556
+ omittedColumns: string[];
557
+ }
558
+ /**
559
+ * Validator class for enforcing blacklist rules.
560
+ * Instantiate once per CLI invocation with a BlacklistManager.
561
+ */
562
+ export declare class BlacklistValidator {
563
+ private manager;
564
+ constructor(manager: BlacklistManager);
565
+ /**
566
+ * Check if an operation on a table is allowed.
567
+ * Throws BlacklistError if the table is blacklisted and override is not active.
568
+ *
569
+ * @param operation SQL operation type: SELECT, INSERT, UPDATE, DELETE
570
+ * @param tableName Table name to check
571
+ * @param _tableList Unused (reserved for future multi-table validation)
572
+ * @throws BlacklistError if table is blacklisted
573
+ */
574
+ checkTableBlacklist(operation: string, tableName: string, _tableList?: string[]): void;
575
+ /**
576
+ * Reject a write that touches blacklisted columns.
577
+ * Computes the intersection of `fields` with the table's column blacklist
578
+ * and throws BlacklistError when non-empty. When override is enabled,
579
+ * emits a console warning and returns without throwing.
580
+ *
581
+ * @param tableName Table or collection name
582
+ * @param fields Top-level field/column names being written
583
+ * @param operation SQL operation type (defaults to 'WRITE')
584
+ * @throws BlacklistError when any field is blacklisted and override is off
585
+ */
586
+ checkColumnBlacklistOnWrite(tableName: string, fields: string[], operation?: string): void;
587
+ /**
588
+ * Filter blacklisted columns from query result rows.
589
+ * Returns new row objects without blacklisted columns (immutable).
590
+ *
591
+ * @param tableName Table name to look up column blacklist
592
+ * @param rows Query result rows
593
+ * @param columnList Column names in result set
594
+ * @returns Filtered rows and list of omitted column names
595
+ */
596
+ filterColumns(tableName: string, rows: Record<string, unknown>[], columnList: string[]): FilterColumnsResult;
597
+ /**
598
+ * Build a security notification message for omitted columns.
599
+ *
600
+ * @param _tableName Table name (reserved for future per-table messages)
601
+ * @param omittedColumns List of column names that were omitted
602
+ * @returns Security notification string, or empty string if no columns omitted
603
+ */
604
+ buildSecurityNotification(_tableName: string, omittedColumns: string[]): string;
605
+ }
606
+ declare const DbcliConfigSchema: z.ZodObject<{
607
+ connection: z.ZodUnion<[
608
+ z.ZodObject<{
609
+ system: z.ZodEnum<[
610
+ "postgresql",
611
+ "mysql",
612
+ "mariadb"
613
+ ]>;
614
+ host: z.ZodUnion<[
615
+ z.ZodString,
616
+ z.ZodObject<{
617
+ $env: z.ZodString;
618
+ }, "strict", z.ZodTypeAny, {
619
+ $env: string;
620
+ }, {
621
+ $env: string;
622
+ }>
623
+ ]>;
624
+ port: z.ZodUnion<[
625
+ z.ZodNumber,
626
+ z.ZodObject<{
627
+ $env: z.ZodString;
628
+ }, "strict", z.ZodTypeAny, {
629
+ $env: string;
630
+ }, {
631
+ $env: string;
632
+ }>
633
+ ]>;
634
+ user: z.ZodUnion<[
635
+ z.ZodString,
636
+ z.ZodObject<{
637
+ $env: z.ZodString;
638
+ }, "strict", z.ZodTypeAny, {
639
+ $env: string;
640
+ }, {
641
+ $env: string;
642
+ }>
643
+ ]>;
644
+ password: z.ZodDefault<z.ZodUnion<[
645
+ z.ZodString,
646
+ z.ZodObject<{
647
+ $env: z.ZodString;
648
+ }, "strict", z.ZodTypeAny, {
649
+ $env: string;
650
+ }, {
651
+ $env: string;
652
+ }>
653
+ ]>>;
654
+ database: z.ZodUnion<[
655
+ z.ZodString,
656
+ z.ZodObject<{
657
+ $env: z.ZodString;
658
+ }, "strict", z.ZodTypeAny, {
659
+ $env: string;
660
+ }, {
661
+ $env: string;
662
+ }>
663
+ ]>;
664
+ }, "strip", z.ZodTypeAny, {
665
+ password: string | {
666
+ $env: string;
667
+ };
668
+ user: string | {
669
+ $env: string;
670
+ };
671
+ system: "postgresql" | "mysql" | "mariadb";
672
+ host: string | {
673
+ $env: string;
674
+ };
675
+ port: number | {
676
+ $env: string;
677
+ };
678
+ database: string | {
679
+ $env: string;
680
+ };
681
+ }, {
682
+ user: string | {
683
+ $env: string;
684
+ };
685
+ system: "postgresql" | "mysql" | "mariadb";
686
+ host: string | {
687
+ $env: string;
688
+ };
689
+ port: number | {
690
+ $env: string;
691
+ };
692
+ database: string | {
693
+ $env: string;
694
+ };
695
+ password?: string | {
696
+ $env: string;
697
+ } | undefined;
698
+ }>,
699
+ z.ZodObject<{
700
+ system: z.ZodLiteral<"mongodb">;
701
+ uri: z.ZodOptional<z.ZodUnion<[
702
+ z.ZodString,
703
+ z.ZodObject<{
704
+ $env: z.ZodString;
705
+ }, "strict", z.ZodTypeAny, {
706
+ $env: string;
707
+ }, {
708
+ $env: string;
709
+ }>
710
+ ]>>;
711
+ host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
712
+ z.ZodString,
713
+ z.ZodObject<{
714
+ $env: z.ZodString;
715
+ }, "strict", z.ZodTypeAny, {
716
+ $env: string;
717
+ }, {
718
+ $env: string;
719
+ }>
720
+ ]>>>;
721
+ port: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
722
+ z.ZodNumber,
723
+ z.ZodObject<{
724
+ $env: z.ZodString;
725
+ }, "strict", z.ZodTypeAny, {
726
+ $env: string;
727
+ }, {
728
+ $env: string;
729
+ }>
730
+ ]>>>;
731
+ user: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
732
+ z.ZodString,
733
+ z.ZodObject<{
734
+ $env: z.ZodString;
735
+ }, "strict", z.ZodTypeAny, {
736
+ $env: string;
737
+ }, {
738
+ $env: string;
739
+ }>
740
+ ]>>>;
741
+ password: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
742
+ z.ZodString,
743
+ z.ZodObject<{
744
+ $env: z.ZodString;
745
+ }, "strict", z.ZodTypeAny, {
746
+ $env: string;
747
+ }, {
748
+ $env: string;
749
+ }>
750
+ ]>>>;
751
+ database: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
752
+ z.ZodString,
753
+ z.ZodObject<{
754
+ $env: z.ZodString;
755
+ }, "strict", z.ZodTypeAny, {
756
+ $env: string;
757
+ }, {
758
+ $env: string;
759
+ }>
760
+ ]>>>;
761
+ }, "strip", z.ZodTypeAny, {
762
+ password: string | {
763
+ $env: string;
764
+ };
765
+ user: string | {
766
+ $env: string;
767
+ };
768
+ system: "mongodb";
769
+ host: string | {
770
+ $env: string;
771
+ };
772
+ port: number | {
773
+ $env: string;
774
+ };
775
+ database: string | {
776
+ $env: string;
777
+ };
778
+ uri?: string | {
779
+ $env: string;
780
+ } | undefined;
781
+ }, {
782
+ system: "mongodb";
783
+ password?: string | {
784
+ $env: string;
785
+ } | undefined;
786
+ user?: string | {
787
+ $env: string;
788
+ } | undefined;
789
+ host?: string | {
790
+ $env: string;
791
+ } | undefined;
792
+ port?: number | {
793
+ $env: string;
794
+ } | undefined;
795
+ database?: string | {
796
+ $env: string;
797
+ } | undefined;
798
+ uri?: string | {
799
+ $env: string;
800
+ } | undefined;
801
+ }>,
802
+ z.ZodObject<{
803
+ system: z.ZodLiteral<"redis">;
804
+ host: z.ZodUnion<[
805
+ z.ZodString,
806
+ z.ZodObject<{
807
+ $env: z.ZodString;
808
+ }, "strict", z.ZodTypeAny, {
809
+ $env: string;
810
+ }, {
811
+ $env: string;
812
+ }>
813
+ ]>;
814
+ port: z.ZodUnion<[
815
+ z.ZodNumber,
816
+ z.ZodObject<{
817
+ $env: z.ZodString;
818
+ }, "strict", z.ZodTypeAny, {
819
+ $env: string;
820
+ }, {
821
+ $env: string;
822
+ }>
823
+ ]>;
824
+ user: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
825
+ z.ZodString,
826
+ z.ZodObject<{
827
+ $env: z.ZodString;
828
+ }, "strict", z.ZodTypeAny, {
829
+ $env: string;
830
+ }, {
831
+ $env: string;
832
+ }>
833
+ ]>>>;
834
+ password: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
835
+ z.ZodString,
836
+ z.ZodObject<{
837
+ $env: z.ZodString;
838
+ }, "strict", z.ZodTypeAny, {
839
+ $env: string;
840
+ }, {
841
+ $env: string;
842
+ }>
843
+ ]>>>;
844
+ database: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
845
+ z.ZodString,
846
+ z.ZodObject<{
847
+ $env: z.ZodString;
848
+ }, "strict", z.ZodTypeAny, {
849
+ $env: string;
850
+ }, {
851
+ $env: string;
852
+ }>
853
+ ]>>>;
854
+ }, "strip", z.ZodTypeAny, {
855
+ password: string | {
856
+ $env: string;
857
+ };
858
+ user: string | {
859
+ $env: string;
860
+ };
861
+ system: "redis";
862
+ host: string | {
863
+ $env: string;
864
+ };
865
+ port: number | {
866
+ $env: string;
867
+ };
868
+ database: string | {
869
+ $env: string;
870
+ };
871
+ }, {
872
+ system: "redis";
873
+ host: string | {
874
+ $env: string;
875
+ };
876
+ port: number | {
877
+ $env: string;
878
+ };
879
+ password?: string | {
880
+ $env: string;
881
+ } | undefined;
882
+ user?: string | {
883
+ $env: string;
884
+ } | undefined;
885
+ database?: string | {
886
+ $env: string;
887
+ } | undefined;
888
+ }>,
889
+ z.ZodObject<{
890
+ system: z.ZodLiteral<"elasticsearch">;
891
+ protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<[
892
+ "http",
893
+ "https"
894
+ ]>>>;
895
+ host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
896
+ z.ZodString,
897
+ z.ZodObject<{
898
+ $env: z.ZodString;
899
+ }, "strict", z.ZodTypeAny, {
900
+ $env: string;
901
+ }, {
902
+ $env: string;
903
+ }>
904
+ ]>>>;
905
+ port: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
906
+ z.ZodNumber,
907
+ z.ZodObject<{
908
+ $env: z.ZodString;
909
+ }, "strict", z.ZodTypeAny, {
910
+ $env: string;
911
+ }, {
912
+ $env: string;
913
+ }>
914
+ ]>>>;
915
+ user: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
916
+ z.ZodString,
917
+ z.ZodObject<{
918
+ $env: z.ZodString;
919
+ }, "strict", z.ZodTypeAny, {
920
+ $env: string;
921
+ }, {
922
+ $env: string;
923
+ }>
924
+ ]>>>;
925
+ password: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
926
+ z.ZodString,
927
+ z.ZodObject<{
928
+ $env: z.ZodString;
929
+ }, "strict", z.ZodTypeAny, {
930
+ $env: string;
931
+ }, {
932
+ $env: string;
933
+ }>
934
+ ]>>>;
935
+ database: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
936
+ z.ZodString,
937
+ z.ZodObject<{
938
+ $env: z.ZodString;
939
+ }, "strict", z.ZodTypeAny, {
940
+ $env: string;
941
+ }, {
942
+ $env: string;
943
+ }>
944
+ ]>>>;
945
+ nodes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
946
+ cloudId: z.ZodOptional<z.ZodUnion<[
947
+ z.ZodString,
948
+ z.ZodObject<{
949
+ $env: z.ZodString;
950
+ }, "strict", z.ZodTypeAny, {
951
+ $env: string;
952
+ }, {
953
+ $env: string;
954
+ }>
955
+ ]>>;
956
+ apiKey: z.ZodOptional<z.ZodUnion<[
957
+ z.ZodString,
958
+ z.ZodObject<{
959
+ $env: z.ZodString;
960
+ }, "strict", z.ZodTypeAny, {
961
+ $env: string;
962
+ }, {
963
+ $env: string;
964
+ }>
965
+ ]>>;
966
+ caPath: z.ZodOptional<z.ZodString>;
967
+ rejectUnauthorized: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
968
+ }, "strip", z.ZodTypeAny, {
969
+ password: string | {
970
+ $env: string;
971
+ };
972
+ user: string | {
973
+ $env: string;
974
+ };
975
+ system: "elasticsearch";
976
+ host: string | {
977
+ $env: string;
978
+ };
979
+ port: number | {
980
+ $env: string;
981
+ };
982
+ database: string | {
983
+ $env: string;
984
+ };
985
+ rejectUnauthorized: boolean;
986
+ protocol: "http" | "https";
987
+ nodes?: string[] | undefined;
988
+ cloudId?: string | {
989
+ $env: string;
990
+ } | undefined;
991
+ apiKey?: string | {
992
+ $env: string;
993
+ } | undefined;
994
+ caPath?: string | undefined;
995
+ }, {
996
+ system: "elasticsearch";
997
+ password?: string | {
998
+ $env: string;
999
+ } | undefined;
1000
+ user?: string | {
1001
+ $env: string;
1002
+ } | undefined;
1003
+ host?: string | {
1004
+ $env: string;
1005
+ } | undefined;
1006
+ port?: number | {
1007
+ $env: string;
1008
+ } | undefined;
1009
+ database?: string | {
1010
+ $env: string;
1011
+ } | undefined;
1012
+ rejectUnauthorized?: boolean | undefined;
1013
+ protocol?: "http" | "https" | undefined;
1014
+ nodes?: string[] | undefined;
1015
+ cloudId?: string | {
1016
+ $env: string;
1017
+ } | undefined;
1018
+ apiKey?: string | {
1019
+ $env: string;
1020
+ } | undefined;
1021
+ caPath?: string | undefined;
1022
+ }>
1023
+ ]>;
1024
+ permission: z.ZodDefault<z.ZodEnum<[
1025
+ "query-only",
1026
+ "read-write",
1027
+ "data-admin",
1028
+ "admin"
1029
+ ]>>;
1030
+ schema: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
1031
+ metadata: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1032
+ createdAt: z.ZodOptional<z.ZodString>;
1033
+ version: z.ZodDefault<z.ZodString>;
1034
+ schemaLastUpdated: z.ZodOptional<z.ZodString>;
1035
+ schemaTableCount: z.ZodOptional<z.ZodNumber>;
1036
+ }, "strip", z.ZodTypeAny, {
1037
+ version: string;
1038
+ createdAt?: string | undefined;
1039
+ schemaLastUpdated?: string | undefined;
1040
+ schemaTableCount?: number | undefined;
1041
+ }, {
1042
+ version?: string | undefined;
1043
+ createdAt?: string | undefined;
1044
+ schemaLastUpdated?: string | undefined;
1045
+ schemaTableCount?: number | undefined;
1046
+ }>>>;
1047
+ blacklist: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1048
+ tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1049
+ columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
1050
+ }, "strip", z.ZodTypeAny, {
1051
+ columns: Record<string, string[]>;
1052
+ tables: string[];
1053
+ }, {
1054
+ columns?: Record<string, string[]> | undefined;
1055
+ tables?: string[] | undefined;
1056
+ }>>>;
1057
+ audit: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1058
+ enabled: z.ZodDefault<z.ZodBoolean>;
1059
+ rotation: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1060
+ max_bytes: z.ZodDefault<z.ZodNumber>;
1061
+ max_entries: z.ZodDefault<z.ZodNumber>;
1062
+ }, "strip", z.ZodTypeAny, {
1063
+ max_bytes: number;
1064
+ max_entries: number;
1065
+ }, {
1066
+ max_bytes?: number | undefined;
1067
+ max_entries?: number | undefined;
1068
+ }>>>;
1069
+ }, "strip", z.ZodTypeAny, {
1070
+ enabled: boolean;
1071
+ rotation: {
1072
+ max_bytes: number;
1073
+ max_entries: number;
1074
+ };
1075
+ }, {
1076
+ enabled?: boolean | undefined;
1077
+ rotation?: {
1078
+ max_bytes?: number | undefined;
1079
+ max_entries?: number | undefined;
1080
+ } | undefined;
1081
+ }>>>;
1082
+ redis: z.ZodOptional<z.ZodObject<{
1083
+ mask: z.ZodDefault<z.ZodArray<z.ZodObject<{
1084
+ keyPattern: z.ZodString;
1085
+ fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1086
+ }, "strip", z.ZodTypeAny, {
1087
+ keyPattern: string;
1088
+ fields?: string[] | undefined;
1089
+ }, {
1090
+ keyPattern: string;
1091
+ fields?: string[] | undefined;
1092
+ }>, "many">>;
1093
+ }, "strip", z.ZodTypeAny, {
1094
+ mask: {
1095
+ keyPattern: string;
1096
+ fields?: string[] | undefined;
1097
+ }[];
1098
+ }, {
1099
+ mask?: {
1100
+ keyPattern: string;
1101
+ fields?: string[] | undefined;
1102
+ }[] | undefined;
1103
+ }>>;
1104
+ }, "strip", z.ZodTypeAny, {
1105
+ schema: Record<string, any>;
1106
+ blacklist: {
1107
+ columns: Record<string, string[]>;
1108
+ tables: string[];
1109
+ };
1110
+ audit: {
1111
+ enabled: boolean;
1112
+ rotation: {
1113
+ max_bytes: number;
1114
+ max_entries: number;
1115
+ };
1116
+ };
1117
+ metadata: {
1118
+ version: string;
1119
+ createdAt?: string | undefined;
1120
+ schemaLastUpdated?: string | undefined;
1121
+ schemaTableCount?: number | undefined;
1122
+ };
1123
+ connection: {
1124
+ password: string | {
1125
+ $env: string;
1126
+ };
1127
+ user: string | {
1128
+ $env: string;
1129
+ };
1130
+ system: "mongodb";
1131
+ host: string | {
1132
+ $env: string;
1133
+ };
1134
+ port: number | {
1135
+ $env: string;
1136
+ };
1137
+ database: string | {
1138
+ $env: string;
1139
+ };
1140
+ uri?: string | {
1141
+ $env: string;
1142
+ } | undefined;
1143
+ } | {
1144
+ password: string | {
1145
+ $env: string;
1146
+ };
1147
+ user: string | {
1148
+ $env: string;
1149
+ };
1150
+ system: "postgresql" | "mysql" | "mariadb";
1151
+ host: string | {
1152
+ $env: string;
1153
+ };
1154
+ port: number | {
1155
+ $env: string;
1156
+ };
1157
+ database: string | {
1158
+ $env: string;
1159
+ };
1160
+ } | {
1161
+ password: string | {
1162
+ $env: string;
1163
+ };
1164
+ user: string | {
1165
+ $env: string;
1166
+ };
1167
+ system: "redis";
1168
+ host: string | {
1169
+ $env: string;
1170
+ };
1171
+ port: number | {
1172
+ $env: string;
1173
+ };
1174
+ database: string | {
1175
+ $env: string;
1176
+ };
1177
+ } | {
1178
+ password: string | {
1179
+ $env: string;
1180
+ };
1181
+ user: string | {
1182
+ $env: string;
1183
+ };
1184
+ system: "elasticsearch";
1185
+ host: string | {
1186
+ $env: string;
1187
+ };
1188
+ port: number | {
1189
+ $env: string;
1190
+ };
1191
+ database: string | {
1192
+ $env: string;
1193
+ };
1194
+ rejectUnauthorized: boolean;
1195
+ protocol: "http" | "https";
1196
+ nodes?: string[] | undefined;
1197
+ cloudId?: string | {
1198
+ $env: string;
1199
+ } | undefined;
1200
+ apiKey?: string | {
1201
+ $env: string;
1202
+ } | undefined;
1203
+ caPath?: string | undefined;
1204
+ };
1205
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1206
+ redis?: {
1207
+ mask: {
1208
+ keyPattern: string;
1209
+ fields?: string[] | undefined;
1210
+ }[];
1211
+ } | undefined;
1212
+ }, {
1213
+ connection: {
1214
+ system: "mongodb";
1215
+ password?: string | {
1216
+ $env: string;
1217
+ } | undefined;
1218
+ user?: string | {
1219
+ $env: string;
1220
+ } | undefined;
1221
+ host?: string | {
1222
+ $env: string;
1223
+ } | undefined;
1224
+ port?: number | {
1225
+ $env: string;
1226
+ } | undefined;
1227
+ database?: string | {
1228
+ $env: string;
1229
+ } | undefined;
1230
+ uri?: string | {
1231
+ $env: string;
1232
+ } | undefined;
1233
+ } | {
1234
+ user: string | {
1235
+ $env: string;
1236
+ };
1237
+ system: "postgresql" | "mysql" | "mariadb";
1238
+ host: string | {
1239
+ $env: string;
1240
+ };
1241
+ port: number | {
1242
+ $env: string;
1243
+ };
1244
+ database: string | {
1245
+ $env: string;
1246
+ };
1247
+ password?: string | {
1248
+ $env: string;
1249
+ } | undefined;
1250
+ } | {
1251
+ system: "redis";
1252
+ host: string | {
1253
+ $env: string;
1254
+ };
1255
+ port: number | {
1256
+ $env: string;
1257
+ };
1258
+ password?: string | {
1259
+ $env: string;
1260
+ } | undefined;
1261
+ user?: string | {
1262
+ $env: string;
1263
+ } | undefined;
1264
+ database?: string | {
1265
+ $env: string;
1266
+ } | undefined;
1267
+ } | {
1268
+ system: "elasticsearch";
1269
+ password?: string | {
1270
+ $env: string;
1271
+ } | undefined;
1272
+ user?: string | {
1273
+ $env: string;
1274
+ } | undefined;
1275
+ host?: string | {
1276
+ $env: string;
1277
+ } | undefined;
1278
+ port?: number | {
1279
+ $env: string;
1280
+ } | undefined;
1281
+ database?: string | {
1282
+ $env: string;
1283
+ } | undefined;
1284
+ rejectUnauthorized?: boolean | undefined;
1285
+ protocol?: "http" | "https" | undefined;
1286
+ nodes?: string[] | undefined;
1287
+ cloudId?: string | {
1288
+ $env: string;
1289
+ } | undefined;
1290
+ apiKey?: string | {
1291
+ $env: string;
1292
+ } | undefined;
1293
+ caPath?: string | undefined;
1294
+ };
1295
+ redis?: {
1296
+ mask?: {
1297
+ keyPattern: string;
1298
+ fields?: string[] | undefined;
1299
+ }[] | undefined;
1300
+ } | undefined;
1301
+ schema?: Record<string, any> | undefined;
1302
+ blacklist?: {
1303
+ columns?: Record<string, string[]> | undefined;
1304
+ tables?: string[] | undefined;
1305
+ } | undefined;
1306
+ audit?: {
1307
+ enabled?: boolean | undefined;
1308
+ rotation?: {
1309
+ max_bytes?: number | undefined;
1310
+ max_entries?: number | undefined;
1311
+ } | undefined;
1312
+ } | undefined;
1313
+ metadata?: {
1314
+ version?: string | undefined;
1315
+ createdAt?: string | undefined;
1316
+ schemaLastUpdated?: string | undefined;
1317
+ schemaTableCount?: number | undefined;
1318
+ } | undefined;
1319
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1320
+ }>;
1321
+ /**
1322
+ * Types inferred from Zod schemas
1323
+ */
1324
+ type DbcliConfig$1 = z.infer<typeof DbcliConfigSchema>;
1325
+ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1326
+ version: z.ZodLiteral<2>;
1327
+ default: z.ZodString;
1328
+ connections: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[
1329
+ z.ZodObject<{
1330
+ system: z.ZodEnum<[
1331
+ "postgresql",
1332
+ "mysql",
1333
+ "mariadb"
1334
+ ]>;
1335
+ host: z.ZodUnion<[
1336
+ z.ZodString,
1337
+ z.ZodObject<{
1338
+ $env: z.ZodString;
1339
+ }, "strict", z.ZodTypeAny, {
1340
+ $env: string;
1341
+ }, {
1342
+ $env: string;
1343
+ }>
1344
+ ]>;
1345
+ port: z.ZodUnion<[
1346
+ z.ZodNumber,
1347
+ z.ZodObject<{
1348
+ $env: z.ZodString;
1349
+ }, "strict", z.ZodTypeAny, {
1350
+ $env: string;
1351
+ }, {
1352
+ $env: string;
1353
+ }>
1354
+ ]>;
1355
+ user: z.ZodUnion<[
1356
+ z.ZodString,
1357
+ z.ZodObject<{
1358
+ $env: z.ZodString;
1359
+ }, "strict", z.ZodTypeAny, {
1360
+ $env: string;
1361
+ }, {
1362
+ $env: string;
1363
+ }>
1364
+ ]>;
1365
+ password: z.ZodDefault<z.ZodUnion<[
1366
+ z.ZodString,
1367
+ z.ZodObject<{
1368
+ $env: z.ZodString;
1369
+ }, "strict", z.ZodTypeAny, {
1370
+ $env: string;
1371
+ }, {
1372
+ $env: string;
1373
+ }>
1374
+ ]>>;
1375
+ database: z.ZodUnion<[
1376
+ z.ZodString,
1377
+ z.ZodObject<{
1378
+ $env: z.ZodString;
1379
+ }, "strict", z.ZodTypeAny, {
1380
+ $env: string;
1381
+ }, {
1382
+ $env: string;
1383
+ }>
1384
+ ]>;
1385
+ } & {
1386
+ permission: z.ZodDefault<z.ZodEnum<[
1387
+ "query-only",
1388
+ "read-write",
1389
+ "data-admin",
1390
+ "admin"
1391
+ ]>>;
1392
+ envFile: z.ZodOptional<z.ZodString>;
1393
+ }, "strip", z.ZodTypeAny, {
1394
+ password: string | {
1395
+ $env: string;
1396
+ };
1397
+ user: string | {
1398
+ $env: string;
1399
+ };
1400
+ system: "postgresql" | "mysql" | "mariadb";
1401
+ host: string | {
1402
+ $env: string;
1403
+ };
1404
+ port: number | {
1405
+ $env: string;
1406
+ };
1407
+ database: string | {
1408
+ $env: string;
1409
+ };
1410
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1411
+ envFile?: string | undefined;
1412
+ }, {
1413
+ user: string | {
1414
+ $env: string;
1415
+ };
1416
+ system: "postgresql" | "mysql" | "mariadb";
1417
+ host: string | {
1418
+ $env: string;
1419
+ };
1420
+ port: number | {
1421
+ $env: string;
1422
+ };
1423
+ database: string | {
1424
+ $env: string;
1425
+ };
1426
+ password?: string | {
1427
+ $env: string;
1428
+ } | undefined;
1429
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1430
+ envFile?: string | undefined;
1431
+ }>,
1432
+ z.ZodObject<{
1433
+ system: z.ZodLiteral<"mongodb">;
1434
+ uri: z.ZodOptional<z.ZodUnion<[
1435
+ z.ZodString,
1436
+ z.ZodObject<{
1437
+ $env: z.ZodString;
1438
+ }, "strict", z.ZodTypeAny, {
1439
+ $env: string;
1440
+ }, {
1441
+ $env: string;
1442
+ }>
1443
+ ]>>;
1444
+ host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1445
+ z.ZodString,
1446
+ z.ZodObject<{
1447
+ $env: z.ZodString;
1448
+ }, "strict", z.ZodTypeAny, {
1449
+ $env: string;
1450
+ }, {
1451
+ $env: string;
1452
+ }>
1453
+ ]>>>;
1454
+ port: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1455
+ z.ZodNumber,
1456
+ z.ZodObject<{
1457
+ $env: z.ZodString;
1458
+ }, "strict", z.ZodTypeAny, {
1459
+ $env: string;
1460
+ }, {
1461
+ $env: string;
1462
+ }>
1463
+ ]>>>;
1464
+ user: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1465
+ z.ZodString,
1466
+ z.ZodObject<{
1467
+ $env: z.ZodString;
1468
+ }, "strict", z.ZodTypeAny, {
1469
+ $env: string;
1470
+ }, {
1471
+ $env: string;
1472
+ }>
1473
+ ]>>>;
1474
+ password: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1475
+ z.ZodString,
1476
+ z.ZodObject<{
1477
+ $env: z.ZodString;
1478
+ }, "strict", z.ZodTypeAny, {
1479
+ $env: string;
1480
+ }, {
1481
+ $env: string;
1482
+ }>
1483
+ ]>>>;
1484
+ database: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1485
+ z.ZodString,
1486
+ z.ZodObject<{
1487
+ $env: z.ZodString;
1488
+ }, "strict", z.ZodTypeAny, {
1489
+ $env: string;
1490
+ }, {
1491
+ $env: string;
1492
+ }>
1493
+ ]>>>;
1494
+ } & {
1495
+ permission: z.ZodDefault<z.ZodEnum<[
1496
+ "query-only",
1497
+ "read-write",
1498
+ "data-admin",
1499
+ "admin"
1500
+ ]>>;
1501
+ envFile: z.ZodOptional<z.ZodString>;
1502
+ }, "strip", z.ZodTypeAny, {
1503
+ password: string | {
1504
+ $env: string;
1505
+ };
1506
+ user: string | {
1507
+ $env: string;
1508
+ };
1509
+ system: "mongodb";
1510
+ host: string | {
1511
+ $env: string;
1512
+ };
1513
+ port: number | {
1514
+ $env: string;
1515
+ };
1516
+ database: string | {
1517
+ $env: string;
1518
+ };
1519
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1520
+ uri?: string | {
1521
+ $env: string;
1522
+ } | undefined;
1523
+ envFile?: string | undefined;
1524
+ }, {
1525
+ system: "mongodb";
1526
+ password?: string | {
1527
+ $env: string;
1528
+ } | undefined;
1529
+ user?: string | {
1530
+ $env: string;
1531
+ } | undefined;
1532
+ host?: string | {
1533
+ $env: string;
1534
+ } | undefined;
1535
+ port?: number | {
1536
+ $env: string;
1537
+ } | undefined;
1538
+ database?: string | {
1539
+ $env: string;
1540
+ } | undefined;
1541
+ uri?: string | {
1542
+ $env: string;
1543
+ } | undefined;
1544
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1545
+ envFile?: string | undefined;
1546
+ }>,
1547
+ z.ZodObject<{
1548
+ system: z.ZodLiteral<"redis">;
1549
+ host: z.ZodUnion<[
1550
+ z.ZodString,
1551
+ z.ZodObject<{
1552
+ $env: z.ZodString;
1553
+ }, "strict", z.ZodTypeAny, {
1554
+ $env: string;
1555
+ }, {
1556
+ $env: string;
1557
+ }>
1558
+ ]>;
1559
+ port: z.ZodUnion<[
1560
+ z.ZodNumber,
1561
+ z.ZodObject<{
1562
+ $env: z.ZodString;
1563
+ }, "strict", z.ZodTypeAny, {
1564
+ $env: string;
1565
+ }, {
1566
+ $env: string;
1567
+ }>
1568
+ ]>;
1569
+ user: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1570
+ z.ZodString,
1571
+ z.ZodObject<{
1572
+ $env: z.ZodString;
1573
+ }, "strict", z.ZodTypeAny, {
1574
+ $env: string;
1575
+ }, {
1576
+ $env: string;
1577
+ }>
1578
+ ]>>>;
1579
+ password: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1580
+ z.ZodString,
1581
+ z.ZodObject<{
1582
+ $env: z.ZodString;
1583
+ }, "strict", z.ZodTypeAny, {
1584
+ $env: string;
1585
+ }, {
1586
+ $env: string;
1587
+ }>
1588
+ ]>>>;
1589
+ database: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1590
+ z.ZodString,
1591
+ z.ZodObject<{
1592
+ $env: z.ZodString;
1593
+ }, "strict", z.ZodTypeAny, {
1594
+ $env: string;
1595
+ }, {
1596
+ $env: string;
1597
+ }>
1598
+ ]>>>;
1599
+ } & {
1600
+ permission: z.ZodDefault<z.ZodEnum<[
1601
+ "query-only",
1602
+ "read-write",
1603
+ "data-admin",
1604
+ "admin"
1605
+ ]>>;
1606
+ envFile: z.ZodOptional<z.ZodString>;
1607
+ }, "strip", z.ZodTypeAny, {
1608
+ password: string | {
1609
+ $env: string;
1610
+ };
1611
+ user: string | {
1612
+ $env: string;
1613
+ };
1614
+ system: "redis";
1615
+ host: string | {
1616
+ $env: string;
1617
+ };
1618
+ port: number | {
1619
+ $env: string;
1620
+ };
1621
+ database: string | {
1622
+ $env: string;
1623
+ };
1624
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1625
+ envFile?: string | undefined;
1626
+ }, {
1627
+ system: "redis";
1628
+ host: string | {
1629
+ $env: string;
1630
+ };
1631
+ port: number | {
1632
+ $env: string;
1633
+ };
1634
+ password?: string | {
1635
+ $env: string;
1636
+ } | undefined;
1637
+ user?: string | {
1638
+ $env: string;
1639
+ } | undefined;
1640
+ database?: string | {
1641
+ $env: string;
1642
+ } | undefined;
1643
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1644
+ envFile?: string | undefined;
1645
+ }>,
1646
+ z.ZodObject<{
1647
+ system: z.ZodLiteral<"elasticsearch">;
1648
+ protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<[
1649
+ "http",
1650
+ "https"
1651
+ ]>>>;
1652
+ host: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1653
+ z.ZodString,
1654
+ z.ZodObject<{
1655
+ $env: z.ZodString;
1656
+ }, "strict", z.ZodTypeAny, {
1657
+ $env: string;
1658
+ }, {
1659
+ $env: string;
1660
+ }>
1661
+ ]>>>;
1662
+ port: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1663
+ z.ZodNumber,
1664
+ z.ZodObject<{
1665
+ $env: z.ZodString;
1666
+ }, "strict", z.ZodTypeAny, {
1667
+ $env: string;
1668
+ }, {
1669
+ $env: string;
1670
+ }>
1671
+ ]>>>;
1672
+ user: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1673
+ z.ZodString,
1674
+ z.ZodObject<{
1675
+ $env: z.ZodString;
1676
+ }, "strict", z.ZodTypeAny, {
1677
+ $env: string;
1678
+ }, {
1679
+ $env: string;
1680
+ }>
1681
+ ]>>>;
1682
+ password: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1683
+ z.ZodString,
1684
+ z.ZodObject<{
1685
+ $env: z.ZodString;
1686
+ }, "strict", z.ZodTypeAny, {
1687
+ $env: string;
1688
+ }, {
1689
+ $env: string;
1690
+ }>
1691
+ ]>>>;
1692
+ database: z.ZodDefault<z.ZodOptional<z.ZodUnion<[
1693
+ z.ZodString,
1694
+ z.ZodObject<{
1695
+ $env: z.ZodString;
1696
+ }, "strict", z.ZodTypeAny, {
1697
+ $env: string;
1698
+ }, {
1699
+ $env: string;
1700
+ }>
1701
+ ]>>>;
1702
+ nodes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1703
+ cloudId: z.ZodOptional<z.ZodUnion<[
1704
+ z.ZodString,
1705
+ z.ZodObject<{
1706
+ $env: z.ZodString;
1707
+ }, "strict", z.ZodTypeAny, {
1708
+ $env: string;
1709
+ }, {
1710
+ $env: string;
1711
+ }>
1712
+ ]>>;
1713
+ apiKey: z.ZodOptional<z.ZodUnion<[
1714
+ z.ZodString,
1715
+ z.ZodObject<{
1716
+ $env: z.ZodString;
1717
+ }, "strict", z.ZodTypeAny, {
1718
+ $env: string;
1719
+ }, {
1720
+ $env: string;
1721
+ }>
1722
+ ]>>;
1723
+ caPath: z.ZodOptional<z.ZodString>;
1724
+ rejectUnauthorized: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1725
+ } & {
1726
+ permission: z.ZodDefault<z.ZodEnum<[
1727
+ "query-only",
1728
+ "read-write",
1729
+ "data-admin",
1730
+ "admin"
1731
+ ]>>;
1732
+ envFile: z.ZodOptional<z.ZodString>;
1733
+ }, "strip", z.ZodTypeAny, {
1734
+ password: string | {
1735
+ $env: string;
1736
+ };
1737
+ user: string | {
1738
+ $env: string;
1739
+ };
1740
+ system: "elasticsearch";
1741
+ host: string | {
1742
+ $env: string;
1743
+ };
1744
+ port: number | {
1745
+ $env: string;
1746
+ };
1747
+ database: string | {
1748
+ $env: string;
1749
+ };
1750
+ rejectUnauthorized: boolean;
1751
+ protocol: "http" | "https";
1752
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1753
+ nodes?: string[] | undefined;
1754
+ cloudId?: string | {
1755
+ $env: string;
1756
+ } | undefined;
1757
+ apiKey?: string | {
1758
+ $env: string;
1759
+ } | undefined;
1760
+ caPath?: string | undefined;
1761
+ envFile?: string | undefined;
1762
+ }, {
1763
+ system: "elasticsearch";
1764
+ password?: string | {
1765
+ $env: string;
1766
+ } | undefined;
1767
+ user?: string | {
1768
+ $env: string;
1769
+ } | undefined;
1770
+ host?: string | {
1771
+ $env: string;
1772
+ } | undefined;
1773
+ port?: number | {
1774
+ $env: string;
1775
+ } | undefined;
1776
+ database?: string | {
1777
+ $env: string;
1778
+ } | undefined;
1779
+ rejectUnauthorized?: boolean | undefined;
1780
+ protocol?: "http" | "https" | undefined;
1781
+ nodes?: string[] | undefined;
1782
+ cloudId?: string | {
1783
+ $env: string;
1784
+ } | undefined;
1785
+ apiKey?: string | {
1786
+ $env: string;
1787
+ } | undefined;
1788
+ caPath?: string | undefined;
1789
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1790
+ envFile?: string | undefined;
1791
+ }>
1792
+ ]>>, Record<string, {
1793
+ password: string | {
1794
+ $env: string;
1795
+ };
1796
+ user: string | {
1797
+ $env: string;
1798
+ };
1799
+ system: "postgresql" | "mysql" | "mariadb";
1800
+ host: string | {
1801
+ $env: string;
1802
+ };
1803
+ port: number | {
1804
+ $env: string;
1805
+ };
1806
+ database: string | {
1807
+ $env: string;
1808
+ };
1809
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1810
+ envFile?: string | undefined;
1811
+ } | {
1812
+ password: string | {
1813
+ $env: string;
1814
+ };
1815
+ user: string | {
1816
+ $env: string;
1817
+ };
1818
+ system: "mongodb";
1819
+ host: string | {
1820
+ $env: string;
1821
+ };
1822
+ port: number | {
1823
+ $env: string;
1824
+ };
1825
+ database: string | {
1826
+ $env: string;
1827
+ };
1828
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1829
+ uri?: string | {
1830
+ $env: string;
1831
+ } | undefined;
1832
+ envFile?: string | undefined;
1833
+ } | {
1834
+ password: string | {
1835
+ $env: string;
1836
+ };
1837
+ user: string | {
1838
+ $env: string;
1839
+ };
1840
+ system: "redis";
1841
+ host: string | {
1842
+ $env: string;
1843
+ };
1844
+ port: number | {
1845
+ $env: string;
1846
+ };
1847
+ database: string | {
1848
+ $env: string;
1849
+ };
1850
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1851
+ envFile?: string | undefined;
1852
+ } | {
1853
+ password: string | {
1854
+ $env: string;
1855
+ };
1856
+ user: string | {
1857
+ $env: string;
1858
+ };
1859
+ system: "elasticsearch";
1860
+ host: string | {
1861
+ $env: string;
1862
+ };
1863
+ port: number | {
1864
+ $env: string;
1865
+ };
1866
+ database: string | {
1867
+ $env: string;
1868
+ };
1869
+ rejectUnauthorized: boolean;
1870
+ protocol: "http" | "https";
1871
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
1872
+ nodes?: string[] | undefined;
1873
+ cloudId?: string | {
1874
+ $env: string;
1875
+ } | undefined;
1876
+ apiKey?: string | {
1877
+ $env: string;
1878
+ } | undefined;
1879
+ caPath?: string | undefined;
1880
+ envFile?: string | undefined;
1881
+ }>, Record<string, {
1882
+ user: string | {
1883
+ $env: string;
1884
+ };
1885
+ system: "postgresql" | "mysql" | "mariadb";
1886
+ host: string | {
1887
+ $env: string;
1888
+ };
1889
+ port: number | {
1890
+ $env: string;
1891
+ };
1892
+ database: string | {
1893
+ $env: string;
1894
+ };
1895
+ password?: string | {
1896
+ $env: string;
1897
+ } | undefined;
1898
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1899
+ envFile?: string | undefined;
1900
+ } | {
1901
+ system: "mongodb";
1902
+ password?: string | {
1903
+ $env: string;
1904
+ } | undefined;
1905
+ user?: string | {
1906
+ $env: string;
1907
+ } | undefined;
1908
+ host?: string | {
1909
+ $env: string;
1910
+ } | undefined;
1911
+ port?: number | {
1912
+ $env: string;
1913
+ } | undefined;
1914
+ database?: string | {
1915
+ $env: string;
1916
+ } | undefined;
1917
+ uri?: string | {
1918
+ $env: string;
1919
+ } | undefined;
1920
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1921
+ envFile?: string | undefined;
1922
+ } | {
1923
+ system: "redis";
1924
+ host: string | {
1925
+ $env: string;
1926
+ };
1927
+ port: number | {
1928
+ $env: string;
1929
+ };
1930
+ password?: string | {
1931
+ $env: string;
1932
+ } | undefined;
1933
+ user?: string | {
1934
+ $env: string;
1935
+ } | undefined;
1936
+ database?: string | {
1937
+ $env: string;
1938
+ } | undefined;
1939
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1940
+ envFile?: string | undefined;
1941
+ } | {
1942
+ system: "elasticsearch";
1943
+ password?: string | {
1944
+ $env: string;
1945
+ } | undefined;
1946
+ user?: string | {
1947
+ $env: string;
1948
+ } | undefined;
1949
+ host?: string | {
1950
+ $env: string;
1951
+ } | undefined;
1952
+ port?: number | {
1953
+ $env: string;
1954
+ } | undefined;
1955
+ database?: string | {
1956
+ $env: string;
1957
+ } | undefined;
1958
+ rejectUnauthorized?: boolean | undefined;
1959
+ protocol?: "http" | "https" | undefined;
1960
+ nodes?: string[] | undefined;
1961
+ cloudId?: string | {
1962
+ $env: string;
1963
+ } | undefined;
1964
+ apiKey?: string | {
1965
+ $env: string;
1966
+ } | undefined;
1967
+ caPath?: string | undefined;
1968
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
1969
+ envFile?: string | undefined;
1970
+ }>>;
1971
+ schema: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
1972
+ schemas: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>>;
1973
+ metadata: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1974
+ createdAt: z.ZodOptional<z.ZodString>;
1975
+ version: z.ZodDefault<z.ZodString>;
1976
+ schemaLastUpdated: z.ZodOptional<z.ZodString>;
1977
+ schemaTableCount: z.ZodOptional<z.ZodNumber>;
1978
+ }, "strip", z.ZodTypeAny, {
1979
+ version: string;
1980
+ createdAt?: string | undefined;
1981
+ schemaLastUpdated?: string | undefined;
1982
+ schemaTableCount?: number | undefined;
1983
+ }, {
1984
+ version?: string | undefined;
1985
+ createdAt?: string | undefined;
1986
+ schemaLastUpdated?: string | undefined;
1987
+ schemaTableCount?: number | undefined;
1988
+ }>>>;
1989
+ blacklist: z.ZodDefault<z.ZodOptional<z.ZodObject<{
1990
+ tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1991
+ columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
1992
+ }, "strip", z.ZodTypeAny, {
1993
+ columns: Record<string, string[]>;
1994
+ tables: string[];
1995
+ }, {
1996
+ columns?: Record<string, string[]> | undefined;
1997
+ tables?: string[] | undefined;
1998
+ }>>>;
1999
+ audit: z.ZodDefault<z.ZodOptional<z.ZodObject<{
2000
+ enabled: z.ZodDefault<z.ZodBoolean>;
2001
+ rotation: z.ZodDefault<z.ZodOptional<z.ZodObject<{
2002
+ max_bytes: z.ZodDefault<z.ZodNumber>;
2003
+ max_entries: z.ZodDefault<z.ZodNumber>;
2004
+ }, "strip", z.ZodTypeAny, {
2005
+ max_bytes: number;
2006
+ max_entries: number;
2007
+ }, {
2008
+ max_bytes?: number | undefined;
2009
+ max_entries?: number | undefined;
2010
+ }>>>;
2011
+ }, "strip", z.ZodTypeAny, {
2012
+ enabled: boolean;
2013
+ rotation: {
2014
+ max_bytes: number;
2015
+ max_entries: number;
2016
+ };
2017
+ }, {
2018
+ enabled?: boolean | undefined;
2019
+ rotation?: {
2020
+ max_bytes?: number | undefined;
2021
+ max_entries?: number | undefined;
2022
+ } | undefined;
2023
+ }>>>;
2024
+ redis: z.ZodOptional<z.ZodObject<{
2025
+ mask: z.ZodDefault<z.ZodArray<z.ZodObject<{
2026
+ keyPattern: z.ZodString;
2027
+ fields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2028
+ }, "strip", z.ZodTypeAny, {
2029
+ keyPattern: string;
2030
+ fields?: string[] | undefined;
2031
+ }, {
2032
+ keyPattern: string;
2033
+ fields?: string[] | undefined;
2034
+ }>, "many">>;
2035
+ }, "strip", z.ZodTypeAny, {
2036
+ mask: {
2037
+ keyPattern: string;
2038
+ fields?: string[] | undefined;
2039
+ }[];
2040
+ }, {
2041
+ mask?: {
2042
+ keyPattern: string;
2043
+ fields?: string[] | undefined;
2044
+ }[] | undefined;
2045
+ }>>;
2046
+ }, "strip", z.ZodTypeAny, {
2047
+ schema: Record<string, any>;
2048
+ blacklist: {
2049
+ columns: Record<string, string[]>;
2050
+ tables: string[];
2051
+ };
2052
+ audit: {
2053
+ enabled: boolean;
2054
+ rotation: {
2055
+ max_bytes: number;
2056
+ max_entries: number;
2057
+ };
2058
+ };
2059
+ version: 2;
2060
+ default: string;
2061
+ metadata: {
2062
+ version: string;
2063
+ createdAt?: string | undefined;
2064
+ schemaLastUpdated?: string | undefined;
2065
+ schemaTableCount?: number | undefined;
2066
+ };
2067
+ connections: Record<string, {
2068
+ password: string | {
2069
+ $env: string;
2070
+ };
2071
+ user: string | {
2072
+ $env: string;
2073
+ };
2074
+ system: "postgresql" | "mysql" | "mariadb";
2075
+ host: string | {
2076
+ $env: string;
2077
+ };
2078
+ port: number | {
2079
+ $env: string;
2080
+ };
2081
+ database: string | {
2082
+ $env: string;
2083
+ };
2084
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
2085
+ envFile?: string | undefined;
2086
+ } | {
2087
+ password: string | {
2088
+ $env: string;
2089
+ };
2090
+ user: string | {
2091
+ $env: string;
2092
+ };
2093
+ system: "mongodb";
2094
+ host: string | {
2095
+ $env: string;
2096
+ };
2097
+ port: number | {
2098
+ $env: string;
2099
+ };
2100
+ database: string | {
2101
+ $env: string;
2102
+ };
2103
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
2104
+ uri?: string | {
2105
+ $env: string;
2106
+ } | undefined;
2107
+ envFile?: string | undefined;
2108
+ } | {
2109
+ password: string | {
2110
+ $env: string;
2111
+ };
2112
+ user: string | {
2113
+ $env: string;
2114
+ };
2115
+ system: "redis";
2116
+ host: string | {
2117
+ $env: string;
2118
+ };
2119
+ port: number | {
2120
+ $env: string;
2121
+ };
2122
+ database: string | {
2123
+ $env: string;
2124
+ };
2125
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
2126
+ envFile?: string | undefined;
2127
+ } | {
2128
+ password: string | {
2129
+ $env: string;
2130
+ };
2131
+ user: string | {
2132
+ $env: string;
2133
+ };
2134
+ system: "elasticsearch";
2135
+ host: string | {
2136
+ $env: string;
2137
+ };
2138
+ port: number | {
2139
+ $env: string;
2140
+ };
2141
+ database: string | {
2142
+ $env: string;
2143
+ };
2144
+ rejectUnauthorized: boolean;
2145
+ protocol: "http" | "https";
2146
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
2147
+ nodes?: string[] | undefined;
2148
+ cloudId?: string | {
2149
+ $env: string;
2150
+ } | undefined;
2151
+ apiKey?: string | {
2152
+ $env: string;
2153
+ } | undefined;
2154
+ caPath?: string | undefined;
2155
+ envFile?: string | undefined;
2156
+ }>;
2157
+ schemas: Record<string, Record<string, any>>;
2158
+ redis?: {
2159
+ mask: {
2160
+ keyPattern: string;
2161
+ fields?: string[] | undefined;
2162
+ }[];
2163
+ } | undefined;
2164
+ }, {
2165
+ version: 2;
2166
+ default: string;
2167
+ connections: Record<string, {
2168
+ user: string | {
2169
+ $env: string;
2170
+ };
2171
+ system: "postgresql" | "mysql" | "mariadb";
2172
+ host: string | {
2173
+ $env: string;
2174
+ };
2175
+ port: number | {
2176
+ $env: string;
2177
+ };
2178
+ database: string | {
2179
+ $env: string;
2180
+ };
2181
+ password?: string | {
2182
+ $env: string;
2183
+ } | undefined;
2184
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
2185
+ envFile?: string | undefined;
2186
+ } | {
2187
+ system: "mongodb";
2188
+ password?: string | {
2189
+ $env: string;
2190
+ } | undefined;
2191
+ user?: string | {
2192
+ $env: string;
2193
+ } | undefined;
2194
+ host?: string | {
2195
+ $env: string;
2196
+ } | undefined;
2197
+ port?: number | {
2198
+ $env: string;
2199
+ } | undefined;
2200
+ database?: string | {
2201
+ $env: string;
2202
+ } | undefined;
2203
+ uri?: string | {
2204
+ $env: string;
2205
+ } | undefined;
2206
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
2207
+ envFile?: string | undefined;
2208
+ } | {
2209
+ system: "redis";
2210
+ host: string | {
2211
+ $env: string;
2212
+ };
2213
+ port: number | {
2214
+ $env: string;
2215
+ };
2216
+ password?: string | {
2217
+ $env: string;
2218
+ } | undefined;
2219
+ user?: string | {
2220
+ $env: string;
2221
+ } | undefined;
2222
+ database?: string | {
2223
+ $env: string;
2224
+ } | undefined;
2225
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
2226
+ envFile?: string | undefined;
2227
+ } | {
2228
+ system: "elasticsearch";
2229
+ password?: string | {
2230
+ $env: string;
2231
+ } | undefined;
2232
+ user?: string | {
2233
+ $env: string;
2234
+ } | undefined;
2235
+ host?: string | {
2236
+ $env: string;
2237
+ } | undefined;
2238
+ port?: number | {
2239
+ $env: string;
2240
+ } | undefined;
2241
+ database?: string | {
2242
+ $env: string;
2243
+ } | undefined;
2244
+ rejectUnauthorized?: boolean | undefined;
2245
+ protocol?: "http" | "https" | undefined;
2246
+ nodes?: string[] | undefined;
2247
+ cloudId?: string | {
2248
+ $env: string;
2249
+ } | undefined;
2250
+ apiKey?: string | {
2251
+ $env: string;
2252
+ } | undefined;
2253
+ caPath?: string | undefined;
2254
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
2255
+ envFile?: string | undefined;
2256
+ }>;
2257
+ redis?: {
2258
+ mask?: {
2259
+ keyPattern: string;
2260
+ fields?: string[] | undefined;
2261
+ }[] | undefined;
2262
+ } | undefined;
2263
+ schema?: Record<string, any> | undefined;
2264
+ blacklist?: {
2265
+ columns?: Record<string, string[]> | undefined;
2266
+ tables?: string[] | undefined;
2267
+ } | undefined;
2268
+ audit?: {
2269
+ enabled?: boolean | undefined;
2270
+ rotation?: {
2271
+ max_bytes?: number | undefined;
2272
+ max_entries?: number | undefined;
2273
+ } | undefined;
2274
+ } | undefined;
2275
+ metadata?: {
2276
+ version?: string | undefined;
2277
+ createdAt?: string | undefined;
2278
+ schemaLastUpdated?: string | undefined;
2279
+ schemaTableCount?: number | undefined;
2280
+ } | undefined;
2281
+ schemas?: Record<string, Record<string, any>> | undefined;
2282
+ }>, {
2283
+ schema: Record<string, any>;
2284
+ blacklist: {
2285
+ columns: Record<string, string[]>;
2286
+ tables: string[];
2287
+ };
2288
+ audit: {
2289
+ enabled: boolean;
2290
+ rotation: {
2291
+ max_bytes: number;
2292
+ max_entries: number;
2293
+ };
2294
+ };
2295
+ version: 2;
2296
+ default: string;
2297
+ metadata: {
2298
+ version: string;
2299
+ createdAt?: string | undefined;
2300
+ schemaLastUpdated?: string | undefined;
2301
+ schemaTableCount?: number | undefined;
2302
+ };
2303
+ connections: Record<string, {
2304
+ password: string | {
2305
+ $env: string;
2306
+ };
2307
+ user: string | {
2308
+ $env: string;
2309
+ };
2310
+ system: "postgresql" | "mysql" | "mariadb";
2311
+ host: string | {
2312
+ $env: string;
2313
+ };
2314
+ port: number | {
2315
+ $env: string;
2316
+ };
2317
+ database: string | {
2318
+ $env: string;
2319
+ };
2320
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
2321
+ envFile?: string | undefined;
2322
+ } | {
2323
+ password: string | {
2324
+ $env: string;
2325
+ };
2326
+ user: string | {
2327
+ $env: string;
2328
+ };
2329
+ system: "mongodb";
2330
+ host: string | {
2331
+ $env: string;
2332
+ };
2333
+ port: number | {
2334
+ $env: string;
2335
+ };
2336
+ database: string | {
2337
+ $env: string;
2338
+ };
2339
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
2340
+ uri?: string | {
2341
+ $env: string;
2342
+ } | undefined;
2343
+ envFile?: string | undefined;
2344
+ } | {
2345
+ password: string | {
2346
+ $env: string;
2347
+ };
2348
+ user: string | {
2349
+ $env: string;
2350
+ };
2351
+ system: "redis";
2352
+ host: string | {
2353
+ $env: string;
2354
+ };
2355
+ port: number | {
2356
+ $env: string;
2357
+ };
2358
+ database: string | {
2359
+ $env: string;
2360
+ };
2361
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
2362
+ envFile?: string | undefined;
2363
+ } | {
2364
+ password: string | {
2365
+ $env: string;
2366
+ };
2367
+ user: string | {
2368
+ $env: string;
2369
+ };
2370
+ system: "elasticsearch";
2371
+ host: string | {
2372
+ $env: string;
2373
+ };
2374
+ port: number | {
2375
+ $env: string;
2376
+ };
2377
+ database: string | {
2378
+ $env: string;
2379
+ };
2380
+ rejectUnauthorized: boolean;
2381
+ protocol: "http" | "https";
2382
+ permission: "admin" | "query-only" | "read-write" | "data-admin";
2383
+ nodes?: string[] | undefined;
2384
+ cloudId?: string | {
2385
+ $env: string;
2386
+ } | undefined;
2387
+ apiKey?: string | {
2388
+ $env: string;
2389
+ } | undefined;
2390
+ caPath?: string | undefined;
2391
+ envFile?: string | undefined;
2392
+ }>;
2393
+ schemas: Record<string, Record<string, any>>;
2394
+ redis?: {
2395
+ mask: {
2396
+ keyPattern: string;
2397
+ fields?: string[] | undefined;
2398
+ }[];
2399
+ } | undefined;
2400
+ }, {
2401
+ version: 2;
2402
+ default: string;
2403
+ connections: Record<string, {
2404
+ user: string | {
2405
+ $env: string;
2406
+ };
2407
+ system: "postgresql" | "mysql" | "mariadb";
2408
+ host: string | {
2409
+ $env: string;
2410
+ };
2411
+ port: number | {
2412
+ $env: string;
2413
+ };
2414
+ database: string | {
2415
+ $env: string;
2416
+ };
2417
+ password?: string | {
2418
+ $env: string;
2419
+ } | undefined;
2420
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
2421
+ envFile?: string | undefined;
2422
+ } | {
2423
+ system: "mongodb";
2424
+ password?: string | {
2425
+ $env: string;
2426
+ } | undefined;
2427
+ user?: string | {
2428
+ $env: string;
2429
+ } | undefined;
2430
+ host?: string | {
2431
+ $env: string;
2432
+ } | undefined;
2433
+ port?: number | {
2434
+ $env: string;
2435
+ } | undefined;
2436
+ database?: string | {
2437
+ $env: string;
2438
+ } | undefined;
2439
+ uri?: string | {
2440
+ $env: string;
2441
+ } | undefined;
2442
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
2443
+ envFile?: string | undefined;
2444
+ } | {
2445
+ system: "redis";
2446
+ host: string | {
2447
+ $env: string;
2448
+ };
2449
+ port: number | {
2450
+ $env: string;
2451
+ };
2452
+ password?: string | {
2453
+ $env: string;
2454
+ } | undefined;
2455
+ user?: string | {
2456
+ $env: string;
2457
+ } | undefined;
2458
+ database?: string | {
2459
+ $env: string;
2460
+ } | undefined;
2461
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
2462
+ envFile?: string | undefined;
2463
+ } | {
2464
+ system: "elasticsearch";
2465
+ password?: string | {
2466
+ $env: string;
2467
+ } | undefined;
2468
+ user?: string | {
2469
+ $env: string;
2470
+ } | undefined;
2471
+ host?: string | {
2472
+ $env: string;
2473
+ } | undefined;
2474
+ port?: number | {
2475
+ $env: string;
2476
+ } | undefined;
2477
+ database?: string | {
2478
+ $env: string;
2479
+ } | undefined;
2480
+ rejectUnauthorized?: boolean | undefined;
2481
+ protocol?: "http" | "https" | undefined;
2482
+ nodes?: string[] | undefined;
2483
+ cloudId?: string | {
2484
+ $env: string;
2485
+ } | undefined;
2486
+ apiKey?: string | {
2487
+ $env: string;
2488
+ } | undefined;
2489
+ caPath?: string | undefined;
2490
+ permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
2491
+ envFile?: string | undefined;
2492
+ }>;
2493
+ redis?: {
2494
+ mask?: {
2495
+ keyPattern: string;
2496
+ fields?: string[] | undefined;
2497
+ }[] | undefined;
2498
+ } | undefined;
2499
+ schema?: Record<string, any> | undefined;
2500
+ blacklist?: {
2501
+ columns?: Record<string, string[]> | undefined;
2502
+ tables?: string[] | undefined;
2503
+ } | undefined;
2504
+ audit?: {
2505
+ enabled?: boolean | undefined;
2506
+ rotation?: {
2507
+ max_bytes?: number | undefined;
2508
+ max_entries?: number | undefined;
2509
+ } | undefined;
2510
+ } | undefined;
2511
+ metadata?: {
2512
+ version?: string | undefined;
2513
+ createdAt?: string | undefined;
2514
+ schemaLastUpdated?: string | undefined;
2515
+ schemaTableCount?: number | undefined;
2516
+ } | undefined;
2517
+ schemas?: Record<string, Record<string, any>> | undefined;
2518
+ }>;
2519
+ type DbcliConfigV2 = z.infer<typeof DbcliConfigV2Schema>;
2520
+ /**
2521
+ * QueryExecutor class for executing SQL queries with permission checks
2522
+ */
2523
+ export declare class QueryExecutor {
2524
+ private adapter;
2525
+ private permission;
2526
+ private blacklistValidator?;
2527
+ private config?;
2528
+ private options;
2529
+ constructor(adapter: DatabaseAdapter, permission: Permission, blacklistValidator?: BlacklistValidator | undefined, config?: DbcliConfig$1 | undefined, options?: {
2530
+ config?: string;
2531
+ });
2532
+ /**
2533
+ * Execute a SQL query with permission enforcement and error handling
2534
+ *
2535
+ * @param sql The SQL query string
2536
+ * @param options Execution options (autoLimit, limitValue)
2537
+ * @returns QueryResult with rows and metadata
2538
+ * @throws PermissionError if query violates permission level
2539
+ * @throws BlacklistError if table is blacklisted
2540
+ * @throws Error for database execution errors
2541
+ */
2542
+ execute(sql: string, options?: {
2543
+ autoLimit?: boolean;
2544
+ limitValue?: number;
2545
+ }): Promise<QueryResult<Record<string, unknown>>>;
2546
+ }
2547
+ interface SchemaIndex {
2548
+ tables: Record<string, {
2549
+ location: "hot" | "cold";
2550
+ file: string;
2551
+ estimatedSize: number;
2552
+ lastModified: string;
2553
+ }>;
2554
+ hotTables: string[];
2555
+ metadata: {
2556
+ version: string;
2557
+ lastRefreshed: string;
2558
+ totalTables: number;
2559
+ };
2560
+ }
2561
+ interface CacheStats {
2562
+ hotTables: number;
2563
+ cachedTables: number;
2564
+ cacheSize: number;
2565
+ cacheHitRate: string;
2566
+ maxItems: number;
2567
+ maxSize: number;
2568
+ }
2569
+ interface LoaderOptions {
2570
+ maxCacheItems?: number;
2571
+ maxCacheSize?: number;
2572
+ hotTableThreshold?: number;
2573
+ enableStreaming?: boolean;
2574
+ streamingTimeout?: number;
2575
+ /** V2 named connection — layered files under `.dbcli/schemas/<name>/` */
2576
+ connectionName?: string;
2577
+ }
2578
+ declare class SchemaCacheManager {
2579
+ private cache;
2580
+ private index;
2581
+ private hotSchemas;
2582
+ private dbcliPath;
2583
+ /** Root for index.json, hot-schemas.json, cold/ (V2: per-connection subfolder) */
2584
+ private schemaRoot;
2585
+ private maxItems;
2586
+ private maxSize;
2587
+ /**
2588
+ * Constructor
2589
+ * @param dbcliPath Path to .dbcli directory
2590
+ * @param options Cache configuration (optional `connectionName` for V2 isolation)
2591
+ */
2592
+ constructor(dbcliPath: string, options?: {
2593
+ maxCacheItems?: number;
2594
+ maxCacheSize?: number;
2595
+ connectionName?: string;
2596
+ });
2597
+ /**
2598
+ * Initialize: Load index and hot schemas
2599
+ *
2600
+ * Performance: < 10ms for typical cases (hot-schemas < 1MB)
2601
+ * Graceful degradation: If files missing, continues with empty cache
2602
+ */
2603
+ initialize(): Promise<void>;
2604
+ /**
2605
+ * Get table schema - Three-tier lookup strategy
2606
+ *
2607
+ * 1. Hot schemas (< 1ms) - in-memory map lookup
2608
+ * 2. LRU cache (< 5ms) - in-memory cache hit
2609
+ * 3. Cold load (10-50ms) - from file, then cache
2610
+ *
2611
+ * @param tableName Name of table to retrieve
2612
+ * @returns TableSchema or null if not found
2613
+ */
2614
+ getTableSchema(tableName: string): Promise<TableSchema | null>;
2615
+ /**
2616
+ * Find fields by name across hot tables
2617
+ *
2618
+ * Performance: < 1ms for typical field searches (O(n) over hot tables only)
2619
+ * Note: Cold tables not searched for efficiency
2620
+ *
2621
+ * @param fieldName Column name to search for
2622
+ * @returns Array of { table, column } matches
2623
+ */
2624
+ findFieldsByName(fieldName: string): Promise<Array<{
2625
+ table: string;
2626
+ column: ColumnSchema;
2627
+ }>>;
2628
+ /**
2629
+ * Get cache statistics
2630
+ *
2631
+ * @returns Cache stats including hit rate and capacity
2632
+ */
2633
+ /**
2634
+ * Remove a table from all cache tiers (hot + LRU)
2635
+ * Used after DROP TABLE to keep cache consistent
2636
+ */
2637
+ invalidateTable(tableName: string): void;
2638
+ /**
2639
+ * Insert or update a table schema in cache
2640
+ * Used after CREATE TABLE or ALTER TABLE to keep cache consistent
2641
+ */
2642
+ refreshTable(tableName: string, schema: TableSchema): void;
2643
+ getStats(): CacheStats;
2644
+ }
2645
+ /**
2646
+ * Schema Layered Loader
2647
+ * Manages hierarchical schema loading: hot on startup, cold on-demand
2648
+ */
2649
+ export declare class SchemaLayeredLoader {
2650
+ private dbcliPath;
2651
+ /** V2 named connection for `.dbcli/schemas/<name>/` */
2652
+ private connectionName;
2653
+ private options;
2654
+ private cache;
2655
+ private index;
2656
+ private loadTime;
2657
+ /**
2658
+ * Constructor
2659
+ * @param dbcliPath Path to .dbcli directory
2660
+ * @param options Loader configuration
2661
+ */
2662
+ constructor(dbcliPath: string, options?: LoaderOptions);
2663
+ /**
2664
+ * Initialize: Main entry point for startup
2665
+ *
2666
+ * Performance Target: < 100ms (including file I/O, JSON parsing, hot-table preload)
2667
+ * For 100+ tables: Should still meet target through layered approach
2668
+ *
2669
+ * Flow:
2670
+ * 1. Load index (schemas/index.json)
2671
+ * 2. Initialize cache manager
2672
+ * 3. Preload hot tables
2673
+ * 4. Return cache, index, and timing
2674
+ *
2675
+ * @returns Initialization result with cache, index, and load time
2676
+ */
2677
+ initialize(): Promise<{
2678
+ cache: SchemaCacheManager;
2679
+ index: SchemaIndex | null;
2680
+ loadTime: number;
2681
+ }>;
2682
+ /**
2683
+ * Load cold table on-demand
2684
+ *
2685
+ * Called when first querying a table not in hot cache
2686
+ *
2687
+ * @param tableName Name of cold table to load
2688
+ * @param cache SchemaCacheManager instance
2689
+ * @returns TableSchema or null if not found
2690
+ */
2691
+ loadColdTable(tableName: string, cache: SchemaCacheManager): Promise<TableSchema | null>;
2692
+ /**
2693
+ * Ensure required directories exist
2694
+ *
2695
+ * Creates:
2696
+ * - .dbcli/schemas/
2697
+ * - .dbcli/schemas/cold/
2698
+ *
2699
+ * @private
2700
+ */
2701
+ private ensureDirectories;
2702
+ /**
2703
+ * Get performance benchmark data
2704
+ *
2705
+ * Used for monitoring and tuning
2706
+ *
2707
+ * @returns Benchmark metrics
2708
+ */
2709
+ getBenchmark(): {
2710
+ initTime: number;
2711
+ hotTables: number;
2712
+ totalTables: number;
2713
+ estimatedSize: number;
2714
+ };
2715
+ }
2716
+ /**
2717
+ * Detect config version from raw parsed JSON
2718
+ */
2719
+ export declare function detectConfigVersion(raw: unknown): 1 | 2;
2720
+ /**
2721
+ * Resolved connection result — what commands receive
2722
+ * Supports SQL, MongoDB, Redis, and Elasticsearch connections
2723
+ */
2724
+ export interface ResolvedConnection {
2725
+ name: string;
2726
+ connection: {
2727
+ system: "postgresql" | "mysql" | "mariadb" | "mongodb" | "redis" | "elasticsearch";
2728
+ host: string | {
2729
+ $env: string;
2730
+ };
2731
+ port: number | {
2732
+ $env: string;
2733
+ };
2734
+ user: string | {
2735
+ $env: string;
2736
+ };
2737
+ password: string | {
2738
+ $env: string;
2739
+ };
2740
+ database: string | {
2741
+ $env: string;
2742
+ };
2743
+ uri?: string | {
2744
+ $env: string;
2745
+ };
2746
+ protocol?: "http" | "https";
2747
+ nodes?: string[];
2748
+ cloudId?: string | {
2749
+ $env: string;
2750
+ };
2751
+ apiKey?: string | {
2752
+ $env: string;
2753
+ };
2754
+ caPath?: string;
2755
+ rejectUnauthorized?: boolean;
2756
+ };
2757
+ permission: "query-only" | "read-write" | "data-admin" | "admin";
2758
+ envFile?: string;
2759
+ }
2760
+ /**
2761
+ * Resolve a named connection from v2 config
2762
+ */
2763
+ export declare function resolveConnection(config: DbcliConfigV2, name: string | undefined): ResolvedConnection;
2764
+ /**
2765
+ * Load env file for a connection if specified
2766
+ */
2767
+ export declare function loadConnectionEnv(resolved: ResolvedConnection, basePath: string): Promise<void>;
2768
+ /**
2769
+ * Read and validate a v2 config from disk
2770
+ */
2771
+ export declare function readV2Config(path: string): Promise<DbcliConfigV2>;
2772
+ /**
2773
+ * List all connection names in a v2 config
2774
+ */
2775
+ export declare function listConnections(config: DbcliConfigV2): Array<{
2776
+ name: string;
2777
+ system: string;
2778
+ host: string | {
2779
+ $env: string;
2780
+ };
2781
+ port: number | {
2782
+ $env: string;
2783
+ };
2784
+ database: string | {
2785
+ $env: string;
2786
+ };
2787
+ uri?: string | {
2788
+ $env: string;
2789
+ };
2790
+ isDefault: boolean;
2791
+ }>;
2792
+
2793
+ export {
2794
+ DbcliConfig$1 as DbcliConfig,
2795
+ };
2796
+
2797
+ export {};