UNPKG

@prisma/client

Version:

Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.

1,485 lines (1,472 loc) 508 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // ../../node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js var require_pluralize = __commonJS({ "../../node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js"(exports2, module2) { "use strict"; (function(root, pluralize3) { if (typeof require === "function" && typeof exports2 === "object" && typeof module2 === "object") { module2.exports = pluralize3(); } else if (typeof define === "function" && define.amd) { define(function() { return pluralize3(); }); } else { root.pluralize = pluralize3(); } })(exports2, function() { var pluralRules = []; var singularRules = []; var uncountables = {}; var irregularPlurals = {}; var irregularSingles = {}; function sanitizeRule(rule) { if (typeof rule === "string") { return new RegExp("^" + rule + "$", "i"); } return rule; } function restoreCase(word, token) { if (word === token) return token; if (word === word.toLowerCase()) return token.toLowerCase(); if (word === word.toUpperCase()) return token.toUpperCase(); if (word[0] === word[0].toUpperCase()) { return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase(); } return token.toLowerCase(); } function interpolate(str, args) { return str.replace(/\$(\d{1,2})/g, function(match, index) { return args[index] || ""; }); } function replace(word, rule) { return word.replace(rule[0], function(match, index) { var result = interpolate(rule[1], arguments); if (match === "") { return restoreCase(word[index - 1], result); } return restoreCase(match, result); }); } function sanitizeWord(token, word, rules) { if (!token.length || uncountables.hasOwnProperty(token)) { return word; } var len = rules.length; while (len--) { var rule = rules[len]; if (rule[0].test(word)) return replace(word, rule); } return word; } function replaceWord(replaceMap, keepMap, rules) { return function(word) { var token = word.toLowerCase(); if (keepMap.hasOwnProperty(token)) { return restoreCase(word, token); } if (replaceMap.hasOwnProperty(token)) { return restoreCase(word, replaceMap[token]); } return sanitizeWord(token, word, rules); }; } function checkWord(replaceMap, keepMap, rules, bool) { return function(word) { var token = word.toLowerCase(); if (keepMap.hasOwnProperty(token)) return true; if (replaceMap.hasOwnProperty(token)) return false; return sanitizeWord(token, token, rules) === token; }; } function pluralize3(word, count, inclusive) { var pluralized = count === 1 ? pluralize3.singular(word) : pluralize3.plural(word); return (inclusive ? count + " " : "") + pluralized; } pluralize3.plural = replaceWord( irregularSingles, irregularPlurals, pluralRules ); pluralize3.isPlural = checkWord( irregularSingles, irregularPlurals, pluralRules ); pluralize3.singular = replaceWord( irregularPlurals, irregularSingles, singularRules ); pluralize3.isSingular = checkWord( irregularPlurals, irregularSingles, singularRules ); pluralize3.addPluralRule = function(rule, replacement) { pluralRules.push([sanitizeRule(rule), replacement]); }; pluralize3.addSingularRule = function(rule, replacement) { singularRules.push([sanitizeRule(rule), replacement]); }; pluralize3.addUncountableRule = function(word) { if (typeof word === "string") { uncountables[word.toLowerCase()] = true; return; } pluralize3.addPluralRule(word, "$0"); pluralize3.addSingularRule(word, "$0"); }; pluralize3.addIrregularRule = function(single, plural) { plural = plural.toLowerCase(); single = single.toLowerCase(); irregularSingles[single] = plural; irregularPlurals[plural] = single; }; [ // Pronouns. ["I", "we"], ["me", "us"], ["he", "they"], ["she", "they"], ["them", "them"], ["myself", "ourselves"], ["yourself", "yourselves"], ["itself", "themselves"], ["herself", "themselves"], ["himself", "themselves"], ["themself", "themselves"], ["is", "are"], ["was", "were"], ["has", "have"], ["this", "these"], ["that", "those"], // Words ending in with a consonant and `o`. ["echo", "echoes"], ["dingo", "dingoes"], ["volcano", "volcanoes"], ["tornado", "tornadoes"], ["torpedo", "torpedoes"], // Ends with `us`. ["genus", "genera"], ["viscus", "viscera"], // Ends with `ma`. ["stigma", "stigmata"], ["stoma", "stomata"], ["dogma", "dogmata"], ["lemma", "lemmata"], ["schema", "schemata"], ["anathema", "anathemata"], // Other irregular rules. ["ox", "oxen"], ["axe", "axes"], ["die", "dice"], ["yes", "yeses"], ["foot", "feet"], ["eave", "eaves"], ["goose", "geese"], ["tooth", "teeth"], ["quiz", "quizzes"], ["human", "humans"], ["proof", "proofs"], ["carve", "carves"], ["valve", "valves"], ["looey", "looies"], ["thief", "thieves"], ["groove", "grooves"], ["pickaxe", "pickaxes"], ["passerby", "passersby"] ].forEach(function(rule) { return pluralize3.addIrregularRule(rule[0], rule[1]); }); [ [/s?$/i, "s"], [/[^\u0000-\u007F]$/i, "$0"], [/([^aeiou]ese)$/i, "$1"], [/(ax|test)is$/i, "$1es"], [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"], [/(e[mn]u)s?$/i, "$1s"], [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"], [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"], [/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"], [/(seraph|cherub)(?:im)?$/i, "$1im"], [/(her|at|gr)o$/i, "$1oes"], [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"], [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"], [/sis$/i, "ses"], [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"], [/([^aeiouy]|qu)y$/i, "$1ies"], [/([^ch][ieo][ln])ey$/i, "$1ies"], [/(x|ch|ss|sh|zz)$/i, "$1es"], [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"], [/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"], [/(pe)(?:rson|ople)$/i, "$1ople"], [/(child)(?:ren)?$/i, "$1ren"], [/eaux$/i, "$0"], [/m[ae]n$/i, "men"], ["thou", "you"] ].forEach(function(rule) { return pluralize3.addPluralRule(rule[0], rule[1]); }); [ [/s$/i, ""], [/(ss)$/i, "$1"], [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"], [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"], [/ies$/i, "y"], [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"], [/\b(mon|smil)ies$/i, "$1ey"], [/\b((?:tit)?m|l)ice$/i, "$1ouse"], [/(seraph|cherub)im$/i, "$1"], [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"], [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"], [/(movie|twelve|abuse|e[mn]u)s$/i, "$1"], [/(test)(?:is|es)$/i, "$1is"], [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"], [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"], [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"], [/(alumn|alg|vertebr)ae$/i, "$1a"], [/(cod|mur|sil|vert|ind)ices$/i, "$1ex"], [/(matr|append)ices$/i, "$1ix"], [/(pe)(rson|ople)$/i, "$1rson"], [/(child)ren$/i, "$1"], [/(eau)x?$/i, "$1"], [/men$/i, "man"] ].forEach(function(rule) { return pluralize3.addSingularRule(rule[0], rule[1]); }); [ // Singular words with no plurals. "adulthood", "advice", "agenda", "aid", "aircraft", "alcohol", "ammo", "analytics", "anime", "athletics", "audio", "bison", "blood", "bream", "buffalo", "butter", "carp", "cash", "chassis", "chess", "clothing", "cod", "commerce", "cooperation", "corps", "debris", "diabetes", "digestion", "elk", "energy", "equipment", "excretion", "expertise", "firmware", "flounder", "fun", "gallows", "garbage", "graffiti", "hardware", "headquarters", "health", "herpes", "highjinks", "homework", "housework", "information", "jeans", "justice", "kudos", "labour", "literature", "machinery", "mackerel", "mail", "media", "mews", "moose", "music", "mud", "manga", "news", "only", "personnel", "pike", "plankton", "pliers", "police", "pollution", "premises", "rain", "research", "rice", "salmon", "scissors", "series", "sewage", "shambles", "shrimp", "software", "species", "staff", "swine", "tennis", "traffic", "transportation", "trout", "tuna", "wealth", "welfare", "whiting", "wildebeest", "wildlife", "you", /pok[eé]mon$/i, // Regexes. /[^aeiou]ese$/i, // "chinese", "japanese" /deer$/i, // "deer", "reindeer" /fish$/i, // "fish", "blowfish", "angelfish" /measles$/i, /o[iu]s$/i, // "carnivorous" /pox$/i, // "chickpox", "smallpox" /sheep$/i ].forEach(pluralize3.addUncountableRule); return pluralize3; }); } }); // ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js var require_universalify = __commonJS({ "../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports2) { "use strict"; exports2.fromCallback = function(fn) { return Object.defineProperty(function(...args) { if (typeof args[args.length - 1] === "function") fn.apply(this, args); else { return new Promise((resolve3, reject) => { args.push((err, res) => err != null ? reject(err) : resolve3(res)); fn.apply(this, args); }); } }, "name", { value: fn.name }); }; exports2.fromPromise = function(fn) { return Object.defineProperty(function(...args) { const cb = args[args.length - 1]; if (typeof cb !== "function") return fn.apply(this, args); else { args.pop(); fn.apply(this, args).then((r) => cb(null, r), cb); } }, "name", { value: fn.name }); }; } }); // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js var require_polyfills = __commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports2, module2) { "use strict"; var constants2 = require("constants"); var origCwd = process.cwd; var cwd = null; var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform; process.cwd = function() { if (!cwd) cwd = origCwd.call(process); return cwd; }; try { process.cwd(); } catch (er) { } if (typeof process.chdir === "function") { chdir = process.chdir; process.chdir = function(d) { cwd = null; chdir.call(process, d); }; if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir); } var chdir; module2.exports = patch; function patch(fs4) { if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { patchLchmod(fs4); } if (!fs4.lutimes) { patchLutimes(fs4); } fs4.chown = chownFix(fs4.chown); fs4.fchown = chownFix(fs4.fchown); fs4.lchown = chownFix(fs4.lchown); fs4.chmod = chmodFix(fs4.chmod); fs4.fchmod = chmodFix(fs4.fchmod); fs4.lchmod = chmodFix(fs4.lchmod); fs4.chownSync = chownFixSync(fs4.chownSync); fs4.fchownSync = chownFixSync(fs4.fchownSync); fs4.lchownSync = chownFixSync(fs4.lchownSync); fs4.chmodSync = chmodFixSync(fs4.chmodSync); fs4.fchmodSync = chmodFixSync(fs4.fchmodSync); fs4.lchmodSync = chmodFixSync(fs4.lchmodSync); fs4.stat = statFix(fs4.stat); fs4.fstat = statFix(fs4.fstat); fs4.lstat = statFix(fs4.lstat); fs4.statSync = statFixSync(fs4.statSync); fs4.fstatSync = statFixSync(fs4.fstatSync); fs4.lstatSync = statFixSync(fs4.lstatSync); if (fs4.chmod && !fs4.lchmod) { fs4.lchmod = function(path10, mode2, cb) { if (cb) process.nextTick(cb); }; fs4.lchmodSync = function() { }; } if (fs4.chown && !fs4.lchown) { fs4.lchown = function(path10, uid, gid, cb) { if (cb) process.nextTick(cb); }; fs4.lchownSync = function() { }; } if (platform === "win32") { fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) { function rename(from, to, cb) { var start = Date.now(); var backoff = 0; fs$rename(from, to, function CB(er) { if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) { setTimeout(function() { fs4.stat(to, function(stater, st) { if (stater && stater.code === "ENOENT") fs$rename(from, to, CB); else cb(er); }); }, backoff); if (backoff < 100) backoff += 10; return; } if (cb) cb(er); }); } if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename); return rename; }(fs4.rename); } fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) { function read(fd, buffer, offset, length, position, callback_) { var callback; if (callback_ && typeof callback_ === "function") { var eagCounter = 0; callback = function(er, _, __) { if (er && er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; return fs$read.call(fs4, fd, buffer, offset, length, position, callback); } callback_.apply(this, arguments); }; } return fs$read.call(fs4, fd, buffer, offset, length, position, callback); } if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read); return read; }(fs4.read); fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { try { return fs$readSync.call(fs4, fd, buffer, offset, length, position); } catch (er) { if (er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; continue; } throw er; } } }; }(fs4.readSync); function patchLchmod(fs5) { fs5.lchmod = function(path10, mode2, callback) { fs5.open( path10, constants2.O_WRONLY | constants2.O_SYMLINK, mode2, function(err, fd) { if (err) { if (callback) callback(err); return; } fs5.fchmod(fd, mode2, function(err2) { fs5.close(fd, function(err22) { if (callback) callback(err2 || err22); }); }); } ); }; fs5.lchmodSync = function(path10, mode2) { var fd = fs5.openSync(path10, constants2.O_WRONLY | constants2.O_SYMLINK, mode2); var threw = true; var ret; try { ret = fs5.fchmodSync(fd, mode2); threw = false; } finally { if (threw) { try { fs5.closeSync(fd); } catch (er) { } } else { fs5.closeSync(fd); } } return ret; }; } function patchLutimes(fs5) { if (constants2.hasOwnProperty("O_SYMLINK") && fs5.futimes) { fs5.lutimes = function(path10, at, mt, cb) { fs5.open(path10, constants2.O_SYMLINK, function(er, fd) { if (er) { if (cb) cb(er); return; } fs5.futimes(fd, at, mt, function(er2) { fs5.close(fd, function(er22) { if (cb) cb(er2 || er22); }); }); }); }; fs5.lutimesSync = function(path10, at, mt) { var fd = fs5.openSync(path10, constants2.O_SYMLINK); var ret; var threw = true; try { ret = fs5.futimesSync(fd, at, mt); threw = false; } finally { if (threw) { try { fs5.closeSync(fd); } catch (er) { } } else { fs5.closeSync(fd); } } return ret; }; } else if (fs5.futimes) { fs5.lutimes = function(_a, _b, _c, cb) { if (cb) process.nextTick(cb); }; fs5.lutimesSync = function() { }; } } function chmodFix(orig) { if (!orig) return orig; return function(target, mode2, cb) { return orig.call(fs4, target, mode2, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); }; } function chmodFixSync(orig) { if (!orig) return orig; return function(target, mode2) { try { return orig.call(fs4, target, mode2); } catch (er) { if (!chownErOk(er)) throw er; } }; } function chownFix(orig) { if (!orig) return orig; return function(target, uid, gid, cb) { return orig.call(fs4, target, uid, gid, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); }; } function chownFixSync(orig) { if (!orig) return orig; return function(target, uid, gid) { try { return orig.call(fs4, target, uid, gid); } catch (er) { if (!chownErOk(er)) throw er; } }; } function statFix(orig) { if (!orig) return orig; return function(target, options2, cb) { if (typeof options2 === "function") { cb = options2; options2 = null; } function callback(er, stats) { if (stats) { if (stats.uid < 0) stats.uid += 4294967296; if (stats.gid < 0) stats.gid += 4294967296; } if (cb) cb.apply(this, arguments); } return options2 ? orig.call(fs4, target, options2, callback) : orig.call(fs4, target, callback); }; } function statFixSync(orig) { if (!orig) return orig; return function(target, options2) { var stats = options2 ? orig.call(fs4, target, options2) : orig.call(fs4, target); if (stats) { if (stats.uid < 0) stats.uid += 4294967296; if (stats.gid < 0) stats.gid += 4294967296; } return stats; }; } function chownErOk(er) { if (!er) return true; if (er.code === "ENOSYS") return true; var nonroot = !process.getuid || process.getuid() !== 0; if (nonroot) { if (er.code === "EINVAL" || er.code === "EPERM") return true; } return false; } } } }); // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js var require_legacy_streams = __commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports2, module2) { "use strict"; var Stream = require("stream").Stream; module2.exports = legacy; function legacy(fs4) { return { ReadStream, WriteStream }; function ReadStream(path10, options2) { if (!(this instanceof ReadStream)) return new ReadStream(path10, options2); Stream.call(this); var self2 = this; this.path = path10; this.fd = null; this.readable = true; this.paused = false; this.flags = "r"; this.mode = 438; this.bufferSize = 64 * 1024; options2 = options2 || {}; var keys = Object.keys(options2); for (var index = 0, length = keys.length; index < length; index++) { var key = keys[index]; this[key] = options2[key]; } if (this.encoding) this.setEncoding(this.encoding); if (this.start !== void 0) { if ("number" !== typeof this.start) { throw TypeError("start must be a Number"); } if (this.end === void 0) { this.end = Infinity; } else if ("number" !== typeof this.end) { throw TypeError("end must be a Number"); } if (this.start > this.end) { throw new Error("start must be <= end"); } this.pos = this.start; } if (this.fd !== null) { process.nextTick(function() { self2._read(); }); return; } fs4.open(this.path, this.flags, this.mode, function(err, fd) { if (err) { self2.emit("error", err); self2.readable = false; return; } self2.fd = fd; self2.emit("open", fd); self2._read(); }); } function WriteStream(path10, options2) { if (!(this instanceof WriteStream)) return new WriteStream(path10, options2); Stream.call(this); this.path = path10; this.fd = null; this.writable = true; this.flags = "w"; this.encoding = "binary"; this.mode = 438; this.bytesWritten = 0; options2 = options2 || {}; var keys = Object.keys(options2); for (var index = 0, length = keys.length; index < length; index++) { var key = keys[index]; this[key] = options2[key]; } if (this.start !== void 0) { if ("number" !== typeof this.start) { throw TypeError("start must be a Number"); } if (this.start < 0) { throw new Error("start must be >= zero"); } this.pos = this.start; } this.busy = false; this._queue = []; if (this.fd === null) { this._open = fs4.open; this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); this.flush(); } } } } }); // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js var require_clone = __commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports2, module2) { "use strict"; module2.exports = clone; var getPrototypeOf = Object.getPrototypeOf || function(obj) { return obj.__proto__; }; function clone(obj) { if (obj === null || typeof obj !== "object") return obj; if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) }; else var copy = /* @__PURE__ */ Object.create(null); Object.getOwnPropertyNames(obj).forEach(function(key) { Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)); }); return copy; } } }); // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js var require_graceful_fs = __commonJS({ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports2, module2) { "use strict"; var fs4 = require("fs"); var polyfills = require_polyfills(); var legacy = require_legacy_streams(); var clone = require_clone(); var util2 = require("util"); var gracefulQueue; var previousSymbol; if (typeof Symbol === "function" && typeof Symbol.for === "function") { gracefulQueue = Symbol.for("graceful-fs.queue"); previousSymbol = Symbol.for("graceful-fs.previous"); } else { gracefulQueue = "___graceful-fs.queue"; previousSymbol = "___graceful-fs.previous"; } function noop2() { } function publishQueue(context, queue2) { Object.defineProperty(context, gracefulQueue, { get: function() { return queue2; } }); } var debug2 = noop2; if (util2.debuglog) debug2 = util2.debuglog("gfs4"); else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug2 = function() { var m = util2.format.apply(util2, arguments); m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); console.error(m); }; if (!fs4[gracefulQueue]) { queue = global[gracefulQueue] || []; publishQueue(fs4, queue); fs4.close = function(fs$close) { function close(fd, cb) { return fs$close.call(fs4, fd, function(err) { if (!err) { resetQueue(); } if (typeof cb === "function") cb.apply(this, arguments); }); } Object.defineProperty(close, previousSymbol, { value: fs$close }); return close; }(fs4.close); fs4.closeSync = function(fs$closeSync) { function closeSync(fd) { fs$closeSync.apply(fs4, arguments); resetQueue(); } Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync }); return closeSync; }(fs4.closeSync); if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { process.on("exit", function() { debug2(fs4[gracefulQueue]); require("assert").equal(fs4[gracefulQueue].length, 0); }); } } var queue; if (!global[gracefulQueue]) { publishQueue(global, fs4[gracefulQueue]); } module2.exports = patch(clone(fs4)); if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) { module2.exports = patch(fs4); fs4.__patched = true; } function patch(fs5) { polyfills(fs5); fs5.gracefulify = patch; fs5.createReadStream = createReadStream2; fs5.createWriteStream = createWriteStream2; var fs$readFile = fs5.readFile; fs5.readFile = readFile; function readFile(path10, options2, cb) { if (typeof options2 === "function") cb = options2, options2 = null; return go$readFile(path10, options2, cb); function go$readFile(path11, options3, cb2, startTime) { return fs$readFile(path11, options3, function(err) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$readFile, [path11, options3, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } var fs$writeFile = fs5.writeFile; fs5.writeFile = writeFile; function writeFile(path10, data, options2, cb) { if (typeof options2 === "function") cb = options2, options2 = null; return go$writeFile(path10, data, options2, cb); function go$writeFile(path11, data2, options3, cb2, startTime) { return fs$writeFile(path11, data2, options3, function(err) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$writeFile, [path11, data2, options3, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } var fs$appendFile = fs5.appendFile; if (fs$appendFile) fs5.appendFile = appendFile; function appendFile(path10, data, options2, cb) { if (typeof options2 === "function") cb = options2, options2 = null; return go$appendFile(path10, data, options2, cb); function go$appendFile(path11, data2, options3, cb2, startTime) { return fs$appendFile(path11, data2, options3, function(err) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$appendFile, [path11, data2, options3, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } var fs$copyFile = fs5.copyFile; if (fs$copyFile) fs5.copyFile = copyFile; function copyFile(src2, dest, flags, cb) { if (typeof flags === "function") { cb = flags; flags = 0; } return go$copyFile(src2, dest, flags, cb); function go$copyFile(src3, dest2, flags2, cb2, startTime) { return fs$copyFile(src3, dest2, flags2, function(err) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$copyFile, [src3, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } var fs$readdir = fs5.readdir; fs5.readdir = readdir; var noReaddirOptionVersions = /^v[0-5]\./; function readdir(path10, options2, cb) { if (typeof options2 === "function") cb = options2, options2 = null; var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path11, options3, cb2, startTime) { return fs$readdir(path11, fs$readdirCallback( path11, options3, cb2, startTime )); } : function go$readdir2(path11, options3, cb2, startTime) { return fs$readdir(path11, options3, fs$readdirCallback( path11, options3, cb2, startTime )); }; return go$readdir(path10, options2, cb); function fs$readdirCallback(path11, options3, cb2, startTime) { return function(err, files) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([ go$readdir, [path11, options3, cb2], err, startTime || Date.now(), Date.now() ]); else { if (files && files.sort) files.sort(); if (typeof cb2 === "function") cb2.call(this, err, files); } }; } } if (process.version.substr(0, 4) === "v0.8") { var legStreams = legacy(fs5); ReadStream = legStreams.ReadStream; WriteStream = legStreams.WriteStream; } var fs$ReadStream = fs5.ReadStream; if (fs$ReadStream) { ReadStream.prototype = Object.create(fs$ReadStream.prototype); ReadStream.prototype.open = ReadStream$open; } var fs$WriteStream = fs5.WriteStream; if (fs$WriteStream) { WriteStream.prototype = Object.create(fs$WriteStream.prototype); WriteStream.prototype.open = WriteStream$open; } Object.defineProperty(fs5, "ReadStream", { get: function() { return ReadStream; }, set: function(val) { ReadStream = val; }, enumerable: true, configurable: true }); Object.defineProperty(fs5, "WriteStream", { get: function() { return WriteStream; }, set: function(val) { WriteStream = val; }, enumerable: true, configurable: true }); var FileReadStream = ReadStream; Object.defineProperty(fs5, "FileReadStream", { get: function() { return FileReadStream; }, set: function(val) { FileReadStream = val; }, enumerable: true, configurable: true }); var FileWriteStream = WriteStream; Object.defineProperty(fs5, "FileWriteStream", { get: function() { return FileWriteStream; }, set: function(val) { FileWriteStream = val; }, enumerable: true, configurable: true }); function ReadStream(path10, options2) { if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this; else return ReadStream.apply(Object.create(ReadStream.prototype), arguments); } function ReadStream$open() { var that = this; open(that.path, that.flags, that.mode, function(err, fd) { if (err) { if (that.autoClose) that.destroy(); that.emit("error", err); } else { that.fd = fd; that.emit("open", fd); that.read(); } }); } function WriteStream(path10, options2) { if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this; else return WriteStream.apply(Object.create(WriteStream.prototype), arguments); } function WriteStream$open() { var that = this; open(that.path, that.flags, that.mode, function(err, fd) { if (err) { that.destroy(); that.emit("error", err); } else { that.fd = fd; that.emit("open", fd); } }); } function createReadStream2(path10, options2) { return new fs5.ReadStream(path10, options2); } function createWriteStream2(path10, options2) { return new fs5.WriteStream(path10, options2); } var fs$open = fs5.open; fs5.open = open; function open(path10, flags, mode2, cb) { if (typeof mode2 === "function") cb = mode2, mode2 = null; return go$open(path10, flags, mode2, cb); function go$open(path11, flags2, mode3, cb2, startTime) { return fs$open(path11, flags2, mode3, function(err, fd) { if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([go$open, [path11, flags2, mode3, cb2], err, startTime || Date.now(), Date.now()]); else { if (typeof cb2 === "function") cb2.apply(this, arguments); } }); } } return fs5; } function enqueue(elem) { debug2("ENQUEUE", elem[0].name, elem[1]); fs4[gracefulQueue].push(elem); retry(); } var retryTimer; function resetQueue() { var now = Date.now(); for (var i = 0; i < fs4[gracefulQueue].length; ++i) { if (fs4[gracefulQueue][i].length > 2) { fs4[gracefulQueue][i][3] = now; fs4[gracefulQueue][i][4] = now; } } retry(); } function retry() { clearTimeout(retryTimer); retryTimer = void 0; if (fs4[gracefulQueue].length === 0) return; var elem = fs4[gracefulQueue].shift(); var fn = elem[0]; var args = elem[1]; var err = elem[2]; var startTime = elem[3]; var lastTime = elem[4]; if (startTime === void 0) { debug2("RETRY", fn.name, args); fn.apply(null, args); } else if (Date.now() - startTime >= 6e4) { debug2("TIMEOUT", fn.name, args); var cb = args.pop(); if (typeof cb === "function") cb.call(null, err); } else { var sinceAttempt = Date.now() - lastTime; var sinceStart = Math.max(lastTime - startTime, 1); var desiredDelay = Math.min(sinceStart * 1.2, 100); if (sinceAttempt >= desiredDelay) { debug2("RETRY", fn.name, args); fn.apply(null, args.concat([startTime])); } else { fs4[gracefulQueue].push(elem); } } if (retryTimer === void 0) { retryTimer = setTimeout(retry, 0); } } } }); // ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/fs/index.js var require_fs = __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/fs/index.js"(exports2) { "use strict"; var u = require_universalify().fromCallback; var fs4 = require_graceful_fs(); var api = [ "access", "appendFile", "chmod", "chown", "close", "copyFile", "cp", "fchmod", "fchown", "fdatasync", "fstat", "fsync", "ftruncate", "futimes", "glob", "lchmod", "lchown", "lutimes", "link", "lstat", "mkdir", "mkdtemp", "open", "opendir", "readdir", "readFile", "readlink", "realpath", "rename", "rm", "rmdir", "stat", "statfs", "symlink", "truncate", "unlink", "utimes", "writeFile" ].filter((key) => { return typeof fs4[key] === "function"; }); Object.assign(exports2, fs4); api.forEach((method2) => { exports2[method2] = u(fs4[method2]); }); exports2.exists = function(filename, callback) { if (typeof callback === "function") { return fs4.exists(filename, callback); } return new Promise((resolve3) => { return fs4.exists(filename, resolve3); }); }; exports2.read = function(fd, buffer, offset, length, position, callback) { if (typeof callback === "function") { return fs4.read(fd, buffer, offset, length, position, callback); } return new Promise((resolve3, reject) => { fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => { if (err) return reject(err); resolve3({ bytesRead, buffer: buffer2 }); }); }); }; exports2.write = function(fd, buffer, ...args) { if (typeof args[args.length - 1] === "function") { return fs4.write(fd, buffer, ...args); } return new Promise((resolve3, reject) => { fs4.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => { if (err) return reject(err); resolve3({ bytesWritten, buffer: buffer2 }); }); }); }; exports2.readv = function(fd, buffers, ...args) { if (typeof args[args.length - 1] === "function") { return fs4.readv(fd, buffers, ...args); } return new Promise((resolve3, reject) => { fs4.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => { if (err) return reject(err); resolve3({ bytesRead, buffers: buffers2 }); }); }); }; exports2.writev = function(fd, buffers, ...args) { if (typeof args[args.length - 1] === "function") { return fs4.writev(fd, buffers, ...args); } return new Promise((resolve3, reject) => { fs4.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => { if (err) return reject(err); resolve3({ bytesWritten, buffers: buffers2 }); }); }); }; if (typeof fs4.realpath.native === "function") { exports2.realpath.native = u(fs4.realpath.native); } else { process.emitWarning( "fs.realpath.native is not a function. Is fs being monkey-patched?", "Warning", "fs-extra-WARN0003" ); } } }); // ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js var require_utils = __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) { "use strict"; var path10 = require("path"); module2.exports.checkPath = function checkPath(pth) { if (process.platform === "win32") { const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path10.parse(pth).root, "")); if (pathHasInvalidWinCharacters) { const error = new Error(`Path contains invalid characters: ${pth}`); error.code = "EINVAL"; throw error; } } }; } }); // ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/make-dir.js var require_make_dir = __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports2, module2) { "use strict"; var fs4 = require_fs(); var { checkPath } = require_utils(); var getMode = (options2) => { const defaults = { mode: 511 }; if (typeof options2 === "number") return options2; return { ...defaults, ...options2 }.mode; }; module2.exports.makeDir = async (dir, options2) => { checkPath(dir); return fs4.mkdir(dir, { mode: getMode(options2), recursive: true }); }; module2.exports.makeDirSync = (dir, options2) => { checkPath(dir); return fs4.mkdirSync(dir, { mode: getMode(options2), recursive: true }); }; } }); // ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/index.js var require_mkdirs = __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports2, module2) { "use strict"; var u = require_universalify().fromPromise; var { makeDir: _makeDir, makeDirSync } = require_make_dir(); var makeDir = u(_makeDir); module2.exports = { mkdirs: makeDir, mkdirsSync: makeDirSync, // alias mkdirp: makeDir, mkdirpSync: makeDirSync, ensureDir: makeDir, ensureDirSync: makeDirSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/path-exists/index.js var require_path_exists = __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/path-exists/index.js"(exports2, module2) { "use strict"; var u = require_universalify().fromPromise; var fs4 = require_fs(); function pathExists(path10) { return fs4.access(path10).then(() => true).catch(() => false); } module2.exports = { pathExists: u(pathExists), pathExistsSync: fs4.existsSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/utimes.js var require_utimes = __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/utimes.js"(exports2, module2) { "use strict"; var fs4 = require_fs(); var u = require_universalify().fromPromise; async function utimesMillis(path10, atime, mtime) { const fd = await fs4.open(path10, "r+"); let closeErr = null; try { await fs4.futimes(fd, atime, mtime); } finally { try { await fs4.close(fd); } catch (e) { closeErr = e; } } if (closeErr) { throw closeErr; } } function utimesMillisSync(path10, atime, mtime) { const fd = fs4.openSync(path10, "r+"); fs4.futimesSync(fd, atime, mtime); return fs4.closeSync(fd); } module2.exports = { utimesMillis: u(utimesMillis), utimesMillisSync }; } }); // ../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js var require_stat = __commonJS({ "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js"(exports2, module2) { "use strict"; var fs4 = require_fs(); var path10 = require("path"); var u = require_universalify().fromPromise; function getStats(src2, dest, opts) { const statFunc = opts.dereference ? (file2) => fs4.stat(file2, { bigint: true }) : (file2) => fs4.lstat(file2, { bigint: true }); return Promise.all([ statFunc(src2), statFunc(dest).catch((err) => { if (err.code === "ENOENT") return null; throw err; }) ]).then(([srcStat, destStat]) => ({ srcStat, destStat })); } function getStatsSync(src2, dest, opts) { let destStat; const statFunc = opts.dereference ? (file2) => fs4.statSync(file2, { bigint: true }) : (file2) => fs4.lstatSync(file2, { bigint: true }); const srcStat = statFunc(src2); try { destStat = statFunc(dest); } catch (err) { if (err.code === "ENOENT") return { srcStat, destStat: null }; throw err; } return { srcStat, destStat }; } async function checkPaths(src2, dest, funcName, opts) { const { srcStat, destStat } = await getStats(src2, dest, opts); if (destStat) { if (areIdentical(srcStat, destStat)) { const srcBaseName = path10.basename(src2); const destBaseName = path10.basename(dest); if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { return { srcStat, destStat, isChangingCase: true }; } throw new Error("Source and destination must not be the same."); } if (srcStat.isDirectory() && !destStat.isDirectory()) { throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src2}'.`); } if (!srcStat.isDirectory() && destStat.isDirectory()) { throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src2}'.`); } } if (srcStat.isDirectory() && isSrcSubdir(src2, dest)) { throw new Error(errMsg(src2, dest, funcName)); } return { srcStat, destStat }; } function checkPathsSync(src2, dest, funcName, opts) { const { srcStat, destStat } = getStatsSync(src2, dest, opts); if (destStat) { if (areIdentical(srcStat, destStat)) { const srcBaseName = path10.basename(src2); const destBaseName = path10.basename(dest); if (funcName === "move" && srcBaseName !== destBaseName && srcB