@prisma/orm-toolchain 8.0.0-rc.21-dev.13 → 8.0.0-rc.21-dev.15
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/{caught-errors-DlLh7HAX-DzRh7ZVr.mjs → caught-errors-DRiDJHfQ-Du9rLuFa.mjs} +8 -6
- package/dist/caught-errors-DRiDJHfQ-Du9rLuFa.mjs.map +1 -0
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +84 -28
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +12 -15
- 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__migration-cli.mjs +1 -1
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/{db-sign-wBQmmQn7-Bl6NVm0G.d.mts → db-sign-D8CcCI0v-Cda_1dSK.d.mts} +17 -4
- package/dist/{db-sign-wBQmmQn7-Bl6NVm0G.d.mts.map → db-sign-D8CcCI0v-Cda_1dSK.d.mts.map} +1 -1
- package/dist/migration-tools.d.mts +1 -1
- package/dist/migration-tools.mjs +1 -1
- package/dist/migration-tools__spaces.d.mts +1 -1
- package/dist/migration-tools__spaces.mjs +1 -1
- package/dist/{ref-qma7fG-2-TOPNrzuP.mjs → ref-CKUrXPT8-DOwCuN0q.mjs} +149 -104
- package/dist/ref-CKUrXPT8-DOwCuN0q.mjs.map +1 -0
- package/dist/{spaces-B0zxbzdl.mjs → spaces-CW5yVjgx.mjs} +28 -8
- package/dist/spaces-CW5yVjgx.mjs.map +1 -0
- package/dist/{spaces-VChSCSMQ.d.mts → spaces-Dsp9mRpJ.d.mts} +9 -6
- package/dist/{spaces-VChSCSMQ.d.mts.map → spaces-Dsp9mRpJ.d.mts.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +2 -1
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +12 -12
- package/dist/caught-errors-DlLh7HAX-DzRh7ZVr.mjs.map +0 -1
- package/dist/ref-qma7fG-2-TOPNrzuP.mjs.map +0 -1
- package/dist/spaces-B0zxbzdl.mjs.map +0 -1
|
@@ -5,7 +5,7 @@ import "./contract-snapshot-store-DrIwu5pn.mjs";
|
|
|
5
5
|
import { i as Refs, n as RefEntry } from "./refs-BNCUu58Y-BIso5Jfg.mjs";
|
|
6
6
|
import { n as MigrationGraph } from "./graph-bDjJ4GL9-BhFevsJS.mjs";
|
|
7
7
|
import { a as MigrationRef, t as ContractRef } from "./ref-resolution-BPhR-kta.mjs";
|
|
8
|
-
import { A as 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-
|
|
8
|
+
import { A as ExecuteDbSignOptions, B as PlannerWarningsListener, C as DbUpdateSuccess, D as EmitOptions, E as EmitFailureCode, G as RenderContractDtsSuccess, H as RenderContractDtsFailureCode, I as OnControlProgress, J as StatementVerb, K as SchemaVerifyOptions, L as PlanAnswer, M as ExecuteDbVerifyOptions, N as ExecuteDbVerifyResult, O as EmitResult, P as IntrospectOptions, Q as executeDbVerify, R as PlanQuestion, S as DbUpdateResult, T as EmitFailure, U as RenderContractDtsOptions, V as RenderContractDtsFailure, W as RenderContractDtsResult, X as VerifyOptions, Y as TemporaryValueReport, Z as executeDbSign, _ as DbInitSuccess, a as ChangedStorageEntity, b as DbSignSpaceOutcome, c as ContractEmitOptions, d as ControlClient, f as ControlClientOptions, g as DbInitResult, h as DbInitOptions, i as AskedSubject, j as ExecuteDbSignResult, k as EmitSuccess, l as ContractEmitResult, m as CreateControlClient, n as AppliedStatementReport, o as CliInvocation, p as ControlProgressEvent, q as StatementText, r as AskedDataLoss, s as CliStructuredError$2, t as AnswerPlanQuestions, u as ControlActionName, v as DbSignOptions, w as EmitContractConfig, x as DbUpdateOptions, y as DbSignSpaceFailure, z as PlanQuestionVerb } from "./db-sign-D8CcCI0v-Cda_1dSK.mjs";
|
|
9
9
|
import { s as PrismaNextConfig$1 } from "./index-CWPFeYyi.mjs";
|
|
10
10
|
import { a as emit } from "./index-BHYAWGxJ.mjs";
|
|
11
11
|
import { f as IntegrityQueryOptions, l as ContractSpaceAggregate, m as IntegrityViolation, t as AggregateContractSpace } from "./aggregate-DbWK1jSi.mjs";
|
|
@@ -55,6 +55,12 @@ type ContractEmitDependencies = {
|
|
|
55
55
|
* (`@internal/vite-plugin-contract-emit`). New callers must go through this
|
|
56
56
|
* function rather than re-implementing load → emit → publish.
|
|
57
57
|
*
|
|
58
|
+
* Before publishing, it writes each composed extension pack's pinned files
|
|
59
|
+
* under `migrations/<space-id>/`, as `migration plan` does, so a project
|
|
60
|
+
* that never plans a migration can still sign its database, and returns
|
|
61
|
+
* each path it wrote there. An `outputPath` writes the contract somewhere
|
|
62
|
+
* other than the project, so it writes no pinned files.
|
|
63
|
+
*
|
|
58
64
|
* The whole flow (load config → resolve source → emit bytes → atomic publish)
|
|
59
65
|
* is serialized per output JSON path via `queueEmitByOutput`. Concurrent calls
|
|
60
66
|
* for the same output line up FIFO; the user-visible outcome is "last
|
|
@@ -100,19 +106,6 @@ interface ResolveContractRefToSnapshotSuccess {
|
|
|
100
106
|
declare function resolveContractRefToSnapshot(options: ResolveContractRefToSnapshotOptions): Promise<Result<ResolveContractRefToSnapshotSuccess, CliStructuredError$2>>;
|
|
101
107
|
//#endregion
|
|
102
108
|
//#region src/control-api/operations/contract-space-aggregate-loader.d.ts
|
|
103
|
-
/**
|
|
104
|
-
* Map the integrity violations `checkIntegrity` reports into a single
|
|
105
|
-
* CLI structured-error envelope, preserving the error codes the prior
|
|
106
|
-
* throw-on-load loader emitted: `MIGRATION.CONTRACT_SPACE_LAYOUT_VIOLATION`
|
|
107
|
-
* (layout drift, bundled) and `MIGRATION.CONTRACT_SPACE_VIOLATION` (target /
|
|
108
|
-
* disjointness / contract-validation / structural integrity). Returns
|
|
109
|
-
* `null` when there is nothing to refuse on.
|
|
110
|
-
*
|
|
111
|
-
* Precedence reproduces the prior loader's first-failure ordering:
|
|
112
|
-
* layout drift first (every offence bundled into one envelope), then
|
|
113
|
-
* target mismatch, then disjointness, then a contract-validation
|
|
114
|
-
* failure, then any remaining structural integrity violation.
|
|
115
|
-
*/
|
|
116
109
|
declare function mapIntegrityViolations(violations: readonly IntegrityViolation[], migrationsDir: string): CliStructuredError$2 | null;
|
|
117
110
|
/**
|
|
118
111
|
* Inputs needed to compose the aggregate loader at the CLI surface.
|
|
@@ -238,6 +231,7 @@ interface SeedPhaseExtensionInput {
|
|
|
238
231
|
interface ContractSpaceSeedPhaseInputs {
|
|
239
232
|
readonly migrationsDir: string;
|
|
240
233
|
readonly extensions: ReadonlyArray<SeedPhaseExtensionInput>;
|
|
234
|
+
readonly signal?: AbortSignal;
|
|
241
235
|
}
|
|
242
236
|
/**
|
|
243
237
|
* One per-space record describing what the seed phase did for an
|
|
@@ -260,12 +254,15 @@ interface ContractSpaceSeedPhaseRecord {
|
|
|
260
254
|
readonly priorHash: string | null;
|
|
261
255
|
readonly newHash: string;
|
|
262
256
|
readonly newMigrationDirs: readonly string[];
|
|
257
|
+
/** Absolute path of each file or directory this run wrote for the space: the head snapshot, `refs/head.json`, and each new migration directory. */
|
|
258
|
+
readonly writtenPaths: readonly string[];
|
|
263
259
|
}
|
|
264
260
|
interface ContractSpaceSeedPhaseResult {
|
|
265
261
|
readonly seeded: readonly ContractSpaceSeedPhaseRecord[];
|
|
266
262
|
}
|
|
267
263
|
/**
|
|
268
|
-
* Phase-1 of the two-phase `migration plan` pipeline (sub-spec § 4)
|
|
264
|
+
* Phase-1 of the two-phase `migration plan` pipeline (sub-spec § 4), and the
|
|
265
|
+
* step of `contract emit` that writes each pack's pinned files.
|
|
269
266
|
*
|
|
270
267
|
* For every extension that exposes a `contractSpace`:
|
|
271
268
|
*
|
|
@@ -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
|
|
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;;;;;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caught-errors-
|
|
2
|
-
import { $ as refuseContractSpaceIntegrity, A as executeRefDeleteCommand, B as loadAggregateIntegrityViolations, C as executeDbSign, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, H as loadContractSource, K as mapContractAtError, M as executeRefSetCommand, O as executeMigrationPlanCommand, Q as readMigrationRefs, R as listRefsByContractHash, S as executeDbInit, T as executeDbVerify, V as loadContractRawSafely, W as loadContractSpaceAggregateForCli, Y as migrationSpaceListEntriesFromAggregate, Z as preflightRefAdvancement, _ as deriveStatusEdgeAnnotations, a as advanceRefSafely, b as enumerateCheckSpaces, c as buildContractSpaceAggregate, ct as resolveContractRefToSnapshot, d as buildRefAdvancementFields, dt as resolveStatements, et as refuseDeclaredExtensionTargetMismatch, f as checkSingleTarget, ft as resolveToForPlan, g as createControlClient, gt as runMigrationList, ht as runMigrationCheck, j as executeRefListCommand, k as executeRefAdvancement, l as buildMigrationSpaceGraphEntries, lt as resolveFromForPlan, mt as runContractSpaceSeedPhase, n as NO_REF_ADVANCEMENT, nt as refusePackageCorruptionOnAggregate, o as appContractStandInFromIdentity, p as computeRefAdvancementName, q as mapIntegrityViolations, rt as refuseUnknownInvariants, s as appliedHashesFromLedger, st as resolveContractRef$1, tt as refuseMissingInvariantPath, u as buildReadAggregate, ut as resolveMigrationRef, v as disposeEmitQueue, w as executeDbUpdate, x as executeContractEmit, y as enrichContract, yt as statusForMigrationHash } from "./ref-
|
|
1
|
+
import { D as errorFromCaught } from "./caught-errors-DRiDJHfQ-Du9rLuFa.mjs";
|
|
2
|
+
import { $ as refuseContractSpaceIntegrity, A as executeRefDeleteCommand, B as loadAggregateIntegrityViolations, C as executeDbSign, D as executeMigrationNewCommand, E as executeMigrateShowPlan, F as hasMigrationPath, H as loadContractSource, K as mapContractAtError, M as executeRefSetCommand, O as executeMigrationPlanCommand, Q as readMigrationRefs, R as listRefsByContractHash, S as executeDbInit, T as executeDbVerify, V as loadContractRawSafely, W as loadContractSpaceAggregateForCli, Y as migrationSpaceListEntriesFromAggregate, Z as preflightRefAdvancement, _ as deriveStatusEdgeAnnotations, a as advanceRefSafely, b as enumerateCheckSpaces, c as buildContractSpaceAggregate, ct as resolveContractRefToSnapshot, d as buildRefAdvancementFields, dt as resolveStatements, et as refuseDeclaredExtensionTargetMismatch, f as checkSingleTarget, ft as resolveToForPlan, g as createControlClient, gt as runMigrationList, ht as runMigrationCheck, j as executeRefListCommand, k as executeRefAdvancement, l as buildMigrationSpaceGraphEntries, lt as resolveFromForPlan, mt as runContractSpaceSeedPhase, n as NO_REF_ADVANCEMENT, nt as refusePackageCorruptionOnAggregate, o as appContractStandInFromIdentity, p as computeRefAdvancementName, q as mapIntegrityViolations, rt as refuseUnknownInvariants, s as appliedHashesFromLedger, st as resolveContractRef$1, tt as refuseMissingInvariantPath, u as buildReadAggregate, ut as resolveMigrationRef, v as disposeEmitQueue, w as executeDbUpdate, x as executeContractEmit, y as enrichContract, yt as statusForMigrationHash } from "./ref-CKUrXPT8-DOwCuN0q.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-D8CcCI0v-Cda_1dSK.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";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as requireConfigSections, p as loadConfigForSections, s as findNearestConfigPathForFile, t as CONFIG_FILENAME, u as loadConfig } from "./exports-ycSqeIf5.mjs";
|
|
2
2
|
import { g as errorInvalidJson } from "./errors-DXha_4l--relAaiI4.mjs";
|
|
3
|
-
import { D as errorFromCaught, it as migrationsDirFor } from "./caught-errors-
|
|
3
|
+
import { D as errorFromCaught, it as migrationsDirFor } from "./caught-errors-DRiDJHfQ-Du9rLuFa.mjs";
|
|
4
4
|
import { r as buildMigrationArtifacts } from "./migration-CWyjX9vz.mjs";
|
|
5
5
|
import { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from "@prisma/orm-framework/errors/control";
|
|
6
6
|
import { createControlStack } from "@prisma/orm-framework/components/control";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli__migration-cli.mjs","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/migration-cli.mjs"],"sourcesContent":["import { n as errorFromCaught, v as migrationsDirFor } from \"./caught-errors-DlLh7HAX.mjs\";\nimport { existsSync, readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { dirname, isAbsolute, join, relative } from \"pathe\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { CONFIG_FILENAME, findNearestConfigPathForFile, loadConfig, loadConfigForSections, requireConfigSections } from \"@internal/config-loader\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/utils/migration-file-config.ts\n/**\n* The config a `migration.ts` runs with. `--config` names it outright. Without it, the config is the one that owns the migration, whose migrations directory holds the file: the nearest `prisma.config.ts` above the migration, else the one in the working directory.\n*/\nasync function loadMigrationFileConfig(options) {\n\tconst { configPath, migrationFile, cwd, sections } = options;\n\tif (configPath !== void 0) return loadConfigForSections(configPath, sections);\n\tconst workingDirectoryConfig = join(cwd, CONFIG_FILENAME);\n\tconst candidates = [.../* @__PURE__ */ new Set([await findNearestConfigPathForFile(migrationFile), existsSync(workingDirectoryConfig) ? workingDirectoryConfig : void 0])].filter((candidate) => candidate !== void 0);\n\tconst checked = [];\n\tfor (const candidate of candidates) {\n\t\tconst loaded = await loadConfig(candidate);\n\t\tconst config = loaded.ok ? requireConfigSections(loaded.value, [...sections, \"migrations\"]) : loaded;\n\t\tif (!config.ok) {\n\t\t\tchecked.push({\n\t\t\t\tconfigPath: candidate,\n\t\t\t\tloadFailure: config.failure.message\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (ownsMigration(config.value, candidate, migrationFile)) return ok(config.value);\n\t\tchecked.push({\n\t\t\tconfigPath: candidate,\n\t\t\tmigrationsDir: migrationsDirFor(config.value, dirname(candidate))\n\t\t});\n\t}\n\treturn notOk(errorMigrationCliConfigNotFound({\n\t\tmigrationDir: dirname(migrationFile),\n\t\tchecked\n\t}));\n}\n/** Whether `migrationFile` is inside the migrations directory of the config at `configPath`. */\nfunction ownsMigration(config, configPath, migrationFile) {\n\tconst path = relative(realPath(migrationsDirFor(config, dirname(configPath))), realPath(migrationFile));\n\treturn path !== \"\" && !path.startsWith(\"..\") && !isAbsolute(path);\n}\nfunction realPath(path) {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n//#endregion\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma db migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the config `--config` names. Without it, loads the config that\n* owns the migration (see `loadMigrationFileConfig`).\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (isStructuredError(err)) writeStructuredError(ctx.stderr, errorFromCaught(err, (message) => message));\n\t\telse ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream. Format\n* matches the legacy hand-rolled writer (`message: why`) so the rest of\n* the project's error rendering stays consistent across surfaces. The\n* full PN code (`PN-<domain>-<code>`) is included so consumers can\n* grep for stable identifiers.\n*/\nfunction writeStructuredError(stream, err) {\n\tconst envelope = err.toEnvelope();\n\tconst why = envelope.why ?? envelope.summary;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}\\n${why}${fix}\\n`);\n}\n/**\n* Read a previously-scaffolded `migration.json` from disk, returning\n* `null` when the file is missing and throwing `MIGRATION.INVALID_JSON`\n* when the file is present but cannot be parsed as JSON. The CLI feeds\n* this into `buildMigrationArtifacts` so the pure builder can preserve\n* fields owned by `migration plan` (contract bookends, `createdAt`) across\n* re-emits.\n*\n* Author-time path: this loader still does not verify the manifest hash\n* or schema — that is the apply-time loader's job. Hash mismatch is the\n* *expected* outcome of a re-author (the developer's source changes\n* invalidate the prior hash by construction), and verification here\n* would block legitimate regenerations. Syntactic JSON-parse failure,\n* however, is now surfaced rather than swallowed: a malformed\n* `migration.json` indicates either a hand-edit gone wrong or partial\n* write, and silently rebuilding from `describe()` would discard the\n* user's on-disk content (preserved bookends, `createdAt`) without any\n* indication something was wrong on disk.\n* Apply-time consumers always route through the verifying\n* `readMigrationPackage` in `@internal/migration-tools/io` instead.\n*/\nfunction readExistingMetadata(metadataPath) {\n\tlet raw;\n\ttry {\n\t\traw = readFileSync(metadataPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(metadataPath, e instanceof Error ? e.message : String(e));\n\t}\n}\n/**\n* Persist a migration instance's artifacts to `migrationDir`. In\n* `dryRun` mode the artifacts are printed to stdout (with the same\n* `--- migration.json --- / --- ops.json ---` framing the legacy\n* `serializeMigration` helper used) and no files are written. Otherwise\n* `ops.json` and `migration.json` are written next to `migration.ts` and\n* a confirmation line is printed.\n*\n* File I/O lives in the CLI rather than `@internal/migration-tools`\n* so the migration-tools package stays focused on the pure\n* `Migration` → in-memory artifact conversion. The CLI is the only\n* legitimate site for combining config loading, stack assembly, and\n* filesystem persistence.\n*/\nasync function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout) {\n\tconst metadataPath = join(migrationDir, \"migration.json\");\n\tconst { opsJson, metadataJson } = await buildMigrationArtifacts(instance, readExistingMetadata(metadataPath));\n\tif (dryRun) {\n\t\tstdout.write(`--- migration.json ---\\n${metadataJson}\\n`);\n\t\tstdout.write(\"--- ops.json ---\\n\");\n\t\tstdout.write(`${opsJson}\\n`);\n\t\treturn;\n\t}\n\twriteFileSync(join(migrationDir, \"ops.json\"), opsJson);\n\twriteFileSync(metadataPath, metadataJson);\n\tstdout.write(`Wrote ops.json + migration.json to ${migrationDir}\\n`);\n}\n/**\n* Inner orchestration: load config, probe-construct the migration,\n* verify target, assemble the stack, construct with the stack, persist.\n*\n* Throws `CliStructuredError` for known failure modes (config not\n* found, target mismatch); the outer `orchestrate` translates those to\n* exit 1.\n*/\nasync function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {\n\tconst migrationFile = fileURLToPath(importMetaUrl);\n\tconst migrationDir = dirname(migrationFile);\n\tconst configResult = await loadMigrationFileConfig({\n\t\tconfigPath: parsed.config,\n\t\tmigrationFile,\n\t\tcwd: process.cwd(),\n\t\tsections: [\n\t\t\t\"family\",\n\t\t\t\"target\",\n\t\t\t\"adapter\",\n\t\t\t\"driver\",\n\t\t\t\"extensions\"\n\t\t]\n\t});\n\tif (!configResult.ok) throw configResult.failure;\n\tconst config = configResult.value;\n\tconst probe = new MigrationClass();\n\tif (probe.targetId !== config.target.targetId) throw errorMigrationTargetMismatch({\n\t\tmigrationTargetId: probe.targetId,\n\t\tconfigTargetId: config.target.targetId\n\t});\n\tawait serializeMigrationToDisk(new MigrationClass(createControlStack(config)), migrationDir, parsed.dryRun, ctx.stdout);\n\tctx.stderr;\n}\n//#endregion\nexport { MigrationCLI };\n\n//# sourceMappingURL=migration-cli.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,eAAe,wBAAwB,SAAS;CAC/C,MAAM,EAAE,YAAY,eAAe,KAAK,aAAa;CACrD,IAAI,eAAe,KAAK,GAAG,OAAO,s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;AACD;;;;;;;;;;;;;;;AAeA,eAAe,yBAAyB,UAAU,cAAc,QAAQ,QAAQ;CAC/E,MAAM,eAAe,KAAK,cAAc,gBAAgB;CACxD,MAAM,EAAE,SAAS,iBAAiB,MAAM,wBAAwB,UAAU,qBAAqB,YAAY,CAAC;CAC5G,IAAI,QAAQ;EACX,OAAO,MAAM,2BAA2B,aAAa,GAAG;EACxD,OAAO,MAAM,oBAAoB;EACjC,OAAO,MAAM,GAAG,QAAQ,GAAG;EAC3B;CACD;CACA,cAAc,KAAK,cAAc,UAAU,GAAG,OAAO;CACrD,cAAc,cAAc,YAAY;CACxC,OAAO,MAAM,sCAAsC,aAAa,GAAG;AACpE;;;;;;;;;AASA,eAAe,aAAa,eAAe,gBAAgB,QAAQ,KAAK;CACvE,MAAM,gBAAgB,cAAc,aAAa;CACjD,MAAM,eAAe,QAAQ,aAAa;CAC1C,MAAM,eAAe,MAAM,wBAAwB;EAClD,YAAY,OAAO;EACnB;EACA,KAAK,QAAQ,IAAI;EACjB,UAAU;GACT;GACA;GACA;GACA;GACA;EACD;CACD,CAAC;CACD,IAAI,CAAC,aAAa,IAAI,MAAM,aAAa;CACzC,MAAM,SAAS,aAAa;CAC5B,MAAM,QAAQ,IAAI,eAAe;CACjC,IAAI,MAAM,aAAa,OAAO,OAAO,UAAU,MAAM,6BAA6B;EACjF,mBAAmB,MAAM;EACzB,gBAAgB,OAAO,OAAO;CAC/B,CAAC;CACD,MAAM,yBAAyB,IAAI,eAAe,mBAAmB,MAAM,CAAC,GAAG,cAAc,OAAO,QAAQ,IAAI,MAAM;CACtH,IAAI;AACL"}
|
|
1
|
+
{"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-DRiDJHfQ.mjs\";\nimport { existsSync, readFileSync, realpathSync, writeFileSync } from \"node:fs\";\nimport { errorMigrationCliConfigNotFound, errorMigrationCliInvalidConfigArg, errorMigrationCliUnknownFlag } from \"@internal/errors/control\";\nimport { createControlStack } from \"@internal/framework-components/control\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { dirname, isAbsolute, join, relative } from \"pathe\";\nimport { errorMigrationTargetMismatch } from \"@internal/errors/migration\";\nimport { errorInvalidJson } from \"@internal/migration-tools/errors\";\nimport { CONFIG_FILENAME, findNearestConfigPathForFile, loadConfig, loadConfigForSections, requireConfigSections } from \"@internal/config-loader\";\nimport { fileURLToPath } from \"node:url\";\nimport { buildMigrationArtifacts } from \"@internal/migration-tools/migration\";\nimport { Cli, Command, Option, UsageError } from \"clipanion\";\n//#region src/utils/migration-file-config.ts\n/**\n* The config a `migration.ts` runs with. `--config` names it outright. Without it, the config is the one that owns the migration, whose migrations directory holds the file: the nearest `prisma.config.ts` above the migration, else the one in the working directory.\n*/\nasync function loadMigrationFileConfig(options) {\n\tconst { configPath, migrationFile, cwd, sections } = options;\n\tif (configPath !== void 0) return loadConfigForSections(configPath, sections);\n\tconst workingDirectoryConfig = join(cwd, CONFIG_FILENAME);\n\tconst candidates = [.../* @__PURE__ */ new Set([await findNearestConfigPathForFile(migrationFile), existsSync(workingDirectoryConfig) ? workingDirectoryConfig : void 0])].filter((candidate) => candidate !== void 0);\n\tconst checked = [];\n\tfor (const candidate of candidates) {\n\t\tconst loaded = await loadConfig(candidate);\n\t\tconst config = loaded.ok ? requireConfigSections(loaded.value, [...sections, \"migrations\"]) : loaded;\n\t\tif (!config.ok) {\n\t\t\tchecked.push({\n\t\t\t\tconfigPath: candidate,\n\t\t\t\tloadFailure: config.failure.message\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (ownsMigration(config.value, candidate, migrationFile)) return ok(config.value);\n\t\tchecked.push({\n\t\t\tconfigPath: candidate,\n\t\t\tmigrationsDir: migrationsDirFor(config.value, dirname(candidate))\n\t\t});\n\t}\n\treturn notOk(errorMigrationCliConfigNotFound({\n\t\tmigrationDir: dirname(migrationFile),\n\t\tchecked\n\t}));\n}\n/** Whether `migrationFile` is inside the migrations directory of the config at `configPath`. */\nfunction ownsMigration(config, configPath, migrationFile) {\n\tconst path = relative(realPath(migrationsDirFor(config, dirname(configPath))), realPath(migrationFile));\n\treturn path !== \"\" && !path.startsWith(\"..\") && !isAbsolute(path);\n}\nfunction realPath(path) {\n\treturn existsSync(path) ? realpathSync(path) : path;\n}\n//#endregion\n//#region src/migration-cli.ts\n/**\n* The migration-file CLI interface: the actor invoked when the author runs\n* `node migration.ts` directly.\n*\n* Naming: this is *not* a \"migration runner\" in the apply-time sense. The\n* apply-time runner is the thing `prisma db migrate` uses to\n* execute migration JSON ops against a database. `MigrationCLI` is the\n* tiny CLI surface owned by an authored `migration.ts` file: parse the\n* file's argv, load the project's `prisma.config.ts`, assemble a\n* `ControlStack`, instantiate the migration class, and serialize.\n*\n* The user authors a migration class, then calls\n* `MigrationCLI.run(import.meta.url, MigrationClass)` at module scope\n* after the class definition. When the file is invoked as a node\n* entrypoint (`node migration.ts`), the CLI:\n*\n* 1. Detects whether the file is the direct entrypoint (no-op when imported).\n* 2. Parses CLI args (`--help`, `--dry-run`, `--config <path>`) via\n* [clipanion](https://github.com/arcanis/clipanion).\n* 3. Loads the config `--config` names. Without it, loads the config that\n* owns the migration (see `loadMigrationFileConfig`).\n* 4. Probe-instantiates the migration class without a stack so it can read\n* `targetId` and verify it matches `config.target.targetId`\n* (`MIGRATION.TARGET_MISMATCH` on mismatch) before any stack-driven adapter\n* construction runs.\n* 5. Assembles a `ControlStack` from the loaded config descriptors and\n* constructs the migration with that stack.\n* 6. Reads any previously-scaffolded `migration.json`, then calls\n* `buildMigrationArtifacts` from `@internal/migration-tools` to\n* produce in-memory `ops.json` + `migration.json` content. Persists\n* the result to disk (or prints in dry-run mode).\n*\n* File I/O lives here, in `@internal/cli`: this is the only place\n* that legitimately combines config loading, stack assembly, and\n* on-disk persistence. `@internal/migration-tools` owns the pure\n* conversion from a `Migration` instance to artifact strings; `Migration`\n* stays a pure abstract class.\n*\n* Parser library: clipanion (chosen over Commander/citty/`node:util.parseArgs`\n* for its in-process testability and runtime-agnostic execution surface; see\n* `docs/architecture docs/research/commander-friction-points.md` for the\n* evaluation rubric and the durable rationale that drove the choice).\n*/\n/**\n* Flags exposed by the migration-file CLI.\n*\n* Must stay in sync with the `Option` declarations on\n* `MigrationFileCommand` below. This list is rendered in the\n* `errorMigrationCliUnknownFlag` envelope's `fix` text and `meta`,\n* so order matters for user-visible output (declaration order is the\n* order users see when they run `--help`).\n*/\nconst KNOWN_FLAGS = [\n\t\"--help\",\n\t\"--dry-run\",\n\t\"--config\"\n];\n/**\n* The clipanion command that owns the migration-file CLI's option\n* declarations. The class is internal — `MigrationCLI.run` is the\n* stable public surface. Adding a flag here automatically updates\n* `--help` rendering and the `KNOWN_FLAGS` list (the latter must be\n* updated in tandem).\n*/\nvar MigrationFileCommand = class extends Command {\n\tstatic paths = [Command.Default];\n\tstatic usage = Command.Usage({\n\t\tdescription: \"Self-emit ops.json and migration.json from a class-flow migration\",\n\t\tdetails: `\n Loads the project's prisma.config.ts, assembles a ControlStack\n from the configured target/adapter/extensions, and serializes the\n migration's operations + metadata next to this file.\n `,\n\t\texamples: [\n\t\t\t[\"Self-emit ops.json + migration.json next to migration.ts\", \"$0\"],\n\t\t\t[\"Preview without writing files\", \"$0 --dry-run\"],\n\t\t\t[\"Use a non-default config path\", \"$0 --config ./custom.config.ts\"]\n\t\t]\n\t});\n\tdryRun = Option.Boolean(\"--dry-run\", false, { description: \"Print operations to stdout without writing files\" });\n\tconfig = Option.String(\"--config\", { description: \"Path to prisma.config.ts\" });\n\t/**\n\t* Unused: orchestration runs inside `MigrationCLI.run` so error\n\t* routing stays under our control (clipanion's `cli.run` writes\n\t* error output to `context.stdout`, but our contract requires\n\t* structured errors on stderr). `cli.process` is used to parse\n\t* argv into a populated `MigrationFileCommand` instance whose\n\t* fields drive the orchestration directly.\n\t*/\n\tasync execute() {\n\t\treturn 0;\n\t}\n};\n/**\n* The CLI surface invoked by an authored `migration.ts` file. Exposed as\n* a class with a static `run` method (rather than a free function) to\n* give the concept a stable identity in the ubiquitous language: this is\n* the \"migration-file CLI\", distinct from the apply-time runner that\n* executes migration JSON ops.\n*\n* Currently a single static method. Future surface (e.g. a programmatic\n* `MigrationCLI.serializeOnly(...)` for tests, or extra subcommands) can\n* land here without changing the import shape used by every authored\n* migration.\n*/\nvar MigrationCLI = class {\n\t/**\n\t* Orchestrates a class-flow `migration.ts` script run.\n\t*\n\t* The third argument is the in-process testability surface: callers\n\t* (and tests) may inject `argv`, `stdout`, and `stderr` instead of\n\t* relying on `process.argv` / `process.stdout` / `process.stderr`.\n\t* Each option defaults to its `process` global when omitted, so\n\t* existing two-argument call sites\n\t* (`MigrationCLI.run(import.meta.url, MyMigration)`) continue to\n\t* compile and behave identically.\n\t*\n\t* Returns the exit code so the caller can branch on it. Also writes\n\t* the same code to `process.exitCode` so script-style callers that\n\t* don't await the return value still surface a non-zero exit when\n\t* something fails.\n\t*\n\t* Exit codes:\n\t* - 0 — success, or `--help`, or imported-not-entrypoint no-op.\n\t* - 1 — runtime/orchestration error (config not found, target\n\t* mismatch, etc.).\n\t* - 2 — usage error (unknown flag, malformed `--config`). Aligns\n\t* with `docs/CLI Style Guide.md` § Exit Codes.\n\t*/\n\tstatic async run(importMetaUrl, MigrationClass, options = {}) {\n\t\tif (!importMetaUrl) return 0;\n\t\tconst argv = options.argv ?? process.argv;\n\t\tconst stdout = options.stdout ?? process.stdout;\n\t\tconst stderr = options.stderr ?? process.stderr;\n\t\tif (!isDirectEntrypoint(importMetaUrl, argv)) return 0;\n\t\tconst exitCode = await orchestrate(importMetaUrl, MigrationClass, {\n\t\t\targv,\n\t\t\tstdout,\n\t\t\tstderr\n\t\t});\n\t\tif (exitCode !== 0 || !process.exitCode) process.exitCode = exitCode;\n\t\treturn exitCode;\n\t}\n};\n/**\n* Argv-aware variant of the entrypoint guard. The shared\n* `@internal/migration-tools` helper of the same name reads\n* `process.argv[1]` directly, which doesn't compose with the new\n* in-process testability surface (tests inject `argv` without mutating\n* the process global). Inlined here so the migration-file CLI's check\n* follows the injected `argv[1]` consistently.\n*/\nfunction isDirectEntrypoint(importMetaUrl, argv) {\n\tconst argv1 = argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(fileURLToPath(importMetaUrl)) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Argv-and-stream-driven orchestration body. Pulled out of the static\n* method so the entrypoint guard / process-default plumbing stays\n* separate from the parse + load + serialize steps.\n*/\nasync function orchestrate(importMetaUrl, MigrationClass, ctx) {\n\tconst cli = Cli.from([MigrationFileCommand], {\n\t\tbinaryName: \"migration.ts\",\n\t\tbinaryLabel: \"Migration file CLI\"\n\t});\n\tconst input = ctx.argv.slice(2);\n\tconst configError = detectInvalidConfig(input);\n\tif (configError) {\n\t\twriteStructuredError(ctx.stderr, configError);\n\t\treturn 2;\n\t}\n\tlet parsed;\n\ttry {\n\t\tconst command = cli.process({\n\t\t\tinput: [...input],\n\t\t\tcontext: {\n\t\t\t\tstdout: ctx.stdout,\n\t\t\t\tstderr: ctx.stderr\n\t\t\t}\n\t\t});\n\t\tif (!(command instanceof MigrationFileCommand)) {\n\t\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\t\treturn 0;\n\t\t}\n\t\tparsed = command;\n\t} catch (err) {\n\t\treturn renderParseError(err, input, ctx.stderr);\n\t}\n\tif (parsed.help) {\n\t\tctx.stdout.write(cli.usage(MigrationFileCommand, { detailed: true }));\n\t\treturn 0;\n\t}\n\ttry {\n\t\tawait runMigration(importMetaUrl, MigrationClass, parsed, ctx);\n\t\treturn 0;\n\t} catch (err) {\n\t\tif (isStructuredError(err)) writeStructuredError(ctx.stderr, errorFromCaught(err, (message) => message));\n\t\telse ctx.stderr.write(`${err instanceof Error ? err.message : String(err)}\\n`);\n\t\treturn 1;\n\t}\n}\n/**\n* Returns an `errorMigrationCliInvalidConfigArg` envelope when `input`\n* contains a malformed `--config`:\n*\n* - `--config` as the last token (no value follows).\n* - `--config <flag>` where `<flag>` starts with `-` (silently\n* consuming the next flag would either drop the flag or serialize\n* against the wrong project).\n* - `--config <empty>` where the value is the empty string. Shells\n* expand `--config \"\"` (or `--config \"$UNSET_VAR\"`) into a real\n* empty argv token; treating that as a usage error here surfaces\n* `CLI.CONFIG_ARG_MISSING_PATH` instead of a less actionable loader error on an\n* empty path.\n* - `--config=` (the equals form with an empty value). Same shape as\n* the empty-string case above; the user expressed intent to override\n* the config path but the override is empty.\n*\n* `--config=<value>` and `--config <value>` with a non-empty value are\n* both valid (and the equals form's value is allowed to start with\n* `-` — the `=` makes the binding explicit).\n*/\nfunction detectInvalidConfig(input) {\n\tfor (let i = 0; i < input.length; i++) {\n\t\tconst token = input[i];\n\t\tif (token === \"--config\") {\n\t\t\tconst next = input[i + 1];\n\t\t\tif (next === void 0 || next === \"\") return errorMigrationCliInvalidConfigArg();\n\t\t\tif (next.startsWith(\"-\")) return errorMigrationCliInvalidConfigArg({ nextToken: next });\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--config=\") return errorMigrationCliInvalidConfigArg();\n\t}\n\treturn null;\n}\n/**\n* Translate clipanion's parse-time errors into the project's structured\n* error envelopes.\n*\n* - `UnknownSyntaxError` covers both unknown flags (`--frobnicate`) and\n* the bare-trailing `--config` case (where arity-1 needs a value but\n* none was supplied). Distinguished by inspecting the input array.\n* - `UsageError` covers schema/validator failures from typanion. None\n* of the migration-file CLI's options have validators today, but we\n* still translate it as a usage error (exit 2) for forward-compat.\n* - Anything else re-throws — caller's outer catch will surface it as\n* exit 1 (runtime error).\n*/\nfunction renderParseError(err, input, stderr) {\n\tif (isUnknownSyntaxError(err)) {\n\t\twriteStructuredError(stderr, errorMigrationCliUnknownFlag({\n\t\t\tflag: findOffendingFlag(input),\n\t\t\tknownFlags: KNOWN_FLAGS\n\t\t}));\n\t\treturn 2;\n\t}\n\tif (err instanceof UsageError) {\n\t\twriteStructuredError(stderr, errorMigrationCliInvalidConfigArg({ nextToken: err.message }));\n\t\treturn 2;\n\t}\n\tthrow err;\n}\n/**\n* Duck-type check for clipanion's `UnknownSyntaxError`: the class is\n* thrown by the parser but is not re-exported from the package's main\n* entry (only `UsageError` is — see clipanion's `advanced/index.d.ts`).\n* Identified by `name === 'UnknownSyntaxError'` and the\n* `clipanion.type === 'none'` discriminator that clipanion's\n* `ErrorWithMeta` interface guarantees.\n*/\nfunction isUnknownSyntaxError(err) {\n\tif (!(err instanceof Error) || err.name !== \"UnknownSyntaxError\") return false;\n\tconst meta = err.clipanion;\n\treturn typeof meta === \"object\" && meta !== null && meta.type === \"none\";\n}\n/**\n* Best-effort: pull the first input token that doesn't match a known\n* flag. Falls back to the first token when we can't pinpoint it. The\n* returned name is rendered into the user-visible CLI.UNKNOWN_FLAG envelope\n* (`Unknown flag \\`<name>\\``) and round-tripped via `meta.flag` so\n* agent consumers can render their own \"did you mean\" suggestions.\n*/\nfunction findOffendingFlag(input) {\n\tfor (const token of input) {\n\t\tif (!token.startsWith(\"-\")) continue;\n\t\tconst head = token.split(\"=\", 1)[0] ?? token;\n\t\tif (!KNOWN_FLAGS.includes(head) && head !== \"-h\") return head;\n\t}\n\treturn input[0] ?? \"\";\n}\n/**\n* Write a `CliStructuredError` envelope to the given stream. Format\n* matches the legacy hand-rolled writer (`message: why`) so the rest of\n* the project's error rendering stays consistent across surfaces. The\n* full PN code (`PN-<domain>-<code>`) is included so consumers can\n* grep for stable identifiers.\n*/\nfunction writeStructuredError(stream, err) {\n\tconst envelope = err.toEnvelope();\n\tconst why = envelope.why ?? envelope.summary;\n\tconst fix = envelope.fix ? `\\n${envelope.fix}` : \"\";\n\tstream.write(`${envelope.code}: ${envelope.summary}\\n${why}${fix}\\n`);\n}\n/**\n* Read a previously-scaffolded `migration.json` from disk, returning\n* `null` when the file is missing and throwing `MIGRATION.INVALID_JSON`\n* when the file is present but cannot be parsed as JSON. The CLI feeds\n* this into `buildMigrationArtifacts` so the pure builder can preserve\n* fields owned by `migration plan` (contract bookends, `createdAt`) across\n* re-emits.\n*\n* Author-time path: this loader still does not verify the manifest hash\n* or schema — that is the apply-time loader's job. Hash mismatch is the\n* *expected* outcome of a re-author (the developer's source changes\n* invalidate the prior hash by construction), and verification here\n* would block legitimate regenerations. Syntactic JSON-parse failure,\n* however, is now surfaced rather than swallowed: a malformed\n* `migration.json` indicates either a hand-edit gone wrong or partial\n* write, and silently rebuilding from `describe()` would discard the\n* user's on-disk content (preserved bookends, `createdAt`) without any\n* indication something was wrong on disk.\n* Apply-time consumers always route through the verifying\n* `readMigrationPackage` in `@internal/migration-tools/io` instead.\n*/\nfunction readExistingMetadata(metadataPath) {\n\tlet raw;\n\ttry {\n\t\traw = readFileSync(metadataPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\ttry {\n\t\treturn JSON.parse(raw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(metadataPath, e instanceof Error ? e.message : String(e));\n\t}\n}\n/**\n* Persist a migration instance's artifacts to `migrationDir`. In\n* `dryRun` mode the artifacts are printed to stdout (with the same\n* `--- migration.json --- / --- ops.json ---` framing the legacy\n* `serializeMigration` helper used) and no files are written. Otherwise\n* `ops.json` and `migration.json` are written next to `migration.ts` and\n* a confirmation line is printed.\n*\n* File I/O lives in the CLI rather than `@internal/migration-tools`\n* so the migration-tools package stays focused on the pure\n* `Migration` → in-memory artifact conversion. The CLI is the only\n* legitimate site for combining config loading, stack assembly, and\n* filesystem persistence.\n*/\nasync function serializeMigrationToDisk(instance, migrationDir, dryRun, stdout) {\n\tconst metadataPath = join(migrationDir, \"migration.json\");\n\tconst { opsJson, metadataJson } = await buildMigrationArtifacts(instance, readExistingMetadata(metadataPath));\n\tif (dryRun) {\n\t\tstdout.write(`--- migration.json ---\\n${metadataJson}\\n`);\n\t\tstdout.write(\"--- ops.json ---\\n\");\n\t\tstdout.write(`${opsJson}\\n`);\n\t\treturn;\n\t}\n\twriteFileSync(join(migrationDir, \"ops.json\"), opsJson);\n\twriteFileSync(metadataPath, metadataJson);\n\tstdout.write(`Wrote ops.json + migration.json to ${migrationDir}\\n`);\n}\n/**\n* Inner orchestration: load config, probe-construct the migration,\n* verify target, assemble the stack, construct with the stack, persist.\n*\n* Throws `CliStructuredError` for known failure modes (config not\n* found, target mismatch); the outer `orchestrate` translates those to\n* exit 1.\n*/\nasync function runMigration(importMetaUrl, MigrationClass, parsed, ctx) {\n\tconst migrationFile = fileURLToPath(importMetaUrl);\n\tconst migrationDir = dirname(migrationFile);\n\tconst configResult = await loadMigrationFileConfig({\n\t\tconfigPath: parsed.config,\n\t\tmigrationFile,\n\t\tcwd: process.cwd(),\n\t\tsections: [\n\t\t\t\"family\",\n\t\t\t\"target\",\n\t\t\t\"adapter\",\n\t\t\t\"driver\",\n\t\t\t\"extensions\"\n\t\t]\n\t});\n\tif (!configResult.ok) throw configResult.failure;\n\tconst config = configResult.value;\n\tconst probe = new MigrationClass();\n\tif (probe.targetId !== config.target.targetId) throw errorMigrationTargetMismatch({\n\t\tmigrationTargetId: probe.targetId,\n\t\tconfigTargetId: config.target.targetId\n\t});\n\tawait serializeMigrationToDisk(new MigrationClass(createControlStack(config)), migrationDir, parsed.dryRun, ctx.stdout);\n\tctx.stderr;\n}\n//#endregion\nexport { MigrationCLI };\n\n//# sourceMappingURL=migration-cli.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,eAAe,wBAAwB,SAAS;CAC/C,MAAM,EAAE,YAAY,eAAe,KAAK,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,QA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ACX,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"}
|
|
@@ -13,7 +13,7 @@ import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components
|
|
|
13
13
|
import "@prisma/cli-engine/protocol";
|
|
14
14
|
import { ContractSourceDiagnostic, ContractSourceDiagnostics, ContractSourceProvider, PrismaNextConfig } from "@prisma/orm-framework/config/config-types";
|
|
15
15
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma/orm-framework/components/authoring";
|
|
16
|
-
//#region ../../../1-framework/3-tooling/cli/dist/db-sign-
|
|
16
|
+
//#region ../../../1-framework/3-tooling/cli/dist/db-sign-D8CcCI0v.d.mts
|
|
17
17
|
//#region src/control-api/statements/statement-text.d.ts
|
|
18
18
|
/** The verbs a statement can have. */
|
|
19
19
|
type StatementVerb = 'rename' | 'delete' | 'allow' | 'convert' | 'backfill';
|
|
@@ -846,6 +846,11 @@ interface ContractEmitResult {
|
|
|
846
846
|
/** Path to the emitted contract.d.ts file */
|
|
847
847
|
readonly dts: string;
|
|
848
848
|
};
|
|
849
|
+
/** Each file or directory written under the migrations directory for a composed extension pack's space, with that space's id. Empty when nothing there changed or the contract went to an output path of its own. */
|
|
850
|
+
readonly pinnedFiles: readonly {
|
|
851
|
+
readonly spaceId: string;
|
|
852
|
+
readonly path: string;
|
|
853
|
+
}[];
|
|
849
854
|
/**
|
|
850
855
|
* Warning surfaced by `validateContractDeps` after a successful publication.
|
|
851
856
|
* Callers (CLI, Vite plugin) decide how to render this; the operation does
|
|
@@ -1059,10 +1064,18 @@ interface DbSignSpaceFailure {
|
|
|
1059
1064
|
readonly contract: MarkerHashes;
|
|
1060
1065
|
readonly schema: VerifyDatabaseSchemaResult;
|
|
1061
1066
|
}
|
|
1067
|
+
/** A space `db sign` refused because its head ref requires invariants its marker does not record; only `db migrate` can provide them. `schema` is present when the live schema does not satisfy the space's contract either. */
|
|
1068
|
+
interface DbSignSpaceMissingInvariants {
|
|
1069
|
+
readonly space: string;
|
|
1070
|
+
readonly status: 'missing-invariants';
|
|
1071
|
+
readonly contract: MarkerHashes;
|
|
1072
|
+
readonly missingInvariants: readonly string[];
|
|
1073
|
+
readonly schema?: VerifyDatabaseSchemaResult;
|
|
1074
|
+
}
|
|
1062
1075
|
/**
|
|
1063
|
-
* What `db sign` did with one contract space: what the family's signing did to its marker ({@link SpaceSignature}),
|
|
1076
|
+
* What `db sign` did with one contract space: what the family's signing did to its marker ({@link SpaceSignature}), `failed` when the live schema does not satisfy the space's contract, or `missing-invariants` when its marker lacks invariants its head ref requires.
|
|
1064
1077
|
*/
|
|
1065
|
-
type DbSignSpaceOutcome = SpaceSignature | DbSignSpaceFailure;
|
|
1078
|
+
type DbSignSpaceOutcome = SpaceSignature | DbSignSpaceFailure | DbSignSpaceMissingInvariants;
|
|
1066
1079
|
interface ExecuteDbSignSuccess {
|
|
1067
1080
|
/** The app space first, then each extension space in declaration order. */
|
|
1068
1081
|
readonly spaces: readonly DbSignSpaceOutcome[];
|
|
@@ -1074,4 +1087,4 @@ type ExecuteDbSignResult = Result<ExecuteDbSignSuccess, CliStructuredError$2>;
|
|
|
1074
1087
|
declare function executeDbSign<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbSignOptions<TFamilyId, TTargetId>): Promise<ExecuteDbSignResult>;
|
|
1075
1088
|
//#endregion
|
|
1076
1089
|
export { ExecuteDbSignOptions as A, PlannerWarningsListener as B, DbUpdateSuccess as C, EmitOptions as D, EmitFailureCode as E, MigrateResult as F, RenderContractDtsSuccess as G, RenderContractDtsFailureCode as H, OnControlProgress as I, StatementVerb as J, SchemaVerifyOptions as K, PlanAnswer as L, ExecuteDbVerifyOptions as M, ExecuteDbVerifyResult as N, EmitResult as O, IntrospectOptions as P, executeDbVerify as Q, PlanQuestion as R, DbUpdateResult as S, EmitFailure as T, RenderContractDtsOptions as U, RenderContractDtsFailure as V, RenderContractDtsResult as W, VerifyOptions as X, TemporaryValueReport as Y, executeDbSign as Z, DbInitSuccess as _, ChangedStorageEntity as a, DbSignSpaceOutcome as b, ContractEmitOptions as c, ControlClient as d, ControlClientOptions as f, DbInitResult as g, DbInitOptions as h, AskedSubject as i, ExecuteDbSignResult as j, EmitSuccess as k, ContractEmitResult as l, CreateControlClient as m, AppliedStatementReport as n, CliInvocation as o, ControlProgressEvent as p, StatementText as q, AskedDataLoss as r, CliStructuredError$2 as s, AnswerPlanQuestions as t, ControlActionName as u, DbSignOptions as v, EmitContractConfig as w, DbUpdateOptions as x, DbSignSpaceFailure as y, PlanQuestionVerb as z };
|
|
1077
|
-
//# sourceMappingURL=db-sign-
|
|
1090
|
+
//# sourceMappingURL=db-sign-D8CcCI0v-Cda_1dSK.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-sign-
|
|
1
|
+
{"version":3,"file":"db-sign-D8CcCI0v-Cda_1dSK.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/cli/dist/db-sign-D8CcCI0v.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;KAiBK;;;;;;UAMK;WACC,MAAM;WACN;;;;;;;;UAQD;WACC;WACA;WACA;;WAEA;;WAEA;;;;;KAKN,uBAAuB,KAAK;WACtB;;;;;;;;;;;;;UAaD,uBAAuB,0BAA0B;WAChD,QAAQ,sBAAsB,WAAW;WACzC,gBAAgB,sBAAsB;WACtC,UAAU;WACV;WACA,UAAU;WACV,YAAY,cAAc,2BAA2B,WAAW;WAChE,qBAAqB,cAAc,+BAA+B,WAAW;WAC7E;WACA;WACA;;WAEA,wBAAwB;WACxB,aAAa;;;;;;;;;;;;;;UAcd;WACC,eAAe,oBAAoB;;;;;;WAMnC;WACA;WACA;;;;;;;;WAQA,aAAa;;KAEnB,wBAAwB,OAAO,wBAAwB;;;;;;;;;;;;;;;;;iBAiB3C,gBAAgB,0BAA0B,0BAA0B,SAAS,uBAAuB,WAAW,aAAa,QAAQ;;;;;;;UAO3I;;WAEC;;;;;;WAMA,yBAAyB;;UAE1B;;WAEC;;KAEN;UACK;WACC,MAAM;WACN;WACA;;WAEA;;KAEN,0BAA0B,OAAO,0BAA0B;;;;KAI3D;;;;KAIA,0CAA0C;;;;;UAKrC;WACC;WACA;;WAEA;WACA,gBAAgB;WAChB;aACE;aACA;;WAEF,WAAW,MAAM,kBAAkB;;;;;WAKnC,mBAAmB,MAAM,kBAAkB,iBAAiB;;WAE5D;;;KAGN;UACK;WACC,MAAM;WACN;;;;;;;;;KASN,uBAAuB,oBAAoB,mBAAmB,kBAAkB;;;;UAI3E;WACC,MAAM;WACN,SAAS;;;;;;KAMf;WACM,MAAM;WACN,WAAW;WACX;;WAEA;;WAEA,MAAM;WACN,WAAW;WACX;;WAEA;;;;;UAKD;WACC;;WAEA;;;;;;;;;;;;;;;UAeD;WACC,QAAQ;WACR,QAAQ;WAC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;;EAc5C,SAAS,SAAS,kBAAkB,QAAQ;;;;;;;EAO5C,OAAO,SAAS,gBAAgB,QAAQ;;;;;;;EAOxC,cAAc,QAAQ;;;;;;EAMtB,kBAAkB,QAAQ,oBAAoB;;;;;;EAM9C,WAAW,iBAAiB,iBAAiB;;;;;;;;;;;;;;EAc7C,QAAQ,SAAS,iBAAiB,QAAQ;;;;;;;EAO1C,WAAW,UAAU,oBAAoB;;;;;;;;EAQzC,aAAa,oBAAoB;;;;;;;;EAQjC,iBAAiB,oBAAoB,QAAQ;;;;;;;;EAQ7C,0BAA0B;;;;;;;;;EAS1B,mBAAmB,qBAAqB,2BAA2B;;;;;;;;EAQnE,KAAK,SAAS,cAAc,QAAQ;;;;;;;;EAQpC,kBAAkB,SAAS,2BAA2B,QAAQ;;;;UAItD,qBAAqB,0BAA0B;WAC9C,QAAQ,sBAAsB,WAAW;WACzC,gBAAgB,sBAAsB;;WAEtC,UAAU;WACV;WACA,UAAU;WACV,YAAY,cAAc,2BAA2B,WAAW;WAChE,qBAAqB,cAAc,+BAA+B,WAAW;WAC7E,wBAAwB;WACxB,aAAa;;;UAGd;WACC;WACA;WACA,UAAU;WACV,QAAQ;;;UAGT;WACC;WACA;WACA,UAAU;WACV;WACA,SAAS;;;;;KAKf,qBAAqB,iBAAiB,qBAAqB;UACtD;;WAEC,iBAAiB;;KAEvB,sBAAsB,OAAO,sBAAsB;;;;iBAIvC,cAAc,0BAA0B,0BAA0B,SAAS,qBAAqB,WAAW,aAAa,QAAQ"}
|
|
@@ -21,5 +21,5 @@ import { n as isGraphNode, r as isInSpaceHistory, t as assertHashIsGraphNode } f
|
|
|
21
21
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-Dkcn8Qu4.mjs";
|
|
22
22
|
import { t as ledgerOriginFromStored } from "./ledger-origin-BGRN77Oy.mjs";
|
|
23
23
|
import { a as shebangLineFor, i as hasMigrationTs, n as detectScaffoldRuntime, o as writeMigrationTs, r as formatMigrationTs, t as ScaffoldRuntime } from "./migration-ts-SGer0PXq.mjs";
|
|
24
|
-
import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-
|
|
24
|
+
import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-Dsp9mRpJ.mjs";
|
|
25
25
|
export { APP_SPACE_ID, type AggregateContractSpace, type AggregateCurrentDBState, type AggregateMigrationEdgeRef, type AppSpacePlanningInputs, type CallerPolicy, type ComputeExtensionSpaceApplyPathInputs, type ContractAtOptions, type ContractAtResult, type ContractMarkerRecordLike, type ContractRef, type ContractRefProvenance, type ContractSnapshotInput, type ContractSpaceAggregate, type ContractSpaceArtifactInputs, type ContractSpaceHeadRecord, type ContractSpaceHeadRef, type DeclaredExtensionEntry, type DescriptorSelfConsistencyInputs, type DiskContractSpaceState, EMPTY_CONTRACT_HASH, EMPTY_CONTRACT_REF, type ExtensionSpaceApplyPathOutcome, HEAD_REF_NAME, type IntegrityComputationInput, type IntegrityQueryOptions, type IntegritySpaceState, type IntegrityViolation, LIVE_MARKER_REF, type LoadAggregateInput, type MarkerCheckResult, type MarkerCheckSection, Migration, type MigrationArtifacts, MigrationContractViews, type MigrationEdge, type MigrationGraph, type MigrationMeta, type MigrationMetadata$1 as MigrationMetadata, type MigrationOps, type MigrationPackage, type MigrationRef, type MigrationRefProvenance, MigrationToolsError, type NoInvariantPathExtensionSpace, type NoInvariantPathStructuralEdge, type OnDiskMigrationPackage, type PackageLoadProblem, type PathDecision, type PerSpacePlan, type PlannerError, type PlannerInput, type PlannerOutput, type PlannerSuccess, RESERVED_CONTRACT_REFS, RESERVED_SPACE_SUBDIR_NAMES, type ReadMigrationsDirResult, type RefEntry, type RefResolutionAmbiguous, type RefResolutionContext, type RefResolutionError, type RefResolutionInvalidFormat, type RefResolutionNotFound, type RefResolutionWrongGrammar, type Refs, type ResolveRecordedPathInputs, type ResolveRecordedPathOutcome, SPACE_REFS_DIRNAME, type ScaffoldRuntime, type SchemaCheckSection, type SnapshotCanonicalizationHooks, type SnapshotContentVerifier, type SpaceApplyInput, type SpaceMarkerRecord, type SpacePlanInput, type SpacePlanOutput, type SpaceVerifierViolation, type ValidSpaceId, type VerifierError, type VerifierInput, type VerifierOutput, type VerifierSuccess, type VerifyContractSpacesInputs, type VerifyContractSpacesResult, type VerifyResult, WORKING_CONTRACT_REF, allStorageElementsExternal, assertDescriptorSelfConsistency, assertHashIsGraphNode, assertValidSpaceId, buildFabricatedMigrationEdge, buildMigrationArtifacts, collectAggregateNamespaces, computeExtensionSpaceApplyPath, computeIntegrityViolations, computeMigrationHash, contractHashAtMarker, contractSnapshotDir, contractSpaceFromJson, copyFilesWithRename, createAggregateContractSpace, createContractSpaceAggregate, createSnapshotContentVerifier, deleteRef, deriveProvidedInvariants, detectCycles, detectOrphans, detectScaffoldRuntime, emitContractSpaceArtifacts, errorContractDeserializationFailed, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant, findEdgeByDirName, findPath, findPathWithDecision, findPathWithInvariants, formatMigrationDirName, formatMigrationTs, gatherDiskContractSpaceState, hasMigrationTs, isDirectEntrypoint, isGraphNode, isInSpaceHistory, isLiveMarkerRef, isReservedContractRef, isValidSpaceId, ledgerOriginFromStored, listContractSpaceDirectories, loadContractSpaceAggregate, loadProblemToViolation, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, parseContractRef, parseMigrationRef, planAllSpaces, planMigration, readContractSnapshotJson, readContractSnapshotJsonTolerant, readContractSpaceHeadRef, readMigrationPackage, readMigrationsDir, readRef, readRefs, reconstructGraph, refsByContractHash, requireHeadRef, resolveRecordedPath, resolveRef, resolveRefsByContractHash, shebangLineFor, snapshotsImportPathFrom, spaceMigrationDirectory, spaceRefsDirectory, spacesInApplyOrder, validateInvariantId, validateRefName, validateRefValue, verifyContractSpaces, verifyMigration, verifyMigrationHash, writeContractSnapshot, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage, writeMigrationTs, writeRef };
|
package/dist/migration-tools.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invar
|
|
|
6
6
|
import { a as materialiseMigrationPackage, c as writeMigrationMetadata, i as materialiseExtensionMigrationPackageIfMissing, l as writeMigrationOps, n as copyFilesWithRename, o as readMigrationPackage, r as formatMigrationDirName, s as readMigrationsDir, u as writeMigrationPackage } from "./io-BNxFm3eg-DYD82QeZ.mjs";
|
|
7
7
|
import { a as findPathWithInvariants, i as findPathWithDecision, n as detectOrphans, o as reconstructGraph, r as findPath, t as detectCycles } from "./migration-graph-BoiiZAaU-DLht12k7.mjs";
|
|
8
8
|
import { a as isValidSpaceId, c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, n as RESERVED_SPACE_SUBDIR_NAMES, o as listContractSpaceDirectories, r as SPACE_REFS_DIRNAME, s as readContractSpaceHeadRef, t as APP_SPACE_ID, u as verifyContractSpaces } from "./verify-contract-spaces-B12R3P5U-CfBKlBjj.mjs";
|
|
9
|
-
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-
|
|
9
|
+
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-CW5yVjgx.mjs";
|
|
10
10
|
import { n as isGraphNode, r as isInSpaceHistory, t as assertHashIsGraphNode } from "./graph-membership-DxpNgxfZ-BfqA-H7V.mjs";
|
|
11
11
|
import { c as resolveRefsByContractHash, d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, r as readRef, s as resolveRef, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-DM3q3IZC-BC6H6P0X.mjs";
|
|
12
12
|
import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, i as computeIntegrityViolations, l as loadProblemToViolation, m as verifyMigration, n as buildFabricatedMigrationEdge, o as createAggregateContractSpace, p as spacesInApplyOrder, r as collectAggregateNamespaces, s as createContractSpaceAggregate, t as allStorageElementsExternal, u as planMigration } from "./aggregate-DS_usja4.mjs";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as VerifyContractSpacesResult, i as VerifyContractSpacesInputs, n as SpaceMarkerRecord, o as listContractSpaceDirectories, r as SpaceVerifierViolation, s as verifyContractSpaces, t as ContractSpaceHeadRecord } from "./verify-contract-spaces-DHD3C7sU-DA28bANE.mjs";
|
|
2
|
-
import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-
|
|
2
|
+
import { C as spaceMigrationDirectory, S as readContractSpaceHeadRef, _ as contractSpaceFromJson, a as DescriptorSelfConsistencyInputs, b as isValidSpaceId, c as RESERVED_SPACE_SUBDIR_NAMES, d as SpacePlanInput, f as SpacePlanOutput, g as computeExtensionSpaceApplyPath, h as assertValidSpaceId, i as ContractSpaceHeadRef, l as SPACE_REFS_DIRNAME, m as assertDescriptorSelfConsistency, n as ComputeExtensionSpaceApplyPathInputs, o as DiskContractSpaceState, p as ValidSpaceId, r as ContractSpaceArtifactInputs, s as ExtensionSpaceApplyPathOutcome, t as APP_SPACE_ID, u as SpaceApplyInput, v as emitContractSpaceArtifacts, w as spaceRefsDirectory, x as planAllSpaces, y as gatherDiskContractSpaceState } from "./spaces-Dsp9mRpJ.mjs";
|
|
3
3
|
export { APP_SPACE_ID, type ComputeExtensionSpaceApplyPathInputs, type ContractSpaceArtifactInputs, type ContractSpaceHeadRecord, type ContractSpaceHeadRef, type DescriptorSelfConsistencyInputs, type DiskContractSpaceState, type ExtensionSpaceApplyPathOutcome, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, type SpaceApplyInput, type SpaceMarkerRecord, type SpacePlanInput, type SpacePlanOutput, type SpaceVerifierViolation, type ValidSpaceId, type VerifyContractSpacesInputs, type VerifyContractSpacesResult, assertDescriptorSelfConsistency, assertValidSpaceId, computeExtensionSpaceApplyPath, contractSpaceFromJson, emitContractSpaceArtifacts, gatherDiskContractSpaceState, isValidSpaceId, listContractSpaceDirectories, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory, spaceRefsDirectory, verifyContractSpaces };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as isValidSpaceId, c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, n as RESERVED_SPACE_SUBDIR_NAMES, o as listContractSpaceDirectories, r as SPACE_REFS_DIRNAME, s as readContractSpaceHeadRef, t as APP_SPACE_ID, u as verifyContractSpaces } from "./verify-contract-spaces-B12R3P5U-CfBKlBjj.mjs";
|
|
2
|
-
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-
|
|
2
|
+
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-CW5yVjgx.mjs";
|
|
3
3
|
export { APP_SPACE_ID, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, assertDescriptorSelfConsistency, assertValidSpaceId, computeExtensionSpaceApplyPath, contractSpaceFromJson, emitContractSpaceArtifacts, gatherDiskContractSpaceState, isValidSpaceId, listContractSpaceDirectories, planAllSpaces, readContractSpaceHeadRef, spaceMigrationDirectory, spaceRefsDirectory, verifyContractSpaces };
|