@prisma/orm-family-sql 8.0.0-rc.21-dev.17 → 8.0.0-rc.21-dev.19

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 (27) hide show
  1. package/dist/contract-prisma7__provider.d.mts +15 -9
  2. package/dist/contract-prisma7__provider.d.mts.map +1 -1
  3. package/dist/contract-prisma7__provider.mjs +36 -11
  4. package/dist/contract-prisma7__provider.mjs.map +1 -1
  5. package/dist/contract-psl.mjs +1 -1
  6. package/dist/contract-psl__attribute-specs.mjs +1 -1
  7. package/dist/contract-psl__diagnostics.mjs +1 -1
  8. package/dist/contract-psl__provider.mjs +1 -1
  9. package/dist/contract-psl__provider.mjs.map +1 -1
  10. package/dist/{control-w9vYxuDF.mjs → control-1JIbMzKB.mjs} +3 -3
  11. package/dist/{control-w9vYxuDF.mjs.map → control-1JIbMzKB.mjs.map} +1 -1
  12. package/dist/{diagnostics-CoM0OFuR.mjs → diagnostics-CSrneG0n.mjs} +2 -2
  13. package/dist/{diagnostics-CoM0OFuR.mjs.map → diagnostics-CSrneG0n.mjs.map} +1 -1
  14. package/dist/family.mjs +1 -1
  15. package/dist/family__control.mjs +1 -1
  16. package/dist/family__pack.mjs +1 -1
  17. package/dist/{interpreter-6czZvMo_-C2_2jQGn.mjs → interpreter-Ct1zWXKw-CRkWwRAw.mjs} +16 -8
  18. package/dist/interpreter-Ct1zWXKw-CRkWwRAw.mjs.map +1 -0
  19. package/dist/psl-attribute-parsing-DrRPFOVh-U_SqMtcb.mjs +71 -0
  20. package/dist/psl-attribute-parsing-DrRPFOVh-U_SqMtcb.mjs.map +1 -0
  21. package/dist/{psl-field-resolution-BW2_FOb9-DxqR43fo.mjs → psl-field-resolution-BnusQmZy-CX0b0mPk.mjs} +4 -9
  22. package/dist/psl-field-resolution-BnusQmZy-CX0b0mPk.mjs.map +1 -0
  23. package/package.json +18 -18
  24. package/dist/interpreter-6czZvMo_-C2_2jQGn.mjs.map +0 -1
  25. package/dist/psl-attribute-parsing-BCsFWsSp-BJ-wGlY6.mjs +0 -42
  26. package/dist/psl-attribute-parsing-BCsFWsSp-BJ-wGlY6.mjs.map +0 -1
  27. package/dist/psl-field-resolution-BW2_FOb9-DxqR43fo.mjs.map +0 -1
@@ -11,7 +11,7 @@ import { ContractConfig } from "@prisma/orm-framework/config/config-types";
11
11
  * itself is target knowledge, supplied by the target binding.
12
12
  */
13
13
  interface Prisma7TypeMapping {
14
- readonly constructorName: string;
14
+ readonly constructorPath: readonly string[];
15
15
  /** The values of the constructor's arguments, as the constructor takes them. */
16
16
  readonly args: readonly unknown[];
17
17
  }
@@ -24,6 +24,18 @@ interface Prisma7TypeMap {
24
24
  * column gets without any.
25
25
  */
26
26
  readonly nativeTypes: Readonly<Record<string, Prisma7TypeMapping>>;
27
+ /** `@db.X` spellings whose column type a database extension provides, read only when the pack that declares the extension is composed. */
28
+ readonly extensionNativeTypes: Readonly<Record<string, Prisma7ExtensionTypeMapping>>;
29
+ }
30
+ interface Prisma7ExtensionTypeMapping extends Prisma7TypeMapping {
31
+ /** The extension's name in the database, a key of the binding's extension packs. */
32
+ readonly extension: string;
33
+ }
34
+ /** An extension pack, and the import a config writes to compose it: `import <importName> from '<importPath>'`. */
35
+ interface Prisma7ExtensionPack {
36
+ readonly id: string;
37
+ readonly importName: string;
38
+ readonly importPath: string;
27
39
  }
28
40
  //#endregion
29
41
  //#region src/target-binding.d.ts
@@ -53,19 +65,13 @@ interface Prisma7FinerThanColumn {
53
65
  readonly heldDigits: number;
54
66
  readonly stored: string;
55
67
  }
56
- /** An extension pack, and the import a config writes to compose it: `import <importName> from '<importPath>'`. */
57
- interface Prisma7ExtensionPack {
58
- readonly id: string;
59
- readonly importName: string;
60
- readonly importPath: string;
61
- }
62
68
  /** How the target reads the datasource `extensions` list. */
63
69
  interface Prisma7DatabaseExtensions {
64
70
  /** The generator preview feature without which Prisma 7 refuses the list. */
65
71
  readonly previewFeature: string;
66
72
  /** The entity kind the target registers for a database extension. */
67
73
  readonly entityKind: string;
68
- /** The extensions an extension pack declares, by name, with that pack. */
74
+ /** The extensions an extension pack declares, by name, with that pack; a datasource `extensions` entry and a `@db.*` type the extension provides are both read through it. */
69
75
  readonly packs: Readonly<Record<string, Prisma7ExtensionPack>>;
70
76
  }
71
77
  /** Everything a target supplies to the Prisma 7 interpreter. */
@@ -111,5 +117,5 @@ interface Prisma7ContractOptions {
111
117
  }
112
118
  declare function prisma7Contract(schemaPath: string, options: Prisma7ContractOptions): ContractConfig;
113
119
  //#endregion
114
- export { type Prisma7ColumnType, type Prisma7ContractOptions, type Prisma7LiteralDefaultForm, type Prisma7TargetBinding, type Prisma7TypeMap, type Prisma7TypeMapping, prisma7Contract };
120
+ export { type Prisma7ColumnType, type Prisma7ContractOptions, type Prisma7ExtensionPack, type Prisma7ExtensionTypeMapping, type Prisma7LiteralDefaultForm, type Prisma7TargetBinding, type Prisma7TypeMap, type Prisma7TypeMapping, prisma7Contract };
115
121
  //# sourceMappingURL=contract-prisma7__provider.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-prisma7__provider.d.mts","names":[],"sources":["../../../../2-sql-family/2-authoring/contract-prisma7/dist/provider.d.mts"],"mappings":";;;;;;;;;;;;UAUU;WACC;;WAEA;;UAED;;WAEC,SAAS,SAAS,eAAe;;;;;;WAMjC,aAAa,SAAS,eAAe;;;;UAItC;WACC;;WAEA;WACA,aAAa,SAAS;;;KAG5B;;;WAGM;;;;WAIA;WACA;;WAEA,OAAO;;WAEP,mBAAmB,iBAAiB;;;UAGrC;WACC;WACA;;;UAGD;WACC;WACA;WACA;;;UAGD;;WAEC;;WAEA;;WAEA,OAAO,SAAS,eAAe;;;UAGhC;WACC,QAAQ;WACR,kBAAkB,OAAO,sBAAsB;;WAE/C;;WAEA,SAAS;;WAET;aACE;aACA;;WAEF,YAAY;;WAEZ,YAAY,SAAS;;WAErB;;WAEA;aACE,aAAa;aACb,aAAa,mBAAmB;;;;;;;WAOlC,6BAA6B,gBAAgB;;WAE7C,qBAAqB,QAAQ,sBAAsB;;WAEnD,2BAA2B,QAAQ,WAAW,QAAQ;;;;UAIvD;WACC,SAAS;WACT;WACA,uBAAuB;;iBAEjB,gBAAgB,oBAAoB,SAAS,yBAAyB"}
1
+ {"version":3,"file":"contract-prisma7__provider.d.mts","names":[],"sources":["../../../../2-sql-family/2-authoring/contract-prisma7/dist/provider.d.mts"],"mappings":";;;;;;;;;;;;UAUU;WACC;;WAEA;;UAED;;WAEC,SAAS,SAAS,eAAe;;;;;;WAMjC,aAAa,SAAS,eAAe;;WAErC,sBAAsB,SAAS,eAAe;;UAE/C,oCAAoC;;WAEnC;;;UAGD;WACC;WACA;WACA;;;;UAID;WACC;;WAEA;WACA,aAAa,SAAS;;;KAG5B;;;WAGM;;;;WAIA;WACA;;WAEA,OAAO;;WAEP,mBAAmB,iBAAiB;;;UAGrC;WACC;WACA;;;UAGD;;WAEC;;WAEA;;WAEA,OAAO,SAAS,eAAe;;;UAGhC;WACC,QAAQ;WACR,kBAAkB,OAAO,sBAAsB;;WAE/C;;WAEA,SAAS;;WAET;aACE;aACA;;WAEF,YAAY;;WAEZ,YAAY,SAAS;;WAErB;;WAEA;aACE,aAAa;aACb,aAAa,mBAAmB;;;;;;;WAOlC,6BAA6B,gBAAgB;;WAE7C,qBAAqB,QAAQ,sBAAsB;;WAEnD,2BAA2B,QAAQ,WAAW,QAAQ;;;;UAIvD;WACC,SAAS;WACT;WACA,uBAAuB;;iBAEjB,gBAAgB,oBAAoB,SAAS,yBAAyB"}
@@ -6,8 +6,8 @@ import { p as validateSqlStorageConsistency, u as validateModelStorageReferences
6
6
  import { t as deriveValueSetFromEntity } from "./value-set-derivation-hook-HVaxhALD.mjs";
7
7
  import { n as buildSqlContractFromDefinition, t as applySqlSpecifierControlPolicy } from "./derived-checks-D__agoFB-Boa1MHcA.mjs";
8
8
  import { o as composedExtensionPackRefs } from "./contract-builder-Y2rB4xMf.mjs";
9
- import { c as instantiateFieldTypeConstructor, i as defaultFunctionCall, v as readDataTypeDefault } from "./psl-field-resolution-BW2_FOb9-DxqR43fo.mjs";
10
- import { a as normalizeReferentialAction, n as buildEntityTypesByDiscriminator, r as indexFkRelations, t as applyBackrelationCandidates } from "./interpreter-6czZvMo_-C2_2jQGn.mjs";
9
+ import { c as instantiateFieldTypeConstructor, i as defaultFunctionCall, v as readDataTypeDefault } from "./psl-field-resolution-BnusQmZy-CX0b0mPk.mjs";
10
+ import { a as normalizeReferentialAction, n as buildEntityTypesByDiscriminator, r as indexFkRelations, t as applyBackrelationCandidates } from "./interpreter-Ct1zWXKw-CRkWwRAw.mjs";
11
11
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
12
12
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
13
13
  import { entryForTag, getAuthoringTypeChoice, getAuthoringTypeConstructor, instantiateAuthoringEntityType, instantiateAuthoringTypeConstructorFromValues, resolveAuthoringTypeChoice } from "@prisma/orm-framework/components/authoring";
@@ -502,6 +502,10 @@ function dbgeneratedDefault(callArgs, unknown, span) {
502
502
  onCreate: void 0
503
503
  };
504
504
  }
505
+ /** The config edit that composes `pack`. */
506
+ function composePackAdvice(pack) {
507
+ return `Add the pack to extensions in prisma.config.ts: import ${pack.importName} from '${pack.importPath}', then extensions: [${pack.importName}].`;
508
+ }
505
509
  const PRISMA7_EXTENSION_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
506
510
  function entryValue(source, key) {
507
511
  return source.block.entries.find((entry) => entry.key()?.name() === key);
@@ -573,7 +577,7 @@ function readDatasourceExtensions(input) {
573
577
  }
574
578
  const pack = Object.hasOwn(binding.packs, name) ? binding.packs[name] : void 0;
575
579
  if (pack !== void 0 && !input.composedExtensions.has(pack.id)) {
576
- diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_EXTENSION_PACK_MISSING", `Extension "${name}" is declared by the "${pack.id}" extension pack, which is not available. Add the pack to extensions in prisma.config.ts: import ${pack.importName} from '${pack.importPath}', then extensions: [${pack.importName}].`, sourceId, span));
580
+ diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_EXTENSION_PACK_MISSING", `Extension "${name}" is declared by the "${pack.id}" extension pack, which is not available. ${composePackAdvice(pack)}`, sourceId, span));
577
581
  continue;
578
582
  }
579
583
  if (!extensions.has(name)) extensions.set(name, {
@@ -634,8 +638,22 @@ function readArguments(name, call, input) {
634
638
  function prisma7ScalarMapping(typeMap, scalar) {
635
639
  return Object.hasOwn(typeMap.scalars, scalar) ? typeMap.scalars[scalar] : void 0;
636
640
  }
637
- function prisma7NativeTypeMapping(typeMap, nativeType) {
638
- return Object.hasOwn(typeMap.nativeTypes, nativeType) ? typeMap.nativeTypes[nativeType] : void 0;
641
+ function prisma7NativeTypeMapping(typeMap, extensionPacks, nativeType, composedExtensions) {
642
+ const builtIn = Object.hasOwn(typeMap.nativeTypes, nativeType) ? typeMap.nativeTypes[nativeType] : void 0;
643
+ if (builtIn !== void 0) return {
644
+ kind: "mapped",
645
+ mapping: builtIn
646
+ };
647
+ const fromExtension = Object.hasOwn(typeMap.extensionNativeTypes, nativeType) ? typeMap.extensionNativeTypes[nativeType] : void 0;
648
+ const pack = fromExtension !== void 0 && Object.hasOwn(extensionPacks, fromExtension.extension) ? extensionPacks[fromExtension.extension] : void 0;
649
+ if (fromExtension === void 0 || pack === void 0) return { kind: "unknown" };
650
+ return composedExtensions.has(pack.id) ? {
651
+ kind: "mapped",
652
+ mapping: fromExtension
653
+ } : {
654
+ kind: "packNotComposed",
655
+ pack
656
+ };
639
657
  }
640
658
  /** The codes `applyBackrelationCandidates` reports, each shown as `PSL.PRISMA7_RELATION_UNRESOLVED`. */
641
659
  const RELATION_PAIRING_CODES = /* @__PURE__ */ new Set([
@@ -1868,7 +1886,10 @@ function unsupportedTypeArgument(call) {
1868
1886
  };
1869
1887
  }
1870
1888
  function nativeTypeMessage(label, nativeType) {
1871
- return `${label}: native type "@db.${nativeType}" has no Prisma 8 codec yet, and Prisma 8 cannot read this schema until it supports the column type. @ignore on the field or @@ignore on the model does not help: Prisma 8 keeps the columns of ignored fields and models in the contract. Changing the field's type to one Prisma 8 supports changes the column type on Prisma 7's next migration.`;
1889
+ return `${label}: native type "@db.${nativeType}" is not one the target knows, and Prisma 7 refuses it too. Correct the spelling.`;
1890
+ }
1891
+ function extensionPackMissingMessage(label, nativeType, pack) {
1892
+ return `${label}: native type "@db.${nativeType}" is a column type of the "${pack.id}" extension pack, which is not available. ${composePackAdvice(pack)}`;
1872
1893
  }
1873
1894
  function readField(args) {
1874
1895
  const { field, build, diagnostics, input } = args;
@@ -1993,20 +2014,24 @@ function readField(args) {
1993
2014
  diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_UNSUPPORTED_TYPE", `${label} has unknown type "${field.typeName}".`, sourceId, field.span));
1994
2015
  return;
1995
2016
  }
1996
- const native = nativeType === void 0 ? void 0 : prisma7NativeTypeMapping(binding.typeMap, nativeType.name);
1997
- if (nativeType !== void 0 && native === void 0) {
2017
+ const native = nativeType === void 0 ? void 0 : prisma7NativeTypeMapping(binding.typeMap, binding.extensions.packs, nativeType.name, args.composedExtensions);
2018
+ if (nativeType !== void 0 && native?.kind === "packNotComposed") {
2019
+ diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_EXTENSION_PACK_MISSING", extensionPackMissingMessage(label, nativeType.name, native.pack), sourceId, nativeType.attribute.span));
2020
+ return;
2021
+ }
2022
+ if (nativeType !== void 0 && native?.kind === "unknown") {
1998
2023
  diagnostics.push(prisma7Diagnostic("PSL.PRISMA7_NATIVE_TYPE_UNSUPPORTED", nativeTypeMessage(label, nativeType.name), sourceId, nativeType.attribute.span));
1999
2024
  return;
2000
2025
  }
2001
- const mapping = native ?? scalar;
2026
+ const mapping = native?.kind === "mapped" ? native.mapping : scalar;
2002
2027
  fieldType = nativeType === void 0 || nativeType.attribute.args.length === 0 ? {
2003
2028
  kind: "values",
2004
- path: [mapping.constructorName],
2029
+ path: mapping.constructorPath,
2005
2030
  values: mapping.args
2006
2031
  } : {
2007
2032
  kind: "written",
2008
2033
  call: {
2009
- path: [mapping.constructorName],
2034
+ path: mapping.constructorPath,
2010
2035
  args: nativeType.attribute.args,
2011
2036
  span: nativeType.attribute.span
2012
2037
  }