@prisma/orm-family-sql 8.0.0-rc.11-dev.16 → 8.0.0-rc.11-dev.18

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 (81) hide show
  1. package/dist/{authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs → authoring-type-constructors-BD-XuavC-CW5J4Z8r.mjs} +2 -2
  2. package/dist/{authoring-type-constructors-BD-XuavC-CJV-TxFh.mjs.map → authoring-type-constructors-BD-XuavC-CW5J4Z8r.mjs.map} +1 -1
  3. package/dist/{config-types-BNJgLUUQ.mjs → config-types-tDX8p7v3.mjs} +2 -2
  4. package/dist/{config-types-BNJgLUUQ.mjs.map → config-types-tDX8p7v3.mjs.map} +1 -1
  5. package/dist/{contract-builder-De_sioHE.d.mts → contract-builder-Bwe2diF2.d.mts} +14 -5
  6. package/dist/{contract-builder-De_sioHE.d.mts.map → contract-builder-Bwe2diF2.d.mts.map} +1 -1
  7. package/dist/{contract-builder-BOmEsrRi.mjs → contract-builder-D1f6k8r4.mjs} +2 -2
  8. package/dist/{contract-builder-BOmEsrRi.mjs.map → contract-builder-D1f6k8r4.mjs.map} +1 -1
  9. package/dist/contract-prisma7__provider.d.mts +85 -0
  10. package/dist/contract-prisma7__provider.d.mts.map +1 -0
  11. package/dist/contract-prisma7__provider.mjs +1648 -0
  12. package/dist/contract-prisma7__provider.mjs.map +1 -0
  13. package/dist/contract-psl.d.mts +4 -3
  14. package/dist/contract-psl.d.mts.map +1 -1
  15. package/dist/contract-psl.mjs +1 -1
  16. package/dist/contract-psl__attribute-specs.d.mts +3 -3
  17. package/dist/contract-psl__attribute-specs.d.mts.map +1 -1
  18. package/dist/contract-psl__attribute-specs.mjs +1 -1
  19. package/dist/contract-psl__provider.mjs +5 -5
  20. package/dist/contract-psl__provider.mjs.map +1 -1
  21. package/dist/contract-ts.d.mts +2 -2
  22. package/dist/contract-ts.mjs +3 -3
  23. package/dist/contract-ts__config-types.mjs +1 -1
  24. package/dist/contract-ts__contract-builder.d.mts +2 -2
  25. package/dist/contract-ts__contract-builder.mjs +2 -2
  26. package/dist/{control-CYQ2U777.d.mts → control-CvOB6L1w.d.mts} +12 -11
  27. package/dist/control-CvOB6L1w.d.mts.map +1 -0
  28. package/dist/{control-adapter-C99J7aEF-CUDc48SO.d.mts → control-adapter-C99J7aEF-BLc1Uog8.d.mts} +3 -3
  29. package/dist/{control-adapter-C99J7aEF-CUDc48SO.d.mts.map → control-adapter-C99J7aEF-BLc1Uog8.d.mts.map} +1 -1
  30. package/dist/control-adapter-DfLKiViv.d.mts +1 -0
  31. package/dist/{control-BNXN-KA4.mjs → control-xNkuCauS.mjs} +4 -4
  32. package/dist/control-xNkuCauS.mjs.map +1 -0
  33. package/dist/{derived-checks-DGjY5t7S-B3txNm7X.mjs → derived-checks-DGjY5t7S-CzJmkeZR.mjs} +2 -2
  34. package/dist/{derived-checks-DGjY5t7S-B3txNm7X.mjs.map → derived-checks-DGjY5t7S-CzJmkeZR.mjs.map} +1 -1
  35. package/dist/{diff-CFhK3Q3k.d.mts → diff-Dz5kQO4e.d.mts} +6 -6
  36. package/dist/{diff-CFhK3Q3k.d.mts.map → diff-Dz5kQO4e.d.mts.map} +1 -1
  37. package/dist/family.d.mts +9 -9
  38. package/dist/family.mjs +4 -4
  39. package/dist/family__control-adapter.d.mts +2 -2
  40. package/dist/family__control.d.mts +4 -4
  41. package/dist/family__control.mjs +3 -3
  42. package/dist/family__diff.d.mts +2 -2
  43. package/dist/family__migration.d.mts +1 -1
  44. package/dist/family__pack.d.mts +1 -1
  45. package/dist/family__pack.d.mts.map +1 -1
  46. package/dist/family__pack.mjs +2 -2
  47. package/dist/family__psl-infer.d.mts +2 -2
  48. package/dist/family__psl-infer.mjs +2 -2
  49. package/dist/{interpreter-C_i0NCiB-CptD-6Yu.mjs → interpreter-QDw8KJeP-Bc93B8xi.mjs} +52 -8
  50. package/dist/interpreter-QDw8KJeP-Bc93B8xi.mjs.map +1 -0
  51. package/dist/{migration-CkjRhB8h.d.mts → migration-D5C6JC3c.d.mts} +2 -2
  52. package/dist/{migration-CkjRhB8h.d.mts.map → migration-D5C6JC3c.d.mts.map} +1 -1
  53. package/dist/{psl-infer-TBwKfKgU.mjs → psl-infer-CPQSp4tG.mjs} +2 -84
  54. package/dist/psl-infer-CPQSp4tG.mjs.map +1 -0
  55. package/dist/{psl-infer-CCAD6FWA.d.mts → psl-infer-tLt9U1UP.d.mts} +4 -7
  56. package/dist/{psl-infer-CCAD6FWA.d.mts.map → psl-infer-tLt9U1UP.d.mts.map} +1 -1
  57. package/dist/{schema-differ-DpG_gnur-BICVtTHY.d.mts → schema-differ-DpG_gnur-CLds_Z0t.d.mts} +3 -3
  58. package/dist/{schema-differ-DpG_gnur-BICVtTHY.d.mts.map → schema-differ-DpG_gnur-CLds_Z0t.d.mts.map} +1 -1
  59. package/dist/schema-ir.d.mts +1 -1
  60. package/dist/schema-ir.mjs +1 -1
  61. package/dist/schema-ir__types.d.mts +2 -2
  62. package/dist/schema-ir__types.mjs +1 -1
  63. package/dist/{sql-attribute-specs-BCJ_CDJH-CfH1ddqf.mjs → sql-attribute-specs-BnUIuOy5-8t7OYHpi.mjs} +5 -5
  64. package/dist/sql-attribute-specs-BnUIuOy5-8t7OYHpi.mjs.map +1 -0
  65. package/dist/types-9RtQn3mX.d.mts +1 -0
  66. package/dist/{types-YStFFkKs-D9UAmnON.d.mts → types-C6k9x_Je-DkvHNHEX.d.mts} +18 -2
  67. package/dist/types-C6k9x_Je-DkvHNHEX.d.mts.map +1 -0
  68. package/dist/{types-BvupgHcG-c8QDupnu.mjs → types-CZn-8Rsg-Bv6arhpI.mjs} +73 -13
  69. package/dist/types-CZn-8Rsg-Bv6arhpI.mjs.map +1 -0
  70. package/dist/{types-IqZMLrFC-BQmtKloA.d.mts → types-IqZMLrFC-BAUPBjE5.d.mts} +4 -4
  71. package/dist/{types-IqZMLrFC-BQmtKloA.d.mts.map → types-IqZMLrFC-BAUPBjE5.d.mts.map} +1 -1
  72. package/package.json +19 -17
  73. package/dist/control-BNXN-KA4.mjs.map +0 -1
  74. package/dist/control-CYQ2U777.d.mts.map +0 -1
  75. package/dist/control-adapter-BPttH3He.d.mts +0 -1
  76. package/dist/interpreter-C_i0NCiB-CptD-6Yu.mjs.map +0 -1
  77. package/dist/psl-infer-TBwKfKgU.mjs.map +0 -1
  78. package/dist/sql-attribute-specs-BCJ_CDJH-CfH1ddqf.mjs.map +0 -1
  79. package/dist/types-BvupgHcG-c8QDupnu.mjs.map +0 -1
  80. package/dist/types-Dwcw0F8X.d.mts +0 -1
  81. package/dist/types-YStFFkKs-D9UAmnON.d.mts.map +0 -1
@@ -148,88 +148,6 @@ function deriveBackRelationFieldName(childModelName, isOneToOne) {
148
148
  const base = childModelName.charAt(0).toLowerCase() + childModelName.slice(1);
149
149
  return isOneToOne ? base : pluralize(base);
150
150
  }
151
- const NEXTVAL_PATTERN = /^nextval\s*\(/i;
152
- const NOW_FUNCTION_PATTERN = /^(now\s*\(\s*\)|CURRENT_TIMESTAMP)$/i;
153
- const CLOCK_TIMESTAMP_PATTERN = /^clock_timestamp\s*\(\s*\)$/i;
154
- const TIMESTAMP_CAST_SUFFIX = /::timestamp(?:tz|\s+(?:with|without)\s+time\s+zone)?$/i;
155
- const TEXT_CAST_SUFFIX = /::text$/i;
156
- const NOW_LITERAL_PATTERN = /^'now'$/i;
157
- const UUID_PATTERN = /^gen_random_uuid\s*\(\s*\)$/i;
158
- const UUID_OSSP_PATTERN = /^uuid_generate_v4\s*\(\s*\)$/i;
159
- const NULL_PATTERN = /^NULL(?:::.+)?$/i;
160
- const TRUE_PATTERN = /^true$/i;
161
- const FALSE_PATTERN = /^false$/i;
162
- const NUMERIC_PATTERN = /^-?\d+(\.\d+)?$/;
163
- const JSON_CAST_SUFFIX = /::jsonb?$/i;
164
- const STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'(?:::(?:"[^"]+"|[\w\s]+)(?:\(\d+\))?)?$/;
165
- function canonicalizeTimestampDefault(expr) {
166
- if (NOW_FUNCTION_PATTERN.test(expr)) return "now()";
167
- if (CLOCK_TIMESTAMP_PATTERN.test(expr)) return "clock_timestamp()";
168
- if (!TIMESTAMP_CAST_SUFFIX.test(expr)) return void 0;
169
- let inner = expr.replace(TIMESTAMP_CAST_SUFFIX, "").trim();
170
- if (inner.startsWith("(") && inner.endsWith(")")) inner = inner.slice(1, -1).trim();
171
- if (NOW_FUNCTION_PATTERN.test(inner)) return "now()";
172
- if (CLOCK_TIMESTAMP_PATTERN.test(inner)) return "clock_timestamp()";
173
- inner = inner.replace(TEXT_CAST_SUFFIX, "").trim();
174
- if (NOW_LITERAL_PATTERN.test(inner)) return "now()";
175
- }
176
- function parseRawDefault(rawDefault, nativeType) {
177
- const trimmed = rawDefault.trim();
178
- const normalizedType = nativeType?.toLowerCase();
179
- if (NEXTVAL_PATTERN.test(trimmed)) return {
180
- kind: "function",
181
- expression: "autoincrement()"
182
- };
183
- const canonicalTimestamp = canonicalizeTimestampDefault(trimmed);
184
- if (canonicalTimestamp) return {
185
- kind: "function",
186
- expression: canonicalTimestamp
187
- };
188
- if (UUID_PATTERN.test(trimmed) || UUID_OSSP_PATTERN.test(trimmed)) return {
189
- kind: "function",
190
- expression: "gen_random_uuid()"
191
- };
192
- if (NULL_PATTERN.test(trimmed)) return {
193
- kind: "literal",
194
- value: null
195
- };
196
- if (TRUE_PATTERN.test(trimmed)) return {
197
- kind: "literal",
198
- value: true
199
- };
200
- if (FALSE_PATTERN.test(trimmed)) return {
201
- kind: "literal",
202
- value: false
203
- };
204
- if (NUMERIC_PATTERN.test(trimmed)) return {
205
- kind: "literal",
206
- value: Number(trimmed)
207
- };
208
- const stringMatch = trimmed.match(STRING_LITERAL_PATTERN);
209
- if (stringMatch?.[1] !== void 0) {
210
- const unescaped = stringMatch[1].replace(/''/g, "'");
211
- if (normalizedType === "json" || normalizedType === "jsonb") {
212
- if (JSON_CAST_SUFFIX.test(trimmed)) return {
213
- kind: "function",
214
- expression: trimmed
215
- };
216
- try {
217
- return {
218
- kind: "literal",
219
- value: JSON.parse(unescaped)
220
- };
221
- } catch {}
222
- }
223
- return {
224
- kind: "literal",
225
- value: unescaped
226
- };
227
- }
228
- return {
229
- kind: "function",
230
- expression: trimmed
231
- };
232
- }
233
151
  const DEFAULT_ON_DELETE = "noAction";
234
152
  const DEFAULT_ON_UPDATE = "noAction";
235
153
  const REFERENTIAL_ACTION_PSL = {
@@ -357,6 +275,6 @@ function addRelationField(map, tableName, field) {
357
275
  else map.set(tableName, [field]);
358
276
  }
359
277
  //#endregion
360
- export { mapDefault as a, toEnumMemberName as c, toModelName as d, inferRelations as i, toEnumName as l, deriveBackRelationFieldName as n, parseRawDefault as o, deriveRelationFieldName as r, pluralize as s, buildChildRelationField as t, toFieldName as u };
278
+ export { mapDefault as a, toEnumName as c, inferRelations as i, toFieldName as l, deriveBackRelationFieldName as n, pluralize as o, deriveRelationFieldName as r, toEnumMemberName as s, buildChildRelationField as t, toModelName as u };
361
279
 
362
- //# sourceMappingURL=psl-infer-TBwKfKgU.mjs.map
280
+ //# sourceMappingURL=psl-infer-CPQSp4tG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"psl-infer-CPQSp4tG.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/psl-infer.mjs"],"sourcesContent":["import pluralizeLib from \"pluralize\";\nimport { backingIndexColumnKeys, isBackedByColumnKeys } from \"@internal/sql-contract/foreign-key-materialization\";\n//#region src/core/psl-contract-infer/default-mapping.ts\nconst DEFAULT_FUNCTION_ATTRIBUTES = {\n\t\"autoincrement()\": \"@default(autoincrement())\",\n\t\"now()\": \"@default(now())\"\n};\nfunction mapDefault(columnDefault, options) {\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": return { attribute: `@default(${formatLiteralValue(columnDefault.value)})` };\n\t\tcase \"function\": {\n\t\t\tconst attribute = options?.functionAttributes?.[columnDefault.expression] ?? DEFAULT_FUNCTION_ATTRIBUTES[columnDefault.expression] ?? options?.fallbackFunctionAttribute?.(columnDefault.expression);\n\t\t\treturn attribute ? { attribute } : { comment: `// Raw default: ${columnDefault.expression.replace(/[\\r\\n]+/g, \" \")}` };\n\t\t}\n\t}\n}\nfunction formatLiteralValue(value) {\n\tif (value === null) return \"null\";\n\tswitch (typeof value) {\n\t\tcase \"boolean\":\n\t\tcase \"number\": return String(value);\n\t\tcase \"string\": return quoteString(value);\n\t\tdefault: return quoteString(JSON.stringify(value));\n\t}\n}\nfunction quoteString(str) {\n\treturn `\"${escapeString(str)}\"`;\n}\nfunction escapeString(str) {\n\treturn JSON.stringify(str).slice(1, -1);\n}\n//#endregion\n//#region src/core/psl-contract-infer/name-transforms.ts\nconst PSL_RESERVED_WORDS = /* @__PURE__ */ new Set([\n\t\"model\",\n\t\"enum\",\n\t\"types\",\n\t\"type\",\n\t\"generator\",\n\t\"datasource\"\n]);\nconst IDENTIFIER_PART_PATTERN = /[A-Za-z0-9]+/g;\nfunction hasSeparators(input) {\n\treturn /[^A-Za-z0-9]/.test(input);\n}\nfunction extractIdentifierParts(input) {\n\treturn input.match(IDENTIFIER_PART_PATTERN) ?? [];\n}\nfunction createSyntheticIdentifier(input) {\n\tlet hash = 2166136261;\n\tfor (const char of input) {\n\t\thash ^= char.codePointAt(0) ?? 0;\n\t\thash = Math.imul(hash, 16777619);\n\t}\n\treturn `x${(hash >>> 0).toString(16)}`;\n}\nfunction sanitizeIdentifierCharacters(input) {\n\tconst sanitized = input.replace(/[^\\w]/g, \"\");\n\treturn sanitized.length > 0 ? sanitized : createSyntheticIdentifier(input);\n}\nfunction capitalize(word) {\n\treturn word.charAt(0).toUpperCase() + word.slice(1);\n}\nfunction snakeToPascalCase(input) {\n\tconst parts = extractIdentifierParts(input);\n\tif (parts.length === 0) return capitalize(sanitizeIdentifierCharacters(input));\n\treturn parts.map(capitalize).join(\"\");\n}\nfunction snakeToCamelCase(input) {\n\tconst parts = extractIdentifierParts(input);\n\tif (parts.length === 0) return sanitizeIdentifierCharacters(input);\n\tconst [firstPart = input, ...rest] = parts;\n\treturn firstPart.charAt(0).toLowerCase() + firstPart.slice(1) + rest.map(capitalize).join(\"\");\n}\nfunction needsEscaping(name) {\n\treturn PSL_RESERVED_WORDS.has(name.toLowerCase()) || /^\\d/.test(name);\n}\nfunction escapeName(name) {\n\treturn `_${name}`;\n}\nfunction escapeIfNeeded(name) {\n\treturn needsEscaping(name) ? escapeName(name) : name;\n}\nfunction toModelName(tableName) {\n\tlet name;\n\tif (hasSeparators(tableName)) name = snakeToPascalCase(tableName);\n\telse name = tableName.charAt(0).toUpperCase() + tableName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: tableName\n\t};\n\tif (name !== tableName) return {\n\t\tname,\n\t\tmap: tableName\n\t};\n\treturn { name };\n}\nfunction toFieldName(columnName) {\n\tlet name;\n\tif (hasSeparators(columnName)) name = snakeToCamelCase(columnName);\n\telse name = columnName.charAt(0).toLowerCase() + columnName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: columnName\n\t};\n\tif (name !== columnName) return {\n\t\tname,\n\t\tmap: columnName\n\t};\n\treturn { name };\n}\nfunction toEnumName(pgTypeName) {\n\tlet name;\n\tif (hasSeparators(pgTypeName)) name = snakeToPascalCase(pgTypeName);\n\telse name = pgTypeName.charAt(0).toUpperCase() + pgTypeName.slice(1);\n\tif (needsEscaping(name)) return {\n\t\tname: escapeName(name),\n\t\tmap: pgTypeName\n\t};\n\tif (name !== pgTypeName) return {\n\t\tname,\n\t\tmap: pgTypeName\n\t};\n\treturn { name };\n}\nconst VALID_IDENTIFIER_PATTERN = /^[A-Za-z_]\\w*$/;\n/**\n* PSL member name for a native-enum value. The value itself always prints\n* explicitly (`member = \"value\"`), so the returned name never needs a map:\n* a value that already is a valid, non-reserved identifier is kept verbatim\n* (case included); anything else is camelCased/escaped like a field name.\n*/\nfunction toEnumMemberName(value) {\n\tif (VALID_IDENTIFIER_PATTERN.test(value) && !needsEscaping(value)) return value;\n\treturn escapeIfNeeded(snakeToCamelCase(value));\n}\nfunction pluralize(word) {\n\treturn pluralizeLib.plural(word);\n}\nfunction deriveRelationFieldName(fkColumns, referencedTableName) {\n\tif (fkColumns.length === 1) {\n\t\tconst [col = referencedTableName] = fkColumns;\n\t\tconst stripped = col.replace(/_id$/i, \"\").replace(/Id$/, \"\");\n\t\tif (stripped.length > 0 && stripped !== col) return escapeIfNeeded(snakeToCamelCase(stripped));\n\t\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n\t}\n\treturn escapeIfNeeded(snakeToCamelCase(referencedTableName));\n}\nfunction deriveBackRelationFieldName(childModelName, isOneToOne) {\n\tconst base = childModelName.charAt(0).toLowerCase() + childModelName.slice(1);\n\treturn isOneToOne ? base : pluralize(base);\n}\n//#endregion\n//#region src/core/psl-contract-infer/relation-inference.ts\nconst DEFAULT_ON_DELETE = \"noAction\";\nconst DEFAULT_ON_UPDATE = \"noAction\";\nconst REFERENTIAL_ACTION_PSL = {\n\tnoAction: \"NoAction\",\n\trestrict: \"Restrict\",\n\tcascade: \"Cascade\",\n\tsetNull: \"SetNull\",\n\tsetDefault: \"SetDefault\"\n};\nfunction inferRelations(tables, modelNameMap) {\n\tconst relationsByTable = /* @__PURE__ */ new Map();\n\tconst fkCountByPair = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst pairKey = `${table.name}→${fk.referencedTable}`;\n\t\tfkCountByPair.set(pairKey, (fkCountByPair.get(pairKey) ?? 0) + 1);\n\t}\n\tconst usedFieldNames = /* @__PURE__ */ new Map();\n\tfor (const table of Object.values(tables)) {\n\t\tconst names = /* @__PURE__ */ new Set();\n\t\tfor (const col of Object.values(table.columns)) names.add(col.name);\n\t\tusedFieldNames.set(table.name, names);\n\t}\n\tfor (const table of Object.values(tables)) for (const fk of table.foreignKeys) {\n\t\tconst childTableName = table.name;\n\t\tconst parentTableName = fk.referencedTable;\n\t\tconst childUsed = usedFieldNames.get(childTableName);\n\t\tconst childModelName = modelNameMap.get(childTableName) ?? childTableName;\n\t\tconst parentModelName = modelNameMap.get(parentTableName) ?? parentTableName;\n\t\tconst pairKey = `${childTableName}→${parentTableName}`;\n\t\tconst isSelfRelation = childTableName === parentTableName;\n\t\tconst needsRelationName = fkCountByPair.get(pairKey) > 1 || isSelfRelation;\n\t\tconst isOneToOne = detectOneToOne(fk, table);\n\t\tconst childRelFieldName = resolveUniqueFieldName(deriveRelationFieldName(fk.columns, parentTableName), childUsed, parentModelName);\n\t\tconst relationName = needsRelationName ? deriveRelationName(fk, childRelFieldName, parentModelName, isSelfRelation) : void 0;\n\t\taddRelationField(relationsByTable, childTableName, buildChildRelationField(childRelFieldName, parentModelName, fk, fk.columns.some((columnName) => table.columns[columnName]?.nullable ?? false), relationName, table));\n\t\tchildUsed.add(childRelFieldName);\n\t\tconst parentUsed = usedFieldNames.get(parentTableName) ?? /* @__PURE__ */ new Set();\n\t\tusedFieldNames.set(parentTableName, parentUsed);\n\t\tconst backRelFieldName = resolveUniqueFieldName(deriveBackRelationFieldName(childModelName, isOneToOne), parentUsed, childModelName);\n\t\taddRelationField(relationsByTable, parentTableName, {\n\t\t\tfieldName: backRelFieldName,\n\t\t\ttypeName: childModelName,\n\t\t\toptional: isOneToOne,\n\t\t\tlist: !isOneToOne,\n\t\t\trelationName\n\t\t});\n\t\tparentUsed.add(backRelFieldName);\n\t}\n\treturn { relationsByTable };\n}\nfunction detectOneToOne(fk, table) {\n\tconst fkCols = [...fk.columns].sort();\n\tif (table.primaryKey) {\n\t\tconst pkCols = [...table.primaryKey.columns].sort();\n\t\tif (pkCols.length === fkCols.length && pkCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const unique of table.uniques) {\n\t\tconst uniqueCols = [...unique.columns].sort();\n\t\tif (uniqueCols.length === fkCols.length && uniqueCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\tfor (const index of table.indexes) {\n\t\tif (!index.unique || index.partial || index.columns === void 0) continue;\n\t\tconst indexCols = [...index.columns].sort();\n\t\tif (indexCols.length === fkCols.length && indexCols.every((c, i) => c === fkCols[i])) return true;\n\t}\n\treturn false;\n}\nfunction deriveRelationName(fk, childRelationFieldName, parentModelName, isSelfRelation) {\n\tif (fk.name) return fk.name;\n\tif (isSelfRelation) return `${childRelationFieldName.charAt(0).toUpperCase() + childRelationFieldName.slice(1)}${pluralize(parentModelName)}`;\n\treturn fk.columns.join(\"_\");\n}\n/**\n* Builds the child-side {@link RelationField} for a single foreign key:\n* `typeName` is the parent model name, `fields`/`references` are the FK's raw\n* columns, and `onDelete`/`onUpdate` are normalized to their PSL spelling.\n* Exported so a caller resolving a foreign key against a model outside\n* `tables` (e.g. a cross-space reference into another contract) can reuse the\n* same normalization instead of duplicating it.\n*\n* `hostTable` is the table the FK is declared on (i.e. `table`, not the\n* referenced parent) — its own indexes/uniques/primary key are what a\n* backing index for this FK would be. When none of them exactly match the\n* FK's source columns (in order), `index: false` is stamped so the emitted\n* `@relation` opts out of the framework's default derived backing-index\n* expectation, matching what `db verify` will find live. Passing the table\n* is optional so existing single-FK callers (e.g. cross-space resolution\n* before a host table reference is threaded through) can omit it and keep\n* the framework default.\n*/\nfunction buildChildRelationField(fieldName, parentModelName, fk, optional, relationName, hostTable) {\n\tconst onDelete = fk.onDelete && fk.onDelete !== DEFAULT_ON_DELETE ? fk.onDelete : void 0;\n\tconst onUpdate = fk.onUpdate && fk.onUpdate !== DEFAULT_ON_UPDATE ? fk.onUpdate : void 0;\n\tconst index = hostTable && !isBackedByColumnKeys(fk.columns, backingIndexColumnKeys({\n\t\tindexes: hostTable.indexes.filter((i) => i.where === void 0),\n\t\tuniques: hostTable.uniques,\n\t\tprimaryKey: hostTable.primaryKey\n\t})) ? false : void 0;\n\treturn {\n\t\tfieldName,\n\t\ttypeName: parentModelName,\n\t\treferencedTableName: fk.referencedTable,\n\t\toptional,\n\t\tlist: false,\n\t\trelationName,\n\t\tfkName: fk.name,\n\t\tfields: fk.columns,\n\t\treferences: fk.referencedColumns,\n\t\tonDelete: onDelete ? REFERENTIAL_ACTION_PSL[onDelete] : void 0,\n\t\tonUpdate: onUpdate ? REFERENTIAL_ACTION_PSL[onUpdate] : void 0,\n\t\tindex\n\t};\n}\nfunction resolveUniqueFieldName(desired, usedNames, fallbackSuffix) {\n\tif (!usedNames.has(desired)) return desired;\n\tconst withSuffix = `${desired}${fallbackSuffix}`;\n\tif (!usedNames.has(withSuffix)) return withSuffix;\n\tlet counter = 2;\n\twhile (usedNames.has(`${desired}${counter}`)) counter++;\n\treturn `${desired}${counter}`;\n}\nfunction addRelationField(map, tableName, field) {\n\tconst existing = map.get(tableName);\n\tif (existing) existing.push(field);\n\telse map.set(tableName, [field]);\n}\n//#endregion\nexport { buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, mapDefault, pluralize, toEnumMemberName, toEnumName, toFieldName, toModelName };\n\n//# sourceMappingURL=psl-infer.mjs.map"],"mappings":";;;AAGA,MAAM,8BAA8B;CACnC,mBAAmB;CACnB,SAAS;AACV;AACA,SAAS,WAAW,eAAe,SAAS;CAC3C,QAAQ,cAAc,MAAtB;EACC,KAAK,WAAW,OAAO,EAAE,WAAW,YAAY,mBAAmB,cAAc,KAAK,EAAE,GAAG;EAC3F,KAAK,YAAY;GAChB,MAAM,YAAY,SAAS,qBAAqB,cAAc,eAAe,4BAA4B,cAAc,eAAe,SAAS,4BAA4B,cAAc,UAAU;GACnM,OAAO,YAAY,EAAE,UAAU,IAAI,EAAE,SAAS,mBAAmB,cAAc,WAAW,QAAQ,YAAY,GAAG,IAAI;EACtH;CACD;AACD;AACA,SAAS,mBAAmB,OAAO;CAClC,IAAI,UAAU,MAAM,OAAO;CAC3B,QAAQ,OAAO,OAAf;EACC,KAAK;EACL,KAAK,UAAU,OAAO,OAAO,KAAK;EAClC,KAAK,UAAU,OAAO,YAAY,KAAK;EACvC,SAAS,OAAO,YAAY,KAAK,UAAU,KAA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aAAa,CAAC,qBAAqB,GAAG,SAAS,uBAAuB;EACnF,SAAS,UAAU,QAAQ,QAAQ,MAAM,EAAE,UAAU,KAAK,CAAC;EAC3D,SAAS,UAAU;EACnB,YAAY,UAAU;CACvB,CAAC,CAAC,IAAI,QAAQ,KAAK;CACnB,OAAO;EACN;EACA,UAAU;EACV,qBAAqB,GAAG;EACxB;EACA,MAAM;EACN;EACA,QAAQ,GAAG;EACX,QAAQ,GAAG;EACX,YAAY,GAAG;EACf,UAAU,WAAW,uBAAuB,YAAY,KAAK;EAC7D,UAAU,WAAW,uBAAuB,YAAY,KAAK;EAC7D;CACD;AACD;AACA,SAAS,uBAAuB,SAAS,WAAW,gBAAgB;CACnE,IAAI,CAAC,UAAU,IAAI,OAAO,GAAG,OAAO;CACpC,MAAM,aAAa,GAAG,UAAU;CAChC,IAAI,CAAC,UAAU,IAAI,UAAU,GAAG,OAAO;CACvC,IAAI,UAAU;CACd,OAAO,UAAU,IAAI,GAAG,UAAU,SAAS,GAAG;CAC9C,OAAO,GAAG,UAAU;AACrB;AACA,SAAS,iBAAiB,KAAK,WAAW,OAAO;CAChD,MAAM,WAAW,IAAI,IAAI,SAAS;CAClC,IAAI,UAAU,SAAS,KAAK,KAAK;MAC5B,IAAI,IAAI,WAAW,CAAC,KAAK,CAAC;AAChC"}
@@ -1,5 +1,5 @@
1
- import { d as SqlForeignKeyIR, y as SqlTableIR } from "./types-YStFFkKs-D9UAmnON.mjs";
2
- import "./types-Dwcw0F8X.mjs";
1
+ import { d as SqlForeignKeyIR, y as SqlTableIR } from "./types-C6k9x_Je-DkvHNHEX.mjs";
2
+ import "./types-9RtQn3mX.mjs";
3
3
  import { ColumnDefault } from "@prisma/orm-framework/contract/types";
4
4
  //#region ../../../2-sql/9-family/dist/psl-infer.d.mts
5
5
  //#region src/core/psl-contract-infer/default-mapping.d.ts
@@ -87,9 +87,6 @@ type RelationField = {
87
87
  readonly index?: boolean | undefined;
88
88
  };
89
89
  //#endregion
90
- //#region src/core/psl-contract-infer/raw-default-parser.d.ts
91
- declare function parseRawDefault(rawDefault: string, nativeType?: string): ColumnDefault | undefined;
92
- //#endregion
93
90
  //#region src/core/psl-contract-infer/relation-inference.d.ts
94
91
  type InferredRelations = {
95
92
  readonly relationsByTable: ReadonlyMap<string, readonly RelationField[]>;
@@ -115,5 +112,5 @@ declare function inferRelations(tables: Record<string, SqlTableIR>, modelNameMap
115
112
  */
116
113
  declare function buildChildRelationField(fieldName: string, parentModelName: string, fk: SqlForeignKeyIR, optional: boolean, relationName?: string, hostTable?: SqlTableIR): RelationField;
117
114
  //#endregion
118
- export { toEnumMemberName as _, PslPrinterOptions as a, toModelName as b, PslTypeResolution as c, deriveBackRelationFieldName as d, deriveRelationFieldName as f, pluralize as g, parseRawDefault as h, InferredRelations as i, RelationField as l, mapDefault as m, DefaultMappingResult as n, PslTypeMap as o, inferRelations as p, EnumInfo as r, PslTypeReference as s, DefaultMappingOptions as t, buildChildRelationField as u, toEnumName as v, toFieldName as y };
119
- //# sourceMappingURL=psl-infer-CCAD6FWA.d.mts.map
115
+ export { toEnumName as _, PslPrinterOptions as a, PslTypeResolution as c, deriveBackRelationFieldName as d, deriveRelationFieldName as f, toEnumMemberName as g, pluralize as h, InferredRelations as i, RelationField as l, mapDefault as m, DefaultMappingResult as n, PslTypeMap as o, inferRelations as p, EnumInfo as r, PslTypeReference as s, DefaultMappingOptions as t, buildChildRelationField as u, toFieldName as v, toModelName as y };
116
+ //# sourceMappingURL=psl-infer-tLt9U1UP.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"psl-infer-CCAD6FWA.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/psl-infer.d.mts"],"mappings":";;;;;UAGU;WACC,qBAAqB,SAAS;WAC9B,8BAA8B;;KAEpC;WACM;;WAEA;;iBAEM,WAAW,eAAe,eAAe,UAAU,wBAAwB;;;KAGvF;WACM;WACA;;iBAEM,YAAY,oBAAoB;iBAChC,YAAY,qBAAqB;iBACjC,WAAW,qBAAqB;;;;;;;iBAOhC,iBAAiB;iBACjB,UAAU;iBACV,wBAAwB,8BAA8B;iBACtD,4BAA4B,wBAAwB;;;KAGhE;WACM;WACA;;KAEN;WACM,SAAS;WACT;WACA,aAAa;;WAEb;WACA;;UAED;EACR,QAAQ,oBAAoB,cAAc,0BAA0B;;UAE5D;WACC,WAAW;WACX,aAAa;;UAEd;WACC,SAAS;WACT,iBAAiB;WACjB,WAAW;WACX,mBAAmB,oBAAoB,wBAAwB;;KAErE;WACM;WACA;;;;;;WAMA;;;;;;WAMA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;;;iBAIM,gBAAgB,oBAAoB,sBAAsB;;;KAGtE;WACM,kBAAkB,6BAA6B;;iBAEzC,eAAe,QAAQ,eAAe,aAAa,cAAc,8BAA8B;;;;;;;;;;;;;;;;;;;iBAmB/F,wBAAwB,mBAAmB,yBAAyB,IAAI,iBAAiB,mBAAmB,uBAAuB,YAAY,aAAa"}
1
+ {"version":3,"file":"psl-infer-tLt9U1UP.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/psl-infer.d.mts"],"mappings":";;;;;UAGU;WACC,qBAAqB,SAAS;WAC9B,8BAA8B;;KAEpC;WACM;;WAEA;;iBAEM,WAAW,eAAe,eAAe,UAAU,wBAAwB;;;KAGvF;WACM;WACA;;iBAEM,YAAY,oBAAoB;iBAChC,YAAY,qBAAqB;iBACjC,WAAW,qBAAqB;;;;;;;iBAOhC,iBAAiB;iBACjB,UAAU;iBACV,wBAAwB,8BAA8B;iBACtD,4BAA4B,wBAAwB;;;KAGhE;WACM;WACA;;KAEN;WACM,SAAS;WACT;WACA,aAAa;;WAEb;WACA;;UAED;EACR,QAAQ,oBAAoB,cAAc,0BAA0B;;UAE5D;WACC,WAAW;WACX,aAAa;;UAEd;WACC,SAAS;WACT,iBAAiB;WACjB,WAAW;WACX,mBAAmB,oBAAoB,wBAAwB;;KAErE;WACM;WACA;;;;;;WAMA;;;;;;WAMA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;WAEA;;;;KAIN;WACM,kBAAkB,6BAA6B;;iBAEzC,eAAe,QAAQ,eAAe,aAAa,cAAc,8BAA8B;;;;;;;;;;;;;;;;;;;iBAmB/F,wBAAwB,mBAAmB,yBAAyB,IAAI,iBAAiB,mBAAmB,uBAAuB,YAAY,aAAa"}
@@ -1,7 +1,7 @@
1
1
  import { c as SqlStorage } from "./sql-storage-8LqxeLAY-DH4DdUXx.mjs";
2
2
  import "./types-C36_3E6_.mjs";
3
- import { v as SqlSchemaIRNode } from "./types-YStFFkKs-D9UAmnON.mjs";
4
- import "./types-Dwcw0F8X.mjs";
3
+ import { v as SqlSchemaIRNode } from "./types-C6k9x_Je-DkvHNHEX.mjs";
4
+ import "./types-9RtQn3mX.mjs";
5
5
  import { Contract, ControlPolicy } from "@prisma/orm-framework/contract/types";
6
6
  import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
7
7
  import { SchemaDiffIssue } from "@prisma/orm-framework/components/control";
@@ -44,4 +44,4 @@ interface SqlSchemaDiffInput {
44
44
  type SqlSchemaDiffFn = (input: SqlSchemaDiffInput) => SqlSchemaDiffResult;
45
45
  //#endregion
46
46
  export { SqlSchemaDiffInput as n, SqlSchemaDiffResult as r, SqlSchemaDiffFn as t };
47
- //# sourceMappingURL=schema-differ-DpG_gnur-BICVtTHY.d.mts.map
47
+ //# sourceMappingURL=schema-differ-DpG_gnur-CLds_Z0t.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-differ-DpG_gnur-BICVtTHY.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/schema-differ-DpG_gnur.d.mts"],"mappings":";;;;;;;;;;;;;;;;;UAcU;;WAEC,iBAAiB;;;;;;;;;WASjB,uBAAuB,OAAO,oBAAoB;;;;;;WAMlD,gBAAgB;aACd,QAAQ;;;UAGX;WACC,UAAU,SAAS;WACnB,QAAQ;WACR,qBAAqB,cAAc;;KAEzC,mBAAmB,OAAO,uBAAuB"}
1
+ {"version":3,"file":"schema-differ-DpG_gnur-CLds_Z0t.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/schema-differ-DpG_gnur.d.mts"],"mappings":";;;;;;;;;;;;;;;;;UAcU;;WAEC,iBAAiB;;;;;;;;;WASjB,uBAAuB,OAAO,oBAAoB;;;;;;WAMlD,gBAAgB;aACd,QAAQ;;;UAGX;WACC,UAAU,SAAS;WACnB,QAAQ;WACR,qBAAqB,cAAc;;KAEzC,mBAAmB,OAAO,uBAAuB"}
@@ -1,2 +1,2 @@
1
- import { C as SqlUniqueIR, D as relationalNodeEntityKind, E as defineNonEnumerable, O as relationalNodeGranularity, S as SqlTypeMetadataRegistry, T as assertNode, _ as SqlSchemaIRInput, a as SqlCheckConstraintIR, b as SqlTableIRInput, c as SqlColumnDefaultIRInput, d as SqlForeignKeyIR, f as SqlForeignKeyIRInput, g as SqlSchemaIR, h as SqlReferentialAction, i as SqlAnnotations, l as SqlColumnIR, m as SqlIndexIRInput, n as PrimaryKeyInput, o as SqlCheckConstraintIRInput, p as SqlIndexIR, r as RelationalSchemaNodeKind, s as SqlColumnDefaultIR, t as PrimaryKey, u as SqlColumnIRInput, v as SqlSchemaIRNode, w as SqlUniqueIRInput, x as SqlTypeMetadata, y as SqlTableIR } from "./types-YStFFkKs-D9UAmnON.mjs";
1
+ import { C as SqlUniqueIR, D as relationalNodeEntityKind, E as defineNonEnumerable, O as relationalNodeGranularity, S as SqlTypeMetadataRegistry, T as assertNode, _ as SqlSchemaIRInput, a as SqlCheckConstraintIR, b as SqlTableIRInput, c as SqlColumnDefaultIRInput, d as SqlForeignKeyIR, f as SqlForeignKeyIRInput, g as SqlSchemaIR, h as SqlReferentialAction, i as SqlAnnotations, l as SqlColumnIR, m as SqlIndexIRInput, n as PrimaryKeyInput, o as SqlCheckConstraintIRInput, p as SqlIndexIR, r as RelationalSchemaNodeKind, s as SqlColumnDefaultIR, t as PrimaryKey, u as SqlColumnIRInput, v as SqlSchemaIRNode, w as SqlUniqueIRInput, x as SqlTypeMetadata, y as SqlTableIR } from "./types-C6k9x_Je-DkvHNHEX.mjs";
2
2
  export { PrimaryKey, type PrimaryKeyInput, RelationalSchemaNodeKind, type SqlAnnotations, SqlCheckConstraintIR, type SqlCheckConstraintIRInput, SqlColumnDefaultIR, type SqlColumnDefaultIRInput, SqlColumnIR, type SqlColumnIRInput, SqlForeignKeyIR, type SqlForeignKeyIRInput, SqlIndexIR, type SqlIndexIRInput, type SqlReferentialAction, SqlSchemaIR, type SqlSchemaIRInput, SqlSchemaIRNode, SqlTableIR, type SqlTableIRInput, type SqlTypeMetadata, type SqlTypeMetadataRegistry, SqlUniqueIR, type SqlUniqueIRInput, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
@@ -1,2 +1,2 @@
1
- import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as relationalNodeGranularity, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as relationalNodeEntityKind, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as defineNonEnumerable, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-BvupgHcG-c8QDupnu.mjs";
1
+ import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as relationalNodeGranularity, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as relationalNodeEntityKind, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as defineNonEnumerable, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-CZn-8Rsg-Bv6arhpI.mjs";
2
2
  export { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlColumnDefaultIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlSchemaIRNode, SqlTableIR, SqlUniqueIR, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
@@ -1,3 +1,3 @@
1
- import { C as SqlUniqueIR, D as relationalNodeEntityKind, E as defineNonEnumerable, O as relationalNodeGranularity, S as SqlTypeMetadataRegistry, T as assertNode, _ as SqlSchemaIRInput, a as SqlCheckConstraintIR, b as SqlTableIRInput, c as SqlColumnDefaultIRInput, d as SqlForeignKeyIR, f as SqlForeignKeyIRInput, g as SqlSchemaIR, h as SqlReferentialAction, i as SqlAnnotations, l as SqlColumnIR, m as SqlIndexIRInput, n as PrimaryKeyInput, o as SqlCheckConstraintIRInput, p as SqlIndexIR, r as RelationalSchemaNodeKind, s as SqlColumnDefaultIR, t as PrimaryKey, u as SqlColumnIRInput, v as SqlSchemaIRNode, w as SqlUniqueIRInput, x as SqlTypeMetadata, y as SqlTableIR } from "./types-YStFFkKs-D9UAmnON.mjs";
2
- import "./types-Dwcw0F8X.mjs";
1
+ import { C as SqlUniqueIR, D as relationalNodeEntityKind, E as defineNonEnumerable, O as relationalNodeGranularity, S as SqlTypeMetadataRegistry, T as assertNode, _ as SqlSchemaIRInput, a as SqlCheckConstraintIR, b as SqlTableIRInput, c as SqlColumnDefaultIRInput, d as SqlForeignKeyIR, f as SqlForeignKeyIRInput, g as SqlSchemaIR, h as SqlReferentialAction, i as SqlAnnotations, l as SqlColumnIR, m as SqlIndexIRInput, n as PrimaryKeyInput, o as SqlCheckConstraintIRInput, p as SqlIndexIR, r as RelationalSchemaNodeKind, s as SqlColumnDefaultIR, t as PrimaryKey, u as SqlColumnIRInput, v as SqlSchemaIRNode, w as SqlUniqueIRInput, x as SqlTypeMetadata, y as SqlTableIR } from "./types-C6k9x_Je-DkvHNHEX.mjs";
2
+ import "./types-9RtQn3mX.mjs";
3
3
  export { PrimaryKey, type PrimaryKeyInput, RelationalSchemaNodeKind, type SqlAnnotations, SqlCheckConstraintIR, type SqlCheckConstraintIRInput, SqlColumnDefaultIR, type SqlColumnDefaultIRInput, SqlColumnIR, type SqlColumnIRInput, SqlForeignKeyIR, type SqlForeignKeyIRInput, SqlIndexIR, type SqlIndexIRInput, type SqlReferentialAction, SqlSchemaIR, type SqlSchemaIRInput, SqlSchemaIRNode, SqlTableIR, type SqlTableIRInput, type SqlTypeMetadata, type SqlTypeMetadataRegistry, SqlUniqueIR, type SqlUniqueIRInput, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
@@ -1,2 +1,2 @@
1
- import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as relationalNodeGranularity, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as relationalNodeEntityKind, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as defineNonEnumerable, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-BvupgHcG-c8QDupnu.mjs";
1
+ import { a as SqlColumnIR, c as SqlSchemaIR, d as SqlUniqueIR, f as assertNode, h as relationalNodeGranularity, i as SqlColumnDefaultIR, l as SqlSchemaIRNode, m as relationalNodeEntityKind, n as RelationalSchemaNodeKind, o as SqlForeignKeyIR, p as defineNonEnumerable, r as SqlCheckConstraintIR, s as SqlIndexIR, t as PrimaryKey, u as SqlTableIR } from "./types-CZn-8Rsg-Bv6arhpI.mjs";
2
2
  export { PrimaryKey, RelationalSchemaNodeKind, SqlCheckConstraintIR, SqlColumnDefaultIR, SqlColumnIR, SqlForeignKeyIR, SqlIndexIR, SqlSchemaIR, SqlSchemaIRNode, SqlTableIR, SqlUniqueIR, assertNode, defineNonEnumerable, relationalNodeEntityKind, relationalNodeGranularity };
@@ -1,7 +1,7 @@
1
1
  import { blindCast } from "@prisma/orm-framework/utils/casts";
2
- import { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, num, oneOf, optional, record, referencedFieldRef, str } from "@prisma/orm-framework/psl-parser";
2
+ import { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, numLiteral, oneOf, optional, record, referencedFieldRef, str } from "@prisma/orm-framework/psl-parser";
3
3
  import { notOk } from "@prisma/orm-framework/utils/result";
4
- //#region ../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-BCJ_CDJH.mjs
4
+ //#region ../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-BnUIuOy5.mjs
5
5
  function findModelAttributeNode(model, name) {
6
6
  for (const attribute of model.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;
7
7
  }
@@ -68,11 +68,11 @@ const mapFieldSpec = fieldAttribute("map", {
68
68
  refine: validateMappedName
69
69
  });
70
70
  function scalarDefaultArms(isList, registry) {
71
- const literal = () => oneOf(str(), num(), bool());
71
+ const literal = () => oneOf(str(), numLiteral(), bool());
72
72
  const funcArms = [...registry.entries()].map(([name, entry]) => funcCall(name, blindCast(entry.signature)));
73
73
  return isList ? [list(literal()), ...funcArms] : [
74
74
  str(),
75
- num(),
75
+ numLiteral(),
76
76
  bool(),
77
77
  ...funcArms
78
78
  ];
@@ -281,4 +281,4 @@ const sqlAttributeSpecs = {
281
281
  //#endregion
282
282
  export { interpretFieldAttribute as a, findModelAttributeNode as i, fieldSpecContext as n, interpretModelAttribute as o, findFieldAttributeNode as r, sqlAttributeSpecs as s, PSL_CHECK_ON_STI_VARIANT as t };
283
283
 
284
- //# sourceMappingURL=sql-attribute-specs-BCJ_CDJH-CfH1ddqf.mjs.map
284
+ //# sourceMappingURL=sql-attribute-specs-BnUIuOy5-8t7OYHpi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-attribute-specs-BnUIuOy5-8t7OYHpi.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/sql-attribute-specs-BnUIuOy5.mjs"],"sourcesContent":["import { bool, entityRef, fieldAttribute, fieldRef, funcCall, identifier, interpretAttribute, leafDiagnostic, list, modelAttribute, nodePslSpan, numLiteral, oneOf, optional, record, referencedFieldRef, str } from \"@internal/psl-parser\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { notOk } from \"@internal/utils/result\";\n//#region src/sql-attribute-specs.ts\nfunction findModelAttributeNode(model, name) {\n\tfor (const attribute of model.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction findFieldAttributeNode(field, name) {\n\tfor (const attribute of field.node.attributes()) if (attribute.name()?.isSimpleName(name) === true) return attribute;\n}\nfunction buildModelAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel\n\t};\n}\nfunction buildFieldAttributeCtx(input) {\n\treturn {\n\t\tsourceId: input.sourceId,\n\t\tsourceFile: input.sourceFile,\n\t\tselfModel: input.selfModel,\n\t\tresolveReferencedModel: input.resolveReferencedModel ?? (() => void 0),\n\t\tfield: input.field\n\t};\n}\nfunction interpretModelAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildModelAttributeCtx({\n\t\tselfModel: input.model,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction interpretFieldAttribute(input) {\n\tconst result = interpretAttribute(input.node, input.spec, buildFieldAttributeCtx({\n\t\tselfModel: input.model,\n\t\tfield: input.field,\n\t\tsourceFile: input.sourceFile,\n\t\tsourceId: input.sourceId,\n\t\tresolveReferencedModel: input.resolveReferencedModel\n\t}));\n\tif (!result.ok) {\n\t\tfor (const failure of result.failure) input.diagnostics.push(failure);\n\t\treturn;\n\t}\n\treturn result.value;\n}\nfunction validateMappedName(value, ctx, attributeNode) {\n\treturn value.name === \"\" ? [leafDiagnostic(ctx, attributeNode, \"Mapped name must not be empty\")] : [];\n}\nconst mapModelSpec = modelAttribute(\"map\", {\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str()\n\t}],\n\trefine: validateMappedName\n});\nconst mapFieldSpec = fieldAttribute(\"map\", {\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: str()\n\t}],\n\trefine: validateMappedName\n});\nfunction scalarDefaultArms(isList, registry) {\n\tconst literal = () => oneOf(str(), numLiteral(), bool());\n\tconst funcArms = [...registry.entries()].map(([name, entry]) => funcCall(name, blindCast(entry.signature)));\n\treturn isList ? [list(literal()), ...funcArms] : [\n\t\tstr(),\n\t\tnumLiteral(),\n\t\tbool(),\n\t\t...funcArms\n\t];\n}\nfunction noEnumMember() {\n\treturn {\n\t\tkind: \"rejecting\",\n\t\tlabel: \"enum member\",\n\t\tmessage: \"Enum declares no members\",\n\t\tparse: (arg, ctx) => notOk([leafDiagnostic(ctx, arg, \"Enum declares no members\")])\n\t};\n}\nfunction enumMemberNames(ctx) {\n\tconst block = (ctx.field.typeNamespaceId === void 0 ? ctx.symbols.topLevel : ctx.symbols.topLevel.namespaces[ctx.field.typeNamespaceId])?.blocks[ctx.field.typeName];\n\tif (block === void 0 || block.keyword !== \"enum\") return void 0;\n\treturn Object.keys(block.block.parameters);\n}\nfunction enumDefaultArms(members) {\n\tconst [first, ...rest] = members;\n\tif (first === void 0) return [noEnumMember()];\n\treturn [identifier(first), ...rest.map((name) => identifier(name))];\n}\nfunction defaultFieldSpec(ctx) {\n\tconst members = enumMemberNames(ctx);\n\treturn fieldAttribute(\"default\", { positional: [{\n\t\tkey: \"value\",\n\t\ttype: oneOf(...members === void 0 ? scalarDefaultArms(ctx.field.list, ctx.controlMutationDefaults) : enumDefaultArms(members))\n\t}] });\n}\nconst idFieldSpec = fieldAttribute(\"id\", { named: { map: optional(str()) } });\nconst uniqueFieldSpec = fieldAttribute(\"unique\", { named: { map: optional(str()) } });\nconst noCheckKindArgument = () => oneOf(identifier(\"membership\"), identifier(\"elementNotNull\"));\n/**\n* `@noCheck` waives generated CHECK constraints on one column: bare for every\n* kind the column's shape derives, or naming concrete kinds. Two optional\n* positional slots cover the whole kind vocabulary; a third argument is\n* necessarily a duplicate and fails as excess arity.\n*/\nconst noCheckFieldSpec = fieldAttribute(\"noCheck\", {\n\tpositional: [{\n\t\tkey: \"first\",\n\t\ttype: optional(noCheckKindArgument())\n\t}, {\n\t\tkey: \"second\",\n\t\ttype: optional(noCheckKindArgument())\n\t}],\n\trefine: (value, ctx, attributeNode) => {\n\t\tif (value.first !== void 0 && value.first === value.second) return [leafDiagnostic(ctx, attributeNode, \"`@noCheck` names the same kind twice\")];\n\t\treturn [];\n\t}\n});\nconst idModelSpec = modelAttribute(\"id\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})\n\t}],\n\tnamed: { map: optional(str()) }\n});\nconst uniqueModelSpec = modelAttribute(\"unique\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})\n\t}],\n\tnamed: { map: optional(str()) }\n});\nconst PSL_INDEX_FIELDS_XOR_EXPRESSION = \"PSL_INDEX_FIELDS_XOR_EXPRESSION\";\nconst PSL_INDEX_EXPRESSION_REQUIRES_NAME = \"PSL_INDEX_EXPRESSION_REQUIRES_NAME\";\nconst PSL_INDEX_NAME_XOR_MAP = \"PSL_INDEX_NAME_XOR_MAP\";\nconst indexModelSpec = modelAttribute(\"index\", {\n\tpositional: [{\n\t\tkey: \"fields\",\n\t\ttype: optional(list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t}))\n\t}],\n\tnamed: {\n\t\texpression: optional(str()),\n\t\twhere: optional(str()),\n\t\tunique: optional(bool()),\n\t\tname: optional(str()),\n\t\tmap: optional(str()),\n\t\ttype: optional(str()),\n\t\toptions: optional(record(str()))\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.fields === void 0 === (value.expression === void 0)) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` requires exactly one of a fields list or an `expression` argument\", PSL_INDEX_FIELDS_XOR_EXPRESSION));\n\t\tif (value.expression !== void 0 && value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` with an `expression` argument requires a `name` or `map` argument (a default name cannot be derived from an expression)\", PSL_INDEX_EXPRESSION_REQUIRES_NAME));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` takes at most one of `name` and `map`\", PSL_INDEX_NAME_XOR_MAP));\n\t\tif (value.options !== void 0 && value.type === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@index` options argument requires a type argument\"));\n\t\treturn diagnostics;\n\t}\n});\nconst PSL_CHECK_REQUIRES_NAME_OR_MAP = \"PSL_CHECK_REQUIRES_NAME_OR_MAP\";\nconst PSL_CHECK_NAME_XOR_MAP = \"PSL_CHECK_NAME_XOR_MAP\";\nconst PSL_CHECK_EXPRESSION_EMPTY = \"PSL_CHECK_EXPRESSION_EMPTY\";\n/**\n* A single-table-inheritance variant (`@@base` with no own `@@map`) shares\n* its base model's storage table and has no table of its own to declare a\n* check on — raised from {@link interpretPslDocumentToSqlContract}, not from\n* this spec's own `refine`, because the rule needs the model's `@@base`\n* declaration, which a single attribute's `refine` cannot see.\n*/\nconst PSL_CHECK_ON_STI_VARIANT = \"PSL_CHECK_ON_STI_VARIANT\";\nconst checkModelSpec = modelAttribute(\"check\", {\n\tnamed: {\n\t\texpression: str(),\n\t\tname: optional(str()),\n\t\tmap: optional(str())\n\t},\n\trefine: (value, ctx, attributeNode) => {\n\t\tconst diagnostics = [];\n\t\tif (value.expression.trim().length === 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` expression must not be empty — an empty predicate is not a constraint\", PSL_CHECK_EXPRESSION_EMPTY));\n\t\tif (value.name === void 0 && value.map === void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` requires a `name` or `map` argument (a default name cannot be derived — a check has no column tuple to name itself after)\", PSL_CHECK_REQUIRES_NAME_OR_MAP));\n\t\tif (value.name !== void 0 && value.map !== void 0) diagnostics.push(leafDiagnostic(ctx, attributeNode, \"`@@check` takes at most one of `name` and `map`\", PSL_CHECK_NAME_XOR_MAP));\n\t\treturn diagnostics;\n\t}\n});\nconst controlModelSpec = modelAttribute(\"control\", { positional: [{\n\tkey: \"policy\",\n\ttype: oneOf(identifier(\"managed\"), identifier(\"tolerated\"), identifier(\"external\"), identifier(\"observed\"))\n}] });\nconst discriminatorModelSpec = modelAttribute(\"discriminator\", { positional: [{\n\tkey: \"field\",\n\ttype: fieldRef()\n}] });\nconst baseModelSpec = modelAttribute(\"base\", { positional: [{\n\tkey: \"base\",\n\ttype: entityRef()\n}, {\n\tkey: \"value\",\n\ttype: str()\n}] });\nfunction relationAttributeSpan(ctx) {\n\tconst node = findFieldAttributeNode(ctx.field, \"relation\");\n\tif (node !== void 0) return nodePslSpan(node.syntax, ctx.sourceFile);\n\treturn ctx.field.span;\n}\nfunction relationInvariants(parsed, ctx) {\n\tif (parsed.fields !== void 0 !== (parsed.references !== void 0)) return [{\n\t\tcode: \"PSL_INVALID_ATTRIBUTE_SYNTAX\",\n\t\tmessage: `Relation field \"${ctx.selfModel.name}.${ctx.field.name}\" requires fields and references arguments`,\n\t\tsourceId: ctx.sourceId,\n\t\tspan: relationAttributeSpan(ctx)\n\t}];\n\treturn [];\n}\nconst referentialActionArgument = () => oneOf(identifier(\"NoAction\"), identifier(\"Restrict\"), identifier(\"Cascade\"), identifier(\"SetNull\"), identifier(\"SetDefault\"));\nconst relationFieldSpec = fieldAttribute(\"relation\", {\n\tpositional: [{\n\t\tkey: \"name\",\n\t\ttype: optional(str())\n\t}],\n\tnamed: {\n\t\tname: optional(str()),\n\t\tfields: optional(list(fieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})),\n\t\treferences: optional(list(referencedFieldRef(), {\n\t\t\tallowEmpty: false,\n\t\t\tunique: true\n\t\t})),\n\t\tmap: optional(str()),\n\t\tonDelete: optional(referentialActionArgument()),\n\t\tonUpdate: optional(referentialActionArgument()),\n\t\tindex: optional(bool())\n\t},\n\trefine: relationInvariants\n});\nfunction fieldSpecContext(input) {\n\treturn {\n\t\tsymbols: input.symbols,\n\t\tmodel: input.model,\n\t\tfield: input.field,\n\t\tcontrolMutationDefaults: input.controlMutationDefaults\n\t};\n}\nconst sqlAttributeSpecs = {\n\tmodel: {\n\t\tmap: () => mapModelSpec,\n\t\tid: () => idModelSpec,\n\t\tunique: () => uniqueModelSpec,\n\t\tindex: () => indexModelSpec,\n\t\tcheck: () => checkModelSpec,\n\t\tcontrol: () => controlModelSpec,\n\t\tdiscriminator: () => discriminatorModelSpec,\n\t\tbase: () => baseModelSpec\n\t},\n\tfield: {\n\t\tmap: () => mapFieldSpec,\n\t\tid: () => idFieldSpec,\n\t\tunique: () => uniqueFieldSpec,\n\t\tnoCheck: () => noCheckFieldSpec,\n\t\trelation: () => relationFieldSpec,\n\t\tdefault: defaultFieldSpec\n\t}\n};\n//#endregion\nexport { interpretFieldAttribute as a, findModelAttributeNode as i, fieldSpecContext as n, interpretModelAttribute as o, findFieldAttributeNode as r, sqlAttributeSpecs as s, PSL_CHECK_ON_STI_VARIANT as t };\n\n//# sourceMappingURL=sql-attribute-specs-BnUIuOy5.mjs.map"],"mappings":";;;;AAIA,SAAS,uBAAuB,OAAO,MAAM;CAC5C,KAAK,MAAM,aAAa,MAAM,KAAK,WAAW,GAAG,IAAI,UAAU,KAAK,CAAC,EAAE,aAAa,IAAI,MAAM,MAAM,OAAO;AAC5G;AACA,SAAS,uBAAuB,OAAO,MAAM;CAC5C,KAAK,MAAM,aAAa,MAAM,KAAK,WAAW,GAAG,IAAI,UAAU,KAAK,CAAC,EAAE,aAAa,IAAI,MAAM,MAAM,OAAO;AAC5G;AACA,SAAS,uBAAuB,OAAO;CACtC,OAAO;EACN,UAAU,MAAM;EAChB,YAAY,MAAM;EAClB,WAAW,MAAM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C;EACF,YAAY,SAAS,KAAK,mBAAmB,GAAG;GAC/C,YAAY;GACZ,QAAQ;EACT,CAAC,CAAC;EACF,KAAK,SAAS,IAAI,CAAC;EACnB,UAAU,SAAS,0BAA0B,CAAC;EAC9C,UAAU,SAAS,0BAA0B,CAAC;EAC9C,OAAO,SAAS,KAAK,CAAC;CACvB;CACA,QAAQ;AACT,CAAC;AACD,SAAS,iBAAiB,OAAO;CAChC,OAAO;EACN,SAAS,MAAM;EACf,OAAO,MAAM;EACb,OAAO,MAAM;EACb,yBAAyB,MAAM;CAChC;AACD;AACA,MAAM,oBAAoB;CACzB,OAAO;EACN,WAAW;EACX,UAAU;EACV,cAAc;EACd,aAAa;EACb,aAAa;EACb,eAAe;EACf,qBAAqB;EACrB,YAAY;CACb;CACA,OAAO;EACN,WAAW;EACX,UAAU;EACV,cAAc;EACd,eAAe;EACf,gBAAgB;EAChB,SAAS;CACV;AACD"}
@@ -0,0 +1 @@
1
+ import "./types-C6k9x_Je-DkvHNHEX.mjs";
@@ -3,7 +3,7 @@ import { IRNodeBase } from "@prisma/orm-framework/components/ir";
3
3
  import { ColumnDefault } from "@prisma/orm-framework/contract/types";
4
4
  import { CodecRef } from "@prisma/orm-framework/components/codec";
5
5
  import { DiffSubjectGranularity, DiffableNode, SchemaNodeRef } from "@prisma/orm-framework/components/control";
6
- //#region ../../../2-sql/1-core/schema-ir/dist/types-YStFFkKs.d.mts
6
+ //#region ../../../2-sql/1-core/schema-ir/dist/types-C6k9x_Je.d.mts
7
7
  //#region src/ir/sql-schema-ir-node.d.ts
8
8
  /**
9
9
  * SQL Schema IR node base. Carries the family-level
@@ -193,6 +193,16 @@ interface SqlColumnDefaultIRInput {
193
193
  * {@link import('./sql-column-ir').SqlColumnIRInput.many}.
194
194
  */
195
195
  readonly many?: boolean;
196
+ /**
197
+ * The owning column's codec identity, threaded through so the set-default op-builder renders a
198
+ * list default's cast to the column type the way the column's DDL writes it. See
199
+ * {@link import('./sql-column-ir').SqlColumnIRInput.codecRef}.
200
+ */
201
+ readonly codecRef?: CodecRef;
202
+ /** See {@link import('./sql-column-ir').SqlColumnIRInput.codecBaseNativeType}. */
203
+ readonly codecBaseNativeType?: string;
204
+ /** See {@link import('./sql-column-ir').SqlColumnIRInput.codecNamedType}. */
205
+ readonly codecNamedType?: boolean;
196
206
  }
197
207
  /**
198
208
  * Schema-diff node for a column's default value. The default is the one
@@ -214,6 +224,12 @@ declare class SqlColumnDefaultIR extends SqlSchemaIRNode implements DiffableNode
214
224
  readonly nativeTypeContext?: string;
215
225
  /** See {@link SqlColumnDefaultIRInput.many}. Non-enumerable so it stays out of JSON and structural equality. */
216
226
  readonly many?: boolean;
227
+ /** See {@link SqlColumnDefaultIRInput.codecRef}. Non-enumerable, same reason as {@link many}. */
228
+ readonly codecRef?: CodecRef;
229
+ /** See {@link SqlColumnDefaultIRInput.codecBaseNativeType}. Non-enumerable, same reason as {@link many}. */
230
+ readonly codecBaseNativeType?: string;
231
+ /** See {@link SqlColumnDefaultIRInput.codecNamedType}. Non-enumerable, same reason as {@link many}. */
232
+ readonly codecNamedType?: boolean;
217
233
  constructor(input: SqlColumnDefaultIRInput);
218
234
  get id(): string;
219
235
  children(): readonly DiffableNode[];
@@ -691,4 +707,4 @@ interface SqlTypeMetadataRegistry {
691
707
  }
692
708
  //#endregion
693
709
  export { SqlUniqueIR as C, relationalNodeEntityKind as D, defineNonEnumerable as E, relationalNodeGranularity as O, SqlTypeMetadataRegistry as S, assertNode as T, SqlSchemaIRInput as _, SqlCheckConstraintIR as a, SqlTableIRInput as b, SqlColumnDefaultIRInput as c, SqlForeignKeyIR as d, SqlForeignKeyIRInput as f, SqlSchemaIR as g, SqlReferentialAction as h, SqlAnnotations as i, SqlColumnIR as l, SqlIndexIRInput as m, PrimaryKeyInput as n, SqlCheckConstraintIRInput as o, SqlIndexIR as p, RelationalSchemaNodeKind as r, SqlColumnDefaultIR as s, PrimaryKey as t, SqlColumnIRInput as u, SqlSchemaIRNode as v, SqlUniqueIRInput as w, SqlTypeMetadata as x, SqlTableIR as y };
694
- //# sourceMappingURL=types-YStFFkKs-D9UAmnON.d.mts.map
710
+ //# sourceMappingURL=types-C6k9x_Je-DkvHNHEX.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-C6k9x_Je-DkvHNHEX.d.mts","names":[],"sources":["../../../../2-sql/1-core/schema-ir/dist/types-C6k9x_Je.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA2BuB,wBAAwB;WACpC;;;;;;;;;oBASS;EAClB;;;;;;;;iBAQe,WAAW,UAAU,iBAAiB,MAAM,6BAA6B,mBAAmB,YAAY,MAAM,oBAAoB,QAAQ,YAAY,QAAQ;;;;;;;;;;iBAU9J,oBAAoB,kBAAkB,QAAQ,GAAG,aAAa;;;UAGrE;WACC;WACA;;;;;;WAMA,qBAAqB;;;;;;;;;;;;;;;cAelB,mBAAmB,2BAA2B;WACjD;WACA;WACA;;WAEA,qBAAqB;EAC9B,YAAY,OAAO;MACf;EACJ,qBAAqB;SACd,KAAK,OAAO,aAAa,kBAAkB;SAC3C,GAAG,MAAM,kBAAkB,QAAQ;EAC1C,UAAU,OAAO;;;;;;;;;;;cAWL;WACH;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;KAEN,mCAAmC,uCAAuC;;;;;;;iBAO9D,0BAA0B,mBAAmB;;;;;;;;iBAQ7C,yBAAyB;;;UAGhC;;WAEC,QAAQ;;WAER;;;;;;;;;WASA,oBAAoB;;;;;;;;;;;;;;;cAejB,6BAA6B,2BAA2B;WAC3D;WACA;WACA;WACA;;WAEA,qBAAqB;EAC9B,YAAY,OAAO;MACf;EACJ,qBAAqB;SACd,KAAK,OAAO,uBAAuB,4BAA4B;SAC/D,GAAG,MAAM,kBAAkB,QAAQ;EAC1C,UAAU,OAAO;;;;UAIT;;WAEC,WAAW;;WAEX;;;;;WAKA;;;;;;;WAOA;;;;;;WAMA,WAAW;;WAEX;;WAEA;;;;;;;;;;;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AO;MACf;EACJ,qBAAqB;SACd,KAAK,OAAO,aAAa,kBAAkB;SAC3C,GAAG,MAAM,kBAAkB,QAAQ;;;;;;;;EAQ1C,UAAU,OAAO;;;;;;;;;;;;;;;;;;;;;;EAsBjB,cAAc,OAAO,YAAY;aACtB;aACA;;;;;UAKH;WACC;WACA;WACA,cAAc;;;;;;WAMd,qBAAqB;;;;;;;;;;;;;cAalB,oBAAoB,2BAA2B;WAClD;WACA;WACA;WACA,cAAc;;WAEd,qBAAqB;EAC9B,YAAY,OAAO;MACf;EACJ,qBAAqB;SACd,GAAG,MAAM,kBAAkB,QAAQ;EAC1C,UAAU,OAAO;;;;UAIT;WACC;WACA,SAAS,eAAe,cAAc;WACtC,aAAa,cAAc,kBAAkB;WAC7C,SAAS,cAAc,cAAc;WACrC,SAAS,cAAc,aAAa;WACpC,aAAa,aAAa;WAC1B,cAAc;;WAEd,SAAS,cAAc,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;cAuB3C,mBAAmB,2BAA2B;WACjD;WACA;WACA,SAAS,SAAS,eAAe;WACjC,aAAa,cAAc;WAC3B,SAAS,cAAc;WACvB,SAAS,cAAc;WACvB,aAAa;WACb,cAAc;WACd,SAAS,cAAc;EAChC,YAAY,OAAO;MACf;EACJ,UAAU,OAAO;EACjB,qBAAqB;;;;UAIb;WACC,QAAQ,eAAe,aAAa;WACpC,cAAc;;;;;;;;;;;;;;;;;cAiBX,oBAAoB,2BAA2B;WAClD;WACA,QAAQ,SAAS,eAAe;WAChC,cAAc;EACvB,YAAY,OAAO;MACf;EACJ,UAAU,OAAO;EACjB,qBAAqB;;;;;;;;;UASb;;WAEC;;WAEA;;;;;WAKA;;;;;;UAMD;EACR,UAAU,iBAAiB"}
@@ -5,7 +5,7 @@ import { ifDefined } from "@prisma/orm-framework/utils/defined";
5
5
  import { blindCast } from "@prisma/orm-framework/utils/casts";
6
6
  import { canonicalStringify } from "@prisma/orm-framework/utils/canonical-stringify";
7
7
  import { isArrayEqual } from "@prisma/orm-framework/utils/array-equal";
8
- //#region ../../../2-sql/1-core/schema-ir/dist/types-BvupgHcG.mjs
8
+ //#region ../../../2-sql/1-core/schema-ir/dist/types-CZn-8Rsg.mjs
9
9
  /**
10
10
  * The `nodeKind` discriminant for each relational schema-diff leaf node.
11
11
  * Each node carries a unique value; the differ pairs siblings by `id`, and
@@ -221,16 +221,18 @@ var SqlCheckConstraintIR = class SqlCheckConstraintIR extends SqlSchemaIRNode {
221
221
  }
222
222
  };
223
223
  /**
224
- * Structural equality for two resolved column defaults, ported from the
225
- * relational walk's `columnDefaultsEqual` normalized branch: kinds must
226
- * match; literal values are normalized (Date and temporal-typed strings to
227
- * ISO instants, and a 64-bit-integer native type's safe-integer number to
228
- * its decimal-text spelling) then compared canonically (JSON objects match
229
- * their canonical string form); function expressions compare case- and
230
- * whitespace-insensitively.
224
+ * Structural equality for two resolved column defaults, ported from the relational walk's
225
+ * `columnDefaultsEqual` normalized branch: kinds must match; literal values are normalized (Date
226
+ * and temporal-typed strings to ISO instants, with a timestamp that has no zone read as UTC; a
227
+ * 64-bit-integer native type's safe-integer number to its decimal-text spelling; a numeric native
228
+ * type's number to its decimal text, and when the type has a modifier, its decimal text to its
229
+ * digits without zeros that do not change the value; a list element by element under its element
230
+ * type) then compared canonically (JSON objects match their canonical string form); function
231
+ * expressions compare case- and whitespace-insensitively.
231
232
  *
232
- * `nativeType` provides the temporal- and int64-normalization context (the
233
- * actual side's resolved native type in a diff comparison).
233
+ * `nativeType` provides the normalization context (the actual side's resolved native type in a diff
234
+ * comparison). A target that reads a raw expression as a literal does so before this comparison,
235
+ * through its `resolveDefault` hook.
234
236
  */
235
237
  function resolvedDefaultsEqual(expected, actual, nativeType) {
236
238
  if (expected.kind !== actual.kind) return false;
@@ -251,13 +253,65 @@ function isInt64NativeType(nativeType) {
251
253
  const normalized = nativeType.toLowerCase();
252
254
  return normalized === "int8" || normalized === "bigint";
253
255
  }
256
+ /**
257
+ * A numeric type with a modifier (`numeric(10,2)`) stores every value at its scale, so zeros that
258
+ * do not change the value do not count. Without one, the value keeps the scale it was written with.
259
+ */
260
+ const DECIMAL_NATIVE_TYPE = /^(?:numeric|decimal)(\(\d+(?:,\s*\d+)?\))?$/i;
261
+ const DECIMAL_NUMERAL = /^(-?)(\d+)(?:\.(\d+))?$/;
262
+ const EXPONENT_NUMERAL = /^(-?)(\d+)(?:\.(\d+))?[eE]([+-]?\d+)$/;
263
+ /**
264
+ * The plain decimal spelling of a value, so that a number JavaScript prints as `1e-7` or `1e+21`
265
+ * can be compared with the decimal text a numeric column stores. No digit is added or dropped;
266
+ * only the decimal point moves.
267
+ */
268
+ function decimalText(value) {
269
+ const text = String(value);
270
+ const numeral = EXPONENT_NUMERAL.exec(text);
271
+ if (numeral === null) return text;
272
+ const [, sign = "", whole = "", fraction = "", exponent = "0"] = numeral;
273
+ const digits = `${whole}${fraction}`;
274
+ const point = whole.length + Number(exponent);
275
+ if (point <= 0) return `${sign}0.${"0".repeat(-point)}${digits}`;
276
+ if (point >= digits.length) return `${sign}${digits}${"0".repeat(point - digits.length)}`;
277
+ return `${sign}${digits.slice(0, point)}.${digits.slice(point)}`;
278
+ }
279
+ function decimalDigits(value) {
280
+ const numeral = DECIMAL_NUMERAL.exec(decimalText(value));
281
+ if (numeral === null) return value;
282
+ const whole = (numeral[2] ?? "").replace(/^0+(?=\d)/, "");
283
+ const fraction = (numeral[3] ?? "").replace(/0+$/, "");
284
+ const digits = fraction === "" ? whole : `${whole}.${fraction}`;
285
+ return digits === "0" ? digits : `${numeral[1] ?? ""}${digits}`;
286
+ }
287
+ /**
288
+ * A timestamp as Postgres prints it, with or without an offset: `2024-01-01 00:00:00`,
289
+ * `0001-01-01 00:00:00+00`, `2024-01-02 03:04:05+05:30`. It is rebuilt as an ISO string before
290
+ * `Date` reads it, because `Date` reads this spelling without a zone as host-local time and reads a
291
+ * year below 100 as 19xx or 20xx. A value without a zone is a wall-clock time, and the contract
292
+ * spells the same wall time as an ISO instant, so it is read as UTC.
293
+ */
294
+ const POSTGRES_TIMESTAMP = /^(\d{4}-\d{2}-\d{2})[ T](\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?)(?:([+-]\d{2})(?::?(\d{2}))?)?$/;
295
+ function parseTemporal(value) {
296
+ const timestamp = POSTGRES_TIMESTAMP.exec(value);
297
+ if (timestamp === null) return new Date(value);
298
+ const [, date, time, offsetHours, offsetMinutes = "00"] = timestamp;
299
+ const zone = offsetHours === void 0 ? "Z" : `${offsetHours}:${offsetMinutes}`;
300
+ return /* @__PURE__ */ new Date(`${date}T${time}${zone}`);
301
+ }
254
302
  function normalizeLiteralValue(value, nativeType) {
303
+ if (Array.isArray(value) && nativeType?.endsWith("[]")) {
304
+ const elementType = nativeType.slice(0, -2);
305
+ return value.map((element) => normalizeLiteralValue(element, elementType));
306
+ }
255
307
  if (value instanceof Date) return value.toISOString();
256
308
  if (typeof value === "string" && isTemporalNativeType(nativeType)) {
257
- const parsed = new Date(value);
309
+ const parsed = parseTemporal(value);
258
310
  if (!Number.isNaN(parsed.getTime())) return parsed.toISOString();
259
311
  }
260
312
  if (typeof value === "number" && Number.isSafeInteger(value) && isInt64NativeType(nativeType)) return String(value);
313
+ const decimalType = nativeType === void 0 ? null : DECIMAL_NATIVE_TYPE.exec(nativeType);
314
+ if ((typeof value === "number" || typeof value === "string") && decimalType !== null) return decimalType[1] === void 0 ? decimalText(value) : decimalDigits(value);
261
315
  return value;
262
316
  }
263
317
  function literalValuesEqual(a, b) {
@@ -296,6 +350,9 @@ var SqlColumnDefaultIR = class SqlColumnDefaultIR extends SqlSchemaIRNode {
296
350
  if (input.raw !== void 0) this.raw = input.raw;
297
351
  if (input.nativeTypeContext !== void 0) this.nativeTypeContext = input.nativeTypeContext;
298
352
  defineNonEnumerable(this, "many", input.many);
353
+ defineNonEnumerable(this, "codecRef", input.codecRef);
354
+ defineNonEnumerable(this, "codecBaseNativeType", input.codecBaseNativeType);
355
+ defineNonEnumerable(this, "codecNamedType", input.codecNamedType);
299
356
  freezeNode(this);
300
357
  }
301
358
  get id() {
@@ -373,7 +430,10 @@ var SqlColumnIR = class SqlColumnIR extends SqlSchemaIRNode {
373
430
  ...ifDefined("resolved", this.resolvedDefault),
374
431
  ...ifDefined("raw", this.default),
375
432
  ...ifDefined("nativeTypeContext", this.resolvedNativeType),
376
- ...ifDefined("many", this.many ?? this.codecRef?.many)
433
+ ...ifDefined("many", this.many ?? this.codecRef?.many),
434
+ ...ifDefined("codecRef", this.codecRef),
435
+ ...ifDefined("codecBaseNativeType", this.codecBaseNativeType),
436
+ ...ifDefined("codecNamedType", this.codecNamedType)
377
437
  })];
378
438
  }
379
439
  static is(node) {
@@ -724,4 +784,4 @@ var SqlSchemaIR = class extends SqlSchemaIRNode {
724
784
  //#endregion
725
785
  export { SqlColumnIR as a, SqlSchemaIR as c, SqlUniqueIR as d, assertNode as f, relationalNodeGranularity as h, SqlColumnDefaultIR as i, SqlSchemaIRNode as l, relationalNodeEntityKind as m, RelationalSchemaNodeKind as n, SqlForeignKeyIR as o, defineNonEnumerable as p, SqlCheckConstraintIR as r, SqlIndexIR as s, PrimaryKey as t, SqlTableIR as u };
726
786
 
727
- //# sourceMappingURL=types-BvupgHcG-c8QDupnu.mjs.map
787
+ //# sourceMappingURL=types-CZn-8Rsg-Bv6arhpI.mjs.map