@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
@@ -1,2 +1,2 @@
1
- import { _ as toEnumMemberName, a as PslPrinterOptions, b as toModelName, c as PslTypeResolution, d as deriveBackRelationFieldName, f as deriveRelationFieldName, g as pluralize, h as parseRawDefault, i as InferredRelations, l as RelationField, m as mapDefault, n as DefaultMappingResult, o as PslTypeMap, p as inferRelations, r as EnumInfo, s as PslTypeReference, t as DefaultMappingOptions, u as buildChildRelationField, v as toEnumName, y as toFieldName } from "./psl-infer-CCAD6FWA.mjs";
2
- export { type DefaultMappingOptions, type DefaultMappingResult, type EnumInfo, type InferredRelations, type PslPrinterOptions, type PslTypeMap, type PslTypeReference, type PslTypeResolution, type RelationField, buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, mapDefault, parseRawDefault, pluralize, toEnumMemberName, toEnumName, toFieldName, toModelName };
1
+ import { _ as toEnumName, a as PslPrinterOptions, c as PslTypeResolution, d as deriveBackRelationFieldName, f as deriveRelationFieldName, g as toEnumMemberName, h as pluralize, i as InferredRelations, l as RelationField, m as mapDefault, n as DefaultMappingResult, o as PslTypeMap, p as inferRelations, r as EnumInfo, s as PslTypeReference, t as DefaultMappingOptions, u as buildChildRelationField, v as toFieldName, y as toModelName } from "./psl-infer-tLt9U1UP.mjs";
2
+ export { type DefaultMappingOptions, type DefaultMappingResult, type EnumInfo, type InferredRelations, type PslPrinterOptions, type PslTypeMap, type PslTypeReference, type PslTypeResolution, type RelationField, buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, mapDefault, pluralize, toEnumMemberName, toEnumName, toFieldName, toModelName };
@@ -1,2 +1,2 @@
1
- import { a as mapDefault, c as toEnumMemberName, d as toModelName, i as inferRelations, l as toEnumName, n as deriveBackRelationFieldName, o as parseRawDefault, r as deriveRelationFieldName, s as pluralize, t as buildChildRelationField, u as toFieldName } from "./psl-infer-TBwKfKgU.mjs";
2
- export { buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, mapDefault, parseRawDefault, pluralize, toEnumMemberName, toEnumName, toFieldName, toModelName };
1
+ import { a as mapDefault, c as toEnumName, i as inferRelations, l as toFieldName, n as deriveBackRelationFieldName, o as pluralize, r as deriveRelationFieldName, s as toEnumMemberName, t as buildChildRelationField, u as toModelName } from "./psl-infer-CPQSp4tG.mjs";
2
+ export { buildChildRelationField, deriveBackRelationFieldName, deriveRelationFieldName, inferRelations, mapDefault, pluralize, toEnumMemberName, toEnumName, toFieldName, toModelName };
@@ -1,6 +1,6 @@
1
1
  import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-Di9JZ0X7.mjs";
2
- import { a as interpretFieldAttribute, i as findModelAttributeNode, n as fieldSpecContext, o as interpretModelAttribute, r as findFieldAttributeNode, s as sqlAttributeSpecs, t as PSL_CHECK_ON_STI_VARIANT } from "./sql-attribute-specs-BCJ_CDJH-CfH1ddqf.mjs";
3
- import { n as buildSqlContractFromDefinition } from "./derived-checks-DGjY5t7S-B3txNm7X.mjs";
2
+ import { n as buildSqlContractFromDefinition } from "./derived-checks-DGjY5t7S-CzJmkeZR.mjs";
3
+ import { a as interpretFieldAttribute, i as findModelAttributeNode, n as fieldSpecContext, o as interpretModelAttribute, r as findFieldAttributeNode, s as sqlAttributeSpecs, t as PSL_CHECK_ON_STI_VARIANT } from "./sql-attribute-specs-BnUIuOy5-8t7OYHpi.mjs";
4
4
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
5
5
  import { hasRegisteredFieldNamespace, instantiateAuthoringEntityType, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringModelAttributeDescriptor, isAuthoringPslBlockDescriptor, isAuthoringTypeConstructorDescriptor, validateAuthoringHelperArguments } from "@prisma/orm-framework/components/authoring";
6
6
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
@@ -9,11 +9,11 @@ import { crossRef } from "@prisma/orm-framework/contract/types";
9
9
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
10
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
11
11
  import { findBlockDescriptor, keywordPslSpan, nodePslSpan } from "@prisma/orm-framework/psl-parser";
12
- import { notOk, ok } from "@prisma/orm-framework/utils/result";
13
12
  import { resolveToOneRelationNullable } from "@prisma/orm-framework/contract-authoring";
14
- import { consumeInvalidFkPairing, fkRelationPairKey, requiredOneToOneBackrelationDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
15
13
  import { assertDefined, invariant } from "@prisma/orm-framework/utils/assertions";
16
- //#region ../../../2-sql/2-authoring/contract-psl/dist/interpreter-C_i0NCiB.mjs
14
+ import { notOk, ok } from "@prisma/orm-framework/utils/result";
15
+ import { consumeInvalidFkPairing, fkRelationPairKey, requiredOneToOneBackrelationDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
16
+ //#region ../../../2-sql/2-authoring/contract-psl/dist/interpreter-QDw8KJeP.mjs
17
17
  function contractError(code, message, options) {
18
18
  return structuredError(code, message, options);
19
19
  }
@@ -82,6 +82,44 @@ function lowerDefaultFunctionWithRegistry(input) {
82
82
  }
83
83
  };
84
84
  }
85
+ /**
86
+ * The default value a number literal gives a column whose codec holds numbers. Returns `undefined`
87
+ * when the codec does not hold numbers, or reads the literal neither as a JSON number nor as
88
+ * decimal text.
89
+ */
90
+ function numberLiteralDefault(text, codecId, codecLookup) {
91
+ const codec = numberHoldingCodec(codecLookup, codecId);
92
+ if (codec === void 0) return void 0;
93
+ const number = Number(text);
94
+ if (tryDecodeJson(codec, number) !== void 0) return number;
95
+ const decoded = tryDecodeJson(codec, canonicalDecimalText(text));
96
+ return decoded !== void 0 && isNumberValue(decoded.value) ? decoded.value : void 0;
97
+ }
98
+ function numberHoldingCodec(codecLookup, codecId) {
99
+ return codecLookup?.descriptorFor?.(codecId)?.traits.includes("numeric") === true ? codecLookup?.get(codecId) : void 0;
100
+ }
101
+ const DECIMAL_NUMERAL = /^(-?)0*(\d+)(\.\d+)?$/;
102
+ /**
103
+ * Leading zeros and the sign of zero never change a decimal. Trailing zeros are kept, because a
104
+ * column without a scale keeps them.
105
+ */
106
+ function canonicalDecimalText(text) {
107
+ const numeral = DECIMAL_NUMERAL.exec(text);
108
+ if (numeral === null) return text;
109
+ const [, sign = "", whole = "", fraction = ""] = numeral;
110
+ const digits = `${whole}${fraction}`;
111
+ return /^[0.]+$/.test(digits) ? digits : `${sign}${digits}`;
112
+ }
113
+ function isNumberValue(value) {
114
+ return typeof value === "string" || typeof value === "number" || typeof value === "bigint";
115
+ }
116
+ function tryDecodeJson(codec, json) {
117
+ try {
118
+ return { value: codec.decodeJson(json) };
119
+ } catch {
120
+ return;
121
+ }
122
+ }
85
123
  const INVALID_AUTHORING_ARGUMENT = Symbol("invalidAuthoringArgument");
86
124
  function isIdentifierStartCharacter(character) {
87
125
  return character !== void 0 && /[A-Za-z_$]/.test(character);
@@ -778,9 +816,14 @@ function lowerDefaultForField(input) {
778
816
  });
779
817
  if (interpreted === void 0) return {};
780
818
  const value = interpreted.value;
819
+ const literalValue = (literal) => typeof literal === "object" ? numberLiteralDefault(literal.text, input.columnDescriptor.codecId, input.codecLookup) ?? Number(literal.text) : literal;
781
820
  if (Array.isArray(value)) return { defaultValue: {
782
821
  kind: "literal",
783
- value: [...value]
822
+ value: value.map(literalValue)
823
+ } };
824
+ if (typeof value === "object" && "text" in value) return { defaultValue: {
825
+ kind: "literal",
826
+ value: literalValue(value)
784
827
  } };
785
828
  if (typeof value === "object") {
786
829
  const lowered = lowerDefaultFunctionWithRegistry({
@@ -1129,6 +1172,7 @@ function collectResolvedFields(input) {
1129
1172
  generatorDescriptorById,
1130
1173
  sourceId,
1131
1174
  defaultFunctionRegistry,
1175
+ codecLookup,
1132
1176
  diagnostics
1133
1177
  }) : {};
1134
1178
  const loweredOnCreate = loweredDefault.executionDefaults?.onCreate;
@@ -3496,6 +3540,6 @@ function interpretPslDocumentToSqlContract(input) {
3496
3540
  });
3497
3541
  }
3498
3542
  //#endregion
3499
- export { interpretPslDocumentToSqlContract as t };
3543
+ export { normalizeReferentialAction as a, interpretPslDocumentToSqlContract as i, buildEntityTypesByDiscriminator as n, numberLiteralDefault as o, indexFkRelations as r, resolveFieldTypeDescriptor as s, applyBackrelationCandidates as t };
3500
3544
 
3501
- //# sourceMappingURL=interpreter-C_i0NCiB-CptD-6Yu.mjs.map
3545
+ //# sourceMappingURL=interpreter-QDw8KJeP-Bc93B8xi.mjs.map