@prisma/orm-toolchain 8.0.0-rc.21-dev.4 → 8.0.0-rc.21-dev.6
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/{aggregate-CNSeEdzt.mjs → aggregate-DS_usja4.mjs} +2 -2
- package/dist/{aggregate-CNSeEdzt.mjs.map → aggregate-DS_usja4.mjs.map} +1 -1
- package/dist/{aggregate-L_KguJXL.d.mts → aggregate-DbWK1jSi.d.mts} +2 -2
- package/dist/{aggregate-L_KguJXL.d.mts.map → aggregate-DbWK1jSi.d.mts.map} +1 -1
- package/dist/{caught-errors-BxdRHTkj-C40Qqf4i.mjs → caught-errors-DlLh7HAX-DzRh7ZVr.mjs} +12 -25
- package/dist/caught-errors-DlLh7HAX-DzRh7ZVr.mjs.map +1 -0
- package/dist/cli-telemetry.mjs +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +11 -9
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +8 -4
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +2 -2
- package/dist/cli__control-api__testing.d.mts +2 -2
- package/dist/cli__migration-cli.mjs +2 -2
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{db-sign-DRaumhgX-DUsGYByK.d.mts → db-sign-wBQmmQn7-Bl6NVm0G.d.mts} +12 -4
- package/dist/db-sign-wBQmmQn7-Bl6NVm0G.d.mts.map +1 -0
- package/dist/{domain-type-generation-B4m774CV-WAjyhZHw.mjs → domain-type-generation-BlYB8GiS-k0HNTf4f.mjs} +38 -26
- package/dist/domain-type-generation-BlYB8GiS-k0HNTf4f.mjs.map +1 -0
- package/dist/{domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts → domain-type-generation-D5cG6TGd-DKLpO6ZA.d.mts} +8 -8
- package/dist/{domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts.map → domain-type-generation-D5cG6TGd-DKLpO6ZA.d.mts.map} +1 -1
- package/dist/emitter.d.mts +2 -2
- package/dist/emitter.mjs +2 -2
- package/dist/emitter__domain-type-generation.d.mts +1 -1
- package/dist/emitter__domain-type-generation.mjs +1 -1
- package/dist/{exports-BCIlMjIW-DkUBVDzl.mjs → exports-CVgs3YWV-BF4rqnxF.mjs} +12 -20
- package/dist/exports-CVgs3YWV-BF4rqnxF.mjs.map +1 -0
- package/dist/{exports-DET_AbNt.mjs → exports-D-eB7CoA.mjs} +2 -2
- package/dist/{exports-DET_AbNt.mjs.map → exports-D-eB7CoA.mjs.map} +1 -1
- package/dist/{exports-BlYTE3-J.mjs → exports-ycSqeIf5.mjs} +2 -2
- package/dist/{exports-BlYTE3-J.mjs.map → exports-ycSqeIf5.mjs.map} +1 -1
- package/dist/{index-tAySVPvZ.d.mts → index-BHYAWGxJ.d.mts} +4 -4
- package/dist/{index-tAySVPvZ.d.mts.map → index-BHYAWGxJ.d.mts.map} +1 -1
- package/dist/migration-tools.d.mts +1 -1
- package/dist/migration-tools.mjs +1 -1
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/{ref-D-HCqZAl-Bbop38S7.mjs → ref-qma7fG-2-TOPNrzuP.mjs} +153 -67
- package/dist/ref-qma7fG-2-TOPNrzuP.mjs.map +1 -0
- package/dist/vite-plugin-contract-emit.mjs +3 -3
- package/package.json +12 -12
- package/dist/caught-errors-BxdRHTkj-C40Qqf4i.mjs.map +0 -1
- package/dist/db-sign-DRaumhgX-DUsGYByK.d.mts.map +0 -1
- package/dist/domain-type-generation-B4m774CV-WAjyhZHw.mjs.map +0 -1
- package/dist/exports-BCIlMjIW-DkUBVDzl.mjs.map +0 -1
- package/dist/ref-D-HCqZAl-Bbop38S7.mjs.map +0 -1
|
@@ -5,18 +5,18 @@ import "./contract-snapshot-store-DrIwu5pn.mjs";
|
|
|
5
5
|
import { i as Refs, n as RefEntry } from "./refs-BNCUu58Y-BIso5Jfg.mjs";
|
|
6
6
|
import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
|
|
7
7
|
import { a as MigrationRef, t as ContractRef } from "./ref-resolution-BPhR-kta.mjs";
|
|
8
|
-
import { A as
|
|
8
|
+
import { A as ExecuteDbSignOptions, B as PlannerWarningsListener, C as DbUpdateSuccess, D as EmitOptions, E as EmitFailureCode, G as RenderContractDtsSuccess, H as RenderContractDtsFailureCode, I as OnControlProgress, J as StatementVerb, K as SchemaVerifyOptions, L as PlanAnswer, M as ExecuteDbVerifyOptions, N as ExecuteDbVerifyResult, O as EmitResult, P as IntrospectOptions, Q as executeDbVerify, R as PlanQuestion, S as DbUpdateResult, T as EmitFailure, U as RenderContractDtsOptions, V as RenderContractDtsFailure, W as RenderContractDtsResult, X as VerifyOptions, Y as TemporaryValueReport, Z as executeDbSign, _ as DbInitSuccess, a as ChangedStorageEntity, b as DbSignSpaceOutcome, c as ContractEmitOptions, d as ControlClient, f as ControlClientOptions, g as DbInitResult, h as DbInitOptions, i as AskedSubject, j as ExecuteDbSignResult, k as EmitSuccess, l as ContractEmitResult, m as CreateControlClient, n as AppliedStatementReport, o as CliInvocation, p as ControlProgressEvent, q as StatementText, r as AskedDataLoss, s as CliStructuredError$2, t as AnswerPlanQuestions, u as ControlActionName, v as DbSignOptions, w as EmitContractConfig, x as DbUpdateOptions, y as DbSignSpaceFailure, z as PlanQuestionVerb } from "./db-sign-wBQmmQn7-Bl6NVm0G.mjs";
|
|
9
9
|
import { s as PrismaNextConfig$1 } from "./index-CWPFeYyi.mjs";
|
|
10
|
-
import { a as emit } from "./index-
|
|
11
|
-
import { f as IntegrityQueryOptions, l as ContractSpaceAggregate, m as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-
|
|
10
|
+
import { a as emit } from "./index-BHYAWGxJ.mjs";
|
|
11
|
+
import { f as IntegrityQueryOptions, l as ContractSpaceAggregate, m as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-DbWK1jSi.mjs";
|
|
12
12
|
import "./metadata-BtscDay2.mjs";
|
|
13
13
|
import "./package-N9PPdFV_.mjs";
|
|
14
14
|
import { CliStructuredError } from "@prisma/orm-framework/errors/control";
|
|
15
15
|
import { ControlAdapterInstance, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyInstance, ControlStack, MigrationOperationSubject, MigrationPlanOperation, MigrationPlanSubjects, MigrationSubject, OperationPreview, ResolvedMigrationStatement, ResolvedMigrationStatement as ResolvedMigrationStatement$1, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
16
16
|
import "@prisma/orm-framework/utils/structured-error";
|
|
17
|
+
import { Contract, ContractWithDomain } from "@prisma/orm-framework/contract/types";
|
|
17
18
|
import { Result } from "@prisma/orm-framework/utils/result";
|
|
18
19
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
19
|
-
import { Contract, ContractWithDomain } from "@prisma/orm-framework/contract/types";
|
|
20
20
|
import { ContractSourceDiagnostic, PrismaNextConfig } from "@prisma/orm-framework/config/config-types";
|
|
21
21
|
//#region ../../../1-framework/3-tooling/cli/dist/exports/control-api.d.mts
|
|
22
22
|
//#region src/control-api/client.d.ts
|
|
@@ -829,6 +829,10 @@ interface MigrationPlanResult {
|
|
|
829
829
|
readonly appliedStatements: readonly AppliedStatementReport[];
|
|
830
830
|
/** The new required fields whose existing rows the plan gives a temporary value. */
|
|
831
831
|
readonly temporaryValues: readonly TemporaryValueReport[];
|
|
832
|
+
/**
|
|
833
|
+
* The storage entities that differ between the origin and the destination. Empty when nothing was written (`noOp`), since the storage hashes are equal. A written migration whose `operations` is empty still lists them. A coordinate in the unbound namespace has no `namespaceId`, since that id is internal.
|
|
834
|
+
*/
|
|
835
|
+
readonly changedStorageEntities: readonly ChangedStorageEntity[];
|
|
832
836
|
readonly timings: {
|
|
833
837
|
readonly total: number;
|
|
834
838
|
};
|
|
@@ -1 +1 @@
|
|
|
1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AIzF,iCAAiC,QAAQ,oBAAkB,uBAAuB,wBAAwB,0BAA0B,QAAQ,gBAAgB,sBAAsB;UACzL;WACC,SAAS;WACT,QAAQ;WACR;WACA;;UAED;WACC,iBAAiB;WACjB;WACA;WACA;;WAEA;;;;;;;;;;;;;;;;;iBAiBM,kBAAkB,gBAAgB,QAAQ,qBAAqB,QAAQ;;;;;;;;iBAQvE,gCAAgC;WACtC,WAAW;WACX,uBAAuB;aACrB;;;;;;;;;;;iBAWI,uBAAuB,OAAO,yBAAyB;;;;;;;;;iBASvD,uCAAuC,WAAW,wBAAwB,+BAA+B,iBAAiB;;;;;;;;;UASjI;WACC,iBAAiB;WACjB;;;;;;;;;;;iBAWM,iBAAiB,QAAQ,yBAAyB,OAAO,qBAAqB;;;UAGrF;WACC,QAAQ;;WAER;;WAEA;WACA;WACA;;WAEA,QAAQ,KAAK;;UAEd;WACC;WACA;WACA;WACA;WACA;;iBAEM,2BAA2B,SAAS,sBAAsB,QAAQ,OAAO,oBAAoB;;;UAGpG;WACC,QAAQ;;WAER;;WAEA;;WAEA;WACA;WACA;WACA;;;;;;;;WAQA,sBAAsB;;;;;;WAMtB,iBAAiB;;WAEjB,QAAQ,KAAK;;UAEd;WACC;WACA;WACA;WACA;WACA;WACA;;;;;;;;;;;;;WAaA;aACE;aACA;;WAEF;aACE;aACA;aACA;;;;;;;;;WASF;aACE;aACA;aACA;;;;;;;WAOF,UAAU;WACV;;;;;;WAMA;;;;;;WAMA;;WAEA;;;;;WAKA;;;;;;WAMA,4BAA4B;;WAE5B,0BAA0B;
|
|
1
|
+
{"version":3,"file":"cli__control-api.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/exports/control-api.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAkBiB,oBAAoB,SAAS,uBAAuB;;;;;;iBAMpD,eAAe,IAAI,UAAU,YAAY,cAAc,kDAAkD;;;;;;;;iBAQzG,gBAAgB,gBAAgB,MAAM,4BAA4B;WACxE;I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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { D as errorFromCaught } from "./caught-errors-
|
|
2
|
-
import { $ as refuseContractSpaceIntegrity, A as executeRefDeleteCommand, B as loadAggregateIntegrityViolations, C as executeDbSign, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, H as loadContractSource, K as mapContractAtError, M as executeRefSetCommand, O as executeMigrationPlanCommand, Q as readMigrationRefs, R as listRefsByContractHash, S as executeDbInit, T as executeDbVerify, V as loadContractRawSafely, W as loadContractSpaceAggregateForCli, Y as migrationSpaceListEntriesFromAggregate, Z as preflightRefAdvancement, _ as deriveStatusEdgeAnnotations, a as advanceRefSafely, b as enumerateCheckSpaces, c as buildContractSpaceAggregate, ct as resolveContractRefToSnapshot, d as buildRefAdvancementFields, dt as resolveStatements, et as refuseDeclaredExtensionTargetMismatch, f as checkSingleTarget, ft as resolveToForPlan, g as createControlClient, gt as runMigrationList, ht as runMigrationCheck, j as executeRefListCommand, k as executeRefAdvancement, l as buildMigrationSpaceGraphEntries, lt as resolveFromForPlan, mt as runContractSpaceSeedPhase, n as NO_REF_ADVANCEMENT, nt as refusePackageCorruptionOnAggregate, o as appContractStandInFromIdentity, p as computeRefAdvancementName, q as mapIntegrityViolations, rt as refuseUnknownInvariants, s as appliedHashesFromLedger, st as resolveContractRef$1, tt as refuseMissingInvariantPath, u as buildReadAggregate, ut as resolveMigrationRef, v as disposeEmitQueue, w as executeDbUpdate, x as executeContractEmit, y as enrichContract, yt as statusForMigrationHash } from "./ref-
|
|
1
|
+
import { D as errorFromCaught } from "./caught-errors-DlLh7HAX-DzRh7ZVr.mjs";
|
|
2
|
+
import { $ as refuseContractSpaceIntegrity, A as executeRefDeleteCommand, B as loadAggregateIntegrityViolations, C as executeDbSign, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, H as loadContractSource, K as mapContractAtError, M as executeRefSetCommand, O as executeMigrationPlanCommand, Q as readMigrationRefs, R as listRefsByContractHash, S as executeDbInit, T as executeDbVerify, V as loadContractRawSafely, W as loadContractSpaceAggregateForCli, Y as migrationSpaceListEntriesFromAggregate, Z as preflightRefAdvancement, _ as deriveStatusEdgeAnnotations, a as advanceRefSafely, b as enumerateCheckSpaces, c as buildContractSpaceAggregate, ct as resolveContractRefToSnapshot, d as buildRefAdvancementFields, dt as resolveStatements, et as refuseDeclaredExtensionTargetMismatch, f as checkSingleTarget, ft as resolveToForPlan, g as createControlClient, gt as runMigrationList, ht as runMigrationCheck, j as executeRefListCommand, k as executeRefAdvancement, l as buildMigrationSpaceGraphEntries, lt as resolveFromForPlan, mt as runContractSpaceSeedPhase, n as NO_REF_ADVANCEMENT, nt as refusePackageCorruptionOnAggregate, o as appContractStandInFromIdentity, p as computeRefAdvancementName, q as mapIntegrityViolations, rt as refuseUnknownInvariants, s as appliedHashesFromLedger, st as resolveContractRef$1, tt as refuseMissingInvariantPath, u as buildReadAggregate, ut as resolveMigrationRef, v as disposeEmitQueue, w as executeDbUpdate, x as executeContractEmit, y as enrichContract, yt as statusForMigrationHash } from "./ref-qma7fG-2-TOPNrzuP.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, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef$1 as resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveStatements, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as MigrateResult, N as ExecuteDbVerifyResult, O as EmitResult, S as DbUpdateResult, W as RenderContractDtsResult, d as ControlClient, g as DbInitResult, j as ExecuteDbSignResult } from "./db-sign-wBQmmQn7-Bl6NVm0G.mjs";
|
|
2
2
|
import { CoreSchemaView, OperationPreview, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
3
|
-
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
4
3
|
import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
4
|
+
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
5
5
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma/orm-framework/components/authoring";
|
|
6
6
|
//#region ../../../1-framework/3-tooling/cli/dist/exports/control-api-testing.d.mts
|
|
7
7
|
//#region src/control-api/testing/fixture-client.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as requireConfigSections, p as loadConfigForSections, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-
|
|
1
|
+
import { g as requireConfigSections, p as loadConfigForSections, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-ycSqeIf5.mjs";
|
|
2
2
|
import { g as errorInvalidJson } from "./errors-DXha_4l--relAaiI4.mjs";
|
|
3
|
-
import { D as errorFromCaught, it as migrationsDirFor } from "./caught-errors-
|
|
3
|
+
import { D as errorFromCaught, it as migrationsDirFor } from "./caught-errors-DlLh7HAX-DzRh7ZVr.mjs";
|
|
4
4
|
import { r as buildMigrationArtifacts } from "./migration-CWyjX9vz.mjs";
|
|
5
5
|
import { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from "@prisma/orm-framework/errors/control";
|
|
6
6
|
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { n as errorFromCaught, v as migrationsDirFor } from \"./caught-errors-BxdRHTkj.mjs\";\nimport { existsSync, readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { dirname, isAbsolute, join, relative } from \"pathe\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { CONFIG_FILENAME, findNearestConfigPathForFile, loadConfig, loadConfigForSections, requireConfigSections } from \"@internal/config-loader\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/utils/migration-file-config.ts\n/**\n* The config a `migration.ts` runs with. `--config` names it outright. Without it, the config is the one that owns the migration, whose migrations directory holds the file: the nearest `prisma.config.ts` above the migration, else the one in the working directory.\n*/\nasync function loadMigrationFileConfig(options) {\n\tconst { configPath, migrationFile, cwd, sections } = options;\n\tif (configPath !== void 0) return loadConfigForSections(configPath, sections);\n\tconst workingDirectoryConfig = join(cwd, CONFIG_FILENAME);\n\tconst candidates = [.../* @__PURE__ */ new Set([await findNearestConfigPathForFile(migrationFile), existsSync(workingDirectoryConfig) ? workingDirectoryConfig : void 0])].filter((candidate) => candidate !== void 0);\n\tconst checked = [];\n\tfor (const candidate of candidates) {\n\t\tconst loaded = await loadConfig(candidate);\n\t\tconst config = loaded.ok ? requireConfigSections(loaded.value, [...sections, \"migrations\"]) : loaded;\n\t\tif (!config.ok) {\n\t\t\tchecked.push({\n\t\t\t\tconfigPath: candidate,\n\t\t\t\tloadFailure: config.failure.message\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (ownsMigration(config.value, candidate, migrationFile)) return ok(config.value);\n\t\tchecked.push({\n\t\t\tconfigPath: candidate,\n\t\t\tmigrationsDir: migrationsDirFor(config.value, dirname(candidate))\n\t\t});\n\t}\n\treturn notOk(errorMigrationCliConfigNotFound({\n\t\tmigrationDir: dirname(migrationFile),\n\t\tchecked\n\t}));\n}\n/** Whether `migrationFile` is inside the migrations directory of the config at `configPath`. */\nfunction ownsMigration(config, configPath, migrationFile) {\n\tconst path = relative(realPath(migrationsDirFor(config, dirname(configPath))), realPath(migrationFile));\n\treturn path !== \"\" && !path.startsWith(\"..\") && !isAbsolute(path);\n}\nfunction realPath(path) {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n//#endregion\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma db migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the config `--config` names. Without it, loads the config that\n* owns the migration (see `loadMigrationFileConfig`).\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (isStructuredError(err)) writeStructuredError(ctx.stderr, errorFromCaught(err, (message) => message));\n\t\telse ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream. Format\n* matches the legacy hand-rolled writer (`message: why`) so the rest of\n* the project's error rendering stays consistent across surfaces. The\n* full PN code (`PN-<domain>-<code>`) is included so consumers can\n* grep for stable identifiers.\n*/\nfunction writeStructuredError(stream, err) {\n\tconst envelope = err.toEnvelope();\n\tconst why = envelope.why ?? envelope.summary;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}\\n${why}${fix}\\n`);\n}\n/**\n* Read a previously-scaffolded `migration.json` from disk, returning\n* `null` when the file is missing and throwing `MIGRATION.INVALID_JSON`\n* when the file is present but cannot be parsed as JSON. The CLI feeds\n* this into `buildMigrationArtifacts` so the pure builder can preserve\n* fields owned by `migration plan` (contract bookends, `createdAt`) across\n* re-emits.\n*\n* Author-time path: this loader still does not verify the manifest hash\n* or schema — that is the apply-time loader's job. Hash mismatch is the\n* *expected* outcome of a re-author (the developer's source changes\n* invalidate the prior hash by construction), and verification here\n* would block legitimate regenerations. Syntactic JSON-parse failure,\n* however, is now surfaced rather than swallowed: a malformed\n* `migration.json` indicates either a hand-edit gone wrong or partial\n* write, and silently rebuilding from `describe()` would discard the\n* user's on-disk content (preserved bookends, `createdAt`) without any\n* indication something was wrong on disk.\n* Apply-time consumers always route through the verifying\n* `readMigrationPackage` in `@internal/migration-tools/io` instead.\n*/\nfunction readExistingMetadata(metadataPath) {\n\tlet raw;\n\ttry {\n\t\traw = readFileSync(metadataPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(metadataPath, e instanceof Error ? e.message : String(e));\n\t}\n}\n/**\n* Persist a migration instance's artifacts to `migrationDir`. In\n* `dryRun` mode the artifacts are printed to stdout (with the same\n* `--- migration.json --- / --- ops.json ---` framing the legacy\n* `serializeMigration` helper used) and no files are written. Otherwise\n* `ops.json` and `migration.json` are written next to `migration.ts` and\n* a confirmation line is printed.\n*\n* File I/O lives in the CLI rather than `@internal/migration-tools`\n* so the migration-tools package stays focused on the pure\n* `Migration` → in-memory artifact conversion. The CLI is the only\n* legitimate site for combining config loading, stack assembly, and\n* filesystem persistence.\n*/\nasync function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout) {\n\tconst metadataPath = join(migrationDir, \"migration.json\");\n\tconst { opsJson, metadataJson } = await buildMigrationArtifacts(instance, readExistingMetadata(metadataPath));\n\tif (dryRun) {\n\t\tstdout.write(`--- migration.json ---\\n${metadataJson}\\n`);\n\t\tstdout.write(\"--- ops.json ---\\n\");\n\t\tstdout.write(`${opsJson}\\n`);\n\t\treturn;\n\t}\n\twriteFileSync(join(migrationDir, \"ops.json\"), opsJson);\n\twriteFileSync(metadataPath, metadataJson);\n\tstdout.write(`Wrote ops.json + migration.json to ${migrationDir}\\n`);\n}\n/**\n* Inner orchestration: load config, probe-construct the migration,\n* verify target, assemble the stack, construct with the stack, persist.\n*\n* Throws `CliStructuredError` for known failure modes (config not\n* found, target mismatch); the outer `orchestrate` translates those to\n* exit 1.\n*/\nasync function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {\n\tconst migrationFile = fileURLToPath(importMetaUrl);\n\tconst migrationDir = dirname(migrationFile);\n\tconst configResult = await loadMigrationFileConfig({\n\t\tconfigPath: parsed.config,\n\t\tmigrationFile,\n\t\tcwd: process.cwd(),\n\t\tsections: [\n\t\t\t\"family\",\n\t\t\t\"target\",\n\t\t\t\"adapter\",\n\t\t\t\"driver\",\n\t\t\t\"extensions\"\n\t\t]\n\t});\n\tif (!configResult.ok) throw configResult.failure;\n\tconst config = configResult.value;\n\tconst probe = new MigrationClass();\n\tif (probe.targetId !== config.target.targetId) throw errorMigrationTargetMismatch({\n\t\tmigrationTargetId: probe.targetId,\n\t\tconfigTargetId: config.target.targetId\n\t});\n\tawait serializeMigrationToDisk(new MigrationCl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ACtH,IAAI;AACL"}
|
|
1
|
+
{"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { n as errorFromCaught, v as migrationsDirFor } from \"./caught-errors-DlLh7HAX.mjs\";\nimport { existsSync, readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { dirname, isAbsolute, join, relative } from \"pathe\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { CONFIG_FILENAME, findNearestConfigPathForFile, loadConfig, loadConfigForSections, requireConfigSections } from \"@internal/config-loader\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/utils/migration-file-config.ts\n/**\n* The config a `migration.ts` runs with. `--config` names it outright. Without it, the config is the one that owns the migration, whose migrations directory holds the file: the nearest `prisma.config.ts` above the migration, else the one in the working directory.\n*/\nasync function loadMigrationFileConfig(options) {\n\tconst { configPath, migrationFile, cwd, sections } = options;\n\tif (configPath !== void 0) return loadConfigForSections(configPath, sections);\n\tconst workingDirectoryConfig = join(cwd, CONFIG_FILENAME);\n\tconst candidates = [.../* @__PURE__ */ new Set([await findNearestConfigPathForFile(migrationFile), existsSync(workingDirectoryConfig) ? workingDirectoryConfig : void 0])].filter((candidate) => candidate !== void 0);\n\tconst checked = [];\n\tfor (const candidate of candidates) {\n\t\tconst loaded = await loadConfig(candidate);\n\t\tconst config = loaded.ok ? requireConfigSections(loaded.value, [...sections, \"migrations\"]) : loaded;\n\t\tif (!config.ok) {\n\t\t\tchecked.push({\n\t\t\t\tconfigPath: candidate,\n\t\t\t\tloadFailure: config.failure.message\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (ownsMigration(config.value, candidate, migrationFile)) return ok(config.value);\n\t\tchecked.push({\n\t\t\tconfigPath: candidate,\n\t\t\tmigrationsDir: migrationsDirFor(config.value, dirname(candidate))\n\t\t});\n\t}\n\treturn notOk(errorMigrationCliConfigNotFound({\n\t\tmigrationDir: dirname(migrationFile),\n\t\tchecked\n\t}));\n}\n/** Whether `migrationFile` is inside the migrations directory of the config at `configPath`. */\nfunction ownsMigration(config, configPath, migrationFile) {\n\tconst path = relative(realPath(migrationsDirFor(config, dirname(configPath))), realPath(migrationFile));\n\treturn path !== \"\" && !path.startsWith(\"..\") && !isAbsolute(path);\n}\nfunction realPath(path) {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n//#endregion\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma db migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the config `--config` names. Without it, loads the config that\n* owns the migration (see `loadMigrationFileConfig`).\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (isStructuredError(err)) writeStructuredError(ctx.stderr, errorFromCaught(err, (message) => message));\n\t\telse ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream. Format\n* matches the legacy hand-rolled writer (`message: why`) so the rest of\n* the project's error rendering stays consistent across surfaces. The\n* full PN code (`PN-<domain>-<code>`) is included so consumers can\n* grep for stable identifiers.\n*/\nfunction writeStructuredError(stream, err) {\n\tconst envelope = err.toEnvelope();\n\tconst why = envelope.why ?? envelope.summary;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}\\n${why}${fix}\\n`);\n}\n/**\n* Read a previously-scaffolded `migration.json` from disk, returning\n* `null` when the file is missing and throwing `MIGRATION.INVALID_JSON`\n* when the file is present but cannot be parsed as JSON. The CLI feeds\n* this into `buildMigrationArtifacts` so the pure builder can preserve\n* fields owned by `migration plan` (contract bookends, `createdAt`) across\n* re-emits.\n*\n* Author-time path: this loader still does not verify the manifest hash\n* or schema — that is the apply-time loader's job. Hash mismatch is the\n* *expected* outcome of a re-author (the developer's source changes\n* invalidate the prior hash by construction), and verification here\n* would block legitimate regenerations. Syntactic JSON-parse failure,\n* however, is now surfaced rather than swallowed: a malformed\n* `migration.json` indicates either a hand-edit gone wrong or partial\n* write, and silently rebuilding from `describe()` would discard the\n* user's on-disk content (preserved bookends, `createdAt`) without any\n* indication something was wrong on disk.\n* Apply-time consumers always route through the verifying\n* `readMigrationPackage` in `@internal/migration-tools/io` instead.\n*/\nfunction readExistingMetadata(metadataPath) {\n\tlet raw;\n\ttry {\n\t\traw = readFileSync(metadataPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(metadataPath, e instanceof Error ? e.message : String(e));\n\t}\n}\n/**\n* Persist a migration instance's artifacts to `migrationDir`. In\n* `dryRun` mode the artifacts are printed to stdout (with the same\n* `--- migration.json --- / --- ops.json ---` framing the legacy\n* `serializeMigration` helper used) and no files are written. Otherwise\n* `ops.json` and `migration.json` are written next to `migration.ts` and\n* a confirmation line is printed.\n*\n* File I/O lives in the CLI rather than `@internal/migration-tools`\n* so the migration-tools package stays focused on the pure\n* `Migration` → in-memory artifact conversion. The CLI is the only\n* legitimate site for combining config loading, stack assembly, and\n* filesystem persistence.\n*/\nasync function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout) {\n\tconst metadataPath = join(migrationDir, \"migration.json\");\n\tconst { opsJson, metadataJson } = await buildMigrationArtifacts(instance, readExistingMetadata(metadataPath));\n\tif (dryRun) {\n\t\tstdout.write(`--- migration.json ---\\n${metadataJson}\\n`);\n\t\tstdout.write(\"--- ops.json ---\\n\");\n\t\tstdout.write(`${opsJson}\\n`);\n\t\treturn;\n\t}\n\twriteFileSync(join(migrationDir, \"ops.json\"), opsJson);\n\twriteFileSync(metadataPath, metadataJson);\n\tstdout.write(`Wrote ops.json + migration.json to ${migrationDir}\\n`);\n}\n/**\n* Inner orchestration: load config, probe-construct the migration,\n* verify target, assemble the stack, construct with the stack, persist.\n*\n* Throws `CliStructuredError` for known failure modes (config not\n* found, target mismatch); the outer `orchestrate` translates those to\n* exit 1.\n*/\nasync function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {\n\tconst migrationFile = fileURLToPath(importMetaUrl);\n\tconst migrationDir = dirname(migrationFile);\n\tconst configResult = await loadMigrationFileConfig({\n\t\tconfigPath: parsed.config,\n\t\tmigrationFile,\n\t\tcwd: process.cwd(),\n\t\tsections: [\n\t\t\t\"family\",\n\t\t\t\"target\",\n\t\t\t\"adapter\",\n\t\t\t\"driver\",\n\t\t\t\"extensions\"\n\t\t]\n\t});\n\tif (!configResult.ok) throw configResult.failure;\n\tconst config = configResult.value;\n\tconst probe = new MigrationClass();\n\tif (probe.targetId !== config.target.targetId) throw errorMigrationTargetMismatch({\n\t\tmigrationTargetId: probe.targetId,\n\t\tconfigTargetId: config.target.targetId\n\t});\n\tawait serializeMigrationToDisk(new MigrationClass(createControlStack(config)), migrationDir, parsed.dryRun, ctx.stdout);\n\tctx.stderr;\n}\n//#endregion\nexport { MigrationCLI };\n\n//# sourceMappingURL=migration-cli.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,eAAe,wBAAwB,SAAS;CAC/C,MAAM,EAAE,YAAY,eAAe,KAAK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a,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;CAChF;AACD;;;;;;;;;;;;;;;AAeA,eAAe,yBAAyB,UAAU,cAAc,QAAQ,QAAQ;CAC/E,MAAM,eAAe,KAAK,cAAc,gBAAgB;CACxD,MAAM,EAAE,SAAS,iBAAiB,MAAM,wBAAwB,UAAU,qBAAqB,YAAY,CAAC;CAC5G,IAAI,QAAQ;EACX,OAAO,MAAM,2BAA2B,aAAa,GAAG;EACxD,OAAO,MAAM,oBAAoB;EACjC,OAAO,MAAM,GAAG,QAAQ,GAAG;EAC3B;CACD;CACA,cAAc,KAAK,cAAc,UAAU,GAAG,OAAO;CACrD,cAAc,cAAc,YAAY;CACxC,OAAO,MAAM,sCAAsC,aAAa,GAAG;AACpE;;;;;;;;;AASA,eAAe,aAAa,eAAe,gBAAgB,QAAQ,KAAK;CACvE,MAAM,gBAAgB,cAAc,aAAa;CACjD,MAAM,eAAe,QAAQ,aAAa;CAC1C,MAAM,eAAe,MAAM,wBAAwB;EAClD,YAAY,OAAO;EACnB;EACA,KAAK,QAAQ,IAAI;EACjB,UAAU;GACT;GACA;GACA;GACA;GACA;EACD;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,MAAM,aAAa;CACzC,MAAM,SAAS,aAAa;CAC5B,MAAM,QAAQ,IAAI,eAAe;CACjC,IAAI,MAAM,aAAa,OAAO,OAAO,UAAU,MAAM,6BAA6B;EACjF,mBAAmB,MAAM;EACzB,gBAAgB,OAAO,OAAO;CAC/B,CAAC;CACD,MAAM,yBAAyB,IAAI,eAAe,mBAAmB,MAAM,CAAC,GAAG,cAAc,OAAO,QAAQ,IAAI,MAAM;CACtH,IAAI;AACL"}
|
package/dist/config-loader.mjs
CHANGED
|
@@ -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-
|
|
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-ycSqeIf5.mjs";
|
|
2
2
|
export { CONFIG_FILENAME, ORM_CONFIG_SECTION_NAME, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };
|
|
@@ -5,15 +5,15 @@ import { CliStructuredError as CliStructuredError$2 } from "@prisma/orm-framewor
|
|
|
5
5
|
import { ControlAdapterDescriptor, ControlDriverConnectOptions, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlTargetDescriptor, CoreSchemaView, MarkerHashes, MigrationAccessChange, MigrationDataLoss, MigrationOperationSubject, MigrationPlanNamespaces, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, MigrationStatementJson, MigrationSubjectJson, OperationPreview, ResolvedMigrationStatement, SpaceSignature, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
6
6
|
import "@prisma/orm-framework/errors/execution";
|
|
7
7
|
import "@prisma/orm-framework/errors/migration";
|
|
8
|
+
import { Contract, ContractMarkerRecord, EntityCoordinate, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
8
9
|
import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
|
|
9
10
|
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
10
11
|
import { Result } from "@prisma/orm-framework/utils/result";
|
|
11
12
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
12
|
-
import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
13
13
|
import "@prisma/cli-engine/protocol";
|
|
14
14
|
import { ContractSourceDiagnostic, ContractSourceDiagnostics, ContractSourceProvider, PrismaNextConfig } from "@prisma/orm-framework/config/config-types";
|
|
15
15
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma/orm-framework/components/authoring";
|
|
16
|
-
//#region ../../../1-framework/3-tooling/cli/dist/db-sign-
|
|
16
|
+
//#region ../../../1-framework/3-tooling/cli/dist/db-sign-wBQmmQn7.d.mts
|
|
17
17
|
//#region src/control-api/statements/statement-text.d.ts
|
|
18
18
|
/** The verbs a statement can have. */
|
|
19
19
|
type StatementVerb = 'rename' | 'delete' | 'allow' | 'convert' | 'backfill';
|
|
@@ -42,6 +42,12 @@ interface CliInvocation {
|
|
|
42
42
|
readonly statementArgs?: readonly string[];
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
|
+
//#region src/control-api/operations/changed-storage-entities.d.ts
|
|
46
|
+
/** The coordinate of a storage entity that changed, without the internal unbound namespace id. */
|
|
47
|
+
type ChangedStorageEntity = Omit<EntityCoordinate, 'namespaceId'> & {
|
|
48
|
+
readonly namespaceId?: string;
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
45
51
|
//#region src/control-api/operations/db-verify.d.ts
|
|
46
52
|
/**
|
|
47
53
|
* Inputs for the aggregate `db verify` operation.
|
|
@@ -618,6 +624,8 @@ interface DbUpdateSuccess extends MigrationPlanSubjects<AskedDataLoss, AskedAcce
|
|
|
618
624
|
* graph ends at it: the origin a `migration plan` for this database starts from.
|
|
619
625
|
*/
|
|
620
626
|
readonly databaseStorageHash?: string;
|
|
627
|
+
/** The storage entities that changed, when the run signed the database with a changed contract and ran no operation. */
|
|
628
|
+
readonly changedStorageEntities?: readonly ChangedStorageEntity[];
|
|
621
629
|
readonly summary: string;
|
|
622
630
|
}
|
|
623
631
|
/** The result of `db update`: a failure is the structured error the command reports. */
|
|
@@ -1065,5 +1073,5 @@ type ExecuteDbSignResult = Result<ExecuteDbSignSuccess, CliStructuredError$2>;
|
|
|
1065
1073
|
*/
|
|
1066
1074
|
declare function executeDbSign<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbSignOptions<TFamilyId, TTargetId>): Promise<ExecuteDbSignResult>;
|
|
1067
1075
|
//#endregion
|
|
1068
|
-
export {
|
|
1069
|
-
//# sourceMappingURL=db-sign-
|
|
1076
|
+
export { ExecuteDbSignOptions as A, PlannerWarningsListener as B, DbUpdateSuccess as C, EmitOptions as D, EmitFailureCode as E, MigrateResult as F, RenderContractDtsSuccess as G, RenderContractDtsFailureCode as H, OnControlProgress as I, StatementVerb as J, SchemaVerifyOptions as K, PlanAnswer as L, ExecuteDbVerifyOptions as M, ExecuteDbVerifyResult as N, EmitResult as O, IntrospectOptions as P, executeDbVerify as Q, PlanQuestion as R, DbUpdateResult as S, EmitFailure as T, RenderContractDtsOptions as U, RenderContractDtsFailure as V, RenderContractDtsResult as W, VerifyOptions as X, TemporaryValueReport as Y, executeDbSign as Z, DbInitSuccess as _, ChangedStorageEntity as a, DbSignSpaceOutcome as b, ContractEmitOptions as c, ControlClient as d, ControlClientOptions as f, DbInitResult as g, DbInitOptions as h, AskedSubject as i, ExecuteDbSignResult as j, EmitSuccess as k, ContractEmitResult as l, CreateControlClient as m, AppliedStatementReport as n, CliInvocation as o, ControlProgressEvent as p, StatementText as q, AskedDataLoss as r, CliStructuredError$2 as s, AnswerPlanQuestions as t, ControlActionName as u, DbSignOptions as v, EmitContractConfig as w, DbUpdateOptions as x, DbSignSpaceFailure as y, PlanQuestionVerb as z };
|
|
1077
|
+
//# sourceMappingURL=db-sign-wBQmmQn7-Bl6NVm0G.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-sign-wBQmmQn7-Bl6NVm0G.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/db-sign-wBQmmQn7.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;KAiBK;;;;;;UAMK;WACC,MAAM;WACN;;;;;;;;UAQD;WACC;WACA;WACA;;WAEA;;WAEA;;;;;KAKN,uBAAuB,KAAK;WACtB;;;;;;;;;;;;;UAaD,uBAAuB,0BAA0B;WAChD,QAAQ,sBAAsB,WAAW;WACzC,gBAAgB,sBAAsB;WACtC,UAAU;WACV;WACA,UAAU;WACV,YAAY,cAAc,2BAA2B,WAAW;WAChE,qBAAqB,cAAc,+BAA+B,WAAW;WAC7E;WACA;WACA;;WAEA,wBAAwB;WACxB,aAAa;;;;;;;;;;;;;;UAcd;WACC,eAAe,oBAAoB;;;;;;WAMnC;WACA;WACA;;;;;;;;WAQA,aAAa;;KAEnB,wBAAwB,OAAO,wBAAwB;;;;;;;;;;;;;;;;;iBAiB3C,gBAAgB,0BAA0B,0BAA0B,SAAS,uBAAuB,WAAW,aAAa,QAAQ;;;;;;;UAO3I;;WAEC;;;;;;WAMA,yBAAyB;;UAE1B;;WAEC;;KAEN;UACK;WACC,MAAM;WACN;WACA;;WAEA;;KAEN,0BAA0B,OAAO,0BAA0B;;;;KAI3D;;;;KAIA,0CAA0C;;;;;UAKrC;WACC;WACA;;WAEA;WACA,gBAAgB;WAChB;aACE;aACA;;WAEF,WAAW,MAAM,kBAAkB;;;;;WAKnC,mBAAmB,MAAM,kBAAkB,iBAAiB;;WAE5D;;;KAGN;UACK;WACC,MAAM;WACN;;;;;;;;;KASN,uBAAuB,oBAAoB,mBAAmB,kBAAkB;;;;UAI3E;WACC,MAAM;WACN,SAAS;;;;;;KAMf;WACM,MAAM;WACN,WAAW;WACX;;WAEA;;WAEA,MAAM;WACN,WAAW;WACX;;WAEA;;;;;UAKD;WACC;;WAEA;;;;;;;;;;;;;;;UAeD;WACC,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;;;;;EAc5C,SAAS,SAAS,kBAAkB,QAAQ;;;;;;;EAO5C,OAAO,SAAS,gBAAgB,QAAQ;;;;;;;EAOxC,cAAc,QAAQ;;;;;;EAMtB,kBAAkB,QAAQ,oBAAoB;;;;;;EAM9C,WAAW,iBAAiB,iBAAiB;;;;;;;;;;;;;;EAc7C,QAAQ,SAAS,iBAAiB,QAAQ;;;;;;;EAO1C,WAAW,UAAU,oBAAoB;;;;;;;;EAQzC,aAAa,oBAAoB;;;;;;;;EAQjC,iBAAiB,oBAAoB,QAAQ;;;;;;;;EAQ7C,0BAA0B;;;;;;;;;EAS1B,mBAAmB,qBAAqB,2BAA2B;;;;;;;;EAQnE,KAAK,SAAS,cAAc,QAAQ;;;;;;;;EAQpC,kBAAkB,SAAS,2BAA2B,QAAQ;;;;UAItD,qBAAqB,0BAA0B;WAC9C,QAAQ,sBAAsB,WAAW;WACzC,gBAAgB,sBAAsB;;WAEtC,UAAU;WACV;WACA,UAAU;WACV,YAAY,cAAc,2BAA2B,WAAW;WAChE,qBAAqB,cAAc,+BAA+B,WAAW;WAC7E,wBAAwB;WACxB,aAAa;;;UAGd;WACC;WACA;WACA,UAAU;WACV,QAAQ;;;;;KAKd,qBAAqB,iBAAiB;UACjC;;WAEC,iBAAiB;;KAEvB,sBAAsB,OAAO,sBAAsB;;;;iBAIvC,cAAc,0BAA0B,0BAA0B,SAAS,qBAAqB,WAAW,aAAa,QAAQ"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { t as isSafeTypeExpression } from "./type-expression-safety-CgHTWypx.mjs";
|
|
2
2
|
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
3
3
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
4
|
+
import { valueObjectsWithCoordinates } from "@prisma/orm-framework/contract/types";
|
|
4
5
|
import { keepInternalSpecifiers } from "@prisma/orm-framework/components/emission";
|
|
6
|
+
import { entityAt } from "@prisma/orm-framework/components/ir";
|
|
5
7
|
import { renderImports, tsStringLiteral } from "@prisma/orm-framework/ts-render";
|
|
6
|
-
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-
|
|
8
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-BlYB8GiS.mjs
|
|
7
9
|
function emitterError(code, message, options) {
|
|
8
10
|
return structuredError(code, message, options);
|
|
9
11
|
}
|
|
@@ -31,6 +33,9 @@ function generateRootsType(roots) {
|
|
|
31
33
|
if (!roots || Object.keys(roots).length === 0) return "Record<string, never>";
|
|
32
34
|
return `{ ${Object.entries(roots).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${serializeCrossReference(value)}`).join("; ")} }`;
|
|
33
35
|
}
|
|
36
|
+
function valueObjectFieldTypeText(type) {
|
|
37
|
+
return `{ readonly kind: "valueObject"; readonly plane: "storage"; readonly namespaceId: ${serializeValue(type.namespaceId)}; readonly entityKind: "valueObject"; readonly entityName: ${serializeValue(type.entityName)} }`;
|
|
38
|
+
}
|
|
34
39
|
function contractFieldModifierSuffix(field) {
|
|
35
40
|
return (field.many ? `; readonly many: { readonly elementNullable: ${field.many.elementNullable} }` : "") + (field.dict === true ? "; readonly dict: true" : "");
|
|
36
41
|
}
|
|
@@ -41,7 +46,7 @@ function generateModelFieldEntry(fieldName, field) {
|
|
|
41
46
|
const typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : "";
|
|
42
47
|
return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: { readonly kind: "scalar"; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${mods} }`;
|
|
43
48
|
}
|
|
44
|
-
if (type.kind === "valueObject") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type:
|
|
49
|
+
if (type.kind === "valueObject") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: ${valueObjectFieldTypeText(type)}${mods} }`;
|
|
45
50
|
return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${nullable}; readonly type: ${serializeValue(type)}${mods} }`;
|
|
46
51
|
}
|
|
47
52
|
function objectTypeOpenWhenEmpty(entries) {
|
|
@@ -183,9 +188,9 @@ function parameterizedOutputTypeFunctionsAlias(typeFunctions) {
|
|
|
183
188
|
const aliases = [...new Set(typeFunctions.map((typeFunction) => typeFunction.alias))];
|
|
184
189
|
return `type ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} = ${aliases.length > 0 ? aliases.join(" | ") : "never"};`;
|
|
185
190
|
}
|
|
186
|
-
/** `FieldOutputTypes` (`side` `'output'`) or `FieldInputTypes` (`'input'`): the shared generic applied to the emitted contract's domain, with `FieldTypeOverrides
|
|
191
|
+
/** `FieldOutputTypes` (`side` `'output'`) or `FieldInputTypes` (`'input'`): the shared generic applied to the emitted contract's domain, with `FieldTypeOverrides`, and to its storage namespaces. */
|
|
187
192
|
function fieldTypesMapExpression(side) {
|
|
188
|
-
return `FieldTypesFromDomain<ContractBase['domain']['namespaces'], CodecTypes, ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, FieldTypeOverrides, ${serializeValue(side)}>`;
|
|
193
|
+
return `FieldTypesFromDomain<ContractBase['domain']['namespaces'], CodecTypes, ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, FieldTypeOverrides, ${serializeValue(side)}, ContractBase['storage']['namespaces']>`;
|
|
189
194
|
}
|
|
190
195
|
function generateContractFieldDescriptor(fieldName, field) {
|
|
191
196
|
const modStr = contractFieldModifierSuffix(field);
|
|
@@ -194,7 +199,7 @@ function generateContractFieldDescriptor(fieldName, field) {
|
|
|
194
199
|
const typeParamsSpec = type.typeParams && Object.keys(type.typeParams).length > 0 ? `; readonly typeParams: ${serializeValue(type.typeParams)}` : "";
|
|
195
200
|
return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: { readonly kind: "scalar"; readonly codecId: ${serializeValue(type.codecId)}${typeParamsSpec} }${modStr} }`;
|
|
196
201
|
}
|
|
197
|
-
if (type.kind === "valueObject") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type:
|
|
202
|
+
if (type.kind === "valueObject") return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: ${valueObjectFieldTypeText(type)}${modStr} }`;
|
|
198
203
|
return `readonly ${serializeObjectKey(fieldName)}: { readonly nullable: ${field.nullable}; readonly type: ${serializeValue(type)}${modStr} }`;
|
|
199
204
|
}
|
|
200
205
|
function generateValueObjectsDescriptorType(valueObjects) {
|
|
@@ -209,11 +214,11 @@ function generateValueObjectsDescriptorType(valueObjects) {
|
|
|
209
214
|
return `{ ${voEntries.join("; ")} }`;
|
|
210
215
|
}
|
|
211
216
|
/**
|
|
212
|
-
* `<Name>Output` and `<Name>Input` for each value object, read from the shared generic's value object types at the namespace that
|
|
217
|
+
* `<Name>Output` and `<Name>Input` for each value object, read from the shared generic's value object types at the storage namespace that holds it.
|
|
213
218
|
*/
|
|
214
219
|
function generateValueObjectTypeAliases(valueObjectNamespaces) {
|
|
215
220
|
if (valueObjectNamespaces.length === 0) return "";
|
|
216
|
-
const generic = (side) => `
|
|
221
|
+
const generic = (side) => `ValueObjectTypesFromStorage<ContractBase['storage']['namespaces'], CodecTypes, ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, FieldTypeOverrides, ${serializeValue(side)}>`;
|
|
217
222
|
const aliases = [`type ValueObjectOutputTypes = ${generic("output")};`, `type ValueObjectInputTypes = ${generic("input")};`];
|
|
218
223
|
for (const [name, namespaceId] of valueObjectNamespaces) {
|
|
219
224
|
const path = `[${serializeValue(namespaceId)}][${serializeValue(name)}]`;
|
|
@@ -283,7 +288,7 @@ function renderOverrideTree(tree) {
|
|
|
283
288
|
return `{ ${[...tree].sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${value instanceof Map ? renderOverrideTree(value) : renderTypeOverride(value)}`).join("; ")} }`;
|
|
284
289
|
}
|
|
285
290
|
/**
|
|
286
|
-
* The values a field's value set holds, with the field's codec. A reference to a domain enum is read from the contract's domain
|
|
291
|
+
* The values a model field's value set holds, with the field's codec. A reference to a domain enum is read from the contract's domain. Any other model field goes to the family's `resolveStorageValueSet`, which reads its storage.
|
|
287
292
|
*/
|
|
288
293
|
function resolveFieldValueSet(field, contract, resolveStorageValueSet) {
|
|
289
294
|
if (field.valueSet?.plane === "domain") return resolveDomainValueSet(field, contract);
|
|
@@ -299,26 +304,33 @@ function resolveDomainValueSet(field, contract) {
|
|
|
299
304
|
codecId: field.type.codecId
|
|
300
305
|
};
|
|
301
306
|
}
|
|
302
|
-
/**
|
|
307
|
+
/** The values of the storage value set a value object field names, with the field's codec. */
|
|
308
|
+
function resolveValueObjectFieldValueSet(field, storage) {
|
|
309
|
+
if (field.valueSet === void 0 || field.type.kind !== "scalar") return void 0;
|
|
310
|
+
const valueSet = entityAt(storage, field.valueSet);
|
|
311
|
+
if (valueSet === void 0) return void 0;
|
|
312
|
+
return {
|
|
313
|
+
encodedValues: valueSet.values,
|
|
314
|
+
codecId: field.type.codecId
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/** `FieldTypeOverrides`: per namespace, `models` (domain namespace) or `valueObjects` (storage namespace), owner and field, the type of each field its codec does not give. */
|
|
303
318
|
function generateFieldTypeOverridesMap(contract, codecLookup, resolveStorageValueSet) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
], resolveFieldTypeOverride(field, codecLookup, resolveFieldValueSet(field, contract, () => void 0))]));
|
|
318
|
-
return [...modelFields, ...valueObjectFields];
|
|
319
|
-
}));
|
|
319
|
+
const modelFields = Object.entries(contract.domain.namespaces).flatMap(([nsId, ns]) => Object.entries(ns.models).flatMap(([modelName, model]) => Object.entries(model.fields).map(([fieldName, field]) => [[
|
|
320
|
+
nsId,
|
|
321
|
+
"models",
|
|
322
|
+
modelName,
|
|
323
|
+
fieldName
|
|
324
|
+
], resolveFieldTypeOverride(field, codecLookup, resolveFieldValueSet(field, contract, () => resolveStorageValueSet?.(modelName, fieldName, model)))])));
|
|
325
|
+
const valueObjectFields = valueObjectsWithCoordinates(contract.storage).flatMap(({ coordinate: { namespaceId: nsId, entityName: valueObjectName }, valueObject }) => Object.entries(valueObject.fields).map(([fieldName, field]) => [[
|
|
326
|
+
nsId,
|
|
327
|
+
"valueObjects",
|
|
328
|
+
valueObjectName,
|
|
329
|
+
fieldName
|
|
330
|
+
], resolveFieldTypeOverride(field, codecLookup, resolveValueObjectFieldValueSet(field, contract.storage))]));
|
|
331
|
+
return renderTypeOverridesMap([...modelFields, ...valueObjectFields]);
|
|
320
332
|
}
|
|
321
333
|
//#endregion
|
|
322
334
|
export { renderValueSetType as C, serializeNamespaceId as D, serializeExecutionType as E, serializeObjectKey as O, renderValueSetOverride as S, serializeCrossReference as T, parameterizedOutputTypeFunctionsAlias as _, generateCodecTypeIntersection as a, renderTypeOverridesMap as b, generateHashTypeAliases as c, generateModelFieldsType as d, generateModelRelationsType as f, generateValueObjectsDescriptorType as g, generateValueObjectTypeAliases as h, fieldTypesMapExpression as i, serializeValue as k, generateImportLines as l, generateRootsType as m, deduplicateImports as n, generateContractFieldDescriptor as o, generateModelsType as p, emitterError as r, generateFieldTypeOverridesMap as s, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as t, generateModelFieldEntry as u, renderCodecTypeOverride as v, resolveFieldTypeOverride as w, renderValueLiteralType as x, renderTypeOverride as y };
|
|
323
335
|
|
|
324
|
-
//# sourceMappingURL=domain-type-generation-
|
|
336
|
+
//# sourceMappingURL=domain-type-generation-BlYB8GiS-k0HNTf4f.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-type-generation-BlYB8GiS-k0HNTf4f.mjs","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-BlYB8GiS.mjs"],"sourcesContent":["import { isSafeTypeExpression } from \"./type-expression-safety.mjs\";\nimport { structuredError } from \"@internal/utils/structured-error\";\nimport { valueObjectsWithCoordinates } from \"@internal/contract/types\";\nimport { keepInternalSpecifiers } from \"@internal/framework-components/emission\";\nimport { entityAt } from \"@internal/framework-components/ir\";\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 valueObjectFieldTypeText(type) {\n\treturn `{ readonly kind: \"valueObject\"; readonly plane: \"storage\"; readonly namespaceId: ${serializeValue(type.namespaceId)}; readonly entityKind: \"valueObject\"; readonly entityName: ${serializeValue(type.entityName)} }`;\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: ${valueObjectFieldTypeText(type)}${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 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}\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, which every value of a codec that declares `keepsWrittenForm` is. A\n* caller that needs column and field types to agree shares this so both compute the union\n* identically.\n*/\nfunction renderValueSetType(values, codecId, side, codecLookup) {\n\tif (values.length === 0) return void 0;\n\tconst literals = [];\n\tfor (const value of values) {\n\t\tconst lit = renderValueLiteralType(value, codecId, side, codecLookup);\n\t\tif (lit === void 0) return void 0;\n\t\tliterals.push(lit);\n\t}\n\treturn literals.join(\" | \");\n}\n/** The TS literal type the codec renders for one stored value, or `undefined` when it renders none or what it renders is not a safe type expression. */\nfunction renderValueLiteralType(value, codecId, side, codecLookup) {\n\tconst lit = codecLookup?.renderValueLiteralFor?.(codecId, value, side);\n\treturn lit === void 0 || !isSafeTypeExpression(lit) ? void 0 : lit;\n}\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 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/** `FieldOutputTypes` (`side` `'output'`) or `FieldInputTypes` (`'input'`): the shared generic applied to the emitted contract's domain, with `FieldTypeOverrides`, and to its storage namespaces. */\nfunction fieldTypesMapExpression(side) {\n\treturn `FieldTypesFromDomain<ContractBase['domain']['namespaces'], CodecTypes, ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, FieldTypeOverrides, ${serializeValue(side)}, ContractBase['storage']['namespaces']>`;\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: ${valueObjectFieldTypeText(type)}${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}\n/**\n* `<Name>Output` and `<Name>Input` for each value object, read from the shared generic's value object types at the storage namespace that holds it.\n*/\nfunction generateValueObjectTypeAliases(valueObjectNamespaces) {\n\tif (valueObjectNamespaces.length === 0) return \"\";\n\tconst generic = (side) => `ValueObjectTypesFromStorage<ContractBase['storage']['namespaces'], CodecTypes, ${PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS}, FieldTypeOverrides, ${serializeValue(side)}>`;\n\tconst aliases = [`type ValueObjectOutputTypes = ${generic(\"output\")};`, `type ValueObjectInputTypes = ${generic(\"input\")};`];\n\tfor (const [name, namespaceId] of valueObjectNamespaces) {\n\t\tconst path = `[${serializeValue(namespaceId)}][${serializeValue(name)}]`;\n\t\taliases.push(`export type ${name}Output = ValueObjectOutputTypes${path};`);\n\t\taliases.push(`export type ${name}Input = ValueObjectInputTypes${path};`);\n\t}\n\treturn aliases.join(\"\\n\");\n}\n/**\n* The type of a scalar field that its codec does not give, which the shared field type generic takes as an override: the literal union of the value set it holds, or the text its codec renders for its type parameters. `undefined` when the codec gives both sides, and for a value object or union field, which the generic types itself.\n*/\nfunction resolveFieldTypeOverride(field, codecLookup, resolvedValueSet) {\n\tconst { type } = field;\n\tif (type.kind !== \"scalar\") return void 0;\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, one level per path segment, ordered by name at every level, leaving out every branch with no entry. */\nfunction renderTypeOverridesMap(entries) {\n\tconst root = /* @__PURE__ */ new Map();\n\tfor (const [path, type] of entries) {\n\t\tif (type === void 0) continue;\n\t\tlet node = root;\n\t\tfor (const segment of path.slice(0, -1)) {\n\t\t\tconst child = node.get(segment);\n\t\t\tconst next = child instanceof Map ? child : /* @__PURE__ */ new Map();\n\t\t\tnode.set(segment, next);\n\t\t\tnode = next;\n\t\t}\n\t\tconst leaf = path.at(-1);\n\t\tif (leaf !== void 0) node.set(leaf, type);\n\t}\n\treturn renderOverrideTree(root);\n}\nfunction renderOverrideTree(tree) {\n\treturn `{ ${[...tree].sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `readonly ${serializeObjectKey(key)}: ${value instanceof Map ? renderOverrideTree(value) : renderTypeOverride(value)}`).join(\"; \")} }`;\n}\n/**\n* The values a model field's value set holds, with the field's codec. A reference to a domain enum is read from the contract's domain. Any other model field goes to the family's `resolveStorageValueSet`, which reads its storage.\n*/\nfunction resolveFieldValueSet(field, contract, resolveStorageValueSet) {\n\tif (field.valueSet?.plane === \"domain\") return resolveDomainValueSet(field, contract);\n\treturn resolveStorageValueSet();\n}\nfunction resolveDomainValueSet(field, contract) {\n\tconst ref = field.valueSet;\n\tif (ref === void 0 || field.type.kind !== \"scalar\" || ref.entityKind !== \"enum\") return;\n\tconst domainEnum = contract.domain.namespaces[ref.namespaceId]?.enum?.[ref.entityName];\n\tif (domainEnum === void 0) return void 0;\n\treturn {\n\t\tencodedValues: domainEnum.members.map((member) => member.value),\n\t\tcodecId: field.type.codecId\n\t};\n}\n/** The values of the storage value set a value object field names, with the field's codec. */\nfunction resolveValueObjectFieldValueSet(field, storage) {\n\tif (field.valueSet === void 0 || field.type.kind !== \"scalar\") return void 0;\n\tconst valueSet = entityAt(storage, field.valueSet);\n\tif (valueSet === void 0) return void 0;\n\treturn {\n\t\tencodedValues: valueSet.values,\n\t\tcodecId: field.type.codecId\n\t};\n}\n/** `FieldTypeOverrides`: per namespace, `models` (domain namespace) or `valueObjects` (storage namespace), owner and field, the type of each field its codec does not give. */\nfunction generateFieldTypeOverridesMap(contract, codecLookup, resolveStorageValueSet) {\n\tconst modelFields = Object.entries(contract.domain.namespaces).flatMap(([nsId, ns]) => Object.entries(ns.models).flatMap(([modelName, model]) => Object.entries(model.fields).map(([fieldName, field]) => [[\n\t\tnsId,\n\t\t\"models\",\n\t\tmodelName,\n\t\tfieldName\n\t], resolveFieldTypeOverride(field, codecLookup, resolveFieldValueSet(field, contract, () => resolveStorageValueSet?.(modelName, fieldName, model)))])));\n\tconst valueObjectFields = valueObjectsWithCoordinates(contract.storage).flatMap(({ coordinate: { namespaceId: nsId, entityName: valueObjectName }, valueObject }) => Object.entries(valueObject.fields).map(([fieldName, field]) => [[\n\t\tnsId,\n\t\t\"valueObjects\",\n\t\tvalueObjectName,\n\t\tfieldName\n\t], resolveFieldTypeOverride(field, codecLookup, resolveValueObjectFieldValueSet(field, contract.storage))]));\n\treturn renderTypeOverridesMap([...modelFields, ...valueObjectFields]);\n}\n//#endregion\nexport { resolveFieldTypeOverride as C, serializeObjectKey as D, serializeNamespaceId as E, serializeValue as O, renderValueSetType as S, serializeExecutionType as T, renderCodecTypeOverride as _, generateContractFieldDescriptor as a, renderValueLiteralType as b, generateImportLines as c, generateModelRelationsType as d, generateModelsType as f, parameterizedOutputTypeFunctionsAlias as g, generateValueObjectsDescriptorType as h, generateCodecTypeIntersection as i, emitterError as k, generateModelFieldEntry as l, generateValueObjectTypeAliases as m, deduplicateImports as n, generateFieldTypeOverridesMap as o, generateRootsType as p, fieldTypesMapExpression as r, generateHashTypeAliases as s, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as t, generateModelFieldsType as u, renderTypeOverride as v, serializeCrossReference as w, renderValueSetOverride as x, renderTypeOverridesMap as y };\n\n//# sourceMappingURL=domain-type-generation-BlYB8GiS.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,aAAa,MAAM,SAAS,SAAS;CAC7C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;AAGA,SAAS,eAAe,OAAO;CAC9B,IAAI,UAAU,MAAM,OAAO;CAC3B,IAAI,UAAU,KAAK,GAAG,OAAO;CAC7B,IAAI,OAAO,UAAU,UAAU,OAAO,gBAAgB,KAAK;CAC3D,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;CAChF,IAAI,OAAO,UAAU,UAAU,OAAO,GAAG,MAAM;CAC/C,IAAI,MAAM,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,MAAM,KAAK;CACrB;AACD;;AAEA,SAAS,gCAAgC,OAAO,SAAS;CACxD,IAAI,MAAM,aAAa,KAAK,KAAK,MAAM,KAAK,SAAS,UAAU,OAAO,KAAK;CAC3E,MAAM,WAAW,SAAS,SAAS,MAAM,QAAQ;CACjD,IAAI,aAAa,KAAK,GAAG,OAAO,KAAK;CACrC,OAAO;EACN,eAAe,SAAS;EACxB,SAAS,MAAM,KAAK;CACrB;AACD;;AAEA,SAAS,8BAA8B,UAAU,aAAa,wBAAwB;CACrF,MAAM,cAAc,OAAO,QAAQ,SAAS,OAAO,UAAU,CAAC,CAAC,SAAS,CAAC,MAAM,QAAQ,OAAO,QAAQ,GAAG,MAAM,CAAC,CAAC,SAAS,CAAC,WAAW,WAAW,OAAO,QAAQ,MAAM,MAAM,CAAC,CAAC,KAAK,CAAC,WAAW,WAAW,CAAC;EAC1M;EACA;EACA;EACA;CACD,GAAG,yBAAyB,OAAO,aAAa,qBAAqB,OAAO,gBAAgB,yBAAyB,WAAW,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACtJ,MAAM,oBAAoB,4BAA4B,SAAS,OAAO,CAAC,CAAC,SAAS,EAAE,YAAY,EAAE,aAAa,MAAM,YAAY,mBAAmB,kBAAkB,OAAO,QAAQ,YAAY,MAAM,CAAC,CAAC,KAAK,CAAC,WAAW,WAAW,CAAC;EACpO;EACA;EACA;EACA;CACD,GAAG,yBAAyB,OAAO,aAAa,gCAAgC,OAAO,SAAS,OAAO,CAAC,CAAC,CAAC,CAAC;CAC3G,OAAO,uBAAuB,CAAC,GAAG,aAAa,GAAG,iBAAiB,CAAC;AACrE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ContractField, ContractModelBase, ContractValueObject, ContractWithDomain, CrossReference, JsonValue } from "@prisma/orm-framework/contract/types";
|
|
1
2
|
import { ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
|
|
2
|
-
import { Contract, 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-
|
|
4
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-D5cG6TGd.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;
|
|
@@ -47,12 +47,12 @@ declare function renderValueLiteralType(value: JsonValue, codecId: string, side:
|
|
|
47
47
|
declare const PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS = "ParameterizedOutputTypeFunctions";
|
|
48
48
|
/** The declaration of {@link PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS} for the type functions the stack's components declare. */
|
|
49
49
|
declare function parameterizedOutputTypeFunctionsAlias(typeFunctions: ReadonlyArray<TypesImportSpec>): string;
|
|
50
|
-
/** `FieldOutputTypes` (`side` `'output'`) or `FieldInputTypes` (`'input'`): the shared generic applied to the emitted contract's domain, with `FieldTypeOverrides
|
|
50
|
+
/** `FieldOutputTypes` (`side` `'output'`) or `FieldInputTypes` (`'input'`): the shared generic applied to the emitted contract's domain, with `FieldTypeOverrides`, and to its storage namespaces. */
|
|
51
51
|
declare function fieldTypesMapExpression(side: 'output' | 'input'): string;
|
|
52
52
|
declare function generateContractFieldDescriptor(fieldName: string, field: ContractField): string;
|
|
53
53
|
declare function generateValueObjectsDescriptorType(valueObjects: Record<string, ContractValueObject> | undefined): string;
|
|
54
54
|
/**
|
|
55
|
-
* `<Name>Output` and `<Name>Input` for each value object, read from the shared generic's value object types at the namespace that
|
|
55
|
+
* `<Name>Output` and `<Name>Input` for each value object, read from the shared generic's value object types at the storage namespace that holds it.
|
|
56
56
|
*/
|
|
57
57
|
declare function generateValueObjectTypeAliases(valueObjectNamespaces: ReadonlyArray<readonly [name: string, namespaceId: string]>): string;
|
|
58
58
|
/** A field's or column's type on each side where its codec does not give it, as type text. */
|
|
@@ -63,7 +63,7 @@ type TypeOverride = {
|
|
|
63
63
|
/**
|
|
64
64
|
* The type of a scalar field that its codec does not give, which the shared field type generic takes as an override: the literal union of the value set it holds, or the text its codec renders for its type parameters. `undefined` when the codec gives both sides, and for a value object or union field, which the generic types itself.
|
|
65
65
|
*/
|
|
66
|
-
declare function resolveFieldTypeOverride(field: ContractField, codecLookup: CodecLookup | undefined, resolvedValueSet: ResolvedFieldValueSet | undefined): TypeOverride | undefined;
|
|
66
|
+
declare function resolveFieldTypeOverride(field: Pick<ContractField, 'type'>, codecLookup: CodecLookup | undefined, resolvedValueSet: ResolvedFieldValueSet | undefined): TypeOverride | undefined;
|
|
67
67
|
/** The literal union of a value set on each side whose values all have literal types, or `undefined` when neither side has. */
|
|
68
68
|
declare function renderValueSetOverride(values: readonly JsonValue[], codecId: string, codecLookup: CodecLookup | undefined): TypeOverride | undefined;
|
|
69
69
|
/** The type text a codec renders for these type parameters, on the sides it renders one. */
|
|
@@ -71,8 +71,8 @@ declare function renderCodecTypeOverride(codecId: string, typeParams: Record<str
|
|
|
71
71
|
declare function renderTypeOverride(override: TypeOverride): string;
|
|
72
72
|
/** A nested map of type overrides, one level per path segment, ordered by name at every level, leaving out every branch with no entry. */
|
|
73
73
|
declare function renderTypeOverridesMap(entries: ReadonlyArray<readonly [path: readonly string[], type: TypeOverride | undefined]>): string;
|
|
74
|
-
/** `FieldTypeOverrides`: per namespace, `models` or `valueObjects
|
|
75
|
-
declare function generateFieldTypeOverridesMap(contract:
|
|
74
|
+
/** `FieldTypeOverrides`: per namespace, `models` (domain namespace) or `valueObjects` (storage namespace), owner and field, the type of each field its codec does not give. */
|
|
75
|
+
declare function generateFieldTypeOverridesMap(contract: ContractWithDomain, codecLookup: CodecLookup | undefined, resolveStorageValueSet: StorageValueSetResolver | undefined): string;
|
|
76
76
|
//#endregion
|
|
77
77
|
export { serializeObjectKey as A, renderValueLiteralType as C, serializeCrossReference as D, resolveFieldTypeOverride as E, serializeExecutionType as O, renderTypeOverridesMap as S, renderValueSetType as T, generateValueObjectTypeAliases as _, deduplicateImports as a, renderCodecTypeOverride as b, generateContractFieldDescriptor as c, generateImportLines as d, generateModelFieldEntry as f, generateRootsType as g, generateModelsType as h, TypeOverride as i, serializeValue as j, serializeNamespaceId as k, generateFieldTypeOverridesMap as l, generateModelRelationsType as m, ResolvedFieldValueSet as n, fieldTypesMapExpression as o, generateModelFieldsType as p, StorageValueSetResolver as r, generateCodecTypeIntersection as s, PARAMETERIZED_OUTPUT_TYPE_FUNCTIONS as t, generateHashTypeAliases as u, generateValueObjectsDescriptorType as v, renderValueSetOverride as w, renderTypeOverride as x, parameterizedOutputTypeFunctionsAlias as y };
|
|
78
|
-
//# sourceMappingURL=domain-type-generation-
|
|
78
|
+
//# sourceMappingURL=domain-type-generation-D5cG6TGd-DKLpO6ZA.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-type-generation-
|
|
1
|
+
{"version":3,"file":"domain-type-generation-D5cG6TGd-DKLpO6ZA.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-D5cG6TGd.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,yBAAyB;iBACzE,8BAA8B,SAAS,cAAc,kBAAkB;iBACvE,uBAAuB,WAAW;iBAClC,wBAAwB;WAC9B;WACA;WACA;;;;;KAKN;WACM,wBAAwB;WACxB;;KAEN,2BAA2B,mBAAmB,mBAAmB,OAAO,sBAAsB;;;;;;;;;;;;iBAYlF,mBAAmB,iBAAiB,aAAa,iBAAiB,0BAA0B,aAAa;;iBAEzG,uBAAuB,OAAO,WAAW,iBAAiB,0BAA0B,aAAa;;cAEpG;;iBAEG,sCAAsC,eAAe,cAAc;;iBAEnE,wBAAwB;iBACxB,gCAAgC,mBAAmB,OAAO;iBAC1D,mCAAmC,cAAc,eAAe;;;;iBAIhE,+BAA+B,uBAAuB,wBAAwB,cAAc;;KAExG;WACM;WACA;;;;;iBAKM,yBAAyB,OAAO,KAAK,wBAAwB,aAAa,yBAAyB,kBAAkB,oCAAoC;;iBAEzJ,uBAAuB,iBAAiB,aAAa,iBAAiB,aAAa,0BAA0B;;iBAE7G,wBAAwB,iBAAiB,YAAY,qCAAqC,aAAa,0BAA0B;iBACjI,mBAAmB,UAAU;;iBAE7B,uBAAuB,SAAS,wBAAwB,yBAAyB,MAAM;;iBAEvF,8BAA8B,UAAU,oBAAoB,aAAa,yBAAyB,wBAAwB"}
|