@carllee1983/dbcli 1.46.0 → 1.47.1

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 CHANGED
@@ -355,13 +355,13 @@ export declare class BlacklistError extends Error {
355
355
  * Enables system-aware instantiation without coupling CLI commands to specific drivers
356
356
  */
357
357
  export declare class AdapterFactory {
358
- static createSqlAdapter(options: SqlConnectionOptions): DatabaseAdapter;
359
- static createQueryableAdapter(options: QueryableConnectionOptions): QueryableAdapter;
358
+ static createSqlAdapter(rawOptions: SqlConnectionOptions): DatabaseAdapter;
359
+ static createQueryableAdapter(rawOptions: QueryableConnectionOptions): QueryableAdapter;
360
360
  static createAdapter(options: SqlConnectionOptions): DatabaseAdapter;
361
361
  static createAdapter(options: QueryableConnectionOptions): QueryableAdapter;
362
362
  static createAdapter(options: ConnectionOptions): DatabaseAdapter | QueryableAdapter;
363
363
  static createMongoDBAdapter(options: ConnectionOptions): QueryableAdapter;
364
- static createRedisAdapter(options: ConnectionOptions, blacklistRules?: string[], maskRules?: RedisMaskRule[]): QueryableAdapter;
364
+ static createRedisAdapter(rawOptions: ConnectionOptions, blacklistRules?: string[], maskRules?: RedisMaskRule[]): QueryableAdapter;
365
365
  static createElasticsearchAdapter(options: ConnectionOptions): QueryableAdapter;
366
366
  }
367
367
  /**
@@ -560,6 +560,12 @@ export interface QueryResult<T> {
560
560
  /** Internal row-limit proof, mapped into public JSON metadata by the formatter. */
561
561
  appliedLimit?: AppliedLimitMetadata;
562
562
  }
563
+ declare const SQL_DIALECTS: readonly [
564
+ "postgresql",
565
+ "mysql",
566
+ "mariadb"
567
+ ];
568
+ type SqlDialect = (typeof SQL_DIALECTS)[number];
563
569
  /**
564
570
  * Manager class for loading and querying blacklist rules.
565
571
  * Instantiate once per CLI invocation.
@@ -668,6 +674,7 @@ export declare class BlacklistValidator {
668
674
  declare const DbcliConfigSchema: z.ZodObject<{
669
675
  connection: z.ZodUnion<[
670
676
  z.ZodObject<{
677
+ timeout: z.ZodOptional<z.ZodNumber>;
671
678
  system: z.ZodEnum<[
672
679
  "postgresql",
673
680
  "mysql",
@@ -740,6 +747,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
740
747
  database: string | {
741
748
  $env: string;
742
749
  };
750
+ timeout?: number | undefined;
743
751
  }, {
744
752
  user: string | {
745
753
  $env: string;
@@ -754,11 +762,13 @@ declare const DbcliConfigSchema: z.ZodObject<{
754
762
  database: string | {
755
763
  $env: string;
756
764
  };
765
+ timeout?: number | undefined;
757
766
  password?: string | {
758
767
  $env: string;
759
768
  } | undefined;
760
769
  }>,
761
770
  z.ZodObject<{
771
+ timeout: z.ZodOptional<z.ZodNumber>;
762
772
  system: z.ZodLiteral<"mongodb">;
763
773
  uri: z.ZodOptional<z.ZodUnion<[
764
774
  z.ZodString,
@@ -860,6 +870,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
860
870
  $env: string;
861
871
  };
862
872
  srv: boolean;
873
+ timeout?: number | undefined;
863
874
  authSource?: string | {
864
875
  $env: string;
865
876
  } | undefined;
@@ -872,6 +883,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
872
883
  } | undefined;
873
884
  }, {
874
885
  system: "mongodb";
886
+ timeout?: number | undefined;
875
887
  password?: string | {
876
888
  $env: string;
877
889
  } | undefined;
@@ -900,6 +912,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
900
912
  } | undefined;
901
913
  }>,
902
914
  z.ZodObject<{
915
+ timeout: z.ZodOptional<z.ZodNumber>;
903
916
  system: z.ZodLiteral<"redis">;
904
917
  host: z.ZodUnion<[
905
918
  z.ZodString,
@@ -968,6 +981,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
968
981
  database: string | {
969
982
  $env: string;
970
983
  };
984
+ timeout?: number | undefined;
971
985
  }, {
972
986
  system: "redis";
973
987
  host: string | {
@@ -976,6 +990,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
976
990
  port: number | {
977
991
  $env: string;
978
992
  };
993
+ timeout?: number | undefined;
979
994
  password?: string | {
980
995
  $env: string;
981
996
  } | undefined;
@@ -987,6 +1002,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
987
1002
  } | undefined;
988
1003
  }>,
989
1004
  z.ZodObject<{
1005
+ timeout: z.ZodOptional<z.ZodNumber>;
990
1006
  system: z.ZodLiteral<"elasticsearch">;
991
1007
  protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<[
992
1008
  "http",
@@ -1084,6 +1100,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1084
1100
  };
1085
1101
  rejectUnauthorized: boolean;
1086
1102
  protocol: "http" | "https";
1103
+ timeout?: number | undefined;
1087
1104
  nodes?: string[] | undefined;
1088
1105
  cloudId?: string | {
1089
1106
  $env: string;
@@ -1094,6 +1111,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1094
1111
  caPath?: string | undefined;
1095
1112
  }, {
1096
1113
  system: "elasticsearch";
1114
+ timeout?: number | undefined;
1097
1115
  password?: string | {
1098
1116
  $env: string;
1099
1117
  } | undefined;
@@ -1238,6 +1256,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1238
1256
  $env: string;
1239
1257
  };
1240
1258
  srv: boolean;
1259
+ timeout?: number | undefined;
1241
1260
  authSource?: string | {
1242
1261
  $env: string;
1243
1262
  } | undefined;
@@ -1265,6 +1284,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1265
1284
  database: string | {
1266
1285
  $env: string;
1267
1286
  };
1287
+ timeout?: number | undefined;
1268
1288
  } | {
1269
1289
  password: string | {
1270
1290
  $env: string;
@@ -1282,6 +1302,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1282
1302
  database: string | {
1283
1303
  $env: string;
1284
1304
  };
1305
+ timeout?: number | undefined;
1285
1306
  } | {
1286
1307
  password: string | {
1287
1308
  $env: string;
@@ -1301,6 +1322,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1301
1322
  };
1302
1323
  rejectUnauthorized: boolean;
1303
1324
  protocol: "http" | "https";
1325
+ timeout?: number | undefined;
1304
1326
  nodes?: string[] | undefined;
1305
1327
  cloudId?: string | {
1306
1328
  $env: string;
@@ -1320,6 +1342,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1320
1342
  }, {
1321
1343
  connection: {
1322
1344
  system: "mongodb";
1345
+ timeout?: number | undefined;
1323
1346
  password?: string | {
1324
1347
  $env: string;
1325
1348
  } | undefined;
@@ -1360,6 +1383,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1360
1383
  database: string | {
1361
1384
  $env: string;
1362
1385
  };
1386
+ timeout?: number | undefined;
1363
1387
  password?: string | {
1364
1388
  $env: string;
1365
1389
  } | undefined;
@@ -1371,6 +1395,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1371
1395
  port: number | {
1372
1396
  $env: string;
1373
1397
  };
1398
+ timeout?: number | undefined;
1374
1399
  password?: string | {
1375
1400
  $env: string;
1376
1401
  } | undefined;
@@ -1382,6 +1407,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
1382
1407
  } | undefined;
1383
1408
  } | {
1384
1409
  system: "elasticsearch";
1410
+ timeout?: number | undefined;
1385
1411
  password?: string | {
1386
1412
  $env: string;
1387
1413
  } | undefined;
@@ -1443,6 +1469,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1443
1469
  default: z.ZodString;
1444
1470
  connections: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[
1445
1471
  z.ZodObject<{
1472
+ timeout: z.ZodOptional<z.ZodNumber>;
1446
1473
  system: z.ZodEnum<[
1447
1474
  "postgresql",
1448
1475
  "mysql",
@@ -1525,6 +1552,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1525
1552
  $env: string;
1526
1553
  };
1527
1554
  permission: "admin" | "query-only" | "read-write" | "data-admin";
1555
+ timeout?: number | undefined;
1528
1556
  envFile?: string | undefined;
1529
1557
  environment?: string | undefined;
1530
1558
  }, {
@@ -1541,6 +1569,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1541
1569
  database: string | {
1542
1570
  $env: string;
1543
1571
  };
1572
+ timeout?: number | undefined;
1544
1573
  password?: string | {
1545
1574
  $env: string;
1546
1575
  } | undefined;
@@ -1549,6 +1578,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1549
1578
  environment?: string | undefined;
1550
1579
  }>,
1551
1580
  z.ZodObject<{
1581
+ timeout: z.ZodOptional<z.ZodNumber>;
1552
1582
  system: z.ZodLiteral<"mongodb">;
1553
1583
  uri: z.ZodOptional<z.ZodUnion<[
1554
1584
  z.ZodString,
@@ -1660,6 +1690,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1660
1690
  };
1661
1691
  srv: boolean;
1662
1692
  permission: "admin" | "query-only" | "read-write" | "data-admin";
1693
+ timeout?: number | undefined;
1663
1694
  authSource?: string | {
1664
1695
  $env: string;
1665
1696
  } | undefined;
@@ -1674,6 +1705,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1674
1705
  environment?: string | undefined;
1675
1706
  }, {
1676
1707
  system: "mongodb";
1708
+ timeout?: number | undefined;
1677
1709
  password?: string | {
1678
1710
  $env: string;
1679
1711
  } | undefined;
@@ -1705,6 +1737,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1705
1737
  environment?: string | undefined;
1706
1738
  }>,
1707
1739
  z.ZodObject<{
1740
+ timeout: z.ZodOptional<z.ZodNumber>;
1708
1741
  system: z.ZodLiteral<"redis">;
1709
1742
  host: z.ZodUnion<[
1710
1743
  z.ZodString,
@@ -1783,6 +1816,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1783
1816
  $env: string;
1784
1817
  };
1785
1818
  permission: "admin" | "query-only" | "read-write" | "data-admin";
1819
+ timeout?: number | undefined;
1786
1820
  envFile?: string | undefined;
1787
1821
  environment?: string | undefined;
1788
1822
  }, {
@@ -1793,6 +1827,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1793
1827
  port: number | {
1794
1828
  $env: string;
1795
1829
  };
1830
+ timeout?: number | undefined;
1796
1831
  password?: string | {
1797
1832
  $env: string;
1798
1833
  } | undefined;
@@ -1807,6 +1842,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1807
1842
  environment?: string | undefined;
1808
1843
  }>,
1809
1844
  z.ZodObject<{
1845
+ timeout: z.ZodOptional<z.ZodNumber>;
1810
1846
  system: z.ZodLiteral<"elasticsearch">;
1811
1847
  protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<[
1812
1848
  "http",
@@ -1914,6 +1950,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1914
1950
  rejectUnauthorized: boolean;
1915
1951
  protocol: "http" | "https";
1916
1952
  permission: "admin" | "query-only" | "read-write" | "data-admin";
1953
+ timeout?: number | undefined;
1917
1954
  nodes?: string[] | undefined;
1918
1955
  cloudId?: string | {
1919
1956
  $env: string;
@@ -1926,6 +1963,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1926
1963
  environment?: string | undefined;
1927
1964
  }, {
1928
1965
  system: "elasticsearch";
1966
+ timeout?: number | undefined;
1929
1967
  password?: string | {
1930
1968
  $env: string;
1931
1969
  } | undefined;
@@ -1973,6 +2011,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1973
2011
  $env: string;
1974
2012
  };
1975
2013
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2014
+ timeout?: number | undefined;
1976
2015
  envFile?: string | undefined;
1977
2016
  environment?: string | undefined;
1978
2017
  } | {
@@ -1994,6 +2033,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
1994
2033
  };
1995
2034
  srv: boolean;
1996
2035
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2036
+ timeout?: number | undefined;
1997
2037
  authSource?: string | {
1998
2038
  $env: string;
1999
2039
  } | undefined;
@@ -2024,6 +2064,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2024
2064
  $env: string;
2025
2065
  };
2026
2066
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2067
+ timeout?: number | undefined;
2027
2068
  envFile?: string | undefined;
2028
2069
  environment?: string | undefined;
2029
2070
  } | {
@@ -2046,6 +2087,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2046
2087
  rejectUnauthorized: boolean;
2047
2088
  protocol: "http" | "https";
2048
2089
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2090
+ timeout?: number | undefined;
2049
2091
  nodes?: string[] | undefined;
2050
2092
  cloudId?: string | {
2051
2093
  $env: string;
@@ -2070,6 +2112,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2070
2112
  database: string | {
2071
2113
  $env: string;
2072
2114
  };
2115
+ timeout?: number | undefined;
2073
2116
  password?: string | {
2074
2117
  $env: string;
2075
2118
  } | undefined;
@@ -2078,6 +2121,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2078
2121
  environment?: string | undefined;
2079
2122
  } | {
2080
2123
  system: "mongodb";
2124
+ timeout?: number | undefined;
2081
2125
  password?: string | {
2082
2126
  $env: string;
2083
2127
  } | undefined;
@@ -2115,6 +2159,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2115
2159
  port: number | {
2116
2160
  $env: string;
2117
2161
  };
2162
+ timeout?: number | undefined;
2118
2163
  password?: string | {
2119
2164
  $env: string;
2120
2165
  } | undefined;
@@ -2129,6 +2174,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2129
2174
  environment?: string | undefined;
2130
2175
  } | {
2131
2176
  system: "elasticsearch";
2177
+ timeout?: number | undefined;
2132
2178
  password?: string | {
2133
2179
  $env: string;
2134
2180
  } | undefined;
@@ -2272,6 +2318,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2272
2318
  $env: string;
2273
2319
  };
2274
2320
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2321
+ timeout?: number | undefined;
2275
2322
  envFile?: string | undefined;
2276
2323
  environment?: string | undefined;
2277
2324
  } | {
@@ -2293,6 +2340,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2293
2340
  };
2294
2341
  srv: boolean;
2295
2342
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2343
+ timeout?: number | undefined;
2296
2344
  authSource?: string | {
2297
2345
  $env: string;
2298
2346
  } | undefined;
@@ -2323,6 +2371,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2323
2371
  $env: string;
2324
2372
  };
2325
2373
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2374
+ timeout?: number | undefined;
2326
2375
  envFile?: string | undefined;
2327
2376
  environment?: string | undefined;
2328
2377
  } | {
@@ -2345,6 +2394,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2345
2394
  rejectUnauthorized: boolean;
2346
2395
  protocol: "http" | "https";
2347
2396
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2397
+ timeout?: number | undefined;
2348
2398
  nodes?: string[] | undefined;
2349
2399
  cloudId?: string | {
2350
2400
  $env: string;
@@ -2380,6 +2430,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2380
2430
  database: string | {
2381
2431
  $env: string;
2382
2432
  };
2433
+ timeout?: number | undefined;
2383
2434
  password?: string | {
2384
2435
  $env: string;
2385
2436
  } | undefined;
@@ -2388,6 +2439,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2388
2439
  environment?: string | undefined;
2389
2440
  } | {
2390
2441
  system: "mongodb";
2442
+ timeout?: number | undefined;
2391
2443
  password?: string | {
2392
2444
  $env: string;
2393
2445
  } | undefined;
@@ -2425,6 +2477,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2425
2477
  port: number | {
2426
2478
  $env: string;
2427
2479
  };
2480
+ timeout?: number | undefined;
2428
2481
  password?: string | {
2429
2482
  $env: string;
2430
2483
  } | undefined;
@@ -2439,6 +2492,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2439
2492
  environment?: string | undefined;
2440
2493
  } | {
2441
2494
  system: "elasticsearch";
2495
+ timeout?: number | undefined;
2442
2496
  password?: string | {
2443
2497
  $env: string;
2444
2498
  } | undefined;
@@ -2532,6 +2586,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2532
2586
  $env: string;
2533
2587
  };
2534
2588
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2589
+ timeout?: number | undefined;
2535
2590
  envFile?: string | undefined;
2536
2591
  environment?: string | undefined;
2537
2592
  } | {
@@ -2553,6 +2608,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2553
2608
  };
2554
2609
  srv: boolean;
2555
2610
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2611
+ timeout?: number | undefined;
2556
2612
  authSource?: string | {
2557
2613
  $env: string;
2558
2614
  } | undefined;
@@ -2583,6 +2639,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2583
2639
  $env: string;
2584
2640
  };
2585
2641
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2642
+ timeout?: number | undefined;
2586
2643
  envFile?: string | undefined;
2587
2644
  environment?: string | undefined;
2588
2645
  } | {
@@ -2605,6 +2662,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2605
2662
  rejectUnauthorized: boolean;
2606
2663
  protocol: "http" | "https";
2607
2664
  permission: "admin" | "query-only" | "read-write" | "data-admin";
2665
+ timeout?: number | undefined;
2608
2666
  nodes?: string[] | undefined;
2609
2667
  cloudId?: string | {
2610
2668
  $env: string;
@@ -2640,6 +2698,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2640
2698
  database: string | {
2641
2699
  $env: string;
2642
2700
  };
2701
+ timeout?: number | undefined;
2643
2702
  password?: string | {
2644
2703
  $env: string;
2645
2704
  } | undefined;
@@ -2648,6 +2707,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2648
2707
  environment?: string | undefined;
2649
2708
  } | {
2650
2709
  system: "mongodb";
2710
+ timeout?: number | undefined;
2651
2711
  password?: string | {
2652
2712
  $env: string;
2653
2713
  } | undefined;
@@ -2685,6 +2745,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2685
2745
  port: number | {
2686
2746
  $env: string;
2687
2747
  };
2748
+ timeout?: number | undefined;
2688
2749
  password?: string | {
2689
2750
  $env: string;
2690
2751
  } | undefined;
@@ -2699,6 +2760,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
2699
2760
  environment?: string | undefined;
2700
2761
  } | {
2701
2762
  system: "elasticsearch";
2763
+ timeout?: number | undefined;
2702
2764
  password?: string | {
2703
2765
  $env: string;
2704
2766
  } | undefined;
@@ -2777,7 +2839,18 @@ export declare class QueryExecutor {
2777
2839
  connectionName?: string;
2778
2840
  recovery?: boolean;
2779
2841
  deferDiagnostics?: boolean;
2842
+ /**
2843
+ * Quoting rules that decide what counts as a statement separator differ
2844
+ * per dialect. Without this, the stacking check has to fail closed.
2845
+ */
2846
+ dialect?: SqlDialect;
2780
2847
  });
2848
+ /**
2849
+ * The dialect the statement will actually run under. Falls back to the
2850
+ * connection config, then to undefined — where the stacking check fails
2851
+ * closed rather than guessing.
2852
+ */
2853
+ private resolveDialect;
2781
2854
  takeDiagnostics(): string[];
2782
2855
  /**
2783
2856
  * Execute a SQL query with permission enforcement and error handling