@prisma/orm-family-sql 8.0.0-rc.8-dev.5 → 8.0.0-rc.8-dev.6
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/contract-psl.mjs +1 -1
- package/dist/contract-psl__provider.mjs +1 -1
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/{interpreter-DyiUUAWh-DYdjIpiE.mjs → interpreter-RTglKUpM-DUHChvJN.mjs} +7 -3
- package/dist/interpreter-RTglKUpM-DUHChvJN.mjs.map +1 -0
- package/package.json +17 -17
- package/dist/interpreter-DyiUUAWh-DYdjIpiE.mjs.map +0 -1
package/dist/contract-psl.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as interpretPslDocumentToSqlContract } from "./interpreter-
|
|
1
|
+
import { t as interpretPslDocumentToSqlContract } from "./interpreter-RTglKUpM-DUHChvJN.mjs";
|
|
2
2
|
export { interpretPslDocumentToSqlContract };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as applySqlSpecifierControlPolicy } from "./derived-checks-DFMRmiAu-DGfB8aS4.mjs";
|
|
2
|
-
import { t as interpretPslDocumentToSqlContract } from "./interpreter-
|
|
2
|
+
import { t as interpretPslDocumentToSqlContract } from "./interpreter-RTglKUpM-DUHChvJN.mjs";
|
|
3
3
|
import { collectScalarTypeConstructors } from "@prisma/orm-framework/components/authoring";
|
|
4
4
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
5
5
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToSqlContract } from \"./interpreter-
|
|
1
|
+
{"version":3,"file":"contract-psl__provider.mjs","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/provider.mjs"],"sourcesContent":["import { t as interpretPslDocumentToSqlContract } from \"./interpreter-RTglKUpM.mjs\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { buildSymbolTable, rangeToPslSpan } from \"@internal/psl-parser\";\nimport { applySqlSpecifierControlPolicy } from \"@internal/sql-contract-ts/contract-builder\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { readFile } from \"node:fs/promises\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { parse } from \"@internal/psl-parser/syntax\";\nimport { basename, extname } from \"pathe\";\n//#region src/provider.ts\n/**\n* Derives the emit output path from the schema input path so artefacts land\n* colocated with the source (e.g. `src/contract/schema.prisma` →\n* `src/contract/contract.json`). The provider owns this because it is the\n* only layer that knows the input path; the upstream `normalizeContractConfig`\n* default is a last-resort fallback for providers that don't carry one.\n*/\nfunction defaultOutputFromSchemaPath(schemaPath) {\n\tconst ext = extname(schemaPath);\n\tif (ext.length === 0) return `${schemaPath}.json`;\n\tconst base = schemaPath.slice(0, -ext.length);\n\tif (basename(base) === \"schema\") return `${base.slice(0, -6)}contract.json`;\n\treturn `${base}.json`;\n}\nfunction mapParseDiagnostics(diagnostics, sourceFile, sourceId) {\n\treturn diagnostics.map((diagnostic) => ({\n\t\tcode: diagnostic.code,\n\t\tmessage: diagnostic.message,\n\t\tsourceId,\n\t\tspan: rangeToPslSpan(diagnostic.range, sourceFile)\n\t}));\n}\nfunction prismaContract(schemaPath, options) {\n\treturn {\n\t\tsource: {\n\t\t\tformat: \"psl\",\n\t\t\tinputs: [schemaPath],\n\t\t\tinterpret(input, context) {\n\t\t\t\tconst scalarColumnDescriptors = collectScalarTypeConstructors(context.authoringContributions.type);\n\t\t\t\treturn interpretPslDocumentToSqlContract({\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsourceFile: input.sourceFile,\n\t\t\t\t\tsourceId: input.sourceId,\n\t\t\t\t\tseedDiagnostics: [],\n\t\t\t\t\ttarget: options.target,\n\t\t\t\t\tauthoringContributions: context.authoringContributions,\n\t\t\t\t\tscalarColumnDescriptors,\n\t\t\t\t\t...ifDefined(\"composedExtensions\", context.composedExtensions.length > 0 ? [...context.composedExtensions] : void 0),\n\t\t\t\t\tcomposedExtensionContracts: context.composedExtensionContracts,\n\t\t\t\t\t...ifDefined(\"composedExtensionPackRefs\", options.composedExtensionPackRefs?.length ? options.composedExtensionPackRefs : void 0),\n\t\t\t\t\tcontrolMutationDefaults: context.controlMutationDefaults,\n\t\t\t\t\tcreateNamespace: options.createNamespace,\n\t\t\t\t\tcapabilities: context.capabilities,\n\t\t\t\t\tcodecLookup: context.codecLookup,\n\t\t\t\t\t...ifDefined(\"enumInferenceCodecs\", options.enumInferenceCodecs)\n\t\t\t\t});\n\t\t\t},\n\t\t\tasync load(context) {\n\t\t\t\tconst [absoluteSchemaPath] = context.resolvedInputs;\n\t\t\t\tif (absoluteSchemaPath === void 0) throw new InternalError(\"prismaContract: context.resolvedInputs is empty. The CLI config loader should populate it positional-matched with source.inputs.\");\n\t\t\t\tlet schema;\n\t\t\t\ttry {\n\t\t\t\t\tschema = await readFile(absoluteSchemaPath, \"utf-8\");\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst message = String(error);\n\t\t\t\t\treturn notOk({\n\t\t\t\t\t\tsummary: `Failed to read Prisma schema at \"${schemaPath}\"`,\n\t\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\t\tcode: \"PSL_SCHEMA_READ_FAILED\",\n\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t\t}],\n\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\tschemaPath,\n\t\t\t\t\t\t\tabsoluteSchemaPath,\n\t\t\t\t\t\t\tcause: message\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst { document, sourceFile, diagnostics: parseDiagnostics } = parse(schema);\n\t\t\t\tconst { table: symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({\n\t\t\t\t\tdocument,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tpslBlockDescriptors: context.authoringContributions.pslBlockDescriptors\n\t\t\t\t});\n\t\t\t\tconst seedDiagnostics = [...mapParseDiagnostics(parseDiagnostics, sourceFile, schemaPath), ...mapParseDiagnostics(symbolTableDiagnostics, sourceFile, schemaPath)];\n\t\t\t\tconst interpreted = withSeedDiagnostics(this.interpret({\n\t\t\t\t\tdocument,\n\t\t\t\t\tsourceFile,\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t}, context), seedDiagnostics);\n\t\t\t\tif (!interpreted.ok) return interpreted;\n\t\t\t\treturn ok(applySqlSpecifierControlPolicy(interpreted.value, options.defaultControlPolicy, options.createNamespace));\n\t\t\t}\n\t\t},\n\t\toutput: options.output ?? defaultOutputFromSchemaPath(schemaPath)\n\t};\n}\n//#endregion\nexport { prismaContract };\n\n//# sourceMappingURL=provider.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,SAAS,4BAA4B,YAAY;CAChD,MAAM,MAAM,QAAQ,UAAU;CAC9B,IAAI,IAAI,WAAW,GAAG,OAAO,GAAG,WAAW;CAC3C,MAAM,OAAO,WAAW,MAAM,GAAG,CAAC,IAAI,MAAM;CAC5C,IAAI,SAAS,IAAI,MAAM,UAAU,OAAO,GAAG,KAAK,MAAM,GAAG,EAAE,EAAE;CAC7D,OAAO,GAAG,KAAK;AAChB;AACA,SAAS,oBAAoB,aAAa,YAAY,UAAU;CAC/D,OAAO,YAAY,KAAK,gBAAgB;EACvC,MAAM,WAAW;EACjB,SAAS,WAAW;EACpB;EACA,MAAM,eAAe,WAAW,OAAO,UAAU;CAClD,EAAE;AACH;AACA,SAAS,eAAe,YAAY,SAAS;CAC5C,OAAO;EACN,QAAQ;GACP,QAAQ;GACR,QAAQ,CAA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oB,KAAK,UAAU;KACtD;KACA;KACA;KACA,UAAU;IACX,GAAG,OAAO,GAAG,eAAe;IAC5B,IAAI,CAAC,YAAY,IAAI,OAAO;IAC5B,OAAO,GAAG,+BAA+B,YAAY,OAAO,QAAQ,sBAAsB,QAAQ,eAAe,CAAC;GACnH;EACD;EACA,QAAQ,QAAQ,UAAU,4BAA4B,UAAU;CACjE;AACD"}
|
|
@@ -10,7 +10,7 @@ import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
|
10
10
|
import { bool, entityRef, fieldAttribute, fieldRef, findBlockDescriptor, funcCall, identifier, interpretAttribute, keywordPslSpan, leafDiagnostic, list, modelAttribute, nodePslSpan, num, oneOf, optional, record, str } from "@prisma/orm-framework/psl-parser";
|
|
11
11
|
import { assertDefined, invariant } from "@prisma/orm-framework/utils/assertions";
|
|
12
12
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
13
|
-
//#region ../../../2-sql/2-authoring/contract-psl/dist/interpreter-
|
|
13
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/interpreter-RTglKUpM.mjs
|
|
14
14
|
function contractError(code, message, options) {
|
|
15
15
|
return structuredError(code, message, options);
|
|
16
16
|
}
|
|
@@ -2594,7 +2594,11 @@ function buildModelNodeFromPsl(input) {
|
|
|
2594
2594
|
if (node === void 0) continue;
|
|
2595
2595
|
const parsed = interpretModelAttribute({
|
|
2596
2596
|
node,
|
|
2597
|
-
spec: blindCast(contributedModelAttribute.spec)
|
|
2597
|
+
spec: blindCast(contributedModelAttribute.spec)({
|
|
2598
|
+
symbols: input.symbolTable,
|
|
2599
|
+
model,
|
|
2600
|
+
controlMutationDefaults: input.defaultFunctionRegistry
|
|
2601
|
+
}),
|
|
2598
2602
|
model,
|
|
2599
2603
|
sourceFile: input.sourceFile,
|
|
2600
2604
|
sourceId,
|
|
@@ -3677,4 +3681,4 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3677
3681
|
//#endregion
|
|
3678
3682
|
export { interpretPslDocumentToSqlContract as t };
|
|
3679
3683
|
|
|
3680
|
-
//# sourceMappingURL=interpreter-
|
|
3684
|
+
//# sourceMappingURL=interpreter-RTglKUpM-DUHChvJN.mjs.map
|