@prisma/orm-toolchain 8.0.0-rc.9-dev.5 → 8.0.0-rc.9-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{aggregate-Ib7P8moX.mjs → aggregate-B4HKshLQ.mjs} +2 -2
- package/dist/aggregate-B4HKshLQ.mjs.map +1 -0
- package/dist/{aggregate-DLUJLq5Y.d.mts → aggregate-D_eX4zoo.d.mts} +3 -3
- package/dist/{aggregate-DLUJLq5Y.d.mts.map → aggregate-D_eX4zoo.d.mts.map} +1 -1
- package/dist/cli.mjs +7 -7
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__migration-cli.mjs +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{exports-gEustzOH.mjs → exports-BXXeNWlj.mjs} +2 -2
- package/dist/exports-BXXeNWlj.mjs.map +1 -0
- package/dist/{exports-BysXxIyI.mjs → exports-DYX_7lXj.mjs} +3 -3
- package/dist/{exports-BysXxIyI.mjs.map → exports-DYX_7lXj.mjs.map} +1 -1
- package/dist/{import-roots-kw_vAdpJ.mjs → import-roots-BHOrDJbI.mjs} +2 -2
- package/dist/import-roots-BHOrDJbI.mjs.map +1 -0
- package/dist/migration-tools.d.mts +1 -1
- package/dist/migration-tools.mjs +1 -1
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/publish-surface.mjs +1 -1
- package/dist/publish-surface__import-roots.mjs +1 -1
- package/dist/quick-reference-mongo.md +1 -1
- package/dist/quick-reference-postgres.md +1 -1
- package/dist/{ref-BPBIUGrB-BFzvJ0bv.mjs → ref-BPBIUGrB-BQt8iSyJ.mjs} +3 -3
- package/dist/{ref-BPBIUGrB-BFzvJ0bv.mjs.map → ref-BPBIUGrB-BQt8iSyJ.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.d.mts +1 -1
- package/dist/vite-plugin-contract-emit.mjs +4 -4
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +13 -13
- package/dist/aggregate-Ib7P8moX.mjs.map +0 -1
- package/dist/exports-gEustzOH.mjs.map +0 -1
- package/dist/import-roots-kw_vAdpJ.mjs.map +0 -1
|
@@ -22,7 +22,7 @@ interface PrismaVitePluginOptions {
|
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/plugin.d.ts
|
|
24
24
|
/**
|
|
25
|
-
* Creates a Vite plugin that automatically emits Prisma
|
|
25
|
+
* Creates a Vite plugin that automatically emits Prisma 8 contract artifacts.
|
|
26
26
|
*
|
|
27
27
|
* The plugin resolves watched files from contract source provider metadata,
|
|
28
28
|
* re-emitting contract artifacts on changes with debounce while serializing
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as getEmittedArtifactPaths } from "./exports-CE6OD63o-4Qpqr2W7.mjs";
|
|
2
|
-
import { R as executeContractEmit, h as disposeEmitQueue } from "./ref-BPBIUGrB-
|
|
3
|
-
import { a as loadConfigForSections } from "./exports-
|
|
2
|
+
import { R as executeContractEmit, h as disposeEmitQueue } from "./ref-BPBIUGrB-BQt8iSyJ.mjs";
|
|
3
|
+
import { a as loadConfigForSections } from "./exports-BXXeNWlj.mjs";
|
|
4
4
|
import { extname, resolve } from "pathe";
|
|
5
5
|
//#region ../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs
|
|
6
6
|
const PLUGIN_NAME = "prisma-vite-plugin-contract-emit";
|
|
@@ -17,7 +17,7 @@ const MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
17
17
|
".cts"
|
|
18
18
|
]);
|
|
19
19
|
/**
|
|
20
|
-
* Creates a Vite plugin that automatically emits Prisma
|
|
20
|
+
* Creates a Vite plugin that automatically emits Prisma 8 contract artifacts.
|
|
21
21
|
*
|
|
22
22
|
* The plugin resolves watched files from contract source provider metadata,
|
|
23
23
|
* re-emitting contract artifacts on changes with debounce while serializing
|
|
@@ -224,7 +224,7 @@ function prismaVitePlugin(configPath = DEFAULT_CONFIG_PATH, options) {
|
|
|
224
224
|
if (!didWarnConfigWatchFallback) {
|
|
225
225
|
didWarnConfigWatchFallback = true;
|
|
226
226
|
const reason = error instanceof Error ? ` ${error.message}` : "";
|
|
227
|
-
logWarning(`${previousWatchedFiles.size > 0 ? `Watching the previous dependency set plus ${absoluteConfigPath}` : `Watching only ${absoluteConfigPath}`} because Prisma
|
|
227
|
+
logWarning(`${previousWatchedFiles.size > 0 ? `Watching the previous dependency set plus ${absoluteConfigPath}` : `Watching only ${absoluteConfigPath}`} because Prisma 8 config inputs could not be resolved.${reason} Contract watch coverage is partial.`);
|
|
228
228
|
}
|
|
229
229
|
if (previousWatchedFiles.size > 0) {
|
|
230
230
|
previousWatchedFiles.add(absoluteConfigPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-contract-emit.mjs","names":[],"sources":["../../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs"],"sourcesContent":["import { disposeEmitQueue, executeContractEmit } from \"@internal/cli/control-api\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { extname, resolve } from \"pathe\";\n//#region src/plugin.ts\nconst PLUGIN_NAME = \"prisma-vite-plugin-contract-emit\";\nconst DEFAULT_DEBOUNCE_MS = 150;\nconst DEFAULT_CONFIG_PATH = \"prisma.config.ts\";\nconst MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([\n\t\".js\",\n\t\".jsx\",\n\t\".mjs\",\n\t\".cjs\",\n\t\".ts\",\n\t\".tsx\",\n\t\".mts\",\n\t\".cts\"\n]);\n/**\n* Creates a Vite plugin that automatically emits Prisma Next contract artifacts.\n*\n* The plugin resolves watched files from contract source provider metadata,\n* re-emitting contract artifacts on changes with debounce while serializing\n* overlapping emits into a single follow-up run.\n*\n* @param configPath - Path to prisma.config.ts (relative or absolute). Defaults to 'prisma.config.ts'\n* @param options - Optional plugin configuration\n* @returns Vite plugin\n*\n* @example\n* ```ts\n* import { defineConfig } from 'vite';\n* import { prismaVitePlugin } from '@internal/vite-plugin-contract-emit';\n*\n* // Use default config path\n* export default defineConfig({\n* plugins: [prismaVitePlugin()],\n* });\n*\n* // Or specify a custom path\n* export default defineConfig({\n* plugins: [prismaVitePlugin('custom/prisma.config.ts')],\n* });\n* ```\n*/\nfunction prismaVitePlugin(configPath = DEFAULT_CONFIG_PATH, options) {\n\tconst debounceMs = options?.debounceMs ?? DEFAULT_DEBOUNCE_MS;\n\tconst logLevel = options?.logLevel ?? \"info\";\n\tlet absoluteConfigPath;\n\tconst watchedFiles = /* @__PURE__ */ new Set();\n\tconst ignoredOutputFiles = /* @__PURE__ */ new Set();\n\tconst ownedOutputJsonPaths = /* @__PURE__ */ new Set();\n\tlet debounceTimer = null;\n\tlet lifecycleAbortController = new AbortController();\n\tlet server = null;\n\tlet isEmitInFlight = false;\n\tlet hasQueuedEmit = false;\n\tlet queuedEmitNeedsWatchedFileRefresh = false;\n\tlet didWarnConfigWatchFallback = false;\n\tfunction log(message, level = \"info\") {\n\t\tif (logLevel === \"silent\") return;\n\t\tif (level === \"debug\" && logLevel !== \"debug\") return;\n\t\tconsole.log(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction logError(message, error) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconst errorMessage = error instanceof Error ? error.message : error ? String(error) : \"\";\n\t\tconsole.error(`[${PLUGIN_NAME}] ${message}${errorMessage ? ` ${errorMessage}` : \"\"}`);\n\t\tif (error instanceof Error && error.stack && logLevel === \"debug\") console.error(error.stack);\n\t}\n\tfunction logWarning(message) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconsole.warn(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction handleTrackedFileChange(file) {\n\t\tconst normalized = resolve(file);\n\t\tif (ignoredOutputFiles.has(normalized)) {\n\t\t\tlog(`Ignoring emitted artifact update: ${normalized}`, \"debug\");\n\t\t\treturn;\n\t\t}\n\t\tif (watchedFiles.has(normalized)) {\n\t\t\tlog(`Detected change: ${normalized}`, \"debug\");\n\t\t\tscheduleEmit();\n\t\t}\n\t}\n\tasync function emitContract({ refreshWatchedFiles = true } = {}) {\n\t\tconst signal = lifecycleAbortController.signal;\n\t\ttry {\n\t\t\tif (server && refreshWatchedFiles) await updateWatchedFiles(server);\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\n\t\t\t\t\"contract\",\n\t\t\t\t\"family\",\n\t\t\t\t\"target\",\n\t\t\t\t\"adapter\",\n\t\t\t\t\"extensions\"\n\t\t\t]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst result = await executeContractEmit({\n\t\t\t\tconfig: configResult.value,\n\t\t\t\tcwd: process.cwd(),\n\t\t\t\tconfigPath: absoluteConfigPath,\n\t\t\t\tsignal\n\t\t\t});\n\t\t\tlog(`Emitted contract (storageHash: ${result.storageHash.slice(0, 8)}...)`);\n\t\t\tlog(` → ${result.files.json}`, \"debug\");\n\t\t\tlog(` → ${result.files.dts}`, \"debug\");\n\t\t\tif (server) {\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.json);\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.dts);\n\t\t\t}\n\t\t\tif (server && !hasQueuedEmit) server.ws.send({ type: \"full-reload\" });\n\t\t\telse if (hasQueuedEmit) log(\"Skipped full reload because a newer emit is queued\", \"debug\");\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (signal.aborted || error instanceof Error && error.name === \"AbortError\") {\n\t\t\t\tlog(\"Emit cancelled\", \"debug\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlogError(\"Contract emit failed:\", error);\n\t\t\tif (server) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\tconst errorStack = error instanceof Error ? error.stack : void 0;\n\t\t\t\tserver.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: errorStack ?? \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\tasync function drainQueuedEmits() {\n\t\tif (isEmitInFlight || lifecycleAbortController.signal.aborted) return;\n\t\tisEmitInFlight = true;\n\t\ttry {\n\t\t\twhile (hasQueuedEmit && !lifecycleAbortController.signal.aborted) {\n\t\t\t\tconst refreshWatchedFiles = queuedEmitNeedsWatchedFileRefresh;\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tawait emitContract({ refreshWatchedFiles });\n\t\t\t}\n\t\t} finally {\n\t\t\tisEmitInFlight = false;\n\t\t}\n\t}\n\tfunction requestEmit({ refreshWatchedFiles = true } = {}) {\n\t\tif (lifecycleAbortController.signal.aborted) return Promise.resolve();\n\t\thasQueuedEmit = true;\n\t\tqueuedEmitNeedsWatchedFileRefresh ||= refreshWatchedFiles;\n\t\tif (isEmitInFlight) {\n\t\t\tlog(\"Queued follow-up emit while another emit is running\", \"debug\");\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn drainQueuedEmits();\n\t}\n\tfunction scheduleEmit() {\n\t\tif (debounceTimer) clearTimeout(debounceTimer);\n\t\tdebounceTimer = setTimeout(() => {\n\t\t\tdebounceTimer = null;\n\t\t\trequestEmit();\n\t\t}, debounceMs);\n\t}\n\tfunction resolveContractOutputFiles(contractOutput) {\n\t\tif (contractOutput === void 0) return /* @__PURE__ */ new Set();\n\t\tconst { jsonPath, dtsPath } = getEmittedArtifactPaths(contractOutput);\n\t\townedOutputJsonPaths.add(jsonPath);\n\t\treturn /* @__PURE__ */ new Set([jsonPath, dtsPath]);\n\t}\n\tfunction isModuleGraphRoot(filePath) {\n\t\treturn MODULE_GRAPH_EXTENSIONS.has(extname(filePath));\n\t}\n\tasync function collectModuleGraphFiles(viteServer, roots) {\n\t\tconst files = /* @__PURE__ */ new Set();\n\t\tconst uniqueRoots = [...new Set(roots)];\n\t\tfor (const root of uniqueRoots) try {\n\t\t\tawait viteServer.ssrLoadModule(root);\n\t\t} catch (error) {\n\t\t\tif (root === absoluteConfigPath) logError(\"Failed to load config module graph root:\", error);\n\t\t\telse log(`Skipped module-graph root after load failure: ${root}`, \"debug\");\n\t\t}\n\t\ttry {\n\t\t\tconst visited = /* @__PURE__ */ new Set();\n\t\t\tconst queue = [...uniqueRoots];\n\t\t\twhile (queue.length > 0) {\n\t\t\t\tconst current = queue.shift();\n\t\t\t\tif (current === void 0 || visited.has(current)) continue;\n\t\t\t\tvisited.add(current);\n\t\t\t\tconst mod = viteServer.moduleGraph.getModuleById(current);\n\t\t\t\tif (!mod) continue;\n\t\t\t\tif (mod.file) files.add(mod.file);\n\t\t\t\tfor (const imported of mod.importedModules) if (imported.id && !visited.has(imported.id)) queue.push(imported.id);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogError(\"Failed to collect watched files:\", error);\n\t\t}\n\t\treturn files;\n\t}\n\tasync function resolveWatchedFiles(viteServer) {\n\t\tconst previousWatchedFiles = new Set(watchedFiles);\n\t\tconst previousIgnoredOutputFiles = new Set(ignoredOutputFiles);\n\t\tignoredOutputFiles.clear();\n\t\ttry {\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\"contract\"]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst config = configResult.value;\n\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\tconst contract = config.contract;\n\t\t\tif (!contract) return /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst files = /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst inputs = contract.source.inputs ?? [];\n\t\t\tfor (const outputFile of resolveContractOutputFiles(contract.output)) ignoredOutputFiles.add(outputFile);\n\t\t\tconst moduleGraphRoots = [absoluteConfigPath];\n\t\t\tfor (const input of inputs) {\n\t\t\t\tif (!ignoredOutputFiles.has(input)) files.add(input);\n\t\t\t\tif (isModuleGraphRoot(input)) moduleGraphRoots.push(input);\n\t\t\t}\n\t\t\tfor (const file of await collectModuleGraphFiles(viteServer, moduleGraphRoots)) if (!ignoredOutputFiles.has(file)) files.add(file);\n\t\t\treturn files;\n\t\t} catch (error) {\n\t\t\tif (previousIgnoredOutputFiles.size > 0) for (const outputFile of previousIgnoredOutputFiles) ignoredOutputFiles.add(outputFile);\n\t\t\tif (!didWarnConfigWatchFallback) {\n\t\t\t\tdidWarnConfigWatchFallback = true;\n\t\t\t\tconst reason = error instanceof Error ? ` ${error.message}` : \"\";\n\t\t\t\tlogWarning(`${previousWatchedFiles.size > 0 ? `Watching the previous dependency set plus ${absoluteConfigPath}` : `Watching only ${absoluteConfigPath}`} because Prisma Next config inputs could not be resolved.${reason} Contract watch coverage is partial.`);\n\t\t\t}\n\t\t\tif (previousWatchedFiles.size > 0) {\n\t\t\t\tpreviousWatchedFiles.add(absoluteConfigPath);\n\t\t\t\treturn previousWatchedFiles;\n\t\t\t}\n\t\t\treturn /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t}\n\t}\n\tasync function updateWatchedFiles(viteServer) {\n\t\tconst newWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\tconst toAdd = [];\n\t\tconst toRemove = [];\n\t\tfor (const file of newWatchedFiles) if (!watchedFiles.has(file)) toAdd.push(file);\n\t\tfor (const file of watchedFiles) if (!newWatchedFiles.has(file)) toRemove.push(file);\n\t\tfor (const file of toAdd) viteServer.watcher.add(file);\n\t\tfor (const file of toRemove) viteServer.watcher.unwatch(file);\n\t\twatchedFiles.clear();\n\t\tfor (const file of newWatchedFiles) watchedFiles.add(file);\n\t\tif (toAdd.length > 0 || toRemove.length > 0) log(`Updated watched files: +${toAdd.length} -${toRemove.length}`, \"debug\");\n\t}\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tconfigResolved(config) {\n\t\t\tabsoluteConfigPath = resolve(config.root, configPath);\n\t\t\tlog(`Config path: ${absoluteConfigPath}`, \"debug\");\n\t\t},\n\t\tasync configureServer(viteServer) {\n\t\t\tserver = viteServer;\n\t\t\tlifecycleAbortController = new AbortController();\n\t\t\tisEmitInFlight = false;\n\t\t\thasQueuedEmit = false;\n\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\tconst onTrackedWatcherEvent = (file) => {\n\t\t\t\thandleTrackedFileChange(file);\n\t\t\t};\n\t\t\tconst cleanup = () => {\n\t\t\t\tif (debounceTimer) {\n\t\t\t\t\tclearTimeout(debounceTimer);\n\t\t\t\t\tdebounceTimer = null;\n\t\t\t\t}\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tlifecycleAbortController.abort();\n\t\t\t\tviteServer.watcher.off?.(\"change\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"add\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"unlink\", onTrackedWatcherEvent);\n\t\t\t\tignoredOutputFiles.clear();\n\t\t\t\tfor (const outputJsonPath of ownedOutputJsonPaths) disposeEmitQueue(outputJsonPath);\n\t\t\t\townedOutputJsonPaths.clear();\n\t\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\t\tserver = null;\n\t\t\t\twatchedFiles.clear();\n\t\t\t\tlog(\"Server closed, cleaned up resources\", \"debug\");\n\t\t\t};\n\t\t\tviteServer.httpServer?.on(\"close\", cleanup);\n\t\t\tviteServer.watcher?.on?.(\"close\", cleanup);\n\t\t\tviteServer.watcher.on(\"change\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"add\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"unlink\", onTrackedWatcherEvent);\n\t\t\tconst initialWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\t\tfor (const file of initialWatchedFiles) watchedFiles.add(file);\n\t\t\tfor (const file of watchedFiles) viteServer.watcher.add(file);\n\t\t\tif (watchedFiles.size === 0) {\n\t\t\t\tconst errorMessage = `No files are being watched. The config file \"${absoluteConfigPath}\" could not be loaded or has no dependencies. HMR for contract changes will not work.`;\n\t\t\t\tlogError(errorMessage);\n\t\t\t\tviteServer.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlog(`Watching ${watchedFiles.size} files`, \"debug\");\n\t\t\t\tif (logLevel === \"debug\") for (const file of watchedFiles) log(` ${file}`, \"debug\");\n\t\t\t}\n\t\t\tawait requestEmit({ refreshWatchedFiles: false });\n\t\t},\n\t\thandleHotUpdate(ctx) {\n\t\t\thandleTrackedFileChange(ctx.file);\n\t\t}\n\t};\n}\n//#endregion\nexport { prismaVitePlugin };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AAKA,MAAM,cAAc;AACpB,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B,MAAM,0CAA0C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BD,SAAS,iBAAiB,aAAa,qBAAqB,SAAS;CACpE,MAAM,aAAa,SAAS,cAAc;CAC1C,MAAM,WAAW,SAAS,YAAY;CACtC,IAAI;CACJ,MAAM,+BAA+B,IAAI,IAAI;CAC7C,MAAM,qCAAqC,IAAI,IAAI;CACnD,MAAM,uCAAuC,IAAI,IAAI;CACrD,IAAI,gBAAgB;CACpB,IAAI,2BAA2B,IAAI,gBAAgB;CACnD,IAAI,SAAS;CACb,IAAI,iBAAiB;CACrB,IAAI,gBAAgB;CACpB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B,6BAA6B;IAC7B,SAAS;IACT,aAAa,MAAM;IACnB,IAAI,uCAAuC,OAAO;GACnD;GACA,WAAW,YAAY,GAAG,SAAS,OAAO;GAC1C,WAAW,SAAS,KAAK,SAAS,OAAO;GACzC,WAAW,QAAQ,GAAG,UAAU,qBAAqB;GACrD,WAAW,QAAQ,GAAG,OAAO,qBAAqB;GAClD,WAAW,QAAQ,GAAG,UAAU,qBAAqB;GACrD,MAAM,sBAAsB,MAAM,oBAAoB,UAAU;GAChE,KAAK,MAAM,QAAQ,qBAAqB,aAAa,IAAI,IAAI;GAC7D,KAAK,MAAM,QAAQ,cAAc,WAAW,QAAQ,IAAI,IAAI;GAC5D,IAAI,aAAa,SAAS,GAAG;IAC5B,MAAM,eAAe,gDAAgD,mBAAmB;IACxF,SAAS,YAAY;IACrB,WAAW,GAAG,KAAK;KAClB,MAAM;KACN,KAAK;MACJ,SAAS,iBAAiB;MAC1B,OAAO;MACP,QAAQ;KACT;IACD,CAAC;GACF,OAAO;IACN,IAAI,YAAY,aAAa,KAAK,SAAS,OAAO;IAClD,IAAI,aAAa,SAAS,KAAK,MAAM,QAAQ,cAAc,IAAI,KAAK,QAAQ,OAAO;GACpF;GACA,MAAM,YAAY,EAAE,qBAAqB,MAAM,CAAC;EACjD;EACA,gBAAgB,KAAK;GACpB,wBAAwB,IAAI,IAAI;EACjC;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"vite-plugin-contract-emit.mjs","names":[],"sources":["../../../../1-framework/3-tooling/vite-plugin-contract-emit/dist/index.mjs"],"sourcesContent":["import { disposeEmitQueue, executeContractEmit } from \"@internal/cli/control-api\";\nimport { loadConfigForSections } from \"@internal/config-loader\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { extname, resolve } from \"pathe\";\n//#region src/plugin.ts\nconst PLUGIN_NAME = \"prisma-vite-plugin-contract-emit\";\nconst DEFAULT_DEBOUNCE_MS = 150;\nconst DEFAULT_CONFIG_PATH = \"prisma.config.ts\";\nconst MODULE_GRAPH_EXTENSIONS = /* @__PURE__ */ new Set([\n\t\".js\",\n\t\".jsx\",\n\t\".mjs\",\n\t\".cjs\",\n\t\".ts\",\n\t\".tsx\",\n\t\".mts\",\n\t\".cts\"\n]);\n/**\n* Creates a Vite plugin that automatically emits Prisma 8 contract artifacts.\n*\n* The plugin resolves watched files from contract source provider metadata,\n* re-emitting contract artifacts on changes with debounce while serializing\n* overlapping emits into a single follow-up run.\n*\n* @param configPath - Path to prisma.config.ts (relative or absolute). Defaults to 'prisma.config.ts'\n* @param options - Optional plugin configuration\n* @returns Vite plugin\n*\n* @example\n* ```ts\n* import { defineConfig } from 'vite';\n* import { prismaVitePlugin } from '@internal/vite-plugin-contract-emit';\n*\n* // Use default config path\n* export default defineConfig({\n* plugins: [prismaVitePlugin()],\n* });\n*\n* // Or specify a custom path\n* export default defineConfig({\n* plugins: [prismaVitePlugin('custom/prisma.config.ts')],\n* });\n* ```\n*/\nfunction prismaVitePlugin(configPath = DEFAULT_CONFIG_PATH, options) {\n\tconst debounceMs = options?.debounceMs ?? DEFAULT_DEBOUNCE_MS;\n\tconst logLevel = options?.logLevel ?? \"info\";\n\tlet absoluteConfigPath;\n\tconst watchedFiles = /* @__PURE__ */ new Set();\n\tconst ignoredOutputFiles = /* @__PURE__ */ new Set();\n\tconst ownedOutputJsonPaths = /* @__PURE__ */ new Set();\n\tlet debounceTimer = null;\n\tlet lifecycleAbortController = new AbortController();\n\tlet server = null;\n\tlet isEmitInFlight = false;\n\tlet hasQueuedEmit = false;\n\tlet queuedEmitNeedsWatchedFileRefresh = false;\n\tlet didWarnConfigWatchFallback = false;\n\tfunction log(message, level = \"info\") {\n\t\tif (logLevel === \"silent\") return;\n\t\tif (level === \"debug\" && logLevel !== \"debug\") return;\n\t\tconsole.log(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction logError(message, error) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconst errorMessage = error instanceof Error ? error.message : error ? String(error) : \"\";\n\t\tconsole.error(`[${PLUGIN_NAME}] ${message}${errorMessage ? ` ${errorMessage}` : \"\"}`);\n\t\tif (error instanceof Error && error.stack && logLevel === \"debug\") console.error(error.stack);\n\t}\n\tfunction logWarning(message) {\n\t\tif (logLevel === \"silent\") return;\n\t\tconsole.warn(`[${PLUGIN_NAME}] ${message}`);\n\t}\n\tfunction handleTrackedFileChange(file) {\n\t\tconst normalized = resolve(file);\n\t\tif (ignoredOutputFiles.has(normalized)) {\n\t\t\tlog(`Ignoring emitted artifact update: ${normalized}`, \"debug\");\n\t\t\treturn;\n\t\t}\n\t\tif (watchedFiles.has(normalized)) {\n\t\t\tlog(`Detected change: ${normalized}`, \"debug\");\n\t\t\tscheduleEmit();\n\t\t}\n\t}\n\tasync function emitContract({ refreshWatchedFiles = true } = {}) {\n\t\tconst signal = lifecycleAbortController.signal;\n\t\ttry {\n\t\t\tif (server && refreshWatchedFiles) await updateWatchedFiles(server);\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\n\t\t\t\t\"contract\",\n\t\t\t\t\"family\",\n\t\t\t\t\"target\",\n\t\t\t\t\"adapter\",\n\t\t\t\t\"extensions\"\n\t\t\t]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst result = await executeContractEmit({\n\t\t\t\tconfig: configResult.value,\n\t\t\t\tcwd: process.cwd(),\n\t\t\t\tconfigPath: absoluteConfigPath,\n\t\t\t\tsignal\n\t\t\t});\n\t\t\tlog(`Emitted contract (storageHash: ${result.storageHash.slice(0, 8)}...)`);\n\t\t\tlog(` → ${result.files.json}`, \"debug\");\n\t\t\tlog(` → ${result.files.dts}`, \"debug\");\n\t\t\tif (server) {\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.json);\n\t\t\t\tserver.moduleGraph.onFileChange(result.files.dts);\n\t\t\t}\n\t\t\tif (server && !hasQueuedEmit) server.ws.send({ type: \"full-reload\" });\n\t\t\telse if (hasQueuedEmit) log(\"Skipped full reload because a newer emit is queued\", \"debug\");\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (signal.aborted || error instanceof Error && error.name === \"AbortError\") {\n\t\t\t\tlog(\"Emit cancelled\", \"debug\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlogError(\"Contract emit failed:\", error);\n\t\t\tif (server) {\n\t\t\t\tconst errorMessage = error instanceof Error ? error.message : String(error);\n\t\t\t\tconst errorStack = error instanceof Error ? error.stack : void 0;\n\t\t\t\tserver.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: errorStack ?? \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n\tasync function drainQueuedEmits() {\n\t\tif (isEmitInFlight || lifecycleAbortController.signal.aborted) return;\n\t\tisEmitInFlight = true;\n\t\ttry {\n\t\t\twhile (hasQueuedEmit && !lifecycleAbortController.signal.aborted) {\n\t\t\t\tconst refreshWatchedFiles = queuedEmitNeedsWatchedFileRefresh;\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tawait emitContract({ refreshWatchedFiles });\n\t\t\t}\n\t\t} finally {\n\t\t\tisEmitInFlight = false;\n\t\t}\n\t}\n\tfunction requestEmit({ refreshWatchedFiles = true } = {}) {\n\t\tif (lifecycleAbortController.signal.aborted) return Promise.resolve();\n\t\thasQueuedEmit = true;\n\t\tqueuedEmitNeedsWatchedFileRefresh ||= refreshWatchedFiles;\n\t\tif (isEmitInFlight) {\n\t\t\tlog(\"Queued follow-up emit while another emit is running\", \"debug\");\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn drainQueuedEmits();\n\t}\n\tfunction scheduleEmit() {\n\t\tif (debounceTimer) clearTimeout(debounceTimer);\n\t\tdebounceTimer = setTimeout(() => {\n\t\t\tdebounceTimer = null;\n\t\t\trequestEmit();\n\t\t}, debounceMs);\n\t}\n\tfunction resolveContractOutputFiles(contractOutput) {\n\t\tif (contractOutput === void 0) return /* @__PURE__ */ new Set();\n\t\tconst { jsonPath, dtsPath } = getEmittedArtifactPaths(contractOutput);\n\t\townedOutputJsonPaths.add(jsonPath);\n\t\treturn /* @__PURE__ */ new Set([jsonPath, dtsPath]);\n\t}\n\tfunction isModuleGraphRoot(filePath) {\n\t\treturn MODULE_GRAPH_EXTENSIONS.has(extname(filePath));\n\t}\n\tasync function collectModuleGraphFiles(viteServer, roots) {\n\t\tconst files = /* @__PURE__ */ new Set();\n\t\tconst uniqueRoots = [...new Set(roots)];\n\t\tfor (const root of uniqueRoots) try {\n\t\t\tawait viteServer.ssrLoadModule(root);\n\t\t} catch (error) {\n\t\t\tif (root === absoluteConfigPath) logError(\"Failed to load config module graph root:\", error);\n\t\t\telse log(`Skipped module-graph root after load failure: ${root}`, \"debug\");\n\t\t}\n\t\ttry {\n\t\t\tconst visited = /* @__PURE__ */ new Set();\n\t\t\tconst queue = [...uniqueRoots];\n\t\t\twhile (queue.length > 0) {\n\t\t\t\tconst current = queue.shift();\n\t\t\t\tif (current === void 0 || visited.has(current)) continue;\n\t\t\t\tvisited.add(current);\n\t\t\t\tconst mod = viteServer.moduleGraph.getModuleById(current);\n\t\t\t\tif (!mod) continue;\n\t\t\t\tif (mod.file) files.add(mod.file);\n\t\t\t\tfor (const imported of mod.importedModules) if (imported.id && !visited.has(imported.id)) queue.push(imported.id);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogError(\"Failed to collect watched files:\", error);\n\t\t}\n\t\treturn files;\n\t}\n\tasync function resolveWatchedFiles(viteServer) {\n\t\tconst previousWatchedFiles = new Set(watchedFiles);\n\t\tconst previousIgnoredOutputFiles = new Set(ignoredOutputFiles);\n\t\tignoredOutputFiles.clear();\n\t\ttry {\n\t\t\tconst configResult = await loadConfigForSections(absoluteConfigPath, [\"contract\"]);\n\t\t\tif (!configResult.ok) throw configResult.failure;\n\t\t\tconst config = configResult.value;\n\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\tconst contract = config.contract;\n\t\t\tif (!contract) return /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst files = /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t\tconst inputs = contract.source.inputs ?? [];\n\t\t\tfor (const outputFile of resolveContractOutputFiles(contract.output)) ignoredOutputFiles.add(outputFile);\n\t\t\tconst moduleGraphRoots = [absoluteConfigPath];\n\t\t\tfor (const input of inputs) {\n\t\t\t\tif (!ignoredOutputFiles.has(input)) files.add(input);\n\t\t\t\tif (isModuleGraphRoot(input)) moduleGraphRoots.push(input);\n\t\t\t}\n\t\t\tfor (const file of await collectModuleGraphFiles(viteServer, moduleGraphRoots)) if (!ignoredOutputFiles.has(file)) files.add(file);\n\t\t\treturn files;\n\t\t} catch (error) {\n\t\t\tif (previousIgnoredOutputFiles.size > 0) for (const outputFile of previousIgnoredOutputFiles) ignoredOutputFiles.add(outputFile);\n\t\t\tif (!didWarnConfigWatchFallback) {\n\t\t\t\tdidWarnConfigWatchFallback = true;\n\t\t\t\tconst reason = error instanceof Error ? ` ${error.message}` : \"\";\n\t\t\t\tlogWarning(`${previousWatchedFiles.size > 0 ? `Watching the previous dependency set plus ${absoluteConfigPath}` : `Watching only ${absoluteConfigPath}`} because Prisma 8 config inputs could not be resolved.${reason} Contract watch coverage is partial.`);\n\t\t\t}\n\t\t\tif (previousWatchedFiles.size > 0) {\n\t\t\t\tpreviousWatchedFiles.add(absoluteConfigPath);\n\t\t\t\treturn previousWatchedFiles;\n\t\t\t}\n\t\t\treturn /* @__PURE__ */ new Set([absoluteConfigPath]);\n\t\t}\n\t}\n\tasync function updateWatchedFiles(viteServer) {\n\t\tconst newWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\tconst toAdd = [];\n\t\tconst toRemove = [];\n\t\tfor (const file of newWatchedFiles) if (!watchedFiles.has(file)) toAdd.push(file);\n\t\tfor (const file of watchedFiles) if (!newWatchedFiles.has(file)) toRemove.push(file);\n\t\tfor (const file of toAdd) viteServer.watcher.add(file);\n\t\tfor (const file of toRemove) viteServer.watcher.unwatch(file);\n\t\twatchedFiles.clear();\n\t\tfor (const file of newWatchedFiles) watchedFiles.add(file);\n\t\tif (toAdd.length > 0 || toRemove.length > 0) log(`Updated watched files: +${toAdd.length} -${toRemove.length}`, \"debug\");\n\t}\n\treturn {\n\t\tname: PLUGIN_NAME,\n\t\tconfigResolved(config) {\n\t\t\tabsoluteConfigPath = resolve(config.root, configPath);\n\t\t\tlog(`Config path: ${absoluteConfigPath}`, \"debug\");\n\t\t},\n\t\tasync configureServer(viteServer) {\n\t\t\tserver = viteServer;\n\t\t\tlifecycleAbortController = new AbortController();\n\t\t\tisEmitInFlight = false;\n\t\t\thasQueuedEmit = false;\n\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\tconst onTrackedWatcherEvent = (file) => {\n\t\t\t\thandleTrackedFileChange(file);\n\t\t\t};\n\t\t\tconst cleanup = () => {\n\t\t\t\tif (debounceTimer) {\n\t\t\t\t\tclearTimeout(debounceTimer);\n\t\t\t\t\tdebounceTimer = null;\n\t\t\t\t}\n\t\t\t\thasQueuedEmit = false;\n\t\t\t\tqueuedEmitNeedsWatchedFileRefresh = false;\n\t\t\t\tlifecycleAbortController.abort();\n\t\t\t\tviteServer.watcher.off?.(\"change\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"add\", onTrackedWatcherEvent);\n\t\t\t\tviteServer.watcher.off?.(\"unlink\", onTrackedWatcherEvent);\n\t\t\t\tignoredOutputFiles.clear();\n\t\t\t\tfor (const outputJsonPath of ownedOutputJsonPaths) disposeEmitQueue(outputJsonPath);\n\t\t\t\townedOutputJsonPaths.clear();\n\t\t\t\tdidWarnConfigWatchFallback = false;\n\t\t\t\tserver = null;\n\t\t\t\twatchedFiles.clear();\n\t\t\t\tlog(\"Server closed, cleaned up resources\", \"debug\");\n\t\t\t};\n\t\t\tviteServer.httpServer?.on(\"close\", cleanup);\n\t\t\tviteServer.watcher?.on?.(\"close\", cleanup);\n\t\t\tviteServer.watcher.on(\"change\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"add\", onTrackedWatcherEvent);\n\t\t\tviteServer.watcher.on(\"unlink\", onTrackedWatcherEvent);\n\t\t\tconst initialWatchedFiles = await resolveWatchedFiles(viteServer);\n\t\t\tfor (const file of initialWatchedFiles) watchedFiles.add(file);\n\t\t\tfor (const file of watchedFiles) viteServer.watcher.add(file);\n\t\t\tif (watchedFiles.size === 0) {\n\t\t\t\tconst errorMessage = `No files are being watched. The config file \"${absoluteConfigPath}\" could not be loaded or has no dependencies. HMR for contract changes will not work.`;\n\t\t\t\tlogError(errorMessage);\n\t\t\t\tviteServer.ws.send({\n\t\t\t\t\ttype: \"error\",\n\t\t\t\t\terr: {\n\t\t\t\t\t\tmessage: `[prisma-next] ${errorMessage}`,\n\t\t\t\t\t\tstack: \"\",\n\t\t\t\t\t\tplugin: PLUGIN_NAME\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlog(`Watching ${watchedFiles.size} files`, \"debug\");\n\t\t\t\tif (logLevel === \"debug\") for (const file of watchedFiles) log(` ${file}`, \"debug\");\n\t\t\t}\n\t\t\tawait requestEmit({ refreshWatchedFiles: false });\n\t\t},\n\t\thandleHotUpdate(ctx) {\n\t\t\thandleTrackedFileChange(ctx.file);\n\t\t}\n\t};\n}\n//#endregion\nexport { prismaVitePlugin };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;AAKA,MAAM,cAAc;AACpB,MAAM,sBAAsB;AAC5B,MAAM,sBAAsB;AAC5B,MAAM,0CAA0C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BD,SAAS,iBAAiB,aAAa,qBAAqB,SAAS;CAC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
|
3
|
-
"version": "8.0.0-rc.9-dev.
|
|
3
|
+
"version": "8.0.0-rc.9-dev.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"description": "Prisma
|
|
7
|
+
"description": "Prisma 8 dev/build tooling: the ORM command family, emitter, config-loader, language server, telemetry, vite plugin",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@prisma/orm-framework": "8.0.0-rc.9-dev.
|
|
12
|
+
"@prisma/orm-framework": "8.0.0-rc.9-dev.6",
|
|
13
13
|
"@vercel/detect-agent": "^1.2.4",
|
|
14
14
|
"arktype": "^2.2.2",
|
|
15
15
|
"c12": "^3.3.4",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"wrap-ansi": "^10.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@internal/cli": "8.0.0-rc.9-dev.
|
|
33
|
-
"@internal/cli-telemetry": "8.0.0-rc.9-dev.
|
|
34
|
-
"@internal/config-loader": "8.0.0-rc.9-dev.
|
|
35
|
-
"@internal/emitter": "8.0.0-rc.9-dev.
|
|
36
|
-
"@internal/language-server": "8.0.0-rc.9-dev.
|
|
37
|
-
"@internal/migration-tools": "8.0.0-rc.9-dev.
|
|
38
|
-
"@internal/publish-surface": "8.0.0-rc.9-dev.
|
|
39
|
-
"@repo/tsconfig": "8.0.0-rc.9-dev.
|
|
40
|
-
"@repo/tsdown": "8.0.0-rc.9-dev.
|
|
41
|
-
"@internal/vite-plugin-contract-emit": "8.0.0-rc.9-dev.
|
|
32
|
+
"@internal/cli": "8.0.0-rc.9-dev.6",
|
|
33
|
+
"@internal/cli-telemetry": "8.0.0-rc.9-dev.6",
|
|
34
|
+
"@internal/config-loader": "8.0.0-rc.9-dev.6",
|
|
35
|
+
"@internal/emitter": "8.0.0-rc.9-dev.6",
|
|
36
|
+
"@internal/language-server": "8.0.0-rc.9-dev.6",
|
|
37
|
+
"@internal/migration-tools": "8.0.0-rc.9-dev.6",
|
|
38
|
+
"@internal/publish-surface": "8.0.0-rc.9-dev.6",
|
|
39
|
+
"@repo/tsconfig": "8.0.0-rc.9-dev.6",
|
|
40
|
+
"@repo/tsdown": "8.0.0-rc.9-dev.6",
|
|
41
|
+
"@internal/vite-plugin-contract-emit": "8.0.0-rc.9-dev.6",
|
|
42
42
|
"tsdown": "0.22.14",
|
|
43
43
|
"typescript": "5.9.3"
|
|
44
44
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-Ib7P8moX.mjs","names":["APP_SPACE_ID"],"sources":["../../../../1-framework/3-tooling/migration/dist/exports/aggregate.mjs"],"sourcesContent":["import { M as errorRefNotResolvable, N as errorSpaceHeadRefMissing, i as errorContractDeserializationFailed, p as errorHashNotInGraph, r as errorBundleNotFoundForGraphNode, t as MigrationToolsError } from \"../errors-SoLLYLtw.mjs\";\nimport { n as readContractSnapshotDts, r as readContractSnapshotJson, t as contractSnapshotDir } from \"../contract-snapshot-store-qGrwlGmt.mjs\";\nimport { s as readMigrationsDir } from \"../io-BmWQNxRP.mjs\";\nimport { t as EMPTY_CONTRACT_HASH } from \"../constants-CM-w38DQ.mjs\";\nimport { n as isGraphNode } from \"../graph-membership-DY1Onbc3.mjs\";\nimport { l as reconstructGraph, o as findPathWithDecision } from \"../migration-graph-CW4bMmTz.mjs\";\nimport { a as readRefsTolerant, r as readRef, t as HEAD_REF_NAME } from \"../refs-BpSpzdYB.mjs\";\nimport { c as isValidSpaceId, i as APP_SPACE_ID, l as spaceMigrationDirectory, r as readContractSpaceHeadRef, t as listContractSpaceDirectories, u as spaceRefsDirectory } from \"../verify-contract-spaces-CrxvgpwD.mjs\";\nimport { join } from \"pathe\";\nimport { issueOutcome } from \"@internal/framework-components/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { UNBOUND_NAMESPACE_ID, coordinateKey, elementCoordinates, entityAt } from \"@internal/framework-components/ir\";\nimport { effectiveControlPolicy } from \"@internal/contract/types\";\n//#region src/aggregate/aggregate.ts\nfunction contractAtMemoKey(hash, refName) {\n\treturn `${hash}\\0${refName ?? \"\"}`;\n}\nfunction deserializeContractAtPath(filePath, contractJson, deserializeContract) {\n\ttry {\n\t\treturn deserializeContract(contractJson);\n\t} catch (error) {\n\t\tif (MigrationToolsError.is(error)) throw error;\n\t\tthrow errorContractDeserializationFailed(filePath, error instanceof Error ? error.message : String(error));\n\t}\n}\nasync function readContractSnapshotEntry(migrationsDir, hash, deserializeContract) {\n\tconst contractJson = await readContractSnapshotJson(migrationsDir, hash);\n\treturn {\n\t\tcontractJson,\n\t\tcontractDts: await readContractSnapshotDts(migrationsDir, hash),\n\t\tcontract: deserializeContractAtPath(join(contractSnapshotDir(migrationsDir, hash), \"contract.json\"), contractJson, deserializeContract)\n\t};\n}\nasync function resolveContractAt(args) {\n\tconst { hash, opts, refsDir, migrationsDir, packages, graph, deserializeContract } = args;\n\tconst refName = opts?.refName;\n\tif (refName !== void 0) {\n\t\tlet refEntry;\n\t\ttry {\n\t\t\trefEntry = await readRef(refsDir, refName);\n\t\t} catch (error) {\n\t\t\tif (MigrationToolsError.is(error) && error.code === \"MIGRATION.UNKNOWN_REF\") refEntry = void 0;\n\t\t\telse throw error;\n\t\t}\n\t\tif (refEntry) {\n\t\t\tconst { contractJson, contractDts, contract } = await readContractSnapshotEntry(migrationsDir, refEntry.hash, deserializeContract);\n\t\t\treturn {\n\t\t\t\thash: refEntry.hash,\n\t\t\t\tcontractJson,\n\t\t\t\tcontractDts,\n\t\t\t\tcontract,\n\t\t\t\tprovenance: \"ref\"\n\t\t\t};\n\t\t}\n\t\tif (isGraphNode(hash, graph)) return resolveGraphNodeContractAt({\n\t\t\thash,\n\t\t\tmigrationsDir,\n\t\t\tpackages,\n\t\t\tdeserializeContract,\n\t\t\texplicitLabel: refName\n\t\t});\n\t\tthrow errorRefNotResolvable(refName);\n\t}\n\tif (isGraphNode(hash, graph)) return resolveGraphNodeContractAt({\n\t\thash,\n\t\tmigrationsDir,\n\t\tpackages,\n\t\tdeserializeContract\n\t});\n\tthrow errorHashNotInGraph(hash, graph);\n}\nasync function resolveGraphNodeContractAt(args) {\n\tconst { hash, migrationsDir, packages, deserializeContract, explicitLabel } = args;\n\tif (!packages.find((pkg) => pkg.metadata.to === hash)) throw errorBundleNotFoundForGraphNode(hash, explicitLabel);\n\tconst { contractJson, contractDts, contract } = await readContractSnapshotEntry(migrationsDir, hash, deserializeContract);\n\treturn {\n\t\thash,\n\t\tcontractJson,\n\t\tcontractDts,\n\t\tcontract,\n\t\tprovenance: \"graph-node\"\n\t};\n}\n/**\n* Resolve a contract space's head ref, asserting it is present. The apply/verify\n* engine only runs after `checkIntegrity` has refused on `headRefMissing`,\n* so a space reaching the planner / verifier without a head ref is a\n* programming error (the integrity gate was skipped), not a user-facing\n* state. The app space's head ref is always synthesised, so this only\n* ever guards an ungated extension space.\n*/\nfunction requireHeadRef(space) {\n\tif (space.headRef === null) throw new InternalError(`Contract space \"${space.spaceId}\" has no head ref; the integrity gate must refuse a missing head ref before planning or verifying.`);\n\treturn space.headRef;\n}\n/**\n* Build a {@link AggregateContractSpace} with lazily-memoised `graph()`,\n* `contract()`, and `contractAt()` facets.\n*\n* `graph()` reconstructs the migration graph from `packages` on first\n* call and caches it. `contract()` calls `resolveContract` on first call\n* and caches the result; a throwing `resolveContract` (e.g. a missing or\n* undeserializable on-disk contract) re-throws on each call rather than\n* caching a value — `checkIntegrity` surfaces that as `contractUnreadable`.\n* `contractAt()` materializes the contract at an arbitrary graph node with\n* the same resolution order as plan-time ref resolution: the ref's pointer\n* plus the store entry keyed by the pointer's hash first (when\n* `opts.refName` is set), else the contract snapshot store entry keyed by\n* the matching package's `to` hash.\n*/\nfunction createAggregateContractSpace(args) {\n\tconst { spaceId, packages, refs, headRef, refsDir, migrationsDir, resolveContract, deserializeContract } = args;\n\tlet graphMemo;\n\tlet contractMemo;\n\tconst contractAtMemo = /* @__PURE__ */ new Map();\n\tfunction spaceGraph() {\n\t\tgraphMemo ??= reconstructGraph(packages);\n\t\treturn graphMemo;\n\t}\n\treturn {\n\t\tspaceId,\n\t\tpackages,\n\t\trefs,\n\t\theadRef,\n\t\tgraph: spaceGraph,\n\t\tcontract() {\n\t\t\tcontractMemo ??= resolveContract();\n\t\t\treturn contractMemo;\n\t\t},\n\t\tasync contractAt(hash, opts) {\n\t\t\tconst key = contractAtMemoKey(hash, opts?.refName);\n\t\t\tconst cached = contractAtMemo.get(key);\n\t\t\tif (cached) return cached;\n\t\t\tconst result = await resolveContractAt({\n\t\t\t\thash,\n\t\t\t\topts,\n\t\t\t\trefsDir,\n\t\t\t\tmigrationsDir,\n\t\t\t\tpackages,\n\t\t\t\tgraph: spaceGraph(),\n\t\t\t\tdeserializeContract\n\t\t\t});\n\t\t\tcontractAtMemo.set(key, result);\n\t\t\treturn result;\n\t\t}\n\t};\n}\n/**\n* Collect the union of every namespace declared across all contract spaces of an\n* aggregate (app + extensions) and return a minimal object with the shape\n* `{ storage: { namespaces } }` suitable for passing to\n* `familyInstance.introspect`.\n*\n* Callers invoke this after the integrity gate (`buildContractSpaceAggregate`\n* with `checkContracts: true`), so every `space.contract()` call is safe —\n* no try/catch is needed here.\n*/\nfunction collectAggregateNamespaces(aggregate) {\n\tconst merged = {};\n\tfor (const space of aggregate.spaces()) for (const [key, ns] of Object.entries(space.contract().storage.namespaces)) {\n\t\tconst existing = merged[key];\n\t\tmerged[key] = existing === void 0 ? ns : mergeNamespaceEntries(existing, ns);\n\t}\n\treturn { storage: { namespaces: merged } };\n}\n/**\n* Union two contract spaces' declarations for the same namespace id, per\n* entity kind. Two spaces may legitimately share a namespace (e.g. both\n* declaring tables in `public`); element-level disjointness is enforced by\n* `checkIntegrity`, so the kind maps never collide on a name — replacing the\n* whole namespace would silently drop the earlier space's entities.\n*/\nfunction mergeNamespaceEntries(a, b) {\n\tconst entries = { ...a.entries };\n\tfor (const [entityKind, kindMap] of Object.entries(b.entries)) entries[entityKind] = {\n\t\t...entries[entityKind],\n\t\t...kindMap\n\t};\n\treturn {\n\t\t...a,\n\t\tentries\n\t};\n}\n/**\n* Assemble a {@link ContractSpaceAggregate} value from its contract spaces and a\n* `checkIntegrity` implementation. The query methods (`listSpaces` /\n* `hasSpace` / `space` / `spaces`) are derived here so every aggregate —\n* loader-built or test-built — shares one query surface: `app` first,\n* then `extensions` in the order supplied (the loader sorts them\n* lex-ascending by `spaceId`).\n*/\nfunction createContractSpaceAggregate(args) {\n\tconst { targetId, app, extensions, checkIntegrity } = args;\n\tconst ordered = [app, ...extensions];\n\tconst byId = new Map(ordered.map((m) => [m.spaceId, m]));\n\tconst spaceDeclares = (space, coordinate) => {\n\t\tconst key = coordinateKey(coordinate);\n\t\tfor (const coord of elementCoordinates(space.contract().storage)) if (coordinateKey(coord) === key) return true;\n\t\treturn false;\n\t};\n\treturn {\n\t\ttargetId,\n\t\tapp,\n\t\textensions,\n\t\tlistSpaces: () => ordered.map((m) => m.spaceId),\n\t\thasSpace: (id) => byId.has(id),\n\t\tspace: (id) => byId.get(id),\n\t\tspaces: () => ordered,\n\t\tdeclaresEntity: (coordinate) => ordered.some((space) => spaceDeclares(space, coordinate)),\n\t\tdeclaringSpaces: (coordinate) => ordered.filter((space) => spaceDeclares(space, coordinate)).map((s) => s.spaceId),\n\t\tcheckIntegrity\n\t};\n}\n//#endregion\n//#region src/aggregate/all-external.ts\nfunction isControlPolicy(value) {\n\treturn value === \"managed\" || value === \"tolerated\" || value === \"external\" || value === \"observed\";\n}\n/**\n* True when every storage element the contract declares resolves to the\n* `external` control policy (ADR 224) — element-level `control` first, the\n* contract's `defaultControlPolicy` otherwise. A contract with no storage\n* elements is vacuously all-external.\n*\n* This is the precondition for advancing a contract space's marker without\n* any migrations (the declared-state resolution the db-init aggregate\n* planner and `migrate` share): only when nothing in the space is\n* Prisma-Next-managed can the storage structure be correct without a\n* migration having produced it. Any space that declares a managed element\n* but ships no migration graph is an authoring bug and must fail loudly.\n*/\nfunction allStorageElementsExternal(contract) {\n\tfor (const coordinate of elementCoordinates(contract.storage)) {\n\t\tconst entity = entityAt(contract.storage, coordinate);\n\t\tconst declared = entity !== null && typeof entity === \"object\" ? blindCast(entity).control : void 0;\n\t\tif (effectiveControlPolicy(isControlPolicy(declared) ? declared : void 0, contract.defaultControlPolicy) !== \"external\") return false;\n\t}\n\treturn true;\n}\n//#endregion\n//#region src/aggregate/check-integrity.ts\n/**\n* Walk the loaded model and return **every** integrity violation — never\n* bailing at the first. Structurally-derivable violations (load-time\n* problems, self-edges, missing / unreachable head refs) are always\n* produced; layout-drift checks require `declaredExtensions`, and\n* contract / target / disjointness checks require `checkContracts`.\n*/\nfunction computeIntegrityViolations(input, opts) {\n\tconst violations = [];\n\tfor (const { space, problems, refProblems, headRefProblem, isApp } of input.spaces) {\n\t\tconst { spaceId } = space;\n\t\tfor (const problem of problems) violations.push(loadProblemToViolation(spaceId, problem));\n\t\tfor (const refProblem of refProblems) violations.push({\n\t\t\tkind: \"refUnreadable\",\n\t\t\tspaceId,\n\t\t\trefName: refProblem.refName,\n\t\t\tdetail: refProblem.detail\n\t\t});\n\t\tif (headRefProblem !== null) violations.push({\n\t\t\tkind: \"refUnreadable\",\n\t\t\tspaceId,\n\t\t\trefName: headRefProblem.refName,\n\t\t\tdetail: headRefProblem.detail\n\t\t});\n\t\tfor (const pkg of space.packages) {\n\t\t\tconst from = pkg.metadata.from ?? \"empty\";\n\t\t\tconst isSelfEdge = from === pkg.metadata.to;\n\t\t\tconst hasDataOp = pkg.ops.some((op) => op.operationClass === \"data\");\n\t\t\tif (isSelfEdge && !hasDataOp) violations.push({\n\t\t\t\tkind: \"sameSourceAndTarget\",\n\t\t\t\tspaceId,\n\t\t\t\tdirName: pkg.dirName,\n\t\t\t\thash: from\n\t\t\t});\n\t\t}\n\t\tviolations.push(...duplicateMigrationHashViolations(spaceId, space.packages));\n\t\tif (!isApp && headRefProblem === null) {\n\t\t\tif (space.headRef === null) violations.push({\n\t\t\t\tkind: \"headRefMissing\",\n\t\t\t\tspaceId\n\t\t\t});\n\t\t\telse if (space.packages.length > 0 && !headRefPresentInGraph(space, space.headRef.hash)) violations.push({\n\t\t\t\tkind: \"headRefNotInGraph\",\n\t\t\t\tspaceId,\n\t\t\t\thash: space.headRef.hash\n\t\t\t});\n\t\t}\n\t}\n\tif (opts?.declaredExtensions !== void 0) violations.push(...layoutViolations(input.spaces, opts.declaredExtensions));\n\tif (opts?.checkContracts === true) violations.push(...contractViolations(input));\n\treturn violations;\n}\nfunction loadProblemToViolation(spaceId, problem) {\n\tswitch (problem.kind) {\n\t\tcase \"hashMismatch\": return {\n\t\t\tkind: \"hashMismatch\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName,\n\t\t\tstored: problem.stored,\n\t\t\tcomputed: problem.computed\n\t\t};\n\t\tcase \"providedInvariantsMismatch\": return {\n\t\t\tkind: \"providedInvariantsMismatch\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName\n\t\t};\n\t\tcase \"packageUnloadable\": return {\n\t\t\tkind: \"packageUnloadable\",\n\t\t\tspaceId,\n\t\t\tdirName: problem.dirName,\n\t\t\tdetail: problem.detail\n\t\t};\n\t}\n}\nfunction duplicateMigrationHashViolations(spaceId, packages) {\n\tconst dirNamesByHash = /* @__PURE__ */ new Map();\n\tfor (const pkg of packages) {\n\t\tconst hash = pkg.metadata.migrationHash;\n\t\tconst dirNames = dirNamesByHash.get(hash);\n\t\tif (dirNames) dirNames.push(pkg.dirName);\n\t\telse dirNamesByHash.set(hash, [pkg.dirName]);\n\t}\n\tconst out = [];\n\tfor (const [migrationHash, dirNames] of dirNamesByHash) if (dirNames.length > 1) out.push({\n\t\tkind: \"duplicateMigrationHash\",\n\t\tspaceId,\n\t\tmigrationHash,\n\t\tdirNames: [...dirNames].sort()\n\t});\n\treturn out;\n}\n/**\n* Whether a space's head-ref hash is present in its reconstructed graph.\n* An empty graph is reachable only by the empty-contract sentinel.\n*/\nfunction headRefPresentInGraph(space, headHash) {\n\tconst graph = space.graph();\n\tif (graph.nodes.size === 0) return headHash === EMPTY_CONTRACT_HASH;\n\treturn graph.nodes.has(headHash);\n}\nfunction layoutViolations(spaces, declaredExtensions) {\n\tconst out = [];\n\tconst extensionSpaceIds = new Set(spaces.filter((s) => !s.isApp).map((s) => s.space.spaceId));\n\tconst declaredIds = new Set(declaredExtensions.map((d) => d.id));\n\tfor (const id of [...extensionSpaceIds].sort()) if (!declaredIds.has(id)) out.push({\n\t\tkind: \"orphanSpaceDir\",\n\t\tspaceId: id\n\t});\n\tfor (const id of [...declaredIds].sort()) if (!extensionSpaceIds.has(id)) out.push({\n\t\tkind: \"declaredButUnmigrated\",\n\t\tspaceId: id\n\t});\n\treturn out;\n}\nfunction contractViolations(input) {\n\tconst out = [];\n\tconst elementClaimedBy = /* @__PURE__ */ new Map();\n\tconst elementLabel = /* @__PURE__ */ new Map();\n\tfor (const { space } of input.spaces) {\n\t\tlet contract;\n\t\ttry {\n\t\t\tcontract = space.contract();\n\t\t} catch (error) {\n\t\t\tout.push({\n\t\t\t\tkind: \"contractUnreadable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tdetail: detailOf$1(error)\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (contract.target !== input.targetId) out.push({\n\t\t\tkind: \"targetMismatch\",\n\t\t\tspaceId: space.spaceId,\n\t\t\texpected: input.targetId,\n\t\t\tactual: contract.target\n\t\t});\n\t\tfor (const coordinate of elementCoordinates(contract.storage)) {\n\t\t\tconst key = coordinateKey(coordinate);\n\t\t\tconst claimers = elementClaimedBy.get(key);\n\t\t\tif (claimers) claimers.push(space.spaceId);\n\t\t\telse {\n\t\t\t\telementClaimedBy.set(key, [space.spaceId]);\n\t\t\t\telementLabel.set(key, `${coordinate.namespaceId}.${coordinate.entityName}`);\n\t\t\t}\n\t\t}\n\t}\n\tconst disjointness = [];\n\tfor (const [key, claimedBy] of elementClaimedBy) if (claimedBy.length > 1) {\n\t\tconst element = elementLabel.get(key) ?? key;\n\t\tdisjointness.push({\n\t\t\tkind: \"disjointness\",\n\t\t\telement,\n\t\t\tclaimedBy: [...claimedBy].sort()\n\t\t});\n\t}\n\tdisjointness.sort((a, b) => a.kind === \"disjointness\" && b.kind === \"disjointness\" ? a.element.localeCompare(b.element) : 0);\n\tout.push(...disjointness);\n\treturn out;\n}\nfunction detailOf$1(error) {\n\tif (MigrationToolsError.is(error)) return error.why;\n\tif (error instanceof Error) return error.message;\n\treturn String(error);\n}\n//#endregion\n//#region src/aggregate/fabricated-migration-edge.ts\nfunction buildFabricatedMigrationEdge(args) {\n\treturn {\n\t\tdirName: \"\",\n\t\tmigrationHash: args.destinationStorageHash,\n\t\tfrom: args.currentMarkerStorageHash ?? \"\",\n\t\tto: args.destinationStorageHash,\n\t\toperationCount: args.operationCount,\n\t\t...args.destinationContractJson !== void 0 ? { destinationContractJson: args.destinationContractJson } : {}\n\t};\n}\n//#endregion\n//#region src/aggregate/loader.ts\n/**\n* Build a tolerant, queryable {@link ContractSpaceAggregate} from on-disk\n* migration state plus the caller's live app contract.\n*\n* Building **never throws on disk content**: a hash- or\n* invariants-mismatched package is retained, an unparseable package is\n* omitted, a missing extension head ref leaves `headRef: null`, and an\n* unreadable on-disk contract defers its failure to `space.contract()`.\n* Every such problem is judged by {@link ContractSpaceAggregate.checkIntegrity}\n* rather than aborting the load. The only rejections are catastrophic I/O\n* (a `migrations/` that exists but is unreadable for reasons other than\n* absence).\n*\n* The app space's head ref is synthesised from the live contract's\n* storage hash (the app contract is authored independently of the\n* migration graph), and `app.contract()` returns the supplied contract.\n* Extension spaces read their contract, refs, and head ref from disk.\n*/\nasync function loadContractSpaceAggregate(input) {\n\tconst { migrationsDir, deserializeContract, appContract } = input;\n\tconst targetId = appContract.target;\n\tconst appState = await loadAppSpace(migrationsDir, appContract, deserializeContract);\n\tconst extensionStates = await loadExtensionSpaces(migrationsDir, deserializeContract);\n\tconst spaces = [appState, ...extensionStates];\n\treturn createContractSpaceAggregate({\n\t\ttargetId,\n\t\tapp: appState.space,\n\t\textensions: extensionStates.map((state) => state.space),\n\t\tcheckIntegrity: (opts) => computeIntegrityViolations({\n\t\t\ttargetId,\n\t\t\tspaces\n\t\t}, opts)\n\t});\n}\nasync function loadAppSpace(migrationsDir, appContract, deserializeContract) {\n\tconst spaceDir = spaceMigrationDirectory(migrationsDir, APP_SPACE_ID);\n\tconst { packages, problems } = await readMigrationsDir(spaceDir, { migrationsDir });\n\tconst { refs, problems: refProblems } = await readRefsTolerant(spaceRefsDirectory(spaceDir));\n\treturn {\n\t\tspace: createAggregateContractSpace({\n\t\t\tspaceId: APP_SPACE_ID,\n\t\t\tpackages,\n\t\t\trefs,\n\t\t\theadRef: {\n\t\t\t\thash: appContract.storage.storageHash,\n\t\t\t\tinvariants: []\n\t\t\t},\n\t\t\trefsDir: spaceRefsDirectory(spaceDir),\n\t\t\tmigrationsDir,\n\t\t\tresolveContract: () => appContract,\n\t\t\tdeserializeContract\n\t\t}),\n\t\tproblems,\n\t\trefProblems,\n\t\theadRefProblem: null,\n\t\tisApp: true\n\t};\n}\nasync function loadExtensionSpaces(migrationsDir, deserializeContract) {\n\tconst extensionIds = (await listContractSpaceDirectories(migrationsDir)).filter((name) => name !== APP_SPACE_ID).filter(isValidSpaceId).sort();\n\tconst states = [];\n\tfor (const spaceId of extensionIds) states.push(await loadExtensionSpace(migrationsDir, spaceId, deserializeContract));\n\treturn states;\n}\nasync function loadExtensionSpace(migrationsDir, spaceId, deserializeContract) {\n\tconst spaceDir = spaceMigrationDirectory(migrationsDir, spaceId);\n\tconst { packages, problems } = await readMigrationsDir(spaceDir, { migrationsDir });\n\tconst { refs, problems: refProblems } = await readRefsTolerant(spaceRefsDirectory(spaceDir));\n\tconst { headRef, problem: headRefProblem } = await readHeadRefTolerant(migrationsDir, spaceId);\n\tconst rawContract = await readRawContractDeferred(migrationsDir, spaceId, headRef);\n\treturn {\n\t\tspace: createAggregateContractSpace({\n\t\t\tspaceId,\n\t\t\tpackages,\n\t\t\trefs,\n\t\t\theadRef,\n\t\t\trefsDir: spaceRefsDirectory(spaceDir),\n\t\t\tmigrationsDir,\n\t\t\tresolveContract: () => deserializeContract(rawContract()),\n\t\t\tdeserializeContract\n\t\t}),\n\t\tproblems,\n\t\trefProblems,\n\t\theadRefProblem,\n\t\tisApp: false\n\t};\n}\n/**\n* Read an extension's head ref, distinguishing a *genuinely absent*\n* `head.json` (`headRef: null`, no problem — judged `headRefMissing`)\n* from one that *exists but cannot be parsed* (`headRef: null` plus a\n* problem — judged `refUnreadable`, not `headRefMissing`).\n* `readContractSpaceHeadRef` already returns `null` only for ENOENT and\n* throws for unparseable / schema-invalid content, so the throw is the\n* corruption signal. Construction never throws on disk content.\n*/\nfunction isToleratedRefHeadReadError(error) {\n\tif (MigrationToolsError.is(error)) return true;\n\tif (!(error instanceof Error)) return false;\n\tconst code = error.code;\n\treturn code === \"ENOENT\" || code === \"EISDIR\";\n}\nasync function readHeadRefTolerant(migrationsDir, spaceId) {\n\ttry {\n\t\treturn {\n\t\t\theadRef: await readContractSpaceHeadRef(migrationsDir, spaceId),\n\t\t\tproblem: null\n\t\t};\n\t} catch (error) {\n\t\tif (!isToleratedRefHeadReadError(error)) throw error;\n\t\treturn {\n\t\t\theadRef: null,\n\t\t\tproblem: {\n\t\t\t\trefName: HEAD_REF_NAME,\n\t\t\t\tdetail: detailOf(error)\n\t\t\t}\n\t\t};\n\t}\n}\nfunction detailOf(error) {\n\treturn error instanceof Error ? error.message : String(error);\n}\n/**\n* Read the raw contract snapshot-store entry eagerly (cheap I/O) but defer\n* its (throwing) failure to call time, so a missing or unparseable store\n* entry becomes a `contract()` throw — surfaced as `contractUnreadable` —\n* rather than a construction failure. When `headRef` is absent there is no\n* hash to resolve against the store, so the deferred call always throws;\n* `checkIntegrity` already reports that case as `headRefMissing`, and a\n* `checkContracts` pass surfaces the same space as `contractUnreadable`.\n*/\nasync function readRawContractDeferred(migrationsDir, spaceId, headRef) {\n\tif (headRef === null) return () => {\n\t\tthrow errorSpaceHeadRefMissing(spaceId);\n\t};\n\ttry {\n\t\tconst raw = await readContractSnapshotJson(migrationsDir, headRef.hash);\n\t\treturn () => raw;\n\t} catch (error) {\n\t\treturn () => {\n\t\t\tthrow error;\n\t\t};\n\t}\n}\n//#endregion\n//#region src/aggregate/strategies/plan-from-diff.ts\n/**\n* Plan a migration for a single contract space from a diff against the full\n* live schema, delegating to the family's `createPlanner(...).plan(...)`.\n*\n* The planner diffs the whole introspected schema, so it sees other contract\n* spaces' tables as \"extras\"; the orchestration hands the planner the\n* aggregate as an ownership oracle so it can ask, per extra, whether any\n* space owns it — a sibling-owned table is left untouched, so the planner\n* never emits a destructive drop for it, and this strategy holds no ownership\n* logic of its own. The schema is never pruned before planning: cross-space\n* foreign keys need every sibling table visible to the diff.\n*\n* The produced plan's `targetId` is set from `aggregateTargetId`\n* (the aggregate's ambient target). The family's planner does not\n* stamp `targetId` on the produced plan; the aggregate planner is\n* the single point that knows the target.\n*\n* Used by:\n*\n* - The app space by default (CLI policy\n* `ignoreGraphFor: { app.spaceId }`).\n* - Any extension space whose `headRef.invariants` is empty and whose\n* graph is non-empty (the all-external, zero-migration-package case is\n* handled directly by the aggregate planner without calling this).\n*/\nasync function planFromDiff(input) {\n\tconst plannerResult = await input.migrations.createPlanner(input.adapter).plan({\n\t\tcontract: input.space.contract(),\n\t\tschema: input.schemaIntrospection,\n\t\tpolicy: input.operationPolicy,\n\t\tfromContract: null,\n\t\tframeworkComponents: input.frameworkComponents,\n\t\tspaceId: input.space.spaceId,\n\t\townership: input.ownership,\n\t\tsnapshotsImportPath: \"\"\n\t});\n\tif (plannerResult.kind === \"failure\") return {\n\t\tkind: \"failure\",\n\t\tconflicts: plannerResult.conflicts\n\t};\n\tconst producedPlan = plannerResult.plan;\n\tconst plan = new Proxy(producedPlan, {\n\t\tget(target, prop) {\n\t\t\tif (prop === \"targetId\") return input.aggregateTargetId;\n\t\t\treturn Reflect.get(target, prop, target);\n\t\t},\n\t\thas(target, prop) {\n\t\t\tif (prop === \"targetId\") return true;\n\t\t\treturn Reflect.has(target, prop);\n\t\t}\n\t});\n\tconst destinationStorageHash = producedPlan.destination.storageHash;\n\tconst producedOps = await Promise.all(producedPlan.operations);\n\tconst destinationContract = input.space.contract();\n\treturn {\n\t\tkind: \"ok\",\n\t\tresult: {\n\t\t\tplan,\n\t\t\tdisplayOps: producedOps,\n\t\t\tdestinationContract,\n\t\t\tstrategy: \"plan-from-diff\",\n\t\t\t...plannerResult.warnings && plannerResult.warnings.length > 0 ? { warnings: plannerResult.warnings } : {},\n\t\t\tmigrationEdges: [buildFabricatedMigrationEdge({\n\t\t\t\tcurrentMarkerStorageHash: input.currentMarker?.storageHash,\n\t\t\t\tdestinationStorageHash,\n\t\t\t\toperationCount: producedOps.length,\n\t\t\t\tdestinationContractJson: destinationContract\n\t\t\t})]\n\t\t}\n\t};\n}\n//#endregion\n//#region src/aggregate/strategies/resolve-recorded-path.ts\n/**\n* Resolve a contract space's hydrated migration graph to the path from the\n* live marker to `space.headRef.hash`, covering every required invariant.\n*\n* Pure synchronous function — no I/O. The aggregate's loader has\n* already integrity-checked every package and reconstructed the graph;\n* this resolves the path by looking up ops by `migrationHash` and\n* assembles a `MigrationPlan` with `targetId` set from the aggregate (no\n* placeholder cast).\n*\n* Required invariants are computed as `headRef.invariants \\ marker.invariants`\n* — the marker already declares some invariants satisfied; the path\n* only needs to provide the remainder. Mirrors today's\n* `computeExtensionSpaceApplyPath` semantics.\n*/\nfunction resolveRecordedPath(input) {\n\tconst { aggregateTargetId, space, currentMarker, refName } = input;\n\tconst headRef = requireHeadRef(space);\n\tconst graph = space.graph();\n\tconst packagesByMigrationHash = new Map(space.packages.map((pkg) => [pkg.metadata.migrationHash, pkg]));\n\tconst fromHash = currentMarker?.storageHash ?? \"empty\";\n\tconst markerInvariants = new Set(currentMarker?.invariants ?? []);\n\tconst required = new Set(headRef.invariants.filter((id) => !markerInvariants.has(id)));\n\tconst outcome = findPathWithDecision(graph, fromHash, headRef.hash, {\n\t\trequired,\n\t\t...refName !== void 0 ? { refName } : {}\n\t});\n\tif (outcome.kind === \"unreachable\") return { kind: \"unreachable\" };\n\tif (outcome.kind === \"unsatisfiable\") return {\n\t\tkind: \"unsatisfiable\",\n\t\tmissing: outcome.missing\n\t};\n\tconst pathOps = [];\n\tconst providedInvariantsSet = /* @__PURE__ */ new Set();\n\tconst edgeRefs = [];\n\tfor (const edge of outcome.decision.selectedPath) {\n\t\tconst pkg = packagesByMigrationHash.get(edge.migrationHash);\n\t\tif (!pkg) throw new InternalError(`Migration package missing for edge ${edge.migrationHash} in space \"${space.spaceId}\". The hydrated migration graph and packagesByMigrationHash map are out of sync — this should be unreachable; report.`);\n\t\tfor (const op of pkg.ops) pathOps.push(op);\n\t\tfor (const invariant of pkg.metadata.providedInvariants) providedInvariantsSet.add(invariant);\n\t\tedgeRefs.push({\n\t\t\tmigrationHash: edge.migrationHash,\n\t\t\tdirName: edge.dirName,\n\t\t\tfrom: edge.from,\n\t\t\tto: edge.to,\n\t\t\toperationCount: pkg.ops.length,\n\t\t\t...pkg.endContractJson !== void 0 ? { destinationContractJson: pkg.endContractJson } : {}\n\t\t});\n\t}\n\treturn {\n\t\tkind: \"ok\",\n\t\tresult: {\n\t\t\tplan: {\n\t\t\t\ttargetId: aggregateTargetId,\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\torigin: currentMarker === null ? null : { storageHash: currentMarker.storageHash },\n\t\t\t\tdestination: { storageHash: headRef.hash },\n\t\t\t\toperations: pathOps,\n\t\t\t\tprovidedInvariants: [...providedInvariantsSet].sort()\n\t\t\t},\n\t\t\tdisplayOps: pathOps,\n\t\t\tdestinationContract: space.contract(),\n\t\t\tstrategy: \"resolve-recorded-path\",\n\t\t\tmigrationEdges: edgeRefs,\n\t\t\tpathDecision: outcome.decision\n\t\t}\n\t};\n}\n//#endregion\n//#region src/aggregate/planner.ts\n/**\n* Plan a migration across every contract space of a {@link ContractSpaceAggregate}.\n*\n* Per-space operation selection, in order; first match wins:\n*\n* 1. If `callerPolicy.ignoreGraphFor.has(space.spaceId)`:\n* - If `space.headRef.invariants` is empty → `planFromDiff`.\n* - Else → `policyConflict` (a diff-fabricated plan cannot satisfy\n* authored invariants).\n* 2. Else if `space.graph()` is non-empty AND `resolveRecordedPath`\n* succeeds → its result.\n* 3. Else if `space.graph()` is non-empty but unresolvable →\n* `extensionPathUnreachable` / `extensionPathUnsatisfiable`.\n* 4. Else (empty graph — the space ships no migration packages at all,\n* e.g. an all-external extension space like Supabase's `auth`/`storage`)\n* if `space.headRef.invariants` is empty → declare the no-op state\n* directly (zero ops, destination = head ref) without invoking the\n* family planner.\n* 5. Else → `extensionPathUnsatisfiable` (an empty graph cannot satisfy\n* non-empty invariants).\n*\n* Output `applyOrder` is `[...aggregate.extensions.map(spaceId), aggregate.app.spaceId]`\n* — extensions alphabetical, then app — matching today's\n* `concatenateSpaceApplyInputs` ordering. This preserves\n* `MigrationRunnerFailure.failingSpace` attribution byte-for-byte.\n*\n* Every emitted `MigrationPlan` has `targetId = aggregate.targetId`.\n* No placeholder cast; no patch step.\n*/\nasync function planMigration(input) {\n\tconst { aggregate, currentDBState, callerPolicy } = input;\n\tconst perSpace = /* @__PURE__ */ new Map();\n\tconst orderedSpaces = [...aggregate.extensions, aggregate.app];\n\tfor (const space of orderedSpaces) {\n\t\tconst currentMarker = currentDBState.markersBySpaceId.get(space.spaceId) ?? null;\n\t\tconst headRef = requireHeadRef(space);\n\t\tconst ignoreGraph = callerPolicy.ignoreGraphFor.has(space.spaceId);\n\t\tconst invariantsRequired = headRef.invariants.length > 0;\n\t\tif (ignoreGraph && invariantsRequired) return notOk({\n\t\t\tkind: \"policyConflict\",\n\t\t\tspaceId: space.spaceId,\n\t\t\tdetail: `\\`callerPolicy.ignoreGraphFor\\` requested for space \"${space.spaceId}\", but the contract space declares non-empty head-ref invariants (${headRef.invariants.join(\", \")}). A plan built directly from the contract IR cannot satisfy authored invariants — the graph must be walked. Either remove \"${space.spaceId}\" from \\`ignoreGraphFor\\` or amend the on-disk head ref to declare zero invariants.`\n\t\t});\n\t\tif (ignoreGraph) {\n\t\t\tconst diffOutcome = await planFromDiff({\n\t\t\t\taggregateTargetId: aggregate.targetId,\n\t\t\t\tcurrentMarker,\n\t\t\t\tspace,\n\t\t\t\townership: aggregate,\n\t\t\t\tschemaIntrospection: currentDBState.schemaIntrospection,\n\t\t\t\tadapter: input.adapter,\n\t\t\t\tmigrations: input.migrations,\n\t\t\t\tframeworkComponents: input.frameworkComponents,\n\t\t\t\toperationPolicy: input.operationPolicy\n\t\t\t});\n\t\t\tif (diffOutcome.kind === \"failure\") return notOk({\n\t\t\t\tkind: \"planFromDiffFailed\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tconflicts: diffOutcome.conflicts\n\t\t\t});\n\t\t\tperSpace.set(space.spaceId, diffOutcome.result);\n\t\t\tcontinue;\n\t\t}\n\t\tif (space.graph().nodes.size > 0) {\n\t\t\tconst resolved = resolveRecordedPath({\n\t\t\t\taggregateTargetId: aggregate.targetId,\n\t\t\t\tspace,\n\t\t\t\tcurrentMarker\n\t\t\t});\n\t\t\tif (resolved.kind === \"ok\") {\n\t\t\t\tperSpace.set(space.spaceId, resolved.result);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (resolved.kind === \"unreachable\") return notOk({\n\t\t\t\tkind: \"extensionPathUnreachable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\ttarget: headRef.hash\n\t\t\t});\n\t\t\treturn notOk({\n\t\t\t\tkind: \"extensionPathUnsatisfiable\",\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\tmissingInvariants: resolved.missing\n\t\t\t});\n\t\t}\n\t\tif (invariantsRequired) return notOk({\n\t\t\tkind: \"extensionPathUnsatisfiable\",\n\t\t\tspaceId: space.spaceId,\n\t\t\tmissingInvariants: [...headRef.invariants].sort()\n\t\t});\n\t\tif (!allStorageElementsExternal(space.contract())) return notOk({\n\t\t\tkind: \"extensionPathUnreachable\",\n\t\t\tspaceId: space.spaceId,\n\t\t\ttarget: headRef.hash\n\t\t});\n\t\tperSpace.set(space.spaceId, {\n\t\t\tplan: {\n\t\t\t\ttargetId: aggregate.targetId,\n\t\t\t\tspaceId: space.spaceId,\n\t\t\t\torigin: currentMarker === null ? null : { storageHash: currentMarker.storageHash },\n\t\t\t\tdestination: { storageHash: headRef.hash },\n\t\t\t\toperations: []\n\t\t\t},\n\t\t\tdisplayOps: [],\n\t\t\tdestinationContract: space.contract(),\n\t\t\tstrategy: \"declared-state\",\n\t\t\tmigrationEdges: [buildFabricatedMigrationEdge({\n\t\t\t\tcurrentMarkerStorageHash: currentMarker?.storageHash,\n\t\t\t\tdestinationStorageHash: headRef.hash,\n\t\t\t\toperationCount: 0\n\t\t\t})]\n\t\t});\n\t}\n\treturn ok({\n\t\tperSpace,\n\t\tapplyOrder: [...aggregate.extensions.map((m) => m.spaceId), aggregate.app.spaceId]\n\t});\n}\nfunction pathIsUnder(path, prefix) {\n\tif (path.length < prefix.length) return false;\n\treturn prefix.every((segment, i) => path[i] === segment);\n}\n/**\n* Whether an issue's subject is a WHOLE top-level entity — as opposed to\n* something nested under one (e.g. a field, an index, or a policy). Calls\n* the injected `classify` capability, which resolves this from the issue's\n* node `nodeKind` (this aggregate never reaches into the node itself).\n* Absent `classify` (or a `classify` that returns nothing for this issue —\n* a family that doesn't classify) falls back to path shape: a\n* top-level entity's path is exactly its own name (one segment), so\n* anything deeper is nested.\n*/\nfunction isWholeEntityIssue(issue, classify) {\n\tconst granularity = classify?.(issue);\n\tif (granularity !== void 0) return granularity === \"entity\";\n\treturn issue.path.length === 1;\n}\n/**\n* A contract space's contract-satisfaction view. Strips the top-level entity\n* extras — the `not-expected` findings on whole-entity nodes (plus the\n* findings the differ's total descent reported under those entities). Those\n* belong to the standalone unclaimed-elements list\n* ({@link collectExtraElementCoordinates}), never a space's own verdict.\n*\n* Nested `not-expected` findings (an extra field on the space's own\n* declared entity…) and structural findings (an undeclared policy) are\n* the space's **own drift** and stay.\n*\n* The verdict recomputes from the surviving list: the per-space result is\n* issue-based (`ok` ⇔ the list is empty), so a space whose only failures\n* were top-level extras passes after the strip.\n*/\nfunction stripExtraFindings(result, classify) {\n\tconst droppedTablePaths = result.schema.issues.filter((issue) => issueOutcome(issue) === \"not-expected\" && isWholeEntityIssue(issue, classify)).map((issue) => issue.path);\n\tconst issues = result.schema.issues.filter((issue) => {\n\t\tif (issueOutcome(issue) !== \"not-expected\") return true;\n\t\tif (classify?.(issue) === \"structural\") return true;\n\t\treturn !droppedTablePaths.some((prefix) => pathIsUnder(issue.path, prefix));\n\t});\n\tif (issues.length === result.schema.issues.length) return result;\n\tconst ok = issues.length === 0;\n\tconst { code: staleCode, ...envelope } = result;\n\treturn {\n\t\t...envelope,\n\t\tok,\n\t\t...ok ? {} : { code: result.code ?? \"CONTRACT.MARKER_REQUIRED\" },\n\t\tsummary: ok ? \"Database schema satisfies contract\" : result.summary,\n\t\tschema: {\n\t\t\tissues,\n\t\t\t...result.schema.warnings !== void 0 ? { warnings: result.schema.warnings } : {}\n\t\t}\n\t};\n}\n/**\n* The schema-IR entity coordinate a `not-expected` `SchemaDiffIssue`\n* addresses, when its subject is a whole top-level entity. A nested leaf\n* (a field, an index, a policy on an undeclared entity) has no entity of\n* its own to report here.\n*\n* The whole-entity's name is the last path segment: the differ builds each\n* path from its nodes' ids, so at a whole-entity finding the last segment is\n* exactly the entity name — for every family, whether or not it stamps a\n* granularity. The namespace segment only exists for namespace-qualified\n* paths (`['database', namespaceId, entityName]`); single-namespace families\n* (a flat `['database', entityName]`, or a bare `[entityName]`) have no\n* separate segment, so every entity they declare implicitly shares one\n* namespace — the same sentinel the aggregate's own coordinate walk uses\n* for those families.\n*\n* `entityKind` is asked from the injected `classifyEntityKind` capability —\n* this module never names a family entity kind itself. Absent a classifier\n* (the classifier-absent path-shape fallback, e.g. a document family) the\n* coordinate carries {@link UNCLASSIFIED_ENTITY_KIND}: no ownership\n* consumer queries `declaresEntity` for a family in that state today, so\n* nothing reads the value as true.\n*/\nfunction schemaDiffIssueCoordinate(issue, classify, classifyEntityKind) {\n\tif (!isWholeEntityIssue(issue, classify)) return void 0;\n\tconst entityName = issue.path[issue.path.length - 1];\n\tif (entityName === void 0) return void 0;\n\treturn {\n\t\tnamespaceId: issue.path.length === 3 ? issue.path[1] ?? UNBOUND_NAMESPACE_ID : UNBOUND_NAMESPACE_ID,\n\t\tentityKind: classifyEntityKind?.(issue) ?? \"unclassified-entity\",\n\t\tentityName\n\t};\n}\n/**\n* The schema-IR entity coordinates of every live element this contract\n* space's diff reports as `not-expected`, deduplicated. The verifier gathers\n* these across all spaces and keeps only the coordinates no contract space\n* declares — the standalone unclaimed-elements list, reported once for the\n* whole database.\n*/\nfunction collectExtraElementCoordinates(result, classify, classifyEntityKind) {\n\tconst seen = /* @__PURE__ */ new Map();\n\tfor (const issue of result.schema.issues) {\n\t\tif (issueOutcome(issue) !== \"not-expected\") continue;\n\t\tconst coordinate = schemaDiffIssueCoordinate(issue, classify, classifyEntityKind);\n\t\tif (coordinate === void 0) continue;\n\t\tseen.set(coordinateKey(coordinate), coordinate);\n\t}\n\treturn [...seen.values()];\n}\n//#endregion\n//#region src/aggregate/verifier.ts\n/**\n* Verify a {@link ContractSpaceAggregate} against the live database\n* state. Bundles two checks:\n*\n* - `markerCheck` per contract space: compare the live marker row against the\n* space's `headRef.hash` + `headRef.invariants`. Absence is a\n* distinct kind, not an error (callers — `db verify` strict vs\n* `db init` precondition — choose how to interpret it).\n* - `schemaCheck`: two distinct outputs from the per-space diffs.\n* `perSpace` — each space verified against the **full**\n* introspected schema, then its extras stripped, leaving the space's\n* declared nodes (its contract-satisfaction view; verdict is\n* missing/mismatch only). `unclaimed` — the extras gathered\n* across every space, deduplicated, and filtered to the names no contract\n* space declares (via the passive aggregate's ownership query); reported\n* once for the database. No schema is pruned before verifying.\n*\n* `markerCheck.orphanMarkers` lists every marker row whose `space` is\n* not a contract space of the aggregate. `db verify` callers reject orphans;\n* future tooling may not.\n*\n* Pure synchronous function; no I/O. The caller (CLI) gathers\n* `markersBySpaceId` and `schemaIntrospection` ahead of the call.\n*/\nfunction verifyMigration(input) {\n\ttry {\n\t\treturn runVerifyMigration(input);\n\t} catch (error) {\n\t\treturn notOk({\n\t\t\tkind: \"introspectionFailure\",\n\t\t\tdetail: error instanceof Error ? error.message : String(error)\n\t\t});\n\t}\n}\nfunction runVerifyMigration(input) {\n\tconst { aggregate, markersBySpaceId, schemaIntrospection, mode, verifySchemaForSpace, classifySubjectGranularity, classifyEntityKind } = input;\n\tconst allSpaces = [aggregate.app, ...aggregate.extensions];\n\tconst aggregateSpaceIds = new Set(allSpaces.map((m) => m.spaceId));\n\tconst markerPerSpace = /* @__PURE__ */ new Map();\n\tfor (const space of allSpaces) {\n\t\tconst marker = markersBySpaceId.get(space.spaceId) ?? null;\n\t\tif (marker === null) {\n\t\t\tmarkerPerSpace.set(space.spaceId, { kind: \"absent\" });\n\t\t\tcontinue;\n\t\t}\n\t\tconst headRef = requireHeadRef(space);\n\t\tif (marker.storageHash !== headRef.hash) {\n\t\t\tmarkerPerSpace.set(space.spaceId, {\n\t\t\t\tkind: \"hashMismatch\",\n\t\t\t\tmarkerHash: marker.storageHash,\n\t\t\t\texpected: headRef.hash\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst markerInvariants = new Set(marker.invariants);\n\t\tconst missing = headRef.invariants.filter((id) => !markerInvariants.has(id));\n\t\tif (missing.length > 0) {\n\t\t\tmarkerPerSpace.set(space.spaceId, {\n\t\t\t\tkind: \"missingInvariants\",\n\t\t\t\tmissing: [...missing].sort()\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tmarkerPerSpace.set(space.spaceId, { kind: \"ok\" });\n\t}\n\tconst orphanMarkers = [];\n\tfor (const [spaceId, row] of markersBySpaceId) if (row !== null && !aggregateSpaceIds.has(spaceId)) orphanMarkers.push({\n\t\tspaceId,\n\t\trow\n\t});\n\torphanMarkers.sort((a, b) => a.spaceId.localeCompare(b.spaceId));\n\tconst schemaPerSpace = /* @__PURE__ */ new Map();\n\tconst extraCoordinates = /* @__PURE__ */ new Map();\n\tfor (const space of allSpaces) {\n\t\tconst result = verifySchemaForSpace(schemaIntrospection, space, mode);\n\t\tschemaPerSpace.set(space.spaceId, stripExtraFindings(result, classifySubjectGranularity));\n\t\tfor (const coordinate of collectExtraElementCoordinates(result, classifySubjectGranularity, classifyEntityKind)) extraCoordinates.set(coordinateKey(coordinate), coordinate);\n\t}\n\tconst unclaimed = [...new Set([...extraCoordinates.values()].filter((coordinate) => !aggregate.declaresEntity(coordinate)).map((coordinate) => coordinate.entityName))].sort((a, b) => a.localeCompare(b));\n\treturn ok({\n\t\tmarkerCheck: {\n\t\t\tperSpace: markerPerSpace,\n\t\t\torphanMarkers\n\t\t},\n\t\tschemaCheck: {\n\t\t\tperSpace: schemaPerSpace,\n\t\t\tunclaimed\n\t\t}\n\t});\n}\n//#endregion\nexport { allStorageElementsExternal, buildFabricatedMigrationEdge, collectAggregateNamespaces, computeIntegrityViolations, createAggregateContractSpace, createContractSpaceAggregate, loadContractSpaceAggregate, loadProblemToViolation, planMigration, requireHeadRef, resolveRecordedPath, verifyMigration };\n\n//# sourceMappingURL=aggregate.mjs.map"],"mappings":";;;;;;;;;;;;;;;;AAgBA,SAAS,kBAAkB,MAAM,SAAS;CACzC,OAAO,GAAG,KAAK,IAAI,WAAW;AAC/B;AACA,SAAS,0BAA0B,UAAU,cAAc,qBAAqB;CAC/E,IAAI;EACH,OAAO,oBAAoB,YAAY;CACxC,SAAS,OAAO;EACf,IAAI,oBAAoB,GAAG,KAAK,GAAG,MAAM;EACzC,MAAM,mCAAmC,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;CAC1G;AACD;AACA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iBAAiB,IAAI,cAAc,UAAU,GAAG,UAAU;CAC5K;CACA,MAAM,YAAY,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,iBAAiB,OAAO,CAAC,CAAC,CAAC,QAAQ,eAAe,CAAC,UAAU,eAAe,UAAU,CAAC,CAAC,CAAC,KAAK,eAAe,WAAW,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;CACzM,OAAO,GAAG;EACT,aAAa;GACZ,UAAU;GACV;EACD;EACA,aAAa;GACZ,UAAU;GACV;EACD;CACD,CAAC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exports-gEustzOH.mjs","names":[],"sources":["../../../../1-framework/3-tooling/config-loader/dist/exports/index.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { normalizeContractConfig } from \"@internal/config/config-types\";\nimport { dirname, join, resolve } from \"pathe\";\nimport { realpathSync } from \"node:fs\";\nimport { access } from \"node:fs/promises\";\nimport { pathToFileURL } from \"node:url\";\nimport { collectConfigIssues } from \"@internal/config/config-validation\";\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\";\n//#region src/finalize-config.ts\nfunction finalizeContractSource(source, configDir) {\n\tconst resolvedInputs = source.inputs?.map((input) => resolve(configDir, input));\n\tif (resolvedInputs === void 0) return source;\n\treturn {\n\t\t...source,\n\t\tinputs: resolvedInputs\n\t};\n}\n/** Normalizes a contract section and resolves its paths against `configDir`. */\nfunction finalizeContractConfig(contract, configDir) {\n\tconst normalized = normalizeContractConfig(contract);\n\treturn {\n\t\t...normalized,\n\t\tsource: finalizeContractSource(normalized.source, configDir),\n\t\toutput: resolve(configDir, normalized.output)\n\t};\n}\nconst DEFAULT_MIGRATIONS_DIR = \"migrations\";\n/**\n* Resolves the migrations directory against `configDir`, which is what `migrations.dir` is\n* documented to be relative to. The default is applied here too, so no caller re-derives it\n* against a different base — a command run from one directory with `--config` naming a project in\n* another would otherwise read the wrong `migrations/`.\n*/\nfunction finalizeMigrationsConfig(migrations, configDir) {\n\treturn {\n\t\t...migrations,\n\t\tdir: resolve(configDir, migrations?.dir ?? DEFAULT_MIGRATIONS_DIR)\n\t};\n}\nfunction finalizeConfig(config, configDir) {\n\treturn {\n\t\t...config,\n\t\t...config.contract ? { contract: finalizeContractConfig(config.contract, configDir) } : void 0,\n\t\tmigrations: finalizeMigrationsConfig(config.migrations, configDir)\n\t};\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 buildLoadedConfig(rawConfig, configDir) {\n\tconst issues = collectConfigIssues(rawConfig);\n\tconst diagnostics = issues.map((issue) => errorConfigValidation(issue.field, {\n\t\twhy: issue.message,\n\t\tsection: issue.section\n\t}));\n\tconst raw = blindCast(rawConfig);\n\tconst config = issues.some((issue) => issue.section === \"migrations\") ? raw : {\n\t\t...raw,\n\t\tmigrations: finalizeMigrationsConfig(raw.migrations, configDir)\n\t};\n\tif (config.contract === void 0 || issues.some((issue) => issue.section === \"contract\")) return {\n\t\tconfig,\n\t\tdiagnostics\n\t};\n\tconst contract = finalizeContractConfig(config.contract, configDir);\n\tdiagnostics.push(...collectArtifactCollisionDiagnostics(contract));\n\treturn {\n\t\tconfig: {\n\t\t\t...config,\n\t\t\tcontract\n\t\t},\n\t\tdiagnostics\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* Loads and finalizes the Prisma Next config.\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*/\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}\nasync function loadConfig(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\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\tif (!result.config || Object.keys(result.config).length === 0) return notOk(errorConfigFileNotFound(result.configFile || resolvedConfigPath || configPath));\n\t/* v8 ignore next -- @preserve */\n\tconst loadedConfigDir = result.configFile ? dirname(result.configFile) : configCwd;\n\t/* v8 ignore next -- c12 always returns layers for a config it evaluated */\n\tconst [requestedLayer] = result.layers ?? [];\n\tconst layerConfig = requestedLayer?.config;\n\tconst engineMarker = isRecord(layerConfig) ? layerConfig[\"$prismaConfig\"] : void 0;\n\tif (engineMarker !== void 0) {\n\t\tif (engineMarker !== 1)\n /* v8 ignore next -- a config that evaluated always carries its resolved path */\n\t\treturn notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));\n\t\tconst orm = result.config[\"orm\"];\n\t\tif (orm !== void 0 && !isRecord(orm)) return ok({\n\t\t\tconfig: buildLoadedConfig({}, loadedConfigDir).config,\n\t\t\tdiagnostics: [errorConfigValidation(\"orm\", { why: `The orm section of ${CONFIG_FILENAME} must be an object` })]\n\t\t});\n\t\treturn ok(buildLoadedConfig(orm ?? {}, loadedConfigDir));\n\t}\n\t/* v8 ignore next -- a config that evaluated always carries its resolved path */\n\treturn notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));\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 { finalizeConfig, findNearestConfigPathForFile, loadConfig, loadConfigForFile, loadConfigForSections, requireConfigSections };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,uBAAuB,QAAQ,WAAW;CAClD,MAAM,iBAAiB,OAAO,QAAQ,KAAK,UAAU,QAAQ,WAAW,KAAK,CAAC;CAC9E,IAAI,mBAAmB,KAAK,GAAG,OAAO;CACtC,OAAO;EACN,GAAG;EACH,QAAQ;CACT;AACD;;AAEA,SAAS,uBAAuB,U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,CAAC;EACrF,MAAM,MAAM,OAAO,OAAO;EAC1B,IAAI,QAAQ,KAAK,KAAK,CAAC,SAAS,GAAG,GAAG,OAAO,GAAG;GAC/C,QAAQ,kBAAkB,CAAC,GAAG,eAAe,CAAC,CAAC;GAC/C,aAAa,CAAC,sBAAsB,OAAO,EAAE,KAAK,sBAAsB,gBAAgB,oBAAoB,CAAC,CAAC;EAC/G,CAAC;EACD,OAAO,GAAG,kBAAkB,OAAO,CAAC,GAAG,eAAe,CAAC;CACxD;;CAEA,OAAO,MAAM,gCAAgC,OAAO,cAAc,kBAAkB,CAAC;AACtF;;;;;;AAMA,SAAS,sBAAsB,QAAQ,UAAU;CAChD,MAAM,WAAW,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"import-roots-kw_vAdpJ.mjs","names":[],"sources":["../../../../0-shared/publish-surface/dist/import-roots.mjs"],"sourcesContent":["import { publicShells } from \"./shells.mjs\";\n//#region src/import-roots.ts\n/**\n* Import-root resolution: the one place that turns an internal workspace\n* specifier into the name generated code should carry.\n*\n* Emission writes package names into files the user keeps — generated\n* contract types, scaffolded migrations, `prisma orm init` output. Which\n* name is correct depends on how the application installed Prisma Next, so\n* every emitter resolves through an {@link ImportRoot} rather than hardcoding\n* a specifier. The mapping itself is `./shells`; nothing here duplicates it.\n*/\nconst INTERNAL_SCOPE = \"@internal/\";\nconst PUBLISHED_SCOPE = \"@prisma/\";\n/** An import root that emitted code cannot express. */\nvar ImportRootError = class extends Error {};\nconst internalImportRoot = { mode: \"internal\" };\n/**\n* The import root an application's own dependency list expresses.\n*\n* Emission has to name packages the application can actually resolve, and the\n* application already states which those are. Reading its manifest keeps the\n* two from drifting and lets consumers move to published names one project at\n* a time instead of behind a repository-wide switch.\n*\n* A project that names exactly one facade is on the facade root; one that\n* names platform shells without a facade is a decomposed install; anything\n* else — including a project with no `@prisma/orm-*` dependency at all — is on\n* the internal root, which emits workspace names unchanged.\n*\n* @throws {ImportRootError} when the project depends on two facades, which no\n* single generated file can be emitted for.\n*/\nfunction importRootForDependencies(dependencies) {\n\tconst named = new Set(dependencies);\n\tconst facades = [];\n\tlet hasPlatform = false;\n\tfor (const [shell, definition] of publicShells) {\n\t\tif (!named.has(shell)) continue;\n\t\tif (definition.kind === \"facade\") facades.push(shell);\n\t\tif (definition.kind === \"platform\") hasPlatform = true;\n\t}\n\tif (facades.length > 1) throw new ImportRootError(`an application may depend on only one database facade, but this one depends on ${facades.join(\" and \")}`);\n\tconst [facade] = facades;\n\tif (facade !== void 0) return {\n\t\tmode: \"facade\",\n\t\tfacade\n\t};\n\treturn hasPlatform ? { mode: \"platform\" } : internalImportRoot;\n}\nconst owners = buildOwnerIndex(publicShells);\n/**\n* Takes the shell map as an argument rather than closing over `publicShells`\n* so the duplicate-owner guard is reachable from a test: the real map is\n* valid by construction, and a guard nothing can exercise is a guard nobody\n* knows still works.\n*/\nfunction buildOwnerIndex(shells) {\n\tconst index = /* @__PURE__ */ new Map();\n\tfor (const [shell, definition] of shells) for (const pkg of definition.packages) {\n\t\tconst existing = index.get(pkg.name);\n\t\tif (existing !== void 0) throw new ImportRootError(`${pkg.name} is mapped to both ${existing.shell} and ${shell}; one module may live in only one published package (ADR 242)`);\n\t\tindex.set(pkg.name, {\n\t\t\tshell,\n\t\t\tentry: pkg.entry\n\t\t});\n\t}\n\treturn index;\n}\nfunction splitSpecifier(specifier) {\n\tconst [scope, pkg, ...rest] = specifier.split(\"/\");\n\treturn {\n\t\tname: `${scope}/${pkg}`,\n\t\tsubpath: rest.join(\"/\")\n\t};\n}\nfunction joinEntrypoint(shell, entry, subpath) {\n\tconst tail = [entry, subpath].filter(Boolean).join(\"/\");\n\treturn tail === \"\" ? shell : `${shell}/${tail}`;\n}\n/**\n* The shells an application installs directly under this root. Emitted code\n* may name only these: a package manager puts a package's own dependencies in\n* its own `node_modules`, so importing a transitively installed package fails\n* to resolve at run time even though the files are on disk.\n*/\nfunction directDependencyShells(root) {\n\tconst direct = /* @__PURE__ */ new Set();\n\tif (root.mode === \"internal\") return direct;\n\tfor (const [shell, definition] of publicShells) {\n\t\tif (definition.kind === \"extension\") direct.add(shell);\n\t\tif (root.mode === \"platform\" && definition.kind === \"platform\") direct.add(shell);\n\t}\n\tif (root.mode === \"facade\") direct.add(root.facade);\n\treturn direct;\n}\nfunction owningShell(specifier, name) {\n\tconst owner = owners.get(name);\n\tif (owner === void 0) throw new ImportRootError(`${specifier} is not mapped to any published shell`);\n\treturn owner;\n}\n/**\n* The platform-install name for an internal specifier, with the shell that\n* owns it. The shell build needs both: an import that stays inside the shell\n* being built is bundled rather than externalized.\n*/\nfunction platformEntrypointOf(specifier) {\n\tconst { name, subpath } = splitSpecifier(specifier);\n\tconst owner = owningShell(specifier, name);\n\treturn {\n\t\tshell: owner.shell,\n\t\tid: joinEntrypoint(owner.shell, owner.entry, subpath)\n\t};\n}\n/**\n* The facade's own name for an internal specifier it republishes, or\n* `undefined` when the facade does not carry that surface.\n*/\nfunction facadeEntrypoint(facade, name, subpath) {\n\tconst definition = publicShells.get(facade);\n\t/* v8 ignore next -- @preserve: every ShellName is a key of publicShells */\n\tif (definition === void 0) throw new ImportRootError(`unknown shell ${facade}`);\n\tif (definition.kind !== \"facade\") throw new ImportRootError(`${facade} is a ${definition.kind} shell, not a facade`);\n\tfor (const reexport of definition.reexports ?? []) {\n\t\tif (reexport.package !== name) continue;\n\t\tif (subpath === \"\" && reexport.root === false) return void 0;\n\t\tif (reexport.subpaths !== void 0 && !reexport.subpaths.includes(subpath)) return void 0;\n\t\treturn joinEntrypoint(facade, reexport.entry, subpath);\n\t}\n}\nfunction describe(root) {\n\treturn root.mode === \"facade\" ? `${root.mode} (${root.facade})` : root.mode;\n}\nfunction resolveImportSpecifier(specifier, root) {\n\tif (root.mode === \"internal\") return specifier;\n\tif (!specifier.startsWith(INTERNAL_SCOPE)) return specifier;\n\tconst { name, subpath } = splitSpecifier(specifier);\n\tif (root.mode === \"facade\") {\n\t\tconst republished = facadeEntrypoint(root.facade, name, subpath);\n\t\tif (republished !== void 0) return republished;\n\t}\n\tconst owner = owningShell(specifier, name);\n\tconst published = joinEntrypoint(owner.shell, owner.entry, subpath);\n\tif (!directDependencyShells(root).has(owner.shell)) throw new ImportRootError(unreachableUnder(specifier, published, root));\n\treturn published;\n}\n/**\n* Why a specifier has no name under `root`.\n*\n* The facade wording deliberately does not say \"not a direct dependency\":\n* under ADR 242 the answer to that is never \"install the platform package\n* too\", it is that the facade has to republish the surface.\n*/\nfunction unreachableUnder(specifier, published, root) {\n\tif (root.mode === \"facade\") return `${specifier} has no name under ${root.facade}: the facade does not republish ${published}. An application installs one facade and nothing else, so every surface it reaches has to be one of that facade’s own entrypoints (ADR 242).`;\n\treturn `${specifier} resolves to ${published}, which an application on the ${describe(root)} import root does not depend on directly. Emitted code may name only direct dependencies (ADR 242).`;\n}\nfunction createImportSpecifierResolver(root) {\n\tif (root.mode === \"internal\") return (specifier) => specifier;\n\treturn (specifier) => resolveImportSpecifier(specifier, root);\n}\n/**\n* Builds the resolver `prisma orm init` scaffolds with. Identical to\n* {@link createImportSpecifierResolver} except that it will not accept a root\n* a scaffold cannot express, so the impossible case is rejected where the\n* resolver is made rather than when a template happens to hit a name.\n*/\nfunction createScaffoldSpecifierResolver(root) {\n\treturn createImportSpecifierResolver(root);\n}\nconst MODULE_SPECIFIER = /\\b(?:from|import)\\s*\\(?\\s*(['\"])([^'\"\\n]+)\\1/g;\n/**\n* True when `source` contains module syntax that must carry a quoted\n* specifier: `import '<s>'`, `import('<s>')`, or an import/export clause\n* followed by `from '<s>'`.\n*\n* Deliberately independent of {@link MODULE_SPECIFIER} — it exists to notice\n* when that scanner has stopped matching, so it accepts any quote character,\n* including the backtick a renderer must never emit. It does still require a\n* quote: the word \"import\" on its own appears in prose and comments all the\n* time, and treating that as module syntax made the check below fire on files\n* that have no imports at all.\n*/\nconst HAS_IMPORT_SYNTAX = /(?:^|[\\s(;}])import\\s*[('\"`]|(?:^|[\\s;}])(?:import|export)\\b[\\w$*,{}\\s]*?\\bfrom\\s*['\"`]/;\n/** The module specifiers a generated source file names. */\nfunction importedSpecifiers(source) {\n\treturn [...source.matchAll(MODULE_SPECIFIER)].map(([, , specifier]) => specifier ?? \"\");\n}\n/**\n* The specifiers in a generated file that the application would not have as a\n* direct dependency under `root` — the thing no emitted file may contain.\n*\n* Under the `internal` root nothing is reported: those names are the\n* repository's own, and every in-repo consumer resolves them through the\n* workspace.\n*\n* Throws rather than returning `[]` when the source plainly has imports but\n* the scan found none. An audit whose scanner has stopped matching would\n* otherwise report every file as clean, which is the one failure mode that\n* makes the audit worse than not having it.\n*/\nfunction transitiveImports(source, root) {\n\tconst specifiers = importedSpecifiers(source);\n\tif (specifiers.length === 0 && HAS_IMPORT_SYNTAX.test(source)) throw new ImportRootError(\"source contains import syntax but no specifier was recognised; the audit would pass vacuously\");\n\tif (root.mode === \"internal\") return [];\n\tconst direct = new Set(directDependencyShells(root));\n\treturn specifiers.filter((specifier) => {\n\t\tif (specifier.startsWith(INTERNAL_SCOPE)) return true;\n\t\tif (!specifier.startsWith(PUBLISHED_SCOPE)) return false;\n\t\tconst [scope, shell] = specifier.split(\"/\");\n\t\tconst name = `${scope}/${shell}`;\n\t\treturn !direct.has(name) && !EXTERNAL_DIRECT_DEPENDENCIES.has(name);\n\t});\n}\n/**\n* Published packages this workspace does not own but `init` installs into a\n* scaffolded application directly, so its files may import them:\n* `@prisma/cli-engine` is the config file's `defineConfig` import.\n*/\nconst EXTERNAL_DIRECT_DEPENDENCIES = /* @__PURE__ */ new Set([\"@prisma/cli-engine\"]);\n//#endregion\nexport { ImportRootError, buildOwnerIndex, createImportSpecifierResolver, createScaffoldSpecifierResolver, directDependencyShells, importRootForDependencies, importedSpecifiers, internalImportRoot, platformEntrypointOf, resolveImportSpecifier, transitiveImports };\n\n//# sourceMappingURL=import-roots.mjs.map"],"mappings":";;;;;;;;;;;;AAYA,MAAM,iBAAiB;AACvB,MAAM,kBAAkB;;AAExB,IAAI,kBAAkB,cAAc,MAAM,CAAC;AAC3C,MAAM,qBAAqB,EAAE,MAAM,WAAW;;;;;;;;;;;;;;;;;AAiB9C,SAAS,0BAA0B,cAAc;CAChD,MAAM,QAAQ,IAAI,IAAI,YAAY;CAClC,MAAM,UAAU,CAAC;CACjB,IAAI,cAAc;CAClB,KAAK,MAAM,CAAC,OAAO,eAAe,cAAc;EAC/C,IAAI,CAAC,MAAM,IAAI,KAAK,GAAG;EACvB,IAAI,WAAW,SAAS,UAAU,QAAQ,KAAK,KAAK;EACpD,IAAI,WAAW,SAAS,YAAY,cAAc;CACnD;CACA,IAAI,QAAQ,SAAS,GAAG,MAAM,IAAI,gBAAgB,kFAAkF,QAAQ,KAAK,OAAO,GAAG;CAC3J,MAAM,CAAC,UAAU;CACjB,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN;CACD;CACA,OAAO,cAAc,EAAE,MAAM,WAAW,IAAI;AAC7C;AACA,MAAM,SAAS,gBAAgB,YAAY;;;;;;;AAO3C,SAAS,gBAAgB,QAAQ;CAChC,MAAM,wBAAw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