@prisma/composer-cli 0.30.0 → 0.31.0-dev.1

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.
Files changed (34) hide show
  1. package/dist/container-transport-HcvNOGZL-CIoZc7Rs.mjs +34 -0
  2. package/dist/container-transport-HcvNOGZL-CIoZc7Rs.mjs.map +1 -0
  3. package/dist/{dev-CqS1W82b-BF0YJc6a.mjs → dev-current-Bm7Yrsmt-TadtLg5x.mjs} +24 -5
  4. package/dist/dev-current-Bm7Yrsmt-TadtLg5x.mjs.map +1 -0
  5. package/dist/dist-j4X7U5yA.mjs +1788 -0
  6. package/dist/dist-j4X7U5yA.mjs.map +1 -0
  7. package/dist/{execute-deploy-destroy-D4UdieU1-C1P6X7uK.mjs → execute-deploy-destroy-BK4R2qCX-DU6ITsO0.mjs} +5 -4
  8. package/dist/execute-deploy-destroy-BK4R2qCX-DU6ITsO0.mjs.map +1 -0
  9. package/dist/execute-dev-current-nYH8EiKK-BcP2HhlW.mjs +126 -0
  10. package/dist/execute-dev-current-nYH8EiKK-BcP2HhlW.mjs.map +1 -0
  11. package/dist/{execute-dev-BSPnsEv--SNELmzE_.mjs → execute-dev-qKlYePGn-B3UnMfa5.mjs} +50 -65
  12. package/dist/execute-dev-qKlYePGn-B3UnMfa5.mjs.map +1 -0
  13. package/dist/{family-Dt7BgpVf-YyjGLli3.d.mts → family-BIyR33Uq-BEqJM2Vx.d.mts} +131 -29
  14. package/dist/family-BIyR33Uq-BEqJM2Vx.d.mts.map +1 -0
  15. package/dist/family.d.mts +47 -3
  16. package/dist/family.d.mts.map +1 -1
  17. package/dist/family.mjs +210 -9
  18. package/dist/family.mjs.map +1 -1
  19. package/dist/local-target-DZ6bu7Aj.mjs +48 -0
  20. package/dist/local-target-DZ6bu7Aj.mjs.map +1 -0
  21. package/dist/{container-transport-HcvNOGZL-ClGmzBIO.mjs → pipeline-Dpesfd2j-DKL3f1bj.mjs} +17 -39
  22. package/dist/pipeline-Dpesfd2j-DKL3f1bj.mjs.map +1 -0
  23. package/dist/testing.d.mts +7 -1
  24. package/dist/testing.d.mts.map +1 -1
  25. package/dist/testing.mjs +23 -2
  26. package/dist/testing.mjs.map +1 -1
  27. package/package.json +9 -5
  28. package/src/exports/family.ts +29 -0
  29. package/src/family/emulator-list.ts +112 -0
  30. package/dist/container-transport-HcvNOGZL-ClGmzBIO.mjs.map +0 -1
  31. package/dist/dev-CqS1W82b-BF0YJc6a.mjs.map +0 -1
  32. package/dist/execute-deploy-destroy-D4UdieU1-C1P6X7uK.mjs.map +0 -1
  33. package/dist/execute-dev-BSPnsEv--SNELmzE_.mjs.map +0 -1
  34. package/dist/family-Dt7BgpVf-YyjGLli3.d.mts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-j4X7U5yA.mjs","names":["fs","path","isRegistryEntry"],"sources":["../../../../node_modules/graceful-fs/polyfills.js","../../../../node_modules/graceful-fs/legacy-streams.js","../../../../node_modules/graceful-fs/clone.js","../../../../node_modules/graceful-fs/graceful-fs.js","../../../../node_modules/retry/lib/retry_operation.js","../../../../node_modules/retry/lib/retry.js","../../../../node_modules/retry/index.js","../../../../node_modules/proper-lockfile/node_modules/signal-exit/signals.js","../../../../node_modules/proper-lockfile/node_modules/signal-exit/index.js","../../../../node_modules/proper-lockfile/lib/mtime-precision.js","../../../../node_modules/proper-lockfile/lib/lockfile.js","../../../../node_modules/proper-lockfile/lib/adapter.js","../../../../node_modules/proper-lockfile/index.js","../../../1-prisma-cloud/0-lowering/dev-emulators/dist/daemon-D9BV062Q.mjs","../../../1-prisma-cloud/0-lowering/dev-emulators/dist/index.mjs"],"sourcesContent":["var constants = require('constants')\n\nvar origCwd = process.cwd\nvar cwd = null\n\nvar platform = process.env.GRACEFUL_FS_PLATFORM || process.platform\n\nprocess.cwd = function() {\n if (!cwd)\n cwd = origCwd.call(process)\n return cwd\n}\ntry {\n process.cwd()\n} catch (er) {}\n\n// This check is needed until node.js 12 is required\nif (typeof process.chdir === 'function') {\n var chdir = process.chdir\n process.chdir = function (d) {\n cwd = null\n chdir.call(process, d)\n }\n if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir)\n}\n\nmodule.exports = patch\n\nfunction patch (fs) {\n // (re-)implement some things that are known busted or missing.\n\n // lchmod, broken prior to 0.6.2\n // back-port the fix here.\n if (constants.hasOwnProperty('O_SYMLINK') &&\n process.version.match(/^v0\\.6\\.[0-2]|^v0\\.5\\./)) {\n patchLchmod(fs)\n }\n\n // lutimes implementation, or no-op\n if (!fs.lutimes) {\n patchLutimes(fs)\n }\n\n // https://github.com/isaacs/node-graceful-fs/issues/4\n // Chown should not fail on einval or eperm if non-root.\n // It should not fail on enosys ever, as this just indicates\n // that a fs doesn't support the intended operation.\n\n fs.chown = chownFix(fs.chown)\n fs.fchown = chownFix(fs.fchown)\n fs.lchown = chownFix(fs.lchown)\n\n fs.chmod = chmodFix(fs.chmod)\n fs.fchmod = chmodFix(fs.fchmod)\n fs.lchmod = chmodFix(fs.lchmod)\n\n fs.chownSync = chownFixSync(fs.chownSync)\n fs.fchownSync = chownFixSync(fs.fchownSync)\n fs.lchownSync = chownFixSync(fs.lchownSync)\n\n fs.chmodSync = chmodFixSync(fs.chmodSync)\n fs.fchmodSync = chmodFixSync(fs.fchmodSync)\n fs.lchmodSync = chmodFixSync(fs.lchmodSync)\n\n fs.stat = statFix(fs.stat)\n fs.fstat = statFix(fs.fstat)\n fs.lstat = statFix(fs.lstat)\n\n fs.statSync = statFixSync(fs.statSync)\n fs.fstatSync = statFixSync(fs.fstatSync)\n fs.lstatSync = statFixSync(fs.lstatSync)\n\n // if lchmod/lchown do not exist, then make them no-ops\n if (fs.chmod && !fs.lchmod) {\n fs.lchmod = function (path, mode, cb) {\n if (cb) process.nextTick(cb)\n }\n fs.lchmodSync = function () {}\n }\n if (fs.chown && !fs.lchown) {\n fs.lchown = function (path, uid, gid, cb) {\n if (cb) process.nextTick(cb)\n }\n fs.lchownSync = function () {}\n }\n\n // on Windows, A/V software can lock the directory, causing this\n // to fail with an EACCES or EPERM if the directory contains newly\n // created files. Try again on failure, for up to 60 seconds.\n\n // Set the timeout this long because some Windows Anti-Virus, such as Parity\n // bit9, may lock files for up to a minute, causing npm package install\n // failures. Also, take care to yield the scheduler. Windows scheduling gives\n // CPU to a busy looping process, which can cause the program causing the lock\n // contention to be starved of CPU by node, so the contention doesn't resolve.\n if (platform === \"win32\") {\n fs.rename = typeof fs.rename !== 'function' ? fs.rename\n : (function (fs$rename) {\n function rename (from, to, cb) {\n var start = Date.now()\n var backoff = 0;\n fs$rename(from, to, function CB (er) {\n if (er\n && (er.code === \"EACCES\" || er.code === \"EPERM\" || er.code === \"EBUSY\")\n && Date.now() - start < 60000) {\n setTimeout(function() {\n fs.stat(to, function (stater, st) {\n if (stater && stater.code === \"ENOENT\")\n fs$rename(from, to, CB);\n else\n cb(er)\n })\n }, backoff)\n if (backoff < 100)\n backoff += 10;\n return;\n }\n if (cb) cb(er)\n })\n }\n if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename)\n return rename\n })(fs.rename)\n }\n\n // if read() returns EAGAIN, then just try it again.\n fs.read = typeof fs.read !== 'function' ? fs.read\n : (function (fs$read) {\n function read (fd, buffer, offset, length, position, callback_) {\n var callback\n if (callback_ && typeof callback_ === 'function') {\n var eagCounter = 0\n callback = function (er, _, __) {\n if (er && er.code === 'EAGAIN' && eagCounter < 10) {\n eagCounter ++\n return fs$read.call(fs, fd, buffer, offset, length, position, callback)\n }\n callback_.apply(this, arguments)\n }\n }\n return fs$read.call(fs, fd, buffer, offset, length, position, callback)\n }\n\n // This ensures `util.promisify` works as it does for native `fs.read`.\n if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read)\n return read\n })(fs.read)\n\n fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync\n : (function (fs$readSync) { return function (fd, buffer, offset, length, position) {\n var eagCounter = 0\n while (true) {\n try {\n return fs$readSync.call(fs, fd, buffer, offset, length, position)\n } catch (er) {\n if (er.code === 'EAGAIN' && eagCounter < 10) {\n eagCounter ++\n continue\n }\n throw er\n }\n }\n }})(fs.readSync)\n\n function patchLchmod (fs) {\n fs.lchmod = function (path, mode, callback) {\n fs.open( path\n , constants.O_WRONLY | constants.O_SYMLINK\n , mode\n , function (err, fd) {\n if (err) {\n if (callback) callback(err)\n return\n }\n // prefer to return the chmod error, if one occurs,\n // but still try to close, and report closing errors if they occur.\n fs.fchmod(fd, mode, function (err) {\n fs.close(fd, function(err2) {\n if (callback) callback(err || err2)\n })\n })\n })\n }\n\n fs.lchmodSync = function (path, mode) {\n var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)\n\n // prefer to return the chmod error, if one occurs,\n // but still try to close, and report closing errors if they occur.\n var threw = true\n var ret\n try {\n ret = fs.fchmodSync(fd, mode)\n threw = false\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd)\n } catch (er) {}\n } else {\n fs.closeSync(fd)\n }\n }\n return ret\n }\n }\n\n function patchLutimes (fs) {\n if (constants.hasOwnProperty(\"O_SYMLINK\") && fs.futimes) {\n fs.lutimes = function (path, at, mt, cb) {\n fs.open(path, constants.O_SYMLINK, function (er, fd) {\n if (er) {\n if (cb) cb(er)\n return\n }\n fs.futimes(fd, at, mt, function (er) {\n fs.close(fd, function (er2) {\n if (cb) cb(er || er2)\n })\n })\n })\n }\n\n fs.lutimesSync = function (path, at, mt) {\n var fd = fs.openSync(path, constants.O_SYMLINK)\n var ret\n var threw = true\n try {\n ret = fs.futimesSync(fd, at, mt)\n threw = false\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd)\n } catch (er) {}\n } else {\n fs.closeSync(fd)\n }\n }\n return ret\n }\n\n } else if (fs.futimes) {\n fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }\n fs.lutimesSync = function () {}\n }\n }\n\n function chmodFix (orig) {\n if (!orig) return orig\n return function (target, mode, cb) {\n return orig.call(fs, target, mode, function (er) {\n if (chownErOk(er)) er = null\n if (cb) cb.apply(this, arguments)\n })\n }\n }\n\n function chmodFixSync (orig) {\n if (!orig) return orig\n return function (target, mode) {\n try {\n return orig.call(fs, target, mode)\n } catch (er) {\n if (!chownErOk(er)) throw er\n }\n }\n }\n\n\n function chownFix (orig) {\n if (!orig) return orig\n return function (target, uid, gid, cb) {\n return orig.call(fs, target, uid, gid, function (er) {\n if (chownErOk(er)) er = null\n if (cb) cb.apply(this, arguments)\n })\n }\n }\n\n function chownFixSync (orig) {\n if (!orig) return orig\n return function (target, uid, gid) {\n try {\n return orig.call(fs, target, uid, gid)\n } catch (er) {\n if (!chownErOk(er)) throw er\n }\n }\n }\n\n function statFix (orig) {\n if (!orig) return orig\n // Older versions of Node erroneously returned signed integers for\n // uid + gid.\n return function (target, options, cb) {\n if (typeof options === 'function') {\n cb = options\n options = null\n }\n function callback (er, stats) {\n if (stats) {\n if (stats.uid < 0) stats.uid += 0x100000000\n if (stats.gid < 0) stats.gid += 0x100000000\n }\n if (cb) cb.apply(this, arguments)\n }\n return options ? orig.call(fs, target, options, callback)\n : orig.call(fs, target, callback)\n }\n }\n\n function statFixSync (orig) {\n if (!orig) return orig\n // Older versions of Node erroneously returned signed integers for\n // uid + gid.\n return function (target, options) {\n var stats = options ? orig.call(fs, target, options)\n : orig.call(fs, target)\n if (stats) {\n if (stats.uid < 0) stats.uid += 0x100000000\n if (stats.gid < 0) stats.gid += 0x100000000\n }\n return stats;\n }\n }\n\n // ENOSYS means that the fs doesn't support the op. Just ignore\n // that, because it doesn't matter.\n //\n // if there's no getuid, or if getuid() is something other\n // than 0, and the error is EINVAL or EPERM, then just ignore\n // it.\n //\n // This specific case is a silent failure in cp, install, tar,\n // and most other unix tools that manage permissions.\n //\n // When running as root, or if other types of errors are\n // encountered, then it's strict.\n function chownErOk (er) {\n if (!er)\n return true\n\n if (er.code === \"ENOSYS\")\n return true\n\n var nonroot = !process.getuid || process.getuid() !== 0\n if (nonroot) {\n if (er.code === \"EINVAL\" || er.code === \"EPERM\")\n return true\n }\n\n return false\n }\n}\n","var Stream = require('stream').Stream\n\nmodule.exports = legacy\n\nfunction legacy (fs) {\n return {\n ReadStream: ReadStream,\n WriteStream: WriteStream\n }\n\n function ReadStream (path, options) {\n if (!(this instanceof ReadStream)) return new ReadStream(path, options);\n\n Stream.call(this);\n\n var self = this;\n\n this.path = path;\n this.fd = null;\n this.readable = true;\n this.paused = false;\n\n this.flags = 'r';\n this.mode = 438; /*=0666*/\n this.bufferSize = 64 * 1024;\n\n options = options || {};\n\n // Mixin options into this\n var keys = Object.keys(options);\n for (var index = 0, length = keys.length; index < length; index++) {\n var key = keys[index];\n this[key] = options[key];\n }\n\n if (this.encoding) this.setEncoding(this.encoding);\n\n if (this.start !== undefined) {\n if ('number' !== typeof this.start) {\n throw TypeError('start must be a Number');\n }\n if (this.end === undefined) {\n this.end = Infinity;\n } else if ('number' !== typeof this.end) {\n throw TypeError('end must be a Number');\n }\n\n if (this.start > this.end) {\n throw new Error('start must be <= end');\n }\n\n this.pos = this.start;\n }\n\n if (this.fd !== null) {\n process.nextTick(function() {\n self._read();\n });\n return;\n }\n\n fs.open(this.path, this.flags, this.mode, function (err, fd) {\n if (err) {\n self.emit('error', err);\n self.readable = false;\n return;\n }\n\n self.fd = fd;\n self.emit('open', fd);\n self._read();\n })\n }\n\n function WriteStream (path, options) {\n if (!(this instanceof WriteStream)) return new WriteStream(path, options);\n\n Stream.call(this);\n\n this.path = path;\n this.fd = null;\n this.writable = true;\n\n this.flags = 'w';\n this.encoding = 'binary';\n this.mode = 438; /*=0666*/\n this.bytesWritten = 0;\n\n options = options || {};\n\n // Mixin options into this\n var keys = Object.keys(options);\n for (var index = 0, length = keys.length; index < length; index++) {\n var key = keys[index];\n this[key] = options[key];\n }\n\n if (this.start !== undefined) {\n if ('number' !== typeof this.start) {\n throw TypeError('start must be a Number');\n }\n if (this.start < 0) {\n throw new Error('start must be >= zero');\n }\n\n this.pos = this.start;\n }\n\n this.busy = false;\n this._queue = [];\n\n if (this.fd === null) {\n this._open = fs.open;\n this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);\n this.flush();\n }\n }\n}\n","'use strict'\n\nmodule.exports = clone\n\nvar getPrototypeOf = Object.getPrototypeOf || function (obj) {\n return obj.__proto__\n}\n\nfunction clone (obj) {\n if (obj === null || typeof obj !== 'object')\n return obj\n\n if (obj instanceof Object)\n var copy = { __proto__: getPrototypeOf(obj) }\n else\n var copy = Object.create(null)\n\n Object.getOwnPropertyNames(obj).forEach(function (key) {\n Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))\n })\n\n return copy\n}\n","var fs = require('fs')\nvar polyfills = require('./polyfills.js')\nvar legacy = require('./legacy-streams.js')\nvar clone = require('./clone.js')\n\nvar util = require('util')\n\n/* istanbul ignore next - node 0.x polyfill */\nvar gracefulQueue\nvar previousSymbol\n\n/* istanbul ignore else - node 0.x polyfill */\nif (typeof Symbol === 'function' && typeof Symbol.for === 'function') {\n gracefulQueue = Symbol.for('graceful-fs.queue')\n // This is used in testing by future versions\n previousSymbol = Symbol.for('graceful-fs.previous')\n} else {\n gracefulQueue = '___graceful-fs.queue'\n previousSymbol = '___graceful-fs.previous'\n}\n\nfunction noop () {}\n\nfunction publishQueue(context, queue) {\n Object.defineProperty(context, gracefulQueue, {\n get: function() {\n return queue\n }\n })\n}\n\nvar debug = noop\nif (util.debuglog)\n debug = util.debuglog('gfs4')\nelse if (/\\bgfs4\\b/i.test(process.env.NODE_DEBUG || ''))\n debug = function() {\n var m = util.format.apply(util, arguments)\n m = 'GFS4: ' + m.split(/\\n/).join('\\nGFS4: ')\n console.error(m)\n }\n\n// Once time initialization\nif (!fs[gracefulQueue]) {\n // This queue can be shared by multiple loaded instances\n var queue = global[gracefulQueue] || []\n publishQueue(fs, queue)\n\n // Patch fs.close/closeSync to shared queue version, because we need\n // to retry() whenever a close happens *anywhere* in the program.\n // This is essential when multiple graceful-fs instances are\n // in play at the same time.\n fs.close = (function (fs$close) {\n function close (fd, cb) {\n return fs$close.call(fs, fd, function (err) {\n // This function uses the graceful-fs shared queue\n if (!err) {\n resetQueue()\n }\n\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n })\n }\n\n Object.defineProperty(close, previousSymbol, {\n value: fs$close\n })\n return close\n })(fs.close)\n\n fs.closeSync = (function (fs$closeSync) {\n function closeSync (fd) {\n // This function uses the graceful-fs shared queue\n fs$closeSync.apply(fs, arguments)\n resetQueue()\n }\n\n Object.defineProperty(closeSync, previousSymbol, {\n value: fs$closeSync\n })\n return closeSync\n })(fs.closeSync)\n\n if (/\\bgfs4\\b/i.test(process.env.NODE_DEBUG || '')) {\n process.on('exit', function() {\n debug(fs[gracefulQueue])\n require('assert').equal(fs[gracefulQueue].length, 0)\n })\n }\n}\n\nif (!global[gracefulQueue]) {\n publishQueue(global, fs[gracefulQueue]);\n}\n\nmodule.exports = patch(clone(fs))\nif (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {\n module.exports = patch(fs)\n fs.__patched = true;\n}\n\nfunction patch (fs) {\n // Everything that references the open() function needs to be in here\n polyfills(fs)\n fs.gracefulify = patch\n\n fs.createReadStream = createReadStream\n fs.createWriteStream = createWriteStream\n var fs$readFile = fs.readFile\n fs.readFile = readFile\n function readFile (path, options, cb) {\n if (typeof options === 'function')\n cb = options, options = null\n\n return go$readFile(path, options, cb)\n\n function go$readFile (path, options, cb, startTime) {\n return fs$readFile(path, options, function (err) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n var fs$writeFile = fs.writeFile\n fs.writeFile = writeFile\n function writeFile (path, data, options, cb) {\n if (typeof options === 'function')\n cb = options, options = null\n\n return go$writeFile(path, data, options, cb)\n\n function go$writeFile (path, data, options, cb, startTime) {\n return fs$writeFile(path, data, options, function (err) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n var fs$appendFile = fs.appendFile\n if (fs$appendFile)\n fs.appendFile = appendFile\n function appendFile (path, data, options, cb) {\n if (typeof options === 'function')\n cb = options, options = null\n\n return go$appendFile(path, data, options, cb)\n\n function go$appendFile (path, data, options, cb, startTime) {\n return fs$appendFile(path, data, options, function (err) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n var fs$copyFile = fs.copyFile\n if (fs$copyFile)\n fs.copyFile = copyFile\n function copyFile (src, dest, flags, cb) {\n if (typeof flags === 'function') {\n cb = flags\n flags = 0\n }\n return go$copyFile(src, dest, flags, cb)\n\n function go$copyFile (src, dest, flags, cb, startTime) {\n return fs$copyFile(src, dest, flags, function (err) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n var fs$readdir = fs.readdir\n fs.readdir = readdir\n var noReaddirOptionVersions = /^v[0-5]\\./\n function readdir (path, options, cb) {\n if (typeof options === 'function')\n cb = options, options = null\n\n var go$readdir = noReaddirOptionVersions.test(process.version)\n ? function go$readdir (path, options, cb, startTime) {\n return fs$readdir(path, fs$readdirCallback(\n path, options, cb, startTime\n ))\n }\n : function go$readdir (path, options, cb, startTime) {\n return fs$readdir(path, options, fs$readdirCallback(\n path, options, cb, startTime\n ))\n }\n\n return go$readdir(path, options, cb)\n\n function fs$readdirCallback (path, options, cb, startTime) {\n return function (err, files) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([\n go$readdir,\n [path, options, cb],\n err,\n startTime || Date.now(),\n Date.now()\n ])\n else {\n if (files && files.sort)\n files.sort()\n\n if (typeof cb === 'function')\n cb.call(this, err, files)\n }\n }\n }\n }\n\n if (process.version.substr(0, 4) === 'v0.8') {\n var legStreams = legacy(fs)\n ReadStream = legStreams.ReadStream\n WriteStream = legStreams.WriteStream\n }\n\n var fs$ReadStream = fs.ReadStream\n if (fs$ReadStream) {\n ReadStream.prototype = Object.create(fs$ReadStream.prototype)\n ReadStream.prototype.open = ReadStream$open\n }\n\n var fs$WriteStream = fs.WriteStream\n if (fs$WriteStream) {\n WriteStream.prototype = Object.create(fs$WriteStream.prototype)\n WriteStream.prototype.open = WriteStream$open\n }\n\n Object.defineProperty(fs, 'ReadStream', {\n get: function () {\n return ReadStream\n },\n set: function (val) {\n ReadStream = val\n },\n enumerable: true,\n configurable: true\n })\n Object.defineProperty(fs, 'WriteStream', {\n get: function () {\n return WriteStream\n },\n set: function (val) {\n WriteStream = val\n },\n enumerable: true,\n configurable: true\n })\n\n // legacy names\n var FileReadStream = ReadStream\n Object.defineProperty(fs, 'FileReadStream', {\n get: function () {\n return FileReadStream\n },\n set: function (val) {\n FileReadStream = val\n },\n enumerable: true,\n configurable: true\n })\n var FileWriteStream = WriteStream\n Object.defineProperty(fs, 'FileWriteStream', {\n get: function () {\n return FileWriteStream\n },\n set: function (val) {\n FileWriteStream = val\n },\n enumerable: true,\n configurable: true\n })\n\n function ReadStream (path, options) {\n if (this instanceof ReadStream)\n return fs$ReadStream.apply(this, arguments), this\n else\n return ReadStream.apply(Object.create(ReadStream.prototype), arguments)\n }\n\n function ReadStream$open () {\n var that = this\n open(that.path, that.flags, that.mode, function (err, fd) {\n if (err) {\n if (that.autoClose)\n that.destroy()\n\n that.emit('error', err)\n } else {\n that.fd = fd\n that.emit('open', fd)\n that.read()\n }\n })\n }\n\n function WriteStream (path, options) {\n if (this instanceof WriteStream)\n return fs$WriteStream.apply(this, arguments), this\n else\n return WriteStream.apply(Object.create(WriteStream.prototype), arguments)\n }\n\n function WriteStream$open () {\n var that = this\n open(that.path, that.flags, that.mode, function (err, fd) {\n if (err) {\n that.destroy()\n that.emit('error', err)\n } else {\n that.fd = fd\n that.emit('open', fd)\n }\n })\n }\n\n function createReadStream (path, options) {\n return new fs.ReadStream(path, options)\n }\n\n function createWriteStream (path, options) {\n return new fs.WriteStream(path, options)\n }\n\n var fs$open = fs.open\n fs.open = open\n function open (path, flags, mode, cb) {\n if (typeof mode === 'function')\n cb = mode, mode = null\n\n return go$open(path, flags, mode, cb)\n\n function go$open (path, flags, mode, cb, startTime) {\n return fs$open(path, flags, mode, function (err, fd) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n return fs\n}\n\nfunction enqueue (elem) {\n debug('ENQUEUE', elem[0].name, elem[1])\n fs[gracefulQueue].push(elem)\n retry()\n}\n\n// keep track of the timeout between retry() calls\nvar retryTimer\n\n// reset the startTime and lastTime to now\n// this resets the start of the 60 second overall timeout as well as the\n// delay between attempts so that we'll retry these jobs sooner\nfunction resetQueue () {\n var now = Date.now()\n for (var i = 0; i < fs[gracefulQueue].length; ++i) {\n // entries that are only a length of 2 are from an older version, don't\n // bother modifying those since they'll be retried anyway.\n if (fs[gracefulQueue][i].length > 2) {\n fs[gracefulQueue][i][3] = now // startTime\n fs[gracefulQueue][i][4] = now // lastTime\n }\n }\n // call retry to make sure we're actively processing the queue\n retry()\n}\n\nfunction retry () {\n // clear the timer and remove it to help prevent unintended concurrency\n clearTimeout(retryTimer)\n retryTimer = undefined\n\n if (fs[gracefulQueue].length === 0)\n return\n\n var elem = fs[gracefulQueue].shift()\n var fn = elem[0]\n var args = elem[1]\n // these items may be unset if they were added by an older graceful-fs\n var err = elem[2]\n var startTime = elem[3]\n var lastTime = elem[4]\n\n // if we don't have a startTime we have no way of knowing if we've waited\n // long enough, so go ahead and retry this item now\n if (startTime === undefined) {\n debug('RETRY', fn.name, args)\n fn.apply(null, args)\n } else if (Date.now() - startTime >= 60000) {\n // it's been more than 60 seconds total, bail now\n debug('TIMEOUT', fn.name, args)\n var cb = args.pop()\n if (typeof cb === 'function')\n cb.call(null, err)\n } else {\n // the amount of time between the last attempt and right now\n var sinceAttempt = Date.now() - lastTime\n // the amount of time between when we first tried, and when we last tried\n // rounded up to at least 1\n var sinceStart = Math.max(lastTime - startTime, 1)\n // backoff. wait longer than the total time we've been retrying, but only\n // up to a maximum of 100ms\n var desiredDelay = Math.min(sinceStart * 1.2, 100)\n // it's been long enough since the last retry, do it again\n if (sinceAttempt >= desiredDelay) {\n debug('RETRY', fn.name, args)\n fn.apply(null, args.concat([startTime]))\n } else {\n // if we can't do this job yet, push it to the end of the queue\n // and let the next iteration check again\n fs[gracefulQueue].push(elem)\n }\n }\n\n // schedule our next run if one isn't already scheduled\n if (retryTimer === undefined) {\n retryTimer = setTimeout(retry, 0)\n }\n}\n","function RetryOperation(timeouts, options) {\n // Compatibility for the old (timeouts, retryForever) signature\n if (typeof options === 'boolean') {\n options = { forever: options };\n }\n\n this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));\n this._timeouts = timeouts;\n this._options = options || {};\n this._maxRetryTime = options && options.maxRetryTime || Infinity;\n this._fn = null;\n this._errors = [];\n this._attempts = 1;\n this._operationTimeout = null;\n this._operationTimeoutCb = null;\n this._timeout = null;\n this._operationStart = null;\n\n if (this._options.forever) {\n this._cachedTimeouts = this._timeouts.slice(0);\n }\n}\nmodule.exports = RetryOperation;\n\nRetryOperation.prototype.reset = function() {\n this._attempts = 1;\n this._timeouts = this._originalTimeouts;\n}\n\nRetryOperation.prototype.stop = function() {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n\n this._timeouts = [];\n this._cachedTimeouts = null;\n};\n\nRetryOperation.prototype.retry = function(err) {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n\n if (!err) {\n return false;\n }\n var currentTime = new Date().getTime();\n if (err && currentTime - this._operationStart >= this._maxRetryTime) {\n this._errors.unshift(new Error('RetryOperation timeout occurred'));\n return false;\n }\n\n this._errors.push(err);\n\n var timeout = this._timeouts.shift();\n if (timeout === undefined) {\n if (this._cachedTimeouts) {\n // retry forever, only keep last error\n this._errors.splice(this._errors.length - 1, this._errors.length);\n this._timeouts = this._cachedTimeouts.slice(0);\n timeout = this._timeouts.shift();\n } else {\n return false;\n }\n }\n\n var self = this;\n var timer = setTimeout(function() {\n self._attempts++;\n\n if (self._operationTimeoutCb) {\n self._timeout = setTimeout(function() {\n self._operationTimeoutCb(self._attempts);\n }, self._operationTimeout);\n\n if (self._options.unref) {\n self._timeout.unref();\n }\n }\n\n self._fn(self._attempts);\n }, timeout);\n\n if (this._options.unref) {\n timer.unref();\n }\n\n return true;\n};\n\nRetryOperation.prototype.attempt = function(fn, timeoutOps) {\n this._fn = fn;\n\n if (timeoutOps) {\n if (timeoutOps.timeout) {\n this._operationTimeout = timeoutOps.timeout;\n }\n if (timeoutOps.cb) {\n this._operationTimeoutCb = timeoutOps.cb;\n }\n }\n\n var self = this;\n if (this._operationTimeoutCb) {\n this._timeout = setTimeout(function() {\n self._operationTimeoutCb();\n }, self._operationTimeout);\n }\n\n this._operationStart = new Date().getTime();\n\n this._fn(this._attempts);\n};\n\nRetryOperation.prototype.try = function(fn) {\n console.log('Using RetryOperation.try() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = function(fn) {\n console.log('Using RetryOperation.start() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = RetryOperation.prototype.try;\n\nRetryOperation.prototype.errors = function() {\n return this._errors;\n};\n\nRetryOperation.prototype.attempts = function() {\n return this._attempts;\n};\n\nRetryOperation.prototype.mainError = function() {\n if (this._errors.length === 0) {\n return null;\n }\n\n var counts = {};\n var mainError = null;\n var mainErrorCount = 0;\n\n for (var i = 0; i < this._errors.length; i++) {\n var error = this._errors[i];\n var message = error.message;\n var count = (counts[message] || 0) + 1;\n\n counts[message] = count;\n\n if (count >= mainErrorCount) {\n mainError = error;\n mainErrorCount = count;\n }\n }\n\n return mainError;\n};\n","var RetryOperation = require('./retry_operation');\n\nexports.operation = function(options) {\n var timeouts = exports.timeouts(options);\n return new RetryOperation(timeouts, {\n forever: options && options.forever,\n unref: options && options.unref,\n maxRetryTime: options && options.maxRetryTime\n });\n};\n\nexports.timeouts = function(options) {\n if (options instanceof Array) {\n return [].concat(options);\n }\n\n var opts = {\n retries: 10,\n factor: 2,\n minTimeout: 1 * 1000,\n maxTimeout: Infinity,\n randomize: false\n };\n for (var key in options) {\n opts[key] = options[key];\n }\n\n if (opts.minTimeout > opts.maxTimeout) {\n throw new Error('minTimeout is greater than maxTimeout');\n }\n\n var timeouts = [];\n for (var i = 0; i < opts.retries; i++) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n if (options && options.forever && !timeouts.length) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n // sort the array numerically ascending\n timeouts.sort(function(a,b) {\n return a - b;\n });\n\n return timeouts;\n};\n\nexports.createTimeout = function(attempt, opts) {\n var random = (opts.randomize)\n ? (Math.random() + 1)\n : 1;\n\n var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));\n timeout = Math.min(timeout, opts.maxTimeout);\n\n return timeout;\n};\n\nexports.wrap = function(obj, options, methods) {\n if (options instanceof Array) {\n methods = options;\n options = null;\n }\n\n if (!methods) {\n methods = [];\n for (var key in obj) {\n if (typeof obj[key] === 'function') {\n methods.push(key);\n }\n }\n }\n\n for (var i = 0; i < methods.length; i++) {\n var method = methods[i];\n var original = obj[method];\n\n obj[method] = function retryWrapper(original) {\n var op = exports.operation(options);\n var args = Array.prototype.slice.call(arguments, 1);\n var callback = args.pop();\n\n args.push(function(err) {\n if (op.retry(err)) {\n return;\n }\n if (err) {\n arguments[0] = op.mainError();\n }\n callback.apply(this, arguments);\n });\n\n op.attempt(function() {\n original.apply(obj, args);\n });\n }.bind(obj, original);\n obj[method].options = options;\n }\n};\n","module.exports = require('./lib/retry');","// This is not the set of all possible signals.\n//\n// It IS, however, the set of all signals that trigger\n// an exit on either Linux or BSD systems. Linux is a\n// superset of the signal names supported on BSD, and\n// the unknown signals just fail to register, so we can\n// catch that easily enough.\n//\n// Don't bother with SIGKILL. It's uncatchable, which\n// means that we can't fire any callbacks anyway.\n//\n// If a user does happen to register a handler on a non-\n// fatal signal like SIGWINCH or something, and then\n// exit, it'll end up firing `process.emit('exit')`, so\n// the handler will be fired anyway.\n//\n// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n// artificially, inherently leave the process in a\n// state from which it is not safe to try and enter JS\n// listeners.\nmodule.exports = [\n 'SIGABRT',\n 'SIGALRM',\n 'SIGHUP',\n 'SIGINT',\n 'SIGTERM'\n]\n\nif (process.platform !== 'win32') {\n module.exports.push(\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n module.exports.push(\n 'SIGIO',\n 'SIGPOLL',\n 'SIGPWR',\n 'SIGSTKFLT',\n 'SIGUNUSED'\n )\n}\n","// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nvar process = global.process\n\nconst processOk = function (process) {\n return process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function'\n}\n\n// some kind of non-node environment, just no-op\n/* istanbul ignore if */\nif (!processOk(process)) {\n module.exports = function () {\n return function () {}\n }\n} else {\n var assert = require('assert')\n var signals = require('./signals.js')\n var isWin = /^win/i.test(process.platform)\n\n var EE = require('events')\n /* istanbul ignore if */\n if (typeof EE !== 'function') {\n EE = EE.EventEmitter\n }\n\n var emitter\n if (process.__signal_exit_emitter__) {\n emitter = process.__signal_exit_emitter__\n } else {\n emitter = process.__signal_exit_emitter__ = new EE()\n emitter.count = 0\n emitter.emitted = {}\n }\n\n // Because this emitter is a global, we have to check to see if a\n // previous version of this library failed to enable infinite listeners.\n // I know what you're about to say. But literally everything about\n // signal-exit is a compromise with evil. Get used to it.\n if (!emitter.infinite) {\n emitter.setMaxListeners(Infinity)\n emitter.infinite = true\n }\n\n module.exports = function (cb, opts) {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return function () {}\n }\n assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')\n\n if (loaded === false) {\n load()\n }\n\n var ev = 'exit'\n if (opts && opts.alwaysLast) {\n ev = 'afterexit'\n }\n\n var remove = function () {\n emitter.removeListener(ev, cb)\n if (emitter.listeners('exit').length === 0 &&\n emitter.listeners('afterexit').length === 0) {\n unload()\n }\n }\n emitter.on(ev, cb)\n\n return remove\n }\n\n var unload = function unload () {\n if (!loaded || !processOk(global.process)) {\n return\n }\n loaded = false\n\n signals.forEach(function (sig) {\n try {\n process.removeListener(sig, sigListeners[sig])\n } catch (er) {}\n })\n process.emit = originalProcessEmit\n process.reallyExit = originalProcessReallyExit\n emitter.count -= 1\n }\n module.exports.unload = unload\n\n var emit = function emit (event, code, signal) {\n /* istanbul ignore if */\n if (emitter.emitted[event]) {\n return\n }\n emitter.emitted[event] = true\n emitter.emit(event, code, signal)\n }\n\n // { <signal>: <listener fn>, ... }\n var sigListeners = {}\n signals.forEach(function (sig) {\n sigListeners[sig] = function listener () {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return\n }\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n var listeners = process.listeners(sig)\n if (listeners.length === emitter.count) {\n unload()\n emit('exit', null, sig)\n /* istanbul ignore next */\n emit('afterexit', null, sig)\n /* istanbul ignore next */\n if (isWin && sig === 'SIGHUP') {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n sig = 'SIGINT'\n }\n /* istanbul ignore next */\n process.kill(process.pid, sig)\n }\n }\n })\n\n module.exports.signals = function () {\n return signals\n }\n\n var loaded = false\n\n var load = function load () {\n if (loaded || !processOk(global.process)) {\n return\n }\n loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n emitter.count += 1\n\n signals = signals.filter(function (sig) {\n try {\n process.on(sig, sigListeners[sig])\n return true\n } catch (er) {\n return false\n }\n })\n\n process.emit = processEmit\n process.reallyExit = processReallyExit\n }\n module.exports.load = load\n\n var originalProcessReallyExit = process.reallyExit\n var processReallyExit = function processReallyExit (code) {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return\n }\n process.exitCode = code || /* istanbul ignore next */ 0\n emit('exit', process.exitCode, null)\n /* istanbul ignore next */\n emit('afterexit', process.exitCode, null)\n /* istanbul ignore next */\n originalProcessReallyExit.call(process, process.exitCode)\n }\n\n var originalProcessEmit = process.emit\n var processEmit = function processEmit (ev, arg) {\n if (ev === 'exit' && processOk(global.process)) {\n /* istanbul ignore else */\n if (arg !== undefined) {\n process.exitCode = arg\n }\n var ret = originalProcessEmit.apply(this, arguments)\n /* istanbul ignore next */\n emit('exit', process.exitCode, null)\n /* istanbul ignore next */\n emit('afterexit', process.exitCode, null)\n /* istanbul ignore next */\n return ret\n } else {\n return originalProcessEmit.apply(this, arguments)\n }\n }\n}\n","'use strict';\n\nconst cacheSymbol = Symbol();\n\nfunction probe(file, fs, callback) {\n const cachedPrecision = fs[cacheSymbol];\n\n if (cachedPrecision) {\n return fs.stat(file, (err, stat) => {\n /* istanbul ignore if */\n if (err) {\n return callback(err);\n }\n\n callback(null, stat.mtime, cachedPrecision);\n });\n }\n\n // Set mtime by ceiling Date.now() to seconds + 5ms so that it's \"not on the second\"\n const mtime = new Date((Math.ceil(Date.now() / 1000) * 1000) + 5);\n\n fs.utimes(file, mtime, mtime, (err) => {\n /* istanbul ignore if */\n if (err) {\n return callback(err);\n }\n\n fs.stat(file, (err, stat) => {\n /* istanbul ignore if */\n if (err) {\n return callback(err);\n }\n\n const precision = stat.mtime.getTime() % 1000 === 0 ? 's' : 'ms';\n\n // Cache the precision in a non-enumerable way\n Object.defineProperty(fs, cacheSymbol, { value: precision });\n\n callback(null, stat.mtime, precision);\n });\n });\n}\n\nfunction getMtime(precision) {\n let now = Date.now();\n\n if (precision === 's') {\n now = Math.ceil(now / 1000) * 1000;\n }\n\n return new Date(now);\n}\n\nmodule.exports.probe = probe;\nmodule.exports.getMtime = getMtime;\n","'use strict';\n\nconst path = require('path');\nconst fs = require('graceful-fs');\nconst retry = require('retry');\nconst onExit = require('signal-exit');\nconst mtimePrecision = require('./mtime-precision');\n\nconst locks = {};\n\nfunction getLockFile(file, options) {\n return options.lockfilePath || `${file}.lock`;\n}\n\nfunction resolveCanonicalPath(file, options, callback) {\n if (!options.realpath) {\n return callback(null, path.resolve(file));\n }\n\n // Use realpath to resolve symlinks\n // It also resolves relative paths\n options.fs.realpath(file, callback);\n}\n\nfunction acquireLock(file, options, callback) {\n const lockfilePath = getLockFile(file, options);\n\n // Use mkdir to create the lockfile (atomic operation)\n options.fs.mkdir(lockfilePath, (err) => {\n if (!err) {\n // At this point, we acquired the lock!\n // Probe the mtime precision\n return mtimePrecision.probe(lockfilePath, options.fs, (err, mtime, mtimePrecision) => {\n // If it failed, try to remove the lock..\n /* istanbul ignore if */\n if (err) {\n options.fs.rmdir(lockfilePath, () => {});\n\n return callback(err);\n }\n\n callback(null, mtime, mtimePrecision);\n });\n }\n\n // If error is not EEXIST then some other error occurred while locking\n if (err.code !== 'EEXIST') {\n return callback(err);\n }\n\n // Otherwise, check if lock is stale by analyzing the file mtime\n if (options.stale <= 0) {\n return callback(Object.assign(new Error('Lock file is already being held'), { code: 'ELOCKED', file }));\n }\n\n options.fs.stat(lockfilePath, (err, stat) => {\n if (err) {\n // Retry if the lockfile has been removed (meanwhile)\n // Skip stale check to avoid recursiveness\n if (err.code === 'ENOENT') {\n return acquireLock(file, { ...options, stale: 0 }, callback);\n }\n\n return callback(err);\n }\n\n if (!isLockStale(stat, options)) {\n return callback(Object.assign(new Error('Lock file is already being held'), { code: 'ELOCKED', file }));\n }\n\n // If it's stale, remove it and try again!\n // Skip stale check to avoid recursiveness\n removeLock(file, options, (err) => {\n if (err) {\n return callback(err);\n }\n\n acquireLock(file, { ...options, stale: 0 }, callback);\n });\n });\n });\n}\n\nfunction isLockStale(stat, options) {\n return stat.mtime.getTime() < Date.now() - options.stale;\n}\n\nfunction removeLock(file, options, callback) {\n // Remove lockfile, ignoring ENOENT errors\n options.fs.rmdir(getLockFile(file, options), (err) => {\n if (err && err.code !== 'ENOENT') {\n return callback(err);\n }\n\n callback();\n });\n}\n\nfunction updateLock(file, options) {\n const lock = locks[file];\n\n // Just for safety, should never happen\n /* istanbul ignore if */\n if (lock.updateTimeout) {\n return;\n }\n\n lock.updateDelay = lock.updateDelay || options.update;\n lock.updateTimeout = setTimeout(() => {\n lock.updateTimeout = null;\n\n // Stat the file to check if mtime is still ours\n // If it is, we can still recover from a system sleep or a busy event loop\n options.fs.stat(lock.lockfilePath, (err, stat) => {\n const isOverThreshold = lock.lastUpdate + options.stale < Date.now();\n\n // If it failed to update the lockfile, keep trying unless\n // the lockfile was deleted or we are over the threshold\n if (err) {\n if (err.code === 'ENOENT' || isOverThreshold) {\n return setLockAsCompromised(file, lock, Object.assign(err, { code: 'ECOMPROMISED' }));\n }\n\n lock.updateDelay = 1000;\n\n return updateLock(file, options);\n }\n\n const isMtimeOurs = lock.mtime.getTime() === stat.mtime.getTime();\n\n if (!isMtimeOurs) {\n return setLockAsCompromised(\n file,\n lock,\n Object.assign(\n new Error('Unable to update lock within the stale threshold'),\n { code: 'ECOMPROMISED' }\n ));\n }\n\n const mtime = mtimePrecision.getMtime(lock.mtimePrecision);\n\n options.fs.utimes(lock.lockfilePath, mtime, mtime, (err) => {\n const isOverThreshold = lock.lastUpdate + options.stale < Date.now();\n\n // Ignore if the lock was released\n if (lock.released) {\n return;\n }\n\n // If it failed to update the lockfile, keep trying unless\n // the lockfile was deleted or we are over the threshold\n if (err) {\n if (err.code === 'ENOENT' || isOverThreshold) {\n return setLockAsCompromised(file, lock, Object.assign(err, { code: 'ECOMPROMISED' }));\n }\n\n lock.updateDelay = 1000;\n\n return updateLock(file, options);\n }\n\n // All ok, keep updating..\n lock.mtime = mtime;\n lock.lastUpdate = Date.now();\n lock.updateDelay = null;\n updateLock(file, options);\n });\n });\n }, lock.updateDelay);\n\n // Unref the timer so that the nodejs process can exit freely\n // This is safe because all acquired locks will be automatically released\n // on process exit\n\n // We first check that `lock.updateTimeout.unref` exists because some users\n // may be using this module outside of NodeJS (e.g., in an electron app),\n // and in those cases `setTimeout` return an integer.\n /* istanbul ignore else */\n if (lock.updateTimeout.unref) {\n lock.updateTimeout.unref();\n }\n}\n\nfunction setLockAsCompromised(file, lock, err) {\n // Signal the lock has been released\n lock.released = true;\n\n // Cancel lock mtime update\n // Just for safety, at this point updateTimeout should be null\n /* istanbul ignore if */\n if (lock.updateTimeout) {\n clearTimeout(lock.updateTimeout);\n }\n\n if (locks[file] === lock) {\n delete locks[file];\n }\n\n lock.options.onCompromised(err);\n}\n\n// ----------------------------------------------------------\n\nfunction lock(file, options, callback) {\n /* istanbul ignore next */\n options = {\n stale: 10000,\n update: null,\n realpath: true,\n retries: 0,\n fs,\n onCompromised: (err) => { throw err; },\n ...options,\n };\n\n options.retries = options.retries || 0;\n options.retries = typeof options.retries === 'number' ? { retries: options.retries } : options.retries;\n options.stale = Math.max(options.stale || 0, 2000);\n options.update = options.update == null ? options.stale / 2 : options.update || 0;\n options.update = Math.max(Math.min(options.update, options.stale / 2), 1000);\n\n // Resolve to a canonical file path\n resolveCanonicalPath(file, options, (err, file) => {\n if (err) {\n return callback(err);\n }\n\n // Attempt to acquire the lock\n const operation = retry.operation(options.retries);\n\n operation.attempt(() => {\n acquireLock(file, options, (err, mtime, mtimePrecision) => {\n if (operation.retry(err)) {\n return;\n }\n\n if (err) {\n return callback(operation.mainError());\n }\n\n // We now own the lock\n const lock = locks[file] = {\n lockfilePath: getLockFile(file, options),\n mtime,\n mtimePrecision,\n options,\n lastUpdate: Date.now(),\n };\n\n // We must keep the lock fresh to avoid staleness\n updateLock(file, options);\n\n callback(null, (releasedCallback) => {\n if (lock.released) {\n return releasedCallback &&\n releasedCallback(Object.assign(new Error('Lock is already released'), { code: 'ERELEASED' }));\n }\n\n // Not necessary to use realpath twice when unlocking\n unlock(file, { ...options, realpath: false }, releasedCallback);\n });\n });\n });\n });\n}\n\nfunction unlock(file, options, callback) {\n options = {\n fs,\n realpath: true,\n ...options,\n };\n\n // Resolve to a canonical file path\n resolveCanonicalPath(file, options, (err, file) => {\n if (err) {\n return callback(err);\n }\n\n // Skip if the lock is not acquired\n const lock = locks[file];\n\n if (!lock) {\n return callback(Object.assign(new Error('Lock is not acquired/owned by you'), { code: 'ENOTACQUIRED' }));\n }\n\n lock.updateTimeout && clearTimeout(lock.updateTimeout); // Cancel lock mtime update\n lock.released = true; // Signal the lock has been released\n delete locks[file]; // Delete from locks\n\n removeLock(file, options, callback);\n });\n}\n\nfunction check(file, options, callback) {\n options = {\n stale: 10000,\n realpath: true,\n fs,\n ...options,\n };\n\n options.stale = Math.max(options.stale || 0, 2000);\n\n // Resolve to a canonical file path\n resolveCanonicalPath(file, options, (err, file) => {\n if (err) {\n return callback(err);\n }\n\n // Check if lockfile exists\n options.fs.stat(getLockFile(file, options), (err, stat) => {\n if (err) {\n // If does not exist, file is not locked. Otherwise, callback with error\n return err.code === 'ENOENT' ? callback(null, false) : callback(err);\n }\n\n // Otherwise, check if lock is stale by analyzing the file mtime\n return callback(null, !isLockStale(stat, options));\n });\n });\n}\n\nfunction getLocks() {\n return locks;\n}\n\n// Remove acquired locks on exit\n/* istanbul ignore next */\nonExit(() => {\n for (const file in locks) {\n const options = locks[file].options;\n\n try { options.fs.rmdirSync(getLockFile(file, options)); } catch (e) { /* Empty */ }\n }\n});\n\nmodule.exports.lock = lock;\nmodule.exports.unlock = unlock;\nmodule.exports.check = check;\nmodule.exports.getLocks = getLocks;\n","'use strict';\n\nconst fs = require('graceful-fs');\n\nfunction createSyncFs(fs) {\n const methods = ['mkdir', 'realpath', 'stat', 'rmdir', 'utimes'];\n const newFs = { ...fs };\n\n methods.forEach((method) => {\n newFs[method] = (...args) => {\n const callback = args.pop();\n let ret;\n\n try {\n ret = fs[`${method}Sync`](...args);\n } catch (err) {\n return callback(err);\n }\n\n callback(null, ret);\n };\n });\n\n return newFs;\n}\n\n// ----------------------------------------------------------\n\nfunction toPromise(method) {\n return (...args) => new Promise((resolve, reject) => {\n args.push((err, result) => {\n if (err) {\n reject(err);\n } else {\n resolve(result);\n }\n });\n\n method(...args);\n });\n}\n\nfunction toSync(method) {\n return (...args) => {\n let err;\n let result;\n\n args.push((_err, _result) => {\n err = _err;\n result = _result;\n });\n\n method(...args);\n\n if (err) {\n throw err;\n }\n\n return result;\n };\n}\n\nfunction toSyncOptions(options) {\n // Shallow clone options because we are oging to mutate them\n options = { ...options };\n\n // Transform fs to use the sync methods instead\n options.fs = createSyncFs(options.fs || fs);\n\n // Retries are not allowed because it requires the flow to be sync\n if (\n (typeof options.retries === 'number' && options.retries > 0) ||\n (options.retries && typeof options.retries.retries === 'number' && options.retries.retries > 0)\n ) {\n throw Object.assign(new Error('Cannot use retries with the sync api'), { code: 'ESYNC' });\n }\n\n return options;\n}\n\nmodule.exports = {\n toPromise,\n toSync,\n toSyncOptions,\n};\n","'use strict';\n\nconst lockfile = require('./lib/lockfile');\nconst { toPromise, toSync, toSyncOptions } = require('./lib/adapter');\n\nasync function lock(file, options) {\n const release = await toPromise(lockfile.lock)(file, options);\n\n return toPromise(release);\n}\n\nfunction lockSync(file, options) {\n const release = toSync(lockfile.lock)(file, toSyncOptions(options));\n\n return toSync(release);\n}\n\nfunction unlock(file, options) {\n return toPromise(lockfile.unlock)(file, options);\n}\n\nfunction unlockSync(file, options) {\n return toSync(lockfile.unlock)(file, toSyncOptions(options));\n}\n\nfunction check(file, options) {\n return toPromise(lockfile.check)(file, options);\n}\n\nfunction checkSync(file, options) {\n return toSync(lockfile.check)(file, toSyncOptions(options));\n}\n\nmodule.exports = lock;\nmodule.exports.lock = lock;\nmodule.exports.unlock = unlock;\nmodule.exports.lockSync = lockSync;\nmodule.exports.unlockSync = unlockSync;\nmodule.exports.check = check;\nmodule.exports.checkSync = checkSync;\n","import * as fs from \"node:fs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { spawn } from \"node:child_process\";\nimport * as fs$1 from \"node:fs/promises\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport getPort, { portNumbers } from \"get-port\";\nimport * as properLockfile from \"proper-lockfile\";\nimport { randomUUID } from \"node:crypto\";\n//#region src/state-file.ts\n/**\n* Temp-then-rename JSON state-file writes behind one in-process queue (spec\n* local-dev § 2, \"API hygiene, both daemons\"): each daemon is single-process,\n* so concurrent HTTP handlers mutating the same state file serialize their\n* writes through a `StateFile` instance instead of racing each other on disk.\n*/\nvar StateFile = class {\n\tfilePath;\n\tmode;\n\tqueue = Promise.resolve();\n\tconstructor(filePath, mode) {\n\t\tthis.filePath = filePath;\n\t\tthis.mode = mode;\n\t}\n\t/** Serializes `value` to disk, temp-then-rename, behind this file's write queue. */\n\twrite(value) {\n\t\tconst next = this.queue.then(() => this.writeNow(value));\n\t\tthis.queue = next.catch(() => void 0);\n\t\treturn next;\n\t}\n\t/** Resolves once every write() call made so far has landed on disk — for graceful shutdown, so a SIGTERM can't race an in-flight write and lose it. */\n\tflush() {\n\t\treturn this.queue;\n\t}\n\tasync writeNow(value) {\n\t\tconst dir = path.dirname(this.filePath);\n\t\tawait fs$1.mkdir(dir, { recursive: true });\n\t\tconst tmpPath = path.join(dir, `.${path.basename(this.filePath)}.${randomUUID()}.tmp`);\n\t\tconst json = `${JSON.stringify(value, null, 2)}\\n`;\n\t\tawait fs$1.writeFile(tmpPath, json, this.mode !== void 0 ? { mode: this.mode } : void 0);\n\t\tawait fs$1.rename(tmpPath, this.filePath);\n\t\tif (this.mode !== void 0) await fs$1.chmod(this.filePath, this.mode);\n\t}\n};\nfunction isEnoent$1(err) {\n\treturn err instanceof Error && \"code\" in err && err.code === \"ENOENT\";\n}\n/**\n* Reads and parses a JSON state file, narrowing the parsed value with\n* `isValid` (a real type predicate, not a cast — the file's shape is only\n* trustworthy because this daemon is its only writer, but a foreign or\n* corrupt file on disk must not be treated as valid state). `undefined` when\n* absent, unreadable, or shaped wrong.\n*/\nasync function readJsonFile(filePath, isValid) {\n\tlet raw;\n\ttry {\n\t\traw = await fs$1.readFile(filePath, \"utf8\");\n\t} catch (err) {\n\t\tif (isEnoent$1(err)) return void 0;\n\t\tthrow err;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\treturn;\n\t}\n\treturn isValid(parsed) ? parsed : void 0;\n}\n//#endregion\n//#region src/daemon.ts\n/**\n* The shared daemon layer (local-dev spec § 2): a machine-scoped registry of\n* running emulator daemons (`compute`, `buckets`), and `ensureDaemon` /\n* `stopDaemon` to start, adopt, or replace them. Every daemon is a detached,\n* `unref()`'d child process that outlives whatever called `ensureDaemon` —\n* the registry is how a later call finds it again.\n*\n* `registryRoot` defaults to `$PRISMA_COMPOSER_EMULATORS_DIR`, else\n* `~/.prisma-composer/emulators/`, and governs every path this module\n* manages for a given daemon: the registry JSON itself, the daemon's own\n* state directory, and its stdio log file. The `{ registryRoot }` override\n* exists solely so tests never touch the real home directory; production\n* code never passes it.\n*/\nconst MIN_PORT = 4300;\nconst MAX_PORT = 65535;\nconst EXISTING_HEALTH_TIMEOUT_MS = 2e3;\nconst START_HEALTH_BUDGET_MS = 1e4;\nconst HEALTH_POLL_INTERVAL_MS = 200;\n/**\n* How long SIGTERM gets before SIGKILL. Generous on purpose: the daemon hosts\n* its `@prisma/dev` servers in-process, and only a graceful exit closes them\n* and releases each server's name lock. A SIGKILLed daemon leaves those locks\n* behind, and the next daemon then has to wait out proper-lockfile's stale\n* threshold before it can start the same database — which surfaces as\n* \"already running\". The wait below ends as soon as the process is gone, so\n* this budget is only ever spent on a daemon that is genuinely not exiting.\n*/\nconst TERMINATE_GRACE_MS = 2e4;\nconst TERMINATE_POLL_INTERVAL_MS = 150;\n/** After SIGKILL, how long to wait for the OS to actually reap the process. */\nconst TERMINATE_KILL_WAIT_MS = 5e3;\nconst LOCK_RETRY_INTERVAL_MS = 250;\nconst LOCK_WAIT_BUDGET_MS = 1e4;\nconst LOCK_STALE_MS = 1e4;\n/** Spec § 2 step 5: a FRESH allocation (no persisted port) tries at most this many distinct port candidates before the pinned failure error. */\nconst MAX_FRESH_PORT_CANDIDATES = 5;\nfunction isErrnoException(err) {\n\treturn err instanceof Error && \"code\" in err;\n}\nfunction isEnoent(err) {\n\treturn isErrnoException(err) && err.code === \"ENOENT\";\n}\nfunction isRegistryEntry(value) {\n\treturn typeof value === \"object\" && value !== null && \"pid\" in value && typeof value.pid === \"number\" && \"port\" in value && typeof value.port === \"number\" && \"version\" in value && typeof value.version === \"string\" && \"logPath\" in value && typeof value.logPath === \"string\";\n}\nfunction isHealthBody(value) {\n\treturn typeof value === \"object\" && value !== null && \"version\" in value && typeof value.version === \"string\";\n}\nfunction isPackageJson(value) {\n\treturn typeof value === \"object\" && value !== null && \"version\" in value && typeof value.version === \"string\";\n}\nfunction sleep(ms) {\n\treturn new Promise((resolve) => setTimeout(resolve, ms));\n}\n/** The environment variable that names the emulator registry root. */\nconst EMULATORS_DIR_ENV = \"PRISMA_COMPOSER_EMULATORS_DIR\";\n/** The environment variable that sets how long the compute emulator waits for a service to accept connections, in milliseconds. */\nconst SERVICE_READY_TIMEOUT_ENV = \"PRISMA_COMPOSER_SERVICE_READY_TIMEOUT_MS\";\n/** The compute emulator's `--ready-timeout-ms` from `SERVICE_READY_TIMEOUT_ENV` in this process's environment; none when it is unset. */\nfunction daemonArgs(name) {\n\tif (name !== \"compute\") return [];\n\tconst raw = process.env[SERVICE_READY_TIMEOUT_ENV];\n\tif (raw === void 0 || raw === \"\") return [];\n\tconst ms = Number(raw);\n\tif (!Number.isInteger(ms) || ms <= 0) throw new CliStructuredError(\"DEV.SERVICE_READY_TIMEOUT_INVALID\", `${SERVICE_READY_TIMEOUT_ENV} must be a positive whole number of milliseconds; got \"${raw}\".`, {\n\t\twhy: \"The compute emulator waits this long for each service to accept connections before it gives up on the service.\",\n\t\tfix: `Set ${SERVICE_READY_TIMEOUT_ENV} to a whole number of milliseconds, such as 60000, or unset it to use the default of 30000.`,\n\t\tmeta: {\n\t\t\tvariable: SERVICE_READY_TIMEOUT_ENV,\n\t\t\tvalue: raw\n\t\t}\n\t});\n\treturn [\"--ready-timeout-ms\", String(ms)];\n}\n/** `registryRoot`'s default: `$PRISMA_COMPOSER_EMULATORS_DIR` (an absolute path, normalised) when set, else `~/.prisma-composer/emulators/`. */\nfunction defaultRegistryRoot() {\n\tconst dir = process.env[EMULATORS_DIR_ENV];\n\tif (dir === void 0 || dir === \"\") return path.join(os.homedir(), \".prisma-composer\", \"emulators\");\n\tif (!path.isAbsolute(dir)) throw new CliStructuredError(\"DEV.EMULATORS_DIR_INVALID\", `${EMULATORS_DIR_ENV} must be an absolute path; got \"${dir}\".`, {\n\t\twhy: \"Every process that starts or reaches the local emulators resolves this directory, and a relative path would name a different one in each working directory.\",\n\t\tfix: `Set ${EMULATORS_DIR_ENV} to an absolute path (\\`~\\` is not expanded), or unset it to use ~/.prisma-composer/emulators.`,\n\t\tmeta: {\n\t\t\tvariable: EMULATORS_DIR_ENV,\n\t\t\tvalue: dir\n\t\t}\n\t});\n\treturn path.resolve(dir);\n}\n/** `<registryRoot>/<name>.json`. */\nfunction registryFilePath(registryRoot, name) {\n\treturn path.join(registryRoot, `${name}.json`);\n}\n/** `<registryRoot>/<name>/` — the daemon's own `--state-dir`. */\nfunction daemonStateDir(registryRoot, name) {\n\treturn path.join(registryRoot, name);\n}\n/** `<registryRoot>/<name>.log` — the daemon's stdio log. */\nfunction daemonLogPath(registryRoot, name) {\n\treturn path.join(registryRoot, `${name}.log`);\n}\n/** Compute's and postgres's root namespace is their own JSON admin API; buckets' root namespace is the S3 wire, so its health lives under `/_pcdev/`. */\nfunction healthPathFor(name) {\n\treturn name === \"buckets\" ? \"/_pcdev/health\" : \"/health\";\n}\n/** `@internal/dev-emulators`'s own `package.json` version — what \"version\" means everywhere in this package. */\nfunction readOwnVersion() {\n\tconst here = path.dirname(fileURLToPath(import.meta.url));\n\tconst pkgPath = path.join(here, \"..\", \"package.json\");\n\tconst raw = fs.readFileSync(pkgPath, \"utf8\");\n\tconst parsed = JSON.parse(raw);\n\tif (!isPackageJson(parsed)) throw new Error(`could not read a version string from ${pkgPath}`);\n\treturn parsed.version;\n}\n/** `process.kill(pid, 0)` existence probe — true unless the pid is provably gone (ESRCH). */\nfunction isPidAlive(pid) {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (err) {\n\t\tif (isErrnoException(err) && err.code === \"EPERM\") return true;\n\t\treturn false;\n\t}\n}\nasync function readRegistryEntry(registryRoot, name) {\n\treturn readJsonFile(registryFilePath(registryRoot, name), isRegistryEntry);\n}\nasync function probeHealth(port, healthPath, timeoutMs) {\n\ttry {\n\t\tconst res = await fetch(`http://127.0.0.1:${port}${healthPath}`, { signal: AbortSignal.timeout(timeoutMs) });\n\t\tif (!res.ok) return void 0;\n\t\tconst body = await res.json();\n\t\treturn isHealthBody(body) ? body : void 0;\n\t} catch {\n\t\treturn;\n\t}\n}\n/**\n* Polls the health path up to `budgetMs`, but returns immediately once the\n* child exits — a dead child can never become healthy, and the port-retry\n* protocol (spec § 2 step 5) needs to move to the next candidate right\n* away rather than exhausting a live-process budget on one that isn't\n* live. Only a child that stays alive without becoming healthy consumes\n* the full budget.\n*\n* Verifies the health response's OWN version, not just that something\n* answered: if our child failed to bind (a foreign process already held\n* the port) that foreign process may itself answer `/health` successfully\n* — a version mismatch there is exactly the \"port taken\" case, not a false\n* \"healthy\", and must not be reported as such.\n*/\nasync function awaitHealthy(child, port, healthPath, ownVersion, budgetMs) {\n\tlet exited = false;\n\tchild.once(\"exit\", () => {\n\t\texited = true;\n\t});\n\tconst deadline = Date.now() + budgetMs;\n\tdo {\n\t\tif (exited) return {\n\t\t\thealthy: false,\n\t\t\texitedBeforeHealthy: true\n\t\t};\n\t\tconst remaining = deadline - Date.now();\n\t\tconst health = await probeHealth(port, healthPath, Math.max(200, Math.min(1e3, remaining)));\n\t\tif (health && health.version === ownVersion) return {\n\t\t\thealthy: true,\n\t\t\texitedBeforeHealthy: false\n\t\t};\n\t\tif (exited) return {\n\t\t\thealthy: false,\n\t\t\texitedBeforeHealthy: true\n\t\t};\n\t\tawait sleep(HEALTH_POLL_INTERVAL_MS);\n\t} while (Date.now() < deadline);\n\treturn {\n\t\thealthy: false,\n\t\texitedBeforeHealthy: exited\n\t};\n}\n/** SIGTERM, wait up to `graceMs` for the pid to exit, then SIGKILL. A no-op if the pid is already gone. */\nasync function terminate(pid, graceMs) {\n\tif (!isPidAlive(pid)) return;\n\ttry {\n\t\tprocess.kill(pid, \"SIGTERM\");\n\t} catch {\n\t\treturn;\n\t}\n\tconst deadline = Date.now() + graceMs;\n\twhile (Date.now() < deadline) {\n\t\tif (!isPidAlive(pid)) return;\n\t\tawait sleep(TERMINATE_POLL_INTERVAL_MS);\n\t}\n\tif (isPidAlive(pid)) {\n\t\ttry {\n\t\t\tprocess.kill(pid, \"SIGKILL\");\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t\tconst killDeadline = Date.now() + TERMINATE_KILL_WAIT_MS;\n\t\twhile (Date.now() < killDeadline) {\n\t\t\tif (!isPidAlive(pid)) return;\n\t\t\tawait sleep(TERMINATE_POLL_INTERVAL_MS);\n\t\t}\n\t}\n}\n/** Every port recorded by any registry entry under `registryRoot` — the two daemons share one port pool. */\nasync function usedPorts(registryRoot) {\n\tlet names;\n\ttry {\n\t\tnames = await fs$1.readdir(registryRoot);\n\t} catch (err) {\n\t\tif (isEnoent(err)) return /* @__PURE__ */ new Set();\n\t\tthrow err;\n\t}\n\tconst ports = /* @__PURE__ */ new Set();\n\tfor (const fname of names) {\n\t\tif (!fname.endsWith(\".json\")) continue;\n\t\tconst entry = await readJsonFile(path.join(registryRoot, fname), isRegistryEntry);\n\t\tif (entry) ports.add(entry.port);\n\t}\n\treturn ports;\n}\n/**\n* The smallest genuinely free port at or above `min`, skipping every port\n* already recorded in the registry — persistence and the range policy\n* (`min`, \"skip registry-used ports\") stay ours; whether a given candidate\n* is actually bindable is `get-port`'s (spec § 2's dependency razor — a\n* hand-rolled probe already produced a real cross-platform bug: a Linux-only\n* self-collision from checking two bind scopes concurrently).\n*/\nasync function smallestUnused(used, min) {\n\treturn getPort({\n\t\tport: portNumbers(min, MAX_PORT),\n\t\texclude: used\n\t});\n}\n/** Spawns the daemon binary detached, stdio appended to `logPath`. Doesn't wait for health. */\nfunction spawnDaemonProcess(entryPath, port, stateDir, logPath, extraArgs) {\n\tconst logFd = fs.openSync(logPath, \"a\");\n\tlet child;\n\ttry {\n\t\tconst args = [\n\t\t\tentryPath,\n\t\t\t\"--port\",\n\t\t\tString(port),\n\t\t\t\"--state-dir\",\n\t\t\tstateDir,\n\t\t\t...extraArgs\n\t\t];\n\t\tchild = spawn(process.execPath, args, {\n\t\t\tdetached: true,\n\t\t\tstdio: [\n\t\t\t\t\"ignore\",\n\t\t\t\tlogFd,\n\t\t\t\tlogFd\n\t\t\t]\n\t\t});\n\t} finally {\n\t\tfs.closeSync(logFd);\n\t}\n\tchild.unref();\n\treturn child;\n}\n/**\n* Reads the registry entry and classifies it. \"dead-or-unhealthy\" covers\n* both a provably dead pid AND a live pid that fails health — the latter\n* can't be confirmed as our daemon (a reused pid after a reboot, a hung\n* foreign process), so it is never signaled, only dropped.\n*/\nasync function observeExisting(registryFile, healthPath, ownVersion) {\n\tconst entry = await readJsonFile(registryFile, isRegistryEntry);\n\tif (!entry) return { kind: \"absent\" };\n\tif (!isPidAlive(entry.pid)) return {\n\t\tkind: \"dead-or-unhealthy\",\n\t\tentry\n\t};\n\tconst health = await probeHealth(entry.port, healthPath, EXISTING_HEALTH_TIMEOUT_MS);\n\tif (health && health.version === ownVersion) return {\n\t\tkind: \"healthy\",\n\t\tentry\n\t};\n\tif (health && health.version !== ownVersion) return {\n\t\tkind: \"stale-version\",\n\t\tentry\n\t};\n\treturn {\n\t\tkind: \"dead-or-unhealthy\",\n\t\tentry\n\t};\n}\n/**\n* `<registryRoot>/.<name>.lock-target` — the file `proper-lockfile` locks\n* for the concurrent-ensure protocol (it marks the lock as a sibling\n* `<file>.lock` directory it manages itself). A stable, never-deleted file:\n* unlike the registry JSON, which this module removes and rewrites\n* repeatedly while ensuring, the lock target must exist continuously for\n* `proper-lockfile`'s `realpath` resolution.\n*/\nfunction lockFilePath(registryRoot, name) {\n\treturn path.join(registryRoot, `.${name}.lock-target`);\n}\n/**\n* Acquires the concurrent-ensure protocol's inter-process lock (spec § 2)\n* via `proper-lockfile` — its staleness/compromise semantics are adopted\n* wholesale rather than re-implementing pid liveness checking on top (the\n* dependency razor: commodity locking is exactly where unforeseen edge\n* cases hide). Polls roughly every 250 ms for up to a 10 s budget; on\n* exhaustion (`ELOCKED`, meaning a live, non-stale holder never let go),\n* throws the pinned timeout error. Any other failure propagates as-is.\n*/\nasync function acquireLock(registryRoot, name) {\n\tawait fs$1.mkdir(registryRoot, { recursive: true });\n\tconst target = lockFilePath(registryRoot, name);\n\tawait fs$1.writeFile(target, \"\", { flag: \"a\" });\n\tconst retries = Math.max(1, Math.floor(LOCK_WAIT_BUDGET_MS / LOCK_RETRY_INTERVAL_MS));\n\ttry {\n\t\treturn await properLockfile.lock(target, {\n\t\t\tstale: LOCK_STALE_MS,\n\t\t\tretries: {\n\t\t\t\tretries,\n\t\t\t\tminTimeout: LOCK_RETRY_INTERVAL_MS,\n\t\t\t\tmaxTimeout: LOCK_RETRY_INTERVAL_MS,\n\t\t\t\tfactor: 1\n\t\t\t}\n\t\t});\n\t} catch (err) {\n\t\tif (isErrnoException(err) && err.code === \"ELOCKED\") throw new Error(`timed out waiting for another process ensuring the ${name} emulator — remove ${target}.lock if stale.`);\n\t\tthrow err;\n\t}\n}\n/**\n* Ensure the named daemon is running and healthy at this package's version,\n* starting or replacing it as needed (spec § 2 `daemon.ts`). Idempotent —\n* safe to call repeatedly, including across unrelated processes on the same\n* machine, and safe under concurrent callers across processes: the\n* observe→spawn→persist critical section is serialized per daemon name by\n* an inter-process lock (the \"Concurrent-ensure protocol\").\n*\n* `entry` is the resolved absolute path to the daemon program to spawn —\n* the CALLER resolves it (local-dev spec § 2's publish note). This module\n* used to resolve it itself via `import.meta.resolve('@internal/dev-emulators/…')`,\n* which only works in-repo: `@internal/*` are private workspace packages a\n* published npm consumer never receives. In-repo callers (including tests)\n* still resolve `@internal/dev-emulators/*-main` the same way; a published\n* consumer resolves its own public subpaths instead.\n*/\nasync function ensureDaemon(name, entry, opts = {}) {\n\tconst registryRoot = opts.registryRoot ?? defaultRegistryRoot();\n\tconst extraArgs = daemonArgs(name);\n\tconst registryFile = registryFilePath(registryRoot, name);\n\tconst healthPath = healthPathFor(name);\n\tconst ownVersion = readOwnVersion();\n\tconst quick = await observeExisting(registryFile, healthPath, ownVersion);\n\tif (quick.kind === \"healthy\") return { url: `http://127.0.0.1:${quick.entry.port}` };\n\tconst release = await acquireLock(registryRoot, name);\n\ttry {\n\t\tconst observed = await observeExisting(registryFile, healthPath, ownVersion);\n\t\tif (observed.kind === \"healthy\") return { url: `http://127.0.0.1:${observed.entry.port}` };\n\t\tlet reusablePort;\n\t\tif (observed.kind === \"stale-version\") {\n\t\t\treusablePort = observed.entry.port;\n\t\t\tawait terminate(observed.entry.pid, TERMINATE_GRACE_MS);\n\t\t\tawait fs$1.rm(registryFile, { force: true });\n\t\t} else if (observed.kind === \"dead-or-unhealthy\") {\n\t\t\treusablePort = observed.entry.port;\n\t\t\tawait fs$1.rm(registryFile, { force: true });\n\t\t}\n\t\tconst isFreshAllocation = reusablePort === void 0;\n\t\tconst maxAttempts = isFreshAllocation ? MAX_FRESH_PORT_CANDIDATES : 1;\n\t\tlet port = reusablePort ?? await smallestUnused(await usedPorts(registryRoot), MIN_PORT);\n\t\tconst stateDir = daemonStateDir(registryRoot, name);\n\t\tconst logPath = daemonLogPath(registryRoot, name);\n\t\tawait fs$1.mkdir(stateDir, { recursive: true });\n\t\tawait fs$1.mkdir(path.dirname(logPath), { recursive: true });\n\t\tfor (let attempt = 1;; attempt++) {\n\t\t\tconst child = spawnDaemonProcess(entry, port, stateDir, logPath, extraArgs);\n\t\t\tif (child.pid === void 0) throw new Error(`failed to spawn the ${name} emulator — see ${logPath}.`);\n\t\t\tawait new StateFile(registryFile).write({\n\t\t\t\tpid: child.pid,\n\t\t\t\tport,\n\t\t\t\tversion: ownVersion,\n\t\t\t\tlogPath\n\t\t\t});\n\t\t\tconst outcome = await awaitHealthy(child, port, healthPath, ownVersion, START_HEALTH_BUDGET_MS);\n\t\t\tif (outcome.healthy) return { url: `http://127.0.0.1:${port}` };\n\t\t\tif (!(isFreshAllocation && outcome.exitedBeforeHealthy && attempt < maxAttempts)) {\n\t\t\t\tawait terminate(child.pid, TERMINATE_GRACE_MS);\n\t\t\t\tawait fs$1.rm(registryFile, { force: true });\n\t\t\t\tthrow new Error(`${name} emulator failed to start on port ${port} — see ${logPath}.`);\n\t\t\t}\n\t\t\tawait fs$1.rm(registryFile, { force: true });\n\t\t\tport = await smallestUnused(await usedPorts(registryRoot), port + 1);\n\t\t}\n\t} finally {\n\t\tawait release();\n\t}\n}\n/** SIGTERM/SIGKILL + registry cleanup. Not called by any v1 command — an operator escape hatch, exported for tests. */\nasync function stopDaemon(name, opts = {}) {\n\tconst registryFile = registryFilePath(opts.registryRoot ?? defaultRegistryRoot(), name);\n\tconst entry = await readJsonFile(registryFile, isRegistryEntry);\n\tif (entry) await terminate(entry.pid, TERMINATE_GRACE_MS);\n\tawait fs$1.rm(registryFile, { force: true });\n}\n//#endregion\nexport { defaultRegistryRoot as a, isPidAlive as c, registryFilePath as d, stopDaemon as f, daemonStateDir as i, readOwnVersion as l, readJsonFile as m, SERVICE_READY_TIMEOUT_ENV as n, ensureDaemon as o, StateFile as p, daemonLogPath as r, healthPathFor as s, EMULATORS_DIR_ENV as t, readRegistryEntry as u };\n\n//# sourceMappingURL=daemon-D9BV062Q.mjs.map","import { a as defaultRegistryRoot, c as isPidAlive, d as registryFilePath, f as stopDaemon, i as daemonStateDir, l as readOwnVersion, o as ensureDaemon, r as daemonLogPath, s as healthPathFor, t as EMULATORS_DIR_ENV, u as readRegistryEntry } from \"./daemon-D9BV062Q.mjs\";\nimport * as fs from \"node:fs\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport { notOk, ok } from \"@internal/foundation/result\";\n//#region src/client.ts\n/**\n* Typed loopback clients for both emulator daemons (local-dev spec § 2),\n* resolving the running daemon's port from the registry. Used by the local\n* providers and the extension's `emulators`/`attach`/`teardown`\n* implementations, which never learn an emulator's HTTP API directly.\n*/\nfunction notRunningError(name) {\n\treturn /* @__PURE__ */ new Error(`the ${name} emulator is not running — \\`prisma dev\\` starts it via the extension's dev.emulators hook.`);\n}\nfunction isRegistryEntry(value) {\n\treturn typeof value === \"object\" && value !== null && \"pid\" in value && typeof value.pid === \"number\" && \"port\" in value && typeof value.port === \"number\";\n}\n/** Synchronous resolve — reading a small local JSON file needs no await, and every consumer wants a ready-to-use client object, not a promise. */\nfunction resolveBaseUrl(name, opts) {\n\tconst file = registryFilePath(opts.registryRoot ?? defaultRegistryRoot(), name);\n\tlet raw;\n\ttry {\n\t\traw = fs.readFileSync(file, \"utf8\");\n\t} catch {\n\t\tthrow notRunningError(name);\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\tthrow notRunningError(name);\n\t}\n\tif (!isRegistryEntry(parsed) || !isPidAlive(parsed.pid)) throw notRunningError(name);\n\treturn `http://127.0.0.1:${parsed.port}`;\n}\nconst ADMIN_FETCH_ATTEMPTS = 3;\nconst ADMIN_FETCH_RETRY_DELAY_MS = 150;\n/**\n* `fetch` for the loopback admin calls, retried on transient socket errors:\n* a keep-alive reuse race (the runtime re-uses a pooled connection the\n* daemon's HTTP server just closed idle — surfaces as \"fetch failed\" /\n* \"other side closed\") or a briefly overloaded daemon. A short blind retry is\n* safe only for an idempotent call; a call that is not, such as creating an\n* instance, passes `retry: false`, because the emulator may have handled the\n* first attempt. A caller-driven abort is never retried. When every attempt\n* fails to connect, it throws `DEV.EMULATOR_UNREACHABLE`; callers retry that\n* code and nothing else.\n*/\nasync function adminFetch(url, init, opts = {}) {\n\tconst attempts = opts.retry === false ? 1 : ADMIN_FETCH_ATTEMPTS;\n\tlet lastError;\n\tfor (let attempt = 1; attempt <= attempts; attempt += 1) try {\n\t\treturn await fetch(url, init);\n\t} catch (error) {\n\t\tif (init?.signal?.aborted === true) throw error;\n\t\tlastError = error;\n\t\tif (attempt < attempts) await new Promise((resolve) => setTimeout(resolve, ADMIN_FETCH_RETRY_DELAY_MS));\n\t}\n\tthrow new CliStructuredError(\"DEV.EMULATOR_UNREACHABLE\", `Could not connect to the local dev emulator at ${new URL(url).origin}: ${lastError instanceof Error ? lastError.message : String(lastError)}`, {\n\t\twhy: \"The emulator is registered and its process is alive, but it did not accept the connection.\",\n\t\tfix: \"Run the command again. If it keeps failing, end the emulator's process; the next `prisma dev` starts a new one.\",\n\t\tmeta: { url },\n\t\tcause: lastError\n\t});\n}\nasync function expectOk(res) {\n\tif (!res.ok) {\n\t\tconst body = await res.text();\n\t\tthrow new Error(`request to the local dev emulator failed (${res.status}): ${body}`);\n\t}\n\treturn res;\n}\nconst INSTANCE_STATUSES = /* @__PURE__ */ new Set([\n\t\"running\",\n\t\"backoff\",\n\t\"held\",\n\t\"stopped\"\n]);\nfunction isStringRecord(value) {\n\treturn typeof value === \"object\" && value !== null && Object.values(value).every((v) => typeof v === \"string\");\n}\nfunction isServiceInstanceInfo(value) {\n\treturn typeof value === \"object\" && value !== null && \"id\" in value && typeof value.id === \"string\" && \"labels\" in value && isStringRecord(value.labels) && \"port\" in value && typeof value.port === \"number\" && \"url\" in value && typeof value.url === \"string\" && \"status\" in value && typeof value.status === \"string\" && INSTANCE_STATUSES.has(value.status) && \"logPath\" in value && typeof value.logPath === \"string\";\n}\nfunction isServiceInstanceInfoArray(value) {\n\treturn Array.isArray(value) && value.every(isServiceInstanceInfo);\n}\nfunction isHealthBody(value) {\n\treturn typeof value === \"object\" && value !== null && \"version\" in value && typeof value.version === \"string\";\n}\nfunction instancePath(baseUrl, id) {\n\treturn `${baseUrl}/instances/${encodeURIComponent(id)}`;\n}\nfunction postJson(body) {\n\treturn {\n\t\tmethod: \"POST\",\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tbody: JSON.stringify(body)\n\t};\n}\nfunction computeClient(opts = {}) {\n\tconst baseUrl = resolveBaseUrl(\"compute\", opts);\n\treturn {\n\t\tbaseUrl,\n\t\tasync health() {\n\t\t\tconst body = await (await expectOk(await adminFetch(`${baseUrl}/health`))).json();\n\t\t\tif (!isHealthBody(body)) throw new Error(\"malformed /health response from the compute emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync createInstance(request) {\n\t\t\tconst body = await (await expectOk(await adminFetch(`${baseUrl}/instances`, postJson(request), { retry: false }))).json();\n\t\t\tif (!isServiceInstanceInfo(body)) throw new Error(\"malformed instance-create response from the compute emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync listInstances() {\n\t\t\tconst body = await (await expectOk(await adminFetch(`${baseUrl}/instances`))).json();\n\t\t\tif (!isServiceInstanceInfoArray(body)) throw new Error(\"malformed instances listing from the compute emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync getInstance(id) {\n\t\t\tconst res = await adminFetch(instancePath(baseUrl, id));\n\t\t\tif (res.status === 404) return void 0;\n\t\t\tconst body = await (await expectOk(res)).json();\n\t\t\tif (!isServiceInstanceInfo(body)) throw new Error(\"malformed instance response from the compute emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync putDeployment(id, deployment) {\n\t\t\tawait expectOk(await adminFetch(`${instancePath(baseUrl, id)}/deployment`, {\n\t\t\t\tmethod: \"PUT\",\n\t\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\t\tbody: JSON.stringify(deployment)\n\t\t\t}));\n\t\t},\n\t\tasync *followLogs(id, signal, opts) {\n\t\t\tconst tail = opts?.tail !== void 0 ? `&tail=${String(Math.max(0, Math.trunc(opts.tail)))}` : \"\";\n\t\t\tconst body = (await expectOk(await adminFetch(`${instancePath(baseUrl, id)}/logs?follow=1${tail}`, signal ? { signal } : void 0))).body;\n\t\t\tif (!body) return;\n\t\t\tconst reader = body.getReader();\n\t\t\tconst decoder = new TextDecoder();\n\t\t\ttry {\n\t\t\t\twhile (true) {\n\t\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\t\tif (done) return;\n\t\t\t\t\tyield decoder.decode(value, { stream: true });\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tawait reader.cancel().catch(() => void 0);\n\t\t\t}\n\t\t},\n\t\tasync startInstances(ids) {\n\t\t\tawait expectOk(await adminFetch(`${baseUrl}/instances/start`, postJson({ ids })));\n\t\t},\n\t\tasync stopInstances(ids) {\n\t\t\tawait expectOk(await adminFetch(`${baseUrl}/instances/stop`, postJson({ ids })));\n\t\t},\n\t\tasync deleteInstance(id) {\n\t\t\tawait expectOk(await adminFetch(instancePath(baseUrl, id), { method: \"DELETE\" }));\n\t\t}\n\t};\n}\nfunction isBucketInstanceInfo(value) {\n\treturn typeof value === \"object\" && value !== null && \"id\" in value && typeof value.id === \"string\" && \"labels\" in value && isStringRecord(value.labels) && \"dir\" in value && typeof value.dir === \"string\";\n}\nfunction isBucketInstanceInfoArray(value) {\n\treturn Array.isArray(value) && value.every(isBucketInstanceInfo);\n}\nfunction bucketsClient(opts = {}) {\n\tconst baseUrl = resolveBaseUrl(\"buckets\", opts);\n\tconst adminUrl = `${baseUrl}/_pcdev/instances`;\n\treturn {\n\t\tbaseUrl,\n\t\tasync health() {\n\t\t\tconst body = await (await expectOk(await adminFetch(`${baseUrl}/_pcdev/health`))).json();\n\t\t\tif (!isHealthBody(body)) throw new Error(\"malformed /_pcdev/health response from the buckets emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync createInstance(request) {\n\t\t\tconst body = await (await expectOk(await adminFetch(adminUrl, postJson(request), { retry: false }))).json();\n\t\t\tif (!isBucketInstanceInfo(body)) throw new Error(\"malformed instance-create response from the buckets emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync listInstances() {\n\t\t\tconst body = await (await expectOk(await adminFetch(adminUrl))).json();\n\t\t\tif (!isBucketInstanceInfoArray(body)) throw new Error(\"malformed instances listing from the buckets emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync getInstance(id) {\n\t\t\tconst res = await adminFetch(instancePath(`${baseUrl}/_pcdev`, id));\n\t\t\tif (res.status === 404) return void 0;\n\t\t\tconst body = await (await expectOk(res)).json();\n\t\t\tif (!isBucketInstanceInfo(body)) throw new Error(\"malformed instance response from the buckets emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync putCredentials(id, accessKeyId, secretAccessKey) {\n\t\t\tawait expectOk(await adminFetch(`${instancePath(`${baseUrl}/_pcdev`, id)}/credentials`, {\n\t\t\t\tmethod: \"PUT\",\n\t\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\taccessKeyId,\n\t\t\t\t\tsecretAccessKey\n\t\t\t\t})\n\t\t\t}));\n\t\t},\n\t\tasync deleteInstance(id) {\n\t\t\tawait expectOk(await adminFetch(instancePath(`${baseUrl}/_pcdev`, id), { method: \"DELETE\" }));\n\t\t}\n\t};\n}\nfunction isDatabaseInstanceInfo(value) {\n\treturn typeof value === \"object\" && value !== null && \"id\" in value && typeof value.id === \"string\" && \"labels\" in value && isStringRecord(value.labels) && \"port\" in value && typeof value.port === \"number\" && \"url\" in value && typeof value.url === \"string\" && \"status\" in value && (value.status === \"running\" || value.status === \"stopped\");\n}\nfunction isDatabaseInstanceInfoArray(value) {\n\treturn Array.isArray(value) && value.every(isDatabaseInstanceInfo);\n}\nfunction postgresClient(opts = {}) {\n\tconst baseUrl = resolveBaseUrl(\"postgres\", opts);\n\treturn {\n\t\tbaseUrl,\n\t\tasync health() {\n\t\t\tconst body = await (await expectOk(await adminFetch(`${baseUrl}/health`))).json();\n\t\t\tif (!isHealthBody(body)) throw new Error(\"malformed /health response from the postgres emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync createInstance(request) {\n\t\t\tconst body = await (await expectOk(await adminFetch(`${baseUrl}/instances`, postJson(request), { retry: false }))).json();\n\t\t\tif (!isDatabaseInstanceInfo(body)) throw new Error(\"malformed instance-create response from the postgres emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync listInstances() {\n\t\t\tconst body = await (await expectOk(await adminFetch(`${baseUrl}/instances`))).json();\n\t\t\tif (!isDatabaseInstanceInfoArray(body)) throw new Error(\"malformed instances listing from the postgres emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync getInstance(id) {\n\t\t\tconst res = await adminFetch(instancePath(baseUrl, id));\n\t\t\tif (res.status === 404) return void 0;\n\t\t\tconst body = await (await expectOk(res)).json();\n\t\t\tif (!isDatabaseInstanceInfo(body)) throw new Error(\"malformed instance response from the postgres emulator\");\n\t\t\treturn body;\n\t\t},\n\t\tasync startInstances(ids, prismaDevModulePath) {\n\t\t\tawait expectOk(await adminFetch(`${baseUrl}/instances/start`, postJson({\n\t\t\t\tids,\n\t\t\t\tprismaDevModulePath\n\t\t\t})));\n\t\t},\n\t\tasync stopInstances(ids) {\n\t\t\tawait expectOk(await adminFetch(`${baseUrl}/instances/stop`, postJson({ ids })));\n\t\t},\n\t\tasync deleteInstance(id, prismaDevModulePath) {\n\t\t\tawait expectOk(await adminFetch(instancePath(baseUrl, id), {\n\t\t\t\tmethod: \"DELETE\",\n\t\t\t\t...prismaDevModulePath !== void 0 ? {\n\t\t\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\t\t\tbody: JSON.stringify({ prismaDevModulePath })\n\t\t\t\t} : {}\n\t\t\t}));\n\t\t}\n\t};\n}\n//#endregion\n//#region src/emulator-list.ts\n/**\n* Every local emulator on this machine and every instance on it — the\n* operation behind `prisma emulator list`. It needs no project: it reads the\n* emulators' registry and asks each running emulator for its instances.\n*/\nconst EMULATOR_KINDS = [\n\t\"service\",\n\t\"database\",\n\t\"bucket\"\n];\nconst DAEMON_OF = {\n\tservice: \"compute\",\n\tdatabase: \"postgres\",\n\tbucket: \"buckets\"\n};\n/** Whether the emulator for `kind` is registered with a live process. */\nasync function isEmulatorRunning(kind, opts = {}) {\n\tconst entry = await readRegistryEntry(opts.registryRoot ?? defaultRegistryRoot(), DAEMON_OF[kind]);\n\treturn entry !== void 0 && isPidAlive(entry.pid);\n}\nfunction listerOf(kind, opts) {\n\tif (kind === \"service\") {\n\t\tconst client = computeClient(opts);\n\t\treturn {\n\t\t\turl: client.baseUrl,\n\t\t\tlist: async () => (await client.listInstances()).map(({ id, url, status, labels }) => ({\n\t\t\t\tid,\n\t\t\t\tkind,\n\t\t\t\turl,\n\t\t\t\tstate: status,\n\t\t\t\tlabels\n\t\t\t}))\n\t\t};\n\t}\n\tif (kind === \"database\") {\n\t\tconst client = postgresClient(opts);\n\t\treturn {\n\t\t\turl: client.baseUrl,\n\t\t\tlist: async () => (await client.listInstances()).map(({ id, url, status, labels }) => ({\n\t\t\t\tid,\n\t\t\t\tkind,\n\t\t\t\turl,\n\t\t\t\tstate: status,\n\t\t\t\tlabels\n\t\t\t}))\n\t\t};\n\t}\n\tconst client = bucketsClient(opts);\n\treturn {\n\t\turl: client.baseUrl,\n\t\tlist: async () => (await client.listInstances()).map(({ id, labels }) => ({\n\t\t\tid,\n\t\t\tkind,\n\t\t\turl: `${client.baseUrl}/${id}`,\n\t\t\tstate: \"running\",\n\t\t\tlabels\n\t\t}))\n\t};\n}\nasync function listingOf(kind, opts) {\n\tif (!await isEmulatorRunning(kind, opts)) return {\n\t\tkind,\n\t\trunning: false,\n\t\turl: null,\n\t\tinstances: [],\n\t\terror: null\n\t};\n\tconst lister = listerOf(kind, opts);\n\ttry {\n\t\treturn {\n\t\t\tkind,\n\t\t\trunning: true,\n\t\t\turl: lister.url,\n\t\t\tinstances: await lister.list(),\n\t\t\terror: null\n\t\t};\n\t} catch (error) {\n\t\tconst failure = CliStructuredError.is(error) ? error : new CliStructuredError(\"DEV.EMULATOR_FAILED\", error instanceof Error ? error.message : String(error), { cause: error });\n\t\treturn {\n\t\t\tkind,\n\t\t\trunning: true,\n\t\t\turl: lister.url,\n\t\t\tinstances: [],\n\t\t\terror: {\n\t\t\t\tcode: failure.code,\n\t\t\t\tmessage: failure.message\n\t\t\t}\n\t\t};\n\t}\n}\n/**\n* Every emulator, whether it runs, and its instances. Nothing running is a\n* valid answer, and an emulator that cannot be listed is reported in its own\n* entry; only an invalid emulators directory fails the whole listing.\n*/\nasync function listEmulators(opts = {}) {\n\ttry {\n\t\tconst emulators = [];\n\t\tfor (const kind of EMULATOR_KINDS) emulators.push(await listingOf(kind, opts));\n\t\treturn ok({ emulators });\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n}\n//#endregion\nexport { EMULATORS_DIR_ENV, EMULATOR_KINDS, bucketsClient, computeClient, daemonLogPath, daemonStateDir, defaultRegistryRoot, ensureDaemon, healthPathFor, isEmulatorRunning, listEmulators, postgresClient, readOwnVersion, readRegistryEntry, registryFilePath, stopDaemon };\n\n//# sourceMappingURL=index.mjs.map"],"x_google_ignoreList":[0,1,2,3,4,5,6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AC1B,OAAO;GACP;EACD,EAAE;CACH;AACD;AACA,eAAe,UAAU,MAAM,MAAM;CACpC,IAAI,CAAC,MAAM,kBAAkB,MAAM,IAAI,GAAG,OAAO;EAChD;EACA,SAAS;EACT,KAAK;EACL,WAAW,CAAC;EACZ,OAAO;CACR;CACA,MAAM,SAAS,SAAS,MAAM,IAAI;CAClC,IAAI;EACH,OAAO;GACN;GACA,SAAS;GACT,KAAK,OAAO;GACZ,WAAW,MAAM,OAAO,KAAK;GAC7B,OAAO;EACR;CACD,SAAS,OAAO;EACf,MAAM,UAAU,mBAAmB,GAAG,KAAK,IAAI,QAAQ,IAAI,mBAAmB,uBAAuB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,EAAE,OAAO,MAAM,CAAC;EAC7K,OAAO;GACN;GACA,SAAS;GACT,KAAK,OAAO;GACZ,WAAW,CAAC;GACZ,OAAO;IACN,MAAM,QAAQ;IACd,SAAS,QAAQ;GAClB;EACD;CACD;AACD;;;;;;AAMA,eAAe,cAAc,OAAO,CAAC,GAAG;CACvC,IAAI;EACH,MAAM,YAAY,CAAC;EACnB,KAAK,MAAM,QAAQ,gBAAgB,UAAU,KAAK,MAAM,UAAU,MAAM,IAAI,CAAC;EAC7E,OAAO,GAAG,EAAE,UAAU,CAAC;CACxB,SAAS,OAAO;EACf,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;EACpD,MAAM;CACP;AACD"}
@@ -1,6 +1,7 @@
1
1
  import { c as spawnAlchemy, d as ok, f as okVoid, l as CliStructuredError, m as blindCast, o as alchemyInvocation, r as noComposerExportMessage, s as reproduceCommand, u as notOk } from "./composer-config-CY9fET8H-CgnpfWc2.mjs";
2
- import { i as toStructured } from "./dev-CqS1W82b-BF0YJc6a.mjs";
3
- import { n as envVarSafeExtensionId, r as runPipeline, t as containerEnv } from "./container-transport-HcvNOGZL-ClGmzBIO.mjs";
2
+ import { o as toStructured } from "./dev-current-Bm7Yrsmt-TadtLg5x.mjs";
3
+ import { n as runPipeline } from "./pipeline-Dpesfd2j-DKL3f1bj.mjs";
4
+ import { n as envVarSafeExtensionId, t as containerEnv } from "./container-transport-HcvNOGZL-CIoZc7Rs.mjs";
4
5
  import * as fs from "node:fs";
5
6
  import * as path from "node:path";
6
7
  import { randomUUID } from "node:crypto";
@@ -130,7 +131,7 @@ function preflightEnv(payloads) {
130
131
  return env;
131
132
  }
132
133
  //#endregion
133
- //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-D4UdieU1.mjs
134
+ //#region ../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-BK4R2qCX.mjs
134
135
  /** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */
135
136
  const GENERATED_DIR = ".prisma-composer";
136
137
  const GENERATED_FILE = "alchemy.run.ts";
@@ -644,4 +645,4 @@ async function runStackPipelineInner(action, opts, reporters) {
644
645
  //#endregion
645
646
  export { executeDeploy, executeDestroy };
646
647
 
647
- //# sourceMappingURL=execute-deploy-destroy-D4UdieU1-C1P6X7uK.mjs.map
648
+ //# sourceMappingURL=execute-deploy-destroy-BK4R2qCX-DU6ITsO0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-deploy-destroy-BK4R2qCX-DU6ITsO0.mjs","names":[],"sources":["../../../0-framework/3-tooling/cli/dist/deployment-summary-37e6WEuh.mjs","../../../0-framework/3-tooling/cli/dist/run-report-C2o98uD-.mjs","../../../0-framework/1-core/core/dist/config.mjs","../../../0-framework/3-tooling/cli/dist/execute-deploy-destroy-BK4R2qCX.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport { format, stripVTControlCharacters } from \"node:util\";\nimport { blindCast } from \"@internal/foundation/casts\";\n//#region src/deployment-summary.ts\n/**\n* The deploy result's cross-process protocol, whole in one place: the\n* serializable shape, the env var that names the carrier file, the writer the\n* report hook calls from inside the alchemy child, and the reader the deploy\n* operation runs after the child exits. `DeploymentResult` itself cannot\n* cross the boundary — its `DeployedNode` entries hold live graph-node\n* references (ADR-0033) — so the writer projects it down to what CAN.\n*\n* The summary is best-effort by contract: the writer never fails the child\n* over it, and the reader maps absent or malformed to `undefined`. So is the\n* failure cause the child leaves beside it when it exits non-zero.\n*/\n/** Env var the deploy operation sets on the alchemy child: when present,\n* the report hook also writes the JSON DeploymentSummary there. */\nconst DEPLOYMENT_RESULT_FILE_ENV = \"PRISMA_COMPOSER_DEPLOYMENT_RESULT_FILE\";\n/** Pure projection: keeps app + each node's address/entities, drops the in-process `node`. */\nfunction toDeploymentSummary(result) {\n\treturn {\n\t\tapp: result.app,\n\t\tnodes: result.nodes.map((node) => ({\n\t\t\taddress: node.address,\n\t\t\tentities: node.entities\n\t\t}))\n\t};\n}\n/**\n* Writer half, called by the report hook inside the alchemy child: when the\n* env var names a file, write the summary there. Best-effort — a write\n* failure must not fail a deploy that already converged, so it is swallowed.\n*/\nfunction writeDeploymentSummaryFile(result) {\n\tconst file = process.env[DEPLOYMENT_RESULT_FILE_ENV];\n\tif (file === void 0 || file.length === 0) return;\n\ttry {\n\t\tfs.writeFileSync(file, JSON.stringify(toDeploymentSummary(result)));\n\t} catch {}\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null;\n}\n/**\n* Reader half, run by the deploy operation after the child exits. Absent or\n* malformed → undefined — the summary is best-effort, never a deploy failure.\n*/\nfunction readDeploymentSummary(resultFilePath) {\n\tlet raw;\n\ttry {\n\t\traw = fs.readFileSync(resultFilePath, \"utf8\");\n\t} catch {\n\t\treturn;\n\t}\n\tlet parsed;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\treturn;\n\t}\n\tif (!isRecord(parsed) || typeof parsed[\"app\"] !== \"string\" || !Array.isArray(parsed[\"nodes\"])) return;\n\tfor (const node of parsed[\"nodes\"]) {\n\t\tif (!isRecord(node) || typeof node[\"address\"] !== \"string\" || !Array.isArray(node[\"entities\"])) return;\n\t\tfor (const entity of node[\"entities\"]) if (!isRecord(entity) || typeof entity[\"kind\"] !== \"string\" || typeof entity[\"id\"] !== \"string\") return;\n\t}\n\treturn blindCast(parsed);\n}\n/** The child's failure cause rides beside the result file, so the one env var names both and the parent's cleanup removes both. */\nfunction engineFailureFilePath(resultFilePath) {\n\treturn `${resultFilePath}.failure.txt`;\n}\n/** Fits the platform's 5000-character build `errorMessage` with room for the exit-status prefix. */\nconst ENGINE_FAILURE_CAUSE_LIMIT = 1e3;\n/**\n* Child half of the failure protocol, called by the generated stack file.\n* Keeps a bounded tail of everything this process logs through `console`,\n* passing every call through untouched, and on a non-zero exit writes the\n* redacted cause beside the result file. `console`, not the output streams:\n* alchemy's logger and its error reporting both go through it, and under Bun\n* `console` does not reach `process.stdout.write`.\n*/\nfunction captureEngineFailure() {\n\tconst resultFile = process.env[DEPLOYMENT_RESULT_FILE_ENV];\n\tif (resultFile === void 0 || resultFile.length === 0) return;\n\tlet tail = \"\";\n\tfor (const method of [\n\t\t\"log\",\n\t\t\"info\",\n\t\t\"warn\",\n\t\t\"error\",\n\t\t\"debug\"\n\t]) {\n\t\tconst original = console[method];\n\t\tconsole[method] = (...args) => {\n\t\t\ttail = `${tail}${redactSecrets(format(...args), process.env)}\\n`.slice(-65536);\n\t\t\toriginal.apply(console, args);\n\t\t};\n\t}\n\tprocess.once(\"exit\", (code) => {\n\t\tif (code === 0) return;\n\t\tconst cause = engineFailureCause(tail, process.env);\n\t\tif (cause === void 0) return;\n\t\ttry {\n\t\t\tfs.writeFileSync(engineFailureFilePath(resultFile), cause);\n\t\t} catch {}\n\t});\n}\n/** Parent half: the cause the child recorded, or undefined when it recorded none. */\nfunction readEngineFailureCause(resultFilePath) {\n\ttry {\n\t\tconst cause = fs.readFileSync(engineFailureFilePath(resultFilePath), \"utf8\");\n\t\treturn cause.length > 0 ? cause : void 0;\n\t} catch {\n\t\treturn;\n\t}\n}\n/** Effect's pretty log prefix, e.g. `[10:29:16.556] INFO (#53): `. */\nconst LOG_PREFIX = /^\\[[\\d:.]+\\] ([A-Z]+) \\(#\\d+\\): ?/;\n/** Alchemy's per-resource failure row, e.g. `[web] fail — UnknownError: …`. */\nconst RESOURCE_FAIL_ROW = /^\\[[^\\]]+\\] fail\\b/;\nconst STACK_FRAME = /^\\s*at /;\n/**\n* The failure the output describes: every line from the first failure line\n* (a failed resource row, an ERROR log, or an `error:` line) to the end, minus\n* blank lines, stack frames and info logs; the last five lines when there is no\n* failure line. Redacted, then capped.\n*/\nfunction engineFailureCause(output, env) {\n\tconst lines = [];\n\tfor (const raw of stripVTControlCharacters(output).split(/\\r\\n|\\r|\\n/)) {\n\t\tconst clean = raw.replace(/(?![\\t])\\p{Cc}/gu, \"\").trimEnd();\n\t\tconst prefix = LOG_PREFIX.exec(clean);\n\t\tconst text = (prefix === null ? clean : clean.slice(prefix[0].length)).trim();\n\t\tif (text.length === 0 || text === \"{\" || text === \"}\" || STACK_FRAME.test(text)) continue;\n\t\tconst level = prefix?.[1];\n\t\tconst failure = level === \"ERROR\" || level === \"FATAL\" || RESOURCE_FAIL_ROW.test(text) || /^\\W*error:/i.test(text);\n\t\tlines.push({\n\t\t\ttext,\n\t\t\tfailure,\n\t\t\tinfo: !failure && level !== void 0\n\t\t});\n\t}\n\tconst start = lines.findIndex((line) => line.failure);\n\tconst kept = start === -1 ? lines.slice(-5) : lines.slice(start).filter((line) => !line.info);\n\tif (kept.length === 0) return void 0;\n\tconst cause = redactSecrets(kept.map((line) => line.text).join(\"\\n\"), env);\n\treturn cause.length <= ENGINE_FAILURE_CAUSE_LIMIT ? cause : `${cause.slice(0, ENGINE_FAILURE_CAUSE_LIMIT - 1)}…`;\n}\n/** Env var names whose values are credentials: the service token, preflight payloads, and the usual secret spellings. */\nconst SECRET_ENV_NAME = /TOKEN|SECRET|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|AUTH|API_?KEY|ACCESS_?KEY|_KEY$|DATABASE_URL|_DSN$|^PRISMA_COMPOSER_PREFLIGHT_/i;\nconst REDACTED = \"[redacted]\";\n/**\n* Removes credentials from text that is about to leave the machine: the value\n* of every secret-named env var, bearer/basic tokens, JWTs, the password in a\n* URL, and `token=…`-style pairs. Values shorter than 8 characters are left,\n* so a one-letter placeholder does not blank every matching letter.\n*/\nfunction redactSecrets(text, env) {\n\tconst values = Object.entries(env).filter(([name, value]) => SECRET_ENV_NAME.test(name) && (value ?? \"\").length >= 8).map(([, value]) => value ?? \"\").sort((a, b) => b.length - a.length);\n\tlet redacted = text;\n\tfor (const value of values) redacted = redacted.replaceAll(value, REDACTED);\n\treturn redacted.replace(/\\b(Bearer|Basic)\\s+[\\w.~+/=-]+/gi, `$1 ${REDACTED}`).replace(/\\beyJ[\\w-]+\\.[\\w-]+\\.[\\w-]*/g, REDACTED).replace(/(\\b[a-z][\\w+.-]*:\\/\\/[^\\s:/@]*:)[^\\s/@]+@/gi, `$1${REDACTED}@`).replace(/\\b((?:[\\w-]*[_-])?(?:token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key)[\"']?\\s*[:=]\\s*[\"']?)[^\\s\"',;&]+/gi, `$1${REDACTED}`);\n}\n//#endregion\nexport { readEngineFailureCause as a, readDeploymentSummary as i, captureEngineFailure as n, writeDeploymentSummaryFile as o, engineFailureFilePath as r, DEPLOYMENT_RESULT_FILE_ENV as t };\n\n//# sourceMappingURL=deployment-summary-37e6WEuh.mjs.map","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n//#region src/run-report.ts\n/**\n* The run report: one deploy's outcome as JSON, for tools that consume a\n* deploy rather than watch one — the Prisma GitHub Action reads it to build a\n* pull-request comment carrying preview links.\n*\n* Deliberately separate from `deployment-summary.ts`. That file is a private\n* carrier between the alchemy child and this process, written to a\n* per-run path the parent deletes in a `finally` so resource ids and URLs do\n* not accumulate on disk. This one is written where the operator asked for\n* it, survives the run, is written on the failure path too, and carries a\n* version so a consumer can depend on its shape.\n*/\n/** Bump when a change would break a consumer that reads the current shape. */\nconst RUN_REPORT_VERSION = 1;\n/** Names the file to write the run report to, when `--report` is not passed. */\nconst RUN_REPORT_FILE_ENV = \"PRISMA_COMPOSER_REPORT_FILE\";\nfunction toRunReport(input) {\n\treturn {\n\t\tversion: 1,\n\t\toutcome: input.failure === void 0 ? \"succeeded\" : \"failed\",\n\t\tapp: input.summary?.app ?? null,\n\t\tstage: input.stage ?? null,\n\t\tnodes: input.summary?.nodes ?? [],\n\t\tfailure: input.failure ?? null\n\t};\n}\n/**\n* The path to write to: the `--report` flag first, then the env var. Relative\n* paths resolve against the deploy's cwd. `undefined` means no report was\n* asked for, which is the common case and writes nothing.\n*/\nfunction resolveRunReportPath(flag, env, cwd) {\n\tconst requested = flag !== void 0 && flag.length > 0 ? flag : env;\n\tif (requested === void 0 || requested.length === 0) return void 0;\n\treturn path.resolve(cwd, requested);\n}\n/**\n* Writes the report, creating the parent directory if needed. A write failure\n* warns and returns false rather than failing a deploy that already\n* converged — but it is never silent, because the operator asked for this\n* file and a consumer is waiting on it.\n*/\nfunction writeRunReport(filePath, report) {\n\ttry {\n\t\tfs.mkdirSync(path.dirname(filePath), { recursive: true });\n\t\tfs.writeFileSync(filePath, `${JSON.stringify(report, null, 2)}\\n`);\n\t\treturn true;\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(`\\nCould not write the run report to ${filePath}: ${detail}`);\n\t\treturn false;\n\t}\n}\n//#endregion\nexport { writeRunReport as a, toRunReport as i, RUN_REPORT_VERSION as n, resolveRunReportPath as r, RUN_REPORT_FILE_ENV as t };\n\n//# sourceMappingURL=run-report-C2o98uD-.mjs.map","import { i as envVarSafeExtensionId, n as containerEnvVarName, r as deserializeContainers, t as containerEnv } from \"./container-transport-HcvNOGZL.mjs\";\nimport { n as defineConfig, r as isBuildOnlyExtension, t as DEV_DIR } from \"./app-config-CGJHcFb-.mjs\";\n//#region src/preflight-transport.ts\n/**\n* Carries an extension's deploy-preflight payload from the CLI process to the\n* alchemy child (which re-imports the config from scratch) — one env var per\n* extension, same channel as containers (container-transport.ts). The\n* framework never reads the contents. Payloads carry metadata only, never\n* secret values: the child's environment is not a secret store.\n*/\n/** '@prisma/composer-prisma-cloud' → 'PRISMA_COMPOSER_PREFLIGHT_PRISMA_COMPOSER_PRISMA_CLOUD' */\nfunction preflightEnvVarName(extensionId) {\n\treturn `PRISMA_COMPOSER_PREFLIGHT_${envVarSafeExtensionId(extensionId)}`;\n}\n/** The env entries the CLI sets on the alchemy process: `{ [preflightEnvVarName(id)]: payload }` for every extension whose preflight returned one. */\nfunction preflightEnv(payloads) {\n\tconst env = {};\n\tconst ownerByVarName = /* @__PURE__ */ new Map();\n\tfor (const [extensionId, payload] of payloads) {\n\t\tif (payload.length === 0) continue;\n\t\tconst varName = preflightEnvVarName(extensionId);\n\t\tconst owner = ownerByVarName.get(varName);\n\t\tif (owner !== void 0) throw new Error(`Extension ids \"${owner}\" and \"${extensionId}\" both map to the preflight transport variable \"${varName}\" — rename one of the extensions.`);\n\t\townerByVarName.set(varName, extensionId);\n\t\tenv[varName] = payload;\n\t}\n\treturn env;\n}\n/** The alchemy-process side: the payload this extension's own preflight wrote, or `undefined` when it wrote none (or when nothing ran a preflight at all). */\nfunction readPreflightPayload(extensionId, env) {\n\tconst payload = env[preflightEnvVarName(extensionId)];\n\treturn payload === void 0 || payload.length === 0 ? void 0 : payload;\n}\n//#endregion\nexport { DEV_DIR, containerEnv, containerEnvVarName, defineConfig, deserializeContainers, isBuildOnlyExtension, preflightEnv, preflightEnvVarName, readPreflightPayload };\n\n//# sourceMappingURL=config.mjs.map","import { a as readEngineFailureCause, i as readDeploymentSummary, r as engineFailureFilePath, t as DEPLOYMENT_RESULT_FILE_ENV } from \"./deployment-summary-37e6WEuh.mjs\";\nimport { l as toStructured } from \"./dev-current-Bm7Yrsmt.mjs\";\nimport { a as writeRunReport, i as toRunReport, r as resolveRunReportPath, t as RUN_REPORT_FILE_ENV } from \"./run-report-C2o98uD-.mjs\";\nimport { i as spawnAlchemy, n as alchemyInvocation, r as reproduceCommand } from \"./run-alchemy-BqHpStQn.mjs\";\nimport { r as noComposerExportMessage } from \"./composer-config-CY9fET8H.mjs\";\nimport { r as runPipeline } from \"./pipeline-Dpesfd2j.mjs\";\nimport * as fs from \"node:fs\";\nimport { notOk, ok, okVoid } from \"@internal/foundation/result\";\nimport { CliStructuredError } from \"@internal/foundation/errors\";\nimport * as path from \"node:path\";\nimport { randomUUID } from \"node:crypto\";\nimport { containerEnv, preflightEnv, preflightEnvVarName } from \"@internal/core/config\";\nimport { spawnSync } from \"node:child_process\";\n//#region src/generate-stack.ts\n/** Pipeline step 6: writes a regenerated-every-run, independently runnable stack module at `.prisma-composer/alchemy.run.ts`. */\nconst GENERATED_DIR = \".prisma-composer\";\nconst GENERATED_FILE = \"alchemy.run.ts\";\n/** A relative import specifier from `.prisma-composer/alchemy.run.ts` to `target` (posix separators). */\nfunction relativeImportSpecifier(generatedDir, target) {\n\tconst rel = path.relative(generatedDir, target).split(path.sep).join(\"/\");\n\treturn rel.startsWith(\".\") ? rel : `./${rel}`;\n}\nfunction quote(value) {\n\treturn JSON.stringify(value);\n}\nfunction renderBundle(bundle) {\n\treturn `{ dir: ${quote(bundle.dir)}, entry: ${quote(bundle.entry)} }`;\n}\nfunction renderOptions(input) {\n\tconst lines = [];\n\tlines.push(` name: ${quote(input.name)},`);\n\tlines.push(\" bundles: {\");\n\tfor (const [id, bundle] of Object.entries(input.assembled.bundles)) lines.push(` ${quote(id)}: ${renderBundle(bundle)},`);\n\tlines.push(\" },\");\n\tlines.push(\" report: report.deploymentReport,\");\n\treturn lines.join(\"\\n\");\n}\n/** Renders the stack module's source (tests assert on it without touching disk) — uses `//` headers, not a block comment, since a cwd path with a star-slash could close one early. */\nfunction renderStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tconst appImport = relativeImportSpecifier(generatedDir, input.entryPath);\n\tconst configImport = relativeImportSpecifier(generatedDir, input.configFile);\n\treturn `// Generated by Composer's deploy and destroy operations — overwritten on every\n// run; do not edit by hand. Runnable from ${quote(input.cwd)} WITH the env the\n// CLI passes its child (the PRISMA_COMPOSER_CONTAINER_*/_PREFLIGHT_* vars —\n// without them lower() refuses because no container is resolved), by the\n// command Composer starts, which a failed run prints:\n//\n// <node> <bin of the alchemy @prisma/composer depends on> deploy ${GENERATED_DIR}/${GENERATED_FILE} --yes --stage <stage>\n//\n// bisects a CLI bug from an Alchemy bug (deploy-cli.md § Implementation decisions).\nimport { lower } from '@prisma/composer/deploy';\nimport * as report from '@prisma/composer/report';\nimport prismaConfig from ${quote(configImport)};\nimport app from ${quote(appImport)};\n\nconst config = prismaConfig.composer;\nif (config === undefined) {\n throw new Error(${quote(noComposerExportMessage(input.configFile))});\n}\n\n// The app's own @prisma/composer may predate the failure recorder.\nreport.captureEngineFailure?.();\n\nexport default lower(app, config, {\n${renderOptions(input)}\n});\n`;\n}\n/** Writes the stack file, returning its absolute path. */\nfunction writeStackFile(input) {\n\tconst generatedDir = path.join(input.cwd, GENERATED_DIR);\n\tfs.mkdirSync(generatedDir, { recursive: true });\n\tconst filePath = path.join(generatedDir, GENERATED_FILE);\n\tfs.writeFileSync(filePath, renderStackFile(input));\n\treturn filePath;\n}\nconst GENERATED_STACK_RELATIVE_PATH = path.join(GENERATED_DIR, GENERATED_FILE);\n//#endregion\n//#region src/validate-stage.ts\n/** A stage name must be a valid git ref (deploy-cli.md) — checked via `git check-ref-format`, never silently normalized. Runs before anything platform-specific. */\nfunction validateStageName(stage) {\n\tconst result = spawnSync(\"git\", [\"check-ref-format\", `refs/heads/${stage}`], { stdio: \"ignore\" });\n\tif (result.error) throw new CliStructuredError(\"DEPLOY.STAGE_UNVALIDATABLE\", `git is required to validate --stage \"${stage}\" (git check-ref-format): ${result.error.message}.`, { cause: result.error });\n\tif (result.status !== 0) throw new CliStructuredError(\"DEPLOY.STAGE_INVALID\", `Invalid --stage \"${stage}\": must be a valid git ref name (git check-ref-format rejected \"refs/heads/${stage}\").`);\n}\n//#endregion\n//#region src/operations/execute-deploy-destroy.ts\n/**\n* The deploy/destroy executor — main.ts's pipeline orchestration with argv,\n* console, and exit codes removed: typed inputs in, structured results out.\n* Reached only by lazy import from deploy.ts/destroy.ts — this module's\n* static graph transitively loads alchemy's provider tree, so the control\n* entry must never import it statically.\n*/\nconst ALCHEMY_STATE_DIR = \".alchemy\";\n/** Destroy guardrail (moved from main.ts): true when `<cwd>/.alchemy` is missing or empty — likely wrong directory or nothing deployed yet. */\nfunction hasNoLocalDeployState(cwd) {\n\tconst stateDir = path.join(cwd, ALCHEMY_STATE_DIR);\n\treturn !(fs.existsSync(stateDir) && fs.readdirSync(stateDir).length > 0);\n}\n/**\n* Times each deploy step for the host's `onEvent`. A step still open when the\n* run fails is closed as failed, innermost first. A host `onEvent` that throws\n* is the host's bug and cannot fail the deploy.\n*/\nfunction deploySteps(onEvent) {\n\tconst open = /* @__PURE__ */ new Map();\n\tconst keyOf = (step) => step.name === \"assemble-service\" ? `${step.name}:${step.address}` : step.name;\n\tconst emit = (event) => {\n\t\ttry {\n\t\t\tonEvent?.(event);\n\t\t} catch {}\n\t};\n\tconst finish = (step, outcome, data) => {\n\t\tconst entry = open.get(keyOf(step));\n\t\tif (entry === void 0) return;\n\t\topen.delete(keyOf(step));\n\t\tconst durationMs = Math.round(performance.now() - entry.startedAt);\n\t\temit({\n\t\t\tkind: \"step-finished\",\n\t\t\tstep,\n\t\t\toutcome,\n\t\t\tdurationMs,\n\t\t\tdata\n\t\t});\n\t};\n\treturn {\n\t\tstart(step) {\n\t\t\topen.set(keyOf(step), {\n\t\t\t\tstep,\n\t\t\t\tstartedAt: performance.now()\n\t\t\t});\n\t\t\temit({\n\t\t\t\tkind: \"step-started\",\n\t\t\t\tstep\n\t\t\t});\n\t\t},\n\t\tfinish(step, data) {\n\t\t\tfinish(step, \"ok\", data);\n\t\t},\n\t\tfail(step) {\n\t\t\tfinish(step, \"failed\");\n\t\t},\n\t\tfailOpen() {\n\t\t\tfor (const { step } of [...open.values()].reverse()) finish(step, \"failed\");\n\t\t}\n\t};\n}\nasync function executeDeploy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"deploy\", {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tstage: input.stage,\n\t\tcwd,\n\t\tonEvent: void 0,\n\t\tdeps,\n\t\treportId: input.reportId,\n\t\treportPath: resolveRunReportPath(input.reportPath, process.env[RUN_REPORT_FILE_ENV], cwd),\n\t\tsteps: deploySteps(input.onEvent)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn ok({ summary: outcome.value });\n}\nasync function executeDestroy(input, deps, cwd) {\n\tconst outcome = await runStackPipeline(\"destroy\", {\n\t\tentry: input.entry,\n\t\tconfig: input.config,\n\t\tname: input.name,\n\t\tstage: input.target.kind === \"stage\" ? input.target.stage : void 0,\n\t\tcwd,\n\t\tonEvent: input.onEvent,\n\t\tdeps,\n\t\treportId: void 0,\n\t\treportPath: void 0,\n\t\tsteps: deploySteps(void 0)\n\t});\n\tif (!outcome.ok) return outcome;\n\treturn okVoid();\n}\n/**\n* Opens a session per extension that declares a reporter. A `begin` that\n* throws costs that extension its reporting and nothing else — the deploy\n* has not started, and refusing to run it because an observer failed would\n* invert the relationship.\n*/\nasync function beginReporters(extensions, context) {\n\treturn (await Promise.all(extensions.map(async (extension) => {\n\t\tif (extension.reporter === void 0) return void 0;\n\t\ttry {\n\t\t\tconst reporter = await extension.reporter.begin(context);\n\t\t\treturn reporter === void 0 ? void 0 : {\n\t\t\t\textensionId: extension.id,\n\t\t\t\treporter\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not start deploy reporting for ${extension.id}: ${detail}`);\n\t\t\treturn;\n\t\t}\n\t}))).filter((entry) => entry !== void 0);\n}\n/** Hands each session its own extension's resolved container, so it can attach the run to what that container names. */\nasync function attachReporters(reporters, containers) {\n\tawait Promise.all(reporters.map(async ({ extensionId, reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.attach({ container: containers.get(extensionId) });\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not attach this deploy to its project for ${extensionId}: ${detail}`);\n\t\t}\n\t}));\n}\n/** Every session's contribution to the alchemy child's environment, so reporting that happens inside the apply can find the run. */\nfunction reporterChildEnv(reporters) {\n\tconst env = {};\n\tfor (const { extensionId, reporter } of reporters) try {\n\t\tObject.assign(env, reporter.childEnv());\n\t} catch (error) {\n\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\tconsole.warn(`\\nCould not pass deploy reporting into the apply for ${extensionId}: ${detail}`);\n\t}\n\treturn env;\n}\n/** `failingStep` is capped at 500 by the platform and `errorMessage` at 5000; truncating here keeps a long message from costing the whole report. */\nfunction truncate(value, limit) {\n\treturn value.length <= limit ? value : `${value.slice(0, limit - 1)}…`;\n}\n/** An interrupted converge (the engine settled a Ctrl-C) — reported as `cancelled`, never as `failed`. */\nfunction wasInterrupted(failure) {\n\treturn typeof failure.meta?.[\"signal\"] === \"string\";\n}\n/**\n* Ends every reporting session, whatever the run did. Sessions never reject\n* by contract, but a buggy one must not turn a converged deploy into a\n* failure — so this swallows anyway, and reports each session independently\n* so one bad implementation cannot silence another.\n*/\nasync function finishReporters(reporters, outcome) {\n\tconst entities = outcome.summary?.nodes.flatMap((node) => node.entities) ?? [];\n\tawait Promise.all(reporters.map(async ({ reporter }) => {\n\t\ttry {\n\t\t\tawait reporter.finish({\n\t\t\t\tok: outcome.ok,\n\t\t\t\tcancelled: outcome.cancelled,\n\t\t\t\tfailingStep: outcome.code === void 0 ? void 0 : truncate(outcome.code, 500),\n\t\t\t\terrorMessage: outcome.message === void 0 ? void 0 : truncate(outcome.message, 5e3),\n\t\t\t\tentities\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tconst detail = error instanceof Error ? error.message : String(error);\n\t\t\tconsole.warn(`\\nCould not report this deploy's outcome: ${detail}`);\n\t\t}\n\t}));\n}\n/**\n* Owns the reporting sessions around the pipeline: the inner run opens them\n* once it knows which extensions are configured, and this closes them on\n* every exit path — a returned failure, a success, or a thrown defect — as\n* the `record` step, which also writes the run report.\n* Nothing here can change what the pipeline returns.\n*/\nasync function runStackPipeline(action, opts) {\n\tconst reporters = [];\n\tlet outcome;\n\ttry {\n\t\toutcome = await runStackPipelineInner(action, opts, reporters);\n\t} catch (error) {\n\t\topts.steps.failOpen();\n\t\topts.steps.start({ name: \"record\" });\n\t\tawait finishReporters(reporters, {\n\t\t\tok: false,\n\t\t\tcancelled: false,\n\t\t\tcode: \"DEPLOY.UNEXPECTED\",\n\t\t\tmessage: error instanceof Error ? error.message : String(error)\n\t\t});\n\t\topts.steps.finish({ name: \"record\" });\n\t\tthrow error;\n\t}\n\tif (!outcome.ok) opts.steps.failOpen();\n\topts.steps.start({ name: \"record\" });\n\tawait finishReporters(reporters, outcome.ok ? {\n\t\tok: true,\n\t\tcancelled: false,\n\t\tsummary: outcome.value\n\t} : {\n\t\tok: false,\n\t\tcancelled: wasInterrupted(outcome.failure),\n\t\tcode: outcome.failure.code,\n\t\tmessage: outcome.failure.message\n\t});\n\tif (opts.reportPath === void 0 || writeRunReport(opts.reportPath, toRunReport({\n\t\tsummary: outcome.ok ? outcome.value : void 0,\n\t\tstage: opts.stage,\n\t\tfailure: outcome.ok ? void 0 : {\n\t\t\tcode: outcome.failure.code,\n\t\t\tmessage: outcome.failure.message\n\t\t}\n\t}))) opts.steps.finish({ name: \"record\" });\n\telse opts.steps.fail({ name: \"record\" });\n\treturn outcome;\n}\n/** The pipeline both actions share: validate, resolve containers, preflight,\n* write the stack file, run alchemy against it, then the destroy-only\n* teardown/removal suffix. The value is only ever a summary for deploy. */\nasync function runStackPipelineInner(action, opts, reporters) {\n\tconst { entry, config: composerConfig, name, stage, cwd, onEvent, deps, steps } = opts;\n\tsteps.start({ name: \"prepare\" });\n\tif (stage !== void 0) try {\n\t\tvalidateStageName(stage);\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tif (action === \"destroy\" && hasNoLocalDeployState(cwd)) onEvent?.({\n\t\tkind: \"no-local-deploy-state\",\n\t\tcwd\n\t});\n\tlet pipeline;\n\tlet containers;\n\tlet alchemyStage;\n\tconst preflightPayloads = /* @__PURE__ */ new Map();\n\tlet preflightTransportEnv = {};\n\ttry {\n\t\tpipeline = await runPipeline(entry, name, cwd, composerConfig, {\n\t\t\trunAssembler: deps.runAssembler,\n\t\t\tonEvent: (event) => {\n\t\t\t\tswitch (event.kind) {\n\t\t\t\t\tcase \"loaded\":\n\t\t\t\t\t\tsteps.finish({ name: \"prepare\" });\n\t\t\t\t\t\tsteps.start({ name: \"assemble\" });\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-started\":\n\t\t\t\t\t\tsteps.start({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn;\n\t\t\t\t\tcase \"service-assembled\":\n\t\t\t\t\t\tsteps.finish({\n\t\t\t\t\t\t\tname: \"assemble-service\",\n\t\t\t\t\t\t\taddress: event.address\n\t\t\t\t\t\t}, event.data);\n\t\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}, action === \"destroy\" ? (error) => new CliStructuredError(\"DEPLOY.BUILD_REQUIRED\", error.message, {\n\t\t\twhy: \"destroy evaluates the same stack program as deploy, which packages the built artifacts — so the app must be built first.\",\n\t\t\tfix: \"Run the build, then retry the destroy.\",\n\t\t\tcause: error\n\t\t}) : void 0);\n\t\tsteps.finish({ name: \"assemble\" });\n\t\tconst { graph, name: resolvedName } = pipeline;\n\t\tconst config = pipeline.configSource.value;\n\t\tsteps.start({ name: \"connect\" });\n\t\tif (action === \"deploy\") reporters.push(...await beginReporters(config.extensions, {\n\t\t\tappName: resolvedName,\n\t\t\tgraph,\n\t\t\tstage,\n\t\t\tcwd,\n\t\t\treportId: opts.reportId,\n\t\t\tcredentials: deps.credentials\n\t\t}));\n\t\tcontainers = /* @__PURE__ */ new Map();\n\t\tfor (const extension of config.extensions) {\n\t\t\tif (extension.container === void 0) continue;\n\t\t\ttry {\n\t\t\t\tif (action === \"deploy\") containers.set(extension.id, await extension.container.ensure({\n\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\tstage\n\t\t\t\t}, deps.credentials));\n\t\t\t\telse {\n\t\t\t\t\tconst instance = await extension.container.locate({\n\t\t\t\t\t\tappName: resolvedName,\n\t\t\t\t\t\tstage\n\t\t\t\t\t}, deps.credentials);\n\t\t\t\t\tif (instance === void 0) throw new CliStructuredError(\"DEPLOY.TARGET_NOT_FOUND\", `Nothing deployed for ${resolvedName}${stage !== void 0 ? `/${stage}` : \"\"}.`, { fix: \"Deploy it first.\" });\n\t\t\t\t\tcontainers.set(extension.id, instance);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_FAILED\", error);\n\t\t\t}\n\t\t}\n\t\tawait attachReporters(reporters, containers);\n\t\tconst pinnedStage = containers.get(config.state.extension)?.alchemyStage ?? stage;\n\t\tif (pinnedStage === void 0) throw new CliStructuredError(\"DEPLOY.SCOPE_MISSING\", \"The configured deploy target supplied no deploy scope (its container defines no alchemyStage), so Alchemy has no stage to run under.\", { fix: action === \"deploy\" ? \"Pass --stage <name> to choose the deploy scope explicitly.\" : \"Destroying production needs a target whose container supplies the production deploy scope.\" });\n\t\talchemyStage = pinnedStage;\n\t\tsteps.finish({ name: \"connect\" });\n\t\tif (action === \"deploy\") {\n\t\t\tsteps.start({ name: \"preflight\" });\n\t\t\tconst counts = {};\n\t\t\tconst report = (reported) => {\n\t\t\t\tfor (const [key, value] of Object.entries(reported)) counts[key] = (counts[key] ?? 0) + value;\n\t\t\t};\n\t\t\tfor (const extension of config.extensions) {\n\t\t\t\tif (extension.preflight === void 0) continue;\n\t\t\t\ttry {\n\t\t\t\t\tconst payload = await extension.preflight({\n\t\t\t\t\t\tgraph,\n\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\tstage,\n\t\t\t\t\t\tcredentials: deps.credentials,\n\t\t\t\t\t\treport\n\t\t\t\t\t});\n\t\t\t\t\tif (payload !== void 0) preflightPayloads.set(extension.id, payload);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t\t}\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tpreflightTransportEnv = preflightEnv(preflightPayloads);\n\t\t\t} catch (error) {\n\t\t\t\tthrow toStructured(\"DEPLOY.PREFLIGHT_FAILED\", error);\n\t\t\t}\n\t\t\tsteps.finish({ name: \"preflight\" }, counts);\n\t\t}\n\t\tfor (const extension of config.extensions) preflightTransportEnv[preflightEnvVarName(extension.id)] ??= \"\";\n\t} catch (error) {\n\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\tthrow error;\n\t}\n\tlet stackPath;\n\tconst resultFilePath = path.join(cwd, \".prisma-composer\", `deployment-result-${String(process.pid)}-${randomUUID()}.json`);\n\ttry {\n\t\ttry {\n\t\t\tstackPath = writeStackFile({\n\t\t\t\tentryPath: pipeline.entryModule.path,\n\t\t\t\tcwd,\n\t\t\t\tconfigFile: pipeline.configSource.file,\n\t\t\t\tname: pipeline.name,\n\t\t\t\tassembled: pipeline.assembled\n\t\t\t});\n\t\t} catch (error) {\n\t\t\treturn notOk(toStructured(\"DEPLOY.STACK_WRITE_FAILED\", error));\n\t\t}\n\t\tconst invocation = alchemyInvocation({\n\t\t\tcommand: action,\n\t\t\tstackFileRelativePath: GENERATED_STACK_RELATIVE_PATH,\n\t\t\tcwd,\n\t\t\tstage: alchemyStage,\n\t\t\tcontainerEnv: containerEnv(containers),\n\t\t\tpreflightEnv: preflightTransportEnv,\n\t\t\tenv: {\n\t\t\t\t...reporterChildEnv(reporters),\n\t\t\t\t[DEPLOYMENT_RESULT_FILE_ENV]: resultFilePath\n\t\t\t}\n\t\t});\n\t\tsteps.start({ name: \"apply\" });\n\t\tlet outcome;\n\t\ttry {\n\t\t\toutcome = await (deps.alchemy ?? spawnAlchemy)(invocation);\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", error instanceof Error ? error.message : String(error), {\n\t\t\t\tcause: error,\n\t\t\t\tmeta: { diagnostics: {\n\t\t\t\t\texitCode: void 0,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand: reproduceCommand(invocation),\n\t\t\t\t\tcwd\n\t\t\t\t} }\n\t\t\t}));\n\t\t}\n\t\tconst reproduce = reproduceCommand(invocation, outcome);\n\t\tif (outcome.signal !== null) return notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", `alchemy ${action} was interrupted by ${outcome.signal}.`, { meta: {\n\t\t\tsignal: outcome.signal,\n\t\t\tdiagnostics: {\n\t\t\t\texitCode: void 0,\n\t\t\t\tsignal: outcome.signal,\n\t\t\t\tstackFilePath: stackPath,\n\t\t\t\treproduceCommand: reproduce,\n\t\t\t\tcwd\n\t\t\t}\n\t\t} }));\n\t\tconst status = outcome.exitCode ?? 1;\n\t\tif (status !== 0) {\n\t\t\tconst engineCause = readEngineFailureCause(resultFilePath);\n\t\t\tconst withCause = (sentence) => engineCause === void 0 ? sentence : `${sentence}\\n${engineCause}`;\n\t\t\treturn notOk(new CliStructuredError(\"DEPLOY.ENGINE_FAILED\", withCause(`alchemy ${action} exited with status ${status}.`), { meta: {\n\t\t\t\texitCode: status,\n\t\t\t\t...engineCause !== void 0 ? { engineCause } : {},\n\t\t\t\tdiagnostics: {\n\t\t\t\t\texitCode: status,\n\t\t\t\t\tstackFilePath: stackPath,\n\t\t\t\t\treproduceCommand: reproduce,\n\t\t\t\t\tcwd\n\t\t\t\t}\n\t\t\t} }));\n\t\t}\n\t\tsteps.finish({ name: \"apply\" });\n\t\ttry {\n\t\t\tif (action === \"destroy\") {\n\t\t\t\tfor (const extension of pipeline.configSource.value.extensions) {\n\t\t\t\t\tif (extension.teardown === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.teardown({\n\t\t\t\t\t\t\tcontainer: containers.get(extension.id),\n\t\t\t\t\t\t\tstage\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.TEARDOWN_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const extension of pipeline.configSource.value.extensions) {\n\t\t\t\t\tif (extension.container === void 0) continue;\n\t\t\t\t\tconst instance = containers.get(extension.id);\n\t\t\t\t\tif (instance === void 0) continue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait extension.container.remove(instance, deps.credentials);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow toStructured(\"DEPLOY.CONTAINER_REMOVE_FAILED\", error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (CliStructuredError.is(error)) return notOk(error);\n\t\t\tthrow error;\n\t\t}\n\t\tif (action === \"deploy\") return ok(readDeploymentSummary(resultFilePath));\n\t\treturn ok(void 0);\n\t} finally {\n\t\ttry {\n\t\t\tfs.rmSync(resultFilePath, { force: true });\n\t\t\tfs.rmSync(engineFailureFilePath(resultFilePath), { force: true });\n\t\t} catch {}\n\t}\n}\n//#endregion\nexport { executeDeploy, executeDestroy };\n\n//# sourceMappingURL=execute-deploy-destroy-BK4R2qCX.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAM,6BAA6B;AAuBnC,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,UAAU;AAC/C;;;;;AAKA,SAAS,sBAAsB,gBAAgB;CAC9C,IAAI;CACJ,IAAI;EACH,MAAM,GAAG,aAAa,gBAAgB,MAAM;CAC7C,QAAQ;EACP;C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O;MACf,MAAM,aAAa,kCAAkC,KAAK;KAC3D;IACD;GACD;EACD,SAAS,OAAO;GACf,IAAI,mBAAmB,GAAG,KAAK,GAAG,OAAO,MAAM,KAAK;GACpD,MAAM;EACP;EACA,IAAI,WAAW,UAAU,OAAO,GAAG,sBAAsB,cAAc,CAAC;EACxE,OAAO,GAAG,KAAK,CAAC;CACjB,UAAU;EACT,IAAI;GACH,GAAG,OAAO,gBAAgB,EAAE,OAAO,KAAK,CAAC;GACzC,GAAG,OAAO,sBAAsB,cAAc,GAAG,EAAE,OAAO,KAAK,CAAC;EACjE,QAAQ,CAAC;CACV;AACD"}
@@ -0,0 +1,126 @@
1
+ import { d as ok, l as CliStructuredError, p as InternalError, u as notOk } from "./composer-config-CY9fET8H-CgnpfWc2.mjs";
2
+ import { o as toStructured } from "./dev-current-Bm7Yrsmt-TadtLg5x.mjs";
3
+ import { t as checkConfigSource } from "./pipeline-Dpesfd2j-DKL3f1bj.mjs";
4
+ import { n as DEV_DIR, t as resolveLocalTargets } from "./local-target-DZ6bu7Aj.mjs";
5
+ import * as path from "node:path";
6
+ //#region ../../0-framework/3-tooling/cli/dist/execute-dev-current-nYH8EiKK.mjs
7
+ /**
8
+ * The `devUrl` and `devStop` executor: config → each extension's local
9
+ * target → the app it recorded in the directory's dev state. Reached only by
10
+ * lazy import from dev-current.ts — resolving the local targets loads their
11
+ * descriptors, whose graphs reach alchemy's provider tree.
12
+ */
13
+ const RUN_DEV = "Run `prisma dev <entry>` in this directory.";
14
+ function platformUnsupported() {
15
+ return new CliStructuredError("DEV.PLATFORM_UNSUPPORTED", "local dev is not supported on Windows yet.");
16
+ }
17
+ /** A call into an extension's local target; its failures that carry no code are the emulator's. */
18
+ async function fromTarget(call) {
19
+ try {
20
+ return await call();
21
+ } catch (error) {
22
+ throw toStructured("DEV.EMULATOR_FAILED", error);
23
+ }
24
+ }
25
+ /** Every extension's record of the app `prisma dev` last ran from `cwd`; fails when none recorded one. */
26
+ async function currentApps(input, cwd) {
27
+ const { value } = checkConfigSource(input.config, cwd);
28
+ const devDir = path.join(cwd, DEV_DIR);
29
+ const apps = [];
30
+ for (const target of (await resolveLocalTargets(value)).values()) {
31
+ const current = await fromTarget(async () => target.current?.({ devDir }));
32
+ if (current !== void 0) apps.push(current);
33
+ }
34
+ if (apps.length === 0) throw new CliStructuredError("DEV.NOT_STARTED_HERE", `\`prisma dev\` has not run in ${cwd}.`, {
35
+ why: `The local services, databases and buckets of an app are recorded in ${devDir} when \`prisma dev\` runs there, and there is no such record.`,
36
+ fix: RUN_DEV,
37
+ meta: { cwd }
38
+ });
39
+ return apps;
40
+ }
41
+ async function locate(input, cwd) {
42
+ const apps = await currentApps(input, cwd);
43
+ const app = apps.find((candidate) => candidate.addresses.includes(input.address));
44
+ if (app === void 0) {
45
+ const known = apps.flatMap((candidate) => candidate.addresses).sort();
46
+ throw new CliStructuredError("DEV.ADDRESS_UNKNOWN", `"${apps.map((a) => a.app).join("\", \"")}" has no node at "${input.address}".`, {
47
+ why: `The addresses recorded for the app \`prisma dev\` last ran here are: ${known.join(", ")}.`,
48
+ fix: "Pass one of those addresses. A nested node has a dotted address, such as `catalog.database`.",
49
+ meta: {
50
+ address: input.address,
51
+ known
52
+ }
53
+ });
54
+ }
55
+ const location = await fromTarget(() => app.locate(input.address));
56
+ if (location === void 0) throw new InternalError(`the local target recorded "${input.address}" but cannot locate it`);
57
+ if (location.emulator === "not-running") throw new CliStructuredError("DEV.EMULATOR_UNREACHABLE", `The local ${location.kind} emulator that runs "${input.address}" is not running.`, {
58
+ why: "The local emulators run your services, databases and buckets on this machine; `prisma dev` starts the ones an app needs.",
59
+ fix: RUN_DEV,
60
+ meta: {
61
+ address: input.address,
62
+ kind: location.kind
63
+ }
64
+ });
65
+ if (location.condition !== "running") throw notRunning(input.address, location);
66
+ if (location.url === void 0) throw new InternalError(`the local target reports "${input.address}" running with no URL`);
67
+ return {
68
+ address: input.address,
69
+ kind: location.kind,
70
+ url: location.url,
71
+ state: location.state
72
+ };
73
+ }
74
+ function notRunning(address, location) {
75
+ const { kind, state, condition, logPath } = location;
76
+ const meta = {
77
+ address,
78
+ kind,
79
+ state,
80
+ ...logPath === void 0 ? {} : { logPath }
81
+ };
82
+ const message = `The ${kind} "${address}" is not running (${state}).`;
83
+ if (condition === "crashing") return new CliStructuredError("DEV.NOT_RUNNING", message, {
84
+ why: "It exited after it started, and it is being restarted or was held after repeated crashes.",
85
+ fix: logPath === void 0 ? "Read its output in the `prisma dev` terminal, fix the cause, and rebuild." : `Read its log at ${logPath}, fix the cause, and rebuild.`,
86
+ meta
87
+ });
88
+ if (condition === "missing") return new CliStructuredError("DEV.NOT_RUNNING", message, {
89
+ why: "The local emulator no longer has it, for example because a Composer upgrade discarded the emulator’s state.",
90
+ fix: `${RUN_DEV} It creates the ${kind} again, empty.`,
91
+ meta
92
+ });
93
+ return new CliStructuredError("DEV.NOT_RUNNING", message, {
94
+ why: "`prisma dev` stops the app when it ends, and a stopped node has no URL that answers.",
95
+ fix: RUN_DEV,
96
+ meta
97
+ });
98
+ }
99
+ async function executeDevUrl(input, cwd) {
100
+ if (process.platform === "win32") return notOk(platformUnsupported());
101
+ try {
102
+ return ok(await locate(input, cwd));
103
+ } catch (error) {
104
+ if (CliStructuredError.is(error)) return notOk(error);
105
+ throw error;
106
+ }
107
+ }
108
+ async function executeDevStop(input, cwd) {
109
+ if (process.platform === "win32") return notOk(platformUnsupported());
110
+ try {
111
+ const apps = await currentApps(input, cwd);
112
+ const stopped = [];
113
+ for (const app of apps) stopped.push(...await fromTarget(() => app.stop()));
114
+ return ok({
115
+ app: apps.map((a) => a.app).join(", "),
116
+ stopped
117
+ });
118
+ } catch (error) {
119
+ if (CliStructuredError.is(error)) return notOk(error);
120
+ throw error;
121
+ }
122
+ }
123
+ //#endregion
124
+ export { executeDevStop, executeDevUrl };
125
+
126
+ //# sourceMappingURL=execute-dev-current-nYH8EiKK-BcP2HhlW.mjs.map