@prisma/orm-family-sql 8.0.0-rc.18-dev.28 → 8.0.0-rc.18-dev.30
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/{attribute-specs-D9QcPJpj.d.mts → attribute-specs-BzBk62Jx.d.mts} +10 -4
- package/dist/{attribute-specs-D9QcPJpj.d.mts.map → attribute-specs-BzBk62Jx.d.mts.map} +1 -1
- package/dist/{authoring-entity-types-CZ-vdwYS-CSU65LVs.d.mts → authoring-entity-types-CZ-vdwYS-DzxLL9BC.d.mts} +2 -2
- package/dist/{authoring-entity-types-CZ-vdwYS-CSU65LVs.d.mts.map → authoring-entity-types-CZ-vdwYS-DzxLL9BC.d.mts.map} +1 -1
- package/dist/{config-types-BJxHMPGt.mjs → config-types-vu5fTaRa.mjs} +2 -2
- package/dist/{config-types-BJxHMPGt.mjs.map → config-types-vu5fTaRa.mjs.map} +1 -1
- package/dist/{contract-builder-CrWbrtE4.mjs → contract-builder-DmX4XnJa.mjs} +95 -10
- package/dist/contract-builder-DmX4XnJa.mjs.map +1 -0
- package/dist/{contract-builder-D-RSOsnc.d.mts → contract-builder-GH-eCIpl.d.mts} +18 -2
- package/dist/contract-builder-GH-eCIpl.d.mts.map +1 -0
- package/dist/contract-prisma7__provider.d.mts +1 -3
- package/dist/contract-prisma7__provider.d.mts.map +1 -1
- package/dist/contract-prisma7__provider.mjs +38 -9
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- package/dist/contract-psl.d.mts +5 -3
- package/dist/contract-psl.d.mts.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.d.mts +1 -1
- package/dist/contract-psl__attribute-specs.mjs +1 -1
- package/dist/contract-psl__provider.mjs +3 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.d.mts +1 -1
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.d.mts +1 -1
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/{control-D9zFmpo0.d.mts → control-B8tb6SEt.d.mts} +73 -21
- package/dist/control-B8tb6SEt.d.mts.map +1 -0
- package/dist/{control-D7jPD-Tk.mjs → control-DNE-Chse.mjs} +15 -28
- package/dist/control-DNE-Chse.mjs.map +1 -0
- package/dist/{control-adapter-BCopdpsT-BPHa2Frw.d.mts → control-adapter-Bn0uhplA-rhq_JtYp.d.mts} +2 -2
- package/dist/{control-adapter-BCopdpsT-BPHa2Frw.d.mts.map → control-adapter-Bn0uhplA-rhq_JtYp.d.mts.map} +1 -1
- package/dist/{control-adapter-ChJhp5vV.d.mts → control-adapter-RwLtGiwa.d.mts} +2 -2
- package/dist/{control-adapter-ChJhp5vV.d.mts.map → control-adapter-RwLtGiwa.d.mts.map} +1 -1
- package/dist/{derived-checks-sRZp_gTF-ermwhVGQ.mjs → derived-checks-CdPHpJSv-B7Bgj3Ao.mjs} +2 -2
- package/dist/{derived-checks-sRZp_gTF-ermwhVGQ.mjs.map → derived-checks-CdPHpJSv-B7Bgj3Ao.mjs.map} +1 -1
- package/dist/{diff-ClZvIVOl.d.mts → diff-B9Z47nHf.d.mts} +2 -2
- package/dist/{diff-ClZvIVOl.d.mts.map → diff-B9Z47nHf.d.mts.map} +1 -1
- package/dist/family.d.mts +9 -9
- package/dist/family.mjs +4 -3
- package/dist/family__control-adapter.d.mts +2 -2
- package/dist/family__control.d.mts +3 -3
- package/dist/family__control.mjs +2 -2
- package/dist/family__diff.d.mts +1 -1
- package/dist/family__migration.d.mts +1 -1
- package/dist/family__pack.d.mts +2 -2
- package/dist/family__pack.mjs +8 -3
- package/dist/family__pack.mjs.map +1 -1
- package/dist/family__psl-build.d.mts +2 -2
- package/dist/family__psl-build.mjs +2 -2
- package/dist/{authoring-type-constructors-0Iv2zdwS-D4LlP1q2.mjs → generator-functions-B4gRRYZB-BTtC2KQz.mjs} +205 -5
- package/dist/generator-functions-B4gRRYZB-BTtC2KQz.mjs.map +1 -0
- package/dist/{interpreter-kQuqdyeP-B-rzJDWE.mjs → interpreter-Bk0xpelv-BifV9Yib.mjs} +9 -9
- package/dist/interpreter-Bk0xpelv-BifV9Yib.mjs.map +1 -0
- package/dist/{migration-RrhpTP1o.d.mts → migration-CSv3UpiC.d.mts} +2 -2
- package/dist/{migration-RrhpTP1o.d.mts.map → migration-CSv3UpiC.d.mts.map} +1 -1
- package/dist/{pack-DNdZwm5w.d.mts → pack-COEyiyfL.d.mts} +74 -4
- package/dist/pack-COEyiyfL.d.mts.map +1 -0
- package/dist/{psl-build-BT8Ue6gd.mjs → psl-build-BkxAXTwj.mjs} +44 -135
- package/dist/psl-build-BkxAXTwj.mjs.map +1 -0
- package/dist/psl-build-O7_tXQ1E.d.mts +108 -0
- package/dist/psl-build-O7_tXQ1E.d.mts.map +1 -0
- package/dist/{psl-column-resolution-BCkhNzOK-DyfXnB-9.d.mts → psl-column-resolution-DNdqpUxt-C8BST0uW.d.mts} +3 -3
- package/dist/psl-column-resolution-DNdqpUxt-C8BST0uW.d.mts.map +1 -0
- package/dist/{psl-field-resolution-C1E-_fQq-VUYD8cnS.mjs → psl-field-resolution-BET6wtHZ-CX2xL99Q.mjs} +110 -46
- package/dist/psl-field-resolution-BET6wtHZ-CX2xL99Q.mjs.map +1 -0
- package/dist/{types-DKU4GeqD-CUClXCme.d.mts → types-DlFdMaDJ-DekbNgDh.d.mts} +3 -3
- package/dist/{types-DKU4GeqD-CUClXCme.d.mts.map → types-DlFdMaDJ-DekbNgDh.d.mts.map} +1 -1
- package/package.json +18 -18
- package/dist/authoring-type-constructors-0Iv2zdwS-D4LlP1q2.mjs.map +0 -1
- package/dist/contract-builder-CrWbrtE4.mjs.map +0 -1
- package/dist/contract-builder-D-RSOsnc.d.mts.map +0 -1
- package/dist/control-D7jPD-Tk.mjs.map +0 -1
- package/dist/control-D9zFmpo0.d.mts.map +0 -1
- package/dist/interpreter-kQuqdyeP-B-rzJDWE.mjs.map +0 -1
- package/dist/pack-DNdZwm5w.d.mts.map +0 -1
- package/dist/psl-build-BT8Ue6gd.mjs.map +0 -1
- package/dist/psl-build-DU55bjfu.d.mts +0 -157
- package/dist/psl-build-DU55bjfu.d.mts.map +0 -1
- package/dist/psl-column-resolution-BCkhNzOK-DyfXnB-9.d.mts.map +0 -1
- package/dist/psl-field-resolution-C1E-_fQq-VUYD8cnS.mjs.map +0 -1
|
@@ -3,11 +3,10 @@ import { t as numeralText } from "./data-type-DKk8Unnz.mjs";
|
|
|
3
3
|
import { r as escapePslString } from "./data-type-support-C5-XxxeB.mjs";
|
|
4
4
|
import "./sql-expression-BJCuy-WI.mjs";
|
|
5
5
|
import { t as sqlFamilyError } from "./errors-B5g0xWro-mWH2C07F.mjs";
|
|
6
|
-
import { authoringTypeConstructorArguments, authoringTypeConstructors, castTypedValue,
|
|
6
|
+
import { authoringTypeConstructorArguments, authoringTypeConstructors, castTypedValue, instantiateAuthoringTypeConstructor, printTaggedLiteral, readWrittenValue } from "@prisma/orm-framework/components/authoring";
|
|
7
7
|
import { dataTypeId, dataTypeParams } from "@prisma/orm-framework/components/codec";
|
|
8
8
|
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
9
9
|
import { InternalError, isInternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
10
|
-
import { isRuntimeError } from "@prisma/orm-framework/components/components";
|
|
11
10
|
//#region ../../../2-sql/9-family/dist/psl-build.mjs
|
|
12
11
|
/** Every constructor of `authoringTypes` marked `inferred`, by the data type its codec represents. */
|
|
13
12
|
function inferredTypeConstructors(input) {
|
|
@@ -357,145 +356,55 @@ function sameForm(left, right) {
|
|
|
357
356
|
return other !== void 0 && sameForm(member, other);
|
|
358
357
|
});
|
|
359
358
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
function writtenArguments(printForm, column) {
|
|
380
|
-
const positional = [];
|
|
381
|
-
for (const [index, name] of printForm.typeParams.entries()) {
|
|
382
|
-
const value = column.typeParams?.[name];
|
|
383
|
-
if (value === void 0) break;
|
|
384
|
-
const text = pslTypeArgumentText(value);
|
|
385
|
-
if (text === void 0) return {
|
|
386
|
-
kind: "unwritable",
|
|
387
|
-
argument: name,
|
|
388
|
-
value
|
|
359
|
+
const GENERATOR_PHASES = ["onCreate", "onUpdate"];
|
|
360
|
+
/**
|
|
361
|
+
* The generator function call that writes each phase of a column's generators, as `@onCreate(...)` and `@onUpdate(...)` take it. A call must resolve back to the stored generator, so a list column, a generator no function writes for the codec, and a call that reads back differently are refused.
|
|
362
|
+
*/
|
|
363
|
+
function generatorCallsFor(input) {
|
|
364
|
+
const { executionDefault, field, list, generatorFunctions } = input;
|
|
365
|
+
const calls = [];
|
|
366
|
+
for (const phase of GENERATOR_PHASES) {
|
|
367
|
+
const generator = executionDefault[phase];
|
|
368
|
+
if (generator === void 0) continue;
|
|
369
|
+
if (list) return {
|
|
370
|
+
ok: false,
|
|
371
|
+
refusal: {
|
|
372
|
+
kind: "on-list",
|
|
373
|
+
phase,
|
|
374
|
+
generator
|
|
375
|
+
}
|
|
389
376
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
kind: "
|
|
395
|
-
|
|
377
|
+
const printed = generatorFunctions.callFor(generator, field);
|
|
378
|
+
if (printed === void 0) return {
|
|
379
|
+
ok: false,
|
|
380
|
+
refusal: {
|
|
381
|
+
kind: "no-function",
|
|
382
|
+
phase,
|
|
383
|
+
generator
|
|
396
384
|
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
value,
|
|
408
|
-
argument: {
|
|
409
|
-
kind: "named",
|
|
410
|
-
name,
|
|
411
|
-
value
|
|
385
|
+
};
|
|
386
|
+
const readBack = generatorFunctions.resolve(printed.call, field);
|
|
387
|
+
if (!readBack.ok || canonicalizeJson(readBack.generator) !== canonicalizeJson(generator)) return {
|
|
388
|
+
ok: false,
|
|
389
|
+
refusal: {
|
|
390
|
+
kind: "reads-back-differently",
|
|
391
|
+
phase,
|
|
392
|
+
generator,
|
|
393
|
+
text: printed.text,
|
|
394
|
+
readBack: readBack.ok ? readBack.generator : void 0
|
|
412
395
|
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
function rejectionOf(preset, args) {
|
|
421
|
-
try {
|
|
422
|
-
validateAuthoringHelperArguments(preset.path.join("."), preset.descriptor.args, args);
|
|
423
|
-
return;
|
|
424
|
-
} catch (error) {
|
|
425
|
-
if (isRuntimeError(error) && error.code === "CONTRACT.ARGUMENT_INVALID") return error.message;
|
|
426
|
-
throw error;
|
|
396
|
+
};
|
|
397
|
+
calls.push({
|
|
398
|
+
phase,
|
|
399
|
+
text: printed.text
|
|
400
|
+
});
|
|
427
401
|
}
|
|
428
|
-
}
|
|
429
|
-
function readBackDifferences(preset, column, args) {
|
|
430
|
-
const printed = instantiateAuthoringFieldPreset(preset.descriptor, args);
|
|
431
|
-
const printedGenerators = printed.executionDefaults ?? {};
|
|
432
|
-
return [
|
|
433
|
-
...printed.descriptor.codecId === column.codecId ? [] : [{
|
|
434
|
-
part: "codecId",
|
|
435
|
-
column: column.codecId,
|
|
436
|
-
printed: printed.descriptor.codecId
|
|
437
|
-
}],
|
|
438
|
-
...sameParams(column.typeParams, printed.descriptor.typeParams) ? [] : [{
|
|
439
|
-
part: "typeParams",
|
|
440
|
-
column: column.typeParams,
|
|
441
|
-
printed: printed.descriptor.typeParams
|
|
442
|
-
}],
|
|
443
|
-
...PHASES.flatMap((phase) => sameGenerator(column.generators[phase], printedGenerators[phase]) ? [] : [{
|
|
444
|
-
part: phase,
|
|
445
|
-
column: column.generators[phase],
|
|
446
|
-
printed: printedGenerators[phase]
|
|
447
|
-
}])
|
|
448
|
-
];
|
|
449
|
-
}
|
|
450
|
-
function cannotWrite(preset, reason) {
|
|
451
|
-
return {
|
|
452
|
-
kind: "cannotWrite",
|
|
453
|
-
preset,
|
|
454
|
-
reason
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* The call of the field preset in the stack that writes a column's codec with its generators. The call is written only for a column that is not a list and whose PSL type stands for its data type, which the preset call takes the place of, and when the preset accepts its arguments as the PSL reader checks them; it is then checked to read back with the column's codec, type params and generators with their params, where absent and empty params count as the same. Otherwise the reason it cannot be written that way.
|
|
459
|
-
*/
|
|
460
|
-
function fieldPresetCallFor(input) {
|
|
461
|
-
const { column } = input;
|
|
462
|
-
const byGenerator = input.fieldPresetsByCodecAndGenerator.get(column.codecId);
|
|
463
|
-
const preset = PHASES.map((phase) => column.generators[phase]?.id).map((generatorId) => generatorId === void 0 ? void 0 : byGenerator?.get(generatorId)).find((found) => found !== void 0);
|
|
464
|
-
if (preset === void 0) return { kind: "noPreset" };
|
|
465
|
-
const { pslType } = column;
|
|
466
|
-
if (pslType.kind !== "dataType") return cannotWrite(preset, {
|
|
467
|
-
kind: "columnType",
|
|
468
|
-
columnType: pslType.kind,
|
|
469
|
-
typeName: pslType.typeName
|
|
470
|
-
});
|
|
471
|
-
if (column.list) return cannotWrite(preset, { kind: "list" });
|
|
472
|
-
if (!writesEveryPhase(preset.printForm, column)) return cannotWrite(preset, { kind: "phasesNotWrittenTogether" });
|
|
473
|
-
const written = writtenArguments(preset.printForm, column);
|
|
474
|
-
if (written.kind === "unwritable") return cannotWrite(preset, {
|
|
475
|
-
kind: "unwritableArgument",
|
|
476
|
-
argument: written.argument,
|
|
477
|
-
value: written.value
|
|
478
|
-
});
|
|
479
|
-
const args = [];
|
|
480
|
-
for (const { index, value } of written.arguments) args[index] = value;
|
|
481
|
-
const rejection = rejectionOf(preset, args);
|
|
482
|
-
if (rejection !== void 0) return cannotWrite(preset, {
|
|
483
|
-
kind: "argumentsRejected",
|
|
484
|
-
message: rejection
|
|
485
|
-
});
|
|
486
|
-
const differences = readBackDifferences(preset, column, args);
|
|
487
|
-
if (differences.length > 0) return {
|
|
488
|
-
kind: "readsBackDifferently",
|
|
489
|
-
preset,
|
|
490
|
-
differences
|
|
491
|
-
};
|
|
492
402
|
return {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
arguments: written.arguments.map(({ argument }) => argument)
|
|
403
|
+
ok: true,
|
|
404
|
+
calls
|
|
496
405
|
};
|
|
497
406
|
}
|
|
498
407
|
//#endregion
|
|
499
|
-
export {
|
|
408
|
+
export { mapDefault as a, inferredTypeConstructors as i, generatorCallsFor as n, pslTypeArgumentText as o, inferColumnTypes as r, fewestArgumentsCall as t };
|
|
500
409
|
|
|
501
|
-
//# sourceMappingURL=psl-build-
|
|
410
|
+
//# sourceMappingURL=psl-build-BkxAXTwj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-build-BkxAXTwj.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/psl-build.mjs"],"sourcesContent":["import { t as sqlFamilyError } from \"./errors-B5g0xWro.mjs\";\nimport { s as toEnumMemberName } from \"./psl-names-C3cwe0rg.mjs\";\nimport { SQL_EXPRESSION_TAG } from \"@internal/sql-contract/sql-expression\";\nimport { authoringTypeConstructorArguments, authoringTypeConstructors, castTypedValue, instantiateAuthoringTypeConstructor, printTaggedLiteral, readWrittenValue } from \"@internal/framework-components/authoring\";\nimport { dataTypeId, dataTypeParams } from \"@internal/framework-components/codec\";\nimport { InternalError, isInternalError } from \"@internal/utils/internal-error\";\nimport { isSqlDataType, numeralText, resolveReportedSqlType } from \"@internal/sql-contract/data-type\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { escapePslString } from \"@internal/sql-contract/data-type-support\";\n//#region src/core/psl-build/inferred-type-constructors.ts\n/** Every constructor of `authoringTypes` marked `inferred`, by the data type its codec represents. */\nfunction inferredTypeConstructors(input) {\n\tconst found = /* @__PURE__ */ new Map();\n\tfor (const { path, descriptor } of authoringTypeConstructors(input.authoringTypes)) {\n\t\tif (descriptor.inferred !== true) continue;\n\t\tconst dataTypeId = input.codecLookup.descriptorFor(descriptor.output.codecId)?.dataType;\n\t\tconst dataType = dataTypeId === void 0 ? void 0 : input.dataTypeLookup.get(dataTypeId);\n\t\tif (dataType === void 0 || !isSqlDataType(dataType)) continue;\n\t\tfound.set(dataType.id, {\n\t\t\tpath,\n\t\t\tdescriptor,\n\t\t\tdataType\n\t\t});\n\t}\n\treturn found;\n}\nfunction normalParams(marked, args) {\n\ttry {\n\t\tconst { typeParams } = instantiateAuthoringTypeConstructor(marked.descriptor, args);\n\t\tconst params = dataTypeParams(marked.dataType, typeParams);\n\t\treturn canonicalizeJson(marked.dataType.sql.normalize(params));\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n}\n/**\n* The call to `marked` with the fewest arguments that produces `params`, the normal form of a\n* column's data type parameters: arguments are dropped from the end while the normal form of what\n* the call produces stays `params`. Undefined when the constructor cannot produce them, such as one\n* whose argument names another entity.\n*/\nfunction fewestArgumentsCall(marked, params) {\n\tconst all = authoringTypeConstructorArguments(marked.descriptor, {\n\t\tcodecId: marked.descriptor.output.codecId,\n\t\ttypeParams: params\n\t});\n\tif (all === void 0) return void 0;\n\tconst wanted = canonicalizeJson(params);\n\tconst args = [...all];\n\twhile (args.length > 0 && normalParams(marked, args.slice(0, -1)) === wanted) args.pop();\n\treturn {\n\t\tpath: marked.path,\n\t\targs\n\t};\n}\n/**\n* A type constructor argument as PSL writes it: a number or boolean as written, a string between quotes.\n* Undefined for any other value, such as an array or an object, and for a string PSL cannot carry, because a quote, backslash or line break in it would read back differently.\n*/\nfunction pslTypeArgumentText(value) {\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value !== \"string\") return void 0;\n\treturn escapePslString(value) === value ? `\"${value}\"` : void 0;\n}\n//#endregion\n//#region src/core/psl-build/column-types.ts\n/** The type the database reported for `column`, which introspection always records. */\nfunction reportedTypeOf(column, tableName) {\n\tif (column.reportedType === void 0) throw new InternalError(`contract infer read column \"${tableName}\".\"${column.name}\" without the type the database reported for it.`);\n\treturn column.reportedType;\n}\nfunction writtenCall(constructors, dataTypes, reported) {\n\tconst resolved = resolveReportedSqlType(reported, dataTypes);\n\tconst marked = resolved && constructors.get(resolved.dataType.id);\n\tconst call = resolved && marked && fewestArgumentsCall(marked, resolved.typeParams);\n\tif (call === void 0) return void 0;\n\tconst args = call.args.map(pslTypeArgumentText);\n\treturn args.every((arg) => arg !== void 0) ? {\n\t\tpath: call.path,\n\t\targs\n\t} : void 0;\n}\n/**\n* The type of every column of `tables` that `isEnumColumn` does not claim: the call, with the\n* fewest arguments, to the constructor marked `inferred` for the data type that claims the\n* column's reported type. When any column has no such call, throws\n* `CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED` listing every one of them.\n*/\nfunction inferColumnTypes(input) {\n\tconst dataTypes = [...input.constructors.values()].map((marked) => marked.dataType);\n\tconst types = /* @__PURE__ */ new Map();\n\tconst unclaimed = [];\n\tfor (const { schemaName, tableName, columns } of input.tables) for (const column of columns) {\n\t\tif (input.isEnumColumn(column)) continue;\n\t\tconst reported = reportedTypeOf(column, tableName);\n\t\tconst call = writtenCall(input.constructors, dataTypes, reported);\n\t\tif (call === void 0) {\n\t\t\tunclaimed.push(`${schemaName}.${tableName}.${column.name}: ${reported.text}${column.many === true ? \"[]\" : \"\"}`);\n\t\t\tcontinue;\n\t\t}\n\t\ttypes.set(JSON.stringify([tableName, column.name]), call);\n\t}\n\tif (unclaimed.length > 0) {\n\t\tconst columns = unclaimed.sort();\n\t\tthrow sqlFamilyError(\"CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED\", [\"contract infer: Prisma 8 cannot write these column types with the configured stack:\", ...columns.map((line) => ` ${line}`)].join(\"\\n\"), {\n\t\t\twhy: \"Prisma 8 reads a column type only through a data type that the target or an extension pack declares.\",\n\t\t\tfix: \"No configured pack has a type for these columns. If a type comes from a database extension that has a Prisma 8 pack, add the pack to extensions in prisma.config.ts. Otherwise change the column's type or remove the column from the database.\",\n\t\t\tmeta: { columns }\n\t\t});\n\t}\n\treturn (tableName, columnName) => {\n\t\tconst type = types.get(JSON.stringify([tableName, columnName]));\n\t\tif (type === void 0) throw new InternalError(`contract infer resolved no type for \"${tableName}\".\"${columnName}\".`);\n\t\treturn type;\n\t};\n}\n//#endregion\n//#region src/core/psl-build/default-mapping.ts\nconst DEFAULT_FUNCTION_ATTRIBUTES = {\n\t\"autoincrement()\": \"@default(autoincrement())\",\n\t\"now()\": \"@default(now())\"\n};\n/**\n* The attribute a stored default prints as: a named function, a literal the column takes, or any\n* other expression as a `sql` literal. `undefined` when a literal has no written form. An expression\n* prints even when the literal would read back as different text: default expressions are compared\n* with case and whitespace ignored (`SqlColumnDefaultIR.isEqualTo`), and canonicalization changes only\n* whitespace (ADR 129).\n*/\nfunction mapDefault(columnDefault, options) {\n\tswitch (columnDefault.kind) {\n\t\tcase \"literal\": {\n\t\t\tconst text = writeDefaultLiteral(columnDefault.value, options);\n\t\t\treturn text === void 0 ? void 0 : { attribute: `@default(${text})` };\n\t\t}\n\t\tcase \"function\": return { attribute: options?.functionAttributes?.[columnDefault.expression] ?? DEFAULT_FUNCTION_ATTRIBUTES[columnDefault.expression] ?? `@default(${printTaggedLiteral(SQL_EXPRESSION_TAG, columnDefault.expression)})` };\n\t}\n}\nfunction writingSurface(support) {\n\tconst entryOf = /* @__PURE__ */ new Map();\n\tconst tagTypes = [];\n\tfor (const [key, entry] of Object.entries(support.entries)) {\n\t\tconst written = entry.written;\n\t\tif (written.kind === \"tag\") {\n\t\t\tconst type = dataTypeId(key);\n\t\t\tif (!entryOf.has(type)) entryOf.set(type, entry);\n\t\t\ttagTypes.push(type);\n\t\t\tcontinue;\n\t\t}\n\t\tif (written.syntax === \"number\") {\n\t\t\tfor (const type of written.types) entryOf.set(type, entry);\n\t\t\tcontinue;\n\t\t}\n\t\tentryOf.set(key, entry);\n\t}\n\treturn {\n\t\tsupport,\n\t\tentryOf,\n\t\ttagTypes\n\t};\n}\nfunction readValue(surface, written) {\n\tconst read = readWrittenValue(surface.support, written);\n\treturn read.ok ? read.value : void 0;\n}\n/** The value of a tag's type that a stored document is, constructed by that type. */\nfunction tagValue(surface, type, value) {\n\ttry {\n\t\treturn surface.support.lookup.get(type)?.valueFrom(value, {});\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n}\n/**\n* Every value the stored form could be, in the order a written value would be read: a number or\n* numeral text through the number entry first, then the plain syntax that matches the shape, then\n* each tag, whose stored form is a whole document, which may itself be a number or a boolean.\n*/\nfunction classifications(value, surface) {\n\tconst found = [];\n\tif (typeof value === \"number\") found.push(readValue(surface, {\n\t\tkind: \"number\",\n\t\ttext: numeralText(value)\n\t}));\n\telse if (typeof value === \"boolean\") found.push(readValue(surface, {\n\t\tkind: \"boolean\",\n\t\tvalue\n\t}));\n\telse if (typeof value === \"string\") {\n\t\tfound.push(readValue(surface, {\n\t\t\tkind: \"number\",\n\t\t\ttext: value\n\t\t}));\n\t\tfound.push(readValue(surface, {\n\t\t\tkind: \"string\",\n\t\t\ttext: value\n\t\t}));\n\t}\n\tfor (const type of surface.tagTypes) found.push(tagValue(surface, type, value));\n\treturn found.filter((candidate) => candidate !== void 0);\n}\n/** What the column's type stores for `json` under the column's parameters, or `undefined` when it holds no such value. */\nfunction storedUnder(json, column, lookup) {\n\tconst type = lookup.get(column.id);\n\tif (type === void 0) return void 0;\n\ttry {\n\t\treturn type.toContract(type.valueFrom(json, column.params));\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n}\n/** The stored form the column takes this value as, spelled as its parameters give it, or `undefined` when its type takes no such value. */\nfunction admitted(candidate, column, surface) {\n\tconst cast = castTypedValue(surface.support, column.id, column.params, candidate);\n\treturn cast.ok ? cast.value.value : void 0;\n}\n/** The text of the literal: what the entry prints, before the syntax that fences it. */\nfunction printedText(entry, value) {\n\ttry {\n\t\treturn entry.print(value);\n\t} catch {\n\t\treturn;\n\t}\n}\n/** The printed text as the entry's syntax writes it, for reading back. */\nfunction writtenAs(entry, text) {\n\tconst written = entry.written;\n\tif (written.kind === \"tag\") return {\n\t\tkind: \"tag\",\n\t\ttag: written.tag,\n\t\ttext\n\t};\n\tif (written.syntax !== \"boolean\") return {\n\t\tkind: written.syntax,\n\t\ttext\n\t};\n\treturn text === \"true\" || text === \"false\" ? {\n\t\tkind: \"boolean\",\n\t\tvalue: text === \"true\"\n\t} : void 0;\n}\n/** What the printed text reads back as, through the same read a written value takes. */\nfunction readBack(surface, entry, text) {\n\tconst written = writtenAs(entry, text);\n\treturn written === void 0 ? void 0 : readValue(surface, written);\n}\nfunction literalText(entry, text) {\n\tconst written = entry.written;\n\tif (written.kind === \"tag\") return printTaggedLiteral(written.tag, text);\n\treturn written.syntax === \"string\" ? `\"${escapePslString(text)}\"` : text;\n}\n/**\n* The value written as the literal of one of its types, proven by reading the text straight back:\n* the same read, the same cast, and the stored form again. A number is tried first without the\n* trailing fraction zeros the column's scale spells it with.\n*/\nfunction writeScalar(value, column, surface) {\n\tconst shortest = withoutTrailingFractionZeros(value);\n\tconst candidates = [...shortest === void 0 ? [] : classifications(shortest, surface), ...classifications(value, surface)];\n\tfor (const candidate of candidates) {\n\t\tconst entry = surface.entryOf.get(candidate.type);\n\t\tif (entry === void 0) continue;\n\t\tconst stored = admitted(candidate, column, surface);\n\t\tif (stored === void 0 || !sameForm(stored, value)) continue;\n\t\tconst text = printedText(entry, candidate.value);\n\t\tif (text === void 0) continue;\n\t\tconst reread = readBack(surface, entry, text);\n\t\tif (reread === void 0) continue;\n\t\tconst restored = admitted(reread, column, surface);\n\t\tif (restored === void 0 || !sameForm(restored, value)) continue;\n\t\treturn literalText(entry, text);\n\t}\n}\nconst DECIMAL_WITH_FRACTION = /^-?\\d+\\.\\d+$/;\nfunction withoutTrailingFractionZeros(value) {\n\tif (typeof value !== \"string\" || !DECIMAL_WITH_FRACTION.test(value)) return void 0;\n\tconst shortened = value.replace(/0+$/, \"\").replace(/\\.$/, \"\");\n\treturn shortened === value ? void 0 : shortened;\n}\n/** One written element of a list, printed as a value of any type, with no column type to admit it. */\nfunction writeElement(value, of, surface) {\n\tfor (const candidate of classifications(value, surface)) {\n\t\tif (!of.includes(candidate.type)) continue;\n\t\tconst entry = surface.entryOf.get(candidate.type);\n\t\tif (entry === void 0) continue;\n\t\tconst text = printedText(entry, candidate.value);\n\t\tif (text === void 0) continue;\n\t\tconst reread = readBack(surface, entry, text);\n\t\tif (reread === void 0 || !of.includes(reread.type)) continue;\n\t\treturn {\n\t\t\ttext: literalText(entry, text),\n\t\t\tvalue: reread.value\n\t\t};\n\t}\n}\n/**\n* A written list on a scalar column, which the column type's list cast turns into its one value,\n* constructed by the column's type. Each element is classified on its own and must be of a type the\n* cast takes.\n*/\nfunction writeListCast(value, column, surface) {\n\tconst listCast = surface.support.lookup.get(column.id)?.listCast;\n\tif (listCast === void 0) return void 0;\n\tconst parts = [];\n\tconst elements = [];\n\tfor (const element of value) {\n\t\tconst written = writeElement(element, listCast.of, surface);\n\t\tif (written === void 0) return void 0;\n\t\tparts.push(written.text);\n\t\telements.push(written.value);\n\t}\n\tlet cast;\n\ttry {\n\t\tcast = listCast.cast(elements);\n\t} catch (error) {\n\t\tif (isInternalError(error)) throw error;\n\t\treturn;\n\t}\n\tconst stored = storedUnder(cast, column, surface.support.lookup);\n\treturn stored !== void 0 && sameForm(stored, value) ? `[${parts.join(\", \")}]` : void 0;\n}\nfunction writeDefaultLiteral(value, options) {\n\tif (value instanceof Date) return void 0;\n\tconst { dataTypes, columnCodec } = options ?? {};\n\tif (dataTypes === void 0 || columnCodec === void 0) return void 0;\n\tconst { lookup } = dataTypes;\n\tconst columnDataType = columnCodec.dataType;\n\tconst columnType = lookup.get(columnDataType);\n\tconst column = {\n\t\tid: columnDataType,\n\t\tparams: columnType === void 0 ? {} : dataTypeParams(columnType, options?.typeParams)\n\t};\n\tconst surface = writingSurface(dataTypes);\n\tif (options?.list === true) {\n\t\tif (!Array.isArray(value)) return void 0;\n\t\tconst parts = [];\n\t\tfor (const element of value) {\n\t\t\tconst written = writeScalar(element, column, surface);\n\t\t\tif (written === void 0) return void 0;\n\t\t\tparts.push(written);\n\t\t}\n\t\treturn `[${parts.join(\", \")}]`;\n\t}\n\tconst written = writeScalar(value, column, surface);\n\tif (written !== void 0) return written;\n\treturn Array.isArray(value) ? writeListCast(value, column, surface) : void 0;\n}\n/** Whether two stored forms are the same JSON value, member by member and element by element. */\nfunction sameForm(left, right) {\n\tif (left === right) return true;\n\tif (Array.isArray(left) !== Array.isArray(right)) return false;\n\tif (typeof left !== \"object\" || typeof right !== \"object\" || left === null || right === null) return false;\n\tconst members = Object.entries(left);\n\tconst others = new Map(Object.entries(right));\n\treturn members.length === others.size && members.every(([key, member]) => {\n\t\tconst other = others.get(key);\n\t\treturn other !== void 0 && sameForm(member, other);\n\t});\n}\n//#endregion\n//#region src/core/psl-build/generator-calls.ts\nconst GENERATOR_PHASES = [\"onCreate\", \"onUpdate\"];\n/**\n* The generator function call that writes each phase of a column's generators, as `@onCreate(...)` and `@onUpdate(...)` take it. A call must resolve back to the stored generator, so a list column, a generator no function writes for the codec, and a call that reads back differently are refused.\n*/\nfunction generatorCallsFor(input) {\n\tconst { executionDefault, field, list, generatorFunctions } = input;\n\tconst calls = [];\n\tfor (const phase of GENERATOR_PHASES) {\n\t\tconst generator = executionDefault[phase];\n\t\tif (generator === void 0) continue;\n\t\tif (list) return {\n\t\t\tok: false,\n\t\t\trefusal: {\n\t\t\t\tkind: \"on-list\",\n\t\t\t\tphase,\n\t\t\t\tgenerator\n\t\t\t}\n\t\t};\n\t\tconst printed = generatorFunctions.callFor(generator, field);\n\t\tif (printed === void 0) return {\n\t\t\tok: false,\n\t\t\trefusal: {\n\t\t\t\tkind: \"no-function\",\n\t\t\t\tphase,\n\t\t\t\tgenerator\n\t\t\t}\n\t\t};\n\t\tconst readBack = generatorFunctions.resolve(printed.call, field);\n\t\tif (!readBack.ok || canonicalizeJson(readBack.generator) !== canonicalizeJson(generator)) return {\n\t\t\tok: false,\n\t\t\trefusal: {\n\t\t\t\tkind: \"reads-back-differently\",\n\t\t\t\tphase,\n\t\t\t\tgenerator,\n\t\t\t\ttext: printed.text,\n\t\t\t\treadBack: readBack.ok ? readBack.generator : void 0\n\t\t\t}\n\t\t};\n\t\tcalls.push({\n\t\t\tphase,\n\t\t\ttext: printed.text\n\t\t});\n\t}\n\treturn {\n\t\tok: true,\n\t\tcalls\n\t};\n}\n//#endregion\nexport { fewestArgumentsCall, generatorCallsFor, inferColumnTypes, inferredTypeConstructors, mapDefault, pslTypeArgumentText, toEnumMemberName };\n\n//# sourceMappingURL=psl-build.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,yBAAyB,OAAO;CACxC,MAAM,wBAAwB,IAAI,IAAI;CACtC,KAAK,MAAM,EAAE,MAAM,gBAAgB,0BAA0B,MAAM,cAAc,GAAG;EACnF,IAAI,WAAW,aAAa,MAAM;EAClC,MAAM,aAAa,MAAM,YAAY,cAAc,WAAW,OAAO,OAAO,CAAC,EAAE;EAC/E,MAAM,WAAW,eAAe,KAAK,IAAI,KAAK,IAAI,MAAM,eAAe,IAAI,UAAU;EACrF,IAAI,aAAa,KAAK,KAAK,CAAC,cAAc,QAAQ,GAAG;EACrD,MAAM,IAAI,SAAS,IAAI;GACtB;GACA;GACA;EACD,CAAC;CACF;CACA,OAAO;AACR;AACA,SAAS,aAAa,QAAQ,MAAM;CACnC,IAAI;EACH,MAAM,EAAE,eAAe,oCAAoC,OAAO,YAAY,IAAI;EAClF,M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,KAAK,YAAY;EACzE,MAAM,QAAQ,OAAO,IAAI,GAAG;EAC5B,OAAO,UAAU,KAAK,KAAK,SAAS,QAAQ,KAAK;CAClD,CAAC;AACF;AAGA,MAAM,mBAAmB,CAAC,YAAY,UAAU;;;;AAIhD,SAAS,kBAAkB,OAAO;CACjC,MAAM,EAAE,kBAAkB,OAAO,MAAM,uBAAuB;CAC9D,MAAM,QAAQ,CAAC;CACf,KAAK,MAAM,SAAS,kBAAkB;EACrC,MAAM,YAAY,iBAAiB;EACnC,IAAI,cAAc,KAAK,GAAG;EAC1B,IAAI,MAAM,OAAO;GAChB,IAAI;GACJ,SAAS;IACR,MAAM;IACN;IACA;GACD;EACD;EACA,MAAM,UAAU,mBAAmB,QAAQ,WAAW,KAAK;EAC3D,IAAI,YAAY,KAAK,GAAG,OAAO;GAC9B,IAAI;GACJ,SAAS;IACR,MAAM;IACN;IACA;GACD;EACD;EACA,MAAM,WAAW,mBAAmB,QAAQ,QAAQ,MAAM,KAAK;EAC/D,IAAI,CAAC,SAAS,MAAM,iBAAiB,SAAS,SAAS,MAAM,iBAAiB,SAAS,GAAG,OAAO;GAChG,IAAI;GACJ,SAAS;IACR,MAAM;IACN;IACA;IACA,MAAM,QAAQ;IACd,UAAU,SAAS,KAAK,SAAS,YAAY,KAAK;GACnD;EACD;EACA,MAAM,KAAK;GACV;GACA,MAAM,QAAQ;EACf,CAAC;CACF;CACA,OAAO;EACN,IAAI;EACJ;CACD;AACD"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { u as SqlColumnIR } from "./types-B3AHHPDh-BHh-89fY.mjs";
|
|
2
|
+
import "./types-BGERR8XF.mjs";
|
|
3
|
+
import { r as SqlDataType, s as SqlTypeParams } from "./data-type-C84xngfv.mjs";
|
|
4
|
+
import "./default-mapping-CEISdj2g-DF1LzGBR.mjs";
|
|
5
|
+
import { AuthoringTypeConstructorCall, AuthoringTypeConstructorDescriptor, AuthoringTypeNamespace } from "@prisma/orm-framework/components/authoring";
|
|
6
|
+
import { CodecLookupWithDescriptors, DataTypeLookup } from "@prisma/orm-framework/components/codec";
|
|
7
|
+
import { ExecutionMutationDefaultPhases, ExecutionMutationDefaultValue } from "@prisma/orm-framework/contract/types";
|
|
8
|
+
import { GeneratorFunctionField, GeneratorFunctionRegistry, GeneratorPhase } from "@prisma/orm-framework/components/components";
|
|
9
|
+
//#region ../../../2-sql/9-family/dist/psl-build.d.mts
|
|
10
|
+
//#region src/core/psl-build/inferred-type-constructors.d.ts
|
|
11
|
+
/** The type constructor `contract infer` writes for a data type, with the data type it produces. */
|
|
12
|
+
interface InferredTypeConstructor {
|
|
13
|
+
readonly path: readonly string[];
|
|
14
|
+
readonly descriptor: AuthoringTypeConstructorDescriptor;
|
|
15
|
+
readonly dataType: SqlDataType;
|
|
16
|
+
}
|
|
17
|
+
/** The constructors marked `inferred` in a stack, keyed by the id of the data type each produces. */
|
|
18
|
+
type InferredTypeConstructors = ReadonlyMap<string, InferredTypeConstructor>;
|
|
19
|
+
/** Every constructor of `authoringTypes` marked `inferred`, by the data type its codec represents. */
|
|
20
|
+
declare function inferredTypeConstructors(input: {
|
|
21
|
+
readonly authoringTypes: AuthoringTypeNamespace;
|
|
22
|
+
readonly codecLookup: Pick<CodecLookupWithDescriptors, 'descriptorFor'>;
|
|
23
|
+
readonly dataTypeLookup: DataTypeLookup;
|
|
24
|
+
}): InferredTypeConstructors;
|
|
25
|
+
/**
|
|
26
|
+
* The call to `marked` with the fewest arguments that produces `params`, the normal form of a
|
|
27
|
+
* column's data type parameters: arguments are dropped from the end while the normal form of what
|
|
28
|
+
* the call produces stays `params`. Undefined when the constructor cannot produce them, such as one
|
|
29
|
+
* whose argument names another entity.
|
|
30
|
+
*/
|
|
31
|
+
declare function fewestArgumentsCall(marked: InferredTypeConstructor, params: SqlTypeParams): AuthoringTypeConstructorCall | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* A type constructor argument as PSL writes it: a number or boolean as written, a string between quotes.
|
|
34
|
+
* Undefined for any other value, such as an array or an object, and for a string PSL cannot carry, because a quote, backslash or line break in it would read back differently.
|
|
35
|
+
*/
|
|
36
|
+
declare function pslTypeArgumentText(value: unknown): string | undefined;
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/core/psl-build/column-types.d.ts
|
|
39
|
+
/** A call to a type constructor as PSL writes it: the constructor's path and its arguments' text. */
|
|
40
|
+
interface PslTypeCall {
|
|
41
|
+
readonly path: readonly string[];
|
|
42
|
+
readonly args: readonly string[];
|
|
43
|
+
}
|
|
44
|
+
/** The PSL type `contract infer` writes for a column that is not an enum, by table and column name. */
|
|
45
|
+
type ColumnTypeOf = (tableName: string, columnName: string) => PslTypeCall;
|
|
46
|
+
/** One introspected table, with the schema it was read from. */
|
|
47
|
+
interface IntrospectedTable {
|
|
48
|
+
readonly schemaName: string;
|
|
49
|
+
readonly tableName: string;
|
|
50
|
+
readonly columns: readonly SqlColumnIR[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The type of every column of `tables` that `isEnumColumn` does not claim: the call, with the
|
|
54
|
+
* fewest arguments, to the constructor marked `inferred` for the data type that claims the
|
|
55
|
+
* column's reported type. When any column has no such call, throws
|
|
56
|
+
* `CONTRACT.INFER_COLUMN_TYPE_UNCLAIMED` listing every one of them.
|
|
57
|
+
*/
|
|
58
|
+
declare function inferColumnTypes(input: {
|
|
59
|
+
readonly tables: readonly IntrospectedTable[];
|
|
60
|
+
readonly constructors: InferredTypeConstructors;
|
|
61
|
+
readonly isEnumColumn: (column: SqlColumnIR) => boolean;
|
|
62
|
+
}): ColumnTypeOf;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/core/psl-build/generator-calls.d.ts
|
|
65
|
+
/** The call text that writes one phase of a column's generators. */
|
|
66
|
+
interface PhaseCallText {
|
|
67
|
+
readonly phase: GeneratorPhase;
|
|
68
|
+
readonly text: string;
|
|
69
|
+
}
|
|
70
|
+
type GeneratorCallRefusal = {
|
|
71
|
+
readonly kind: 'on-list' | 'no-function';
|
|
72
|
+
readonly phase: GeneratorPhase;
|
|
73
|
+
readonly generator: ExecutionMutationDefaultValue;
|
|
74
|
+
} | {
|
|
75
|
+
readonly kind: 'reads-back-differently';
|
|
76
|
+
readonly phase: GeneratorPhase;
|
|
77
|
+
readonly generator: ExecutionMutationDefaultValue;
|
|
78
|
+
readonly text: string;
|
|
79
|
+
readonly readBack: ExecutionMutationDefaultValue | undefined;
|
|
80
|
+
};
|
|
81
|
+
type GeneratorCallsResult = {
|
|
82
|
+
readonly ok: true;
|
|
83
|
+
readonly calls: readonly PhaseCallText[];
|
|
84
|
+
} | {
|
|
85
|
+
readonly ok: false;
|
|
86
|
+
readonly refusal: GeneratorCallRefusal;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The generator function call that writes each phase of a column's generators, as `@onCreate(...)` and `@onUpdate(...)` take it. A call must resolve back to the stored generator, so a list column, a generator no function writes for the codec, and a call that reads back differently are refused.
|
|
90
|
+
*/
|
|
91
|
+
declare function generatorCallsFor(input: {
|
|
92
|
+
readonly executionDefault: ExecutionMutationDefaultPhases;
|
|
93
|
+
readonly field: GeneratorFunctionField;
|
|
94
|
+
readonly list: boolean;
|
|
95
|
+
readonly generatorFunctions: GeneratorFunctionRegistry;
|
|
96
|
+
}): GeneratorCallsResult;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/core/psl-build/psl-names.d.ts
|
|
99
|
+
/**
|
|
100
|
+
* PSL member name for a native-enum value. The value itself always prints
|
|
101
|
+
* explicitly (`member = "value"`), so the returned name never needs a map:
|
|
102
|
+
* a value that already is a valid, non-reserved identifier is kept verbatim
|
|
103
|
+
* (case included); anything else is camelCased/escaped like a field name.
|
|
104
|
+
*/
|
|
105
|
+
declare function toEnumMemberName(value: string): string;
|
|
106
|
+
//#endregion
|
|
107
|
+
export { InferredTypeConstructors as a, PslTypeCall as c, inferColumnTypes as d, inferredTypeConstructors as f, InferredTypeConstructor as i, fewestArgumentsCall as l, toEnumMemberName as m, GeneratorCallRefusal as n, IntrospectedTable as o, pslTypeArgumentText as p, GeneratorCallsResult as r, PhaseCallText as s, ColumnTypeOf as t, generatorCallsFor as u };
|
|
108
|
+
//# sourceMappingURL=psl-build-O7_tXQ1E.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-build-O7_tXQ1E.d.mts","names":[],"sources":["../../../../2-sql/9-family/dist/psl-build.d.mts"],"mappings":";;;;;;;;;;;UASU;WACC;WACA,YAAY;WACZ,UAAU;;;KAGhB,2BAA2B,oBAAoB;;iBAEnC,yBAAyB;WAC/B,gBAAgB;WAChB,aAAa,KAAK;WAClB,gBAAgB;IACvB;;;;;;;iBAOa,oBAAoB,QAAQ,yBAAyB,QAAQ,gBAAgB;;;;;iBAK7E,oBAAoB;;;;UAI3B;WACC;WACA;;;KAGN,gBAAgB,mBAAmB,uBAAuB;;UAErD;WACC;WACA;WACA,kBAAkB;;;;;;;;iBAQZ,iBAAiB;WACvB,iBAAiB;WACjB,cAAc;WACd,eAAe,QAAQ;IAC9B;;;;UAIM;WACC,OAAO;WACP;;KAEN;WACM;WACA,OAAO;WACP,WAAW;;WAEX;WACA,OAAO;WACP,WAAW;WACX;WACA,UAAU;;KAEhB;WACM;WACA,gBAAgB;;WAEhB;WACA,SAAS;;;;;iBAKH,kBAAkB;WACxB,kBAAkB;WAClB,OAAO;WACP;WACA,oBAAoB;IAC3B;;;;;;;;;iBASa,iBAAiB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./contract-builder-
|
|
1
|
+
import "./contract-builder-GH-eCIpl.mjs";
|
|
2
2
|
import { AuthoringTypeConstructorDescriptor } from "@prisma/orm-framework/components/authoring";
|
|
3
3
|
import { CodecLookupWithDescriptors } from "@prisma/orm-framework/components/codec";
|
|
4
4
|
import { ColumnDefault, ExecutionMutationDefaultPhases, ValueSetRef } from "@prisma/orm-framework/contract/types";
|
|
5
5
|
import { Binder } from "@prisma/orm-framework/psl-parser";
|
|
6
6
|
import "@prisma/orm-framework/components/control";
|
|
7
|
-
//#region ../../../2-sql/2-authoring/contract-psl/dist/psl-column-resolution-
|
|
7
|
+
//#region ../../../2-sql/2-authoring/contract-psl/dist/psl-column-resolution-DNdqpUxt.d.mts
|
|
8
8
|
//#region src/psl-column-resolution.d.ts
|
|
9
9
|
type ColumnDescriptor = {
|
|
10
10
|
readonly codecId: string;
|
|
@@ -22,4 +22,4 @@ type ColumnDescriptor = {
|
|
|
22
22
|
};
|
|
23
23
|
//#endregion
|
|
24
24
|
export { ColumnDescriptor as t };
|
|
25
|
-
//# sourceMappingURL=psl-column-resolution-
|
|
25
|
+
//# sourceMappingURL=psl-column-resolution-DNdqpUxt-C8BST0uW.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psl-column-resolution-DNdqpUxt-C8BST0uW.d.mts","names":[],"sources":["../../../../2-sql/2-authoring/contract-psl/dist/psl-column-resolution-DNdqpUxt.d.mts"],"mappings":";;;;;;;;KASK;WACM;WACA;WACA,aAAa;;;;;;;;;WASb,WAAW"}
|