@prisma/orm-family-sql 8.0.0-rc.14-dev.16 → 8.0.0-rc.14-dev.17

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 (31) hide show
  1. package/dist/contract-prisma7__provider.mjs +15 -25
  2. package/dist/contract-prisma7__provider.mjs.map +1 -1
  3. package/dist/contract-psl.d.mts +6 -24
  4. package/dist/contract-psl.d.mts.map +1 -1
  5. package/dist/contract-psl.mjs +1 -1
  6. package/dist/contract-psl__attribute-specs.d.mts +11 -3
  7. package/dist/contract-psl__attribute-specs.d.mts.map +1 -1
  8. package/dist/contract-psl__attribute-specs.mjs +2 -2
  9. package/dist/contract-psl__provider.mjs +12 -5
  10. package/dist/contract-psl__provider.mjs.map +1 -1
  11. package/dist/{control-B8LE0HRq.mjs → control-DIVsNXHK.mjs} +4 -2
  12. package/dist/control-DIVsNXHK.mjs.map +1 -0
  13. package/dist/{control--13SHD7X.d.mts → control-nLCfcNhb.d.mts} +4 -1
  14. package/dist/control-nLCfcNhb.d.mts.map +1 -0
  15. package/dist/family.d.mts +1 -1
  16. package/dist/family.mjs +1 -1
  17. package/dist/family__control.d.mts +1 -1
  18. package/dist/family__control.mjs +1 -1
  19. package/dist/family__pack.mjs +1 -1
  20. package/dist/{interpreter-CkCfPqup-DF7bZvNM.mjs → interpreter-C8cP92FD-Co9RsuUU.mjs} +58 -1549
  21. package/dist/interpreter-C8cP92FD-Co9RsuUU.mjs.map +1 -0
  22. package/dist/psl-column-resolution-sNpXQygQ-BQr15EoR.d.mts +28 -0
  23. package/dist/psl-column-resolution-sNpXQygQ-BQr15EoR.d.mts.map +1 -0
  24. package/dist/psl-field-resolution-_o74AUE4-CKYNRnzL.mjs +1868 -0
  25. package/dist/psl-field-resolution-_o74AUE4-CKYNRnzL.mjs.map +1 -0
  26. package/package.json +18 -18
  27. package/dist/control--13SHD7X.d.mts.map +0 -1
  28. package/dist/control-B8LE0HRq.mjs.map +0 -1
  29. package/dist/interpreter-CkCfPqup-DF7bZvNM.mjs.map +0 -1
  30. package/dist/sql-attribute-specs-DxpHr9Fk-CeWmMP7y.mjs +0 -543
  31. package/dist/sql-attribute-specs-DxpHr9Fk-CeWmMP7y.mjs.map +0 -1
@@ -1,9 +1,10 @@
1
1
  import { d as validateSqlStorageConsistency, l as validateModelStorageReferences } from "./validators-DvzOZLel.mjs";
2
2
  import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-Di9JZ0X7.mjs";
3
3
  import { n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from "./derived-checks-C_y1rk6O-DdqjzGNy.mjs";
4
- import { c as resolveFieldTypeDescriptor, i as indexFkRelations, n as buildEntityTypesByDiscriminator, o as normalizeReferentialAction, r as entryForTag, s as readDataTypeDefault, t as applyBackrelationCandidates } from "./interpreter-CkCfPqup-DF7bZvNM.mjs";
4
+ import { d as instantiateFieldTypeConstructor, o as entryForTag, v as readDataTypeDefault } from "./psl-field-resolution-_o74AUE4-CKYNRnzL.mjs";
5
+ import { a as normalizeReferentialAction, n as buildEntityTypesByDiscriminator, r as indexFkRelations, t as applyBackrelationCandidates } from "./interpreter-C8cP92FD-Co9RsuUU.mjs";
5
6
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
6
- import { collectScalarTypeConstructors, instantiateAuthoringEntityType } from "@prisma/orm-framework/components/authoring";
7
+ import { getAuthoringTypeConstructor, instantiateAuthoringEntityType } from "@prisma/orm-framework/components/authoring";
7
8
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
8
9
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
9
10
  import { blindCast } from "@prisma/orm-framework/utils/casts";
@@ -12,7 +13,7 @@ import { readFile, readdir, stat } from "node:fs/promises";
12
13
  import { ArrayLiteralAst, BooleanLiteralExprAst, FunctionCallAst, IdentifierAst, NumberLiteralExprAst, PathExprAst, StringLiteralExprAst, dottedPathsIn, parse, printSyntax } from "@prisma/orm-framework/psl-parser/syntax";
13
14
  import { notOk, ok } from "@prisma/orm-framework/utils/result";
14
15
  import { basename, dirname, extname, join, normalize } from "pathe";
15
- import { buildSymbolTable, createPslDiagnosticCollector, keywordPslSpan, nodePslSpan, readResolvedAttribute, readResolvedAttributes } from "@prisma/orm-framework/psl-parser";
16
+ import { buildSymbolTable, createPslDiagnosticCollector, diagnosticSource, keywordPslSpan, nodePslSpan, readResolvedAttribute, readResolvedAttributes } from "@prisma/orm-framework/psl-parser";
16
17
  import { fkRelationPairKey } from "@prisma/orm-framework/psl-parser/interpret";
17
18
  //#region ../../../2-sql/2-authoring/contract-prisma7/dist/provider.mjs
18
19
  function prisma7Diagnostic(code, message, sourceId, span) {
@@ -921,7 +922,6 @@ function synthesizeJunction(requester, partner, naming, diagnostics) {
921
922
  };
922
923
  }
923
924
  const SUMMARY = "Prisma 7 schema interpretation failed";
924
- const EMPTY_DESCRIPTORS = /* @__PURE__ */ new Map();
925
925
  function attributeText(attribute) {
926
926
  const args = attribute.args.map((arg) => arg.kind === "named" ? `${arg.name}: ${arg.value}` : arg.value);
927
927
  return args.length === 0 ? `@${attribute.name}` : `@${attribute.name}(${args.join(", ")})`;
@@ -1060,7 +1060,6 @@ function interpretPrisma7Documents(input) {
1060
1060
  }
1061
1061
  const namespaceEntities = lowerNativeEnums(enums, input, diagnostics);
1062
1062
  const modelNames = /* @__PURE__ */ new Set([...models.map((model) => model.symbol.name), ...ignoredModels]);
1063
- const scalarColumnDescriptors = collectScalarTypeConstructors(input.authoringContributions.type);
1064
1063
  const composedExtensions = new Set(input.composedExtensions);
1065
1064
  const builds = /* @__PURE__ */ new Map();
1066
1065
  for (const declaration of models) {
@@ -1083,7 +1082,6 @@ function interpretPrisma7Documents(input) {
1083
1082
  ignoredModels,
1084
1083
  enums,
1085
1084
  namespaceEntities,
1086
- scalarColumnDescriptors,
1087
1085
  composedExtensions,
1088
1086
  input,
1089
1087
  diagnostics
@@ -1568,32 +1566,24 @@ function readField(args) {
1568
1566
  span
1569
1567
  };
1570
1568
  }
1571
- const namespaceExtensionEntities = args.namespaceEntities.get(model.namespaceId);
1569
+ const typeConstructor = getAuthoringTypeConstructor(input.authoringContributions, call.path);
1570
+ if (typeConstructor === void 0) {
1571
+ diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_UNSUPPORTED_TYPE", `${label} type "${field.typeName}" could not be resolved against target "${binding.target.targetId}".`, sourceId, field.span));
1572
+ return;
1573
+ }
1572
1574
  const typeDiagnostics = createPslDiagnosticCollector(model.sources);
1573
- const resolved = resolveFieldTypeDescriptor({
1574
- field: {
1575
- ...field,
1576
- typeConstructor: call
1577
- },
1578
- enumTypeDescriptors: EMPTY_DESCRIPTORS,
1579
- namedTypeDescriptors: EMPTY_DESCRIPTORS,
1580
- scalarColumnDescriptors: args.scalarColumnDescriptors,
1581
- authoringContributions: input.authoringContributions,
1582
- composedExtensions: args.composedExtensions,
1583
- familyId: binding.target.familyId,
1584
- targetId: binding.target.targetId,
1575
+ const resolved = instantiateFieldTypeConstructor({
1576
+ call,
1577
+ descriptor: typeConstructor,
1585
1578
  diagnostics: typeDiagnostics,
1586
- sources: model.sources,
1579
+ source: diagnosticSource(model.sources, field.node.syntax),
1587
1580
  entityLabel: label,
1588
1581
  namespaceId: model.namespaceId,
1589
- ...ifDefined("namespaceExtensionEntities", namespaceExtensionEntities),
1582
+ namespaceExtensionEntities: args.namespaceEntities.get(model.namespaceId),
1590
1583
  codecLookup: input.codecLookup
1591
1584
  });
1592
1585
  diagnostics.push(...typeDiagnostics.toExternal());
1593
- if (!resolved.ok) {
1594
- if (!resolved.alreadyReported) diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_UNSUPPORTED_TYPE", `${label} type "${field.typeName}" could not be resolved against target "${binding.target.targetId}".`, sourceId, field.span));
1595
- return;
1596
- }
1586
+ if (!resolved.ok) return;
1597
1587
  const updatedAtGeneratorId = updatedAt === void 0 ? void 0 : binding.updatedAtGeneratorId(resolved.descriptor.codecId);
1598
1588
  if (updatedAt !== void 0 && updatedAtGeneratorId === void 0) {
1599
1589
  const withoutUpdatedAt = defaultAttribute !== void 0 && givesColumnDefault(defaultAttribute) ? `. Its ${attributeText(defaultAttribute)} still sets the value on create, and neither client changes it on update.` : field.optional ? ", but neither client then fills the value, so it stays empty unless a client writes it, and updates leave it unchanged." : ", but neither client then fills the value, so both require it on create and leave it unchanged on update.";