@prisma/orm-toolchain 8.0.0-rc.17-dev.28 → 8.0.0-rc.17-dev.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{aggregate-DlfOyErc.mjs → aggregate-C0Kci0iw.mjs} +7 -7
- package/dist/{aggregate-DlfOyErc.mjs.map → aggregate-C0Kci0iw.mjs.map} +1 -1
- package/dist/{caught-errors-HFQjjQVE-b_GDV-6J.mjs → caught-errors-DUV-u8yQ-DuPp394m.mjs} +45 -8
- package/dist/caught-errors-DUV-u8yQ-DuPp394m.mjs.map +1 -0
- package/dist/cli-telemetry.mjs +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +22 -54
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +4 -2
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +2 -2
- package/dist/cli__control-api__testing.d.mts +1 -1
- package/dist/cli__migration-cli.mjs +62 -18
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/config-loader.d.mts +2 -2
- package/dist/config-loader.mjs +2 -2
- package/dist/{contract-snapshot-store-1S_6vaGt-HJIMKsVd.mjs → contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs} +3 -3
- package/dist/{contract-snapshot-store-1S_6vaGt-HJIMKsVd.mjs.map → contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs.map} +1 -1
- package/dist/{db-sign-BPf9SzzX-CwOFPxoZ.d.mts → db-sign-DvCsMwUF-D5UIkRXD.d.mts} +2 -2
- package/dist/{db-sign-BPf9SzzX-CwOFPxoZ.d.mts.map → db-sign-DvCsMwUF-D5UIkRXD.d.mts.map} +1 -1
- package/dist/{errors-DD6iLGXk-6I9PqjpZ.mjs → errors-B1xJ5JTo-CrQL55Qf.mjs} +3 -3
- package/dist/{errors-DD6iLGXk-6I9PqjpZ.mjs.map → errors-B1xJ5JTo-CrQL55Qf.mjs.map} +1 -1
- package/dist/{exports-Cxv8mNRJ.mjs → exports-D997yN01.mjs} +2 -2
- package/dist/{exports-Cxv8mNRJ.mjs.map → exports-D997yN01.mjs.map} +1 -1
- package/dist/{exports-C7GzkPEc.mjs → exports-JFLSlPBW.mjs} +4 -3
- package/dist/{exports-C7GzkPEc.mjs.map → exports-JFLSlPBW.mjs.map} +1 -1
- package/dist/{graph-membership-C_ZO26nT-B7C4CJsh.mjs → graph-membership-C-5WMh1R-BUtW54H2.mjs} +3 -3
- package/dist/{graph-membership-C_ZO26nT-B7C4CJsh.mjs.map → graph-membership-C-5WMh1R-BUtW54H2.mjs.map} +1 -1
- package/dist/{index-DVcYlnHq.d.mts → index-CWPFeYyi.d.mts} +3 -2
- package/dist/{index-DVcYlnHq.d.mts.map → index-CWPFeYyi.d.mts.map} +1 -1
- package/dist/{invariants-C0lpc60l-CMUCvk4O.mjs → invariants-1xSrwDkH-BoUuNrf4.mjs} +3 -3
- package/dist/{invariants-C0lpc60l-CMUCvk4O.mjs.map → invariants-1xSrwDkH-BoUuNrf4.mjs.map} +1 -1
- package/dist/{io-xKnQrxIC-CEXpCgE_.mjs → io-CUFeeOVP-CEgOEVwW.mjs} +5 -5
- package/dist/{io-xKnQrxIC-CEXpCgE_.mjs.map → io-CUFeeOVP-CEgOEVwW.mjs.map} +1 -1
- package/dist/{migration-oIynqb-J.mjs → migration-CZrQ_3zY.mjs} +3 -3
- package/dist/{migration-oIynqb-J.mjs.map → migration-CZrQ_3zY.mjs.map} +1 -1
- package/dist/migration-tools.mjs +11 -11
- 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 +1 -1
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{ref-Cc_CTagE-BYkEh32b.mjs → ref-BITTabCb-BMk154EL.mjs} +100 -69
- package/dist/ref-BITTabCb-BMk154EL.mjs.map +1 -0
- package/dist/{ref-resolution-Be_zewf7.mjs → ref-resolution-kNMjYJ26.mjs} +2 -2
- package/dist/{ref-resolution-Be_zewf7.mjs.map → ref-resolution-kNMjYJ26.mjs.map} +1 -1
- package/dist/{refs-qwvw4_dV-DNg_7WTD.mjs → refs-CS997f-J-BxkRLuCE.mjs} +3 -3
- package/dist/{refs-qwvw4_dV-DNg_7WTD.mjs.map → refs-CS997f-J-BxkRLuCE.mjs.map} +1 -1
- package/dist/{spaces-DGu96Hkk.mjs → spaces-CtxjvIS0.mjs} +5 -5
- package/dist/{spaces-DGu96Hkk.mjs.map → spaces-CtxjvIS0.mjs.map} +1 -1
- package/dist/{verify-contract-spaces-CYjc343k-ClHHEkJF.mjs → verify-contract-spaces-sL5mlmCX-K2P69KDp.mjs} +4 -4
- package/dist/{verify-contract-spaces-CYjc343k-ClHHEkJF.mjs.map → verify-contract-spaces-sL5mlmCX-K2P69KDp.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.mjs +2 -2
- package/package.json +12 -12
- package/dist/caught-errors-HFQjjQVE-b_GDV-6J.mjs.map +0 -1
- package/dist/ref-Cc_CTagE-BYkEh32b.mjs.map +0 -1
|
@@ -25,6 +25,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
25
25
|
//#endregion
|
|
26
26
|
//#region ../../../1-framework/3-tooling/config-loader/dist/exports/index.mjs
|
|
27
27
|
var exports_exports = /* @__PURE__ */ __exportAll({
|
|
28
|
+
CONFIG_FILENAME: () => CONFIG_FILENAME,
|
|
28
29
|
ORM_CONFIG_SECTION_NAME: () => "orm",
|
|
29
30
|
buildLoadedConfig: () => buildLoadedConfig,
|
|
30
31
|
evaluateConfigModule: () => evaluateConfigModule,
|
|
@@ -432,7 +433,7 @@ async function loadConfigFiles(configPath, options) {
|
|
|
432
433
|
/* v8 ignore next -- a config that evaluated always carries its resolved path */
|
|
433
434
|
return notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));
|
|
434
435
|
/* v8 ignore next -- @preserve */
|
|
435
|
-
const requested = result.configFile ?? join(configCwd,
|
|
436
|
+
const requested = result.configFile ?? join(configCwd, "prisma.config.ts");
|
|
436
437
|
const files = layers.flatMap((layer, index) => isRecord(layer.config) && Object.keys(layer.config).length > 0 ? [{
|
|
437
438
|
path: index === 0 ? requested : resolve(configCwd, layer.configFile ?? requested),
|
|
438
439
|
sections: sectionsOf(layer.config)
|
|
@@ -533,6 +534,6 @@ async function loadConfigForFile(filePath) {
|
|
|
533
534
|
return loadConfig(configPath);
|
|
534
535
|
}
|
|
535
536
|
//#endregion
|
|
536
|
-
export {
|
|
537
|
+
export { validateOrmSection as _, expandContractInputs as a, globContractInputMatching as c, loadConfigFiles as d, loadConfigForFile as f, requireConfigSections as g, ormConfigSection as h, evaluateConfigModule as i, isConfigSection as l, ormConfigSchema as m, ORM_CONFIG_SECTION_NAME as n, exports_exports as o, loadConfigForSections as p, buildLoadedConfig as r, findNearestConfigPathForFile as s, CONFIG_FILENAME as t, loadConfig as u };
|
|
537
538
|
|
|
538
|
-
//# sourceMappingURL=exports-
|
|
539
|
+
//# sourceMappingURL=exports-JFLSlPBW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports-C7GzkPEc.mjs","names":[],"sources":["../../../../1-framework/3-tooling/config-loader/dist/exports/index.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { dirname, join, matchesGlob, resolve } from \"pathe\";\nimport { glob, isDynamicPattern } from \"tinyglobby\";\nimport { realpathSync } from \"node:fs\";\nimport { access } from \"node:fs/promises\";\nimport { pathToFileURL } from \"node:url\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { CliStructuredError, errorConfigEvaluationFailed, errorConfigFileNotFound, errorConfigValidation, errorConfigVersionMarkerMissing } from \"@internal/errors/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { configSchema, defineConfigSection, reference, validateSectionWithSchema } from \"@prisma/cli-engine\";\n//#region src/expand-contract-inputs.ts\nconst UNC_PREFIX_RE = /^(?:\\\\\\\\|\\/\\/)/;\nfunction isUncLike(entry) {\n\treturn UNC_PREFIX_RE.test(entry);\n}\nfunction resolveLiteral(entry) {\n\treturn isUncLike(entry) ? entry : resolve(entry);\n}\n/**\n* Expands a finalized contract source input list into its member file set:\n* absolute, deduped by canonical path, sorted. `patterns` must already be\n* absolute (the `orm` config schema resolves each entry against the config\n* file that wrote it but does not expand it).\n*\n* A wildcard-free entry (per tinyglobby's own magic-character check) passes\n* through verbatim — no globbing, no existence check, no directory\n* expansion — so a literal file, a nonexistent path (its read error\n* surfaces downstream), and a directory (`contract-prisma7`'s adoption\n* surface) all reach the result unchanged. Only entries containing glob\n* magic run through `tinyglobby`, directories-not-auto-expanded and\n* files-only; a glob matching nothing contributes nothing — no diagnostic\n* here.\n*/\nasync function expandContractInputs(patterns) {\n\tif (patterns === void 0 || patterns.length === 0) return [];\n\tconst literals = [];\n\tconst globPatterns = [];\n\tfor (const pattern of patterns) (isDynamicPattern(pattern) ? globPatterns : literals).push(pattern);\n\tconst globMatches = globPatterns.length === 0 ? [] : await glob(globPatterns, {\n\t\tabsolute: true,\n\t\tonlyFiles: true,\n\t\texpandDirectories: false\n\t});\n\tconst canonical = new Set([...literals, ...globMatches].map(resolveLiteral));\n\treturn Array.from(canonical).sort();\n}\n/**\n* The first glob entry of `patterns` that `path` matches, whether or not a\n* file exists at `path`. Both must be absolute.\n*/\nfunction globContractInputMatching(patterns, path) {\n\treturn patterns.find((pattern) => isDynamicPattern(pattern) && matchesGlob(path, pattern));\n}\n//#endregion\n//#region src/orm-section.ts\n/** The single config section the `orm` command family owns. */\nconst ORM_CONFIG_SECTION_NAME = \"orm\";\nconst CONFIG_SECTIONS = [\n\t\"family\",\n\t\"target\",\n\t\"adapter\",\n\t\"driver\",\n\t\"extensions\",\n\t\"db\",\n\t\"contract\",\n\t\"migrations\",\n\t\"formatter\"\n];\nfunction isConfigSection(value) {\n\treturn CONFIG_SECTIONS.some((section) => section === value);\n}\n/**\n* The fields that identify a control descriptor. Only these are declared: a\n* descriptor is a runtime object the family builds, and its other members\n* (codec tables, the contract serializer, migration hooks) pass through. Each\n* descriptor is declared a reference, so the command receives the object the\n* config file built.\n*/\nconst descriptorFields = {\n\tid: \"string\",\n\tfamilyId: \"string\",\n\tversion: \"string\",\n\tcreate: \"Function\"\n};\nconst targetLikeFields = {\n\t...descriptorFields,\n\ttargetId: \"string\"\n};\n/**\n* The contract source provider: `load` closes over the authored contract,\n* `inputs` are paths the schema resolves against the config file, and\n* `format` names the language the inputs are written in. Other keys a\n* provider carries pass through.\n*/\nconst contractSource = {\n\tload: \"Function\",\n\t\"inputs?\": \"path[]\",\n\tformat: \"'psl' | 'typescript'\",\n\t\"parserOptions?\": {\n\t\t\"+\": \"reject\",\n\t\t\"grammar?\": \"'prisma-7' | 'prisma-8'\"\n\t}\n};\n/** Each subsection's own shape, without the rules that relate subsections to one another. */\nconst ormSubsectionsSchema = configSchema({\n\tfamily: reference(configSchema({\n\t\tkind: \"'family'\",\n\t\t...descriptorFields,\n\t\temission: \"object\"\n\t})),\n\ttarget: reference(configSchema({\n\t\tkind: \"'target'\",\n\t\t...targetLikeFields\n\t})),\n\tadapter: reference(configSchema({\n\t\tkind: \"'adapter'\",\n\t\t...targetLikeFields\n\t})),\n\t\"driver?\": reference(configSchema({\n\t\tkind: \"'driver'\",\n\t\t...targetLikeFields\n\t})),\n\t\"extensions?\": [reference(configSchema({\n\t\tkind: \"'extension'\",\n\t\t...targetLikeFields\n\t})), \"[]\"],\n\t\"db?\": { \"connection?\": reference(configSchema(\"unknown\")) },\n\t\"contract?\": {\n\t\tsource: contractSource,\n\t\toutput: [\n\t\t\t\"path\",\n\t\t\t\"=\",\n\t\t\t() => \"src/prisma/contract.json\"\n\t\t]\n\t},\n\tmigrations: [\n\t\t{ dir: [\n\t\t\t\"path\",\n\t\t\t\"=\",\n\t\t\t() => \"./migrations\"\n\t\t] },\n\t\t\"=\",\n\t\t() => ({})\n\t],\n\t\"formatter?\": {\n\t\t\"indent?\": \"number.integer >= 1 | 'tab'\",\n\t\t\"newline?\": \"'LF' | 'CRLF'\"\n\t}\n});\n/**\n* Every broken rule relating the descriptor subsections: each descriptor\n* shares the family's `familyId`, and each target-bound descriptor shares\n* the target's `targetId`. A rule is checked only when `checked` accepts\n* both subsections it relates, so a loader can check the subsections that\n* validated while others have diagnostics.\n*/\nfunction descriptorRelationshipProblems(config, checked) {\n\tconst family = checked(\"family\") ? config.family : void 0;\n\tconst target = checked(\"target\") ? config.target : void 0;\n\tconst bound = [\n\t\t[[\"target\"], target],\n\t\t[[\"adapter\"], checked(\"adapter\") ? config.adapter : void 0],\n\t\t[[\"driver\"], checked(\"driver\") ? config.driver : void 0],\n\t\t...(checked(\"extensions\") ? config.extensions ?? [] : []).map((extension, index) => [[\"extensions\", index], extension])\n\t];\n\tconst problems = [];\n\tfor (const [path, descriptor] of bound) {\n\t\tif (descriptor === void 0) continue;\n\t\tif (family !== void 0 && descriptor.familyId !== family.familyId) problems.push({\n\t\t\tpath: [...path, \"familyId\"],\n\t\t\texpected: `Config.family.familyId (${family.familyId})`,\n\t\t\tactual: descriptor.familyId\n\t\t});\n\t\tif (target !== void 0 && path[0] !== \"target\" && descriptor.targetId !== target.targetId) problems.push({\n\t\t\tpath: [...path, \"targetId\"],\n\t\t\texpected: `Config.target.targetId (${target.targetId})`,\n\t\t\tactual: descriptor.targetId\n\t\t});\n\t}\n\treturn problems;\n}\n/**\n* The shape of the `orm` section of `prisma.config.ts`, declared once. The\n* CLI engine derives validation, the diagnostics naming a bad field and the\n* file to fix, and the resolution of every `path` field against the config\n* file that wrote it (prisma-cli ADR 0005). Relative paths are resolved\n* before any command sees the value, and the value carries `baseDir`.\n*/\nconst ormConfigSchema = ormSubsectionsSchema.narrow((config, ctx) => {\n\tif (\"extensionPacks\" in config) return ctx.reject({\n\t\tpath: [\"extensionPacks\"],\n\t\tmessage: \"Config.extensionPacks is no longer supported; rename it to Config.extensions\"\n\t});\n\tconst problems = descriptorRelationshipProblems(config, () => true);\n\tfor (const problem of problems) ctx.error({\n\t\tpath: [...problem.path],\n\t\texpected: problem.expected,\n\t\tactual: problem.actual\n\t});\n\treturn problems.length === 0;\n});\n/**\n* The section token the ORM's commands declare in `needs.config`. The\n* engine validates the merged section with its provenance and hands the\n* handler the value: absolute paths, `migrations.dir` defaulted, `baseDir`\n* recorded.\n*/\nconst ormConfigSection = blindCast(defineConfigSection({\n\tname: \"orm\",\n\tschema: ormConfigSchema\n}));\n/**\n* Validates a raw `orm` section the way the engine does for a command,\n* for the loaders and tools that read the config outside a command run.\n*/\nfunction validateOrmSection(raw, provenance) {\n\treturn blindCast(validateSectionWithSchema(\"orm\", ormConfigSchema, raw, provenance));\n}\n/**\n* Validates the shape of every subsection except `failing`, which comes back\n* as authored. A loader uses it when some subsections have diagnostics, so a\n* caller that reads only the others still gets their paths resolved and\n* defaults applied. The rules relating subsections are not applied here; see\n* {@link descriptorRelationshipProblems}.\n*/\nfunction validateOrmSectionExcept(raw, provenance, failing) {\n\tconst healthy = CONFIG_SECTIONS.filter((section) => !failing.has(section));\n\treturn validateSectionWithSchema(\"orm\", ormSubsectionsSchema.pick(...healthy), raw, provenance);\n}\n//#endregion\n//#region src/load.ts\nconst CONFIG_FILENAME = \"prisma.config.ts\";\nasync function findNearestConfigPathForFile(filePath) {\n\tlet current = dirname(resolve(process.cwd(), filePath));\n\twhile (true) {\n\t\tconst candidate = join(current, CONFIG_FILENAME);\n\t\tif (await fileExists(candidate)) return candidate;\n\t\tconst parent = dirname(current);\n\t\tif (parent === current) return;\n\t\tcurrent = parent;\n\t}\n}\nasync function fileExists(path) {\n\ttry {\n\t\tawait access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction collectArtifactCollisionDiagnostics(contract) {\n\tconst inputs = contract.source.inputs;\n\tconst output = contract.output;\n\tif (inputs === void 0 || output === void 0) return [];\n\tlet emittedArtifactPaths;\n\ttry {\n\t\temittedArtifactPaths = getEmittedArtifactPaths(output);\n\t} catch (error) {\n\t\treturn [errorConfigValidation(\"contract.output\", {\n\t\t\t/* v8 ignore next -- getEmittedArtifactPaths only ever throws an Error */\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tsection: \"contract\"\n\t\t})];\n\t}\n\tconst emittedPaths = /* @__PURE__ */ new Set([emittedArtifactPaths.jsonPath, emittedArtifactPaths.dtsPath]);\n\tif (inputs.some((input) => emittedPaths.has(input))) return [errorConfigValidation(\"contract.source.inputs[]\", {\n\t\twhy: \"Config.contract.source.inputs must not include emitted artifact paths derived from contract.output\",\n\t\tsection: \"contract\"\n\t})];\n\treturn [];\n}\nfunction validateLoadedSection(rawConfig, provenance) {\n\tconst validation = validateOrmSection(rawConfig, provenance);\n\tif (!validation.ok) {\n\t\tconst diagnostics = validation.diagnostics.map((diagnostic) => {\n\t\t\tconst field = typeof diagnostic.meta?.[\"field\"] === \"string\" ? diagnostic.meta[\"field\"] : \"\";\n\t\t\tconst section = field.split(\".\")[0] ?? \"\";\n\t\t\treturn errorConfigValidation(field, {\n\t\t\t\twhy: diagnostic.summary,\n\t\t\t\t...isConfigSection(section) ? { section } : {}\n\t\t\t});\n\t\t});\n\t\tconst failing = new Set(diagnostics.map((diagnostic) => String(diagnostic.meta?.[\"section\"] ?? \"\")));\n\t\tconst partial = validateOrmSectionExcept(rawConfig, provenance, failing);\n\t\tconst config = blindCast(partial.ok ? partial.value : rawConfig);\n\t\tif (!partial.ok) return {\n\t\t\tconfig,\n\t\t\tdiagnostics\n\t\t};\n\t\tconst related = descriptorRelationshipProblems(config, (section) => !failing.has(section)).map((problem) => errorConfigValidation(problem.path.join(\".\"), {\n\t\t\twhy: `${problem.path.join(\".\")} must be ${problem.expected} (was ${problem.actual})`,\n\t\t\tsection: String(problem.path[0])\n\t\t}));\n\t\tconst collisions = failing.has(\"contract\") || config.contract === void 0 ? [] : collectArtifactCollisionDiagnostics(config.contract);\n\t\treturn {\n\t\t\tconfig,\n\t\t\tdiagnostics: [\n\t\t\t\t...diagnostics,\n\t\t\t\t...related,\n\t\t\t\t...collisions\n\t\t\t]\n\t\t};\n\t}\n\tconst config = validation.value;\n\tif (config.contract === void 0) return {\n\t\tconfig,\n\t\tdiagnostics: []\n\t};\n\treturn {\n\t\tconfig,\n\t\tdiagnostics: collectArtifactCollisionDiagnostics(config.contract)\n\t};\n}\n/**\n* Validates a raw `orm` section and resolves its paths against `configDir`, the way a loaded config\n* file is. A caller that builds the section in memory gets the same diagnostics as one that wrote\n* it to `prisma.config.ts`.\n*/\nfunction buildLoadedConfig(rawConfig, configDir) {\n\tconst file = join(configDir, CONFIG_FILENAME);\n\treturn validateLoadedSection(rawConfig, {\n\t\tfiles: [file],\n\t\tkeys: Object.fromEntries(Object.keys(rawConfig).map((key) => [key, file]))\n\t});\n}\nfunction toConfigLoadFailure(error, configPath) {\n\tif (CliStructuredError.is(error)) return error;\n\tconst resolvedPath = configPath ? resolve(process.cwd(), configPath) : void 0;\n\tif (isStructuredError(error)) return new CliStructuredError(error.code, error.message, {\n\t\t...ifDefined(\"why\", error.why),\n\t\t...ifDefined(\"fix\", error.fix),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta),\n\t\tcause: error\n\t});\n\tif (error instanceof Error) return errorConfigEvaluationFailed(resolvedPath, {\n\t\twhy: error.message,\n\t\tcause: error\n\t});\n\treturn errorConfigEvaluationFailed(resolvedPath, { why: String(error) });\n}\n/**\n* c12 is resolved to its real on-disk entry before importing: jiti (inside\n* c12) resolves its own transitive imports from the importing file's location,\n* and a symlinked install (pnpm) would otherwise anchor them somewhere the\n* packages are not. Importing at the real location keeps every transitive\n* resolution working.\n*/\nasync function importC12() {\n\treturn await import(pathToFileURL(realpathSync(createRequire(import.meta.url).resolve(\"c12\"))).href);\n}\n/**\n* Runs c12 against one config path. Every throw out of evaluation becomes a\n* `CONFIG.EVALUATION_FAILED` and a requested path c12 did not resolve to becomes\n* `CONFIG.FILE_NOT_FOUND`, so both loaders report the same failures for the\n* same file.\n*/\nasync function evaluateWithC12(configPath, cwd) {\n\tconst resolvedConfigPath = configPath ? resolve(cwd, configPath) : void 0;\n\tconst configCwd = resolvedConfigPath ? dirname(resolvedConfigPath) : cwd;\n\tlet result;\n\ttry {\n\t\tresult = await (await importC12()).loadConfig({\n\t\t\tname: \"prisma\",\n\t\t\t...ifDefined(\"configFile\", resolvedConfigPath),\n\t\t\tcwd: configCwd\n\t\t});\n\t} catch (error) {\n\t\treturn notOk(toConfigLoadFailure(error, configPath));\n\t}\n\tif (resolvedConfigPath && result.configFile !== resolvedConfigPath) return notOk(errorConfigFileNotFound(resolvedConfigPath));\n\treturn ok(result);\n}\nconst FILE_FORMAT_KEYS = /* @__PURE__ */ new Set([\"$prismaConfig\", \"extends\"]);\nfunction sectionsOf(exported) {\n\treturn Object.fromEntries(Object.entries(exported).filter(([key]) => !FILE_FORMAT_KEYS.has(key)));\n}\n/**\n* Evaluates `prisma.config.ts` and hands back each file on the chain with its\n* sections as written, plus c12's merge. Failures that prevent evaluation are\n* the Result failure. Nothing is validated or resolved here: the CLI engine\n* validates each section against its schema with the files' provenance, and\n* {@link loadConfig} does the same for the `orm` section outside a command run.\n*/\nasync function loadConfigFiles(configPath, options) {\n\tconst cwd = options?.cwd ?? process.cwd();\n\tconst resolvedConfigPath = configPath ? resolve(cwd, configPath) : void 0;\n\tconst configCwd = resolvedConfigPath ? dirname(resolvedConfigPath) : cwd;\n\tconst evaluated = await evaluateWithC12(configPath, cwd);\n\tif (!evaluated.ok) return evaluated;\n\tconst result = evaluated.value;\n\tif (!result.config || Object.keys(result.config).length === 0) return notOk(errorConfigFileNotFound(result.configFile || resolvedConfigPath || configPath));\n\t/* v8 ignore next -- c12 always returns layers for a config it evaluated */\n\tconst layers = result.layers ?? [];\n\tconst layerConfig = layers[0]?.config;\n\tconst engineMarker = isRecord(layerConfig) ? layerConfig[\"$prismaConfig\"] : void 0;\n\tif (engineMarker === void 0)\n /* v8 ignore next -- a config that evaluated always carries its resolved path */\n\treturn notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));\n\tif (engineMarker !== 1)\n /* v8 ignore next -- a config that evaluated always carries its resolved path */\n\treturn notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));\n\t/* v8 ignore next -- @preserve */\n\tconst requested = result.configFile ?? join(configCwd, CONFIG_FILENAME);\n\tconst files = layers.flatMap((layer, index) => isRecord(layer.config) && Object.keys(layer.config).length > 0 ? [{\n\t\tpath: index === 0 ? requested : resolve(configCwd, layer.configFile ?? requested),\n\t\tsections: sectionsOf(layer.config)\n\t}] : []);\n\treturn ok({\n\t\tfiles: files.length === 0 ? [{\n\t\t\tpath: requested,\n\t\t\tsections: sectionsOf(result.config)\n\t\t}] : files,\n\t\tmerged: result.config\n\t});\n}\n/**\n* The raw default export of the module at `configPath`, evaluated exactly as\n* {@link loadConfig} evaluates it and returned without validation or the\n* version-marker check. The caller decides what the export means — a\n* default export without the `$prismaConfig` marker is what an earlier Prisma\n* CLI's config looks like.\n*/\nasync function evaluateConfigModule(configPath, options) {\n\tconst cwd = options?.cwd ?? process.cwd();\n\tconst resolvedConfigPath = resolve(cwd, configPath);\n\tif (!await fileExists(resolvedConfigPath)) return notOk(errorConfigFileNotFound(resolvedConfigPath));\n\tconst evaluated = await evaluateWithC12(resolvedConfigPath, cwd);\n\tif (!evaluated.ok) return evaluated;\n\t/* v8 ignore next -- c12 always returns layers for a config it evaluated */\n\tconst [requestedLayer] = evaluated.value.layers ?? [];\n\treturn ok(requestedLayer?.config);\n}\n/** Which file wrote each top-level key of the `orm` section, nearest file first. */\nfunction ormProvenance(files, merged) {\n\tconst contributors = files.filter((file) => isRecord(file.sections[\"orm\"]));\n\tconst paths = contributors.map((file) => file.path);\n\treturn {\n\t\tfiles: paths,\n\t\tkeys: Object.fromEntries(Object.keys(merged).flatMap((key) => {\n\t\t\tconst file = contributors.find((contributor) => {\n\t\t\t\tconst orm = contributor.sections[\"orm\"];\n\t\t\t\treturn isRecord(orm) && Object.hasOwn(orm, key);\n\t\t\t})?.path ?? paths[0];\n\t\t\treturn file === void 0 ? [] : [[key, file]];\n\t\t}))\n\t};\n}\n/**\n* Loads the Prisma 8 config and validates its `orm` section.\n*\n* Failures that prevent evaluation entirely — missing file, module that does\n* not evaluate (`CONFIG.FILE_NOT_FOUND`, `CONFIG.EVALUATION_FAILED`) — are the\n* `Result` failure. Structural problems inside an evaluated config do not\n* fail the load: they are returned as section-tagged diagnostics so commands\n* fail only on the sections they read (via {@link requireConfigSections}).\n*/\nasync function loadConfig(configPath, options) {\n\tconst loaded = await loadConfigFiles(configPath, options);\n\tif (!loaded.ok) return loaded;\n\tconst orm = loaded.value.merged[\"orm\"];\n\tif (orm !== void 0 && !isRecord(orm)) return ok({\n\t\tconfig: validateLoadedSection({}, {\n\t\t\tfiles: [],\n\t\t\tkeys: {}\n\t\t}).config,\n\t\tdiagnostics: [errorConfigValidation(\"orm\", { why: `The orm section of ${CONFIG_FILENAME} must be an object` })]\n\t});\n\tconst section = orm ?? {};\n\tconst provenance = ormProvenance(loaded.value.files, section);\n\tconst requested = loaded.value.files[0]?.path;\n\treturn ok(validateLoadedSection(section, provenance.files.length === 0 && requested !== void 0 ? {\n\t\tfiles: [requested],\n\t\tkeys: Object.fromEntries(Object.keys(section).map((key) => [key, requested]))\n\t} : provenance));\n}\n/**\n* Narrows a {@link LoadedConfig} to the sections a command reads. Fails with\n* the first diagnostic concerning a required section; diagnostics on other\n* sections are ignored so unrelated commands keep working.\n*/\nfunction requireConfigSections(loaded, sections) {\n\tconst blocking = loaded.diagnostics.find((diagnostic) => {\n\t\tconst section = diagnostic.meta?.[\"section\"];\n\t\treturn typeof section !== \"string\" || sections.some((required) => required === section);\n\t});\n\treturn blocking ? notOk(blocking) : ok(loaded.config);\n}\n/**\n* Convenience composition of {@link loadConfig} and\n* {@link requireConfigSections} for commands that read a fixed set of\n* sections and have no use for diagnostics outside them.\n*/\nasync function loadConfigForSections(configPath, sections) {\n\tconst loaded = await loadConfig(configPath);\n\tif (!loaded.ok) return loaded;\n\treturn requireConfigSections(loaded.value, sections);\n}\nasync function loadConfigForFile(filePath) {\n\tconst configPath = await findNearestConfigPathForFile(filePath);\n\tif (configPath === void 0) return notOk(errorConfigFileNotFound(join(dirname(resolve(process.cwd(), filePath)), CONFIG_FILENAME)));\n\treturn loadConfig(configPath);\n}\n//#endregion\nexport { ORM_CONFIG_SECTION_NAME, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,gBAAgB;AACtB,SAAS,UAAU,OAAO;CACzB,OAAO,cAAc,KAAK,KAAK;AAChC;AACA,SAAS,eAAe,OAAO;CAC9B,OAAO,UAAU,KAAK,IAAI,QAAQ,QAAQ,KAAK;AAChD;;;;;;;;;;;;;;;;AAgBA,eAAe,qBAAqB,UAAU;CAC7C,IAAI,aAAa,KAAK,KAAK,SAAS,WAAW,GAAG,OAAO,CAAC;CAC1D,MAAM,WAAW,CAAC;CAClB,MAAM,eAAe,CAAC;CACtB,KAAK,MAAM,WAAW,UAAU,CAAC,iBAAiB,OAAO,IAAI,eAAe,SAAA,CAAU,KAAK,OAAO;CAClG,MAAM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W,OAAO,YAAY,MAAM,eAAe;EACxD,MAAM,UAAU,WAAW,OAAO;EAClC,OAAO,OAAO,YAAY,YAAY,SAAS,MAAM,aAAa,aAAa,OAAO;CACvF,CAAC;CACD,OAAO,WAAW,MAAM,QAAQ,IAAI,GAAG,OAAO,MAAM;AACrD;;;;;;AAMA,eAAe,sBAAsB,YAAY,UAAU;CAC1D,MAAM,SAAS,MAAM,WAAW,UAAU;CAC1C,IAAI,CAAC,OAAO,IAAI,OAAO;CACvB,OAAO,sBAAsB,OAAO,OAAO,QAAQ;AACpD;AACA,eAAe,kBAAkB,UAAU;CAC1C,MAAM,aAAa,MAAM,6BAA6B,QAAQ;CAC9D,IAAI,eAAe,KAAK,GAAG,OAAO,MAAM,wBAAwB,KAAK,QAAQ,QAAQ,QAAQ,IAAI,GAAG,QAAQ,CAAC,GAAG,eAAe,CAAC,CAAC;CACjI,OAAO,WAAW,UAAU;AAC7B"}
|
|
1
|
+
{"version":3,"file":"exports-JFLSlPBW.mjs","names":[],"sources":["../../../../1-framework/3-tooling/config-loader/dist/exports/index.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { dirname, join, matchesGlob, resolve } from \"pathe\";\nimport { glob, isDynamicPattern } from \"tinyglobby\";\nimport { realpathSync } from \"node:fs\";\nimport { access } from \"node:fs/promises\";\nimport { pathToFileURL } from \"node:url\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { CliStructuredError, errorConfigEvaluationFailed, errorConfigFileNotFound, errorConfigValidation, errorConfigVersionMarkerMissing } from \"@internal/errors/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\nimport { configSchema, defineConfigSection, reference, validateSectionWithSchema } from \"@prisma/cli-engine\";\n//#region src/expand-contract-inputs.ts\nconst UNC_PREFIX_RE = /^(?:\\\\\\\\|\\/\\/)/;\nfunction isUncLike(entry) {\n\treturn UNC_PREFIX_RE.test(entry);\n}\nfunction resolveLiteral(entry) {\n\treturn isUncLike(entry) ? entry : resolve(entry);\n}\n/**\n* Expands a finalized contract source input list into its member file set:\n* absolute, deduped by canonical path, sorted. `patterns` must already be\n* absolute (the `orm` config schema resolves each entry against the config\n* file that wrote it but does not expand it).\n*\n* A wildcard-free entry (per tinyglobby's own magic-character check) passes\n* through verbatim — no globbing, no existence check, no directory\n* expansion — so a literal file, a nonexistent path (its read error\n* surfaces downstream), and a directory (`contract-prisma7`'s adoption\n* surface) all reach the result unchanged. Only entries containing glob\n* magic run through `tinyglobby`, directories-not-auto-expanded and\n* files-only; a glob matching nothing contributes nothing — no diagnostic\n* here.\n*/\nasync function expandContractInputs(patterns) {\n\tif (patterns === void 0 || patterns.length === 0) return [];\n\tconst literals = [];\n\tconst globPatterns = [];\n\tfor (const pattern of patterns) (isDynamicPattern(pattern) ? globPatterns : literals).push(pattern);\n\tconst globMatches = globPatterns.length === 0 ? [] : await glob(globPatterns, {\n\t\tabsolute: true,\n\t\tonlyFiles: true,\n\t\texpandDirectories: false\n\t});\n\tconst canonical = new Set([...literals, ...globMatches].map(resolveLiteral));\n\treturn Array.from(canonical).sort();\n}\n/**\n* The first glob entry of `patterns` that `path` matches, whether or not a\n* file exists at `path`. Both must be absolute.\n*/\nfunction globContractInputMatching(patterns, path) {\n\treturn patterns.find((pattern) => isDynamicPattern(pattern) && matchesGlob(path, pattern));\n}\n//#endregion\n//#region src/orm-section.ts\n/** The single config section the `orm` command family owns. */\nconst ORM_CONFIG_SECTION_NAME = \"orm\";\nconst CONFIG_SECTIONS = [\n\t\"family\",\n\t\"target\",\n\t\"adapter\",\n\t\"driver\",\n\t\"extensions\",\n\t\"db\",\n\t\"contract\",\n\t\"migrations\",\n\t\"formatter\"\n];\nfunction isConfigSection(value) {\n\treturn CONFIG_SECTIONS.some((section) => section === value);\n}\n/**\n* The fields that identify a control descriptor. Only these are declared: a\n* descriptor is a runtime object the family builds, and its other members\n* (codec tables, the contract serializer, migration hooks) pass through. Each\n* descriptor is declared a reference, so the command receives the object the\n* config file built.\n*/\nconst descriptorFields = {\n\tid: \"string\",\n\tfamilyId: \"string\",\n\tversion: \"string\",\n\tcreate: \"Function\"\n};\nconst targetLikeFields = {\n\t...descriptorFields,\n\ttargetId: \"string\"\n};\n/**\n* The contract source provider: `load` closes over the authored contract,\n* `inputs` are paths the schema resolves against the config file, and\n* `format` names the language the inputs are written in. Other keys a\n* provider carries pass through.\n*/\nconst contractSource = {\n\tload: \"Function\",\n\t\"inputs?\": \"path[]\",\n\tformat: \"'psl' | 'typescript'\",\n\t\"parserOptions?\": {\n\t\t\"+\": \"reject\",\n\t\t\"grammar?\": \"'prisma-7' | 'prisma-8'\"\n\t}\n};\n/** Each subsection's own shape, without the rules that relate subsections to one another. */\nconst ormSubsectionsSchema = configSchema({\n\tfamily: reference(configSchema({\n\t\tkind: \"'family'\",\n\t\t...descriptorFields,\n\t\temission: \"object\"\n\t})),\n\ttarget: reference(configSchema({\n\t\tkind: \"'target'\",\n\t\t...targetLikeFields\n\t})),\n\tadapter: reference(configSchema({\n\t\tkind: \"'adapter'\",\n\t\t...targetLikeFields\n\t})),\n\t\"driver?\": reference(configSchema({\n\t\tkind: \"'driver'\",\n\t\t...targetLikeFields\n\t})),\n\t\"extensions?\": [reference(configSchema({\n\t\tkind: \"'extension'\",\n\t\t...targetLikeFields\n\t})), \"[]\"],\n\t\"db?\": { \"connection?\": reference(configSchema(\"unknown\")) },\n\t\"contract?\": {\n\t\tsource: contractSource,\n\t\toutput: [\n\t\t\t\"path\",\n\t\t\t\"=\",\n\t\t\t() => \"src/prisma/contract.json\"\n\t\t]\n\t},\n\tmigrations: [\n\t\t{ dir: [\n\t\t\t\"path\",\n\t\t\t\"=\",\n\t\t\t() => \"./migrations\"\n\t\t] },\n\t\t\"=\",\n\t\t() => ({})\n\t],\n\t\"formatter?\": {\n\t\t\"indent?\": \"number.integer >= 1 | 'tab'\",\n\t\t\"newline?\": \"'LF' | 'CRLF'\"\n\t}\n});\n/**\n* Every broken rule relating the descriptor subsections: each descriptor\n* shares the family's `familyId`, and each target-bound descriptor shares\n* the target's `targetId`. A rule is checked only when `checked` accepts\n* both subsections it relates, so a loader can check the subsections that\n* validated while others have diagnostics.\n*/\nfunction descriptorRelationshipProblems(config, checked) {\n\tconst family = checked(\"family\") ? config.family : void 0;\n\tconst target = checked(\"target\") ? config.target : void 0;\n\tconst bound = [\n\t\t[[\"target\"], target],\n\t\t[[\"adapter\"], checked(\"adapter\") ? config.adapter : void 0],\n\t\t[[\"driver\"], checked(\"driver\") ? config.driver : void 0],\n\t\t...(checked(\"extensions\") ? config.extensions ?? [] : []).map((extension, index) => [[\"extensions\", index], extension])\n\t];\n\tconst problems = [];\n\tfor (const [path, descriptor] of bound) {\n\t\tif (descriptor === void 0) continue;\n\t\tif (family !== void 0 && descriptor.familyId !== family.familyId) problems.push({\n\t\t\tpath: [...path, \"familyId\"],\n\t\t\texpected: `Config.family.familyId (${family.familyId})`,\n\t\t\tactual: descriptor.familyId\n\t\t});\n\t\tif (target !== void 0 && path[0] !== \"target\" && descriptor.targetId !== target.targetId) problems.push({\n\t\t\tpath: [...path, \"targetId\"],\n\t\t\texpected: `Config.target.targetId (${target.targetId})`,\n\t\t\tactual: descriptor.targetId\n\t\t});\n\t}\n\treturn problems;\n}\n/**\n* The shape of the `orm` section of `prisma.config.ts`, declared once. The\n* CLI engine derives validation, the diagnostics naming a bad field and the\n* file to fix, and the resolution of every `path` field against the config\n* file that wrote it (prisma-cli ADR 0005). Relative paths are resolved\n* before any command sees the value, and the value carries `baseDir`.\n*/\nconst ormConfigSchema = ormSubsectionsSchema.narrow((config, ctx) => {\n\tif (\"extensionPacks\" in config) return ctx.reject({\n\t\tpath: [\"extensionPacks\"],\n\t\tmessage: \"Config.extensionPacks is no longer supported; rename it to Config.extensions\"\n\t});\n\tconst problems = descriptorRelationshipProblems(config, () => true);\n\tfor (const problem of problems) ctx.error({\n\t\tpath: [...problem.path],\n\t\texpected: problem.expected,\n\t\tactual: problem.actual\n\t});\n\treturn problems.length === 0;\n});\n/**\n* The section token the ORM's commands declare in `needs.config`. The\n* engine validates the merged section with its provenance and hands the\n* handler the value: absolute paths, `migrations.dir` defaulted, `baseDir`\n* recorded.\n*/\nconst ormConfigSection = blindCast(defineConfigSection({\n\tname: \"orm\",\n\tschema: ormConfigSchema\n}));\n/**\n* Validates a raw `orm` section the way the engine does for a command,\n* for the loaders and tools that read the config outside a command run.\n*/\nfunction validateOrmSection(raw, provenance) {\n\treturn blindCast(validateSectionWithSchema(\"orm\", ormConfigSchema, raw, provenance));\n}\n/**\n* Validates the shape of every subsection except `failing`, which comes back\n* as authored. A loader uses it when some subsections have diagnostics, so a\n* caller that reads only the others still gets their paths resolved and\n* defaults applied. The rules relating subsections are not applied here; see\n* {@link descriptorRelationshipProblems}.\n*/\nfunction validateOrmSectionExcept(raw, provenance, failing) {\n\tconst healthy = CONFIG_SECTIONS.filter((section) => !failing.has(section));\n\treturn validateSectionWithSchema(\"orm\", ormSubsectionsSchema.pick(...healthy), raw, provenance);\n}\n//#endregion\n//#region src/load.ts\nconst CONFIG_FILENAME = \"prisma.config.ts\";\nasync function findNearestConfigPathForFile(filePath) {\n\tlet current = dirname(resolve(process.cwd(), filePath));\n\twhile (true) {\n\t\tconst candidate = join(current, CONFIG_FILENAME);\n\t\tif (await fileExists(candidate)) return candidate;\n\t\tconst parent = dirname(current);\n\t\tif (parent === current) return;\n\t\tcurrent = parent;\n\t}\n}\nasync function fileExists(path) {\n\ttry {\n\t\tawait access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction collectArtifactCollisionDiagnostics(contract) {\n\tconst inputs = contract.source.inputs;\n\tconst output = contract.output;\n\tif (inputs === void 0 || output === void 0) return [];\n\tlet emittedArtifactPaths;\n\ttry {\n\t\temittedArtifactPaths = getEmittedArtifactPaths(output);\n\t} catch (error) {\n\t\treturn [errorConfigValidation(\"contract.output\", {\n\t\t\t/* v8 ignore next -- getEmittedArtifactPaths only ever throws an Error */\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tsection: \"contract\"\n\t\t})];\n\t}\n\tconst emittedPaths = /* @__PURE__ */ new Set([emittedArtifactPaths.jsonPath, emittedArtifactPaths.dtsPath]);\n\tif (inputs.some((input) => emittedPaths.has(input))) return [errorConfigValidation(\"contract.source.inputs[]\", {\n\t\twhy: \"Config.contract.source.inputs must not include emitted artifact paths derived from contract.output\",\n\t\tsection: \"contract\"\n\t})];\n\treturn [];\n}\nfunction validateLoadedSection(rawConfig, provenance) {\n\tconst validation = validateOrmSection(rawConfig, provenance);\n\tif (!validation.ok) {\n\t\tconst diagnostics = validation.diagnostics.map((diagnostic) => {\n\t\t\tconst field = typeof diagnostic.meta?.[\"field\"] === \"string\" ? diagnostic.meta[\"field\"] : \"\";\n\t\t\tconst section = field.split(\".\")[0] ?? \"\";\n\t\t\treturn errorConfigValidation(field, {\n\t\t\t\twhy: diagnostic.summary,\n\t\t\t\t...isConfigSection(section) ? { section } : {}\n\t\t\t});\n\t\t});\n\t\tconst failing = new Set(diagnostics.map((diagnostic) => String(diagnostic.meta?.[\"section\"] ?? \"\")));\n\t\tconst partial = validateOrmSectionExcept(rawConfig, provenance, failing);\n\t\tconst config = blindCast(partial.ok ? partial.value : rawConfig);\n\t\tif (!partial.ok) return {\n\t\t\tconfig,\n\t\t\tdiagnostics\n\t\t};\n\t\tconst related = descriptorRelationshipProblems(config, (section) => !failing.has(section)).map((problem) => errorConfigValidation(problem.path.join(\".\"), {\n\t\t\twhy: `${problem.path.join(\".\")} must be ${problem.expected} (was ${problem.actual})`,\n\t\t\tsection: String(problem.path[0])\n\t\t}));\n\t\tconst collisions = failing.has(\"contract\") || config.contract === void 0 ? [] : collectArtifactCollisionDiagnostics(config.contract);\n\t\treturn {\n\t\t\tconfig,\n\t\t\tdiagnostics: [\n\t\t\t\t...diagnostics,\n\t\t\t\t...related,\n\t\t\t\t...collisions\n\t\t\t]\n\t\t};\n\t}\n\tconst config = validation.value;\n\tif (config.contract === void 0) return {\n\t\tconfig,\n\t\tdiagnostics: []\n\t};\n\treturn {\n\t\tconfig,\n\t\tdiagnostics: collectArtifactCollisionDiagnostics(config.contract)\n\t};\n}\n/**\n* Validates a raw `orm` section and resolves its paths against `configDir`, the way a loaded config\n* file is. A caller that builds the section in memory gets the same diagnostics as one that wrote\n* it to `prisma.config.ts`.\n*/\nfunction buildLoadedConfig(rawConfig, configDir) {\n\tconst file = join(configDir, CONFIG_FILENAME);\n\treturn validateLoadedSection(rawConfig, {\n\t\tfiles: [file],\n\t\tkeys: Object.fromEntries(Object.keys(rawConfig).map((key) => [key, file]))\n\t});\n}\nfunction toConfigLoadFailure(error, configPath) {\n\tif (CliStructuredError.is(error)) return error;\n\tconst resolvedPath = configPath ? resolve(process.cwd(), configPath) : void 0;\n\tif (isStructuredError(error)) return new CliStructuredError(error.code, error.message, {\n\t\t...ifDefined(\"why\", error.why),\n\t\t...ifDefined(\"fix\", error.fix),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta),\n\t\tcause: error\n\t});\n\tif (error instanceof Error) return errorConfigEvaluationFailed(resolvedPath, {\n\t\twhy: error.message,\n\t\tcause: error\n\t});\n\treturn errorConfigEvaluationFailed(resolvedPath, { why: String(error) });\n}\n/**\n* c12 is resolved to its real on-disk entry before importing: jiti (inside\n* c12) resolves its own transitive imports from the importing file's location,\n* and a symlinked install (pnpm) would otherwise anchor them somewhere the\n* packages are not. Importing at the real location keeps every transitive\n* resolution working.\n*/\nasync function importC12() {\n\treturn await import(pathToFileURL(realpathSync(createRequire(import.meta.url).resolve(\"c12\"))).href);\n}\n/**\n* Runs c12 against one config path. Every throw out of evaluation becomes a\n* `CONFIG.EVALUATION_FAILED` and a requested path c12 did not resolve to becomes\n* `CONFIG.FILE_NOT_FOUND`, so both loaders report the same failures for the\n* same file.\n*/\nasync function evaluateWithC12(configPath, cwd) {\n\tconst resolvedConfigPath = configPath ? resolve(cwd, configPath) : void 0;\n\tconst configCwd = resolvedConfigPath ? dirname(resolvedConfigPath) : cwd;\n\tlet result;\n\ttry {\n\t\tresult = await (await importC12()).loadConfig({\n\t\t\tname: \"prisma\",\n\t\t\t...ifDefined(\"configFile\", resolvedConfigPath),\n\t\t\tcwd: configCwd\n\t\t});\n\t} catch (error) {\n\t\treturn notOk(toConfigLoadFailure(error, configPath));\n\t}\n\tif (resolvedConfigPath && result.configFile !== resolvedConfigPath) return notOk(errorConfigFileNotFound(resolvedConfigPath));\n\treturn ok(result);\n}\nconst FILE_FORMAT_KEYS = /* @__PURE__ */ new Set([\"$prismaConfig\", \"extends\"]);\nfunction sectionsOf(exported) {\n\treturn Object.fromEntries(Object.entries(exported).filter(([key]) => !FILE_FORMAT_KEYS.has(key)));\n}\n/**\n* Evaluates `prisma.config.ts` and hands back each file on the chain with its\n* sections as written, plus c12's merge. Failures that prevent evaluation are\n* the Result failure. Nothing is validated or resolved here: the CLI engine\n* validates each section against its schema with the files' provenance, and\n* {@link loadConfig} does the same for the `orm` section outside a command run.\n*/\nasync function loadConfigFiles(configPath, options) {\n\tconst cwd = options?.cwd ?? process.cwd();\n\tconst resolvedConfigPath = configPath ? resolve(cwd, configPath) : void 0;\n\tconst configCwd = resolvedConfigPath ? dirname(resolvedConfigPath) : cwd;\n\tconst evaluated = await evaluateWithC12(configPath, cwd);\n\tif (!evaluated.ok) return evaluated;\n\tconst result = evaluated.value;\n\tif (!result.config || Object.keys(result.config).length === 0) return notOk(errorConfigFileNotFound(result.configFile || resolvedConfigPath || configPath));\n\t/* v8 ignore next -- c12 always returns layers for a config it evaluated */\n\tconst layers = result.layers ?? [];\n\tconst layerConfig = layers[0]?.config;\n\tconst engineMarker = isRecord(layerConfig) ? layerConfig[\"$prismaConfig\"] : void 0;\n\tif (engineMarker === void 0)\n /* v8 ignore next -- a config that evaluated always carries its resolved path */\n\treturn notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));\n\tif (engineMarker !== 1)\n /* v8 ignore next -- a config that evaluated always carries its resolved path */\n\treturn notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));\n\t/* v8 ignore next -- @preserve */\n\tconst requested = result.configFile ?? join(configCwd, \"prisma.config.ts\");\n\tconst files = layers.flatMap((layer, index) => isRecord(layer.config) && Object.keys(layer.config).length > 0 ? [{\n\t\tpath: index === 0 ? requested : resolve(configCwd, layer.configFile ?? requested),\n\t\tsections: sectionsOf(layer.config)\n\t}] : []);\n\treturn ok({\n\t\tfiles: files.length === 0 ? [{\n\t\t\tpath: requested,\n\t\t\tsections: sectionsOf(result.config)\n\t\t}] : files,\n\t\tmerged: result.config\n\t});\n}\n/**\n* The raw default export of the module at `configPath`, evaluated exactly as\n* {@link loadConfig} evaluates it and returned without validation or the\n* version-marker check. The caller decides what the export means — a\n* default export without the `$prismaConfig` marker is what an earlier Prisma\n* CLI's config looks like.\n*/\nasync function evaluateConfigModule(configPath, options) {\n\tconst cwd = options?.cwd ?? process.cwd();\n\tconst resolvedConfigPath = resolve(cwd, configPath);\n\tif (!await fileExists(resolvedConfigPath)) return notOk(errorConfigFileNotFound(resolvedConfigPath));\n\tconst evaluated = await evaluateWithC12(resolvedConfigPath, cwd);\n\tif (!evaluated.ok) return evaluated;\n\t/* v8 ignore next -- c12 always returns layers for a config it evaluated */\n\tconst [requestedLayer] = evaluated.value.layers ?? [];\n\treturn ok(requestedLayer?.config);\n}\n/** Which file wrote each top-level key of the `orm` section, nearest file first. */\nfunction ormProvenance(files, merged) {\n\tconst contributors = files.filter((file) => isRecord(file.sections[\"orm\"]));\n\tconst paths = contributors.map((file) => file.path);\n\treturn {\n\t\tfiles: paths,\n\t\tkeys: Object.fromEntries(Object.keys(merged).flatMap((key) => {\n\t\t\tconst file = contributors.find((contributor) => {\n\t\t\t\tconst orm = contributor.sections[\"orm\"];\n\t\t\t\treturn isRecord(orm) && Object.hasOwn(orm, key);\n\t\t\t})?.path ?? paths[0];\n\t\t\treturn file === void 0 ? [] : [[key, file]];\n\t\t}))\n\t};\n}\n/**\n* Loads the Prisma 8 config and validates its `orm` section.\n*\n* Failures that prevent evaluation entirely — missing file, module that does\n* not evaluate (`CONFIG.FILE_NOT_FOUND`, `CONFIG.EVALUATION_FAILED`) — are the\n* `Result` failure. Structural problems inside an evaluated config do not\n* fail the load: they are returned as section-tagged diagnostics so commands\n* fail only on the sections they read (via {@link requireConfigSections}).\n*/\nasync function loadConfig(configPath, options) {\n\tconst loaded = await loadConfigFiles(configPath, options);\n\tif (!loaded.ok) return loaded;\n\tconst orm = loaded.value.merged[\"orm\"];\n\tif (orm !== void 0 && !isRecord(orm)) return ok({\n\t\tconfig: validateLoadedSection({}, {\n\t\t\tfiles: [],\n\t\t\tkeys: {}\n\t\t}).config,\n\t\tdiagnostics: [errorConfigValidation(\"orm\", { why: `The orm section of ${CONFIG_FILENAME} must be an object` })]\n\t});\n\tconst section = orm ?? {};\n\tconst provenance = ormProvenance(loaded.value.files, section);\n\tconst requested = loaded.value.files[0]?.path;\n\treturn ok(validateLoadedSection(section, provenance.files.length === 0 && requested !== void 0 ? {\n\t\tfiles: [requested],\n\t\tkeys: Object.fromEntries(Object.keys(section).map((key) => [key, requested]))\n\t} : provenance));\n}\n/**\n* Narrows a {@link LoadedConfig} to the sections a command reads. Fails with\n* the first diagnostic concerning a required section; diagnostics on other\n* sections are ignored so unrelated commands keep working.\n*/\nfunction requireConfigSections(loaded, sections) {\n\tconst blocking = loaded.diagnostics.find((diagnostic) => {\n\t\tconst section = diagnostic.meta?.[\"section\"];\n\t\treturn typeof section !== \"string\" || sections.some((required) => required === section);\n\t});\n\treturn blocking ? notOk(blocking) : ok(loaded.config);\n}\n/**\n* Convenience composition of {@link loadConfig} and\n* {@link requireConfigSections} for commands that read a fixed set of\n* sections and have no use for diagnostics outside them.\n*/\nasync function loadConfigForSections(configPath, sections) {\n\tconst loaded = await loadConfig(configPath);\n\tif (!loaded.ok) return loaded;\n\treturn requireConfigSections(loaded.value, sections);\n}\nasync function loadConfigForFile(filePath) {\n\tconst configPath = await findNearestConfigPathForFile(filePath);\n\tif (configPath === void 0) return notOk(errorConfigFileNotFound(join(dirname(resolve(process.cwd(), filePath)), CONFIG_FILENAME)));\n\treturn loadConfig(configPath);\n}\n//#endregion\nexport { CONFIG_FILENAME, ORM_CONFIG_SECTION_NAME, buildLoadedConfig, evaluateConfigModule, expandContractInputs, findNearestConfigPathForFile, globContractInputMatching, isConfigSection, loadConfig, loadConfigFiles, loadConfigForFile, loadConfigForSections, ormConfigSchema, ormConfigSection, requireConfigSections, validateOrmSection };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,gBAAgB;AACtB,SAAS,UAAU,OAAO;CACzB,OAAO,cAAc,KAAK,KAAK;AAChC;AACA,SAAS,eAAe,OAAO;CAC9B,OAAO,UAAU,KAAK,IAAI,QAAQ,QAAQ,KAAK;AAChD;;;;;;;;;;;;;;;;AAgBA,eAAe,qBAAqB,UAAU;CAC7C,IAAI,aAAa,KAAK,KAAK,SAAS,WAAW,GAAG,OAAO,CAAC;CAC1D,MAAM,WAAW,CAAC;CAClB,MAAM,eAAe,CAAC;CACtB,KAAK,MAAM,WAAW,UAAU,CAAC,iBAAiB,OAAO,IAAI,eAAe,SAAA,CAAU,KAAK,OAAO;CAClG,MAAM,cAAc,aAAa,WAAW,IAAI,CAAC,IAAI,MAAM,KAAK,cAAc;EAC7E,UAAU;EACV,WAAW;EACX,mBAAmB;CACpB,CAAC;CACD,MAAM,YAAY,IAAI,IAAI,CAAC,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC,IAAI,cAAc,CAAC;CAC3E,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,KAAK;AACnC;;;;;AAKA,SAAS,0BAA0B,UAAU,MA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AC,OAAO,IAAI,OAAO;CACvB,OAAO,sBAAsB,OAAO,OAAO,QAAQ;AACpD;AACA,eAAe,kBAAkB,UAAU;CAC1C,MAAM,aAAa,MAAM,6BAA6B,QAAQ;CAC9D,IAAI,eAAe,KAAK,GAAG,OAAO,MAAM,wBAAwB,KAAK,QAAQ,QAAQ,QAAQ,IAAI,GAAG,QAAQ,CAAC,GAAG,eAAe,CAAC,CAAC;CACjI,OAAO,WAAW,UAAU;AAC7B"}
|
package/dist/{graph-membership-C_ZO26nT-B7C4CJsh.mjs → graph-membership-C-5WMh1R-BUtW54H2.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as errorHashNotInGraph } from "./errors-
|
|
2
|
-
//#region ../../../1-framework/3-tooling/migration/dist/graph-membership-
|
|
1
|
+
import { p as errorHashNotInGraph } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/migration/dist/graph-membership-C-5WMh1R.mjs
|
|
3
3
|
function isGraphNode(hash, graph) {
|
|
4
4
|
if (hash === "empty") return true;
|
|
5
5
|
return graph.nodes.has(hash);
|
|
@@ -16,4 +16,4 @@ function assertHashIsGraphNode(hash, graph) {
|
|
|
16
16
|
//#endregion
|
|
17
17
|
export { isGraphNode as n, isInSpaceHistory as r, assertHashIsGraphNode as t };
|
|
18
18
|
|
|
19
|
-
//# sourceMappingURL=graph-membership-
|
|
19
|
+
//# sourceMappingURL=graph-membership-C-5WMh1R-BUtW54H2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-membership-
|
|
1
|
+
{"version":3,"file":"graph-membership-C-5WMh1R-BUtW54H2.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/graph-membership-C-5WMh1R.mjs"],"sourcesContent":["import { p as errorHashNotInGraph } from \"./errors-B1xJ5JTo.mjs\";\nimport \"./constants-CM-w38DQ.mjs\";\n//#region src/graph-membership.ts\nfunction isGraphNode(hash, graph) {\n\tif (hash === \"empty\") return true;\n\treturn graph.nodes.has(hash);\n}\n/** True when a marker hash is in a space's history: a graph node, or the head of a space that has no migrations. */\nfunction isInSpaceHistory(hash, space) {\n\tif (isGraphNode(hash, space.graph)) return true;\n\treturn space.graph.nodes.size === 0 && hash === space.headHash;\n}\nfunction assertHashIsGraphNode(hash, graph) {\n\tif (isGraphNode(hash, graph)) return;\n\tthrow errorHashNotInGraph(hash, graph);\n}\n//#endregion\nexport { isGraphNode as n, isInSpaceHistory as r, assertHashIsGraphNode as t };\n\n//# sourceMappingURL=graph-membership-C-5WMh1R.mjs.map"],"mappings":";;AAGA,SAAS,YAAY,MAAM,OAAO;CACjC,IAAI,SAAS,SAAS,OAAO;CAC7B,OAAO,MAAM,MAAM,IAAI,IAAI;AAC5B;;AAEA,SAAS,iBAAiB,MAAM,OAAO;CACtC,IAAI,YAAY,MAAM,MAAM,KAAK,GAAG,OAAO;CAC3C,OAAO,MAAM,MAAM,MAAM,SAAS,KAAK,SAAS,MAAM;AACvD;AACA,SAAS,sBAAsB,MAAM,OAAO;CAC3C,IAAI,YAAY,MAAM,KAAK,GAAG;CAC9B,MAAM,oBAAoB,MAAM,KAAK;AACtC"}
|
|
@@ -122,6 +122,7 @@ declare const ormConfigSection: ConfigSection<PrismaNextConfig>;
|
|
|
122
122
|
declare function validateOrmSection(raw: unknown, provenance: SectionProvenance): ReturnType<typeof ormConfigSection.validate>;
|
|
123
123
|
//#endregion
|
|
124
124
|
//#region src/load.d.ts
|
|
125
|
+
declare const CONFIG_FILENAME = "prisma.config.ts";
|
|
125
126
|
/**
|
|
126
127
|
* A successfully evaluated config plus the structural diagnostics found in it.
|
|
127
128
|
* Diagnostics are tagged with the config section they concern
|
|
@@ -199,5 +200,5 @@ declare function requireConfigSections(loaded: LoadedConfig$1, sections: readonl
|
|
|
199
200
|
declare function loadConfigForSections(configPath: string | undefined, sections: readonly ConfigSection$1[]): Promise<Result<PrismaNextConfig, CliStructuredError>>;
|
|
200
201
|
declare function loadConfigForFile(filePath: string): Promise<Result<LoadedConfig$1, CliStructuredError>>;
|
|
201
202
|
//#endregion
|
|
202
|
-
export {
|
|
203
|
-
//# sourceMappingURL=index-
|
|
203
|
+
export { loadConfigForSections as _, LoadedConfig$1 as a, requireConfigSections as b, buildLoadedConfig as c, findNearestConfigPathForFile as d, globContractInputMatching as f, loadConfigForFile as g, loadConfigFiles as h, ConfigSection$1 as i, evaluateConfigModule as l, loadConfig as m, ConfigFile as n, ORM_CONFIG_SECTION_NAME as o, isConfigSection as p, ConfigFiles as r, PrismaNextConfig$1 as s, CONFIG_FILENAME as t, expandContractInputs as u, ormConfigSchema as v, validateOrmSection as x, ormConfigSection as y };
|
|
204
|
+
//# sourceMappingURL=index-CWPFeYyi.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-CWPFeYyi.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/config-loader/dist/exports/index.d.mts"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAoBiB,qBAAqB,0CAA0C;;;;;iBAK/D,0BAA0B,6BAA6B;;;;cAI1D;;;;;;KAMT;iBACY,gBAAgB,gBAAgB,SAAS;;;;;;;;cAQ5C,+DAA+D;EAC3E;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF,qDAAqD;IACnD,MAAM,6CAA6C,8CAA8C;;EAEnG;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;;EAEF;IACE;MACE,MAAM;MACN;MACA,WAAW,iCAAiC;MAC5C;QACE;;;IAGJ,SAAS,6CAA6C,8CAA8C;;EAEtG;IACE;IACA;;;EAGF,OAAO,iCAAiC;;;;;;;;cAQ5B,kBAAkB,cAAgB;;;;;iBAK/B,mBAAmB,cAAc,YAAY,oBAAoB,kBAAkB,iBAAiB;;;cAGvG;;;;;;;;UAQJ;WACC,QAAQ;WACR,sBAAsB;;iBAEhB,6BAA6B,mBAAmB;;;;;;iBAMhD,kBAAkB,WAAW,yBAAyB,oBAAoB;;UAEjF;WACC;;WAEA,UAAU,SAAS;;;UAGpB;;WAEC,gBAAgB;;WAEhB,QAAQ,SAAS;;;;;;;;;iBASX,gBAAgB,qBAAqB;WAC3C;IACP,QAAQ,OAAO,aAAa;;;;;;;;iBAQf,qBAAqB,oBAAoB;WAC/C;IACP,QAAQ,gBAAgB;;;;;;;;;;iBAUX,WAAW,qBAAqB;WACtC;IACP,QAAQ,OAAO,gBAAc;;;;;;iBAMhB,sBAAsB,QAAQ,gBAAc,mBAAmB,oBAAkB,OAAO,kBAAoB;;;;;;iBAM5G,sBAAsB,gCAAgC,mBAAmB,oBAAkB,QAAQ,OAAO,kBAAoB;iBAC9H,kBAAkB,mBAAmB,QAAQ,OAAO,gBAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-
|
|
2
|
-
//#region ../../../1-framework/3-tooling/migration/dist/invariants-
|
|
1
|
+
import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
|
|
2
|
+
//#region ../../../1-framework/3-tooling/migration/dist/invariants-1xSrwDkH.mjs
|
|
3
3
|
/**
|
|
4
4
|
* Hygiene check for `invariantId`. Rejects empty values plus any
|
|
5
5
|
* whitespace or control character (including Unicode whitespace like
|
|
@@ -54,4 +54,4 @@ function readInvariantId(op) {
|
|
|
54
54
|
//#endregion
|
|
55
55
|
export { validateInvariantId as n, deriveProvidedInvariants as t };
|
|
56
56
|
|
|
57
|
-
//# sourceMappingURL=invariants-
|
|
57
|
+
//# sourceMappingURL=invariants-1xSrwDkH-BoUuNrf4.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invariants-
|
|
1
|
+
{"version":3,"file":"invariants-1xSrwDkH-BoUuNrf4.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/invariants-1xSrwDkH.mjs"],"sourcesContent":["import { d as errorDuplicateInvariantInEdge, h as errorInvalidInvariantId } from \"./errors-B1xJ5JTo.mjs\";\n//#region src/invariants.ts\n/**\n* Hygiene check for `invariantId`. Rejects empty values plus any\n* whitespace or control character (including Unicode whitespace like\n* NBSP and em space, which are visually identical to ASCII space and\n* routinely sneak in via paste).\n*/\nfunction validateInvariantId(invariantId) {\n\tif (invariantId.length === 0) return false;\n\treturn !/[\\p{Cc}\\p{White_Space}]/u.test(invariantId);\n}\n/**\n* Walk a migration's operations and produce its `providedInvariants`\n* aggregate: the sorted, deduplicated list of `invariantId`s declared\n* by ops in the migration. Ops without an `invariantId` are skipped.\n*\n* Both `data`-class ops (data-transforms, e.g. backfills) and\n* `additive`-class opaque DDL (e.g. cipherstash's vendored EQL bundle\n* via `installEqlBundleOp`) may declare invariantIds: the\n* `operationClass` axis classifies *policy gating* (which kinds of ops\n* a `db init` / `db update` policy permits), while `invariantId`\n* classifies *marker bookkeeping* (which named bundles of work a\n* future regeneration knows to skip). The two concerns are\n* intentionally orthogonal — an extension can ship additive\n* non-IR-derivable DDL (the only way the planner can know the bundle\n* is already applied is via the invariantId on the marker) without\n* needing to mis-classify it as `data`-class.\n*\n* Throws `MIGRATION.INVALID_INVARIANT_ID` on a malformed id and\n* `MIGRATION.DUPLICATE_INVARIANT_IN_EDGE` on duplicates.\n*\n* @see docs/architecture docs/adrs/ADR 212 - Contract spaces.md\n* — extension migrations carry `invariantId`s on additive ops; e.g.\n* cipherstash's `installEqlBundle` and structural `create-*` ops are\n* additive-class but carry `cipherstash:*` invariantIds.\n*/\nfunction deriveProvidedInvariants(ops) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tfor (const op of ops) {\n\t\tconst invariantId = readInvariantId(op);\n\t\tif (invariantId === void 0) continue;\n\t\tif (!validateInvariantId(invariantId)) throw errorInvalidInvariantId(invariantId);\n\t\tif (seen.has(invariantId)) throw errorDuplicateInvariantInEdge(invariantId);\n\t\tseen.add(invariantId);\n\t}\n\treturn [...seen].sort();\n}\nfunction readInvariantId(op) {\n\tif (!Object.hasOwn(op, \"invariantId\")) return void 0;\n\tconst candidate = op.invariantId;\n\treturn typeof candidate === \"string\" ? candidate : void 0;\n}\n//#endregion\nexport { validateInvariantId as n, deriveProvidedInvariants as t };\n\n//# sourceMappingURL=invariants-1xSrwDkH.mjs.map"],"mappings":";;;;;;;;AAQA,SAAS,oBAAoB,aAAa;CACzC,IAAI,YAAY,WAAW,GAAG,OAAO;CACrC,OAAO,CAAC,2BAA2B,KAAK,WAAW;AACpD;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,yBAAyB,KAAK;CACtC,MAAM,uBAAuB,IAAI,IAAI;CACrC,KAAK,MAAM,MAAM,KAAK;EACrB,MAAM,cAAc,gBAAgB,EAAE;EACtC,IAAI,gBAAgB,KAAK,GAAG;EAC5B,IAAI,CAAC,oBAAoB,WAAW,GAAG,MAAM,wBAAwB,WAAW;EAChF,IAAI,KAAK,IAAI,WAAW,GAAG,MAAM,8BAA8B,WAAW;EAC1E,KAAK,IAAI,WAAW;CACrB;CACA,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK;AACvB;AACA,SAAS,gBAAgB,IAAI;CAC5B,IAAI,CAAC,OAAO,OAAO,IAAI,aAAa,GAAG,OAAO,KAAK;CACnD,MAAM,YAAY,GAAG;CACrB,OAAO,OAAO,cAAc,WAAW,YAAY,KAAK;AACzD"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, k as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from "./errors-
|
|
1
|
+
import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, k as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
|
|
2
2
|
import { r as verifyMigrationHash } from "./hash-BAZVWU4a-BQovI7hF.mjs";
|
|
3
|
-
import { i as readContractSnapshotJsonTolerant } from "./contract-snapshot-store-
|
|
4
|
-
import { t as deriveProvidedInvariants } from "./invariants-
|
|
3
|
+
import { i as readContractSnapshotJsonTolerant } from "./contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs";
|
|
4
|
+
import { t as deriveProvidedInvariants } from "./invariants-1xSrwDkH-BoUuNrf4.mjs";
|
|
5
5
|
import { n as MigrationOpsSchema } from "./op-schema-BSVHzEQN-DIWt28D8.mjs";
|
|
6
6
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
7
7
|
import { basename, dirname, join, resolve } from "pathe";
|
|
8
8
|
import { copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
9
9
|
import { type } from "arktype";
|
|
10
|
-
//#region ../../../1-framework/3-tooling/migration/dist/io-
|
|
10
|
+
//#region ../../../1-framework/3-tooling/migration/dist/io-CUFeeOVP.mjs
|
|
11
11
|
const MANIFEST_FILE = "migration.json";
|
|
12
12
|
const OPS_FILE = "ops.json";
|
|
13
13
|
const MAX_SLUG_LENGTH = 64;
|
|
@@ -310,4 +310,4 @@ function formatMigrationDirName(timestamp, slug) {
|
|
|
310
310
|
//#endregion
|
|
311
311
|
export { materialiseMigrationPackage as a, writeMigrationMetadata as c, materialiseExtensionMigrationPackageIfMissing as i, writeMigrationOps as l, copyFilesWithRename as n, readMigrationPackage as o, formatMigrationDirName as r, readMigrationsDir as s, MANIFEST_FILE as t, writeMigrationPackage as u };
|
|
312
312
|
|
|
313
|
-
//# sourceMappingURL=io-
|
|
313
|
+
//# sourceMappingURL=io-CUFeeOVP-CEgOEVwW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io-xKnQrxIC-CEXpCgE_.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/io-xKnQrxIC.mjs"],"sourcesContent":["import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, k as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from \"./errors-DD6iLGXk.mjs\";\nimport { r as verifyMigrationHash } from \"./hash-BAZVWU4a.mjs\";\nimport { i as readContractSnapshotJsonTolerant } from \"./contract-snapshot-store-1S_6vaGt.mjs\";\nimport { t as deriveProvidedInvariants } from \"./invariants-C0lpc60l.mjs\";\nimport { n as MigrationOpsSchema } from \"./op-schema-BSVHzEQN.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join, resolve } from \"pathe\";\nimport { copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { type } from \"arktype\";\n//#region src/io.ts\nconst MANIFEST_FILE = \"migration.json\";\nconst OPS_FILE = \"ops.json\";\nconst MAX_SLUG_LENGTH = 64;\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\nconst MigrationMetadataSchema = type({\n\t\"+\": \"reject\",\n\tfrom: \"string > 0 | null\",\n\tto: \"string\",\n\tmigrationHash: \"string\",\n\tprovidedInvariants: \"string[]\",\n\tcreatedAt: \"string\"\n});\nasync function writeMigrationPackage(dir, metadata, ops) {\n\tawait mkdir(dirname(dir), { recursive: true });\n\ttry {\n\t\tawait mkdir(dir);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"EEXIST\")) throw errorDirectoryExists(dir);\n\t\tthrow error;\n\t}\n\tawait writeFile(join(dir, MANIFEST_FILE), JSON.stringify(metadata, null, 2), { flag: \"wx\" });\n\tawait writeFile(join(dir, OPS_FILE), JSON.stringify(ops, null, 2), { flag: \"wx\" });\n}\n/**\n* Materialise an in-memory {@link MigrationPackage} to a per-space\n* directory on disk.\n*\n* Writes two files under `<targetDir>/<pkg.dirName>/`:\n*\n* - `migration.json` — the manifest (pretty-printed, matches\n* {@link writeMigrationPackage}'s output for byte-for-byte parity with\n* app-space migrations).\n* - `ops.json` — the operation list (pretty-printed).\n*\n* Distinct verb from the lower-level {@link writeMigrationPackage}\n* (which takes constituent `(metadata, ops)`): callers reading\n* `materialise…` know they are persisting a struct-typed package.\n*\n* Overwrite-idempotent: the per-package directory is cleared before\n* each emit, so re-running against the same `targetDir` produces\n* byte-identical contents and never leaves stale files behind. The\n* lower-level {@link writeMigrationPackage} stays strict because the\n* CLI authoring path (`migration plan` / `migration new`) deliberately\n* refuses to clobber an existing authored migration; this helper is\n* the re-emit path that is supposed to converge on a single canonical\n* on-disk shape.\n*\n* The per-space head contract resolves through\n* `<projectMigrationsDir>/snapshots/<hex>/` (written by\n* {@link import('./emit-contract-space-artifacts').emitContractSpaceArtifacts}),\n* not inside the per-package directory. The runner reads only\n* `migration.json` + `ops.json` from each package.\n*/\nasync function materialiseMigrationPackage(targetDir, pkg) {\n\tconst dir = join(targetDir, pkg.dirName);\n\tawait rm(dir, {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tawait writeMigrationPackage(dir, pkg.metadata, pkg.ops);\n}\n/**\n* Idempotent variant of {@link materialiseMigrationPackage}: writes the\n* package only if `<targetDir>/<pkg.dirName>/` does not already exist on\n* disk as a directory; returns `{ written: false }` when the package\n* directory is present (no rewrite, no comparison — by-existence skip).\n*\n* Concretely:\n* - existing directory → skip silently, return `{ written: false }`.\n* - missing path → write three files via {@link materialiseMigrationPackage},\n* return `{ written: true }`.\n* - path exists but is not a directory (file/symlink) → treated as\n* missing; {@link materialiseMigrationPackage} will attempt creation\n* and fail with an appropriate OS error.\n* - any other I/O error from `stat` → propagated unchanged.\n*\n* Used by the CLI's `runContractSpaceExtensionMigrationsPass` to\n* materialise extension migration packages into a project's\n* `migrations/<spaceId>/` directory, and by extension-package tests\n* that mirror the same idempotent-rematerialise property locally\n* without taking a CLI dependency.\n*/\nasync function materialiseExtensionMigrationPackageIfMissing(targetDir, pkg) {\n\tif (await directoryExists(join(targetDir, pkg.dirName))) return { written: false };\n\tawait materialiseMigrationPackage(targetDir, pkg);\n\treturn { written: true };\n}\nasync function directoryExists(p) {\n\ttry {\n\t\treturn (await stat(p)).isDirectory();\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return false;\n\t\tthrow error;\n\t}\n}\n/**\n* Copy a list of files into `destDir`, optionally renaming each one.\n*\n* The destination directory is created (with `recursive: true`) if it\n* does not already exist. Each source path is copied byte-for-byte into\n* `destDir/<destName>`; missing sources throw `ENOENT`. The helper is\n* intentionally generic: callers own the list of files and the naming\n* convention for the copies.\n*/\nasync function copyFilesWithRename(destDir, files) {\n\tawait mkdir(destDir, { recursive: true });\n\tfor (const file of files) {\n\t\tif (basename(file.destName) !== file.destName) throw errorInvalidDestName(file.destName);\n\t\tawait copyFile(file.sourcePath, join(destDir, file.destName));\n\t}\n}\nasync function writeMigrationMetadata(dir, metadata) {\n\tawait writeFile(join(dir, MANIFEST_FILE), `${JSON.stringify(metadata, null, 2)}\\n`);\n}\nasync function writeMigrationOps(dir, ops) {\n\tawait writeFile(join(dir, OPS_FILE), `${JSON.stringify(ops, null, 2)}\\n`);\n}\nasync function readMigrationPackage(dir, options) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(MANIFEST_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(OPS_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(manifestPath, e instanceof Error ? e.message : String(e));\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(opsPath, e instanceof Error ? e.message : String(e));\n\t}\n\tvalidateMetadata(metadata, manifestPath);\n\tvalidateOps(ops, opsPath);\n\tconst derivedInvariants = deriveProvidedInvariants(ops);\n\tif (!arraysEqual(metadata.providedInvariants, derivedInvariants)) throw errorProvidedInvariantsMismatch(manifestPath, metadata.providedInvariants, derivedInvariants);\n\tconst endContractJson = await readContractSnapshotJsonTolerant(options.migrationsDir, metadata.to, options.verifySnapshotContent);\n\tconst pkg = {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops,\n\t\t...ifDefined(\"endContractJson\", endContractJson)\n\t};\n\tconst verification = verifyMigrationHash(pkg);\n\tif (!verification.ok) throw errorMigrationHashMismatch(absoluteDir, verification.storedHash, verification.computedHash);\n\treturn pkg;\n}\n/**\n* Reads a migration package's manifest and ops without running hash or\n* invariants verification. Returns `null` when the files cannot be read or\n* parsed (i.e. when the package is genuinely unloadable).\n*\n* Used by {@link readMigrationsDir} to retain a package whose hash or\n* invariants diverge from what is stored on disk — the raw content is still\n* useful for display / querying; only integrity is in question.\n*/\nasync function readMigrationPackageRaw(dir) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (MigrationMetadataSchema(metadata) instanceof type.errors) return null;\n\tif (MigrationOpsSchema(ops) instanceof type.errors) return null;\n\treturn {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops\n\t};\n}\nfunction arraysEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n\treturn true;\n}\nfunction validateMetadata(metadata, filePath) {\n\tconst result = MigrationMetadataSchema(metadata);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction validateOps(ops, filePath) {\n\tconst result = MigrationOpsSchema(ops);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction packageLoadProblemDetailFromError(error) {\n\tif (MigrationToolsError.is(error)) return error.why;\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\nasync function readMigrationsDir(migrationsRoot, options) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(migrationsRoot);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\tpackages: [],\n\t\t\tproblems: []\n\t\t};\n\t\tthrow error;\n\t}\n\tconst packages = [];\n\tconst problems = [];\n\tfor (const entry of entries.sort()) {\n\t\tconst entryPath = join(migrationsRoot, entry);\n\t\tif (!(await stat(entryPath)).isDirectory()) continue;\n\t\tconst manifestPath = join(entryPath, MANIFEST_FILE);\n\t\ttry {\n\t\t\tawait stat(manifestPath);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tlet pkg;\n\t\ttry {\n\t\t\tpkg = await readMigrationPackage(entryPath, options);\n\t\t} catch (error) {\n\t\t\tconst dirName = entry;\n\t\t\tif (MigrationToolsError.is(error)) {\n\t\t\t\tif (error.code === \"MIGRATION.HASH_MISMATCH\") {\n\t\t\t\t\tconst meta = error.meta;\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\t\t\tdirName,\n\t\t\t\t\t\tstored: typeof meta?.[\"storedHash\"] === \"string\" ? meta[\"storedHash\"] : \"\",\n\t\t\t\t\t\tcomputed: typeof meta?.[\"computedHash\"] === \"string\" ? meta[\"computedHash\"] : \"\"\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (error.code === \"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\") {\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"providedInvariantsMismatch\",\n\t\t\t\t\t\tdirName\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tproblems.push({\n\t\t\t\tkind: \"packageUnloadable\",\n\t\t\t\tdirName,\n\t\t\t\tdetail: packageLoadProblemDetailFromError(error)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpackages.push(pkg);\n\t}\n\treturn {\n\t\tpackages,\n\t\tproblems\n\t};\n}\nfunction formatMigrationDirName(timestamp, slug) {\n\tconst sanitized = slug.toLowerCase().replace(/[^a-z0-9]/g, \"_\").replace(/_+/g, \"_\").replace(/^_|_$/g, \"\");\n\tif (sanitized.length === 0) throw errorInvalidSlug(slug);\n\tconst truncated = sanitized.slice(0, MAX_SLUG_LENGTH);\n\treturn `${timestamp.getUTCFullYear()}${String(timestamp.getUTCMonth() + 1).padStart(2, \"0\")}${String(timestamp.getUTCDate()).padStart(2, \"0\")}T${String(timestamp.getUTCHours()).padStart(2, \"0\")}${String(timestamp.getUTCMinutes()).padStart(2, \"0\")}_${truncated}`;\n}\n//#endregion\nexport { materialiseMigrationPackage as a, writeMigrationMetadata as c, materialiseExtensionMigrationPackageIfMissing as i, writeMigrationOps as l, copyFilesWithRename as n, readMigrationPackage as o, formatMigrationDirName as r, readMigrationsDir as s, MANIFEST_FILE as t, writeMigrationPackage as u };\n\n//# sourceMappingURL=io-xKnQrxIC.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,gBAAgB;AACtB,MAAM,WAAW;AACjB,MAAM,kBAAkB;AACxB,SAAS,aAAa,OAAO,MAAM;CAClC,OAAO,iBAAiB,SAAS,MAAM,SAAS;AACjD;AACA,MAAM,0BAA0B,KAAK;CACpC,KAAK;CACL,MAAM;CACN,IAAI;CACJ,eAAe;CACf,oBAAoB;CACpB,WAAW;AACZ,CAAC;AACD,eAAe,sBAAsB,KAAK,UAAU,KAAK;CACxD,MAAM,MAAM,QAAQ,GAAG,GAAG,EAAE,WAAW,KAAK,CAAC;CAC7C,IAAI;EACH,MAAM,MAAM,GAAG;CAChB,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG,MAAM,qBAAqB,GAAG;EACjE,MAAM;CACP;CACA,MAAM,UAAU,KAAK,KAAK,aAAa,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;CAC3F,MAAM,UAAU,KAAK,KAAK,QAAQ,GAAG,KAAK,UAAU,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;AAClF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,eAAe,4BAA4B,WAAW,KAAK;CAC1D,MAAM,MAAM,KAAK,WAAW,IAAI,OAAO;CACvC,MAAM,GAAG,KAAK;EACb,WAAW;EACX,OAAO;CACR,CAAC;CACD,MAAM,sBAAsB,KAAK,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eAAe,IAAI,OAAO,UAAU,YAAY,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,WAAW,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,UAAU,YAAY,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,cAAc,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG;AAC3P"}
|
|
1
|
+
{"version":3,"file":"io-CUFeeOVP-CEgOEVwW.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/io-CUFeeOVP.mjs"],"sourcesContent":["import { E as errorMissingFile, S as errorInvalidSlug, T as errorMigrationHashMismatch, _ as errorInvalidManifest, g as errorInvalidJson, k as errorProvidedInvariantsMismatch, m as errorInvalidDestName, t as MigrationToolsError, u as errorDirectoryExists } from \"./errors-B1xJ5JTo.mjs\";\nimport { r as verifyMigrationHash } from \"./hash-BAZVWU4a.mjs\";\nimport { i as readContractSnapshotJsonTolerant } from \"./contract-snapshot-store-CNu34KAd.mjs\";\nimport { t as deriveProvidedInvariants } from \"./invariants-1xSrwDkH.mjs\";\nimport { n as MigrationOpsSchema } from \"./op-schema-BSVHzEQN.mjs\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { basename, dirname, join, resolve } from \"pathe\";\nimport { copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { type } from \"arktype\";\n//#region src/io.ts\nconst MANIFEST_FILE = \"migration.json\";\nconst OPS_FILE = \"ops.json\";\nconst MAX_SLUG_LENGTH = 64;\nfunction hasErrnoCode(error, code) {\n\treturn error instanceof Error && error.code === code;\n}\nconst MigrationMetadataSchema = type({\n\t\"+\": \"reject\",\n\tfrom: \"string > 0 | null\",\n\tto: \"string\",\n\tmigrationHash: \"string\",\n\tprovidedInvariants: \"string[]\",\n\tcreatedAt: \"string\"\n});\nasync function writeMigrationPackage(dir, metadata, ops) {\n\tawait mkdir(dirname(dir), { recursive: true });\n\ttry {\n\t\tawait mkdir(dir);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"EEXIST\")) throw errorDirectoryExists(dir);\n\t\tthrow error;\n\t}\n\tawait writeFile(join(dir, MANIFEST_FILE), JSON.stringify(metadata, null, 2), { flag: \"wx\" });\n\tawait writeFile(join(dir, OPS_FILE), JSON.stringify(ops, null, 2), { flag: \"wx\" });\n}\n/**\n* Materialise an in-memory {@link MigrationPackage} to a per-space\n* directory on disk.\n*\n* Writes two files under `<targetDir>/<pkg.dirName>/`:\n*\n* - `migration.json` — the manifest (pretty-printed, matches\n* {@link writeMigrationPackage}'s output for byte-for-byte parity with\n* app-space migrations).\n* - `ops.json` — the operation list (pretty-printed).\n*\n* Distinct verb from the lower-level {@link writeMigrationPackage}\n* (which takes constituent `(metadata, ops)`): callers reading\n* `materialise…` know they are persisting a struct-typed package.\n*\n* Overwrite-idempotent: the per-package directory is cleared before\n* each emit, so re-running against the same `targetDir` produces\n* byte-identical contents and never leaves stale files behind. The\n* lower-level {@link writeMigrationPackage} stays strict because the\n* CLI authoring path (`migration plan` / `migration new`) deliberately\n* refuses to clobber an existing authored migration; this helper is\n* the re-emit path that is supposed to converge on a single canonical\n* on-disk shape.\n*\n* The per-space head contract resolves through\n* `<projectMigrationsDir>/snapshots/<hex>/` (written by\n* {@link import('./emit-contract-space-artifacts').emitContractSpaceArtifacts}),\n* not inside the per-package directory. The runner reads only\n* `migration.json` + `ops.json` from each package.\n*/\nasync function materialiseMigrationPackage(targetDir, pkg) {\n\tconst dir = join(targetDir, pkg.dirName);\n\tawait rm(dir, {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tawait writeMigrationPackage(dir, pkg.metadata, pkg.ops);\n}\n/**\n* Idempotent variant of {@link materialiseMigrationPackage}: writes the\n* package only if `<targetDir>/<pkg.dirName>/` does not already exist on\n* disk as a directory; returns `{ written: false }` when the package\n* directory is present (no rewrite, no comparison — by-existence skip).\n*\n* Concretely:\n* - existing directory → skip silently, return `{ written: false }`.\n* - missing path → write three files via {@link materialiseMigrationPackage},\n* return `{ written: true }`.\n* - path exists but is not a directory (file/symlink) → treated as\n* missing; {@link materialiseMigrationPackage} will attempt creation\n* and fail with an appropriate OS error.\n* - any other I/O error from `stat` → propagated unchanged.\n*\n* Used by the CLI's `runContractSpaceExtensionMigrationsPass` to\n* materialise extension migration packages into a project's\n* `migrations/<spaceId>/` directory, and by extension-package tests\n* that mirror the same idempotent-rematerialise property locally\n* without taking a CLI dependency.\n*/\nasync function materialiseExtensionMigrationPackageIfMissing(targetDir, pkg) {\n\tif (await directoryExists(join(targetDir, pkg.dirName))) return { written: false };\n\tawait materialiseMigrationPackage(targetDir, pkg);\n\treturn { written: true };\n}\nasync function directoryExists(p) {\n\ttry {\n\t\treturn (await stat(p)).isDirectory();\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return false;\n\t\tthrow error;\n\t}\n}\n/**\n* Copy a list of files into `destDir`, optionally renaming each one.\n*\n* The destination directory is created (with `recursive: true`) if it\n* does not already exist. Each source path is copied byte-for-byte into\n* `destDir/<destName>`; missing sources throw `ENOENT`. The helper is\n* intentionally generic: callers own the list of files and the naming\n* convention for the copies.\n*/\nasync function copyFilesWithRename(destDir, files) {\n\tawait mkdir(destDir, { recursive: true });\n\tfor (const file of files) {\n\t\tif (basename(file.destName) !== file.destName) throw errorInvalidDestName(file.destName);\n\t\tawait copyFile(file.sourcePath, join(destDir, file.destName));\n\t}\n}\nasync function writeMigrationMetadata(dir, metadata) {\n\tawait writeFile(join(dir, MANIFEST_FILE), `${JSON.stringify(metadata, null, 2)}\\n`);\n}\nasync function writeMigrationOps(dir, ops) {\n\tawait writeFile(join(dir, OPS_FILE), `${JSON.stringify(ops, null, 2)}\\n`);\n}\nasync function readMigrationPackage(dir, options) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(MANIFEST_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) throw errorMissingFile(OPS_FILE, absoluteDir);\n\t\tthrow error;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(manifestPath, e instanceof Error ? e.message : String(e));\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch (e) {\n\t\tthrow errorInvalidJson(opsPath, e instanceof Error ? e.message : String(e));\n\t}\n\tvalidateMetadata(metadata, manifestPath);\n\tvalidateOps(ops, opsPath);\n\tconst derivedInvariants = deriveProvidedInvariants(ops);\n\tif (!arraysEqual(metadata.providedInvariants, derivedInvariants)) throw errorProvidedInvariantsMismatch(manifestPath, metadata.providedInvariants, derivedInvariants);\n\tconst endContractJson = await readContractSnapshotJsonTolerant(options.migrationsDir, metadata.to, options.verifySnapshotContent);\n\tconst pkg = {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops,\n\t\t...ifDefined(\"endContractJson\", endContractJson)\n\t};\n\tconst verification = verifyMigrationHash(pkg);\n\tif (!verification.ok) throw errorMigrationHashMismatch(absoluteDir, verification.storedHash, verification.computedHash);\n\treturn pkg;\n}\n/**\n* Reads a migration package's manifest and ops without running hash or\n* invariants verification. Returns `null` when the files cannot be read or\n* parsed (i.e. when the package is genuinely unloadable).\n*\n* Used by {@link readMigrationsDir} to retain a package whose hash or\n* invariants diverge from what is stored on disk — the raw content is still\n* useful for display / querying; only integrity is in question.\n*/\nasync function readMigrationPackageRaw(dir) {\n\tconst absoluteDir = resolve(dir);\n\tconst manifestPath = join(absoluteDir, MANIFEST_FILE);\n\tconst opsPath = join(absoluteDir, OPS_FILE);\n\tlet manifestRaw;\n\ttry {\n\t\tmanifestRaw = await readFile(manifestPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet opsRaw;\n\ttry {\n\t\topsRaw = await readFile(opsPath, \"utf-8\");\n\t} catch {\n\t\treturn null;\n\t}\n\tlet metadata;\n\ttry {\n\t\tmetadata = JSON.parse(manifestRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tlet ops;\n\ttry {\n\t\tops = JSON.parse(opsRaw);\n\t} catch {\n\t\treturn null;\n\t}\n\tif (MigrationMetadataSchema(metadata) instanceof type.errors) return null;\n\tif (MigrationOpsSchema(ops) instanceof type.errors) return null;\n\treturn {\n\t\tdirName: basename(absoluteDir),\n\t\tdirPath: absoluteDir,\n\t\tmetadata,\n\t\tops\n\t};\n}\nfunction arraysEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tfor (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n\treturn true;\n}\nfunction validateMetadata(metadata, filePath) {\n\tconst result = MigrationMetadataSchema(metadata);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction validateOps(ops, filePath) {\n\tconst result = MigrationOpsSchema(ops);\n\tif (result instanceof type.errors) throw errorInvalidManifest(filePath, result.summary);\n}\nfunction packageLoadProblemDetailFromError(error) {\n\tif (MigrationToolsError.is(error)) return error.why;\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\nasync function readMigrationsDir(migrationsRoot, options) {\n\tlet entries;\n\ttry {\n\t\tentries = await readdir(migrationsRoot);\n\t} catch (error) {\n\t\tif (hasErrnoCode(error, \"ENOENT\")) return {\n\t\t\tpackages: [],\n\t\t\tproblems: []\n\t\t};\n\t\tthrow error;\n\t}\n\tconst packages = [];\n\tconst problems = [];\n\tfor (const entry of entries.sort()) {\n\t\tconst entryPath = join(migrationsRoot, entry);\n\t\tif (!(await stat(entryPath)).isDirectory()) continue;\n\t\tconst manifestPath = join(entryPath, MANIFEST_FILE);\n\t\ttry {\n\t\t\tawait stat(manifestPath);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tlet pkg;\n\t\ttry {\n\t\t\tpkg = await readMigrationPackage(entryPath, options);\n\t\t} catch (error) {\n\t\t\tconst dirName = entry;\n\t\t\tif (MigrationToolsError.is(error)) {\n\t\t\t\tif (error.code === \"MIGRATION.HASH_MISMATCH\") {\n\t\t\t\t\tconst meta = error.meta;\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\t\t\tdirName,\n\t\t\t\t\t\tstored: typeof meta?.[\"storedHash\"] === \"string\" ? meta[\"storedHash\"] : \"\",\n\t\t\t\t\t\tcomputed: typeof meta?.[\"computedHash\"] === \"string\" ? meta[\"computedHash\"] : \"\"\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (error.code === \"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\") {\n\t\t\t\t\tconst rawPkg = await readMigrationPackageRaw(entryPath);\n\t\t\t\t\tif (rawPkg !== null) packages.push(rawPkg);\n\t\t\t\t\tproblems.push({\n\t\t\t\t\t\tkind: \"providedInvariantsMismatch\",\n\t\t\t\t\t\tdirName\n\t\t\t\t\t});\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tproblems.push({\n\t\t\t\tkind: \"packageUnloadable\",\n\t\t\t\tdirName,\n\t\t\t\tdetail: packageLoadProblemDetailFromError(error)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tpackages.push(pkg);\n\t}\n\treturn {\n\t\tpackages,\n\t\tproblems\n\t};\n}\nfunction formatMigrationDirName(timestamp, slug) {\n\tconst sanitized = slug.toLowerCase().replace(/[^a-z0-9]/g, \"_\").replace(/_+/g, \"_\").replace(/^_|_$/g, \"\");\n\tif (sanitized.length === 0) throw errorInvalidSlug(slug);\n\tconst truncated = sanitized.slice(0, MAX_SLUG_LENGTH);\n\treturn `${timestamp.getUTCFullYear()}${String(timestamp.getUTCMonth() + 1).padStart(2, \"0\")}${String(timestamp.getUTCDate()).padStart(2, \"0\")}T${String(timestamp.getUTCHours()).padStart(2, \"0\")}${String(timestamp.getUTCMinutes()).padStart(2, \"0\")}_${truncated}`;\n}\n//#endregion\nexport { materialiseMigrationPackage as a, writeMigrationMetadata as c, materialiseExtensionMigrationPackageIfMissing as i, writeMigrationOps as l, copyFilesWithRename as n, readMigrationPackage as o, formatMigrationDirName as r, readMigrationsDir as s, MANIFEST_FILE as t, writeMigrationPackage as u };\n\n//# sourceMappingURL=io-CUFeeOVP.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,gBAAgB;AACtB,MAAM,WAAW;AACjB,MAAM,kBAAkB;AACxB,SAAS,aAAa,OAAO,MAAM;CAClC,OAAO,iBAAiB,SAAS,MAAM,SAAS;AACjD;AACA,MAAM,0BAA0B,KAAK;CACpC,KAAK;CACL,MAAM;CACN,IAAI;CACJ,eAAe;CACf,oBAAoB;CACpB,WAAW;AACZ,CAAC;AACD,eAAe,sBAAsB,KAAK,UAAU,KAAK;CACxD,MAAM,MAAM,QAAQ,GAAG,GAAG,EAAE,WAAW,KAAK,CAAC;CAC7C,IAAI;EACH,MAAM,MAAM,GAAG;CAChB,SAAS,OAAO;EACf,IAAI,aAAa,OAAO,QAAQ,GAAG,MAAM,qBAAqB,GAAG;EACjE,MAAM;CACP;CACA,MAAM,UAAU,KAAK,KAAK,aAAa,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;CAC3F,MAAM,UAAU,KAAK,KAAK,QAAQ,GAAG,KAAK,UAAU,KAAK,MAAM,CAAC,GAAG,EA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KAAK,YAAY,CAAC,CAAC,QAAQ,cAAc,GAAG,CAAC,CAAC,QAAQ,OAAO,GAAG,CAAC,CAAC,QAAQ,UAAU,EAAE;CACxG,IAAI,UAAU,WAAW,GAAG,MAAM,iBAAiB,IAAI;CACvD,MAAM,YAAY,UAAU,MAAM,GAAG,eAAe;CACpD,OAAO,GAAG,UAAU,eAAe,IAAI,OAAO,UAAU,YAAY,IAAI,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,WAAW,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,OAAO,UAAU,YAAY,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,IAAI,OAAO,UAAU,cAAc,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG;AAC3P"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { O as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from "./errors-
|
|
1
|
+
import { O as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
|
|
2
2
|
import { t as computeMigrationHash } from "./hash-BAZVWU4a-BQovI7hF.mjs";
|
|
3
|
-
import { t as deriveProvidedInvariants } from "./invariants-
|
|
3
|
+
import { t as deriveProvidedInvariants } from "./invariants-1xSrwDkH-BoUuNrf4.mjs";
|
|
4
4
|
import { t as MigrationOpSchema } from "./op-schema-BSVHzEQN-DIWt28D8.mjs";
|
|
5
5
|
import { type } from "arktype";
|
|
6
6
|
import { realpathSync } from "node:fs";
|
|
@@ -218,4 +218,4 @@ async function buildMigrationArtifacts(instance, existing) {
|
|
|
218
218
|
//#endregion
|
|
219
219
|
export { isDirectEntrypoint as i, MigrationContractViews as n, buildMigrationArtifacts as r, Migration as t };
|
|
220
220
|
|
|
221
|
-
//# sourceMappingURL=migration-
|
|
221
|
+
//# sourceMappingURL=migration-CZrQ_3zY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-oIynqb-J.mjs","names":["#endView","#startView"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/migration.mjs"],"sourcesContent":["import { O as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from \"../errors-DD6iLGXk.mjs\";\nimport { t as computeMigrationHash } from \"../hash-BAZVWU4a.mjs\";\nimport { t as deriveProvidedInvariants } from \"../invariants-C0lpc60l.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\t/**\n\t* Called by {@link Migration.readOperations} before each read of `operations`: a migration that\n\t* builds state while its operations are read, such as the schema its earlier rename operations\n\t* leave behind, discards it here so every read starts from the start contract. The default keeps\n\t* no state.\n\t*/\n\tbeginOperationsRead() {}\n\t/** Reads `migration`'s operations from the start contract; read them only through this. */\n\tstatic readOperations(migration) {\n\t\tmigration.beginOperationsRead();\n\t\treturn migration.operations;\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 = Migration.readOperations(instance);\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;;;;;;;CAOA,sBAAsB,CAAC;;CAEvB,OAAO,eAAe,WAAW;EAChC,UAAU,oBAAoB;EAC9B,OAAO,UAAU;CAClB;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,GAAG,MAAM,kCAAkC,KAAK,WAAW,eAAe,iBAAiB;GAC7G,KAAKA,WAAW,KAAK,SAAS,IAAI;E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Q;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-CZrQ_3zY.mjs","names":["#endView","#startView"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/migration.mjs"],"sourcesContent":["import { O as errorOperationsNotArray, c as errorDescribeMissingEndContract, s as errorDescribeInvalidMetadata, v as errorInvalidOperationEntry, w as errorMigrationContractViewMissing } from \"../errors-B1xJ5JTo.mjs\";\nimport { t as computeMigrationHash } from \"../hash-BAZVWU4a.mjs\";\nimport { t as deriveProvidedInvariants } from \"../invariants-1xSrwDkH.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\t/**\n\t* Called by {@link Migration.readOperations} before each read of `operations`: a migration that\n\t* builds state while its operations are read, such as the schema its earlier rename operations\n\t* leave behind, discards it here so every read starts from the start contract. The default keeps\n\t* no state.\n\t*/\n\tbeginOperationsRead() {}\n\t/** Reads `migration`'s operations from the start contract; read them only through this. */\n\tstatic readOperations(migration) {\n\t\tmigration.beginOperationsRead();\n\t\treturn migration.operations;\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 = Migration.readOperations(instance);\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;;;;;;;CAOA,sBAAsB,CAAC;;CAEvB,OAAO,eAAe,WAAW;EAChC,UAAU,oBAAoB;EAC9B,OAAO,UAAU;CAClB;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,GAAG,MAAM,kCAAkC,KAAK,WAAW,eAAe,iBAAiB;GAC7G,KAAKA,W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BAAsB,QAAQ,KAAK,QAAQ;CAC5D,OAAO;EACN,SAAS,KAAK,UAAU,KAAK,MAAM,CAAC;EACpC;EACA,cAAc,KAAK,UAAU,UAAU,MAAM,CAAC;CAC/C;AACD"}
|
package/dist/migration-tools.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { D as errorNoInvariantPath, M as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-
|
|
1
|
+
import { D as errorNoInvariantPath, M as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-B1xJ5JTo-CrQL55Qf.mjs";
|
|
2
2
|
import { r as verifyMigrationHash, t as computeMigrationHash } from "./hash-BAZVWU4a-BQovI7hF.mjs";
|
|
3
|
-
import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as createSnapshotContentVerifier, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-
|
|
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-
|
|
3
|
+
import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as createSnapshotContentVerifier, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs";
|
|
4
|
+
import { n as validateInvariantId, t as deriveProvidedInvariants } from "./invariants-1xSrwDkH-BoUuNrf4.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-CUFeeOVP-CEgOEVwW.mjs";
|
|
6
6
|
import { t as EMPTY_CONTRACT_HASH } from "./constants-CM-w38DQ-Cz_EXbOc.mjs";
|
|
7
7
|
import { a as findPathWithInvariants, i as findPathWithDecision, n as detectOrphans, o as reconstructGraph, r as findPath, t as detectCycles } from "./migration-graph-BoiiZAaU-DLht12k7.mjs";
|
|
8
|
-
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-
|
|
9
|
-
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-
|
|
10
|
-
import { n as isGraphNode, r as isInSpaceHistory, t as assertHashIsGraphNode } from "./graph-membership-
|
|
11
|
-
import { c as resolveRefsByContractHash, d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, r as readRef, s as resolveRef, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-
|
|
12
|
-
import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, i as computeIntegrityViolations, l as loadProblemToViolation, m as verifyMigration, n as buildFabricatedMigrationEdge, o as createAggregateContractSpace, p as spacesInApplyOrder, r as collectAggregateNamespaces, s as createContractSpaceAggregate, t as allStorageElementsExternal, u as planMigration } from "./aggregate-
|
|
13
|
-
import { a as findEdgeByDirName, c as parseContractRef, i as WORKING_CONTRACT_REF, l as parseMigrationRef, n as LIVE_MARKER_REF, o as isLiveMarkerRef, r as RESERVED_CONTRACT_REFS, s as isReservedContractRef, t as EMPTY_CONTRACT_REF } from "./ref-resolution-
|
|
8
|
+
import { a as isValidSpaceId, c as spaceMigrationDirectory, i as assertValidSpaceId, l as spaceRefsDirectory, n as RESERVED_SPACE_SUBDIR_NAMES, o as listContractSpaceDirectories, r as SPACE_REFS_DIRNAME, s as readContractSpaceHeadRef, t as APP_SPACE_ID, u as verifyContractSpaces } from "./verify-contract-spaces-sL5mlmCX-K2P69KDp.mjs";
|
|
9
|
+
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-CtxjvIS0.mjs";
|
|
10
|
+
import { n as isGraphNode, r as isInSpaceHistory, t as assertHashIsGraphNode } from "./graph-membership-C-5WMh1R-BUtW54H2.mjs";
|
|
11
|
+
import { c as resolveRefsByContractHash, d as writeRef, i as readRefs, l as validateRefName, n as deleteRef, o as refsByContractHash, r as readRef, s as resolveRef, t as HEAD_REF_NAME, u as validateRefValue } from "./refs-CS997f-J-BxkRLuCE.mjs";
|
|
12
|
+
import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, i as computeIntegrityViolations, l as loadProblemToViolation, m as verifyMigration, n as buildFabricatedMigrationEdge, o as createAggregateContractSpace, p as spacesInApplyOrder, r as collectAggregateNamespaces, s as createContractSpaceAggregate, t as allStorageElementsExternal, u as planMigration } from "./aggregate-C0Kci0iw.mjs";
|
|
13
|
+
import { a as findEdgeByDirName, c as parseContractRef, i as WORKING_CONTRACT_REF, l as parseMigrationRef, n as LIVE_MARKER_REF, o as isLiveMarkerRef, r as RESERVED_CONTRACT_REFS, s as isReservedContractRef, t as EMPTY_CONTRACT_REF } from "./ref-resolution-kNMjYJ26.mjs";
|
|
14
14
|
import { a as writeMigrationTs, i as shebangLineFor, n as formatMigrationTs, r as hasMigrationTs, t as detectScaffoldRuntime } from "./migration-ts-DDgjsR1O.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-CZrQ_3zY.mjs";
|
|
16
16
|
import { t as ledgerOriginFromStored } from "./ledger-origin-D7PN4Fon.mjs";
|
|
17
17
|
export { APP_SPACE_ID, EMPTY_CONTRACT_HASH, EMPTY_CONTRACT_REF, HEAD_REF_NAME, LIVE_MARKER_REF, Migration, MigrationContractViews, MigrationToolsError, RESERVED_CONTRACT_REFS, RESERVED_SPACE_SUBDIR_NAMES, SPACE_REFS_DIRNAME, WORKING_CONTRACT_REF, allStorageElementsExternal, assertDescriptorSelfConsistency, assertHashIsGraphNode, assertValidSpaceId, buildFabricatedMigrationEdge, buildMigrationArtifacts, collectAggregateNamespaces, computeExtensionSpaceApplyPath, computeIntegrityViolations, computeMigrationHash, contractHashAtMarker, contractSnapshotDir, contractSpaceFromJson, copyFilesWithRename, createAggregateContractSpace, createContractSpaceAggregate, createSnapshotContentVerifier, deleteRef, deriveProvidedInvariants, detectCycles, detectOrphans, detectScaffoldRuntime, emitContractSpaceArtifacts, errorContractDeserializationFailed, errorContractSnapshotHashMismatch, errorContractSnapshotMissing, errorDescriptorHeadHashMismatch, errorInvalidJson, errorInvalidRefName, errorNoInvariantPath, errorUnknownInvariant, findEdgeByDirName, findPath, findPathWithDecision, findPathWithInvariants, formatMigrationDirName, formatMigrationTs, gatherDiskContractSpaceState, hasMigrationTs, isDirectEntrypoint, isGraphNode, isInSpaceHistory, isLiveMarkerRef, isReservedContractRef, isValidSpaceId, ledgerOriginFromStored, listContractSpaceDirectories, loadContractSpaceAggregate, loadProblemToViolation, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, parseContractRef, parseMigrationRef, planAllSpaces, planMigration, readContractSnapshotJson, readContractSnapshotJsonTolerant, readContractSpaceHeadRef, readMigrationPackage, readMigrationsDir, readRef, readRefs, reconstructGraph, refsByContractHash, requireHeadRef, resolveRecordedPath, resolveRef, resolveRefsByContractHash, shebangLineFor, snapshotsImportPathFrom, spaceMigrationDirectory, spaceRefsDirectory, spacesInApplyOrder, validateInvariantId, validateRefName, validateRefValue, verifyContractSpaces, verifyMigration, verifyMigrationHash, writeContractSnapshot, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage, writeMigrationTs, writeRef };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, i as computeIntegrityViolations, l as loadProblemToViolation, m as verifyMigration, n as buildFabricatedMigrationEdge, o as createAggregateContractSpace, p as spacesInApplyOrder, r as collectAggregateNamespaces, s as createContractSpaceAggregate, t as allStorageElementsExternal, u as planMigration } from "./aggregate-
|
|
1
|
+
import { a as contractHashAtMarker, c as loadContractSpaceAggregate, d as requireHeadRef, f as resolveRecordedPath, i as computeIntegrityViolations, l as loadProblemToViolation, m as verifyMigration, n as buildFabricatedMigrationEdge, o as createAggregateContractSpace, p as spacesInApplyOrder, r as collectAggregateNamespaces, s as createContractSpaceAggregate, t as allStorageElementsExternal, u as planMigration } from "./aggregate-C0Kci0iw.mjs";
|
|
2
2
|
export { allStorageElementsExternal, buildFabricatedMigrationEdge, collectAggregateNamespaces, computeIntegrityViolations, contractHashAtMarker, createAggregateContractSpace, createContractSpaceAggregate, loadContractSpaceAggregate, loadProblemToViolation, planMigration, requireHeadRef, resolveRecordedPath, spacesInApplyOrder, verifyMigration };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as createSnapshotContentVerifier, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-
|
|
1
|
+
import { a as snapshotsImportPathFrom, i as readContractSnapshotJsonTolerant, n as createSnapshotContentVerifier, o as writeContractSnapshot, r as readContractSnapshotJson, t as contractSnapshotDir } from "./contract-snapshot-store-CNu34KAd-D9xN1Sll.mjs";
|
|
2
2
|
export { contractSnapshotDir, createSnapshotContentVerifier, readContractSnapshotJson, readContractSnapshotJsonTolerant, snapshotsImportPathFrom, writeContractSnapshot };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { D as errorNoInvariantPath, M as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-
|
|
1
|
+
import { D as errorNoInvariantPath, M as errorUnknownInvariant, a as errorContractSnapshotHashMismatch, b as errorInvalidRefName, g as errorInvalidJson, l as errorDescriptorHeadHashMismatch, o as errorContractSnapshotMissing, r as errorContractDeserializationFailed, t as MigrationToolsError } from "./errors-B1xJ5JTo-CrQL55Qf.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-1xSrwDkH-BoUuNrf4.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-CUFeeOVP-CEgOEVwW.mjs";
|
|
2
2
|
export { copyFilesWithRename, formatMigrationDirName, materialiseExtensionMigrationPackageIfMissing, materialiseMigrationPackage, readMigrationPackage, readMigrationsDir, writeMigrationMetadata, writeMigrationOps, writeMigrationPackage };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as findPathWithInvariants, i as findPathWithDecision, n as detectOrphans, o as reconstructGraph, r as findPath, t as detectCycles } from "./migration-graph-BoiiZAaU-DLht12k7.mjs";
|
|
2
|
-
import { n as isGraphNode, r as isInSpaceHistory, t as assertHashIsGraphNode } from "./graph-membership-
|
|
2
|
+
import { n as isGraphNode, r as isInSpaceHistory, t as assertHashIsGraphNode } from "./graph-membership-C-5WMh1R-BUtW54H2.mjs";
|
|
3
3
|
export { assertHashIsGraphNode, detectCycles, detectOrphans, findPath, findPathWithDecision, findPathWithInvariants, isGraphNode, isInSpaceHistory, 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-CZrQ_3zY.mjs";
|
|
2
2
|
export { Migration, MigrationContractViews, buildMigrationArtifacts, isDirectEntrypoint };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as findEdgeByDirName, c as parseContractRef, i as WORKING_CONTRACT_REF, l as parseMigrationRef, n as LIVE_MARKER_REF, o as isLiveMarkerRef, r as RESERVED_CONTRACT_REFS, s as isReservedContractRef, t as EMPTY_CONTRACT_REF } from "./ref-resolution-
|
|
1
|
+
import { a as findEdgeByDirName, c as parseContractRef, i as WORKING_CONTRACT_REF, l as parseMigrationRef, n as LIVE_MARKER_REF, o as isLiveMarkerRef, r as RESERVED_CONTRACT_REFS, s as isReservedContractRef, t as EMPTY_CONTRACT_REF } from "./ref-resolution-kNMjYJ26.mjs";
|
|
2
2
|
export { EMPTY_CONTRACT_REF, LIVE_MARKER_REF, RESERVED_CONTRACT_REFS, WORKING_CONTRACT_REF, findEdgeByDirName, isLiveMarkerRef, isReservedContractRef, 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-CS997f-J-BxkRLuCE.mjs";
|
|
2
2
|
export { HEAD_REF_NAME, deleteRef, readRef, readRefs, refsByContractHash, resolveRef, resolveRefsByContractHash, validateRefName, validateRefValue, writeRef };
|
|
@@ -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-sL5mlmCX-K2P69KDp.mjs";
|
|
2
|
+
import { a as gatherDiskContractSpaceState, i as emitContractSpaceArtifacts, n as computeExtensionSpaceApplyPath, o as planAllSpaces, r as contractSpaceFromJson, t as assertDescriptorSelfConsistency } from "./spaces-CtxjvIS0.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 };
|