@prisma/orm-toolchain 8.0.0-rc.24-dev.28 → 8.0.0-rc.24-dev.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/dist/{aggregate-CRIdmKmq.mjs → aggregate-7sB4u_aJ.mjs} +11 -5
- package/dist/aggregate-7sB4u_aJ.mjs.map +1 -0
- package/dist/{aggregate-C6PGBKyb.d.mts → aggregate-DgWdbWNs.d.mts} +12 -6
- package/dist/{aggregate-C6PGBKyb.d.mts.map → aggregate-DgWdbWNs.d.mts.map} +1 -1
- package/dist/{caught-errors-I1l50iPc-D_-F2M3t.mjs → caught-errors-D_pbHqmS-B-4jRN6g.mjs} +52 -11
- package/dist/caught-errors-D_pbHqmS-B-4jRN6g.mjs.map +1 -0
- package/dist/cli-telemetry.mjs +1 -1
- package/dist/cli.d.mts +2 -2
- package/dist/cli.mjs +1094 -1012
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +16 -14
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +2 -2
- package/dist/cli__control-api__testing.d.mts +1 -1
- package/dist/cli__init-contribution.d.mts +101 -0
- package/dist/cli__init-contribution.d.mts.map +1 -0
- package/dist/cli__init-contribution.mjs +1 -0
- package/dist/cli__init-output.d.mts +3 -3
- package/dist/cli__init-output.mjs +1 -1
- package/dist/cli__migration-cli.mjs +3 -3
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/config-loader.d.mts +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{db-sign-Bv-FZMAD-uQhMNCC7.d.mts → db-sign-DLIR5swa-DQ0aN1nU.d.mts} +25 -21
- package/dist/db-sign-DLIR5swa-DQ0aN1nU.d.mts.map +1 -0
- package/dist/{domain-type-generation-BlYB8GiS-k0HNTf4f.mjs → domain-type-generation-BGcbGgHJ-Cdw5RNaZ.mjs} +11 -12
- package/dist/domain-type-generation-BGcbGgHJ-Cdw5RNaZ.mjs.map +1 -0
- package/dist/{domain-type-generation-D5cG6TGd-DKLpO6ZA.d.mts → domain-type-generation-BP8J5hy8-CxSjSRCh.d.mts} +6 -5
- package/dist/domain-type-generation-BP8J5hy8-CxSjSRCh.d.mts.map +1 -0
- package/dist/emitter.d.mts +3 -3
- package/dist/emitter.mjs +3 -3
- package/dist/emitter__domain-type-generation.d.mts +2 -2
- package/dist/emitter__domain-type-generation.mjs +2 -2
- package/dist/{exports-RTLU0w9r.mjs → exports-BiXPktAF.mjs} +4 -4
- package/dist/{exports-RTLU0w9r.mjs.map → exports-BiXPktAF.mjs.map} +1 -1
- package/dist/{exports-CVgs3YWV-BF4rqnxF.mjs → exports-CCuYD8dO-yw1GizAT.mjs} +28 -18
- package/dist/exports-CCuYD8dO-yw1GizAT.mjs.map +1 -0
- package/dist/{exports-CSVHjfwG.mjs → exports-CZ6dPu-O.mjs} +35 -10
- package/dist/exports-CZ6dPu-O.mjs.map +1 -0
- package/dist/{index-BHYAWGxJ.d.mts → index-C09OeJjf.d.mts} +7 -12
- package/dist/index-C09OeJjf.d.mts.map +1 -0
- package/dist/{index-BhNbc269.d.mts → index-C3KtOcBP.d.mts} +3 -1
- package/dist/index-C3KtOcBP.d.mts.map +1 -0
- package/dist/migration-tools.d.mts +1 -1
- package/dist/migration-tools.mjs +3 -3
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/{output-BcC8eB0h-C5bRd-aC.mjs → output-E6F4-EMc-CqlzGlv-.mjs} +50 -9
- package/dist/output-E6F4-EMc-CqlzGlv-.mjs.map +1 -0
- package/dist/{ref-DfuqRCA7-CPPoVHY9.mjs → ref-PQOM_LTC-lyfzb0MO.mjs} +535 -270
- package/dist/ref-PQOM_LTC-lyfzb0MO.mjs.map +1 -0
- package/dist/{ref-resolution-C9j2SSb6.mjs → ref-resolution-C0xsiRig.mjs} +2 -2
- package/dist/{ref-resolution-C9j2SSb6.mjs.map → ref-resolution-C0xsiRig.mjs.map} +1 -1
- package/dist/{refs-t_JbIjGo-CRpBRRkq.mjs → refs-t_JbIjGo-BVCqKpXd.mjs} +2 -2
- package/dist/{refs-t_JbIjGo-CRpBRRkq.mjs.map → refs-t_JbIjGo-BVCqKpXd.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +4 -5
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +19 -22
- package/dist/aggregate-CRIdmKmq.mjs.map +0 -1
- package/dist/caught-errors-I1l50iPc-D_-F2M3t.mjs.map +0 -1
- package/dist/db-sign-Bv-FZMAD-uQhMNCC7.d.mts.map +0 -1
- package/dist/domain-type-generation-BlYB8GiS-k0HNTf4f.mjs.map +0 -1
- package/dist/domain-type-generation-D5cG6TGd-DKLpO6ZA.d.mts.map +0 -1
- package/dist/exports-CSVHjfwG.mjs.map +0 -1
- package/dist/exports-CVgs3YWV-BF4rqnxF.mjs.map +0 -1
- package/dist/import-roots-DlSoi7oS.d.mts +0 -119
- package/dist/import-roots-DlSoi7oS.d.mts.map +0 -1
- package/dist/import-roots-Dqs1_cn4.mjs +0 -224
- package/dist/import-roots-Dqs1_cn4.mjs.map +0 -1
- package/dist/index-BHYAWGxJ.d.mts.map +0 -1
- package/dist/index-BhNbc269.d.mts.map +0 -1
- package/dist/output-BcC8eB0h-C5bRd-aC.mjs.map +0 -1
- package/dist/publish-surface.d.mts +0 -3
- package/dist/publish-surface.mjs +0 -3
- package/dist/publish-surface__import-roots.d.mts +0 -2
- package/dist/publish-surface__import-roots.mjs +0 -2
- package/dist/publish-surface__shells.d.mts +0 -2
- package/dist/publish-surface__shells.mjs +0 -2
- package/dist/quick-reference-mongo.md +0 -116
- package/dist/quick-reference-postgres.md +0 -95
- package/dist/quick-reference-prisma7.md +0 -80
- package/dist/readme-mongo.md +0 -35
- package/dist/readme-postgres.md +0 -34
- package/dist/ref-DfuqRCA7-CPPoVHY9.mjs.map +0 -1
- package/dist/shells-BA7YJyPT.mjs +0 -777
- package/dist/shells-BA7YJyPT.mjs.map +0 -1
- package/dist/shells-D7NNxMLT.d.mts +0 -129
- package/dist/shells-D7NNxMLT.d.mts.map +0 -1
|
@@ -6,17 +6,17 @@ import { a as Refs, n as NamedRef, r as RefEntry } from "./refs-CkGjbosE-CLkrSkQ
|
|
|
6
6
|
import "./refs-B5N_vHH7.mjs";
|
|
7
7
|
import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
|
|
8
8
|
import { a as MigrationRef, t as ContractRef } from "./ref-resolution-UwnXbc9M.mjs";
|
|
9
|
-
import { A as ExecuteDbSignOptions, B as PlannerWarningsListener, C as DbUpdateSuccess, D as EmitOptions, E as EmitFailureCode, G as RenderContractDtsSuccess, H as RenderContractDtsFailureCode, I as OnControlProgress, J as StatementVerb, K as SchemaVerifyOptions, L as PlanAnswer, M as ExecuteDbVerifyOptions, N as ExecuteDbVerifyResult, O as EmitResult, P as IntrospectOptions, Q as executeDbVerify, R as PlanQuestion, S as DbUpdateResult, T as EmitFailure, U as RenderContractDtsOptions, V as RenderContractDtsFailure, W as RenderContractDtsResult, X as VerifyOptions, Y as TemporaryValueReport, Z as executeDbSign, _ as DbInitSuccess, a as ChangedStorageEntity, b as DbSignSpaceOutcome, c as ContractEmitOptions, d as ControlClient, f as ControlClientOptions, g as DbInitResult, h as DbInitOptions, i as AskedSubject, j as ExecuteDbSignResult, k as EmitSuccess, l as ContractEmitResult, m as CreateControlClient, n as AppliedStatementReport, o as CliInvocation, p as ControlProgressEvent, q as StatementText, r as AskedDataLoss, s as CliStructuredError$2, t as AnswerPlanQuestions, u as ControlActionName, v as DbSignOptions, w as EmitContractConfig, x as DbUpdateOptions, y as DbSignSpaceFailure, z as PlanQuestionVerb } from "./db-sign-
|
|
10
|
-
import { s as PrismaConfig$1 } from "./index-
|
|
11
|
-
import { a as emit } from "./index-
|
|
12
|
-
import { f as IntegrityQueryOptions, l as ContractSpaceAggregate, m as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-
|
|
9
|
+
import { A as ExecuteDbSignOptions, B as PlannerWarningsListener, C as DbUpdateSuccess, D as EmitOptions, E as EmitFailureCode, G as RenderContractDtsSuccess, H as RenderContractDtsFailureCode, I as OnControlProgress, J as StatementVerb, K as SchemaVerifyOptions, L as PlanAnswer, M as ExecuteDbVerifyOptions, N as ExecuteDbVerifyResult, O as EmitResult, P as IntrospectOptions, Q as executeDbVerify, R as PlanQuestion, S as DbUpdateResult, T as EmitFailure, U as RenderContractDtsOptions, V as RenderContractDtsFailure, W as RenderContractDtsResult, X as VerifyOptions, Y as TemporaryValueReport, Z as executeDbSign, _ as DbInitSuccess, a as ChangedStorageEntity, b as DbSignSpaceOutcome, c as ContractEmitOptions, d as ControlClient, f as ControlClientOptions, g as DbInitResult, h as DbInitOptions, i as AskedSubject, j as ExecuteDbSignResult, k as EmitSuccess, l as ContractEmitResult, m as CreateControlClient, n as AppliedStatementReport, o as CliInvocation, p as ControlProgressEvent, q as StatementText, r as AskedDataLoss, s as CliStructuredError$2, t as AnswerPlanQuestions, u as ControlActionName, v as DbSignOptions, w as EmitContractConfig, x as DbUpdateOptions, y as DbSignSpaceFailure, z as PlanQuestionVerb } from "./db-sign-DLIR5swa-DQ0aN1nU.mjs";
|
|
10
|
+
import { s as PrismaConfig$1 } from "./index-C3KtOcBP.mjs";
|
|
11
|
+
import { a as emit } from "./index-C09OeJjf.mjs";
|
|
12
|
+
import { f as IntegrityQueryOptions, l as ContractSpaceAggregate, m as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-DgWdbWNs.mjs";
|
|
13
13
|
import "./metadata-BtscDay2.mjs";
|
|
14
14
|
import "./package-N9PPdFV_.mjs";
|
|
15
15
|
import { CliStructuredError } from "@prisma/orm-framework/errors/control";
|
|
16
|
-
import { ControlAdapterInstance, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyInstance, ControlStack, DeclaredDatabasePolicies, MigrationOperationSubject, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, MigrationSubject, OperationPreview, ResolvedMigrationStatement, ResolvedMigrationStatement as ResolvedMigrationStatement$1, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
16
|
+
import { ControlAdapterInstance, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyInstance, ControlStack, DeclaredDatabasePolicies, MigrationAccessChange, MigrationOperationSubject, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, MigrationSubject, OperationPreview, ResolvedMigrationStatement, ResolvedMigrationStatement as ResolvedMigrationStatement$1, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
17
|
+
import { Result } from "@prisma/orm-framework/utils/result";
|
|
17
18
|
import "@prisma/orm-framework/utils/structured-error";
|
|
18
19
|
import { Contract, ContractWithDomain } from "@prisma/orm-framework/contract/types";
|
|
19
|
-
import { Result } from "@prisma/orm-framework/utils/result";
|
|
20
20
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
21
21
|
import { ContractSourceDiagnostic, PrismaConfig } from "@prisma/orm-framework/config/config-types";
|
|
22
22
|
//#region ../../../1-framework/3-tooling/cli/dist/exports/control-api.d.mts
|
|
@@ -199,6 +199,7 @@ declare function buildReadAggregate(config: PrismaConfig, options: {
|
|
|
199
199
|
readonly aggregate: ContractSpaceAggregate;
|
|
200
200
|
readonly contractHash: string;
|
|
201
201
|
readonly storageNameOf: (operation: MigrationPlanOperation) => string;
|
|
202
|
+
readonly accessChangesOf: (operations: readonly MigrationPlanOperation[]) => readonly MigrationAccessChange[];
|
|
202
203
|
/** Where the family keeps its markers, which an unreadable marker's error names. */
|
|
203
204
|
readonly markerLocation: string;
|
|
204
205
|
}, CliStructuredError$2>>;
|
|
@@ -719,8 +720,6 @@ interface MigrationNewOptions {
|
|
|
719
720
|
readonly config: PrismaConfig;
|
|
720
721
|
/** Directory the command was invoked from. */
|
|
721
722
|
readonly cwd: string;
|
|
722
|
-
/** The project's directory, normally the validated config's `baseDir`; locates the project manifest. */
|
|
723
|
-
readonly projectDir?: string;
|
|
724
723
|
readonly name?: string;
|
|
725
724
|
readonly from?: string;
|
|
726
725
|
/** Renders the declarations of the destination snapshot from its `contract.json`. */
|
|
@@ -740,8 +739,6 @@ interface MigrationPlanOptions {
|
|
|
740
739
|
readonly config: PrismaConfig;
|
|
741
740
|
/** Directory the command was invoked from. */
|
|
742
741
|
readonly cwd: string;
|
|
743
|
-
/** The project's directory, normally the validated config's `baseDir`; locates the project manifest. */
|
|
744
|
-
readonly projectDir?: string;
|
|
745
742
|
/** The `--config` the command was given, repeated in the command that runs a written `migration.ts`. */
|
|
746
743
|
readonly configPath?: string;
|
|
747
744
|
readonly name?: string;
|
|
@@ -926,6 +923,8 @@ interface ResolveToForPlanInput {
|
|
|
926
923
|
interface ResolvedContractRef {
|
|
927
924
|
readonly hash: string;
|
|
928
925
|
readonly contract: Contract;
|
|
926
|
+
/** The ref `--to` named, with the policies it declares; `undefined` when `--to` named no ref. */
|
|
927
|
+
readonly ref: NamedRef | undefined;
|
|
929
928
|
}
|
|
930
929
|
declare function resolveToForPlan(optionsTo: string, input: ResolveToForPlanInput): Promise<Result<ResolvedContractRef, CliStructuredError$2>>;
|
|
931
930
|
//#endregion
|
|
@@ -979,16 +978,19 @@ declare function computeRefAdvancementName(options: {
|
|
|
979
978
|
/**
|
|
980
979
|
* Everything `executeRefAdvancement` needs, produced before a command does the
|
|
981
980
|
* work that precedes the ref write: the ref name is validated and the
|
|
982
|
-
* declarations of the contract to snapshot are rendered from its JSON
|
|
983
|
-
*
|
|
984
|
-
* read or rendered after the database is touched, so a contract that cannot
|
|
981
|
+
* declarations of the contract to snapshot are rendered from its JSON. Nothing
|
|
982
|
+
* is read or rendered after the database is touched, so a contract that cannot
|
|
985
983
|
* be snapshotted refuses the command before it changes anything.
|
|
986
984
|
*/
|
|
987
985
|
declare function preflightRefAdvancement(args: {
|
|
988
986
|
readonly name: string;
|
|
989
987
|
readonly contractJson: Record<string, unknown>;
|
|
990
988
|
readonly contractJsonPath: string;
|
|
991
|
-
readonly
|
|
989
|
+
readonly config: {
|
|
990
|
+
readonly contract?: {
|
|
991
|
+
readonly typesModule?: string;
|
|
992
|
+
};
|
|
993
|
+
};
|
|
992
994
|
readonly client: Pick<ControlClient, 'renderContractDts'>;
|
|
993
995
|
}): Promise<Result<ContractIR, CliStructuredError$2>>;
|
|
994
996
|
declare function executeRefAdvancement(refsDir: string, migrationsDir: string, name: string, hash: string, contractIR: ContractIR): Promise<{
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;iBAkBiB,oBAAoB,SAAS,uBAAuB;;;;;;iBAMpD,eAAe,IAAI,UAAU,YAAY,cAAc,kDAAkD;;;;;;;;iBAQzG,gBAAgB,gBAAgB,MAAM,4BAA4B;WACxE;IACP;;;iBAGa,mBAAmB,gBAAgB;WACzC;IACP,cAAc;;;KAGb;WACM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4BP,oBAAoB,SAAS,qBAAqB,eAAe,2BAA2B,QAAQ;;;UAG3G;WACC,QAAQ;WACR;;WAEA;;WAEA;;;;;;;KAON,sCAAsC;WAChC;;WAEA;;WAEA;;UAED;WACC;WACA,cAAc;;WAEd;WACA;;WAEA,MAAM;;iBAEA,6BAA6B,SAAS,sCAAsC,QAAQ,OAAO,qCAAqC;;;iBAGhI,uBAAuB,qBAAqB,sBAAsB,wBAAwB;;;;;;;;UAQjG,qBAAqB,0BAA0B;WAC9C,UAAU;WACV;WACA,aAAa;WACb,YAAY,cAAc,2BAA2B,WAAW;WAChE,sBAAsB,0BAA0B;;;;;;WAMhD,wBAAwB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sB,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;;;;;;;;;iBASM,wBAAwB;WAC9B;WACA,cAAc;WACd;WACA;aACE;eACE;;;WAGJ,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,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as executeMigrationNewCommand, Ct as statusForMigrationHash, D as executeDbUpdate, E as executeDbSign, F as executeRefSetCommand, G as loadContractSource, M as executeRefAdvancement, N as executeRefDeleteCommand, O as executeDbVerify, P as executeRefListCommand, Q as migrationSpaceListEntriesFromAggregate, R as hasMigrationPath, S as enumerateCheckSpaces, T as executeDbInit, U as loadAggregateIntegrityViolations, V as listRefsByContractHash, W as loadContractRawSafely, X as mapIntegrityViolations, Y as mapContractAtError, _t as runContractSpaceSeedPhase, a as advanceRefSafely, at as refusePackageCorruptionOnAggregate, b as disposeEmitQueue, c as buildContractSpaceAggregate, d as buildRefAdvancementFields, dt as resolveContractRefToSnapshot, et as preflightRefAdvancement, f as checkSingleTarget, ft as resolveFromForPlan, g as createControlClient, ht as resolveToForPlan, it as refuseMissingInvariantPath, j as executeMigrationPlanCommand, k as executeMigrateShowPlan, l as buildMigrationSpaceGraphEntries, mt as resolveStatements, n as NO_REF_ADVANCEMENT, nt as refuseContractSpaceIntegrity, o as appContractStandInFromIdentity, ot as refuseUnknownInvariants, p as computeRefAdvancementName, pt as resolveMigrationRef, q as loadContractSpaceAggregateForCli, rt as refuseDeclaredExtensionTargetMismatch, s as appliedHashesFromLedger, tt as readMigrationRefs, u as buildReadAggregate, ut as resolveContractRef$1, vt as runMigrationCheck, w as executeContractEmit, x as enrichContract, y as deriveStatusEdgeAnnotations, yt as runMigrationList } from "./ref-
|
|
1
|
+
import { j as errorFromCaught } from "./caught-errors-D_pbHqmS-B-4jRN6g.mjs";
|
|
2
|
+
import { A as executeMigrationNewCommand, Ct as statusForMigrationHash, D as executeDbUpdate, E as executeDbSign, F as executeRefSetCommand, G as loadContractSource, M as executeRefAdvancement, N as executeRefDeleteCommand, O as executeDbVerify, P as executeRefListCommand, Q as migrationSpaceListEntriesFromAggregate, R as hasMigrationPath, S as enumerateCheckSpaces, T as executeDbInit, U as loadAggregateIntegrityViolations, V as listRefsByContractHash, W as loadContractRawSafely, X as mapIntegrityViolations, Y as mapContractAtError, _t as runContractSpaceSeedPhase, a as advanceRefSafely, at as refusePackageCorruptionOnAggregate, b as disposeEmitQueue, c as buildContractSpaceAggregate, d as buildRefAdvancementFields, dt as resolveContractRefToSnapshot, et as preflightRefAdvancement, f as checkSingleTarget, ft as resolveFromForPlan, g as createControlClient, ht as resolveToForPlan, it as refuseMissingInvariantPath, j as executeMigrationPlanCommand, k as executeMigrateShowPlan, l as buildMigrationSpaceGraphEntries, mt as resolveStatements, n as NO_REF_ADVANCEMENT, nt as refuseContractSpaceIntegrity, o as appContractStandInFromIdentity, ot as refuseUnknownInvariants, p as computeRefAdvancementName, pt as resolveMigrationRef, q as loadContractSpaceAggregateForCli, rt as refuseDeclaredExtensionTargetMismatch, s as appliedHashesFromLedger, tt as readMigrationRefs, u as buildReadAggregate, ut as resolveContractRef$1, vt as runMigrationCheck, w as executeContractEmit, x as enrichContract, y as deriveStatusEdgeAnnotations, yt as runMigrationList } from "./ref-PQOM_LTC-lyfzb0MO.mjs";
|
|
3
3
|
export { NO_REF_ADVANCEMENT, advanceRefSafely, appContractStandInFromIdentity, appliedHashesFromLedger, buildContractSpaceAggregate, buildMigrationSpaceGraphEntries, buildReadAggregate, buildRefAdvancementFields, checkSingleTarget, computeRefAdvancementName, createControlClient, deriveStatusEdgeAnnotations, disposeEmitQueue, enrichContract, enumerateCheckSpaces, errorFromCaught, executeContractEmit, executeDbInit, executeDbSign, executeDbUpdate, executeDbVerify, executeMigrateShowPlan, executeMigrationNewCommand, executeMigrationPlanCommand, executeRefAdvancement, executeRefDeleteCommand, executeRefListCommand, executeRefSetCommand, hasMigrationPath, listRefsByContractHash, loadAggregateIntegrityViolations, loadContractRawSafely, loadContractSource, loadContractSpaceAggregateForCli, mapContractAtError, mapIntegrityViolations, migrationSpaceListEntriesFromAggregate, preflightRefAdvancement, readMigrationRefs, refuseContractSpaceIntegrity, refuseDeclaredExtensionTargetMismatch, refuseMissingInvariantPath, refusePackageCorruptionOnAggregate, refuseUnknownInvariants, resolveContractRef$1 as resolveContractRef, resolveContractRefToSnapshot, resolveFromForPlan, resolveMigrationRef, resolveStatements, resolveToForPlan, runContractSpaceSeedPhase, runMigrationCheck, runMigrationList, statusForMigrationHash };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as MigrateResult, N as ExecuteDbVerifyResult, O as EmitResult, S as DbUpdateResult, W as RenderContractDtsResult, d as ControlClient, g as DbInitResult, j as ExecuteDbSignResult } from "./db-sign-
|
|
1
|
+
import { F as MigrateResult, N as ExecuteDbVerifyResult, O as EmitResult, S as DbUpdateResult, W as RenderContractDtsResult, d as ControlClient, g as DbInitResult, j as ExecuteDbSignResult } from "./db-sign-DLIR5swa-DQ0aN1nU.mjs";
|
|
2
2
|
import { CoreSchemaView, OperationPreview, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
3
3
|
import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
4
4
|
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ContractSourceFormat } from "@prisma/orm-framework/config/config-types";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/cli/dist/exports/init-contribution.d.mts
|
|
3
|
+
//#region src/commands/init/init-contribution.d.ts
|
|
4
|
+
interface QuickReferenceInput {
|
|
5
|
+
readonly mode: ContractSourceFormat;
|
|
6
|
+
readonly schemaPath: string;
|
|
7
|
+
/** The command that runs the project's Prisma CLI, such as `pnpm prisma`. */
|
|
8
|
+
readonly cliCommand: string;
|
|
9
|
+
/** The rendered "Requirements" section, or an empty string when the package states none. */
|
|
10
|
+
readonly requirements: string;
|
|
11
|
+
}
|
|
12
|
+
interface ReadmeInput {
|
|
13
|
+
readonly projectName: string;
|
|
14
|
+
readonly contractPath: string;
|
|
15
|
+
/** The command that runs a `package.json` script with the project's package manager. */
|
|
16
|
+
readonly runScript: (script: string) => string;
|
|
17
|
+
}
|
|
18
|
+
interface Prisma7QuickReferenceInput {
|
|
19
|
+
readonly schemaPath: string;
|
|
20
|
+
/** The directory the contract is emitted into, which also holds `db.ts`. */
|
|
21
|
+
readonly outputDir: string;
|
|
22
|
+
readonly cliCommand: string;
|
|
23
|
+
readonly requirements: string;
|
|
24
|
+
/** The Prisma 7 config's file name once init is done; `undefined` when the project has none. */
|
|
25
|
+
readonly prisma7Config: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
interface ServerRequirement {
|
|
28
|
+
readonly minVersion: string;
|
|
29
|
+
/** A query the user can run against the server to read its version. */
|
|
30
|
+
readonly checkCommand: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* What a probe found. It rejects only when it cannot connect; once connected, a query that fails
|
|
34
|
+
* or an answer with no readable version is `version-unreadable`.
|
|
35
|
+
*/
|
|
36
|
+
type InitProbeResult = {
|
|
37
|
+
readonly kind: 'server-version';
|
|
38
|
+
readonly serverVersion: string;
|
|
39
|
+
} |
|
|
40
|
+
/** It connected, but the version query failed or its answer held no version the probe can read. */
|
|
41
|
+
{
|
|
42
|
+
readonly kind: 'version-unreadable';
|
|
43
|
+
readonly detail: string;
|
|
44
|
+
} |
|
|
45
|
+
/** The driver is not installed where the target package can load it. */
|
|
46
|
+
{
|
|
47
|
+
readonly kind: 'driver-missing';
|
|
48
|
+
readonly driver: string;
|
|
49
|
+
readonly cause: string;
|
|
50
|
+
} |
|
|
51
|
+
/** The driver is installed but failed to load. */
|
|
52
|
+
{
|
|
53
|
+
readonly kind: 'driver-failed';
|
|
54
|
+
readonly driver: string;
|
|
55
|
+
readonly cause: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* What a target package tells `prisma orm init`, as the default export of its `init` entrypoint.
|
|
59
|
+
* The entrypoint may import types from the framework but no framework code that runs.
|
|
60
|
+
*
|
|
61
|
+
* A package takes a Prisma 7 schema as its contract source when its `configModule` exports
|
|
62
|
+
* `prisma7Schema`; `init` then writes the config itself and needs `prisma7QuickReference`.
|
|
63
|
+
*/
|
|
64
|
+
interface InitContribution {
|
|
65
|
+
readonly label: string;
|
|
66
|
+
/** The module `prisma.config.ts` imports `defineConfig` from. */
|
|
67
|
+
readonly configModule: string;
|
|
68
|
+
/** Packages installed into the application with the target package. */
|
|
69
|
+
readonly peerPackages: readonly string[];
|
|
70
|
+
readonly authoringModes: readonly ContractSourceFormat[];
|
|
71
|
+
readonly starterContract: (mode: ContractSourceFormat) => string;
|
|
72
|
+
/** A short contract sample for the quick reference, as a fenced code block. */
|
|
73
|
+
readonly contractSample: (mode: ContractSourceFormat) => string;
|
|
74
|
+
/**
|
|
75
|
+
* `db.ts`, which sits beside the emitted `contract.json` and `contract.d.ts`. The connection
|
|
76
|
+
* string is in `DATABASE_URL`, and `dotenv` is installed, so it may import `dotenv/config`.
|
|
77
|
+
*/
|
|
78
|
+
readonly databaseFile: () => string;
|
|
79
|
+
/**
|
|
80
|
+
* The body of `.env.example`, and of `.env` when the user asks for one. It sets `DATABASE_URL`,
|
|
81
|
+
* the variable `prisma.config.ts`, `db.ts` and `--probe-db` read; `dotenv` loads it.
|
|
82
|
+
*/
|
|
83
|
+
readonly envExample: () => string;
|
|
84
|
+
readonly quickReference: (input: QuickReferenceInput) => string;
|
|
85
|
+
/** The README for a project that already has `src/index.ts`; no README is written without it. */
|
|
86
|
+
readonly readme?: (input: ReadmeInput) => string;
|
|
87
|
+
readonly serverRequirement?: ServerRequirement;
|
|
88
|
+
/**
|
|
89
|
+
* Connects to the `DATABASE_URL` of the shell environment that ran `init` (not `.env`) and
|
|
90
|
+
* reads the server's version; rejects when it cannot connect. `init` waits 60 seconds for it,
|
|
91
|
+
* then aborts `signal` and reports the probe as not finished. A probe should close its client when
|
|
92
|
+
* `signal` aborts, and bound its own connect and query with its driver's timeouts, well inside
|
|
93
|
+
* the 60 seconds.
|
|
94
|
+
*/
|
|
95
|
+
readonly probe?: (databaseUrl: string, signal: AbortSignal) => Promise<InitProbeResult>;
|
|
96
|
+
/** The quick reference for a project that keeps its Prisma 7 schema as the contract source. */
|
|
97
|
+
readonly prisma7QuickReference?: (input: Prisma7QuickReferenceInput) => string;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export type { InitContribution, InitProbeResult, Prisma7QuickReferenceInput, QuickReferenceInput, ReadmeInput, ServerRequirement };
|
|
101
|
+
//# sourceMappingURL=cli__init-contribution.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli__init-contribution.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/exports/init-contribution.d.mts"],"mappings":";;;UAEU;WACC,MAAM;WACN;;WAEA;;WAEA;;UAED;WACC;WACA;;WAEA,YAAY;;UAEb;WACC;;WAEA;WACA;WACA;;WAEA;;UAED;WACC;;WAEA;;;;;;KAMN;WACM;WACA;;;;WAIA;WACA;;;;WAIA;WACA;WACA;;;;WAIA;WACA;WACA;;;;;;;;;UASD;WACC;;WAEA;;WAEA;WACA,yBAAyB;WACzB,kBAAkB,MAAM;;WAExB,iBAAiB,MAAM;;;;;WAKvB;;;;;WAKA;WACA,iBAAiB,OAAO;;WAExB,UAAU,OAAO;WACjB,oBAAoB;;;;;;;;WAQpB,SAAS,qBAAqB,QAAQ,gBAAgB,QAAQ;;WAE9D,yBAAyB,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* to stdout (FR1.5). The same shape backs the human-readable outro
|
|
6
6
|
* renderer (FR10), so the two output modes carry identical information.
|
|
7
7
|
*
|
|
8
|
-
* `target` is
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* `target` is the short name of the target package, the value `--target`
|
|
9
|
+
* takes, so consumers can round-trip the document straight into a
|
|
10
|
+
* follow-up `--target` invocation.
|
|
11
11
|
*
|
|
12
12
|
* The `ok: true` literal is the documented success/error discriminator —
|
|
13
13
|
* see [Style Guide § JSON Semantics](../../../../../../../docs/CLI%20Style%20Guide.md#json-semantics).
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as InitOutputSchema } from "./output-
|
|
1
|
+
import { n as InitOutputSchema } from "./output-E6F4-EMc-CqlzGlv-.mjs";
|
|
2
2
|
export { InitOutputSchema };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { g as requireConfigSections, p as loadConfigForSections, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-
|
|
1
|
+
import { g as requireConfigSections, p as loadConfigForSections, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-CZ6dPu-O.mjs";
|
|
2
2
|
import { g as errorInvalidJson } from "./errors-BMq40nYH-Cg8PBect.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { j as errorFromCaught, ut as migrationsDirFor } from "./caught-errors-D_pbHqmS-B-4jRN6g.mjs";
|
|
4
4
|
import { r as buildMigrationArtifacts } from "./migration-DTmtOJ0n.mjs";
|
|
5
5
|
import { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from "@prisma/orm-framework/errors/control";
|
|
6
6
|
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
7
|
+
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
7
8
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
8
9
|
import { dirname, isAbsolute, join, relative } from "pathe";
|
|
9
10
|
import { errorMigrationTargetMismatch } from "@prisma/orm-framework/errors/migration";
|
|
10
11
|
import { existsSync, readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
11
|
-
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
import { Cli, Command, Option, UsageError } from "clipanion";
|
|
14
14
|
//#region ../../../1-framework/3-tooling/cli/dist/migration-cli.mjs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { n as errorFromCaught, v as migrationsDirFor } from \"./caught-errors-I1l50iPc.mjs\";\nimport { existsSync, readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { dirname, isAbsolute, join, relative } from \"pathe\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { CONFIG_FILENAME, findNearestConfigPathForFile, loadConfig, loadConfigForSections, requireConfigSections } from \"@internal/config-loader\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/utils/migration-file-config.ts\n/**\n* The config a `migration.ts` runs with. `--config` names it outright. Without it, the config is the one that owns the migration, whose migrations directory holds the file: the nearest `prisma.config.ts` above the migration, else the one in the working directory.\n*/\nasync function loadMigrationFileConfig(options) {\n\tconst { configPath, migrationFile, cwd, sections } = options;\n\tif (configPath !== void 0) return loadConfigForSections(configPath, sections);\n\tconst workingDirectoryConfig = join(cwd, CONFIG_FILENAME);\n\tconst candidates = [.../* @__PURE__ */ new Set([await findNearestConfigPathForFile(migrationFile), existsSync(workingDirectoryConfig) ? workingDirectoryConfig : void 0])].filter((candidate) => candidate !== void 0);\n\tconst checked = [];\n\tfor (const candidate of candidates) {\n\t\tconst loaded = await loadConfig(candidate);\n\t\tconst config = loaded.ok ? requireConfigSections(loaded.value, [...sections, \"migrations\"]) : loaded;\n\t\tif (!config.ok) {\n\t\t\tchecked.push({\n\t\t\t\tconfigPath: candidate,\n\t\t\t\tloadFailure: config.failure.message\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (ownsMigration(config.value, candidate, migrationFile)) return ok(config.value);\n\t\tchecked.push({\n\t\t\tconfigPath: candidate,\n\t\t\tmigrationsDir: migrationsDirFor(config.value, dirname(candidate))\n\t\t});\n\t}\n\treturn notOk(errorMigrationCliConfigNotFound({\n\t\tmigrationDir: dirname(migrationFile),\n\t\tchecked\n\t}));\n}\n/** Whether `migrationFile` is inside the migrations directory of the config at `configPath`. */\nfunction ownsMigration(config, configPath, migrationFile) {\n\tconst path = relative(realPath(migrationsDirFor(config, dirname(configPath))), realPath(migrationFile));\n\treturn path !== \"\" && !path.startsWith(\"..\") && !isAbsolute(path);\n}\nfunction realPath(path) {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n//#endregion\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma db migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the config `--config` names. Without it, loads the config that\n* owns the migration (see `loadMigrationFileConfig`).\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (isStructuredError(err)) writeStructuredError(ctx.stderr, errorFromCaught(err, (message) => message));\n\t\telse ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream: the code and\n* summary, then the why when it says more than the summary, then the fix. 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 === void 0 || envelope.why === envelope.summary ? \"\" : `\\n${envelope.why}`;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}${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,IAAI,eAAe,KAAK,GAAG,OAAO,sBAAsB,YAAY,QAAQ;CAC5E,MAAM,yBAAyB,KAAK,KAAK,eAAe;CACxD,MAAM,aAAa,CAAC,mBAAmB,IAAI,IAAI,CAAC,MAAM,6BAA6B,aAAa,GAAG,WAAW,sBAAsB,IAAI,yBAAyB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,cAAc,cAAc,KAAK,CAAC;CACrN,MAAM,U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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
|
+
{"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { b as migrationsDirFor, n as errorFromCaught } from \"./caught-errors-D_pbHqmS.mjs\";\nimport { existsSync, readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { dirname, isAbsolute, join, relative } from \"pathe\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { CONFIG_FILENAME, findNearestConfigPathForFile, loadConfig, loadConfigForSections, requireConfigSections } from \"@internal/config-loader\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/utils/migration-file-config.ts\n/**\n* The config a `migration.ts` runs with. `--config` names it outright. Without it, the config is the one that owns the migration, whose migrations directory holds the file: the nearest `prisma.config.ts` above the migration, else the one in the working directory.\n*/\nasync function loadMigrationFileConfig(options) {\n\tconst { configPath, migrationFile, cwd, sections } = options;\n\tif (configPath !== void 0) return loadConfigForSections(configPath, sections);\n\tconst workingDirectoryConfig = join(cwd, CONFIG_FILENAME);\n\tconst candidates = [.../* @__PURE__ */ new Set([await findNearestConfigPathForFile(migrationFile), existsSync(workingDirectoryConfig) ? workingDirectoryConfig : void 0])].filter((candidate) => candidate !== void 0);\n\tconst checked = [];\n\tfor (const candidate of candidates) {\n\t\tconst loaded = await loadConfig(candidate);\n\t\tconst config = loaded.ok ? requireConfigSections(loaded.value, [...sections, \"migrations\"]) : loaded;\n\t\tif (!config.ok) {\n\t\t\tchecked.push({\n\t\t\t\tconfigPath: candidate,\n\t\t\t\tloadFailure: config.failure.message\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (ownsMigration(config.value, candidate, migrationFile)) return ok(config.value);\n\t\tchecked.push({\n\t\t\tconfigPath: candidate,\n\t\t\tmigrationsDir: migrationsDirFor(config.value, dirname(candidate))\n\t\t});\n\t}\n\treturn notOk(errorMigrationCliConfigNotFound({\n\t\tmigrationDir: dirname(migrationFile),\n\t\tchecked\n\t}));\n}\n/** Whether `migrationFile` is inside the migrations directory of the config at `configPath`. */\nfunction ownsMigration(config, configPath, migrationFile) {\n\tconst path = relative(realPath(migrationsDirFor(config, dirname(configPath))), realPath(migrationFile));\n\treturn path !== \"\" && !path.startsWith(\"..\") && !isAbsolute(path);\n}\nfunction realPath(path) {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n//#endregion\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma db migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the config `--config` names. Without it, loads the config that\n* owns the migration (see `loadMigrationFileConfig`).\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (isStructuredError(err)) writeStructuredError(ctx.stderr, errorFromCaught(err, (message) => message));\n\t\telse ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream: the code and\n* summary, then the why when it says more than the summary, then the fix. 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 === void 0 || envelope.why === envelope.summary ? \"\" : `\\n${envelope.why}`;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}${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,IAAI,eAAe,KAAK,GAAG,OAAO,sBAAsB,YAAY,QAAQ;CAC5E,MAAM,yBAAyB,KAAK,KAAK,eAAe;CACxD,MAAM,aAAa,CAAC,mBAAmB,IAAI,IAAI,CAAC,MAAM,6BAA6B,aAAa,GAAG,WAAW,sBAAsB,IAAI,yBAAyB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,cAAc,cAAc,KAAK,CAAC;CACrN,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,aAAa,YAAY;EACnC,MAAM,SAAS,MAAM,WAAW,SAAS;EACzC,MAAM,SAAS,OAAO,KAAK,sBAAsB,OAAO,OAAO,CAAC,GAAG,UAAU,YAAY,CAAC,IAAI;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c,cAAc,YAAY;CACxC,OAAO,MAAM,sCAAsC,aAAa,GAAG;AACpE;;;;;;;;;AASA,eAAe,aAAa,eAAe,gBAAgB,QAAQ,KAAK;CACvE,MAAM,gBAAgB,cAAc,aAAa;CACjD,MAAM,eAAe,QAAQ,aAAa;CAC1C,MAAM,eAAe,MAAM,wBAAwB;EAClD,YAAY,OAAO;EACnB;EACA,KAAK,QAAQ,IAAI;EACjB,UAAU;GACT;GACA;GACA;GACA;GACA;EACD;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,MAAM,aAAa;CACzC,MAAM,SAAS,aAAa;CAC5B,MAAM,QAAQ,IAAI,eAAe;CACjC,IAAI,MAAM,aAAa,OAAO,OAAO,UAAU,MAAM,6BAA6B;EACjF,mBAAmB,MAAM;EACzB,gBAAgB,OAAO,OAAO;CAC/B,CAAC;CACD,MAAM,yBAAyB,IAAI,eAAe,mBAAmB,MAAM,CAAC,GAAG,cAAc,OAAO,QAAQ,IAAI,MAAM;CACtH,IAAI;AACL"}
|
package/dist/config-loader.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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 PrismaConfig, t as CONFIG_FILENAME, u as expandContractInputs, v as ormConfigSchema, x as validateOrmSection, y as ormConfigSection } from "./index-
|
|
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 PrismaConfig, t as CONFIG_FILENAME, u as expandContractInputs, v as ormConfigSchema, x as validateOrmSection, y as ormConfigSection } from "./index-C3KtOcBP.mjs";
|
|
2
2
|
export { CONFIG_FILENAME, type ConfigFile, type ConfigFiles, type ConfigSection, type LoadedConfig, ORM_CONFIG_SECTION_NAME, type PrismaConfig, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };
|
package/dist/config-loader.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as validateOrmSection, a as expandContractInputs, c as globContractInputMatching, d as loadConfigFiles, f as loadConfigForFile, g as requireConfigSections, h as ormConfigSection, i as evaluateConfigModule, l as isConfigSection, m as ormConfigSchema, n as ORM_CONFIG_SECTION_NAME, p as loadConfigForSections, r as buildLoadedConfig, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-
|
|
1
|
+
import { _ as validateOrmSection, a as expandContractInputs, c as globContractInputMatching, d as loadConfigFiles, f as loadConfigForFile, g as requireConfigSections, h as ormConfigSection, i as evaluateConfigModule, l as isConfigSection, m as ormConfigSchema, n as ORM_CONFIG_SECTION_NAME, p as loadConfigForSections, r as buildLoadedConfig, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-CZ6dPu-O.mjs";
|
|
2
2
|
export { CONFIG_FILENAME, ORM_CONFIG_SECTION_NAME, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };
|
|
@@ -4,18 +4,17 @@ import { n as NamedRef } from "./refs-CkGjbosE-CLkrSkQ4.mjs";
|
|
|
4
4
|
import "./refs-B5N_vHH7.mjs";
|
|
5
5
|
import "./ref-resolution-UwnXbc9M.mjs";
|
|
6
6
|
import { CliStructuredError as CliStructuredError$2 } from "@prisma/orm-framework/errors/control";
|
|
7
|
-
import { ControlAdapterDescriptor, ControlDriverConnectOptions, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlTargetDescriptor, CoreSchemaView, DatabasePolicyDifference, MarkerHashes, MigrationAccessChange, MigrationDataLoss, MigrationOperationSubject, MigrationPlanNamespaces, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, MigrationStatementJson, MigrationSubjectJson, OperationPreview, ResolvedMigrationStatement, SpaceDatabasePoliciesConflict, SpaceSignature, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
7
|
+
import { ControlAdapterDescriptor, ControlDriverConnectOptions, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlTargetDescriptor, CoreSchemaView, DatabasePolicies, DatabasePolicyDifference, MarkerHashes, MigrationAccessChange, MigrationDataLoss, MigrationOperationSubject, MigrationPlanNamespaces, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, MigrationStatementJson, MigrationSubjectJson, OperationPreview, ResolvedMigrationStatement, SpaceDatabasePoliciesConflict, SpaceSignature, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
8
|
+
import { Result } from "@prisma/orm-framework/utils/result";
|
|
8
9
|
import "@prisma/orm-framework/errors/execution";
|
|
9
10
|
import "@prisma/orm-framework/errors/migration";
|
|
10
11
|
import { Contract, ContractMarkerRecord, EntityCoordinate, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
11
|
-
import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
|
|
12
12
|
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
13
|
-
import { Result } from "@prisma/orm-framework/utils/result";
|
|
14
13
|
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
15
14
|
import "@prisma/cli-engine/protocol";
|
|
16
15
|
import { ContractSourceDiagnostic, ContractSourceDiagnostics, ContractSourceProvider, PrismaConfig } from "@prisma/orm-framework/config/config-types";
|
|
17
16
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma/orm-framework/components/authoring";
|
|
18
|
-
//#region ../../../1-framework/3-tooling/cli/dist/db-sign-
|
|
17
|
+
//#region ../../../1-framework/3-tooling/cli/dist/db-sign-DLIR5swa.d.mts
|
|
19
18
|
//#region src/control-api/statements/statement-text.d.ts
|
|
20
19
|
/** The verbs a statement can have. */
|
|
21
20
|
type StatementVerb = 'rename' | 'delete' | 'allow' | 'convert' | 'backfill';
|
|
@@ -44,6 +43,10 @@ interface CliInvocation {
|
|
|
44
43
|
readonly statementArgs?: readonly string[];
|
|
45
44
|
}
|
|
46
45
|
//#endregion
|
|
46
|
+
//#region src/utils/data-protection-settings.d.ts
|
|
47
|
+
/** A setting of the data protection policy. */
|
|
48
|
+
type DataProtectionSetting = keyof DatabasePolicies['dataProtection'];
|
|
49
|
+
//#endregion
|
|
47
50
|
//#region src/control-api/operations/changed-storage-entities.d.ts
|
|
48
51
|
/** The coordinate of a storage entity that changed, without the internal unbound namespace id. */
|
|
49
52
|
type ChangedStorageEntity = Omit<EntityCoordinate, 'namespaceId'> & {
|
|
@@ -133,15 +136,11 @@ declare function executeDbVerify<TFamilyId extends string, TTargetId extends str
|
|
|
133
136
|
interface RenderContractDtsOptions {
|
|
134
137
|
/** The parsed `contract.json` to render types for. */
|
|
135
138
|
readonly contract: unknown;
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
* root of the project that keeps them. Defaults to leaving every specifier
|
|
139
|
-
* as authored.
|
|
140
|
-
*/
|
|
141
|
-
readonly resolveImportSpecifier?: ImportSpecifierResolver;
|
|
139
|
+
/** The module the declarations import the framework and family contract types from: the config's `contract.typesModule`. */
|
|
140
|
+
readonly typesModule: string;
|
|
142
141
|
}
|
|
143
142
|
interface RenderContractDtsSuccess {
|
|
144
|
-
/** The declarations, rendered through the same emitter as `emit`,
|
|
143
|
+
/** The declarations, rendered through the same emitter as `emit`, importing from the module the caller named. */
|
|
145
144
|
readonly contractDts: string;
|
|
146
145
|
}
|
|
147
146
|
type RenderContractDtsFailureCode = 'CONTRACT_VALIDATION_FAILED' | 'RENDER_FAILED';
|
|
@@ -197,7 +196,16 @@ interface PlanAnswer {
|
|
|
197
196
|
* then. Beside a `rename` or `convert` answer, which plans again, a question may be left
|
|
198
197
|
* `undefined`: it is asked again, as the new plan has it.
|
|
199
198
|
*/
|
|
200
|
-
type AnswerPlanQuestions = (questions: readonly PlanQuestion[]) => Promise<readonly (PlanAnswer | undefined)[]>;
|
|
199
|
+
type AnswerPlanQuestions = (questions: readonly PlanQuestion[], answeredWithoutAsking?: readonly AnsweredWithoutAsking[]) => Promise<readonly (PlanAnswer | undefined)[]>;
|
|
200
|
+
/**
|
|
201
|
+
* A subject a run answered without asking, because `consentAll` covers its verb: a consent flag
|
|
202
|
+
* the user gave for it anyway is used, not unused.
|
|
203
|
+
*/
|
|
204
|
+
interface AnsweredWithoutAsking {
|
|
205
|
+
readonly verb: ConsentVerb;
|
|
206
|
+
readonly subject: string;
|
|
207
|
+
readonly removedNamespace?: string;
|
|
208
|
+
}
|
|
201
209
|
//#endregion
|
|
202
210
|
//#region src/control-api/statements/report-applied-statements.d.ts
|
|
203
211
|
/** A delete or allow statement in JSON output: the subject whose data or access it consents to. */
|
|
@@ -488,6 +496,8 @@ interface EmitContractConfig {
|
|
|
488
496
|
* The .d.ts types file will be colocated (e.g., contract.json → contract.d.ts).
|
|
489
497
|
*/
|
|
490
498
|
readonly output: string;
|
|
499
|
+
/** The module the generated `contract.d.ts` imports the framework and family contract types from. */
|
|
500
|
+
readonly typesModule: string;
|
|
491
501
|
}
|
|
492
502
|
/**
|
|
493
503
|
* Options for the emit operation.
|
|
@@ -640,6 +650,8 @@ interface DbUpdateSuccess extends MigrationPlanSubjects<AskedDataLoss, AskedAcce
|
|
|
640
650
|
readonly summary: string;
|
|
641
651
|
/** The settings the run recorded as the database's policies, with the values they replaced. Present only when it recorded some. */
|
|
642
652
|
readonly databasePoliciesUpdated?: readonly DatabasePolicyDifference[];
|
|
653
|
+
/** The data protection settings at their `permitted` level, so an apply asks nothing about the operations they cover. Present only when some are. */
|
|
654
|
+
readonly permitted?: readonly DataProtectionSetting[];
|
|
643
655
|
}
|
|
644
656
|
/** The result of `db update`: a failure is the structured error the command reports. */
|
|
645
657
|
type DbUpdateResult = Result<DbUpdateSuccess, CliStructuredError$2>;
|
|
@@ -820,14 +832,6 @@ interface ContractEmitOptions {
|
|
|
820
832
|
readonly config: PrismaConfig;
|
|
821
833
|
/** Directory the caller was invoked from. */
|
|
822
834
|
readonly cwd: string;
|
|
823
|
-
/**
|
|
824
|
-
* The project's directory, normally the validated config's `baseDir`. Used
|
|
825
|
-
* to find the project manifest whose dependencies decide the import
|
|
826
|
-
* specifiers in emitted files. Omit it and the manifest is looked up from
|
|
827
|
-
* the directory the artifacts are written to, which is the package that
|
|
828
|
-
* will import them.
|
|
829
|
-
*/
|
|
830
|
-
readonly projectDir?: string;
|
|
831
835
|
/**
|
|
832
836
|
* Directory to write contract artifacts into. When set, `contract.json` and
|
|
833
837
|
* `contract.d.ts` are written inside this directory, taking precedence over
|
|
@@ -1103,4 +1107,4 @@ type ExecuteDbSignResult = Result<ExecuteDbSignSuccess, CliStructuredError$2>;
|
|
|
1103
1107
|
declare function executeDbSign<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbSignOptions<TFamilyId, TTargetId>): Promise<ExecuteDbSignResult>;
|
|
1104
1108
|
//#endregion
|
|
1105
1109
|
export { ExecuteDbSignOptions as A, PlannerWarningsListener as B, DbUpdateSuccess as C, EmitOptions as D, EmitFailureCode as E, MigrateResult as F, RenderContractDtsSuccess as G, RenderContractDtsFailureCode as H, OnControlProgress as I, StatementVerb as J, SchemaVerifyOptions as K, PlanAnswer as L, ExecuteDbVerifyOptions as M, ExecuteDbVerifyResult as N, EmitResult as O, IntrospectOptions as P, executeDbVerify as Q, PlanQuestion as R, DbUpdateResult as S, EmitFailure as T, RenderContractDtsOptions as U, RenderContractDtsFailure as V, RenderContractDtsResult as W, VerifyOptions as X, TemporaryValueReport as Y, executeDbSign as Z, DbInitSuccess as _, ChangedStorageEntity as a, DbSignSpaceOutcome as b, ContractEmitOptions as c, ControlClient as d, ControlClientOptions as f, DbInitResult as g, DbInitOptions as h, AskedSubject as i, ExecuteDbSignResult as j, EmitSuccess as k, ContractEmitResult as l, CreateControlClient as m, AppliedStatementReport as n, CliInvocation as o, ControlProgressEvent as p, StatementText as q, AskedDataLoss as r, CliStructuredError$2 as s, AnswerPlanQuestions as t, ControlActionName as u, DbSignOptions as v, EmitContractConfig as w, DbUpdateOptions as x, DbSignSpaceFailure as y, PlanQuestionVerb as z };
|
|
1106
|
-
//# sourceMappingURL=db-sign-
|
|
1110
|
+
//# sourceMappingURL=db-sign-DLIR5swa-DQ0aN1nU.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-sign-DLIR5swa-DQ0aN1nU.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/db-sign-DLIR5swa.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;KAiBK;;;;;;UAMK;WACC,MAAM;WACN;;;;;;;;UAQD;WACC;WACA;WACA;;WAEA;;WAEA;;;;;KAKN,8BAA8B;;;;KAI9B,uBAAuB,KAAK;WACtB;;;;;;;;;;;;;UAaD,uBAAuB,0BAA0B;WAChD,QAAQ,sBAAsB,WAAW;WACzC,gBAAgB,sBAAsB;WACtC,UAAU;WACV;WACA,UAAU;WACV,YAAY,cAAc,2BAA2B,WAAW;WAChE,qBAAqB,cAAc,+BAA+B,WAAW;WAC7E;WACA;WACA;;WAEA,wBAAwB;WACxB,aAAa;;;;;;;;;;;;;;UAcd;WACC,eAAe,oBAAoB;;;;;;WAMn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