UNPKG

@prisma/cli-init

Version:

Init CLI for Prisma

1,226 lines (1,224 loc) • 6.04 MB
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url); import { Engine, apiKeyValidator, array, handleEngineError, integer, literal, looseObject, minLength, minValue, number, object, optional, pipe, safeParse, string, union } from "./chunk-7WBH7PZA.js"; import { __commonJS, __require, __toESM } from "./chunk-NJX2BODH.js"; // ../../node_modules/.pnpm/@prisma+query-plan-executor@7.1.0/node_modules/@prisma/query-plan-executor/dist/index.js var require_dist = __commonJS({ "../../node_modules/.pnpm/@prisma+query-plan-executor@7.1.0/node_modules/@prisma/query-plan-executor/dist/index.js"(exports2, module2) { "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 = (fn2, res) => function __init() { return fn2 && (res = (0, fn2[__getOwnPropNames(fn2)[0]])(fn2 = 0)), res; }; var __commonJS2 = (cb, mod22) => function __require2() { return mod22 || (0, cb[__getOwnPropNames(cb)[0]])((mod22 = { exports: {} }).exports, mod22), mod22.exports; }; var __export = (target, all) => { for (var name6 in all) __defProp(target, name6, { get: all[name6], enumerable: true }); }; var __copyProps = (to2, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to2, key) && key !== except) __defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to2; }; var __toESM2 = (mod22, isNodeMode, target) => (target = mod22 != null ? __create(__getProtoOf(mod22)) : {}, __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 || !mod22 || !mod22.__esModule ? __defProp(target, "default", { value: mod22, enumerable: true }) : target, mod22 )); var __toCommonJS = (mod22) => __copyProps(__defProp({}, "__esModule", { value: true }), mod22); var require_assert = __commonJS2({ "../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/_assert.js"(exports22) { "use strict"; Object.defineProperty(exports22, "__esModule", { value: true }); exports22.anumber = anumber; exports22.abytes = abytes; exports22.ahash = ahash; exports22.aexists = aexists; exports22.aoutput = aoutput; function anumber(n2) { if (!Number.isSafeInteger(n2) || n2 < 0) throw new Error("positive integer expected, got " + n2); } function isBytes(a2) { return a2 instanceof Uint8Array || ArrayBuffer.isView(a2) && a2.constructor.name === "Uint8Array"; } function abytes(b2, ...lengths) { if (!isBytes(b2)) throw new Error("Uint8Array expected"); if (lengths.length > 0 && !lengths.includes(b2.length)) throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b2.length); } function ahash(h2) { if (typeof h2 !== "function" || typeof h2.create !== "function") throw new Error("Hash should be wrapped by utils.wrapConstructor"); anumber(h2.outputLen); anumber(h2.blockLen); } function aexists(instance, checkFinished = true) { if (instance.destroyed) throw new Error("Hash instance has been destroyed"); if (checkFinished && instance.finished) throw new Error("Hash#digest() has already been called"); } function aoutput(out, instance) { abytes(out); const min2 = instance.outputLen; if (out.length < min2) { throw new Error("digestInto() expects output buffer of length at least " + min2); } } } }); var require_u64 = __commonJS2({ "../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/_u64.js"(exports22) { "use strict"; Object.defineProperty(exports22, "__esModule", { value: true }); exports22.add5L = exports22.add5H = exports22.add4H = exports22.add4L = exports22.add3H = exports22.add3L = exports22.rotlBL = exports22.rotlBH = exports22.rotlSL = exports22.rotlSH = exports22.rotr32L = exports22.rotr32H = exports22.rotrBL = exports22.rotrBH = exports22.rotrSL = exports22.rotrSH = exports22.shrSL = exports22.shrSH = exports22.toBig = void 0; exports22.fromBig = fromBig; exports22.split = split; exports22.add = add2; var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); var _32n = /* @__PURE__ */ BigInt(32); function fromBig(n2, le2 = false) { if (le2) return { h: Number(n2 & U32_MASK64), l: Number(n2 >> _32n & U32_MASK64) }; return { h: Number(n2 >> _32n & U32_MASK64) | 0, l: Number(n2 & U32_MASK64) | 0 }; } function split(lst, le2 = false) { let Ah = new Uint32Array(lst.length); let Al = new Uint32Array(lst.length); for (let i2 = 0; i2 < lst.length; i2++) { const { h: h2, l: l2 } = fromBig(lst[i2], le2); [Ah[i2], Al[i2]] = [h2, l2]; } return [Ah, Al]; } var toBig = (h2, l2) => BigInt(h2 >>> 0) << _32n | BigInt(l2 >>> 0); exports22.toBig = toBig; var shrSH = (h2, _l, s2) => h2 >>> s2; exports22.shrSH = shrSH; var shrSL = (h2, l2, s2) => h2 << 32 - s2 | l2 >>> s2; exports22.shrSL = shrSL; var rotrSH = (h2, l2, s2) => h2 >>> s2 | l2 << 32 - s2; exports22.rotrSH = rotrSH; var rotrSL = (h2, l2, s2) => h2 << 32 - s2 | l2 >>> s2; exports22.rotrSL = rotrSL; var rotrBH = (h2, l2, s2) => h2 << 64 - s2 | l2 >>> s2 - 32; exports22.rotrBH = rotrBH; var rotrBL = (h2, l2, s2) => h2 >>> s2 - 32 | l2 << 64 - s2; exports22.rotrBL = rotrBL; var rotr32H = (_h, l2) => l2; exports22.rotr32H = rotr32H; var rotr32L = (h2, _l) => h2; exports22.rotr32L = rotr32L; var rotlSH = (h2, l2, s2) => h2 << s2 | l2 >>> 32 - s2; exports22.rotlSH = rotlSH; var rotlSL = (h2, l2, s2) => l2 << s2 | h2 >>> 32 - s2; exports22.rotlSL = rotlSL; var rotlBH = (h2, l2, s2) => l2 << s2 - 32 | h2 >>> 64 - s2; exports22.rotlBH = rotlBH; var rotlBL = (h2, l2, s2) => h2 << s2 - 32 | l2 >>> 64 - s2; exports22.rotlBL = rotlBL; function add2(Ah, Al, Bh, Bl) { const l2 = (Al >>> 0) + (Bl >>> 0); return { h: Ah + Bh + (l2 / 2 ** 32 | 0) | 0, l: l2 | 0 }; } var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); exports22.add3L = add3L; var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0; exports22.add3H = add3H; var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); exports22.add4L = add4L; var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0; exports22.add4H = add4H; var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); exports22.add5L = add5L; var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0; exports22.add5H = add5H; var u64 = { fromBig, split, toBig, shrSH, shrSL, rotrSH, rotrSL, rotrBH, rotrBL, rotr32H, rotr32L, rotlSH, rotlSL, rotlBH, rotlBL, add: add2, add3L, add3H, add4L, add4H, add5H, add5L }; exports22.default = u64; } }); var require_cryptoNode = __commonJS2({ "../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/cryptoNode.js"(exports22) { "use strict"; Object.defineProperty(exports22, "__esModule", { value: true }); exports22.crypto = void 0; var nc = __require("crypto"); exports22.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0; } }); var require_utils = __commonJS2({ "../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/utils.js"(exports22) { "use strict"; Object.defineProperty(exports22, "__esModule", { value: true }); exports22.Hash = exports22.nextTick = exports22.byteSwapIfBE = exports22.isLE = void 0; exports22.isBytes = isBytes; exports22.u8 = u8; exports22.u32 = u32; exports22.createView = createView; exports22.rotr = rotr; exports22.rotl = rotl; exports22.byteSwap = byteSwap; exports22.byteSwap32 = byteSwap32; exports22.bytesToHex = bytesToHex; exports22.hexToBytes = hexToBytes; exports22.asyncLoop = asyncLoop; exports22.utf8ToBytes = utf8ToBytes; exports22.toBytes = toBytes; exports22.concatBytes = concatBytes; exports22.checkOpts = checkOpts; exports22.wrapConstructor = wrapConstructor; exports22.wrapConstructorWithOpts = wrapConstructorWithOpts; exports22.wrapXOFConstructorWithOpts = wrapXOFConstructorWithOpts; exports22.randomBytes = randomBytes; var crypto_1 = require_cryptoNode(); var _assert_js_1 = require_assert(); function isBytes(a2) { return a2 instanceof Uint8Array || ArrayBuffer.isView(a2) && a2.constructor.name === "Uint8Array"; } function u8(arr) { return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); } function u32(arr) { return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); } function createView(arr) { return new DataView(arr.buffer, arr.byteOffset, arr.byteLength); } function rotr(word, shift) { return word << 32 - shift | word >>> shift; } function rotl(word, shift) { return word << shift | word >>> 32 - shift >>> 0; } exports22.isLE = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)(); function byteSwap(word) { return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255; } exports22.byteSwapIfBE = exports22.isLE ? (n2) => n2 : (n2) => byteSwap(n2); function byteSwap32(arr) { for (let i2 = 0; i2 < arr.length; i2++) { arr[i2] = byteSwap(arr[i2]); } } var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_3, i2) => i2.toString(16).padStart(2, "0")); function bytesToHex(bytes) { (0, _assert_js_1.abytes)(bytes); let hex3 = ""; for (let i2 = 0; i2 < bytes.length; i2++) { hex3 += hexes[bytes[i2]]; } return hex3; } var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; function asciiToBase16(ch) { if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); return; } function hexToBytes(hex3) { if (typeof hex3 !== "string") throw new Error("hex string expected, got " + typeof hex3); const hl = hex3.length; const al = hl / 2; if (hl % 2) throw new Error("hex string expected, got unpadded hex of length " + hl); const array22 = new Uint8Array(al); for (let ai2 = 0, hi2 = 0; ai2 < al; ai2++, hi2 += 2) { const n1 = asciiToBase16(hex3.charCodeAt(hi2)); const n2 = asciiToBase16(hex3.charCodeAt(hi2 + 1)); if (n1 === void 0 || n2 === void 0) { const char = hex3[hi2] + hex3[hi2 + 1]; throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi2); } array22[ai2] = n1 * 16 + n2; } return array22; } var nextTick = async () => { }; exports22.nextTick = nextTick; async function asyncLoop(iters, tick, cb) { let ts = Date.now(); for (let i2 = 0; i2 < iters; i2++) { cb(i2); const diff = Date.now() - ts; if (diff >= 0 && diff < tick) continue; await (0, exports22.nextTick)(); ts += diff; } } function utf8ToBytes(str) { if (typeof str !== "string") throw new Error("utf8ToBytes expected string, got " + typeof str); return new Uint8Array(new TextEncoder().encode(str)); } function toBytes(data) { if (typeof data === "string") data = utf8ToBytes(data); (0, _assert_js_1.abytes)(data); return data; } function concatBytes(...arrays) { let sum2 = 0; for (let i2 = 0; i2 < arrays.length; i2++) { const a2 = arrays[i2]; (0, _assert_js_1.abytes)(a2); sum2 += a2.length; } const res = new Uint8Array(sum2); for (let i2 = 0, pad2 = 0; i2 < arrays.length; i2++) { const a2 = arrays[i2]; res.set(a2, pad2); pad2 += a2.length; } return res; } var Hash2 = class { // Safe version that clones internal state clone() { return this._cloneInto(); } }; exports22.Hash = Hash2; function checkOpts(defaults2, opts) { if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]") throw new Error("Options should be object or undefined"); const merged = Object.assign(defaults2, opts); return merged; } function wrapConstructor(hashCons) { const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); const tmp = hashCons(); hashC.outputLen = tmp.outputLen; hashC.blockLen = tmp.blockLen; hashC.create = () => hashCons(); return hashC; } function wrapConstructorWithOpts(hashCons) { const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); const tmp = hashCons({}); hashC.outputLen = tmp.outputLen; hashC.blockLen = tmp.blockLen; hashC.create = (opts) => hashCons(opts); return hashC; } function wrapXOFConstructorWithOpts(hashCons) { const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); const tmp = hashCons({}); hashC.outputLen = tmp.outputLen; hashC.blockLen = tmp.blockLen; hashC.create = (opts) => hashCons(opts); return hashC; } function randomBytes(bytesLength = 32) { if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") { return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength)); } if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === "function") { return crypto_1.crypto.randomBytes(bytesLength); } throw new Error("crypto.getRandomValues must be defined"); } } }); var require_sha3 = __commonJS2({ "../../node_modules/.pnpm/@noble+hashes@1.7.1/node_modules/@noble/hashes/sha3.js"(exports22) { "use strict"; Object.defineProperty(exports22, "__esModule", { value: true }); exports22.shake256 = exports22.shake128 = exports22.keccak_512 = exports22.keccak_384 = exports22.keccak_256 = exports22.keccak_224 = exports22.sha3_512 = exports22.sha3_384 = exports22.sha3_256 = exports22.sha3_224 = exports22.Keccak = void 0; exports22.keccakP = keccakP; var _assert_js_1 = require_assert(); var _u64_js_1 = require_u64(); var utils_js_1 = require_utils(); var SHA3_PI = []; var SHA3_ROTL = []; var _SHA3_IOTA = []; var _0n = /* @__PURE__ */ BigInt(0); var _1n = /* @__PURE__ */ BigInt(1); var _2n = /* @__PURE__ */ BigInt(2); var _7n = /* @__PURE__ */ BigInt(7); var _256n = /* @__PURE__ */ BigInt(256); var _0x71n = /* @__PURE__ */ BigInt(113); for (let round2 = 0, R2 = _1n, x2 = 1, y2 = 0; round2 < 24; round2++) { [x2, y2] = [y2, (2 * x2 + 3 * y2) % 5]; SHA3_PI.push(2 * (5 * y2 + x2)); SHA3_ROTL.push((round2 + 1) * (round2 + 2) / 2 % 64); let t2 = _0n; for (let j2 = 0; j2 < 7; j2++) { R2 = (R2 << _1n ^ (R2 >> _7n) * _0x71n) % _256n; if (R2 & _2n) t2 ^= _1n << (_1n << /* @__PURE__ */ BigInt(j2)) - _1n; } _SHA3_IOTA.push(t2); } var [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ (0, _u64_js_1.split)(_SHA3_IOTA, true); var rotlH = (h2, l2, s2) => s2 > 32 ? (0, _u64_js_1.rotlBH)(h2, l2, s2) : (0, _u64_js_1.rotlSH)(h2, l2, s2); var rotlL = (h2, l2, s2) => s2 > 32 ? (0, _u64_js_1.rotlBL)(h2, l2, s2) : (0, _u64_js_1.rotlSL)(h2, l2, s2); function keccakP(s2, rounds = 24) { const B2 = new Uint32Array(5 * 2); for (let round2 = 24 - rounds; round2 < 24; round2++) { for (let x2 = 0; x2 < 10; x2++) B2[x2] = s2[x2] ^ s2[x2 + 10] ^ s2[x2 + 20] ^ s2[x2 + 30] ^ s2[x2 + 40]; for (let x2 = 0; x2 < 10; x2 += 2) { const idx1 = (x2 + 8) % 10; const idx0 = (x2 + 2) % 10; const B0 = B2[idx0]; const B1 = B2[idx0 + 1]; const Th = rotlH(B0, B1, 1) ^ B2[idx1]; const Tl = rotlL(B0, B1, 1) ^ B2[idx1 + 1]; for (let y2 = 0; y2 < 50; y2 += 10) { s2[x2 + y2] ^= Th; s2[x2 + y2 + 1] ^= Tl; } } let curH = s2[2]; let curL = s2[3]; for (let t2 = 0; t2 < 24; t2++) { const shift = SHA3_ROTL[t2]; const Th = rotlH(curH, curL, shift); const Tl = rotlL(curH, curL, shift); const PI2 = SHA3_PI[t2]; curH = s2[PI2]; curL = s2[PI2 + 1]; s2[PI2] = Th; s2[PI2 + 1] = Tl; } for (let y2 = 0; y2 < 50; y2 += 10) { for (let x2 = 0; x2 < 10; x2++) B2[x2] = s2[y2 + x2]; for (let x2 = 0; x2 < 10; x2++) s2[y2 + x2] ^= ~B2[(x2 + 2) % 10] & B2[(x2 + 4) % 10]; } s2[0] ^= SHA3_IOTA_H[round2]; s2[1] ^= SHA3_IOTA_L[round2]; } B2.fill(0); } var Keccak = class _Keccak extends utils_js_1.Hash { // NOTE: we accept arguments in bytes instead of bits here. constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { super(); this.blockLen = blockLen; this.suffix = suffix; this.outputLen = outputLen; this.enableXOF = enableXOF; this.rounds = rounds; this.pos = 0; this.posOut = 0; this.finished = false; this.destroyed = false; (0, _assert_js_1.anumber)(outputLen); if (0 >= this.blockLen || this.blockLen >= 200) throw new Error("Sha3 supports only keccak-f1600 function"); this.state = new Uint8Array(200); this.state32 = (0, utils_js_1.u32)(this.state); } keccak() { if (!utils_js_1.isLE) (0, utils_js_1.byteSwap32)(this.state32); keccakP(this.state32, this.rounds); if (!utils_js_1.isLE) (0, utils_js_1.byteSwap32)(this.state32); this.posOut = 0; this.pos = 0; } update(data) { (0, _assert_js_1.aexists)(this); const { blockLen, state: state2 } = this; data = (0, utils_js_1.toBytes)(data); const len = data.length; for (let pos = 0; pos < len; ) { const take = Math.min(blockLen - this.pos, len - pos); for (let i2 = 0; i2 < take; i2++) state2[this.pos++] ^= data[pos++]; if (this.pos === blockLen) this.keccak(); } return this; } finish() { if (this.finished) return; this.finished = true; const { state: state2, suffix, pos, blockLen } = this; state2[pos] ^= suffix; if ((suffix & 128) !== 0 && pos === blockLen - 1) this.keccak(); state2[blockLen - 1] ^= 128; this.keccak(); } writeInto(out) { (0, _assert_js_1.aexists)(this, false); (0, _assert_js_1.abytes)(out); this.finish(); const bufferOut = this.state; const { blockLen } = this; for (let pos = 0, len = out.length; pos < len; ) { if (this.posOut >= blockLen) this.keccak(); const take = Math.min(blockLen - this.posOut, len - pos); out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); this.posOut += take; pos += take; } return out; } xofInto(out) { if (!this.enableXOF) throw new Error("XOF is not possible for this instance"); return this.writeInto(out); } xof(bytes) { (0, _assert_js_1.anumber)(bytes); return this.xofInto(new Uint8Array(bytes)); } digestInto(out) { (0, _assert_js_1.aoutput)(out, this); if (this.finished) throw new Error("digest() was already called"); this.writeInto(out); this.destroy(); return out; } digest() { return this.digestInto(new Uint8Array(this.outputLen)); } destroy() { this.destroyed = true; this.state.fill(0); } _cloneInto(to2) { const { blockLen, suffix, outputLen, rounds, enableXOF } = this; to2 || (to2 = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); to2.state32.set(this.state32); to2.pos = this.pos; to2.posOut = this.posOut; to2.finished = this.finished; to2.rounds = rounds; to2.suffix = suffix; to2.outputLen = outputLen; to2.enableXOF = enableXOF; to2.destroyed = this.destroyed; return to2; } }; exports22.Keccak = Keccak; var gen = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapConstructor)(() => new Keccak(blockLen, suffix, outputLen)); exports22.sha3_224 = gen(6, 144, 224 / 8); exports22.sha3_256 = gen(6, 136, 256 / 8); exports22.sha3_384 = gen(6, 104, 384 / 8); exports22.sha3_512 = gen(6, 72, 512 / 8); exports22.keccak_224 = gen(1, 144, 224 / 8); exports22.keccak_256 = gen(1, 136, 256 / 8); exports22.keccak_384 = gen(1, 104, 384 / 8); exports22.keccak_512 = gen(1, 72, 512 / 8); var genShake = (suffix, blockLen, outputLen) => (0, utils_js_1.wrapXOFConstructorWithOpts)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true)); exports22.shake128 = genShake(31, 168, 128 / 8); exports22.shake256 = genShake(31, 136, 256 / 8); } }); var require_src = __commonJS2({ "../../node_modules/.pnpm/@paralleldrive+cuid2@2.2.2/node_modules/@paralleldrive/cuid2/src/index.js"(exports22, module22) { "use strict"; var { sha3_512: sha3 } = require_sha3(); var defaultLength = 24; var bigLength = 32; var createEntropy = (length2 = 4, random2 = Math.random) => { let entropy = ""; while (entropy.length < length2) { entropy = entropy + Math.floor(random2() * 36).toString(36); } return entropy; }; function bufToBigInt(buf) { let bits = 8n; let value = 0n; for (const i2 of buf.values()) { const bi2 = BigInt(i2); value = (value << bits) + bi2; } return value; } var hash2 = (input = "") => { return bufToBigInt(sha3(input)).toString(36).slice(1); }; var alphabet = Array.from( { length: 26 }, (x2, i2) => String.fromCharCode(i2 + 97) ); var randomLetter = (random2) => alphabet[Math.floor(random2() * alphabet.length)]; var createFingerprint = ({ globalObj = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {}, random: random2 = Math.random } = {}) => { const globals = Object.keys(globalObj).toString(); const sourceString = globals.length ? globals + createEntropy(bigLength, random2) : createEntropy(bigLength, random2); return hash2(sourceString).substring(0, bigLength); }; var createCounter = (count) => () => { return count++; }; var initialCountMax = 476782367; var init3 = ({ // Fallback if the user does not pass in a CSPRNG. This should be OK // because we don't rely solely on the random number generator for entropy. // We also use the host fingerprint, current time, and a session counter. random: random2 = Math.random, counter = createCounter(Math.floor(random2() * initialCountMax)), length: length2 = defaultLength, fingerprint: fingerprint2 = createFingerprint({ random: random2 }) } = {}) => { return function cuid24() { const firstLetter = randomLetter(random2); const time3 = Date.now().toString(36); const count = counter().toString(36); const salt = createEntropy(length2, random2); const hashInput = `${time3 + salt + count + fingerprint2}`; return `${firstLetter + hash2(hashInput).substring(1, length2)}`; }; }; var createId = init3(); var isCuid2 = (id, { minLength: minLength2 = 2, maxLength = bigLength } = {}) => { const length2 = id.length; const regex = /^[0-9a-z]+$/; try { if (typeof id === "string" && length2 >= minLength2 && length2 <= maxLength && regex.test(id)) return true; } finally { } return false; }; module22.exports.getConstants = () => ({ defaultLength, bigLength }); module22.exports.init = init3; module22.exports.createId = createId; module22.exports.bufToBigInt = bufToBigInt; module22.exports.createCounter = createCounter; module22.exports.createFingerprint = createFingerprint; module22.exports.isCuid = isCuid2; } }); var require_cuid2 = __commonJS2({ "../../node_modules/.pnpm/@paralleldrive+cuid2@2.2.2/node_modules/@paralleldrive/cuid2/index.js"(exports22, module22) { "use strict"; var { createId, init: init3, getConstants, isCuid: isCuid2 } = require_src(); module22.exports.createId = createId; module22.exports.init = init3; module22.exports.getConstants = getConstants; module22.exports.isCuid = isCuid2; } }); var require_package = __commonJS2({ "../../node_modules/.pnpm/mariadb@3.4.5/node_modules/mariadb/package.json"(exports22, module22) { module22.exports = { name: "mariadb", version: "3.4.5", description: "fast mariadb or mysql connector.", main: "promise.js", types: "types/index.d.ts", typesVersions: { "*": { callback: [ "types/callback.d.ts" ], "*": [ "types/index.d.ts" ] } }, directories: { lib: "lib", test: "test" }, private: false, scripts: { test: "npm run test:types-prettier && npm run test:prettier && npm run test:types && npm run test:lint && npm run test:base", "test:base": 'mocha --no-parallel --timeout 5000 "test/**/*.js"', "test:lint": 'eslint "*.js" "{lib,test}/**/*.js"', "test:types": 'eslint "types/*.ts"', "test:types-prettier": 'prettier --write "types/*.ts"', "test:prettier": 'prettier --write "*.js" "{tools,lib,test,benchmarks}/**/*.js"', coverage: "npm run coverage:test && npm run coverage:create && npm run coverage:send", "coverage:test": 'nyc mocha --no-parallel --timeout 5000 "test/**/*.js"', "coverage:report": "npm run coverage:create && npm run coverage:send", "coverage:create": "nyc report --reporter=text-lcov > coverage.lcov", "coverage:send": "./codecov --disable=gcov", benchmark: "node benchmarks/benchmarks-all.js", generate: "node ./tools/generate-mariadb.js" }, repository: { type: "git", url: "git+https://github.com/mariadb-corporation/mariadb-connector-nodejs.git" }, keywords: [ "mariadb", "mysql", "client", "driver", "connector" ], files: [ "lib", "types/index.d.ts", "types/callback.d.ts", "types/share.d.ts", "promise.js", "check-node.js", "callback.js" ], engines: { node: ">= 14" }, author: "Diego Dupin <diego.dupin@mariadb.com>", license: "LGPL-2.1-or-later", dependencies: { "@types/geojson": "^7946.0.16", "@types/node": "^24.0.13", denque: "^2.1.0", "iconv-lite": "^0.6.3", "lru-cache": "^10.4.3" }, devDependencies: { "@typescript-eslint/eslint-plugin": "^8.36.0", "@typescript-eslint/parser": "^8.36.0", benchmark: "^2.1.4", chai: "^4.5.0", chalk: "^5.4.1", "error-stack-parser": "^2.1.4", eslint: "^8.57.1", "eslint-config-prettier": "^10.1.5", "eslint-plugin-markdown": "^5.1.0", "eslint-plugin-prettier": "^5.5.1", mocha: "^11.7.1", "mocha-lcov-reporter": "^1.3.0", nyc: "^17.1.0", prettier: "^3.6.2", typescript: "^5.8.3", winston: "^3.17.0" }, bugs: { url: "https://jira.mariadb.org/projects/CONJS/" }, homepage: "https://github.com/mariadb-corporation/mariadb-connector-nodejs#readme" }; } }); var require_check_node = __commonJS2({ "../../node_modules/.pnpm/mariadb@3.4.5/node_modules/mariadb/check-node.js"(exports22, module22) { "use strict"; var hasMinVersion = function(nodeVersionStr, connectorRequirement2) { const versNode = nodeVersionStr.split("."); const versReq = connectorRequirement2.split("."); const majorNode = Number(versNode[0]); const majorReq = Number(versReq[0]); if (majorNode > majorReq) return true; if (majorNode < majorReq) return false; if (versReq.length === 1) return true; const minorNode = Number(versNode[1]); const minorReq = Number(versReq[1]); return minorNode >= minorReq; }; module22.exports.hasMinVersion = hasMinVersion; var requirement = require_package().engines.node; var connectorRequirement = requirement.replace(">=", "").trim(); var currentNodeVersion = process.version.replace("v", ""); if (!hasMinVersion(currentNodeVersion, connectorRequirement)) { console.error(`please upgrade node: mariadb requires at least version ${connectorRequirement}`); process.exit(1); } } }); var require_denque = __commonJS2({ "../../node_modules/.pnpm/denque@2.1.0/node_modules/denque/index.js"(exports22, module22) { "use strict"; function Denque(array22, options) { var options = options || {}; this._capacity = options.capacity; this._head = 0; this._tail = 0; if (Array.isArray(array22)) { this._fromArray(array22); } else { this._capacityMask = 3; this._list = new Array(4); } } Denque.prototype.peekAt = function peekAt(index) { var i2 = index; if (i2 !== (i2 | 0)) { return void 0; } var len = this.size(); if (i2 >= len || i2 < -len) return void 0; if (i2 < 0) i2 += len; i2 = this._head + i2 & this._capacityMask; return this._list[i2]; }; Denque.prototype.get = function get(i2) { return this.peekAt(i2); }; Denque.prototype.peek = function peek() { if (this._head === this._tail) return void 0; return this._list[this._head]; }; Denque.prototype.peekFront = function peekFront() { return this.peek(); }; Denque.prototype.peekBack = function peekBack() { return this.peekAt(-1); }; Object.defineProperty(Denque.prototype, "length", { get: function length2() { return this.size(); } }); Denque.prototype.size = function size() { if (this._head === this._tail) return 0; if (this._head < this._tail) return this._tail - this._head; else return this._capacityMask + 1 - (this._head - this._tail); }; Denque.prototype.unshift = function unshift(item) { if (arguments.length === 0) return this.size(); var len = this._list.length; this._head = this._head - 1 + len & this._capacityMask; this._list[this._head] = item; if (this._tail === this._head) this._growArray(); if (this._capacity && this.size() > this._capacity) this.pop(); if (this._head < this._tail) return this._tail - this._head; else return this._capacityMask + 1 - (this._head - this._tail); }; Denque.prototype.shift = function shift() { var head = this._head; if (head === this._tail) return void 0; var item = this._list[head]; this._list[head] = void 0; this._head = head + 1 & this._capacityMask; if (head < 2 && this._tail > 1e4 && this._tail <= this._list.length >>> 2) this._shrinkArray(); return item; }; Denque.prototype.push = function push(item) { if (arguments.length === 0) return this.size(); var tail = this._tail; this._list[tail] = item; this._tail = tail + 1 & this._capacityMask; if (this._tail === this._head) { this._growArray(); } if (this._capacity && this.size() > this._capacity) { this.shift(); } if (this._head < this._tail) return this._tail - this._head; else return this._capacityMask + 1 - (this._head - this._tail); }; Denque.prototype.pop = function pop() { var tail = this._tail; if (tail === this._head) return void 0; var len = this._list.length; this._tail = tail - 1 + len & this._capacityMask; var item = this._list[this._tail]; this._list[this._tail] = void 0; if (this._head < 2 && tail > 1e4 && tail <= len >>> 2) this._shrinkArray(); return item; }; Denque.prototype.removeOne = function removeOne(index) { var i2 = index; if (i2 !== (i2 | 0)) { return void 0; } if (this._head === this._tail) return void 0; var size = this.size(); var len = this._list.length; if (i2 >= size || i2 < -size) return void 0; if (i2 < 0) i2 += size; i2 = this._head + i2 & this._capacityMask; var item = this._list[i2]; var k2; if (index < size / 2) { for (k2 = index; k2 > 0; k2--) { this._list[i2] = this._list[i2 = i2 - 1 + len & this._capacityMask]; } this._list[i2] = void 0; this._head = this._head + 1 + len & this._capacityMask; } else { for (k2 = size - 1 - index; k2 > 0; k2--) { this._list[i2] = this._list[i2 = i2 + 1 + len & this._capacityMask]; } this._list[i2] = void 0; this._tail = this._tail - 1 + len & this._capacityMask; } return item; }; Denque.prototype.remove = function remove(index, count) { var i2 = index; var removed; var del_count = count; if (i2 !== (i2 | 0)) { return void 0; } if (this._head === this._tail) return void 0; var size = this.size(); var len = this._list.length; if (i2 >= size || i2 < -size || count < 1) return void 0; if (i2 < 0) i2 += size; if (count === 1 || !count) { removed = new Array(1); removed[0] = this.removeOne(i2); return removed; } if (i2 === 0 && i2 + count >= size) { removed = this.toArray(); this.clear(); return removed; } if (i2 + count > size) count = size - i2; var k2; removed = new Array(count); for (k2 = 0; k2 < count; k2++) { removed[k2] = this._list[this._head + i2 + k2 & this._capacityMask]; } i2 = this._head + i2 & this._capacityMask; if (index + count === size) { this._tail = this._tail - count + len & this._capacityMask; for (k2 = count; k2 > 0; k2--) { this._list[i2 = i2 + 1 + len & this._capacityMask] = void 0; } return removed; } if (index === 0) { this._head = this._head + count + len & this._capacityMask; for (k2 = count - 1; k2 > 0; k2--) { this._list[i2 = i2 + 1 + len & this._capacityMask] = void 0; } return removed; } if (i2 < size / 2) { this._head = this._head + index + count + len & this._capacityMask; for (k2 = index; k2 > 0; k2--) { this.unshift(this._list[i2 = i2 - 1 + len & this._capacityMask]); } i2 = this._head - 1 + len & this._capacityMask; while (del_count > 0) { this._list[i2 = i2 - 1 + len & this._capacityMask] = void 0; del_count--; } if (index < 0) this._tail = i2; } else { this._tail = i2; i2 = i2 + count + len & this._capacityMask; for (k2 = size - (count + index); k2 > 0; k2--) { this.push(this._list[i2++]); } i2 = this._tail; while (del_count > 0) { this._list[i2 = i2 + 1 + len & this._capacityMask] = void 0; del_count--; } } if (this._head < 2 && this._tail > 1e4 && this._tail <= len >>> 2) this._shrinkArray(); return removed; }; Denque.prototype.splice = function splice(index, count) { var i2 = index; if (i2 !== (i2 | 0)) { return void 0; } var size = this.size(); if (i2 < 0) i2 += size; if (i2 > size) return void 0; if (arguments.length > 2) { var k2; var temp; var removed; var arg_len = arguments.length; var len = this._list.length; var arguments_index = 2; if (!size || i2 < size / 2) { temp = new Array(i2); for (k2 = 0; k2 < i2; k2++) { temp[k2] = this._list[this._head + k2 & this._capacityMask]; } if (count === 0) { removed = []; if (i2 > 0) { this._head = this._head + i2 + len & this._capacityMask; } } else { removed = this.remove(i2, count); this._head = this._head + i2 + len & this._capacityMask; } while (arg_len > arguments_index) { this.unshift(arguments[--arg_len]); } for (k2 = i2; k2 > 0; k2--) { this.unshift(temp[k2 - 1]); } } else { temp = new Array(size - (i2 + count)); var leng = temp.length; for (k2 = 0; k2 < leng; k2++) { temp[k2] = this._list[this._head + i2 + count + k2 & this._capacityMask]; } if (count === 0) { removed = []; if (i2 != size) { this._tail = this._head + i2 + len & this._capacityMask; } } else { removed = this.remove(i2, count); this._tail = this._tail - leng + len & this._capacityMask; } while (arguments_index < arg_len) { this.push(arguments[arguments_index++]); } for (k2 = 0; k2 < leng; k2++) { this.push(temp[k2]); } } return removed; } else { return this.remove(i2, count); } }; Denque.prototype.clear = function clear() { this._list = new Array(this._list.length); this._head = 0; this._tail = 0; }; Denque.prototype.isEmpty = function isEmpty2() { return this._head === this._tail; }; Denque.prototype.toArray = function toArray() { return this._copyArray(false); }; Denque.prototype._fromArray = function _fromArray(array22) { var length2 = array22.length; var capacity = this._nextPowerOf2(length2); this._list = new Array(capacity); this._capacityMask = capacity - 1; this._tail = length2; for (var i2 = 0; i2 < length2; i2++) this._list[i2] = array22[i2]; }; Denque.prototype._copyArray = function _copyArray(fullCopy, size) { var src = this._list; var capacity = src.length; var length2 = this.length; size = size | length2; if (size == length2 && this._head < this._tail) { return this._list.slice(this._head, this._tail); } var dest = new Array(size); var k2 = 0; var i2; if (fullCopy || this._head > this._tail) { for (i2 = this._head; i2 < capacity; i2++) dest[k2++] = src[i2]; for (i2 = 0; i2 < this._tail; i2++) dest[k2++] = src[i2]; } else { for (i2 = this._head; i2 < this._tail; i2++) dest[k2++] = src[i2]; } return dest; }; Denque.prototype._growArray = function _growArray() { if (this._head != 0) { var newList = this._copyArray(true, this._list.length << 1); this._tail = this._list.length; this._head = 0; this._list = newList; } else { this._tail = this._list.length; this._list.length <<= 1; } this._capacityMask = this._capacityMask << 1 | 1; }; Denque.prototype._shrinkArray = function _shrinkArray() { this._list.length >>>= 1; this._capacityMask >>>= 1; }; Denque.prototype._nextPowerOf2 = function _nextPowerOf2(num) { var log22 = Math.log(num) / Math.log(2); var nextPow2 = 1 << log22 + 1; return Math.max(nextPow2, 4); }; module22.exports = Denque; } }); var require_error_code = __commonJS2({ "../../node_modules/.pnpm/mariadb@3.4.5/node_modules/mariadb/lib/const/error-code.js"(exports22, module22) { "use strict"; var codes = {}; codes[120] = "HA_ERR_KEY_NOT_FOUND"; codes[121] = "HA_ERR_FOUND_DUPP_KEY"; codes[122] = "HA_ERR_INTERNAL_ERROR"; codes[123] = "HA_ERR_RECORD_CHANGED"; codes[124] = "HA_ERR_WRONG_INDEX"; codes[126] = "HA_ERR_CRASHED"; codes[127] = "HA_ERR_WRONG_IN_RECORD"; codes[128] = "HA_ERR_OUT_OF_MEM"; codes[130] = "HA_ERR_NOT_A_TABLE"; codes[131] = "HA_ERR_WRONG_COMMAND"; codes[132] = "HA_ERR_OLD_FILE"; codes[133] = "HA_ERR_NO_ACTIVE_RECORD"; codes[134] = "HA_ERR_RECORD_DELETED"; codes[135] = "HA_ERR_RECORD_FILE_FULL"; codes[136] = "HA_ERR_INDEX_FILE_FULL"; codes[137] = "HA_ERR_END_OF_FILE"; codes[138] = "HA_ERR_UNSUPPORTED"; codes[139] = "HA_ERR_TO_BIG_ROW"; codes[140] = "HA_WRONG_CREATE_OPTION"; codes[141] = "HA_ERR_FOUND_DUPP_UNIQUE"; codes[142] = "HA_ERR_UNKNOWN_CHARSET"; codes[143] = "HA_ERR_WRONG_MRG_TABLE_DEF"; codes[144] = "HA_ERR_CRASHED_ON_REPAIR"; codes[145] = "HA_ERR_CRASHED_ON_USAGE"; codes[146] = "HA_ERR_LOCK_WAIT_TIMEOUT"; codes[147] = "HA_ERR_LOCK_TABLE_FULL"; codes[148] = "HA_ERR_READ_ONLY_TRANSACTION"; codes[149] = "HA_ERR_LOCK_DEADLOCK"; codes[150] = "HA_ERR_CANNOT_ADD_FOREIGN"; codes[151] = "HA_ERR_NO_REFERENCED_ROW"; codes[152] = "HA_ERR_ROW_IS_REFERENCED"; codes[153] = "HA_ERR_NO_SAVEPOINT"; codes[154] = "HA_ERR_NON_UNIQUE_BLOCK_SIZE"; codes[155] = "HA_ERR_NO_SUCH_TABLE"; codes[156] = "HA_ERR_TABLE_EXIST"; codes[157] = "HA_ERR_NO_CONNECTION"; codes[158] = "HA_ERR_NULL_IN_SPATIAL"; codes[159] = "HA_ERR_TABLE_DEF_CHANGED"; codes[160] = "HA_ERR_NO_PARTITION_FOUND"; codes[161] = "HA_ERR_RBR_LOGGING_FAILED"; codes[162] = "HA_ERR_DROP_INDEX_FK"; codes[163] = "HA_ERR_FOREIGN_DUPLICATE_KEY"; codes[164] = "HA_ERR_TABLE_NEEDS_UPGRADE"; codes[165] = "HA_ERR_TABLE_READONLY"; codes[166] = "HA_ERR_AUTOINC_READ_FAILED"; codes[167] = "HA_ERR_AUTOINC_ERANGE"; codes[168] = "HA_ERR_GENERIC"; codes[169] = "HA_ERR_RECORD_IS_THE_SAME"; codes[170] = "HA_ERR_LOGGING_IMPOSSIBLE"; codes[171] = "HA_ERR_CORRUPT_EVENT"; codes[172] = "HA_ERR_NEW_FILE"; codes[173] = "HA_ERR_ROWS_EVENT_APPLY"; codes[174] = "HA_ERR_INITIALIZATION"; codes[175] = "HA_ERR_FILE_TOO_SHORT"; codes[176] = "HA_ERR_WRONG_CRC"; codes[177] = "HA_ERR_TOO_MANY_CONCURRENT_TRXS"; codes[178] = "HA_ERR_NOT_IN_LOCK_PARTITIONS"; codes[179] = "HA_ERR_INDEX_COL_TOO_LONG"; codes[180] = "HA_ERR_INDEX_CORRUPT"; codes[181] = "HA_ERR_UNDO_REC_TOO_BIG"; codes[182] = "HA_FTS_INVALID_DOCID"; codes[184] = "HA_ERR_TABLESPACE_EXISTS"; codes[185] = "HA_ERR_TOO_MANY_FIELDS"; codes[186] = "HA_ERR_ROW_IN_WRONG_PARTITION"; codes[187] = "HA_ERR_ROW_NOT_VISIBLE"; codes[188] = "HA_ERR_ABORTED_BY_USER"; codes[189] = "HA_ERR_DISK_FULL"; codes[190] = "HA_ERR_INCOMPATIBLE_DEFINITION"; codes[191] = "HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE"; codes[192] = "HA_ERR_DECRYPTION_FAILED"; codes[193] = "HA_ERR_FK_DEPTH_EXCEEDED"; codes[194] = "HA_ERR_TABLESPACE_MISSING"; codes[195] = "HA_ERR_SEQUENCE_INVALID_DATA"; codes[196] = "HA_ERR_SEQUENCE_RUN_OUT"; codes[197] = "HA_ERR_COMMIT_ERROR"; codes[198] = "HA_ERR_PARTITION_LIST"; codes[1e3] = "ER_HASHCHK"; codes[1001] = "ER_NISAMCHK"; codes[1002] = "ER_NO";