@prisma/orm-toolchain 8.0.0-rc.3-dev.7 → 8.0.0-rc.3-dev.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{aggregate-CPZB020V.mjs → aggregate-BOlLu7k7.mjs} +8 -8
- package/dist/{aggregate-CPZB020V.mjs.map → aggregate-BOlLu7k7.mjs.map} +1 -1
- package/dist/cli-telemetry.d.mts +2 -2
- package/dist/cli-telemetry.mjs +9 -12
- package/dist/cli-telemetry.mjs.map +1 -1
- package/dist/cli.d.mts +1 -5
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +117 -58
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +3 -3
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__control-api__testing.d.mts +1 -1
- package/dist/cli__migration-cli.mjs +5 -5
- 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/{contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs → contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs} +3 -3
- package/dist/{contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs.map → contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs.map} +1 -1
- package/dist/{db-verify-BwgNK50T-DGvKgFCK.d.mts → db-verify-BRDzImLV-3eI346zy.d.mts} +3 -3
- package/dist/{db-verify-BwgNK50T-DGvKgFCK.d.mts.map → db-verify-BRDzImLV-3eI346zy.d.mts.map} +1 -1
- package/dist/emitter.mjs +1 -1
- package/dist/{errors-CXbGUWGu-CstQHPh6.mjs → errors-CcEpbfnE-CsSXrttT.mjs} +6 -6
- package/dist/errors-CcEpbfnE-CsSXrttT.mjs.map +1 -0
- package/dist/{exports-DLDFkjNv.mjs → exports-CN1Qe98l.mjs} +3 -3
- package/dist/{exports-DLDFkjNv.mjs.map → exports-CN1Qe98l.mjs.map} +1 -1
- package/dist/{exports-UjssmDwy.mjs → exports-Cv8nMmBT.mjs} +15 -51
- package/dist/exports-Cv8nMmBT.mjs.map +1 -0
- package/dist/{exports-BCLg4CiV-05kuwcb0.mjs → exports-Dw2WIX63-CQgI2e_L.mjs} +6 -6
- package/dist/exports-Dw2WIX63-CQgI2e_L.mjs.map +1 -0
- package/dist/{graph-membership-BViWUMpP-C4lYYJdU.mjs → graph-membership-BoITerZB-C2-x1Qp6.mjs} +3 -3
- package/dist/{graph-membership-BViWUMpP-C4lYYJdU.mjs.map → graph-membership-BoITerZB-C2-x1Qp6.mjs.map} +1 -1
- package/dist/{import-roots-CfoYgejL.d.mts → import-roots-ARK1wjzc.d.mts} +3 -3
- package/dist/{import-roots-CfoYgejL.d.mts.map → import-roots-ARK1wjzc.d.mts.map} +1 -1
- package/dist/{import-roots-CNFBPAT1.mjs → import-roots-D0H8HuRw.mjs} +3 -3
- package/dist/import-roots-D0H8HuRw.mjs.map +1 -0
- package/dist/{index-BRjNSwL-.d.mts → index-u5RdrumF.d.mts} +2 -10
- package/dist/index-u5RdrumF.d.mts.map +1 -0
- package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs → invariants-DcFfhJMZ-BHDWZP9k.mjs} +3 -3
- package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs.map → invariants-DcFfhJMZ-BHDWZP9k.mjs.map} +1 -1
- package/dist/{io-635GlNx1-D3zrw2qu.mjs → io-DsViRB_O-Ci1kJGBg.mjs} +5 -5
- package/dist/{io-635GlNx1-D3zrw2qu.mjs.map → io-DsViRB_O-Ci1kJGBg.mjs.map} +1 -1
- package/dist/{migration-BB4LDjuS.mjs → migration-CWSj4pMr.mjs} +3 -3
- package/dist/{migration-BB4LDjuS.mjs.map → migration-CWSj4pMr.mjs.map} +1 -1
- package/dist/{migration-graph-_SJImD5V-BURyY1KM.mjs → migration-graph-DwXAHP6T-NgmP2DNz.mjs} +3 -3
- package/dist/{migration-graph-_SJImD5V-BURyY1KM.mjs.map → migration-graph-DwXAHP6T-NgmP2DNz.mjs.map} +1 -1
- package/dist/migration-tools.d.mts +1 -1
- package/dist/migration-tools.mjs +12 -12
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
- package/dist/migration-tools__errors.mjs +1 -1
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.mjs +2 -2
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.d.mts +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/publish-surface.d.mts +1 -1
- package/dist/publish-surface.mjs +1 -1
- package/dist/publish-surface__import-roots.d.mts +1 -1
- package/dist/publish-surface__import-roots.mjs +1 -1
- package/dist/quick-reference-postgres.md +1 -1
- package/dist/{ref-BSRf-7Uh-JmET-ptm.mjs → ref-dWFulULw-TMeX1ZM1.mjs} +16 -16
- package/dist/ref-dWFulULw-TMeX1ZM1.mjs.map +1 -0
- package/dist/{ref-resolution-HeNBXW53.mjs → ref-resolution-Cbdejrwt.mjs} +2 -2
- package/dist/{ref-resolution-HeNBXW53.mjs.map → ref-resolution-Cbdejrwt.mjs.map} +1 -1
- package/dist/{refs-WK86uYYp-gM8tvWQP.mjs → refs-KVVlm3lE-BcqdpdYD.mjs} +6 -6
- package/dist/refs-KVVlm3lE-BcqdpdYD.mjs.map +1 -0
- package/dist/{spaces-Dj65JrwZ.d.mts → spaces-B20bgxF9.d.mts} +2 -2
- package/dist/{spaces-Dj65JrwZ.d.mts.map → spaces-B20bgxF9.d.mts.map} +1 -1
- package/dist/{spaces-4qMOAYE9.mjs → spaces-CHrjWRoZ.mjs} +7 -7
- package/dist/spaces-CHrjWRoZ.mjs.map +1 -0
- package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs → verify-contract-spaces-DomK5uP5-CyI3hD3Q.mjs} +7 -7
- package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs.map → verify-contract-spaces-DomK5uP5-CyI3hD3Q.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +3 -3
- package/package.json +12 -12
- package/dist/errors-CXbGUWGu-CstQHPh6.mjs.map +0 -1
- package/dist/exports-BCLg4CiV-05kuwcb0.mjs.map +0 -1
- package/dist/exports-UjssmDwy.mjs.map +0 -1
- package/dist/import-roots-CNFBPAT1.mjs.map +0 -1
- package/dist/index-BRjNSwL-.d.mts.map +0 -1
- package/dist/ref-BSRf-7Uh-JmET-ptm.mjs.map +0 -1
- package/dist/refs-WK86uYYp-gM8tvWQP.mjs.map +0 -1
- package/dist/spaces-4qMOAYE9.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-BB4LDjuS.mjs","names":["#endView","#startView"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/migration.mjs"],"sourcesContent":["import { A as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from \"../errors-CXbGUWGu.mjs\";\nimport { t as computeMigrationHash } from \"../hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"../invariants-CTHy88OP.mjs\";\nimport { t as MigrationOpSchema } from \"../op-schema-BSVHzEQN.mjs\";\nimport { type } from \"arktype\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n//#region src/migration-base.ts\nconst MigrationMetaSchema = type({\n\tfrom: \"string > 0 | null\",\n\tto: \"string\"\n});\n/**\n* Base class for migrations.\n*\n* A `Migration` subclass is itself a `MigrationPlan`: CLI commands and the\n* runner can consume it directly via `targetId`, `operations`, `origin`, and\n* `destination`.\n*\n* The from/to identities come from `describe()`. A migration provides them in\n* one of two ways:\n* - **Contract-derived (default):** assign the `contract.json` imports from\n* the snapshot store (`migrations/snapshots/<hex>/contract.json`) to\n* `startContractJson` / `endContractJson`; the concrete `describe()` below\n* derives `to`/`from` from their\n* `storage.storageHash`. The family bases additionally expose typed view\n* getters (`startContract` / `endContract`) over the same JSON.\n* - **Override (e.g. extension migrations that carry no contract):** override\n* `describe()` directly; the override wins and the JSON fields are unused.\n*\n* The `Start` / `End` generics carry each migration's precise contract types so\n* the family-base view getters resolve to fully-typed views.\n*/\nvar Migration = class {\n\t/**\n\t* The migration's end-state contract JSON (the `contract.json` import from\n\t* the snapshot store). When set, the derived `describe()` reads `to` from its\n\t* `storage.storageHash`. Family bases build the typed `endContract` view from\n\t* it. Optional so `describe()`-overriding migrations (no contract) compile.\n\t*\n\t* Typed with a plain `storageHash: string`, not the branded\n\t* `StorageHashBase`, so a raw `contract.json` import — whose `storageHash`\n\t* is an untyped string literal — is assignable without a cast. The full\n\t* `Start`/`End` contract typing is applied downstream in the family bases'\n\t* view getters (via `<Family>ContractView.fromJson<…>`).\n\t*/\n\tendContractJson;\n\t/**\n\t* The migration's start-state contract JSON (the `contract.json` import\n\t* from the snapshot store). Absent for a baseline migration (`from`\n\t* derives to `null`). Family bases build the typed `startContract` view from\n\t* it.\n\t*/\n\tstartContractJson;\n\t/**\n\t* Assembled `ControlStack` injected by the orchestrator (`runMigration`).\n\t*\n\t* Subclasses (e.g. `PostgresMigration`) read the stack to materialize their\n\t* adapter once per instance. Optional at the abstract level so unit tests can\n\t* construct `Migration` instances purely for `operations` / `describe`\n\t* assertions without needing a real stack; concrete subclasses that need the\n\t* stack at runtime should narrow the parameter to required.\n\t*/\n\tstack;\n\tconstructor(stack) {\n\t\tthis.stack = stack;\n\t}\n\t/**\n\t* Metadata inputs used to build `migration.json` and to derive the plan's\n\t* origin/destination identities.\n\t*\n\t* Default derivation: `to = endContractJson.storage.storageHash`,\n\t* `from = startContractJson?.storage.storageHash ?? null`. A migration that\n\t* carries no contract JSON (e.g. an extension migration) must override this;\n\t* otherwise it throws, since `migration.json` requires a `to` identity.\n\t*/\n\tdescribe() {\n\t\tconst end = this.endContractJson;\n\t\tif (end === void 0) throw errorDescribeMissingEndContract();\n\t\treturn {\n\t\t\tfrom: this.startContractJson?.storage.storageHash ?? null,\n\t\t\tto: end.storage.storageHash\n\t\t};\n\t}\n\tget origin() {\n\t\tconst from = this.describe().from;\n\t\treturn from === null ? null : { storageHash: from };\n\t}\n\tget destination() {\n\t\treturn { storageHash: this.describe().to };\n\t}\n};\n/**\n* Lazy-memoized `endContract` / `startContract` view accessors, one instance\n* held per migration. Each target base (`MongoMigration`, `SqliteMigration`,\n* `PostgresMigration`) creates one `MigrationContractViews` field from\n* `this` — passing its own `<Family>ContractView.fromJson<…>` as `fromJson`\n* and a name for error messages — and forwards its\n* `endContract`/`startContract` getters to it.\n*\n* `endContract` throws `MIGRATION.CONTRACT_VIEW_MISSING` when the migration\n* has no `endContractJson` (mirrors `describe()`'s own requirement).\n* `startContract` returns `null` for a baseline migration (no\n* `startContractJson`) instead of throwing.\n*/\nvar MigrationContractViews = class {\n\tmigration;\n\tclassName;\n\tfromJson;\n\t#endView;\n\t#startView;\n\tconstructor(migration, className, fromJson) {\n\t\tthis.migration = migration;\n\t\tthis.className = className;\n\t\tthis.fromJson = fromJson;\n\t}\n\tget endContract() {\n\t\tif (this.#endView === void 0) {\n\t\t\tconst json = this.migration.endContractJson;\n\t\t\tif (json === void 0) throw errorMigrationContractViewMissing(this.className, \"endContract\", \"endContractJson\");\n\t\t\tthis.#endView = this.fromJson(json);\n\t\t}\n\t\treturn this.#endView;\n\t}\n\tget startContract() {\n\t\tif (this.#startView === void 0) {\n\t\t\tconst json = this.migration.startContractJson;\n\t\t\tthis.#startView = json === void 0 ? null : this.fromJson(json);\n\t\t}\n\t\treturn this.#startView;\n\t}\n};\n/**\n* Returns true when `import.meta.url` resolves to the same file that was\n* invoked as the node entrypoint (`process.argv[1]`). Used by\n* `MigrationCLI.run` (in `@internal/cli/migration-cli`) to no-op when\n* the migration module is being imported (e.g. by another script) rather\n* than executed directly.\n*/\nfunction isDirectEntrypoint(importMetaUrl) {\n\tconst metaFilename = fileURLToPath(importMetaUrl);\n\tconst argv1 = process.argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(metaFilename) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Build the attested metadata from `describe()`-derived metadata, the\n* operations list, and the previously-scaffolded metadata (if any).\n*\n* When a `migration.json` already exists for this package (the common\n* case: it was scaffolded by `migration plan`), preserve `createdAt`\n* set there — that field is owned by the CLI scaffolder, not the authored\n* class. Only the `describe()`-derived fields (`from`, `to`) and the\n* operations change as the author iterates. When no metadata exists yet\n* (a bare `migration.ts` run from scratch), synthesize a minimal but\n* schema-conformant record so the resulting package can still be read,\n* verified, and applied.\n*\n* The `migrationHash` is recomputed against the current metadata + ops so\n* the on-disk artifacts are always fully attested.\n*/\nfunction buildAttestedMetadata(meta, ops, existing) {\n\tconst baseMetadata = {\n\t\tfrom: meta.from,\n\t\tto: meta.to,\n\t\tprovidedInvariants: deriveProvidedInvariants(ops),\n\t\tcreatedAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()\n\t};\n\tconst migrationHash = computeMigrationHash(baseMetadata, ops);\n\treturn {\n\t\t...baseMetadata,\n\t\tmigrationHash\n\t};\n}\n/**\n* Pure conversion from a `Migration` instance (plus the previously\n* scaffolded metadata, when one exists on disk) to the in-memory\n* artifacts that downstream tooling persists. Owns metadata validation,\n* metadata synthesis/preservation, and the content-addressed\n* `migrationHash` computation, but performs no file I/O — callers handle\n* reads (to source `existing`) and writes (to persist `opsJson` /\n* `metadataJson`).\n*/\nasync function buildMigrationArtifacts(instance, existing) {\n\tconst rawOps = instance.operations;\n\tif (!Array.isArray(rawOps)) throw errorOperationsNotArray();\n\tconst ops = await Promise.all(rawOps);\n\tfor (let index = 0; index < ops.length; index++) {\n\t\tconst result = MigrationOpSchema(ops[index]);\n\t\tif (result instanceof type.errors) throw errorInvalidOperationEntry(index, result.summary);\n\t}\n\tconst rawMeta = instance.describe();\n\tconst parsed = MigrationMetaSchema(rawMeta);\n\tif (parsed instanceof type.errors) throw errorDescribeInvalidMetadata(parsed.summary);\n\tconst metadata = buildAttestedMetadata(parsed, ops, existing);\n\treturn {\n\t\topsJson: JSON.stringify(ops, null, 2),\n\t\tmetadata,\n\t\tmetadataJson: JSON.stringify(metadata, null, 2)\n\t};\n}\n//#endregion\nexport { Migration, MigrationContractViews, buildMigrationArtifacts, isDirectEntrypoint };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;AAQA,MAAM,sBAAsB,KAAK;CAChC,MAAM;CACN,IAAI;AACL,CAAC;;;;;;;;;;;;;;;;;;;;;;AAsBD,IAAI,YAAY,MAAM;;;;;;;;;;;;;CAarB;;;;;;;CAOA;;;;;;;;;;CAUA;CACA,YAAY,OAAO;EAClB,KAAK,QAAQ;CACd;;;;;;;;;;CAUA,WAAW;EACV,MAAM,MAAM,KAAK;EACjB,IAAI,QAAQ,KAAK,GAAG,MAAM,gCAAgC;EAC1D,OAAO;GACN,MAAM,KAAK,mBAAmB,QAAQ,eAAe;GACrD,IAAI,IAAI,QAAQ;EACjB;CACD;CACA,IAAI,SAAS;EACZ,MAAM,OAAO,KAAK,SAAS,CAAC,CAAC;EAC7B,OAAO,SAAS,OAAO,OAAO,EAAE,aAAa,KAAK;CACnD;CACA,IAAI,cAAc;EACjB,OAAO,EAAE,aAAa,KAAK,SAAS,CAAC,CAAC,GAAG;CAC1C;AACD;;;;;;;;;;;;;;AAcA,IAAI,yBAAyB,MAAM;CAClC;CACA;CACA;CACA;CACA;CACA,YAAY,WAAW,WAAW,UAAU;EAC3C,KAAK,YAAY;EACjB,KAAK,YAAY;EACjB,KAAK,WAAW;CACjB;CACA,IAAI,cAAc;EACjB,IAAI,KAAKA,aAAa,KAAK,GAAG;GAC7B,MAAM,OAAO,KAAK,UAAU;GAC5B,IAAI,SAAS,KAAK,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Q,MAAM,6BAA6B,OAAO,OAAO;CACpF,MAAM,WAAW,sBAAsB,QAAQ,KAAK,QAAQ;CAC5D,OAAO;EACN,SAAS,KAAK,UAAU,KAAK,MAAM,CAAC;EACpC;EACA,cAAc,KAAK,UAAU,UAAU,MAAM,CAAC;CAC/C;AACD"}
|
|
1
|
+
{"version":3,"file":"migration-CWSj4pMr.mjs","names":["#endView","#startView"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/migration.mjs"],"sourcesContent":["import { A as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from \"../errors-CcEpbfnE.mjs\";\nimport { t as computeMigrationHash } from \"../hash-DH8hl5Rq.mjs\";\nimport { t as deriveProvidedInvariants } from \"../invariants-DcFfhJMZ.mjs\";\nimport { t as MigrationOpSchema } from \"../op-schema-BSVHzEQN.mjs\";\nimport { type } from \"arktype\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n//#region src/migration-base.ts\nconst MigrationMetaSchema = type({\n\tfrom: \"string > 0 | null\",\n\tto: \"string\"\n});\n/**\n* Base class for migrations.\n*\n* A `Migration` subclass is itself a `MigrationPlan`: CLI commands and the\n* runner can consume it directly via `targetId`, `operations`, `origin`, and\n* `destination`.\n*\n* The from/to identities come from `describe()`. A migration provides them in\n* one of two ways:\n* - **Contract-derived (default):** assign the `contract.json` imports from\n* the snapshot store (`migrations/snapshots/<hex>/contract.json`) to\n* `startContractJson` / `endContractJson`; the concrete `describe()` below\n* derives `to`/`from` from their\n* `storage.storageHash`. The family bases additionally expose typed view\n* getters (`startContract` / `endContract`) over the same JSON.\n* - **Override (e.g. extension migrations that carry no contract):** override\n* `describe()` directly; the override wins and the JSON fields are unused.\n*\n* The `Start` / `End` generics carry each migration's precise contract types so\n* the family-base view getters resolve to fully-typed views.\n*/\nvar Migration = class {\n\t/**\n\t* The migration's end-state contract JSON (the `contract.json` import from\n\t* the snapshot store). When set, the derived `describe()` reads `to` from its\n\t* `storage.storageHash`. Family bases build the typed `endContract` view from\n\t* it. Optional so `describe()`-overriding migrations (no contract) compile.\n\t*\n\t* Typed with a plain `storageHash: string`, not the branded\n\t* `StorageHashBase`, so a raw `contract.json` import — whose `storageHash`\n\t* is an untyped string literal — is assignable without a cast. The full\n\t* `Start`/`End` contract typing is applied downstream in the family bases'\n\t* view getters (via `<Family>ContractView.fromJson<…>`).\n\t*/\n\tendContractJson;\n\t/**\n\t* The migration's start-state contract JSON (the `contract.json` import\n\t* from the snapshot store). Absent for a baseline migration (`from`\n\t* derives to `null`). Family bases build the typed `startContract` view from\n\t* it.\n\t*/\n\tstartContractJson;\n\t/**\n\t* Assembled `ControlStack` injected by the orchestrator (`runMigration`).\n\t*\n\t* Subclasses (e.g. `PostgresMigration`) read the stack to materialize their\n\t* adapter once per instance. Optional at the abstract level so unit tests can\n\t* construct `Migration` instances purely for `operations` / `describe`\n\t* assertions without needing a real stack; concrete subclasses that need the\n\t* stack at runtime should narrow the parameter to required.\n\t*/\n\tstack;\n\tconstructor(stack) {\n\t\tthis.stack = stack;\n\t}\n\t/**\n\t* Metadata inputs used to build `migration.json` and to derive the plan's\n\t* origin/destination identities.\n\t*\n\t* Default derivation: `to = endContractJson.storage.storageHash`,\n\t* `from = startContractJson?.storage.storageHash ?? null`. A migration that\n\t* carries no contract JSON (e.g. an extension migration) must override this;\n\t* otherwise it throws, since `migration.json` requires a `to` identity.\n\t*/\n\tdescribe() {\n\t\tconst end = this.endContractJson;\n\t\tif (end === void 0) throw errorDescribeMissingEndContract();\n\t\treturn {\n\t\t\tfrom: this.startContractJson?.storage.storageHash ?? null,\n\t\t\tto: end.storage.storageHash\n\t\t};\n\t}\n\tget origin() {\n\t\tconst from = this.describe().from;\n\t\treturn from === null ? null : { storageHash: from };\n\t}\n\tget destination() {\n\t\treturn { storageHash: this.describe().to };\n\t}\n};\n/**\n* Lazy-memoized `endContract` / `startContract` view accessors, one instance\n* held per migration. Each target base (`MongoMigration`, `SqliteMigration`,\n* `PostgresMigration`) creates one `MigrationContractViews` field from\n* `this` — passing its own `<Family>ContractView.fromJson<…>` as `fromJson`\n* and a name for error messages — and forwards its\n* `endContract`/`startContract` getters to it.\n*\n* `endContract` throws `MIGRATION.CONTRACT_VIEW_MISSING` when the migration\n* has no `endContractJson` (mirrors `describe()`'s own requirement).\n* `startContract` returns `null` for a baseline migration (no\n* `startContractJson`) instead of throwing.\n*/\nvar MigrationContractViews = class {\n\tmigration;\n\tclassName;\n\tfromJson;\n\t#endView;\n\t#startView;\n\tconstructor(migration, className, fromJson) {\n\t\tthis.migration = migration;\n\t\tthis.className = className;\n\t\tthis.fromJson = fromJson;\n\t}\n\tget endContract() {\n\t\tif (this.#endView === void 0) {\n\t\t\tconst json = this.migration.endContractJson;\n\t\t\tif (json === void 0) throw errorMigrationContractViewMissing(this.className, \"endContract\", \"endContractJson\");\n\t\t\tthis.#endView = this.fromJson(json);\n\t\t}\n\t\treturn this.#endView;\n\t}\n\tget startContract() {\n\t\tif (this.#startView === void 0) {\n\t\t\tconst json = this.migration.startContractJson;\n\t\t\tthis.#startView = json === void 0 ? null : this.fromJson(json);\n\t\t}\n\t\treturn this.#startView;\n\t}\n};\n/**\n* Returns true when `import.meta.url` resolves to the same file that was\n* invoked as the node entrypoint (`process.argv[1]`). Used by\n* `MigrationCLI.run` (in `@internal/cli/migration-cli`) to no-op when\n* the migration module is being imported (e.g. by another script) rather\n* than executed directly.\n*/\nfunction isDirectEntrypoint(importMetaUrl) {\n\tconst metaFilename = fileURLToPath(importMetaUrl);\n\tconst argv1 = process.argv[1];\n\tif (!argv1) return false;\n\ttry {\n\t\treturn realpathSync(metaFilename) === realpathSync(argv1);\n\t} catch {\n\t\treturn false;\n\t}\n}\n/**\n* Build the attested metadata from `describe()`-derived metadata, the\n* operations list, and the previously-scaffolded metadata (if any).\n*\n* When a `migration.json` already exists for this package (the common\n* case: it was scaffolded by `migration plan`), preserve `createdAt`\n* set there — that field is owned by the CLI scaffolder, not the authored\n* class. Only the `describe()`-derived fields (`from`, `to`) and the\n* operations change as the author iterates. When no metadata exists yet\n* (a bare `migration.ts` run from scratch), synthesize a minimal but\n* schema-conformant record so the resulting package can still be read,\n* verified, and applied.\n*\n* The `migrationHash` is recomputed against the current metadata + ops so\n* the on-disk artifacts are always fully attested.\n*/\nfunction buildAttestedMetadata(meta, ops, existing) {\n\tconst baseMetadata = {\n\t\tfrom: meta.from,\n\t\tto: meta.to,\n\t\tprovidedInvariants: deriveProvidedInvariants(ops),\n\t\tcreatedAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()\n\t};\n\tconst migrationHash = computeMigrationHash(baseMetadata, ops);\n\treturn {\n\t\t...baseMetadata,\n\t\tmigrationHash\n\t};\n}\n/**\n* Pure conversion from a `Migration` instance (plus the previously\n* scaffolded metadata, when one exists on disk) to the in-memory\n* artifacts that downstream tooling persists. Owns metadata validation,\n* metadata synthesis/preservation, and the content-addressed\n* `migrationHash` computation, but performs no file I/O — callers handle\n* reads (to source `existing`) and writes (to persist `opsJson` /\n* `metadataJson`).\n*/\nasync function buildMigrationArtifacts(instance, existing) {\n\tconst rawOps = instance.operations;\n\tif (!Array.isArray(rawOps)) throw errorOperationsNotArray();\n\tconst ops = await Promise.all(rawOps);\n\tfor (let index = 0; index < ops.length; index++) {\n\t\tconst result = MigrationOpSchema(ops[index]);\n\t\tif (result instanceof type.errors) throw errorInvalidOperationEntry(index, result.summary);\n\t}\n\tconst rawMeta = instance.describe();\n\tconst parsed = MigrationMetaSchema(rawMeta);\n\tif (parsed instanceof type.errors) throw errorDescribeInvalidMetadata(parsed.summary);\n\tconst metadata = buildAttestedMetadata(parsed, ops, existing);\n\treturn {\n\t\topsJson: JSON.stringify(ops, null, 2),\n\t\tmetadata,\n\t\tmetadataJson: JSON.stringify(metadata, null, 2)\n\t};\n}\n//#endregion\nexport { Migration, MigrationContractViews, buildMigrationArtifacts, isDirectEntrypoint };\n\n//# source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iguousTarget } from "./errors-
|
|
1
|
+
import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from "./errors-CcEpbfnE-CsSXrttT.mjs";
|
|
2
2
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
3
3
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
4
4
|
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
5
|
-
//#region ../../../1-framework/3-tooling/migration/dist/migration-graph-
|
|
5
|
+
//#region ../../../1-framework/3-tooling/migration/dist/migration-graph-DwXAHP6T.mjs
|
|
6
6
|
/**
|
|
7
7
|
* FIFO queue with amortised O(1) push and shift.
|
|
8
8
|
*
|
|
@@ -497,4 +497,4 @@ function detectOrphans(graph) {
|
|
|
497
497
|
//#endregion
|
|
498
498
|
export { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };
|
|
499
499
|
|
|
500
|
-
//# sourceMappingURL=migration-graph-
|
|
500
|
+
//# sourceMappingURL=migration-graph-DwXAHP6T-NgmP2DNz.mjs.map
|
package/dist/{migration-graph-_SJImD5V-BURyY1KM.mjs.map → migration-graph-DwXAHP6T-NgmP2DNz.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-graph-_SJImD5V-BURyY1KM.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/migration-graph-_SJImD5V.mjs"],"sourcesContent":["import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from \"./errors-CXbGUWGu.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"./constants-CM-w38DQ.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/queue.ts\n/**\n* FIFO queue with amortised O(1) push and shift.\n*\n* Uses a head-index cursor over a backing array rather than\n* `Array.prototype.shift()`, which is O(n) on V8. Intended for BFS-shaped\n* traversals where the queue is drained in a single pass — it does not\n* reclaim memory for already-shifted items, so it is not suitable for\n* long-lived queues with many push/shift cycles.\n*/\nvar Queue = class {\n\titems;\n\thead = 0;\n\tconstructor(initial = []) {\n\t\tthis.items = [...initial];\n\t}\n\tpush(item) {\n\t\tthis.items.push(item);\n\t}\n\t/**\n\t* Remove and return the next item. Caller must check `isEmpty` first —\n\t* shifting an empty queue throws.\n\t*/\n\tshift() {\n\t\tif (this.head >= this.items.length) throw new InternalError(\"Queue.shift called on empty queue\");\n\t\treturn this.items[this.head++];\n\t}\n\tget isEmpty() {\n\t\treturn this.head >= this.items.length;\n\t}\n};\n//#endregion\n//#region src/graph-ops.ts\nfunction* bfs(starts, neighbours, key = (state) => state) {\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst queue = new Queue();\n\tfor (const start of starts) {\n\t\tconst k = key(start);\n\t\tif (!visited.has(k)) {\n\t\t\tvisited.add(k);\n\t\t\tqueue.push({\n\t\t\t\tstate: start,\n\t\t\t\tkey: k\n\t\t\t});\n\t\t}\n\t}\n\twhile (!queue.isEmpty) {\n\t\tconst { state: current, key: curKey } = queue.shift();\n\t\tconst parentInfo = parentMap.get(curKey);\n\t\tyield {\n\t\t\tstate: current,\n\t\t\tparent: parentInfo?.parent ?? null,\n\t\t\tincomingEdge: parentInfo?.edge ?? null\n\t\t};\n\t\tfor (const { next, edge } of neighbours(current)) {\n\t\t\tconst k = key(next);\n\t\t\tif (!visited.has(k)) {\n\t\t\t\tvisited.add(k);\n\t\t\t\tparentMap.set(k, {\n\t\t\t\t\tparent: current,\n\t\t\t\t\tedge\n\t\t\t\t});\n\t\t\t\tqueue.push({\n\t\t\t\t\tstate: next,\n\t\t\t\t\tkey: k\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n//#endregion\n//#region src/migration-graph.ts\n/** Forward-edge neighbours: edge `e` from `n` visits `e.to` next. */\nfunction forwardNeighbours(graph, node) {\n\treturn (graph.forwardChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/**\n* Forward-edge neighbours, sorted by the deterministic tie-break.\n* Used by path-finding so the resulting shortest path is stable across runs.\n*/\nfunction sortedForwardNeighbours(graph, node) {\n\treturn [...graph.forwardChain.get(node) ?? []].sort(compareTieBreak).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/** Reverse-edge neighbours: edge `e` from `n` visits `e.from` next. */\nfunction reverseNeighbours(graph, node) {\n\treturn (graph.reverseChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.from,\n\t\tedge\n\t}));\n}\nfunction appendEdge(map, key, entry) {\n\tconst bucket = map.get(key);\n\tif (bucket) bucket.push(entry);\n\telse map.set(key, [entry]);\n}\nfunction reconstructGraph(packages) {\n\tconst nodes = /* @__PURE__ */ new Set();\n\tconst forwardChain = /* @__PURE__ */ new Map();\n\tconst reverseChain = /* @__PURE__ */ new Map();\n\tconst migrationByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\tconst { to } = pkg.metadata;\n\t\tnodes.add(from);\n\t\tnodes.add(to);\n\t\tconst migration = {\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tmigrationHash: pkg.metadata.migrationHash,\n\t\t\tdirName: pkg.dirName,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\tinvariants: pkg.metadata.providedInvariants\n\t\t};\n\t\tif (!migrationByHash.has(migration.migrationHash)) migrationByHash.set(migration.migrationHash, migration);\n\t\tappendEdge(forwardChain, from, migration);\n\t\tappendEdge(reverseChain, to, migration);\n\t}\n\treturn {\n\t\tnodes,\n\t\tforwardChain,\n\t\treverseChain,\n\t\tmigrationByHash\n\t};\n}\nfunction compareTieBreak(a, b) {\n\tconst ca = a.createdAt.localeCompare(b.createdAt);\n\tif (ca !== 0) return ca;\n\tconst tc = a.to.localeCompare(b.to);\n\tif (tc !== 0) return tc;\n\treturn a.migrationHash.localeCompare(b.migrationHash);\n}\nfunction sortedNeighbors(edges) {\n\treturn [...edges].sort(compareTieBreak);\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` using BFS over the\n* contract-hash graph. Returns the ordered list of edges, or null if no path\n* exists. Returns an empty array when `fromHash === toHash` (no-op).\n*\n* Neighbor ordering is deterministic via the tie-break sort key:\n* createdAt → to → migrationHash.\n*/\nfunction findPath(graph, fromHash, toHash) {\n\tif (fromHash === toHash) return [];\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([fromHash], (n) => sortedForwardNeighbours(graph, n))) {\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(step.state, {\n\t\t\tparent: step.parent,\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state === toHash) {\n\t\t\tconst path = [];\n\t\t\tlet cur = toHash;\n\t\t\tlet p = parents.get(cur);\n\t\t\twhile (p) {\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parent;\n\t\t\t\tp = parents.get(cur);\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` whose edges collectively\n* cover every invariant in `required`. Returns `null` when no such path exists\n* (either `fromHash`→`toHash` is structurally unreachable, or every reachable\n* path leaves at least one required invariant uncovered). When `required` is\n* empty, delegates to `findPath` so the result is byte-identical for that case.\n*\n* Algorithm: BFS over `(node, coveredSubset)` states with state-level dedup.\n* The covered subset is a `Set<string>` of invariant ids; the state's dedup\n* key is `${node}\\0${[...covered].sort().join('\\0')}`. State keys distinguish\n* distinct `(node, covered)` tuples regardless of node-name length because\n* `\\0` cannot appear in any invariant id (validation rejects whitespace and\n* control chars at authoring time).\n*\n* Neighbour ordering when `required ≠ ∅`: edges covering ≥1 still-needed\n* invariant come first, with `createdAt → to → migrationHash` as the\n* secondary key. The heuristic steers BFS toward the satisfying path;\n* correctness (shortest, deterministic) does not depend on it.\n*/\nfunction findPathWithInvariants(graph, fromHash, toHash, required) {\n\tif (required.size === 0) return findPath(graph, fromHash, toHash);\n\tconst stateKey = (s) => {\n\t\tif (s.covered.size === 0) return `${s.node}\\0`;\n\t\treturn `${s.node}\\0${[...s.covered].sort().join(\"\\0\")}`;\n\t};\n\tconst neighbours = (s) => {\n\t\tconst outgoing = graph.forwardChain.get(s.node) ?? [];\n\t\tif (outgoing.length === 0) return [];\n\t\treturn [...outgoing].map((edge) => {\n\t\t\tlet useful = false;\n\t\t\tlet next = null;\n\t\t\tfor (const inv of edge.invariants) if (required.has(inv) && !s.covered.has(inv)) {\n\t\t\t\tif (next === null) next = new Set(s.covered);\n\t\t\t\tnext.add(inv);\n\t\t\t\tuseful = true;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tedge,\n\t\t\t\tuseful,\n\t\t\t\tnextCovered: next ?? s.covered\n\t\t\t};\n\t\t}).sort((a, b) => {\n\t\t\tif (a.useful !== b.useful) return a.useful ? -1 : 1;\n\t\t\treturn compareTieBreak(a.edge, b.edge);\n\t\t}).map(({ edge, nextCovered }) => ({\n\t\t\tnext: {\n\t\t\t\tnode: edge.to,\n\t\t\t\tcovered: nextCovered\n\t\t\t},\n\t\t\tedge\n\t\t}));\n\t};\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([{\n\t\tnode: fromHash,\n\t\tcovered: /* @__PURE__ */ new Set()\n\t}], neighbours, stateKey)) {\n\t\tconst curKey = stateKey(step.state);\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(curKey, {\n\t\t\tparentKey: stateKey(step.parent),\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state.node === toHash && step.state.covered.size === required.size) {\n\t\t\tconst path = [];\n\t\t\tlet cur = curKey;\n\t\t\twhile (cur !== void 0) {\n\t\t\t\tconst p = parents.get(cur);\n\t\t\t\tif (!p) break;\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parentKey;\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Reverse-BFS from `toHash` over `reverseChain` to collect every node from\n* which `toHash` is reachable (inclusive of `toHash` itself).\n*/\nfunction collectNodesReachingTarget(graph, toHash) {\n\tconst reached = /* @__PURE__ */ new Set();\n\tfor (const step of bfs([toHash], (n) => reverseNeighbours(graph, n))) reached.add(step.state);\n\treturn reached;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` and return structured\n* path-decision metadata for machine-readable output. When `required` is\n* non-empty, the returned path is the shortest one whose edges collectively\n* cover every required invariant.\n*\n* The discriminated return type tells the caller *why* a path could not be\n* found, so the CLI can pick the right structured error without re-running\n* a structural BFS.\n*/\nfunction findPathWithDecision(graph, fromHash, toHash, options = {}) {\n\tconst { refName, required = /* @__PURE__ */ new Set() } = options;\n\tconst requiredInvariants = [...required].sort();\n\tif (fromHash === toHash && required.size === 0) return {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: [],\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount: 0,\n\t\t\ttieBreakReasons: [],\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants: [],\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n\tconst path = findPathWithInvariants(graph, fromHash, toHash, required);\n\tif (!path) {\n\t\tif (required.size === 0) return { kind: \"unreachable\" };\n\t\tconst structural = findPath(graph, fromHash, toHash);\n\t\tif (structural === null) return { kind: \"unreachable\" };\n\t\tconst coveredByStructural = /* @__PURE__ */ new Set();\n\t\tfor (const edge of structural) for (const inv of edge.invariants) if (required.has(inv)) coveredByStructural.add(inv);\n\t\treturn {\n\t\t\tkind: \"unsatisfiable\",\n\t\t\tstructuralPath: structural,\n\t\t\tmissing: requiredInvariants.filter((id) => !coveredByStructural.has(id))\n\t\t};\n\t}\n\tconst satisfiedInvariants = computeSatisfiedInvariants(required, path);\n\tconst reachesTarget = collectNodesReachingTarget(graph, toHash);\n\tconst coveragePrefixes = requiredCoveragePrefixes(required, path);\n\tconst tieBreakReasons = [];\n\tlet alternativeCount = 0;\n\tfor (const [i, edge] of path.entries()) {\n\t\tconst outgoing = graph.forwardChain.get(edge.from);\n\t\tif (!outgoing || outgoing.length <= 1) continue;\n\t\tconst reachable = outgoing.filter((e) => reachesTarget.has(e.to));\n\t\tif (reachable.length <= 1) continue;\n\t\tlet comparisonPool = reachable;\n\t\tif (required.size > 0) {\n\t\t\tconst prefixSet = coveragePrefixes[i];\n\t\t\tif (prefixSet === void 0) continue;\n\t\t\tcomparisonPool = invariantViableAlternativesAtStep(required, prefixSet, reachable);\n\t\t}\n\t\talternativeCount += reachable.length - 1;\n\t\tif (sortedNeighbors(reachable)[0]?.migrationHash !== edge.migrationHash) continue;\n\t\tif (!reachable.some((e) => e.migrationHash !== edge.migrationHash)) continue;\n\t\tconst sortedViable = sortedNeighbors(comparisonPool);\n\t\tif (sortedViable.length > 1 && sortedViable[0]?.migrationHash === edge.migrationHash && sortedViable.some((e) => e.migrationHash !== edge.migrationHash)) tieBreakReasons.push(`at ${edge.from}: ${comparisonPool.length} candidates, selected by tie-break`);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: path,\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount,\n\t\t\ttieBreakReasons,\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n}\nfunction computeSatisfiedInvariants(required, path) {\n\tif (required.size === 0) return [];\n\tconst covered = /* @__PURE__ */ new Set();\n\tfor (const edge of path) for (const inv of edge.invariants) if (required.has(inv)) covered.add(inv);\n\treturn [...covered].sort();\n}\n/**\n* For each edge on path, invariant coverage accumulated from earlier edges only —\n* `(required ∩ ∪_{j<i} path[j].invariants)` represented as cumulative set along `required`,\n* keyed as \"full set of required ids satisfied before taking path[i]\".\n*/\nfunction requiredCoveragePrefixes(required, path) {\n\tconst prefixes = [];\n\tconst acc = /* @__PURE__ */ new Set();\n\tfor (const edge of path) {\n\t\tprefixes.push(new Set(acc));\n\t\tfor (const inv of edge.invariants) if (required.has(inv)) acc.add(inv);\n\t}\n\treturn prefixes;\n}\nfunction invariantViableAlternativesAtStep(required, coverageBeforeTakingEdge, outgoing) {\n\tif (required.size === 0) return [...outgoing];\n\treturn outgoing.filter((e) => [...required].every((id) => coverageBeforeTakingEdge.has(id) || e.invariants.includes(id)));\n}\n/**\n* Walk ancestors of each branch tip back to find the last node\n* that appears on all paths. Returns `fromHash` if no shared ancestor is found.\n*/\nfunction findDivergencePoint(graph, fromHash, leaves) {\n\tconst ancestorSets = leaves.map((leaf) => {\n\t\tconst ancestors = /* @__PURE__ */ new Set();\n\t\tfor (const step of bfs([leaf], (n) => reverseNeighbours(graph, n))) ancestors.add(step.state);\n\t\treturn ancestors;\n\t});\n\tconst commonAncestors = [...ancestorSets[0] ?? []].filter((node) => ancestorSets.every((s) => s.has(node)));\n\tlet deepest = fromHash;\n\tlet deepestDepth = -1;\n\tfor (const ancestor of commonAncestors) {\n\t\tconst path = findPath(graph, fromHash, ancestor);\n\t\tconst depth = path ? path.length : 0;\n\t\tif (depth > deepestDepth) {\n\t\t\tdeepestDepth = depth;\n\t\t\tdeepest = ancestor;\n\t\t}\n\t}\n\treturn deepest;\n}\n/**\n* Find all branch tips (nodes with no outgoing edges) reachable from\n* `fromHash` via forward edges.\n*/\nfunction findReachableLeaves(graph, fromHash) {\n\tconst leaves = [];\n\tfor (const step of bfs([fromHash], (n) => forwardNeighbours(graph, n))) if (!graph.forwardChain.get(step.state)?.length) leaves.push(step.state);\n\treturn leaves;\n}\n/**\n* Find the target contract hash of the migration graph reachable from\n* EMPTY_CONTRACT_HASH. Returns `null` for a graph that has no target\n* state (either empty, or containing only the root with no outgoing\n* edges). Throws NO_INITIAL_MIGRATION if the graph has nodes but none\n* originate from the empty hash, and AMBIGUOUS_TARGET if multiple\n* branch tips exist.\n*/\nfunction findLeaf(graph) {\n\tif (graph.nodes.size === 0) return null;\n\tif (!graph.nodes.has(\"empty\")) throw errorNoInitialMigration([...graph.nodes]);\n\tconst leaves = findReachableLeaves(graph, EMPTY_CONTRACT_HASH);\n\tif (leaves.length === 0) {\n\t\tconst reachable = [...graph.nodes].filter((n) => n !== EMPTY_CONTRACT_HASH);\n\t\tif (reachable.length > 0) throw errorNoTarget(reachable);\n\t\treturn null;\n\t}\n\tif (leaves.length > 1) {\n\t\tconst divergencePoint = findDivergencePoint(graph, EMPTY_CONTRACT_HASH, leaves);\n\t\tthrow errorAmbiguousTarget(leaves, {\n\t\t\tdivergencePoint,\n\t\t\tbranches: leaves.map((tip) => {\n\t\t\t\treturn {\n\t\t\t\t\ttip,\n\t\t\t\t\tedges: (findPath(graph, divergencePoint, tip) ?? []).map((e) => ({\n\t\t\t\t\t\tdirName: e.dirName,\n\t\t\t\t\t\tfrom: e.from,\n\t\t\t\t\t\tto: e.to\n\t\t\t\t\t}))\n\t\t\t\t};\n\t\t\t})\n\t\t});\n\t}\n\treturn leaves[0];\n}\n/**\n* Find the latest migration entry by traversing from EMPTY_CONTRACT_HASH\n* to the single target. Returns null for an empty graph.\n* Throws AMBIGUOUS_TARGET if the graph has multiple branch tips.\n*/\nfunction findLatestMigration(graph) {\n\tconst leafHash = findLeaf(graph);\n\tif (leafHash === null) return null;\n\treturn findPath(graph, \"empty\", leafHash)?.at(-1) ?? null;\n}\nfunction detectCycles(graph) {\n\tconst WHITE = 0;\n\tconst GRAY = 1;\n\tconst BLACK = 2;\n\tconst color = /* @__PURE__ */ new Map();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst cycles = [];\n\tfor (const node of graph.nodes) color.set(node, WHITE);\n\tconst stack = [];\n\tfunction pushFrame(u) {\n\t\tcolor.set(u, GRAY);\n\t\tstack.push({\n\t\t\tnode: u,\n\t\t\toutgoing: graph.forwardChain.get(u) ?? [],\n\t\t\tindex: 0\n\t\t});\n\t}\n\tfor (const root of graph.nodes) {\n\t\tif (color.get(root) !== WHITE) continue;\n\t\tparentMap.set(root, null);\n\t\tpushFrame(root);\n\t\twhile (stack.length > 0) {\n\t\t\tconst frame = stack[stack.length - 1];\n\t\t\tif (frame.index >= frame.outgoing.length) {\n\t\t\t\tcolor.set(frame.node, BLACK);\n\t\t\t\tstack.pop();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst v = frame.outgoing[frame.index++].to;\n\t\t\tconst vColor = color.get(v);\n\t\t\tif (vColor === GRAY) {\n\t\t\t\tconst cycle = [v];\n\t\t\t\tlet cur = frame.node;\n\t\t\t\twhile (cur !== v) {\n\t\t\t\t\tcycle.push(cur);\n\t\t\t\t\tcur = parentMap.get(cur) ?? v;\n\t\t\t\t}\n\t\t\t\tcycle.reverse();\n\t\t\t\tcycles.push(cycle);\n\t\t\t} else if (vColor === WHITE) {\n\t\t\t\tparentMap.set(v, frame.node);\n\t\t\t\tpushFrame(v);\n\t\t\t}\n\t\t}\n\t}\n\treturn cycles;\n}\nfunction detectOrphans(graph) {\n\tif (graph.nodes.size === 0) return [];\n\tconst reachable = /* @__PURE__ */ new Set();\n\tconst startNodes = [];\n\tif (graph.forwardChain.has(\"empty\")) startNodes.push(EMPTY_CONTRACT_HASH);\n\telse {\n\t\tconst allTargets = /* @__PURE__ */ new Set();\n\t\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) allTargets.add(edge.to);\n\t\tfor (const node of graph.nodes) if (!allTargets.has(node)) startNodes.push(node);\n\t}\n\tfor (const step of bfs(startNodes, (n) => forwardNeighbours(graph, n))) reachable.add(step.state);\n\tconst orphans = [];\n\tfor (const [from, migrations] of graph.forwardChain) if (!reachable.has(from)) orphans.push(...migrations);\n\treturn orphans;\n}\n//#endregion\nexport { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };\n\n//# sourceMappingURL=migration-graph-_SJImD5V.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,IAAI,QAAQ,MAAM;CACjB;CACA,OAAO;CACP,YAAY,UAAU,CAAC,GAAG;EACzB,KAAK,QAAQ,CAAC,GAAG,OAAO;CACzB;CACA,KAAK,MAAM;EACV,KAAK,MAAM,KAAK,IAAI;CACrB;;;;;CAKA,QAAQ;EACP,IAAI,KAAK,QAAQ,KAAK,MAAM,QAAQ,MAAM,IAAI,cAAc,mCAAmC;EAC/F,OAAO,KAAK,MAAM,KAAK;CACxB;CACA,IAAI,UAAU;EACb,OAAO,KAAK,QAAQ,KAAK,MAAM;CAChC;AACD;AAGA,UAAU,IAAI,QAAQ,YAAY,OAAO,UAAU,OAAO;CACzD,MAAM,0BAA0B,IAAI,IAAI;CACxC,MAAM,4BAA4B,IAAI,IAAI;CAC1C,MAAM,QAAQ,IAAI,MAAM;CACxB,KAAK,MAAM,SAAS,QAAQ;EAC3B,MAAM,IAAI,IAAI,KAAK;EACnB,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG;GACpB,QAAQ,IAAI,CAAC;GACb,MAAM,KAAK;IACV,OAAO;IACP,KAAK;GACN,CAAC;EACF;CACD;CACA,OAAO,CAAC,MAAM,SAAS;EACtB,MAAM,EAAE,OAAO,SAAS,KAAK,WAAW,MAAM,MAAM;EACpD,MAAM,aAAa,UAAU,IAAI,MAAM;EACvC,MAAM;GACL,OAAO;GACP,QAAQ,YAAY,UAAU;GAC9B,cAAc,YAAY,QAAQ;EACnC;EACA,KAAK,MAAM,EAAE,MAAM,UAAU,WAAW,OAAO,GAAG;GACjD,MAAM,IAAI,IAAI,IAAI;GAClB,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG;IACpB,QAAQ,IAAI,CAAC;IACb,UAAU,IAAI,GAAG;KAChB,QAAQ;KACR;IACD,CAAC;IACD,MAAM,KAAK;KACV,OAAO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,aAAa,IAAI,OAAO,GAAG,WAAW,KAAK,mBAAmB;MACnE;EACJ,MAAM,6BAA6B,IAAI,IAAI;EAC3C,KAAK,MAAM,SAAS,MAAM,aAAa,OAAO,GAAG,KAAK,MAAM,QAAQ,OAAO,WAAW,IAAI,KAAK,EAAE;EACjG,KAAK,MAAM,QAAQ,MAAM,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,GAAG,WAAW,KAAK,IAAI;CAChF;CACA,KAAK,MAAM,QAAQ,IAAI,aAAa,MAAM,kBAAkB,OAAO,CAAC,CAAC,GAAG,UAAU,IAAI,KAAK,KAAK;CAChG,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,MAAM,eAAe,MAAM,cAAc,IAAI,CAAC,UAAU,IAAI,IAAI,GAAG,QAAQ,KAAK,GAAG,UAAU;CACzG,OAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"migration-graph-DwXAHP6T-NgmP2DNz.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/migration-graph-DwXAHP6T.mjs"],"sourcesContent":["import { D as errorNoInitialMigration, k as errorNoTarget, n as errorAmbiguousTarget } from \"./errors-CcEpbfnE.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"./constants-CM-w38DQ.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/queue.ts\n/**\n* FIFO queue with amortised O(1) push and shift.\n*\n* Uses a head-index cursor over a backing array rather than\n* `Array.prototype.shift()`, which is O(n) on V8. Intended for BFS-shaped\n* traversals where the queue is drained in a single pass — it does not\n* reclaim memory for already-shifted items, so it is not suitable for\n* long-lived queues with many push/shift cycles.\n*/\nvar Queue = class {\n\titems;\n\thead = 0;\n\tconstructor(initial = []) {\n\t\tthis.items = [...initial];\n\t}\n\tpush(item) {\n\t\tthis.items.push(item);\n\t}\n\t/**\n\t* Remove and return the next item. Caller must check `isEmpty` first —\n\t* shifting an empty queue throws.\n\t*/\n\tshift() {\n\t\tif (this.head >= this.items.length) throw new InternalError(\"Queue.shift called on empty queue\");\n\t\treturn this.items[this.head++];\n\t}\n\tget isEmpty() {\n\t\treturn this.head >= this.items.length;\n\t}\n};\n//#endregion\n//#region src/graph-ops.ts\nfunction* bfs(starts, neighbours, key = (state) => state) {\n\tconst visited = /* @__PURE__ */ new Set();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst queue = new Queue();\n\tfor (const start of starts) {\n\t\tconst k = key(start);\n\t\tif (!visited.has(k)) {\n\t\t\tvisited.add(k);\n\t\t\tqueue.push({\n\t\t\t\tstate: start,\n\t\t\t\tkey: k\n\t\t\t});\n\t\t}\n\t}\n\twhile (!queue.isEmpty) {\n\t\tconst { state: current, key: curKey } = queue.shift();\n\t\tconst parentInfo = parentMap.get(curKey);\n\t\tyield {\n\t\t\tstate: current,\n\t\t\tparent: parentInfo?.parent ?? null,\n\t\t\tincomingEdge: parentInfo?.edge ?? null\n\t\t};\n\t\tfor (const { next, edge } of neighbours(current)) {\n\t\t\tconst k = key(next);\n\t\t\tif (!visited.has(k)) {\n\t\t\t\tvisited.add(k);\n\t\t\t\tparentMap.set(k, {\n\t\t\t\t\tparent: current,\n\t\t\t\t\tedge\n\t\t\t\t});\n\t\t\t\tqueue.push({\n\t\t\t\t\tstate: next,\n\t\t\t\t\tkey: k\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n//#endregion\n//#region src/migration-graph.ts\n/** Forward-edge neighbours: edge `e` from `n` visits `e.to` next. */\nfunction forwardNeighbours(graph, node) {\n\treturn (graph.forwardChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/**\n* Forward-edge neighbours, sorted by the deterministic tie-break.\n* Used by path-finding so the resulting shortest path is stable across runs.\n*/\nfunction sortedForwardNeighbours(graph, node) {\n\treturn [...graph.forwardChain.get(node) ?? []].sort(compareTieBreak).map((edge) => ({\n\t\tnext: edge.to,\n\t\tedge\n\t}));\n}\n/** Reverse-edge neighbours: edge `e` from `n` visits `e.from` next. */\nfunction reverseNeighbours(graph, node) {\n\treturn (graph.reverseChain.get(node) ?? []).map((edge) => ({\n\t\tnext: edge.from,\n\t\tedge\n\t}));\n}\nfunction appendEdge(map, key, entry) {\n\tconst bucket = map.get(key);\n\tif (bucket) bucket.push(entry);\n\telse map.set(key, [entry]);\n}\nfunction reconstructGraph(packages) {\n\tconst nodes = /* @__PURE__ */ new Set();\n\tconst forwardChain = /* @__PURE__ */ new Map();\n\tconst reverseChain = /* @__PURE__ */ new Map();\n\tconst migrationByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\tconst { to } = pkg.metadata;\n\t\tnodes.add(from);\n\t\tnodes.add(to);\n\t\tconst migration = {\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tmigrationHash: pkg.metadata.migrationHash,\n\t\t\tdirName: pkg.dirName,\n\t\t\tcreatedAt: pkg.metadata.createdAt,\n\t\t\tinvariants: pkg.metadata.providedInvariants\n\t\t};\n\t\tif (!migrationByHash.has(migration.migrationHash)) migrationByHash.set(migration.migrationHash, migration);\n\t\tappendEdge(forwardChain, from, migration);\n\t\tappendEdge(reverseChain, to, migration);\n\t}\n\treturn {\n\t\tnodes,\n\t\tforwardChain,\n\t\treverseChain,\n\t\tmigrationByHash\n\t};\n}\nfunction compareTieBreak(a, b) {\n\tconst ca = a.createdAt.localeCompare(b.createdAt);\n\tif (ca !== 0) return ca;\n\tconst tc = a.to.localeCompare(b.to);\n\tif (tc !== 0) return tc;\n\treturn a.migrationHash.localeCompare(b.migrationHash);\n}\nfunction sortedNeighbors(edges) {\n\treturn [...edges].sort(compareTieBreak);\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` using BFS over the\n* contract-hash graph. Returns the ordered list of edges, or null if no path\n* exists. Returns an empty array when `fromHash === toHash` (no-op).\n*\n* Neighbor ordering is deterministic via the tie-break sort key:\n* createdAt → to → migrationHash.\n*/\nfunction findPath(graph, fromHash, toHash) {\n\tif (fromHash === toHash) return [];\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([fromHash], (n) => sortedForwardNeighbours(graph, n))) {\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(step.state, {\n\t\t\tparent: step.parent,\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state === toHash) {\n\t\t\tconst path = [];\n\t\t\tlet cur = toHash;\n\t\t\tlet p = parents.get(cur);\n\t\t\twhile (p) {\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parent;\n\t\t\t\tp = parents.get(cur);\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` whose edges collectively\n* cover every invariant in `required`. Returns `null` when no such path exists\n* (either `fromHash`→`toHash` is structurally unreachable, or every reachable\n* path leaves at least one required invariant uncovered). When `required` is\n* empty, delegates to `findPath` so the result is byte-identical for that case.\n*\n* Algorithm: BFS over `(node, coveredSubset)` states with state-level dedup.\n* The covered subset is a `Set<string>` of invariant ids; the state's dedup\n* key is `${node}\\0${[...covered].sort().join('\\0')}`. State keys distinguish\n* distinct `(node, covered)` tuples regardless of node-name length because\n* `\\0` cannot appear in any invariant id (validation rejects whitespace and\n* control chars at authoring time).\n*\n* Neighbour ordering when `required ≠ ∅`: edges covering ≥1 still-needed\n* invariant come first, with `createdAt → to → migrationHash` as the\n* secondary key. The heuristic steers BFS toward the satisfying path;\n* correctness (shortest, deterministic) does not depend on it.\n*/\nfunction findPathWithInvariants(graph, fromHash, toHash, required) {\n\tif (required.size === 0) return findPath(graph, fromHash, toHash);\n\tconst stateKey = (s) => {\n\t\tif (s.covered.size === 0) return `${s.node}\\0`;\n\t\treturn `${s.node}\\0${[...s.covered].sort().join(\"\\0\")}`;\n\t};\n\tconst neighbours = (s) => {\n\t\tconst outgoing = graph.forwardChain.get(s.node) ?? [];\n\t\tif (outgoing.length === 0) return [];\n\t\treturn [...outgoing].map((edge) => {\n\t\t\tlet useful = false;\n\t\t\tlet next = null;\n\t\t\tfor (const inv of edge.invariants) if (required.has(inv) && !s.covered.has(inv)) {\n\t\t\t\tif (next === null) next = new Set(s.covered);\n\t\t\t\tnext.add(inv);\n\t\t\t\tuseful = true;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tedge,\n\t\t\t\tuseful,\n\t\t\t\tnextCovered: next ?? s.covered\n\t\t\t};\n\t\t}).sort((a, b) => {\n\t\t\tif (a.useful !== b.useful) return a.useful ? -1 : 1;\n\t\t\treturn compareTieBreak(a.edge, b.edge);\n\t\t}).map(({ edge, nextCovered }) => ({\n\t\t\tnext: {\n\t\t\t\tnode: edge.to,\n\t\t\t\tcovered: nextCovered\n\t\t\t},\n\t\t\tedge\n\t\t}));\n\t};\n\tconst parents = /* @__PURE__ */ new Map();\n\tfor (const step of bfs([{\n\t\tnode: fromHash,\n\t\tcovered: /* @__PURE__ */ new Set()\n\t}], neighbours, stateKey)) {\n\t\tconst curKey = stateKey(step.state);\n\t\tif (step.parent !== null && step.incomingEdge !== null) parents.set(curKey, {\n\t\t\tparentKey: stateKey(step.parent),\n\t\t\tedge: step.incomingEdge\n\t\t});\n\t\tif (step.state.node === toHash && step.state.covered.size === required.size) {\n\t\t\tconst path = [];\n\t\t\tlet cur = curKey;\n\t\t\twhile (cur !== void 0) {\n\t\t\t\tconst p = parents.get(cur);\n\t\t\t\tif (!p) break;\n\t\t\t\tpath.push(p.edge);\n\t\t\t\tcur = p.parentKey;\n\t\t\t}\n\t\t\tpath.reverse();\n\t\t\treturn path;\n\t\t}\n\t}\n\treturn null;\n}\n/**\n* Reverse-BFS from `toHash` over `reverseChain` to collect every node from\n* which `toHash` is reachable (inclusive of `toHash` itself).\n*/\nfunction collectNodesReachingTarget(graph, toHash) {\n\tconst reached = /* @__PURE__ */ new Set();\n\tfor (const step of bfs([toHash], (n) => reverseNeighbours(graph, n))) reached.add(step.state);\n\treturn reached;\n}\n/**\n* Find the shortest path from `fromHash` to `toHash` and return structured\n* path-decision metadata for machine-readable output. When `required` is\n* non-empty, the returned path is the shortest one whose edges collectively\n* cover every required invariant.\n*\n* The discriminated return type tells the caller *why* a path could not be\n* found, so the CLI can pick the right structured error without re-running\n* a structural BFS.\n*/\nfunction findPathWithDecision(graph, fromHash, toHash, options = {}) {\n\tconst { refName, required = /* @__PURE__ */ new Set() } = options;\n\tconst requiredInvariants = [...required].sort();\n\tif (fromHash === toHash && required.size === 0) return {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: [],\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount: 0,\n\t\t\ttieBreakReasons: [],\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants: [],\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n\tconst path = findPathWithInvariants(graph, fromHash, toHash, required);\n\tif (!path) {\n\t\tif (required.size === 0) return { kind: \"unreachable\" };\n\t\tconst structural = findPath(graph, fromHash, toHash);\n\t\tif (structural === null) return { kind: \"unreachable\" };\n\t\tconst coveredByStructural = /* @__PURE__ */ new Set();\n\t\tfor (const edge of structural) for (const inv of edge.invariants) if (required.has(inv)) coveredByStructural.add(inv);\n\t\treturn {\n\t\t\tkind: \"unsatisfiable\",\n\t\t\tstructuralPath: structural,\n\t\t\tmissing: requiredInvariants.filter((id) => !coveredByStructural.has(id))\n\t\t};\n\t}\n\tconst satisfiedInvariants = computeSatisfiedInvariants(required, path);\n\tconst reachesTarget = collectNodesReachingTarget(graph, toHash);\n\tconst coveragePrefixes = requiredCoveragePrefixes(required, path);\n\tconst tieBreakReasons = [];\n\tlet alternativeCount = 0;\n\tfor (const [i, edge] of path.entries()) {\n\t\tconst outgoing = graph.forwardChain.get(edge.from);\n\t\tif (!outgoing || outgoing.length <= 1) continue;\n\t\tconst reachable = outgoing.filter((e) => reachesTarget.has(e.to));\n\t\tif (reachable.length <= 1) continue;\n\t\tlet comparisonPool = reachable;\n\t\tif (required.size > 0) {\n\t\t\tconst prefixSet = coveragePrefixes[i];\n\t\t\tif (prefixSet === void 0) continue;\n\t\t\tcomparisonPool = invariantViableAlternativesAtStep(required, prefixSet, reachable);\n\t\t}\n\t\talternativeCount += reachable.length - 1;\n\t\tif (sortedNeighbors(reachable)[0]?.migrationHash !== edge.migrationHash) continue;\n\t\tif (!reachable.some((e) => e.migrationHash !== edge.migrationHash)) continue;\n\t\tconst sortedViable = sortedNeighbors(comparisonPool);\n\t\tif (sortedViable.length > 1 && sortedViable[0]?.migrationHash === edge.migrationHash && sortedViable.some((e) => e.migrationHash !== edge.migrationHash)) tieBreakReasons.push(`at ${edge.from}: ${comparisonPool.length} candidates, selected by tie-break`);\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tdecision: {\n\t\t\tselectedPath: path,\n\t\t\tfromHash,\n\t\t\ttoHash,\n\t\t\talternativeCount,\n\t\t\ttieBreakReasons,\n\t\t\trequiredInvariants,\n\t\t\tsatisfiedInvariants,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t};\n}\nfunction computeSatisfiedInvariants(required, path) {\n\tif (required.size === 0) return [];\n\tconst covered = /* @__PURE__ */ new Set();\n\tfor (const edge of path) for (const inv of edge.invariants) if (required.has(inv)) covered.add(inv);\n\treturn [...covered].sort();\n}\n/**\n* For each edge on path, invariant coverage accumulated from earlier edges only —\n* `(required ∩ ∪_{j<i} path[j].invariants)` represented as cumulative set along `required`,\n* keyed as \"full set of required ids satisfied before taking path[i]\".\n*/\nfunction requiredCoveragePrefixes(required, path) {\n\tconst prefixes = [];\n\tconst acc = /* @__PURE__ */ new Set();\n\tfor (const edge of path) {\n\t\tprefixes.push(new Set(acc));\n\t\tfor (const inv of edge.invariants) if (required.has(inv)) acc.add(inv);\n\t}\n\treturn prefixes;\n}\nfunction invariantViableAlternativesAtStep(required, coverageBeforeTakingEdge, outgoing) {\n\tif (required.size === 0) return [...outgoing];\n\treturn outgoing.filter((e) => [...required].every((id) => coverageBeforeTakingEdge.has(id) || e.invariants.includes(id)));\n}\n/**\n* Walk ancestors of each branch tip back to find the last node\n* that appears on all paths. Returns `fromHash` if no shared ancestor is found.\n*/\nfunction findDivergencePoint(graph, fromHash, leaves) {\n\tconst ancestorSets = leaves.map((leaf) => {\n\t\tconst ancestors = /* @__PURE__ */ new Set();\n\t\tfor (const step of bfs([leaf], (n) => reverseNeighbours(graph, n))) ancestors.add(step.state);\n\t\treturn ancestors;\n\t});\n\tconst commonAncestors = [...ancestorSets[0] ?? []].filter((node) => ancestorSets.every((s) => s.has(node)));\n\tlet deepest = fromHash;\n\tlet deepestDepth = -1;\n\tfor (const ancestor of commonAncestors) {\n\t\tconst path = findPath(graph, fromHash, ancestor);\n\t\tconst depth = path ? path.length : 0;\n\t\tif (depth > deepestDepth) {\n\t\t\tdeepestDepth = depth;\n\t\t\tdeepest = ancestor;\n\t\t}\n\t}\n\treturn deepest;\n}\n/**\n* Find all branch tips (nodes with no outgoing edges) reachable from\n* `fromHash` via forward edges.\n*/\nfunction findReachableLeaves(graph, fromHash) {\n\tconst leaves = [];\n\tfor (const step of bfs([fromHash], (n) => forwardNeighbours(graph, n))) if (!graph.forwardChain.get(step.state)?.length) leaves.push(step.state);\n\treturn leaves;\n}\n/**\n* Find the target contract hash of the migration graph reachable from\n* EMPTY_CONTRACT_HASH. Returns `null` for a graph that has no target\n* state (either empty, or containing only the root with no outgoing\n* edges). Throws NO_INITIAL_MIGRATION if the graph has nodes but none\n* originate from the empty hash, and AMBIGUOUS_TARGET if multiple\n* branch tips exist.\n*/\nfunction findLeaf(graph) {\n\tif (graph.nodes.size === 0) return null;\n\tif (!graph.nodes.has(\"empty\")) throw errorNoInitialMigration([...graph.nodes]);\n\tconst leaves = findReachableLeaves(graph, EMPTY_CONTRACT_HASH);\n\tif (leaves.length === 0) {\n\t\tconst reachable = [...graph.nodes].filter((n) => n !== EMPTY_CONTRACT_HASH);\n\t\tif (reachable.length > 0) throw errorNoTarget(reachable);\n\t\treturn null;\n\t}\n\tif (leaves.length > 1) {\n\t\tconst divergencePoint = findDivergencePoint(graph, EMPTY_CONTRACT_HASH, leaves);\n\t\tthrow errorAmbiguousTarget(leaves, {\n\t\t\tdivergencePoint,\n\t\t\tbranches: leaves.map((tip) => {\n\t\t\t\treturn {\n\t\t\t\t\ttip,\n\t\t\t\t\tedges: (findPath(graph, divergencePoint, tip) ?? []).map((e) => ({\n\t\t\t\t\t\tdirName: e.dirName,\n\t\t\t\t\t\tfrom: e.from,\n\t\t\t\t\t\tto: e.to\n\t\t\t\t\t}))\n\t\t\t\t};\n\t\t\t})\n\t\t});\n\t}\n\treturn leaves[0];\n}\n/**\n* Find the latest migration entry by traversing from EMPTY_CONTRACT_HASH\n* to the single target. Returns null for an empty graph.\n* Throws AMBIGUOUS_TARGET if the graph has multiple branch tips.\n*/\nfunction findLatestMigration(graph) {\n\tconst leafHash = findLeaf(graph);\n\tif (leafHash === null) return null;\n\treturn findPath(graph, \"empty\", leafHash)?.at(-1) ?? null;\n}\nfunction detectCycles(graph) {\n\tconst WHITE = 0;\n\tconst GRAY = 1;\n\tconst BLACK = 2;\n\tconst color = /* @__PURE__ */ new Map();\n\tconst parentMap = /* @__PURE__ */ new Map();\n\tconst cycles = [];\n\tfor (const node of graph.nodes) color.set(node, WHITE);\n\tconst stack = [];\n\tfunction pushFrame(u) {\n\t\tcolor.set(u, GRAY);\n\t\tstack.push({\n\t\t\tnode: u,\n\t\t\toutgoing: graph.forwardChain.get(u) ?? [],\n\t\t\tindex: 0\n\t\t});\n\t}\n\tfor (const root of graph.nodes) {\n\t\tif (color.get(root) !== WHITE) continue;\n\t\tparentMap.set(root, null);\n\t\tpushFrame(root);\n\t\twhile (stack.length > 0) {\n\t\t\tconst frame = stack[stack.length - 1];\n\t\t\tif (frame.index >= frame.outgoing.length) {\n\t\t\t\tcolor.set(frame.node, BLACK);\n\t\t\t\tstack.pop();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst v = frame.outgoing[frame.index++].to;\n\t\t\tconst vColor = color.get(v);\n\t\t\tif (vColor === GRAY) {\n\t\t\t\tconst cycle = [v];\n\t\t\t\tlet cur = frame.node;\n\t\t\t\twhile (cur !== v) {\n\t\t\t\t\tcycle.push(cur);\n\t\t\t\t\tcur = parentMap.get(cur) ?? v;\n\t\t\t\t}\n\t\t\t\tcycle.reverse();\n\t\t\t\tcycles.push(cycle);\n\t\t\t} else if (vColor === WHITE) {\n\t\t\t\tparentMap.set(v, frame.node);\n\t\t\t\tpushFrame(v);\n\t\t\t}\n\t\t}\n\t}\n\treturn cycles;\n}\nfunction detectOrphans(graph) {\n\tif (graph.nodes.size === 0) return [];\n\tconst reachable = /* @__PURE__ */ new Set();\n\tconst startNodes = [];\n\tif (graph.forwardChain.has(\"empty\")) startNodes.push(EMPTY_CONTRACT_HASH);\n\telse {\n\t\tconst allTargets = /* @__PURE__ */ new Set();\n\t\tfor (const edges of graph.forwardChain.values()) for (const edge of edges) allTargets.add(edge.to);\n\t\tfor (const node of graph.nodes) if (!allTargets.has(node)) startNodes.push(node);\n\t}\n\tfor (const step of bfs(startNodes, (n) => forwardNeighbours(graph, n))) reachable.add(step.state);\n\tconst orphans = [];\n\tfor (const [from, migrations] of graph.forwardChain) if (!reachable.has(from)) orphans.push(...migrations);\n\treturn orphans;\n}\n//#endregion\nexport { findPath as a, findReachableLeaves as c, findLeaf as i, reconstructGraph as l, detectOrphans as n, findPathWithDecision as o, findLatestMigration as r, findPathWithInvariants as s, detectCycles as t };\n\n//# sourceMappingURL=migration-graph-DwXAHP6T.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,IAAI,QAAQ,MAAM;CACjB;CACA,OAAO;CACP,YAAY,UAAU,CAAC,GAAG;EACzB,KAAK,QAAQ,CAAC,GAAG,OAAO;CACzB;CACA,KAAK,MAAM;EACV,KAAK,MAAM,KAAK,IAAI;CACrB;;;;;CAKA,QAAQ;EACP,IAAI,KAAK,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Aa,MAAM,kBAAkB,OAAO,CAAC,CAAC,GAAG,UAAU,IAAI,KAAK,KAAK;CAChG,MAAM,UAAU,CAAC;CACjB,KAAK,MAAM,CAAC,MAAM,eAAe,MAAM,cAAc,IAAI,CAAC,UAAU,IAAI,IAAI,GAAG,QAAQ,KAAK,GAAG,UAAU;CACzG,OAAO;AACR"}
|
|
@@ -19,5 +19,5 @@ import { n as isGraphNode, t as assertHashIsGraphNode } from "./migration-graph-
|
|
|
19
19
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-Dkcn8Qu4.mjs";
|
|
20
20
|
import { t as ledgerOriginFromStored } from "./ledger-origin-BGRN77Oy.mjs";
|
|
21
21
|
import { a as writeMigrationTs, i as shebangLineFor, n as detectScaffoldRuntime, r as hasMigrationTs, t as ScaffoldRuntime } from "./migration-ts-CNaAtK8C.mjs";
|
|
22
|
-
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-
|
|
22
|
+
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-B20bgxF9.mjs";
|
|
23
23
|
export { APP_SPACE_ID, type AggregateContractSpace, type AggregateCurrentDBState, type AggregateMigrationEdgeRef, 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, type ExtensionSpaceApplyPathOutcome, HEAD_REF_NAME, type IntegrityComputationInput, type IntegrityQueryOptions, type IntegritySpaceState, type IntegrityViolation, 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 NoInvariantPathStructuralEdge, type OnDiskMigrationPackage, type PackageLoadProblem, type PathDecision, type PerSpacePlan, type PlannerError, type PlannerInput, type PlannerOutput, type PlannerSuccess, 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 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, allStorageElementsExternal, assertDescriptorSelfConsistency, assertHashIsGraphNode, assertValidSpaceId, buildFabricatedMigrationEdge, buildMigrationArtifacts, collectAggregateNamespaces, computeExtensionSpaceApplyPath, computeIntegrityViolations, computeMigrationHash, contractSnapshotDir, contractSpaceFromJson, copyFilesWithRename, createAggregateContractSpace, createContractSpaceAggregate, deleteRef, deriveProvidedInvariants, detectCycles, detectOrphans, detectScaffoldRuntime, emitContractSpaceArtifacts, errorContractDeserializationFailed, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant, findEdgeByDirName, findLatestMigration, findLeaf, findPath, findPathWithDecision, findPathWithInvariants, findReachableLeaves, formatMigrationDirName, gatherDiskContractSpaceState, hasMigrationTs, isDirectEntrypoint, isGraphNode, isValidSpaceId, ledgerOriginFromStored, listContractSpaceDirectories, loadContractSpaceAggregate, loadProblemToViolation, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, parseContractRef, parseMigrationRef, planAllSpaces, planMigration, readContractSnapshotDts, readContractSnapshotJson, readContractSnapshotJsonTolerant, readContractSpaceHeadRef, readMigrationPackage, readMigrationsDir, readRef, readRefs, reconstructGraph, refsByContractHash, requireHeadRef, resolveRecordedPath, resolveRef, resolveRefsByContractHash, shebangLineFor, snapshotsImportPathFrom, spaceMigrationDirectory, spaceRefsDirectory, validateInvariantId, validateRefName, validateRefValue, verifyContractSpaces, verifyMigration, verifyMigrationHash, writeContractSnapshot, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage, writeMigrationTs, writeRef };
|
package/dist/migration-tools.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { O as errorNoInvariantPath, P as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, i as errorContractDeserializationFailed, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-
|
|
2
|
-
import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as readContractSnapshotDts, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-
|
|
1
|
+
import { O as errorNoInvariantPath, P as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, i as errorContractDeserializationFailed, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-CcEpbfnE-CsSXrttT.mjs";
|
|
2
|
+
import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as readContractSnapshotDts, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs";
|
|
3
3
|
import { n as verifyMigrationHash, t as computeMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
4
|
-
import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-
|
|
5
|
-
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-
|
|
4
|
+
import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-DcFfhJMZ-BHDWZP9k.mjs";
|
|
5
|
+
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-DsViRB_O-Ci1kJGBg.mjs";
|
|
6
6
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
7
|
-
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-
|
|
8
|
-
import { a as findPath, c as findReachableLeaves, i as findLeaf, l as reconstructGraph, n as detectOrphans, o as findPathWithDecision, r as findLatestMigration, s as findPathWithInvariants, t as detectCycles } from "./migration-graph-
|
|
9
|
-
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-
|
|
10
|
-
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-
|
|
11
|
-
import { a as createAggregateContractSpace, c as loadProblemToViolation, d as resolveRecordedPath, f as verifyMigration, i as computeIntegrityViolations, l as planMigration, n as buildFabricatedMigrationEdge, o as createContractSpaceAggregate, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-
|
|
12
|
-
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-
|
|
13
|
-
import { n as parseContractRef, r as parseMigrationRef, t as findEdgeByDirName } from "./ref-resolution-
|
|
7
|
+
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-BoITerZB-C2-x1Qp6.mjs";
|
|
8
|
+
import { a as findPath, c as findReachableLeaves, i as findLeaf, l as reconstructGraph, n as detectOrphans, o as findPathWithDecision, r as findLatestMigration, s as findPathWithInvariants, t as detectCycles } from "./migration-graph-DwXAHP6T-NgmP2DNz.mjs";
|
|
9
|
+
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-KVVlm3lE-BcqdpdYD.mjs";
|
|
10
|
+
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-DomK5uP5-CyI3hD3Q.mjs";
|
|
11
|
+
import { a as createAggregateContractSpace, c as loadProblemToViolation, d as resolveRecordedPath, f as verifyMigration, i as computeIntegrityViolations, l as planMigration, n as buildFabricatedMigrationEdge, o as createContractSpaceAggregate, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-BOlLu7k7.mjs";
|
|
12
|
+
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-CHrjWRoZ.mjs";
|
|
13
|
+
import { n as parseContractRef, r as parseMigrationRef, t as findEdgeByDirName } from "./ref-resolution-Cbdejrwt.mjs";
|
|
14
14
|
import { i as writeMigrationTs, n as hasMigrationTs, r as shebangLineFor, t as detectScaffoldRuntime } from "./migration-ts-DdVm0rws.mjs";
|
|
15
|
-
import { i as isDirectEntrypoint, n as MigrationContractViews, r as buildMigrationArtifacts, t as Migration } from "./migration-
|
|
15
|
+
import { i as isDirectEntrypoint, n as MigrationContractViews, r as buildMigrationArtifacts, t as Migration } from "./migration-CWSj4pMr.mjs";
|
|
16
16
|
import { t as ledgerOriginFromStored } from "./ledger-origin-D7PN4Fon.mjs";
|
|
17
17
|
export { APP_SPACE_ID, EMPTY_CONTRACT_HASH, HEAD_REF_NAME, Migration, MigrationContractViews, MigrationToolsError, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, allStorageElementsExternal, assertDescriptorSelfConsistency, assertHashIsGraphNode, assertValidSpaceId, buildFabricatedMigrationEdge, buildMigrationArtifacts, collectAggregateNamespaces, computeExtensionSpaceApplyPath, computeIntegrityViolations, computeMigrationHash, contractSnapshotDir, contractSpaceFromJson, copyFilesWithRename, createAggregateContractSpace, createContractSpaceAggregate, deleteRef, deriveProvidedInvariants, detectCycles, detectOrphans, detectScaffoldRuntime, emitContractSpaceArtifacts, errorContractDeserializationFailed, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant, findEdgeByDirName, findLatestMigration, findLeaf, findPath, findPathWithDecision, findPathWithInvariants, findReachableLeaves, formatMigrationDirName, gatherDiskContractSpaceState, hasMigrationTs, isDirectEntrypoint, isGraphNode, isValidSpaceId, ledgerOriginFromStored, listContractSpaceDirectories, loadContractSpaceAggregate, loadProblemToViolation, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, parseContractRef, parseMigrationRef, planAllSpaces, planMigration, readContractSnapshotDts, readContractSnapshotJson, readContractSnapshotJsonTolerant, readContractSpaceHeadRef, readMigrationPackage, readMigrationsDir, readRef, readRefs, reconstructGraph, refsByContractHash, requireHeadRef, resolveRecordedPath, resolveRef, resolveRefsByContractHash, shebangLineFor, snapshotsImportPathFrom, spaceMigrationDirectory, spaceRefsDirectory, validateInvariantId, validateRefName, validateRefValue, verifyContractSpaces, verifyMigration, verifyMigrationHash, writeContractSnapshot, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage, writeMigrationTs, writeRef };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createAggregateContractSpace, c as loadProblemToViolation, d as resolveRecordedPath, f as verifyMigration, i as computeIntegrityViolations, l as planMigration, n as buildFabricatedMigrationEdge, o as createContractSpaceAggregate, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-
|
|
1
|
+
import { a as createAggregateContractSpace, c as loadProblemToViolation, d as resolveRecordedPath, f as verifyMigration, i as computeIntegrityViolations, l as planMigration, n as buildFabricatedMigrationEdge, o as createContractSpaceAggregate, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-BOlLu7k7.mjs";
|
|
2
2
|
export { allStorageElementsExternal, buildFabricatedMigrationEdge, collectAggregateNamespaces, computeIntegrityViolations, createAggregateContractSpace, createContractSpaceAggregate, loadContractSpaceAggregate, loadProblemToViolation, planMigration, requireHeadRef, resolveRecordedPath, verifyMigration };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as readContractSnapshotDts, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-
|
|
1
|
+
import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as readContractSnapshotDts, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs";
|
|
2
2
|
export { contractSnapshotDir, readContractSnapshotDts, readContractSnapshotJson, readContractSnapshotJsonTolerant, snapshotsImportPathFrom, writeContractSnapshot };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { O as errorNoInvariantPath, P as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, i as errorContractDeserializationFailed, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-
|
|
1
|
+
import { O as errorNoInvariantPath, P as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, i as errorContractDeserializationFailed, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, t as MigrationToolsError } from "./errors-CcEpbfnE-CsSXrttT.mjs";
|
|
2
2
|
export { MigrationToolsError, errorContractDeserializationFailed, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-
|
|
1
|
+
import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-DcFfhJMZ-BHDWZP9k.mjs";
|
|
2
2
|
export { deriveProvidedInvariants, validateInvariantId };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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-DsViRB_O-Ci1kJGBg.mjs";
|
|
2
2
|
export { copyFilesWithRename, formatMigrationDirName, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, readMigrationPackage, readMigrationsDir, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-
|
|
2
|
-
import { a as findPath, c as findReachableLeaves, i as findLeaf, l as reconstructGraph, n as detectOrphans, o as findPathWithDecision, r as findLatestMigration, s as findPathWithInvariants, t as detectCycles } from "./migration-graph-
|
|
1
|
+
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-BoITerZB-C2-x1Qp6.mjs";
|
|
2
|
+
import { a as findPath, c as findReachableLeaves, i as findLeaf, l as reconstructGraph, n as detectOrphans, o as findPathWithDecision, r as findLatestMigration, s as findPathWithInvariants, t as detectCycles } from "./migration-graph-DwXAHP6T-NgmP2DNz.mjs";
|
|
3
3
|
export { assertHashIsGraphNode, detectCycles, detectOrphans, findLatestMigration, findLeaf, findPath, findPathWithDecision, findPathWithInvariants, findReachableLeaves, isGraphNode, reconstructGraph };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as isDirectEntrypoint, n as MigrationContractViews, r as buildMigrationArtifacts, t as Migration } from "./migration-
|
|
1
|
+
import { i as isDirectEntrypoint, n as MigrationContractViews, r as buildMigrationArtifacts, t as Migration } from "./migration-CWSj4pMr.mjs";
|
|
2
2
|
export { Migration, MigrationContractViews, buildMigrationArtifacts, isDirectEntrypoint };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as parseContractRef, r as parseMigrationRef, t as findEdgeByDirName } from "./ref-resolution-
|
|
1
|
+
import { n as parseContractRef, r as parseMigrationRef, t as findEdgeByDirName } from "./ref-resolution-Cbdejrwt.mjs";
|
|
2
2
|
export { findEdgeByDirName, parseContractRef, parseMigrationRef };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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-KVVlm3lE-BcqdpdYD.mjs";
|
|
2
2
|
export { HEAD_REF_NAME, deleteRef, readRef, readRefs, refsByContractHash, resolveRef, resolveRefsByContractHash, validateRefName, validateRefValue, writeRef };
|
|
@@ -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-C3PiFBk3-DfomYyOE.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-B20bgxF9.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
|
-
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-
|
|
2
|
-
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-
|
|
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-DomK5uP5-CyI3hD3Q.mjs";
|
|
2
|
+
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-CHrjWRoZ.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 };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as ShellReexportMapping, i as ShellPackageMapping, n as ShellKind, o as excludedSubpaths, r as ShellName, s as publicShells, t as ShellDefinition } from "./shells-CIUmT4u4.mjs";
|
|
2
|
-
import { a as ScaffoldImportRoot, c as createScaffoldSpecifierResolver, d as importedSpecifiers, f as internalImportRoot, h as transitiveImports, i as ImportSpecifierResolver, l as directDependencyShells, m as resolveImportSpecifier, n as ImportRootError, o as buildOwnerIndex, p as platformEntrypointOf, r as ImportRootMode, s as createImportSpecifierResolver, t as ImportRoot, u as importRootForDependencies } from "./import-roots-
|
|
2
|
+
import { a as ScaffoldImportRoot, c as createScaffoldSpecifierResolver, d as importedSpecifiers, f as internalImportRoot, h as transitiveImports, i as ImportSpecifierResolver, l as directDependencyShells, m as resolveImportSpecifier, n as ImportRootError, o as buildOwnerIndex, p as platformEntrypointOf, r as ImportRootMode, s as createImportSpecifierResolver, t as ImportRoot, u as importRootForDependencies } from "./import-roots-ARK1wjzc.mjs";
|
|
3
3
|
export { ImportRoot, ImportRootError, ImportRootMode, ImportSpecifierResolver, ScaffoldImportRoot, ShellDefinition, ShellKind, ShellName, ShellPackageMapping, ShellReexportMapping, buildOwnerIndex, createImportSpecifierResolver, createScaffoldSpecifierResolver, directDependencyShells, excludedSubpaths, importRootForDependencies, importedSpecifiers, internalImportRoot, platformEntrypointOf, publicShells, resolveImportSpecifier, transitiveImports };
|
package/dist/publish-surface.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as publicShells, t as excludedSubpaths } from "./shells-C4HbRAr5.mjs";
|
|
2
|
-
import { a as directDependencyShells, c as internalImportRoot, d as transitiveImports, i as createScaffoldSpecifierResolver, l as platformEntrypointOf, n as buildOwnerIndex, o as importRootForDependencies, r as createImportSpecifierResolver, s as importedSpecifiers, t as ImportRootError, u as resolveImportSpecifier } from "./import-roots-
|
|
2
|
+
import { a as directDependencyShells, c as internalImportRoot, d as transitiveImports, i as createScaffoldSpecifierResolver, l as platformEntrypointOf, n as buildOwnerIndex, o as importRootForDependencies, r as createImportSpecifierResolver, s as importedSpecifiers, t as ImportRootError, u as resolveImportSpecifier } from "./import-roots-D0H8HuRw.mjs";
|
|
3
3
|
export { ImportRootError, buildOwnerIndex, createImportSpecifierResolver, createScaffoldSpecifierResolver, directDependencyShells, excludedSubpaths, importRootForDependencies, importedSpecifiers, internalImportRoot, platformEntrypointOf, publicShells, resolveImportSpecifier, transitiveImports };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ScaffoldImportRoot, c as createScaffoldSpecifierResolver, d as importedSpecifiers, f as internalImportRoot, h as transitiveImports, i as ImportSpecifierResolver, l as directDependencyShells, m as resolveImportSpecifier, n as ImportRootError, o as buildOwnerIndex, p as platformEntrypointOf, r as ImportRootMode, s as createImportSpecifierResolver, t as ImportRoot, u as importRootForDependencies } from "./import-roots-
|
|
1
|
+
import { a as ScaffoldImportRoot, c as createScaffoldSpecifierResolver, d as importedSpecifiers, f as internalImportRoot, h as transitiveImports, i as ImportSpecifierResolver, l as directDependencyShells, m as resolveImportSpecifier, n as ImportRootError, o as buildOwnerIndex, p as platformEntrypointOf, r as ImportRootMode, s as createImportSpecifierResolver, t as ImportRoot, u as importRootForDependencies } from "./import-roots-ARK1wjzc.mjs";
|
|
2
2
|
export { ImportRoot, ImportRootError, ImportRootMode, ImportSpecifierResolver, ScaffoldImportRoot, buildOwnerIndex, createImportSpecifierResolver, createScaffoldSpecifierResolver, directDependencyShells, importRootForDependencies, importedSpecifiers, internalImportRoot, platformEntrypointOf, resolveImportSpecifier, transitiveImports };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as directDependencyShells, c as internalImportRoot, d as transitiveImports, i as createScaffoldSpecifierResolver, l as platformEntrypointOf, n as buildOwnerIndex, o as importRootForDependencies, r as createImportSpecifierResolver, s as importedSpecifiers, t as ImportRootError, u as resolveImportSpecifier } from "./import-roots-
|
|
1
|
+
import { a as directDependencyShells, c as internalImportRoot, d as transitiveImports, i as createScaffoldSpecifierResolver, l as platformEntrypointOf, n as buildOwnerIndex, o as importRootForDependencies, r as createImportSpecifierResolver, s as importedSpecifiers, t as ImportRootError, u as resolveImportSpecifier } from "./import-roots-D0H8HuRw.mjs";
|
|
2
2
|
export { ImportRootError, buildOwnerIndex, createImportSpecifierResolver, createScaffoldSpecifierResolver, directDependencyShells, importRootForDependencies, importedSpecifiers, internalImportRoot, platformEntrypointOf, resolveImportSpecifier, transitiveImports };
|
|
@@ -17,7 +17,7 @@ Every model you define in your contract can be queried from your app. Your edito
|
|
|
17
17
|
```typescript
|
|
18
18
|
import { db } from '{{dbImportPath}}';
|
|
19
19
|
|
|
20
|
-
const user = await db.orm.User
|
|
20
|
+
const user = await db.orm.public.User
|
|
21
21
|
.where({ email: 'alice@example.com' })
|
|
22
22
|
.first();
|
|
23
23
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { r as getEmittedArtifactPaths, t as emit } from "./exports-
|
|
2
|
-
import { O as errorNoInvariantPath, P as errorUnknownInvariant, b as errorInvalidRefName, i as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-
|
|
3
|
-
import { a as snapshotsImportPathFrom, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-
|
|
1
|
+
import { r as getEmittedArtifactPaths, t as emit } from "./exports-Dw2WIX63-CQgI2e_L.mjs";
|
|
2
|
+
import { O as errorNoInvariantPath, P as errorUnknownInvariant, b as errorInvalidRefName, i as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-CcEpbfnE-CsSXrttT.mjs";
|
|
3
|
+
import { a as snapshotsImportPathFrom, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-BAmQkHe5-BJFpuIQQ.mjs";
|
|
4
4
|
import { n as verifyMigrationHash, t as computeMigrationHash } from "./hash-DH8hl5Rq-BpM2t3Nu.mjs";
|
|
5
|
-
import { t as deriveProvidedInvariants } from "./invariants-
|
|
6
|
-
import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-
|
|
5
|
+
import { t as deriveProvidedInvariants } from "./invariants-DcFfhJMZ-BHDWZP9k.mjs";
|
|
6
|
+
import { i as materialiseExtensionMigrationPackageIfMissing, r as formatMigrationDirName, u as writeMigrationPackage } from "./io-DsViRB_O-Ci1kJGBg.mjs";
|
|
7
7
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
8
|
-
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-
|
|
9
|
-
import { a as findPath, o as findPathWithDecision, r as findLatestMigration } from "./migration-graph-
|
|
10
|
-
import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-
|
|
11
|
-
import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID$1 } from "./verify-contract-spaces-
|
|
12
|
-
import { d as resolveRecordedPath, f as verifyMigration, l as planMigration, n as buildFabricatedMigrationEdge, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-
|
|
13
|
-
import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-
|
|
14
|
-
import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver } from "./import-roots-
|
|
15
|
-
import { n as parseContractRef, r as parseMigrationRef } from "./ref-resolution-
|
|
8
|
+
import { n as isGraphNode, t as assertHashIsGraphNode } from "./graph-membership-BoITerZB-C2-x1Qp6.mjs";
|
|
9
|
+
import { a as findPath, o as findPathWithDecision, r as findLatestMigration } from "./migration-graph-DwXAHP6T-NgmP2DNz.mjs";
|
|
10
|
+
import { d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-KVVlm3lE-BcqdpdYD.mjs";
|
|
11
|
+
import { a as isValidSpaceId, c as spaceMigrationDirectory, l as spaceRefsDirectory, o as listContractSpaceDirectories, s as readContractSpaceHeadRef, t as APP_SPACE_ID$1 } from "./verify-contract-spaces-DomK5uP5-CyI3hD3Q.mjs";
|
|
12
|
+
import { d as resolveRecordedPath, f as verifyMigration, l as planMigration, n as buildFabricatedMigrationEdge, r as collectAggregateNamespaces, s as loadContractSpaceAggregate, t as allStorageElementsExternal, u as requireHeadRef } from "./aggregate-BOlLu7k7.mjs";
|
|
13
|
+
import { i as emitContractSpaceArtifacts, o as planAllSpaces } from "./spaces-CHrjWRoZ.mjs";
|
|
14
|
+
import { c as internalImportRoot, o as importRootForDependencies, r as createImportSpecifierResolver } from "./import-roots-D0H8HuRw.mjs";
|
|
15
|
+
import { n as parseContractRef, r as parseMigrationRef } from "./ref-resolution-Cbdejrwt.mjs";
|
|
16
16
|
import { i as writeMigrationTs } from "./migration-ts-DdVm0rws.mjs";
|
|
17
17
|
import { createRequire } from "node:module";
|
|
18
18
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
@@ -32,7 +32,7 @@ import { createHash } from "node:crypto";
|
|
|
32
32
|
import { canonicalizeJson } from "@prisma/orm-framework/components/utils";
|
|
33
33
|
import { abortable } from "@prisma/orm-framework/utils/abortable";
|
|
34
34
|
import { resolve as resolve$1 } from "node:path";
|
|
35
|
-
//#region ../../../1-framework/3-tooling/cli/dist/ref-
|
|
35
|
+
//#region ../../../1-framework/3-tooling/cli/dist/ref-dWFulULw.mjs
|
|
36
36
|
/**
|
|
37
37
|
* The typed remediation the CLI attaches to its own errors and findings.
|
|
38
38
|
* Constructors live here rather than in any library the CLI calls: naming a
|
|
@@ -2832,7 +2832,7 @@ function validateProviderResult(providerResult) {
|
|
|
2832
2832
|
* Canonical contract emit operation.
|
|
2833
2833
|
*
|
|
2834
2834
|
* This is the SINGLE publication path used by both the CLI command
|
|
2835
|
-
* (`prisma
|
|
2835
|
+
* (`prisma contract emit`) and the Vite plugin
|
|
2836
2836
|
* (`@internal/vite-plugin-contract-emit`). New callers must go through this
|
|
2837
2837
|
* function rather than re-implementing load → emit → publish.
|
|
2838
2838
|
*
|
|
@@ -4684,4 +4684,4 @@ async function executeRefListCommand(options) {
|
|
|
4684
4684
|
//#endregion
|
|
4685
4685
|
export { loadContractRawSafely as $, errorMigrationPlanningFailed as A, statusForMigrationHash as At, executeDbUpdate as B, errorDestructiveChanges as C, resolveRefAdvancementFields as Ct, errorLegendHumanOnly as D, runMigrationCheck as Dt, errorHashMismatch as E, runContractSpaceSeedPhase as Et, errorTargetMigrationNotSupported as F, executeRefAdvancement as G, executeMigrateShowPlan as H, errorTargetMismatch as I, executeRefSetCommand as J, executeRefDeleteCommand as K, errorUnexpected as L, errorPathUnreachable as M, toDeclaredExtensionsFromRaw as Mt, errorRunnerFailed as N, errorMarkerMissing as O, runMigrationList as Ot, errorRuntime as P, loadAggregateIntegrityViolations as Q, executeContractEmit as R, errorDatabaseConnectionRequired as S, resolveMigrationRef as St, errorFileNotFound as T, runCommandAction as Tt, executeMigrationNewCommand as U, executeDbVerify as V, executeMigrationPlanCommand as W, hasMigrationPath as X, findPackageByDirPath as Y, listRefsByContractHash as Z, enumerateCheckSpaces as _, requireLiveDatabase as _t, buildContractSpaceAggregate as a, maskConnectionUrl as at, errorContractArgConflict as b, resolveContractRefToSnapshot as bt, buildRefAdvancementFields as c, readContractEnvelope as ct, closeQuietly as d, refuseContractSpaceIntegrity as dt, loadContractSpaceAggregateForCli as et, computeRefAdvancementName as f, refuseDeclaredExtensionTargetMismatch as ft, enrichContract as g, refuseUnknownInvariants as gt, disposeEmitQueue as h, refusePackageCorruptionOnAggregate as ht, appliedHashesFromLedger as i, mapIntegrityViolations as it, errorNoMigrations as j, targetSupportsMigrations as jt, errorMigrationPackageNotFound as k, sanitizeErrorMessage as kt, checkSingleTarget as l, readContractIR as lt, deriveStatusEdgeAnnotations as m, refuseMissingInvariantPath as mt, advanceRefSafely as n, mapCaughtMigrationError as nt, buildMigrationSpaceGraphEntries as o, migrationSpaceListEntriesFromAggregate as ot, createControlClient as p, refuseMarkerOutsideGraph as pt, executeRefListCommand as q, appContractStandInFromIdentity as r, mapContractAtError as rt, buildReadAggregate as s, originHashForStatus as st, CliStructuredError$1 as t, looksLikePath as tt, chooseAction as u, readMigrationRefs as ut, errorConfigValidation$1 as v, resolveAppTargetPath as vt, errorDriverRequired as w, resolveToForPlan as wt, errorContractValidationFailed as x, resolveFromForPlan as xt, errorConsentPlanMismatch as y, resolveContractRef$1 as yt, executeDbInit as z };
|
|
4686
4686
|
|
|
4687
|
-
//# sourceMappingURL=ref-
|
|
4687
|
+
//# sourceMappingURL=ref-dWFulULw-TMeX1ZM1.mjs.map
|