@prisma/orm-toolchain 8.0.0-rc.18-dev.6 → 8.0.0-rc.18-dev.8

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.
Files changed (38) hide show
  1. package/dist/cli-telemetry.mjs +1 -1
  2. package/dist/cli.mjs +5 -5
  3. package/dist/cli__control-api.d.mts +1 -1
  4. package/dist/cli__control-api.mjs +1 -1
  5. package/dist/cli__migration-cli.mjs +1 -1
  6. package/dist/config-loader.mjs +1 -1
  7. package/dist/{domain-type-generation-Bsqbaqj5-CRHf18kl.mjs → domain-type-generation-BRVQvoy8-CcRke3tl.mjs} +121 -14
  8. package/dist/domain-type-generation-BRVQvoy8-CcRke3tl.mjs.map +1 -0
  9. package/dist/{domain-type-generation-W1f7UBwI-CwzLK5TL.d.mts → domain-type-generation-B_tgVA9W-DdPq_876.d.mts} +37 -3
  10. package/dist/domain-type-generation-B_tgVA9W-DdPq_876.d.mts.map +1 -0
  11. package/dist/emitter.d.mts +2 -2
  12. package/dist/emitter.mjs +2 -2
  13. package/dist/emitter__domain-type-generation.d.mts +2 -2
  14. package/dist/emitter__domain-type-generation.mjs +2 -2
  15. package/dist/{exports-BP5EU7G8-CdTO3MPb.mjs → exports-CBaM-1YD-CJuFjV3_.mjs} +27 -10
  16. package/dist/exports-CBaM-1YD-CJuFjV3_.mjs.map +1 -0
  17. package/dist/{exports-CELbmah_.mjs → exports-D1qqHTu1.mjs} +2 -2
  18. package/dist/{exports-CELbmah_.mjs.map → exports-D1qqHTu1.mjs.map} +1 -1
  19. package/dist/{exports-cWMrCC0a.mjs → exports-DsqGwQ1B.mjs} +2 -2
  20. package/dist/{exports-cWMrCC0a.mjs.map → exports-DsqGwQ1B.mjs.map} +1 -1
  21. package/dist/{import-roots-B6vrm5bT.mjs → import-roots-DXD7fung.mjs} +2 -2
  22. package/dist/{import-roots-B6vrm5bT.mjs.map → import-roots-DXD7fung.mjs.map} +1 -1
  23. package/dist/{index-C1kfLErt.d.mts → index-Co6ho75S.d.mts} +4 -3
  24. package/dist/index-Co6ho75S.d.mts.map +1 -0
  25. package/dist/publish-surface.mjs +2 -2
  26. package/dist/publish-surface__import-roots.mjs +1 -1
  27. package/dist/publish-surface__shells.mjs +1 -1
  28. package/dist/{ref-D0TsCUZG-Cyf9-Rs6.mjs → ref-D0TsCUZG-jEQXQOEL.mjs} +4 -4
  29. package/dist/{ref-D0TsCUZG-Cyf9-Rs6.mjs.map → ref-D0TsCUZG-jEQXQOEL.mjs.map} +1 -1
  30. package/dist/{shells-DVHHju1S.mjs → shells-CyW1wrP1.mjs} +2 -1
  31. package/dist/shells-CyW1wrP1.mjs.map +1 -0
  32. package/dist/vite-plugin-contract-emit.mjs +3 -3
  33. package/package.json +12 -12
  34. package/dist/domain-type-generation-Bsqbaqj5-CRHf18kl.mjs.map +0 -1
  35. package/dist/domain-type-generation-W1f7UBwI-CwzLK5TL.d.mts.map +0 -1
  36. package/dist/exports-BP5EU7G8-CdTO3MPb.mjs.map +0 -1
  37. package/dist/index-C1kfLErt.d.mts.map +0 -1
  38. package/dist/shells-DVHHju1S.mjs.map +0 -1
@@ -42,7 +42,7 @@ async function loadProjectConfig(projectRoot) {
42
42
  const orm = config["orm"];
43
43
  if (orm === null || typeof orm !== "object" || Array.isArray(orm)) return EMPTY_PROJECT_CONFIG;
44
44
  config = blindCast(orm);
45
- const { validateOrmSection } = await import("./exports-CELbmah_.mjs").then((n) => n.o);
45
+ const { validateOrmSection } = await import("./exports-D1qqHTu1.mjs").then((n) => n.o);
46
46
  const validation = validateOrmSection(config, {
47
47
  files: [],
48
48
  keys: {}
package/dist/cli.mjs CHANGED
@@ -1,17 +1,17 @@
1
- import { a as expandContractInputs, c as globContractInputMatching, d as loadConfigFiles, g as requireConfigSections, h as ormConfigSection, i as evaluateConfigModule, r as buildLoadedConfig } from "./exports-CELbmah_.mjs";
1
+ import { a as expandContractInputs, c as globContractInputMatching, d as loadConfigFiles, g as requireConfigSections, h as ormConfigSection, i as evaluateConfigModule, r as buildLoadedConfig } from "./exports-D1qqHTu1.mjs";
2
2
  import { t as MigrationToolsError } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
3
3
  import { t as contractSnapshotDir } from "./contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs";
4
4
  import { s as readMigrationsDir } from "./io-CUFeeOVP-CEgOEVwW.mjs";
5
5
  import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
6
6
  import { c as spaceMigrationDirectory, l as spaceRefsDirectory } from "./verify-contract-spaces-sL5mlmCX-K2P69KDp.mjs";
7
7
  import { A as errorMigrationPackageNotFound, B as errorRunnerFailed, C as errorFileNotFound, D as errorLegendHumanOnly, H as errorSignRefsNotWritten, J as errorStatementNeedsMigrationFile, M as errorNoMigrations, N as errorPathUnreachable, Q as errorTargetMismatch, S as errorDriverRequired, T as errorHashMismatch, V as errorRuntime, Z as errorTargetMigrationNotSupported, _ as errorContractArgConflict, a as appRefsDirFor, at as printedPlanCommand, b as errorConvertAndDelete, c as cliCommand, ct as requireLiveDatabase, dt as runCommandAction, f as contractPathFor, ft as selfEmitCommand, g as errorConfigValidation$1, ht as targetSupportsMigrations, i as appMigrationsDirFor, it as printedPath, j as errorMigrationPlanningFailed, k as errorMarkerMissing, l as cliInvocation, m as errorAdvanceRefArgConflict, mt as statementFlag, n as CliStructuredError$1$1, nt as maskConnectionUrl, o as baseDirFor, ot as readContractEnvelope, p as displayPath, pt as shellQuoted, rt as migrationsDirFor, s as chooseAction, st as redactUrlCredentials, t as ActionableCliError, u as closeQuietly, v as errorContractConfigMissing, w as errorFromCaught, x as errorDatabaseConnectionRequired, y as errorContractValidationFailed } from "./caught-errors-olsx_RBn-Cg0ilJtv.mjs";
8
- import { r as getEmittedArtifactPaths } from "./exports-BP5EU7G8-CdTO3MPb.mjs";
8
+ import { r as getEmittedArtifactPaths } from "./exports-CBaM-1YD-CJuFjV3_.mjs";
9
9
  import { r as isInSpaceHistory } from "./graph-membership-C-5WMh1R-BUtW54H2.mjs";
10
10
  import { d as writeRef, r as readRef } from "./refs-CS997f-J-BxkRLuCE.mjs";
11
11
  import { a as contractHashAtMarker } from "./aggregate-CJjYCgNP.mjs";
12
- import { i as createScaffoldSpecifierResolver } from "./import-roots-B6vrm5bT.mjs";
12
+ import { i as createScaffoldSpecifierResolver } from "./import-roots-DXD7fung.mjs";
13
13
  import { o as isLiveMarkerRef } from "./ref-resolution-kNMjYJ26.mjs";
14
- import { $ as refuseMissingInvariantPath, A as executeRefDeleteCommand, B as loadContractRawSafely, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as mapContractAtError, H as loadContractSourceWithStack, I as isStatementVerb, J as preflightRefAdvancement, L as listRefsByContractHash, M as executeRefSetCommand, N as findPackageByDirPath, O as executeMigrationPlanCommand, P as formatSourceDiagnostic, Q as refuseMarkerOutsideGraph, R as liveMarkerUse, U as loadContractSpaceAggregateForCli, V as loadContractSource, W as looksLikePath, X as refuseContractSpaceIntegrity, Y as readMigrationRefs, _ as deriveStatusEdgeAnnotations, _t as toDeclaredExtensionsFromRaw, a as RECORDED_OR_EMPTY_CONTRACT_REF_FORMS, at as resolveContractRefToSnapshot, b as enumerateCheckSpaces, c as appliedHashesFromLedger, d as buildReadAggregate, et as refusePackageCorruptionOnAggregate, f as buildRefAdvancementFields, ft as runMigrationCheck, g as createControlClient, gt as statusForMigrationHash, h as convertAndDelete, ht as sourceWarningDiagnostic, i as RECORDED_CONTRACT_REF_FORMS, it as resolveContractRef$1, j as executeRefListCommand, m as computeRefAdvancementName, mt as snapshotVerifierFor, n as DB_UPDATE_POLICY, nt as requireDatabaseForLiveMarkerUse, o as advanceRefSafely, p as checkSingleTarget, pt as runMigrationList, q as migrationSpaceListEntriesFromAggregate, r as NO_REF_ADVANCEMENT, rt as resolveAppTargetPath, st as resolveMigrationRef, t as ALL_CONTRACT_REF_FORMS, tt as refuseUnknownInvariants, u as buildMigrationSpaceGraphEntries, ut as retryCommandFor, vt as validateLoadedContract, x as executeContractEmit, z as loadAggregateIntegrityViolations } from "./ref-D0TsCUZG-Cyf9-Rs6.mjs";
14
+ import { $ as refuseMissingInvariantPath, A as executeRefDeleteCommand, B as loadContractRawSafely, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as mapContractAtError, H as loadContractSourceWithStack, I as isStatementVerb, J as preflightRefAdvancement, L as listRefsByContractHash, M as executeRefSetCommand, N as findPackageByDirPath, O as executeMigrationPlanCommand, P as formatSourceDiagnostic, Q as refuseMarkerOutsideGraph, R as liveMarkerUse, U as loadContractSpaceAggregateForCli, V as loadContractSource, W as looksLikePath, X as refuseContractSpaceIntegrity, Y as readMigrationRefs, _ as deriveStatusEdgeAnnotations, _t as toDeclaredExtensionsFromRaw, a as RECORDED_OR_EMPTY_CONTRACT_REF_FORMS, at as resolveContractRefToSnapshot, b as enumerateCheckSpaces, c as appliedHashesFromLedger, d as buildReadAggregate, et as refusePackageCorruptionOnAggregate, f as buildRefAdvancementFields, ft as runMigrationCheck, g as createControlClient, gt as statusForMigrationHash, h as convertAndDelete, ht as sourceWarningDiagnostic, i as RECORDED_CONTRACT_REF_FORMS, it as resolveContractRef$1, j as executeRefListCommand, m as computeRefAdvancementName, mt as snapshotVerifierFor, n as DB_UPDATE_POLICY, nt as requireDatabaseForLiveMarkerUse, o as advanceRefSafely, p as checkSingleTarget, pt as runMigrationList, q as migrationSpaceListEntriesFromAggregate, r as NO_REF_ADVANCEMENT, rt as resolveAppTargetPath, st as resolveMigrationRef, t as ALL_CONTRACT_REF_FORMS, tt as refuseUnknownInvariants, u as buildMigrationSpaceGraphEntries, ut as retryCommandFor, vt as validateLoadedContract, x as executeContractEmit, z as loadAggregateIntegrityViolations } from "./ref-D0TsCUZG-jEQXQOEL.mjs";
15
15
  import { a as PRISMA7_QUICK_REFERENCE_STEP, i as PRISMA7_LOOP_STEP, n as InitOutputSchema, o as buildNextSteps, r as NEXT_STEPS_BEFORE_SCAFFOLD, t as DB_SIGN_STEP } from "./output-BcC8eB0h-C5bRd-aC.mjs";
16
16
  import { createRequire } from "node:module";
17
17
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
@@ -7160,7 +7160,7 @@ const lspCommand = defineServerCommand({
7160
7160
  } },
7161
7161
  handler: async (args, io) => {
7162
7162
  const exitCode = await withoutClientProcessIdInArgv(async () => {
7163
- const { startServer } = await import("./exports-cWMrCC0a.mjs");
7163
+ const { startServer } = await import("./exports-DsqGwQ1B.mjs");
7164
7164
  return startServer({
7165
7165
  stdin: io.stdin,
7166
7166
  stdout: io.stdout,
@@ -7,7 +7,7 @@ import { i as Refs, n as RefEntry } from "./refs-BNCUu58Y-BIso5Jfg.mjs";
7
7
  import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
8
8
  import { a as MigrationRef, t as ContractRef } from "./ref-resolution-BPhR-kta.mjs";
9
9
  import { $ as executeDbVerify, A as EmitResult, B as PlanQuestion, C as DbUpdateOptions, D as EmitFailure, E as EmitContractConfig, F as ExecuteDbVerifyResult, G as RenderContractDtsResult, H as RenderContractDtsFailure, I as IntrospectOptions, J as StatementText, K as RenderContractDtsSuccess, M as ExecuteDbSignOptions, N as ExecuteDbSignResult, O as EmitFailureCode, P as ExecuteDbVerifyOptions, Q as executeDbSign, R as OnControlProgress, S as DbUpdateFailureCode, T as DbUpdateSuccess, U as RenderContractDtsFailureCode, V as PlanQuestionVerb, W as RenderContractDtsOptions, X as TemporaryValueReport, Y as StatementVerb, Z as VerifyOptions, _ as DbInitSuccess, a as CliStructuredError$2, b as DbSignSpaceOutcome, c as ControlActionName, d as ControlProgressEvent, f as CreateControlClient, g as DbInitResult, h as DbInitOptions, i as AskedSubject, j as EmitSuccess, k as EmitOptions, l as ControlClient, m as DbInitFailureCode, n as AppliedStatementReport, o as ContractEmitOptions, p as DbInitFailure, q as SchemaVerifyOptions, r as AskedDataLoss, s as ContractEmitResult, t as AnswerPlanQuestions, u as ControlClientOptions, v as DbSignOptions, w as DbUpdateResult, x as DbUpdateFailure, y as DbSignSpaceFailure, z as PlanAnswer } from "./db-sign-D90hPxFE-B-YLAvFQ.mjs";
10
- import { a as emit } from "./index-C1kfLErt.mjs";
10
+ import { a as emit } from "./index-Co6ho75S.mjs";
11
11
  import { f as IntegrityQueryOptions, l as ContractSpaceAggregate, m as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-MAVa_CD0.mjs";
12
12
  import "./metadata-BtscDay2.mjs";
13
13
  import "./package-N9PPdFV_.mjs";
@@ -1,3 +1,3 @@
1
1
  import { w as errorFromCaught } from "./caught-errors-olsx_RBn-Cg0ilJtv.mjs";
2
- import { $ as refuseMissingInvariantPath, A as executeRefDeleteCommand, B as loadContractRawSafely, C as executeDbSign, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as mapContractAtError, J as preflightRefAdvancement, K as mapIntegrityViolations, L as listRefsByContractHash, M as executeRefSetCommand, O as executeMigrationPlanCommand, Q as refuseMarkerOutsideGraph, S as executeDbInit, T as executeDbVerify, U as loadContractSpaceAggregateForCli, V as loadContractSource, X as refuseContractSpaceIntegrity, Y as readMigrationRefs, Z as refuseDeclaredExtensionTargetMismatch, _ as deriveStatusEdgeAnnotations, at as resolveContractRefToSnapshot, b as enumerateCheckSpaces, c as appliedHashesFromLedger, ct as resolveStatements, d as buildReadAggregate, dt as runContractSpaceSeedPhase, et as refusePackageCorruptionOnAggregate, f as buildRefAdvancementFields, ft as runMigrationCheck, g as createControlClient, gt as statusForMigrationHash, it as resolveContractRef$1, j as executeRefListCommand, k as executeRefAdvancement, l as buildContractSpaceAggregate, lt as resolveToForPlan, m as computeRefAdvancementName, o as advanceRefSafely, ot as resolveFromForPlan, p as checkSingleTarget, pt as runMigrationList, q as migrationSpaceListEntriesFromAggregate, r as NO_REF_ADVANCEMENT, s as appContractStandInFromIdentity, st as resolveMigrationRef, tt as refuseUnknownInvariants, u as buildMigrationSpaceGraphEntries, v as disposeEmitQueue, w as executeDbUpdate, x as executeContractEmit, y as enrichContract, z as loadAggregateIntegrityViolations } from "./ref-D0TsCUZG-Cyf9-Rs6.mjs";
2
+ import { $ as refuseMissingInvariantPath, A as executeRefDeleteCommand, B as loadContractRawSafely, C as executeDbSign, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, G as mapContractAtError, J as preflightRefAdvancement, K as mapIntegrityViolations, L as listRefsByContractHash, M as executeRefSetCommand, O as executeMigrationPlanCommand, Q as refuseMarkerOutsideGraph, S as executeDbInit, T as executeDbVerify, U as loadContractSpaceAggregateForCli, V as loadContractSource, X as refuseContractSpaceIntegrity, Y as readMigrationRefs, Z as refuseDeclaredExtensionTargetMismatch, _ as deriveStatusEdgeAnnotations, at as resolveContractRefToSnapshot, b as enumerateCheckSpaces, c as appliedHashesFromLedger, ct as resolveStatements, d as buildReadAggregate, dt as runContractSpaceSeedPhase, et as refusePackageCorruptionOnAggregate, f as buildRefAdvancementFields, ft as runMigrationCheck, g as createControlClient, gt as statusForMigrationHash, it as resolveContractRef$1, j as executeRefListCommand, k as executeRefAdvancement, l as buildContractSpaceAggregate, lt as resolveToForPlan, m as computeRefAdvancementName, o as advanceRefSafely, ot as resolveFromForPlan, p as checkSingleTarget, pt as runMigrationList, q as migrationSpaceListEntriesFromAggregate, r as NO_REF_ADVANCEMENT, s as appContractStandInFromIdentity, st as resolveMigrationRef, tt as refuseUnknownInvariants, u as buildMigrationSpaceGraphEntries, v as disposeEmitQueue, w as executeDbUpdate, x as executeContractEmit, y as enrichContract, z as loadAggregateIntegrityViolations } from "./ref-D0TsCUZG-jEQXQOEL.mjs";
3
3
  export { NO_REF_ADVANCEMENT, advanceRefSafely, appContractStandInFromIdentity, appliedHashesFromLedger, buildContractSpaceAggregate, buildMigrationSpaceGraphEntries, buildReadAggregate, buildRefAdvancementFields, checkSingleTarget, computeRefAdvancementName, createControlClient, deriveStatusEdgeAnnotations, disposeEmitQueue, enrichContract, enumerateCheckSpaces, errorFromCaught, executeContractEmit, executeDbInit, executeDbSign, executeDbUpdate, executeDbVerify, executeMigrateShowPlan, executeMigrationNewCommand, executeMigrationPlanCommand, executeRefAdvancement, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand, hasMigrationPath, listRefsByContractHash, loadAggregateIntegrityViolations, loadContractRawSafely, loadContractSource, loadContractSpaceAggregateForCli, mapContractAtError, mapIntegrityViolations, migrationSpaceListEntriesFromAggregate, preflightRefAdvancement, readMigrationRefs, refuseContractSpaceIntegrity, refuseDeclaredExtensionTargetMismatch, refuseMarkerOutsideGraph, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef$1 as resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveStatements, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
@@ -1,4 +1,4 @@
1
- import { g as requireConfigSections, p as loadConfigForSections, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-CELbmah_.mjs";
1
+ import { g as requireConfigSections, p as loadConfigForSections, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-D1qqHTu1.mjs";
2
2
  import { g as errorInvalidJson } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
3
3
  import { rt as migrationsDirFor, w as errorFromCaught } from "./caught-errors-olsx_RBn-Cg0ilJtv.mjs";
4
4
  import { r as buildMigrationArtifacts } from "./migration-CZrQ_3zY.mjs";
@@ -1,2 +1,2 @@
1
- import { _ as validateOrmSection, a as expandContractInputs, c as globContractInputMatching, d as loadConfigFiles, f as loadConfigForFile, g as requireConfigSections, h as ormConfigSection, i as evaluateConfigModule, l as isConfigSection, m as ormConfigSchema, n as ORM_CONFIG_SECTION_NAME, p as loadConfigForSections, r as buildLoadedConfig, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-CELbmah_.mjs";
1
+ import { _ as validateOrmSection, a as expandContractInputs, c as globContractInputMatching, d as loadConfigFiles, f as loadConfigForFile, g as requireConfigSections, h as ormConfigSection, i as evaluateConfigModule, l as isConfigSection, m as ormConfigSchema, n as ORM_CONFIG_SECTION_NAME, p as loadConfigForSections, r as buildLoadedConfig, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-D1qqHTu1.mjs";
2
2
  export { CONFIG_FILENAME, ORM_CONFIG_SECTION_NAME, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };
@@ -3,7 +3,7 @@ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
3
3
  import { blindCast } from "@prisma/orm-framework/utils/casts";
4
4
  import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
5
5
  import { renderImports, tsStringLiteral } from "@prisma/orm-framework/ts-render";
6
- //#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-Bsqbaqj5.mjs
6
+ //#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-BRVQvoy8.mjs
7
7
  function emitterError(code, message, options) {
8
8
  return structuredError(code, message, options);
9
9
  }
@@ -183,6 +183,35 @@ function renderValueSetType(values, codecId, side, codecLookup) {
183
183
  }
184
184
  return literals.join(" | ");
185
185
  }
186
+ /** The local alias an emitted `contract.d.ts` types a column with type parameters through. */
187
+ const CODEC_OUTPUT_FOR = "CodecOutputFor";
188
+ /** The local alias for the union of the stack's parameterized output type functions. */
189
+ const PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS = "ParameterizedOutputTypeFunctions";
190
+ /** The declaration of {@link CODEC_OUTPUT_FOR}: `ParameterizedOutputType` from `@internal/contract/types` applied to {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, falling back to the codec's plain output type. */
191
+ const codecOutputForAlias = `type ${CODEC_OUTPUT_FOR}<CodecId extends keyof CodecTypes, TypeParams extends Record<string, unknown>> = ParameterizedOutputType<${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, CodecId, TypeParams, CodecTypes[CodecId]["output"]>;`;
192
+ /** The declaration of {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} for the type functions the stack's components declare. */
193
+ function parameterizedOutputTypeFunctionsAlias(typeFunctions) {
194
+ const aliases = [...new Set(typeFunctions.map((typeFunction) => typeFunction.alias))];
195
+ return `type ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} = ${aliases.length > 0 ? aliases.join(" | ") : "never"};`;
196
+ }
197
+ /**
198
+ * The output type of a value of codec `codecId` in a column with these type parameters. A codec that renders its own type text (`renderOutputType`) gets that text. Otherwise a column with type parameters is typed through {@link CODEC_OUTPUT_FOR}, which applies the stack's type functions as the field type generic does and falls back to the codec's plain output type; a column without them gets the plain output type.
199
+ */
200
+ function codecOutputType(codecId, typeParams, codecLookup) {
201
+ const plain = `CodecTypes[${serializeValue(codecId)}]["output"]`;
202
+ if (typeParams === void 0) return plain;
203
+ const rendered = codecLookup?.renderOutputTypeFor(codecId, typeParams);
204
+ if (rendered && isSafeTypeExpression(rendered)) return rendered;
205
+ return `${CODEC_OUTPUT_FOR}<${serializeValue(codecId)}, ${serializeValue(typeParams)}>`;
206
+ }
207
+ /** The input type of a value of codec `codecId` in a column with these type parameters: the text the codec renders (`renderInputType`), or its plain input type. */
208
+ function codecInputType(codecId, typeParams, codecLookup) {
209
+ if (codecLookup !== void 0 && typeParams !== void 0) {
210
+ const rendered = codecLookup.renderInputTypeFor?.(codecId, typeParams);
211
+ if (rendered && isSafeTypeExpression(rendered)) return rendered;
212
+ }
213
+ return `CodecTypes[${serializeValue(codecId)}]["input"]`;
214
+ }
186
215
  function resolveFieldType(field, codecLookup, resolvedValueSet) {
187
216
  const { type } = field;
188
217
  switch (type.kind) {
@@ -195,19 +224,10 @@ function resolveFieldType(field, codecLookup, resolvedValueSet) {
195
224
  input: applyModifiers(input, field)
196
225
  };
197
226
  }
198
- let outputResolved;
199
- let inputResolved;
200
227
  const typeParams = type.typeParams && Object.keys(type.typeParams).length > 0 ? type.typeParams : void 0;
201
- if (codecLookup && typeParams) {
202
- const rendered = codecLookup.renderOutputTypeFor(type.codecId, typeParams);
203
- if (rendered && isSafeTypeExpression(rendered)) outputResolved = rendered;
204
- const renderedInput = codecLookup.renderInputTypeFor?.(type.codecId, typeParams);
205
- if (renderedInput && isSafeTypeExpression(renderedInput)) inputResolved = renderedInput;
206
- }
207
- const codecAccessor = `CodecTypes[${serializeValue(type.codecId)}]`;
208
228
  return {
209
- output: applyModifiers(outputResolved ?? `${codecAccessor}["output"]`, field),
210
- input: applyModifiers(inputResolved ?? `${codecAccessor}["input"]`, field)
229
+ output: applyModifiers(codecOutputType(type.codecId, typeParams, codecLookup), field),
230
+ input: applyModifiers(codecInputType(type.codecId, typeParams, codecLookup), field)
211
231
  };
212
232
  }
213
233
  case "valueObject": return {
@@ -345,7 +365,94 @@ function generateValueObjectTypeAliases(valueObjects, codecLookup) {
345
365
  }
346
366
  return aliases.join("\n");
347
367
  }
368
+ /**
369
+ * The type of a field that its codec does not give, for a family that types its fields with a generic over the contract's shape: the literal union of the value set it holds, the type of a value object or union field, or the text its codec renders for its type parameters. `undefined` when the codec gives both sides.
370
+ */
371
+ function resolveFieldTypeOverride(field, codecLookup, resolvedValueSet) {
372
+ const { type } = field;
373
+ if (type.kind !== "scalar") {
374
+ const resolved = resolveFieldType({
375
+ nullable: false,
376
+ type
377
+ }, codecLookup);
378
+ return {
379
+ output: resolved.output,
380
+ input: resolved.input
381
+ };
382
+ }
383
+ if (resolvedValueSet) {
384
+ const override = renderValueSetOverride(resolvedValueSet.encodedValues, resolvedValueSet.codecId, codecLookup);
385
+ if (override !== void 0) return override;
386
+ }
387
+ const typeParams = type.typeParams && Object.keys(type.typeParams).length > 0 ? type.typeParams : void 0;
388
+ return renderCodecTypeOverride(type.codecId, typeParams, codecLookup);
389
+ }
390
+ /** The literal union of a value set on each side whose values all have literal types, or `undefined` when neither side has. */
391
+ function renderValueSetOverride(values, codecId, codecLookup) {
392
+ const output = renderValueSetType(values, codecId, "output", codecLookup);
393
+ const input = renderValueSetType(values, codecId, "input", codecLookup);
394
+ const override = {
395
+ ...output !== void 0 ? { output } : {},
396
+ ...input !== void 0 ? { input } : {}
397
+ };
398
+ return Object.keys(override).length > 0 ? override : void 0;
399
+ }
400
+ /** The type text a codec renders for these type parameters, on the sides it renders one. */
401
+ function renderCodecTypeOverride(codecId, typeParams, codecLookup) {
402
+ if (codecLookup === void 0 || typeParams === void 0) return void 0;
403
+ const output = codecLookup.renderOutputTypeFor(codecId, typeParams);
404
+ const input = codecLookup.renderInputTypeFor?.(codecId, typeParams);
405
+ const override = {
406
+ ...output && isSafeTypeExpression(output) ? { output } : {},
407
+ ...input && isSafeTypeExpression(input) ? { input } : {}
408
+ };
409
+ return Object.keys(override).length > 0 ? override : void 0;
410
+ }
411
+ function renderTypeOverride(override) {
412
+ return `{ ${["output", "input"].flatMap((side) => {
413
+ const type = override[side];
414
+ return type === void 0 ? [] : [`readonly ${side}: ${type}`];
415
+ }).join("; ")} }`;
416
+ }
417
+ /** A nested map of type overrides, ordered by name at every level, leaving out every branch with no entry. */
418
+ function renderTypeOverridesMap(entries) {
419
+ const sorted = entries.flatMap(([first, second, third, type]) => {
420
+ return type === void 0 ? [] : [{
421
+ path: [
422
+ first,
423
+ second,
424
+ third
425
+ ],
426
+ type
427
+ }];
428
+ }).sort((a, b) => comparePaths(a.path, b.path));
429
+ const outer = /* @__PURE__ */ new Map();
430
+ for (const { path, type } of sorted) {
431
+ const [first, second, third] = path;
432
+ const middle = outer.get(first) ?? /* @__PURE__ */ new Map();
433
+ outer.set(first, middle);
434
+ const inner = middle.get(second) ?? [];
435
+ middle.set(second, inner);
436
+ inner.push(`readonly ${serializeObjectKey(third)}: ${renderTypeOverride(type)}`);
437
+ }
438
+ return `{ ${[...outer].map(([first, middle]) => {
439
+ const secondParts = [...middle].map(([second, inner]) => `readonly ${serializeObjectKey(second)}: { ${inner.join("; ")} }`);
440
+ return `readonly ${serializeObjectKey(first)}: { ${secondParts.join("; ")} }`;
441
+ }).join("; ")} }`;
442
+ }
443
+ function comparePaths(a, b) {
444
+ return a[0].localeCompare(b[0]) || a[1].localeCompare(b[1]) || a[2].localeCompare(b[2]);
445
+ }
446
+ /** `FieldTypeOverrides`: per namespace, model and field, the type of each field its codec does not give. */
447
+ function generateFieldTypeOverridesMap(namespaceModels, codecLookup, resolveFieldValueSet) {
448
+ return renderTypeOverridesMap(namespaceModels.flatMap(([nsId, models]) => Object.entries(models).flatMap(([modelName, model]) => Object.entries(model.fields).map(([fieldName, field]) => [
449
+ nsId,
450
+ modelName,
451
+ fieldName,
452
+ resolveFieldTypeOverride(field, codecLookup, resolveFieldValueSet?.(modelName, fieldName, model))
453
+ ]))));
454
+ }
348
455
  //#endregion
349
- export { resolveValueObjectType as C, serializeObjectKey as D, serializeNamespaceId as E, serializeValue as O, resolveModelFieldType as S, serializeExecutionType as T, generateValueObjectType as _, generateContractFieldDescriptor as a, renderValueSetType as b, generateFieldResolvedType as c, generateImportLines as d, generateModelFieldEntry as f, generateRootsType as g, generateModelsType as h, generateCodecTypeIntersection as i, generateFieldTypesMapsByNamespace as l, generateModelRelationsType as m, emitterError as n, generateFieldInputTypesMap as o, generateModelFieldsType as p, generateBothFieldTypesMaps as r, generateFieldOutputTypesMap as s, deduplicateImports as t, generateHashTypeAliases as u, generateValueObjectTypeAliases as v, serializeCrossReference as w, resolveFieldType as x, generateValueObjectsDescriptorType as y };
456
+ export { renderValueSetOverride as A, serializeValue as B, generateValueObjectType as C, renderCodecTypeOverride as D, parameterizedOutputTypeFunctionsAlias as E, resolveValueObjectType as F, serializeCrossReference as I, serializeExecutionType as L, resolveFieldType as M, resolveFieldTypeOverride as N, renderTypeOverride as O, resolveModelFieldType as P, serializeNamespaceId as R, generateRootsType as S, generateValueObjectsDescriptorType as T, generateImportLines as _, codecOutputType as a, generateModelRelationsType as b, generateBothFieldTypesMaps as c, generateFieldInputTypesMap as d, generateFieldOutputTypesMap as f, generateHashTypeAliases as g, generateFieldTypesMapsByNamespace as h, codecOutputForAlias as i, renderValueSetType as j, renderTypeOverridesMap as k, generateCodecTypeIntersection as l, generateFieldTypeOverridesMap as m, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as n, deduplicateImports as o, generateFieldResolvedType as p, codecInputType as r, emitterError as s, CODEC_OUTPUT_FOR as t, generateContractFieldDescriptor as u, generateModelFieldEntry as v, generateValueObjectTypeAliases as w, generateModelsType as x, generateModelFieldsType as y, serializeObjectKey as z };
350
457
 
351
- //# sourceMappingURL=domain-type-generation-Bsqbaqj5-CRHf18kl.mjs.map
458
+ //# sourceMappingURL=domain-type-generation-BRVQvoy8-CcRke3tl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-type-generation-BRVQvoy8-CcRke3tl.mjs","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-BRVQvoy8.mjs"],"sourcesContent":["import { isSafeTypeExpression } from \"./type-expression-safety.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { renderImports, tsStringLiteral } from \"@internal/ts-render\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/emitter-errors.ts\nfunction emitterError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n//#endregion\n//#region src/domain-type-generation.ts\nfunction serializeValue(value) {\n\tif (value === null) return \"null\";\n\tif (value === void 0) return \"undefined\";\n\tif (typeof value === \"string\") return tsStringLiteral(value);\n\tif (typeof value === \"number\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"bigint\") return `${value}n`;\n\tif (Array.isArray(value)) return `readonly [${value.map((v) => serializeValue(v)).join(\", \")}]`;\n\tif (typeof value === \"object\") return `{ ${Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([k, v]) => `readonly ${serializeObjectKey(k)}: ${serializeValue(v)}`).join(\"; \")} }`;\n\treturn \"unknown\";\n}\nfunction serializeObjectKey(key) {\n\tif (/^[$A-Z_a-z][$\\w]*$/.test(key)) return key;\n\treturn serializeValue(key);\n}\nfunction serializeNamespaceId(value) {\n\treturn `${serializeValue(value)} & NamespaceId`;\n}\nfunction serializeCrossReference(ref) {\n\treturn `{ readonly namespace: ${serializeNamespaceId(String(ref.namespace))}; readonly model: ${serializeValue(ref.model)}${ref.space !== void 0 ? `; readonly space: ${serializeValue(ref.space)}` : \"\"} }`;\n}\nfunction generateRootsType(roots) {\n\tif (!roots || Object.keys(roots).length === 0) return \"Record<string, never>\";\n\treturn `{ ${Object.entries(roots).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${serializeCrossReference(value)}`).join(\"; \")} }`;\n}\nfunction contractFieldModifierSuffix(field) {\n\treturn (field.many ? `; readonly many: { readonly elementNullable: ${field.many.elementNullable} }` : \"\") + (field.dict === true ? \"; readonly dict: true\" : \"\");\n}\nfunction generateModelFieldEntry(fieldName, field) {\n\tconst mods = contractFieldModifierSuffix(field);\n\tconst { nullable, type } = field;\n\tif (type.kind === \"scalar\") {\n\t\tconst typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : \"\";\n\t\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: \"scalar\"; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${mods} }`;\n\t}\n\tif (type.kind === \"valueObject\") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: \"valueObject\"; readonly name: ${serializeValue(type.name)} }${mods} }`;\n\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: ${serializeValue(type)}${mods} }`;\n}\nfunction objectTypeOpenWhenEmpty(entries) {\n\treturn entries.length > 0 ? `{ ${entries.join(\"; \")} }` : \"{}\";\n}\nfunction objectTypeClosedWhenEmpty(entries) {\n\treturn entries.length > 0 ? `{ ${entries.join(\"; \")} }` : \"Record<string, never>\";\n}\nfunction generateModelFieldsType(fields) {\n\tconst fieldEntries = [];\n\tfor (const [fieldName, field] of Object.entries(fields)) fieldEntries.push(generateModelFieldEntry(fieldName, field));\n\treturn objectTypeOpenWhenEmpty(fieldEntries);\n}\nfunction generateModelRelationsType(relations) {\n\tconst relationEntries = [];\n\tfor (const [relName, rel] of Object.entries(relations)) {\n\t\tif (typeof rel !== \"object\" || rel === null) continue;\n\t\tconst relObj = blindCast(rel);\n\t\tconst toRef = relObj[\"to\"];\n\t\tif (toRef !== null && typeof toRef === \"object\" && \"space\" in toRef && toRef.space !== void 0) {\n\t\t\trelationEntries.push(`readonly ${serializeObjectKey(relName)}: never`);\n\t\t\tcontinue;\n\t\t}\n\t\tconst parts = [];\n\t\tif (toRef) parts.push(`readonly to: ${serializeCrossReference(blindCast(toRef))}`);\n\t\tif (relObj[\"cardinality\"]) parts.push(`readonly cardinality: ${serializeValue(relObj[\"cardinality\"])}`);\n\t\tif (typeof relObj[\"nullable\"] === \"boolean\") parts.push(`readonly nullable: ${relObj[\"nullable\"]}`);\n\t\tconst on = blindCast(relObj[\"on\"]);\n\t\tif (on && (!on.localFields || !on.targetFields)) throw emitterError(\"CONTRACT.RELATION_INVALID\", `Relation \"${relName}\" has an \"on\" block but is missing localFields or targetFields`, { meta: { relation: relName } });\n\t\tif (on?.localFields && on.targetFields) {\n\t\t\tconst localFields = on.localFields.map((f) => serializeValue(f)).join(\", \");\n\t\t\tconst targetFields = on.targetFields.map((f) => serializeValue(f)).join(\", \");\n\t\t\tparts.push(`readonly on: { readonly localFields: readonly [${localFields}]; readonly targetFields: readonly [${targetFields}] }`);\n\t\t}\n\t\tif (relObj[\"cardinality\"] === \"N:M\") {\n\t\t\tconst { through } = blindCast(relObj);\n\t\t\tconst table = serializeValue(through.table);\n\t\t\tconst namespaceId = serializeValue(through.namespaceId);\n\t\t\tconst parentColumns = through.parentColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tconst childColumns = through.childColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tconst targetColumns = through.targetColumns.map((c) => serializeValue(c)).join(\", \");\n\t\t\tparts.push(`readonly through: { readonly table: ${table}; readonly namespaceId: ${namespaceId}; readonly parentColumns: readonly [${parentColumns}]; readonly childColumns: readonly [${childColumns}]; readonly targetColumns: readonly [${targetColumns}] }`);\n\t\t}\n\t\tif (parts.length > 0) relationEntries.push(`readonly ${serializeObjectKey(relName)}: { ${parts.join(\"; \")} }`);\n\t}\n\tif (relationEntries.length === 0) return \"Record<string, never>\";\n\treturn `{ ${relationEntries.join(\"; \")} }`;\n}\nfunction generateModelsType(models, generateModelStorage) {\n\tif (!models || Object.keys(models).length === 0) return \"Record<string, never>\";\n\tconst modelTypes = [];\n\tfor (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tconst fieldsType = generateModelFieldsType(model.fields);\n\t\tconst relationsType = generateModelRelationsType(model.relations);\n\t\tconst storageType = generateModelStorage(modelName, model);\n\t\tconst modelParts = [\n\t\t\t`readonly fields: ${fieldsType}`,\n\t\t\t`readonly relations: ${relationsType}`,\n\t\t\t`readonly storage: ${storageType}`\n\t\t];\n\t\tif (model.owner) modelParts.push(`readonly owner: ${serializeValue(model.owner)}`);\n\t\tif (model.discriminator) modelParts.push(`readonly discriminator: ${serializeValue(model.discriminator)}`);\n\t\tif (model.variants) {\n\t\t\tconst variantEntries = Object.entries(model.variants).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([value, ref]) => `readonly ${serializeObjectKey(value)}: ${serializeCrossReference(ref)}`);\n\t\t\tmodelParts.push(`readonly variants: { ${variantEntries.join(\"; \")} }`);\n\t\t}\n\t\tif (model.base) modelParts.push(`readonly base: ${serializeCrossReference(model.base)}`);\n\t\tmodelTypes.push(`readonly ${serializeObjectKey(modelName)}: { ${modelParts.join(\"; \")} }`);\n\t}\n\treturn `{ ${modelTypes.join(\"; \")} }`;\n}\nfunction deduplicateImports(imports) {\n\tconst seenKeys = /* @__PURE__ */ new Set();\n\tconst result = [];\n\tfor (const imp of imports) {\n\t\tconst key = `${imp.package}::${imp.named}`;\n\t\tif (!seenKeys.has(key)) {\n\t\t\tseenKeys.add(key);\n\t\t\tresult.push(imp);\n\t\t}\n\t}\n\treturn result;\n}\nfunction generateImportLines(imports, resolveImportSpecifier = keepInternalSpecifiers) {\n\tconst rendered = renderImports(imports.map((imp) => ({\n\t\tmoduleSpecifier: resolveImportSpecifier(imp.package),\n\t\tsymbol: imp.named,\n\t\talias: imp.alias,\n\t\ttypeOnly: true\n\t})));\n\treturn rendered === \"\" ? [] : rendered.split(\"\\n\");\n}\nfunction generateCodecTypeIntersection(imports, named) {\n\treturn imports.filter((imp) => imp.named === named).map((imp) => imp.alias).join(\" & \") || \"Record<string, never>\";\n}\nfunction serializeExecutionType(execution) {\n\tconst parts = [\"readonly executionHash: ExecutionHash\"];\n\tfor (const [key, value] of Object.entries(execution)) {\n\t\tif (key === \"executionHash\") continue;\n\t\tparts.push(`readonly ${serializeObjectKey(key)}: ${serializeValue(value)}`);\n\t}\n\treturn `{ ${parts.join(\"; \")} }`;\n}\nfunction generateHashTypeAliases(hashes) {\n\tconst executionHashType = hashes.executionHash ? `ExecutionHashBase<${serializeValue(hashes.executionHash)}>` : \"ExecutionHashBase<string>\";\n\treturn [\n\t\t`export type StorageHash = StorageHashBase<${serializeValue(hashes.storageHash)}>;`,\n\t\t`export type ExecutionHash = ${executionHashType};`,\n\t\t`export type ProfileHash = ProfileHashBase<${serializeValue(hashes.profileHash)}>;`\n\t].join(\"\\n\");\n}\nfunction applyModifiers(base, field) {\n\tlet result = base;\n\tif (field.many) {\n\t\tif (field.many.elementNullable) result = `${result} | null`;\n\t\tresult = `ReadonlyArray<${result}>`;\n\t}\n\tif (field.dict === true) result = `Readonly<Record<string, ${result}>>`;\n\tif (field.nullable) result = `${result} | null`;\n\treturn result;\n}\n/**\n* Renders a value set (a field/column's permitted values, codec-encoded) into a TS literal union by\n* routing **each** value through the codec's `renderValueLiteral` — the seam owned by the codec, not\n* a generic serializer. `side`: `output` = read type, `input` = create/update type.\n*\n* Returns `undefined` — signalling the caller to fall back to the codec's full output type — when\n* the lookup is absent, has no `renderValueLiteralFor`, the value set is empty, or **any** value\n* isn't literal-expressible. A caller that needs column and field types to agree shares this so both\n* compute the union identically.\n*/\nfunction renderValueSetType(values, codecId, side, codecLookup) {\n\tif (values.length === 0 || codecLookup?.renderValueLiteralFor === void 0) return void 0;\n\tconst literals = [];\n\tfor (const value of values) {\n\t\tconst lit = codecLookup.renderValueLiteralFor(codecId, value, side);\n\t\tif (lit === void 0 || !isSafeTypeExpression(lit)) return void 0;\n\t\tliterals.push(lit);\n\t}\n\treturn literals.join(\" | \");\n}\n/** The local alias an emitted `contract.d.ts` types a column with type parameters through. */\nconst CODEC_OUTPUT_FOR = \"CodecOutputFor\";\n/** The local alias for the union of the stack's parameterized output type functions. */\nconst PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS = \"ParameterizedOutputTypeFunctions\";\n/** The declaration of {@link CODEC_OUTPUT_FOR}: `ParameterizedOutputType` from `@internal/contract/types` applied to {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, falling back to the codec's plain output type. */\nconst codecOutputForAlias = `type ${CODEC_OUTPUT_FOR}<CodecId extends keyof CodecTypes, TypeParams extends Record<string, unknown>> = ParameterizedOutputType<${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, CodecId, TypeParams, CodecTypes[CodecId][\"output\"]>;`;\n/** The declaration of {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} for the type functions the stack's components declare. */\nfunction parameterizedOutputTypeFunctionsAlias(typeFunctions) {\n\tconst aliases = [...new Set(typeFunctions.map((typeFunction) => typeFunction.alias))];\n\treturn `type ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} = ${aliases.length > 0 ? aliases.join(\" | \") : \"never\"};`;\n}\n/**\n* The output type of a value of codec `codecId` in a column with these type parameters. A codec that renders its own type text (`renderOutputType`) gets that text. Otherwise a column with type parameters is typed through {@link CODEC_OUTPUT_FOR}, which applies the stack's type functions as the field type generic does and falls back to the codec's plain output type; a column without them gets the plain output type.\n*/\nfunction codecOutputType(codecId, typeParams, codecLookup) {\n\tconst plain = `CodecTypes[${serializeValue(codecId)}][\"output\"]`;\n\tif (typeParams === void 0) return plain;\n\tconst rendered = codecLookup?.renderOutputTypeFor(codecId, typeParams);\n\tif (rendered && isSafeTypeExpression(rendered)) return rendered;\n\treturn `${CODEC_OUTPUT_FOR}<${serializeValue(codecId)}, ${serializeValue(typeParams)}>`;\n}\n/** The input type of a value of codec `codecId` in a column with these type parameters: the text the codec renders (`renderInputType`), or its plain input type. */\nfunction codecInputType(codecId, typeParams, codecLookup) {\n\tif (codecLookup !== void 0 && typeParams !== void 0) {\n\t\tconst rendered = codecLookup.renderInputTypeFor?.(codecId, typeParams);\n\t\tif (rendered && isSafeTypeExpression(rendered)) return rendered;\n\t}\n\treturn `CodecTypes[${serializeValue(codecId)}][\"input\"]`;\n}\nfunction resolveFieldType(field, codecLookup, resolvedValueSet) {\n\tconst { type } = field;\n\tswitch (type.kind) {\n\t\tcase \"scalar\": {\n\t\t\tif (resolvedValueSet) {\n\t\t\t\tconst output = renderValueSetType(resolvedValueSet.encodedValues, resolvedValueSet.codecId, \"output\", codecLookup);\n\t\t\t\tconst input = renderValueSetType(resolvedValueSet.encodedValues, resolvedValueSet.codecId, \"input\", codecLookup);\n\t\t\t\tif (output !== void 0 && input !== void 0) return {\n\t\t\t\t\toutput: applyModifiers(output, field),\n\t\t\t\t\tinput: applyModifiers(input, field)\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst typeParams = type.typeParams && Object.keys(type.typeParams).length > 0 ? type.typeParams : void 0;\n\t\t\treturn {\n\t\t\t\toutput: applyModifiers(codecOutputType(type.codecId, typeParams, codecLookup), field),\n\t\t\t\tinput: applyModifiers(codecInputType(type.codecId, typeParams, codecLookup), field)\n\t\t\t};\n\t\t}\n\t\tcase \"valueObject\": return {\n\t\t\toutput: applyModifiers(`${type.name}Output`, field),\n\t\t\tinput: applyModifiers(`${type.name}Input`, field)\n\t\t};\n\t\tcase \"union\": {\n\t\t\tconst outputMembers = type.members.map((m) => m.kind === \"scalar\" ? `CodecTypes[${serializeValue(m.codecId)}][\"output\"]` : `${m.name}Output`);\n\t\t\tconst inputMembers = type.members.map((m) => m.kind === \"scalar\" ? `CodecTypes[${serializeValue(m.codecId)}][\"input\"]` : `${m.name}Input`);\n\t\t\treturn {\n\t\t\t\toutput: applyModifiers(outputMembers.join(\" | \"), field),\n\t\t\t\tinput: applyModifiers(inputMembers.join(\" | \"), field)\n\t\t\t};\n\t\t}\n\t\tdefault: return {\n\t\t\toutput: applyModifiers(\"unknown\", field),\n\t\t\tinput: applyModifiers(\"unknown\", field)\n\t\t};\n\t}\n}\nfunction generateFieldResolvedType(field, codecLookup, side = \"output\") {\n\treturn resolveFieldType(field, codecLookup)[side];\n}\n/**\n* Resolves one model field's input and output types the way `FieldOutputTypes` /\n* `FieldInputTypes` do: the field's type parameters refine its codec's type, and a family-resolved\n* value set renders as a literal union.\n*/\nfunction resolveModelFieldType(modelName, fieldName, field, model, resolvers) {\n\tconst resolvedValueSet = resolvers.resolveFieldValueSet?.(modelName, fieldName, model);\n\treturn resolveFieldType(field, resolvers.codecLookup, resolvedValueSet);\n}\nfunction generateBothFieldTypesMaps(models, codecLookup, resolveFieldValueSet) {\n\tif (!models || Object.keys(models).length === 0) return {\n\t\toutput: \"Record<string, never>\",\n\t\tinput: \"Record<string, never>\"\n\t};\n\tconst resolvers = {\n\t\tcodecLookup,\n\t\tresolveFieldValueSet\n\t};\n\tconst outputModelEntries = [];\n\tconst inputModelEntries = [];\n\tfor (const [modelName, model] of Object.entries(models).sort(([a], [b]) => a.localeCompare(b))) {\n\t\tif (!model) continue;\n\t\tconst outputFieldEntries = [];\n\t\tconst inputFieldEntries = [];\n\t\tfor (const [fieldName, field] of Object.entries(model.fields)) {\n\t\t\tconst resolved = resolveModelFieldType(modelName, fieldName, field, model, resolvers);\n\t\t\tconst key = `readonly ${serializeObjectKey(fieldName)}`;\n\t\t\toutputFieldEntries.push(`${key}: ${resolved.output}`);\n\t\t\tinputFieldEntries.push(`${key}: ${resolved.input}`);\n\t\t}\n\t\tconst outputFields = objectTypeOpenWhenEmpty(outputFieldEntries);\n\t\tconst inputFields = objectTypeClosedWhenEmpty(inputFieldEntries);\n\t\tconst modelKey = `readonly ${serializeObjectKey(modelName)}`;\n\t\toutputModelEntries.push(`${modelKey}: ${outputFields}`);\n\t\tinputModelEntries.push(`${modelKey}: ${inputFields}`);\n\t}\n\treturn {\n\t\toutput: `{ ${outputModelEntries.join(\"; \")} }`,\n\t\tinput: `{ ${inputModelEntries.join(\"; \")} }`\n\t};\n}\nfunction generateFieldTypesMapsByNamespace(namespaceModels, codecLookup, resolveFieldValueSet) {\n\tif (namespaceModels.length === 0) return {\n\t\toutput: \"Record<string, never>\",\n\t\tinput: \"Record<string, never>\"\n\t};\n\tconst outputNamespaceEntries = [];\n\tconst inputNamespaceEntries = [];\n\tfor (const [nsId, models] of namespaceModels) {\n\t\tconst inner = generateBothFieldTypesMaps(models, codecLookup, resolveFieldValueSet);\n\t\tconst nsKey = `readonly ${serializeObjectKey(nsId)}`;\n\t\toutputNamespaceEntries.push(`${nsKey}: ${inner.output}`);\n\t\tinputNamespaceEntries.push(`${nsKey}: ${inner.input}`);\n\t}\n\treturn {\n\t\toutput: `{ ${outputNamespaceEntries.join(\"; \")} }`,\n\t\tinput: `{ ${inputNamespaceEntries.join(\"; \")} }`\n\t};\n}\nfunction generateFieldOutputTypesMap(models, codecLookup) {\n\treturn generateBothFieldTypesMaps(models, codecLookup).output;\n}\nfunction generateFieldInputTypesMap(models, codecLookup) {\n\treturn generateBothFieldTypesMaps(models, codecLookup).input;\n}\nfunction generateValueObjectType(_voName, vo, _valueObjects, side = \"output\", codecLookup) {\n\treturn resolveValueObjectType(_voName, vo, _valueObjects, codecLookup)[side];\n}\nfunction resolveValueObjectType(_voName, vo, _valueObjects, codecLookup) {\n\tconst outputEntries = [];\n\tconst inputEntries = [];\n\tfor (const [fieldName, field] of Object.entries(vo.fields)) {\n\t\tconst resolved = resolveFieldType(field, codecLookup);\n\t\tconst key = `readonly ${serializeObjectKey(fieldName)}`;\n\t\toutputEntries.push(`${key}: ${resolved.output}`);\n\t\tinputEntries.push(`${key}: ${resolved.input}`);\n\t}\n\tconst empty = \"Record<string, never>\";\n\treturn {\n\t\toutput: outputEntries.length > 0 ? `{ ${outputEntries.join(\"; \")} }` : empty,\n\t\tinput: inputEntries.length > 0 ? `{ ${inputEntries.join(\"; \")} }` : empty\n\t};\n}\nfunction generateContractFieldDescriptor(fieldName, field) {\n\tconst modStr = contractFieldModifierSuffix(field);\n\tconst { type } = field;\n\tif (type.kind === \"scalar\") {\n\t\tconst typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : \"\";\n\t\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: \"scalar\"; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${modStr} }`;\n\t}\n\tif (type.kind === \"valueObject\") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: \"valueObject\"; readonly name: ${serializeValue(type.name)} }${modStr} }`;\n\treturn `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: ${serializeValue(type)}${modStr} }`;\n}\nfunction generateValueObjectsDescriptorType(valueObjects) {\n\tif (!valueObjects || Object.keys(valueObjects).length === 0) return \"Record<string, never>\";\n\tconst voEntries = [];\n\tfor (const [voName, vo] of Object.entries(valueObjects)) {\n\t\tconst fieldEntries = [];\n\t\tfor (const [fieldName, field] of Object.entries(vo.fields)) fieldEntries.push(generateContractFieldDescriptor(fieldName, field));\n\t\tconst fieldsType = fieldEntries.length > 0 ? `{ ${fieldEntries.join(\"; \")} }` : \"Record<string, never>\";\n\t\tvoEntries.push(`readonly ${serializeObjectKey(voName)}: { readonly fields: ${fieldsType} }`);\n\t}\n\treturn `{ ${voEntries.join(\"; \")} }`;\n}\nfunction generateValueObjectTypeAliases(valueObjects, codecLookup) {\n\tif (!valueObjects || Object.keys(valueObjects).length === 0) return \"\";\n\tconst aliases = [];\n\tfor (const [voName, vo] of Object.entries(valueObjects)) {\n\t\tconst resolved = resolveValueObjectType(voName, vo, valueObjects, codecLookup);\n\t\taliases.push(`export type ${voName}Output = ${resolved.output};`);\n\t\taliases.push(`export type ${voName}Input = ${resolved.input};`);\n\t}\n\treturn aliases.join(\"\\n\");\n}\n/**\n* The type of a field that its codec does not give, for a family that types its fields with a generic over the contract's shape: the literal union of the value set it holds, the type of a value object or union field, or the text its codec renders for its type parameters. `undefined` when the codec gives both sides.\n*/\nfunction resolveFieldTypeOverride(field, codecLookup, resolvedValueSet) {\n\tconst { type } = field;\n\tif (type.kind !== \"scalar\") {\n\t\tconst resolved = resolveFieldType({\n\t\t\tnullable: false,\n\t\t\ttype\n\t\t}, codecLookup);\n\t\treturn {\n\t\t\toutput: resolved.output,\n\t\t\tinput: resolved.input\n\t\t};\n\t}\n\tif (resolvedValueSet) {\n\t\tconst override = renderValueSetOverride(resolvedValueSet.encodedValues, resolvedValueSet.codecId, codecLookup);\n\t\tif (override !== void 0) return override;\n\t}\n\tconst typeParams = type.typeParams && Object.keys(type.typeParams).length > 0 ? type.typeParams : void 0;\n\treturn renderCodecTypeOverride(type.codecId, typeParams, codecLookup);\n}\n/** The literal union of a value set on each side whose values all have literal types, or `undefined` when neither side has. */\nfunction renderValueSetOverride(values, codecId, codecLookup) {\n\tconst output = renderValueSetType(values, codecId, \"output\", codecLookup);\n\tconst input = renderValueSetType(values, codecId, \"input\", codecLookup);\n\tconst override = {\n\t\t...output !== void 0 ? { output } : {},\n\t\t...input !== void 0 ? { input } : {}\n\t};\n\treturn Object.keys(override).length > 0 ? override : void 0;\n}\n/** The type text a codec renders for these type parameters, on the sides it renders one. */\nfunction renderCodecTypeOverride(codecId, typeParams, codecLookup) {\n\tif (codecLookup === void 0 || typeParams === void 0) return void 0;\n\tconst output = codecLookup.renderOutputTypeFor(codecId, typeParams);\n\tconst input = codecLookup.renderInputTypeFor?.(codecId, typeParams);\n\tconst override = {\n\t\t...output && isSafeTypeExpression(output) ? { output } : {},\n\t\t...input && isSafeTypeExpression(input) ? { input } : {}\n\t};\n\treturn Object.keys(override).length > 0 ? override : void 0;\n}\nfunction renderTypeOverride(override) {\n\treturn `{ ${[\"output\", \"input\"].flatMap((side) => {\n\t\tconst type = override[side];\n\t\treturn type === void 0 ? [] : [`readonly ${side}: ${type}`];\n\t}).join(\"; \")} }`;\n}\n/** A nested map of type overrides, ordered by name at every level, leaving out every branch with no entry. */\nfunction renderTypeOverridesMap(entries) {\n\tconst sorted = entries.flatMap(([first, second, third, type]) => {\n\t\treturn type === void 0 ? [] : [{\n\t\t\tpath: [\n\t\t\t\tfirst,\n\t\t\t\tsecond,\n\t\t\t\tthird\n\t\t\t],\n\t\t\ttype\n\t\t}];\n\t}).sort((a, b) => comparePaths(a.path, b.path));\n\tconst outer = /* @__PURE__ */ new Map();\n\tfor (const { path, type } of sorted) {\n\t\tconst [first, second, third] = path;\n\t\tconst middle = outer.get(first) ?? /* @__PURE__ */ new Map();\n\t\touter.set(first, middle);\n\t\tconst inner = middle.get(second) ?? [];\n\t\tmiddle.set(second, inner);\n\t\tinner.push(`readonly ${serializeObjectKey(third)}: ${renderTypeOverride(type)}`);\n\t}\n\treturn `{ ${[...outer].map(([first, middle]) => {\n\t\tconst secondParts = [...middle].map(([second, inner]) => `readonly ${serializeObjectKey(second)}: { ${inner.join(\"; \")} }`);\n\t\treturn `readonly ${serializeObjectKey(first)}: { ${secondParts.join(\"; \")} }`;\n\t}).join(\"; \")} }`;\n}\nfunction comparePaths(a, b) {\n\treturn a[0].localeCompare(b[0]) || a[1].localeCompare(b[1]) || a[2].localeCompare(b[2]);\n}\n/** `FieldTypeOverrides`: per namespace, model and field, the type of each field its codec does not give. */\nfunction generateFieldTypeOverridesMap(namespaceModels, codecLookup, resolveFieldValueSet) {\n\treturn renderTypeOverridesMap(namespaceModels.flatMap(([nsId, models]) => Object.entries(models).flatMap(([modelName, model]) => Object.entries(model.fields).map(([fieldName, field]) => [\n\t\tnsId,\n\t\tmodelName,\n\t\tfieldName,\n\t\tresolveFieldTypeOverride(field, codecLookup, resolveFieldValueSet?.(modelName, fieldName, model))\n\t]))));\n}\n//#endregion\nexport { renderValueSetType as A, emitterError as B, generateValueObjectTypeAliases as C, renderTypeOverride as D, renderCodecTypeOverride as E, serializeCrossReference as F, serializeExecutionType as I, serializeNamespaceId as L, resolveFieldTypeOverride as M, resolveModelFieldType as N, renderTypeOverridesMap as O, resolveValueObjectType as P, serializeObjectKey as R, generateValueObjectType as S, parameterizedOutputTypeFunctionsAlias as T, generateModelFieldEntry as _, codecOutputType as a, generateModelsType as b, generateCodecTypeIntersection as c, generateFieldOutputTypesMap as d, generateFieldResolvedType as f, generateImportLines as g, generateHashTypeAliases as h, codecOutputForAlias as i, resolveFieldType as j, renderValueSetOverride as k, generateContractFieldDescriptor as l, generateFieldTypesMapsByNamespace as m, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as n, deduplicateImports as o, generateFieldTypeOverridesMap as p, codecInputType as r, generateBothFieldTypesMaps as s, CODEC_OUTPUT_FOR as t, generateFieldInputTypesMap as u, generateModelFieldsType as v, generateValueObjectsDescriptorType as w, generateRootsType as x, generateModelRelationsType as y, serializeValue as z };\n\n//# sourceMappingURL=domain-type-generation-BRVQvoy8.mjs.map"],"mappings":";;;;;;AAMA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,eAA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,yBAAyB,OAAO,aAAa,uBAAuB,WAAW,WAAW,KAAK,CAAC;CACjG,CAAC,CAAC,CAAC,CAAC;AACL"}
@@ -1,7 +1,7 @@
1
1
  import { ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
2
2
  import { ContractField, ContractModelBase, ContractValueObject, CrossReference, JsonValue } from "@prisma/orm-framework/contract/types";
3
3
  import { CodecLookup } from "@prisma/orm-framework/components/codec";
4
- //#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-W1f7UBwI.d.mts
4
+ //#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-B_tgVA9W.d.mts
5
5
  //#region src/domain-type-generation.d.ts
6
6
  declare function serializeValue(value: unknown): string;
7
7
  declare function serializeObjectKey(key: string): string;
@@ -46,11 +46,27 @@ type FieldValueSetResolver = (modelName: string, fieldName: string, model: Contr
46
46
  * compute the union identically.
47
47
  */
48
48
  declare function renderValueSetType(values: readonly JsonValue[], codecId: string, side: 'output' | 'input', codecLookup: CodecLookup | undefined): string | undefined;
49
+ /** The local alias an emitted `contract.d.ts` types a column with type parameters through. */
50
+ declare const CODEC_OUTPUT_FOR = "CodecOutputFor";
51
+ /** The local alias for the union of the stack's parameterized output type functions. */
52
+ declare const PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS = "ParameterizedOutputTypeFunctions";
53
+ /** The declaration of {@link CODEC_OUTPUT_FOR}: `ParameterizedOutputType` from `@internal/contract/types` applied to {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, falling back to the codec's plain output type. */
54
+ declare const codecOutputForAlias = "type CodecOutputFor<CodecId extends keyof CodecTypes, TypeParams extends Record<string, unknown>> = ParameterizedOutputType<ParameterizedOutputTypeFunctions, CodecId, TypeParams, CodecTypes[CodecId][\"output\"]>;";
55
+ /** The declaration of {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} for the type functions the stack's components declare. */
56
+ declare function parameterizedOutputTypeFunctionsAlias(typeFunctions: ReadonlyArray<TypesImportSpec>): string;
57
+ /**
58
+ * The output type of a value of codec `codecId` in a column with these type parameters. A codec that renders its own type text (`renderOutputType`) gets that text. Otherwise a column with type parameters is typed through {@link CODEC_OUTPUT_FOR}, which applies the stack's type functions as the field type generic does and falls back to the codec's plain output type; a column without them gets the plain output type.
59
+ */
60
+ declare function codecOutputType(codecId: string, typeParams: Record<string, unknown> | undefined, codecLookup: CodecLookup | undefined): string;
61
+ /** The input type of a value of codec `codecId` in a column with these type parameters: the text the codec renders (`renderInputType`), or its plain input type. */
62
+ declare function codecInputType(codecId: string, typeParams: Record<string, unknown> | undefined, codecLookup: CodecLookup | undefined): string;
49
63
  declare function resolveFieldType(field: ContractField, codecLookup?: CodecLookup, resolvedValueSet?: ResolvedFieldValueSet): ResolvedFieldType;
50
64
  declare function generateFieldResolvedType(field: ContractField, codecLookup?: CodecLookup, side?: 'input' | 'output'): string;
51
65
  type ModelFieldTypeResolvers = {
52
66
  readonly codecLookup: CodecLookup | undefined;
53
67
  readonly resolveFieldValueSet: FieldValueSetResolver | undefined;
68
+ /** Types a `Models` member's field by indexing `FieldOutputTypes` rather than writing the type out. */
69
+ readonly referenceFieldOutputTypes?: boolean;
54
70
  };
55
71
  /**
56
72
  * Resolves one model field's input and output types the way `FieldOutputTypes` /
@@ -67,6 +83,24 @@ declare function resolveValueObjectType(_voName: string, vo: ContractValueObject
67
83
  declare function generateContractFieldDescriptor(fieldName: string, field: ContractField): string;
68
84
  declare function generateValueObjectsDescriptorType(valueObjects: Record<string, ContractValueObject> | undefined): string;
69
85
  declare function generateValueObjectTypeAliases(valueObjects: Record<string, ContractValueObject> | undefined, codecLookup?: CodecLookup): string;
86
+ /** A field's or column's type on each side where its codec does not give it, as type text. */
87
+ type TypeOverride = {
88
+ readonly output?: string;
89
+ readonly input?: string;
90
+ };
91
+ /**
92
+ * The type of a field that its codec does not give, for a family that types its fields with a generic over the contract's shape: the literal union of the value set it holds, the type of a value object or union field, or the text its codec renders for its type parameters. `undefined` when the codec gives both sides.
93
+ */
94
+ declare function resolveFieldTypeOverride(field: ContractField, codecLookup: CodecLookup | undefined, resolvedValueSet: ResolvedFieldValueSet | undefined): TypeOverride | undefined;
95
+ /** The literal union of a value set on each side whose values all have literal types, or `undefined` when neither side has. */
96
+ declare function renderValueSetOverride(values: readonly JsonValue[], codecId: string, codecLookup: CodecLookup | undefined): TypeOverride | undefined;
97
+ /** The type text a codec renders for these type parameters, on the sides it renders one. */
98
+ declare function renderCodecTypeOverride(codecId: string, typeParams: Record<string, unknown> | undefined, codecLookup: CodecLookup | undefined): TypeOverride | undefined;
99
+ declare function renderTypeOverride(override: TypeOverride): string;
100
+ /** A nested map of type overrides, ordered by name at every level, leaving out every branch with no entry. */
101
+ declare function renderTypeOverridesMap(entries: ReadonlyArray<readonly [string, string, string, TypeOverride | undefined]>): string;
102
+ /** `FieldTypeOverrides`: per namespace, model and field, the type of each field its codec does not give. */
103
+ declare function generateFieldTypeOverridesMap(namespaceModels: ReadonlyArray<readonly [string, Record<string, ContractModelBase>]>, codecLookup: CodecLookup | undefined, resolveFieldValueSet: FieldValueSetResolver | undefined): string;
70
104
  //#endregion
71
- export { serializeObjectKey as A, renderValueSetType as C, serializeCrossReference as D, resolveValueObjectType as E, serializeExecutionType as O, generateValueObjectsDescriptorType as S, resolveModelFieldType as T, generateModelRelationsType as _, deduplicateImports as a, generateValueObjectType as b, generateContractFieldDescriptor as c, generateFieldResolvedType as d, generateFieldTypesMapsByNamespace as f, generateModelFieldsType as g, generateModelFieldEntry as h, ResolvedFieldValueSet as i, serializeValue as j, serializeNamespaceId as k, generateFieldInputTypesMap as l, generateImportLines as m, ModelFieldTypeResolvers as n, generateBothFieldTypesMaps as o, generateHashTypeAliases as p, ResolvedFieldType as r, generateCodecTypeIntersection as s, FieldValueSetResolver as t, generateFieldOutputTypesMap as u, generateModelsType as v, resolveFieldType as w, generateValueObjectTypeAliases as x, generateRootsType as y };
72
- //# sourceMappingURL=domain-type-generation-W1f7UBwI-CwzLK5TL.d.mts.map
105
+ export { parameterizedOutputTypeFunctionsAlias as A, serializeCrossReference as B, generateModelFieldsType as C, generateValueObjectType as D, generateRootsType as E, renderValueSetType as F, serializeNamespaceId as H, resolveFieldType as I, resolveFieldTypeOverride as L, renderTypeOverride as M, renderTypeOverridesMap as N, generateValueObjectTypeAliases as O, renderValueSetOverride as P, resolveModelFieldType as R, generateModelFieldEntry as S, generateModelsType as T, serializeObjectKey as U, serializeExecutionType as V, serializeValue as W, generateFieldResolvedType as _, ResolvedFieldType as a, generateHashTypeAliases as b, codecInputType as c, deduplicateImports as d, generateBothFieldTypesMaps as f, generateFieldOutputTypesMap as g, generateFieldInputTypesMap as h, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as i, renderCodecTypeOverride as j, generateValueObjectsDescriptorType as k, codecOutputForAlias as l, generateContractFieldDescriptor as m, FieldValueSetResolver as n, ResolvedFieldValueSet as o, generateCodecTypeIntersection as p, ModelFieldTypeResolvers as r, TypeOverride as s, CODEC_OUTPUT_FOR as t, codecOutputType as u, generateFieldTypeOverridesMap as v, generateModelRelationsType as w, generateImportLines as x, generateFieldTypesMapsByNamespace as y, resolveValueObjectType as z };
106
+ //# sourceMappingURL=domain-type-generation-B_tgVA9W-DdPq_876.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-type-generation-B_tgVA9W-DdPq_876.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-B_tgVA9W.d.mts"],"mappings":";;;;;iBAIiB,eAAe;iBACf,mBAAmB;iBACnB,qBAAqB;iBACrB,wBAAwB,KAAK;iBAC7B,kBAAkB,OAAO,eAAe;iBACxC,wBAAwB,mBAAmB,OAAO;iBAClD,wBAAwB,QAAQ,eAAe;iBAC/C,2BAA2B,WAAW;iBACtC,mBAAmB,QAAQ,eAAe,oBAAoB,uBAAuB,mBAAmB,OAAO;iBAC/G,mBAAmB,SAAS,oBAAoB;iBAChD,oBAAoB,SAAS,mBAAmB,yBA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;;iBAE7G,wBAAwB,iBAAiB,YAAY,qCAAqC,aAAa,0BAA0B;iBACjI,mBAAmB,UAAU;;iBAE7B,uBAAuB,SAAS,gDAAgD;;iBAEhF,8BAA8B,iBAAiB,gCAAgC,eAAe,sBAAsB,aAAa,yBAAyB,sBAAsB"}
@@ -1,3 +1,3 @@
1
- import { A as serializeObjectKey, _ as generateModelRelationsType, a as deduplicateImports, j as serializeValue, m as generateImportLines, p as generateHashTypeAliases, s as generateCodecTypeIntersection, u as generateFieldOutputTypesMap, y as generateRootsType } from "./domain-type-generation-W1f7UBwI-CwzLK5TL.mjs";
2
- import { a as emit, i as EmittedArtifactPaths, n as EmitResult, o as generateContractDts, r as EmitStackInput, s as getEmittedArtifactPaths, t as EmitOptions } from "./index-C1kfLErt.mjs";
1
+ import { E as generateRootsType, U as serializeObjectKey, W as serializeValue, b as generateHashTypeAliases, d as deduplicateImports, g as generateFieldOutputTypesMap, p as generateCodecTypeIntersection, w as generateModelRelationsType, x as generateImportLines } from "./domain-type-generation-B_tgVA9W-DdPq_876.mjs";
2
+ import { a as emit, i as EmittedArtifactPaths, n as EmitResult, o as generateContractDts, r as EmitStackInput, s as getEmittedArtifactPaths, t as EmitOptions } from "./index-Co6ho75S.mjs";
3
3
  export { type EmitOptions, type EmitResult, type EmitStackInput, type EmittedArtifactPaths, deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateFieldOutputTypesMap, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
package/dist/emitter.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { D as serializeObjectKey, O as serializeValue, d as generateImportLines, g as generateRootsType, i as generateCodecTypeIntersection, m as generateModelRelationsType, s as generateFieldOutputTypesMap, t as deduplicateImports, u as generateHashTypeAliases } from "./domain-type-generation-Bsqbaqj5-CRHf18kl.mjs";
2
- import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-BP5EU7G8-CdTO3MPb.mjs";
1
+ import { B as serializeValue, S as generateRootsType, _ as generateImportLines, b as generateModelRelationsType, f as generateFieldOutputTypesMap, g as generateHashTypeAliases, l as generateCodecTypeIntersection, o as deduplicateImports, z as serializeObjectKey } from "./domain-type-generation-BRVQvoy8-CcRke3tl.mjs";
2
+ import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-CBaM-1YD-CJuFjV3_.mjs";
3
3
  export { deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateFieldOutputTypesMap, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
@@ -1,2 +1,2 @@
1
- import { A as serializeObjectKey, C as renderValueSetType, D as serializeCrossReference, E as resolveValueObjectType, O as serializeExecutionType, S as generateValueObjectsDescriptorType, T as resolveModelFieldType, _ as generateModelRelationsType, a as deduplicateImports, b as generateValueObjectType, c as generateContractFieldDescriptor, d as generateFieldResolvedType, f as generateFieldTypesMapsByNamespace, g as generateModelFieldsType, h as generateModelFieldEntry, i as ResolvedFieldValueSet, j as serializeValue, k as serializeNamespaceId, l as generateFieldInputTypesMap, m as generateImportLines, n as ModelFieldTypeResolvers, o as generateBothFieldTypesMaps, p as generateHashTypeAliases, r as ResolvedFieldType, s as generateCodecTypeIntersection, t as FieldValueSetResolver, u as generateFieldOutputTypesMap, v as generateModelsType, w as resolveFieldType, x as generateValueObjectTypeAliases, y as generateRootsType } from "./domain-type-generation-W1f7UBwI-CwzLK5TL.mjs";
2
- export { FieldValueSetResolver, ModelFieldTypeResolvers, ResolvedFieldType, ResolvedFieldValueSet, deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, renderValueSetType, resolveFieldType, resolveModelFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
1
+ import { A as parameterizedOutputTypeFunctionsAlias, B as serializeCrossReference, C as generateModelFieldsType, D as generateValueObjectType, E as generateRootsType, F as renderValueSetType, H as serializeNamespaceId, I as resolveFieldType, L as resolveFieldTypeOverride, M as renderTypeOverride, N as renderTypeOverridesMap, O as generateValueObjectTypeAliases, P as renderValueSetOverride, R as resolveModelFieldType, S as generateModelFieldEntry, T as generateModelsType, U as serializeObjectKey, V as serializeExecutionType, W as serializeValue, _ as generateFieldResolvedType, a as ResolvedFieldType, b as generateHashTypeAliases, c as codecInputType, d as deduplicateImports, f as generateBothFieldTypesMaps, g as generateFieldOutputTypesMap, h as generateFieldInputTypesMap, i as PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, j as renderCodecTypeOverride, k as generateValueObjectsDescriptorType, l as codecOutputForAlias, m as generateContractFieldDescriptor, n as FieldValueSetResolver, o as ResolvedFieldValueSet, p as generateCodecTypeIntersection, r as ModelFieldTypeResolvers, s as TypeOverride, t as CODEC_OUTPUT_FOR, u as codecOutputType, v as generateFieldTypeOverridesMap, w as generateModelRelationsType, x as generateImportLines, y as generateFieldTypesMapsByNamespace, z as resolveValueObjectType } from "./domain-type-generation-B_tgVA9W-DdPq_876.mjs";
2
+ export { CODEC_OUTPUT_FOR, FieldValueSetResolver, ModelFieldTypeResolvers, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, ResolvedFieldType, ResolvedFieldValueSet, TypeOverride, codecInputType, codecOutputForAlias, codecOutputType, deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypeOverridesMap, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, parameterizedOutputTypeFunctionsAlias, renderCodecTypeOverride, renderTypeOverride, renderTypeOverridesMap, renderValueSetOverride, renderValueSetType, resolveFieldType, resolveFieldTypeOverride, resolveModelFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
@@ -1,2 +1,2 @@
1
- import { C as resolveValueObjectType, D as serializeObjectKey, E as serializeNamespaceId, O as serializeValue, S as resolveModelFieldType, T as serializeExecutionType, _ as generateValueObjectType, a as generateContractFieldDescriptor, b as renderValueSetType, c as generateFieldResolvedType, d as generateImportLines, f as generateModelFieldEntry, g as generateRootsType, h as generateModelsType, i as generateCodecTypeIntersection, l as generateFieldTypesMapsByNamespace, m as generateModelRelationsType, o as generateFieldInputTypesMap, p as generateModelFieldsType, r as generateBothFieldTypesMaps, s as generateFieldOutputTypesMap, t as deduplicateImports, u as generateHashTypeAliases, v as generateValueObjectTypeAliases, w as serializeCrossReference, x as resolveFieldType, y as generateValueObjectsDescriptorType } from "./domain-type-generation-Bsqbaqj5-CRHf18kl.mjs";
2
- export { deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, renderValueSetType, resolveFieldType, resolveModelFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
1
+ import { A as renderValueSetOverride, B as serializeValue, C as generateValueObjectType, D as renderCodecTypeOverride, E as parameterizedOutputTypeFunctionsAlias, F as resolveValueObjectType, I as serializeCrossReference, L as serializeExecutionType, M as resolveFieldType, N as resolveFieldTypeOverride, O as renderTypeOverride, P as resolveModelFieldType, R as serializeNamespaceId, S as generateRootsType, T as generateValueObjectsDescriptorType, _ as generateImportLines, a as codecOutputType, b as generateModelRelationsType, c as generateBothFieldTypesMaps, d as generateFieldInputTypesMap, f as generateFieldOutputTypesMap, g as generateHashTypeAliases, h as generateFieldTypesMapsByNamespace, i as codecOutputForAlias, j as renderValueSetType, k as renderTypeOverridesMap, l as generateCodecTypeIntersection, m as generateFieldTypeOverridesMap, n as PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, o as deduplicateImports, p as generateFieldResolvedType, r as codecInputType, t as CODEC_OUTPUT_FOR, u as generateContractFieldDescriptor, v as generateModelFieldEntry, w as generateValueObjectTypeAliases, x as generateModelsType, y as generateModelFieldsType, z as serializeObjectKey } from "./domain-type-generation-BRVQvoy8-CcRke3tl.mjs";
2
+ export { CODEC_OUTPUT_FOR, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS, codecInputType, codecOutputForAlias, codecOutputType, deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypeOverridesMap, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, parameterizedOutputTypeFunctionsAlias, renderCodecTypeOverride, renderTypeOverride, renderTypeOverridesMap, renderValueSetOverride, renderValueSetType, resolveFieldType, resolveFieldTypeOverride, resolveModelFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
@@ -1,4 +1,4 @@
1
- import { D as serializeObjectKey, O as serializeValue, S as resolveModelFieldType, T as serializeExecutionType, d as generateImportLines, g as generateRootsType, h as generateModelsType, i as generateCodecTypeIntersection, l as generateFieldTypesMapsByNamespace, n as emitterError, t as deduplicateImports, u as generateHashTypeAliases, v as generateValueObjectTypeAliases, y as generateValueObjectsDescriptorType } from "./domain-type-generation-Bsqbaqj5-CRHf18kl.mjs";
1
+ import { B as serializeValue, E as parameterizedOutputTypeFunctionsAlias, L as serializeExecutionType, P as resolveModelFieldType, S as generateRootsType, T as generateValueObjectsDescriptorType, _ as generateImportLines, g as generateHashTypeAliases, h as generateFieldTypesMapsByNamespace, i as codecOutputForAlias, l as generateCodecTypeIntersection, m as generateFieldTypeOverridesMap, o as deduplicateImports, s as emitterError, w as generateValueObjectTypeAliases, x as generateModelsType, z as serializeObjectKey } from "./domain-type-generation-BRVQvoy8-CcRke3tl.mjs";
2
2
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
3
3
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
4
4
  import { blindCast } from "@prisma/orm-framework/utils/casts";
@@ -7,7 +7,7 @@ import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emissio
7
7
  import { format } from "prettier";
8
8
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
9
9
  import { UNBOUND_PSL_NAMESPACE_NAME } from "@prisma/orm-framework/components/psl-ast";
10
- //#region ../../../1-framework/3-tooling/emitter/dist/exports-BP5EU7G8.mjs
10
+ //#region ../../../1-framework/3-tooling/emitter/dist/exports-CBaM-1YD.mjs
11
11
  const JSON_EXTENSION = ".json";
12
12
  function getEmittedArtifactPaths(outputJsonPath) {
13
13
  if (!outputJsonPath.endsWith(JSON_EXTENSION)) throw emitterError("CONFIG.VALIDATION_FAILED", "Contract output path must end with .json", { meta: {
@@ -100,7 +100,7 @@ function requireVariant(namespaces, base, variantRef) {
100
100
  function collectFieldLines(ref, resolvers, discriminatorType) {
101
101
  const lines = /* @__PURE__ */ new Map();
102
102
  for (const [fieldName, field] of Object.entries(ref.model.fields)) {
103
- const type = discriminatorType !== void 0 && fieldName === discriminatorType.field ? discriminatorType.type : resolveModelFieldType(ref.modelName, fieldName, field, ref.model, resolvers).output;
103
+ const type = discriminatorType !== void 0 && fieldName === discriminatorType.field ? discriminatorType.type : resolvers.referenceFieldOutputTypes === true ? `FieldOutputTypes[${serializeValue(ref.namespaceId)}][${serializeValue(ref.modelName)}][${serializeValue(fieldName)}]` : resolveModelFieldType(ref.modelName, fieldName, field, ref.model, resolvers).output;
104
104
  lines.set(fieldName, `${serializeObjectKey(fieldName)}: ${type};`);
105
105
  }
106
106
  return lines;
@@ -256,6 +256,7 @@ function literalType(value) {
256
256
  function generateContractDts(contract, emitter, codecTypeImports, hashes, options, codecLookup, resolveImportSpecifier = keepInternalSpecifiers) {
257
257
  const allImports = [...codecTypeImports];
258
258
  if (options?.queryOperationTypeImports) allImports.push(...options.queryOperationTypeImports);
259
+ if (options?.parameterizedOutputTypeImports) allImports.push(...options.parameterizedOutputTypeImports);
259
260
  const uniqueImports = deduplicateImports(allImports);
260
261
  const familyImportLines = emitter.getFamilyImports(resolveImportSpecifier);
261
262
  const hashAliases = generateHashTypeAliases(hashes);
@@ -294,19 +295,34 @@ function generateContractDts(contract, emitter, codecTypeImports, hashes, option
294
295
  }).join(";\n");
295
296
  const executionClause = contract.execution !== void 0 ? `\n readonly execution: ${serializeExecutionType(contract.execution)};` : "";
296
297
  const resolveFieldValueSet = emitter.resolveFieldValueSet ? (modelName, fieldName, model) => emitter.resolveFieldValueSet?.(modelName, fieldName, model, contract) : void 0;
297
- const fieldTypesMaps = generateFieldTypesMapsByNamespace(namespaceEntries.map(([nsId, ns]) => [nsId, ns.models]), codecLookup, resolveFieldValueSet);
298
+ const namespaceModelsForFieldTypes = namespaceEntries.map(([nsId, ns]) => [nsId, ns.models]);
299
+ const fieldTypesExpression = emitter.fieldTypesExpression?.bind(emitter);
300
+ const fieldTypesMaps = fieldTypesExpression === void 0 ? generateFieldTypesMapsByNamespace(namespaceModelsForFieldTypes, codecLookup, resolveFieldValueSet) : {
301
+ output: fieldTypesExpression("output"),
302
+ input: fieldTypesExpression("input")
303
+ };
304
+ const knownFieldTypesDeclaration = fieldTypesExpression === void 0 ? "" : `type FieldTypeOverrides = ${generateFieldTypeOverridesMap(namespaceModelsForFieldTypes, codecLookup, resolveFieldValueSet)};\n`;
298
305
  const extraTypeExports = emitter.getStorageTypeExports?.(contract, codecLookup);
299
306
  const contractWrapper = emitter.getContractWrapper("ContractBase", "TypeMaps");
300
307
  const modelTypesBlock = generateModelTypesBlock(contract, {
301
308
  codecLookup,
302
- resolveFieldValueSet
309
+ resolveFieldValueSet,
310
+ referenceFieldOutputTypes: fieldTypesExpression !== void 0
303
311
  }, options?.supportsNamespaces ?? true);
312
+ const typeTexts = [
313
+ fieldTypesMaps.output,
314
+ knownFieldTypesDeclaration,
315
+ extraTypeExports ?? "",
316
+ modelTypesBlock,
317
+ valueObjectTypeAliases
318
+ ];
319
+ const parameterizedOutputDeclaration = typeTexts.some((text) => mentions(text, "CodecOutputFor")) ? `${codecOutputForAlias}\n` : "";
304
320
  const body = `${hashAliases}
305
321
 
306
322
  export type CodecTypes = ${codecTypes};
307
323
  ${familyTypeAliases}
308
- ${valueObjectTypeAliases}
309
- export type FieldOutputTypes = ${fieldTypesMaps.output};
324
+ ${[...typeTexts, parameterizedOutputDeclaration].some((text) => mentions(text, "ParameterizedOutputTypeFunctions")) ? `${parameterizedOutputTypeFunctionsAlias(options?.parameterizedOutputTypeImports ?? [])}\n` : ""}${parameterizedOutputDeclaration}${valueObjectTypeAliases}
325
+ ${knownFieldTypesDeclaration}export type FieldOutputTypes = ${fieldTypesMaps.output};
310
326
  export type FieldInputTypes = ${fieldTypesMaps.input};
311
327
  ${extraTypeExports ? `${extraTypeExports}\n` : ""}
312
328
  ${modelTypesBlock}
@@ -343,7 +359,7 @@ ${familyImportLines.join("\n")}
343
359
  import type {
344
360
  Contract as ContractType,
345
361
  ExecutionHashBase,
346
- NamespaceId,
362
+ NamespaceId,${mentions(body, "ParameterizedOutputType") ? "\n ParameterizedOutputType," : ""}
347
363
  ProfileHashBase,
348
364
  StorageHashBase,
349
365
  } from '${resolveImportSpecifier("@internal/contract/types")}';
@@ -378,7 +394,7 @@ const SCHEMA_VERSION = "1";
378
394
  async function emit(contract, stack, targetFamily, options) {
379
395
  if (options.outputJsonPath !== void 0) getEmittedArtifactPaths(options.outputJsonPath);
380
396
  requireToOneRelationNullability(contract);
381
- const { codecTypeImports, queryOperationTypeImports, aggregateDescriptors, codecDescriptors } = stack;
397
+ const { codecTypeImports, queryOperationTypeImports, parameterizedOutputTypeImports, aggregateDescriptors, codecDescriptors } = stack;
382
398
  const { storageHash } = contract.storage;
383
399
  const executionHash = contract.execution?.executionHash;
384
400
  const { profileHash } = contract;
@@ -398,6 +414,7 @@ async function emit(contract, stack, targetFamily, options) {
398
414
  }, null, 2);
399
415
  const generateOptions = {
400
416
  ...ifDefined("queryOperationTypeImports", queryOperationTypeImports),
417
+ ...ifDefined("parameterizedOutputTypeImports", parameterizedOutputTypeImports),
401
418
  ...ifDefined("aggregateDescriptors", aggregateDescriptors),
402
419
  ...ifDefined("codecDescriptors", codecDescriptors),
403
420
  ...ifDefined("supportsNamespaces", options.supportsNamespaces)
@@ -423,4 +440,4 @@ async function emit(contract, stack, targetFamily, options) {
423
440
  //#endregion
424
441
  export { generateContractDts as n, getEmittedArtifactPaths as r, emit as t };
425
442
 
426
- //# sourceMappingURL=exports-BP5EU7G8-CdTO3MPb.mjs.map
443
+ //# sourceMappingURL=exports-CBaM-1YD-CJuFjV3_.mjs.map