@prisma/orm-family-sql 8.0.0-rc.17-dev.40 → 8.0.0-rc.17-dev.42
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 +14 -12
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__provider.mjs +3 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/{control-Bs-0JljW.d.mts → control-CkV_zSCA.d.mts} +2 -2
- package/dist/{control-Bs-0JljW.d.mts.map → control-CkV_zSCA.d.mts.map} +1 -1
- package/dist/family.d.mts +1 -1
- package/dist/family__control.d.mts +1 -1
- package/dist/{interpreter-0z4AxG0I-CM9DULu1.mjs → interpreter-BbopSq2f-y_JBQJFT.mjs} +77 -150
- package/dist/interpreter-BbopSq2f-y_JBQJFT.mjs.map +1 -0
- package/package.json +18 -18
- package/dist/interpreter-0z4AxG0I-CM9DULu1.mjs.map +0 -1
package/dist/contract-psl.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as interpretPslDocumentToSqlContract } from "./interpreter-
|
|
1
|
+
import { i as interpretPslDocumentToSqlContract } from "./interpreter-BbopSq2f-y_JBQJFT.mjs";
|
|
2
2
|
export { interpretPslDocumentToSqlContract };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as applySqlSpecifierControlPolicy } from "./derived-checks-CYz041Ol-TjL7rPxe.mjs";
|
|
2
|
-
import { i as interpretPslDocumentToSqlContract } from "./interpreter-
|
|
2
|
+
import { i as interpretPslDocumentToSqlContract } from "./interpreter-BbopSq2f-y_JBQJFT.mjs";
|
|
3
3
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
4
4
|
import { collectScalarTypeConstructors } from "@prisma/orm-framework/components/authoring";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
|
@@ -126,7 +126,8 @@ function prismaContract(schemaPath, options) {
|
|
|
126
126
|
const seedDiagnostics = [...readDiagnostics, ...mapPslDiagnostics(parsed.flatMap(({ diagnostics }) => diagnostics), sources)];
|
|
127
127
|
const { symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({
|
|
128
128
|
documents,
|
|
129
|
-
sources
|
|
129
|
+
sources,
|
|
130
|
+
defaultNamespaceId: context.defaultNamespaceId
|
|
130
131
|
});
|
|
131
132
|
const { binder, diagnostics: binderDiagnostics } = createBinder({
|
|
132
133
|
symbolTable,
|
|
@@ -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-BbopSq2f.mjs\";\nimport { buildSymbolTable, createBinder, isPrismaNextSchema, mapPslDiagnostics } from \"@internal/psl-parser\";\nimport { applySqlSpecifierControlPolicy } from \"@internal/sql-contract-ts/contract-builder\";\nimport { assertDefined } from \"@internal/utils/assertions\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { collectScalarTypeConstructors } from \"@internal/framework-components/authoring\";\nimport { withSeedDiagnostics } from \"@internal/psl-parser/interpret\";\nimport { parse } from \"@internal/psl-parser/syntax\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { readFile } from \"node:fs/promises\";\nimport { basename, extname } from \"pathe\";\nimport { isDynamicPattern } from \"tinyglobby\";\n//#region src/provider.ts\n/**\n* The directory portion of `pattern` before its first glob-magic segment,\n* joined back with `/` (e.g. a `prisma` directory holding a recursive\n* `.prisma` glob derives `./prisma`). A rootless pattern with no static\n* segments yields `''`.\n*/\nfunction staticPrefixDirectory(pattern) {\n\tconst staticSegments = [];\n\tfor (const segment of pattern.replaceAll(\"\\\\\", \"/\").split(\"/\")) {\n\t\tif (isDynamicPattern(segment)) break;\n\t\tstaticSegments.push(segment);\n\t}\n\treturn staticSegments.join(\"/\");\n}\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`). A glob-shaped path derives from its static\n* prefix directory instead (a recursive glob under `prisma` derives\n* `./prisma/contract.json`). The provider owns this because it is the only\n* 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\tif (isDynamicPattern(schemaPath)) {\n\t\tconst prefix = staticPrefixDirectory(schemaPath);\n\t\treturn prefix.length === 0 ? \"contract.json\" : `${prefix}/contract.json`;\n\t}\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 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\tdocuments: input.documents,\n\t\t\t\t\tsymbolTable: input.symbolTable,\n\t\t\t\t\tsources: input.sources,\n\t\t\t\t\tbinder: input.binder,\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\tdataTypes: context.dataTypes,\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 candidates = [...new Set(context.resolvedInputs)].sort();\n\t\t\t\tif (candidates.length === 0) return notOk({\n\t\t\t\t\tsummary: \"No schema files matched the configured contract source\",\n\t\t\t\t\tdiagnostics: [{\n\t\t\t\t\t\tcode: \"PSL_NO_SCHEMA_FILES_MATCHED\",\n\t\t\t\t\t\tmessage: `No files matched the configured pattern \"${schemaPath}\"`,\n\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t\tconst readDiagnostics = [];\n\t\t\t\tconst members = [];\n\t\t\t\tconst undirected = [];\n\t\t\t\tfor (const path of candidates) {\n\t\t\t\t\tlet text;\n\t\t\t\t\ttry {\n\t\t\t\t\t\ttext = await readFile(path, \"utf-8\");\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tconst message = String(error);\n\t\t\t\t\t\treadDiagnostics.push({\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: path\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif (isPrismaNextSchema(text)) members.push({\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\ttext\n\t\t\t\t\t});\n\t\t\t\t\telse undirected.push(path);\n\t\t\t\t}\n\t\t\t\tif (members.length === 0) {\n\t\t\t\t\tif (undirected.length === 0) return notOk({\n\t\t\t\t\t\tsummary: \"Failed to read Prisma schema files\",\n\t\t\t\t\t\tdiagnostics: readDiagnostics\n\t\t\t\t\t});\n\t\t\t\t\treturn notOk({\n\t\t\t\t\t\tsummary: \"No schema file carries the \\\"// use prisma-8\\\" directive\",\n\t\t\t\t\t\tdiagnostics: [...readDiagnostics, {\n\t\t\t\t\t\t\tcode: \"PSL_NO_OPTED_IN_SCHEMA_FILES\",\n\t\t\t\t\t\t\tmessage: `None of the matched files carry the \"// use prisma-8\" directive: ${undirected.join(\", \")}`,\n\t\t\t\t\t\t\tsourceId: schemaPath\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst parsed = members.map(({ path, text }) => parse(text, path));\n\t\t\t\tconst documents = parsed.map(({ document }) => document);\n\t\t\t\tconst [firstSources, ...restSources] = parsed.map(({ sources }) => sources);\n\t\t\t\tassertDefined(firstSources, \"prismaContract requires at least one parsed schema file\");\n\t\t\t\tconst sources = firstSources.merge(...restSources);\n\t\t\t\tconst seedDiagnostics = [...readDiagnostics, ...mapPslDiagnostics(parsed.flatMap(({ diagnostics }) => diagnostics), sources)];\n\t\t\t\tconst { symbolTable, diagnostics: symbolTableDiagnostics } = buildSymbolTable({\n\t\t\t\t\tdocuments,\n\t\t\t\t\tsources,\n\t\t\t\t\tdefaultNamespaceId: context.defaultNamespaceId\n\t\t\t\t});\n\t\t\t\tconst { binder, diagnostics: binderDiagnostics } = createBinder({\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tsources,\n\t\t\t\t\tcontext\n\t\t\t\t});\n\t\t\t\tconst interpreted = withSeedDiagnostics(this.interpret({\n\t\t\t\t\tdocuments,\n\t\t\t\t\tsources,\n\t\t\t\t\tsymbolTable,\n\t\t\t\t\tbinder\n\t\t\t\t}, context), [...seedDiagnostics, ...mapPslDiagnostics([...symbolTableDiagnostics, ...binderDiagnostics], sources)]);\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,sBAAsB,SAAS;CACvC,MAAM,iBAAiB,CAAC;CACxB,KAAK,MAAM,WAAW,QAAQ,WAAW,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,GAAG;EAC/D,IAAI,iBAAiB,OAAO,GAAG;EAC/B,eAAe,KAAK,OAAO;CAC5B;CACA,OAAO,eAAe,KAAK,GAAG;AAC/B;;;;;;;;;;AAUA,SAAS,4BAA4B,YAAY;CAChD,IAAI,iBAAiB,UAAU,GAAG;EACjC,MAAM,SAAS,sBAAsB,UAAU;EAC/C,OAAO,OAAO,WAAW,IAAI,kBAAkB,GAAG,OAAO;CAC1D;CACA,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,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,WAAW,MAAM;KACjB,aAAa,MAAM;KACnB,SAAS,MAAM;KACf,QAAQ,MAAM;KACd,iBAAiB,CAAC;KAClB,QAAQ,QAAQ;KAChB,wBAAwB,QAAQ;KAChC;KACA,GAAG,UAAU,sBAAsB,QAAQ,mBAAmB,SAAS,IAAI,CAAC,GAAG,QAAQ,kBAAkB,IAAI,KAAK,CAAC;KACnH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EAAE,eAAe,QAAQ;IACvD,MAAM,CAAC,cAAc,GAAG,eAAe,OAAO,KAAK,EAAE,cAAc,OAAO;IAC1E,cAAc,cAAc,yDAAyD;IACrF,MAAM,UAAU,aAAa,MAAM,GAAG,WAAW;IACjD,MAAM,kBAAkB,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,OAAO,SAAS,EAAE,kBAAkB,WAAW,GAAG,OAAO,CAAC;IAC5H,MAAM,EAAE,aAAa,aAAa,2BAA2B,iBAAiB;KAC7E;KACA;KACA,oBAAoB,QAAQ;IAC7B,CAAC;IACD,MAAM,EAAE,QAAQ,aAAa,sBAAsB,aAAa;KAC/D;KACA;KACA;IACD,CAAC;IACD,MAAM,cAAc,oBAAoB,KAAK,UAAU;KACtD;KACA;KACA;KACA;IACD,GAAG,OAAO,GAAG,CAAC,GAAG,iBAAiB,GAAG,kBAAkB,CAAC,GAAG,wBAAwB,GAAG,iBAAiB,GAAG,OAAO,CAAC,CAAC;IACnH,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"}
|
|
@@ -23,8 +23,8 @@ import { ColumnDefault, Contract, ContractWithDomain, ControlPolicy } from "@pri
|
|
|
23
23
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
24
24
|
import { NotOk, Ok, Result } from "@prisma/orm-framework/utils/result";
|
|
25
25
|
import { AppliedMigrationStatement, AssembledAuthoringContributions, ContractSerializer, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, DiffSubjectGranularity, FailedTypeChange, FieldCoordinate, ImportRequirement, MigratableTargetDescriptor, MigrationDataLossKind, MigrationOperationClass, MigrationOperationClass as MigrationOperationClass$1, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan as MigrationPlan$1, MigrationPlanOperation, MigrationPlanOperation as MigrationPlanOperation$1, MigrationPlanSubjects, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, MigrationSubject, ModelCoordinate, OpFactoryCall, OperationPreview, OperationPreviewCapable, PslContractBuildCapable, PslContractInferCapable, ResolvedFieldRenameStatement, ResolvedMigrationStatement, ResolvedModelRenameStatement, ResolvedRenameStatement, RowsWithoutValue, SchemaDiffIssue, SchemaVerifier, SchemaViewCapable, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseSchemaResult, assembleAuthoringContributions } from "@prisma/orm-framework/components/control";
|
|
26
|
-
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
27
26
|
import { EmissionSpi, TypesImportSpec } from "@prisma/orm-framework/components/emission";
|
|
27
|
+
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
28
28
|
//#region ../../../2-sql/9-family/dist/control.d.mts
|
|
29
29
|
//#region src/core/control-instance.d.ts
|
|
30
30
|
interface SqlFamilyInstanceState {
|
|
@@ -1383,4 +1383,4 @@ declare function temporalCodecPresetWithPrecision<const CodecId extends string,
|
|
|
1383
1383
|
declare const _default: SqlFamilyDescriptor;
|
|
1384
1384
|
//#endregion
|
|
1385
1385
|
export { backfillOfDefaultedField as $, SchemaTables as A, rowsWithoutValueFailure as At, StatementColumn as B, temporalStringAuthoringPresets as Bt, ModelStorageEffect as C, plannerFailure as Ct, PlannedStatements as D, requiredColumnsOfMigration as Dt, PlanFieldEventOperationsOptions as E, requiredColumnOf as Et, SqlPslBuildContext as F, sqlOfSlot as Ft, TableNameCaseGuardTable as G, SubjectStorage as H, unknownCallNames as Ht, SqlQuote as I, sqlTypeLookupsOf as It, TableRenameRequest as J, TableRename as K, SqlQuotingRules as L, storageNameOfOperation as Lt, SqlControlFamilyInstance as M, runnerFailure as Mt, SqlControlTargetDescriptor as N, runnerSuccess as Nt, RequiredColumn as O, resolveColumnRenameAgainst as Ot, SqlDescribedContractSpace as P, slotSource as Pt, assembleAuthoringContributions as Q, SqlSlot as R, subjectsOfCalls as Rt, MigrationPlannerResult as S, planStatements as St, NoTable as T, requiredColumnMeta as Tt, SuppressionRecord as U, unmatchedColumnRename as Ut, StatementPlanningTarget as V, unconvertedFieldOf as Vt, TABLE_NAME_CASE_CHANGED_CODE as W, unmatchedTableRename as Wt, _default as X, TargetMigrationsCapability as Y, appliedStatementsInOrder as Z, MigrationOperationPolicy$1 as _, modelRenameStorageEffect as _t, ColumnRename as a, convertedColumnMeta as at, MigrationPlanner as b, planFieldEventCalls as bt, ControlPolicySubject as c, createSqlTextSources as ct, DefaultResolver as d, extractCodecControlHooks as dt, checkSqlExpressionText as et, FieldEventCall as f, fieldEventStorage as ft, MigrationOperationClass$1 as g, isUnfilledSlot as gt, INIT_ADDITIVE_POLICY as h, fieldStatementColumns as ht, ColumnOnOneSide as i, controlPolicyForCall as it, SingleOperationCall as j, rowsWithoutValueSummary as jt, RequiredColumnMark as k, resolveTableRenameAgainst as kt, ConvertedColumn as l, detectDestructiveChanges as lt, FieldStorageEffect as m, fieldRenameStorageEffect as mt, CallSubjects as n, contractNamespaceToSchemaIR as nt, ColumnRenameRequest as o, convertedColumnOf as ot, FieldStatementColumns as p, fieldOfColumn as pt, TableRenameByHand as q, CallWithCompanions as r, contractToSchemaIR as rt, ContractToSchemaIROptions as s, createMigrationPlan as st, COLUMN_RENAME_UNMATCHED_CODE as t, columnTakesTemporaryValue as tt, DefaultRenderer as u, detectTableNameCaseChanges as ut, MigrationPlan$1 as v, partitionCallsByControlPolicy as vt, ModelTable as w, plannerSuccess as wt, MigrationPlannerConflict$1 as x, planFieldEventOperations as xt, MigrationPlanOperation$1 as y, partitionIssuesByControlPolicy as yt, SqlTextSources as z, temporalCodecPresetWithPrecision as zt };
|
|
1386
|
-
//# sourceMappingURL=control-
|
|
1386
|
+
//# sourceMappingURL=control-CkV_zSCA.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-
|
|
1
|
+
{"version":3,"file":"control-CkV_zSCA.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/control.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAoBU;WACC,kBAAkB,cAAc;WAChC,cAAc;;UAEf,iCAAiC,6BAA6B,kBAAkB,kBAAkB,kBAAkB,wBAAwB,kBAAkB,wBAAwB,SAAS,cAAc,yBAAyB;;;;;;;;;EAS9O,oBAAoB,wBAAwB;EAC5C,OAAO;aACI,QAAQ;aACR;aACA;aACA;aACA;MACP,QAAQ;;;;;;;;;;EAUZ,aAAa;aACF;aACA,QAAQ;aACR;aACA,qBAAqB,cAAc;MAC1C;;;;;;;;;;EAUJ,2BAA2B,OAAO,kBAAkB;;;;;;;;EAQpD,mBAAmB,OAAO;EAC1B,WAAW;aACA,QAAQ;aACR;MACP,QAAQ;EACZ,iBAAiB,UAAU,kBAAkB;EAC7C,SAAS,KAAK,cAAc,SAAS,SAAS,0BAA0B,QAAQ;;;;;;EAMhF,WAAW;aACA,QAAQ;aACR;aACA;eACE;eACA;eACA;;MAET;;;;;EAKJ,aAAa;aACF,QAAQ;aACR;aACA;aACA;eACE;eACA;eACA;;MAET;;;;;EAKJ,iBAAiB;aACN,QAAQ;aACR;aACA;eACE;eACA;eACA;eACA;eACA;eACA;eACA;;MAET;EACJ,yCAAyC;EACzC,mBAAmB,qBAAqB,2BAA6B;EACrE,cAAc,WAAW;;;;cAIb,+BAA+B,+BAA+B;WACjE;WACA;WACA;WACA;WACA,UAAU;WACV,oBAAoB;WACpB;aACE;eACE;iBACE;iBACA;mBACE;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;mBACA;qBACE;uBACE;uBACA;uBACA;uBACA;uBACA;;;;iBAIN;mBACE;mBACA;qBACE;uBACE;uBACA;uBACA;uBACA;;;;;eAKR;iBACE;iBACA;mBACE;mBACA;qBACE;;;;eAIN;iBACE;iBACA;mBACE;mBACA;qBACE;;;;eAIN;iBACE;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;qBACA;uBACE;yBACE;yBACA;yBACA;yBACA;yBACA;;;;mBAIN;qBACE;qBACA;uBACE;yBACE;yBACA;yBACA;yBACA;;;qBAGJ;uBACE;yBACE;yBACA;yBACA;2BACE;6BACE;6BACA;6BACA;;;;;qBAKR;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;iBAGJ;mBACE;mBACA;qBACE;qBACA;uBACE;;qBAEF;uBACE;yBACE;yBACA;;;qBAGJ;;;;;aAKR;eACE;iBACE;mBACE;mBACA;mBACA;qBACE;qBACA;qBACA;;mBAEF;qBACE;qBACA;uBACE;yBACE;yBACA;;;;;;;aAOZ,gEAAgE;aAChE;eACE;QACP;QACA;QACA;QACA;QACA;UACE;;QAEF,aAAa;QACb;UACE,2CAA2C;YACzC;4CACgC;;;;aAI/B;eACE;iBACE,MAAM,qCAAqC,wDAAwD;UAC1G;0CACgC;iBACzB,KAAK,qCAAqC,wDAAwD;UACzG;mBACS;0CACuB;iBACzB,SAAS,qCAAqC,wDAAwD;UAC7G;mBACS;0CACuB;iBACzB,QAAQ,oCAAoC,wDAAwD;UAC3G;mBACS,4CAA4C;mBAC5C,uCAAuC;mBACvC;mBACA;mBACA;mBACA;mBACA,UAAU;0CACa;iBACzB,QAAQ,oCAAoC,wDAAwD;mBAClG,2CAA2C;mBAC3C;mBACA;0CACuB;iBACzB,UAAU,qCAAqC,wDAAwD;UAC9G;0CACgC;iBACzB,g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SAAS;WACT,cAAc;;WAEd;WACA;aACE;aACA;aACA;aACA;;aAEA;aACA;aACA;aACA;;aAEA;aACA;aACA;aACA;;WAEF;aACE,SAAS;aACT;eACE;iBACE;iBACA;;;aAGJ;eACE;iBACE;iBACA;iBACA;mBACE;qBACE;qBACA,qBAAqB;;;;eAI3B;iBACE;iBACA;iBACA;mBACE;qBACE;qBACA,qBAAqB;;;;;;;;;cAS5B,UAAU"}
|
package/dist/family.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { h as checkSqlDefaultText } from "./validators-CudqzmkF.mjs";
|
|
|
3
3
|
import { a as arraysEqual, n as Lowerer, r as SqlControlAdapter, t as ExecuteRequestLowerer } from "./control-adapter-CkFfBVei-DH5DAObc.mjs";
|
|
4
4
|
import { A as StorageTypePlanResult, C as SqlPlanTargetDetails, D as SqlPlannerFailureResult, E as SqlPlannerConflictLocation, O as SqlPlannerResult, S as SqlMigrationRunnerSuccessValue, T as SqlPlannerConflictKind, _ as SqlMigrationRunnerErrorCode, a as FieldEventContext, b as SqlMigrationRunnerFailure, c as SqlControlExtensionDescriptor, d as SqlMigrationPlanOperation, f as SqlMigrationPlanOperationStep, g as SqlMigrationRunner, h as SqlMigrationPlannerPlanOptions, i as FieldEvent, k as SqlPlannerSuccessResult, l as SqlMigrationPlan, m as SqlMigrationPlanner, n as CodecControlHooks, o as ResolveIdentityValueInput, p as SqlMigrationPlanOperationTarget, r as CreateSqlMigrationPlanOptions, s as SqlControlAdapterDescriptor, u as SqlMigrationPlanContractInfo, v as SqlMigrationRunnerExecuteCallbacks, w as SqlPlannerConflict, x as SqlMigrationRunnerResult, y as SqlMigrationRunnerExecuteOptions } from "./types-CzxOObSY-BxwvvyRZ.mjs";
|
|
5
5
|
import { n as SqlSchemaDiffInput, r as SqlSchemaDiffResult, t as SqlSchemaDiffFn } from "./schema-differ-CqWOkoW9-DQkzKV8b.mjs";
|
|
6
|
-
import { $ as backfillOfDefaultedField, A as SchemaTables, At as rowsWithoutValueFailure, B as StatementColumn, Bt as temporalStringAuthoringPresets, C as ModelStorageEffect, Ct as plannerFailure, D as PlannedStatements, Dt as requiredColumnsOfMigration, E as PlanFieldEventOperationsOptions, Et as requiredColumnOf, F as SqlPslBuildContext, Ft as sqlOfSlot, G as TableNameCaseGuardTable, H as SubjectStorage, Ht as unknownCallNames, I as SqlQuote, It as sqlTypeLookupsOf, J as TableRenameRequest, K as TableRename, L as SqlQuotingRules, Lt as storageNameOfOperation, M as SqlControlFamilyInstance, Mt as runnerFailure, N as SqlControlTargetDescriptor, Nt as runnerSuccess, O as RequiredColumn, Ot as resolveColumnRenameAgainst, P as SqlDescribedContractSpace, Pt as slotSource, Q as assembleAuthoringContributions, R as SqlSlot, Rt as subjectsOfCalls, S as MigrationPlannerResult, St as planStatements, T as NoTable, Tt as requiredColumnMeta, U as SuppressionRecord, Ut as unmatchedColumnRename, V as StatementPlanningTarget, Vt as unconvertedFieldOf, W as TABLE_NAME_CASE_CHANGED_CODE, Wt as unmatchedTableRename, Y as TargetMigrationsCapability, Z as appliedStatementsInOrder, _ as MigrationOperationPolicy, _t as modelRenameStorageEffect, a as ColumnRename, at as convertedColumnMeta, b as MigrationPlanner, bt as planFieldEventCalls, c as ControlPolicySubject, ct as createSqlTextSources, d as DefaultResolver, dt as extractCodecControlHooks, et as checkSqlExpressionText, f as FieldEventCall, ft as fieldEventStorage, g as MigrationOperationClass, gt as isUnfilledSlot, h as INIT_ADDITIVE_POLICY, ht as fieldStatementColumns, i as ColumnOnOneSide, it as controlPolicyForCall, j as SingleOperationCall, jt as rowsWithoutValueSummary, k as RequiredColumnMark, kt as resolveTableRenameAgainst, l as ConvertedColumn, lt as detectDestructiveChanges, m as FieldStorageEffect, mt as fieldRenameStorageEffect, n as CallSubjects, nt as contractNamespaceToSchemaIR, o as ColumnRenameRequest, ot as convertedColumnOf, p as FieldStatementColumns, pt as fieldOfColumn, q as TableRenameByHand, r as CallWithCompanions, rt as contractToSchemaIR, s as ContractToSchemaIROptions, st as createMigrationPlan, t as COLUMN_RENAME_UNMATCHED_CODE, tt as columnTakesTemporaryValue, u as DefaultRenderer, ut as detectTableNameCaseChanges, v as MigrationPlan, vt as partitionCallsByControlPolicy, w as ModelTable, wt as plannerSuccess, x as MigrationPlannerConflict, xt as planFieldEventOperations, y as MigrationPlanOperation, yt as partitionIssuesByControlPolicy, z as SqlTextSources, zt as temporalCodecPresetWithPrecision } from "./control-
|
|
6
|
+
import { $ as backfillOfDefaultedField, A as SchemaTables, At as rowsWithoutValueFailure, B as StatementColumn, Bt as temporalStringAuthoringPresets, C as ModelStorageEffect, Ct as plannerFailure, D as PlannedStatements, Dt as requiredColumnsOfMigration, E as PlanFieldEventOperationsOptions, Et as requiredColumnOf, F as SqlPslBuildContext, Ft as sqlOfSlot, G as TableNameCaseGuardTable, H as SubjectStorage, Ht as unknownCallNames, I as SqlQuote, It as sqlTypeLookupsOf, J as TableRenameRequest, K as TableRename, L as SqlQuotingRules, Lt as storageNameOfOperation, M as SqlControlFamilyInstance, Mt as runnerFailure, N as SqlControlTargetDescriptor, Nt as runnerSuccess, O as RequiredColumn, Ot as resolveColumnRenameAgainst, P as SqlDescribedContractSpace, Pt as slotSource, Q as assembleAuthoringContributions, R as SqlSlot, Rt as subjectsOfCalls, S as MigrationPlannerResult, St as planStatements, T as NoTable, Tt as requiredColumnMeta, U as SuppressionRecord, Ut as unmatchedColumnRename, V as StatementPlanningTarget, Vt as unconvertedFieldOf, W as TABLE_NAME_CASE_CHANGED_CODE, Wt as unmatchedTableRename, Y as TargetMigrationsCapability, Z as appliedStatementsInOrder, _ as MigrationOperationPolicy, _t as modelRenameStorageEffect, a as ColumnRename, at as convertedColumnMeta, b as MigrationPlanner, bt as planFieldEventCalls, c as ControlPolicySubject, ct as createSqlTextSources, d as DefaultResolver, dt as extractCodecControlHooks, et as checkSqlExpressionText, f as FieldEventCall, ft as fieldEventStorage, g as MigrationOperationClass, gt as isUnfilledSlot, h as INIT_ADDITIVE_POLICY, ht as fieldStatementColumns, i as ColumnOnOneSide, it as controlPolicyForCall, j as SingleOperationCall, jt as rowsWithoutValueSummary, k as RequiredColumnMark, kt as resolveTableRenameAgainst, l as ConvertedColumn, lt as detectDestructiveChanges, m as FieldStorageEffect, mt as fieldRenameStorageEffect, n as CallSubjects, nt as contractNamespaceToSchemaIR, o as ColumnRenameRequest, ot as convertedColumnOf, p as FieldStatementColumns, pt as fieldOfColumn, q as TableRenameByHand, r as CallWithCompanions, rt as contractToSchemaIR, s as ContractToSchemaIROptions, st as createMigrationPlan, t as COLUMN_RENAME_UNMATCHED_CODE, tt as columnTakesTemporaryValue, u as DefaultRenderer, ut as detectTableNameCaseChanges, v as MigrationPlan, vt as partitionCallsByControlPolicy, w as ModelTable, wt as plannerSuccess, x as MigrationPlannerConflict, xt as planFieldEventOperations, y as MigrationPlanOperation, yt as partitionIssuesByControlPolicy, z as SqlTextSources, zt as temporalCodecPresetWithPrecision } from "./control-CkV_zSCA.mjs";
|
|
7
7
|
import "./control-adapter-DB7MPI5L.mjs";
|
|
8
8
|
import { a as VerifySqlSchemaByDiffInput, c as computeSqlDiffVerdict, i as StorageTypeVerdictInput, l as computeStorageTypeVerdict, n as SqlDiffVerdictInput, o as classifyDiffSubjectGranularity, r as StorageTypeVerdict, s as classifySqlDiffIssue, t as SqlDiffVerdict, u as verifySqlSchemaByDiff } from "./diff-C-18M6Ii.mjs";
|
|
9
9
|
import { i as SqlSchemaVerifierBase, n as SqlContractSerializerBase, r as SqlEntityHydrationFactory, t as SqlContractSerializer } from "./ir-OBn7ct21.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as checkSqlDefaultText } from "./validators-CudqzmkF.mjs";
|
|
2
2
|
import { A as StorageTypePlanResult, C as SqlPlanTargetDetails, D as SqlPlannerFailureResult, E as SqlPlannerConflictLocation, O as SqlPlannerResult, S as SqlMigrationRunnerSuccessValue, T as SqlPlannerConflictKind, _ as SqlMigrationRunnerErrorCode, a as FieldEventContext, b as SqlMigrationRunnerFailure, c as SqlControlExtensionDescriptor, d as SqlMigrationPlanOperation, f as SqlMigrationPlanOperationStep, g as SqlMigrationRunner, h as SqlMigrationPlannerPlanOptions, i as FieldEvent, k as SqlPlannerSuccessResult, l as SqlMigrationPlan, m as SqlMigrationPlanner, n as CodecControlHooks, o as ResolveIdentityValueInput, p as SqlMigrationPlanOperationTarget, r as CreateSqlMigrationPlanOptions, s as SqlControlAdapterDescriptor, u as SqlMigrationPlanContractInfo, v as SqlMigrationRunnerExecuteCallbacks, w as SqlPlannerConflict, x as SqlMigrationRunnerResult, y as SqlMigrationRunnerExecuteOptions } from "./types-CzxOObSY-BxwvvyRZ.mjs";
|
|
3
3
|
import { n as SqlSchemaDiffInput, r as SqlSchemaDiffResult, t as SqlSchemaDiffFn } from "./schema-differ-CqWOkoW9-DQkzKV8b.mjs";
|
|
4
|
-
import { $ as backfillOfDefaultedField, A as SchemaTables, At as rowsWithoutValueFailure, B as StatementColumn, Bt as temporalStringAuthoringPresets, C as ModelStorageEffect, Ct as plannerFailure, D as PlannedStatements, Dt as requiredColumnsOfMigration, E as PlanFieldEventOperationsOptions, Et as requiredColumnOf, F as SqlPslBuildContext, Ft as sqlOfSlot, G as TableNameCaseGuardTable, H as SubjectStorage, Ht as unknownCallNames, I as SqlQuote, It as sqlTypeLookupsOf, J as TableRenameRequest, K as TableRename, L as SqlQuotingRules, Lt as storageNameOfOperation, M as SqlControlFamilyInstance, Mt as runnerFailure, N as SqlControlTargetDescriptor, Nt as runnerSuccess, O as RequiredColumn, Ot as resolveColumnRenameAgainst, P as SqlDescribedContractSpace, Pt as slotSource, Q as assembleAuthoringContributions, R as SqlSlot, Rt as subjectsOfCalls, S as MigrationPlannerResult, St as planStatements, T as NoTable, Tt as requiredColumnMeta, U as SuppressionRecord, Ut as unmatchedColumnRename, V as StatementPlanningTarget, Vt as unconvertedFieldOf, W as TABLE_NAME_CASE_CHANGED_CODE, Wt as unmatchedTableRename, X as _default, Y as TargetMigrationsCapability, Z as appliedStatementsInOrder, _ as MigrationOperationPolicy, _t as modelRenameStorageEffect, a as ColumnRename, at as convertedColumnMeta, b as MigrationPlanner, bt as planFieldEventCalls, c as ControlPolicySubject, ct as createSqlTextSources, d as DefaultResolver, dt as extractCodecControlHooks, et as checkSqlExpressionText, f as FieldEventCall, ft as fieldEventStorage, g as MigrationOperationClass, gt as isUnfilledSlot, h as INIT_ADDITIVE_POLICY, ht as fieldStatementColumns, i as ColumnOnOneSide, it as controlPolicyForCall, j as SingleOperationCall, jt as rowsWithoutValueSummary, k as RequiredColumnMark, kt as resolveTableRenameAgainst, l as ConvertedColumn, lt as detectDestructiveChanges, m as FieldStorageEffect, mt as fieldRenameStorageEffect, n as CallSubjects, nt as contractNamespaceToSchemaIR, o as ColumnRenameRequest, ot as convertedColumnOf, p as FieldStatementColumns, pt as fieldOfColumn, q as TableRenameByHand, r as CallWithCompanions, rt as contractToSchemaIR, s as ContractToSchemaIROptions, st as createMigrationPlan, t as COLUMN_RENAME_UNMATCHED_CODE, tt as columnTakesTemporaryValue, u as DefaultRenderer, ut as detectTableNameCaseChanges, v as MigrationPlan, vt as partitionCallsByControlPolicy, w as ModelTable, wt as plannerSuccess, x as MigrationPlannerConflict, xt as planFieldEventOperations, y as MigrationPlanOperation, yt as partitionIssuesByControlPolicy, z as SqlTextSources, zt as temporalCodecPresetWithPrecision } from "./control-
|
|
4
|
+
import { $ as backfillOfDefaultedField, A as SchemaTables, At as rowsWithoutValueFailure, B as StatementColumn, Bt as temporalStringAuthoringPresets, C as ModelStorageEffect, Ct as plannerFailure, D as PlannedStatements, Dt as requiredColumnsOfMigration, E as PlanFieldEventOperationsOptions, Et as requiredColumnOf, F as SqlPslBuildContext, Ft as sqlOfSlot, G as TableNameCaseGuardTable, H as SubjectStorage, Ht as unknownCallNames, I as SqlQuote, It as sqlTypeLookupsOf, J as TableRenameRequest, K as TableRename, L as SqlQuotingRules, Lt as storageNameOfOperation, M as SqlControlFamilyInstance, Mt as runnerFailure, N as SqlControlTargetDescriptor, Nt as runnerSuccess, O as RequiredColumn, Ot as resolveColumnRenameAgainst, P as SqlDescribedContractSpace, Pt as slotSource, Q as assembleAuthoringContributions, R as SqlSlot, Rt as subjectsOfCalls, S as MigrationPlannerResult, St as planStatements, T as NoTable, Tt as requiredColumnMeta, U as SuppressionRecord, Ut as unmatchedColumnRename, V as StatementPlanningTarget, Vt as unconvertedFieldOf, W as TABLE_NAME_CASE_CHANGED_CODE, Wt as unmatchedTableRename, X as _default, Y as TargetMigrationsCapability, Z as appliedStatementsInOrder, _ as MigrationOperationPolicy, _t as modelRenameStorageEffect, a as ColumnRename, at as convertedColumnMeta, b as MigrationPlanner, bt as planFieldEventCalls, c as ControlPolicySubject, ct as createSqlTextSources, d as DefaultResolver, dt as extractCodecControlHooks, et as checkSqlExpressionText, f as FieldEventCall, ft as fieldEventStorage, g as MigrationOperationClass, gt as isUnfilledSlot, h as INIT_ADDITIVE_POLICY, ht as fieldStatementColumns, i as ColumnOnOneSide, it as controlPolicyForCall, j as SingleOperationCall, jt as rowsWithoutValueSummary, k as RequiredColumnMark, kt as resolveTableRenameAgainst, l as ConvertedColumn, lt as detectDestructiveChanges, m as FieldStorageEffect, mt as fieldRenameStorageEffect, n as CallSubjects, nt as contractNamespaceToSchemaIR, o as ColumnRenameRequest, ot as convertedColumnOf, p as FieldStatementColumns, pt as fieldOfColumn, q as TableRenameByHand, r as CallWithCompanions, rt as contractToSchemaIR, s as ContractToSchemaIROptions, st as createMigrationPlan, t as COLUMN_RENAME_UNMATCHED_CODE, tt as columnTakesTemporaryValue, u as DefaultRenderer, ut as detectTableNameCaseChanges, v as MigrationPlan, vt as partitionCallsByControlPolicy, w as ModelTable, wt as plannerSuccess, x as MigrationPlannerConflict, xt as planFieldEventOperations, y as MigrationPlanOperation, yt as partitionIssuesByControlPolicy, z as SqlTextSources, zt as temporalCodecPresetWithPrecision } from "./control-CkV_zSCA.mjs";
|
|
5
5
|
export { COLUMN_RENAME_UNMATCHED_CODE, type CallSubjects, type CallWithCompanions, type CodecControlHooks, type ColumnOnOneSide, type ColumnRename, type ColumnRenameRequest, type ContractToSchemaIROptions, type ControlPolicySubject, type ConvertedColumn, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type DefaultResolver, type FieldEvent, type FieldEventCall, type FieldEventContext, type FieldStatementColumns, type FieldStorageEffect, INIT_ADDITIVE_POLICY, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerResult, type ModelStorageEffect, type ModelTable, type NoTable, type PlanFieldEventOperationsOptions, type PlannedStatements, type RequiredColumn, type RequiredColumnMark, type ResolveIdentityValueInput, type SchemaTables, type SingleOperationCall, type SqlControlAdapterDescriptor, type SqlControlExtensionDescriptor, type SqlControlFamilyInstance, type SqlControlTargetDescriptor, type SqlDescribedContractSpace, type SqlMigrationPlan, type SqlMigrationPlanContractInfo, type SqlMigrationPlanOperation, type SqlMigrationPlanOperationStep, type SqlMigrationPlanOperationTarget, type SqlMigrationPlanner, type SqlMigrationPlannerPlanOptions, type SqlMigrationRunner, type SqlMigrationRunnerErrorCode, type SqlMigrationRunnerExecuteCallbacks, type SqlMigrationRunnerExecuteOptions, type SqlMigrationRunnerFailure, type SqlMigrationRunnerResult, type SqlMigrationRunnerSuccessValue, type SqlPlanTargetDetails, type SqlPlannerConflict, type SqlPlannerConflictKind, type SqlPlannerConflictLocation, type SqlPlannerFailureResult, type SqlPlannerResult, type SqlPlannerSuccessResult, type SqlPslBuildContext, type SqlQuote, type SqlQuotingRules, type SqlSchemaDiffFn, type SqlSchemaDiffInput, type SqlSchemaDiffResult, type SqlSlot, type SqlTextSources, type StatementColumn, type StatementPlanningTarget, type StorageTypePlanResult, type SubjectStorage, type SuppressionRecord, TABLE_NAME_CASE_CHANGED_CODE, type TableNameCaseGuardTable, type TableRename, type TableRenameByHand, type TableRenameRequest, type TargetMigrationsCapability, appliedStatementsInOrder, assembleAuthoringContributions, backfillOfDefaultedField, checkSqlDefaultText, checkSqlExpressionText, columnTakesTemporaryValue, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, convertedColumnMeta, convertedColumnOf, createMigrationPlan, createSqlTextSources, _default as default, detectDestructiveChanges, detectTableNameCaseChanges, extractCodecControlHooks, fieldEventStorage, fieldOfColumn, fieldRenameStorageEffect, fieldStatementColumns, isUnfilledSlot, modelRenameStorageEffect, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventCalls, planFieldEventOperations, planStatements, plannerFailure, plannerSuccess, requiredColumnMeta, requiredColumnOf, requiredColumnsOfMigration, resolveColumnRenameAgainst, resolveTableRenameAgainst, rowsWithoutValueFailure, rowsWithoutValueSummary, runnerFailure, runnerSuccess, slotSource, sqlOfSlot, sqlTypeLookupsOf, storageNameOfOperation, subjectsOfCalls, temporalCodecPresetWithPrecision, temporalStringAuthoringPresets, unconvertedFieldOf, unknownCallNames, unmatchedColumnRename, unmatchedTableRename };
|
|
@@ -20,8 +20,7 @@ import { assertDefined, invariant } from "@prisma/orm-framework/utils/assertions
|
|
|
20
20
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
21
21
|
import { contributedTypeOf, createPslDiagnosticCollector, diagnosticSource, findBlockDescriptor, interpretExtensionBlocks, nodePslSpan, typeReferenceNode } from "@prisma/orm-framework/psl-parser";
|
|
22
22
|
import { claimedBlockKeywords, enumMemberAttributeDiagnostics, fkRelationPairKey, requiredOneToOneBackrelationDiagnostic, unsupportedBlockDiagnostic } from "@prisma/orm-framework/psl-parser/interpret";
|
|
23
|
-
|
|
24
|
-
//#region ../../../2-sql/2-authoring/contract-psl/dist/interpreter-0z4AxG0I.mjs
|
|
23
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/interpreter-BbopSq2f.mjs
|
|
25
24
|
function baseColumnDescriptor(resolution, enumTypeDescriptors) {
|
|
26
25
|
if (resolution?.kind === "block") return enumTypeDescriptors.get(resolution.symbol);
|
|
27
26
|
const scalar = bareTypeConstructorOf(resolution);
|
|
@@ -474,85 +473,37 @@ function compareStrings(left, right) {
|
|
|
474
473
|
if (left > right) return 1;
|
|
475
474
|
return 0;
|
|
476
475
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
* block) is the only namespace SQLite accepts.
|
|
485
|
-
* - **Postgres** accepts every explicit block — `namespace unbound { … }`
|
|
486
|
-
* is the late-binding opt-in (lowers to the IR `__unbound__` slot in
|
|
487
|
-
* a follow-on commit), `namespace public { … }` reopen-merges with
|
|
488
|
-
* the implicit bucket, and any other name lowers to a named schema.
|
|
489
|
-
*
|
|
490
|
-
* Storage-side lowering of these buckets to IR namespace slots is not
|
|
491
|
-
* yet wired; this helper closes only the diagnostic surface.
|
|
492
|
-
*/
|
|
493
|
-
/**
|
|
494
|
-
* Per-target namespace lowering: map a PSL AST namespace bucket name to the
|
|
495
|
-
* resolved IR namespace id (the key downstream consumers use against
|
|
496
|
-
* `SqlStorage.namespaces`).
|
|
497
|
-
*
|
|
498
|
-
* - **Postgres**: an explicit `namespace unbound { … }` block lowers
|
|
499
|
-
* to the framework sentinel `__unbound__` — the slot whose binding
|
|
500
|
-
* the connection's `search_path` resolves at runtime. Every other
|
|
501
|
-
* explicit bucket name (e.g. `auth`, `public`) passes through as a
|
|
502
|
-
* named schema id. The implicit `__unspecified__` bucket — top-level
|
|
503
|
-
* declarations outside any `namespace { … }` block — leaves the
|
|
504
|
-
* coordinate unset; downstream consumers treat unset as the
|
|
505
|
-
* late-bound default, and TS / PSL authoring stay byte-identical
|
|
506
|
-
* on single-namespace contracts. (A future round will add a
|
|
507
|
-
* target-default-namespace surface so `__unspecified__` lowers to
|
|
508
|
-
* `public` consistently on both authoring paths.)
|
|
509
|
-
* - **SQLite**: SQLite has no schema concept; every namespace
|
|
510
|
-
* collapses to the late-bound default. The namespace-block
|
|
511
|
-
* validation step (above) has already rejected any explicit
|
|
512
|
-
* `namespace { … }` block on SQLite, so the only bucket the
|
|
513
|
-
* lowering ever sees there is `__unspecified__`.
|
|
514
|
-
*
|
|
515
|
-
* Returns `undefined` for targets / bucket names with no explicit
|
|
516
|
-
* namespaceId to assign — callers leave the model's `namespaceId`
|
|
517
|
-
* slot empty (which means the late-bound default at the `StorageTable`
|
|
518
|
-
* layer; emitted JSON omits the field).
|
|
519
|
-
*/
|
|
520
|
-
function resolveNamespaceIdForSqlTarget(input) {
|
|
521
|
-
if (input.targetId !== "postgres") return;
|
|
522
|
-
if (input.bucketName === UNSPECIFIED_PSL_NAMESPACE_ID) return "public";
|
|
523
|
-
if (input.bucketName === UNBOUND_PSL_NAMESPACE_NAME) return UNBOUND_NAMESPACE_ID;
|
|
524
|
-
return input.bucketName;
|
|
525
|
-
}
|
|
526
|
-
/**
|
|
527
|
-
* A namespace block is the unbound block when its name RESOLVES to the
|
|
528
|
-
* unbound id — both the `namespace unbound { }` spelling (mapped by
|
|
529
|
-
* {@link resolveNamespaceIdForSqlTarget}) and the raw sentinel spelling
|
|
530
|
-
* `namespace __unbound__ { }` (passed through verbatim) behave identically:
|
|
531
|
-
* same models-sibling restriction, same block-lowering bucket.
|
|
532
|
-
*/
|
|
533
|
-
function isUnboundNamespaceBlock(ns, targetId) {
|
|
534
|
-
return resolveNamespaceIdForSqlTarget({
|
|
535
|
-
bucketName: ns.name,
|
|
536
|
-
targetId
|
|
537
|
-
}) === UNBOUND_NAMESPACE_ID;
|
|
476
|
+
function declarationsHoldingModels(namespace) {
|
|
477
|
+
const declarations = /* @__PURE__ */ new Set();
|
|
478
|
+
for (const model of Object.values(namespace.models)) {
|
|
479
|
+
const written = model.node.syntax.findAncestor(NamespaceDeclarationAst.cast);
|
|
480
|
+
if (written !== void 0) declarations.add(written.syntax);
|
|
481
|
+
}
|
|
482
|
+
return declarations;
|
|
538
483
|
}
|
|
539
484
|
function validateNamespaceBlocksForSqlTarget(input) {
|
|
540
485
|
if (input.targetId === "sqlite") {
|
|
541
486
|
for (const namespace of input.namespaces) for (const { node, span } of namespace.declarations) input.diagnostics.push({
|
|
542
487
|
code: "PSL_UNSUPPORTED_NAMESPACE_BLOCK",
|
|
543
|
-
message: `SQLite does not support \`namespace ${namespace.name} { … }\` blocks (SQLite has no schema concept; declare models at the document top level instead).`,
|
|
488
|
+
message: `SQLite does not support \`namespace ${node.name()?.name() ?? namespace.name} { … }\` blocks (SQLite has no schema concept; declare models at the document top level instead).`,
|
|
544
489
|
...diagnosticSource(input.sources, node.syntax).at(span)
|
|
545
490
|
});
|
|
546
491
|
return;
|
|
547
492
|
}
|
|
548
493
|
if (input.targetId === "postgres") {
|
|
549
|
-
const
|
|
550
|
-
const hasSibling = input.namespaces.some((
|
|
551
|
-
if (
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
494
|
+
const unboundNamespace = input.namespaces.find((namespace) => namespace.id === UNBOUND_NAMESPACE_ID && Object.keys(namespace.models).length > 0);
|
|
495
|
+
const hasSibling = input.namespaces.some((namespace) => namespace.id !== UNBOUND_NAMESPACE_ID && namespace.declarations.length > 0);
|
|
496
|
+
if (unboundNamespace !== void 0 && hasSibling) {
|
|
497
|
+
const holdingModels = declarationsHoldingModels(unboundNamespace);
|
|
498
|
+
for (const { node, span } of unboundNamespace.declarations) {
|
|
499
|
+
if (!holdingModels.has(node.syntax)) continue;
|
|
500
|
+
input.diagnostics.push({
|
|
501
|
+
code: "PSL_RESERVED_NAMESPACE_NAME",
|
|
502
|
+
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.",
|
|
503
|
+
...diagnosticSource(input.sources, node.syntax).at(span)
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
}
|
|
556
507
|
}
|
|
557
508
|
}
|
|
558
509
|
/**
|
|
@@ -743,7 +694,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
743
694
|
dataTypes: input.dataTypes
|
|
744
695
|
});
|
|
745
696
|
const modelNamespaceId = input.namespaceId;
|
|
746
|
-
const namespaceExtensionEntitiesForModel =
|
|
697
|
+
const namespaceExtensionEntitiesForModel = input.namespaceExtensionEntities?.get(modelNamespaceId);
|
|
747
698
|
const resolvedFields = collectResolvedFields({
|
|
748
699
|
model,
|
|
749
700
|
physicalNames: input.physicalNames,
|
|
@@ -762,7 +713,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
762
713
|
scalarColumnDescriptors: input.scalarColumnDescriptors,
|
|
763
714
|
enumHandles: input.enumHandles,
|
|
764
715
|
capabilities: input.capabilities,
|
|
765
|
-
|
|
716
|
+
namespaceId: modelNamespaceId,
|
|
766
717
|
...ifDefined("namespaceExtensionEntities", namespaceExtensionEntitiesForModel),
|
|
767
718
|
codecLookup: input.codecLookup
|
|
768
719
|
});
|
|
@@ -1066,7 +1017,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
1066
1017
|
return field === void 0 ? void 0 : storageName(field, input.physicalNames);
|
|
1067
1018
|
},
|
|
1068
1019
|
fieldCodecId: (fieldName) => resolvedFields.find((resolved) => resolved.field.name === fieldName)?.descriptor.codecId,
|
|
1069
|
-
namespaceId: modelNamespaceId
|
|
1020
|
+
namespaceId: modelNamespaceId,
|
|
1070
1021
|
sourceId: source.sources.sourceFileFor(source.node).filename,
|
|
1071
1022
|
diagnostics: { push: (d) => {
|
|
1072
1023
|
diagnostics.pushExternal(blindCast(d));
|
|
@@ -1197,7 +1148,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
1197
1148
|
...ifDefined("index", parsedRelation.index)
|
|
1198
1149
|
});
|
|
1199
1150
|
if (typeof parsedRelation.index === "string") relationIndexLocations.push({
|
|
1200
|
-
namespaceId: modelNamespaceId
|
|
1151
|
+
namespaceId: modelNamespaceId,
|
|
1201
1152
|
tableName,
|
|
1202
1153
|
columns: localColumns,
|
|
1203
1154
|
index: parsedRelation.index,
|
|
@@ -1224,8 +1175,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
1224
1175
|
const typeReference = typeReferenceNode(relationAttribute.field);
|
|
1225
1176
|
const targetResolution = typeReference === void 0 ? void 0 : input.binder.symbolForNode(typeReference);
|
|
1226
1177
|
if (targetResolution?.kind === "unresolved") continue;
|
|
1227
|
-
|
|
1228
|
-
if (targetModel === void 0) {
|
|
1178
|
+
if (targetResolution?.kind !== "model") {
|
|
1229
1179
|
const foundKind = targetResolution === void 0 ? void 0 : relationTargetKindLabel(targetResolution);
|
|
1230
1180
|
diagnostics.push({
|
|
1231
1181
|
code: "PSL_INVALID_RELATION_TARGET",
|
|
@@ -1234,6 +1184,8 @@ function buildModelNodeFromPsl(input) {
|
|
|
1234
1184
|
});
|
|
1235
1185
|
continue;
|
|
1236
1186
|
}
|
|
1187
|
+
const targetModel = targetResolution.symbol;
|
|
1188
|
+
const targetNamespaceId = targetResolution.namespace.id;
|
|
1237
1189
|
const parsedRelation = interpretRelationAttribute({
|
|
1238
1190
|
selfModel: model,
|
|
1239
1191
|
field: relationAttribute.field,
|
|
@@ -1295,10 +1247,6 @@ function buildModelNodeFromPsl(input) {
|
|
|
1295
1247
|
}
|
|
1296
1248
|
const onDelete = parsedRelation.onDelete ? normalizeReferentialAction(parsedRelation.onDelete) : void 0;
|
|
1297
1249
|
const onUpdate = parsedRelation.onUpdate ? normalizeReferentialAction(parsedRelation.onUpdate) : void 0;
|
|
1298
|
-
const targetNamespaceId = resolveNamespaceIdForSqlTarget({
|
|
1299
|
-
bucketName: targetModel.node.syntax.findAncestor(NamespaceDeclarationAst.cast)?.name()?.name() ?? UNSPECIFIED_PSL_NAMESPACE_ID,
|
|
1300
|
-
targetId: input.targetId
|
|
1301
|
-
});
|
|
1302
1250
|
const targetTableName = storageName(targetModel, input.physicalNames);
|
|
1303
1251
|
foreignKeyNodes.push({
|
|
1304
1252
|
columns: localColumns,
|
|
@@ -1306,7 +1254,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
1306
1254
|
model: targetModel.name,
|
|
1307
1255
|
table: targetTableName,
|
|
1308
1256
|
columns: referencedColumns,
|
|
1309
|
-
|
|
1257
|
+
namespaceId: targetNamespaceId
|
|
1310
1258
|
},
|
|
1311
1259
|
...ifDefined("name", parsedRelation.map),
|
|
1312
1260
|
...ifDefined("onDelete", onDelete),
|
|
@@ -1314,7 +1262,7 @@ function buildModelNodeFromPsl(input) {
|
|
|
1314
1262
|
...ifDefined("index", parsedRelation.index)
|
|
1315
1263
|
});
|
|
1316
1264
|
if (typeof parsedRelation.index === "string") relationIndexLocations.push({
|
|
1317
|
-
namespaceId: modelNamespaceId
|
|
1265
|
+
namespaceId: modelNamespaceId,
|
|
1318
1266
|
tableName,
|
|
1319
1267
|
columns: localColumns,
|
|
1320
1268
|
index: parsedRelation.index,
|
|
@@ -1796,8 +1744,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
1796
1744
|
defaultFunctionRegistry,
|
|
1797
1745
|
dataTypes
|
|
1798
1746
|
});
|
|
1799
|
-
const
|
|
1800
|
-
const namespaceSymbols = Object.values(topLevel.namespaces);
|
|
1747
|
+
const namespaceSymbols = Object.values(input.symbolTable.namespaces);
|
|
1801
1748
|
validateNamespaceBlocksForSqlTarget({
|
|
1802
1749
|
namespaces: namespaceSymbols,
|
|
1803
1750
|
targetId: input.target.targetId,
|
|
@@ -1823,22 +1770,16 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
1823
1770
|
const models = [];
|
|
1824
1771
|
const modelEntries = [];
|
|
1825
1772
|
const compositeTypes = [];
|
|
1826
|
-
const
|
|
1827
|
-
const
|
|
1828
|
-
bucketName,
|
|
1829
|
-
targetId: input.target.targetId
|
|
1830
|
-
});
|
|
1831
|
-
for (const model of scopeModels) {
|
|
1773
|
+
for (const namespace of namespaceSymbols) {
|
|
1774
|
+
for (const model of Object.values(namespace.models)) {
|
|
1832
1775
|
models.push(model);
|
|
1833
1776
|
modelEntries.push({
|
|
1834
1777
|
model,
|
|
1835
|
-
namespaceId:
|
|
1778
|
+
namespaceId: namespace.id
|
|
1836
1779
|
});
|
|
1837
1780
|
}
|
|
1838
|
-
|
|
1839
|
-
}
|
|
1840
|
-
collectScope(UNSPECIFIED_PSL_NAMESPACE_ID, Object.values(topLevel.models), Object.values(topLevel.compositeTypes));
|
|
1841
|
-
for (const namespace of namespaceSymbols) collectScope(namespace.name, Object.values(namespace.models), Object.values(namespace.compositeTypes));
|
|
1781
|
+
compositeTypes.push(...Object.values(namespace.compositeTypes));
|
|
1782
|
+
}
|
|
1842
1783
|
const physicalNames = /* @__PURE__ */ new Map();
|
|
1843
1784
|
for (const model of models) {
|
|
1844
1785
|
const mapNode = getAttribute(model.attributes, "map")?.node;
|
|
@@ -1871,7 +1812,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
1871
1812
|
physicalNames.set(field, mapped?.name ?? field.name);
|
|
1872
1813
|
}
|
|
1873
1814
|
}
|
|
1874
|
-
const defaultNamespaceId = input.
|
|
1815
|
+
const defaultNamespaceId = input.symbolTable.defaultNamespace.id;
|
|
1875
1816
|
const composedExtensions = new Set(input.composedExtensions ?? []);
|
|
1876
1817
|
const composedExtensionContracts = input.composedExtensionContracts;
|
|
1877
1818
|
const generatorDescriptors = input.controlMutationDefaults?.generatorDescriptors ?? [];
|
|
@@ -1883,25 +1824,29 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
1883
1824
|
diagnostics.push(unsupportedBlockDiagnostic(block, input.sources));
|
|
1884
1825
|
};
|
|
1885
1826
|
const topLevelEnums = [];
|
|
1886
|
-
const
|
|
1887
|
-
for (const
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1827
|
+
const extensionBlocksByNamespace = /* @__PURE__ */ new Map();
|
|
1828
|
+
for (const namespace of namespaceSymbols) {
|
|
1829
|
+
const extensionBlocks = {};
|
|
1830
|
+
extensionBlocksByNamespace.set(namespace, extensionBlocks);
|
|
1831
|
+
for (const [blockName, block] of Object.entries(namespace.blocks)) {
|
|
1832
|
+
const writtenNamespace = block.node.syntax.findAncestor(NamespaceDeclarationAst.cast);
|
|
1833
|
+
if (writtenNamespace === void 0) {
|
|
1834
|
+
if (!legitimateBlockKeywords.has(block.keyword)) reportUnsupportedTopLevelBlock(block);
|
|
1835
|
+
else if (isEnumBlock(block)) topLevelEnums.push(block);
|
|
1836
|
+
else extensionBlocks[blockName] = block;
|
|
1837
|
+
continue;
|
|
1838
|
+
}
|
|
1839
|
+
extensionBlocks[blockName] = block;
|
|
1840
|
+
if (isEnumBlock(block)) {
|
|
1841
|
+
diagnostics.push({
|
|
1842
|
+
code: "PSL_ENUM_NAMESPACE_NOT_SUPPORTED",
|
|
1843
|
+
message: `enum "${block.name}" inside namespace "${writtenNamespace.name()?.name() ?? namespace.name}" is not supported; declare enum at the top level`,
|
|
1844
|
+
...diagnosticSource(input.sources, block.node.syntax).at(nodePslSpan(block.node.syntax, input.sources))
|
|
1845
|
+
});
|
|
1846
|
+
continue;
|
|
1847
|
+
}
|
|
1848
|
+
if (!legitimateBlockKeywords.has(block.keyword)) reportUnsupportedTopLevelBlock(block);
|
|
1903
1849
|
}
|
|
1904
|
-
if (!legitimateBlockKeywords.has(block.keyword)) reportUnsupportedTopLevelBlock(block);
|
|
1905
1850
|
}
|
|
1906
1851
|
const enumResult = processEnumDeclarations({
|
|
1907
1852
|
enumBlocks: topLevelEnums,
|
|
@@ -1952,12 +1897,11 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
1952
1897
|
} },
|
|
1953
1898
|
warnings: authoringWarnings
|
|
1954
1899
|
};
|
|
1900
|
+
const namespaceIdByModel = new Map(modelEntries.map(({ model, namespaceId }) => [model, namespaceId]));
|
|
1955
1901
|
const modelCoordinateOf = (model) => {
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
targetId: input.target.targetId
|
|
1960
|
-
}) ?? defaultNamespaceId,
|
|
1902
|
+
const namespaceId = namespaceIdByModel.get(model);
|
|
1903
|
+
return namespaceId === void 0 ? void 0 : {
|
|
1904
|
+
namespaceId,
|
|
1961
1905
|
tableName: storageName(model, physicalNames)
|
|
1962
1906
|
};
|
|
1963
1907
|
};
|
|
@@ -1984,23 +1928,11 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
1984
1928
|
slot[row.key] = row.entity;
|
|
1985
1929
|
}
|
|
1986
1930
|
};
|
|
1987
|
-
for (const
|
|
1988
|
-
if (ns.name === UNSPECIFIED_PSL_NAMESPACE_ID) continue;
|
|
1989
|
-
const nsId = resolveNamespaceIdForSqlTarget({
|
|
1990
|
-
bucketName: ns.name,
|
|
1991
|
-
targetId: input.target.targetId
|
|
1992
|
-
});
|
|
1993
|
-
if (nsId === void 0) continue;
|
|
1994
|
-
fileExtensionEntityRows(lowerExtensionBlocksForNamespace(ns.blocks, nsId, entityTypesByDiscriminator, extensionEntityContext, parsedBlocks, modelCoordinateOf, input.sources), ns.blocks);
|
|
1995
|
-
}
|
|
1996
|
-
if (Object.keys(topLevelExtensionBlocks).length > 0) fileExtensionEntityRows(lowerExtensionBlocksForNamespace(topLevelExtensionBlocks, resolveNamespaceIdForSqlTarget({
|
|
1997
|
-
bucketName: UNSPECIFIED_PSL_NAMESPACE_ID,
|
|
1998
|
-
targetId: input.target.targetId
|
|
1999
|
-
}) ?? defaultNamespaceId, entityTypesByDiscriminator, extensionEntityContext, parsedBlocks, modelCoordinateOf, input.sources), topLevelExtensionBlocks);
|
|
1931
|
+
for (const [namespace, extensionBlocks] of extensionBlocksByNamespace) fileExtensionEntityRows(lowerExtensionBlocksForNamespace(extensionBlocks, namespace.id, entityTypesByDiscriminator, extensionEntityContext, parsedBlocks, modelCoordinateOf, input.sources), extensionBlocks);
|
|
2000
1932
|
const defaultNsExtensionValueSets = namespaceExtensionEntities.get(defaultNamespaceId)?.["valueSet"];
|
|
2001
1933
|
if (defaultNsExtensionValueSets !== void 0) {
|
|
2002
1934
|
for (const name of Object.keys(defaultNsExtensionValueSets)) if (Object.hasOwn(validEnumHandles, name)) {
|
|
2003
|
-
const enumSymbol =
|
|
1935
|
+
const enumSymbol = input.symbolTable.defaultNamespace.blocks[name];
|
|
2004
1936
|
invariant(enumSymbol !== void 0, "Domain enum has an owning block");
|
|
2005
1937
|
diagnostics.pushUnlocated({
|
|
2006
1938
|
code: "PSL_VALUE_SET_NAME_COLLISION",
|
|
@@ -2013,7 +1945,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2013
1945
|
const reference = typeReferenceNode(symbol);
|
|
2014
1946
|
return !symbol.isConstructor && symbol.baseType !== void 0 && reference !== void 0 && bareTypeConstructorOf(binder.symbolForNode(reference)) !== void 0;
|
|
2015
1947
|
};
|
|
2016
|
-
const allNamedTypes = Object.values(
|
|
1948
|
+
const allNamedTypes = Object.values(input.symbolTable.namedTypes);
|
|
2017
1949
|
const namedTypeResult = resolveNamedTypeDeclarations({
|
|
2018
1950
|
declarations: [...allNamedTypes.filter(isScalarRefinement), ...allNamedTypes.filter((symbol) => !isScalarRefinement(symbol))],
|
|
2019
1951
|
source,
|
|
@@ -2073,13 +2005,12 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2073
2005
|
codecLookup: input.codecLookup,
|
|
2074
2006
|
modelAttributesByName,
|
|
2075
2007
|
contributedModelAttributeSpecs: contributedModelSpecs,
|
|
2076
|
-
defaultNamespaceId,
|
|
2077
2008
|
parsedBlocks
|
|
2078
2009
|
});
|
|
2079
|
-
modelNodes.set(model,
|
|
2010
|
+
modelNodes.set(model, {
|
|
2080
2011
|
...result.modelNode,
|
|
2081
2012
|
namespaceId
|
|
2082
|
-
}
|
|
2013
|
+
});
|
|
2083
2014
|
fkRelationMetadata.push(...result.fkRelationMetadata);
|
|
2084
2015
|
relationIndexLocations.push(...result.relationIndexLocations);
|
|
2085
2016
|
invalidFkPairings.push(...result.invalidFkPairings);
|
|
@@ -2089,13 +2020,12 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2089
2020
|
crossSpaceRelationsByModel.set(model, [...existing, ...result.crossSpaceRelations]);
|
|
2090
2021
|
}
|
|
2091
2022
|
if (Object.keys(result.modelAttributeEntities).length > 0) {
|
|
2092
|
-
const
|
|
2093
|
-
const existingByAttribute = modelAttributeEntitiesByNamespace.get(nsKey) ?? {};
|
|
2023
|
+
const existingByAttribute = modelAttributeEntitiesByNamespace.get(namespaceId) ?? {};
|
|
2094
2024
|
for (const [attribute, keyed] of Object.entries(result.modelAttributeEntities)) existingByAttribute[attribute] = {
|
|
2095
2025
|
...existingByAttribute[attribute] ?? {},
|
|
2096
2026
|
...keyed
|
|
2097
2027
|
};
|
|
2098
|
-
modelAttributeEntitiesByNamespace.set(
|
|
2028
|
+
modelAttributeEntitiesByNamespace.set(namespaceId, existingByAttribute);
|
|
2099
2029
|
}
|
|
2100
2030
|
}
|
|
2101
2031
|
const { modelRelations, fkRelationsByPair, fkRelationsByDeclaringModel } = indexFkRelations({ fkRelationMetadata });
|
|
@@ -2125,14 +2055,11 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2125
2055
|
if (existing) existing.push(...relations);
|
|
2126
2056
|
else modelRelations.set(modelName, [...relations]);
|
|
2127
2057
|
}
|
|
2128
|
-
const { discriminatorDeclarations, baseDeclarations } = collectPolymorphismDeclarations(new Map(modelEntries.map(({ model, namespaceId }) => {
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
key: modelCoordinateKey(resolvedNamespaceId, model.name)
|
|
2134
|
-
}];
|
|
2135
|
-
})), input.symbolTable, input.sources, binder, specContextFor, input.scalarColumnDescriptors.get("String")?.codecId, diagnostics);
|
|
2058
|
+
const { discriminatorDeclarations, baseDeclarations } = collectPolymorphismDeclarations(new Map(modelEntries.map(({ model, namespaceId }) => [model, {
|
|
2059
|
+
model,
|
|
2060
|
+
namespaceId,
|
|
2061
|
+
key: modelCoordinateKey(namespaceId, model.name)
|
|
2062
|
+
}])), input.symbolTable, input.sources, binder, specContextFor, input.scalarColumnDescriptors.get("String")?.codecId, diagnostics);
|
|
2136
2063
|
const stiVariantKeys = /* @__PURE__ */ new Set();
|
|
2137
2064
|
for (const [variantKey, declaration] of baseDeclarations) if (!(getAttribute(declaration.model.attributes, "map") !== void 0)) stiVariantKeys.add(variantKey);
|
|
2138
2065
|
for (const variantKey of stiVariantKeys) {
|
|
@@ -2244,4 +2171,4 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
2244
2171
|
//#endregion
|
|
2245
2172
|
export { normalizeReferentialAction as a, interpretPslDocumentToSqlContract as i, buildEntityTypesByDiscriminator as n, indexFkRelations as r, applyBackrelationCandidates as t };
|
|
2246
2173
|
|
|
2247
|
-
//# sourceMappingURL=interpreter-
|
|
2174
|
+
//# sourceMappingURL=interpreter-BbopSq2f-y_JBQJFT.mjs.map
|