@carllee1983/dbcli 1.46.0 → 1.47.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor/rules/dbcli.mdc +5 -2
- package/.cursor/skills/dbcli/reference.md +30 -2
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/SKILL.md +5 -2
- package/.github/skills/dbcli/reference.md +30 -2
- package/CHANGELOG.md +14 -0
- package/assets/SKILL.md +5 -2
- package/assets/SKILL.zh-TW.md +4 -2
- package/assets/reference.md +30 -2
- package/dist/cli.mjs +725 -11288
- package/dist/core.d.ts +59 -3
- package/dist/core.mjs +127 -8
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
- package/plugins/dbcli-agent/.codex-plugin/plugin.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/SKILL.md +5 -2
- package/plugins/dbcli-agent/skills/dbcli/reference.md +30 -2
- package/skills/dbcli/SKILL.md +5 -2
- package/skills/dbcli/reference.md +30 -2
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(
|
|
359
|
-
static createQueryableAdapter(
|
|
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(
|
|
364
|
+
static createRedisAdapter(rawOptions: ConnectionOptions, blacklistRules?: string[], maskRules?: RedisMaskRule[]): QueryableAdapter;
|
|
365
365
|
static createElasticsearchAdapter(options: ConnectionOptions): QueryableAdapter;
|
|
366
366
|
}
|
|
367
367
|
/**
|
|
@@ -668,6 +668,7 @@ export declare class BlacklistValidator {
|
|
|
668
668
|
declare const DbcliConfigSchema: z.ZodObject<{
|
|
669
669
|
connection: z.ZodUnion<[
|
|
670
670
|
z.ZodObject<{
|
|
671
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
671
672
|
system: z.ZodEnum<[
|
|
672
673
|
"postgresql",
|
|
673
674
|
"mysql",
|
|
@@ -740,6 +741,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
740
741
|
database: string | {
|
|
741
742
|
$env: string;
|
|
742
743
|
};
|
|
744
|
+
timeout?: number | undefined;
|
|
743
745
|
}, {
|
|
744
746
|
user: string | {
|
|
745
747
|
$env: string;
|
|
@@ -754,11 +756,13 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
754
756
|
database: string | {
|
|
755
757
|
$env: string;
|
|
756
758
|
};
|
|
759
|
+
timeout?: number | undefined;
|
|
757
760
|
password?: string | {
|
|
758
761
|
$env: string;
|
|
759
762
|
} | undefined;
|
|
760
763
|
}>,
|
|
761
764
|
z.ZodObject<{
|
|
765
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
762
766
|
system: z.ZodLiteral<"mongodb">;
|
|
763
767
|
uri: z.ZodOptional<z.ZodUnion<[
|
|
764
768
|
z.ZodString,
|
|
@@ -860,6 +864,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
860
864
|
$env: string;
|
|
861
865
|
};
|
|
862
866
|
srv: boolean;
|
|
867
|
+
timeout?: number | undefined;
|
|
863
868
|
authSource?: string | {
|
|
864
869
|
$env: string;
|
|
865
870
|
} | undefined;
|
|
@@ -872,6 +877,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
872
877
|
} | undefined;
|
|
873
878
|
}, {
|
|
874
879
|
system: "mongodb";
|
|
880
|
+
timeout?: number | undefined;
|
|
875
881
|
password?: string | {
|
|
876
882
|
$env: string;
|
|
877
883
|
} | undefined;
|
|
@@ -900,6 +906,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
900
906
|
} | undefined;
|
|
901
907
|
}>,
|
|
902
908
|
z.ZodObject<{
|
|
909
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
903
910
|
system: z.ZodLiteral<"redis">;
|
|
904
911
|
host: z.ZodUnion<[
|
|
905
912
|
z.ZodString,
|
|
@@ -968,6 +975,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
968
975
|
database: string | {
|
|
969
976
|
$env: string;
|
|
970
977
|
};
|
|
978
|
+
timeout?: number | undefined;
|
|
971
979
|
}, {
|
|
972
980
|
system: "redis";
|
|
973
981
|
host: string | {
|
|
@@ -976,6 +984,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
976
984
|
port: number | {
|
|
977
985
|
$env: string;
|
|
978
986
|
};
|
|
987
|
+
timeout?: number | undefined;
|
|
979
988
|
password?: string | {
|
|
980
989
|
$env: string;
|
|
981
990
|
} | undefined;
|
|
@@ -987,6 +996,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
987
996
|
} | undefined;
|
|
988
997
|
}>,
|
|
989
998
|
z.ZodObject<{
|
|
999
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
990
1000
|
system: z.ZodLiteral<"elasticsearch">;
|
|
991
1001
|
protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<[
|
|
992
1002
|
"http",
|
|
@@ -1084,6 +1094,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1084
1094
|
};
|
|
1085
1095
|
rejectUnauthorized: boolean;
|
|
1086
1096
|
protocol: "http" | "https";
|
|
1097
|
+
timeout?: number | undefined;
|
|
1087
1098
|
nodes?: string[] | undefined;
|
|
1088
1099
|
cloudId?: string | {
|
|
1089
1100
|
$env: string;
|
|
@@ -1094,6 +1105,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1094
1105
|
caPath?: string | undefined;
|
|
1095
1106
|
}, {
|
|
1096
1107
|
system: "elasticsearch";
|
|
1108
|
+
timeout?: number | undefined;
|
|
1097
1109
|
password?: string | {
|
|
1098
1110
|
$env: string;
|
|
1099
1111
|
} | undefined;
|
|
@@ -1238,6 +1250,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1238
1250
|
$env: string;
|
|
1239
1251
|
};
|
|
1240
1252
|
srv: boolean;
|
|
1253
|
+
timeout?: number | undefined;
|
|
1241
1254
|
authSource?: string | {
|
|
1242
1255
|
$env: string;
|
|
1243
1256
|
} | undefined;
|
|
@@ -1265,6 +1278,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1265
1278
|
database: string | {
|
|
1266
1279
|
$env: string;
|
|
1267
1280
|
};
|
|
1281
|
+
timeout?: number | undefined;
|
|
1268
1282
|
} | {
|
|
1269
1283
|
password: string | {
|
|
1270
1284
|
$env: string;
|
|
@@ -1282,6 +1296,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1282
1296
|
database: string | {
|
|
1283
1297
|
$env: string;
|
|
1284
1298
|
};
|
|
1299
|
+
timeout?: number | undefined;
|
|
1285
1300
|
} | {
|
|
1286
1301
|
password: string | {
|
|
1287
1302
|
$env: string;
|
|
@@ -1301,6 +1316,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1301
1316
|
};
|
|
1302
1317
|
rejectUnauthorized: boolean;
|
|
1303
1318
|
protocol: "http" | "https";
|
|
1319
|
+
timeout?: number | undefined;
|
|
1304
1320
|
nodes?: string[] | undefined;
|
|
1305
1321
|
cloudId?: string | {
|
|
1306
1322
|
$env: string;
|
|
@@ -1320,6 +1336,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1320
1336
|
}, {
|
|
1321
1337
|
connection: {
|
|
1322
1338
|
system: "mongodb";
|
|
1339
|
+
timeout?: number | undefined;
|
|
1323
1340
|
password?: string | {
|
|
1324
1341
|
$env: string;
|
|
1325
1342
|
} | undefined;
|
|
@@ -1360,6 +1377,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1360
1377
|
database: string | {
|
|
1361
1378
|
$env: string;
|
|
1362
1379
|
};
|
|
1380
|
+
timeout?: number | undefined;
|
|
1363
1381
|
password?: string | {
|
|
1364
1382
|
$env: string;
|
|
1365
1383
|
} | undefined;
|
|
@@ -1371,6 +1389,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1371
1389
|
port: number | {
|
|
1372
1390
|
$env: string;
|
|
1373
1391
|
};
|
|
1392
|
+
timeout?: number | undefined;
|
|
1374
1393
|
password?: string | {
|
|
1375
1394
|
$env: string;
|
|
1376
1395
|
} | undefined;
|
|
@@ -1382,6 +1401,7 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1382
1401
|
} | undefined;
|
|
1383
1402
|
} | {
|
|
1384
1403
|
system: "elasticsearch";
|
|
1404
|
+
timeout?: number | undefined;
|
|
1385
1405
|
password?: string | {
|
|
1386
1406
|
$env: string;
|
|
1387
1407
|
} | undefined;
|
|
@@ -1443,6 +1463,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1443
1463
|
default: z.ZodString;
|
|
1444
1464
|
connections: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[
|
|
1445
1465
|
z.ZodObject<{
|
|
1466
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
1446
1467
|
system: z.ZodEnum<[
|
|
1447
1468
|
"postgresql",
|
|
1448
1469
|
"mysql",
|
|
@@ -1525,6 +1546,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1525
1546
|
$env: string;
|
|
1526
1547
|
};
|
|
1527
1548
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
1549
|
+
timeout?: number | undefined;
|
|
1528
1550
|
envFile?: string | undefined;
|
|
1529
1551
|
environment?: string | undefined;
|
|
1530
1552
|
}, {
|
|
@@ -1541,6 +1563,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1541
1563
|
database: string | {
|
|
1542
1564
|
$env: string;
|
|
1543
1565
|
};
|
|
1566
|
+
timeout?: number | undefined;
|
|
1544
1567
|
password?: string | {
|
|
1545
1568
|
$env: string;
|
|
1546
1569
|
} | undefined;
|
|
@@ -1549,6 +1572,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1549
1572
|
environment?: string | undefined;
|
|
1550
1573
|
}>,
|
|
1551
1574
|
z.ZodObject<{
|
|
1575
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
1552
1576
|
system: z.ZodLiteral<"mongodb">;
|
|
1553
1577
|
uri: z.ZodOptional<z.ZodUnion<[
|
|
1554
1578
|
z.ZodString,
|
|
@@ -1660,6 +1684,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1660
1684
|
};
|
|
1661
1685
|
srv: boolean;
|
|
1662
1686
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
1687
|
+
timeout?: number | undefined;
|
|
1663
1688
|
authSource?: string | {
|
|
1664
1689
|
$env: string;
|
|
1665
1690
|
} | undefined;
|
|
@@ -1674,6 +1699,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1674
1699
|
environment?: string | undefined;
|
|
1675
1700
|
}, {
|
|
1676
1701
|
system: "mongodb";
|
|
1702
|
+
timeout?: number | undefined;
|
|
1677
1703
|
password?: string | {
|
|
1678
1704
|
$env: string;
|
|
1679
1705
|
} | undefined;
|
|
@@ -1705,6 +1731,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1705
1731
|
environment?: string | undefined;
|
|
1706
1732
|
}>,
|
|
1707
1733
|
z.ZodObject<{
|
|
1734
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
1708
1735
|
system: z.ZodLiteral<"redis">;
|
|
1709
1736
|
host: z.ZodUnion<[
|
|
1710
1737
|
z.ZodString,
|
|
@@ -1783,6 +1810,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1783
1810
|
$env: string;
|
|
1784
1811
|
};
|
|
1785
1812
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
1813
|
+
timeout?: number | undefined;
|
|
1786
1814
|
envFile?: string | undefined;
|
|
1787
1815
|
environment?: string | undefined;
|
|
1788
1816
|
}, {
|
|
@@ -1793,6 +1821,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1793
1821
|
port: number | {
|
|
1794
1822
|
$env: string;
|
|
1795
1823
|
};
|
|
1824
|
+
timeout?: number | undefined;
|
|
1796
1825
|
password?: string | {
|
|
1797
1826
|
$env: string;
|
|
1798
1827
|
} | undefined;
|
|
@@ -1807,6 +1836,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1807
1836
|
environment?: string | undefined;
|
|
1808
1837
|
}>,
|
|
1809
1838
|
z.ZodObject<{
|
|
1839
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
1810
1840
|
system: z.ZodLiteral<"elasticsearch">;
|
|
1811
1841
|
protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<[
|
|
1812
1842
|
"http",
|
|
@@ -1914,6 +1944,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1914
1944
|
rejectUnauthorized: boolean;
|
|
1915
1945
|
protocol: "http" | "https";
|
|
1916
1946
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
1947
|
+
timeout?: number | undefined;
|
|
1917
1948
|
nodes?: string[] | undefined;
|
|
1918
1949
|
cloudId?: string | {
|
|
1919
1950
|
$env: string;
|
|
@@ -1926,6 +1957,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1926
1957
|
environment?: string | undefined;
|
|
1927
1958
|
}, {
|
|
1928
1959
|
system: "elasticsearch";
|
|
1960
|
+
timeout?: number | undefined;
|
|
1929
1961
|
password?: string | {
|
|
1930
1962
|
$env: string;
|
|
1931
1963
|
} | undefined;
|
|
@@ -1973,6 +2005,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1973
2005
|
$env: string;
|
|
1974
2006
|
};
|
|
1975
2007
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2008
|
+
timeout?: number | undefined;
|
|
1976
2009
|
envFile?: string | undefined;
|
|
1977
2010
|
environment?: string | undefined;
|
|
1978
2011
|
} | {
|
|
@@ -1994,6 +2027,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
1994
2027
|
};
|
|
1995
2028
|
srv: boolean;
|
|
1996
2029
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2030
|
+
timeout?: number | undefined;
|
|
1997
2031
|
authSource?: string | {
|
|
1998
2032
|
$env: string;
|
|
1999
2033
|
} | undefined;
|
|
@@ -2024,6 +2058,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2024
2058
|
$env: string;
|
|
2025
2059
|
};
|
|
2026
2060
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2061
|
+
timeout?: number | undefined;
|
|
2027
2062
|
envFile?: string | undefined;
|
|
2028
2063
|
environment?: string | undefined;
|
|
2029
2064
|
} | {
|
|
@@ -2046,6 +2081,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2046
2081
|
rejectUnauthorized: boolean;
|
|
2047
2082
|
protocol: "http" | "https";
|
|
2048
2083
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2084
|
+
timeout?: number | undefined;
|
|
2049
2085
|
nodes?: string[] | undefined;
|
|
2050
2086
|
cloudId?: string | {
|
|
2051
2087
|
$env: string;
|
|
@@ -2070,6 +2106,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2070
2106
|
database: string | {
|
|
2071
2107
|
$env: string;
|
|
2072
2108
|
};
|
|
2109
|
+
timeout?: number | undefined;
|
|
2073
2110
|
password?: string | {
|
|
2074
2111
|
$env: string;
|
|
2075
2112
|
} | undefined;
|
|
@@ -2078,6 +2115,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2078
2115
|
environment?: string | undefined;
|
|
2079
2116
|
} | {
|
|
2080
2117
|
system: "mongodb";
|
|
2118
|
+
timeout?: number | undefined;
|
|
2081
2119
|
password?: string | {
|
|
2082
2120
|
$env: string;
|
|
2083
2121
|
} | undefined;
|
|
@@ -2115,6 +2153,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2115
2153
|
port: number | {
|
|
2116
2154
|
$env: string;
|
|
2117
2155
|
};
|
|
2156
|
+
timeout?: number | undefined;
|
|
2118
2157
|
password?: string | {
|
|
2119
2158
|
$env: string;
|
|
2120
2159
|
} | undefined;
|
|
@@ -2129,6 +2168,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2129
2168
|
environment?: string | undefined;
|
|
2130
2169
|
} | {
|
|
2131
2170
|
system: "elasticsearch";
|
|
2171
|
+
timeout?: number | undefined;
|
|
2132
2172
|
password?: string | {
|
|
2133
2173
|
$env: string;
|
|
2134
2174
|
} | undefined;
|
|
@@ -2272,6 +2312,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2272
2312
|
$env: string;
|
|
2273
2313
|
};
|
|
2274
2314
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2315
|
+
timeout?: number | undefined;
|
|
2275
2316
|
envFile?: string | undefined;
|
|
2276
2317
|
environment?: string | undefined;
|
|
2277
2318
|
} | {
|
|
@@ -2293,6 +2334,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2293
2334
|
};
|
|
2294
2335
|
srv: boolean;
|
|
2295
2336
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2337
|
+
timeout?: number | undefined;
|
|
2296
2338
|
authSource?: string | {
|
|
2297
2339
|
$env: string;
|
|
2298
2340
|
} | undefined;
|
|
@@ -2323,6 +2365,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2323
2365
|
$env: string;
|
|
2324
2366
|
};
|
|
2325
2367
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2368
|
+
timeout?: number | undefined;
|
|
2326
2369
|
envFile?: string | undefined;
|
|
2327
2370
|
environment?: string | undefined;
|
|
2328
2371
|
} | {
|
|
@@ -2345,6 +2388,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2345
2388
|
rejectUnauthorized: boolean;
|
|
2346
2389
|
protocol: "http" | "https";
|
|
2347
2390
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2391
|
+
timeout?: number | undefined;
|
|
2348
2392
|
nodes?: string[] | undefined;
|
|
2349
2393
|
cloudId?: string | {
|
|
2350
2394
|
$env: string;
|
|
@@ -2380,6 +2424,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2380
2424
|
database: string | {
|
|
2381
2425
|
$env: string;
|
|
2382
2426
|
};
|
|
2427
|
+
timeout?: number | undefined;
|
|
2383
2428
|
password?: string | {
|
|
2384
2429
|
$env: string;
|
|
2385
2430
|
} | undefined;
|
|
@@ -2388,6 +2433,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2388
2433
|
environment?: string | undefined;
|
|
2389
2434
|
} | {
|
|
2390
2435
|
system: "mongodb";
|
|
2436
|
+
timeout?: number | undefined;
|
|
2391
2437
|
password?: string | {
|
|
2392
2438
|
$env: string;
|
|
2393
2439
|
} | undefined;
|
|
@@ -2425,6 +2471,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2425
2471
|
port: number | {
|
|
2426
2472
|
$env: string;
|
|
2427
2473
|
};
|
|
2474
|
+
timeout?: number | undefined;
|
|
2428
2475
|
password?: string | {
|
|
2429
2476
|
$env: string;
|
|
2430
2477
|
} | undefined;
|
|
@@ -2439,6 +2486,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2439
2486
|
environment?: string | undefined;
|
|
2440
2487
|
} | {
|
|
2441
2488
|
system: "elasticsearch";
|
|
2489
|
+
timeout?: number | undefined;
|
|
2442
2490
|
password?: string | {
|
|
2443
2491
|
$env: string;
|
|
2444
2492
|
} | undefined;
|
|
@@ -2532,6 +2580,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2532
2580
|
$env: string;
|
|
2533
2581
|
};
|
|
2534
2582
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2583
|
+
timeout?: number | undefined;
|
|
2535
2584
|
envFile?: string | undefined;
|
|
2536
2585
|
environment?: string | undefined;
|
|
2537
2586
|
} | {
|
|
@@ -2553,6 +2602,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2553
2602
|
};
|
|
2554
2603
|
srv: boolean;
|
|
2555
2604
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2605
|
+
timeout?: number | undefined;
|
|
2556
2606
|
authSource?: string | {
|
|
2557
2607
|
$env: string;
|
|
2558
2608
|
} | undefined;
|
|
@@ -2583,6 +2633,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2583
2633
|
$env: string;
|
|
2584
2634
|
};
|
|
2585
2635
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2636
|
+
timeout?: number | undefined;
|
|
2586
2637
|
envFile?: string | undefined;
|
|
2587
2638
|
environment?: string | undefined;
|
|
2588
2639
|
} | {
|
|
@@ -2605,6 +2656,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2605
2656
|
rejectUnauthorized: boolean;
|
|
2606
2657
|
protocol: "http" | "https";
|
|
2607
2658
|
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2659
|
+
timeout?: number | undefined;
|
|
2608
2660
|
nodes?: string[] | undefined;
|
|
2609
2661
|
cloudId?: string | {
|
|
2610
2662
|
$env: string;
|
|
@@ -2640,6 +2692,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2640
2692
|
database: string | {
|
|
2641
2693
|
$env: string;
|
|
2642
2694
|
};
|
|
2695
|
+
timeout?: number | undefined;
|
|
2643
2696
|
password?: string | {
|
|
2644
2697
|
$env: string;
|
|
2645
2698
|
} | undefined;
|
|
@@ -2648,6 +2701,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2648
2701
|
environment?: string | undefined;
|
|
2649
2702
|
} | {
|
|
2650
2703
|
system: "mongodb";
|
|
2704
|
+
timeout?: number | undefined;
|
|
2651
2705
|
password?: string | {
|
|
2652
2706
|
$env: string;
|
|
2653
2707
|
} | undefined;
|
|
@@ -2685,6 +2739,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2685
2739
|
port: number | {
|
|
2686
2740
|
$env: string;
|
|
2687
2741
|
};
|
|
2742
|
+
timeout?: number | undefined;
|
|
2688
2743
|
password?: string | {
|
|
2689
2744
|
$env: string;
|
|
2690
2745
|
} | undefined;
|
|
@@ -2699,6 +2754,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2699
2754
|
environment?: string | undefined;
|
|
2700
2755
|
} | {
|
|
2701
2756
|
system: "elasticsearch";
|
|
2757
|
+
timeout?: number | undefined;
|
|
2702
2758
|
password?: string | {
|
|
2703
2759
|
$env: string;
|
|
2704
2760
|
} | undefined;
|
package/dist/core.mjs
CHANGED
|
@@ -16725,9 +16725,22 @@ class ElasticsearchAdapter {
|
|
|
16725
16725
|
}
|
|
16726
16726
|
}
|
|
16727
16727
|
|
|
16728
|
+
// src/utils/connection-timeout.ts
|
|
16729
|
+
var _globalConnectionTimeout;
|
|
16730
|
+
function resolveConnectionTimeout(configured) {
|
|
16731
|
+
return _globalConnectionTimeout ?? configured;
|
|
16732
|
+
}
|
|
16733
|
+
function withResolvedTimeout(options) {
|
|
16734
|
+
const timeout = resolveConnectionTimeout(options.timeout);
|
|
16735
|
+
if (timeout === options.timeout)
|
|
16736
|
+
return options;
|
|
16737
|
+
return { ...options, timeout };
|
|
16738
|
+
}
|
|
16739
|
+
|
|
16728
16740
|
// src/adapters/factory.ts
|
|
16729
16741
|
class AdapterFactory {
|
|
16730
|
-
static createSqlAdapter(
|
|
16742
|
+
static createSqlAdapter(rawOptions) {
|
|
16743
|
+
const options = withResolvedTimeout(rawOptions);
|
|
16731
16744
|
switch (options.system) {
|
|
16732
16745
|
case "postgresql":
|
|
16733
16746
|
return new PostgreSQLAdapter(options);
|
|
@@ -16738,7 +16751,8 @@ class AdapterFactory {
|
|
|
16738
16751
|
throw new Error(`createSqlAdapter requires a SQL system, got: ${options.system}`);
|
|
16739
16752
|
}
|
|
16740
16753
|
}
|
|
16741
|
-
static createQueryableAdapter(
|
|
16754
|
+
static createQueryableAdapter(rawOptions) {
|
|
16755
|
+
const options = withResolvedTimeout(rawOptions);
|
|
16742
16756
|
switch (options.system) {
|
|
16743
16757
|
case "mongodb":
|
|
16744
16758
|
return new MongoDBAdapter(options);
|
|
@@ -16770,10 +16784,11 @@ class AdapterFactory {
|
|
|
16770
16784
|
}
|
|
16771
16785
|
return AdapterFactory.createQueryableAdapter(options);
|
|
16772
16786
|
}
|
|
16773
|
-
static createRedisAdapter(
|
|
16774
|
-
if (
|
|
16787
|
+
static createRedisAdapter(rawOptions, blacklistRules = [], maskRules = []) {
|
|
16788
|
+
if (rawOptions.system !== "redis") {
|
|
16775
16789
|
throw new Error("createRedisAdapter requires system: redis");
|
|
16776
16790
|
}
|
|
16791
|
+
const options = withResolvedTimeout(rawOptions);
|
|
16777
16792
|
const adapter = new RedisAdapter(options);
|
|
16778
16793
|
adapter.setBlacklistRules(blacklistRules);
|
|
16779
16794
|
adapter.setMaskRules(maskRules);
|
|
@@ -21851,6 +21866,11 @@ var StringOrEnvRef = exports_external.union([exports_external.string().min(1), E
|
|
|
21851
21866
|
var NumberOrEnvRef = exports_external.union([exports_external.number().int().min(1).max(65535), EnvRefSchema]);
|
|
21852
21867
|
var OptStringOrEnvRef = exports_external.union([exports_external.string(), EnvRefSchema]).optional().default("");
|
|
21853
21868
|
var OptNumberOrEnvRef = exports_external.union([exports_external.number().int(), EnvRefSchema]).optional().default(27017);
|
|
21869
|
+
var MIN_CONNECTION_TIMEOUT_MS = 100;
|
|
21870
|
+
var MAX_CONNECTION_TIMEOUT_MS = 600000;
|
|
21871
|
+
var TimeoutField = {
|
|
21872
|
+
timeout: exports_external.number().int().min(MIN_CONNECTION_TIMEOUT_MS).max(MAX_CONNECTION_TIMEOUT_MS).optional()
|
|
21873
|
+
};
|
|
21854
21874
|
var MongoDBConnectionConfigSchema = exports_external.object({
|
|
21855
21875
|
system: exports_external.literal("mongodb"),
|
|
21856
21876
|
uri: exports_external.union([exports_external.string(), EnvRefSchema]).optional(),
|
|
@@ -21862,7 +21882,8 @@ var MongoDBConnectionConfigSchema = exports_external.object({
|
|
|
21862
21882
|
authSource: exports_external.union([exports_external.string(), EnvRefSchema]).optional(),
|
|
21863
21883
|
replicaSet: exports_external.union([exports_external.string(), EnvRefSchema]).optional(),
|
|
21864
21884
|
tls: exports_external.boolean().optional(),
|
|
21865
|
-
srv: exports_external.boolean().optional().default(false)
|
|
21885
|
+
srv: exports_external.boolean().optional().default(false),
|
|
21886
|
+
...TimeoutField
|
|
21866
21887
|
});
|
|
21867
21888
|
var SqlConnectionConfigSchema = exports_external.object({
|
|
21868
21889
|
system: exports_external.enum(["postgresql", "mysql", "mariadb"]),
|
|
@@ -21870,7 +21891,8 @@ var SqlConnectionConfigSchema = exports_external.object({
|
|
|
21870
21891
|
port: NumberOrEnvRef,
|
|
21871
21892
|
user: StringOrEnvRef,
|
|
21872
21893
|
password: exports_external.union([exports_external.string(), EnvRefSchema]).default(""),
|
|
21873
|
-
database: StringOrEnvRef
|
|
21894
|
+
database: StringOrEnvRef,
|
|
21895
|
+
...TimeoutField
|
|
21874
21896
|
});
|
|
21875
21897
|
var RedisConnectionConfigSchema = exports_external.object({
|
|
21876
21898
|
system: exports_external.literal("redis"),
|
|
@@ -21878,7 +21900,8 @@ var RedisConnectionConfigSchema = exports_external.object({
|
|
|
21878
21900
|
port: NumberOrEnvRef,
|
|
21879
21901
|
user: OptStringOrEnvRef,
|
|
21880
21902
|
password: exports_external.union([exports_external.string(), EnvRefSchema]).optional().default(""),
|
|
21881
|
-
database: OptStringOrEnvRef
|
|
21903
|
+
database: OptStringOrEnvRef,
|
|
21904
|
+
...TimeoutField
|
|
21882
21905
|
});
|
|
21883
21906
|
var ElasticsearchConnectionConfigSchema = exports_external.object({
|
|
21884
21907
|
system: exports_external.literal("elasticsearch"),
|
|
@@ -21892,7 +21915,8 @@ var ElasticsearchConnectionConfigSchema = exports_external.object({
|
|
|
21892
21915
|
cloudId: exports_external.union([exports_external.string(), EnvRefSchema]).optional(),
|
|
21893
21916
|
apiKey: exports_external.union([exports_external.string(), EnvRefSchema]).optional(),
|
|
21894
21917
|
caPath: exports_external.string().optional(),
|
|
21895
|
-
rejectUnauthorized: exports_external.boolean().optional().default(true)
|
|
21918
|
+
rejectUnauthorized: exports_external.boolean().optional().default(true),
|
|
21919
|
+
...TimeoutField
|
|
21896
21920
|
});
|
|
21897
21921
|
var ConnectionConfigSchema = exports_external.union([
|
|
21898
21922
|
SqlConnectionConfigSchema,
|
|
@@ -21982,6 +22006,89 @@ var DbcliConfigV2Schema = exports_external.object({
|
|
|
21982
22006
|
path: ["default"]
|
|
21983
22007
|
});
|
|
21984
22008
|
|
|
22009
|
+
// src/utils/config-error-format.ts
|
|
22010
|
+
var SUPPORTED_SYSTEMS = [
|
|
22011
|
+
"postgresql",
|
|
22012
|
+
"mysql",
|
|
22013
|
+
"mariadb",
|
|
22014
|
+
"mongodb",
|
|
22015
|
+
"redis",
|
|
22016
|
+
"elasticsearch"
|
|
22017
|
+
];
|
|
22018
|
+
function isConnectionNode(raw, path) {
|
|
22019
|
+
const last = path[path.length - 1];
|
|
22020
|
+
const parent = path[path.length - 2];
|
|
22021
|
+
if (last !== "connection" && parent !== "connections")
|
|
22022
|
+
return false;
|
|
22023
|
+
const node = valueAtPath(raw, path);
|
|
22024
|
+
return typeof node === "object" && node !== null && !Array.isArray(node);
|
|
22025
|
+
}
|
|
22026
|
+
function valueAtPath(raw, path) {
|
|
22027
|
+
let current = raw;
|
|
22028
|
+
for (const key of path) {
|
|
22029
|
+
if (current == null || typeof current !== "object")
|
|
22030
|
+
return;
|
|
22031
|
+
current = current[key];
|
|
22032
|
+
}
|
|
22033
|
+
return current;
|
|
22034
|
+
}
|
|
22035
|
+
function declaredSystem(raw, path) {
|
|
22036
|
+
const node = valueAtPath(raw, path);
|
|
22037
|
+
if (node == null || typeof node !== "object")
|
|
22038
|
+
return;
|
|
22039
|
+
const system = node.system;
|
|
22040
|
+
return typeof system === "string" ? system : undefined;
|
|
22041
|
+
}
|
|
22042
|
+
function branchMatchesSystem(issues) {
|
|
22043
|
+
return !issues.some((issue) => issue.path[issue.path.length - 1] === "system" && (issue.code === "invalid_literal" || issue.code === "invalid_enum_value" || issue.code === "invalid_type"));
|
|
22044
|
+
}
|
|
22045
|
+
function formatPath(path) {
|
|
22046
|
+
return path.length > 0 ? path.join(".") : "(root)";
|
|
22047
|
+
}
|
|
22048
|
+
function flattenIssues(issues, raw, basePath = []) {
|
|
22049
|
+
const flat = [];
|
|
22050
|
+
for (const issue of issues) {
|
|
22051
|
+
const fullPath = [...basePath, ...issue.path];
|
|
22052
|
+
if (issue.code === "invalid_union") {
|
|
22053
|
+
const system = declaredSystem(raw, fullPath);
|
|
22054
|
+
const branches = issue.unionErrors.map((error) => error.issues);
|
|
22055
|
+
const candidates = system ? branches.filter((branchIssues) => branchMatchesSystem(branchIssues)) : [];
|
|
22056
|
+
if (isConnectionNode(raw, fullPath) && candidates.length === 0) {
|
|
22057
|
+
flat.push({
|
|
22058
|
+
path: formatPath([...fullPath, "system"]),
|
|
22059
|
+
message: `must be one of ${SUPPORTED_SYSTEMS.join(" | ")}` + (system === undefined ? " (missing)" : ` (received '${system}')`)
|
|
22060
|
+
});
|
|
22061
|
+
continue;
|
|
22062
|
+
}
|
|
22063
|
+
const chosen = candidates[0] ?? branches.reduce((best, current) => current.length < best.length ? current : best, branches[0] ?? []);
|
|
22064
|
+
flat.push(...flattenIssues(chosen, raw, basePath));
|
|
22065
|
+
continue;
|
|
22066
|
+
}
|
|
22067
|
+
flat.push({ path: formatPath(fullPath), message: issue.message });
|
|
22068
|
+
}
|
|
22069
|
+
return flat;
|
|
22070
|
+
}
|
|
22071
|
+
function dedupe(issues) {
|
|
22072
|
+
const seen = new Set;
|
|
22073
|
+
return issues.filter((issue) => {
|
|
22074
|
+
const key = `${issue.path}\x00${issue.message}`;
|
|
22075
|
+
if (seen.has(key))
|
|
22076
|
+
return false;
|
|
22077
|
+
seen.add(key);
|
|
22078
|
+
return true;
|
|
22079
|
+
});
|
|
22080
|
+
}
|
|
22081
|
+
function formatConfigValidationError(error, raw) {
|
|
22082
|
+
const issues = dedupe(flattenIssues(error.issues, raw));
|
|
22083
|
+
if (issues.length === 0)
|
|
22084
|
+
return error.message;
|
|
22085
|
+
return issues.map((issue) => ` - ${issue.path}: ${issue.message}`).join(`
|
|
22086
|
+
`);
|
|
22087
|
+
}
|
|
22088
|
+
function isZodError(error) {
|
|
22089
|
+
return error instanceof Error && error.name === "ZodError" && Array.isArray(error.issues);
|
|
22090
|
+
}
|
|
22091
|
+
|
|
21985
22092
|
// src/agent-core/env-loader.ts
|
|
21986
22093
|
import { readFile as readFile3 } from "fs/promises";
|
|
21987
22094
|
function parseEnvContent(content) {
|
|
@@ -22188,6 +22295,7 @@ function parseEnvPassword(content) {
|
|
|
22188
22295
|
var configModule = {
|
|
22189
22296
|
async read(path, connectionName, options = {}) {
|
|
22190
22297
|
const effectiveConnectionName = connectionName ?? _globalConnectionName;
|
|
22298
|
+
let rawForDiagnostics;
|
|
22191
22299
|
try {
|
|
22192
22300
|
const binding = await readProjectBinding(path);
|
|
22193
22301
|
const storagePath = await resolveConfigStoragePath(path);
|
|
@@ -22213,6 +22321,7 @@ var configModule = {
|
|
|
22213
22321
|
const content = await configFile.text();
|
|
22214
22322
|
await assertConfigIntegrity(storagePath, content, { requireRecord: true });
|
|
22215
22323
|
const config = JSON.parse(content);
|
|
22324
|
+
rawForDiagnostics = config;
|
|
22216
22325
|
if (detectConfigVersion(config) === 2) {
|
|
22217
22326
|
const v2Config = DbcliConfigV2Schema.parse(config);
|
|
22218
22327
|
const resolved = resolveConnection(v2Config, effectiveConnectionName);
|
|
@@ -22293,6 +22402,7 @@ var configModule = {
|
|
|
22293
22402
|
assertNoConnectionSelectorOnV1(effectiveConnectionName);
|
|
22294
22403
|
const content = await file.text();
|
|
22295
22404
|
const raw = JSON.parse(content);
|
|
22405
|
+
rawForDiagnostics = raw;
|
|
22296
22406
|
const resolved = resolveEnvReferences(raw, process.env);
|
|
22297
22407
|
return DbcliConfigSchema.parse(resolved);
|
|
22298
22408
|
}
|
|
@@ -22303,6 +22413,10 @@ var configModule = {
|
|
|
22303
22413
|
} catch (error) {
|
|
22304
22414
|
if (error instanceof ConfigError)
|
|
22305
22415
|
throw error;
|
|
22416
|
+
if (isZodError(error)) {
|
|
22417
|
+
throw new ConfigError(`Failed to read .dbcli config: \u8A2D\u5B9A\u5167\u5BB9\u4E0D\u7B26\u5408\u7D50\u69CB
|
|
22418
|
+
${formatConfigValidationError(error, rawForDiagnostics)}`);
|
|
22419
|
+
}
|
|
22306
22420
|
if (error instanceof Error && error.message.includes("JSON")) {
|
|
22307
22421
|
throw new ConfigError(`Failed to parse .dbcli file: ${error.message}`);
|
|
22308
22422
|
}
|
|
@@ -22313,6 +22427,10 @@ var configModule = {
|
|
|
22313
22427
|
try {
|
|
22314
22428
|
return DbcliConfigSchema.parse(raw);
|
|
22315
22429
|
} catch (error) {
|
|
22430
|
+
if (isZodError(error)) {
|
|
22431
|
+
throw new ConfigError(`Invalid .dbcli config structure:
|
|
22432
|
+
${formatConfigValidationError(error, raw)}`);
|
|
22433
|
+
}
|
|
22316
22434
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
22317
22435
|
throw new ConfigError(`Invalid .dbcli config structure: ${errorMessage}`);
|
|
22318
22436
|
}
|
|
@@ -22413,6 +22531,7 @@ var KEEP_VALUE_FLAGS = new Set([
|
|
|
22413
22531
|
"--min-severity",
|
|
22414
22532
|
"--output",
|
|
22415
22533
|
"--limit",
|
|
22534
|
+
"--timeout",
|
|
22416
22535
|
"--collection",
|
|
22417
22536
|
"--index",
|
|
22418
22537
|
"--fields",
|
package/gemini-extension.json
CHANGED