@carllee1983/dbcli 3.0.0 → 4.0.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/skills/dbcli/reference.md +31 -2
- package/.cursor-plugin/plugin.json +1 -1
- package/.github/skills/dbcli/reference.md +31 -2
- package/CHANGELOG.md +435 -0
- package/assets/reference.md +31 -2
- package/dist/cli-runtime.mjs +2412 -1269
- package/dist/cli.mjs +3 -1
- package/dist/core.d.ts +172 -420
- package/dist/core.mjs +354 -2697
- package/gemini-extension.json +1 -1
- package/package.json +3 -1
- package/plugins/dbcli-agent/.codex-plugin/plugin.json +1 -1
- package/plugins/dbcli-agent/skills/dbcli/reference.md +31 -2
- package/skills/dbcli/reference.md +31 -2
package/dist/core.d.ts
CHANGED
|
@@ -255,123 +255,12 @@ export interface DatabaseAdapter {
|
|
|
255
255
|
*/
|
|
256
256
|
getServerVersion(): Promise<string>;
|
|
257
257
|
}
|
|
258
|
-
interface QueryableAdapter {
|
|
259
|
-
/**
|
|
260
|
-
* Establish connection and verify credentials
|
|
261
|
-
* Throws ConnectionError with categorized error type on failure
|
|
262
|
-
* @throws {ConnectionError} If connection fails (server down, auth failed, timeout, etc.)
|
|
263
|
-
*/
|
|
264
|
-
connect(): Promise<void>;
|
|
265
|
-
/**
|
|
266
|
-
* Close connection and release resources
|
|
267
|
-
* Should never throw; safe to call multiple times
|
|
268
|
-
* Handles cleanup gracefully even if already disconnected
|
|
269
|
-
*/
|
|
270
|
-
disconnect(): Promise<void>;
|
|
271
|
-
/**
|
|
272
|
-
* Execute arbitrary query with parameterized values
|
|
273
|
-
* Accepts JSON query strings for MongoDB operations
|
|
274
|
-
* @param query Query string (JSON format for MongoDB)
|
|
275
|
-
* @param params Array of parameter values in order
|
|
276
|
-
* @param options Optional execution controls (e.g. result-cardinality limit)
|
|
277
|
-
* @returns Execution result containing rows and metadata
|
|
278
|
-
* @throws {ConnectionError} If query execution fails
|
|
279
|
-
*/
|
|
280
|
-
execute<T>(query: string, params?: unknown[], options?: {
|
|
281
|
-
limit?: number;
|
|
282
|
-
noLimit?: boolean;
|
|
283
|
-
projection?: Record<string, 0 | 1>;
|
|
284
|
-
}): Promise<ExecutionResult<T>>;
|
|
285
|
-
/**
|
|
286
|
-
* List all collections in the connected database
|
|
287
|
-
* Includes metadata such as document count
|
|
288
|
-
* @param options Optional filter for system indices
|
|
289
|
-
* @returns Array of collection info with basic information
|
|
290
|
-
* @throws {ConnectionError} If query fails
|
|
291
|
-
*/
|
|
292
|
-
listCollections(options?: {
|
|
293
|
-
includeSystem?: boolean;
|
|
294
|
-
/** Redis: 取樣上限。列 key 沒有 catalog 可查,只能掃,所以上限是必要的。 */
|
|
295
|
-
limit?: number;
|
|
296
|
-
}): Promise<{
|
|
297
|
-
name: string;
|
|
298
|
-
documentCount?: number;
|
|
299
|
-
}[]>;
|
|
300
|
-
/**
|
|
301
|
-
* Redis-only: 取樣 key 名稱並回報是否觸及取樣上限。
|
|
302
|
-
*
|
|
303
|
-
* 宣告在介面上而不是讓呼叫端 double-cast:`dbcli list` 與 shell 補全都需要
|
|
304
|
-
* `truncated` 才能誠實顯示「只看了前 N 個」,而那個資訊 listCollections
|
|
305
|
-
* 的形狀裝不下。其他引擎有 catalog 可查,不需要取樣。
|
|
306
|
-
*/
|
|
307
|
-
sampleKeyNames?(limit: number): Promise<{
|
|
308
|
-
names: string[];
|
|
309
|
-
truncated: boolean;
|
|
310
|
-
}>;
|
|
311
|
-
/**
|
|
312
|
-
* SQL-compatible collection listing for shared command surfaces.
|
|
313
|
-
* @param options Optional filter for system indices
|
|
314
|
-
*/
|
|
315
|
-
listTables?(options?: {
|
|
316
|
-
includeSystem?: boolean;
|
|
317
|
-
}): Promise<TableSchema[]>;
|
|
318
|
-
/**
|
|
319
|
-
* SQL-compatible schema lookup for shared command surfaces.
|
|
320
|
-
* @param tableName Name of collection/table to inspect
|
|
321
|
-
* @param options Optional adapter-specific knobs (e.g. mongo `sampleSize`).
|
|
322
|
-
*/
|
|
323
|
-
getTableSchema?(tableName: string, options?: {
|
|
324
|
-
sampleSize?: number;
|
|
325
|
-
sampleMethod?: "random" | "natural";
|
|
326
|
-
}): Promise<TableSchema>;
|
|
327
|
-
/**
|
|
328
|
-
* Test connection with lightweight probe query
|
|
329
|
-
* Executes a ping or equivalent to verify connection is alive
|
|
330
|
-
* @returns true if connection successful
|
|
331
|
-
* @throws {ConnectionError} If connection test fails
|
|
332
|
-
*/
|
|
333
|
-
testConnection(): Promise<boolean>;
|
|
334
|
-
/**
|
|
335
|
-
* Get the database server version string
|
|
336
|
-
* @returns Raw version string from the server
|
|
337
|
-
* @throws {ConnectionError} If not connected or query fails
|
|
338
|
-
*/
|
|
339
|
-
getServerVersion(): Promise<string>;
|
|
340
|
-
/**
|
|
341
|
-
* Insert a single document/row
|
|
342
|
-
* @param collection Collection or table name
|
|
343
|
-
* @param data Data object to insert
|
|
344
|
-
* @returns Execution result
|
|
345
|
-
*/
|
|
346
|
-
insert(collection: string, data: Record<string, unknown>): Promise<ExecutionResult<unknown>>;
|
|
347
|
-
/**
|
|
348
|
-
* Update documents/rows matching filter
|
|
349
|
-
* @param collection Collection or table name
|
|
350
|
-
* @param filter Filter object
|
|
351
|
-
* @param update Update operations (e.g. {$set: ...})
|
|
352
|
-
* @returns Execution result
|
|
353
|
-
*/
|
|
354
|
-
update(collection: string, filter: Record<string, unknown>, update: Record<string, unknown>): Promise<ExecutionResult<unknown>>;
|
|
355
|
-
/**
|
|
356
|
-
* Delete documents/rows matching filter
|
|
357
|
-
* @param collection Collection or table name
|
|
358
|
-
* @param filter Filter object
|
|
359
|
-
* @returns Execution result
|
|
360
|
-
*/
|
|
361
|
-
delete(collection: string, filter: Record<string, unknown>): Promise<ExecutionResult<unknown>>;
|
|
362
|
-
}
|
|
363
258
|
interface BlacklistConfig {
|
|
364
259
|
/** Table names to block all operations on */
|
|
365
260
|
tables: string[];
|
|
366
261
|
/** Column names to omit per table: { tableName: [col1, col2] } */
|
|
367
262
|
columns: Record<string, string[]>;
|
|
368
263
|
}
|
|
369
|
-
interface RedisMaskRule {
|
|
370
|
-
/** Redis-native glob (e.g. "user:*"). */
|
|
371
|
-
keyPattern: string;
|
|
372
|
-
/** Hash field names to mask. Absent/empty → mask the whole value. */
|
|
373
|
-
fields?: string[];
|
|
374
|
-
}
|
|
375
264
|
interface BlacklistState {
|
|
376
265
|
/** Set of lowercase table names for O(1) case-insensitive lookup */
|
|
377
266
|
tables: Set<string>;
|
|
@@ -386,21 +275,6 @@ export declare class BlacklistError extends Error {
|
|
|
386
275
|
readonly operation: string;
|
|
387
276
|
constructor(message: string, tableName: string, operation: string);
|
|
388
277
|
}
|
|
389
|
-
/**
|
|
390
|
-
* Factory for creating database adapters
|
|
391
|
-
* Implements factory pattern to route to correct adapter based on system type
|
|
392
|
-
* Enables system-aware instantiation without coupling CLI commands to specific drivers
|
|
393
|
-
*/
|
|
394
|
-
export declare class AdapterFactory {
|
|
395
|
-
static createSqlAdapter(rawOptions: SqlConnectionOptions): DatabaseAdapter;
|
|
396
|
-
static createQueryableAdapter(rawOptions: QueryableConnectionOptions): QueryableAdapter;
|
|
397
|
-
static createAdapter(options: SqlConnectionOptions): DatabaseAdapter;
|
|
398
|
-
static createAdapter(options: QueryableConnectionOptions): QueryableAdapter;
|
|
399
|
-
static createAdapter(options: ConnectionOptions): DatabaseAdapter | QueryableAdapter;
|
|
400
|
-
static createMongoDBAdapter(options: ConnectionOptions): QueryableAdapter;
|
|
401
|
-
static createRedisAdapter(rawOptions: ConnectionOptions, blacklistRules?: string[], maskRules?: RedisMaskRule[]): QueryableAdapter;
|
|
402
|
-
static createElasticsearchAdapter(options: ConnectionOptions): QueryableAdapter;
|
|
403
|
-
}
|
|
404
278
|
/**
|
|
405
279
|
* Type definitions for data modification operations
|
|
406
280
|
* Defines results and options for data modification (INSERT, UPDATE, DELETE) operations
|
|
@@ -1340,18 +1214,47 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1340
1214
|
schemaLastUpdated?: string | undefined;
|
|
1341
1215
|
schemaTableCount?: number | undefined;
|
|
1342
1216
|
}>>>;
|
|
1343
|
-
blacklist: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1217
|
+
blacklist: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
1344
1218
|
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1345
1219
|
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1346
|
-
}, "
|
|
1347
|
-
|
|
1220
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
1221
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1222
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1223
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1224
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1225
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1226
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
1227
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1228
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1229
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
1230
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1231
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1232
|
+
}, z.ZodTypeAny, "passthrough">>, {
|
|
1348
1233
|
tables: string[];
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
tables
|
|
1352
|
-
|
|
1353
|
-
|
|
1234
|
+
columns: Record<string, string[]>;
|
|
1235
|
+
}, z.objectInputType<{
|
|
1236
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1237
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1238
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
1239
|
+
audit: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
1354
1240
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
1241
|
+
/**
|
|
1242
|
+
* 稽核寫不出來就不要動資料庫。
|
|
1243
|
+
*
|
|
1244
|
+
* audit 一直是 best-effort:磁碟滿、目錄不可寫、lock budget 耗盡時,操作
|
|
1245
|
+
* 照樣執行而紀錄不存在,只有一行 stderr 警告(一個 process 只印一次,
|
|
1246
|
+
* 管線模式通常看不到)。對多數使用者這是對的取捨——遺失一列紀錄不該讓
|
|
1247
|
+
* 工具停擺。但把稽核當成控制本身的人(ES shell 的 permission 就是這種
|
|
1248
|
+
* 情形)需要能表達相反的取捨,而先前連表達都表達不了。
|
|
1249
|
+
*
|
|
1250
|
+
* 強制點是「效果發生前」的稽核寫入(`writeAuditEntryBeforeEffect`):
|
|
1251
|
+
* ES shell 送出請求前的那一列,與 SQL 的 gate decision。效果已經發生之後
|
|
1252
|
+
* 才寫的紀錄不在範圍內——那時拒絕擋不回任何東西,只會把一次成功的操作
|
|
1253
|
+
* 回報成失敗。
|
|
1254
|
+
*
|
|
1255
|
+
* 預設關閉:這改的是既有行為,開啟與否是使用者的判斷。
|
|
1256
|
+
*/
|
|
1257
|
+
strict: z.ZodDefault<z.ZodBoolean>;
|
|
1355
1258
|
rotation: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
1356
1259
|
max_bytes: z.ZodDefault<z.ZodNumber>;
|
|
1357
1260
|
max_entries: z.ZodDefault<z.ZodNumber>;
|
|
@@ -1363,12 +1266,28 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1363
1266
|
max_entries?: number | undefined;
|
|
1364
1267
|
}>>>;
|
|
1365
1268
|
}, "strip", z.ZodTypeAny, {
|
|
1269
|
+
strict: boolean;
|
|
1366
1270
|
enabled: boolean;
|
|
1367
1271
|
rotation: {
|
|
1368
1272
|
max_bytes: number;
|
|
1369
1273
|
max_entries: number;
|
|
1370
1274
|
};
|
|
1371
1275
|
}, {
|
|
1276
|
+
strict?: boolean | undefined;
|
|
1277
|
+
enabled?: boolean | undefined;
|
|
1278
|
+
rotation?: {
|
|
1279
|
+
max_bytes?: number | undefined;
|
|
1280
|
+
max_entries?: number | undefined;
|
|
1281
|
+
} | undefined;
|
|
1282
|
+
}>, {
|
|
1283
|
+
strict: boolean;
|
|
1284
|
+
enabled: boolean;
|
|
1285
|
+
rotation: {
|
|
1286
|
+
max_bytes: number;
|
|
1287
|
+
max_entries: number;
|
|
1288
|
+
};
|
|
1289
|
+
}, {
|
|
1290
|
+
strict?: boolean | undefined;
|
|
1372
1291
|
enabled?: boolean | undefined;
|
|
1373
1292
|
rotation?: {
|
|
1374
1293
|
max_bytes?: number | undefined;
|
|
@@ -1400,10 +1319,11 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1400
1319
|
}, "strip", z.ZodTypeAny, {
|
|
1401
1320
|
schema: Record<string, any>;
|
|
1402
1321
|
blacklist: {
|
|
1403
|
-
columns: Record<string, string[]>;
|
|
1404
1322
|
tables: string[];
|
|
1323
|
+
columns: Record<string, string[]>;
|
|
1405
1324
|
};
|
|
1406
1325
|
audit: {
|
|
1326
|
+
strict: boolean;
|
|
1407
1327
|
enabled: boolean;
|
|
1408
1328
|
rotation: {
|
|
1409
1329
|
max_bytes: number;
|
|
@@ -1627,11 +1547,12 @@ declare const DbcliConfigSchema: z.ZodObject<{
|
|
|
1627
1547
|
}[] | undefined;
|
|
1628
1548
|
} | undefined;
|
|
1629
1549
|
schema?: Record<string, any> | undefined;
|
|
1630
|
-
blacklist?: {
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
} | undefined;
|
|
1550
|
+
blacklist?: z.objectInputType<{
|
|
1551
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1552
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
1553
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1634
1554
|
audit?: {
|
|
1555
|
+
strict?: boolean | undefined;
|
|
1635
1556
|
enabled?: boolean | undefined;
|
|
1636
1557
|
rotation?: {
|
|
1637
1558
|
max_bytes?: number | undefined;
|
|
@@ -1653,7 +1574,7 @@ type DbcliConfig$1 = z.infer<typeof DbcliConfigSchema>;
|
|
|
1653
1574
|
declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
1654
1575
|
version: z.ZodLiteral<2>;
|
|
1655
1576
|
default: z.ZodString;
|
|
1656
|
-
connections: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[
|
|
1577
|
+
connections: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodUnion<[
|
|
1657
1578
|
z.ZodObject<{
|
|
1658
1579
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
1659
1580
|
statementTimeout: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2191,7 +2112,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2191
2112
|
envFile?: string | undefined;
|
|
2192
2113
|
environment?: string | undefined;
|
|
2193
2114
|
}>
|
|
2194
|
-
]
|
|
2115
|
+
]>, {
|
|
2195
2116
|
password: string | {
|
|
2196
2117
|
$env: string;
|
|
2197
2118
|
};
|
|
@@ -2300,7 +2221,10 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2300
2221
|
caPath?: string | undefined;
|
|
2301
2222
|
envFile?: string | undefined;
|
|
2302
2223
|
environment?: string | undefined;
|
|
2303
|
-
}
|
|
2224
|
+
}, unknown>>, Record<string, {
|
|
2225
|
+
password: string | {
|
|
2226
|
+
$env: string;
|
|
2227
|
+
};
|
|
2304
2228
|
system: "postgresql" | "mysql" | "mariadb";
|
|
2305
2229
|
host: string | {
|
|
2306
2230
|
$env: string;
|
|
@@ -2314,31 +2238,30 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2314
2238
|
database: string | {
|
|
2315
2239
|
$env: string;
|
|
2316
2240
|
};
|
|
2317
|
-
|
|
2318
|
-
$env: string;
|
|
2319
|
-
} | undefined;
|
|
2241
|
+
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2320
2242
|
timeout?: number | undefined;
|
|
2321
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2322
2243
|
statementTimeout?: number | undefined;
|
|
2323
2244
|
envFile?: string | undefined;
|
|
2324
2245
|
environment?: string | undefined;
|
|
2325
2246
|
} | {
|
|
2326
|
-
|
|
2327
|
-
password?: string | {
|
|
2247
|
+
password: string | {
|
|
2328
2248
|
$env: string;
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2249
|
+
};
|
|
2250
|
+
system: "mongodb";
|
|
2251
|
+
host: string | {
|
|
2331
2252
|
$env: string;
|
|
2332
|
-
}
|
|
2333
|
-
port
|
|
2253
|
+
};
|
|
2254
|
+
port: number | {
|
|
2334
2255
|
$env: string;
|
|
2335
|
-
}
|
|
2336
|
-
user
|
|
2256
|
+
};
|
|
2257
|
+
user: string | {
|
|
2337
2258
|
$env: string;
|
|
2338
|
-
}
|
|
2339
|
-
database
|
|
2259
|
+
};
|
|
2260
|
+
database: string | {
|
|
2340
2261
|
$env: string;
|
|
2341
|
-
}
|
|
2262
|
+
};
|
|
2263
|
+
srv: boolean;
|
|
2264
|
+
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2342
2265
|
uri?: string | {
|
|
2343
2266
|
$env: string;
|
|
2344
2267
|
} | undefined;
|
|
@@ -2349,13 +2272,14 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2349
2272
|
$env: string;
|
|
2350
2273
|
} | undefined;
|
|
2351
2274
|
tls?: boolean | undefined;
|
|
2352
|
-
srv?: boolean | undefined;
|
|
2353
2275
|
timeout?: number | undefined;
|
|
2354
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2355
2276
|
statementTimeout?: number | undefined;
|
|
2356
2277
|
envFile?: string | undefined;
|
|
2357
2278
|
environment?: string | undefined;
|
|
2358
2279
|
} | {
|
|
2280
|
+
password: string | {
|
|
2281
|
+
$env: string;
|
|
2282
|
+
};
|
|
2359
2283
|
system: "redis";
|
|
2360
2284
|
host: string | {
|
|
2361
2285
|
$env: string;
|
|
@@ -2363,42 +2287,39 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2363
2287
|
port: number | {
|
|
2364
2288
|
$env: string;
|
|
2365
2289
|
};
|
|
2366
|
-
|
|
2367
|
-
$env: string;
|
|
2368
|
-
} | undefined;
|
|
2369
|
-
user?: string | {
|
|
2290
|
+
user: string | {
|
|
2370
2291
|
$env: string;
|
|
2371
|
-
}
|
|
2372
|
-
database
|
|
2292
|
+
};
|
|
2293
|
+
database: string | {
|
|
2373
2294
|
$env: string;
|
|
2374
|
-
}
|
|
2295
|
+
};
|
|
2296
|
+
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2375
2297
|
timeout?: number | undefined;
|
|
2376
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2377
2298
|
statementTimeout?: number | undefined;
|
|
2378
2299
|
envFile?: string | undefined;
|
|
2379
2300
|
environment?: string | undefined;
|
|
2380
2301
|
} | {
|
|
2381
|
-
|
|
2382
|
-
password?: string | {
|
|
2302
|
+
password: string | {
|
|
2383
2303
|
$env: string;
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2304
|
+
};
|
|
2305
|
+
system: "elasticsearch";
|
|
2306
|
+
host: string | {
|
|
2386
2307
|
$env: string;
|
|
2387
|
-
}
|
|
2388
|
-
port
|
|
2308
|
+
};
|
|
2309
|
+
port: number | {
|
|
2389
2310
|
$env: string;
|
|
2390
|
-
}
|
|
2391
|
-
user
|
|
2311
|
+
};
|
|
2312
|
+
user: string | {
|
|
2392
2313
|
$env: string;
|
|
2393
|
-
}
|
|
2394
|
-
database
|
|
2314
|
+
};
|
|
2315
|
+
database: string | {
|
|
2395
2316
|
$env: string;
|
|
2396
|
-
}
|
|
2397
|
-
rejectUnauthorized
|
|
2317
|
+
};
|
|
2318
|
+
rejectUnauthorized: boolean;
|
|
2319
|
+
permission: "admin" | "query-only" | "read-write" | "data-admin";
|
|
2320
|
+
protocol: "http" | "https";
|
|
2398
2321
|
timeout?: number | undefined;
|
|
2399
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2400
2322
|
statementTimeout?: number | undefined;
|
|
2401
|
-
protocol?: "http" | "https" | undefined;
|
|
2402
2323
|
nodes?: string[] | undefined;
|
|
2403
2324
|
cloudId?: string | {
|
|
2404
2325
|
$env: string;
|
|
@@ -2409,7 +2330,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2409
2330
|
caPath?: string | undefined;
|
|
2410
2331
|
envFile?: string | undefined;
|
|
2411
2332
|
environment?: string | undefined;
|
|
2412
|
-
}>>;
|
|
2333
|
+
}>, Record<string, unknown>>;
|
|
2413
2334
|
schema: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
2414
2335
|
schemas: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>>;
|
|
2415
2336
|
metadata: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
@@ -2428,18 +2349,47 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2428
2349
|
schemaLastUpdated?: string | undefined;
|
|
2429
2350
|
schemaTableCount?: number | undefined;
|
|
2430
2351
|
}>>>;
|
|
2431
|
-
blacklist: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2352
|
+
blacklist: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
2432
2353
|
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2433
2354
|
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
2434
|
-
}, "
|
|
2435
|
-
|
|
2355
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
2356
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2357
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
2358
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
2359
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2360
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
2361
|
+
}, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
|
|
2362
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2363
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
2364
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
2365
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2366
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
2367
|
+
}, z.ZodTypeAny, "passthrough">>, {
|
|
2436
2368
|
tables: string[];
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
tables
|
|
2440
|
-
|
|
2441
|
-
|
|
2369
|
+
columns: Record<string, string[]>;
|
|
2370
|
+
}, z.objectInputType<{
|
|
2371
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2372
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
2373
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
2374
|
+
audit: z.ZodDefault<z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
2442
2375
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2376
|
+
/**
|
|
2377
|
+
* 稽核寫不出來就不要動資料庫。
|
|
2378
|
+
*
|
|
2379
|
+
* audit 一直是 best-effort:磁碟滿、目錄不可寫、lock budget 耗盡時,操作
|
|
2380
|
+
* 照樣執行而紀錄不存在,只有一行 stderr 警告(一個 process 只印一次,
|
|
2381
|
+
* 管線模式通常看不到)。對多數使用者這是對的取捨——遺失一列紀錄不該讓
|
|
2382
|
+
* 工具停擺。但把稽核當成控制本身的人(ES shell 的 permission 就是這種
|
|
2383
|
+
* 情形)需要能表達相反的取捨,而先前連表達都表達不了。
|
|
2384
|
+
*
|
|
2385
|
+
* 強制點是「效果發生前」的稽核寫入(`writeAuditEntryBeforeEffect`):
|
|
2386
|
+
* ES shell 送出請求前的那一列,與 SQL 的 gate decision。效果已經發生之後
|
|
2387
|
+
* 才寫的紀錄不在範圍內——那時拒絕擋不回任何東西,只會把一次成功的操作
|
|
2388
|
+
* 回報成失敗。
|
|
2389
|
+
*
|
|
2390
|
+
* 預設關閉:這改的是既有行為,開啟與否是使用者的判斷。
|
|
2391
|
+
*/
|
|
2392
|
+
strict: z.ZodDefault<z.ZodBoolean>;
|
|
2443
2393
|
rotation: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
2444
2394
|
max_bytes: z.ZodDefault<z.ZodNumber>;
|
|
2445
2395
|
max_entries: z.ZodDefault<z.ZodNumber>;
|
|
@@ -2451,12 +2401,28 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2451
2401
|
max_entries?: number | undefined;
|
|
2452
2402
|
}>>>;
|
|
2453
2403
|
}, "strip", z.ZodTypeAny, {
|
|
2404
|
+
strict: boolean;
|
|
2454
2405
|
enabled: boolean;
|
|
2455
2406
|
rotation: {
|
|
2456
2407
|
max_bytes: number;
|
|
2457
2408
|
max_entries: number;
|
|
2458
2409
|
};
|
|
2459
2410
|
}, {
|
|
2411
|
+
strict?: boolean | undefined;
|
|
2412
|
+
enabled?: boolean | undefined;
|
|
2413
|
+
rotation?: {
|
|
2414
|
+
max_bytes?: number | undefined;
|
|
2415
|
+
max_entries?: number | undefined;
|
|
2416
|
+
} | undefined;
|
|
2417
|
+
}>, {
|
|
2418
|
+
strict: boolean;
|
|
2419
|
+
enabled: boolean;
|
|
2420
|
+
rotation: {
|
|
2421
|
+
max_bytes: number;
|
|
2422
|
+
max_entries: number;
|
|
2423
|
+
};
|
|
2424
|
+
}, {
|
|
2425
|
+
strict?: boolean | undefined;
|
|
2460
2426
|
enabled?: boolean | undefined;
|
|
2461
2427
|
rotation?: {
|
|
2462
2428
|
max_bytes?: number | undefined;
|
|
@@ -2488,10 +2454,11 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2488
2454
|
}, "strip", z.ZodTypeAny, {
|
|
2489
2455
|
schema: Record<string, any>;
|
|
2490
2456
|
blacklist: {
|
|
2491
|
-
columns: Record<string, string[]>;
|
|
2492
2457
|
tables: string[];
|
|
2458
|
+
columns: Record<string, string[]>;
|
|
2493
2459
|
};
|
|
2494
2460
|
audit: {
|
|
2461
|
+
strict: boolean;
|
|
2495
2462
|
enabled: boolean;
|
|
2496
2463
|
rotation: {
|
|
2497
2464
|
max_bytes: number;
|
|
@@ -2626,116 +2593,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2626
2593
|
}, {
|
|
2627
2594
|
version: 2;
|
|
2628
2595
|
default: string;
|
|
2629
|
-
connections: Record<string,
|
|
2630
|
-
system: "postgresql" | "mysql" | "mariadb";
|
|
2631
|
-
host: string | {
|
|
2632
|
-
$env: string;
|
|
2633
|
-
};
|
|
2634
|
-
port: number | {
|
|
2635
|
-
$env: string;
|
|
2636
|
-
};
|
|
2637
|
-
user: string | {
|
|
2638
|
-
$env: string;
|
|
2639
|
-
};
|
|
2640
|
-
database: string | {
|
|
2641
|
-
$env: string;
|
|
2642
|
-
};
|
|
2643
|
-
password?: string | {
|
|
2644
|
-
$env: string;
|
|
2645
|
-
} | undefined;
|
|
2646
|
-
timeout?: number | undefined;
|
|
2647
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2648
|
-
statementTimeout?: number | undefined;
|
|
2649
|
-
envFile?: string | undefined;
|
|
2650
|
-
environment?: string | undefined;
|
|
2651
|
-
} | {
|
|
2652
|
-
system: "mongodb";
|
|
2653
|
-
password?: string | {
|
|
2654
|
-
$env: string;
|
|
2655
|
-
} | undefined;
|
|
2656
|
-
host?: string | {
|
|
2657
|
-
$env: string;
|
|
2658
|
-
} | undefined;
|
|
2659
|
-
port?: number | {
|
|
2660
|
-
$env: string;
|
|
2661
|
-
} | undefined;
|
|
2662
|
-
user?: string | {
|
|
2663
|
-
$env: string;
|
|
2664
|
-
} | undefined;
|
|
2665
|
-
database?: string | {
|
|
2666
|
-
$env: string;
|
|
2667
|
-
} | undefined;
|
|
2668
|
-
uri?: string | {
|
|
2669
|
-
$env: string;
|
|
2670
|
-
} | undefined;
|
|
2671
|
-
authSource?: string | {
|
|
2672
|
-
$env: string;
|
|
2673
|
-
} | undefined;
|
|
2674
|
-
replicaSet?: string | {
|
|
2675
|
-
$env: string;
|
|
2676
|
-
} | undefined;
|
|
2677
|
-
tls?: boolean | undefined;
|
|
2678
|
-
srv?: boolean | undefined;
|
|
2679
|
-
timeout?: number | undefined;
|
|
2680
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2681
|
-
statementTimeout?: number | undefined;
|
|
2682
|
-
envFile?: string | undefined;
|
|
2683
|
-
environment?: string | undefined;
|
|
2684
|
-
} | {
|
|
2685
|
-
system: "redis";
|
|
2686
|
-
host: string | {
|
|
2687
|
-
$env: string;
|
|
2688
|
-
};
|
|
2689
|
-
port: number | {
|
|
2690
|
-
$env: string;
|
|
2691
|
-
};
|
|
2692
|
-
password?: string | {
|
|
2693
|
-
$env: string;
|
|
2694
|
-
} | undefined;
|
|
2695
|
-
user?: string | {
|
|
2696
|
-
$env: string;
|
|
2697
|
-
} | undefined;
|
|
2698
|
-
database?: string | {
|
|
2699
|
-
$env: string;
|
|
2700
|
-
} | undefined;
|
|
2701
|
-
timeout?: number | undefined;
|
|
2702
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2703
|
-
statementTimeout?: number | undefined;
|
|
2704
|
-
envFile?: string | undefined;
|
|
2705
|
-
environment?: string | undefined;
|
|
2706
|
-
} | {
|
|
2707
|
-
system: "elasticsearch";
|
|
2708
|
-
password?: string | {
|
|
2709
|
-
$env: string;
|
|
2710
|
-
} | undefined;
|
|
2711
|
-
host?: string | {
|
|
2712
|
-
$env: string;
|
|
2713
|
-
} | undefined;
|
|
2714
|
-
port?: number | {
|
|
2715
|
-
$env: string;
|
|
2716
|
-
} | undefined;
|
|
2717
|
-
user?: string | {
|
|
2718
|
-
$env: string;
|
|
2719
|
-
} | undefined;
|
|
2720
|
-
database?: string | {
|
|
2721
|
-
$env: string;
|
|
2722
|
-
} | undefined;
|
|
2723
|
-
rejectUnauthorized?: boolean | undefined;
|
|
2724
|
-
timeout?: number | undefined;
|
|
2725
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2726
|
-
statementTimeout?: number | undefined;
|
|
2727
|
-
protocol?: "http" | "https" | undefined;
|
|
2728
|
-
nodes?: string[] | undefined;
|
|
2729
|
-
cloudId?: string | {
|
|
2730
|
-
$env: string;
|
|
2731
|
-
} | undefined;
|
|
2732
|
-
apiKey?: string | {
|
|
2733
|
-
$env: string;
|
|
2734
|
-
} | undefined;
|
|
2735
|
-
caPath?: string | undefined;
|
|
2736
|
-
envFile?: string | undefined;
|
|
2737
|
-
environment?: string | undefined;
|
|
2738
|
-
}>;
|
|
2596
|
+
connections: Record<string, unknown>;
|
|
2739
2597
|
redis?: {
|
|
2740
2598
|
mask?: {
|
|
2741
2599
|
keyPattern: string;
|
|
@@ -2743,11 +2601,12 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2743
2601
|
}[] | undefined;
|
|
2744
2602
|
} | undefined;
|
|
2745
2603
|
schema?: Record<string, any> | undefined;
|
|
2746
|
-
blacklist?: {
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
} | undefined;
|
|
2604
|
+
blacklist?: z.objectInputType<{
|
|
2605
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2606
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
2607
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
2750
2608
|
audit?: {
|
|
2609
|
+
strict?: boolean | undefined;
|
|
2751
2610
|
enabled?: boolean | undefined;
|
|
2752
2611
|
rotation?: {
|
|
2753
2612
|
max_bytes?: number | undefined;
|
|
@@ -2764,10 +2623,11 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2764
2623
|
}>, {
|
|
2765
2624
|
schema: Record<string, any>;
|
|
2766
2625
|
blacklist: {
|
|
2767
|
-
columns: Record<string, string[]>;
|
|
2768
2626
|
tables: string[];
|
|
2627
|
+
columns: Record<string, string[]>;
|
|
2769
2628
|
};
|
|
2770
2629
|
audit: {
|
|
2630
|
+
strict: boolean;
|
|
2771
2631
|
enabled: boolean;
|
|
2772
2632
|
rotation: {
|
|
2773
2633
|
max_bytes: number;
|
|
@@ -2902,116 +2762,7 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
2902
2762
|
}, {
|
|
2903
2763
|
version: 2;
|
|
2904
2764
|
default: string;
|
|
2905
|
-
connections: Record<string,
|
|
2906
|
-
system: "postgresql" | "mysql" | "mariadb";
|
|
2907
|
-
host: string | {
|
|
2908
|
-
$env: string;
|
|
2909
|
-
};
|
|
2910
|
-
port: number | {
|
|
2911
|
-
$env: string;
|
|
2912
|
-
};
|
|
2913
|
-
user: string | {
|
|
2914
|
-
$env: string;
|
|
2915
|
-
};
|
|
2916
|
-
database: string | {
|
|
2917
|
-
$env: string;
|
|
2918
|
-
};
|
|
2919
|
-
password?: string | {
|
|
2920
|
-
$env: string;
|
|
2921
|
-
} | undefined;
|
|
2922
|
-
timeout?: number | undefined;
|
|
2923
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2924
|
-
statementTimeout?: number | undefined;
|
|
2925
|
-
envFile?: string | undefined;
|
|
2926
|
-
environment?: string | undefined;
|
|
2927
|
-
} | {
|
|
2928
|
-
system: "mongodb";
|
|
2929
|
-
password?: string | {
|
|
2930
|
-
$env: string;
|
|
2931
|
-
} | undefined;
|
|
2932
|
-
host?: string | {
|
|
2933
|
-
$env: string;
|
|
2934
|
-
} | undefined;
|
|
2935
|
-
port?: number | {
|
|
2936
|
-
$env: string;
|
|
2937
|
-
} | undefined;
|
|
2938
|
-
user?: string | {
|
|
2939
|
-
$env: string;
|
|
2940
|
-
} | undefined;
|
|
2941
|
-
database?: string | {
|
|
2942
|
-
$env: string;
|
|
2943
|
-
} | undefined;
|
|
2944
|
-
uri?: string | {
|
|
2945
|
-
$env: string;
|
|
2946
|
-
} | undefined;
|
|
2947
|
-
authSource?: string | {
|
|
2948
|
-
$env: string;
|
|
2949
|
-
} | undefined;
|
|
2950
|
-
replicaSet?: string | {
|
|
2951
|
-
$env: string;
|
|
2952
|
-
} | undefined;
|
|
2953
|
-
tls?: boolean | undefined;
|
|
2954
|
-
srv?: boolean | undefined;
|
|
2955
|
-
timeout?: number | undefined;
|
|
2956
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2957
|
-
statementTimeout?: number | undefined;
|
|
2958
|
-
envFile?: string | undefined;
|
|
2959
|
-
environment?: string | undefined;
|
|
2960
|
-
} | {
|
|
2961
|
-
system: "redis";
|
|
2962
|
-
host: string | {
|
|
2963
|
-
$env: string;
|
|
2964
|
-
};
|
|
2965
|
-
port: number | {
|
|
2966
|
-
$env: string;
|
|
2967
|
-
};
|
|
2968
|
-
password?: string | {
|
|
2969
|
-
$env: string;
|
|
2970
|
-
} | undefined;
|
|
2971
|
-
user?: string | {
|
|
2972
|
-
$env: string;
|
|
2973
|
-
} | undefined;
|
|
2974
|
-
database?: string | {
|
|
2975
|
-
$env: string;
|
|
2976
|
-
} | undefined;
|
|
2977
|
-
timeout?: number | undefined;
|
|
2978
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
2979
|
-
statementTimeout?: number | undefined;
|
|
2980
|
-
envFile?: string | undefined;
|
|
2981
|
-
environment?: string | undefined;
|
|
2982
|
-
} | {
|
|
2983
|
-
system: "elasticsearch";
|
|
2984
|
-
password?: string | {
|
|
2985
|
-
$env: string;
|
|
2986
|
-
} | undefined;
|
|
2987
|
-
host?: string | {
|
|
2988
|
-
$env: string;
|
|
2989
|
-
} | undefined;
|
|
2990
|
-
port?: number | {
|
|
2991
|
-
$env: string;
|
|
2992
|
-
} | undefined;
|
|
2993
|
-
user?: string | {
|
|
2994
|
-
$env: string;
|
|
2995
|
-
} | undefined;
|
|
2996
|
-
database?: string | {
|
|
2997
|
-
$env: string;
|
|
2998
|
-
} | undefined;
|
|
2999
|
-
rejectUnauthorized?: boolean | undefined;
|
|
3000
|
-
timeout?: number | undefined;
|
|
3001
|
-
permission?: "admin" | "query-only" | "read-write" | "data-admin" | undefined;
|
|
3002
|
-
statementTimeout?: number | undefined;
|
|
3003
|
-
protocol?: "http" | "https" | undefined;
|
|
3004
|
-
nodes?: string[] | undefined;
|
|
3005
|
-
cloudId?: string | {
|
|
3006
|
-
$env: string;
|
|
3007
|
-
} | undefined;
|
|
3008
|
-
apiKey?: string | {
|
|
3009
|
-
$env: string;
|
|
3010
|
-
} | undefined;
|
|
3011
|
-
caPath?: string | undefined;
|
|
3012
|
-
envFile?: string | undefined;
|
|
3013
|
-
environment?: string | undefined;
|
|
3014
|
-
}>;
|
|
2765
|
+
connections: Record<string, unknown>;
|
|
3015
2766
|
redis?: {
|
|
3016
2767
|
mask?: {
|
|
3017
2768
|
keyPattern: string;
|
|
@@ -3019,11 +2770,12 @@ declare const DbcliConfigV2Schema: z.ZodEffects<z.ZodObject<{
|
|
|
3019
2770
|
}[] | undefined;
|
|
3020
2771
|
} | undefined;
|
|
3021
2772
|
schema?: Record<string, any> | undefined;
|
|
3022
|
-
blacklist?: {
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
} | undefined;
|
|
2773
|
+
blacklist?: z.objectInputType<{
|
|
2774
|
+
tables: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
2775
|
+
columns: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
2776
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
3026
2777
|
audit?: {
|
|
2778
|
+
strict?: boolean | undefined;
|
|
3027
2779
|
enabled?: boolean | undefined;
|
|
3028
2780
|
rotation?: {
|
|
3029
2781
|
max_bytes?: number | undefined;
|