@this-npm-test-org/sql-driver-sdk 0.1.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.
@@ -0,0 +1,509 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Amodal Labs, Inc.
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ /**
7
+ * Zod schemas validating connection config files for `protocol: 'sql'`
8
+ * connections. The inferred TS types match the type-level shapes in
9
+ * `@amodalai/types/sql-connection-types`; we don't redeclare them here
10
+ * — the schemas are the single source of truth for runtime validation,
11
+ * and the type-level contracts are the source for compile-time use.
12
+ */
13
+ import { z } from 'zod';
14
+ export declare const SqlConnectionConfigSchema: z.ZodEffects<z.ZodObject<{
15
+ protocol: z.ZodLiteral<"sql">;
16
+ dialect: z.ZodString;
17
+ driver: z.ZodString;
18
+ parser: z.ZodOptional<z.ZodString>;
19
+ connection: z.ZodOptional<z.ZodObject<{
20
+ url: z.ZodString;
21
+ ssl: z.ZodOptional<z.ZodEnum<["require", "disable", "prefer"]>>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ url: string;
24
+ ssl?: "require" | "disable" | "prefer" | undefined;
25
+ }, {
26
+ url: string;
27
+ ssl?: "require" | "disable" | "prefer" | undefined;
28
+ }>>;
29
+ mcp: z.ZodOptional<z.ZodObject<{
30
+ transport: z.ZodEnum<["stdio", "sse", "http"]>;
31
+ command: z.ZodOptional<z.ZodString>;
32
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
33
+ url: z.ZodOptional<z.ZodString>;
34
+ queryTool: z.ZodDefault<z.ZodString>;
35
+ schemaIntrospection: z.ZodOptional<z.ZodEnum<["resources", "informationSchema"]>>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ transport: "stdio" | "sse" | "http";
38
+ queryTool: string;
39
+ url?: string | undefined;
40
+ command?: string | undefined;
41
+ args?: string[] | undefined;
42
+ schemaIntrospection?: "resources" | "informationSchema" | undefined;
43
+ }, {
44
+ transport: "stdio" | "sse" | "http";
45
+ url?: string | undefined;
46
+ command?: string | undefined;
47
+ args?: string[] | undefined;
48
+ queryTool?: string | undefined;
49
+ schemaIntrospection?: "resources" | "informationSchema" | undefined;
50
+ }>>;
51
+ pool: z.ZodOptional<z.ZodObject<{
52
+ max: z.ZodOptional<z.ZodNumber>;
53
+ idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
54
+ statementTimeoutMs: z.ZodOptional<z.ZodNumber>;
55
+ acquireTimeoutMs: z.ZodOptional<z.ZodNumber>;
56
+ eagerInit: z.ZodOptional<z.ZodBoolean>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ max?: number | undefined;
59
+ idleTimeoutMs?: number | undefined;
60
+ statementTimeoutMs?: number | undefined;
61
+ acquireTimeoutMs?: number | undefined;
62
+ eagerInit?: boolean | undefined;
63
+ }, {
64
+ max?: number | undefined;
65
+ idleTimeoutMs?: number | undefined;
66
+ statementTimeoutMs?: number | undefined;
67
+ acquireTimeoutMs?: number | undefined;
68
+ eagerInit?: boolean | undefined;
69
+ }>>;
70
+ scoping: z.ZodOptional<z.ZodObject<{
71
+ enforcement: z.ZodEnum<["verify", "rls", "inject"]>;
72
+ contextVars: z.ZodRecord<z.ZodString, z.ZodString>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ enforcement: "verify" | "rls" | "inject";
75
+ contextVars: Record<string, string>;
76
+ }, {
77
+ enforcement: "verify" | "rls" | "inject";
78
+ contextVars: Record<string, string>;
79
+ }>>;
80
+ queryConstraints: z.ZodOptional<z.ZodObject<{
81
+ maxRows: z.ZodOptional<z.ZodNumber>;
82
+ forbidSelectStar: z.ZodOptional<z.ZodBoolean>;
83
+ forbidUnknownTables: z.ZodOptional<z.ZodBoolean>;
84
+ forbidUnknownColumns: z.ZodOptional<z.ZodBoolean>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ maxRows?: number | undefined;
87
+ forbidSelectStar?: boolean | undefined;
88
+ forbidUnknownTables?: boolean | undefined;
89
+ forbidUnknownColumns?: boolean | undefined;
90
+ }, {
91
+ maxRows?: number | undefined;
92
+ forbidSelectStar?: boolean | undefined;
93
+ forbidUnknownTables?: boolean | undefined;
94
+ forbidUnknownColumns?: boolean | undefined;
95
+ }>>;
96
+ guidedQueries: z.ZodOptional<z.ZodString>;
97
+ audit: z.ZodOptional<z.ZodObject<{
98
+ logQueryText: z.ZodOptional<z.ZodBoolean>;
99
+ logRowCounts: z.ZodOptional<z.ZodBoolean>;
100
+ synchronousFlush: z.ZodOptional<z.ZodBoolean>;
101
+ }, "strip", z.ZodTypeAny, {
102
+ logQueryText?: boolean | undefined;
103
+ logRowCounts?: boolean | undefined;
104
+ synchronousFlush?: boolean | undefined;
105
+ }, {
106
+ logQueryText?: boolean | undefined;
107
+ logRowCounts?: boolean | undefined;
108
+ synchronousFlush?: boolean | undefined;
109
+ }>>;
110
+ schemaDriftPolicy: z.ZodOptional<z.ZodObject<{
111
+ addedColumnsOnPiiTables: z.ZodOptional<z.ZodEnum<["failLoad", "warn", "ignore"]>>;
112
+ addedColumnsOnNonPiiTables: z.ZodOptional<z.ZodEnum<["failLoad", "warn", "ignore"]>>;
113
+ removedColumnsReferencedInPolicy: z.ZodOptional<z.ZodEnum<["failLoad", "warn", "ignore"]>>;
114
+ }, "strip", z.ZodTypeAny, {
115
+ addedColumnsOnPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
116
+ addedColumnsOnNonPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
117
+ removedColumnsReferencedInPolicy?: "failLoad" | "warn" | "ignore" | undefined;
118
+ }, {
119
+ addedColumnsOnPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
120
+ addedColumnsOnNonPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
121
+ removedColumnsReferencedInPolicy?: "failLoad" | "warn" | "ignore" | undefined;
122
+ }>>;
123
+ weakerThresholdsAccepted: z.ZodOptional<z.ZodBoolean>;
124
+ schemaPath: z.ZodString;
125
+ }, "strip", z.ZodTypeAny, {
126
+ driver: string;
127
+ protocol: "sql";
128
+ dialect: string;
129
+ schemaPath: string;
130
+ parser?: string | undefined;
131
+ connection?: {
132
+ url: string;
133
+ ssl?: "require" | "disable" | "prefer" | undefined;
134
+ } | undefined;
135
+ mcp?: {
136
+ transport: "stdio" | "sse" | "http";
137
+ queryTool: string;
138
+ url?: string | undefined;
139
+ command?: string | undefined;
140
+ args?: string[] | undefined;
141
+ schemaIntrospection?: "resources" | "informationSchema" | undefined;
142
+ } | undefined;
143
+ pool?: {
144
+ max?: number | undefined;
145
+ idleTimeoutMs?: number | undefined;
146
+ statementTimeoutMs?: number | undefined;
147
+ acquireTimeoutMs?: number | undefined;
148
+ eagerInit?: boolean | undefined;
149
+ } | undefined;
150
+ scoping?: {
151
+ enforcement: "verify" | "rls" | "inject";
152
+ contextVars: Record<string, string>;
153
+ } | undefined;
154
+ queryConstraints?: {
155
+ maxRows?: number | undefined;
156
+ forbidSelectStar?: boolean | undefined;
157
+ forbidUnknownTables?: boolean | undefined;
158
+ forbidUnknownColumns?: boolean | undefined;
159
+ } | undefined;
160
+ guidedQueries?: string | undefined;
161
+ audit?: {
162
+ logQueryText?: boolean | undefined;
163
+ logRowCounts?: boolean | undefined;
164
+ synchronousFlush?: boolean | undefined;
165
+ } | undefined;
166
+ schemaDriftPolicy?: {
167
+ addedColumnsOnPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
168
+ addedColumnsOnNonPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
169
+ removedColumnsReferencedInPolicy?: "failLoad" | "warn" | "ignore" | undefined;
170
+ } | undefined;
171
+ weakerThresholdsAccepted?: boolean | undefined;
172
+ }, {
173
+ driver: string;
174
+ protocol: "sql";
175
+ dialect: string;
176
+ schemaPath: string;
177
+ parser?: string | undefined;
178
+ connection?: {
179
+ url: string;
180
+ ssl?: "require" | "disable" | "prefer" | undefined;
181
+ } | undefined;
182
+ mcp?: {
183
+ transport: "stdio" | "sse" | "http";
184
+ url?: string | undefined;
185
+ command?: string | undefined;
186
+ args?: string[] | undefined;
187
+ queryTool?: string | undefined;
188
+ schemaIntrospection?: "resources" | "informationSchema" | undefined;
189
+ } | undefined;
190
+ pool?: {
191
+ max?: number | undefined;
192
+ idleTimeoutMs?: number | undefined;
193
+ statementTimeoutMs?: number | undefined;
194
+ acquireTimeoutMs?: number | undefined;
195
+ eagerInit?: boolean | undefined;
196
+ } | undefined;
197
+ scoping?: {
198
+ enforcement: "verify" | "rls" | "inject";
199
+ contextVars: Record<string, string>;
200
+ } | undefined;
201
+ queryConstraints?: {
202
+ maxRows?: number | undefined;
203
+ forbidSelectStar?: boolean | undefined;
204
+ forbidUnknownTables?: boolean | undefined;
205
+ forbidUnknownColumns?: boolean | undefined;
206
+ } | undefined;
207
+ guidedQueries?: string | undefined;
208
+ audit?: {
209
+ logQueryText?: boolean | undefined;
210
+ logRowCounts?: boolean | undefined;
211
+ synchronousFlush?: boolean | undefined;
212
+ } | undefined;
213
+ schemaDriftPolicy?: {
214
+ addedColumnsOnPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
215
+ addedColumnsOnNonPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
216
+ removedColumnsReferencedInPolicy?: "failLoad" | "warn" | "ignore" | undefined;
217
+ } | undefined;
218
+ weakerThresholdsAccepted?: boolean | undefined;
219
+ }>, {
220
+ driver: string;
221
+ protocol: "sql";
222
+ dialect: string;
223
+ schemaPath: string;
224
+ parser?: string | undefined;
225
+ connection?: {
226
+ url: string;
227
+ ssl?: "require" | "disable" | "prefer" | undefined;
228
+ } | undefined;
229
+ mcp?: {
230
+ transport: "stdio" | "sse" | "http";
231
+ queryTool: string;
232
+ url?: string | undefined;
233
+ command?: string | undefined;
234
+ args?: string[] | undefined;
235
+ schemaIntrospection?: "resources" | "informationSchema" | undefined;
236
+ } | undefined;
237
+ pool?: {
238
+ max?: number | undefined;
239
+ idleTimeoutMs?: number | undefined;
240
+ statementTimeoutMs?: number | undefined;
241
+ acquireTimeoutMs?: number | undefined;
242
+ eagerInit?: boolean | undefined;
243
+ } | undefined;
244
+ scoping?: {
245
+ enforcement: "verify" | "rls" | "inject";
246
+ contextVars: Record<string, string>;
247
+ } | undefined;
248
+ queryConstraints?: {
249
+ maxRows?: number | undefined;
250
+ forbidSelectStar?: boolean | undefined;
251
+ forbidUnknownTables?: boolean | undefined;
252
+ forbidUnknownColumns?: boolean | undefined;
253
+ } | undefined;
254
+ guidedQueries?: string | undefined;
255
+ audit?: {
256
+ logQueryText?: boolean | undefined;
257
+ logRowCounts?: boolean | undefined;
258
+ synchronousFlush?: boolean | undefined;
259
+ } | undefined;
260
+ schemaDriftPolicy?: {
261
+ addedColumnsOnPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
262
+ addedColumnsOnNonPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
263
+ removedColumnsReferencedInPolicy?: "failLoad" | "warn" | "ignore" | undefined;
264
+ } | undefined;
265
+ weakerThresholdsAccepted?: boolean | undefined;
266
+ }, {
267
+ driver: string;
268
+ protocol: "sql";
269
+ dialect: string;
270
+ schemaPath: string;
271
+ parser?: string | undefined;
272
+ connection?: {
273
+ url: string;
274
+ ssl?: "require" | "disable" | "prefer" | undefined;
275
+ } | undefined;
276
+ mcp?: {
277
+ transport: "stdio" | "sse" | "http";
278
+ url?: string | undefined;
279
+ command?: string | undefined;
280
+ args?: string[] | undefined;
281
+ queryTool?: string | undefined;
282
+ schemaIntrospection?: "resources" | "informationSchema" | undefined;
283
+ } | undefined;
284
+ pool?: {
285
+ max?: number | undefined;
286
+ idleTimeoutMs?: number | undefined;
287
+ statementTimeoutMs?: number | undefined;
288
+ acquireTimeoutMs?: number | undefined;
289
+ eagerInit?: boolean | undefined;
290
+ } | undefined;
291
+ scoping?: {
292
+ enforcement: "verify" | "rls" | "inject";
293
+ contextVars: Record<string, string>;
294
+ } | undefined;
295
+ queryConstraints?: {
296
+ maxRows?: number | undefined;
297
+ forbidSelectStar?: boolean | undefined;
298
+ forbidUnknownTables?: boolean | undefined;
299
+ forbidUnknownColumns?: boolean | undefined;
300
+ } | undefined;
301
+ guidedQueries?: string | undefined;
302
+ audit?: {
303
+ logQueryText?: boolean | undefined;
304
+ logRowCounts?: boolean | undefined;
305
+ synchronousFlush?: boolean | undefined;
306
+ } | undefined;
307
+ schemaDriftPolicy?: {
308
+ addedColumnsOnPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
309
+ addedColumnsOnNonPiiTables?: "failLoad" | "warn" | "ignore" | undefined;
310
+ removedColumnsReferencedInPolicy?: "failLoad" | "warn" | "ignore" | undefined;
311
+ } | undefined;
312
+ weakerThresholdsAccepted?: boolean | undefined;
313
+ }>;
314
+ export type SqlConnectionConfig = z.infer<typeof SqlConnectionConfigSchema>;
315
+ export declare const SchemaJsonSchema: z.ZodEffects<z.ZodObject<{
316
+ tables: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
317
+ access: z.ZodEnum<["read", "readWrite", "denied"]>;
318
+ scoping: z.ZodOptional<z.ZodObject<{
319
+ column: z.ZodString;
320
+ boundFrom: z.ZodString;
321
+ }, "strip", z.ZodTypeAny, {
322
+ column: string;
323
+ boundFrom: string;
324
+ }, {
325
+ column: string;
326
+ boundFrom: string;
327
+ }>>;
328
+ sensitivity: z.ZodOptional<z.ZodEnum<["pii", "phi", "pci", "internal"]>>;
329
+ columns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodObject<{
330
+ policy: z.ZodEnum<["allow", "redact", "roleGated", "neverRetrieve"]>;
331
+ sensitivity: z.ZodOptional<z.ZodString>;
332
+ allowedRoles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
333
+ }, "strip", z.ZodTypeAny, {
334
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
335
+ sensitivity?: string | undefined;
336
+ allowedRoles?: string[] | undefined;
337
+ }, {
338
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
339
+ sensitivity?: string | undefined;
340
+ allowedRoles?: string[] | undefined;
341
+ }>, {
342
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
343
+ sensitivity?: string | undefined;
344
+ allowedRoles?: string[] | undefined;
345
+ }, {
346
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
347
+ sensitivity?: string | undefined;
348
+ allowedRoles?: string[] | undefined;
349
+ }>>>;
350
+ writeThresholds: z.ZodOptional<z.ZodArray<z.ZodObject<{
351
+ operation: z.ZodEnum<["update", "delete", "insert", "merge"]>;
352
+ above: z.ZodNumber;
353
+ escalate: z.ZodEnum<["review", "block", "never"]>;
354
+ }, "strip", z.ZodTypeAny, {
355
+ operation: "update" | "delete" | "insert" | "merge";
356
+ above: number;
357
+ escalate: "never" | "review" | "block";
358
+ }, {
359
+ operation: "update" | "delete" | "insert" | "merge";
360
+ above: number;
361
+ escalate: "never" | "review" | "block";
362
+ }>, "many">>;
363
+ }, "strip", z.ZodTypeAny, {
364
+ access: "read" | "readWrite" | "denied";
365
+ scoping?: {
366
+ column: string;
367
+ boundFrom: string;
368
+ } | undefined;
369
+ sensitivity?: "pii" | "phi" | "pci" | "internal" | undefined;
370
+ columns?: Record<string, {
371
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
372
+ sensitivity?: string | undefined;
373
+ allowedRoles?: string[] | undefined;
374
+ }> | undefined;
375
+ writeThresholds?: {
376
+ operation: "update" | "delete" | "insert" | "merge";
377
+ above: number;
378
+ escalate: "never" | "review" | "block";
379
+ }[] | undefined;
380
+ }, {
381
+ access: "read" | "readWrite" | "denied";
382
+ scoping?: {
383
+ column: string;
384
+ boundFrom: string;
385
+ } | undefined;
386
+ sensitivity?: "pii" | "phi" | "pci" | "internal" | undefined;
387
+ columns?: Record<string, {
388
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
389
+ sensitivity?: string | undefined;
390
+ allowedRoles?: string[] | undefined;
391
+ }> | undefined;
392
+ writeThresholds?: {
393
+ operation: "update" | "delete" | "insert" | "merge";
394
+ above: number;
395
+ escalate: "never" | "review" | "block";
396
+ }[] | undefined;
397
+ }>, {
398
+ access: "read" | "readWrite" | "denied";
399
+ scoping?: {
400
+ column: string;
401
+ boundFrom: string;
402
+ } | undefined;
403
+ sensitivity?: "pii" | "phi" | "pci" | "internal" | undefined;
404
+ columns?: Record<string, {
405
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
406
+ sensitivity?: string | undefined;
407
+ allowedRoles?: string[] | undefined;
408
+ }> | undefined;
409
+ writeThresholds?: {
410
+ operation: "update" | "delete" | "insert" | "merge";
411
+ above: number;
412
+ escalate: "never" | "review" | "block";
413
+ }[] | undefined;
414
+ }, {
415
+ access: "read" | "readWrite" | "denied";
416
+ scoping?: {
417
+ column: string;
418
+ boundFrom: string;
419
+ } | undefined;
420
+ sensitivity?: "pii" | "phi" | "pci" | "internal" | undefined;
421
+ columns?: Record<string, {
422
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
423
+ sensitivity?: string | undefined;
424
+ allowedRoles?: string[] | undefined;
425
+ }> | undefined;
426
+ writeThresholds?: {
427
+ operation: "update" | "delete" | "insert" | "merge";
428
+ above: number;
429
+ escalate: "never" | "review" | "block";
430
+ }[] | undefined;
431
+ }>>;
432
+ }, "strip", z.ZodTypeAny, {
433
+ tables: Record<string, {
434
+ access: "read" | "readWrite" | "denied";
435
+ scoping?: {
436
+ column: string;
437
+ boundFrom: string;
438
+ } | undefined;
439
+ sensitivity?: "pii" | "phi" | "pci" | "internal" | undefined;
440
+ columns?: Record<string, {
441
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
442
+ sensitivity?: string | undefined;
443
+ allowedRoles?: string[] | undefined;
444
+ }> | undefined;
445
+ writeThresholds?: {
446
+ operation: "update" | "delete" | "insert" | "merge";
447
+ above: number;
448
+ escalate: "never" | "review" | "block";
449
+ }[] | undefined;
450
+ }>;
451
+ }, {
452
+ tables: Record<string, {
453
+ access: "read" | "readWrite" | "denied";
454
+ scoping?: {
455
+ column: string;
456
+ boundFrom: string;
457
+ } | undefined;
458
+ sensitivity?: "pii" | "phi" | "pci" | "internal" | undefined;
459
+ columns?: Record<string, {
460
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
461
+ sensitivity?: string | undefined;
462
+ allowedRoles?: string[] | undefined;
463
+ }> | undefined;
464
+ writeThresholds?: {
465
+ operation: "update" | "delete" | "insert" | "merge";
466
+ above: number;
467
+ escalate: "never" | "review" | "block";
468
+ }[] | undefined;
469
+ }>;
470
+ }>, {
471
+ tables: Record<string, {
472
+ access: "read" | "readWrite" | "denied";
473
+ scoping?: {
474
+ column: string;
475
+ boundFrom: string;
476
+ } | undefined;
477
+ sensitivity?: "pii" | "phi" | "pci" | "internal" | undefined;
478
+ columns?: Record<string, {
479
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
480
+ sensitivity?: string | undefined;
481
+ allowedRoles?: string[] | undefined;
482
+ }> | undefined;
483
+ writeThresholds?: {
484
+ operation: "update" | "delete" | "insert" | "merge";
485
+ above: number;
486
+ escalate: "never" | "review" | "block";
487
+ }[] | undefined;
488
+ }>;
489
+ }, {
490
+ tables: Record<string, {
491
+ access: "read" | "readWrite" | "denied";
492
+ scoping?: {
493
+ column: string;
494
+ boundFrom: string;
495
+ } | undefined;
496
+ sensitivity?: "pii" | "phi" | "pci" | "internal" | undefined;
497
+ columns?: Record<string, {
498
+ policy: "allow" | "redact" | "roleGated" | "neverRetrieve";
499
+ sensitivity?: string | undefined;
500
+ allowedRoles?: string[] | undefined;
501
+ }> | undefined;
502
+ writeThresholds?: {
503
+ operation: "update" | "delete" | "insert" | "merge";
504
+ above: number;
505
+ escalate: "never" | "review" | "block";
506
+ }[] | undefined;
507
+ }>;
508
+ }>;
509
+ export type SchemaJson = z.infer<typeof SchemaJsonSchema>;