@prisma/orm-toolchain 8.0.0-rc.11-dev.39 → 8.0.0-rc.11-dev.41
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-DKBycuzO.d.mts → aggregate-BxeUZtei.d.mts} +14 -4
- package/dist/aggregate-BxeUZtei.d.mts.map +1 -0
- package/dist/{aggregate-DI9VS7yL.mjs → aggregate-DqY54LCk.mjs} +43 -31
- package/dist/aggregate-DqY54LCk.mjs.map +1 -0
- package/dist/cli.mjs +87 -32
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +75 -6
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__control-api__testing.d.mts +1 -1
- package/dist/cli__migration-cli.mjs +2 -2
- package/dist/contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts +59 -0
- package/dist/contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts.map +1 -0
- package/dist/{contract-snapshot-store-D-mFkiHR-CFl0ulR2.mjs → contract-snapshot-store-CM9ubenX-o8kTVHxP.mjs} +48 -11
- package/dist/contract-snapshot-store-CM9ubenX-o8kTVHxP.mjs.map +1 -0
- package/dist/contract-snapshot-store-DrIwu5pn.d.mts +2 -0
- package/dist/{db-verify-BdKY7U7l-6VLIVuKF.d.mts → db-verify-BkwsVjIf-CDWnVSjr.d.mts} +6 -2
- package/dist/db-verify-BkwsVjIf-CDWnVSjr.d.mts.map +1 -0
- package/dist/{errors-SoLLYLtw-DMxVbVs9.mjs → errors-BIroGS9E-Dg6CF-dm.mjs} +15 -3
- package/dist/{errors-SoLLYLtw-DMxVbVs9.mjs.map → errors-BIroGS9E-Dg6CF-dm.mjs.map} +1 -1
- package/dist/{graph-membership-DY1Onbc3-CwBd6wuB.mjs → graph-membership-CdU6royq-gP9Kb9Eh.mjs} +3 -3
- package/dist/{graph-membership-DY1Onbc3-CwBd6wuB.mjs.map → graph-membership-CdU6royq-gP9Kb9Eh.mjs.map} +1 -1
- package/dist/{hash-DH8hl5Rq-BpM2t3Nu.mjs → hash-BAZVWU4a-BdynTmar.mjs} +24 -3
- package/dist/hash-BAZVWU4a-BdynTmar.mjs.map +1 -0
- package/dist/hash-CwWGlFWV.d.mts +1 -0
- package/dist/{hash-XZYYKJ-i.d.mts → hash-DclMqd7S-WBvXJ_4C.d.mts} +17 -4
- package/dist/hash-DclMqd7S-WBvXJ_4C.d.mts.map +1 -0
- package/dist/{invariants-Cww4bv0v-BEiFxmbX.mjs → invariants-CUbFGAse-DqgE4fhO.mjs} +3 -3
- package/dist/{invariants-Cww4bv0v-BEiFxmbX.mjs.map → invariants-CUbFGAse-DqgE4fhO.mjs.map} +1 -1
- package/dist/{io-DSQXOfBH-GRpmFG2F.mjs → io-CyV6U3am-CMJIi_UO.mjs} +7 -7
- package/dist/io-CyV6U3am-CMJIi_UO.mjs.map +1 -0
- package/dist/io-D8Epu7iY.d.mts +1 -0
- package/dist/{io-sr4CO9_t-C3eV_kn-.d.mts → io-DZfMV51z-BKlH5Dhb.d.mts} +9 -2
- package/dist/io-DZfMV51z-BKlH5Dhb.d.mts.map +1 -0
- package/dist/{migration-B9w-7dKe.mjs → migration-D95UJ0Dj.mjs} +4 -4
- package/dist/{migration-B9w-7dKe.mjs.map → migration-D95UJ0Dj.mjs.map} +1 -1
- package/dist/{migration-graph-CW4bMmTz-B5xFtFVB.mjs → migration-graph-BBWEuNAt-C6X6rauo.mjs} +3 -3
- package/dist/{migration-graph-CW4bMmTz-B5xFtFVB.mjs.map → migration-graph-BBWEuNAt-C6X6rauo.mjs.map} +1 -1
- package/dist/{migration-graph-Dqndu0i5.d.mts → migration-graph-CHhNBJSJ.d.mts} +2 -2
- package/dist/{migration-graph-Dqndu0i5.d.mts.map → migration-graph-CHhNBJSJ.d.mts.map} +1 -1
- package/dist/{migration-graph-tarTxJ99-BrGBANeE.d.mts → migration-graph-tarTxJ99-2GNs0O8U.d.mts} +2 -2
- package/dist/{migration-graph-tarTxJ99-BrGBANeE.d.mts.map → migration-graph-tarTxJ99-2GNs0O8U.d.mts.map} +1 -1
- package/dist/migration-tools.d.mts +12 -10
- package/dist/migration-tools.mjs +14 -14
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.d.mts +4 -2
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -2
- package/dist/migration-tools__errors.mjs +1 -1
- package/dist/migration-tools__hash.d.mts +2 -1
- package/dist/migration-tools__hash.mjs +1 -1
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.d.mts +2 -2
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.d.mts +2 -2
- package/dist/migration-tools__migration-graph.mjs +2 -2
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{ref-DlKsxbtg-B55l0TCq.mjs → ref-D5u8Xxwc-BjjqYtnQ.mjs} +212 -48
- package/dist/ref-D5u8Xxwc-BjjqYtnQ.mjs.map +1 -0
- package/dist/{ref-resolution-BWpwb8_b.mjs → ref-resolution-BwWLoU7C.mjs} +2 -2
- package/dist/{ref-resolution-BWpwb8_b.mjs.map → ref-resolution-BwWLoU7C.mjs.map} +1 -1
- package/dist/{refs-BpSpzdYB-BcDelHGt.mjs → refs-S0wu2JkI-BbFdehLe.mjs} +3 -3
- package/dist/{refs-BpSpzdYB-BcDelHGt.mjs.map → refs-S0wu2JkI-BbFdehLe.mjs.map} +1 -1
- package/dist/{spaces-DzFtKEl3.mjs → spaces--kxjIRHx.mjs} +14 -13
- package/dist/spaces--kxjIRHx.mjs.map +1 -0
- package/dist/{verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs → verify-contract-spaces-BLkC9r9l-CJIppNL8.mjs} +4 -4
- package/dist/{verify-contract-spaces-_vwt5LT0-BQAf8Q4T.mjs.map → verify-contract-spaces-BLkC9r9l-CJIppNL8.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +1 -1
- package/package.json +12 -12
- package/dist/aggregate-DI9VS7yL.mjs.map +0 -1
- package/dist/aggregate-DKBycuzO.d.mts.map +0 -1
- package/dist/contract-snapshot-store-BqDMcO4r.d.mts +0 -27
- package/dist/contract-snapshot-store-BqDMcO4r.d.mts.map +0 -1
- package/dist/contract-snapshot-store-D-mFkiHR-CFl0ulR2.mjs.map +0 -1
- package/dist/db-verify-BdKY7U7l-6VLIVuKF.d.mts.map +0 -1
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +0 -1
- package/dist/hash-XZYYKJ-i.d.mts.map +0 -1
- package/dist/io-DSQXOfBH-GRpmFG2F.mjs.map +0 -1
- package/dist/io-DYfeLJxR.d.mts +0 -1
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +0 -1
- package/dist/ref-DlKsxbtg-B55l0TCq.mjs.map +0 -1
- package/dist/spaces-DzFtKEl3.mjs.map +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { t as MigrationMetadata$1 } from "./metadata-2nbOAGsV-uYNeq2Cp.mjs";
|
|
2
|
+
import { n as OnDiskMigrationPackage, t as MigrationOps } from "./package-CfWiDNrr-ZR4HM_Iz.mjs";
|
|
3
|
+
import { n as SnapshotContentVerifier } from "./contract-snapshot-store-Bok5nQYi-D3g_P7im.mjs";
|
|
4
|
+
import "./contract-snapshot-store-DrIwu5pn.mjs";
|
|
1
5
|
import { i as Refs, n as RefEntry } from "./refs-BNCUu58Y-BIso5Jfg.mjs";
|
|
2
6
|
import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
|
|
3
7
|
import { r as MigrationRef, t as ContractRef } from "./ref-resolution-CaHQJXE0.mjs";
|
|
4
|
-
import { A as RenderContractDtsFailure, C as EmitResult, D as IntrospectOptions, E as ExecuteDbVerifyResult, F as SchemaVerifyOptions, I as SignOptions, L as VerifyOptions, M as RenderContractDtsOptions, N as RenderContractDtsResult, P as RenderContractDtsSuccess, R as executeDbVerify, S as EmitOptions, T as ExecuteDbVerifyOptions, _ as DbUpdateResult, a as ControlClient, b as EmitFailure, c as CreateControlClient, d as DbInitOptions, f as DbInitResult, g as DbUpdateOptions, h as DbUpdateFailureCode, i as ControlActionName, j as RenderContractDtsFailureCode, k as OnControlProgress, l as DbInitFailure, m as DbUpdateFailure, n as ContractEmitOptions, o as ControlClientOptions, p as DbInitSuccess, r as ContractEmitResult, s as ControlProgressEvent, t as CliStructuredError$2, u as DbInitFailureCode, v as DbUpdateSuccess, w as EmitSuccess, x as EmitFailureCode, y as EmitContractConfig } from "./db-verify-
|
|
8
|
+
import { A as RenderContractDtsFailure, C as EmitResult, D as IntrospectOptions, E as ExecuteDbVerifyResult, F as SchemaVerifyOptions, I as SignOptions, L as VerifyOptions, M as RenderContractDtsOptions, N as RenderContractDtsResult, P as RenderContractDtsSuccess, R as executeDbVerify, S as EmitOptions, T as ExecuteDbVerifyOptions, _ as DbUpdateResult, a as ControlClient, b as EmitFailure, c as CreateControlClient, d as DbInitOptions, f as DbInitResult, g as DbUpdateOptions, h as DbUpdateFailureCode, i as ControlActionName, j as RenderContractDtsFailureCode, k as OnControlProgress, l as DbInitFailure, m as DbUpdateFailure, n as ContractEmitOptions, o as ControlClientOptions, p as DbInitSuccess, r as ContractEmitResult, s as ControlProgressEvent, t as CliStructuredError$2, u as DbInitFailureCode, v as DbUpdateSuccess, w as EmitSuccess, x as EmitFailureCode, y as EmitContractConfig } from "./db-verify-BkwsVjIf-CDWnVSjr.mjs";
|
|
5
9
|
import { a as emit } from "./index-DG1D9rrd.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { c as ContractSpaceAggregate, d as IntegrityQueryOptions, p as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-DKBycuzO.mjs";
|
|
10
|
+
import { c as ContractSpaceAggregate, d as IntegrityQueryOptions, p as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-BxeUZtei.mjs";
|
|
8
11
|
import { r as PrismaNextConfig$1 } from "./index-u5RdrumF.mjs";
|
|
9
|
-
import { t as MigrationMetadata$1 } from "./metadata-2nbOAGsV-uYNeq2Cp.mjs";
|
|
10
12
|
import "./metadata-BtscDay2.mjs";
|
|
11
13
|
import "./package-N9PPdFV_.mjs";
|
|
12
14
|
import { ControlAdapterInstance, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyInstance, ControlStack, OperationPreview, SignDatabaseResult, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
@@ -130,6 +132,12 @@ interface BuildAggregateInputs<TFamilyId extends string, TTargetId extends strin
|
|
|
130
132
|
readonly appContract: Contract;
|
|
131
133
|
readonly extensions: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
132
134
|
readonly deserializeContract: (contractJson: unknown) => Contract;
|
|
135
|
+
/**
|
|
136
|
+
* Content check for contract snapshots resolved through the aggregate;
|
|
137
|
+
* build it with `snapshotVerifierFor(config)` so the recompute uses the
|
|
138
|
+
* target's canonicalization hooks.
|
|
139
|
+
*/
|
|
140
|
+
readonly verifySnapshotContent?: SnapshotContentVerifier;
|
|
133
141
|
}
|
|
134
142
|
/**
|
|
135
143
|
* Reject extension descriptors whose configured target disagrees with
|
|
@@ -194,6 +202,8 @@ declare function loadContractRawSafely(config: {
|
|
|
194
202
|
*/
|
|
195
203
|
declare function buildReadAggregate(config: PrismaNextConfig, options: {
|
|
196
204
|
readonly migrationsDir: string;
|
|
205
|
+
/** Command-scoped verifier to share the verified-hash memo; defaults to one built from `config`. */
|
|
206
|
+
readonly verifySnapshotContent?: SnapshotContentVerifier;
|
|
197
207
|
}): Promise<Result<{
|
|
198
208
|
readonly aggregate: ContractSpaceAggregate;
|
|
199
209
|
readonly contractHash: string;
|
|
@@ -328,6 +338,8 @@ interface ExecuteDbInitOptions<TFamilyId extends string, TTargetId extends strin
|
|
|
328
338
|
* extension spaces in the aggregate.
|
|
329
339
|
*/
|
|
330
340
|
readonly extensions?: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
341
|
+
/** Content check for contract snapshots the aggregate loader resolves. */
|
|
342
|
+
readonly verifySnapshotContent?: SnapshotContentVerifier;
|
|
331
343
|
/** Optional progress callback for observing operation progress */
|
|
332
344
|
readonly onProgress?: OnControlProgress;
|
|
333
345
|
}
|
|
@@ -370,6 +382,8 @@ interface ExecuteDbUpdateOptions<TFamilyId extends string, TTargetId extends str
|
|
|
370
382
|
readonly migrationsDir: string;
|
|
371
383
|
readonly targetId: TTargetId;
|
|
372
384
|
readonly extensions?: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
385
|
+
/** Content check for contract snapshots the aggregate loader resolves. */
|
|
386
|
+
readonly verifySnapshotContent?: SnapshotContentVerifier;
|
|
373
387
|
readonly onProgress?: OnControlProgress;
|
|
374
388
|
}
|
|
375
389
|
/**
|
|
@@ -553,6 +567,12 @@ interface CheckSpace {
|
|
|
553
567
|
readonly projectMigrationsDir: string;
|
|
554
568
|
/** Directory the command was invoked from; every `where` path is relative to it. */
|
|
555
569
|
readonly cwd: string;
|
|
570
|
+
/**
|
|
571
|
+
* Content check for snapshot-store entries; when present,
|
|
572
|
+
* `checkSnapshotConsistency` recomputes each snapshot's storage hash and
|
|
573
|
+
* reports `MIGRATION.CHECK_SNAPSHOT_CONTENT_MISMATCH` on disagreement.
|
|
574
|
+
*/
|
|
575
|
+
readonly verifySnapshotContent?: SnapshotContentVerifier;
|
|
556
576
|
}
|
|
557
577
|
/**
|
|
558
578
|
* Project the loaded {@link ContractSpaceAggregate} into the
|
|
@@ -562,7 +582,7 @@ interface CheckSpace {
|
|
|
562
582
|
* membership matches the on-disk directories, package / ref / graph data come
|
|
563
583
|
* from `aggregate.space(id)`.
|
|
564
584
|
*/
|
|
565
|
-
declare function enumerateCheckSpaces(aggregate: ContractSpaceAggregate, projectMigrationsDir: string, cwd: string): Promise<readonly CheckSpace[]>;
|
|
585
|
+
declare function enumerateCheckSpaces(aggregate: ContractSpaceAggregate, projectMigrationsDir: string, cwd: string, verifySnapshotContent?: SnapshotContentVerifier): Promise<readonly CheckSpace[]>;
|
|
566
586
|
/**
|
|
567
587
|
* Inputs for {@link runMigrationCheck} — the multi-space policy core of
|
|
568
588
|
* the holistic (no-arg) `migration check`. Enumeration is supplied by the
|
|
@@ -586,7 +606,7 @@ interface RunMigrationCheckInputs {
|
|
|
586
606
|
* in by the caller, not here.
|
|
587
607
|
*/
|
|
588
608
|
declare function runMigrationCheck(inputs: RunMigrationCheckInputs): Promise<Result<MigrationCheckResult, CliStructuredError$2>>;
|
|
589
|
-
declare function loadAggregateIntegrityViolations(config: PrismaNextConfig$1, migrationsDir: string): Promise<readonly IntegrityViolation[]>;
|
|
609
|
+
declare function loadAggregateIntegrityViolations(config: PrismaNextConfig$1, migrationsDir: string, verifySnapshotContent?: SnapshotContentVerifier): Promise<readonly IntegrityViolation[]>;
|
|
590
610
|
interface MigrationCheckOutcome {
|
|
591
611
|
readonly result?: MigrationCheckResult;
|
|
592
612
|
readonly error?: CliStructuredError$2;
|
|
@@ -704,6 +724,25 @@ interface MigrationPlanOptions {
|
|
|
704
724
|
readonly to?: string;
|
|
705
725
|
/** Renders the declarations of the destination snapshot from its `contract.json`. */
|
|
706
726
|
readonly client: Pick<ControlClient, 'renderContractDts'>;
|
|
727
|
+
/**
|
|
728
|
+
* Consent to the auto-baseline plan a prior `MIGRATION.DESTRUCTIVE_CHANGES`
|
|
729
|
+
* refusal named by its `planHash`. The consented run recomputes the baseline
|
|
730
|
+
* plan and refuses with `MIGRATION.CONSENT_PLAN_MISMATCH` when it differs.
|
|
731
|
+
*/
|
|
732
|
+
readonly consent?: {
|
|
733
|
+
readonly planHash: string;
|
|
734
|
+
};
|
|
735
|
+
/**
|
|
736
|
+
* Extension-space migration packages a refused first run of this same
|
|
737
|
+
* invocation already materialised. The consented re-run finds them on disk
|
|
738
|
+
* (its seed phase reports `unchanged`), so the caller threads them back in
|
|
739
|
+
* to keep `emittedExtensionDirs` and the summary describing the whole
|
|
740
|
+
* invocation, not just the second run.
|
|
741
|
+
*/
|
|
742
|
+
readonly carryEmittedExtensionDirs?: readonly {
|
|
743
|
+
readonly spaceId: string;
|
|
744
|
+
readonly dirName: string;
|
|
745
|
+
}[];
|
|
707
746
|
}
|
|
708
747
|
interface MigrationPlanResult {
|
|
709
748
|
readonly ok: boolean;
|
|
@@ -733,6 +772,18 @@ interface MigrationPlanResult {
|
|
|
733
772
|
readonly label: string;
|
|
734
773
|
readonly operationClass: string;
|
|
735
774
|
}[];
|
|
775
|
+
/**
|
|
776
|
+
* Operations of the auto-baseline package when this run wrote two packages
|
|
777
|
+
* (`baselineDir` + `dir`). Kept separate from `operations` (the app-space
|
|
778
|
+
* delta) so consumers keep reading `operations` as "the change", while
|
|
779
|
+
* renderers and the destructive warn-summary still cover everything the
|
|
780
|
+
* run wrote.
|
|
781
|
+
*/
|
|
782
|
+
readonly baselineOperations?: readonly {
|
|
783
|
+
readonly id: string;
|
|
784
|
+
readonly label: string;
|
|
785
|
+
readonly operationClass: string;
|
|
786
|
+
}[];
|
|
736
787
|
/**
|
|
737
788
|
* Family-agnostic textual preview of the migration plan operations.
|
|
738
789
|
* Replaces the previous `sql?: readonly string[]` field; consumers should
|
|
@@ -740,6 +791,12 @@ interface MigrationPlanResult {
|
|
|
740
791
|
*/
|
|
741
792
|
readonly preview?: OperationPreview;
|
|
742
793
|
readonly summary: string;
|
|
794
|
+
/**
|
|
795
|
+
* Origin-resolution caveats the user must see, e.g. the default `db` ref
|
|
796
|
+
* sitting behind the graph tip. Rendered as warn summaries by the human
|
|
797
|
+
* presentation and carried verbatim for JSON consumers.
|
|
798
|
+
*/
|
|
799
|
+
readonly warnings?: readonly string[];
|
|
743
800
|
/**
|
|
744
801
|
* When true, `migration.ts` was written but contains unfilled
|
|
745
802
|
* `placeholder(...)` calls. The user must edit the file and then run
|
|
@@ -794,6 +851,16 @@ declare function appliedHashesFromLedger(ledgerEntries: ReadonlyArray<{
|
|
|
794
851
|
declare function statusForMigrationHash(migrationHash: string, annotations: ReadonlyMap<string, MigrationEdgeAnnotation>): 'applied' | 'pending' | null;
|
|
795
852
|
//#endregion
|
|
796
853
|
//#region src/control-api/operations/plan-resolution.d.ts
|
|
854
|
+
/**
|
|
855
|
+
* Set when the origin was derived from the `db` ref by default (no `--from`)
|
|
856
|
+
* and that ref sits on an in-graph node that is not the graph tip. Planning
|
|
857
|
+
* from it forks the graph, so the caller must surface it to the user.
|
|
858
|
+
*/
|
|
859
|
+
interface DefaultOriginBehindTip {
|
|
860
|
+
readonly refName: string;
|
|
861
|
+
readonly refHash: string;
|
|
862
|
+
readonly tipHash: string;
|
|
863
|
+
}
|
|
797
864
|
type FromResolution = {
|
|
798
865
|
kind: 'greenfield';
|
|
799
866
|
fromHash: null;
|
|
@@ -803,10 +870,12 @@ type FromResolution = {
|
|
|
803
870
|
kind: 'graph-node';
|
|
804
871
|
fromHash: string;
|
|
805
872
|
fromContract: Contract;
|
|
873
|
+
defaultOriginBehindTip?: DefaultOriginBehindTip;
|
|
806
874
|
} | {
|
|
807
875
|
kind: 'ref';
|
|
808
876
|
fromHash: string;
|
|
809
877
|
fromContract: Contract;
|
|
878
|
+
defaultOriginBehindTip?: DefaultOriginBehindTip;
|
|
810
879
|
} | {
|
|
811
880
|
kind: 'auto-baseline';
|
|
812
881
|
fromHash: 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":"
|
|
1
|
+
{"version":3,"file":"cli__control-api.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/exports/control-api.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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,qBAAqB;;;UAG9G;WACC;WACA;WACA;WACA;;UAED;WACC;WACA;WACA;;UAED;WACC;WACA,MAAM,eAAe;;UAEtB;WACC,QAAQ;;WAER;;WAEA;;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;;;iBAGzD,iBAAiB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as hasMigrationPath, At as runMigrationList, Ct as resolveContractRefToSnapshot, Et as resolveToForPlan, G as executeMigrateShowPlan, H as executeDbInit, J as executeRefAdvancement, K as executeMigrationNewCommand, Nt as statusForMigrationHash, Ot as runContractSpaceSeedPhase, St as resolveContractRef$1, Tt as resolveMigrationRef, U as executeDbUpdate, V as executeContractEmit, W as executeDbVerify, X as executeRefListCommand, Y as executeRefDeleteCommand, Z as executeRefSetCommand, _ as disposeEmitQueue, _t as refuseMissingInvariantPath, a as appContractStandInFromIdentity, at as mapCaughtMigrationError, c as buildMigrationSpaceGraphEntries, d as checkSingleTarget, dt as preflightRefAdvancement, et as listRefsByContractHash, g as deriveStatusEdgeAnnotations, gt as refuseMarkerOutsideGraph, h as createControlClient, ht as refuseDeclaredExtensionTargetMismatch, i as advanceRefSafely, kt as runMigrationCheck, l as buildReadAggregate, lt as migrationSpaceListEntriesFromAggregate, m as computeRefAdvancementName, mt as refuseContractSpaceIntegrity, nt as loadContractRawSafely, o as appliedHashesFromLedger, ot as mapContractAtError, pt as readMigrationRefs, q as executeMigrationPlanCommand, r as NO_REF_ADVANCEMENT, rt as loadContractSpaceAggregateForCli, s as buildContractSpaceAggregate, st as mapIntegrityViolations, tt as loadAggregateIntegrityViolations, u as buildRefAdvancementFields, ut as originHashForStatus, v as enrichContract, vt as refusePackageCorruptionOnAggregate, wt as resolveFromForPlan, y as enumerateCheckSpaces, yt as refuseUnknownInvariants } from "./ref-D5u8Xxwc-BjjqYtnQ.mjs";
|
|
2
2
|
export { NO_REF_ADVANCEMENT, advanceRefSafely, appContractStandInFromIdentity, appliedHashesFromLedger, buildContractSpaceAggregate, buildMigrationSpaceGraphEntries, buildReadAggregate, buildRefAdvancementFields, checkSingleTarget, computeRefAdvancementName, createControlClient, deriveStatusEdgeAnnotations, disposeEmitQueue, enrichContract, enumerateCheckSpaces, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify, executeMigrateShowPlan, executeMigrationNewCommand, executeMigrationPlanCommand, executeRefAdvancement, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand, hasMigrationPath, listRefsByContractHash, loadAggregateIntegrityViolations, loadContractRawSafely, loadContractSpaceAggregateForCli, mapCaughtMigrationError, mapContractAtError, mapIntegrityViolations, migrationSpaceListEntriesFromAggregate, originHashForStatus, preflightRefAdvancement, readMigrationRefs, refuseContractSpaceIntegrity, refuseDeclaredExtensionTargetMismatch, refuseMarkerOutsideGraph, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef$1 as resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as EmitResult, E as ExecuteDbVerifyResult, N as RenderContractDtsResult, O as MigrateResult, _ as DbUpdateResult, a as ControlClient, f as DbInitResult } from "./db-verify-
|
|
1
|
+
import { C as EmitResult, E as ExecuteDbVerifyResult, N as RenderContractDtsResult, O as MigrateResult, _ as DbUpdateResult, a as ControlClient, f as DbInitResult } from "./db-verify-BkwsVjIf-CDWnVSjr.mjs";
|
|
2
2
|
import { CoreSchemaView, OperationPreview, SignDatabaseResult, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
3
3
|
import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
4
4
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma/orm-framework/components/authoring";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as errorInvalidJson } from "./errors-BIroGS9E-Dg6CF-dm.mjs";
|
|
2
2
|
import { a as loadConfigForSections } from "./exports-DJ4RhlW4.mjs";
|
|
3
|
-
import { r as buildMigrationArtifacts } from "./migration-
|
|
3
|
+
import { r as buildMigrationArtifacts } from "./migration-D95UJ0Dj.mjs";
|
|
4
4
|
import { readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { CliStructuredError, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from "@prisma/orm-framework/errors/control";
|
|
6
6
|
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { t as SnapshotCanonicalizationHooks } from "./hash-DclMqd7S-WBvXJ_4C.mjs";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-Bok5nQYi.d.mts
|
|
3
|
+
//#region src/contract-snapshot-store.d.ts
|
|
4
|
+
declare function contractSnapshotDir(migrationsDir: string, storageHash: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Recompute-and-compare integrity check for loaded contract snapshots,
|
|
7
|
+
* mirroring `verifyMigrationHash` for migration packages and
|
|
8
|
+
* `assertDescriptorSelfConsistency` for extension descriptors: the store is
|
|
9
|
+
* content-addressed, so the JSON read back for a hash must reproduce that
|
|
10
|
+
* hash. Every assertion recomputes — nothing is cached, so mutated or
|
|
11
|
+
* re-read content is always re-verified; repeated resolutions of the same
|
|
12
|
+
* snapshot are already deduplicated by the aggregate's result memo, so each
|
|
13
|
+
* file read is hashed once in practice. The recompute is coupled to
|
|
14
|
+
* the emit-time canonicalization: a release that changes the family hooks
|
|
15
|
+
* or hash canonicalization rules must regenerate (or migrate) existing
|
|
16
|
+
* snapshot stores, or every pre-existing snapshot reads as tampered.
|
|
17
|
+
*/
|
|
18
|
+
interface SnapshotContentVerifier {
|
|
19
|
+
/**
|
|
20
|
+
* Throws `MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH` when
|
|
21
|
+
* `contractJson`'s content does not recompute to `storageHash` — the hash
|
|
22
|
+
* the snapshot at `jsonPath` was addressed by.
|
|
23
|
+
*/
|
|
24
|
+
assertSnapshotContentMatches(contractJson: unknown, storageHash: string, jsonPath: string): void;
|
|
25
|
+
}
|
|
26
|
+
declare function createSnapshotContentVerifier(hooks?: SnapshotCanonicalizationHooks): SnapshotContentVerifier;
|
|
27
|
+
interface ContractSnapshotInput {
|
|
28
|
+
readonly contractJson: unknown;
|
|
29
|
+
readonly contractDts: string;
|
|
30
|
+
}
|
|
31
|
+
declare function writeContractSnapshot(migrationsDir: string, storageHash: string, input: ContractSnapshotInput): Promise<{
|
|
32
|
+
readonly written: boolean;
|
|
33
|
+
readonly dir: string;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* When `verifyContent` is supplied, the parsed snapshot's content is checked
|
|
37
|
+
* against the hash it was addressed by before being returned — the store is
|
|
38
|
+
* content-addressed, and a snapshot edited in place under an unchanged hash
|
|
39
|
+
* would otherwise flow into planning as if it were the recorded contract.
|
|
40
|
+
*/
|
|
41
|
+
declare function readContractSnapshotJson(migrationsDir: string, storageHash: string, verifyContent?: SnapshotContentVerifier): Promise<unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* Tolerant read: a missing store entry (ENOENT), an unparseable
|
|
44
|
+
* `contract.json`, the JSON literal `null`, or a `storageHash` that isn't a
|
|
45
|
+
* well-formed 64-hex value all resolve to `undefined` rather than
|
|
46
|
+
* throwing — parity with the catch-all tolerance of the pre-store
|
|
47
|
+
* `readEndContractJson` (`io.ts`), which never validated the hash it was
|
|
48
|
+
* keyed by either. Any other fs error (e.g. `EACCES` on a present-but-
|
|
49
|
+
* unreadable file) propagates rather than silently loading a contract-less
|
|
50
|
+
* package. When `verifyContent` is supplied, an entry whose content does not
|
|
51
|
+
* recompute to its address also resolves to `undefined` — tampered content
|
|
52
|
+
* must not flow onward, and the strict store reads report the same file
|
|
53
|
+
* loudly as `MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH`.
|
|
54
|
+
*/
|
|
55
|
+
declare function readContractSnapshotJsonTolerant(migrationsDir: string, storageHash: string, verifyContent?: SnapshotContentVerifier): Promise<unknown | undefined>;
|
|
56
|
+
declare function snapshotsImportPathFrom(packageDir: string, migrationsDir: string): string;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { readContractSnapshotJson as a, writeContractSnapshot as c, createSnapshotContentVerifier as i, SnapshotContentVerifier as n, readContractSnapshotJsonTolerant as o, contractSnapshotDir as r, snapshotsImportPathFrom as s, ContractSnapshotInput as t };
|
|
59
|
+
//# sourceMappingURL=contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-Bok5nQYi.d.mts"],"mappings":";;;iBAEiB,oBAAoB,uBAAuB;;;;;;;;;;;;;;UAclD;;;;;;EAMR,6BAA6B,uBAAuB,qBAAqB;;iBAE1D,8BAA8B,QAAQ,gCAAgC;UAC7E;WACC;WACA;;iBAEM,sBAAsB,uBAAuB,qBAAqB,OAAO,wBAAwB;WACvG;WACA;;;;;;;;iBAQM,yBAAyB,uBAAuB,qBAAqB,gBAAgB,0BAA0B;;;;;;;;;;;;;;iBAc/G,iCAAiC,uBAAuB,qBAAqB,gBAAgB,0BAA0B;iBACvH,wBAAwB,oBAAoB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as errorInvalidJson, a as errorContractSnapshotContentMismatch, o as errorContractSnapshotHashMismatch, s as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-BIroGS9E-Dg6CF-dm.mjs";
|
|
2
|
+
import { n as recomputePublishedStorageHash } from "./hash-BAZVWU4a-BdynTmar.mjs";
|
|
2
3
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
3
4
|
import { CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex } from "@prisma/orm-framework/components/control";
|
|
4
5
|
import { join, relative } from "pathe";
|
|
5
|
-
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 { mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
9
|
+
//#region ../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-CM9ubenX.mjs
|
|
9
10
|
const CONTRACT_JSON_FILE = "contract.json";
|
|
10
11
|
const CONTRACT_DTS_FILE = "contract.d.ts";
|
|
11
12
|
function hasErrnoCode(error, code) {
|
|
@@ -22,6 +23,22 @@ async function directoryExists(p) {
|
|
|
22
23
|
function contractSnapshotDir(migrationsDir, storageHash) {
|
|
23
24
|
return join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME, storageHashHex(storageHash));
|
|
24
25
|
}
|
|
26
|
+
function createSnapshotContentVerifier(hooks) {
|
|
27
|
+
return { assertSnapshotContentMatches(contractJson, storageHash, jsonPath) {
|
|
28
|
+
const record = blindCast(contractJson ?? {});
|
|
29
|
+
const computedHash = recomputePublishedStorageHash({
|
|
30
|
+
target: record.target,
|
|
31
|
+
targetFamily: record.targetFamily,
|
|
32
|
+
storage: record.storage,
|
|
33
|
+
hooks
|
|
34
|
+
});
|
|
35
|
+
if (computedHash !== storageHash) throw errorContractSnapshotContentMismatch({
|
|
36
|
+
storageHash,
|
|
37
|
+
computedHash,
|
|
38
|
+
jsonPath
|
|
39
|
+
});
|
|
40
|
+
} };
|
|
41
|
+
}
|
|
25
42
|
async function writeContractSnapshot(migrationsDir, storageHash, input) {
|
|
26
43
|
const dir = contractSnapshotDir(migrationsDir, storageHash);
|
|
27
44
|
const actualStorageHash = blindCast(input.contractJson).storage?.storageHash;
|
|
@@ -54,7 +71,13 @@ async function writeContractSnapshot(migrationsDir, storageHash, input) {
|
|
|
54
71
|
dir
|
|
55
72
|
};
|
|
56
73
|
}
|
|
57
|
-
|
|
74
|
+
/**
|
|
75
|
+
* When `verifyContent` is supplied, the parsed snapshot's content is checked
|
|
76
|
+
* against the hash it was addressed by before being returned — the store is
|
|
77
|
+
* content-addressed, and a snapshot edited in place under an unchanged hash
|
|
78
|
+
* would otherwise flow into planning as if it were the recorded contract.
|
|
79
|
+
*/
|
|
80
|
+
async function readContractSnapshotJson(migrationsDir, storageHash, verifyContent) {
|
|
58
81
|
const jsonPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_JSON_FILE);
|
|
59
82
|
let raw;
|
|
60
83
|
try {
|
|
@@ -63,11 +86,14 @@ async function readContractSnapshotJson(migrationsDir, storageHash) {
|
|
|
63
86
|
if (hasErrnoCode(error, "ENOENT")) throw errorContractSnapshotMissing(storageHash, jsonPath);
|
|
64
87
|
throw error;
|
|
65
88
|
}
|
|
89
|
+
let parsed;
|
|
66
90
|
try {
|
|
67
|
-
|
|
91
|
+
parsed = JSON.parse(raw);
|
|
68
92
|
} catch (e) {
|
|
69
93
|
throw errorInvalidJson(jsonPath, e instanceof Error ? e.message : String(e));
|
|
70
94
|
}
|
|
95
|
+
verifyContent?.assertSnapshotContentMatches(parsed, storageHash, jsonPath);
|
|
96
|
+
return parsed;
|
|
71
97
|
}
|
|
72
98
|
/**
|
|
73
99
|
* Tolerant read: a missing store entry (ENOENT), an unparseable
|
|
@@ -77,9 +103,12 @@ async function readContractSnapshotJson(migrationsDir, storageHash) {
|
|
|
77
103
|
* `readEndContractJson` (`io.ts`), which never validated the hash it was
|
|
78
104
|
* keyed by either. Any other fs error (e.g. `EACCES` on a present-but-
|
|
79
105
|
* unreadable file) propagates rather than silently loading a contract-less
|
|
80
|
-
* package.
|
|
106
|
+
* package. When `verifyContent` is supplied, an entry whose content does not
|
|
107
|
+
* recompute to its address also resolves to `undefined` — tampered content
|
|
108
|
+
* must not flow onward, and the strict store reads report the same file
|
|
109
|
+
* loudly as `MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH`.
|
|
81
110
|
*/
|
|
82
|
-
async function readContractSnapshotJsonTolerant(migrationsDir, storageHash) {
|
|
111
|
+
async function readContractSnapshotJsonTolerant(migrationsDir, storageHash, verifyContent) {
|
|
83
112
|
let jsonPath;
|
|
84
113
|
try {
|
|
85
114
|
jsonPath = join(contractSnapshotDir(migrationsDir, storageHash), CONTRACT_JSON_FILE);
|
|
@@ -93,17 +122,25 @@ async function readContractSnapshotJsonTolerant(migrationsDir, storageHash) {
|
|
|
93
122
|
if (hasErrnoCode(error, "ENOENT")) return;
|
|
94
123
|
throw error;
|
|
95
124
|
}
|
|
125
|
+
let parsed;
|
|
96
126
|
try {
|
|
97
|
-
|
|
98
|
-
return parsed === null ? void 0 : parsed;
|
|
127
|
+
parsed = JSON.parse(raw);
|
|
99
128
|
} catch {
|
|
100
129
|
return;
|
|
101
130
|
}
|
|
131
|
+
if (parsed === null) return;
|
|
132
|
+
try {
|
|
133
|
+
verifyContent?.assertSnapshotContentMatches(parsed, storageHash, jsonPath);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (MigrationToolsError.is(error) && error.code === "MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH") return;
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
return parsed;
|
|
102
139
|
}
|
|
103
140
|
function snapshotsImportPathFrom(packageDir, migrationsDir) {
|
|
104
141
|
return relative(packageDir, join(migrationsDir, CONTRACT_SNAPSHOTS_DIRNAME)).split("\\").join("/");
|
|
105
142
|
}
|
|
106
143
|
//#endregion
|
|
107
|
-
export {
|
|
144
|
+
export { snapshotsImportPathFrom as a, readContractSnapshotJsonTolerant as i, createSnapshotContentVerifier as n, writeContractSnapshot as o, readContractSnapshotJson as r, contractSnapshotDir as t };
|
|
108
145
|
|
|
109
|
-
//# sourceMappingURL=contract-snapshot-store-
|
|
146
|
+
//# sourceMappingURL=contract-snapshot-store-CM9ubenX-o8kTVHxP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-snapshot-store-CM9ubenX-o8kTVHxP.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/contract-snapshot-store-CM9ubenX.mjs"],"sourcesContent":["import { _ as errorInvalidJson, a as errorContractSnapshotContentMismatch, o as errorContractSnapshotHashMismatch, s as errorContractSnapshotMissing, t as MigrationToolsError } from \"./errors-BIroGS9E.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-CM9ubenX.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,gBA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BAAoB,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,3 +1,5 @@
|
|
|
1
|
+
import { n as SnapshotContentVerifier } from "./contract-snapshot-store-Bok5nQYi-D3g_P7im.mjs";
|
|
2
|
+
import "./contract-snapshot-store-DrIwu5pn.mjs";
|
|
1
3
|
import "./ref-resolution-CaHQJXE0.mjs";
|
|
2
4
|
import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
|
|
3
5
|
import { CliStructuredError as CliStructuredError$2 } from "@prisma/orm-framework/errors/control";
|
|
@@ -11,7 +13,7 @@ import "@prisma/cli-engine/protocol";
|
|
|
11
13
|
import { ContractSourceDiagnostics, ContractSourceProvider, PrismaNextConfig } from "@prisma/orm-framework/config/config-types";
|
|
12
14
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma/orm-framework/components/authoring";
|
|
13
15
|
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
14
|
-
//#region ../../../1-framework/3-tooling/cli/dist/db-verify-
|
|
16
|
+
//#region ../../../1-framework/3-tooling/cli/dist/db-verify-BkwsVjIf.d.mts
|
|
15
17
|
//#region src/control-api/render-contract-dts.d.ts
|
|
16
18
|
/**
|
|
17
19
|
* Options for rendering the `contract.d.ts` text of an already-emitted
|
|
@@ -945,6 +947,8 @@ interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends str
|
|
|
945
947
|
readonly mode: 'strict' | 'lenient';
|
|
946
948
|
readonly skipSchema: boolean;
|
|
947
949
|
readonly skipMarker: boolean;
|
|
950
|
+
/** Content check for contract snapshots the aggregate loader resolves. */
|
|
951
|
+
readonly verifySnapshotContent?: SnapshotContentVerifier;
|
|
948
952
|
readonly onProgress?: OnControlProgress;
|
|
949
953
|
}
|
|
950
954
|
/**
|
|
@@ -998,4 +1002,4 @@ type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError$2
|
|
|
998
1002
|
declare function executeDbVerify<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbVerifyOptions<TFamilyId, TTargetId>): Promise<ExecuteDbVerifyResult>;
|
|
999
1003
|
//#endregion
|
|
1000
1004
|
export { RenderContractDtsFailure as A, EmitResult as C, IntrospectOptions as D, ExecuteDbVerifyResult as E, SchemaVerifyOptions as F, SignOptions as I, VerifyOptions as L, RenderContractDtsOptions as M, RenderContractDtsResult as N, MigrateResult as O, RenderContractDtsSuccess as P, executeDbVerify as R, EmitOptions as S, ExecuteDbVerifyOptions as T, DbUpdateResult as _, ControlClient as a, EmitFailure as b, CreateControlClient as c, DbInitOptions as d, DbInitResult as f, DbUpdateOptions as g, DbUpdateFailureCode as h, ControlActionName as i, RenderContractDtsFailureCode as j, OnControlProgress as k, DbInitFailure as l, DbUpdateFailure as m, ContractEmitOptions as n, ControlClientOptions as o, DbInitSuccess as p, ContractEmitResult as r, ControlProgressEvent as s, CliStructuredError$2 as t, DbInitFailureCode as u, DbUpdateSuccess as v, EmitSuccess as w, EmitFailureCode as x, EmitContractConfig as y };
|
|
1001
|
-
//# sourceMappingURL=db-verify-
|
|
1005
|
+
//# sourceMappingURL=db-verify-BkwsVjIf-CDWnVSjr.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-verify-BkwsVjIf-CDWnVSjr.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/db-verify-BkwsVjIf.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAoBU;;WAEC;;;;;;WAMA,yBAAyB;;UAE1B;;WAEC;;KAEN;UACK;WACC,MAAM;WACN;WACA;;WAEA;;KAEN,0BAA0B,OAAO,0BAA0B;;;;;;;;;;;;;;UActD;WACC,QAAQ;WACR,QAAQ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;;;EASpD,KAAK,SAAS,cAAc,QAAQ;;;;;;;;;EASpC,OAAO,SAAS,gBAAgB,QAAQ;;;;;;;;;;EAUxC,SAAS,SAAS,kBAAkB,QAAQ;;;;;;;;;;;;;;EAc5C,SAAS,SAAS,kBAAkB,QAAQ;;;;;;;EAO5C,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;;;;;;;;;;;;;UAatD,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"}
|
|
@@ -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-
|
|
4
|
+
//#region ../../../1-framework/3-tooling/migration/dist/errors-BIroGS9E.mjs
|
|
5
5
|
/**
|
|
6
6
|
* Build the canonical "re-emit this package" remediation hint.
|
|
7
7
|
*
|
|
@@ -402,6 +402,18 @@ function errorContractSnapshotHashMismatch(storageHash, actualHash, dir) {
|
|
|
402
402
|
}
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
|
+
function errorContractSnapshotContentMismatch(args) {
|
|
406
|
+
const { storageHash, computedHash, jsonPath } = args;
|
|
407
|
+
return new MigrationToolsError("MIGRATION.CONTRACT_SNAPSHOT_CONTENT_MISMATCH", "Contract snapshot content does not match its hash", {
|
|
408
|
+
why: `The contract snapshot at "${jsonPath}" is addressed by storage hash ${storageHash}, but its content recomputes to ${computedHash}. The file has been edited (or corrupted) since it was written.`,
|
|
409
|
+
fix: "Restore migrations/snapshots/ from version control, or re-run the command that authored the migration referencing this hash to regenerate the snapshot.",
|
|
410
|
+
meta: {
|
|
411
|
+
storageHash,
|
|
412
|
+
computedHash,
|
|
413
|
+
jsonPath
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
405
417
|
function errorMigrationContractViewMissing(className, accessor, jsonField) {
|
|
406
418
|
return new MigrationToolsError("MIGRATION.CONTRACT_VIEW_MISSING", `${className}.${accessor} requires ${jsonField}`, {
|
|
407
419
|
why: `${className}.${accessor} was read, but this instance has no ${jsonField} to build the view from.`,
|
|
@@ -414,6 +426,6 @@ function errorMigrationContractViewMissing(className, accessor, jsonField) {
|
|
|
414
426
|
});
|
|
415
427
|
}
|
|
416
428
|
//#endregion
|
|
417
|
-
export {
|
|
429
|
+
export { errorNoTarget as A, errorInvalidSlug as C, errorMissingFile as D, errorMigrationHashMismatch as E, errorUnknownInvariant as F, errorProvidedInvariantsMismatch as M, errorRefNotResolvable as N, errorNoInitialMigration as O, errorSpaceHeadRefMissing as P, errorInvalidRefValue as S, errorMigrationContractViewMissing as T, errorInvalidJson as _, errorContractSnapshotContentMismatch as a, errorInvalidRefFile as b, errorDescribeInvalidMetadata as c, errorDirectoryExists as d, errorDuplicateInvariantInEdge as f, errorInvalidInvariantId as g, errorInvalidDestName as h, errorContractDeserializationFailed as i, errorOperationsNotArray as j, errorNoInvariantPath as k, errorDescribeMissingEndContract as l, errorHashNotInGraph as m, errorAmbiguousTarget as n, errorContractSnapshotHashMismatch as o, errorDuplicateSpaceId as p, errorBundleNotFoundForGraphNode as r, errorContractSnapshotMissing as s, MigrationToolsError as t, errorDescriptorHeadHashMismatch as u, errorInvalidManifest as v, errorInvalidSpaceId as w, errorInvalidRefName as x, errorInvalidOperationEntry as y };
|
|
418
430
|
|
|
419
|
-
//# sourceMappingURL=errors-
|
|
431
|
+
//# sourceMappingURL=errors-BIroGS9E-Dg6CF-dm.mjs.map
|