@prisma-next/sql-contract-psl 0.13.0 → 0.14.0-dev.2
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 +3 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{interpreter-B_KtZusL.mjs → interpreter-B0BsCLKT.mjs} +110 -96
- package/dist/interpreter-B0BsCLKT.mjs.map +1 -0
- package/dist/provider.d.mts +1 -1
- package/dist/provider.mjs +5 -3
- package/dist/provider.mjs.map +1 -1
- package/package.json +12 -12
- package/src/interpreter.ts +91 -130
- package/src/provider.ts +2 -0
- package/src/psl-column-resolution.ts +1 -1
- package/src/psl-field-resolution.ts +90 -14
- package/dist/interpreter-B_KtZusL.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Contract } from "@prisma-next/contract/types";
|
|
2
2
|
import { AuthoringContributions } from "@prisma-next/framework-components/authoring";
|
|
3
|
-
import { SqlNamespaceTablesInput } from "@prisma-next/sql-contract/types";
|
|
4
3
|
import { Result } from "@prisma-next/utils/result";
|
|
5
4
|
import { ParsePslDocumentResult } from "@prisma-next/psl-parser";
|
|
6
5
|
import { ControlMutationDefaults, ControlMutationDefaults as ControlMutationDefaults$1, DefaultFunctionLoweringContext, DefaultFunctionLoweringHandler, DefaultFunctionRegistry, DefaultFunctionRegistryEntry, MutationDefaultGeneratorDescriptor } from "@prisma-next/framework-components/control";
|
|
7
6
|
import { ContractSourceDiagnostics } from "@prisma-next/config/config-types";
|
|
7
|
+
import { CodecLookup } from "@prisma-next/framework-components/codec";
|
|
8
8
|
import { ExtensionPackRef, TargetPackRef } from "@prisma-next/framework-components/components";
|
|
9
9
|
import { Namespace } from "@prisma-next/framework-components/ir";
|
|
10
|
+
import { SqlNamespaceTablesInput } from "@prisma-next/sql-contract/types";
|
|
10
11
|
|
|
11
12
|
//#region src/psl-column-resolution.d.ts
|
|
12
13
|
type ColumnDescriptor = {
|
|
@@ -45,6 +46,7 @@ interface InterpretPslDocumentToSqlContractInput {
|
|
|
45
46
|
* `SqlUnboundNamespace` singleton.
|
|
46
47
|
*/
|
|
47
48
|
readonly createNamespace?: (input: SqlNamespaceTablesInput) => Namespace;
|
|
49
|
+
readonly codecLookup?: CodecLookup;
|
|
48
50
|
}
|
|
49
51
|
declare function interpretPslDocumentToSqlContract(input: InterpretPslDocumentToSqlContractInput): Result<Contract, ContractSourceDiagnostics>;
|
|
50
52
|
//#endregion
|
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":"
|
|
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;;;UCmDb,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;ED1DzB;;;AAAmB;;;;ACmD9B;;EDnDW,SCoEA,0BAAA,EAA4B,WAAA,SAAoB,QAAA;EAhBtC;;;;;;;;;EAAA,SA0BV,eAAA,IAAmB,KAAA,EAAO,uBAAA,KAA4B,SAAA;EAAA,SACtD,WAAA,GAAc,WAAA;AAAA;AAAA,iBA+rDT,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-B0BsCLKT.mjs";
|
|
2
2
|
export { interpretPslDocumentToSqlContract };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { crossRef } from "@prisma-next/contract/types";
|
|
2
2
|
import { hasRegisteredFieldNamespace, instantiateAuthoringEntityType, instantiateAuthoringFieldPreset, instantiateAuthoringTypeConstructor, isAuthoringEntityTypeDescriptor, isAuthoringFieldPresetDescriptor, isAuthoringTypeConstructorDescriptor, validateAuthoringHelperArguments } from "@prisma-next/framework-components/authoring";
|
|
3
|
-
import {
|
|
3
|
+
import { namespacePslExtensionBlocks } from "@prisma-next/framework-components/psl-ast";
|
|
4
4
|
import { buildSqlContractFromDefinition } from "@prisma-next/sql-contract-ts/contract-builder";
|
|
5
5
|
import { blindCast } from "@prisma-next/utils/casts";
|
|
6
6
|
import { ifDefined } from "@prisma-next/utils/defined";
|
|
@@ -1071,7 +1071,7 @@ const NATIVE_TYPE_SPECS = {
|
|
|
1071
1071
|
"db.Uuid": {
|
|
1072
1072
|
args: "noArgs",
|
|
1073
1073
|
baseType: "String",
|
|
1074
|
-
codecId:
|
|
1074
|
+
codecId: "pg/uuid@1",
|
|
1075
1075
|
nativeType: "uuid"
|
|
1076
1076
|
},
|
|
1077
1077
|
"db.SmallInt": {
|
|
@@ -1308,6 +1308,37 @@ function resolveColumnDescriptor(field, enumTypeDescriptors, namedTypeDescriptor
|
|
|
1308
1308
|
}
|
|
1309
1309
|
//#endregion
|
|
1310
1310
|
//#region src/psl-field-resolution.ts
|
|
1311
|
+
function lowerEnumDefaultForField(input) {
|
|
1312
|
+
const expressionEntry = getPositionalArgumentEntry(input.defaultAttribute);
|
|
1313
|
+
if (!expressionEntry) return {};
|
|
1314
|
+
const raw = expressionEntry.value.trim();
|
|
1315
|
+
const isQuotedString = /^(['"]).*\1$/.test(raw);
|
|
1316
|
+
const isFunctionCall = raw.includes("(") && raw.endsWith(")");
|
|
1317
|
+
if (isQuotedString || isFunctionCall) {
|
|
1318
|
+
input.diagnostics.push({
|
|
1319
|
+
code: "PSL_ENUM_DEFAULT_MUST_BE_MEMBER_NAME",
|
|
1320
|
+
message: `Field "${input.modelName}.${input.fieldName}" @default on an enum field must name a member (e.g. @default(Low)), not a raw value or function.`,
|
|
1321
|
+
sourceId: input.sourceId,
|
|
1322
|
+
span: input.defaultAttribute.span
|
|
1323
|
+
});
|
|
1324
|
+
return {};
|
|
1325
|
+
}
|
|
1326
|
+
const match = input.enumHandle.enumMembers.find((m) => m.name === raw);
|
|
1327
|
+
if (!match) {
|
|
1328
|
+
const validNames = input.enumHandle.enumMembers.map((m) => m.name).join(", ");
|
|
1329
|
+
input.diagnostics.push({
|
|
1330
|
+
code: "PSL_ENUM_UNKNOWN_DEFAULT_MEMBER",
|
|
1331
|
+
message: `Field "${input.modelName}.${input.fieldName}" @default(${raw}) does not name a member of ${input.enumHandle.enumName}. Valid members: ${validNames}.`,
|
|
1332
|
+
sourceId: input.sourceId,
|
|
1333
|
+
span: input.defaultAttribute.span
|
|
1334
|
+
});
|
|
1335
|
+
return {};
|
|
1336
|
+
}
|
|
1337
|
+
return { defaultValue: {
|
|
1338
|
+
kind: "literal",
|
|
1339
|
+
value: blindCast(match.value)
|
|
1340
|
+
} };
|
|
1341
|
+
}
|
|
1311
1342
|
const MODEL_COORDINATE_SEPARATOR = "\0";
|
|
1312
1343
|
function modelCoordinateKey(namespaceId, modelName) {
|
|
1313
1344
|
return `${namespaceId}${MODEL_COORDINATE_SEPARATOR}${modelName}`;
|
|
@@ -1381,7 +1412,7 @@ function extractFieldConstraintNames(input) {
|
|
|
1381
1412
|
};
|
|
1382
1413
|
}
|
|
1383
1414
|
function collectResolvedFields(input) {
|
|
1384
|
-
const { model, mapping, enumTypeDescriptors, namedTypeDescriptors, modelNames, compositeTypeNames, composedExtensions, authoringContributions, familyId, targetId, defaultFunctionRegistry, generatorDescriptorById, diagnostics, sourceId, scalarTypeDescriptors } = input;
|
|
1415
|
+
const { model, mapping, enumTypeDescriptors, namedTypeDescriptors, modelNames, compositeTypeNames, composedExtensions, authoringContributions, familyId, targetId, defaultFunctionRegistry, generatorDescriptorById, diagnostics, sourceId, scalarTypeDescriptors, enumHandles } = input;
|
|
1385
1416
|
const resolvedFields = [];
|
|
1386
1417
|
for (const field of model.fields) {
|
|
1387
1418
|
const isModelField = modelNames.has(field.typeName);
|
|
@@ -1474,7 +1505,15 @@ function collectResolvedFields(input) {
|
|
|
1474
1505
|
});
|
|
1475
1506
|
continue;
|
|
1476
1507
|
}
|
|
1477
|
-
const
|
|
1508
|
+
const enumHandle = enumHandles?.get(field.typeName);
|
|
1509
|
+
const loweredDefault = defaultAttribute ? enumHandle ? lowerEnumDefaultForField({
|
|
1510
|
+
modelName: model.name,
|
|
1511
|
+
fieldName: field.name,
|
|
1512
|
+
defaultAttribute,
|
|
1513
|
+
enumHandle,
|
|
1514
|
+
sourceId,
|
|
1515
|
+
diagnostics
|
|
1516
|
+
}) : lowerDefaultForField({
|
|
1478
1517
|
modelName: model.name,
|
|
1479
1518
|
fieldName: field.name,
|
|
1480
1519
|
defaultAttribute,
|
|
@@ -1495,7 +1534,8 @@ function collectResolvedFields(input) {
|
|
|
1495
1534
|
});
|
|
1496
1535
|
continue;
|
|
1497
1536
|
}
|
|
1498
|
-
|
|
1537
|
+
const fieldUsesNamedType = field.typeRef !== void 0 || namedTypeDescriptors.has(field.typeName);
|
|
1538
|
+
if (loweredOnCreate && !fieldUsesNamedType) {
|
|
1499
1539
|
const generatedDescriptor = generatorDescriptorById.get(loweredOnCreate.id)?.resolveGeneratedColumnDescriptor?.({ generated: loweredOnCreate });
|
|
1500
1540
|
if (generatedDescriptor) descriptor = generatedDescriptor;
|
|
1501
1541
|
}
|
|
@@ -1943,58 +1983,37 @@ function validateNamespaceBlocksForSqlTarget(input) {
|
|
|
1943
1983
|
}
|
|
1944
1984
|
}
|
|
1945
1985
|
function processEnumDeclarations(input) {
|
|
1946
|
-
const
|
|
1986
|
+
const enumHandles = {};
|
|
1947
1987
|
const enumTypeDescriptors = /* @__PURE__ */ new Map();
|
|
1948
|
-
if (input.
|
|
1949
|
-
|
|
1988
|
+
if (input.enumBlocks.length === 0) return {
|
|
1989
|
+
enumHandles,
|
|
1950
1990
|
enumTypeDescriptors
|
|
1951
1991
|
};
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1992
|
+
const enumDescriptor = getAuthoringEntity(input.authoringContributions, ["enum"]);
|
|
1993
|
+
if (!enumDescriptor) {
|
|
1994
|
+
for (const decl of input.enumBlocks) input.diagnostics.push({
|
|
1995
|
+
code: "PSL_ENUM_MISSING_FACTORY",
|
|
1996
|
+
message: `enum "${decl.name}" requires an "enum" entityType factory in the active authoring contributions`,
|
|
1956
1997
|
sourceId: input.sourceId,
|
|
1957
|
-
span:
|
|
1998
|
+
span: decl.span
|
|
1958
1999
|
});
|
|
1959
2000
|
return {
|
|
1960
|
-
|
|
2001
|
+
enumHandles,
|
|
1961
2002
|
enumTypeDescriptors
|
|
1962
2003
|
};
|
|
1963
2004
|
}
|
|
1964
|
-
for (const
|
|
1965
|
-
const
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
});
|
|
1973
|
-
const values = enumDeclaration.values.map((value) => value.name);
|
|
1974
|
-
const constructed = instantiateAuthoringEntityType("enum", input.enumEntityDescriptor, [{
|
|
1975
|
-
name: enumDeclaration.name,
|
|
1976
|
-
nativeType,
|
|
1977
|
-
values
|
|
1978
|
-
}], input.entityContext);
|
|
1979
|
-
if (!isPostgresEnumStorageEntry(constructed)) {
|
|
1980
|
-
input.diagnostics.push({
|
|
1981
|
-
code: "PSL_UNSUPPORTED_NAMED_TYPE_BASE",
|
|
1982
|
-
message: `Enum "${enumDeclaration.name}": enum entity-type factory must return a PostgresEnumStorageEntry-shaped value (kind: 'postgres-enum')`,
|
|
1983
|
-
sourceId: input.sourceId,
|
|
1984
|
-
span: enumDeclaration.span
|
|
1985
|
-
});
|
|
1986
|
-
continue;
|
|
1987
|
-
}
|
|
1988
|
-
const descriptor = {
|
|
1989
|
-
codecId: constructed.codecId,
|
|
1990
|
-
nativeType: constructed.nativeType,
|
|
1991
|
-
typeRef: enumDeclaration.name
|
|
1992
|
-
};
|
|
1993
|
-
enumTypeDescriptors.set(enumDeclaration.name, descriptor);
|
|
1994
|
-
storageTypes[enumDeclaration.name] = constructed;
|
|
2005
|
+
for (const decl of input.enumBlocks) {
|
|
2006
|
+
const handle = instantiateAuthoringEntityType("enum", enumDescriptor, [decl], input.entityContext);
|
|
2007
|
+
if (handle === void 0 || handle === null) continue;
|
|
2008
|
+
const enumHandle = blindCast(handle);
|
|
2009
|
+
enumHandles[decl.name] = enumHandle;
|
|
2010
|
+
enumTypeDescriptors.set(decl.name, {
|
|
2011
|
+
codecId: enumHandle.codecId,
|
|
2012
|
+
nativeType: enumHandle.nativeType
|
|
2013
|
+
});
|
|
1995
2014
|
}
|
|
1996
2015
|
return {
|
|
1997
|
-
|
|
2016
|
+
enumHandles,
|
|
1998
2017
|
enumTypeDescriptors
|
|
1999
2018
|
};
|
|
2000
2019
|
}
|
|
@@ -2169,7 +2188,8 @@ function buildModelNodeFromPsl(input) {
|
|
|
2169
2188
|
generatorDescriptorById: input.generatorDescriptorById,
|
|
2170
2189
|
diagnostics,
|
|
2171
2190
|
sourceId,
|
|
2172
|
-
scalarTypeDescriptors: input.scalarTypeDescriptors
|
|
2191
|
+
scalarTypeDescriptors: input.scalarTypeDescriptors,
|
|
2192
|
+
...ifDefined("enumHandles", input.enumHandles)
|
|
2173
2193
|
});
|
|
2174
2194
|
const inlineIdFields = resolvedFields.filter((field) => field.isId);
|
|
2175
2195
|
if (inlineIdFields.length > 1) diagnostics.push({
|
|
@@ -2710,14 +2730,18 @@ function buildModelNodeFromPsl(input) {
|
|
|
2710
2730
|
modelNode: {
|
|
2711
2731
|
modelName: model.name,
|
|
2712
2732
|
tableName,
|
|
2713
|
-
fields: resolvedFields.map((resolvedField) =>
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2733
|
+
fields: resolvedFields.map((resolvedField) => {
|
|
2734
|
+
const enumHandle = input.enumHandles?.get(resolvedField.field.typeName);
|
|
2735
|
+
return {
|
|
2736
|
+
fieldName: resolvedField.field.name,
|
|
2737
|
+
columnName: resolvedField.columnName,
|
|
2738
|
+
descriptor: resolvedField.descriptor,
|
|
2739
|
+
nullable: resolvedField.field.optional,
|
|
2740
|
+
...ifDefined("default", resolvedField.defaultValue),
|
|
2741
|
+
...ifDefined("executionDefaults", resolvedField.executionDefaults),
|
|
2742
|
+
...ifDefined("enumTypeHandle", enumHandle)
|
|
2743
|
+
};
|
|
2744
|
+
}),
|
|
2721
2745
|
...ifDefined("id", primaryKey),
|
|
2722
2746
|
...uniqueConstraints.length > 0 ? { uniques: uniqueConstraints } : {},
|
|
2723
2747
|
...indexNodes.length > 0 ? { indexes: indexNodes } : {},
|
|
@@ -3189,18 +3213,6 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3189
3213
|
}
|
|
3190
3214
|
}
|
|
3191
3215
|
const defaultNamespaceId = input.target.defaultNamespaceId;
|
|
3192
|
-
const topLevelEnums = input.document.ast.namespaces.filter((ns) => ns.name === UNSPECIFIED_PSL_NAMESPACE_NAME).flatMap((ns) => ns.enums);
|
|
3193
|
-
const namedNamespaceEnumsByNsId = /* @__PURE__ */ new Map();
|
|
3194
|
-
for (const ns of input.document.ast.namespaces) {
|
|
3195
|
-
if (ns.name === UNSPECIFIED_PSL_NAMESPACE_NAME || ns.enums.length === 0) continue;
|
|
3196
|
-
const resolvedId = resolveNamespaceIdForSqlTarget({
|
|
3197
|
-
bucketName: ns.name,
|
|
3198
|
-
targetId: input.target.targetId
|
|
3199
|
-
});
|
|
3200
|
-
if (resolvedId === void 0) continue;
|
|
3201
|
-
const existing = namedNamespaceEnumsByNsId.get(resolvedId) ?? [];
|
|
3202
|
-
namedNamespaceEnumsByNsId.set(resolvedId, [...existing, ...ns.enums]);
|
|
3203
|
-
}
|
|
3204
3216
|
const compositeTypes = input.document.ast.namespaces.flatMap((ns) => ns.compositeTypes);
|
|
3205
3217
|
const modelNames = new Set(models.map((model) => model.name));
|
|
3206
3218
|
const compositeTypeNames = new Set(compositeTypes.map((ct) => ct.name));
|
|
@@ -3210,33 +3222,36 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3210
3222
|
const generatorDescriptors = input.controlMutationDefaults?.generatorDescriptors ?? [];
|
|
3211
3223
|
const generatorDescriptorById = /* @__PURE__ */ new Map();
|
|
3212
3224
|
for (const descriptor of generatorDescriptors) generatorDescriptorById.set(descriptor.id, descriptor);
|
|
3213
|
-
const
|
|
3214
|
-
const
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3225
|
+
const topLevelEnums = input.document.ast.namespaces.filter((ns) => ns.name === UNSPECIFIED_PSL_NAMESPACE_NAME).flatMap((ns) => namespacePslExtensionBlocks(ns).filter((b) => b.kind === "enum"));
|
|
3226
|
+
for (const ns of input.document.ast.namespaces) {
|
|
3227
|
+
if (ns.name === UNSPECIFIED_PSL_NAMESPACE_NAME) continue;
|
|
3228
|
+
const nsEnums = namespacePslExtensionBlocks(ns).filter((b) => b.kind === "enum");
|
|
3229
|
+
if (nsEnums.length === 0) continue;
|
|
3230
|
+
for (const decl of nsEnums) diagnostics.push({
|
|
3231
|
+
code: "PSL_ENUM_NAMESPACE_NOT_SUPPORTED",
|
|
3232
|
+
message: `enum "${decl.name}" inside namespace "${ns.name}" is not supported; declare enum at the top level`,
|
|
3233
|
+
sourceId,
|
|
3234
|
+
span: decl.span
|
|
3235
|
+
});
|
|
3236
|
+
}
|
|
3218
3237
|
const enumResult = processEnumDeclarations({
|
|
3219
|
-
|
|
3238
|
+
enumBlocks: topLevelEnums,
|
|
3220
3239
|
sourceId,
|
|
3221
|
-
|
|
3222
|
-
entityContext:
|
|
3240
|
+
authoringContributions: input.authoringContributions,
|
|
3241
|
+
entityContext: {
|
|
3242
|
+
family: input.target.familyId,
|
|
3243
|
+
target: input.target.targetId,
|
|
3244
|
+
...ifDefined("codecLookup", input.codecLookup),
|
|
3245
|
+
sourceId,
|
|
3246
|
+
diagnostics: { push: (d) => {
|
|
3247
|
+
diagnostics.push(blindCast(d));
|
|
3248
|
+
} }
|
|
3249
|
+
},
|
|
3223
3250
|
diagnostics
|
|
3224
3251
|
});
|
|
3225
3252
|
const allEnumTypeDescriptors = new Map(enumResult.enumTypeDescriptors);
|
|
3226
|
-
const
|
|
3227
|
-
|
|
3228
|
-
const nsEnumResult = processEnumDeclarations({
|
|
3229
|
-
enums: nsEnums,
|
|
3230
|
-
sourceId,
|
|
3231
|
-
enumEntityDescriptor,
|
|
3232
|
-
entityContext: enumEntityContext,
|
|
3233
|
-
diagnostics
|
|
3234
|
-
});
|
|
3235
|
-
for (const [name, descriptor] of nsEnumResult.enumTypeDescriptors) allEnumTypeDescriptors.set(name, descriptor);
|
|
3236
|
-
const nsEntries = {};
|
|
3237
|
-
for (const [name, entry] of Object.entries(nsEnumResult.storageTypes)) if (isPostgresEnumStorageEntry(entry)) nsEntries[name] = entry;
|
|
3238
|
-
if (Object.keys(nsEntries).length > 0) namespaceEnumStorageTypes[nsId] = nsEntries;
|
|
3239
|
-
}
|
|
3253
|
+
const validEnumHandles = { ...enumResult.enumHandles };
|
|
3254
|
+
const enumHandlesByName = new Map(Object.entries(validEnumHandles));
|
|
3240
3255
|
const namedTypeResult = resolveNamedTypeDeclarations({
|
|
3241
3256
|
declarations: input.document.ast.types?.declarations ?? [],
|
|
3242
3257
|
sourceId,
|
|
@@ -3248,10 +3263,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3248
3263
|
authoringContributions: input.authoringContributions,
|
|
3249
3264
|
diagnostics
|
|
3250
3265
|
});
|
|
3251
|
-
const storageTypes = {
|
|
3252
|
-
...enumResult.storageTypes,
|
|
3253
|
-
...namedTypeResult.storageTypes
|
|
3254
|
-
};
|
|
3266
|
+
const storageTypes = { ...namedTypeResult.storageTypes };
|
|
3255
3267
|
const modelMappingsByCoordinate = buildModelMappings(modelEntries, defaultNamespaceId, diagnostics, sourceId);
|
|
3256
3268
|
const modelMappings = /* @__PURE__ */ new Map();
|
|
3257
3269
|
for (const mapping of modelMappingsByCoordinate.values()) modelMappings.set(mapping.model.name, mapping);
|
|
@@ -3283,7 +3295,8 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3283
3295
|
scalarTypeDescriptors: input.scalarTypeDescriptors,
|
|
3284
3296
|
sourceId,
|
|
3285
3297
|
diagnostics,
|
|
3286
|
-
modelNamespaceIds
|
|
3298
|
+
modelNamespaceIds,
|
|
3299
|
+
...enumHandlesByName.size > 0 ? { enumHandles: enumHandlesByName } : {}
|
|
3287
3300
|
});
|
|
3288
3301
|
modelNodes.push(namespaceId !== void 0 ? {
|
|
3289
3302
|
...result.modelNode,
|
|
@@ -3335,7 +3348,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3335
3348
|
target: input.target,
|
|
3336
3349
|
...ifDefined("extensionPacks", buildComposedExtensionPackRefs(input.target, [...composedExtensions].sort(compareStrings), input.composedExtensionPackRefs)),
|
|
3337
3350
|
...Object.keys(storageTypes).length > 0 ? { storageTypes } : {},
|
|
3338
|
-
...Object.keys(
|
|
3351
|
+
...Object.keys(validEnumHandles).length > 0 ? { enums: validEnumHandles } : {},
|
|
3339
3352
|
...ifDefined("createNamespace", input.createNamespace),
|
|
3340
3353
|
models: stiColumnModelNodes.map((model) => ({
|
|
3341
3354
|
...model,
|
|
@@ -3362,6 +3375,7 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3362
3375
|
roots: filteredRoots,
|
|
3363
3376
|
domain: { namespaces: Object.fromEntries(Object.entries(contract.domain.namespaces).map(([namespaceId, namespaceSlice]) => [namespaceId, {
|
|
3364
3377
|
models: Object.fromEntries(Object.entries(namespaceSlice.models).map(([modelName, model]) => [modelName, patchedModels[modelCoordinateKey(namespaceId, modelName)] ?? model])),
|
|
3378
|
+
...namespaceSlice.enum !== void 0 ? { enum: namespaceSlice.enum } : {},
|
|
3365
3379
|
...namespaceSlice.valueObjects !== void 0 ? { valueObjects: namespaceSlice.valueObjects } : {},
|
|
3366
3380
|
...namespaceId === input.target.defaultNamespaceId && Object.keys(valueObjects).length > 0 ? { valueObjects } : {}
|
|
3367
3381
|
}])) }
|
|
@@ -3370,4 +3384,4 @@ function interpretPslDocumentToSqlContract(input) {
|
|
|
3370
3384
|
//#endregion
|
|
3371
3385
|
export { interpretPslDocumentToSqlContract as t };
|
|
3372
3386
|
|
|
3373
|
-
//# sourceMappingURL=interpreter-
|
|
3387
|
+
//# sourceMappingURL=interpreter-B0BsCLKT.mjs.map
|