@drzl/cli 4.18.0 → 4.21.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/dist/config.d.ts CHANGED
@@ -60,6 +60,7 @@ declare const GeneratorSchema: z.ZodObject<{
60
60
  valibot: "valibot";
61
61
  arktype: "arktype";
62
62
  typebox: "typebox";
63
+ effect: "effect";
63
64
  "json-schema": "json-schema";
64
65
  }>;
65
66
  importExtension: z.ZodOptional<z.ZodEnum<{
@@ -71,15 +72,25 @@ declare const GeneratorSchema: z.ZodObject<{
71
72
  includeRelations: z.ZodOptional<z.ZodBoolean>;
72
73
  coerceDates: z.ZodOptional<z.ZodEnum<{
73
74
  all: "all";
74
- none: "none";
75
75
  input: "input";
76
+ none: "none";
76
77
  }>>;
77
78
  typedJson: z.ZodOptional<z.ZodBoolean>;
78
79
  typedColumns: z.ZodOptional<z.ZodBoolean>;
79
80
  applyDefaults: z.ZodOptional<z.ZodBoolean>;
80
81
  duplicateFinder: z.ZodOptional<z.ZodBoolean>;
82
+ meta: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
83
+ enabled: z.ZodOptional<z.ZodBoolean>;
84
+ description: z.ZodOptional<z.ZodBoolean>;
85
+ }, z.core.$strict>]>>;
86
+ standardSchema: z.ZodOptional<z.ZodBoolean>;
81
87
  nestedSchemas: z.ZodOptional<z.ZodBoolean>;
82
88
  nestedDepth: z.ZodOptional<z.ZodNumber>;
89
+ branded: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
90
+ enabled: z.ZodOptional<z.ZodBoolean>;
91
+ foreignKeys: z.ZodOptional<z.ZodBoolean>;
92
+ aliases: z.ZodOptional<z.ZodBoolean>;
93
+ }, z.core.$strict>]>>;
83
94
  naming: z.ZodOptional<z.ZodObject<{
84
95
  routerSuffix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
85
96
  procedureCase: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
@@ -214,6 +225,17 @@ declare const GeneratorSchema: z.ZodObject<{
214
225
  }, z.core.$strip>>;
215
226
  templateOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
216
227
  }, z.core.$strip>;
228
+ /**
229
+ * One table's column rules. Strict, so `ommit` is refused by the parser rather than dropped.
230
+ *
231
+ * The whole option exists to remove a column, and a key zod strips in silence is a config that
232
+ * looks like it removed one and did not. `GeneratorSchema` is deliberately not strict and has
233
+ * already cost this repo two options that parsed and then did nothing.
234
+ */
235
+ declare const ColumnRulesSchema: z.ZodObject<{
236
+ omit: z.ZodOptional<z.ZodArray<z.ZodString>>;
237
+ pick: z.ZodOptional<z.ZodArray<z.ZodString>>;
238
+ }, z.core.$strict>;
217
239
  declare const AnalyzerSchema: z.ZodObject<{
218
240
  includeRelations: z.ZodDefault<z.ZodBoolean>;
219
241
  validateConstraints: z.ZodDefault<z.ZodBoolean>;
@@ -224,6 +246,10 @@ declare const ConfigSchema: z.ZodObject<{
224
246
  outDir: z.ZodDefault<z.ZodString>;
225
247
  include: z.ZodOptional<z.ZodArray<z.ZodString>>;
226
248
  exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
249
+ columns: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
250
+ omit: z.ZodOptional<z.ZodArray<z.ZodString>>;
251
+ pick: z.ZodOptional<z.ZodArray<z.ZodString>>;
252
+ }, z.core.$strict>>>;
227
253
  importExtension: z.ZodDefault<z.ZodEnum<{
228
254
  js: "js";
229
255
  none: "none";
@@ -243,6 +269,7 @@ declare const ConfigSchema: z.ZodObject<{
243
269
  valibot: "valibot";
244
270
  arktype: "arktype";
245
271
  typebox: "typebox";
272
+ effect: "effect";
246
273
  "json-schema": "json-schema";
247
274
  }>;
248
275
  importExtension: z.ZodOptional<z.ZodEnum<{
@@ -254,15 +281,25 @@ declare const ConfigSchema: z.ZodObject<{
254
281
  includeRelations: z.ZodOptional<z.ZodBoolean>;
255
282
  coerceDates: z.ZodOptional<z.ZodEnum<{
256
283
  all: "all";
257
- none: "none";
258
284
  input: "input";
285
+ none: "none";
259
286
  }>>;
260
287
  typedJson: z.ZodOptional<z.ZodBoolean>;
261
288
  typedColumns: z.ZodOptional<z.ZodBoolean>;
262
289
  applyDefaults: z.ZodOptional<z.ZodBoolean>;
263
290
  duplicateFinder: z.ZodOptional<z.ZodBoolean>;
291
+ meta: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
292
+ enabled: z.ZodOptional<z.ZodBoolean>;
293
+ description: z.ZodOptional<z.ZodBoolean>;
294
+ }, z.core.$strict>]>>;
295
+ standardSchema: z.ZodOptional<z.ZodBoolean>;
264
296
  nestedSchemas: z.ZodOptional<z.ZodBoolean>;
265
297
  nestedDepth: z.ZodOptional<z.ZodNumber>;
298
+ branded: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
299
+ enabled: z.ZodOptional<z.ZodBoolean>;
300
+ foreignKeys: z.ZodOptional<z.ZodBoolean>;
301
+ aliases: z.ZodOptional<z.ZodBoolean>;
302
+ }, z.core.$strict>]>>;
266
303
  naming: z.ZodOptional<z.ZodObject<{
267
304
  routerSuffix: z.ZodOptional<z.ZodDefault<z.ZodString>>;
268
305
  procedureCase: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
@@ -450,13 +487,30 @@ declare function resolveTemplateDirsSync(cfg: DrzlConfig, cwd?: string): string[
450
487
  * Matching is on the database table name, anchored, with `*` as the only metacharacter. Anchored
451
488
  * matters: `user` must not also drop `users`, and a substring match would. `exclude` is applied
452
489
  * after `include`, so the safer direction wins when both name the same table.
490
+ *
491
+ * A table also answers to its schema-qualified name, so `reporting.users` addresses one of two
492
+ * same-named tables and `reporting.*` addresses a whole schema. See `tableAliases`.
453
493
  */
454
494
  declare function filterTables<T extends {
455
495
  name: string;
496
+ schema?: string;
456
497
  }>(tables: T[], opts: {
457
498
  include?: string[];
458
499
  exclude?: string[];
459
500
  }): T[];
501
+ /**
502
+ * What to warn about the table filter, before it is applied.
503
+ *
504
+ * Separate from `filterTables` so that returns a plain array, as every caller and every test
505
+ * already expects it to.
506
+ */
507
+ declare function tableFilterWarnings(tables: readonly {
508
+ name: string;
509
+ schema?: string;
510
+ }[], opts: {
511
+ include?: string[];
512
+ exclude?: string[];
513
+ }): string[];
460
514
  declare function computeWatchTargets(cfg: DrzlConfig, cwd?: string): string[];
461
515
 
462
- export { AffixSchema, AnalyzerSchema, ConfigSchema, type DrzlConfig, type DrzlConfigInput, GeneratorSchema, ImportExtensionSchema, NamingSchema, computeGeneratorOutputDirs, computeWatchTargets, defineConfig, filterTables, loadConfig, resolveConfig, resolveTemplateDirsSync, trpcOutDir };
516
+ export { AffixSchema, AnalyzerSchema, ColumnRulesSchema, ConfigSchema, type DrzlConfig, type DrzlConfigInput, GeneratorSchema, ImportExtensionSchema, NamingSchema, computeGeneratorOutputDirs, computeWatchTargets, defineConfig, filterTables, loadConfig, resolveConfig, resolveTemplateDirsSync, tableFilterWarnings, trpcOutDir };
package/dist/config.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  AffixSchema,
3
3
  AnalyzerSchema,
4
+ ColumnRulesSchema,
4
5
  ConfigSchema,
5
6
  GeneratorSchema,
6
7
  ImportExtensionSchema,
@@ -12,11 +13,13 @@ import {
12
13
  loadConfig,
13
14
  resolveConfig,
14
15
  resolveTemplateDirsSync,
16
+ tableFilterWarnings,
15
17
  trpcOutDir
16
- } from "./chunk-I4KMDCQR.js";
18
+ } from "./chunk-XNNKHBGV.js";
17
19
  export {
18
20
  AffixSchema,
19
21
  AnalyzerSchema,
22
+ ColumnRulesSchema,
20
23
  ConfigSchema,
21
24
  GeneratorSchema,
22
25
  ImportExtensionSchema,
@@ -28,6 +31,7 @@ export {
28
31
  loadConfig,
29
32
  resolveConfig,
30
33
  resolveTemplateDirsSync,
34
+ tableFilterWarnings,
31
35
  trpcOutDir
32
36
  };
33
37
  //# sourceMappingURL=config.js.map
@@ -7,6 +7,7 @@ import {
7
7
  schemaName,
8
8
  typeName
9
9
  } from "@drzl/validation-core";
10
+ import { qualifiedForeignTable, qualifiedTableName } from "@drzl/analyzer";
10
11
  import {
11
12
  COLUMN_FORMATS,
12
13
  insertColumns,
@@ -261,12 +262,13 @@ var modesFor = (table, key) => [
261
262
  ...table.readOnly || !key ? [] : ["update"],
262
263
  "select"
263
264
  ];
264
- var resourceSegment = (table) => encodeURIComponent(table.name);
265
+ var resourceSegment = (table) => table.schema ? `${encodeURIComponent(table.schema)}/${encodeURIComponent(table.name)}` : encodeURIComponent(table.name);
265
266
  function foreignKeysOf(table) {
266
267
  if (table.foreignKeys?.length) return table.foreignKeys;
267
268
  return table.columns.filter((c) => c.references).map((c) => ({
268
269
  columns: [c.name],
269
270
  foreignTable: c.references.table,
271
+ ...c.references.schema ? { foreignSchema: c.references.schema } : {},
270
272
  foreignColumns: [c.references.column]
271
273
  }));
272
274
  }
@@ -293,11 +295,11 @@ function build(tables, opts) {
293
295
  const clash = operationIds.get(id);
294
296
  if (clash !== void 0) {
295
297
  throw new Error(
296
- `@drzl/generator-json-schema: the operationId "${id}" would be emitted for both "${clash}" and "${table.name}". An operationId is the method name a client generator derives, and the specification requires it to be unique across the document.`
298
+ `@drzl/generator-json-schema: the operationId "${id}" would be emitted for both "${clash}" and "${qualifiedTableName(table)}". An operationId is the method name a client generator derives, and the specification requires it to be unique across the document.`
297
299
  );
298
300
  }
299
- operationIds.set(id, table.name);
300
- return { operationId: id, tags: [table.name], ...rest };
301
+ operationIds.set(id, qualifiedTableName(table));
302
+ return { operationId: id, tags: [qualifiedTableName(table)], ...rest };
301
303
  };
302
304
  const built = tables.map((table) => ({
303
305
  table,
@@ -315,7 +317,10 @@ function build(tables, opts) {
315
317
  if (table.readOnly) {
316
318
  notes.push("It refuses every write, so only reads are described.");
317
319
  }
318
- tags.push({ name: table.name, description: [`Table "${table.name}".`, ...notes].join(" ") });
320
+ tags.push({
321
+ name: qualifiedTableName(table),
322
+ description: [`Table "${qualifiedTableName(table)}".`, ...notes].join(" ")
323
+ });
319
324
  const T = pascal(table.tsName);
320
325
  const select = ref(componentName(table, "select"));
321
326
  const validationFailed = {
@@ -331,7 +336,7 @@ function build(tables, opts) {
331
336
  ...jsonBody(ref(ERROR_SCHEMA))
332
337
  });
333
338
  const collection = `/${segment}`;
334
- claim(collection, table.tsName, table.name);
339
+ claim(collection, table.tsName, qualifiedTableName(table));
335
340
  const item = {
336
341
  get: operation(`list${T}`, table, {
337
342
  summary: `List every ${table.name} row.`,
@@ -360,7 +365,7 @@ function build(tables, opts) {
360
365
  paths[collection] = item;
361
366
  if (!key) continue;
362
367
  const itemPath = `${collection}/${key.map((c) => `{${c.name}}`).join("/")}`;
363
- claim(itemPath, table.tsName, table.name);
368
+ claim(itemPath, table.tsName, qualifiedTableName(table));
364
369
  const parameters = key.map((c) => ({
365
370
  name: c.name,
366
371
  in: "path",
@@ -419,14 +424,18 @@ function build(tables, opts) {
419
424
  for (const child of built) {
420
425
  if (child.table === table) continue;
421
426
  const matching = foreignKeysOf(child.table).filter(
422
- (fk) => fk.foreignTable === table.name && fk.foreignColumns.length === key.length && fk.foreignColumns.every((c, i) => c === key[i].name)
427
+ (fk) => (
428
+ // Qualified on both sides. On the bare name a key pointing at `reporting.users` also
429
+ // answered for `public.users`, so the child was hung under a parent in another schema.
430
+ qualifiedForeignTable(fk) === qualifiedTableName(table) && fk.foreignColumns.length === key.length && fk.foreignColumns.every((c, i) => c === key[i].name)
431
+ )
423
432
  );
424
433
  if (matching.length !== 1) continue;
425
434
  const subPath = `${itemPath}/${child.segment}`;
426
435
  claim(
427
436
  subPath,
428
437
  `${table.tsName} -> ${child.table.tsName}`,
429
- `${table.name} -> ${child.table.name}`
438
+ `${qualifiedTableName(table)} -> ${qualifiedTableName(child.table)}`
430
439
  );
431
440
  paths[subPath] = {
432
441
  parameters,
@@ -600,4 +609,4 @@ export {
600
609
  openApiDocument,
601
610
  tableSchemas
602
611
  };
603
- //# sourceMappingURL=dist-TRJLPIWT.js.map
612
+ //# sourceMappingURL=dist-K6N4F3XW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../generator-json-schema/dist/index.js"],"sourcesContent":["// src/index.ts\nimport {\n formatCode,\n moduleFileName,\n moduleSpecifier,\n resolveAffix,\n schemaName,\n typeName\n} from \"@drzl/validation-core\";\n\n// src/openapi.ts\nimport { qualifiedForeignTable, qualifiedTableName } from \"@drzl/analyzer\";\n\n// src/schemas.ts\nimport {\n COLUMN_FORMATS,\n insertColumns,\n isIntegerColumn,\n parseCheck,\n selectColumns,\n updateColumns\n} from \"@drzl/validation-core\";\nvar DRAFT = \"https://json-schema.org/draft/2020-12/schema\";\nvar UUID_FORMAT = \"uuid\";\nvar base64 = (target) => target === \"openapi-3.0\" ? { type: \"string\", format: \"byte\" } : { type: \"string\", contentEncoding: \"base64\" };\nfunction baseSchema(c, mode, target, checks, sets, lengths) {\n const s = c.shape;\n if (s) {\n switch (s.kind) {\n case \"json\":\n return {};\n case \"custom\":\n return {};\n case \"buffer\":\n return base64(target);\n case \"tuple\":\n return target === \"openapi-3.0\" ? { type: \"array\", items: { type: \"number\" }, minItems: s.length, maxItems: s.length } : {\n type: \"array\",\n prefixItems: Array.from({ length: s.length }, () => ({ type: \"number\" })),\n minItems: s.length,\n maxItems: s.length\n };\n case \"numberObject\":\n return {\n type: \"object\",\n properties: Object.fromEntries(s.fields.map((f) => [f, { type: \"number\" }])),\n required: [...s.fields]\n };\n case \"numberVector\":\n return {\n type: \"array\",\n items: { type: \"number\" },\n ...s.length ? { minItems: s.length, maxItems: s.length } : {}\n };\n case \"bitstring\":\n return {\n type: \"string\",\n pattern: \"^[01]*$\",\n ...s.length ? s.exact ? { minLength: s.length, maxLength: s.length } : { maxLength: s.length } : {}\n };\n case \"byteString\":\n return { type: \"string\", ...s.length ? { maxLength: s.length } : {} };\n }\n }\n const set = sets.find((x) => x.column === c.name);\n if (set) return { enum: set.values.map((v) => set.kind === \"string\" ? v : Number(v)) };\n if (c.enumValues && c.enumValues.length) return { enum: [...c.enumValues] };\n const mine = c.arrayDimensions ? [] : checks.filter((k) => k.column === c.name);\n const eq = mine.find((k) => k.operator === \"=\");\n if (eq) {\n const only = eq.kind === \"string\" ? eq.value : Number(eq.value);\n return target === \"openapi-3.0\" ? { enum: [only] } : { const: only };\n }\n switch (c.tsType) {\n case \"string\": {\n const out = { type: \"string\" };\n if (c.format === \"uuid\") out.format = UUID_FORMAT;\n else if (c.format && COLUMN_FORMATS[c.format]) out.pattern = COLUMN_FORMATS[c.format];\n if (c.maxLength !== void 0) out.maxLength = c.maxLength;\n applyByteCap(out, c);\n applyLengths(out, c, lengths);\n return out;\n }\n case \"number\": {\n const out = { type: isIntegerColumn(c) ? \"integer\" : \"number\" };\n if (!c.arrayDimensions) applyNumericBounds(out, c, checks, target);\n return out;\n }\n case \"bigint\":\n return { type: \"string\", pattern: \"^-?\\\\d+$\" };\n case \"boolean\":\n return { type: \"boolean\" };\n case \"Date\":\n return { type: \"string\", format: \"date-time\" };\n case \"Uint8Array\":\n return base64(target);\n default:\n return {};\n }\n}\nfunction applyByteCap(out, c) {\n if (!c.maxBytes) return;\n out.maxLength = Math.min(Number(out.maxLength ?? Infinity), c.maxBytes);\n out.description = `At most ${c.maxBytes} bytes of UTF-8, which JSON Schema has no keyword for. maxLength counts characters: it refuses nothing the column accepts, and a string of multi-byte characters can satisfy it and still be too long for the column.`;\n}\nfunction applyLengths(out, c, lengths) {\n for (const k of lengths.filter((x) => x.column === c.name)) {\n const n = Number(k.value);\n if (k.operator === \">=\") out.minLength = Math.max(Number(out.minLength ?? 0), n);\n else if (k.operator === \">\") out.minLength = Math.max(Number(out.minLength ?? 0), n + 1);\n else if (k.operator === \"<=\") out.maxLength = Math.min(Number(out.maxLength ?? Infinity), n);\n else if (k.operator === \"<\") out.maxLength = Math.min(Number(out.maxLength ?? Infinity), n - 1);\n else if (k.operator === \"=\") {\n out.minLength = n;\n out.maxLength = n;\n }\n }\n}\nfunction applyNumericBounds(out, c, checks, target) {\n let min = c.min !== void 0 ? { value: Number(c.min), exclusive: false } : void 0;\n let max = c.max !== void 0 ? { value: Number(c.max), exclusive: false } : void 0;\n for (const k of checks.filter((x) => x.column === c.name && x.kind === \"number\")) {\n if (k.operator === \">=\") min = { value: Number(k.value), exclusive: false };\n else if (k.operator === \">\") min = { value: Number(k.value), exclusive: true };\n else if (k.operator === \"<=\") max = { value: Number(k.value), exclusive: false };\n else if (k.operator === \"<\") max = { value: Number(k.value), exclusive: true };\n }\n const old = target === \"openapi-3.0\";\n if (min) {\n if (min.exclusive && !old) out.exclusiveMinimum = min.value;\n else {\n out.minimum = min.value;\n if (min.exclusive) out.exclusiveMinimum = true;\n }\n }\n if (max) {\n if (max.exclusive && !old) out.exclusiveMaximum = max.value;\n else {\n out.maximum = max.value;\n if (max.exclusive) out.exclusiveMaximum = true;\n }\n }\n}\nfunction cardinalityBounds(c, cardinalities) {\n if (!c.arrayDimensions) return {};\n const out = {};\n for (const k of cardinalities.filter((x) => x.column === c.name)) {\n const n = Number(k.value);\n if (k.operator === \">=\") out.minItems = n;\n else if (k.operator === \">\") out.minItems = n + 1;\n else if (k.operator === \"<=\") out.maxItems = n;\n else if (k.operator === \"<\") out.maxItems = n - 1;\n else if (k.operator === \"=\") {\n out.minItems = n;\n out.maxItems = n;\n }\n }\n return out;\n}\nfunction makeNullable(s, target) {\n if (target === \"openapi-3.0\") return { ...s, nullable: true };\n if (s.type === void 0) {\n if (Array.isArray(s.enum)) return { ...s, enum: [...s.enum, null] };\n if (\"const\" in s) {\n const { const: k, ...rest } = s;\n return { ...rest, enum: [k, null] };\n }\n return s;\n }\n return { ...s, type: [s.type, \"null\"] };\n}\nfunction columnSchema(c, mode, target, checks, sets, lengths, cardinalities, applyDefault) {\n let s = baseSchema(c, mode, target, checks, sets, lengths);\n const dims = c.arrayDimensions ?? 0;\n for (let i = 0; i < dims; i++) {\n s = { type: \"array\", items: s, ...i === dims - 1 ? cardinalityBounds(c, cardinalities) : {} };\n }\n if (c.nullable) s = makeNullable(s, target);\n if (mode === \"insert\" && applyDefault && c.defaultValue !== void 0) {\n s = { ...s, default: c.defaultValue };\n }\n return s;\n}\nfunction rowDescription(rows, cols) {\n const present = new Set(cols.map((c) => c.name));\n const applicable = rows.filter((r) => present.has(r.left) && present.has(r.right));\n if (!applicable.length) return void 0;\n const list = applicable.map((r) => `${r.name ? `${r.name}: ` : \"\"}${r.left} ${r.operator} ${r.right}`).join(\"; \");\n return `Row constraints not expressible in JSON Schema: ${list}`;\n}\nfunction tableSchema(table, cols, mode, target, applyDefaults, parsed) {\n const properties = {};\n const required = [];\n for (const c of cols) {\n properties[c.name] = columnSchema(\n c,\n mode,\n target,\n parsed.checks,\n parsed.sets,\n parsed.lengths,\n parsed.cardinalities,\n applyDefaults\n );\n const suppliedOnInsert = c.hasDefault || applyDefaults && c.defaultValue !== void 0 || c.isGenerated;\n const optional = mode === \"update\" || mode === \"insert\" && suppliedOnInsert;\n if (!optional) required.push(c.name);\n }\n const desc = rowDescription(parsed.rows, cols);\n return {\n ...target === \"draft-2020-12\" ? { $schema: DRAFT } : {},\n $id: `${table.tsName}.${mode}`,\n title: `${mode} ${table.tsName}`,\n ...desc ? { description: desc } : {},\n type: \"object\",\n properties,\n ...required.length ? { required } : {},\n additionalProperties: false\n };\n}\nfunction collect(table) {\n const parsed = (table.checks ?? []).map((k) => parseCheck(k.expression, k.name));\n return {\n checks: parsed.flatMap((p) => p.ok ? p.checks : []),\n sets: parsed.flatMap((p) => p.ok ? p.sets ?? [] : []),\n rows: parsed.flatMap((p) => p.ok ? p.rows ?? [] : []),\n lengths: parsed.flatMap((p) => p.ok ? p.lengths ?? [] : []),\n cardinalities: parsed.flatMap((p) => p.ok ? p.cardinalities ?? [] : [])\n };\n}\nfunction tableSchemas(table, opts = {}) {\n const target = opts.target ?? \"draft-2020-12\";\n const parsed = collect(table);\n const build2 = (cols, mode) => tableSchema(table, cols, mode, target, !!opts.applyDefaults, parsed);\n return {\n insert: build2(insertColumns(table), \"insert\"),\n update: build2(updateColumns(table), \"update\"),\n select: build2(selectColumns(table), \"select\")\n };\n}\nfunction componentsDocument(tables, opts = {}) {\n const schemas = {};\n for (const table of tables) {\n const built = tableSchemas(table, opts);\n for (const mode of [\"insert\", \"update\", \"select\"]) {\n const name = `${table.tsName}${mode[0].toUpperCase()}${mode.slice(1)}`;\n const { $schema: _dialect, $id: _id, ...rest } = built[mode];\n schemas[name] = rest;\n }\n }\n return { schemas };\n}\n\n// src/openapi.ts\nvar ERROR_SCHEMA = \"Error\";\nvar componentName = (table, mode) => `${table.tsName}${mode[0].toUpperCase()}${mode.slice(1)}`;\nvar ref = (name) => ({ $ref: `#/components/schemas/${name}` });\nvar pascal = (s) => s.charAt(0).toUpperCase() + s.slice(1);\nfunction keyColumns(table) {\n const names = table.primaryKey?.columns ?? [];\n if (!names.length) return null;\n const cols = names.map((n) => table.columns.find((c) => c.name === n));\n if (cols.some((c) => !c)) return null;\n return cols;\n}\nvar modesFor = (table, key) => [\n ...table.readOnly ? [] : [\"insert\"],\n ...table.readOnly || !key ? [] : [\"update\"],\n \"select\"\n];\nvar resourceSegment = (table) => table.schema ? `${encodeURIComponent(table.schema)}/${encodeURIComponent(table.name)}` : encodeURIComponent(table.name);\nfunction foreignKeysOf(table) {\n if (table.foreignKeys?.length) return table.foreignKeys;\n return table.columns.filter((c) => c.references).map((c) => ({\n columns: [c.name],\n foreignTable: c.references.table,\n ...c.references.schema ? { foreignSchema: c.references.schema } : {},\n foreignColumns: [c.references.column]\n }));\n}\nvar jsonBody = (schema) => ({ content: { \"application/json\": { schema } } });\nfunction build(tables, opts) {\n const target = opts.target ?? \"draft-2020-12\";\n const schemaTarget = target === \"openapi-3.0\" ? \"openapi-3.0\" : \"openapi-3.1\";\n const failure = String(opts.validationStatus ?? 400);\n const paths = {};\n const schemas = {};\n const tags = [];\n const operationIds = /* @__PURE__ */ new Map();\n const owner = /* @__PURE__ */ new Map();\n const claim = (path, by, label) => {\n const taken = owner.get(path);\n if (taken !== void 0 && taken.by !== by) {\n throw new Error(\n `@drzl/generator-json-schema: the OpenAPI path \"${path}\" is claimed twice: by table \"${taken.label}\" (exported as ${taken.by}) and by table \"${label}\" (exported as ${by}). A path names one resource, so one of the two has to be left out of this generator with the config's \"exclude\" list.`\n );\n }\n owner.set(path, { by, label });\n };\n const operation = (id, table, rest) => {\n const clash = operationIds.get(id);\n if (clash !== void 0) {\n throw new Error(\n `@drzl/generator-json-schema: the operationId \"${id}\" would be emitted for both \"${clash}\" and \"${qualifiedTableName(table)}\". An operationId is the method name a client generator derives, and the specification requires it to be unique across the document.`\n );\n }\n operationIds.set(id, qualifiedTableName(table));\n return { operationId: id, tags: [qualifiedTableName(table)], ...rest };\n };\n const built = tables.map((table) => ({\n table,\n key: keyColumns(table),\n segment: resourceSegment(table),\n schemas: tableSchemas(table, { target: schemaTarget, applyDefaults: opts.applyDefaults })\n }));\n for (const { table, key, segment, schemas: built3 } of built) {\n for (const mode of modesFor(table, key)) {\n const { $schema: _dialect, $id: _id, ...rest } = built3[mode];\n schemas[componentName(table, mode)] = rest;\n }\n const notes = [];\n if (!key) notes.push(\"It has no primary key, so no path addresses a single row.\");\n if (table.readOnly) {\n notes.push(\"It refuses every write, so only reads are described.\");\n }\n tags.push({\n name: qualifiedTableName(table),\n description: [`Table \"${qualifiedTableName(table)}\".`, ...notes].join(\" \")\n });\n const T = pascal(table.tsName);\n const select = ref(componentName(table, \"select\"));\n const validationFailed = {\n description: \"The request does not match the schema for this operation.\",\n ...jsonBody(ref(ERROR_SCHEMA))\n };\n const collidable = [\n ...table.primaryKey ? [`primary key (${table.primaryKey.columns.join(\", \")})`] : [],\n ...table.unique.map((u) => `${u.name ? `${u.name} ` : \"\"}(${u.columns.join(\", \")})`)\n ];\n const conflict = (constraints) => ({\n description: `The row collides with an existing one on ${constraints.join(\"; \")}.`,\n ...jsonBody(ref(ERROR_SCHEMA))\n });\n const collection = `/${segment}`;\n claim(collection, table.tsName, qualifiedTableName(table));\n const item = {\n get: operation(`list${T}`, table, {\n summary: `List every ${table.name} row.`,\n // No pagination parameters. Whether the server implements a limit, an offset or a cursor is\n // not something a Drizzle schema states, and a declared parameter nothing honours is worse\n // than an undeclared one.\n responses: {\n \"200\": {\n description: `Every ${table.name} row.`,\n ...jsonBody({ type: \"array\", items: select })\n }\n }\n })\n };\n if (!table.readOnly) {\n item.post = operation(`create${T}`, table, {\n summary: `Create a ${table.name} row.`,\n requestBody: { required: true, ...jsonBody(ref(componentName(table, \"insert\"))) },\n responses: {\n \"201\": { description: `The ${table.name} row that was created.`, ...jsonBody(select) },\n [failure]: validationFailed,\n ...collidable.length ? { \"409\": conflict(collidable) } : {}\n }\n });\n }\n paths[collection] = item;\n if (!key) continue;\n const itemPath = `${collection}/${key.map((c) => `{${c.name}}`).join(\"/\")}`;\n claim(itemPath, table.tsName, qualifiedTableName(table));\n const parameters = key.map((c) => ({\n name: c.name,\n in: \"path\",\n required: true,\n description: `${c.name}, from the primary key of ${table.name}.`,\n // The column's own schema rather than a string, so an integer key is declared as one and a\n // uuid key carries its format. This is the whole point of reading the real key.\n schema: built3.select.properties[c.name] ?? {}\n }));\n const missing = {\n description: `No ${table.name} row has that ${key.map((c) => c.name).join(\" and \")}.`,\n ...jsonBody(ref(ERROR_SCHEMA))\n };\n const byId = {\n parameters,\n get: operation(`get${T}`, table, {\n summary: `Read one ${table.name} row.`,\n responses: {\n \"200\": { description: `The requested ${table.name} row.`, ...jsonBody(select) },\n [failure]: validationFailed,\n \"404\": missing\n }\n })\n };\n if (!table.readOnly) {\n byId.patch = operation(`update${T}`, table, {\n summary: `Patch one ${table.name} row.`,\n requestBody: { required: true, ...jsonBody(ref(componentName(table, \"update\"))) },\n responses: {\n \"200\": { description: `The ${table.name} row after the patch.`, ...jsonBody(select) },\n [failure]: validationFailed,\n \"404\": missing,\n // The primary key is not in the update schema, so a patch cannot collide on it. Only a\n // unique constraint over other columns can.\n ...table.unique.length ? {\n \"409\": conflict(\n table.unique.map((u) => `${u.name ? `${u.name} ` : \"\"}(${u.columns.join(\", \")})`)\n )\n } : {}\n }\n });\n byId.delete = operation(`delete${T}`, table, {\n summary: `Delete one ${table.name} row.`,\n responses: {\n // No body. Handing back the deleted row is the alternative and it is not a true statement\n // on every dialect DRZL supports: RETURNING is Postgres and SQLite, and MySQL has no such\n // clause, so an implementation there has nothing to send.\n \"204\": { description: `The ${table.name} row was deleted. No content is returned.` },\n [failure]: validationFailed,\n \"404\": missing\n }\n });\n }\n paths[itemPath] = byId;\n if (!opts.includeRelations) continue;\n for (const child of built) {\n if (child.table === table) continue;\n const matching = foreignKeysOf(child.table).filter(\n (fk) => (\n // Qualified on both sides. On the bare name a key pointing at `reporting.users` also\n // answered for `public.users`, so the child was hung under a parent in another schema.\n qualifiedForeignTable(fk) === qualifiedTableName(table) && fk.foreignColumns.length === key.length && fk.foreignColumns.every((c, i) => c === key[i].name)\n )\n );\n if (matching.length !== 1) continue;\n const subPath = `${itemPath}/${child.segment}`;\n claim(\n subPath,\n `${table.tsName} -> ${child.table.tsName}`,\n `${qualifiedTableName(table)} -> ${qualifiedTableName(child.table)}`\n );\n paths[subPath] = {\n parameters,\n get: operation(`list${T}${pascal(child.table.tsName)}`, child.table, {\n summary: `List the ${child.table.name} rows belonging to one ${table.name} row.`,\n responses: {\n \"200\": {\n description: `The ${child.table.name} rows whose ${matching[0].columns.join(\", \")} names this ${table.name} row.`,\n ...jsonBody({ type: \"array\", items: ref(componentName(child.table, \"select\")) })\n },\n [failure]: validationFailed,\n \"404\": missing\n }\n })\n };\n }\n }\n return { paths, schemas, tags };\n}\nvar errorSchema = () => ({\n title: \"error\",\n description: \"What an operation returns when it does not return the row.\",\n type: \"object\",\n properties: {\n message: { type: \"string\" },\n code: { type: \"string\" }\n },\n required: [\"message\"],\n additionalProperties: true\n});\nfunction openApiDocument(tables, opts = {}) {\n const target = opts.target ?? \"draft-2020-12\";\n const { paths, schemas, tags } = build(tables, opts);\n if (ERROR_SCHEMA in schemas) {\n throw new Error(\n `@drzl/generator-json-schema: a table produced the component schema name \"${ERROR_SCHEMA}\", which the document already uses for its error responses.`\n );\n }\n return {\n openapi: target === \"openapi-3.0\" ? \"3.0.3\" : \"3.1.1\",\n info: {\n title: opts.info?.title ?? \"API\",\n version: opts.info?.version ?? \"0.0.0\",\n description: opts.info?.description ?? \"Generated by DRZL from a Drizzle schema. Paths, request bodies and response bodies are derived from the schema alone; nothing here has been checked against a running server.\"\n },\n ...opts.servers?.length ? { servers: opts.servers } : {},\n paths,\n components: { schemas: { ...schemas, [ERROR_SCHEMA]: errorSchema() } },\n tags\n };\n}\n\n// src/index.ts\nvar DEFAULT_FILE_SUFFIX = \".schema.ts\";\nfunction renderTableModule(table, affix, target, applyDefaults) {\n const T = table.tsName;\n const schemas = tableSchemas(table, { target, applyDefaults });\n const decl = (mode) => `export const ${schemaName(mode, T, affix)} = ${JSON.stringify(schemas[mode], null, 2)} as const;\n\nexport type ${typeName(mode, T, affix)} = typeof ${schemaName(mode, T, affix)};`;\n return [decl(\"insert\"), decl(\"update\"), decl(\"select\")].join(\"\\n\\n\") + \"\\n\";\n}\nfunction resolveDocument(opt) {\n if (!opt) return null;\n const o = opt === true ? {} : opt;\n if (o.enabled === false) return null;\n return { ...o, format: o.format ?? \"ts\" };\n}\nvar JsonSchemaGenerator = class {\n constructor(analysis) {\n this.analysis = analysis;\n this.library = \"json-schema\";\n }\n async generate(opts) {\n const fs = await import(\"fs/promises\");\n const path = await import(\"path\");\n const out = path.resolve(process.cwd(), opts.outDir);\n const files = [];\n await fs.mkdir(out, { recursive: true });\n const affix = resolveAffix(opts);\n const fileSuffix = opts.fileSuffix ?? DEFAULT_FILE_SUFFIX;\n const target = opts.target ?? \"draft-2020-12\";\n const document = resolveDocument(opts.document);\n for (const table of this.analysis.tables) {\n const filePath = path.join(out, moduleFileName(table.tsName, fileSuffix));\n const code = renderTableModule(table, affix, target, !!opts.applyDefaults);\n const formatted = await formatCode(\n buildHeader(opts.outputHeader) + code,\n filePath,\n opts.format\n );\n await fs.writeFile(filePath, formatted, \"utf8\");\n files.push(filePath);\n }\n if (opts.components) {\n const doc = componentsDocument(this.analysis.tables, {\n target,\n applyDefaults: !!opts.applyDefaults\n });\n const componentsPath = path.join(out, \"components.ts\");\n const code = `export const components = ${JSON.stringify(doc, null, 2)} as const;\n`;\n await fs.writeFile(\n componentsPath,\n await formatCode(buildHeader(opts.outputHeader) + code, componentsPath, opts.format),\n \"utf8\"\n );\n files.push(componentsPath);\n }\n if (document) {\n const built = openApiDocument(this.analysis.tables, {\n target,\n applyDefaults: !!opts.applyDefaults,\n includeRelations: !!opts.includeRelations,\n info: document.info,\n servers: document.servers,\n validationStatus: document.validationStatus\n });\n const body = JSON.stringify(built, null, 2);\n if (document.format !== \"json\") {\n const tsPath = path.join(out, \"openapi.ts\");\n const code = `export const openapi = ${body} as const;\n`;\n await fs.writeFile(\n tsPath,\n await formatCode(buildHeader(opts.outputHeader) + code, tsPath, opts.format),\n \"utf8\"\n );\n files.push(tsPath);\n }\n if (document.format !== \"ts\") {\n const jsonPath = path.join(out, \"openapi.json\");\n await fs.writeFile(jsonPath, body + \"\\n\", \"utf8\");\n files.push(jsonPath);\n }\n }\n const ext = opts.importExtension === \"none\" ? \"\" : \".js\";\n const indexPath = path.join(out, \"index.ts\");\n const index = this.analysis.tables.map(\n (t) => `export * from '${moduleSpecifier(t.tsName, fileSuffix, opts.importExtension)}';`\n ).concat(opts.components ? [`export * from './components${ext}';`] : []).concat(document && document.format !== \"json\" ? [`export * from './openapi${ext}';`] : []).join(\"\\n\") + \"\\n\";\n const indexFormatted = await formatCode(\n buildHeader(opts.outputHeader) + index,\n indexPath,\n opts.format\n );\n await fs.writeFile(indexPath, indexFormatted, \"utf8\");\n files.push(indexPath);\n return files;\n }\n renderTable(table, opts) {\n return renderTableModule(\n table,\n resolveAffix(opts),\n opts?.target ?? \"draft-2020-12\",\n !!opts?.applyDefaults\n );\n }\n};\nvar index_default = JsonSchemaGenerator;\nfunction buildHeader(h) {\n if (h?.enabled === false) return \"\";\n const text = h?.text ?? \"// Generated by DRZL. Do not edit by hand.\";\n return `${text}\n\n`;\n}\nexport {\n DRAFT,\n JsonSchemaGenerator,\n componentsDocument,\n index_default as default,\n openApiDocument,\n tableSchemas\n};\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,uBAAuB,0BAA0B;AAG1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,IAAI,QAAQ;AACZ,IAAI,cAAc;AAClB,IAAI,SAAS,CAAC,WAAW,WAAW,gBAAgB,EAAE,MAAM,UAAU,QAAQ,OAAO,IAAI,EAAE,MAAM,UAAU,iBAAiB,SAAS;AACrI,SAAS,WAAW,GAAG,MAAM,QAAQ,QAAQ,MAAM,SAAS;AAC1D,QAAM,IAAI,EAAE;AACZ,MAAI,GAAG;AACL,YAAQ,EAAE,MAAM;AAAA,MACd,KAAK;AACH,eAAO,CAAC;AAAA,MACV,KAAK;AACH,eAAO,CAAC;AAAA,MACV,KAAK;AACH,eAAO,OAAO,MAAM;AAAA,MACtB,KAAK;AACH,eAAO,WAAW,gBAAgB,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,GAAG,UAAU,EAAE,QAAQ,UAAU,EAAE,OAAO,IAAI;AAAA,UACvH,MAAM;AAAA,UACN,aAAa,MAAM,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,EAAE,MAAM,SAAS,EAAE;AAAA,UACxE,UAAU,EAAE;AAAA,UACZ,UAAU,EAAE;AAAA,QACd;AAAA,MACF,KAAK;AACH,eAAO;AAAA,UACL,MAAM;AAAA,UACN,YAAY,OAAO,YAAY,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,SAAS,CAAC,CAAC,CAAC;AAAA,UAC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