@prisma-next/sql-contract-psl 0.12.0-dev.60 → 0.12.0-dev.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{interpreter-1VmrYYbi.mjs → interpreter-B5_yovSP.mjs} +23 -3
- package/dist/interpreter-B5_yovSP.mjs.map +1 -0
- package/dist/provider.mjs +2 -1
- package/dist/provider.mjs.map +1 -1
- package/package.json +12 -12
- package/src/interpreter.ts +45 -9
- package/src/provider.ts +1 -0
- package/dist/interpreter-1VmrYYbi.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -25,6 +25,16 @@ interface InterpretPslDocumentToSqlContractInput {
|
|
|
25
25
|
readonly composedExtensionPackRefs?: readonly ExtensionPackRef<'sql', string>[];
|
|
26
26
|
readonly controlMutationDefaults?: ControlMutationDefaults$1;
|
|
27
27
|
readonly authoringContributions?: AuthoringContributions;
|
|
28
|
+
/**
|
|
29
|
+
* Extension contracts keyed by space ID. Required for cross-space FK
|
|
30
|
+
* resolution. A composed space must have an entry here; if the space ID
|
|
31
|
+
* appears in `composedExtensionPacks` but is absent from this map, the
|
|
32
|
+
* interpreter emits `PSL_UNKNOWN_CONTRACT_SPACE` and fails fast — there
|
|
33
|
+
* is no silent fallback. If a space's contract is present but the
|
|
34
|
+
* referenced model or namespace is not found in it, the interpreter
|
|
35
|
+
* emits `PSL_UNKNOWN_CROSS_SPACE_TARGET`.
|
|
36
|
+
*/
|
|
37
|
+
readonly composedExtensionContracts: ReadonlyMap<string, Contract>;
|
|
28
38
|
/**
|
|
29
39
|
* Target-supplied `Namespace` factory threaded into
|
|
30
40
|
* `buildSqlContractFromDefinition` for the contract's
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"mappings":";;;;;;;;;;;KA0CY,gBAAA;EAAA,SACD,OAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA,GAAa,MAAM;AAAA;;;UCkDb,sCAAA;EAAA,SACN,QAAA,EAAU,sBAAA;EAAA,SACV,MAAA,EAAQ,aAAA;EAAA,SACR,qBAAA,EAAuB,WAAA,SAAoB,gBAAA;EAAA,SAC3C,sBAAA;EAAA,SACA,yBAAA,YAAqC,gBAAA;EAAA,SACrC,uBAAA,GAA0B,yBAAA;EAAA,SAC1B,sBAAA,GAAyB,sBAAA;EDzDzB;;;AAAmB;;;;ACkD9B;;EDlDW,SCmEA,eAAA,IAAmB,KAAA,EAAO,uBAAA,KAA4B,SAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"mappings":";;;;;;;;;;;KA0CY,gBAAA;EAAA,SACD,OAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA,GAAa,MAAM;AAAA;;;UCkDb,sCAAA;EAAA,SACN,QAAA,EAAU,sBAAA;EAAA,SACV,MAAA,EAAQ,aAAA;EAAA,SACR,qBAAA,EAAuB,WAAA,SAAoB,gBAAA;EAAA,SAC3C,sBAAA;EAAA,SACA,yBAAA,YAAqC,gBAAA;EAAA,SACrC,uBAAA,GAA0B,yBAAA;EAAA,SAC1B,sBAAA,GAAyB,sBAAA;EDzDzB;;;AAAmB;;;;ACkD9B;;EDlDW,SCmEA,0BAAA,EAA4B,WAAA,SAAoB,QAAA;EAhBtC;;;;;;;;;EAAA,SA0BV,eAAA,IAAmB,KAAA,EAAO,uBAAA,KAA4B,SAAA;AAAA;AAAA,iBAurDjD,iCAAA,CACd,KAAA,EAAO,sCAAA,GACN,MAAA,CAAO,QAAA,EAAU,yBAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as interpretPslDocumentToSqlContract } from "./interpreter-
|
|
1
|
+
import { t as interpretPslDocumentToSqlContract } from "./interpreter-B5_yovSP.mjs";
|
|
2
2
|
export { interpretPslDocumentToSqlContract };
|
|
@@ -2465,7 +2465,8 @@ function buildModelNodeFromPsl(input) {
|
|
|
2465
2465
|
continue;
|
|
2466
2466
|
}
|
|
2467
2467
|
if (fieldTypeContractSpaceId !== void 0) {
|
|
2468
|
-
|
|
2468
|
+
const extContractForSpace = input.composedExtensionContracts.get(fieldTypeContractSpaceId);
|
|
2469
|
+
if (extContractForSpace === void 0) {
|
|
2469
2470
|
diagnostics.push({
|
|
2470
2471
|
code: "PSL_UNKNOWN_CONTRACT_SPACE",
|
|
2471
2472
|
message: `Relation field "${model.name}.${relationAttribute.field.name}" references contract space "${fieldTypeContractSpaceId}" which is not declared in extensionPacks. Add "${fieldTypeContractSpaceId}" to extensionPacks in prisma-next.config.ts.`,
|
|
@@ -2534,7 +2535,24 @@ function buildModelNodeFromPsl(input) {
|
|
|
2534
2535
|
diagnostics
|
|
2535
2536
|
}) : void 0;
|
|
2536
2537
|
const crossTargetNamespaceId = fieldTypeNamespaceId ?? "__unbound__";
|
|
2537
|
-
const
|
|
2538
|
+
const extContract = extContractForSpace;
|
|
2539
|
+
const resolvedTable = extContract.domain.namespaces[crossTargetNamespaceId]?.models[fieldTypeName]?.storage["table"];
|
|
2540
|
+
if (typeof resolvedTable !== "string") {
|
|
2541
|
+
const availableModels = Object.keys(extContract.domain.namespaces[crossTargetNamespaceId]?.models ?? {}).join(", ") || "(none)";
|
|
2542
|
+
diagnostics.push({
|
|
2543
|
+
code: "PSL_UNKNOWN_CROSS_SPACE_TARGET",
|
|
2544
|
+
message: `Relation field "${model.name}.${relationAttribute.field.name}" references model "${fieldTypeName}" in namespace "${crossTargetNamespaceId}" of space "${fieldTypeContractSpaceId}", but that model was not found in the extension contract. Available models: ${availableModels}`,
|
|
2545
|
+
sourceId,
|
|
2546
|
+
span: relationAttribute.field.span,
|
|
2547
|
+
data: {
|
|
2548
|
+
space: fieldTypeContractSpaceId,
|
|
2549
|
+
namespace: crossTargetNamespaceId,
|
|
2550
|
+
model: fieldTypeName
|
|
2551
|
+
}
|
|
2552
|
+
});
|
|
2553
|
+
continue;
|
|
2554
|
+
}
|
|
2555
|
+
const crossTargetTableName = resolvedTable;
|
|
2538
2556
|
foreignKeyNodes.push({
|
|
2539
2557
|
columns: localColumns,
|
|
2540
2558
|
references: {
|
|
@@ -3174,6 +3192,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3174
3192
|
const modelNames = new Set(models.map((model) => model.name));
|
|
3175
3193
|
const compositeTypeNames = new Set(compositeTypes.map((ct) => ct.name));
|
|
3176
3194
|
const composedExtensions = new Set(input.composedExtensionPacks ?? []);
|
|
3195
|
+
const composedExtensionContracts = input.composedExtensionContracts;
|
|
3177
3196
|
const defaultFunctionRegistry = input.controlMutationDefaults?.defaultFunctionRegistry ?? /* @__PURE__ */ new Map();
|
|
3178
3197
|
const generatorDescriptors = input.controlMutationDefaults?.generatorDescriptors ?? [];
|
|
3179
3198
|
const generatorDescriptorById = /* @__PURE__ */ new Map();
|
|
@@ -3238,6 +3257,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3238
3257
|
enumTypeDescriptors: allEnumTypeDescriptors,
|
|
3239
3258
|
namedTypeDescriptors: namedTypeResult.namedTypeDescriptors,
|
|
3240
3259
|
composedExtensions,
|
|
3260
|
+
composedExtensionContracts,
|
|
3241
3261
|
familyId: input.target.familyId,
|
|
3242
3262
|
targetId: input.target.targetId,
|
|
3243
3263
|
authoringContributions: input.authoringContributions,
|
|
@@ -3333,4 +3353,4 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3333
3353
|
//#endregion
|
|
3334
3354
|
export { interpretPslDocumentToSqlContract as t };
|
|
3335
3355
|
|
|
3336
|
-
//# sourceMappingURL=interpreter-
|
|
3356
|
+
//# sourceMappingURL=interpreter-B5_yovSP.mjs.map
|