@prisma/orm-toolchain 8.0.0-rc.17-dev.28 → 8.0.0-rc.17-dev.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/{aggregate-DlfOyErc.mjs → aggregate-C0Kci0iw.mjs} +7 -7
  2. package/dist/{aggregate-DlfOyErc.mjs.map → aggregate-C0Kci0iw.mjs.map} +1 -1
  3. package/dist/{caught-errors-HFQjjQVE-b_GDV-6J.mjs → caught-errors-DUV-u8yQ-DuPp394m.mjs} +45 -8
  4. package/dist/caught-errors-DUV-u8yQ-DuPp394m.mjs.map +1 -0
  5. package/dist/cli-telemetry.mjs +1 -1
  6. package/dist/cli.d.mts +1 -1
  7. package/dist/cli.mjs +22 -54
  8. package/dist/cli.mjs.map +1 -1
  9. package/dist/cli__control-api.d.mts +4 -2
  10. package/dist/cli__control-api.d.mts.map +1 -1
  11. package/dist/cli__control-api.mjs +2 -2
  12. package/dist/cli__control-api__testing.d.mts +1 -1
  13. package/dist/cli__migration-cli.mjs +62 -18
  14. package/dist/cli__migration-cli.mjs.map +1 -1
  15. package/dist/config-loader.d.mts +2 -2
  16. package/dist/config-loader.mjs +2 -2
  17. package/dist/{contract-snapshot-store-1S_6vaGt-HJIMKsVd.mjs → contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs} +3 -3
  18. package/dist/{contract-snapshot-store-1S_6vaGt-HJIMKsVd.mjs.map → contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs.map} +1 -1
  19. package/dist/{db-sign-BPf9SzzX-CwOFPxoZ.d.mts → db-sign-DvCsMwUF-D5UIkRXD.d.mts} +2 -2
  20. package/dist/{db-sign-BPf9SzzX-CwOFPxoZ.d.mts.map → db-sign-DvCsMwUF-D5UIkRXD.d.mts.map} +1 -1
  21. package/dist/{errors-DD6iLGXk-6I9PqjpZ.mjs → errors-B1xJ5JTo-CrQL55Qf.mjs} +3 -3
  22. package/dist/{errors-DD6iLGXk-6I9PqjpZ.mjs.map → errors-B1xJ5JTo-CrQL55Qf.mjs.map} +1 -1
  23. package/dist/{exports-Cxv8mNRJ.mjs → exports-D997yN01.mjs} +2 -2
  24. package/dist/{exports-Cxv8mNRJ.mjs.map → exports-D997yN01.mjs.map} +1 -1
  25. package/dist/{exports-C7GzkPEc.mjs → exports-JFLSlPBW.mjs} +4 -3
  26. package/dist/{exports-C7GzkPEc.mjs.map → exports-JFLSlPBW.mjs.map} +1 -1
  27. package/dist/{graph-membership-C_ZO26nT-B7C4CJsh.mjs → graph-membership-C-5WMh1R-BUtW54H2.mjs} +3 -3
  28. package/dist/{graph-membership-C_ZO26nT-B7C4CJsh.mjs.map → graph-membership-C-5WMh1R-BUtW54H2.mjs.map} +1 -1
  29. package/dist/{index-DVcYlnHq.d.mts → index-CWPFeYyi.d.mts} +3 -2
  30. package/dist/{index-DVcYlnHq.d.mts.map → index-CWPFeYyi.d.mts.map} +1 -1
  31. package/dist/{invariants-C0lpc60l-CMUCvk4O.mjs → invariants-1xSrwDkH-BoUuNrf4.mjs} +3 -3
  32. package/dist/{invariants-C0lpc60l-CMUCvk4O.mjs.map → invariants-1xSrwDkH-BoUuNrf4.mjs.map} +1 -1
  33. package/dist/{io-xKnQrxIC-CEXpCgE_.mjs → io-CUFeeOVP-CEgOEVwW.mjs} +5 -5
  34. package/dist/{io-xKnQrxIC-CEXpCgE_.mjs.map → io-CUFeeOVP-CEgOEVwW.mjs.map} +1 -1
  35. package/dist/{migration-oIynqb-J.mjs → migration-CZrQ_3zY.mjs} +3 -3
  36. package/dist/{migration-oIynqb-J.mjs.map → migration-CZrQ_3zY.mjs.map} +1 -1
  37. package/dist/migration-tools.mjs +11 -11
  38. package/dist/migration-tools__aggregate.mjs +1 -1
  39. package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
  40. package/dist/migration-tools__errors.mjs +1 -1
  41. package/dist/migration-tools__invariants.mjs +1 -1
  42. package/dist/migration-tools__io.mjs +1 -1
  43. package/dist/migration-tools__migration-graph.mjs +1 -1
  44. package/dist/migration-tools__migration.mjs +1 -1
  45. package/dist/migration-tools__ref-resolution.mjs +1 -1
  46. package/dist/migration-tools__refs.mjs +1 -1
  47. package/dist/migration-tools__spaces.mjs +2 -2
  48. package/dist/{ref-Cc_CTagE-BYkEh32b.mjs → ref-BITTabCb-BMk154EL.mjs} +100 -69
  49. package/dist/ref-BITTabCb-BMk154EL.mjs.map +1 -0
  50. package/dist/{ref-resolution-Be_zewf7.mjs → ref-resolution-kNMjYJ26.mjs} +2 -2
  51. package/dist/{ref-resolution-Be_zewf7.mjs.map → ref-resolution-kNMjYJ26.mjs.map} +1 -1
  52. package/dist/{refs-qwvw4_dV-DNg_7WTD.mjs → refs-CS997f-J-BxkRLuCE.mjs} +3 -3
  53. package/dist/{refs-qwvw4_dV-DNg_7WTD.mjs.map → refs-CS997f-J-BxkRLuCE.mjs.map} +1 -1
  54. package/dist/{spaces-DGu96Hkk.mjs → spaces-CtxjvIS0.mjs} +5 -5
  55. package/dist/{spaces-DGu96Hkk.mjs.map → spaces-CtxjvIS0.mjs.map} +1 -1
  56. package/dist/{verify-contract-spaces-CYjc343k-ClHHEkJF.mjs → verify-contract-spaces-sL5mlmCX-K2P69KDp.mjs} +4 -4
  57. package/dist/{verify-contract-spaces-CYjc343k-ClHHEkJF.mjs.map → verify-contract-spaces-sL5mlmCX-K2P69KDp.mjs.map} +1 -1
  58. package/dist/vite-plugin-contract-emit.mjs +2 -2
  59. package/package.json +12 -12
  60. package/dist/caught-errors-HFQjjQVE-b_GDV-6J.mjs.map +0 -1
  61. package/dist/ref-Cc_CTagE-BYkEh32b.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { o as PrismaNextConfig$1 } from "./index-DVcYlnHq.mjs";
1
+ import { s as PrismaNextConfig$1 } from "./index-CWPFeYyi.mjs";
2
2
  import { t as MigrationMetadata$1 } from "./metadata-2nbOAGsV-uYNeq2Cp.mjs";
3
3
  import { n as OnDiskMigrationPackage, t as MigrationOps } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
4
4
  import { n as SnapshotContentVerifier } from "./contract-snapshot-store-Bok5nQYi-D3g_P7im.mjs";
@@ -6,7 +6,7 @@ import "./contract-snapshot-store-DrIwu5pn.mjs";
6
6
  import { i as Refs, n as RefEntry } from "./refs-BNCUu58Y-BIso5Jfg.mjs";
7
7
  import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
8
8
  import { a as MigrationRef, t as ContractRef } from "./ref-resolution-BPhR-kta.mjs";
9
- import { A as EmitSuccess, B as PlanQuestionVerb, C as DbUpdateResult, D as EmitFailureCode, E as EmitFailure, F as IntrospectOptions, G as RenderContractDtsSuccess, H as RenderContractDtsFailureCode, J as StatementVerb, K as SchemaVerifyOptions, L as OnControlProgress, M as ExecuteDbSignResult, N as ExecuteDbVerifyOptions, O as EmitOptions, P as ExecuteDbVerifyResult, R as PlanAnswer, S as DbUpdateOptions, T as EmitContractConfig, U as RenderContractDtsOptions, V as RenderContractDtsFailure, W as RenderContractDtsResult, X as executeDbSign, Y as VerifyOptions, Z as executeDbVerify, _ as DbSignOptions, a as ContractEmitOptions, b as DbUpdateFailure, c as ControlClient, d as CreateControlClient, f as DbInitFailure, g as DbInitSuccess, h as DbInitResult, i as CliStructuredError$2, j as ExecuteDbSignOptions, k as EmitResult, l as ControlClientOptions, m as DbInitOptions, n as AppliedStatementReport, o as ContractEmitResult, p as DbInitFailureCode, q as StatementText, r as AskedSubject, s as ControlActionName, t as AnswerPlanQuestions, u as ControlProgressEvent, v as DbSignSpaceFailure, w as DbUpdateSuccess, x as DbUpdateFailureCode, y as DbSignSpaceOutcome, z as PlanQuestion } from "./db-sign-BPf9SzzX-CwOFPxoZ.mjs";
9
+ import { A as EmitSuccess, B as PlanQuestionVerb, C as DbUpdateResult, D as EmitFailureCode, E as EmitFailure, F as IntrospectOptions, G as RenderContractDtsSuccess, H as RenderContractDtsFailureCode, J as StatementVerb, K as SchemaVerifyOptions, L as OnControlProgress, M as ExecuteDbSignResult, N as ExecuteDbVerifyOptions, O as EmitOptions, P as ExecuteDbVerifyResult, R as PlanAnswer, S as DbUpdateOptions, T as EmitContractConfig, U as RenderContractDtsOptions, V as RenderContractDtsFailure, W as RenderContractDtsResult, X as executeDbSign, Y as VerifyOptions, Z as executeDbVerify, _ as DbSignOptions, a as ContractEmitOptions, b as DbUpdateFailure, c as ControlClient, d as CreateControlClient, f as DbInitFailure, g as DbInitSuccess, h as DbInitResult, i as CliStructuredError$2, j as ExecuteDbSignOptions, k as EmitResult, l as ControlClientOptions, m as DbInitOptions, n as AppliedStatementReport, o as ContractEmitResult, p as DbInitFailureCode, q as StatementText, r as AskedSubject, s as ControlActionName, t as AnswerPlanQuestions, u as ControlProgressEvent, v as DbSignSpaceFailure, w as DbUpdateSuccess, x as DbUpdateFailureCode, y as DbSignSpaceOutcome, z as PlanQuestion } from "./db-sign-DvCsMwUF-D5UIkRXD.mjs";
10
10
  import { a as emit } from "./index-C1kfLErt.mjs";
11
11
  import { f as IntegrityQueryOptions, l as ContractSpaceAggregate, m as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-C23h_Ybm.mjs";
12
12
  import "./metadata-BtscDay2.mjs";
@@ -735,6 +735,8 @@ interface MigrationPlanOptions {
735
735
  readonly cwd: string;
736
736
  /** The project's directory, normally the validated config's `baseDir`; locates the project manifest. */
737
737
  readonly projectDir?: string;
738
+ /** The `--config` the command was given, repeated in the command that runs a written `migration.ts`. */
739
+ readonly configPath?: string;
738
740
  readonly name?: string;
739
741
  readonly from?: string;
740
742
  readonly to?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"cli__control-api.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/exports/control-api.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BiB,oBAAoB,SAAS,uBAAuB;;;;;;iBAMpD,eAAe,IAAI,UAAU,YAAY,cAAc,kDAAkD;;;;;;;;iBAQzG,gBA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UAAU;;iBAEJ,iBAAiB,mBAAmB,OAAO,wBAAwB,QAAQ,OAAO,qBAAqB;;;UAG9G;WACC;WACA;WACA;WACA;;UAED;WACC;WACA;WACA;;UAED;WACC;WACA,MAAM,eAAe;;UAEtB;WACC,QAAQ;;WAER;;iBAEM,qBAAqB,cAAc,uBAAuB,SAAS,sBAAsB,QAAQ,OAAO,cAAc;iBACtH,wBAAwB,cAAc,SAAS,sBAAsB,QAAQ,OAAO,iBAAiB;iBACrG,sBAAsB,SAAS,sBAAsB,QAAQ,OAAO,eAAe;;;;UAI1F;WACC;WACA;;UAED;WACC;aACE;aACA;;WAEF;aACE;aACA;;;cAGC,oBAAoB;iBACjB,0BAA0B;WAChC;WACA;;;;;;;;;;iBAUM,wBAAwB;WAC9B;WACA,cAAc;WACd;WACA;WACA,QAAQ,KAAK;IACpB,QAAQ,OAAO,YAAY;iBACd,sBAAsB,iBAAiB,uBAAuB,cAAc,cAAc,YAAY,aAAa;EAClI;EACA;;;;;;;iBAOe,0BAA0B;WAChC;WACA;WACA;WACA,YAAY;WACZ;WACA;IACP,QAAQ,OAAO,sBAAsB;;;;;iBAKxB,iBAAiB;WACvB;WACA;WACA;WACA;WACA,YAAY;IACnB,QAAQ;WACD;WACA;GACR;;;UAGO;WACC,OAAO;WACP,MAAM;WACN;;iBAEM,mBAAmB,eAAe,SAAS,uBAAuB,OAAO,aAAa;iBACtF,oBAAoB,eAAe;WACzC,OAAO;WACP,MAAM;IACb,OAAO,cAAc;;;;iBAIR,kBAAkB,kBAAkB,QAAQ,OAAO,MAAM;;;;;;;KAOrE;WACM;WACA,UAAU;;WAEV;WACA;WACA;;WAEA;;;;;;UAMD;;WAEC,qBAAqB;WACrB,QAAQ;WACR,aAAa;;;;;;;;;iBASP,kBAAkB,OAAO,yBAAyB,gBAAgB,gCAAgC;;;iBAGlG,iBAAiB"}
1
+ {"version":3,"file":"cli__control-api.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/exports/control-api.d.mts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a;;;;;;;;;iBASP,kBAAkB,OAAO,yBAAyB,gBAAgB,gCAAgC;;;iBAGlG,iBAAiB"}
@@ -1,3 +1,3 @@
1
- import { g as errorFromCaught } from "./caught-errors-HFQjjQVE-b_GDV-6J.mjs";
2
- import { $ as refuseUnknownInvariants, A as executeRefListCommand, C as executeDbUpdate, D as executeMigrationPlanCommand, E as executeMigrationNewCommand, F as listRefsByContractHash, G as migrationSpaceListEntriesFromAggregate, J as refuseContractSpaceIntegrity, K as preflightRefAdvancement, L as loadAggregateIntegrityViolations, O as executeRefAdvancement, P as hasMigrationPath, Q as refusePackageCorruptionOnAggregate, R as loadContractRawSafely, S as executeDbSign, T as executeMigrateShowPlan, U as mapContractAtError, V as loadContractSpaceAggregateForCli, W as mapIntegrityViolations, X as refuseMarkerOutsideGraph, Y as refuseDeclaredExtensionTargetMismatch, Z as refuseMissingInvariantPath, _ as disposeEmitQueue, at as resolveMigrationRef, b as executeContractEmit, c as appliedHashesFromLedger, d as buildReadAggregate, dt as runMigrationList, f as buildRefAdvancementFields, g as deriveStatusEdgeAnnotations, gt as statusForMigrationHash, h as createControlClient, it as resolveFromForPlan, j as executeRefSetCommand, k as executeRefDeleteCommand, l as buildContractSpaceAggregate, lt as runContractSpaceSeedPhase, m as computeRefAdvancementName, nt as resolveContractRef$1, o as advanceRefSafely, ot as resolveStatements, p as checkSingleTarget, q as readMigrationRefs, r as NO_REF_ADVANCEMENT, rt as resolveContractRefToSnapshot, s as appContractStandInFromIdentity, st as resolveToForPlan, u as buildMigrationSpaceGraphEntries, ut as runMigrationCheck, v as enrichContract, w as executeDbVerify, x as executeDbInit, y as enumerateCheckSpaces, z as loadContractSource } from "./ref-Cc_CTagE-BYkEh32b.mjs";
1
+ import { x as errorFromCaught } from "./caught-errors-DUV-u8yQ-DuPp394m.mjs";
2
+ import { $ as refuseUnknownInvariants, A as executeRefListCommand, C as executeDbUpdate, D as executeMigrationPlanCommand, E as executeMigrationNewCommand, F as listRefsByContractHash, G as migrationSpaceListEntriesFromAggregate, J as refuseContractSpaceIntegrity, K as preflightRefAdvancement, L as loadAggregateIntegrityViolations, O as executeRefAdvancement, P as hasMigrationPath, Q as refusePackageCorruptionOnAggregate, R as loadContractRawSafely, S as executeDbSign, T as executeMigrateShowPlan, U as mapContractAtError, V as loadContractSpaceAggregateForCli, W as mapIntegrityViolations, X as refuseMarkerOutsideGraph, Y as refuseDeclaredExtensionTargetMismatch, Z as refuseMissingInvariantPath, _ as disposeEmitQueue, _t as statusForMigrationHash, at as resolveMigrationRef, b as executeContractEmit, c as appliedHashesFromLedger, d as buildReadAggregate, dt as runMigrationList, f as buildRefAdvancementFields, g as deriveStatusEdgeAnnotations, h as createControlClient, it as resolveFromForPlan, j as executeRefSetCommand, k as executeRefDeleteCommand, l as buildContractSpaceAggregate, lt as runContractSpaceSeedPhase, m as computeRefAdvancementName, nt as resolveContractRef$1, o as advanceRefSafely, ot as resolveStatements, p as checkSingleTarget, q as readMigrationRefs, r as NO_REF_ADVANCEMENT, rt as resolveContractRefToSnapshot, s as appContractStandInFromIdentity, st as resolveToForPlan, u as buildMigrationSpaceGraphEntries, ut as runMigrationCheck, v as enrichContract, w as executeDbVerify, x as executeDbInit, y as enumerateCheckSpaces, z as loadContractSource } from "./ref-BITTabCb-BMk154EL.mjs";
3
3
  export { NO_REF_ADVANCEMENT, advanceRefSafely, appContractStandInFromIdentity, appliedHashesFromLedger, buildContractSpaceAggregate, buildMigrationSpaceGraphEntries, buildReadAggregate, buildRefAdvancementFields, checkSingleTarget, computeRefAdvancementName, createControlClient, deriveStatusEdgeAnnotations, disposeEmitQueue, enrichContract, enumerateCheckSpaces, errorFromCaught, executeContractEmit, executeDbInit, executeDbSign, executeDbUpdate, executeDbVerify, executeMigrateShowPlan, executeMigrationNewCommand, executeMigrationPlanCommand, executeRefAdvancement, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand, hasMigrationPath, listRefsByContractHash, loadAggregateIntegrityViolations, loadContractRawSafely, loadContractSource, loadContractSpaceAggregateForCli, mapContractAtError, mapIntegrityViolations, migrationSpaceListEntriesFromAggregate, preflightRefAdvancement, readMigrationRefs, refuseContractSpaceIntegrity, refuseDeclaredExtensionTargetMismatch, refuseMarkerOutsideGraph, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef$1 as resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveStatements, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
@@ -1,4 +1,4 @@
1
- import { C as DbUpdateResult, I as MigrateResult, M as ExecuteDbSignResult, P as ExecuteDbVerifyResult, W as RenderContractDtsResult, c as ControlClient, h as DbInitResult, k as EmitResult } from "./db-sign-BPf9SzzX-CwOFPxoZ.mjs";
1
+ import { C as DbUpdateResult, I as MigrateResult, M as ExecuteDbSignResult, P as ExecuteDbVerifyResult, W as RenderContractDtsResult, c as ControlClient, h as DbInitResult, k as EmitResult } from "./db-sign-DvCsMwUF-D5UIkRXD.mjs";
2
2
  import { CoreSchemaView, OperationPreview, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
3
3
  import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
4
4
  import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
@@ -1,17 +1,56 @@
1
- import { f as loadConfigForSections } from "./exports-C7GzkPEc.mjs";
2
- import { g as errorInvalidJson } from "./errors-DD6iLGXk-6I9PqjpZ.mjs";
3
- import { g as errorFromCaught } from "./caught-errors-HFQjjQVE-b_GDV-6J.mjs";
4
- import { r as buildMigrationArtifacts } from "./migration-oIynqb-J.mjs";
5
- import { errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from "@prisma/orm-framework/errors/control";
1
+ import { g as requireConfigSections, p as loadConfigForSections, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-JFLSlPBW.mjs";
2
+ import { g as errorInvalidJson } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
3
+ import { $ as migrationsDirFor, x as errorFromCaught } from "./caught-errors-DUV-u8yQ-DuPp394m.mjs";
4
+ import { r as buildMigrationArtifacts } from "./migration-CZrQ_3zY.mjs";
5
+ import { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from "@prisma/orm-framework/errors/control";
6
6
  import { createControlStack } from "@prisma/orm-framework/components/control";
7
7
  import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
8
8
  import { errorMigrationTargetMismatch } from "@prisma/orm-framework/errors/migration";
9
- import { dirname, join } from "pathe";
10
- import { readFileSync, realpathSync, writeFileSync } from "node:fs";
9
+ import { dirname, isAbsolute, join, relative } from "pathe";
10
+ import { existsSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
11
+ import { notOk, ok } from "@prisma/orm-framework/utils/result";
11
12
  import { fileURLToPath } from "node:url";
12
13
  import { Cli, Command, Option, UsageError } from "clipanion";
13
14
  //#region ../../../1-framework/3-tooling/cli/dist/migration-cli.mjs
14
15
  /**
16
+ * 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.
17
+ */
18
+ async function loadMigrationFileConfig(options) {
19
+ const { configPath, migrationFile, cwd, sections } = options;
20
+ if (configPath !== void 0) return loadConfigForSections(configPath, sections);
21
+ const workingDirectoryConfig = join(cwd, CONFIG_FILENAME);
22
+ const candidates = [.../* @__PURE__ */ new Set([await findNearestConfigPathForFile(migrationFile), existsSync(workingDirectoryConfig) ? workingDirectoryConfig : void 0])].filter((candidate) => candidate !== void 0);
23
+ const checked = [];
24
+ for (const candidate of candidates) {
25
+ const loaded = await loadConfig(candidate);
26
+ const config = loaded.ok ? requireConfigSections(loaded.value, [...sections, "migrations"]) : loaded;
27
+ if (!config.ok) {
28
+ checked.push({
29
+ configPath: candidate,
30
+ loadFailure: config.failure.message
31
+ });
32
+ continue;
33
+ }
34
+ if (ownsMigration(config.value, candidate, migrationFile)) return ok(config.value);
35
+ checked.push({
36
+ configPath: candidate,
37
+ migrationsDir: migrationsDirFor(config.value, dirname(candidate))
38
+ });
39
+ }
40
+ return notOk(errorMigrationCliConfigNotFound({
41
+ migrationDir: dirname(migrationFile),
42
+ checked
43
+ }));
44
+ }
45
+ /** Whether `migrationFile` is inside the migrations directory of the config at `configPath`. */
46
+ function ownsMigration(config, configPath, migrationFile) {
47
+ const path = relative(realPath(migrationsDirFor(config, dirname(configPath))), realPath(migrationFile));
48
+ return path !== "" && !path.startsWith("..") && !isAbsolute(path);
49
+ }
50
+ function realPath(path) {
51
+ return existsSync(path) ? realpathSync(path) : path;
52
+ }
53
+ /**
15
54
  * The migration-file CLI interface: the actor invoked when the author runs
16
55
  * `node migration.ts` directly.
17
56
  *
@@ -30,9 +69,8 @@ import { Cli, Command, Option, UsageError } from "clipanion";
30
69
  * 1. Detects whether the file is the direct entrypoint (no-op when imported).
31
70
  * 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via
32
71
  * [clipanion](https://github.com/arcanis/clipanion).
33
- * 3. Loads the project's `prisma.config.ts` via the same
34
- * `loadConfigForSections` the CLI commands use, walking up from the
35
- * migration file's directory.
72
+ * 3. Loads the config `--config` names. Without it, loads the config that
73
+ * owns the migration (see `loadMigrationFileConfig`).
36
74
  * 4. Probe-instantiates the migration class without a stack so it can read
37
75
  * `targetId` and verify it matches `config.target.targetId`
38
76
  * (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter
@@ -391,14 +429,20 @@ async function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout)
391
429
  * exit 1.
392
430
  */
393
431
  async function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {
394
- const migrationDir = dirname(fileURLToPath(importMetaUrl));
395
- const configResult = await loadConfigForSections(parsed.config, [
396
- "family",
397
- "target",
398
- "adapter",
399
- "driver",
400
- "extensions"
401
- ]);
432
+ const migrationFile = fileURLToPath(importMetaUrl);
433
+ const migrationDir = dirname(migrationFile);
434
+ const configResult = await loadMigrationFileConfig({
435
+ configPath: parsed.config,
436
+ migrationFile,
437
+ cwd: process.cwd(),
438
+ sections: [
439
+ "family",
440
+ "target",
441
+ "adapter",
442
+ "driver",
443
+ "extensions"
444
+ ]
445
+ });
402
446
  if (!configResult.ok) throw configResult.failure;
403
447
  const config = configResult.value;
404
448
  const probe = new MigrationClass();
@@ -1 +1 @@
1
- {"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { t as errorFromCaught } from \"./caught-errors-HFQjjQVE.mjs\";\nimport { readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { dirname, join } from \"pathe\";\nimport { loadConfigForSections } 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/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 project's `prisma.config.ts` via the same\n* `loadConfigForSections` the CLI commands use, walking up from the\n* migration file's directory.\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 migrationDir = dirname(fileURLToPath(importMetaUrl));\n\tconst configResult = await loadConfigForSections(parsed.config, [\n\t\t\"family\",\n\t\t\"target\",\n\t\t\"adapter\",\n\t\t\"driver\",\n\t\t\"extensions\"\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAM,cAAc;CACnB;CACA;CACA;AACD;;;;;;;;AAQA,IAAI,uBAAuB,cAAc,QAAQ;CAChD,OAAO,QAAQ,CAAC,QAAQ,OAAO;CAC/B,OAAO,QAAQ,QAAQ,MAAM;EAC5B,aAAa;EACb,SAAS;;;;;EAKT,UAAU;GACT,CAAC,4DAA4D,IAAI;GACjE,CAAC,iCAAiC,cAAc;GAChD,CAAC,iCAAiC,gCAAgC;EACnE;CACD,CAAC;CACD,SAAS,OAAO,QAAQ,aAAa,OAAO,EAAE,aAAa,mDAAmD,CAAC;CAC/G,SAAS,OAAO,OAAO,YAAY,EAAE,aAAa,2BAA2B,CAAC;;;;;;;;;CAS9E,MAAM,UAAU;EACf,OAAO;CACR;AACD;;;;;;;;;;;;;AAaA,IAAI,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;CAwBxB,aAAa,IAAI,eAAe,gBAAgB,UAAU,CAAC,GAAG;EAC7D,IAAI,CAAC,eAAe,OAAO;EAC3B,MAAM,OAAO,QAAQ,QAAQ,QAAQ;EACrC,MAAM,SAAS,QAAQ,UAAU,QAAQ;EACzC,MAAM,SAAS,QAAQ,UAAU,QAAQ;EACzC,IAAI,CAAC,mBAAmB,eAAe,IAAI,GAAG,OAAO;EACrD,MAAM,WAAW,MAAM,YAAY,eAAe,gBAAgB;GACjE;GACA;GACA;EACD,CAAC;EACD,IAAI,aAAa,KAAK,CAAC,QAAQ,UAAU,QAAQ,WAAW;EAC5D,OAAO;CACR;AACD;;;;;;;;;AASA,SAAS,mBAAmB,eAAe,MAAM;CAChD,MAAM,QAAQ,KAAK;CACnB,IAAI,CAAC,OAAO,OAAO;CAC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AI;AACL"}
1
+ {"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { _ as migrationsDirFor, t as errorFromCaught } from \"./caught-errors-DUV-u8yQ.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 { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { dirname, isAbsolute, join, relative } from \"pathe\";\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,aAAa;CACrD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AE,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"}
@@ -1,2 +1,2 @@
1
- import { _ as ormConfigSchema, a as ORM_CONFIG_SECTION_NAME, b as validateOrmSection, c as evaluateConfigModule, d as globContractInputMatching, f as isConfigSection, g as loadConfigForSections, h as loadConfigForFile, i as LoadedConfig, l as expandContractInputs, m as loadConfigFiles, n as ConfigFiles, o as PrismaNextConfig, p as loadConfig, r as ConfigSection, s as buildLoadedConfig, t as ConfigFile, u as findNearestConfigPathForFile, v as ormConfigSection, y as requireConfigSections } from "./index-DVcYlnHq.mjs";
2
- export { type ConfigFile, type ConfigFiles, type ConfigSection, type LoadedConfig, ORM_CONFIG_SECTION_NAME, type PrismaNextConfig, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };
1
+ import { _ as loadConfigForSections, a as LoadedConfig, b as requireConfigSections, c as buildLoadedConfig, d as findNearestConfigPathForFile, f as globContractInputMatching, g as loadConfigForFile, h as loadConfigFiles, i as ConfigSection, l as evaluateConfigModule, m as loadConfig, n as ConfigFile, o as ORM_CONFIG_SECTION_NAME, p as isConfigSection, r as ConfigFiles, s as PrismaNextConfig, t as CONFIG_FILENAME, u as expandContractInputs, v as ormConfigSchema, x as validateOrmSection, y as ormConfigSection } from "./index-CWPFeYyi.mjs";
2
+ export { CONFIG_FILENAME, type ConfigFile, type ConfigFiles, type ConfigSection, type LoadedConfig, ORM_CONFIG_SECTION_NAME, type PrismaNextConfig, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };
@@ -1,2 +1,2 @@
1
- import { c as isConfigSection, d as loadConfigForFile, f as loadConfigForSections, g as validateOrmSection, h as requireConfigSections, i as expandContractInputs, l as loadConfig, m as ormConfigSection, n as buildLoadedConfig, o as findNearestConfigPathForFile, p as ormConfigSchema, r as evaluateConfigModule, s as globContractInputMatching, t as ORM_CONFIG_SECTION_NAME, u as loadConfigFiles } from "./exports-C7GzkPEc.mjs";
2
- export { ORM_CONFIG_SECTION_NAME, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };
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-JFLSlPBW.mjs";
2
+ export { CONFIG_FILENAME, ORM_CONFIG_SECTION_NAME, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };
@@ -1,4 +1,4 @@
1
- import { a as errorContractSnapshotHashMismatch, g as errorInvalidJson, i as errorContractSnapshotContentMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-DD6iLGXk-6I9PqjpZ.mjs";
1
+ import { a as errorContractSnapshotHashMismatch, g as errorInvalidJson, i as errorContractSnapshotContentMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
2
2
  import { n as recomputePublishedStorageHash } from "./hash-BAZVWU4a-BQovI7hF.mjs";
3
3
  import { CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex } from "@prisma/orm-framework/components/control";
4
4
  import { join, relative } from "pathe";
@@ -6,7 +6,7 @@ import { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
6
6
  import { randomBytes } from "node:crypto";
7
7
  import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
8
8
  import { blindCast } from "@prisma/orm-framework/utils/casts";
9
- //#region ../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-1S_6vaGt.mjs
9
+ //#region ../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-CNu34KAd.mjs
10
10
  const CONTRACT_JSON_FILE = "contract.json";
11
11
  const CONTRACT_DTS_FILE = "contract.d.ts";
12
12
  function hasErrnoCode(error, code) {
@@ -143,4 +143,4 @@ function snapshotsImportPathFrom(packageDir, migrationsDir) {
143
143
  //#endregion
144
144
  export { snapshotsImportPathFrom as a, readContractSnapshotJsonTolerant as i, createSnapshotContentVerifier as n, writeContractSnapshot as o, readContractSnapshotJson as r, contractSnapshotDir as t };
145
145
 
146
- //# sourceMappingURL=contract-snapshot-store-1S_6vaGt-HJIMKsVd.mjs.map
146
+ //# sourceMappingURL=contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract-snapshot-store-1S_6vaGt-HJIMKsVd.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-1S_6vaGt.mjs"],"sourcesContent":["import { a as errorContractSnapshotHashMismatch, g as errorInvalidJson, i as errorContractSnapshotContentMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from \"./errors-DD6iLGXk.mjs\";\nimport { n as recomputePublishedStorageHash } from \"./hash-BAZVWU4a.mjs\";\nimport { join, relative } from \"pathe\";\nimport { mkdir, readFile, rename, rm, stat, writeFile } from \"node:fs/promises\";\nimport { randomBytes } from \"node:crypto\";\nimport { CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex } from \"@internal/framework-components/control\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/contract-snapshot-store.ts\nconst CONTRACT_JSON_FILE = \"contract.json\";\nconst CONTRACT_DTS_FILE = \"contract.d.ts\";\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && blindCast(error).code === code;\n}\nasync function directoryExists(p) {\n\ttry {\n\t\treturn (await stat(p)).isDirectory();\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return false;\n\t\tthrow error;\n\t}\n}\nfunction contractSnapshotDir(migrationsDir, storageHash) {\n\treturn join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex(storageHash));\n}\nfunction createSnapshotContentVerifier(hooks) {\n\treturn { assertSnapshotContentMatches(contractJson, storageHash, jsonPath) {\n\t\tconst record = blindCast(contractJson ?? {});\n\t\tconst computedHash = recomputePublishedStorageHash({\n\t\t\ttarget: record.target,\n\t\t\ttargetFamily: record.targetFamily,\n\t\t\tstorage: record.storage,\n\t\t\thooks\n\t\t});\n\t\tif (computedHash !== storageHash) throw errorContractSnapshotContentMismatch({\n\t\t\tstorageHash,\n\t\t\tcomputedHash,\n\t\t\tjsonPath\n\t\t});\n\t} };\n}\nasync function writeContractSnapshot(migrationsDir, storageHash, input) {\n\tconst dir = contractSnapshotDir(migrationsDir, storageHash);\n\tconst actualStorageHash = blindCast(input.contractJson).storage?.storageHash;\n\tif (actualStorageHash !== storageHash) throw errorContractSnapshotHashMismatch(storageHash, typeof actualStorageHash === \"string\" ? actualStorageHash : String(actualStorageHash), dir);\n\tif (await directoryExists(dir)) return {\n\t\twritten: false,\n\t\tdir\n\t};\n\tconst tmpDir = join(join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME), `.tmp-${storageHashHex(storageHash)}-${Date.now()}-${randomBytes(4).toString(\"hex\")}`);\n\tawait mkdir(tmpDir, { recursive: true });\n\tconst jsonContent = `${canonicalizeJson(input.contractJson)}\\n`;\n\tconst dtsContent = input.contractDts.endsWith(\"\\n\") ? input.contractDts : `${input.contractDts}\\n`;\n\ttry {\n\t\tawait writeFile(join(tmpDir, CONTRACT_JSON_FILE), jsonContent);\n\t\tawait writeFile(join(tmpDir, CONTRACT_DTS_FILE), dtsContent);\n\t\tawait rename(tmpDir, dir);\n\t} catch (error) {\n\t\tawait rm(tmpDir, {\n\t\t\trecursive: true,\n\t\t\tforce: true\n\t\t});\n\t\tif (hasErrnoCode(error, \"EEXIST\") || hasErrnoCode(error, \"ENOTEMPTY\")) return {\n\t\t\twritten: false,\n\t\t\tdir\n\t\t};\n\t\tthrow error;\n\t}\n\treturn {\n\t\twritten: true,\n\t\tdir\n\t};\n}\n/**\n* When `verifyContent` is supplied, the parsed snapshot's content is checked\n* against the hash it was addressed by before being returned — the store is\n* content-addressed, and a snapshot edited in place under an unchanged hash\n* would otherwise flow into planning as if it were the recorded contract.\n*/\nasync function readContractSnapshotJson(migrationsDir, storageHash, verifyContent) {\n\tconst jsonPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_JSON_FILE);\n\tlet raw;\n\ttry {\n\t\traw = await readFile(jsonPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorContractSnapshotMissing(storageHash, jsonPath);\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(jsonPath, e instanceof Error ? e.message : String(e));\n\t}\n\tverifyContent?.assertSnapshotContentMatches(parsed, storageHash, jsonPath);\n\treturn parsed;\n}\n/**\n* Tolerant read: a missing store entry (ENOENT), an unparseable\n* `contract.json`, the JSON literal `null`, or a `storageHash` that isn't a\n* well-formed 64-hex value all resolve to `undefined` rather than\n* throwing — parity with the catch-all tolerance of the pre-store\n* `readEndContractJson` (`io.ts`), which never validated the hash it was\n* keyed by either. Any other fs error (e.g. `EACCES` on a present-but-\n* unreadable file) propagates rather than silently loading a contract-less\n* package. When `verifyContent` is supplied, an entry whose content does not\n* recompute to its address also resolves to `undefined` — tampered content\n* must not flow onward, and the strict store reads report the same file\n* loudly as `MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH`.\n*/\nasync function readContractSnapshotJsonTolerant(migrationsDir, storageHash, verifyContent) {\n\tlet jsonPath;\n\ttry {\n\t\tjsonPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_JSON_FILE);\n\t} catch {\n\t\treturn;\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readFile(jsonPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return;\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\treturn;\n\t}\n\tif (parsed === null) return;\n\ttry {\n\t\tverifyContent?.assertSnapshotContentMatches(parsed, storageHash, jsonPath);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH\") return;\n\t\tthrow error;\n\t}\n\treturn parsed;\n}\nfunction snapshotsImportPathFrom(packageDir, migrationsDir) {\n\treturn relative(packageDir, join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME)).split(\"\\\\\").join(\"/\");\n}\n//#endregion\nexport { snapshotsImportPathFrom as a, readContractSnapshotJsonTolerant as i, createSnapshotContentVerifier as n, writeContractSnapshot as o, readContractSnapshotJson as r, contractSnapshotDir as t };\n\n//# sourceMappingURL=contract-snapshot-store-1S_6vaGt.mjs.map"],"mappings":";;;;;;;;;AASA,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAC1B,SAAS,aAAa,OAAO,MAAM;CAClC,OAAO,iBAAiB,SAAS,UAAU,KAAK,CAAC,CAAC,SAAS;AAC5D;AACA,eAAe,gBAAgB,GAAG;CACjC,IAAI;EACH,QAAQ,MAAM,KAAK,CAAC,EAAA,CAAG,YAAY;CACpC,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG,OAAO;EAC1C,MAAM;CACP;AACD;AACA,SAAS,oBAAoB,eAAe,aAAa;CACxD,OAAO,KAAK,eAAe,4BAA4B,eAAe,WAAW,CAAC;AACnF;AACA,SAAS,8BAA8B,OAAO;CAC7C,OAAO,EAAE,6BAA6B,cAAc,aAAa,UAAU;EAC1E,MAAM,SAAS,UAAU,gBAAgB,CAAC,CAAC;EAC3C,MAAM,eAAe,8BAA8B;GAClD,QA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AAG,kBAAkB;CACzF,IAAI;CACJ,IAAI;EACH,MAAM,MAAM,SAAS,UAAU,OAAO;CACvC,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG,MAAM,6BAA6B,aAAa,QAAQ;EAC3F,MAAM;CACP;CACA,IAAI;CACJ,IAAI;EACH,SAAS,KAAK,MAAM,GAAG;CACxB,SAAS,GAAG;EACX,MAAM,iBAAiB,UAAU,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC;CAC5E;CACA,eAAe,6BAA6B,QAAQ,aAAa,QAAQ;CACzE,OAAO;AACR;;;;;;;;;;;;;;AAcA,eAAe,iCAAiC,eAAe,aAAa,eAAe;CAC1F,IAAI;CACJ,IAAI;EACH,WAAW,KAAK,oBAAoB,eAAe,WAAW,GAAG,kBAAkB;CACpF,QAAQ;EACP;CACD;CACA,IAAI;CACJ,IAAI;EACH,MAAM,MAAM,SAAS,UAAU,OAAO;CACvC,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG;EACnC,MAAM;CACP;CACA,IAAI;CACJ,IAAI;EACH,SAAS,KAAK,MAAM,GAAG;CACxB,QAAQ;EACP;CACD;CACA,IAAI,WAAW,MAAM;CACrB,IAAI;EACH,eAAe,6BAA6B,QAAQ,aAAa,QAAQ;CAC1E,SAAS,OAAO;EACf,IAAI,oBAAoB,GAAG,KAAK,KAAK,MAAM,SAAS,gDAAgD;EACpG,MAAM;CACP;CACA,OAAO;AACR;AACA,SAAS,wBAAwB,YAAY,eAAe;CAC3D,OAAO,SAAS,YAAY,KAAK,eAAe,0BAA0B,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG;AAClG"}
1
+ {"version":3,"file":"contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-CNu34KAd.mjs"],"sourcesContent":["import { a as errorContractSnapshotHashMismatch, g as errorInvalidJson, i as errorContractSnapshotContentMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from \"./errors-B1xJ5JTo.mjs\";\nimport { n as recomputePublishedStorageHash } from \"./hash-BAZVWU4a.mjs\";\nimport { join, relative } from \"pathe\";\nimport { mkdir, readFile, rename, rm, stat, writeFile } from \"node:fs/promises\";\nimport { randomBytes } from \"node:crypto\";\nimport { CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex } from \"@internal/framework-components/control\";\nimport { canonicalizeJson } from \"@internal/framework-components/utils\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/contract-snapshot-store.ts\nconst CONTRACT_JSON_FILE = \"contract.json\";\nconst CONTRACT_DTS_FILE = \"contract.d.ts\";\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && blindCast(error).code === code;\n}\nasync function directoryExists(p) {\n\ttry {\n\t\treturn (await stat(p)).isDirectory();\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return false;\n\t\tthrow error;\n\t}\n}\nfunction contractSnapshotDir(migrationsDir, storageHash) {\n\treturn join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex(storageHash));\n}\nfunction createSnapshotContentVerifier(hooks) {\n\treturn { assertSnapshotContentMatches(contractJson, storageHash, jsonPath) {\n\t\tconst record = blindCast(contractJson ?? {});\n\t\tconst computedHash = recomputePublishedStorageHash({\n\t\t\ttarget: record.target,\n\t\t\ttargetFamily: record.targetFamily,\n\t\t\tstorage: record.storage,\n\t\t\thooks\n\t\t});\n\t\tif (computedHash !== storageHash) throw errorContractSnapshotContentMismatch({\n\t\t\tstorageHash,\n\t\t\tcomputedHash,\n\t\t\tjsonPath\n\t\t});\n\t} };\n}\nasync function writeContractSnapshot(migrationsDir, storageHash, input) {\n\tconst dir = contractSnapshotDir(migrationsDir, storageHash);\n\tconst actualStorageHash = blindCast(input.contractJson).storage?.storageHash;\n\tif (actualStorageHash !== storageHash) throw errorContractSnapshotHashMismatch(storageHash, typeof actualStorageHash === \"string\" ? actualStorageHash : String(actualStorageHash), dir);\n\tif (await directoryExists(dir)) return {\n\t\twritten: false,\n\t\tdir\n\t};\n\tconst tmpDir = join(join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME), `.tmp-${storageHashHex(storageHash)}-${Date.now()}-${randomBytes(4).toString(\"hex\")}`);\n\tawait mkdir(tmpDir, { recursive: true });\n\tconst jsonContent = `${canonicalizeJson(input.contractJson)}\\n`;\n\tconst dtsContent = input.contractDts.endsWith(\"\\n\") ? input.contractDts : `${input.contractDts}\\n`;\n\ttry {\n\t\tawait writeFile(join(tmpDir, CONTRACT_JSON_FILE), jsonContent);\n\t\tawait writeFile(join(tmpDir, CONTRACT_DTS_FILE), dtsContent);\n\t\tawait rename(tmpDir, dir);\n\t} catch (error) {\n\t\tawait rm(tmpDir, {\n\t\t\trecursive: true,\n\t\t\tforce: true\n\t\t});\n\t\tif (hasErrnoCode(error, \"EEXIST\") || hasErrnoCode(error, \"ENOTEMPTY\")) return {\n\t\t\twritten: false,\n\t\t\tdir\n\t\t};\n\t\tthrow error;\n\t}\n\treturn {\n\t\twritten: true,\n\t\tdir\n\t};\n}\n/**\n* When `verifyContent` is supplied, the parsed snapshot's content is checked\n* against the hash it was addressed by before being returned — the store is\n* content-addressed, and a snapshot edited in place under an unchanged hash\n* would otherwise flow into planning as if it were the recorded contract.\n*/\nasync function readContractSnapshotJson(migrationsDir, storageHash, verifyContent) {\n\tconst jsonPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_JSON_FILE);\n\tlet raw;\n\ttry {\n\t\traw = await readFile(jsonPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorContractSnapshotMissing(storageHash, jsonPath);\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(jsonPath, e instanceof Error ? e.message : String(e));\n\t}\n\tverifyContent?.assertSnapshotContentMatches(parsed, storageHash, jsonPath);\n\treturn parsed;\n}\n/**\n* Tolerant read: a missing store entry (ENOENT), an unparseable\n* `contract.json`, the JSON literal `null`, or a `storageHash` that isn't a\n* well-formed 64-hex value all resolve to `undefined` rather than\n* throwing — parity with the catch-all tolerance of the pre-store\n* `readEndContractJson` (`io.ts`), which never validated the hash it was\n* keyed by either. Any other fs error (e.g. `EACCES` on a present-but-\n* unreadable file) propagates rather than silently loading a contract-less\n* package. When `verifyContent` is supplied, an entry whose content does not\n* recompute to its address also resolves to `undefined` — tampered content\n* must not flow onward, and the strict store reads report the same file\n* loudly as `MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH`.\n*/\nasync function readContractSnapshotJsonTolerant(migrationsDir, storageHash, verifyContent) {\n\tlet jsonPath;\n\ttry {\n\t\tjsonPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_JSON_FILE);\n\t} catch {\n\t\treturn;\n\t}\n\tlet raw;\n\ttry {\n\t\traw = await readFile(jsonPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return;\n\t\tthrow error;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\treturn;\n\t}\n\tif (parsed === null) return;\n\ttry {\n\t\tverifyContent?.assertSnapshotContentMatches(parsed, storageHash, jsonPath);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH\") return;\n\t\tthrow error;\n\t}\n\treturn parsed;\n}\nfunction snapshotsImportPathFrom(packageDir, migrationsDir) {\n\treturn relative(packageDir, join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME)).split(\"\\\\\").join(\"/\");\n}\n//#endregion\nexport { snapshotsImportPathFrom as a, readContractSnapshotJsonTolerant as i, createSnapshotContentVerifier as n, writeContractSnapshot as o, readContractSnapshotJson as r, contractSnapshotDir as t };\n\n//# sourceMappingURL=contract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nC,MAAM;CACP;CACA,IAAI;CACJ,IAAI;EACH,SAAS,KAAK,MAAM,GAAG;CACxB,QAAQ;EACP;CACD;CACA,IAAI,WAAW,MAAM;CACrB,IAAI;EACH,eAAe,6BAA6B,QAAQ,aAAa,QAAQ;CAC1E,SAAS,OAAO;EACf,IAAI,oBAAoB,GAAG,KAAK,KAAK,MAAM,SAAS,gDAAgD;EACpG,MAAM;CACP;CACA,OAAO;AACR;AACA,SAAS,wBAAwB,YAAY,eAAe;CAC3D,OAAO,SAAS,YAAY,KAAK,eAAe,0BAA0B,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG;AAClG"}
@@ -13,7 +13,7 @@ import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-f
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-BPf9SzzX.d.mts
16
+ //#region ../../../1-framework/3-tooling/cli/dist/db-sign-DvCsMwUF.d.mts
17
17
  //#region src/control-api/operations/db-verify.d.ts
18
18
  /**
19
19
  * Inputs for the aggregate `db verify` operation.
@@ -1072,4 +1072,4 @@ type ExecuteDbSignResult = Result<ExecuteDbSignSuccess, CliStructuredError$2>;
1072
1072
  declare function executeDbSign<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbSignOptions<TFamilyId, TTargetId>): Promise<ExecuteDbSignResult>;
1073
1073
  //#endregion
1074
1074
  export { EmitSuccess as A, PlanQuestionVerb as B, DbUpdateResult as C, EmitFailureCode as D, EmitFailure as E, IntrospectOptions as F, RenderContractDtsSuccess as G, RenderContractDtsFailureCode as H, MigrateResult as I, StatementVerb as J, SchemaVerifyOptions as K, OnControlProgress as L, ExecuteDbSignResult as M, ExecuteDbVerifyOptions as N, EmitOptions as O, ExecuteDbVerifyResult as P, PlanAnswer as R, DbUpdateOptions as S, EmitContractConfig as T, RenderContractDtsOptions as U, RenderContractDtsFailure as V, RenderContractDtsResult as W, executeDbSign as X, VerifyOptions as Y, executeDbVerify as Z, DbSignOptions as _, ContractEmitOptions as a, DbUpdateFailure as b, ControlClient as c, CreateControlClient as d, DbInitFailure as f, DbInitSuccess as g, DbInitResult as h, CliStructuredError$2 as i, ExecuteDbSignOptions as j, EmitResult as k, ControlClientOptions as l, DbInitOptions as m, AppliedStatementReport as n, ContractEmitResult as o, DbInitFailureCode as p, StatementText as q, AskedSubject as r, ControlActionName as s, AnswerPlanQuestions as t, ControlProgressEvent as u, DbSignSpaceFailure as v, DbUpdateSuccess as w, DbUpdateFailureCode as x, DbSignSpaceOutcome as y, PlanQuestion as z };
1075
- //# sourceMappingURL=db-sign-BPf9SzzX-CwOFPxoZ.d.mts.map
1075
+ //# sourceMappingURL=db-sign-DvCsMwUF-D5UIkRXD.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"db-sign-BPf9SzzX-CwOFPxoZ.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/db-sign-BPf9SzzX.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;UAyBU,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;;;;;;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QAAQ;;;;;;;;EAQxC,aAAa,SAAS,sBAAsB,QAAQ;;;;;;;;;EASpD,OAAO,SAAS,gBAAgB,QAAQ;;;;;;;;;;EAUxC,SAAS,SAAS,kBAAkB,QAAQ;;;;;;;;;;;;;;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;;;;;;;;EAQrC,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,7 +1,7 @@
1
1
  import { ifDefined } from "@prisma/orm-framework/utils/defined";
2
2
  import { CliStructuredError } from "@prisma/orm-framework/errors/control";
3
3
  import { dirname, relative } from "pathe";
4
- //#region ../../../1-framework/3-tooling/migration/dist/errors-DD6iLGXk.mjs
4
+ //#region ../../../1-framework/3-tooling/migration/dist/errors-B1xJ5JTo.mjs
5
5
  /**
6
6
  * Build the canonical "re-emit this package" remediation hint.
7
7
  *
@@ -13,7 +13,7 @@ import { dirname, relative } from "pathe";
13
13
  * heal the broken one.
14
14
  */
15
15
  function reemitHint(dir, fallback) {
16
- const reemit = `Re-emit the package by running \`node "${relative(process.cwd(), dir)}/migration.ts"\``;
16
+ const reemit = `Re-emit the package by running \`node "${relative(process.cwd(), dir)}/migration.ts"\`, adding the \`--config <path>\` you gave this command, if any`;
17
17
  return fallback ? `${reemit}, ${fallback}` : `${reemit}.`;
18
18
  }
19
19
  /**
@@ -400,4 +400,4 @@ function errorMigrationContractViewMissing(className, accessor, jsonField) {
400
400
  //#endregion
401
401
  export { errorRefNotResolvable as A, errorInvalidSpaceId as C, errorNoInvariantPath as D, errorMissingFile as E, errorUnknownInvariant as M, errorOperationsNotArray as O, errorInvalidSlug as S, errorMigrationHashMismatch as T, errorInvalidManifest as _, errorContractSnapshotHashMismatch as a, errorInvalidRefName as b, errorDescribeMissingEndContract as c, errorDuplicateInvariantInEdge as d, errorDuplicateSpaceId as f, errorInvalidJson as g, errorInvalidInvariantId as h, errorContractSnapshotContentMismatch as i, errorSpaceHeadRefMissing as j, errorProvidedInvariantsMismatch as k, errorDescriptorHeadHashMismatch as l, errorInvalidDestName as m, errorBundleNotFoundForGraphNode as n, errorContractSnapshotMissing as o, errorHashNotInGraph as p, errorContractDeserializationFailed as r, errorDescribeInvalidMetadata as s, MigrationToolsError as t, errorDirectoryExists as u, errorInvalidOperationEntry as v, errorMigrationContractViewMissing as w, errorInvalidRefValue as x, errorInvalidRefFile as y };
402
402
 
403
- //# sourceMappingURL=errors-DD6iLGXk-6I9PqjpZ.mjs.map
403
+ //# sourceMappingURL=errors-B1xJ5JTo-CrQL55Qf.mjs.map