@prisma/orm-family-sql 8.0.0-rc.11-dev.30 → 8.0.0-rc.11-dev.32
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-prisma7__provider.mjs +2 -2
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- 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-CRJpMQRR-BjjPK_dV.mjs → interpreter-9Ru2E-MH-CQdWmnh8.mjs} +6 -6
- package/dist/interpreter-9Ru2E-MH-CQdWmnh8.mjs.map +1 -0
- package/package.json +18 -18
- package/dist/interpreter-CRJpMQRR-BjjPK_dV.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as applySqlSpecifierControlPolicy } from "./derived-checks-DGjY5t7S-DofD5V_2.mjs";
|
|
2
|
-
import { i as interpretPslDocumentToSqlContract } from "./interpreter-
|
|
2
|
+
import { i as interpretPslDocumentToSqlContract } from "./interpreter-9Ru2E-MH-CQdWmnh8.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 { n 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 { n as interpretPslDocumentToSqlContract } from \"./interpreter-9Ru2E-MH.mjs\";\nimport { buildSymbolTable, rangeToPslSpan } from \"@internal/psl-parser\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { applySqlSpecifierControlPolicy } from \"@internal/sql-contract-ts/contract-builder\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { readFile } from \"node:fs/promises\";\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,CAAC,UAAU;GACnB,UAAU,OAAO,SAAS;IACzB,MAAM,0BAA0B,8BAA8B,QAAQ,uBAAuB,IAAI;IACjG,OAAO,kCAAkC;KACxC,aAAa,MAAM;KACnB,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+BAA+B,YAAY,OAAO,QAAQ,sBAAsB,QAAQ,eAAe,CAAC;GACnH;EACD;EACA,QAAQ,QAAQ,UAAU,4BAA4B,UAAU;CACjE;AACD"}
|
|
@@ -15,7 +15,7 @@ import { assertDefined, invariant } from "@prisma/orm-framework/utils/assertions
|
|
|
15
15
|
import { describeTaggedLiteralFailure } from "@prisma/orm-framework/components/control";
|
|
16
16
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
17
17
|
import { consumeInvalidFkPairing, fkRelationPairKey, requiredOneToOneBackrelationDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
|
|
18
|
-
//#region ../../../2-sql/2-authoring/contract-psl/dist/interpreter-
|
|
18
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/interpreter-9Ru2E-MH.mjs
|
|
19
19
|
function contractError(code, message, options) {
|
|
20
20
|
return structuredError(code, message, options);
|
|
21
21
|
}
|
|
@@ -1909,22 +1909,22 @@ function isUnboundNamespaceBlock(ns, targetId) {
|
|
|
1909
1909
|
}
|
|
1910
1910
|
function validateNamespaceBlocksForSqlTarget(input) {
|
|
1911
1911
|
if (input.targetId === "sqlite") {
|
|
1912
|
-
for (const namespace of input.namespaces) input.diagnostics.push({
|
|
1912
|
+
for (const namespace of input.namespaces) for (const { span } of namespace.declarations) input.diagnostics.push({
|
|
1913
1913
|
code: "PSL_UNSUPPORTED_NAMESPACE_BLOCK",
|
|
1914
1914
|
message: `SQLite does not support \`namespace ${namespace.name} { … }\` blocks (SQLite has no schema concept; declare models at the document top level instead).`,
|
|
1915
1915
|
sourceId: input.sourceId,
|
|
1916
|
-
span
|
|
1916
|
+
span
|
|
1917
1917
|
});
|
|
1918
1918
|
return;
|
|
1919
1919
|
}
|
|
1920
1920
|
if (input.targetId === "postgres") {
|
|
1921
1921
|
const unboundBlock = input.namespaces.find((ns) => isUnboundNamespaceBlock(ns, input.targetId) && Object.keys(ns.models).length > 0);
|
|
1922
1922
|
const hasSibling = input.namespaces.some((ns) => !isUnboundNamespaceBlock(ns, input.targetId));
|
|
1923
|
-
if (unboundBlock !== void 0 && hasSibling) input.diagnostics.push({
|
|
1923
|
+
if (unboundBlock !== void 0 && hasSibling) for (const { span } of unboundBlock.declarations) input.diagnostics.push({
|
|
1924
1924
|
code: "PSL_RESERVED_NAMESPACE_NAME",
|
|
1925
1925
|
message: "Namespace \"unbound\" is reserved for the late-binding sentinel mapping; a `namespace unbound { … }` containing models cannot appear alongside other named namespace blocks. Use `namespace unbound { … }` alone (no sibling named namespaces) for late-binding multi-tenant contracts.",
|
|
1926
1926
|
sourceId: input.sourceId,
|
|
1927
|
-
span
|
|
1927
|
+
span
|
|
1928
1928
|
});
|
|
1929
1929
|
}
|
|
1930
1930
|
}
|
|
@@ -3590,4 +3590,4 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3590
3590
|
//#endregion
|
|
3591
3591
|
export { normalizeReferentialAction as a, interpretPslDocumentToSqlContract as i, buildEntityTypesByDiscriminator as n, numberLiteralDefault as o, indexFkRelations as r, resolveFieldTypeDescriptor as s, applyBackrelationCandidates as t };
|
|
3592
3592
|
|
|
3593
|
-
//# sourceMappingURL=interpreter-
|
|
3593
|
+
//# sourceMappingURL=interpreter-9Ru2E-MH-CQdWmnh8.mjs.map
|