@adminiumjs/engine 0.1.0-rc.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.
Files changed (94) hide show
  1. package/LICENSE +661 -0
  2. package/dist/adapter-registry.d.ts +62 -0
  3. package/dist/adapter-registry.d.ts.map +1 -0
  4. package/dist/adapter-registry.js +75 -0
  5. package/dist/adapter-registry.js.map +1 -0
  6. package/dist/adapter.d.ts +384 -0
  7. package/dist/adapter.d.ts.map +1 -0
  8. package/dist/adapter.js +54 -0
  9. package/dist/adapter.js.map +1 -0
  10. package/dist/capabilities.d.ts +57 -0
  11. package/dist/capabilities.d.ts.map +1 -0
  12. package/dist/capabilities.js +131 -0
  13. package/dist/capabilities.js.map +1 -0
  14. package/dist/classify/columns.d.ts +57 -0
  15. package/dist/classify/columns.d.ts.map +1 -0
  16. package/dist/classify/columns.js +535 -0
  17. package/dist/classify/columns.js.map +1 -0
  18. package/dist/classify/index.d.ts +29 -0
  19. package/dist/classify/index.d.ts.map +1 -0
  20. package/dist/classify/index.js +44 -0
  21. package/dist/classify/index.js.map +1 -0
  22. package/dist/classify/names.d.ts +11 -0
  23. package/dist/classify/names.d.ts.map +1 -0
  24. package/dist/classify/names.js +19 -0
  25. package/dist/classify/names.js.map +1 -0
  26. package/dist/classify/pii.d.ts +29 -0
  27. package/dist/classify/pii.d.ts.map +1 -0
  28. package/dist/classify/pii.js +55 -0
  29. package/dist/classify/pii.js.map +1 -0
  30. package/dist/classify/tables.d.ts +64 -0
  31. package/dist/classify/tables.d.ts.map +1 -0
  32. package/dist/classify/tables.js +303 -0
  33. package/dist/classify/tables.js.map +1 -0
  34. package/dist/config-schema/envelope.d.ts +83 -0
  35. package/dist/config-schema/envelope.d.ts.map +1 -0
  36. package/dist/config-schema/envelope.js +87 -0
  37. package/dist/config-schema/envelope.js.map +1 -0
  38. package/dist/config-schema/index.d.ts +14 -0
  39. package/dist/config-schema/index.d.ts.map +1 -0
  40. package/dist/config-schema/index.js +15 -0
  41. package/dist/config-schema/index.js.map +1 -0
  42. package/dist/config-schema/migrations.d.ts +44 -0
  43. package/dist/config-schema/migrations.d.ts.map +1 -0
  44. package/dist/config-schema/migrations.js +62 -0
  45. package/dist/config-schema/migrations.js.map +1 -0
  46. package/dist/generate/archetype.d.ts +76 -0
  47. package/dist/generate/archetype.d.ts.map +1 -0
  48. package/dist/generate/archetype.js +250 -0
  49. package/dist/generate/archetype.js.map +1 -0
  50. package/dist/generate/crud.d.ts +36 -0
  51. package/dist/generate/crud.d.ts.map +1 -0
  52. package/dist/generate/crud.js +45 -0
  53. package/dist/generate/crud.js.map +1 -0
  54. package/dist/generate/dashboard.d.ts +43 -0
  55. package/dist/generate/dashboard.d.ts.map +1 -0
  56. package/dist/generate/dashboard.js +61 -0
  57. package/dist/generate/dashboard.js.map +1 -0
  58. package/dist/generate/domains.d.ts +29 -0
  59. package/dist/generate/domains.d.ts.map +1 -0
  60. package/dist/generate/domains.js +145 -0
  61. package/dist/generate/domains.js.map +1 -0
  62. package/dist/generate/index.d.ts +78 -0
  63. package/dist/generate/index.d.ts.map +1 -0
  64. package/dist/generate/index.js +301 -0
  65. package/dist/generate/index.js.map +1 -0
  66. package/dist/generate/util.d.ts +46 -0
  67. package/dist/generate/util.d.ts.map +1 -0
  68. package/dist/generate/util.js +123 -0
  69. package/dist/generate/util.js.map +1 -0
  70. package/dist/index.d.ts +8 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +8 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/schema-model.d.ts +1853 -0
  75. package/dist/schema-model.d.ts.map +1 -0
  76. package/dist/schema-model.js +463 -0
  77. package/dist/schema-model.js.map +1 -0
  78. package/dist/snapshot/diff.d.ts +258 -0
  79. package/dist/snapshot/diff.d.ts.map +1 -0
  80. package/dist/snapshot/diff.js +151 -0
  81. package/dist/snapshot/diff.js.map +1 -0
  82. package/dist/snapshot/hash.d.ts +23 -0
  83. package/dist/snapshot/hash.d.ts.map +1 -0
  84. package/dist/snapshot/hash.js +47 -0
  85. package/dist/snapshot/hash.js.map +1 -0
  86. package/dist/snapshot/index.d.ts +28 -0
  87. package/dist/snapshot/index.d.ts.map +1 -0
  88. package/dist/snapshot/index.js +26 -0
  89. package/dist/snapshot/index.js.map +1 -0
  90. package/dist/snapshot/sha256.d.ts +14 -0
  91. package/dist/snapshot/sha256.d.ts.map +1 -0
  92. package/dist/snapshot/sha256.js +99 -0
  93. package/dist/snapshot/sha256.js.map +1 -0
  94. package/package.json +37 -0
@@ -0,0 +1,1853 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The normalized schema model (the IR) — 05-introspection-engine.md §2.
4
+ *
5
+ * One model for everything: live introspection, every schema-import parser,
6
+ * the LLM round-trip, snapshots, and the generator all speak this shape.
7
+ * TypeScript types are `z.infer<>` of the Zod schemas below — never
8
+ * hand-duplicated. All objects are strict so unknown keys fail loudly, and
9
+ * every value is JSON-native (no Dates, no undefined-bearing unions) because
10
+ * the serialized model persists verbatim into
11
+ * `adminium_schema_snapshots.model`.
12
+ *
13
+ * Minimal valid IR (§2.3): `irVersion`, `dialect: 'generic'`, `name`, one
14
+ * table with one column — everything else has defaults so third-party
15
+ * emitters stay small.
16
+ */
17
+ export declare const IR_VERSION: 1;
18
+ export declare const DIALECTS: readonly ["postgres", "mysql", "sqlite", "generic"];
19
+ /** 'generic' = ORM import that doesn't pin a dialect. */
20
+ export declare const dialectSchema: z.ZodEnum<{
21
+ postgres: "postgres";
22
+ mysql: "mysql";
23
+ sqlite: "sqlite";
24
+ generic: "generic";
25
+ }>;
26
+ export type Dialect = z.infer<typeof dialectSchema>;
27
+ export declare const IMPORT_FORMATS: readonly ["sql-ddl", "prisma", "drizzle", "typeorm", "sequelize", "rails", "django", "json-ir"];
28
+ export declare const importFormatSchema: z.ZodEnum<{
29
+ "sql-ddl": "sql-ddl";
30
+ prisma: "prisma";
31
+ drizzle: "drizzle";
32
+ typeorm: "typeorm";
33
+ sequelize: "sequelize";
34
+ rails: "rails";
35
+ django: "django";
36
+ "json-ir": "json-ir";
37
+ }>;
38
+ export type ImportFormat = z.infer<typeof importFormatSchema>;
39
+ /** §2.2 — every adapter/parser maps native types onto this closed set. */
40
+ export declare const LOGICAL_TYPES: readonly ["text", "varchar", "integer", "bigint", "decimal", "float", "boolean", "date", "time", "timestamp", "timestamptz", "interval", "uuid", "json", "binary", "enum", "geometry", "inet", "unknown"];
41
+ export declare const logicalTypeSchema: z.ZodEnum<{
42
+ bigint: "bigint";
43
+ boolean: "boolean";
44
+ text: "text";
45
+ varchar: "varchar";
46
+ integer: "integer";
47
+ decimal: "decimal";
48
+ float: "float";
49
+ date: "date";
50
+ time: "time";
51
+ timestamp: "timestamp";
52
+ timestamptz: "timestamptz";
53
+ interval: "interval";
54
+ uuid: "uuid";
55
+ json: "json";
56
+ binary: "binary";
57
+ enum: "enum";
58
+ geometry: "geometry";
59
+ inet: "inet";
60
+ unknown: "unknown";
61
+ }>;
62
+ export type LogicalType = z.infer<typeof logicalTypeSchema>;
63
+ /** Where a model came from: a live connection or a schema import. */
64
+ export declare const modelSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
65
+ kind: z.ZodLiteral<"live">;
66
+ connectionId: z.ZodString;
67
+ }, z.core.$strict>, z.ZodObject<{
68
+ kind: z.ZodLiteral<"import">;
69
+ format: z.ZodEnum<{
70
+ "sql-ddl": "sql-ddl";
71
+ prisma: "prisma";
72
+ drizzle: "drizzle";
73
+ typeorm: "typeorm";
74
+ sequelize: "sequelize";
75
+ rails: "rails";
76
+ django: "django";
77
+ "json-ir": "json-ir";
78
+ }>;
79
+ fileName: z.ZodOptional<z.ZodString>;
80
+ }, z.core.$strict>], "kind">;
81
+ export type ModelSource = z.infer<typeof modelSourceSchema>;
82
+ /**
83
+ * Capability flags describing what the SOURCE could express (drives UI
84
+ * degradation) — 05 §2.1 `AdapterCapabilities`. Adapters also expose these
85
+ * statically per dialect; imports set them to what the format expresses.
86
+ */
87
+ export declare const adapterCapabilitiesSchema: z.ZodObject<{
88
+ hasEnums: z.ZodDefault<z.ZodBoolean>;
89
+ hasFKs: z.ZodDefault<z.ZodBoolean>;
90
+ hasSchemas: z.ZodDefault<z.ZodBoolean>;
91
+ hasComments: z.ZodDefault<z.ZodBoolean>;
92
+ hasChecks: z.ZodDefault<z.ZodBoolean>;
93
+ hasRLS: z.ZodDefault<z.ZodBoolean>;
94
+ hasMaterializedViews: z.ZodDefault<z.ZodBoolean>;
95
+ hasRowEstimates: z.ZodDefault<z.ZodBoolean>;
96
+ supportsStatementTimeout: z.ZodDefault<z.ZodBoolean>;
97
+ supportsReturning: z.ZodDefault<z.ZodBoolean>;
98
+ maxIdentifierLength: z.ZodDefault<z.ZodNumber>;
99
+ }, z.core.$strict>;
100
+ export type AdapterCapabilities = z.infer<typeof adapterCapabilitiesSchema>;
101
+ /** Workplan alias — several docs call these "capability flags". */
102
+ export declare const capabilityFlagsSchema: z.ZodObject<{
103
+ hasEnums: z.ZodDefault<z.ZodBoolean>;
104
+ hasFKs: z.ZodDefault<z.ZodBoolean>;
105
+ hasSchemas: z.ZodDefault<z.ZodBoolean>;
106
+ hasComments: z.ZodDefault<z.ZodBoolean>;
107
+ hasChecks: z.ZodDefault<z.ZodBoolean>;
108
+ hasRLS: z.ZodDefault<z.ZodBoolean>;
109
+ hasMaterializedViews: z.ZodDefault<z.ZodBoolean>;
110
+ hasRowEstimates: z.ZodDefault<z.ZodBoolean>;
111
+ supportsStatementTimeout: z.ZodDefault<z.ZodBoolean>;
112
+ supportsReturning: z.ZodDefault<z.ZodBoolean>;
113
+ maxIdentifierLength: z.ZodDefault<z.ZodNumber>;
114
+ }, z.core.$strict>;
115
+ export type CapabilityFlags = AdapterCapabilities;
116
+ /** §2.1 `EnumDef` — native = pg CREATE TYPE AS ENUM · column-type = MySQL enum(...) · check = CHECK (col IN (...)). */
117
+ export declare const enumDefSchema: z.ZodObject<{
118
+ id: z.ZodString;
119
+ name: z.ZodString;
120
+ values: z.ZodArray<z.ZodString>;
121
+ source: z.ZodDefault<z.ZodEnum<{
122
+ check: "check";
123
+ import: "import";
124
+ native: "native";
125
+ "column-type": "column-type";
126
+ }>>;
127
+ }, z.core.$strict>;
128
+ export type EnumDef = z.infer<typeof enumDefSchema>;
129
+ export declare const indexModelSchema: z.ZodObject<{
130
+ name: z.ZodString;
131
+ columns: z.ZodDefault<z.ZodArray<z.ZodString>>;
132
+ expression: z.ZodDefault<z.ZodNullable<z.ZodString>>;
133
+ unique: z.ZodDefault<z.ZodBoolean>;
134
+ primary: z.ZodDefault<z.ZodBoolean>;
135
+ method: z.ZodDefault<z.ZodNullable<z.ZodString>>;
136
+ partial: z.ZodDefault<z.ZodBoolean>;
137
+ }, z.core.$strict>;
138
+ export type IndexModel = z.infer<typeof indexModelSchema>;
139
+ export declare const columnDefaultSchema: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
140
+ kind: z.ZodEnum<{
141
+ literal: "literal";
142
+ expression: "expression";
143
+ }>;
144
+ text: z.ZodString;
145
+ }, z.core.$strict>, z.ZodObject<{
146
+ kind: z.ZodEnum<{
147
+ uuid: "uuid";
148
+ autoincrement: "autoincrement";
149
+ now: "now";
150
+ }>;
151
+ }, z.core.$strict>]>>;
152
+ export type ColumnDefault = z.infer<typeof columnDefaultSchema>;
153
+ /**
154
+ * §7 column semantic tags — one kebab-case id per §7.1 rule row, in
155
+ * precedence order. Later docs and the LLM prompt reference these exact ids;
156
+ * the classifier (classify/columns.ts, 05-T07) must emit only these.
157
+ */
158
+ export declare const SEMANTIC_TAGS: readonly ["secret", "pk-id", "fk", "money", "percent", "score", "status-workflow", "category-enum", "created-at", "updated-at", "date-range", "event-timestamp", "duration", "geo-point", "geo-region", "person-name", "email", "phone", "image-url", "file-ref", "url", "boolean-flag", "color", "tags", "slug", "ip-address", "json-config", "external-id", "free-text", "plain"];
159
+ export declare const semanticTagSchema: z.ZodEnum<{
160
+ secret: "secret";
161
+ "pk-id": "pk-id";
162
+ fk: "fk";
163
+ money: "money";
164
+ percent: "percent";
165
+ score: "score";
166
+ "status-workflow": "status-workflow";
167
+ "category-enum": "category-enum";
168
+ "created-at": "created-at";
169
+ "updated-at": "updated-at";
170
+ "date-range": "date-range";
171
+ "event-timestamp": "event-timestamp";
172
+ duration: "duration";
173
+ "geo-point": "geo-point";
174
+ "geo-region": "geo-region";
175
+ "person-name": "person-name";
176
+ email: "email";
177
+ phone: "phone";
178
+ "image-url": "image-url";
179
+ "file-ref": "file-ref";
180
+ url: "url";
181
+ "boolean-flag": "boolean-flag";
182
+ color: "color";
183
+ tags: "tags";
184
+ slug: "slug";
185
+ "ip-address": "ip-address";
186
+ "json-config": "json-config";
187
+ "external-id": "external-id";
188
+ "free-text": "free-text";
189
+ plain: "plain";
190
+ }>;
191
+ export type SemanticTag = z.infer<typeof semanticTagSchema>;
192
+ /** §7.2 PII kinds — a flag layer independent of the primary semantic. */
193
+ export declare const PII_KINDS: readonly ["email", "phone", "ip", "person-name", "address", "dob", "gov-id", "payment-id", "geo-precise"];
194
+ export declare const piiKindSchema: z.ZodEnum<{
195
+ "person-name": "person-name";
196
+ email: "email";
197
+ phone: "phone";
198
+ ip: "ip";
199
+ address: "address";
200
+ dob: "dob";
201
+ "gov-id": "gov-id";
202
+ "payment-id": "payment-id";
203
+ "geo-precise": "geo-precise";
204
+ }>;
205
+ export type PiiKind = z.infer<typeof piiKindSchema>;
206
+ /** §7 `ColumnSemantics` — classifier output persisted with the model. */
207
+ export declare const columnSemanticsSchema: z.ZodObject<{
208
+ primary: z.ZodEnum<{
209
+ secret: "secret";
210
+ "pk-id": "pk-id";
211
+ fk: "fk";
212
+ money: "money";
213
+ percent: "percent";
214
+ score: "score";
215
+ "status-workflow": "status-workflow";
216
+ "category-enum": "category-enum";
217
+ "created-at": "created-at";
218
+ "updated-at": "updated-at";
219
+ "date-range": "date-range";
220
+ "event-timestamp": "event-timestamp";
221
+ duration: "duration";
222
+ "geo-point": "geo-point";
223
+ "geo-region": "geo-region";
224
+ "person-name": "person-name";
225
+ email: "email";
226
+ phone: "phone";
227
+ "image-url": "image-url";
228
+ "file-ref": "file-ref";
229
+ url: "url";
230
+ "boolean-flag": "boolean-flag";
231
+ color: "color";
232
+ tags: "tags";
233
+ slug: "slug";
234
+ "ip-address": "ip-address";
235
+ "json-config": "json-config";
236
+ "external-id": "external-id";
237
+ "free-text": "free-text";
238
+ plain: "plain";
239
+ }>;
240
+ flags: z.ZodObject<{
241
+ secret: z.ZodDefault<z.ZodBoolean>;
242
+ pii: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
243
+ "person-name": "person-name";
244
+ email: "email";
245
+ phone: "phone";
246
+ ip: "ip";
247
+ address: "address";
248
+ dob: "dob";
249
+ "gov-id": "gov-id";
250
+ "payment-id": "payment-id";
251
+ "geo-precise": "geo-precise";
252
+ }>>>;
253
+ maskedByDefault: z.ZodDefault<z.ZodBoolean>;
254
+ }, z.core.$strict>;
255
+ format: z.ZodDefault<z.ZodNullable<z.ZodString>>;
256
+ pair: z.ZodDefault<z.ZodNullable<z.ZodObject<{
257
+ role: z.ZodEnum<{
258
+ start: "start";
259
+ end: "end";
260
+ lat: "lat";
261
+ lng: "lng";
262
+ "poly-type": "poly-type";
263
+ "poly-id": "poly-id";
264
+ }>;
265
+ partner: z.ZodString;
266
+ }, z.core.$strict>>>;
267
+ confidence: z.ZodNumber;
268
+ source: z.ZodDefault<z.ZodEnum<{
269
+ heuristic: "heuristic";
270
+ llm: "llm";
271
+ override: "override";
272
+ }>>;
273
+ }, z.core.$strict>;
274
+ export type ColumnSemantics = z.infer<typeof columnSemanticsSchema>;
275
+ /** §8 `TableSemantics` — table-shape classifier output. */
276
+ export declare const TABLE_ROLES: readonly ["entity", "join-table", "log", "people", "messages", "line-items", "system"];
277
+ export declare const tableRoleSchema: z.ZodEnum<{
278
+ entity: "entity";
279
+ "join-table": "join-table";
280
+ log: "log";
281
+ people: "people";
282
+ messages: "messages";
283
+ "line-items": "line-items";
284
+ system: "system";
285
+ }>;
286
+ export type TableRole = z.infer<typeof tableRoleSchema>;
287
+ export declare const tableSemanticsSchema: z.ZodObject<{
288
+ role: z.ZodEnum<{
289
+ entity: "entity";
290
+ "join-table": "join-table";
291
+ log: "log";
292
+ people: "people";
293
+ messages: "messages";
294
+ "line-items": "line-items";
295
+ system: "system";
296
+ }>;
297
+ hierarchy: z.ZodDefault<z.ZodNullable<z.ZodObject<{
298
+ parentColumn: z.ZodString;
299
+ }, z.core.$strict>>>;
300
+ polymorphic: z.ZodDefault<z.ZodArray<z.ZodObject<{
301
+ typeColumn: z.ZodString;
302
+ idColumn: z.ZodString;
303
+ targets: z.ZodDefault<z.ZodArray<z.ZodString>>;
304
+ }, z.core.$strict>>>;
305
+ }, z.core.$strict>;
306
+ export type TableSemantics = z.infer<typeof tableSemanticsSchema>;
307
+ export declare const columnModelSchema: z.ZodObject<{
308
+ name: z.ZodString;
309
+ ordinal: z.ZodDefault<z.ZodNumber>;
310
+ dbType: z.ZodDefault<z.ZodString>;
311
+ logicalType: z.ZodDefault<z.ZodEnum<{
312
+ bigint: "bigint";
313
+ boolean: "boolean";
314
+ text: "text";
315
+ varchar: "varchar";
316
+ integer: "integer";
317
+ decimal: "decimal";
318
+ float: "float";
319
+ date: "date";
320
+ time: "time";
321
+ timestamp: "timestamp";
322
+ timestamptz: "timestamptz";
323
+ interval: "interval";
324
+ uuid: "uuid";
325
+ json: "json";
326
+ binary: "binary";
327
+ enum: "enum";
328
+ geometry: "geometry";
329
+ inet: "inet";
330
+ unknown: "unknown";
331
+ }>>;
332
+ nullable: z.ZodDefault<z.ZodBoolean>;
333
+ default: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
334
+ kind: z.ZodEnum<{
335
+ literal: "literal";
336
+ expression: "expression";
337
+ }>;
338
+ text: z.ZodString;
339
+ }, z.core.$strict>, z.ZodObject<{
340
+ kind: z.ZodEnum<{
341
+ uuid: "uuid";
342
+ autoincrement: "autoincrement";
343
+ now: "now";
344
+ }>;
345
+ }, z.core.$strict>]>>>;
346
+ isPrimaryKey: z.ZodDefault<z.ZodBoolean>;
347
+ isUnique: z.ZodDefault<z.ZodBoolean>;
348
+ isGenerated: z.ZodDefault<z.ZodBoolean>;
349
+ enumRef: z.ZodDefault<z.ZodNullable<z.ZodString>>;
350
+ maxLength: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
351
+ numericPrecision: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
352
+ numericScale: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
353
+ isArray: z.ZodDefault<z.ZodBoolean>;
354
+ comment: z.ZodDefault<z.ZodNullable<z.ZodString>>;
355
+ references: z.ZodDefault<z.ZodNullable<z.ZodObject<{
356
+ tableId: z.ZodString;
357
+ column: z.ZodString;
358
+ }, z.core.$strict>>>;
359
+ semantics: z.ZodDefault<z.ZodNullable<z.ZodObject<{
360
+ primary: z.ZodEnum<{
361
+ secret: "secret";
362
+ "pk-id": "pk-id";
363
+ fk: "fk";
364
+ money: "money";
365
+ percent: "percent";
366
+ score: "score";
367
+ "status-workflow": "status-workflow";
368
+ "category-enum": "category-enum";
369
+ "created-at": "created-at";
370
+ "updated-at": "updated-at";
371
+ "date-range": "date-range";
372
+ "event-timestamp": "event-timestamp";
373
+ duration: "duration";
374
+ "geo-point": "geo-point";
375
+ "geo-region": "geo-region";
376
+ "person-name": "person-name";
377
+ email: "email";
378
+ phone: "phone";
379
+ "image-url": "image-url";
380
+ "file-ref": "file-ref";
381
+ url: "url";
382
+ "boolean-flag": "boolean-flag";
383
+ color: "color";
384
+ tags: "tags";
385
+ slug: "slug";
386
+ "ip-address": "ip-address";
387
+ "json-config": "json-config";
388
+ "external-id": "external-id";
389
+ "free-text": "free-text";
390
+ plain: "plain";
391
+ }>;
392
+ flags: z.ZodObject<{
393
+ secret: z.ZodDefault<z.ZodBoolean>;
394
+ pii: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
395
+ "person-name": "person-name";
396
+ email: "email";
397
+ phone: "phone";
398
+ ip: "ip";
399
+ address: "address";
400
+ dob: "dob";
401
+ "gov-id": "gov-id";
402
+ "payment-id": "payment-id";
403
+ "geo-precise": "geo-precise";
404
+ }>>>;
405
+ maskedByDefault: z.ZodDefault<z.ZodBoolean>;
406
+ }, z.core.$strict>;
407
+ format: z.ZodDefault<z.ZodNullable<z.ZodString>>;
408
+ pair: z.ZodDefault<z.ZodNullable<z.ZodObject<{
409
+ role: z.ZodEnum<{
410
+ start: "start";
411
+ end: "end";
412
+ lat: "lat";
413
+ lng: "lng";
414
+ "poly-type": "poly-type";
415
+ "poly-id": "poly-id";
416
+ }>;
417
+ partner: z.ZodString;
418
+ }, z.core.$strict>>>;
419
+ confidence: z.ZodNumber;
420
+ source: z.ZodDefault<z.ZodEnum<{
421
+ heuristic: "heuristic";
422
+ llm: "llm";
423
+ override: "override";
424
+ }>>;
425
+ }, z.core.$strict>>>;
426
+ }, z.core.$strict>;
427
+ export type ColumnModel = z.infer<typeof columnModelSchema>;
428
+ export declare const tableModelSchema: z.ZodPipe<z.ZodObject<{
429
+ id: z.ZodOptional<z.ZodString>;
430
+ schema: z.ZodDefault<z.ZodString>;
431
+ name: z.ZodString;
432
+ label: z.ZodOptional<z.ZodString>;
433
+ kind: z.ZodDefault<z.ZodEnum<{
434
+ table: "table";
435
+ view: "view";
436
+ "materialized-view": "materialized-view";
437
+ }>>;
438
+ comment: z.ZodDefault<z.ZodNullable<z.ZodString>>;
439
+ columns: z.ZodArray<z.ZodObject<{
440
+ name: z.ZodString;
441
+ ordinal: z.ZodDefault<z.ZodNumber>;
442
+ dbType: z.ZodDefault<z.ZodString>;
443
+ logicalType: z.ZodDefault<z.ZodEnum<{
444
+ bigint: "bigint";
445
+ boolean: "boolean";
446
+ text: "text";
447
+ varchar: "varchar";
448
+ integer: "integer";
449
+ decimal: "decimal";
450
+ float: "float";
451
+ date: "date";
452
+ time: "time";
453
+ timestamp: "timestamp";
454
+ timestamptz: "timestamptz";
455
+ interval: "interval";
456
+ uuid: "uuid";
457
+ json: "json";
458
+ binary: "binary";
459
+ enum: "enum";
460
+ geometry: "geometry";
461
+ inet: "inet";
462
+ unknown: "unknown";
463
+ }>>;
464
+ nullable: z.ZodDefault<z.ZodBoolean>;
465
+ default: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
466
+ kind: z.ZodEnum<{
467
+ literal: "literal";
468
+ expression: "expression";
469
+ }>;
470
+ text: z.ZodString;
471
+ }, z.core.$strict>, z.ZodObject<{
472
+ kind: z.ZodEnum<{
473
+ uuid: "uuid";
474
+ autoincrement: "autoincrement";
475
+ now: "now";
476
+ }>;
477
+ }, z.core.$strict>]>>>;
478
+ isPrimaryKey: z.ZodDefault<z.ZodBoolean>;
479
+ isUnique: z.ZodDefault<z.ZodBoolean>;
480
+ isGenerated: z.ZodDefault<z.ZodBoolean>;
481
+ enumRef: z.ZodDefault<z.ZodNullable<z.ZodString>>;
482
+ maxLength: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
483
+ numericPrecision: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
484
+ numericScale: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
485
+ isArray: z.ZodDefault<z.ZodBoolean>;
486
+ comment: z.ZodDefault<z.ZodNullable<z.ZodString>>;
487
+ references: z.ZodDefault<z.ZodNullable<z.ZodObject<{
488
+ tableId: z.ZodString;
489
+ column: z.ZodString;
490
+ }, z.core.$strict>>>;
491
+ semantics: z.ZodDefault<z.ZodNullable<z.ZodObject<{
492
+ primary: z.ZodEnum<{
493
+ secret: "secret";
494
+ "pk-id": "pk-id";
495
+ fk: "fk";
496
+ money: "money";
497
+ percent: "percent";
498
+ score: "score";
499
+ "status-workflow": "status-workflow";
500
+ "category-enum": "category-enum";
501
+ "created-at": "created-at";
502
+ "updated-at": "updated-at";
503
+ "date-range": "date-range";
504
+ "event-timestamp": "event-timestamp";
505
+ duration: "duration";
506
+ "geo-point": "geo-point";
507
+ "geo-region": "geo-region";
508
+ "person-name": "person-name";
509
+ email: "email";
510
+ phone: "phone";
511
+ "image-url": "image-url";
512
+ "file-ref": "file-ref";
513
+ url: "url";
514
+ "boolean-flag": "boolean-flag";
515
+ color: "color";
516
+ tags: "tags";
517
+ slug: "slug";
518
+ "ip-address": "ip-address";
519
+ "json-config": "json-config";
520
+ "external-id": "external-id";
521
+ "free-text": "free-text";
522
+ plain: "plain";
523
+ }>;
524
+ flags: z.ZodObject<{
525
+ secret: z.ZodDefault<z.ZodBoolean>;
526
+ pii: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
527
+ "person-name": "person-name";
528
+ email: "email";
529
+ phone: "phone";
530
+ ip: "ip";
531
+ address: "address";
532
+ dob: "dob";
533
+ "gov-id": "gov-id";
534
+ "payment-id": "payment-id";
535
+ "geo-precise": "geo-precise";
536
+ }>>>;
537
+ maskedByDefault: z.ZodDefault<z.ZodBoolean>;
538
+ }, z.core.$strict>;
539
+ format: z.ZodDefault<z.ZodNullable<z.ZodString>>;
540
+ pair: z.ZodDefault<z.ZodNullable<z.ZodObject<{
541
+ role: z.ZodEnum<{
542
+ start: "start";
543
+ end: "end";
544
+ lat: "lat";
545
+ lng: "lng";
546
+ "poly-type": "poly-type";
547
+ "poly-id": "poly-id";
548
+ }>;
549
+ partner: z.ZodString;
550
+ }, z.core.$strict>>>;
551
+ confidence: z.ZodNumber;
552
+ source: z.ZodDefault<z.ZodEnum<{
553
+ heuristic: "heuristic";
554
+ llm: "llm";
555
+ override: "override";
556
+ }>>;
557
+ }, z.core.$strict>>>;
558
+ }, z.core.$strict>>;
559
+ primaryKey: z.ZodDefault<z.ZodArray<z.ZodString>>;
560
+ uniques: z.ZodDefault<z.ZodArray<z.ZodObject<{
561
+ name: z.ZodNullable<z.ZodString>;
562
+ columns: z.ZodArray<z.ZodString>;
563
+ }, z.core.$strict>>>;
564
+ checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
565
+ name: z.ZodNullable<z.ZodString>;
566
+ expression: z.ZodString;
567
+ }, z.core.$strict>>>;
568
+ indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
569
+ name: z.ZodString;
570
+ columns: z.ZodDefault<z.ZodArray<z.ZodString>>;
571
+ expression: z.ZodDefault<z.ZodNullable<z.ZodString>>;
572
+ unique: z.ZodDefault<z.ZodBoolean>;
573
+ primary: z.ZodDefault<z.ZodBoolean>;
574
+ method: z.ZodDefault<z.ZodNullable<z.ZodString>>;
575
+ partial: z.ZodDefault<z.ZodBoolean>;
576
+ }, z.core.$strict>>>;
577
+ rowCountEstimate: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
578
+ rowCountExact: z.ZodDefault<z.ZodBoolean>;
579
+ sizeBytes: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
580
+ activity: z.ZodDefault<z.ZodNullable<z.ZodObject<{
581
+ inserts: z.ZodNumber;
582
+ updates: z.ZodNumber;
583
+ deletes: z.ZodNumber;
584
+ }, z.core.$strict>>>;
585
+ rls: z.ZodDefault<z.ZodNullable<z.ZodObject<{
586
+ enabled: z.ZodBoolean;
587
+ forced: z.ZodBoolean;
588
+ policyCount: z.ZodNumber;
589
+ }, z.core.$strict>>>;
590
+ system: z.ZodDefault<z.ZodBoolean>;
591
+ semantics: z.ZodDefault<z.ZodNullable<z.ZodObject<{
592
+ role: z.ZodEnum<{
593
+ entity: "entity";
594
+ "join-table": "join-table";
595
+ log: "log";
596
+ people: "people";
597
+ messages: "messages";
598
+ "line-items": "line-items";
599
+ system: "system";
600
+ }>;
601
+ hierarchy: z.ZodDefault<z.ZodNullable<z.ZodObject<{
602
+ parentColumn: z.ZodString;
603
+ }, z.core.$strict>>>;
604
+ polymorphic: z.ZodDefault<z.ZodArray<z.ZodObject<{
605
+ typeColumn: z.ZodString;
606
+ idColumn: z.ZodString;
607
+ targets: z.ZodDefault<z.ZodArray<z.ZodString>>;
608
+ }, z.core.$strict>>>;
609
+ }, z.core.$strict>>>;
610
+ }, z.core.$strict>, z.ZodTransform<{
611
+ id: string;
612
+ schema: string;
613
+ name: string;
614
+ kind: "table" | "view" | "materialized-view";
615
+ comment: string | null;
616
+ columns: {
617
+ name: string;
618
+ ordinal: number;
619
+ dbType: string;
620
+ logicalType: "bigint" | "boolean" | "text" | "varchar" | "integer" | "decimal" | "float" | "date" | "time" | "timestamp" | "timestamptz" | "interval" | "uuid" | "json" | "binary" | "enum" | "geometry" | "inet" | "unknown";
621
+ nullable: boolean;
622
+ default: {
623
+ kind: "literal" | "expression";
624
+ text: string;
625
+ } | {
626
+ kind: "uuid" | "autoincrement" | "now";
627
+ } | null;
628
+ isPrimaryKey: boolean;
629
+ isUnique: boolean;
630
+ isGenerated: boolean;
631
+ enumRef: string | null;
632
+ maxLength: number | null;
633
+ numericPrecision: number | null;
634
+ numericScale: number | null;
635
+ isArray: boolean;
636
+ comment: string | null;
637
+ references: {
638
+ tableId: string;
639
+ column: string;
640
+ } | null;
641
+ semantics: {
642
+ primary: "secret" | "pk-id" | "fk" | "money" | "percent" | "score" | "status-workflow" | "category-enum" | "created-at" | "updated-at" | "date-range" | "event-timestamp" | "duration" | "geo-point" | "geo-region" | "person-name" | "email" | "phone" | "image-url" | "file-ref" | "url" | "boolean-flag" | "color" | "tags" | "slug" | "ip-address" | "json-config" | "external-id" | "free-text" | "plain";
643
+ flags: {
644
+ secret: boolean;
645
+ pii: "person-name" | "email" | "phone" | "ip" | "address" | "dob" | "gov-id" | "payment-id" | "geo-precise" | null;
646
+ maskedByDefault: boolean;
647
+ };
648
+ format: string | null;
649
+ pair: {
650
+ role: "start" | "end" | "lat" | "lng" | "poly-type" | "poly-id";
651
+ partner: string;
652
+ } | null;
653
+ confidence: number;
654
+ source: "heuristic" | "llm" | "override";
655
+ } | null;
656
+ }[];
657
+ primaryKey: string[];
658
+ uniques: {
659
+ name: string | null;
660
+ columns: string[];
661
+ }[];
662
+ checks: {
663
+ name: string | null;
664
+ expression: string;
665
+ }[];
666
+ indexes: {
667
+ name: string;
668
+ columns: string[];
669
+ expression: string | null;
670
+ unique: boolean;
671
+ primary: boolean;
672
+ method: string | null;
673
+ partial: boolean;
674
+ }[];
675
+ rowCountEstimate: number | null;
676
+ rowCountExact: boolean;
677
+ sizeBytes: number | null;
678
+ activity: {
679
+ inserts: number;
680
+ updates: number;
681
+ deletes: number;
682
+ } | null;
683
+ rls: {
684
+ enabled: boolean;
685
+ forced: boolean;
686
+ policyCount: number;
687
+ } | null;
688
+ system: boolean;
689
+ semantics: {
690
+ role: "entity" | "join-table" | "log" | "people" | "messages" | "line-items" | "system";
691
+ hierarchy: {
692
+ parentColumn: string;
693
+ } | null;
694
+ polymorphic: {
695
+ typeColumn: string;
696
+ idColumn: string;
697
+ targets: string[];
698
+ }[];
699
+ } | null;
700
+ label?: string | undefined;
701
+ }, {
702
+ schema: string;
703
+ name: string;
704
+ kind: "table" | "view" | "materialized-view";
705
+ comment: string | null;
706
+ columns: {
707
+ name: string;
708
+ ordinal: number;
709
+ dbType: string;
710
+ logicalType: "bigint" | "boolean" | "text" | "varchar" | "integer" | "decimal" | "float" | "date" | "time" | "timestamp" | "timestamptz" | "interval" | "uuid" | "json" | "binary" | "enum" | "geometry" | "inet" | "unknown";
711
+ nullable: boolean;
712
+ default: {
713
+ kind: "literal" | "expression";
714
+ text: string;
715
+ } | {
716
+ kind: "uuid" | "autoincrement" | "now";
717
+ } | null;
718
+ isPrimaryKey: boolean;
719
+ isUnique: boolean;
720
+ isGenerated: boolean;
721
+ enumRef: string | null;
722
+ maxLength: number | null;
723
+ numericPrecision: number | null;
724
+ numericScale: number | null;
725
+ isArray: boolean;
726
+ comment: string | null;
727
+ references: {
728
+ tableId: string;
729
+ column: string;
730
+ } | null;
731
+ semantics: {
732
+ primary: "secret" | "pk-id" | "fk" | "money" | "percent" | "score" | "status-workflow" | "category-enum" | "created-at" | "updated-at" | "date-range" | "event-timestamp" | "duration" | "geo-point" | "geo-region" | "person-name" | "email" | "phone" | "image-url" | "file-ref" | "url" | "boolean-flag" | "color" | "tags" | "slug" | "ip-address" | "json-config" | "external-id" | "free-text" | "plain";
733
+ flags: {
734
+ secret: boolean;
735
+ pii: "person-name" | "email" | "phone" | "ip" | "address" | "dob" | "gov-id" | "payment-id" | "geo-precise" | null;
736
+ maskedByDefault: boolean;
737
+ };
738
+ format: string | null;
739
+ pair: {
740
+ role: "start" | "end" | "lat" | "lng" | "poly-type" | "poly-id";
741
+ partner: string;
742
+ } | null;
743
+ confidence: number;
744
+ source: "heuristic" | "llm" | "override";
745
+ } | null;
746
+ }[];
747
+ primaryKey: string[];
748
+ uniques: {
749
+ name: string | null;
750
+ columns: string[];
751
+ }[];
752
+ checks: {
753
+ name: string | null;
754
+ expression: string;
755
+ }[];
756
+ indexes: {
757
+ name: string;
758
+ columns: string[];
759
+ expression: string | null;
760
+ unique: boolean;
761
+ primary: boolean;
762
+ method: string | null;
763
+ partial: boolean;
764
+ }[];
765
+ rowCountEstimate: number | null;
766
+ rowCountExact: boolean;
767
+ sizeBytes: number | null;
768
+ activity: {
769
+ inserts: number;
770
+ updates: number;
771
+ deletes: number;
772
+ } | null;
773
+ rls: {
774
+ enabled: boolean;
775
+ forced: boolean;
776
+ policyCount: number;
777
+ } | null;
778
+ system: boolean;
779
+ semantics: {
780
+ role: "entity" | "join-table" | "log" | "people" | "messages" | "line-items" | "system";
781
+ hierarchy: {
782
+ parentColumn: string;
783
+ } | null;
784
+ polymorphic: {
785
+ typeColumn: string;
786
+ idColumn: string;
787
+ targets: string[];
788
+ }[];
789
+ } | null;
790
+ id?: string | undefined;
791
+ label?: string | undefined;
792
+ }>>;
793
+ export type TableModel = z.output<typeof tableModelSchema>;
794
+ export declare const FK_ACTIONS: readonly ["cascade", "restrict", "set-null", "set-default", "no-action"];
795
+ export declare const fkActionSchema: z.ZodEnum<{
796
+ cascade: "cascade";
797
+ restrict: "restrict";
798
+ "set-null": "set-null";
799
+ "set-default": "set-default";
800
+ "no-action": "no-action";
801
+ }>;
802
+ export type FkAction = z.infer<typeof fkActionSchema>;
803
+ export declare const RELATION_KINDS: readonly ["declared-fk", "inferred-name", "inferred-join-table", "override", "manifest"];
804
+ export declare const relationKindSchema: z.ZodEnum<{
805
+ override: "override";
806
+ "declared-fk": "declared-fk";
807
+ "inferred-name": "inferred-name";
808
+ "inferred-join-table": "inferred-join-table";
809
+ manifest: "manifest";
810
+ }>;
811
+ export type RelationKind = z.infer<typeof relationKindSchema>;
812
+ export declare const CARDINALITIES: readonly ["one-to-one", "one-to-many", "many-to-many"];
813
+ export declare const cardinalitySchema: z.ZodEnum<{
814
+ "one-to-one": "one-to-one";
815
+ "one-to-many": "one-to-many";
816
+ "many-to-many": "many-to-many";
817
+ }>;
818
+ export type Cardinality = z.infer<typeof cardinalitySchema>;
819
+ declare const relationEndpointSchema: z.ZodObject<{
820
+ tableId: z.ZodString;
821
+ columns: z.ZodArray<z.ZodString>;
822
+ }, z.core.$strict>;
823
+ export type RelationEndpoint = z.infer<typeof relationEndpointSchema>;
824
+ /** §2.1 `Relation` — declared + inferred + overrides, deduped. */
825
+ export declare const relationSchema: z.ZodObject<{
826
+ id: z.ZodString;
827
+ kind: z.ZodEnum<{
828
+ override: "override";
829
+ "declared-fk": "declared-fk";
830
+ "inferred-name": "inferred-name";
831
+ "inferred-join-table": "inferred-join-table";
832
+ manifest: "manifest";
833
+ }>;
834
+ cardinality: z.ZodEnum<{
835
+ "one-to-one": "one-to-one";
836
+ "one-to-many": "one-to-many";
837
+ "many-to-many": "many-to-many";
838
+ }>;
839
+ from: z.ZodObject<{
840
+ tableId: z.ZodString;
841
+ columns: z.ZodArray<z.ZodString>;
842
+ }, z.core.$strict>;
843
+ to: z.ZodObject<{
844
+ tableId: z.ZodString;
845
+ columns: z.ZodArray<z.ZodString>;
846
+ }, z.core.$strict>;
847
+ through: z.ZodDefault<z.ZodNullable<z.ZodObject<{
848
+ tableId: z.ZodString;
849
+ fromColumns: z.ZodArray<z.ZodString>;
850
+ toColumns: z.ZodArray<z.ZodString>;
851
+ }, z.core.$strict>>>;
852
+ onDelete: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
853
+ cascade: "cascade";
854
+ restrict: "restrict";
855
+ "set-null": "set-null";
856
+ "set-default": "set-default";
857
+ "no-action": "no-action";
858
+ }>>>;
859
+ onUpdate: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
860
+ cascade: "cascade";
861
+ restrict: "restrict";
862
+ "set-null": "set-null";
863
+ "set-default": "set-default";
864
+ "no-action": "no-action";
865
+ }>>>;
866
+ selfReferential: z.ZodDefault<z.ZodBoolean>;
867
+ confidence: z.ZodDefault<z.ZodNumber>;
868
+ }, z.core.$strict>;
869
+ export type Relation = z.infer<typeof relationSchema>;
870
+ /** Non-fatal issues: skipped statements, capped enums, permission gaps. */
871
+ export declare const modelWarningSchema: z.ZodObject<{
872
+ code: z.ZodString;
873
+ message: z.ZodString;
874
+ tableId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
875
+ }, z.core.$strict>;
876
+ export type ModelWarning = z.infer<typeof modelWarningSchema>;
877
+ export declare const modelStatsSchema: z.ZodObject<{
878
+ tableCount: z.ZodDefault<z.ZodNumber>;
879
+ columnCount: z.ZodDefault<z.ZodNumber>;
880
+ relationCount: z.ZodDefault<z.ZodNumber>;
881
+ durationMs: z.ZodDefault<z.ZodNumber>;
882
+ }, z.core.$strict>;
883
+ export type ModelStats = z.infer<typeof modelStatsSchema>;
884
+ /**
885
+ * Cross-reference integrity: relations, FK mirrors, enum refs, and primary
886
+ * keys must point at tables/columns/enums that exist in the model. Runs on
887
+ * every parse so a snapshot can never persist dangling references.
888
+ */
889
+ export declare const databaseModelSchema: z.ZodObject<{
890
+ irVersion: z.ZodDefault<z.ZodLiteral<1>>;
891
+ dialect: z.ZodEnum<{
892
+ postgres: "postgres";
893
+ mysql: "mysql";
894
+ sqlite: "sqlite";
895
+ generic: "generic";
896
+ }>;
897
+ source: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
898
+ kind: z.ZodLiteral<"live">;
899
+ connectionId: z.ZodString;
900
+ }, z.core.$strict>, z.ZodObject<{
901
+ kind: z.ZodLiteral<"import">;
902
+ format: z.ZodEnum<{
903
+ "sql-ddl": "sql-ddl";
904
+ prisma: "prisma";
905
+ drizzle: "drizzle";
906
+ typeorm: "typeorm";
907
+ sequelize: "sequelize";
908
+ rails: "rails";
909
+ django: "django";
910
+ "json-ir": "json-ir";
911
+ }>;
912
+ fileName: z.ZodOptional<z.ZodString>;
913
+ }, z.core.$strict>], "kind">>;
914
+ name: z.ZodString;
915
+ defaultSchema: z.ZodDefault<z.ZodString>;
916
+ schemas: z.ZodDefault<z.ZodArray<z.ZodString>>;
917
+ tables: z.ZodArray<z.ZodPipe<z.ZodObject<{
918
+ id: z.ZodOptional<z.ZodString>;
919
+ schema: z.ZodDefault<z.ZodString>;
920
+ name: z.ZodString;
921
+ label: z.ZodOptional<z.ZodString>;
922
+ kind: z.ZodDefault<z.ZodEnum<{
923
+ table: "table";
924
+ view: "view";
925
+ "materialized-view": "materialized-view";
926
+ }>>;
927
+ comment: z.ZodDefault<z.ZodNullable<z.ZodString>>;
928
+ columns: z.ZodArray<z.ZodObject<{
929
+ name: z.ZodString;
930
+ ordinal: z.ZodDefault<z.ZodNumber>;
931
+ dbType: z.ZodDefault<z.ZodString>;
932
+ logicalType: z.ZodDefault<z.ZodEnum<{
933
+ bigint: "bigint";
934
+ boolean: "boolean";
935
+ text: "text";
936
+ varchar: "varchar";
937
+ integer: "integer";
938
+ decimal: "decimal";
939
+ float: "float";
940
+ date: "date";
941
+ time: "time";
942
+ timestamp: "timestamp";
943
+ timestamptz: "timestamptz";
944
+ interval: "interval";
945
+ uuid: "uuid";
946
+ json: "json";
947
+ binary: "binary";
948
+ enum: "enum";
949
+ geometry: "geometry";
950
+ inet: "inet";
951
+ unknown: "unknown";
952
+ }>>;
953
+ nullable: z.ZodDefault<z.ZodBoolean>;
954
+ default: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
955
+ kind: z.ZodEnum<{
956
+ literal: "literal";
957
+ expression: "expression";
958
+ }>;
959
+ text: z.ZodString;
960
+ }, z.core.$strict>, z.ZodObject<{
961
+ kind: z.ZodEnum<{
962
+ uuid: "uuid";
963
+ autoincrement: "autoincrement";
964
+ now: "now";
965
+ }>;
966
+ }, z.core.$strict>]>>>;
967
+ isPrimaryKey: z.ZodDefault<z.ZodBoolean>;
968
+ isUnique: z.ZodDefault<z.ZodBoolean>;
969
+ isGenerated: z.ZodDefault<z.ZodBoolean>;
970
+ enumRef: z.ZodDefault<z.ZodNullable<z.ZodString>>;
971
+ maxLength: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
972
+ numericPrecision: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
973
+ numericScale: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
974
+ isArray: z.ZodDefault<z.ZodBoolean>;
975
+ comment: z.ZodDefault<z.ZodNullable<z.ZodString>>;
976
+ references: z.ZodDefault<z.ZodNullable<z.ZodObject<{
977
+ tableId: z.ZodString;
978
+ column: z.ZodString;
979
+ }, z.core.$strict>>>;
980
+ semantics: z.ZodDefault<z.ZodNullable<z.ZodObject<{
981
+ primary: z.ZodEnum<{
982
+ secret: "secret";
983
+ "pk-id": "pk-id";
984
+ fk: "fk";
985
+ money: "money";
986
+ percent: "percent";
987
+ score: "score";
988
+ "status-workflow": "status-workflow";
989
+ "category-enum": "category-enum";
990
+ "created-at": "created-at";
991
+ "updated-at": "updated-at";
992
+ "date-range": "date-range";
993
+ "event-timestamp": "event-timestamp";
994
+ duration: "duration";
995
+ "geo-point": "geo-point";
996
+ "geo-region": "geo-region";
997
+ "person-name": "person-name";
998
+ email: "email";
999
+ phone: "phone";
1000
+ "image-url": "image-url";
1001
+ "file-ref": "file-ref";
1002
+ url: "url";
1003
+ "boolean-flag": "boolean-flag";
1004
+ color: "color";
1005
+ tags: "tags";
1006
+ slug: "slug";
1007
+ "ip-address": "ip-address";
1008
+ "json-config": "json-config";
1009
+ "external-id": "external-id";
1010
+ "free-text": "free-text";
1011
+ plain: "plain";
1012
+ }>;
1013
+ flags: z.ZodObject<{
1014
+ secret: z.ZodDefault<z.ZodBoolean>;
1015
+ pii: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
1016
+ "person-name": "person-name";
1017
+ email: "email";
1018
+ phone: "phone";
1019
+ ip: "ip";
1020
+ address: "address";
1021
+ dob: "dob";
1022
+ "gov-id": "gov-id";
1023
+ "payment-id": "payment-id";
1024
+ "geo-precise": "geo-precise";
1025
+ }>>>;
1026
+ maskedByDefault: z.ZodDefault<z.ZodBoolean>;
1027
+ }, z.core.$strict>;
1028
+ format: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1029
+ pair: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1030
+ role: z.ZodEnum<{
1031
+ start: "start";
1032
+ end: "end";
1033
+ lat: "lat";
1034
+ lng: "lng";
1035
+ "poly-type": "poly-type";
1036
+ "poly-id": "poly-id";
1037
+ }>;
1038
+ partner: z.ZodString;
1039
+ }, z.core.$strict>>>;
1040
+ confidence: z.ZodNumber;
1041
+ source: z.ZodDefault<z.ZodEnum<{
1042
+ heuristic: "heuristic";
1043
+ llm: "llm";
1044
+ override: "override";
1045
+ }>>;
1046
+ }, z.core.$strict>>>;
1047
+ }, z.core.$strict>>;
1048
+ primaryKey: z.ZodDefault<z.ZodArray<z.ZodString>>;
1049
+ uniques: z.ZodDefault<z.ZodArray<z.ZodObject<{
1050
+ name: z.ZodNullable<z.ZodString>;
1051
+ columns: z.ZodArray<z.ZodString>;
1052
+ }, z.core.$strict>>>;
1053
+ checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
1054
+ name: z.ZodNullable<z.ZodString>;
1055
+ expression: z.ZodString;
1056
+ }, z.core.$strict>>>;
1057
+ indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
1058
+ name: z.ZodString;
1059
+ columns: z.ZodDefault<z.ZodArray<z.ZodString>>;
1060
+ expression: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1061
+ unique: z.ZodDefault<z.ZodBoolean>;
1062
+ primary: z.ZodDefault<z.ZodBoolean>;
1063
+ method: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1064
+ partial: z.ZodDefault<z.ZodBoolean>;
1065
+ }, z.core.$strict>>>;
1066
+ rowCountEstimate: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1067
+ rowCountExact: z.ZodDefault<z.ZodBoolean>;
1068
+ sizeBytes: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1069
+ activity: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1070
+ inserts: z.ZodNumber;
1071
+ updates: z.ZodNumber;
1072
+ deletes: z.ZodNumber;
1073
+ }, z.core.$strict>>>;
1074
+ rls: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1075
+ enabled: z.ZodBoolean;
1076
+ forced: z.ZodBoolean;
1077
+ policyCount: z.ZodNumber;
1078
+ }, z.core.$strict>>>;
1079
+ system: z.ZodDefault<z.ZodBoolean>;
1080
+ semantics: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1081
+ role: z.ZodEnum<{
1082
+ entity: "entity";
1083
+ "join-table": "join-table";
1084
+ log: "log";
1085
+ people: "people";
1086
+ messages: "messages";
1087
+ "line-items": "line-items";
1088
+ system: "system";
1089
+ }>;
1090
+ hierarchy: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1091
+ parentColumn: z.ZodString;
1092
+ }, z.core.$strict>>>;
1093
+ polymorphic: z.ZodDefault<z.ZodArray<z.ZodObject<{
1094
+ typeColumn: z.ZodString;
1095
+ idColumn: z.ZodString;
1096
+ targets: z.ZodDefault<z.ZodArray<z.ZodString>>;
1097
+ }, z.core.$strict>>>;
1098
+ }, z.core.$strict>>>;
1099
+ }, z.core.$strict>, z.ZodTransform<{
1100
+ id: string;
1101
+ schema: string;
1102
+ name: string;
1103
+ kind: "table" | "view" | "materialized-view";
1104
+ comment: string | null;
1105
+ columns: {
1106
+ name: string;
1107
+ ordinal: number;
1108
+ dbType: string;
1109
+ logicalType: "bigint" | "boolean" | "text" | "varchar" | "integer" | "decimal" | "float" | "date" | "time" | "timestamp" | "timestamptz" | "interval" | "uuid" | "json" | "binary" | "enum" | "geometry" | "inet" | "unknown";
1110
+ nullable: boolean;
1111
+ default: {
1112
+ kind: "literal" | "expression";
1113
+ text: string;
1114
+ } | {
1115
+ kind: "uuid" | "autoincrement" | "now";
1116
+ } | null;
1117
+ isPrimaryKey: boolean;
1118
+ isUnique: boolean;
1119
+ isGenerated: boolean;
1120
+ enumRef: string | null;
1121
+ maxLength: number | null;
1122
+ numericPrecision: number | null;
1123
+ numericScale: number | null;
1124
+ isArray: boolean;
1125
+ comment: string | null;
1126
+ references: {
1127
+ tableId: string;
1128
+ column: string;
1129
+ } | null;
1130
+ semantics: {
1131
+ primary: "secret" | "pk-id" | "fk" | "money" | "percent" | "score" | "status-workflow" | "category-enum" | "created-at" | "updated-at" | "date-range" | "event-timestamp" | "duration" | "geo-point" | "geo-region" | "person-name" | "email" | "phone" | "image-url" | "file-ref" | "url" | "boolean-flag" | "color" | "tags" | "slug" | "ip-address" | "json-config" | "external-id" | "free-text" | "plain";
1132
+ flags: {
1133
+ secret: boolean;
1134
+ pii: "person-name" | "email" | "phone" | "ip" | "address" | "dob" | "gov-id" | "payment-id" | "geo-precise" | null;
1135
+ maskedByDefault: boolean;
1136
+ };
1137
+ format: string | null;
1138
+ pair: {
1139
+ role: "start" | "end" | "lat" | "lng" | "poly-type" | "poly-id";
1140
+ partner: string;
1141
+ } | null;
1142
+ confidence: number;
1143
+ source: "heuristic" | "llm" | "override";
1144
+ } | null;
1145
+ }[];
1146
+ primaryKey: string[];
1147
+ uniques: {
1148
+ name: string | null;
1149
+ columns: string[];
1150
+ }[];
1151
+ checks: {
1152
+ name: string | null;
1153
+ expression: string;
1154
+ }[];
1155
+ indexes: {
1156
+ name: string;
1157
+ columns: string[];
1158
+ expression: string | null;
1159
+ unique: boolean;
1160
+ primary: boolean;
1161
+ method: string | null;
1162
+ partial: boolean;
1163
+ }[];
1164
+ rowCountEstimate: number | null;
1165
+ rowCountExact: boolean;
1166
+ sizeBytes: number | null;
1167
+ activity: {
1168
+ inserts: number;
1169
+ updates: number;
1170
+ deletes: number;
1171
+ } | null;
1172
+ rls: {
1173
+ enabled: boolean;
1174
+ forced: boolean;
1175
+ policyCount: number;
1176
+ } | null;
1177
+ system: boolean;
1178
+ semantics: {
1179
+ role: "entity" | "join-table" | "log" | "people" | "messages" | "line-items" | "system";
1180
+ hierarchy: {
1181
+ parentColumn: string;
1182
+ } | null;
1183
+ polymorphic: {
1184
+ typeColumn: string;
1185
+ idColumn: string;
1186
+ targets: string[];
1187
+ }[];
1188
+ } | null;
1189
+ label?: string | undefined;
1190
+ }, {
1191
+ schema: string;
1192
+ name: string;
1193
+ kind: "table" | "view" | "materialized-view";
1194
+ comment: string | null;
1195
+ columns: {
1196
+ name: string;
1197
+ ordinal: number;
1198
+ dbType: string;
1199
+ logicalType: "bigint" | "boolean" | "text" | "varchar" | "integer" | "decimal" | "float" | "date" | "time" | "timestamp" | "timestamptz" | "interval" | "uuid" | "json" | "binary" | "enum" | "geometry" | "inet" | "unknown";
1200
+ nullable: boolean;
1201
+ default: {
1202
+ kind: "literal" | "expression";
1203
+ text: string;
1204
+ } | {
1205
+ kind: "uuid" | "autoincrement" | "now";
1206
+ } | null;
1207
+ isPrimaryKey: boolean;
1208
+ isUnique: boolean;
1209
+ isGenerated: boolean;
1210
+ enumRef: string | null;
1211
+ maxLength: number | null;
1212
+ numericPrecision: number | null;
1213
+ numericScale: number | null;
1214
+ isArray: boolean;
1215
+ comment: string | null;
1216
+ references: {
1217
+ tableId: string;
1218
+ column: string;
1219
+ } | null;
1220
+ semantics: {
1221
+ primary: "secret" | "pk-id" | "fk" | "money" | "percent" | "score" | "status-workflow" | "category-enum" | "created-at" | "updated-at" | "date-range" | "event-timestamp" | "duration" | "geo-point" | "geo-region" | "person-name" | "email" | "phone" | "image-url" | "file-ref" | "url" | "boolean-flag" | "color" | "tags" | "slug" | "ip-address" | "json-config" | "external-id" | "free-text" | "plain";
1222
+ flags: {
1223
+ secret: boolean;
1224
+ pii: "person-name" | "email" | "phone" | "ip" | "address" | "dob" | "gov-id" | "payment-id" | "geo-precise" | null;
1225
+ maskedByDefault: boolean;
1226
+ };
1227
+ format: string | null;
1228
+ pair: {
1229
+ role: "start" | "end" | "lat" | "lng" | "poly-type" | "poly-id";
1230
+ partner: string;
1231
+ } | null;
1232
+ confidence: number;
1233
+ source: "heuristic" | "llm" | "override";
1234
+ } | null;
1235
+ }[];
1236
+ primaryKey: string[];
1237
+ uniques: {
1238
+ name: string | null;
1239
+ columns: string[];
1240
+ }[];
1241
+ checks: {
1242
+ name: string | null;
1243
+ expression: string;
1244
+ }[];
1245
+ indexes: {
1246
+ name: string;
1247
+ columns: string[];
1248
+ expression: string | null;
1249
+ unique: boolean;
1250
+ primary: boolean;
1251
+ method: string | null;
1252
+ partial: boolean;
1253
+ }[];
1254
+ rowCountEstimate: number | null;
1255
+ rowCountExact: boolean;
1256
+ sizeBytes: number | null;
1257
+ activity: {
1258
+ inserts: number;
1259
+ updates: number;
1260
+ deletes: number;
1261
+ } | null;
1262
+ rls: {
1263
+ enabled: boolean;
1264
+ forced: boolean;
1265
+ policyCount: number;
1266
+ } | null;
1267
+ system: boolean;
1268
+ semantics: {
1269
+ role: "entity" | "join-table" | "log" | "people" | "messages" | "line-items" | "system";
1270
+ hierarchy: {
1271
+ parentColumn: string;
1272
+ } | null;
1273
+ polymorphic: {
1274
+ typeColumn: string;
1275
+ idColumn: string;
1276
+ targets: string[];
1277
+ }[];
1278
+ } | null;
1279
+ id?: string | undefined;
1280
+ label?: string | undefined;
1281
+ }>>>;
1282
+ enums: z.ZodDefault<z.ZodArray<z.ZodObject<{
1283
+ id: z.ZodString;
1284
+ name: z.ZodString;
1285
+ values: z.ZodArray<z.ZodString>;
1286
+ source: z.ZodDefault<z.ZodEnum<{
1287
+ check: "check";
1288
+ import: "import";
1289
+ native: "native";
1290
+ "column-type": "column-type";
1291
+ }>>;
1292
+ }, z.core.$strict>>>;
1293
+ relations: z.ZodDefault<z.ZodArray<z.ZodObject<{
1294
+ id: z.ZodString;
1295
+ kind: z.ZodEnum<{
1296
+ override: "override";
1297
+ "declared-fk": "declared-fk";
1298
+ "inferred-name": "inferred-name";
1299
+ "inferred-join-table": "inferred-join-table";
1300
+ manifest: "manifest";
1301
+ }>;
1302
+ cardinality: z.ZodEnum<{
1303
+ "one-to-one": "one-to-one";
1304
+ "one-to-many": "one-to-many";
1305
+ "many-to-many": "many-to-many";
1306
+ }>;
1307
+ from: z.ZodObject<{
1308
+ tableId: z.ZodString;
1309
+ columns: z.ZodArray<z.ZodString>;
1310
+ }, z.core.$strict>;
1311
+ to: z.ZodObject<{
1312
+ tableId: z.ZodString;
1313
+ columns: z.ZodArray<z.ZodString>;
1314
+ }, z.core.$strict>;
1315
+ through: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1316
+ tableId: z.ZodString;
1317
+ fromColumns: z.ZodArray<z.ZodString>;
1318
+ toColumns: z.ZodArray<z.ZodString>;
1319
+ }, z.core.$strict>>>;
1320
+ onDelete: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
1321
+ cascade: "cascade";
1322
+ restrict: "restrict";
1323
+ "set-null": "set-null";
1324
+ "set-default": "set-default";
1325
+ "no-action": "no-action";
1326
+ }>>>;
1327
+ onUpdate: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
1328
+ cascade: "cascade";
1329
+ restrict: "restrict";
1330
+ "set-null": "set-null";
1331
+ "set-default": "set-default";
1332
+ "no-action": "no-action";
1333
+ }>>>;
1334
+ selfReferential: z.ZodDefault<z.ZodBoolean>;
1335
+ confidence: z.ZodDefault<z.ZodNumber>;
1336
+ }, z.core.$strict>>>;
1337
+ capabilities: z.ZodPrefault<z.ZodObject<{
1338
+ hasEnums: z.ZodDefault<z.ZodBoolean>;
1339
+ hasFKs: z.ZodDefault<z.ZodBoolean>;
1340
+ hasSchemas: z.ZodDefault<z.ZodBoolean>;
1341
+ hasComments: z.ZodDefault<z.ZodBoolean>;
1342
+ hasChecks: z.ZodDefault<z.ZodBoolean>;
1343
+ hasRLS: z.ZodDefault<z.ZodBoolean>;
1344
+ hasMaterializedViews: z.ZodDefault<z.ZodBoolean>;
1345
+ hasRowEstimates: z.ZodDefault<z.ZodBoolean>;
1346
+ supportsStatementTimeout: z.ZodDefault<z.ZodBoolean>;
1347
+ supportsReturning: z.ZodDefault<z.ZodBoolean>;
1348
+ maxIdentifierLength: z.ZodDefault<z.ZodNumber>;
1349
+ }, z.core.$strict>>;
1350
+ introspectedAt: z.ZodDefault<z.ZodISODateTime>;
1351
+ stats: z.ZodPrefault<z.ZodObject<{
1352
+ tableCount: z.ZodDefault<z.ZodNumber>;
1353
+ columnCount: z.ZodDefault<z.ZodNumber>;
1354
+ relationCount: z.ZodDefault<z.ZodNumber>;
1355
+ durationMs: z.ZodDefault<z.ZodNumber>;
1356
+ }, z.core.$strict>>;
1357
+ warnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
1358
+ code: z.ZodString;
1359
+ message: z.ZodString;
1360
+ tableId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1361
+ }, z.core.$strict>>>;
1362
+ }, z.core.$strict>;
1363
+ export type DatabaseModel = z.output<typeof databaseModelSchema>;
1364
+ /**
1365
+ * Workplan aliases: the milestone plan and several sibling docs refer to the
1366
+ * IR as `SchemaModel` (e.g. 01-architecture.md §2.3 "interface + SchemaModel
1367
+ * types"). Same schema, same type.
1368
+ */
1369
+ export declare const schemaModelSchema: z.ZodObject<{
1370
+ irVersion: z.ZodDefault<z.ZodLiteral<1>>;
1371
+ dialect: z.ZodEnum<{
1372
+ postgres: "postgres";
1373
+ mysql: "mysql";
1374
+ sqlite: "sqlite";
1375
+ generic: "generic";
1376
+ }>;
1377
+ source: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
1378
+ kind: z.ZodLiteral<"live">;
1379
+ connectionId: z.ZodString;
1380
+ }, z.core.$strict>, z.ZodObject<{
1381
+ kind: z.ZodLiteral<"import">;
1382
+ format: z.ZodEnum<{
1383
+ "sql-ddl": "sql-ddl";
1384
+ prisma: "prisma";
1385
+ drizzle: "drizzle";
1386
+ typeorm: "typeorm";
1387
+ sequelize: "sequelize";
1388
+ rails: "rails";
1389
+ django: "django";
1390
+ "json-ir": "json-ir";
1391
+ }>;
1392
+ fileName: z.ZodOptional<z.ZodString>;
1393
+ }, z.core.$strict>], "kind">>;
1394
+ name: z.ZodString;
1395
+ defaultSchema: z.ZodDefault<z.ZodString>;
1396
+ schemas: z.ZodDefault<z.ZodArray<z.ZodString>>;
1397
+ tables: z.ZodArray<z.ZodPipe<z.ZodObject<{
1398
+ id: z.ZodOptional<z.ZodString>;
1399
+ schema: z.ZodDefault<z.ZodString>;
1400
+ name: z.ZodString;
1401
+ label: z.ZodOptional<z.ZodString>;
1402
+ kind: z.ZodDefault<z.ZodEnum<{
1403
+ table: "table";
1404
+ view: "view";
1405
+ "materialized-view": "materialized-view";
1406
+ }>>;
1407
+ comment: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1408
+ columns: z.ZodArray<z.ZodObject<{
1409
+ name: z.ZodString;
1410
+ ordinal: z.ZodDefault<z.ZodNumber>;
1411
+ dbType: z.ZodDefault<z.ZodString>;
1412
+ logicalType: z.ZodDefault<z.ZodEnum<{
1413
+ bigint: "bigint";
1414
+ boolean: "boolean";
1415
+ text: "text";
1416
+ varchar: "varchar";
1417
+ integer: "integer";
1418
+ decimal: "decimal";
1419
+ float: "float";
1420
+ date: "date";
1421
+ time: "time";
1422
+ timestamp: "timestamp";
1423
+ timestamptz: "timestamptz";
1424
+ interval: "interval";
1425
+ uuid: "uuid";
1426
+ json: "json";
1427
+ binary: "binary";
1428
+ enum: "enum";
1429
+ geometry: "geometry";
1430
+ inet: "inet";
1431
+ unknown: "unknown";
1432
+ }>>;
1433
+ nullable: z.ZodDefault<z.ZodBoolean>;
1434
+ default: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
1435
+ kind: z.ZodEnum<{
1436
+ literal: "literal";
1437
+ expression: "expression";
1438
+ }>;
1439
+ text: z.ZodString;
1440
+ }, z.core.$strict>, z.ZodObject<{
1441
+ kind: z.ZodEnum<{
1442
+ uuid: "uuid";
1443
+ autoincrement: "autoincrement";
1444
+ now: "now";
1445
+ }>;
1446
+ }, z.core.$strict>]>>>;
1447
+ isPrimaryKey: z.ZodDefault<z.ZodBoolean>;
1448
+ isUnique: z.ZodDefault<z.ZodBoolean>;
1449
+ isGenerated: z.ZodDefault<z.ZodBoolean>;
1450
+ enumRef: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1451
+ maxLength: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1452
+ numericPrecision: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1453
+ numericScale: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1454
+ isArray: z.ZodDefault<z.ZodBoolean>;
1455
+ comment: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1456
+ references: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1457
+ tableId: z.ZodString;
1458
+ column: z.ZodString;
1459
+ }, z.core.$strict>>>;
1460
+ semantics: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1461
+ primary: z.ZodEnum<{
1462
+ secret: "secret";
1463
+ "pk-id": "pk-id";
1464
+ fk: "fk";
1465
+ money: "money";
1466
+ percent: "percent";
1467
+ score: "score";
1468
+ "status-workflow": "status-workflow";
1469
+ "category-enum": "category-enum";
1470
+ "created-at": "created-at";
1471
+ "updated-at": "updated-at";
1472
+ "date-range": "date-range";
1473
+ "event-timestamp": "event-timestamp";
1474
+ duration: "duration";
1475
+ "geo-point": "geo-point";
1476
+ "geo-region": "geo-region";
1477
+ "person-name": "person-name";
1478
+ email: "email";
1479
+ phone: "phone";
1480
+ "image-url": "image-url";
1481
+ "file-ref": "file-ref";
1482
+ url: "url";
1483
+ "boolean-flag": "boolean-flag";
1484
+ color: "color";
1485
+ tags: "tags";
1486
+ slug: "slug";
1487
+ "ip-address": "ip-address";
1488
+ "json-config": "json-config";
1489
+ "external-id": "external-id";
1490
+ "free-text": "free-text";
1491
+ plain: "plain";
1492
+ }>;
1493
+ flags: z.ZodObject<{
1494
+ secret: z.ZodDefault<z.ZodBoolean>;
1495
+ pii: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
1496
+ "person-name": "person-name";
1497
+ email: "email";
1498
+ phone: "phone";
1499
+ ip: "ip";
1500
+ address: "address";
1501
+ dob: "dob";
1502
+ "gov-id": "gov-id";
1503
+ "payment-id": "payment-id";
1504
+ "geo-precise": "geo-precise";
1505
+ }>>>;
1506
+ maskedByDefault: z.ZodDefault<z.ZodBoolean>;
1507
+ }, z.core.$strict>;
1508
+ format: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1509
+ pair: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1510
+ role: z.ZodEnum<{
1511
+ start: "start";
1512
+ end: "end";
1513
+ lat: "lat";
1514
+ lng: "lng";
1515
+ "poly-type": "poly-type";
1516
+ "poly-id": "poly-id";
1517
+ }>;
1518
+ partner: z.ZodString;
1519
+ }, z.core.$strict>>>;
1520
+ confidence: z.ZodNumber;
1521
+ source: z.ZodDefault<z.ZodEnum<{
1522
+ heuristic: "heuristic";
1523
+ llm: "llm";
1524
+ override: "override";
1525
+ }>>;
1526
+ }, z.core.$strict>>>;
1527
+ }, z.core.$strict>>;
1528
+ primaryKey: z.ZodDefault<z.ZodArray<z.ZodString>>;
1529
+ uniques: z.ZodDefault<z.ZodArray<z.ZodObject<{
1530
+ name: z.ZodNullable<z.ZodString>;
1531
+ columns: z.ZodArray<z.ZodString>;
1532
+ }, z.core.$strict>>>;
1533
+ checks: z.ZodDefault<z.ZodArray<z.ZodObject<{
1534
+ name: z.ZodNullable<z.ZodString>;
1535
+ expression: z.ZodString;
1536
+ }, z.core.$strict>>>;
1537
+ indexes: z.ZodDefault<z.ZodArray<z.ZodObject<{
1538
+ name: z.ZodString;
1539
+ columns: z.ZodDefault<z.ZodArray<z.ZodString>>;
1540
+ expression: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1541
+ unique: z.ZodDefault<z.ZodBoolean>;
1542
+ primary: z.ZodDefault<z.ZodBoolean>;
1543
+ method: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1544
+ partial: z.ZodDefault<z.ZodBoolean>;
1545
+ }, z.core.$strict>>>;
1546
+ rowCountEstimate: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1547
+ rowCountExact: z.ZodDefault<z.ZodBoolean>;
1548
+ sizeBytes: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
1549
+ activity: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1550
+ inserts: z.ZodNumber;
1551
+ updates: z.ZodNumber;
1552
+ deletes: z.ZodNumber;
1553
+ }, z.core.$strict>>>;
1554
+ rls: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1555
+ enabled: z.ZodBoolean;
1556
+ forced: z.ZodBoolean;
1557
+ policyCount: z.ZodNumber;
1558
+ }, z.core.$strict>>>;
1559
+ system: z.ZodDefault<z.ZodBoolean>;
1560
+ semantics: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1561
+ role: z.ZodEnum<{
1562
+ entity: "entity";
1563
+ "join-table": "join-table";
1564
+ log: "log";
1565
+ people: "people";
1566
+ messages: "messages";
1567
+ "line-items": "line-items";
1568
+ system: "system";
1569
+ }>;
1570
+ hierarchy: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1571
+ parentColumn: z.ZodString;
1572
+ }, z.core.$strict>>>;
1573
+ polymorphic: z.ZodDefault<z.ZodArray<z.ZodObject<{
1574
+ typeColumn: z.ZodString;
1575
+ idColumn: z.ZodString;
1576
+ targets: z.ZodDefault<z.ZodArray<z.ZodString>>;
1577
+ }, z.core.$strict>>>;
1578
+ }, z.core.$strict>>>;
1579
+ }, z.core.$strict>, z.ZodTransform<{
1580
+ id: string;
1581
+ schema: string;
1582
+ name: string;
1583
+ kind: "table" | "view" | "materialized-view";
1584
+ comment: string | null;
1585
+ columns: {
1586
+ name: string;
1587
+ ordinal: number;
1588
+ dbType: string;
1589
+ logicalType: "bigint" | "boolean" | "text" | "varchar" | "integer" | "decimal" | "float" | "date" | "time" | "timestamp" | "timestamptz" | "interval" | "uuid" | "json" | "binary" | "enum" | "geometry" | "inet" | "unknown";
1590
+ nullable: boolean;
1591
+ default: {
1592
+ kind: "literal" | "expression";
1593
+ text: string;
1594
+ } | {
1595
+ kind: "uuid" | "autoincrement" | "now";
1596
+ } | null;
1597
+ isPrimaryKey: boolean;
1598
+ isUnique: boolean;
1599
+ isGenerated: boolean;
1600
+ enumRef: string | null;
1601
+ maxLength: number | null;
1602
+ numericPrecision: number | null;
1603
+ numericScale: number | null;
1604
+ isArray: boolean;
1605
+ comment: string | null;
1606
+ references: {
1607
+ tableId: string;
1608
+ column: string;
1609
+ } | null;
1610
+ semantics: {
1611
+ primary: "secret" | "pk-id" | "fk" | "money" | "percent" | "score" | "status-workflow" | "category-enum" | "created-at" | "updated-at" | "date-range" | "event-timestamp" | "duration" | "geo-point" | "geo-region" | "person-name" | "email" | "phone" | "image-url" | "file-ref" | "url" | "boolean-flag" | "color" | "tags" | "slug" | "ip-address" | "json-config" | "external-id" | "free-text" | "plain";
1612
+ flags: {
1613
+ secret: boolean;
1614
+ pii: "person-name" | "email" | "phone" | "ip" | "address" | "dob" | "gov-id" | "payment-id" | "geo-precise" | null;
1615
+ maskedByDefault: boolean;
1616
+ };
1617
+ format: string | null;
1618
+ pair: {
1619
+ role: "start" | "end" | "lat" | "lng" | "poly-type" | "poly-id";
1620
+ partner: string;
1621
+ } | null;
1622
+ confidence: number;
1623
+ source: "heuristic" | "llm" | "override";
1624
+ } | null;
1625
+ }[];
1626
+ primaryKey: string[];
1627
+ uniques: {
1628
+ name: string | null;
1629
+ columns: string[];
1630
+ }[];
1631
+ checks: {
1632
+ name: string | null;
1633
+ expression: string;
1634
+ }[];
1635
+ indexes: {
1636
+ name: string;
1637
+ columns: string[];
1638
+ expression: string | null;
1639
+ unique: boolean;
1640
+ primary: boolean;
1641
+ method: string | null;
1642
+ partial: boolean;
1643
+ }[];
1644
+ rowCountEstimate: number | null;
1645
+ rowCountExact: boolean;
1646
+ sizeBytes: number | null;
1647
+ activity: {
1648
+ inserts: number;
1649
+ updates: number;
1650
+ deletes: number;
1651
+ } | null;
1652
+ rls: {
1653
+ enabled: boolean;
1654
+ forced: boolean;
1655
+ policyCount: number;
1656
+ } | null;
1657
+ system: boolean;
1658
+ semantics: {
1659
+ role: "entity" | "join-table" | "log" | "people" | "messages" | "line-items" | "system";
1660
+ hierarchy: {
1661
+ parentColumn: string;
1662
+ } | null;
1663
+ polymorphic: {
1664
+ typeColumn: string;
1665
+ idColumn: string;
1666
+ targets: string[];
1667
+ }[];
1668
+ } | null;
1669
+ label?: string | undefined;
1670
+ }, {
1671
+ schema: string;
1672
+ name: string;
1673
+ kind: "table" | "view" | "materialized-view";
1674
+ comment: string | null;
1675
+ columns: {
1676
+ name: string;
1677
+ ordinal: number;
1678
+ dbType: string;
1679
+ logicalType: "bigint" | "boolean" | "text" | "varchar" | "integer" | "decimal" | "float" | "date" | "time" | "timestamp" | "timestamptz" | "interval" | "uuid" | "json" | "binary" | "enum" | "geometry" | "inet" | "unknown";
1680
+ nullable: boolean;
1681
+ default: {
1682
+ kind: "literal" | "expression";
1683
+ text: string;
1684
+ } | {
1685
+ kind: "uuid" | "autoincrement" | "now";
1686
+ } | null;
1687
+ isPrimaryKey: boolean;
1688
+ isUnique: boolean;
1689
+ isGenerated: boolean;
1690
+ enumRef: string | null;
1691
+ maxLength: number | null;
1692
+ numericPrecision: number | null;
1693
+ numericScale: number | null;
1694
+ isArray: boolean;
1695
+ comment: string | null;
1696
+ references: {
1697
+ tableId: string;
1698
+ column: string;
1699
+ } | null;
1700
+ semantics: {
1701
+ primary: "secret" | "pk-id" | "fk" | "money" | "percent" | "score" | "status-workflow" | "category-enum" | "created-at" | "updated-at" | "date-range" | "event-timestamp" | "duration" | "geo-point" | "geo-region" | "person-name" | "email" | "phone" | "image-url" | "file-ref" | "url" | "boolean-flag" | "color" | "tags" | "slug" | "ip-address" | "json-config" | "external-id" | "free-text" | "plain";
1702
+ flags: {
1703
+ secret: boolean;
1704
+ pii: "person-name" | "email" | "phone" | "ip" | "address" | "dob" | "gov-id" | "payment-id" | "geo-precise" | null;
1705
+ maskedByDefault: boolean;
1706
+ };
1707
+ format: string | null;
1708
+ pair: {
1709
+ role: "start" | "end" | "lat" | "lng" | "poly-type" | "poly-id";
1710
+ partner: string;
1711
+ } | null;
1712
+ confidence: number;
1713
+ source: "heuristic" | "llm" | "override";
1714
+ } | null;
1715
+ }[];
1716
+ primaryKey: string[];
1717
+ uniques: {
1718
+ name: string | null;
1719
+ columns: string[];
1720
+ }[];
1721
+ checks: {
1722
+ name: string | null;
1723
+ expression: string;
1724
+ }[];
1725
+ indexes: {
1726
+ name: string;
1727
+ columns: string[];
1728
+ expression: string | null;
1729
+ unique: boolean;
1730
+ primary: boolean;
1731
+ method: string | null;
1732
+ partial: boolean;
1733
+ }[];
1734
+ rowCountEstimate: number | null;
1735
+ rowCountExact: boolean;
1736
+ sizeBytes: number | null;
1737
+ activity: {
1738
+ inserts: number;
1739
+ updates: number;
1740
+ deletes: number;
1741
+ } | null;
1742
+ rls: {
1743
+ enabled: boolean;
1744
+ forced: boolean;
1745
+ policyCount: number;
1746
+ } | null;
1747
+ system: boolean;
1748
+ semantics: {
1749
+ role: "entity" | "join-table" | "log" | "people" | "messages" | "line-items" | "system";
1750
+ hierarchy: {
1751
+ parentColumn: string;
1752
+ } | null;
1753
+ polymorphic: {
1754
+ typeColumn: string;
1755
+ idColumn: string;
1756
+ targets: string[];
1757
+ }[];
1758
+ } | null;
1759
+ id?: string | undefined;
1760
+ label?: string | undefined;
1761
+ }>>>;
1762
+ enums: z.ZodDefault<z.ZodArray<z.ZodObject<{
1763
+ id: z.ZodString;
1764
+ name: z.ZodString;
1765
+ values: z.ZodArray<z.ZodString>;
1766
+ source: z.ZodDefault<z.ZodEnum<{
1767
+ check: "check";
1768
+ import: "import";
1769
+ native: "native";
1770
+ "column-type": "column-type";
1771
+ }>>;
1772
+ }, z.core.$strict>>>;
1773
+ relations: z.ZodDefault<z.ZodArray<z.ZodObject<{
1774
+ id: z.ZodString;
1775
+ kind: z.ZodEnum<{
1776
+ override: "override";
1777
+ "declared-fk": "declared-fk";
1778
+ "inferred-name": "inferred-name";
1779
+ "inferred-join-table": "inferred-join-table";
1780
+ manifest: "manifest";
1781
+ }>;
1782
+ cardinality: z.ZodEnum<{
1783
+ "one-to-one": "one-to-one";
1784
+ "one-to-many": "one-to-many";
1785
+ "many-to-many": "many-to-many";
1786
+ }>;
1787
+ from: z.ZodObject<{
1788
+ tableId: z.ZodString;
1789
+ columns: z.ZodArray<z.ZodString>;
1790
+ }, z.core.$strict>;
1791
+ to: z.ZodObject<{
1792
+ tableId: z.ZodString;
1793
+ columns: z.ZodArray<z.ZodString>;
1794
+ }, z.core.$strict>;
1795
+ through: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1796
+ tableId: z.ZodString;
1797
+ fromColumns: z.ZodArray<z.ZodString>;
1798
+ toColumns: z.ZodArray<z.ZodString>;
1799
+ }, z.core.$strict>>>;
1800
+ onDelete: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
1801
+ cascade: "cascade";
1802
+ restrict: "restrict";
1803
+ "set-null": "set-null";
1804
+ "set-default": "set-default";
1805
+ "no-action": "no-action";
1806
+ }>>>;
1807
+ onUpdate: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
1808
+ cascade: "cascade";
1809
+ restrict: "restrict";
1810
+ "set-null": "set-null";
1811
+ "set-default": "set-default";
1812
+ "no-action": "no-action";
1813
+ }>>>;
1814
+ selfReferential: z.ZodDefault<z.ZodBoolean>;
1815
+ confidence: z.ZodDefault<z.ZodNumber>;
1816
+ }, z.core.$strict>>>;
1817
+ capabilities: z.ZodPrefault<z.ZodObject<{
1818
+ hasEnums: z.ZodDefault<z.ZodBoolean>;
1819
+ hasFKs: z.ZodDefault<z.ZodBoolean>;
1820
+ hasSchemas: z.ZodDefault<z.ZodBoolean>;
1821
+ hasComments: z.ZodDefault<z.ZodBoolean>;
1822
+ hasChecks: z.ZodDefault<z.ZodBoolean>;
1823
+ hasRLS: z.ZodDefault<z.ZodBoolean>;
1824
+ hasMaterializedViews: z.ZodDefault<z.ZodBoolean>;
1825
+ hasRowEstimates: z.ZodDefault<z.ZodBoolean>;
1826
+ supportsStatementTimeout: z.ZodDefault<z.ZodBoolean>;
1827
+ supportsReturning: z.ZodDefault<z.ZodBoolean>;
1828
+ maxIdentifierLength: z.ZodDefault<z.ZodNumber>;
1829
+ }, z.core.$strict>>;
1830
+ introspectedAt: z.ZodDefault<z.ZodISODateTime>;
1831
+ stats: z.ZodPrefault<z.ZodObject<{
1832
+ tableCount: z.ZodDefault<z.ZodNumber>;
1833
+ columnCount: z.ZodDefault<z.ZodNumber>;
1834
+ relationCount: z.ZodDefault<z.ZodNumber>;
1835
+ durationMs: z.ZodDefault<z.ZodNumber>;
1836
+ }, z.core.$strict>>;
1837
+ warnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
1838
+ code: z.ZodString;
1839
+ message: z.ZodString;
1840
+ tableId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1841
+ }, z.core.$strict>>>;
1842
+ }, z.core.$strict>;
1843
+ export type SchemaModel = DatabaseModel;
1844
+ /**
1845
+ * Single entry point used by the JSON IR importer, the LLM response
1846
+ * validator (06-llm-assist.md), and snapshot loading. Accepts a parsed JSON
1847
+ * value or a JSON string. Throws ZodError (or SyntaxError for bad JSON).
1848
+ */
1849
+ export declare function parseDatabaseModel(json: unknown): DatabaseModel;
1850
+ /** Alias of {@link parseDatabaseModel} under the `SchemaModel` naming. */
1851
+ export declare const parseSchemaModel: typeof parseDatabaseModel;
1852
+ export {};
1853
+ //# sourceMappingURL=schema-model.d.ts.map