From c225864b45b83ad24bc6b7c48fea6ae61f3aa074 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 26 Nov 2024 13:12:01 +0000 Subject: [PATCH 01/40] Added .prettierrc --- .prettierrc | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} From 9b403a34c8df4989679272e023492c24f246878b Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 26 Nov 2024 13:14:14 +0000 Subject: [PATCH 02/40] Updated all packages (except pg, deliberately held back) --- dist/serverless.mjs | 13207 +++++++----------------------------------- package-lock.json | 1449 +++-- package.json | 6 +- 3 files changed, 3156 insertions(+), 11506 deletions(-) diff --git a/dist/serverless.mjs b/dist/serverless.mjs index 726e874..d58ec68 100644 --- a/dist/serverless.mjs +++ b/dist/serverless.mjs @@ -1,10983 +1,2238 @@ -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 __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -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/base64-js/index.js -var require_base64_js = __commonJS({ - "node_modules/base64-js/index.js"(exports) { - "use strict"; - init_shims(); - exports.byteLength = byteLength; - exports.toByteArray = toByteArray; - exports.fromByteArray = fromByteArray; - var lookup = []; - var revLookup = []; - var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; - var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - for (i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; - } - var i; - var len; - revLookup["-".charCodeAt(0)] = 62; - revLookup["_".charCodeAt(0)] = 63; - function getLens(b64) { - var len2 = b64.length; - if (len2 % 4 > 0) { - throw new Error("Invalid string. Length must be a multiple of 4"); - } - var validLen = b64.indexOf("="); - if (validLen === -1) validLen = len2; - var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4; - return [validLen, placeHoldersLen]; - } - __name(getLens, "getLens"); - function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; - } - __name(byteLength, "byteLength"); - function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; - } - __name(_byteLength, "_byteLength"); - function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i2; - for (i2 = 0; i2 < len2; i2 += 4) { - tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)]; - arr[curByte++] = tmp >> 16 & 255; - arr[curByte++] = tmp >> 8 & 255; - arr[curByte++] = tmp & 255; - } - if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4; - arr[curByte++] = tmp & 255; - } - if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 255; - arr[curByte++] = tmp & 255; - } - return arr; - } - __name(toByteArray, "toByteArray"); - function tripletToBase64(num) { - return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63]; - } - __name(tripletToBase64, "tripletToBase64"); - function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for (var i2 = start; i2 < end; i2 += 3) { - tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255); - output.push(tripletToBase64(tmp)); - } - return output.join(""); - } - __name(encodeChunk, "encodeChunk"); - function fromByteArray(uint8) { - var tmp; - var len2 = uint8.length; - var extraBytes = len2 % 3; - var parts = []; - var maxChunkLength = 16383; - for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) { - parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength)); - } - if (extraBytes === 1) { - tmp = uint8[len2 - 1]; - parts.push( - lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==" - ); - } else if (extraBytes === 2) { - tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1]; - parts.push( - lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=" - ); - } - return parts.join(""); - } - __name(fromByteArray, "fromByteArray"); - } -}); - -// node_modules/ieee754/index.js -var require_ieee754 = __commonJS({ - "node_modules/ieee754/index.js"(exports) { - init_shims(); - exports.read = function(buffer, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) { - } - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) { - } - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : (s ? -1 : 1) * Infinity; - } else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); - }; - exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt2 = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) { - value += rt2 / c; - } else { - value += rt2 * Math.pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) { - } - e = e << mLen | m; - eLen += mLen; - for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) { - } - buffer[offset + i - d] |= s * 128; - }; - } -}); - -// node_modules/buffer/index.js -var require_buffer = __commonJS({ - "node_modules/buffer/index.js"(exports) { - "use strict"; - init_shims(); - var base64 = require_base64_js(); - var ieee754 = require_ieee754(); - var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null; - exports.Buffer = Buffer3; - exports.SlowBuffer = SlowBuffer; - exports.INSPECT_MAX_BYTES = 50; - var K_MAX_LENGTH = 2147483647; - exports.kMaxLength = K_MAX_LENGTH; - Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") { - console.error( - "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support." - ); - } - function typedArraySupport() { - try { - const arr = new Uint8Array(1); - const proto = { foo: /* @__PURE__ */ __name(function() { - return 42; - }, "foo") }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; - } - } - __name(typedArraySupport, "typedArraySupport"); - Object.defineProperty(Buffer3.prototype, "parent", { - enumerable: true, - get: /* @__PURE__ */ __name(function() { - if (!Buffer3.isBuffer(this)) return void 0; - return this.buffer; - }, "get") - }); - Object.defineProperty(Buffer3.prototype, "offset", { - enumerable: true, - get: /* @__PURE__ */ __name(function() { - if (!Buffer3.isBuffer(this)) return void 0; - return this.byteOffset; - }, "get") - }); - function createBuffer(length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"'); - } - const buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer3.prototype); - return buf; - } - __name(createBuffer, "createBuffer"); - function Buffer3(arg, encodingOrOffset, length) { - if (typeof arg === "number") { - if (typeof encodingOrOffset === "string") { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ); - } - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); - } - __name(Buffer3, "Buffer"); - Buffer3.poolSize = 8192; - function from(value, encodingOrOffset, length) { - if (typeof value === "string") { - return fromString(value, encodingOrOffset); - } - if (ArrayBuffer.isView(value)) { - return fromArrayView(value); - } - if (value == null) { - throw new TypeError( - "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value - ); - } - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length); - } - if (typeof value === "number") { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ); - } - const valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) { - return Buffer3.from(valueOf, encodingOrOffset, length); - } - const b = fromObject(value); - if (b) return b; - if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") { - return Buffer3.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length); - } - throw new TypeError( - "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value - ); - } - __name(from, "from"); - Buffer3.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); - }; - Object.setPrototypeOf(Buffer3.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer3, Uint8Array); - function assertSize(size) { - if (typeof size !== "number") { - throw new TypeError('"size" argument must be of type number'); - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"'); - } - } - __name(assertSize, "assertSize"); - function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) { - return createBuffer(size); - } - if (fill !== void 0) { - return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - } - return createBuffer(size); - } - __name(alloc, "alloc"); - Buffer3.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); - }; - function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); - } - __name(allocUnsafe, "allocUnsafe"); - Buffer3.allocUnsafe = function(size) { - return allocUnsafe(size); - }; - Buffer3.allocUnsafeSlow = function(size) { - return allocUnsafe(size); - }; - function fromString(string, encoding) { - if (typeof encoding !== "string" || encoding === "") { - encoding = "utf8"; - } - if (!Buffer3.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - const length = byteLength(string, encoding) | 0; - let buf = createBuffer(length); - const actual = buf.write(string, encoding); - if (actual !== length) { - buf = buf.slice(0, actual); - } - return buf; - } - __name(fromString, "fromString"); - function fromArrayLike(array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0; - const buf = createBuffer(length); - for (let i = 0; i < length; i += 1) { - buf[i] = array[i] & 255; - } - return buf; - } - __name(fromArrayLike, "fromArrayLike"); - function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); - } - __name(fromArrayView, "fromArrayView"); - function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds'); - } - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds'); - } - let buf; - if (byteOffset === void 0 && length === void 0) { - buf = new Uint8Array(array); - } else if (length === void 0) { - buf = new Uint8Array(array, byteOffset); - } else { - buf = new Uint8Array(array, byteOffset, length); - } - Object.setPrototypeOf(buf, Buffer3.prototype); - return buf; - } - __name(fromArrayBuffer, "fromArrayBuffer"); - function fromObject(obj) { - if (Buffer3.isBuffer(obj)) { - const len = checked(obj.length) | 0; - const buf = createBuffer(len); - if (buf.length === 0) { - return buf; - } - obj.copy(buf, 0, 0, len); - return buf; - } - if (obj.length !== void 0) { - if (typeof obj.length !== "number" || numberIsNaN(obj.length)) { - return createBuffer(0); - } - return fromArrayLike(obj); - } - if (obj.type === "Buffer" && Array.isArray(obj.data)) { - return fromArrayLike(obj.data); - } - } - __name(fromObject, "fromObject"); - function checked(length) { - if (length >= K_MAX_LENGTH) { - throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes"); - } - return length | 0; - } - __name(checked, "checked"); - function SlowBuffer(length) { - if (+length != length) { - length = 0; - } - return Buffer3.alloc(+length); - } - __name(SlowBuffer, "SlowBuffer"); - Buffer3.isBuffer = /* @__PURE__ */ __name(function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer3.prototype; - }, "isBuffer"); - Buffer3.compare = /* @__PURE__ */ __name(function compare(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer3.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer3.from(b, b.offset, b.byteLength); - if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ); - } - if (a === b) return 0; - let x = a.length; - let y = b.length; - for (let i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - if (x < y) return -1; - if (y < x) return 1; - return 0; - }, "compare"); - Buffer3.isEncoding = /* @__PURE__ */ __name(function isEncoding(encoding) { - switch (String(encoding).toLowerCase()) { - case "hex": - case "utf8": - case "utf-8": - case "ascii": - case "latin1": - case "binary": - case "base64": - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return true; - default: - return false; - } - }, "isEncoding"); - Buffer3.concat = /* @__PURE__ */ __name(function concat(list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } - if (list.length === 0) { - return Buffer3.alloc(0); - } - let i; - if (length === void 0) { - length = 0; - for (i = 0; i < list.length; ++i) { - length += list[i].length; - } - } - const buffer = Buffer3.allocUnsafe(length); - let pos = 0; - for (i = 0; i < list.length; ++i) { - let buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer3.isBuffer(buf)) buf = Buffer3.from(buf); - buf.copy(buffer, pos); - } else { - Uint8Array.prototype.set.call( - buffer, - buf, - pos - ); - } - } else if (!Buffer3.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers'); - } else { - buf.copy(buffer, pos); - } - pos += buf.length; - } - return buffer; - }, "concat"); - function byteLength(string, encoding) { - if (Buffer3.isBuffer(string)) { - return string.length; - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength; - } - if (typeof string !== "string") { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string - ); - } - const len = string.length; - const mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) return 0; - let loweredCase = false; - for (; ; ) { - switch (encoding) { - case "ascii": - case "latin1": - case "binary": - return len; - case "utf8": - case "utf-8": - return utf8ToBytes(string).length; - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return len * 2; - case "hex": - return len >>> 1; - case "base64": - return base64ToBytes(string).length; - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length; - } - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - } - __name(byteLength, "byteLength"); - Buffer3.byteLength = byteLength; - function slowToString(encoding, start, end) { - let loweredCase = false; - if (start === void 0 || start < 0) { - start = 0; - } - if (start > this.length) { - return ""; - } - if (end === void 0 || end > this.length) { - end = this.length; - } - if (end <= 0) { - return ""; - } - end >>>= 0; - start >>>= 0; - if (end <= start) { - return ""; - } - if (!encoding) encoding = "utf8"; - while (true) { - switch (encoding) { - case "hex": - return hexSlice(this, start, end); - case "utf8": - case "utf-8": - return utf8Slice(this, start, end); - case "ascii": - return asciiSlice(this, start, end); - case "latin1": - case "binary": - return latin1Slice(this, start, end); - case "base64": - return base64Slice(this, start, end); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return utf16leSlice(this, start, end); - default: - if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); - encoding = (encoding + "").toLowerCase(); - loweredCase = true; - } - } - } - __name(slowToString, "slowToString"); - Buffer3.prototype._isBuffer = true; - function swap(b, n, m) { - const i = b[n]; - b[n] = b[m]; - b[m] = i; - } - __name(swap, "swap"); - Buffer3.prototype.swap16 = /* @__PURE__ */ __name(function swap16() { - const len = this.length; - if (len % 2 !== 0) { - throw new RangeError("Buffer size must be a multiple of 16-bits"); - } - for (let i = 0; i < len; i += 2) { - swap(this, i, i + 1); - } - return this; - }, "swap16"); - Buffer3.prototype.swap32 = /* @__PURE__ */ __name(function swap32() { - const len = this.length; - if (len % 4 !== 0) { - throw new RangeError("Buffer size must be a multiple of 32-bits"); - } - for (let i = 0; i < len; i += 4) { - swap(this, i, i + 3); - swap(this, i + 1, i + 2); - } - return this; - }, "swap32"); - Buffer3.prototype.swap64 = /* @__PURE__ */ __name(function swap64() { - const len = this.length; - if (len % 8 !== 0) { - throw new RangeError("Buffer size must be a multiple of 64-bits"); - } - for (let i = 0; i < len; i += 8) { - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); - } - return this; - }, "swap64"); - Buffer3.prototype.toString = /* @__PURE__ */ __name(function toString() { - const length = this.length; - if (length === 0) return ""; - if (arguments.length === 0) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); - }, "toString"); - Buffer3.prototype.toLocaleString = Buffer3.prototype.toString; - Buffer3.prototype.equals = /* @__PURE__ */ __name(function equals(b) { - if (!Buffer3.isBuffer(b)) throw new TypeError("Argument must be a Buffer"); - if (this === b) return true; - return Buffer3.compare(this, b) === 0; - }, "equals"); - Buffer3.prototype.inspect = /* @__PURE__ */ __name(function inspect() { - let str = ""; - const max = exports.INSPECT_MAX_BYTES; - str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim(); - if (this.length > max) str += " ... "; - return ""; - }, "inspect"); - if (customInspectSymbol) { - Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect; - } - Buffer3.prototype.compare = /* @__PURE__ */ __name(function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer3.from(target, target.offset, target.byteLength); - } - if (!Buffer3.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target - ); - } - if (start === void 0) { - start = 0; - } - if (end === void 0) { - end = target ? target.length : 0; - } - if (thisStart === void 0) { - thisStart = 0; - } - if (thisEnd === void 0) { - thisEnd = this.length; - } - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError("out of range index"); - } - if (thisStart >= thisEnd && start >= end) { - return 0; - } - if (thisStart >= thisEnd) { - return -1; - } - if (start >= end) { - return 1; - } - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - let x = thisEnd - thisStart; - let y = end - start; - const len = Math.min(x, y); - const thisCopy = this.slice(thisStart, thisEnd); - const targetCopy = target.slice(start, end); - for (let i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; - } - } - if (x < y) return -1; - if (y < x) return 1; - return 0; - }, "compare"); - function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - if (buffer.length === 0) return -1; - if (typeof byteOffset === "string") { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 2147483647) { - byteOffset = 2147483647; - } else if (byteOffset < -2147483648) { - byteOffset = -2147483648; - } - byteOffset = +byteOffset; - if (numberIsNaN(byteOffset)) { - byteOffset = dir ? 0 : buffer.length - 1; - } - if (byteOffset < 0) byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) return -1; - else byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) byteOffset = 0; - else return -1; - } - if (typeof val === "string") { - val = Buffer3.from(val, encoding); - } - if (Buffer3.isBuffer(val)) { - if (val.length === 0) { - return -1; - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === "number") { - val = val & 255; - if (typeof Uint8Array.prototype.indexOf === "function") { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); - } - throw new TypeError("val must be string, number or Buffer"); - } - __name(bidirectionalIndexOf, "bidirectionalIndexOf"); - function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - let indexSize = 1; - let arrLength = arr.length; - let valLength = val.length; - if (encoding !== void 0) { - encoding = String(encoding).toLowerCase(); - if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { - if (arr.length < 2 || val.length < 2) { - return -1; - } - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i2) { - if (indexSize === 1) { - return buf[i2]; - } else { - return buf.readUInt16BE(i2 * indexSize); - } - } - __name(read, "read"); - let i; - if (dir) { - let foundIndex = -1; - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (foundIndex !== -1) i -= i - foundIndex; - foundIndex = -1; - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for (i = byteOffset; i >= 0; i--) { - let found = true; - for (let j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - } - if (found) return i; - } - } - return -1; - } - __name(arrayIndexOf, "arrayIndexOf"); - Buffer3.prototype.includes = /* @__PURE__ */ __name(function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; - }, "includes"); - Buffer3.prototype.indexOf = /* @__PURE__ */ __name(function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); - }, "indexOf"); - Buffer3.prototype.lastIndexOf = /* @__PURE__ */ __name(function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); - }, "lastIndexOf"); - function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - const remaining = buf.length - offset; - if (!length) { - length = remaining; - } else { - length = Number(length); - if (length > remaining) { - length = remaining; - } - } - const strLen = string.length; - if (length > strLen / 2) { - length = strLen / 2; - } - let i; - for (i = 0; i < length; ++i) { - const parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) return i; - buf[offset + i] = parsed; - } - return i; - } - __name(hexWrite, "hexWrite"); - function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); - } - __name(utf8Write, "utf8Write"); - function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); - } - __name(asciiWrite, "asciiWrite"); - function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); - } - __name(base64Write, "base64Write"); - function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); - } - __name(ucs2Write, "ucs2Write"); - Buffer3.prototype.write = /* @__PURE__ */ __name(function write(string, offset, length, encoding) { - if (offset === void 0) { - encoding = "utf8"; - length = this.length; - offset = 0; - } else if (length === void 0 && typeof offset === "string") { - encoding = offset; - length = this.length; - offset = 0; - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === void 0) encoding = "utf8"; - } else { - encoding = length; - length = void 0; - } - } else { - throw new Error( - "Buffer.write(string, encoding, offset[, length]) is no longer supported" - ); - } - const remaining = this.length - offset; - if (length === void 0 || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { - throw new RangeError("Attempt to write outside buffer bounds"); - } - if (!encoding) encoding = "utf8"; - let loweredCase = false; - for (; ; ) { - switch (encoding) { - case "hex": - return hexWrite(this, string, offset, length); - case "utf8": - case "utf-8": - return utf8Write(this, string, offset, length); - case "ascii": - case "latin1": - case "binary": - return asciiWrite(this, string, offset, length); - case "base64": - return base64Write(this, string, offset, length); - case "ucs2": - case "ucs-2": - case "utf16le": - case "utf-16le": - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError("Unknown encoding: " + encoding); - encoding = ("" + encoding).toLowerCase(); - loweredCase = true; - } - } - }, "write"); - Buffer3.prototype.toJSON = /* @__PURE__ */ __name(function toJSON() { - return { - type: "Buffer", - data: Array.prototype.slice.call(this._arr || this, 0) - }; - }, "toJSON"); - function base64Slice(buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf); - } else { - return base64.fromByteArray(buf.slice(start, end)); - } - } - __name(base64Slice, "base64Slice"); - function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - const res = []; - let i = start; - while (i < end) { - const firstByte = buf[i]; - let codePoint = null; - let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint; - switch (bytesPerSequence) { - case 1: - if (firstByte < 128) { - codePoint = firstByte; - } - break; - case 2: - secondByte = buf[i + 1]; - if ((secondByte & 192) === 128) { - tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; - if (tempCodePoint > 127) { - codePoint = tempCodePoint; - } - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; - if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { - codePoint = tempCodePoint; - } - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { - tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; - if (tempCodePoint > 65535 && tempCodePoint < 1114112) { - codePoint = tempCodePoint; - } - } - } - } - if (codePoint === null) { - codePoint = 65533; - bytesPerSequence = 1; - } else if (codePoint > 65535) { - codePoint -= 65536; - res.push(codePoint >>> 10 & 1023 | 55296); - codePoint = 56320 | codePoint & 1023; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); - } - __name(utf8Slice, "utf8Slice"); - var MAX_ARGUMENTS_LENGTH = 4096; - function decodeCodePointsArray(codePoints) { - const len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints); - } - let res = ""; - let i = 0; - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ); - } - return res; - } - __name(decodeCodePointsArray, "decodeCodePointsArray"); - function asciiSlice(buf, start, end) { - let ret = ""; - end = Math.min(buf.length, end); - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 127); - } - return ret; - } - __name(asciiSlice, "asciiSlice"); - function latin1Slice(buf, start, end) { - let ret = ""; - end = Math.min(buf.length, end); - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]); - } - return ret; - } - __name(latin1Slice, "latin1Slice"); - function hexSlice(buf, start, end) { - const len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - let out = ""; - for (let i = start; i < end; ++i) { - out += hexSliceLookupTable[buf[i]]; - } - return out; - } - __name(hexSlice, "hexSlice"); - function utf16leSlice(buf, start, end) { - const bytes = buf.slice(start, end); - let res = ""; - for (let i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - } - return res; - } - __name(utf16leSlice, "utf16leSlice"); - Buffer3.prototype.slice = /* @__PURE__ */ __name(function slice(start, end) { - const len = this.length; - start = ~~start; - end = end === void 0 ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) { - start = len; - } - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) { - end = len; - } - if (end < start) end = start; - const newBuf = this.subarray(start, end); - Object.setPrototypeOf(newBuf, Buffer3.prototype); - return newBuf; - }, "slice"); - function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint"); - if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length"); - } - __name(checkOffset, "checkOffset"); - Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = /* @__PURE__ */ __name(function readUIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) checkOffset(offset, byteLength2, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - return val; - }, "readUIntLE"); - Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = /* @__PURE__ */ __name(function readUIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - checkOffset(offset, byteLength2, this.length); - } - let val = this[offset + --byteLength2]; - let mul = 1; - while (byteLength2 > 0 && (mul *= 256)) { - val += this[offset + --byteLength2] * mul; - } - return val; - }, "readUIntBE"); - Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = /* @__PURE__ */ __name(function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; - }, "readUInt8"); - Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = /* @__PURE__ */ __name(function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; - }, "readUInt16LE"); - Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = /* @__PURE__ */ __name(function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; - }, "readUInt16BE"); - Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = /* @__PURE__ */ __name(function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; - }, "readUInt32LE"); - Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = /* @__PURE__ */ __name(function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); - }, "readUInt32BE"); - Buffer3.prototype.readBigUInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigUInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, "offset"); - const first = this[offset]; - const last = this[offset + 7]; - if (first === void 0 || last === void 0) { - boundsError(offset, this.length - 8); - } - const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24; - const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24; - return BigInt(lo) + (BigInt(hi) << BigInt(32)); - }, "readBigUInt64LE")); - Buffer3.prototype.readBigUInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigUInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, "offset"); - const first = this[offset]; - const last = this[offset + 7]; - if (first === void 0 || last === void 0) { - boundsError(offset, this.length - 8); - } - const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset]; - const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last; - return (BigInt(hi) << BigInt(32)) + BigInt(lo); - }, "readBigUInt64BE")); - Buffer3.prototype.readIntLE = /* @__PURE__ */ __name(function readIntLE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) checkOffset(offset, byteLength2, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while (++i < byteLength2 && (mul *= 256)) { - val += this[offset + i] * mul; - } - mul *= 128; - if (val >= mul) val -= Math.pow(2, 8 * byteLength2); - return val; - }, "readIntLE"); - Buffer3.prototype.readIntBE = /* @__PURE__ */ __name(function readIntBE(offset, byteLength2, noAssert) { - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) checkOffset(offset, byteLength2, this.length); - let i = byteLength2; - let mul = 1; - let val = this[offset + --i]; - while (i > 0 && (mul *= 256)) { - val += this[offset + --i] * mul; - } - mul *= 128; - if (val >= mul) val -= Math.pow(2, 8 * byteLength2); - return val; - }, "readIntBE"); - Buffer3.prototype.readInt8 = /* @__PURE__ */ __name(function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(this[offset] & 128)) return this[offset]; - return (255 - this[offset] + 1) * -1; - }, "readInt8"); - Buffer3.prototype.readInt16LE = /* @__PURE__ */ __name(function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset] | this[offset + 1] << 8; - return val & 32768 ? val | 4294901760 : val; - }, "readInt16LE"); - Buffer3.prototype.readInt16BE = /* @__PURE__ */ __name(function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset + 1] | this[offset] << 8; - return val & 32768 ? val | 4294901760 : val; - }, "readInt16BE"); - Buffer3.prototype.readInt32LE = /* @__PURE__ */ __name(function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; - }, "readInt32LE"); - Buffer3.prototype.readInt32BE = /* @__PURE__ */ __name(function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; - }, "readInt32BE"); - Buffer3.prototype.readBigInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, "offset"); - const first = this[offset]; - const last = this[offset + 7]; - if (first === void 0 || last === void 0) { - boundsError(offset, this.length - 8); - } - const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24); - return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); - }, "readBigInt64LE")); - Buffer3.prototype.readBigInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function readBigInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, "offset"); - const first = this[offset]; - const last = this[offset + 7]; - if (first === void 0 || last === void 0) { - boundsError(offset, this.length - 8); - } - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset]; - return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last); - }, "readBigInt64BE")); - Buffer3.prototype.readFloatLE = /* @__PURE__ */ __name(function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); - }, "readFloatLE"); - Buffer3.prototype.readFloatBE = /* @__PURE__ */ __name(function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); - }, "readFloatBE"); - Buffer3.prototype.readDoubleLE = /* @__PURE__ */ __name(function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); - }, "readDoubleLE"); - Buffer3.prototype.readDoubleBE = /* @__PURE__ */ __name(function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); - }, "readDoubleBE"); - function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer3.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError("Index out of range"); - } - __name(checkInt, "checkInt"); - Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = /* @__PURE__ */ __name(function writeUIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); - } - let mul = 1; - let i = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - this[offset + i] = value / mul & 255; - } - return offset + byteLength2; - }, "writeUIntLE"); - Buffer3.prototype.writeUintBE = Buffer3.prototype.writeUIntBE = /* @__PURE__ */ __name(function writeUIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength2 = byteLength2 >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength2) - 1; - checkInt(this, value, offset, byteLength2, maxBytes, 0); - } - let i = byteLength2 - 1; - let mul = 1; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - this[offset + i] = value / mul & 255; - } - return offset + byteLength2; - }, "writeUIntBE"); - Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = /* @__PURE__ */ __name(function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 255, 0); - this[offset] = value & 255; - return offset + 1; - }, "writeUInt8"); - Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = /* @__PURE__ */ __name(function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }, "writeUInt16LE"); - Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = /* @__PURE__ */ __name(function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 65535, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }, "writeUInt16BE"); - Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = /* @__PURE__ */ __name(function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 255; - return offset + 4; - }, "writeUInt32LE"); - Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = /* @__PURE__ */ __name(function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; - }, "writeUInt32BE"); - function wrtBigUInt64LE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(4294967295)); - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - let hi = Number(value >> BigInt(32) & BigInt(4294967295)); - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - return offset; - } - __name(wrtBigUInt64LE, "wrtBigUInt64LE"); - function wrtBigUInt64BE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(4294967295)); - buf[offset + 7] = lo; - lo = lo >> 8; - buf[offset + 6] = lo; - lo = lo >> 8; - buf[offset + 5] = lo; - lo = lo >> 8; - buf[offset + 4] = lo; - let hi = Number(value >> BigInt(32) & BigInt(4294967295)); - buf[offset + 3] = hi; - hi = hi >> 8; - buf[offset + 2] = hi; - hi = hi >> 8; - buf[offset + 1] = hi; - hi = hi >> 8; - buf[offset] = hi; - return offset + 8; - } - __name(wrtBigUInt64BE, "wrtBigUInt64BE"); - Buffer3.prototype.writeBigUInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigUInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); - }, "writeBigUInt64LE")); - Buffer3.prototype.writeBigUInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigUInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff")); - }, "writeBigUInt64BE")); - Buffer3.prototype.writeIntLE = /* @__PURE__ */ __name(function writeIntLE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); - } - let i = 0; - let mul = 1; - let sub = 0; - this[offset] = value & 255; - while (++i < byteLength2 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1; - } - this[offset + i] = (value / mul >> 0) - sub & 255; - } - return offset + byteLength2; - }, "writeIntLE"); - Buffer3.prototype.writeIntBE = /* @__PURE__ */ __name(function writeIntBE(value, offset, byteLength2, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength2 - 1); - checkInt(this, value, offset, byteLength2, limit - 1, -limit); - } - let i = byteLength2 - 1; - let mul = 1; - let sub = 0; - this[offset + i] = value & 255; - while (--i >= 0 && (mul *= 256)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1; - } - this[offset + i] = (value / mul >> 0) - sub & 255; - } - return offset + byteLength2; - }, "writeIntBE"); - Buffer3.prototype.writeInt8 = /* @__PURE__ */ __name(function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 127, -128); - if (value < 0) value = 255 + value + 1; - this[offset] = value & 255; - return offset + 1; - }, "writeInt8"); - Buffer3.prototype.writeInt16LE = /* @__PURE__ */ __name(function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - return offset + 2; - }, "writeInt16LE"); - Buffer3.prototype.writeInt16BE = /* @__PURE__ */ __name(function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 255; - return offset + 2; - }, "writeInt16BE"); - Buffer3.prototype.writeInt32LE = /* @__PURE__ */ __name(function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648); - this[offset] = value & 255; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; - }, "writeInt32LE"); - Buffer3.prototype.writeInt32BE = /* @__PURE__ */ __name(function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648); - if (value < 0) value = 4294967295 + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 255; - return offset + 4; - }, "writeInt32BE"); - Buffer3.prototype.writeBigInt64LE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); - }, "writeBigInt64LE")); - Buffer3.prototype.writeBigInt64BE = defineBigIntMethod(/* @__PURE__ */ __name(function writeBigInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff")); - }, "writeBigInt64BE")); - function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError("Index out of range"); - if (offset < 0) throw new RangeError("Index out of range"); - } - __name(checkIEEE754, "checkIEEE754"); - function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22); - } - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; - } - __name(writeFloat, "writeFloat"); - Buffer3.prototype.writeFloatLE = /* @__PURE__ */ __name(function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); - }, "writeFloatLE"); - Buffer3.prototype.writeFloatBE = /* @__PURE__ */ __name(function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); - }, "writeFloatBE"); - function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292); - } - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; - } - __name(writeDouble, "writeDouble"); - Buffer3.prototype.writeDoubleLE = /* @__PURE__ */ __name(function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); - }, "writeDoubleLE"); - Buffer3.prototype.writeDoubleBE = /* @__PURE__ */ __name(function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); - }, "writeDoubleBE"); - Buffer3.prototype.copy = /* @__PURE__ */ __name(function copy(target, targetStart, start, end) { - if (!Buffer3.isBuffer(target)) throw new TypeError("argument should be a Buffer"); - if (!start) start = 0; - if (!end && end !== 0) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - if (end === start) return 0; - if (target.length === 0 || this.length === 0) return 0; - if (targetStart < 0) { - throw new RangeError("targetStart out of bounds"); - } - if (start < 0 || start >= this.length) throw new RangeError("Index out of range"); - if (end < 0) throw new RangeError("sourceEnd out of bounds"); - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start; - } - const len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === "function") { - this.copyWithin(targetStart, start, end); - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ); - } - return len; - }, "copy"); - Buffer3.prototype.fill = /* @__PURE__ */ __name(function fill(val, start, end, encoding) { - if (typeof val === "string") { - if (typeof start === "string") { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === "string") { - encoding = end; - end = this.length; - } - if (encoding !== void 0 && typeof encoding !== "string") { - throw new TypeError("encoding must be a string"); - } - if (typeof encoding === "string" && !Buffer3.isEncoding(encoding)) { - throw new TypeError("Unknown encoding: " + encoding); - } - if (val.length === 1) { - const code = val.charCodeAt(0); - if (encoding === "utf8" && code < 128 || encoding === "latin1") { - val = code; - } - } - } else if (typeof val === "number") { - val = val & 255; - } else if (typeof val === "boolean") { - val = Number(val); - } - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError("Out of range index"); - } - if (end <= start) { - return this; - } - start = start >>> 0; - end = end === void 0 ? this.length : end >>> 0; - if (!val) val = 0; - let i; - if (typeof val === "number") { - for (i = start; i < end; ++i) { - this[i] = val; - } - } else { - const bytes = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding); - const len = bytes.length; - if (len === 0) { - throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len]; - } - } - return this; - }, "fill"); - var errors = {}; - function E(sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - static { - __name(this, "NodeError"); - } - constructor() { - super(); - Object.defineProperty(this, "message", { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }); - this.name = `${this.name} [${sym}]`; - this.stack; - delete this.name; - } - get code() { - return sym; - } - set code(value) { - Object.defineProperty(this, "code", { - configurable: true, - enumerable: true, - value, - writable: true - }); - } - toString() { - return `${this.name} [${sym}]: ${this.message}`; - } - }; - } - __name(E, "E"); - E( - "ERR_BUFFER_OUT_OF_BOUNDS", - function(name) { - if (name) { - return `${name} is outside of buffer bounds`; - } - return "Attempt to access memory outside buffer bounds"; - }, - RangeError - ); - E( - "ERR_INVALID_ARG_TYPE", - function(name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}`; - }, - TypeError - ); - E( - "ERR_OUT_OF_RANGE", - function(str, range, input) { - let msg = `The value of "${str}" is out of range.`; - let received = input; - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)); - } else if (typeof input === "bigint") { - received = String(input); - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { - received = addNumericalSeparator(received); - } - received += "n"; - } - msg += ` It must be ${range}. Received ${received}`; - return msg; - }, - RangeError - ); - function addNumericalSeparator(val) { - let res = ""; - let i = val.length; - const start = val[0] === "-" ? 1 : 0; - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}`; - } - return `${val.slice(0, i)}${res}`; - } - __name(addNumericalSeparator, "addNumericalSeparator"); - function checkBounds(buf, offset, byteLength2) { - validateNumber(offset, "offset"); - if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) { - boundsError(offset, buf.length - (byteLength2 + 1)); - } - } - __name(checkBounds, "checkBounds"); - function checkIntBI(value, min, max, buf, offset, byteLength2) { - if (value > max || value < min) { - const n = typeof min === "bigint" ? "n" : ""; - let range; - if (byteLength2 > 3) { - if (min === 0 || min === BigInt(0)) { - range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`; - } else { - range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`; - } - } else { - range = `>= ${min}${n} and <= ${max}${n}`; - } - throw new errors.ERR_OUT_OF_RANGE("value", range, value); - } - checkBounds(buf, offset, byteLength2); - } - __name(checkIntBI, "checkIntBI"); - function validateNumber(value, name) { - if (typeof value !== "number") { - throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value); - } - } - __name(validateNumber, "validateNumber"); - function boundsError(value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type); - throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value); - } - if (length < 0) { - throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); - } - throw new errors.ERR_OUT_OF_RANGE( - type || "offset", - `>= ${type ? 1 : 0} and <= ${length}`, - value - ); - } - __name(boundsError, "boundsError"); - var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; - function base64clean(str) { - str = str.split("=")[0]; - str = str.trim().replace(INVALID_BASE64_RE, ""); - if (str.length < 2) return ""; - while (str.length % 4 !== 0) { - str = str + "="; - } - return str; - } - __name(base64clean, "base64clean"); - function utf8ToBytes(string, units) { - units = units || Infinity; - let codePoint; - const length = string.length; - let leadSurrogate = null; - const bytes = []; - for (let i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i); - if (codePoint > 55295 && codePoint < 57344) { - if (!leadSurrogate) { - if (codePoint > 56319) { - if ((units -= 3) > -1) bytes.push(239, 191, 189); - continue; - } else if (i + 1 === length) { - if ((units -= 3) > -1) bytes.push(239, 191, 189); - continue; - } - leadSurrogate = codePoint; - continue; - } - if (codePoint < 56320) { - if ((units -= 3) > -1) bytes.push(239, 191, 189); - leadSurrogate = codePoint; - continue; - } - codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; - } else if (leadSurrogate) { - if ((units -= 3) > -1) bytes.push(239, 191, 189); - } - leadSurrogate = null; - if (codePoint < 128) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 2048) { - if ((units -= 2) < 0) break; - bytes.push( - codePoint >> 6 | 192, - codePoint & 63 | 128 - ); - } else if (codePoint < 65536) { - if ((units -= 3) < 0) break; - bytes.push( - codePoint >> 12 | 224, - codePoint >> 6 & 63 | 128, - codePoint & 63 | 128 - ); - } else if (codePoint < 1114112) { - if ((units -= 4) < 0) break; - bytes.push( - codePoint >> 18 | 240, - codePoint >> 12 & 63 | 128, - codePoint >> 6 & 63 | 128, - codePoint & 63 | 128 - ); - } else { - throw new Error("Invalid code point"); - } - } - return bytes; - } - __name(utf8ToBytes, "utf8ToBytes"); - function asciiToBytes(str) { - const byteArray = []; - for (let i = 0; i < str.length; ++i) { - byteArray.push(str.charCodeAt(i) & 255); - } - return byteArray; - } - __name(asciiToBytes, "asciiToBytes"); - function utf16leToBytes(str, units) { - let c, hi, lo; - const byteArray = []; - for (let i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; - } - __name(utf16leToBytes, "utf16leToBytes"); - function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); - } - __name(base64ToBytes, "base64ToBytes"); - function blitBuffer(src, dst, offset, length) { - let i; - for (i = 0; i < length; ++i) { - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; - } - return i; - } - __name(blitBuffer, "blitBuffer"); - function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; - } - __name(isInstance, "isInstance"); - function numberIsNaN(obj) { - return obj !== obj; - } - __name(numberIsNaN, "numberIsNaN"); - var hexSliceLookupTable = function() { - const alphabet = "0123456789abcdef"; - const table = new Array(256); - for (let i = 0; i < 16; ++i) { - const i16 = i * 16; - for (let j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j]; - } - } - return table; - }(); - function defineBigIntMethod(fn) { - return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn; - } - __name(defineBigIntMethod, "defineBigIntMethod"); - function BufferBigIntNotDefined() { - throw new Error("BigInt not supported"); - } - __name(BufferBigIntNotDefined, "BufferBigIntNotDefined"); - } -}); - -// shims/shims.js -var global, setImmediate, clearImmediate, crypto, Buffer2, process; -var init_shims = __esm({ - "shims/shims.js"() { - "use strict"; - global = globalThis; - setImmediate = globalThis.setImmediate ?? ((fn) => setTimeout(fn, 0)); - clearImmediate = globalThis.clearImmediate ?? ((id) => clearTimeout(id)); - crypto = globalThis.crypto ?? {}; - crypto.subtle ??= {}; - Buffer2 = typeof globalThis.Buffer === "function" && typeof globalThis.Buffer.allocUnsafe === "function" ? globalThis.Buffer : require_buffer().Buffer; - process = globalThis.process ?? {}; - process.env ??= {}; - try { - process.nextTick(() => void 0); - } catch (err) { - const resolve = Promise.resolve(); - process.nextTick = resolve.then.bind(resolve); - } - } -}); - -// node_modules/events/events.js -var require_events = __commonJS({ - "node_modules/events/events.js"(exports, module) { - "use strict"; - init_shims(); - var R = typeof Reflect === "object" ? Reflect : null; - var ReflectApply = R && typeof R.apply === "function" ? R.apply : /* @__PURE__ */ __name(function ReflectApply2(target, receiver, args) { - return Function.prototype.apply.call(target, receiver, args); - }, "ReflectApply"); - var ReflectOwnKeys; - if (R && typeof R.ownKeys === "function") { - ReflectOwnKeys = R.ownKeys; - } else if (Object.getOwnPropertySymbols) { - ReflectOwnKeys = /* @__PURE__ */ __name(function ReflectOwnKeys2(target) { - return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); - }, "ReflectOwnKeys"); - } else { - ReflectOwnKeys = /* @__PURE__ */ __name(function ReflectOwnKeys2(target) { - return Object.getOwnPropertyNames(target); - }, "ReflectOwnKeys"); - } - function ProcessEmitWarning(warning) { - if (console && console.warn) console.warn(warning); - } - __name(ProcessEmitWarning, "ProcessEmitWarning"); - var NumberIsNaN = Number.isNaN || /* @__PURE__ */ __name(function NumberIsNaN2(value) { - return value !== value; - }, "NumberIsNaN"); - function EventEmitter2() { - EventEmitter2.init.call(this); - } - __name(EventEmitter2, "EventEmitter"); - module.exports = EventEmitter2; - module.exports.once = once; - EventEmitter2.EventEmitter = EventEmitter2; - EventEmitter2.prototype._events = void 0; - EventEmitter2.prototype._eventsCount = 0; - EventEmitter2.prototype._maxListeners = void 0; - var defaultMaxListeners = 10; - function checkListener(listener) { - if (typeof listener !== "function") { - throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); - } - } - __name(checkListener, "checkListener"); - Object.defineProperty(EventEmitter2, "defaultMaxListeners", { - enumerable: true, - get: /* @__PURE__ */ __name(function() { - return defaultMaxListeners; - }, "get"), - set: /* @__PURE__ */ __name(function(arg) { - if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) { - throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + "."); - } - defaultMaxListeners = arg; - }, "set") - }); - EventEmitter2.init = function() { - if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) { - this._events = /* @__PURE__ */ Object.create(null); - this._eventsCount = 0; - } - this._maxListeners = this._maxListeners || void 0; - }; - EventEmitter2.prototype.setMaxListeners = /* @__PURE__ */ __name(function setMaxListeners(n) { - if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) { - throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + "."); - } - this._maxListeners = n; - return this; - }, "setMaxListeners"); - function _getMaxListeners(that) { - if (that._maxListeners === void 0) - return EventEmitter2.defaultMaxListeners; - return that._maxListeners; - } - __name(_getMaxListeners, "_getMaxListeners"); - EventEmitter2.prototype.getMaxListeners = /* @__PURE__ */ __name(function getMaxListeners() { - return _getMaxListeners(this); - }, "getMaxListeners"); - EventEmitter2.prototype.emit = /* @__PURE__ */ __name(function emit(type) { - var args = []; - for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); - var doError = type === "error"; - var events = this._events; - if (events !== void 0) - doError = doError && events.error === void 0; - else if (!doError) - return false; - if (doError) { - var er; - if (args.length > 0) - er = args[0]; - if (er instanceof Error) { - throw er; - } - var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : "")); - err.context = er; - throw err; - } - var handler = events[type]; - if (handler === void 0) - return false; - if (typeof handler === "function") { - ReflectApply(handler, this, args); - } else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - ReflectApply(listeners[i], this, args); - } - return true; - }, "emit"); - function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - checkListener(listener); - events = target._events; - if (events === void 0) { - events = target._events = /* @__PURE__ */ Object.create(null); - target._eventsCount = 0; - } else { - if (events.newListener !== void 0) { - target.emit( - "newListener", - type, - listener.listener ? listener.listener : listener - ); - events = target._events; - } - existing = events[type]; - } - if (existing === void 0) { - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === "function") { - existing = events[type] = prepend ? [listener, existing] : [existing, listener]; - } else if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - m = _getMaxListeners(target); - if (m > 0 && existing.length > m && !existing.warned) { - existing.warned = true; - var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - w.name = "MaxListenersExceededWarning"; - w.emitter = target; - w.type = type; - w.count = existing.length; - ProcessEmitWarning(w); - } - } - return target; - } - __name(_addListener, "_addListener"); - EventEmitter2.prototype.addListener = /* @__PURE__ */ __name(function addListener(type, listener) { - return _addListener(this, type, listener, false); - }, "addListener"); - EventEmitter2.prototype.on = EventEmitter2.prototype.addListener; - EventEmitter2.prototype.prependListener = /* @__PURE__ */ __name(function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }, "prependListener"); - function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - if (arguments.length === 0) - return this.listener.call(this.target); - return this.listener.apply(this.target, arguments); - } - } - __name(onceWrapper, "onceWrapper"); - function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: void 0, target, type, listener }; - var wrapped = onceWrapper.bind(state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; - } - __name(_onceWrap, "_onceWrap"); - EventEmitter2.prototype.once = /* @__PURE__ */ __name(function once2(type, listener) { - checkListener(listener); - this.on(type, _onceWrap(this, type, listener)); - return this; - }, "once"); - EventEmitter2.prototype.prependOnceListener = /* @__PURE__ */ __name(function prependOnceListener(type, listener) { - checkListener(listener); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }, "prependOnceListener"); - EventEmitter2.prototype.removeListener = /* @__PURE__ */ __name(function removeListener(type, listener) { - var list, events, position, i, originalListener; - checkListener(listener); - events = this._events; - if (events === void 0) - return this; - list = events[type]; - if (list === void 0) - return this; - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = /* @__PURE__ */ Object.create(null); - else { - delete events[type]; - if (events.removeListener) - this.emit("removeListener", type, list.listener || listener); - } - } else if (typeof list !== "function") { - position = -1; - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - if (position < 0) - return this; - if (position === 0) - list.shift(); - else { - spliceOne(list, position); - } - if (list.length === 1) - events[type] = list[0]; - if (events.removeListener !== void 0) - this.emit("removeListener", type, originalListener || listener); - } - return this; - }, "removeListener"); - EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener; - EventEmitter2.prototype.removeAllListeners = /* @__PURE__ */ __name(function removeAllListeners(type) { - var listeners, events, i; - events = this._events; - if (events === void 0) - return this; - if (events.removeListener === void 0) { - if (arguments.length === 0) { - this._events = /* @__PURE__ */ Object.create(null); - this._eventsCount = 0; - } else if (events[type] !== void 0) { - if (--this._eventsCount === 0) - this._events = /* @__PURE__ */ Object.create(null); - else - delete events[type]; - } - return this; - } - if (arguments.length === 0) { - var keys2 = Object.keys(events); - var key; - for (i = 0; i < keys2.length; ++i) { - key = keys2[i]; - if (key === "removeListener") continue; - this.removeAllListeners(key); - } - this.removeAllListeners("removeListener"); - this._events = /* @__PURE__ */ Object.create(null); - this._eventsCount = 0; - return this; - } - listeners = events[type]; - if (typeof listeners === "function") { - this.removeListener(type, listeners); - } else if (listeners !== void 0) { - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - return this; - }, "removeAllListeners"); - function _listeners(target, type, unwrap) { - var events = target._events; - if (events === void 0) - return []; - var evlistener = events[type]; - if (evlistener === void 0) - return []; - if (typeof evlistener === "function") - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); - } - __name(_listeners, "_listeners"); - EventEmitter2.prototype.listeners = /* @__PURE__ */ __name(function listeners(type) { - return _listeners(this, type, true); - }, "listeners"); - EventEmitter2.prototype.rawListeners = /* @__PURE__ */ __name(function rawListeners(type) { - return _listeners(this, type, false); - }, "rawListeners"); - EventEmitter2.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === "function") { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } - }; - EventEmitter2.prototype.listenerCount = listenerCount; - function listenerCount(type) { - var events = this._events; - if (events !== void 0) { - var evlistener = events[type]; - if (typeof evlistener === "function") { - return 1; - } else if (evlistener !== void 0) { - return evlistener.length; - } - } - return 0; - } - __name(listenerCount, "listenerCount"); - EventEmitter2.prototype.eventNames = /* @__PURE__ */ __name(function eventNames() { - return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; - }, "eventNames"); - function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; - } - __name(arrayClone, "arrayClone"); - function spliceOne(list, index) { - for (; index + 1 < list.length; index++) - list[index] = list[index + 1]; - list.pop(); - } - __name(spliceOne, "spliceOne"); - function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; - } - __name(unwrapListeners, "unwrapListeners"); - function once(emitter, name) { - return new Promise(function(resolve, reject) { - function errorListener(err) { - emitter.removeListener(name, resolver); - reject(err); - } - __name(errorListener, "errorListener"); - function resolver() { - if (typeof emitter.removeListener === "function") { - emitter.removeListener("error", errorListener); - } - resolve([].slice.call(arguments)); - } - __name(resolver, "resolver"); - ; - eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); - if (name !== "error") { - addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); - } - }); - } - __name(once, "once"); - function addErrorHandlerIfEventEmitter(emitter, handler, flags) { - if (typeof emitter.on === "function") { - eventTargetAgnosticAddListener(emitter, "error", handler, flags); - } - } - __name(addErrorHandlerIfEventEmitter, "addErrorHandlerIfEventEmitter"); - function eventTargetAgnosticAddListener(emitter, name, listener, flags) { - if (typeof emitter.on === "function") { - if (flags.once) { - emitter.once(name, listener); - } else { - emitter.on(name, listener); - } - } else if (typeof emitter.addEventListener === "function") { - emitter.addEventListener(name, /* @__PURE__ */ __name(function wrapListener(arg) { - if (flags.once) { - emitter.removeEventListener(name, wrapListener); - } - listener(arg); - }, "wrapListener")); - } else { - throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); - } - } - __name(eventTargetAgnosticAddListener, "eventTargetAgnosticAddListener"); - } -}); - -// shims/util/index.ts -var util_exports = {}; -__export(util_exports, { - default: () => util_default -}); -var util_default; -var init_util = __esm({ - "shims/util/index.ts"() { - "use strict"; - init_shims(); - util_default = {}; - } -}); - -// shims/crypto/sha256.ts -function sha256(data) { - let h0 = 1779033703, h1 = 3144134277, h2 = 1013904242, h3 = 2773480762, h4 = 1359893119, h5 = 2600822924, h6 = 528734635, h7 = 1541459225, tsz = 0, bp = 0; - const k = [ - 1116352408, - 1899447441, - 3049323471, - 3921009573, - 961987163, - 1508970993, - 2453635748, - 2870763221, - 3624381080, - 310598401, - 607225278, - 1426881987, - 1925078388, - 2162078206, - 2614888103, - 3248222580, - 3835390401, - 4022224774, - 264347078, - 604807628, - 770255983, - 1249150122, - 1555081692, - 1996064986, - 2554220882, - 2821834349, - 2952996808, - 3210313671, - 3336571891, - 3584528711, - 113926993, - 338241895, - 666307205, - 773529912, - 1294757372, - 1396182291, - 1695183700, - 1986661051, - 2177026350, - 2456956037, - 2730485921, - 2820302411, - 3259730800, - 3345764771, - 3516065817, - 3600352804, - 4094571909, - 275423344, - 430227734, - 506948616, - 659060556, - 883997877, - 958139571, - 1322822218, - 1537002063, - 1747873779, - 1955562222, - 2024104815, - 2227730452, - 2361852424, - 2428436474, - 2756734187, - 3204031479, - 3329325298 - ], rrot = /* @__PURE__ */ __name((x, n) => x >>> n | x << 32 - n, "rrot"), w = new Uint32Array(64), buf = new Uint8Array(64), process2 = /* @__PURE__ */ __name(() => { - for (let j = 0, r2 = 0; j < 16; j++, r2 += 4) { - w[j] = buf[r2] << 24 | buf[r2 + 1] << 16 | buf[r2 + 2] << 8 | buf[r2 + 3]; - } - for (let j = 16; j < 64; j++) { - let s0 = rrot(w[j - 15], 7) ^ rrot(w[j - 15], 18) ^ w[j - 15] >>> 3; - let s1 = rrot(w[j - 2], 17) ^ rrot(w[j - 2], 19) ^ w[j - 2] >>> 10; - w[j] = w[j - 16] + s0 + w[j - 7] + s1 | 0; - } - let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7; - for (let j = 0; j < 64; j++) { - let S1 = rrot(e, 6) ^ rrot(e, 11) ^ rrot(e, 25), ch = e & f ^ ~e & g, t1 = h + S1 + ch + k[j] + w[j] | 0, S0 = rrot(a, 2) ^ rrot(a, 13) ^ rrot(a, 22), maj = a & b ^ a & c ^ b & c, t2 = S0 + maj | 0; - h = g; - g = f; - f = e; - e = d + t1 | 0; - d = c; - c = b; - b = a; - a = t1 + t2 | 0; - } - h0 = h0 + a | 0; - h1 = h1 + b | 0; - h2 = h2 + c | 0; - h3 = h3 + d | 0; - h4 = h4 + e | 0; - h5 = h5 + f | 0; - h6 = h6 + g | 0; - h7 = h7 + h | 0; - bp = 0; - }, "process"), add = /* @__PURE__ */ __name((data2) => { - if (typeof data2 === "string") { - data2 = new TextEncoder().encode(data2); - } - for (let i = 0; i < data2.length; i++) { - buf[bp++] = data2[i]; - if (bp === 64) process2(); - } - tsz += data2.length; - }, "add"), digest = /* @__PURE__ */ __name(() => { - buf[bp++] = 128; - if (bp == 64) process2(); - if (bp + 8 > 64) { - while (bp < 64) buf[bp++] = 0; - process2(); - } - while (bp < 58) buf[bp++] = 0; - let L = tsz * 8; - buf[bp++] = L / 1099511627776 & 255; - buf[bp++] = L / 4294967296 & 255; - buf[bp++] = L >>> 24; - buf[bp++] = L >>> 16 & 255; - buf[bp++] = L >>> 8 & 255; - buf[bp++] = L & 255; - process2(); - let reply = new Uint8Array(32); - reply[0] = h0 >>> 24; - reply[1] = h0 >>> 16 & 255; - reply[2] = h0 >>> 8 & 255; - reply[3] = h0 & 255; - reply[4] = h1 >>> 24; - reply[5] = h1 >>> 16 & 255; - reply[6] = h1 >>> 8 & 255; - reply[7] = h1 & 255; - reply[8] = h2 >>> 24; - reply[9] = h2 >>> 16 & 255; - reply[10] = h2 >>> 8 & 255; - reply[11] = h2 & 255; - reply[12] = h3 >>> 24; - reply[13] = h3 >>> 16 & 255; - reply[14] = h3 >>> 8 & 255; - reply[15] = h3 & 255; - reply[16] = h4 >>> 24; - reply[17] = h4 >>> 16 & 255; - reply[18] = h4 >>> 8 & 255; - reply[19] = h4 & 255; - reply[20] = h5 >>> 24; - reply[21] = h5 >>> 16 & 255; - reply[22] = h5 >>> 8 & 255; - reply[23] = h5 & 255; - reply[24] = h6 >>> 24; - reply[25] = h6 >>> 16 & 255; - reply[26] = h6 >>> 8 & 255; - reply[27] = h6 & 255; - reply[28] = h7 >>> 24; - reply[29] = h7 >>> 16 & 255; - reply[30] = h7 >>> 8 & 255; - reply[31] = h7 & 255; - return reply; - }, "digest"); - if (data === void 0) return { add, digest }; - add(data); - return digest(); -} -var init_sha256 = __esm({ - "shims/crypto/sha256.ts"() { - "use strict"; - init_shims(); - __name(sha256, "sha256"); - } -}); - -// shims/crypto/md5.ts -var Md5; -var init_md5 = __esm({ - "shims/crypto/md5.ts"() { - "use strict"; - init_shims(); - Md5 = class _Md5 { - static { - __name(this, "Md5"); - } - static hashByteArray(arr, raw = false) { - return this.onePassHasher.start().appendByteArray(arr).end(raw); - } - static hashStr(str, raw = false) { - return this.onePassHasher.start().appendStr(str).end(raw); - } - static hashAsciiStr(str, raw = false) { - return this.onePassHasher.start().appendAsciiStr(str).end(raw); - } - // Private Static Variables - static stateIdentity = new Int32Array([ - 1732584193, - -271733879, - -1732584194, - 271733878 - ]); - static buffer32Identity = new Int32Array([ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ]); - static hexChars = "0123456789abcdef"; - static hexOut = []; - // Permanent instance is to use for one-call hashing - static onePassHasher = new _Md5(); - static _hex(x) { - const hc = _Md5.hexChars; - const ho = _Md5.hexOut; - let n; - let offset; - let j; - let i; - for (i = 0; i < 4; i += 1) { - offset = i * 8; - n = x[i]; - for (j = 0; j < 8; j += 2) { - ho[offset + 1 + j] = hc.charAt(n & 15); - n >>>= 4; - ho[offset + 0 + j] = hc.charAt(n & 15); - n >>>= 4; - } - } - return ho.join(""); - } - static _md5cycle(x, k) { - let a = x[0]; - let b = x[1]; - let c = x[2]; - let d = x[3]; - a += (b & c | ~b & d) + k[0] - 680876936 | 0; - a = (a << 7 | a >>> 25) + b | 0; - d += (a & b | ~a & c) + k[1] - 389564586 | 0; - d = (d << 12 | d >>> 20) + a | 0; - c += (d & a | ~d & b) + k[2] + 606105819 | 0; - c = (c << 17 | c >>> 15) + d | 0; - b += (c & d | ~c & a) + k[3] - 1044525330 | 0; - b = (b << 22 | b >>> 10) + c | 0; - a += (b & c | ~b & d) + k[4] - 176418897 | 0; - a = (a << 7 | a >>> 25) + b | 0; - d += (a & b | ~a & c) + k[5] + 1200080426 | 0; - d = (d << 12 | d >>> 20) + a | 0; - c += (d & a | ~d & b) + k[6] - 1473231341 | 0; - c = (c << 17 | c >>> 15) + d | 0; - b += (c & d | ~c & a) + k[7] - 45705983 | 0; - b = (b << 22 | b >>> 10) + c | 0; - a += (b & c | ~b & d) + k[8] + 1770035416 | 0; - a = (a << 7 | a >>> 25) + b | 0; - d += (a & b | ~a & c) + k[9] - 1958414417 | 0; - d = (d << 12 | d >>> 20) + a | 0; - c += (d & a | ~d & b) + k[10] - 42063 | 0; - c = (c << 17 | c >>> 15) + d | 0; - b += (c & d | ~c & a) + k[11] - 1990404162 | 0; - b = (b << 22 | b >>> 10) + c | 0; - a += (b & c | ~b & d) + k[12] + 1804603682 | 0; - a = (a << 7 | a >>> 25) + b | 0; - d += (a & b | ~a & c) + k[13] - 40341101 | 0; - d = (d << 12 | d >>> 20) + a | 0; - c += (d & a | ~d & b) + k[14] - 1502002290 | 0; - c = (c << 17 | c >>> 15) + d | 0; - b += (c & d | ~c & a) + k[15] + 1236535329 | 0; - b = (b << 22 | b >>> 10) + c | 0; - a += (b & d | c & ~d) + k[1] - 165796510 | 0; - a = (a << 5 | a >>> 27) + b | 0; - d += (a & c | b & ~c) + k[6] - 1069501632 | 0; - d = (d << 9 | d >>> 23) + a | 0; - c += (d & b | a & ~b) + k[11] + 643717713 | 0; - c = (c << 14 | c >>> 18) + d | 0; - b += (c & a | d & ~a) + k[0] - 373897302 | 0; - b = (b << 20 | b >>> 12) + c | 0; - a += (b & d | c & ~d) + k[5] - 701558691 | 0; - a = (a << 5 | a >>> 27) + b | 0; - d += (a & c | b & ~c) + k[10] + 38016083 | 0; - d = (d << 9 | d >>> 23) + a | 0; - c += (d & b | a & ~b) + k[15] - 660478335 | 0; - c = (c << 14 | c >>> 18) + d | 0; - b += (c & a | d & ~a) + k[4] - 405537848 | 0; - b = (b << 20 | b >>> 12) + c | 0; - a += (b & d | c & ~d) + k[9] + 568446438 | 0; - a = (a << 5 | a >>> 27) + b | 0; - d += (a & c | b & ~c) + k[14] - 1019803690 | 0; - d = (d << 9 | d >>> 23) + a | 0; - c += (d & b | a & ~b) + k[3] - 187363961 | 0; - c = (c << 14 | c >>> 18) + d | 0; - b += (c & a | d & ~a) + k[8] + 1163531501 | 0; - b = (b << 20 | b >>> 12) + c | 0; - a += (b & d | c & ~d) + k[13] - 1444681467 | 0; - a = (a << 5 | a >>> 27) + b | 0; - d += (a & c | b & ~c) + k[2] - 51403784 | 0; - d = (d << 9 | d >>> 23) + a | 0; - c += (d & b | a & ~b) + k[7] + 1735328473 | 0; - c = (c << 14 | c >>> 18) + d | 0; - b += (c & a | d & ~a) + k[12] - 1926607734 | 0; - b = (b << 20 | b >>> 12) + c | 0; - a += (b ^ c ^ d) + k[5] - 378558 | 0; - a = (a << 4 | a >>> 28) + b | 0; - d += (a ^ b ^ c) + k[8] - 2022574463 | 0; - d = (d << 11 | d >>> 21) + a | 0; - c += (d ^ a ^ b) + k[11] + 1839030562 | 0; - c = (c << 16 | c >>> 16) + d | 0; - b += (c ^ d ^ a) + k[14] - 35309556 | 0; - b = (b << 23 | b >>> 9) + c | 0; - a += (b ^ c ^ d) + k[1] - 1530992060 | 0; - a = (a << 4 | a >>> 28) + b | 0; - d += (a ^ b ^ c) + k[4] + 1272893353 | 0; - d = (d << 11 | d >>> 21) + a | 0; - c += (d ^ a ^ b) + k[7] - 155497632 | 0; - c = (c << 16 | c >>> 16) + d | 0; - b += (c ^ d ^ a) + k[10] - 1094730640 | 0; - b = (b << 23 | b >>> 9) + c | 0; - a += (b ^ c ^ d) + k[13] + 681279174 | 0; - a = (a << 4 | a >>> 28) + b | 0; - d += (a ^ b ^ c) + k[0] - 358537222 | 0; - d = (d << 11 | d >>> 21) + a | 0; - c += (d ^ a ^ b) + k[3] - 722521979 | 0; - c = (c << 16 | c >>> 16) + d | 0; - b += (c ^ d ^ a) + k[6] + 76029189 | 0; - b = (b << 23 | b >>> 9) + c | 0; - a += (b ^ c ^ d) + k[9] - 640364487 | 0; - a = (a << 4 | a >>> 28) + b | 0; - d += (a ^ b ^ c) + k[12] - 421815835 | 0; - d = (d << 11 | d >>> 21) + a | 0; - c += (d ^ a ^ b) + k[15] + 530742520 | 0; - c = (c << 16 | c >>> 16) + d | 0; - b += (c ^ d ^ a) + k[2] - 995338651 | 0; - b = (b << 23 | b >>> 9) + c | 0; - a += (c ^ (b | ~d)) + k[0] - 198630844 | 0; - a = (a << 6 | a >>> 26) + b | 0; - d += (b ^ (a | ~c)) + k[7] + 1126891415 | 0; - d = (d << 10 | d >>> 22) + a | 0; - c += (a ^ (d | ~b)) + k[14] - 1416354905 | 0; - c = (c << 15 | c >>> 17) + d | 0; - b += (d ^ (c | ~a)) + k[5] - 57434055 | 0; - b = (b << 21 | b >>> 11) + c | 0; - a += (c ^ (b | ~d)) + k[12] + 1700485571 | 0; - a = (a << 6 | a >>> 26) + b | 0; - d += (b ^ (a | ~c)) + k[3] - 1894986606 | 0; - d = (d << 10 | d >>> 22) + a | 0; - c += (a ^ (d | ~b)) + k[10] - 1051523 | 0; - c = (c << 15 | c >>> 17) + d | 0; - b += (d ^ (c | ~a)) + k[1] - 2054922799 | 0; - b = (b << 21 | b >>> 11) + c | 0; - a += (c ^ (b | ~d)) + k[8] + 1873313359 | 0; - a = (a << 6 | a >>> 26) + b | 0; - d += (b ^ (a | ~c)) + k[15] - 30611744 | 0; - d = (d << 10 | d >>> 22) + a | 0; - c += (a ^ (d | ~b)) + k[6] - 1560198380 | 0; - c = (c << 15 | c >>> 17) + d | 0; - b += (d ^ (c | ~a)) + k[13] + 1309151649 | 0; - b = (b << 21 | b >>> 11) + c | 0; - a += (c ^ (b | ~d)) + k[4] - 145523070 | 0; - a = (a << 6 | a >>> 26) + b | 0; - d += (b ^ (a | ~c)) + k[11] - 1120210379 | 0; - d = (d << 10 | d >>> 22) + a | 0; - c += (a ^ (d | ~b)) + k[2] + 718787259 | 0; - c = (c << 15 | c >>> 17) + d | 0; - b += (d ^ (c | ~a)) + k[9] - 343485551 | 0; - b = (b << 21 | b >>> 11) + c | 0; - x[0] = a + x[0] | 0; - x[1] = b + x[1] | 0; - x[2] = c + x[2] | 0; - x[3] = d + x[3] | 0; - } - _dataLength = 0; - _bufferLength = 0; - _state = new Int32Array(4); - _buffer = new ArrayBuffer(68); - _buffer8; - _buffer32; - constructor() { - this._buffer8 = new Uint8Array(this._buffer, 0, 68); - this._buffer32 = new Uint32Array(this._buffer, 0, 17); - this.start(); - } - /** - * Initialise buffer to be hashed - */ - start() { - this._dataLength = 0; - this._bufferLength = 0; - this._state.set(_Md5.stateIdentity); - return this; - } - // Char to code point to to array conversion: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt - // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown - /** - * Append a UTF-8 string to the hash buffer - * @param str String to append - */ - appendStr(str) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let code; - let i; - for (i = 0; i < str.length; i += 1) { - code = str.charCodeAt(i); - if (code < 128) { - buf8[bufLen++] = code; - } else if (code < 2048) { - buf8[bufLen++] = (code >>> 6) + 192; - buf8[bufLen++] = code & 63 | 128; - } else if (code < 55296 || code > 56319) { - buf8[bufLen++] = (code >>> 12) + 224; - buf8[bufLen++] = code >>> 6 & 63 | 128; - buf8[bufLen++] = code & 63 | 128; - } else { - code = (code - 55296) * 1024 + (str.charCodeAt(++i) - 56320) + 65536; - if (code > 1114111) { - throw new Error( - "Unicode standard supports code points up to U+10FFFF" - ); - } - buf8[bufLen++] = (code >>> 18) + 240; - buf8[bufLen++] = code >>> 12 & 63 | 128; - buf8[bufLen++] = code >>> 6 & 63 | 128; - buf8[bufLen++] = code & 63 | 128; - } - if (bufLen >= 64) { - this._dataLength += 64; - _Md5._md5cycle(this._state, buf32); - bufLen -= 64; - buf32[0] = buf32[16]; - } - } - this._bufferLength = bufLen; - return this; - } - /** - * Append an ASCII string to the hash buffer - * @param str String to append - */ - appendAsciiStr(str) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let i; - let j = 0; - for (; ; ) { - i = Math.min(str.length - j, 64 - bufLen); - while (i--) { - buf8[bufLen++] = str.charCodeAt(j++); - } - if (bufLen < 64) { - break; - } - this._dataLength += 64; - _Md5._md5cycle(this._state, buf32); - bufLen = 0; - } - this._bufferLength = bufLen; - return this; - } - /** - * Append a byte array to the hash buffer - * @param input array to append - */ - appendByteArray(input) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let i; - let j = 0; - for (; ; ) { - i = Math.min(input.length - j, 64 - bufLen); - while (i--) { - buf8[bufLen++] = input[j++]; - } - if (bufLen < 64) { - break; - } - this._dataLength += 64; - _Md5._md5cycle(this._state, buf32); - bufLen = 0; - } - this._bufferLength = bufLen; - return this; - } - /** - * Get the state of the hash buffer - */ - getState() { - const s = this._state; - return { - buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)), - buflen: this._bufferLength, - length: this._dataLength, - state: [s[0], s[1], s[2], s[3]] - }; - } - /** - * Override the current state of the hash buffer - * @param state New hash buffer state - */ - setState(state) { - const buf = state.buffer; - const x = state.state; - const s = this._state; - let i; - this._dataLength = state.length; - this._bufferLength = state.buflen; - s[0] = x[0]; - s[1] = x[1]; - s[2] = x[2]; - s[3] = x[3]; - for (i = 0; i < buf.length; i += 1) { - this._buffer8[i] = buf.charCodeAt(i); - } - } - /** - * Hash the current state of the hash buffer and return the result - * @param raw Whether to return the value as an `Int32Array` - */ - end(raw = false) { - const bufLen = this._bufferLength; - const buf8 = this._buffer8; - const buf32 = this._buffer32; - const i = (bufLen >> 2) + 1; - this._dataLength += bufLen; - const dataBitsLen = this._dataLength * 8; - buf8[bufLen] = 128; - buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0; - buf32.set(_Md5.buffer32Identity.subarray(i), i); - if (bufLen > 55) { - _Md5._md5cycle(this._state, buf32); - buf32.set(_Md5.buffer32Identity); - } - if (dataBitsLen <= 4294967295) { - buf32[14] = dataBitsLen; - } else { - const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/); - if (matches === null) { - return; - } - const lo = parseInt(matches[2], 16); - const hi = parseInt(matches[1], 16) || 0; - buf32[14] = lo; - buf32[15] = hi; - } - _Md5._md5cycle(this._state, buf32); - return raw ? this._state : _Md5._hex(this._state); - } - }; - } -}); - -// shims/crypto/index.ts -var crypto_exports = {}; -__export(crypto_exports, { - createHash: () => createHash, - createHmac: () => createHmac, - randomBytes: () => randomBytes -}); -function randomBytes(length) { - return crypto.getRandomValues(Buffer2.alloc(length)); -} -function createHash(type) { - if (type === "sha256") - return { - update: /* @__PURE__ */ __name(function(data) { - return { - digest: /* @__PURE__ */ __name(function() { - return Buffer2.from(sha256(data)); - }, "digest") - }; - }, "update") - }; - if (type === "md5") - return { - update: /* @__PURE__ */ __name(function(data) { - return { - digest: /* @__PURE__ */ __name(function() { - return typeof data === "string" ? Md5.hashStr(data) : Md5.hashByteArray(data); - }, "digest") - }; - }, "update") - }; - throw new Error(`Hash type '${type}' not supported`); -} -function createHmac(type, key) { - if (type !== "sha256") - throw new Error(`Only sha256 is supported (requested: '${type}')`); - return { - update: /* @__PURE__ */ __name(function(data) { - return { - digest: /* @__PURE__ */ __name(function() { - if (typeof key === "string") key = new TextEncoder().encode(key); - if (typeof data === "string") data = new TextEncoder().encode(data); - const keyLen = key.length; - if (keyLen > 64) { - key = sha256(key); - } else if (keyLen < 64) { - const tmp = new Uint8Array(64); - tmp.set(key); - key = tmp; - } - const innerKey = new Uint8Array(64); - const outerKey = new Uint8Array(64); - for (let i = 0; i < 64; i++) { - innerKey[i] = 54 ^ key[i]; - outerKey[i] = 92 ^ key[i]; - } - const msg = new Uint8Array(data.length + 64); - msg.set(innerKey, 0); - msg.set(data, 64); - const result = new Uint8Array(64 + 32); - result.set(outerKey, 0); - result.set(sha256(msg), 64); - return Buffer2.from(sha256(result)); - }, "digest") - }; - }, "update") - }; -} -var init_crypto = __esm({ - "shims/crypto/index.ts"() { - "use strict"; - init_shims(); - init_sha256(); - init_md5(); - __name(randomBytes, "randomBytes"); - __name(createHash, "createHash"); - __name(createHmac, "createHmac"); - } -}); - -// node_modules/pg/node_modules/postgres-array/index.js -var require_postgres_array = __commonJS({ - "node_modules/pg/node_modules/postgres-array/index.js"(exports) { - "use strict"; - init_shims(); - exports.parse = function(source, transform) { - return new ArrayParser(source, transform).parse(); - }; - var ArrayParser = class _ArrayParser { - static { - __name(this, "ArrayParser"); - } - constructor(source, transform) { - this.source = source; - this.transform = transform || identity; - this.position = 0; - this.entries = []; - this.recorded = []; - this.dimension = 0; - } - isEof() { - return this.position >= this.source.length; - } - nextCharacter() { - var character = this.source[this.position++]; - if (character === "\\") { - return { - value: this.source[this.position++], - escaped: true - }; - } - return { - value: character, - escaped: false - }; - } - record(character) { - this.recorded.push(character); - } - newEntry(includeEmpty) { - var entry; - if (this.recorded.length > 0 || includeEmpty) { - entry = this.recorded.join(""); - if (entry === "NULL" && !includeEmpty) { - entry = null; - } - if (entry !== null) entry = this.transform(entry); - this.entries.push(entry); - this.recorded = []; - } - } - consumeDimensions() { - if (this.source[0] === "[") { - while (!this.isEof()) { - var char = this.nextCharacter(); - if (char.value === "=") break; - } - } - } - parse(nested) { - var character, parser, quote; - this.consumeDimensions(); - while (!this.isEof()) { - character = this.nextCharacter(); - if (character.value === "{" && !quote) { - this.dimension++; - if (this.dimension > 1) { - parser = new _ArrayParser(this.source.substr(this.position - 1), this.transform); - this.entries.push(parser.parse(true)); - this.position += parser.position - 2; - } - } else if (character.value === "}" && !quote) { - this.dimension--; - if (!this.dimension) { - this.newEntry(); - if (nested) return this.entries; - } - } else if (character.value === '"' && !character.escaped) { - if (quote) this.newEntry(true); - quote = !quote; - } else if (character.value === "," && !quote) { - this.newEntry(); - } else { - this.record(character.value); - } - } - if (this.dimension !== 0) { - throw new Error("array dimension not balanced"); - } - return this.entries; - } - }; - function identity(value) { - return value; - } - __name(identity, "identity"); - } -}); - -// node_modules/pg/node_modules/pg-types/lib/arrayParser.js -var require_arrayParser = __commonJS({ - "node_modules/pg/node_modules/pg-types/lib/arrayParser.js"(exports, module) { - init_shims(); - var array = require_postgres_array(); - module.exports = { - create: /* @__PURE__ */ __name(function(source, transform) { - return { - parse: /* @__PURE__ */ __name(function() { - return array.parse(source, transform); - }, "parse") - }; - }, "create") - }; - } -}); - -// node_modules/pg/node_modules/postgres-date/index.js -var require_postgres_date = __commonJS({ - "node_modules/pg/node_modules/postgres-date/index.js"(exports, module) { - "use strict"; - init_shims(); - var DATE_TIME = /(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/; - var DATE = /^(\d{1,})-(\d{2})-(\d{2})( BC)?$/; - var TIME_ZONE = /([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/; - var INFINITY = /^-?infinity$/; - module.exports = /* @__PURE__ */ __name(function parseDate(isoDate) { - if (INFINITY.test(isoDate)) { - return Number(isoDate.replace("i", "I")); - } - var matches = DATE_TIME.exec(isoDate); - if (!matches) { - return getDate(isoDate) || null; - } - var isBC = !!matches[8]; - var year = parseInt(matches[1], 10); - if (isBC) { - year = bcYearToNegativeYear(year); - } - var month = parseInt(matches[2], 10) - 1; - var day = matches[3]; - var hour = parseInt(matches[4], 10); - var minute = parseInt(matches[5], 10); - var second = parseInt(matches[6], 10); - var ms = matches[7]; - ms = ms ? 1e3 * parseFloat(ms) : 0; - var date; - var offset = timeZoneOffset(isoDate); - if (offset != null) { - date = new Date(Date.UTC(year, month, day, hour, minute, second, ms)); - if (is0To99(year)) { - date.setUTCFullYear(year); - } - if (offset !== 0) { - date.setTime(date.getTime() - offset); - } - } else { - date = new Date(year, month, day, hour, minute, second, ms); - if (is0To99(year)) { - date.setFullYear(year); - } - } - return date; - }, "parseDate"); - function getDate(isoDate) { - var matches = DATE.exec(isoDate); - if (!matches) { - return; - } - var year = parseInt(matches[1], 10); - var isBC = !!matches[4]; - if (isBC) { - year = bcYearToNegativeYear(year); - } - var month = parseInt(matches[2], 10) - 1; - var day = matches[3]; - var date = new Date(year, month, day); - if (is0To99(year)) { - date.setFullYear(year); - } - return date; - } - __name(getDate, "getDate"); - function timeZoneOffset(isoDate) { - if (isoDate.endsWith("+00")) { - return 0; - } - var zone = TIME_ZONE.exec(isoDate.split(" ")[1]); - if (!zone) return; - var type = zone[1]; - if (type === "Z") { - return 0; - } - var sign = type === "-" ? -1 : 1; - var offset = parseInt(zone[2], 10) * 3600 + parseInt(zone[3] || 0, 10) * 60 + parseInt(zone[4] || 0, 10); - return offset * sign * 1e3; - } - __name(timeZoneOffset, "timeZoneOffset"); - function bcYearToNegativeYear(year) { - return -(year - 1); - } - __name(bcYearToNegativeYear, "bcYearToNegativeYear"); - function is0To99(num) { - return num >= 0 && num < 100; - } - __name(is0To99, "is0To99"); - } -}); - -// node_modules/xtend/mutable.js -var require_mutable = __commonJS({ - "node_modules/xtend/mutable.js"(exports, module) { - init_shims(); - module.exports = extend; - var hasOwnProperty2 = Object.prototype.hasOwnProperty; - function extend(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (hasOwnProperty2.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - } - __name(extend, "extend"); - } -}); - -// node_modules/pg/node_modules/postgres-interval/index.js -var require_postgres_interval = __commonJS({ - "node_modules/pg/node_modules/postgres-interval/index.js"(exports, module) { - "use strict"; - init_shims(); - var extend = require_mutable(); - module.exports = PostgresInterval; - function PostgresInterval(raw) { - if (!(this instanceof PostgresInterval)) { - return new PostgresInterval(raw); - } - extend(this, parse2(raw)); - } - __name(PostgresInterval, "PostgresInterval"); - var properties = ["seconds", "minutes", "hours", "days", "months", "years"]; - PostgresInterval.prototype.toPostgres = function() { - var filtered = properties.filter(this.hasOwnProperty, this); - if (this.milliseconds && filtered.indexOf("seconds") < 0) { - filtered.push("seconds"); - } - if (filtered.length === 0) return "0"; - return filtered.map(function(property) { - var value = this[property] || 0; - if (property === "seconds" && this.milliseconds) { - value = (value + this.milliseconds / 1e3).toFixed(6).replace(/\.?0+$/, ""); - } - return value + " " + property; - }, this).join(" "); - }; - var propertiesISOEquivalent = { - years: "Y", - months: "M", - days: "D", - hours: "H", - minutes: "M", - seconds: "S" - }; - var dateProperties = ["years", "months", "days"]; - var timeProperties = ["hours", "minutes", "seconds"]; - PostgresInterval.prototype.toISOString = PostgresInterval.prototype.toISO = function() { - var datePart = dateProperties.map(buildProperty, this).join(""); - var timePart = timeProperties.map(buildProperty, this).join(""); - return "P" + datePart + "T" + timePart; - function buildProperty(property) { - var value = this[property] || 0; - if (property === "seconds" && this.milliseconds) { - value = (value + this.milliseconds / 1e3).toFixed(6).replace(/0+$/, ""); - } - return value + propertiesISOEquivalent[property]; - } - __name(buildProperty, "buildProperty"); - }; - var NUMBER = "([+-]?\\d+)"; - var YEAR = NUMBER + "\\s+years?"; - var MONTH = NUMBER + "\\s+mons?"; - var DAY = NUMBER + "\\s+days?"; - var TIME = "([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?"; - var INTERVAL = new RegExp([YEAR, MONTH, DAY, TIME].map(function(regexString) { - return "(" + regexString + ")?"; - }).join("\\s*")); - var positions = { - years: 2, - months: 4, - days: 6, - hours: 9, - minutes: 10, - seconds: 11, - milliseconds: 12 - }; - var negatives = ["hours", "minutes", "seconds", "milliseconds"]; - function parseMilliseconds(fraction) { - var microseconds = fraction + "000000".slice(fraction.length); - return parseInt(microseconds, 10) / 1e3; - } - __name(parseMilliseconds, "parseMilliseconds"); - function parse2(interval) { - if (!interval) return {}; - var matches = INTERVAL.exec(interval); - var isNegative = matches[8] === "-"; - return Object.keys(positions).reduce(function(parsed, property) { - var position = positions[property]; - var value = matches[position]; - if (!value) return parsed; - value = property === "milliseconds" ? parseMilliseconds(value) : parseInt(value, 10); - if (!value) return parsed; - if (isNegative && ~negatives.indexOf(property)) { - value *= -1; - } - parsed[property] = value; - return parsed; - }, {}); - } - __name(parse2, "parse"); - } -}); - -// node_modules/pg/node_modules/postgres-bytea/index.js -var require_postgres_bytea = __commonJS({ - "node_modules/pg/node_modules/postgres-bytea/index.js"(exports, module) { - "use strict"; - init_shims(); - module.exports = /* @__PURE__ */ __name(function parseBytea(input) { - if (/^\\x/.test(input)) { - return new Buffer2(input.substr(2), "hex"); - } - var output = ""; - var i = 0; - while (i < input.length) { - if (input[i] !== "\\") { - output += input[i]; - ++i; - } else { - if (/[0-7]{3}/.test(input.substr(i + 1, 3))) { - output += String.fromCharCode(parseInt(input.substr(i + 1, 3), 8)); - i += 4; - } else { - var backslashes = 1; - while (i + backslashes < input.length && input[i + backslashes] === "\\") { - backslashes++; - } - for (var k = 0; k < Math.floor(backslashes / 2); ++k) { - output += "\\"; - } - i += Math.floor(backslashes / 2) * 2; - } - } - } - return new Buffer2(output, "binary"); - }, "parseBytea"); - } -}); - -// node_modules/pg/node_modules/pg-types/lib/textParsers.js -var require_textParsers = __commonJS({ - "node_modules/pg/node_modules/pg-types/lib/textParsers.js"(exports, module) { - init_shims(); - var array = require_postgres_array(); - var arrayParser = require_arrayParser(); - var parseDate = require_postgres_date(); - var parseInterval = require_postgres_interval(); - var parseByteA = require_postgres_bytea(); - function allowNull(fn) { - return /* @__PURE__ */ __name(function nullAllowed(value) { - if (value === null) return value; - return fn(value); - }, "nullAllowed"); - } - __name(allowNull, "allowNull"); - function parseBool(value) { - if (value === null) return value; - return value === "TRUE" || value === "t" || value === "true" || value === "y" || value === "yes" || value === "on" || value === "1"; - } - __name(parseBool, "parseBool"); - function parseBoolArray(value) { - if (!value) return null; - return array.parse(value, parseBool); - } - __name(parseBoolArray, "parseBoolArray"); - function parseBaseTenInt(string) { - return parseInt(string, 10); - } - __name(parseBaseTenInt, "parseBaseTenInt"); - function parseIntegerArray(value) { - if (!value) return null; - return array.parse(value, allowNull(parseBaseTenInt)); - } - __name(parseIntegerArray, "parseIntegerArray"); - function parseBigIntegerArray(value) { - if (!value) return null; - return array.parse(value, allowNull(function(entry) { - return parseBigInteger(entry).trim(); - })); - } - __name(parseBigIntegerArray, "parseBigIntegerArray"); - var parsePointArray = /* @__PURE__ */ __name(function(value) { - if (!value) { - return null; - } - var p2 = arrayParser.create(value, function(entry) { - if (entry !== null) { - entry = parsePoint(entry); - } - return entry; - }); - return p2.parse(); - }, "parsePointArray"); - var parseFloatArray = /* @__PURE__ */ __name(function(value) { - if (!value) { - return null; - } - var p2 = arrayParser.create(value, function(entry) { - if (entry !== null) { - entry = parseFloat(entry); - } - return entry; - }); - return p2.parse(); - }, "parseFloatArray"); - var parseStringArray = /* @__PURE__ */ __name(function(value) { - if (!value) { - return null; - } - var p2 = arrayParser.create(value); - return p2.parse(); - }, "parseStringArray"); - var parseDateArray = /* @__PURE__ */ __name(function(value) { - if (!value) { - return null; - } - var p2 = arrayParser.create(value, function(entry) { - if (entry !== null) { - entry = parseDate(entry); - } - return entry; - }); - return p2.parse(); - }, "parseDateArray"); - var parseIntervalArray = /* @__PURE__ */ __name(function(value) { - if (!value) { - return null; - } - var p2 = arrayParser.create(value, function(entry) { - if (entry !== null) { - entry = parseInterval(entry); - } - return entry; - }); - return p2.parse(); - }, "parseIntervalArray"); - var parseByteAArray = /* @__PURE__ */ __name(function(value) { - if (!value) { - return null; - } - return array.parse(value, allowNull(parseByteA)); - }, "parseByteAArray"); - var parseInteger = /* @__PURE__ */ __name(function(value) { - return parseInt(value, 10); - }, "parseInteger"); - var parseBigInteger = /* @__PURE__ */ __name(function(value) { - var valStr = String(value); - if (/^\d+$/.test(valStr)) { - return valStr; - } - return value; - }, "parseBigInteger"); - var parseJsonArray = /* @__PURE__ */ __name(function(value) { - if (!value) { - return null; - } - return array.parse(value, allowNull(JSON.parse)); - }, "parseJsonArray"); - var parsePoint = /* @__PURE__ */ __name(function(value) { - if (value[0] !== "(") { - return null; - } - value = value.substring(1, value.length - 1).split(","); - return { - x: parseFloat(value[0]), - y: parseFloat(value[1]) - }; - }, "parsePoint"); - var parseCircle = /* @__PURE__ */ __name(function(value) { - if (value[0] !== "<" && value[1] !== "(") { - return null; - } - var point = "("; - var radius = ""; - var pointParsed = false; - for (var i = 2; i < value.length - 1; i++) { - if (!pointParsed) { - point += value[i]; - } - if (value[i] === ")") { - pointParsed = true; - continue; - } else if (!pointParsed) { - continue; - } - if (value[i] === ",") { - continue; - } - radius += value[i]; - } - var result = parsePoint(point); - result.radius = parseFloat(radius); - return result; - }, "parseCircle"); - var init = /* @__PURE__ */ __name(function(register) { - register(20, parseBigInteger); - register(21, parseInteger); - register(23, parseInteger); - register(26, parseInteger); - register(700, parseFloat); - register(701, parseFloat); - register(16, parseBool); - register(1082, parseDate); - register(1114, parseDate); - register(1184, parseDate); - register(600, parsePoint); - register(651, parseStringArray); - register(718, parseCircle); - register(1e3, parseBoolArray); - register(1001, parseByteAArray); - register(1005, parseIntegerArray); - register(1007, parseIntegerArray); - register(1028, parseIntegerArray); - register(1016, parseBigIntegerArray); - register(1017, parsePointArray); - register(1021, parseFloatArray); - register(1022, parseFloatArray); - register(1231, parseFloatArray); - register(1014, parseStringArray); - register(1015, parseStringArray); - register(1008, parseStringArray); - register(1009, parseStringArray); - register(1040, parseStringArray); - register(1041, parseStringArray); - register(1115, parseDateArray); - register(1182, parseDateArray); - register(1185, parseDateArray); - register(1186, parseInterval); - register(1187, parseIntervalArray); - register(17, parseByteA); - register(114, JSON.parse.bind(JSON)); - register(3802, JSON.parse.bind(JSON)); - register(199, parseJsonArray); - register(3807, parseJsonArray); - register(3907, parseStringArray); - register(2951, parseStringArray); - register(791, parseStringArray); - register(1183, parseStringArray); - register(1270, parseStringArray); - }, "init"); - module.exports = { - init - }; - } -}); - -// node_modules/pg-int8/index.js -var require_pg_int8 = __commonJS({ - "node_modules/pg-int8/index.js"(exports, module) { - "use strict"; - init_shims(); - var BASE = 1e6; - function readInt8(buffer) { - var high = buffer.readInt32BE(0); - var low = buffer.readUInt32BE(4); - var sign = ""; - if (high < 0) { - high = ~high + (low === 0); - low = ~low + 1 >>> 0; - sign = "-"; - } - var result = ""; - var carry; - var t; - var digits; - var pad; - var l2; - var i; - { - carry = high % BASE; - high = high / BASE >>> 0; - t = 4294967296 * carry + low; - low = t / BASE >>> 0; - digits = "" + (t - BASE * low); - if (low === 0 && high === 0) { - return sign + digits + result; - } - pad = ""; - l2 = 6 - digits.length; - for (i = 0; i < l2; i++) { - pad += "0"; - } - result = pad + digits + result; - } - { - carry = high % BASE; - high = high / BASE >>> 0; - t = 4294967296 * carry + low; - low = t / BASE >>> 0; - digits = "" + (t - BASE * low); - if (low === 0 && high === 0) { - return sign + digits + result; - } - pad = ""; - l2 = 6 - digits.length; - for (i = 0; i < l2; i++) { - pad += "0"; - } - result = pad + digits + result; - } - { - carry = high % BASE; - high = high / BASE >>> 0; - t = 4294967296 * carry + low; - low = t / BASE >>> 0; - digits = "" + (t - BASE * low); - if (low === 0 && high === 0) { - return sign + digits + result; - } - pad = ""; - l2 = 6 - digits.length; - for (i = 0; i < l2; i++) { - pad += "0"; - } - result = pad + digits + result; - } - { - carry = high % BASE; - t = 4294967296 * carry + low; - digits = "" + t % BASE; - return sign + digits + result; - } - } - __name(readInt8, "readInt8"); - module.exports = readInt8; - } -}); - -// node_modules/pg/node_modules/pg-types/lib/binaryParsers.js -var require_binaryParsers = __commonJS({ - "node_modules/pg/node_modules/pg-types/lib/binaryParsers.js"(exports, module) { - init_shims(); - var parseInt64 = require_pg_int8(); - var parseBits = /* @__PURE__ */ __name(function(data, bits, offset, invert, callback) { - offset = offset || 0; - invert = invert || false; - callback = callback || function(lastValue, newValue, bits2) { - return lastValue * Math.pow(2, bits2) + newValue; - }; - var offsetBytes = offset >> 3; - var inv = /* @__PURE__ */ __name(function(value) { - if (invert) { - return ~value & 255; - } - return value; - }, "inv"); - var mask = 255; - var firstBits = 8 - offset % 8; - if (bits < firstBits) { - mask = 255 << 8 - bits & 255; - firstBits = bits; - } - if (offset) { - mask = mask >> offset % 8; - } - var result = 0; - if (offset % 8 + bits >= 8) { - result = callback(0, inv(data[offsetBytes]) & mask, firstBits); - } - var bytes = bits + offset >> 3; - for (var i = offsetBytes + 1; i < bytes; i++) { - result = callback(result, inv(data[i]), 8); - } - var lastBits = (bits + offset) % 8; - if (lastBits > 0) { - result = callback(result, inv(data[bytes]) >> 8 - lastBits, lastBits); - } - return result; - }, "parseBits"); - var parseFloatFromBits = /* @__PURE__ */ __name(function(data, precisionBits, exponentBits) { - var bias = Math.pow(2, exponentBits - 1) - 1; - var sign = parseBits(data, 1); - var exponent = parseBits(data, exponentBits, 1); - if (exponent === 0) { - return 0; - } - var precisionBitsCounter = 1; - var parsePrecisionBits = /* @__PURE__ */ __name(function(lastValue, newValue, bits) { - if (lastValue === 0) { - lastValue = 1; - } - for (var i = 1; i <= bits; i++) { - precisionBitsCounter /= 2; - if ((newValue & 1 << bits - i) > 0) { - lastValue += precisionBitsCounter; - } - } - return lastValue; - }, "parsePrecisionBits"); - var mantissa = parseBits(data, precisionBits, exponentBits + 1, false, parsePrecisionBits); - if (exponent == Math.pow(2, exponentBits + 1) - 1) { - if (mantissa === 0) { - return sign === 0 ? Infinity : -Infinity; - } - return NaN; - } - return (sign === 0 ? 1 : -1) * Math.pow(2, exponent - bias) * mantissa; - }, "parseFloatFromBits"); - var parseInt16 = /* @__PURE__ */ __name(function(value) { - if (parseBits(value, 1) == 1) { - return -1 * (parseBits(value, 15, 1, true) + 1); - } - return parseBits(value, 15, 1); - }, "parseInt16"); - var parseInt32 = /* @__PURE__ */ __name(function(value) { - if (parseBits(value, 1) == 1) { - return -1 * (parseBits(value, 31, 1, true) + 1); - } - return parseBits(value, 31, 1); - }, "parseInt32"); - var parseFloat32 = /* @__PURE__ */ __name(function(value) { - return parseFloatFromBits(value, 23, 8); - }, "parseFloat32"); - var parseFloat64 = /* @__PURE__ */ __name(function(value) { - return parseFloatFromBits(value, 52, 11); - }, "parseFloat64"); - var parseNumeric = /* @__PURE__ */ __name(function(value) { - var sign = parseBits(value, 16, 32); - if (sign == 49152) { - return NaN; - } - var weight = Math.pow(1e4, parseBits(value, 16, 16)); - var result = 0; - var digits = []; - var ndigits = parseBits(value, 16); - for (var i = 0; i < ndigits; i++) { - result += parseBits(value, 16, 64 + 16 * i) * weight; - weight /= 1e4; - } - var scale = Math.pow(10, parseBits(value, 16, 48)); - return (sign === 0 ? 1 : -1) * Math.round(result * scale) / scale; - }, "parseNumeric"); - var parseDate = /* @__PURE__ */ __name(function(isUTC, value) { - var sign = parseBits(value, 1); - var rawValue = parseBits(value, 63, 1); - var result = new Date((sign === 0 ? 1 : -1) * rawValue / 1e3 + 9466848e5); - if (!isUTC) { - result.setTime(result.getTime() + result.getTimezoneOffset() * 6e4); - } - result.usec = rawValue % 1e3; - result.getMicroSeconds = function() { - return this.usec; - }; - result.setMicroSeconds = function(value2) { - this.usec = value2; - }; - result.getUTCMicroSeconds = function() { - return this.usec; - }; - return result; - }, "parseDate"); - var parseArray = /* @__PURE__ */ __name(function(value) { - var dim = parseBits(value, 32); - var flags = parseBits(value, 32, 32); - var elementType = parseBits(value, 32, 64); - var offset = 96; - var dims = []; - for (var i = 0; i < dim; i++) { - dims[i] = parseBits(value, 32, offset); - offset += 32; - offset += 32; - } - var parseElement = /* @__PURE__ */ __name(function(elementType2) { - var length = parseBits(value, 32, offset); - offset += 32; - if (length == 4294967295) { - return null; - } - var result; - if (elementType2 == 23 || elementType2 == 20) { - result = parseBits(value, length * 8, offset); - offset += length * 8; - return result; - } else if (elementType2 == 25) { - result = value.toString(this.encoding, offset >> 3, (offset += length << 3) >> 3); - return result; - } else { - console.log("ERROR: ElementType not implemented: " + elementType2); - } - }, "parseElement"); - var parse2 = /* @__PURE__ */ __name(function(dimension, elementType2) { - var array = []; - var i2; - if (dimension.length > 1) { - var count = dimension.shift(); - for (i2 = 0; i2 < count; i2++) { - array[i2] = parse2(dimension, elementType2); - } - dimension.unshift(count); - } else { - for (i2 = 0; i2 < dimension[0]; i2++) { - array[i2] = parseElement(elementType2); - } - } - return array; - }, "parse"); - return parse2(dims, elementType); - }, "parseArray"); - var parseText = /* @__PURE__ */ __name(function(value) { - return value.toString("utf8"); - }, "parseText"); - var parseBool = /* @__PURE__ */ __name(function(value) { - if (value === null) return null; - return parseBits(value, 8) > 0; - }, "parseBool"); - var init = /* @__PURE__ */ __name(function(register) { - register(20, parseInt64); - register(21, parseInt16); - register(23, parseInt32); - register(26, parseInt32); - register(1700, parseNumeric); - register(700, parseFloat32); - register(701, parseFloat64); - register(16, parseBool); - register(1114, parseDate.bind(null, false)); - register(1184, parseDate.bind(null, true)); - register(1e3, parseArray); - register(1007, parseArray); - register(1016, parseArray); - register(1008, parseArray); - register(1009, parseArray); - register(25, parseText); - }, "init"); - module.exports = { - init - }; - } -}); - -// node_modules/pg/node_modules/pg-types/lib/builtins.js -var require_builtins = __commonJS({ - "node_modules/pg/node_modules/pg-types/lib/builtins.js"(exports, module) { - init_shims(); - module.exports = { - BOOL: 16, - BYTEA: 17, - CHAR: 18, - INT8: 20, - INT2: 21, - INT4: 23, - REGPROC: 24, - TEXT: 25, - OID: 26, - TID: 27, - XID: 28, - CID: 29, - JSON: 114, - XML: 142, - PG_NODE_TREE: 194, - SMGR: 210, - PATH: 602, - POLYGON: 604, - CIDR: 650, - FLOAT4: 700, - FLOAT8: 701, - ABSTIME: 702, - RELTIME: 703, - TINTERVAL: 704, - CIRCLE: 718, - MACADDR8: 774, - MONEY: 790, - MACADDR: 829, - INET: 869, - ACLITEM: 1033, - BPCHAR: 1042, - VARCHAR: 1043, - DATE: 1082, - TIME: 1083, - TIMESTAMP: 1114, - TIMESTAMPTZ: 1184, - INTERVAL: 1186, - TIMETZ: 1266, - BIT: 1560, - VARBIT: 1562, - NUMERIC: 1700, - REFCURSOR: 1790, - REGPROCEDURE: 2202, - REGOPER: 2203, - REGOPERATOR: 2204, - REGCLASS: 2205, - REGTYPE: 2206, - UUID: 2950, - TXID_SNAPSHOT: 2970, - PG_LSN: 3220, - PG_NDISTINCT: 3361, - PG_DEPENDENCIES: 3402, - TSVECTOR: 3614, - TSQUERY: 3615, - GTSVECTOR: 3642, - REGCONFIG: 3734, - REGDICTIONARY: 3769, - JSONB: 3802, - REGNAMESPACE: 4089, - REGROLE: 4096 - }; - } -}); - -// node_modules/pg/node_modules/pg-types/index.js -var require_pg_types = __commonJS({ - "node_modules/pg/node_modules/pg-types/index.js"(exports) { - init_shims(); - var textParsers = require_textParsers(); - var binaryParsers = require_binaryParsers(); - var arrayParser = require_arrayParser(); - var builtinTypes = require_builtins(); - exports.getTypeParser = getTypeParser; - exports.setTypeParser = setTypeParser; - exports.arrayParser = arrayParser; - exports.builtins = builtinTypes; - var typeParsers = { - text: {}, - binary: {} - }; - function noParse(val) { - return String(val); - } - __name(noParse, "noParse"); - function getTypeParser(oid, format) { - format = format || "text"; - if (!typeParsers[format]) { - return noParse; - } - return typeParsers[format][oid] || noParse; - } - __name(getTypeParser, "getTypeParser"); - function setTypeParser(oid, format, parseFn) { - if (typeof format == "function") { - parseFn = format; - format = "text"; - } - typeParsers[format][oid] = parseFn; - } - __name(setTypeParser, "setTypeParser"); - textParsers.init(function(oid, converter) { - typeParsers.text[oid] = converter; - }); - binaryParsers.init(function(oid, converter) { - typeParsers.binary[oid] = converter; - }); - } -}); - -// node_modules/pg/lib/defaults.js -var require_defaults = __commonJS({ - "node_modules/pg/lib/defaults.js"(exports, module) { - "use strict"; - init_shims(); - module.exports = { - // database host. defaults to localhost - host: "localhost", - // database user's name - user: process.platform === "win32" ? process.env.USERNAME : process.env.USER, - // name of database to connect - database: void 0, - // database user's password - password: null, - // a Postgres connection string to be used instead of setting individual connection items - // NOTE: Setting this value will cause it to override any other value (such as database or user) defined - // in the defaults object. - connectionString: void 0, - // database port - port: 5432, - // number of rows to return at a time from a prepared statement's - // portal. 0 will return all rows at once - rows: 0, - // binary result mode - binary: false, - // Connection pool options - see https://github.com/brianc/node-pg-pool - // number of connections to use in connection pool - // 0 will disable connection pooling - max: 10, - // max milliseconds a client can go unused before it is removed - // from the pool and destroyed - idleTimeoutMillis: 3e4, - client_encoding: "", - ssl: false, - application_name: void 0, - fallback_application_name: void 0, - options: void 0, - parseInputDatesAsUTC: false, - // max milliseconds any query using this connection will execute for before timing out in error. - // false=unlimited - statement_timeout: false, - // Abort any statement that waits longer than the specified duration in milliseconds while attempting to acquire a lock. - // false=unlimited - lock_timeout: false, - // Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds - // false=unlimited - idle_in_transaction_session_timeout: false, - // max milliseconds to wait for query to complete (client side) - query_timeout: false, - connect_timeout: 0, - keepalives: 1, - keepalives_idle: 0 - }; - var pgTypes = require_pg_types(); - var parseBigInteger = pgTypes.getTypeParser(20, "text"); - var parseBigIntegerArray = pgTypes.getTypeParser(1016, "text"); - module.exports.__defineSetter__("parseInt8", function(val) { - pgTypes.setTypeParser(20, "text", val ? pgTypes.getTypeParser(23, "text") : parseBigInteger); - pgTypes.setTypeParser(1016, "text", val ? pgTypes.getTypeParser(1007, "text") : parseBigIntegerArray); - }); - } -}); - -// node_modules/pg/lib/utils.js -var require_utils = __commonJS({ - "node_modules/pg/lib/utils.js"(exports, module) { - "use strict"; - init_shims(); - var crypto2 = (init_crypto(), __toCommonJS(crypto_exports)); - var defaults2 = require_defaults(); - function escapeElement(elementRepresentation) { - var escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"'); - return '"' + escaped + '"'; - } - __name(escapeElement, "escapeElement"); - function arrayString(val) { - var result = "{"; - for (var i = 0; i < val.length; i++) { - if (i > 0) { - result = result + ","; - } - if (val[i] === null || typeof val[i] === "undefined") { - result = result + "NULL"; - } else if (Array.isArray(val[i])) { - result = result + arrayString(val[i]); - } else if (val[i] instanceof Buffer2) { - result += "\\\\x" + val[i].toString("hex"); - } else { - result += escapeElement(prepareValue2(val[i])); - } - } - result = result + "}"; - return result; - } - __name(arrayString, "arrayString"); - var prepareValue2 = /* @__PURE__ */ __name(function(val, seen) { - if (val == null) { - return null; - } - if (val instanceof Buffer2) { - return val; - } - if (ArrayBuffer.isView(val)) { - var buf = Buffer2.from(val.buffer, val.byteOffset, val.byteLength); - if (buf.length === val.byteLength) { - return buf; - } - return buf.slice(val.byteOffset, val.byteOffset + val.byteLength); - } - if (val instanceof Date) { - if (defaults2.parseInputDatesAsUTC) { - return dateToStringUTC(val); - } else { - return dateToString(val); - } - } - if (Array.isArray(val)) { - return arrayString(val); - } - if (typeof val === "object") { - return prepareObject(val, seen); - } - return val.toString(); - }, "prepareValue"); - function prepareObject(val, seen) { - if (val && typeof val.toPostgres === "function") { - seen = seen || []; - if (seen.indexOf(val) !== -1) { - throw new Error('circular reference detected while preparing "' + val + '" for query'); - } - seen.push(val); - return prepareValue2(val.toPostgres(prepareValue2), seen); - } - return JSON.stringify(val); - } - __name(prepareObject, "prepareObject"); - function pad(number, digits) { - number = "" + number; - while (number.length < digits) { - number = "0" + number; - } - return number; - } - __name(pad, "pad"); - function dateToString(date) { - var offset = -date.getTimezoneOffset(); - var year = date.getFullYear(); - var isBCYear = year < 1; - if (isBCYear) year = Math.abs(year) + 1; - var ret = pad(year, 4) + "-" + pad(date.getMonth() + 1, 2) + "-" + pad(date.getDate(), 2) + "T" + pad(date.getHours(), 2) + ":" + pad(date.getMinutes(), 2) + ":" + pad(date.getSeconds(), 2) + "." + pad(date.getMilliseconds(), 3); - if (offset < 0) { - ret += "-"; - offset *= -1; - } else { - ret += "+"; - } - ret += pad(Math.floor(offset / 60), 2) + ":" + pad(offset % 60, 2); - if (isBCYear) ret += " BC"; - return ret; - } - __name(dateToString, "dateToString"); - function dateToStringUTC(date) { - var year = date.getUTCFullYear(); - var isBCYear = year < 1; - if (isBCYear) year = Math.abs(year) + 1; - var ret = pad(year, 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + "T" + pad(date.getUTCHours(), 2) + ":" + pad(date.getUTCMinutes(), 2) + ":" + pad(date.getUTCSeconds(), 2) + "." + pad(date.getUTCMilliseconds(), 3); - ret += "+00:00"; - if (isBCYear) ret += " BC"; - return ret; - } - __name(dateToStringUTC, "dateToStringUTC"); - function normalizeQueryConfig(config, values, callback) { - config = typeof config === "string" ? { text: config } : config; - if (values) { - if (typeof values === "function") { - config.callback = values; - } else { - config.values = values; - } - } - if (callback) { - config.callback = callback; - } - return config; - } - __name(normalizeQueryConfig, "normalizeQueryConfig"); - var md5 = /* @__PURE__ */ __name(function(string) { - return crypto2.createHash("md5").update(string, "utf-8").digest("hex"); - }, "md5"); - var postgresMd5PasswordHash = /* @__PURE__ */ __name(function(user, password, salt) { - var inner = md5(password + user); - var outer = md5(Buffer2.concat([Buffer2.from(inner), salt])); - return "md5" + outer; - }, "postgresMd5PasswordHash"); - module.exports = { - prepareValue: /* @__PURE__ */ __name(function prepareValueWrapper(value) { - return prepareValue2(value); - }, "prepareValueWrapper"), - normalizeQueryConfig, - postgresMd5PasswordHash, - md5 - }; - } -}); - -// node_modules/pg/lib/sasl.js -var require_sasl = __commonJS({ - "node_modules/pg/lib/sasl.js"(exports, module) { - "use strict"; - init_shims(); - var crypto2 = (init_crypto(), __toCommonJS(crypto_exports)); - function startSession(mechanisms) { - if (mechanisms.indexOf("SCRAM-SHA-256") === -1) { - throw new Error("SASL: Only mechanism SCRAM-SHA-256 is currently supported"); - } - const clientNonce = crypto2.randomBytes(18).toString("base64"); - return { - mechanism: "SCRAM-SHA-256", - clientNonce, - response: "n,,n=*,r=" + clientNonce, - message: "SASLInitialResponse" - }; - } - __name(startSession, "startSession"); - function continueSession(session, password, serverData) { - if (session.message !== "SASLInitialResponse") { - throw new Error("SASL: Last message was not SASLInitialResponse"); - } - if (typeof password !== "string") { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string"); - } - if (typeof serverData !== "string") { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string"); - } - const sv = parseServerFirstMessage(serverData); - if (!sv.nonce.startsWith(session.clientNonce)) { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); - } else if (sv.nonce.length === session.clientNonce.length) { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short"); - } - var saltBytes = Buffer2.from(sv.salt, "base64"); - var saltedPassword = Hi(password, saltBytes, sv.iteration); - var clientKey = hmacSha256(saltedPassword, "Client Key"); - var storedKey = sha2562(clientKey); - var clientFirstMessageBare = "n=*,r=" + session.clientNonce; - var serverFirstMessage = "r=" + sv.nonce + ",s=" + sv.salt + ",i=" + sv.iteration; - var clientFinalMessageWithoutProof = "c=biws,r=" + sv.nonce; - var authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof; - var clientSignature = hmacSha256(storedKey, authMessage); - var clientProofBytes = xorBuffers(clientKey, clientSignature); - var clientProof = clientProofBytes.toString("base64"); - var serverKey = hmacSha256(saltedPassword, "Server Key"); - var serverSignatureBytes = hmacSha256(serverKey, authMessage); - session.message = "SASLResponse"; - session.serverSignature = serverSignatureBytes.toString("base64"); - session.response = clientFinalMessageWithoutProof + ",p=" + clientProof; - } - __name(continueSession, "continueSession"); - function finalizeSession(session, serverData) { - if (session.message !== "SASLResponse") { - throw new Error("SASL: Last message was not SASLResponse"); - } - if (typeof serverData !== "string") { - throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string"); - } - const { serverSignature } = parseServerFinalMessage(serverData); - if (serverSignature !== session.serverSignature) { - throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match"); - } - } - __name(finalizeSession, "finalizeSession"); - function isPrintableChars(text) { - if (typeof text !== "string") { - throw new TypeError("SASL: text must be a string"); - } - return text.split("").map((_2, i) => text.charCodeAt(i)).every((c) => c >= 33 && c <= 43 || c >= 45 && c <= 126); - } - __name(isPrintableChars, "isPrintableChars"); - function isBase64(text) { - return /^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(text); - } - __name(isBase64, "isBase64"); - function parseAttributePairs(text) { - if (typeof text !== "string") { - throw new TypeError("SASL: attribute pairs text must be a string"); - } - return new Map( - text.split(",").map((attrValue) => { - if (!/^.=/.test(attrValue)) { - throw new Error("SASL: Invalid attribute pair entry"); - } - const name = attrValue[0]; - const value = attrValue.substring(2); - return [name, value]; - }) - ); - } - __name(parseAttributePairs, "parseAttributePairs"); - function parseServerFirstMessage(data) { - const attrPairs = parseAttributePairs(data); - const nonce = attrPairs.get("r"); - if (!nonce) { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing"); - } else if (!isPrintableChars(nonce)) { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters"); - } - const salt = attrPairs.get("s"); - if (!salt) { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing"); - } else if (!isBase64(salt)) { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64"); - } - const iterationText = attrPairs.get("i"); - if (!iterationText) { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); - } else if (!/^[1-9][0-9]*$/.test(iterationText)) { - throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count"); - } - const iteration = parseInt(iterationText, 10); - return { - nonce, - salt, - iteration - }; - } - __name(parseServerFirstMessage, "parseServerFirstMessage"); - function parseServerFinalMessage(serverData) { - const attrPairs = parseAttributePairs(serverData); - const serverSignature = attrPairs.get("v"); - if (!serverSignature) { - throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing"); - } else if (!isBase64(serverSignature)) { - throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64"); - } - return { - serverSignature - }; - } - __name(parseServerFinalMessage, "parseServerFinalMessage"); - function xorBuffers(a, b) { - if (!Buffer2.isBuffer(a)) { - throw new TypeError("first argument must be a Buffer"); - } - if (!Buffer2.isBuffer(b)) { - throw new TypeError("second argument must be a Buffer"); - } - if (a.length !== b.length) { - throw new Error("Buffer lengths must match"); - } - if (a.length === 0) { - throw new Error("Buffers cannot be empty"); - } - return Buffer2.from(a.map((_2, i) => a[i] ^ b[i])); - } - __name(xorBuffers, "xorBuffers"); - function sha2562(text) { - return crypto2.createHash("sha256").update(text).digest(); - } - __name(sha2562, "sha256"); - function hmacSha256(key, msg) { - return crypto2.createHmac("sha256", key).update(msg).digest(); - } - __name(hmacSha256, "hmacSha256"); - function Hi(password, saltBytes, iterations) { - var ui1 = hmacSha256(password, Buffer2.concat([saltBytes, Buffer2.from([0, 0, 0, 1])])); - var ui = ui1; - for (var i = 0; i < iterations - 1; i++) { - ui1 = hmacSha256(password, ui1); - ui = xorBuffers(ui, ui1); - } - return ui; - } - __name(Hi, "Hi"); - module.exports = { - startSession, - continueSession, - finalizeSession - }; - } -}); - -// shims/path/index.ts -var path_exports = {}; -__export(path_exports, { - join: () => join -}); -function join(...args) { - return args.join("/"); -} -var init_path = __esm({ - "shims/path/index.ts"() { - "use strict"; - init_shims(); - __name(join, "join"); - } -}); - -// shims/fs/index.ts -var fs_exports = {}; -__export(fs_exports, { - stat: () => stat -}); -function stat(file, cb) { - cb(new Error("No filesystem")); -} -var init_fs = __esm({ - "shims/fs/index.ts"() { - "use strict"; - init_shims(); - __name(stat, "stat"); - } -}); - -// shims/stream/index.ts -var stream_exports = {}; -__export(stream_exports, { - default: () => stream_default -}); -var stream_default; -var init_stream = __esm({ - "shims/stream/index.ts"() { - "use strict"; - init_shims(); - stream_default = {}; - } -}); - -// shims/string_decoder/index.ts -var string_decoder_exports = {}; -__export(string_decoder_exports, { - StringDecoder: () => StringDecoder -}); -var StringDecoder; -var init_string_decoder = __esm({ - "shims/string_decoder/index.ts"() { - "use strict"; - init_shims(); - StringDecoder = class { - static { - __name(this, "StringDecoder"); - } - td; - constructor(encoding) { - this.td = new TextDecoder(encoding); - } - write(data) { - return this.td.decode(data, { stream: true }); - } - end(data) { - return this.td.decode(data); - } - }; - } -}); - -// node_modules/split2/index.js -var require_split2 = __commonJS({ - "node_modules/split2/index.js"(exports, module) { - "use strict"; - init_shims(); - var { Transform } = (init_stream(), __toCommonJS(stream_exports)); - var { StringDecoder: StringDecoder2 } = (init_string_decoder(), __toCommonJS(string_decoder_exports)); - var kLast = Symbol("last"); - var kDecoder = Symbol("decoder"); - function transform(chunk, enc, cb) { - let list; - if (this.overflow) { - const buf = this[kDecoder].write(chunk); - list = buf.split(this.matcher); - if (list.length === 1) return cb(); - list.shift(); - this.overflow = false; - } else { - this[kLast] += this[kDecoder].write(chunk); - list = this[kLast].split(this.matcher); - } - this[kLast] = list.pop(); - for (let i = 0; i < list.length; i++) { - try { - push(this, this.mapper(list[i])); - } catch (error) { - return cb(error); - } - } - this.overflow = this[kLast].length > this.maxLength; - if (this.overflow && !this.skipOverflow) { - cb(new Error("maximum buffer reached")); - return; - } - cb(); - } - __name(transform, "transform"); - function flush(cb) { - this[kLast] += this[kDecoder].end(); - if (this[kLast]) { - try { - push(this, this.mapper(this[kLast])); - } catch (error) { - return cb(error); - } - } - cb(); - } - __name(flush, "flush"); - function push(self, val) { - if (val !== void 0) { - self.push(val); - } - } - __name(push, "push"); - function noop(incoming) { - return incoming; - } - __name(noop, "noop"); - function split(matcher, mapper, options) { - matcher = matcher || /\r?\n/; - mapper = mapper || noop; - options = options || {}; - switch (arguments.length) { - case 1: - if (typeof matcher === "function") { - mapper = matcher; - matcher = /\r?\n/; - } else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) { - options = matcher; - matcher = /\r?\n/; - } - break; - case 2: - if (typeof matcher === "function") { - options = mapper; - mapper = matcher; - matcher = /\r?\n/; - } else if (typeof mapper === "object") { - options = mapper; - mapper = noop; - } - } - options = Object.assign({}, options); - options.autoDestroy = true; - options.transform = transform; - options.flush = flush; - options.readableObjectMode = true; - const stream = new Transform(options); - stream[kLast] = ""; - stream[kDecoder] = new StringDecoder2("utf8"); - stream.matcher = matcher; - stream.mapper = mapper; - stream.maxLength = options.maxLength; - stream.skipOverflow = options.skipOverflow || false; - stream.overflow = false; - stream._destroy = function(err, cb) { - this._writableState.errorEmitted = false; - cb(err); - }; - return stream; - } - __name(split, "split"); - module.exports = split; - } -}); - -// node_modules/pgpass/lib/helper.js -var require_helper = __commonJS({ - "node_modules/pgpass/lib/helper.js"(exports, module) { - "use strict"; - init_shims(); - var path = (init_path(), __toCommonJS(path_exports)); - var Stream = (init_stream(), __toCommonJS(stream_exports)).Stream; - var split = require_split2(); - var util = (init_util(), __toCommonJS(util_exports)); - var defaultPort = 5432; - var isWin = process.platform === "win32"; - var warnStream = process.stderr; - var S_IRWXG = 56; - var S_IRWXO = 7; - var S_IFMT = 61440; - var S_IFREG = 32768; - function isRegFile(mode) { - return (mode & S_IFMT) == S_IFREG; - } - __name(isRegFile, "isRegFile"); - var fieldNames = ["host", "port", "database", "user", "password"]; - var nrOfFields = fieldNames.length; - var passKey = fieldNames[nrOfFields - 1]; - function warn() { - var isWritable = warnStream instanceof Stream && true === warnStream.writable; - if (isWritable) { - var args = Array.prototype.slice.call(arguments).concat("\n"); - warnStream.write(util.format.apply(util, args)); - } - } - __name(warn, "warn"); - Object.defineProperty(module.exports, "isWin", { - get: /* @__PURE__ */ __name(function() { - return isWin; - }, "get"), - set: /* @__PURE__ */ __name(function(val) { - isWin = val; - }, "set") - }); - module.exports.warnTo = function(stream) { - var old = warnStream; - warnStream = stream; - return old; - }; - module.exports.getFileName = function(rawEnv) { - var env = rawEnv || process.env; - var file = env.PGPASSFILE || (isWin ? path.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path.join(env.HOME || "./", ".pgpass")); - return file; - }; - module.exports.usePgPass = function(stats, fname) { - if (Object.prototype.hasOwnProperty.call(process.env, "PGPASSWORD")) { - return false; - } - if (isWin) { - return true; - } - fname = fname || ""; - if (!isRegFile(stats.mode)) { - warn('WARNING: password file "%s" is not a plain file', fname); - return false; - } - if (stats.mode & (S_IRWXG | S_IRWXO)) { - warn('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less', fname); - return false; - } - return true; - }; - var matcher = module.exports.match = function(connInfo, entry) { - return fieldNames.slice(0, -1).reduce(function(prev, field, idx) { - if (idx == 1) { - if (Number(connInfo[field] || defaultPort) === Number(entry[field])) { - return prev && true; - } - } - return prev && (entry[field] === "*" || entry[field] === connInfo[field]); - }, true); - }; - module.exports.getPassword = function(connInfo, stream, cb) { - var pass; - var lineStream = stream.pipe(split()); - function onLine(line) { - var entry = parseLine(line); - if (entry && isValidEntry(entry) && matcher(connInfo, entry)) { - pass = entry[passKey]; - lineStream.end(); - } - } - __name(onLine, "onLine"); - var onEnd = /* @__PURE__ */ __name(function() { - stream.destroy(); - cb(pass); - }, "onEnd"); - var onErr = /* @__PURE__ */ __name(function(err) { - stream.destroy(); - warn("WARNING: error on reading file: %s", err); - cb(void 0); - }, "onErr"); - stream.on("error", onErr); - lineStream.on("data", onLine).on("end", onEnd).on("error", onErr); - }; - var parseLine = module.exports.parseLine = function(line) { - if (line.length < 11 || line.match(/^\s+#/)) { - return null; - } - var curChar = ""; - var prevChar = ""; - var fieldIdx = 0; - var startIdx = 0; - var endIdx = 0; - var obj = {}; - var isLastField = false; - var addToObj = /* @__PURE__ */ __name(function(idx, i0, i1) { - var field = line.substring(i0, i1); - if (!Object.hasOwnProperty.call(process.env, "PGPASS_NO_DEESCAPE")) { - field = field.replace(/\\([:\\])/g, "$1"); - } - obj[fieldNames[idx]] = field; - }, "addToObj"); - for (var i = 0; i < line.length - 1; i += 1) { - curChar = line.charAt(i + 1); - prevChar = line.charAt(i); - isLastField = fieldIdx == nrOfFields - 1; - if (isLastField) { - addToObj(fieldIdx, startIdx); - break; - } - if (i >= 0 && curChar == ":" && prevChar !== "\\") { - addToObj(fieldIdx, startIdx, i + 1); - startIdx = i + 2; - fieldIdx += 1; - } - } - obj = Object.keys(obj).length === nrOfFields ? obj : null; - return obj; - }; - var isValidEntry = module.exports.isValidEntry = function(entry) { - var rules = { - // host - 0: function(x) { - return x.length > 0; - }, - // port - 1: function(x) { - if (x === "*") { - return true; - } - x = Number(x); - return isFinite(x) && x > 0 && x < 9007199254740992 && Math.floor(x) === x; - }, - // database - 2: function(x) { - return x.length > 0; - }, - // username - 3: function(x) { - return x.length > 0; - }, - // password - 4: function(x) { - return x.length > 0; - } - }; - for (var idx = 0; idx < fieldNames.length; idx += 1) { - var rule = rules[idx]; - var value = entry[fieldNames[idx]] || ""; - var res = rule(value); - if (!res) { - return false; - } - } - return true; - }; - } -}); - -// node_modules/pgpass/lib/index.js -var require_lib = __commonJS({ - "node_modules/pgpass/lib/index.js"(exports, module) { - "use strict"; - init_shims(); - var path = (init_path(), __toCommonJS(path_exports)); - var fs = (init_fs(), __toCommonJS(fs_exports)); - var helper = require_helper(); - module.exports = function(connInfo, cb) { - var file = helper.getFileName(); - fs.stat(file, function(err, stat2) { - if (err || !helper.usePgPass(stat2, file)) { - return cb(void 0); - } - var st2 = fs.createReadStream(file); - helper.getPassword(connInfo, st2, cb); - }); - }; - module.exports.warnTo = helper.warnTo; - } -}); - -// node_modules/pg/lib/type-overrides.js -var require_type_overrides = __commonJS({ - "node_modules/pg/lib/type-overrides.js"(exports, module) { - "use strict"; - init_shims(); - var types2 = require_pg_types(); - function TypeOverrides2(userTypes) { - this._types = userTypes || types2; - this.text = {}; - this.binary = {}; - } - __name(TypeOverrides2, "TypeOverrides"); - TypeOverrides2.prototype.getOverrides = function(format) { - switch (format) { - case "text": - return this.text; - case "binary": - return this.binary; - default: - return {}; - } - }; - TypeOverrides2.prototype.setTypeParser = function(oid, format, parseFn) { - if (typeof format === "function") { - parseFn = format; - format = "text"; - } - this.getOverrides(format)[oid] = parseFn; - }; - TypeOverrides2.prototype.getTypeParser = function(oid, format) { - format = format || "text"; - return this.getOverrides(format)[oid] || this._types.getTypeParser(oid, format); - }; - module.exports = TypeOverrides2; - } -}); - -// shims/dns/index.ts -var dns_exports = {}; -__export(dns_exports, { - default: () => dns_default -}); -var dns_default; -var init_dns = __esm({ - "shims/dns/index.ts"() { - "use strict"; - init_shims(); - dns_default = {}; - } -}); - -// shims/url/index.ts -var url_exports = {}; -__export(url_exports, { - parse: () => parse -}); -function parse(url, parseQueryString = false) { - const { protocol } = new URL(url); - const httpUrl = "http:" + url.substring(protocol.length); - let { - username, - password, - host, - hostname, - port, - pathname, - search, - searchParams, - hash - } = new URL(httpUrl); - password = decodeURIComponent(password); - username = decodeURIComponent(username); - pathname = decodeURIComponent(pathname); - const auth = username + ":" + password; - const query = parseQueryString ? Object.fromEntries(searchParams.entries()) : search; - return { - href: url, - protocol, - auth, - username, - password, - host, - hostname, - port, - pathname, - search, - query, - hash - }; -} -var init_url = __esm({ - "shims/url/index.ts"() { - "use strict"; - init_shims(); - __name(parse, "parse"); - } -}); - -// node_modules/pg-connection-string/index.js -var require_pg_connection_string = __commonJS({ - "node_modules/pg-connection-string/index.js"(exports, module) { - "use strict"; - init_shims(); - var url = (init_url(), __toCommonJS(url_exports)); - var fs = (init_fs(), __toCommonJS(fs_exports)); - function parse2(str) { - if (str.charAt(0) === "/") { - var config = str.split(" "); - return { host: config[0], database: config[1] }; - } - var result = url.parse( - / |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str) ? encodeURI(str).replace(/\%25(\d\d)/g, "%$1") : str, - true - ); - var config = result.query; - for (var k in config) { - if (Array.isArray(config[k])) { - config[k] = config[k][config[k].length - 1]; - } - } - var auth = (result.auth || ":").split(":"); - config.user = auth[0]; - config.password = auth.splice(1).join(":"); - config.port = result.port; - if (result.protocol == "socket:") { - config.host = decodeURI(result.pathname); - config.database = result.query.db; - config.client_encoding = result.query.encoding; - return config; - } - if (!config.host) { - config.host = result.hostname; - } - var pathname = result.pathname; - if (!config.host && pathname && /^%2f/i.test(pathname)) { - var pathnameSplit = pathname.split("/"); - config.host = decodeURIComponent(pathnameSplit[0]); - pathname = pathnameSplit.splice(1).join("/"); - } - if (pathname && pathname.charAt(0) === "/") { - pathname = pathname.slice(1) || null; - } - config.database = pathname && decodeURI(pathname); - if (config.ssl === "true" || config.ssl === "1") { - config.ssl = true; - } - if (config.ssl === "0") { - config.ssl = false; - } - if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) { - config.ssl = {}; - } - if (config.sslcert) { - config.ssl.cert = fs.readFileSync(config.sslcert).toString(); - } - if (config.sslkey) { - config.ssl.key = fs.readFileSync(config.sslkey).toString(); - } - if (config.sslrootcert) { - config.ssl.ca = fs.readFileSync(config.sslrootcert).toString(); - } - switch (config.sslmode) { - case "disable": { - config.ssl = false; - break; - } - case "prefer": - case "require": - case "verify-ca": - case "verify-full": { - break; - } - case "no-verify": { - config.ssl.rejectUnauthorized = false; - break; - } - } - return config; - } - __name(parse2, "parse"); - module.exports = parse2; - parse2.parse = parse2; - } -}); - -// node_modules/pg/lib/connection-parameters.js -var require_connection_parameters = __commonJS({ - "node_modules/pg/lib/connection-parameters.js"(exports, module) { - "use strict"; - init_shims(); - var dns = (init_dns(), __toCommonJS(dns_exports)); - var defaults2 = require_defaults(); - var parse2 = require_pg_connection_string().parse; - var val = /* @__PURE__ */ __name(function(key, config, envVar) { - if (envVar === void 0) { - envVar = process.env["PG" + key.toUpperCase()]; - } else if (envVar === false) { - } else { - envVar = process.env[envVar]; - } - return config[key] || envVar || defaults2[key]; - }, "val"); - var readSSLConfigFromEnvironment = /* @__PURE__ */ __name(function() { - switch (process.env.PGSSLMODE) { - case "disable": - return false; - case "prefer": - case "require": - case "verify-ca": - case "verify-full": - return true; - case "no-verify": - return { rejectUnauthorized: false }; - } - return defaults2.ssl; - }, "readSSLConfigFromEnvironment"); - var quoteParamValue = /* @__PURE__ */ __name(function(value) { - return "'" + ("" + value).replace(/\\/g, "\\\\").replace(/'/g, "\\'") + "'"; - }, "quoteParamValue"); - var add = /* @__PURE__ */ __name(function(params, config, paramName) { - var value = config[paramName]; - if (value !== void 0 && value !== null) { - params.push(paramName + "=" + quoteParamValue(value)); - } - }, "add"); - var ConnectionParameters2 = class { - static { - __name(this, "ConnectionParameters"); - } - constructor(config) { - config = typeof config === "string" ? parse2(config) : config || {}; - if (config.connectionString) { - config = Object.assign({}, config, parse2(config.connectionString)); - } - this.user = val("user", config); - this.database = val("database", config); - if (this.database === void 0) { - this.database = this.user; - } - this.port = parseInt(val("port", config), 10); - this.host = val("host", config); - Object.defineProperty(this, "password", { - configurable: true, - enumerable: false, - writable: true, - value: val("password", config) - }); - this.binary = val("binary", config); - this.options = val("options", config); - this.ssl = typeof config.ssl === "undefined" ? readSSLConfigFromEnvironment() : config.ssl; - if (typeof this.ssl === "string") { - if (this.ssl === "true") { - this.ssl = true; - } - } - if (this.ssl === "no-verify") { - this.ssl = { rejectUnauthorized: false }; - } - if (this.ssl && this.ssl.key) { - Object.defineProperty(this.ssl, "key", { - enumerable: false - }); - } - this.client_encoding = val("client_encoding", config); - this.replication = val("replication", config); - this.isDomainSocket = !(this.host || "").indexOf("/"); - this.application_name = val("application_name", config, "PGAPPNAME"); - this.fallback_application_name = val("fallback_application_name", config, false); - this.statement_timeout = val("statement_timeout", config, false); - this.lock_timeout = val("lock_timeout", config, false); - this.idle_in_transaction_session_timeout = val("idle_in_transaction_session_timeout", config, false); - this.query_timeout = val("query_timeout", config, false); - if (config.connectionTimeoutMillis === void 0) { - this.connect_timeout = process.env.PGCONNECT_TIMEOUT || 0; - } else { - this.connect_timeout = Math.floor(config.connectionTimeoutMillis / 1e3); - } - if (config.keepAlive === false) { - this.keepalives = 0; - } else if (config.keepAlive === true) { - this.keepalives = 1; - } - if (typeof config.keepAliveInitialDelayMillis === "number") { - this.keepalives_idle = Math.floor(config.keepAliveInitialDelayMillis / 1e3); - } - } - getLibpqConnectionString(cb) { - var params = []; - add(params, this, "user"); - add(params, this, "password"); - add(params, this, "port"); - add(params, this, "application_name"); - add(params, this, "fallback_application_name"); - add(params, this, "connect_timeout"); - add(params, this, "options"); - var ssl = typeof this.ssl === "object" ? this.ssl : this.ssl ? { sslmode: this.ssl } : {}; - add(params, ssl, "sslmode"); - add(params, ssl, "sslca"); - add(params, ssl, "sslkey"); - add(params, ssl, "sslcert"); - add(params, ssl, "sslrootcert"); - if (this.database) { - params.push("dbname=" + quoteParamValue(this.database)); - } - if (this.replication) { - params.push("replication=" + quoteParamValue(this.replication)); - } - if (this.host) { - params.push("host=" + quoteParamValue(this.host)); - } - if (this.isDomainSocket) { - return cb(null, params.join(" ")); - } - if (this.client_encoding) { - params.push("client_encoding=" + quoteParamValue(this.client_encoding)); - } - dns.lookup(this.host, function(err, address) { - if (err) return cb(err, null); - params.push("hostaddr=" + quoteParamValue(address)); - return cb(null, params.join(" ")); - }); - } - }; - module.exports = ConnectionParameters2; - } -}); - -// node_modules/pg/lib/result.js -var require_result = __commonJS({ - "node_modules/pg/lib/result.js"(exports, module) { - "use strict"; - init_shims(); - var types2 = require_pg_types(); - var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/; - var Result = class { - static { - __name(this, "Result"); - } - constructor(rowMode, types3) { - this.command = null; - this.rowCount = null; - this.oid = null; - this.rows = []; - this.fields = []; - this._parsers = void 0; - this._types = types3; - this.RowCtor = null; - this.rowAsArray = rowMode === "array"; - if (this.rowAsArray) { - this.parseRow = this._parseRowAsArray; - } - } - // adds a command complete message - addCommandComplete(msg) { - var match; - if (msg.text) { - match = matchRegexp.exec(msg.text); - } else { - match = matchRegexp.exec(msg.command); - } - if (match) { - this.command = match[1]; - if (match[3]) { - this.oid = parseInt(match[2], 10); - this.rowCount = parseInt(match[3], 10); - } else if (match[2]) { - this.rowCount = parseInt(match[2], 10); - } - } - } - _parseRowAsArray(rowData) { - var row = new Array(rowData.length); - for (var i = 0, len = rowData.length; i < len; i++) { - var rawValue = rowData[i]; - if (rawValue !== null) { - row[i] = this._parsers[i](rawValue); - } else { - row[i] = null; - } - } - return row; - } - parseRow(rowData) { - var row = {}; - for (var i = 0, len = rowData.length; i < len; i++) { - var rawValue = rowData[i]; - var field = this.fields[i].name; - if (rawValue !== null) { - row[field] = this._parsers[i](rawValue); - } else { - row[field] = null; - } - } - return row; - } - addRow(row) { - this.rows.push(row); - } - addFields(fieldDescriptions) { - this.fields = fieldDescriptions; - if (this.fields.length) { - this._parsers = new Array(fieldDescriptions.length); - } - for (var i = 0; i < fieldDescriptions.length; i++) { - var desc = fieldDescriptions[i]; - if (this._types) { - this._parsers[i] = this._types.getTypeParser(desc.dataTypeID, desc.format || "text"); - } else { - this._parsers[i] = types2.getTypeParser(desc.dataTypeID, desc.format || "text"); - } - } - } - }; - module.exports = Result; - } -}); - -// node_modules/pg/lib/query.js -var require_query = __commonJS({ - "node_modules/pg/lib/query.js"(exports, module) { - "use strict"; - init_shims(); - var { EventEmitter: EventEmitter2 } = require_events(); - var Result = require_result(); - var utils = require_utils(); - var Query2 = class extends EventEmitter2 { - static { - __name(this, "Query"); - } - constructor(config, values, callback) { - super(); - config = utils.normalizeQueryConfig(config, values, callback); - this.text = config.text; - this.values = config.values; - this.rows = config.rows; - this.types = config.types; - this.name = config.name; - this.binary = config.binary; - this.portal = config.portal || ""; - this.callback = config.callback; - this._rowMode = config.rowMode; - if (process.domain && config.callback) { - this.callback = process.domain.bind(config.callback); - } - this._result = new Result(this._rowMode, this.types); - this._results = this._result; - this.isPreparedStatement = false; - this._canceledDueToError = false; - this._promise = null; - } - requiresPreparation() { - if (this.name) { - return true; - } - if (this.rows) { - return true; - } - if (!this.text) { - return false; - } - if (!this.values) { - return false; - } - return this.values.length > 0; - } - _checkForMultirow() { - if (this._result.command) { - if (!Array.isArray(this._results)) { - this._results = [this._result]; - } - this._result = new Result(this._rowMode, this.types); - this._results.push(this._result); - } - } - // associates row metadata from the supplied - // message with this query object - // metadata used when parsing row results - handleRowDescription(msg) { - this._checkForMultirow(); - this._result.addFields(msg.fields); - this._accumulateRows = this.callback || !this.listeners("row").length; - } - handleDataRow(msg) { - let row; - if (this._canceledDueToError) { - return; - } - try { - row = this._result.parseRow(msg.fields); - } catch (err) { - this._canceledDueToError = err; - return; - } - this.emit("row", row, this._result); - if (this._accumulateRows) { - this._result.addRow(row); - } - } - handleCommandComplete(msg, connection) { - this._checkForMultirow(); - this._result.addCommandComplete(msg); - if (this.rows) { - connection.sync(); - } - } - // if a named prepared statement is created with empty query text - // the backend will send an emptyQuery message but *not* a command complete message - // since we pipeline sync immediately after execute we don't need to do anything here - // unless we have rows specified, in which case we did not pipeline the intial sync call - handleEmptyQuery(connection) { - if (this.rows) { - connection.sync(); - } - } - handleError(err, connection) { - if (this._canceledDueToError) { - err = this._canceledDueToError; - this._canceledDueToError = false; - } - if (this.callback) { - return this.callback(err); - } - this.emit("error", err); - } - handleReadyForQuery(con) { - if (this._canceledDueToError) { - return this.handleError(this._canceledDueToError, con); - } - if (this.callback) { - try { - this.callback(null, this._results); - } catch (err) { - process.nextTick(() => { - throw err; - }); - } - } - this.emit("end", this._results); - } - submit(connection) { - if (typeof this.text !== "string" && typeof this.name !== "string") { - return new Error("A query must have either text or a name. Supplying neither is unsupported."); - } - const previous = connection.parsedStatements[this.name]; - if (this.text && previous && this.text !== previous) { - return new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`); - } - if (this.values && !Array.isArray(this.values)) { - return new Error("Query values must be an array"); - } - if (this.requiresPreparation()) { - this.prepare(connection); - } else { - connection.query(this.text); - } - return null; - } - hasBeenParsed(connection) { - return this.name && connection.parsedStatements[this.name]; - } - handlePortalSuspended(connection) { - this._getRows(connection, this.rows); - } - _getRows(connection, rows) { - connection.execute({ - portal: this.portal, - rows - }); - if (!rows) { - connection.sync(); - } else { - connection.flush(); - } - } - // http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY - prepare(connection) { - this.isPreparedStatement = true; - if (!this.hasBeenParsed(connection)) { - connection.parse({ - text: this.text, - name: this.name, - types: this.types - }); - } - try { - connection.bind({ - portal: this.portal, - statement: this.name, - values: this.values, - binary: this.binary, - valueMapper: utils.prepareValue - }); - } catch (err) { - this.handleError(err, connection); - return; - } - connection.describe({ - type: "P", - name: this.portal || "" - }); - this._getRows(connection, this.rows); - } - handleCopyInResponse(connection) { - connection.sendCopyFail("No source stream defined"); - } - // eslint-disable-next-line no-unused-vars - handleCopyData(msg, connection) { - } - }; - module.exports = Query2; - } -}); - -// shims/net/index.ts -var net_exports = {}; -__export(net_exports, { - Socket: () => Socket, - isIP: () => isIP -}); -function hexDump(data) { - return `${data.length} bytes` + data.reduce( - (memo, byte) => memo + " " + byte.toString(16).padStart(2, "0"), - "\nhex:" - ) + "\nstr: " + new TextDecoder().decode(data); -} -function log(...args) { - console.log( - ...args.map( - (arg) => arg instanceof Uint8Array ? hexDump(arg) : arg instanceof ArrayBuffer ? hexDump(new Uint8Array(arg)) : arg - ) - ); -} -function isIP(input) { - return 0; -} -var import_events, FIRST_WORD_REGEX, Socket; -var init_net = __esm({ - "shims/net/index.ts"() { - "use strict"; - init_shims(); - import_events = __toESM(require_events(), 1); - __name(hexDump, "hexDump"); - __name(log, "log"); - __name(isIP, "isIP"); - FIRST_WORD_REGEX = /^[^.]+\./; - Socket = class _Socket extends import_events.EventEmitter { - static { - __name(this, "Socket"); - } - static defaults = { - // these options relate to the fetch transport and take effect *only* when set globally - poolQueryViaFetch: false, - fetchEndpoint: /* @__PURE__ */ __name((host, _port, options) => { - let newHost; - if (options?.jwtAuth) { - newHost = host.replace(FIRST_WORD_REGEX, "apiauth."); - } else { - newHost = host.replace(FIRST_WORD_REGEX, "api."); - } - return "https://" + newHost + "/sql"; - }, "fetchEndpoint"), - fetchConnectionCache: true, - fetchFunction: void 0, - // these options relate to the WebSocket transport - webSocketConstructor: void 0, - wsProxy: /* @__PURE__ */ __name((host) => host + "/v2", "wsProxy"), - useSecureWebSocket: true, - forceDisablePgSSL: true, - coalesceWrites: true, - pipelineConnect: "password", - // these options apply only to Postgres-native TLS over WebSockets (when forceDisablePgSSL === false) - subtls: void 0, - rootCerts: "", - pipelineTLS: false, - disableSNI: false - }; - static opts = {}; - opts = {}; - static get poolQueryViaFetch() { - return _Socket.opts.poolQueryViaFetch ?? _Socket.defaults.poolQueryViaFetch; - } - static set poolQueryViaFetch(newValue) { - _Socket.opts.poolQueryViaFetch = newValue; - } - static get fetchEndpoint() { - return _Socket.opts.fetchEndpoint ?? _Socket.defaults.fetchEndpoint; - } - static set fetchEndpoint(newValue) { - _Socket.opts.fetchEndpoint = newValue; - } - static get fetchConnectionCache() { - return true; - } - static set fetchConnectionCache(newValue) { - console.warn( - "The `fetchConnectionCache` option is deprecated (now always `true`)" - ); - } - static get fetchFunction() { - return _Socket.opts.fetchFunction ?? _Socket.defaults.fetchFunction; - } - static set fetchFunction(newValue) { - _Socket.opts.fetchFunction = newValue; - } - static get webSocketConstructor() { - return _Socket.opts.webSocketConstructor ?? _Socket.defaults.webSocketConstructor; - } - static set webSocketConstructor(newValue) { - _Socket.opts.webSocketConstructor = newValue; - } - get webSocketConstructor() { - return this.opts.webSocketConstructor ?? _Socket.webSocketConstructor; - } - set webSocketConstructor(newValue) { - this.opts.webSocketConstructor = newValue; - } - static get wsProxy() { - return _Socket.opts.wsProxy ?? _Socket.defaults.wsProxy; - } - static set wsProxy(newValue) { - _Socket.opts.wsProxy = newValue; - } - get wsProxy() { - return this.opts.wsProxy ?? _Socket.wsProxy; - } - set wsProxy(newValue) { - this.opts.wsProxy = newValue; - } - static get coalesceWrites() { - return _Socket.opts.coalesceWrites ?? _Socket.defaults.coalesceWrites; - } - static set coalesceWrites(newValue) { - _Socket.opts.coalesceWrites = newValue; - } - get coalesceWrites() { - return this.opts.coalesceWrites ?? _Socket.coalesceWrites; - } - set coalesceWrites(newValue) { - this.opts.coalesceWrites = newValue; - } - static get useSecureWebSocket() { - return _Socket.opts.useSecureWebSocket ?? _Socket.defaults.useSecureWebSocket; - } - static set useSecureWebSocket(newValue) { - _Socket.opts.useSecureWebSocket = newValue; - } - get useSecureWebSocket() { - return this.opts.useSecureWebSocket ?? _Socket.useSecureWebSocket; - } - set useSecureWebSocket(newValue) { - this.opts.useSecureWebSocket = newValue; - } - static get forceDisablePgSSL() { - return _Socket.opts.forceDisablePgSSL ?? _Socket.defaults.forceDisablePgSSL; - } - static set forceDisablePgSSL(newValue) { - _Socket.opts.forceDisablePgSSL = newValue; - } - get forceDisablePgSSL() { - return this.opts.forceDisablePgSSL ?? _Socket.forceDisablePgSSL; - } - set forceDisablePgSSL(newValue) { - this.opts.forceDisablePgSSL = newValue; - } - static get disableSNI() { - return _Socket.opts.disableSNI ?? _Socket.defaults.disableSNI; - } - static set disableSNI(newValue) { - _Socket.opts.disableSNI = newValue; - } - get disableSNI() { - return this.opts.disableSNI ?? _Socket.disableSNI; - } - set disableSNI(newValue) { - this.opts.disableSNI = newValue; - } - static get pipelineConnect() { - return _Socket.opts.pipelineConnect ?? _Socket.defaults.pipelineConnect; - } - static set pipelineConnect(newValue) { - _Socket.opts.pipelineConnect = newValue; - } - get pipelineConnect() { - return this.opts.pipelineConnect ?? _Socket.pipelineConnect; - } - set pipelineConnect(newValue) { - this.opts.pipelineConnect = newValue; - } - static get subtls() { - return _Socket.opts.subtls ?? _Socket.defaults.subtls; - } - static set subtls(newValue) { - _Socket.opts.subtls = newValue; - } - get subtls() { - return this.opts.subtls ?? _Socket.subtls; - } - set subtls(newValue) { - this.opts.subtls = newValue; - } - static get pipelineTLS() { - return _Socket.opts.pipelineTLS ?? _Socket.defaults.pipelineTLS; - } - static set pipelineTLS(newValue) { - _Socket.opts.pipelineTLS = newValue; - } - get pipelineTLS() { - return this.opts.pipelineTLS ?? _Socket.pipelineTLS; - } - set pipelineTLS(newValue) { - this.opts.pipelineTLS = newValue; - } - static get rootCerts() { - return _Socket.opts.rootCerts ?? _Socket.defaults.rootCerts; - } - static set rootCerts(newValue) { - _Socket.opts.rootCerts = newValue; - } - get rootCerts() { - return this.opts.rootCerts ?? _Socket.rootCerts; - } - set rootCerts(newValue) { - this.opts.rootCerts = newValue; - } - wsProxyAddrForHost(host, port) { - const wsProxy = this.wsProxy; - if (wsProxy === void 0) { - throw new Error( - `No WebSocket proxy is configured. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#wsproxy-string--host-string-port-number--string--string` - ); - } - return typeof wsProxy === "function" ? wsProxy(host, port) : `${wsProxy}?address=${host}:${port}`; - } - connecting = false; - pending = true; - writable = true; - encrypted = false; - authorized = false; - destroyed = false; - ws = null; - writeBuffer; - // used only if coalesceWrites === true - tlsState = 0 /* None */; - tlsRead; - tlsWrite; - setNoDelay() { - log("setNoDelay (no-op)"); - return this; - } - setKeepAlive() { - log("setKeepAlive (no-op)"); - return this; - } - ref() { - log("ref (no-op)"); - return this; - } - unref() { - log("unref (no-op)"); - return this; - } - connect(port, host, connectListener) { - this.connecting = true; - if (connectListener) this.once("connect", connectListener); - const handleWebSocketOpen = /* @__PURE__ */ __name(() => { - log("socket ready"); - this.connecting = false; - this.pending = false; - this.emit("connect"); - this.emit("ready"); - }, "handleWebSocketOpen"); - const configureWebSocket = /* @__PURE__ */ __name((ws, immediateOpen = false) => { - ws.binaryType = "arraybuffer"; - ws.addEventListener("error", (err) => { - log("websocket error", err); - this.emit("error", err); - this.emit("close"); - }); - ws.addEventListener("message", (msg) => { - log("socket received:", msg.data); - if (this.tlsState === 0 /* None */) { - log("emitting received data"); - const buffer = Buffer2.from(msg.data); - this.emit("data", buffer); - } - }); - ws.addEventListener("close", () => { - log("websocket closed"); - this.emit("close"); - }); - if (immediateOpen) handleWebSocketOpen(); - else ws.addEventListener("open", handleWebSocketOpen); - }, "configureWebSocket"); - let wsAddr; - try { - wsAddr = this.wsProxyAddrForHost( - host, - typeof port === "string" ? parseInt(port, 10) : port - ); - } catch (err) { - this.emit("error", err); - this.emit("close"); - return; - } - try { - const wsProtocol = this.useSecureWebSocket ? "wss:" : "ws:"; - const wsAddrFull = wsProtocol + "//" + wsAddr; - if (this.webSocketConstructor !== void 0) { - this.ws = new this.webSocketConstructor(wsAddrFull); - configureWebSocket(this.ws); - } else { - try { - this.ws = new WebSocket(wsAddrFull); - configureWebSocket(this.ws); - } catch (err) { - log("new WebSocket() failed"); - this.ws = new __unstable_WebSocket(wsAddrFull); - configureWebSocket(this.ws); - } - } - } catch (err) { - log("WebSocket constructors failed"); - const wsProtocol = this.useSecureWebSocket ? "https:" : "http:"; - const fetchAddrFull = wsProtocol + "//" + wsAddr; - fetch(fetchAddrFull, { headers: { Upgrade: "websocket" } }).then((resp) => { - this.ws = resp.webSocket; - if (this.ws == null) throw err; - this.ws.accept(); - configureWebSocket(this.ws, true); - log("Cloudflare WebSocket opened"); - }).catch((err2) => { - log(`fetch() with { Upgrade: "websocket" } failed`); - this.emit( - "error", - new Error( - `All attempts to open a WebSocket to connect to the database failed. Please refer to https://github.com/neondatabase/serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined. Details: ${err2.message}` - ) - ); - this.emit("close"); - }); - } - } - async startTls(host) { - log("starting TLS"); - if (this.subtls === void 0) - throw new Error( - "For Postgres SSL connections, you must set `neonConfig.subtls` to the subtls library. See https://github.com/neondatabase/serverless/blob/main/CONFIG.md for more information." - ); - this.tlsState = 1 /* Handshake */; - const rootCerts = this.subtls.TrustedCert.fromPEM(this.rootCerts); - const readQueue = new this.subtls.WebSocketReadQueue(this.ws); - const networkRead = readQueue.read.bind(readQueue); - const networkWrite = this.rawWrite.bind(this); - const [tlsRead, tlsWrite] = await this.subtls.startTls( - host, - rootCerts, - networkRead, - networkWrite, - { - useSNI: !this.disableSNI, - expectPreData: this.pipelineTLS ? new Uint8Array([83]) : void 0 - // expect (and discard) an 'S' before the TLS response if pipelineTLS is set - } - ); - this.tlsRead = tlsRead; - this.tlsWrite = tlsWrite; - log("TLS connection established"); - this.tlsState = 2 /* Established */; - this.encrypted = true; - this.authorized = true; - this.emit("secureConnection", this); - this.tlsReadLoop(); - } - async tlsReadLoop() { - while (true) { - log("awaiting TLS data ..."); - const data = await this.tlsRead(); - if (data === void 0) { - log("no TLS data, breaking loop"); - break; - } else { - log("emitting decrypted TLS data:", data); - const buffer = Buffer2.from(data); - this.emit("data", buffer); - } - } - } - rawWrite(data) { - if (!this.coalesceWrites) { - this.ws.send(data); - return; - } - if (this.writeBuffer === void 0) { - this.writeBuffer = data; - setTimeout(() => { - this.ws.send(this.writeBuffer); - this.writeBuffer = void 0; - }, 0); - } else { - const newBuffer = new Uint8Array(this.writeBuffer.length + data.length); - newBuffer.set(this.writeBuffer); - newBuffer.set(data, this.writeBuffer.length); - this.writeBuffer = newBuffer; - } - } - write(data, encoding = "utf8", callback = (err) => { - }) { - if (data.length === 0) { - callback(); - return true; - } - if (typeof data === "string") - data = Buffer2.from(data, encoding); - if (this.tlsState === 0 /* None */) { - log("sending data direct:", data); - this.rawWrite(data); - callback(); - } else if (this.tlsState === 1 /* Handshake */) { - log("TLS handshake in progress, queueing data:", data); - this.once("secureConnection", () => { - this.write(data, encoding, callback); - }); - } else { - log("encrypting data:", data); - this.tlsWrite(data); - callback(); - } - return true; - } - end(data = Buffer2.alloc(0), encoding = "utf8", callback = () => { - }) { - log("ending socket"); - this.write(data, encoding, () => { - this.ws.close(); - callback(); - }); - return this; - } - destroy() { - this.destroyed = true; - return this.end(); - } - }; - } -}); - -// node_modules/pg-protocol/dist/messages.js -var require_messages = __commonJS({ - "node_modules/pg-protocol/dist/messages.js"(exports) { - "use strict"; - init_shims(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.NoticeMessage = exports.DataRowMessage = exports.CommandCompleteMessage = exports.ReadyForQueryMessage = exports.NotificationResponseMessage = exports.BackendKeyDataMessage = exports.AuthenticationMD5Password = exports.ParameterStatusMessage = exports.ParameterDescriptionMessage = exports.RowDescriptionMessage = exports.Field = exports.CopyResponse = exports.CopyDataMessage = exports.DatabaseError = exports.copyDone = exports.emptyQuery = exports.replicationStart = exports.portalSuspended = exports.noData = exports.closeComplete = exports.bindComplete = exports.parseComplete = void 0; - exports.parseComplete = { - name: "parseComplete", - length: 5 - }; - exports.bindComplete = { - name: "bindComplete", - length: 5 - }; - exports.closeComplete = { - name: "closeComplete", - length: 5 - }; - exports.noData = { - name: "noData", - length: 5 - }; - exports.portalSuspended = { - name: "portalSuspended", - length: 5 - }; - exports.replicationStart = { - name: "replicationStart", - length: 4 - }; - exports.emptyQuery = { - name: "emptyQuery", - length: 4 - }; - exports.copyDone = { - name: "copyDone", - length: 4 - }; - var DatabaseError2 = class extends Error { - static { - __name(this, "DatabaseError"); - } - constructor(message, length, name) { - super(message); - this.length = length; - this.name = name; - } - }; - exports.DatabaseError = DatabaseError2; - var CopyDataMessage = class { - static { - __name(this, "CopyDataMessage"); - } - constructor(length, chunk) { - this.length = length; - this.chunk = chunk; - this.name = "copyData"; - } - }; - exports.CopyDataMessage = CopyDataMessage; - var CopyResponse = class { - static { - __name(this, "CopyResponse"); - } - constructor(length, name, binary, columnCount) { - this.length = length; - this.name = name; - this.binary = binary; - this.columnTypes = new Array(columnCount); - } - }; - exports.CopyResponse = CopyResponse; - var Field = class { - static { - __name(this, "Field"); - } - constructor(name, tableID, columnID, dataTypeID, dataTypeSize, dataTypeModifier, format) { - this.name = name; - this.tableID = tableID; - this.columnID = columnID; - this.dataTypeID = dataTypeID; - this.dataTypeSize = dataTypeSize; - this.dataTypeModifier = dataTypeModifier; - this.format = format; - } - }; - exports.Field = Field; - var RowDescriptionMessage = class { - static { - __name(this, "RowDescriptionMessage"); - } - constructor(length, fieldCount) { - this.length = length; - this.fieldCount = fieldCount; - this.name = "rowDescription"; - this.fields = new Array(this.fieldCount); - } - }; - exports.RowDescriptionMessage = RowDescriptionMessage; - var ParameterDescriptionMessage = class { - static { - __name(this, "ParameterDescriptionMessage"); - } - constructor(length, parameterCount) { - this.length = length; - this.parameterCount = parameterCount; - this.name = "parameterDescription"; - this.dataTypeIDs = new Array(this.parameterCount); - } - }; - exports.ParameterDescriptionMessage = ParameterDescriptionMessage; - var ParameterStatusMessage = class { - static { - __name(this, "ParameterStatusMessage"); - } - constructor(length, parameterName, parameterValue) { - this.length = length; - this.parameterName = parameterName; - this.parameterValue = parameterValue; - this.name = "parameterStatus"; - } - }; - exports.ParameterStatusMessage = ParameterStatusMessage; - var AuthenticationMD5Password = class { - static { - __name(this, "AuthenticationMD5Password"); - } - constructor(length, salt) { - this.length = length; - this.salt = salt; - this.name = "authenticationMD5Password"; - } - }; - exports.AuthenticationMD5Password = AuthenticationMD5Password; - var BackendKeyDataMessage = class { - static { - __name(this, "BackendKeyDataMessage"); - } - constructor(length, processID, secretKey) { - this.length = length; - this.processID = processID; - this.secretKey = secretKey; - this.name = "backendKeyData"; - } - }; - exports.BackendKeyDataMessage = BackendKeyDataMessage; - var NotificationResponseMessage = class { - static { - __name(this, "NotificationResponseMessage"); - } - constructor(length, processId, channel, payload) { - this.length = length; - this.processId = processId; - this.channel = channel; - this.payload = payload; - this.name = "notification"; - } - }; - exports.NotificationResponseMessage = NotificationResponseMessage; - var ReadyForQueryMessage = class { - static { - __name(this, "ReadyForQueryMessage"); - } - constructor(length, status) { - this.length = length; - this.status = status; - this.name = "readyForQuery"; - } - }; - exports.ReadyForQueryMessage = ReadyForQueryMessage; - var CommandCompleteMessage = class { - static { - __name(this, "CommandCompleteMessage"); - } - constructor(length, text) { - this.length = length; - this.text = text; - this.name = "commandComplete"; - } - }; - exports.CommandCompleteMessage = CommandCompleteMessage; - var DataRowMessage = class { - static { - __name(this, "DataRowMessage"); - } - constructor(length, fields) { - this.length = length; - this.fields = fields; - this.name = "dataRow"; - this.fieldCount = fields.length; - } - }; - exports.DataRowMessage = DataRowMessage; - var NoticeMessage = class { - static { - __name(this, "NoticeMessage"); - } - constructor(length, message) { - this.length = length; - this.message = message; - this.name = "notice"; - } - }; - exports.NoticeMessage = NoticeMessage; - } -}); - -// node_modules/pg-protocol/dist/buffer-writer.js -var require_buffer_writer = __commonJS({ - "node_modules/pg-protocol/dist/buffer-writer.js"(exports) { - "use strict"; - init_shims(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Writer = void 0; - var Writer = class { - static { - __name(this, "Writer"); - } - constructor(size = 256) { - this.size = size; - this.offset = 5; - this.headerPosition = 0; - this.buffer = Buffer2.allocUnsafe(size); - } - ensure(size) { - var remaining = this.buffer.length - this.offset; - if (remaining < size) { - var oldBuffer = this.buffer; - var newSize = oldBuffer.length + (oldBuffer.length >> 1) + size; - this.buffer = Buffer2.allocUnsafe(newSize); - oldBuffer.copy(this.buffer); - } - } - addInt32(num) { - this.ensure(4); - this.buffer[this.offset++] = num >>> 24 & 255; - this.buffer[this.offset++] = num >>> 16 & 255; - this.buffer[this.offset++] = num >>> 8 & 255; - this.buffer[this.offset++] = num >>> 0 & 255; - return this; - } - addInt16(num) { - this.ensure(2); - this.buffer[this.offset++] = num >>> 8 & 255; - this.buffer[this.offset++] = num >>> 0 & 255; - return this; - } - addCString(string) { - if (!string) { - this.ensure(1); - } else { - var len = Buffer2.byteLength(string); - this.ensure(len + 1); - this.buffer.write(string, this.offset, "utf-8"); - this.offset += len; - } - this.buffer[this.offset++] = 0; - return this; - } - addString(string = "") { - var len = Buffer2.byteLength(string); - this.ensure(len); - this.buffer.write(string, this.offset); - this.offset += len; - return this; - } - add(otherBuffer) { - this.ensure(otherBuffer.length); - otherBuffer.copy(this.buffer, this.offset); - this.offset += otherBuffer.length; - return this; - } - join(code) { - if (code) { - this.buffer[this.headerPosition] = code; - const length = this.offset - (this.headerPosition + 1); - this.buffer.writeInt32BE(length, this.headerPosition + 1); - } - return this.buffer.slice(code ? 0 : 5, this.offset); - } - flush(code) { - var result = this.join(code); - this.offset = 5; - this.headerPosition = 0; - this.buffer = Buffer2.allocUnsafe(this.size); - return result; - } - }; - exports.Writer = Writer; - } -}); - -// node_modules/pg-protocol/dist/serializer.js -var require_serializer = __commonJS({ - "node_modules/pg-protocol/dist/serializer.js"(exports) { - "use strict"; - init_shims(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.serialize = void 0; - var buffer_writer_1 = require_buffer_writer(); - var writer = new buffer_writer_1.Writer(); - var startup = /* @__PURE__ */ __name((opts) => { - writer.addInt16(3).addInt16(0); - for (const key of Object.keys(opts)) { - writer.addCString(key).addCString(opts[key]); - } - writer.addCString("client_encoding").addCString("UTF8"); - var bodyBuffer = writer.addCString("").flush(); - var length = bodyBuffer.length + 4; - return new buffer_writer_1.Writer().addInt32(length).add(bodyBuffer).flush(); - }, "startup"); - var requestSsl = /* @__PURE__ */ __name(() => { - const response = Buffer2.allocUnsafe(8); - response.writeInt32BE(8, 0); - response.writeInt32BE(80877103, 4); - return response; - }, "requestSsl"); - var password = /* @__PURE__ */ __name((password2) => { - return writer.addCString(password2).flush( - 112 - /* code.startup */ - ); - }, "password"); - var sendSASLInitialResponseMessage = /* @__PURE__ */ __name(function(mechanism, initialResponse) { - writer.addCString(mechanism).addInt32(Buffer2.byteLength(initialResponse)).addString(initialResponse); - return writer.flush( - 112 - /* code.startup */ - ); - }, "sendSASLInitialResponseMessage"); - var sendSCRAMClientFinalMessage = /* @__PURE__ */ __name(function(additionalData) { - return writer.addString(additionalData).flush( - 112 - /* code.startup */ - ); - }, "sendSCRAMClientFinalMessage"); - var query = /* @__PURE__ */ __name((text) => { - return writer.addCString(text).flush( - 81 - /* code.query */ - ); - }, "query"); - var emptyArray = []; - var parse2 = /* @__PURE__ */ __name((query2) => { - const name = query2.name || ""; - if (name.length > 63) { - console.error("Warning! Postgres only supports 63 characters for query names."); - console.error("You supplied %s (%s)", name, name.length); - console.error("This can cause conflicts and silent errors executing queries"); - } - const types2 = query2.types || emptyArray; - var len = types2.length; - var buffer = writer.addCString(name).addCString(query2.text).addInt16(len); - for (var i = 0; i < len; i++) { - buffer.addInt32(types2[i]); - } - return writer.flush( - 80 - /* code.parse */ - ); - }, "parse"); - var paramWriter = new buffer_writer_1.Writer(); - var writeValues = /* @__PURE__ */ __name(function(values, valueMapper) { - for (let i = 0; i < values.length; i++) { - const mappedVal = valueMapper ? valueMapper(values[i], i) : values[i]; - if (mappedVal == null) { - writer.addInt16( - 0 - /* ParamType.STRING */ - ); - paramWriter.addInt32(-1); - } else if (mappedVal instanceof Buffer2) { - writer.addInt16( - 1 - /* ParamType.BINARY */ - ); - paramWriter.addInt32(mappedVal.length); - paramWriter.add(mappedVal); - } else { - writer.addInt16( - 0 - /* ParamType.STRING */ - ); - paramWriter.addInt32(Buffer2.byteLength(mappedVal)); - paramWriter.addString(mappedVal); - } - } - }, "writeValues"); - var bind = /* @__PURE__ */ __name((config = {}) => { - const portal = config.portal || ""; - const statement = config.statement || ""; - const binary = config.binary || false; - const values = config.values || emptyArray; - const len = values.length; - writer.addCString(portal).addCString(statement); - writer.addInt16(len); - writeValues(values, config.valueMapper); - writer.addInt16(len); - writer.add(paramWriter.flush()); - writer.addInt16( - binary ? 1 : 0 - /* ParamType.STRING */ - ); - return writer.flush( - 66 - /* code.bind */ - ); - }, "bind"); - var emptyExecute = Buffer2.from([69, 0, 0, 0, 9, 0, 0, 0, 0, 0]); - var execute = /* @__PURE__ */ __name((config) => { - if (!config || !config.portal && !config.rows) { - return emptyExecute; - } - const portal = config.portal || ""; - const rows = config.rows || 0; - const portalLength = Buffer2.byteLength(portal); - const len = 4 + portalLength + 1 + 4; - const buff = Buffer2.allocUnsafe(1 + len); - buff[0] = 69; - buff.writeInt32BE(len, 1); - buff.write(portal, 5, "utf-8"); - buff[portalLength + 5] = 0; - buff.writeUInt32BE(rows, buff.length - 4); - return buff; - }, "execute"); - var cancel = /* @__PURE__ */ __name((processID, secretKey) => { - const buffer = Buffer2.allocUnsafe(16); - buffer.writeInt32BE(16, 0); - buffer.writeInt16BE(1234, 4); - buffer.writeInt16BE(5678, 6); - buffer.writeInt32BE(processID, 8); - buffer.writeInt32BE(secretKey, 12); - return buffer; - }, "cancel"); - var cstringMessage = /* @__PURE__ */ __name((code, string) => { - const stringLen = Buffer2.byteLength(string); - const len = 4 + stringLen + 1; - const buffer = Buffer2.allocUnsafe(1 + len); - buffer[0] = code; - buffer.writeInt32BE(len, 1); - buffer.write(string, 5, "utf-8"); - buffer[len] = 0; - return buffer; - }, "cstringMessage"); - var emptyDescribePortal = writer.addCString("P").flush( - 68 - /* code.describe */ - ); - var emptyDescribeStatement = writer.addCString("S").flush( - 68 - /* code.describe */ - ); - var describe = /* @__PURE__ */ __name((msg) => { - return msg.name ? cstringMessage(68, `${msg.type}${msg.name || ""}`) : msg.type === "P" ? emptyDescribePortal : emptyDescribeStatement; - }, "describe"); - var close = /* @__PURE__ */ __name((msg) => { - const text = `${msg.type}${msg.name || ""}`; - return cstringMessage(67, text); - }, "close"); - var copyData = /* @__PURE__ */ __name((chunk) => { - return writer.add(chunk).flush( - 100 - /* code.copyFromChunk */ - ); - }, "copyData"); - var copyFail = /* @__PURE__ */ __name((message) => { - return cstringMessage(102, message); - }, "copyFail"); - var codeOnlyBuffer = /* @__PURE__ */ __name((code) => Buffer2.from([code, 0, 0, 0, 4]), "codeOnlyBuffer"); - var flushBuffer = codeOnlyBuffer( - 72 - /* code.flush */ - ); - var syncBuffer = codeOnlyBuffer( - 83 - /* code.sync */ - ); - var endBuffer = codeOnlyBuffer( - 88 - /* code.end */ - ); - var copyDoneBuffer = codeOnlyBuffer( - 99 - /* code.copyDone */ - ); - var serialize = { - startup, - password, - requestSsl, - sendSASLInitialResponseMessage, - sendSCRAMClientFinalMessage, - query, - parse: parse2, - bind, - execute, - describe, - close, - flush: /* @__PURE__ */ __name(() => flushBuffer, "flush"), - sync: /* @__PURE__ */ __name(() => syncBuffer, "sync"), - end: /* @__PURE__ */ __name(() => endBuffer, "end"), - copyData, - copyDone: /* @__PURE__ */ __name(() => copyDoneBuffer, "copyDone"), - copyFail, - cancel - }; - exports.serialize = serialize; - } -}); - -// node_modules/pg-protocol/dist/buffer-reader.js -var require_buffer_reader = __commonJS({ - "node_modules/pg-protocol/dist/buffer-reader.js"(exports) { - "use strict"; - init_shims(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.BufferReader = void 0; - var emptyBuffer = Buffer2.allocUnsafe(0); - var BufferReader = class { - static { - __name(this, "BufferReader"); - } - constructor(offset = 0) { - this.offset = offset; - this.buffer = emptyBuffer; - this.encoding = "utf-8"; - } - setBuffer(offset, buffer) { - this.offset = offset; - this.buffer = buffer; - } - int16() { - const result = this.buffer.readInt16BE(this.offset); - this.offset += 2; - return result; - } - byte() { - const result = this.buffer[this.offset]; - this.offset++; - return result; - } - int32() { - const result = this.buffer.readInt32BE(this.offset); - this.offset += 4; - return result; - } - string(length) { - const result = this.buffer.toString(this.encoding, this.offset, this.offset + length); - this.offset += length; - return result; - } - cstring() { - const start = this.offset; - let end = start; - while (this.buffer[end++] !== 0) { - } - this.offset = end; - return this.buffer.toString(this.encoding, start, end - 1); - } - bytes(length) { - const result = this.buffer.slice(this.offset, this.offset + length); - this.offset += length; - return result; - } - }; - exports.BufferReader = BufferReader; - } -}); - -// node_modules/pg-protocol/dist/parser.js -var require_parser = __commonJS({ - "node_modules/pg-protocol/dist/parser.js"(exports) { - "use strict"; - init_shims(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Parser = void 0; - var messages_1 = require_messages(); - var buffer_reader_1 = require_buffer_reader(); - var CODE_LENGTH = 1; - var LEN_LENGTH = 4; - var HEADER_LENGTH = CODE_LENGTH + LEN_LENGTH; - var emptyBuffer = Buffer2.allocUnsafe(0); - var Parser = class { - static { - __name(this, "Parser"); - } - constructor(opts) { - this.buffer = emptyBuffer; - this.bufferLength = 0; - this.bufferOffset = 0; - this.reader = new buffer_reader_1.BufferReader(); - if ((opts === null || opts === void 0 ? void 0 : opts.mode) === "binary") { - throw new Error("Binary mode not supported yet"); - } - this.mode = (opts === null || opts === void 0 ? void 0 : opts.mode) || "text"; - } - parse(buffer, callback) { - this.mergeBuffer(buffer); - const bufferFullLength = this.bufferOffset + this.bufferLength; - let offset = this.bufferOffset; - while (offset + HEADER_LENGTH <= bufferFullLength) { - const code = this.buffer[offset]; - const length = this.buffer.readUInt32BE(offset + CODE_LENGTH); - const fullMessageLength = CODE_LENGTH + length; - if (fullMessageLength + offset <= bufferFullLength) { - const message = this.handlePacket(offset + HEADER_LENGTH, code, length, this.buffer); - callback(message); - offset += fullMessageLength; - } else { - break; - } - } - if (offset === bufferFullLength) { - this.buffer = emptyBuffer; - this.bufferLength = 0; - this.bufferOffset = 0; - } else { - this.bufferLength = bufferFullLength - offset; - this.bufferOffset = offset; - } - } - mergeBuffer(buffer) { - if (this.bufferLength > 0) { - const newLength = this.bufferLength + buffer.byteLength; - const newFullLength = newLength + this.bufferOffset; - if (newFullLength > this.buffer.byteLength) { - let newBuffer; - if (newLength <= this.buffer.byteLength && this.bufferOffset >= this.bufferLength) { - newBuffer = this.buffer; - } else { - let newBufferLength = this.buffer.byteLength * 2; - while (newLength >= newBufferLength) { - newBufferLength *= 2; - } - newBuffer = Buffer2.allocUnsafe(newBufferLength); - } - this.buffer.copy(newBuffer, 0, this.bufferOffset, this.bufferOffset + this.bufferLength); - this.buffer = newBuffer; - this.bufferOffset = 0; - } - buffer.copy(this.buffer, this.bufferOffset + this.bufferLength); - this.bufferLength = newLength; - } else { - this.buffer = buffer; - this.bufferOffset = 0; - this.bufferLength = buffer.byteLength; - } - } - handlePacket(offset, code, length, bytes) { - switch (code) { - case 50: - return messages_1.bindComplete; - case 49: - return messages_1.parseComplete; - case 51: - return messages_1.closeComplete; - case 110: - return messages_1.noData; - case 115: - return messages_1.portalSuspended; - case 99: - return messages_1.copyDone; - case 87: - return messages_1.replicationStart; - case 73: - return messages_1.emptyQuery; - case 68: - return this.parseDataRowMessage(offset, length, bytes); - case 67: - return this.parseCommandCompleteMessage(offset, length, bytes); - case 90: - return this.parseReadyForQueryMessage(offset, length, bytes); - case 65: - return this.parseNotificationMessage(offset, length, bytes); - case 82: - return this.parseAuthenticationResponse(offset, length, bytes); - case 83: - return this.parseParameterStatusMessage(offset, length, bytes); - case 75: - return this.parseBackendKeyData(offset, length, bytes); - case 69: - return this.parseErrorMessage(offset, length, bytes, "error"); - case 78: - return this.parseErrorMessage(offset, length, bytes, "notice"); - case 84: - return this.parseRowDescriptionMessage(offset, length, bytes); - case 116: - return this.parseParameterDescriptionMessage(offset, length, bytes); - case 71: - return this.parseCopyInMessage(offset, length, bytes); - case 72: - return this.parseCopyOutMessage(offset, length, bytes); - case 100: - return this.parseCopyData(offset, length, bytes); - default: - return new messages_1.DatabaseError("received invalid response: " + code.toString(16), length, "error"); - } - } - parseReadyForQueryMessage(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const status = this.reader.string(1); - return new messages_1.ReadyForQueryMessage(length, status); - } - parseCommandCompleteMessage(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const text = this.reader.cstring(); - return new messages_1.CommandCompleteMessage(length, text); - } - parseCopyData(offset, length, bytes) { - const chunk = bytes.slice(offset, offset + (length - 4)); - return new messages_1.CopyDataMessage(length, chunk); - } - parseCopyInMessage(offset, length, bytes) { - return this.parseCopyMessage(offset, length, bytes, "copyInResponse"); - } - parseCopyOutMessage(offset, length, bytes) { - return this.parseCopyMessage(offset, length, bytes, "copyOutResponse"); - } - parseCopyMessage(offset, length, bytes, messageName) { - this.reader.setBuffer(offset, bytes); - const isBinary = this.reader.byte() !== 0; - const columnCount = this.reader.int16(); - const message = new messages_1.CopyResponse(length, messageName, isBinary, columnCount); - for (let i = 0; i < columnCount; i++) { - message.columnTypes[i] = this.reader.int16(); - } - return message; - } - parseNotificationMessage(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const processId = this.reader.int32(); - const channel = this.reader.cstring(); - const payload = this.reader.cstring(); - return new messages_1.NotificationResponseMessage(length, processId, channel, payload); - } - parseRowDescriptionMessage(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const fieldCount = this.reader.int16(); - const message = new messages_1.RowDescriptionMessage(length, fieldCount); - for (let i = 0; i < fieldCount; i++) { - message.fields[i] = this.parseField(); - } - return message; - } - parseField() { - const name = this.reader.cstring(); - const tableID = this.reader.int32(); - const columnID = this.reader.int16(); - const dataTypeID = this.reader.int32(); - const dataTypeSize = this.reader.int16(); - const dataTypeModifier = this.reader.int32(); - const mode = this.reader.int16() === 0 ? "text" : "binary"; - return new messages_1.Field(name, tableID, columnID, dataTypeID, dataTypeSize, dataTypeModifier, mode); - } - parseParameterDescriptionMessage(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const parameterCount = this.reader.int16(); - const message = new messages_1.ParameterDescriptionMessage(length, parameterCount); - for (let i = 0; i < parameterCount; i++) { - message.dataTypeIDs[i] = this.reader.int32(); - } - return message; - } - parseDataRowMessage(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const fieldCount = this.reader.int16(); - const fields = new Array(fieldCount); - for (let i = 0; i < fieldCount; i++) { - const len = this.reader.int32(); - fields[i] = len === -1 ? null : this.reader.string(len); - } - return new messages_1.DataRowMessage(length, fields); - } - parseParameterStatusMessage(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const name = this.reader.cstring(); - const value = this.reader.cstring(); - return new messages_1.ParameterStatusMessage(length, name, value); - } - parseBackendKeyData(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const processID = this.reader.int32(); - const secretKey = this.reader.int32(); - return new messages_1.BackendKeyDataMessage(length, processID, secretKey); - } - parseAuthenticationResponse(offset, length, bytes) { - this.reader.setBuffer(offset, bytes); - const code = this.reader.int32(); - const message = { - name: "authenticationOk", - length - }; - switch (code) { - case 0: - break; - case 3: - if (message.length === 8) { - message.name = "authenticationCleartextPassword"; - } - break; - case 5: - if (message.length === 12) { - message.name = "authenticationMD5Password"; - const salt = this.reader.bytes(4); - return new messages_1.AuthenticationMD5Password(length, salt); - } - break; - case 10: - message.name = "authenticationSASL"; - message.mechanisms = []; - let mechanism; - do { - mechanism = this.reader.cstring(); - if (mechanism) { - message.mechanisms.push(mechanism); - } - } while (mechanism); - break; - case 11: - message.name = "authenticationSASLContinue"; - message.data = this.reader.string(length - 8); - break; - case 12: - message.name = "authenticationSASLFinal"; - message.data = this.reader.string(length - 8); - break; - default: - throw new Error("Unknown authenticationOk message type " + code); - } - return message; - } - parseErrorMessage(offset, length, bytes, name) { - this.reader.setBuffer(offset, bytes); - const fields = {}; - let fieldType = this.reader.string(1); - while (fieldType !== "\0") { - fields[fieldType] = this.reader.cstring(); - fieldType = this.reader.string(1); - } - const messageValue = fields.M; - const message = name === "notice" ? new messages_1.NoticeMessage(length, messageValue) : new messages_1.DatabaseError(messageValue, length, name); - message.severity = fields.S; - message.code = fields.C; - message.detail = fields.D; - message.hint = fields.H; - message.position = fields.P; - message.internalPosition = fields.p; - message.internalQuery = fields.q; - message.where = fields.W; - message.schema = fields.s; - message.table = fields.t; - message.column = fields.c; - message.dataType = fields.d; - message.constraint = fields.n; - message.file = fields.F; - message.line = fields.L; - message.routine = fields.R; - return message; - } - }; - exports.Parser = Parser; - } -}); - -// node_modules/pg-protocol/dist/index.js -var require_dist = __commonJS({ - "node_modules/pg-protocol/dist/index.js"(exports) { - "use strict"; - init_shims(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DatabaseError = exports.serialize = exports.parse = void 0; - var messages_1 = require_messages(); - Object.defineProperty(exports, "DatabaseError", { enumerable: true, get: /* @__PURE__ */ __name(function() { - return messages_1.DatabaseError; - }, "get") }); - var serializer_1 = require_serializer(); - Object.defineProperty(exports, "serialize", { enumerable: true, get: /* @__PURE__ */ __name(function() { - return serializer_1.serialize; - }, "get") }); - var parser_1 = require_parser(); - function parse2(stream, callback) { - const parser = new parser_1.Parser(); - stream.on("data", (buffer) => parser.parse(buffer, callback)); - return new Promise((resolve) => stream.on("end", () => resolve())); - } - __name(parse2, "parse"); - exports.parse = parse2; - } -}); - -// shims/tls/index.ts -var tls_exports = {}; -__export(tls_exports, { - connect: () => connect -}); -function connect({ - socket, - servername -}) { - socket.startTls(servername); - return socket; -} -var init_tls = __esm({ - "shims/tls/index.ts"() { - "use strict"; - init_shims(); - __name(connect, "connect"); - } -}); - -// node_modules/pg/lib/connection.js -var require_connection = __commonJS({ - "node_modules/pg/lib/connection.js"(exports, module) { - "use strict"; - init_shims(); - var net = (init_net(), __toCommonJS(net_exports)); - var EventEmitter2 = require_events().EventEmitter; - var { parse: parse2, serialize } = require_dist(); - var flushBuffer = serialize.flush(); - var syncBuffer = serialize.sync(); - var endBuffer = serialize.end(); - var Connection3 = class extends EventEmitter2 { - static { - __name(this, "Connection"); - } - constructor(config) { - super(); - config = config || {}; - this.stream = config.stream || new net.Socket(); - this._keepAlive = config.keepAlive; - this._keepAliveInitialDelayMillis = config.keepAliveInitialDelayMillis; - this.lastBuffer = false; - this.parsedStatements = {}; - this.ssl = config.ssl || false; - this._ending = false; - this._emitMessage = false; - var self = this; - this.on("newListener", function(eventName) { - if (eventName === "message") { - self._emitMessage = true; - } - }); - } - connect(port, host) { - var self = this; - this._connecting = true; - this.stream.setNoDelay(true); - this.stream.connect(port, host); - this.stream.once("connect", function() { - if (self._keepAlive) { - self.stream.setKeepAlive(true, self._keepAliveInitialDelayMillis); - } - self.emit("connect"); - }); - const reportStreamError = /* @__PURE__ */ __name(function(error) { - if (self._ending && (error.code === "ECONNRESET" || error.code === "EPIPE")) { - return; - } - self.emit("error", error); - }, "reportStreamError"); - this.stream.on("error", reportStreamError); - this.stream.on("close", function() { - self.emit("end"); - }); - if (!this.ssl) { - return this.attachListeners(this.stream); - } - this.stream.once("data", function(buffer) { - var responseCode = buffer.toString("utf8"); - switch (responseCode) { - case "S": - break; - case "N": - self.stream.end(); - return self.emit("error", new Error("The server does not support SSL connections")); - default: - self.stream.end(); - return self.emit("error", new Error("There was an error establishing an SSL connection")); - } - var tls = (init_tls(), __toCommonJS(tls_exports)); - const options = { - socket: self.stream - }; - if (self.ssl !== true) { - Object.assign(options, self.ssl); - if ("key" in self.ssl) { - options.key = self.ssl.key; - } - } - if (net.isIP(host) === 0) { - options.servername = host; - } - try { - self.stream = tls.connect(options); - } catch (err) { - return self.emit("error", err); - } - self.attachListeners(self.stream); - self.stream.on("error", reportStreamError); - self.emit("sslconnect"); - }); - } - attachListeners(stream) { - stream.on("end", () => { - this.emit("end"); - }); - parse2(stream, (msg) => { - var eventName = msg.name === "error" ? "errorMessage" : msg.name; - if (this._emitMessage) { - this.emit("message", msg); - } - this.emit(eventName, msg); - }); - } - requestSsl() { - this.stream.write(serialize.requestSsl()); - } - startup(config) { - this.stream.write(serialize.startup(config)); - } - cancel(processID, secretKey) { - this._send(serialize.cancel(processID, secretKey)); - } - password(password) { - this._send(serialize.password(password)); - } - sendSASLInitialResponseMessage(mechanism, initialResponse) { - this._send(serialize.sendSASLInitialResponseMessage(mechanism, initialResponse)); - } - sendSCRAMClientFinalMessage(additionalData) { - this._send(serialize.sendSCRAMClientFinalMessage(additionalData)); - } - _send(buffer) { - if (!this.stream.writable) { - return false; - } - return this.stream.write(buffer); - } - query(text) { - this._send(serialize.query(text)); - } - // send parse message - parse(query) { - this._send(serialize.parse(query)); - } - // send bind message - bind(config) { - this._send(serialize.bind(config)); - } - // send execute message - execute(config) { - this._send(serialize.execute(config)); - } - flush() { - if (this.stream.writable) { - this.stream.write(flushBuffer); - } - } - sync() { - this._ending = true; - this._send(flushBuffer); - this._send(syncBuffer); - } - ref() { - this.stream.ref(); - } - unref() { - this.stream.unref(); - } - end() { - this._ending = true; - if (!this._connecting || !this.stream.writable) { - this.stream.end(); - return; - } - return this.stream.write(endBuffer, () => { - this.stream.end(); - }); - } - close(msg) { - this._send(serialize.close(msg)); - } - describe(msg) { - this._send(serialize.describe(msg)); - } - sendCopyFromChunk(chunk) { - this._send(serialize.copyData(chunk)); - } - endCopyFrom() { - this._send(serialize.copyDone()); - } - sendCopyFail(msg) { - this._send(serialize.copyFail(msg)); - } - }; - module.exports = Connection3; - } -}); - -// node_modules/pg/lib/client.js -var require_client = __commonJS({ - "node_modules/pg/lib/client.js"(exports, module) { - "use strict"; - init_shims(); - var EventEmitter2 = require_events().EventEmitter; - var util = (init_util(), __toCommonJS(util_exports)); - var utils = require_utils(); - var sasl = require_sasl(); - var pgPass = require_lib(); - var TypeOverrides2 = require_type_overrides(); - var ConnectionParameters2 = require_connection_parameters(); - var Query2 = require_query(); - var defaults2 = require_defaults(); - var Connection3 = require_connection(); - var Client3 = class extends EventEmitter2 { - static { - __name(this, "Client"); - } - constructor(config) { - super(); - this.connectionParameters = new ConnectionParameters2(config); - this.user = this.connectionParameters.user; - this.database = this.connectionParameters.database; - this.port = this.connectionParameters.port; - this.host = this.connectionParameters.host; - Object.defineProperty(this, "password", { - configurable: true, - enumerable: false, - writable: true, - value: this.connectionParameters.password - }); - this.replication = this.connectionParameters.replication; - var c = config || {}; - this._Promise = c.Promise || global.Promise; - this._types = new TypeOverrides2(c.types); - this._ending = false; - this._connecting = false; - this._connected = false; - this._connectionError = false; - this._queryable = true; - this.connection = c.connection || new Connection3({ - stream: c.stream, - ssl: this.connectionParameters.ssl, - keepAlive: c.keepAlive || false, - keepAliveInitialDelayMillis: c.keepAliveInitialDelayMillis || 0, - encoding: this.connectionParameters.client_encoding || "utf8" - }); - this.queryQueue = []; - this.binary = c.binary || defaults2.binary; - this.processID = null; - this.secretKey = null; - this.ssl = this.connectionParameters.ssl || false; - if (this.ssl && this.ssl.key) { - Object.defineProperty(this.ssl, "key", { - enumerable: false - }); - } - this._connectionTimeoutMillis = c.connectionTimeoutMillis || 0; - } - _errorAllQueries(err) { - const enqueueError = /* @__PURE__ */ __name((query) => { - process.nextTick(() => { - query.handleError(err, this.connection); - }); - }, "enqueueError"); - if (this.activeQuery) { - enqueueError(this.activeQuery); - this.activeQuery = null; - } - this.queryQueue.forEach(enqueueError); - this.queryQueue.length = 0; - } - _connect(callback) { - var self = this; - var con = this.connection; - this._connectionCallback = callback; - if (this._connecting || this._connected) { - const err = new Error("Client has already been connected. You cannot reuse a client."); - process.nextTick(() => { - callback(err); - }); - return; - } - this._connecting = true; - this.connectionTimeoutHandle; - if (this._connectionTimeoutMillis > 0) { - this.connectionTimeoutHandle = setTimeout(() => { - con._ending = true; - con.stream.destroy(new Error("timeout expired")); - }, this._connectionTimeoutMillis); - } - if (this.host && this.host.indexOf("/") === 0) { - con.connect(this.host + "/.s.PGSQL." + this.port); - } else { - con.connect(this.port, this.host); - } - con.on("connect", function() { - if (self.ssl) { - con.requestSsl(); - } else { - con.startup(self.getStartupConf()); - } - }); - con.on("sslconnect", function() { - con.startup(self.getStartupConf()); - }); - this._attachListeners(con); - con.once("end", () => { - const error = this._ending ? new Error("Connection terminated") : new Error("Connection terminated unexpectedly"); - clearTimeout(this.connectionTimeoutHandle); - this._errorAllQueries(error); - if (!this._ending) { - if (this._connecting && !this._connectionError) { - if (this._connectionCallback) { - this._connectionCallback(error); - } else { - this._handleErrorEvent(error); - } - } else if (!this._connectionError) { - this._handleErrorEvent(error); - } - } - process.nextTick(() => { - this.emit("end"); - }); - }); - } - connect(callback) { - if (callback) { - this._connect(callback); - return; - } - return new this._Promise((resolve, reject) => { - this._connect((error) => { - if (error) { - reject(error); - } else { - resolve(); - } - }); - }); - } - _attachListeners(con) { - con.on("authenticationCleartextPassword", this._handleAuthCleartextPassword.bind(this)); - con.on("authenticationMD5Password", this._handleAuthMD5Password.bind(this)); - con.on("authenticationSASL", this._handleAuthSASL.bind(this)); - con.on("authenticationSASLContinue", this._handleAuthSASLContinue.bind(this)); - con.on("authenticationSASLFinal", this._handleAuthSASLFinal.bind(this)); - con.on("backendKeyData", this._handleBackendKeyData.bind(this)); - con.on("error", this._handleErrorEvent.bind(this)); - con.on("errorMessage", this._handleErrorMessage.bind(this)); - con.on("readyForQuery", this._handleReadyForQuery.bind(this)); - con.on("notice", this._handleNotice.bind(this)); - con.on("rowDescription", this._handleRowDescription.bind(this)); - con.on("dataRow", this._handleDataRow.bind(this)); - con.on("portalSuspended", this._handlePortalSuspended.bind(this)); - con.on("emptyQuery", this._handleEmptyQuery.bind(this)); - con.on("commandComplete", this._handleCommandComplete.bind(this)); - con.on("parseComplete", this._handleParseComplete.bind(this)); - con.on("copyInResponse", this._handleCopyInResponse.bind(this)); - con.on("copyData", this._handleCopyData.bind(this)); - con.on("notification", this._handleNotification.bind(this)); - } - // TODO(bmc): deprecate pgpass "built in" integration since this.password can be a function - // it can be supplied by the user if required - this is a breaking change! - _checkPgPass(cb) { - const con = this.connection; - if (typeof this.password === "function") { - this._Promise.resolve().then(() => this.password()).then((pass) => { - if (pass !== void 0) { - if (typeof pass !== "string") { - con.emit("error", new TypeError("Password must be a string")); - return; - } - this.connectionParameters.password = this.password = pass; - } else { - this.connectionParameters.password = this.password = null; - } - cb(); - }).catch((err) => { - con.emit("error", err); - }); - } else if (this.password !== null) { - cb(); - } else { - pgPass(this.connectionParameters, (pass) => { - if (void 0 !== pass) { - this.connectionParameters.password = this.password = pass; - } - cb(); - }); - } - } - _handleAuthCleartextPassword(msg) { - this._checkPgPass(() => { - this.connection.password(this.password); - }); - } - _handleAuthMD5Password(msg) { - this._checkPgPass(() => { - const hashedPassword = utils.postgresMd5PasswordHash(this.user, this.password, msg.salt); - this.connection.password(hashedPassword); - }); - } - _handleAuthSASL(msg) { - this._checkPgPass(() => { - this.saslSession = sasl.startSession(msg.mechanisms); - this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response); - }); - } - _handleAuthSASLContinue(msg) { - sasl.continueSession(this.saslSession, this.password, msg.data); - this.connection.sendSCRAMClientFinalMessage(this.saslSession.response); - } - _handleAuthSASLFinal(msg) { - sasl.finalizeSession(this.saslSession, msg.data); - this.saslSession = null; - } - _handleBackendKeyData(msg) { - this.processID = msg.processID; - this.secretKey = msg.secretKey; - } - _handleReadyForQuery(msg) { - if (this._connecting) { - this._connecting = false; - this._connected = true; - clearTimeout(this.connectionTimeoutHandle); - if (this._connectionCallback) { - this._connectionCallback(null, this); - this._connectionCallback = null; - } - this.emit("connect"); - } - const { activeQuery } = this; - this.activeQuery = null; - this.readyForQuery = true; - if (activeQuery) { - activeQuery.handleReadyForQuery(this.connection); - } - this._pulseQueryQueue(); - } - // if we receieve an error event or error message - // during the connection process we handle it here - _handleErrorWhileConnecting(err) { - if (this._connectionError) { - return; - } - this._connectionError = true; - clearTimeout(this.connectionTimeoutHandle); - if (this._connectionCallback) { - return this._connectionCallback(err); - } - this.emit("error", err); - } - // if we're connected and we receive an error event from the connection - // this means the socket is dead - do a hard abort of all queries and emit - // the socket error on the client as well - _handleErrorEvent(err) { - if (this._connecting) { - return this._handleErrorWhileConnecting(err); - } - this._queryable = false; - this._errorAllQueries(err); - this.emit("error", err); - } - // handle error messages from the postgres backend - _handleErrorMessage(msg) { - if (this._connecting) { - return this._handleErrorWhileConnecting(msg); - } - const activeQuery = this.activeQuery; - if (!activeQuery) { - this._handleErrorEvent(msg); - return; - } - this.activeQuery = null; - activeQuery.handleError(msg, this.connection); - } - _handleRowDescription(msg) { - this.activeQuery.handleRowDescription(msg); - } - _handleDataRow(msg) { - this.activeQuery.handleDataRow(msg); - } - _handlePortalSuspended(msg) { - this.activeQuery.handlePortalSuspended(this.connection); - } - _handleEmptyQuery(msg) { - this.activeQuery.handleEmptyQuery(this.connection); - } - _handleCommandComplete(msg) { - this.activeQuery.handleCommandComplete(msg, this.connection); - } - _handleParseComplete(msg) { - if (this.activeQuery.name) { - this.connection.parsedStatements[this.activeQuery.name] = this.activeQuery.text; - } - } - _handleCopyInResponse(msg) { - this.activeQuery.handleCopyInResponse(this.connection); - } - _handleCopyData(msg) { - this.activeQuery.handleCopyData(msg, this.connection); - } - _handleNotification(msg) { - this.emit("notification", msg); - } - _handleNotice(msg) { - this.emit("notice", msg); - } - getStartupConf() { - var params = this.connectionParameters; - var data = { - user: params.user, - database: params.database - }; - var appName = params.application_name || params.fallback_application_name; - if (appName) { - data.application_name = appName; - } - if (params.replication) { - data.replication = "" + params.replication; - } - if (params.statement_timeout) { - data.statement_timeout = String(parseInt(params.statement_timeout, 10)); - } - if (params.lock_timeout) { - data.lock_timeout = String(parseInt(params.lock_timeout, 10)); - } - if (params.idle_in_transaction_session_timeout) { - data.idle_in_transaction_session_timeout = String(parseInt(params.idle_in_transaction_session_timeout, 10)); - } - if (params.options) { - data.options = params.options; - } - return data; - } - cancel(client, query) { - if (client.activeQuery === query) { - var con = this.connection; - if (this.host && this.host.indexOf("/") === 0) { - con.connect(this.host + "/.s.PGSQL." + this.port); - } else { - con.connect(this.port, this.host); - } - con.on("connect", function() { - con.cancel(client.processID, client.secretKey); - }); - } else if (client.queryQueue.indexOf(query) !== -1) { - client.queryQueue.splice(client.queryQueue.indexOf(query), 1); - } - } - setTypeParser(oid, format, parseFn) { - return this._types.setTypeParser(oid, format, parseFn); - } - getTypeParser(oid, format) { - return this._types.getTypeParser(oid, format); - } - // Ported from PostgreSQL 9.2.4 source code in src/interfaces/libpq/fe-exec.c - escapeIdentifier(str) { - return '"' + str.replace(/"/g, '""') + '"'; - } - // Ported from PostgreSQL 9.2.4 source code in src/interfaces/libpq/fe-exec.c - escapeLiteral(str) { - var hasBackslash = false; - var escaped = "'"; - for (var i = 0; i < str.length; i++) { - var c = str[i]; - if (c === "'") { - escaped += c + c; - } else if (c === "\\") { - escaped += c + c; - hasBackslash = true; - } else { - escaped += c; - } - } - escaped += "'"; - if (hasBackslash === true) { - escaped = " E" + escaped; - } - return escaped; - } - _pulseQueryQueue() { - if (this.readyForQuery === true) { - this.activeQuery = this.queryQueue.shift(); - if (this.activeQuery) { - this.readyForQuery = false; - this.hasExecuted = true; - const queryError = this.activeQuery.submit(this.connection); - if (queryError) { - process.nextTick(() => { - this.activeQuery.handleError(queryError, this.connection); - this.readyForQuery = true; - this._pulseQueryQueue(); - }); - } - } else if (this.hasExecuted) { - this.activeQuery = null; - this.emit("drain"); - } - } - } - query(config, values, callback) { - var query; - var result; - var readTimeout; - var readTimeoutTimer; - var queryCallback; - if (config === null || config === void 0) { - throw new TypeError("Client was passed a null or undefined query"); - } else if (typeof config.submit === "function") { - readTimeout = config.query_timeout || this.connectionParameters.query_timeout; - result = query = config; - if (typeof values === "function") { - query.callback = query.callback || values; - } - } else { - readTimeout = this.connectionParameters.query_timeout; - query = new Query2(config, values, callback); - if (!query.callback) { - result = new this._Promise((resolve, reject) => { - query.callback = (err, res) => err ? reject(err) : resolve(res); - }); - } - } - if (readTimeout) { - queryCallback = query.callback; - readTimeoutTimer = setTimeout(() => { - var error = new Error("Query read timeout"); - process.nextTick(() => { - query.handleError(error, this.connection); - }); - queryCallback(error); - query.callback = () => { - }; - var index = this.queryQueue.indexOf(query); - if (index > -1) { - this.queryQueue.splice(index, 1); - } - this._pulseQueryQueue(); - }, readTimeout); - query.callback = (err, res) => { - clearTimeout(readTimeoutTimer); - queryCallback(err, res); - }; - } - if (this.binary && !query.binary) { - query.binary = true; - } - if (query._result && !query._result._types) { - query._result._types = this._types; - } - if (!this._queryable) { - process.nextTick(() => { - query.handleError(new Error("Client has encountered a connection error and is not queryable"), this.connection); - }); - return result; - } - if (this._ending) { - process.nextTick(() => { - query.handleError(new Error("Client was closed and is not queryable"), this.connection); - }); - return result; - } - this.queryQueue.push(query); - this._pulseQueryQueue(); - return result; - } - ref() { - this.connection.ref(); - } - unref() { - this.connection.unref(); - } - end(cb) { - this._ending = true; - if (!this.connection._connecting) { - if (cb) { - cb(); - } else { - return this._Promise.resolve(); - } - } - if (this.activeQuery || !this._queryable) { - this.connection.stream.destroy(); - } else { - this.connection.end(); - } - if (cb) { - this.connection.once("end", cb); - } else { - return new this._Promise((resolve) => { - this.connection.once("end", resolve); - }); - } - } - }; - Client3.Query = Query2; - module.exports = Client3; - } -}); - -// node_modules/pg-pool/index.js -var require_pg_pool = __commonJS({ - "node_modules/pg-pool/index.js"(exports, module) { - "use strict"; - init_shims(); - var EventEmitter2 = require_events().EventEmitter; - var NOOP = /* @__PURE__ */ __name(function() { - }, "NOOP"); - var removeWhere = /* @__PURE__ */ __name((list, predicate) => { - const i = list.findIndex(predicate); - return i === -1 ? void 0 : list.splice(i, 1)[0]; - }, "removeWhere"); - var IdleItem = class { - static { - __name(this, "IdleItem"); - } - constructor(client, idleListener, timeoutId) { - this.client = client; - this.idleListener = idleListener; - this.timeoutId = timeoutId; - } - }; - var PendingItem = class { - static { - __name(this, "PendingItem"); - } - constructor(callback) { - this.callback = callback; - } - }; - function throwOnDoubleRelease() { - throw new Error("Release called on client which has already been released to the pool."); - } - __name(throwOnDoubleRelease, "throwOnDoubleRelease"); - function promisify2(Promise2, callback) { - if (callback) { - return { callback, result: void 0 }; - } - let rej; - let res; - const cb = /* @__PURE__ */ __name(function(err, client) { - err ? rej(err) : res(client); - }, "cb"); - const result = new Promise2(function(resolve, reject) { - res = resolve; - rej = reject; - }).catch((err) => { - Error.captureStackTrace(err); - throw err; - }); - return { callback: cb, result }; - } - __name(promisify2, "promisify"); - function makeIdleListener(pool, client) { - return /* @__PURE__ */ __name(function idleListener(err) { - err.client = client; - client.removeListener("error", idleListener); - client.on("error", () => { - pool.log("additional client error after disconnection due to error", err); - }); - pool._remove(client); - pool.emit("error", err, client); - }, "idleListener"); - } - __name(makeIdleListener, "makeIdleListener"); - var Pool2 = class extends EventEmitter2 { - static { - __name(this, "Pool"); - } - constructor(options, Client3) { - super(); - this.options = Object.assign({}, options); - if (options != null && "password" in options) { - Object.defineProperty(this.options, "password", { - configurable: true, - enumerable: false, - writable: true, - value: options.password - }); - } - if (options != null && options.ssl && options.ssl.key) { - Object.defineProperty(this.options.ssl, "key", { - enumerable: false - }); - } - this.options.max = this.options.max || this.options.poolSize || 10; - this.options.maxUses = this.options.maxUses || Infinity; - this.options.allowExitOnIdle = this.options.allowExitOnIdle || false; - this.options.maxLifetimeSeconds = this.options.maxLifetimeSeconds || 0; - this.log = this.options.log || function() { - }; - this.Client = this.options.Client || Client3 || require_lib2().Client; - this.Promise = this.options.Promise || global.Promise; - if (typeof this.options.idleTimeoutMillis === "undefined") { - this.options.idleTimeoutMillis = 1e4; - } - this._clients = []; - this._idle = []; - this._expired = /* @__PURE__ */ new WeakSet(); - this._pendingQueue = []; - this._endCallback = void 0; - this.ending = false; - this.ended = false; - } - _isFull() { - return this._clients.length >= this.options.max; - } - _pulseQueue() { - this.log("pulse queue"); - if (this.ended) { - this.log("pulse queue ended"); - return; - } - if (this.ending) { - this.log("pulse queue on ending"); - if (this._idle.length) { - this._idle.slice().map((item) => { - this._remove(item.client); - }); - } - if (!this._clients.length) { - this.ended = true; - this._endCallback(); - } - return; - } - if (!this._pendingQueue.length) { - this.log("no queued requests"); - return; - } - if (!this._idle.length && this._isFull()) { - return; - } - const pendingItem = this._pendingQueue.shift(); - if (this._idle.length) { - const idleItem = this._idle.pop(); - clearTimeout(idleItem.timeoutId); - const client = idleItem.client; - client.ref && client.ref(); - const idleListener = idleItem.idleListener; - return this._acquireClient(client, pendingItem, idleListener, false); - } - if (!this._isFull()) { - return this.newClient(pendingItem); - } - throw new Error("unexpected condition"); - } - _remove(client) { - const removed = removeWhere(this._idle, (item) => item.client === client); - if (removed !== void 0) { - clearTimeout(removed.timeoutId); - } - this._clients = this._clients.filter((c) => c !== client); - client.end(); - this.emit("remove", client); - } - connect(cb) { - if (this.ending) { - const err = new Error("Cannot use a pool after calling end on the pool"); - return cb ? cb(err) : this.Promise.reject(err); - } - const response = promisify2(this.Promise, cb); - const result = response.result; - if (this._isFull() || this._idle.length) { - if (this._idle.length) { - process.nextTick(() => this._pulseQueue()); - } - if (!this.options.connectionTimeoutMillis) { - this._pendingQueue.push(new PendingItem(response.callback)); - return result; - } - const queueCallback = /* @__PURE__ */ __name((err, res, done) => { - clearTimeout(tid); - response.callback(err, res, done); - }, "queueCallback"); - const pendingItem = new PendingItem(queueCallback); - const tid = setTimeout(() => { - removeWhere(this._pendingQueue, (i) => i.callback === queueCallback); - pendingItem.timedOut = true; - response.callback(new Error("timeout exceeded when trying to connect")); - }, this.options.connectionTimeoutMillis); - this._pendingQueue.push(pendingItem); - return result; - } - this.newClient(new PendingItem(response.callback)); - return result; - } - newClient(pendingItem) { - const client = new this.Client(this.options); - this._clients.push(client); - const idleListener = makeIdleListener(this, client); - this.log("checking client timeout"); - let tid; - let timeoutHit = false; - if (this.options.connectionTimeoutMillis) { - tid = setTimeout(() => { - this.log("ending client due to timeout"); - timeoutHit = true; - client.connection ? client.connection.stream.destroy() : client.end(); - }, this.options.connectionTimeoutMillis); - } - this.log("connecting new client"); - client.connect((err) => { - if (tid) { - clearTimeout(tid); - } - client.on("error", idleListener); - if (err) { - this.log("client failed to connect", err); - this._clients = this._clients.filter((c) => c !== client); - if (timeoutHit) { - err.message = "Connection terminated due to connection timeout"; - } - this._pulseQueue(); - if (!pendingItem.timedOut) { - pendingItem.callback(err, void 0, NOOP); - } - } else { - this.log("new client connected"); - if (this.options.maxLifetimeSeconds !== 0) { - const maxLifetimeTimeout = setTimeout(() => { - this.log("ending client due to expired lifetime"); - this._expired.add(client); - const idleIndex = this._idle.findIndex((idleItem) => idleItem.client === client); - if (idleIndex !== -1) { - this._acquireClient( - client, - new PendingItem((err2, client2, clientRelease) => clientRelease()), - idleListener, - false - ); - } - }, this.options.maxLifetimeSeconds * 1e3); - maxLifetimeTimeout.unref(); - client.once("end", () => clearTimeout(maxLifetimeTimeout)); - } - return this._acquireClient(client, pendingItem, idleListener, true); - } - }); - } - // acquire a client for a pending work item - _acquireClient(client, pendingItem, idleListener, isNew) { - if (isNew) { - this.emit("connect", client); - } - this.emit("acquire", client); - client.release = this._releaseOnce(client, idleListener); - client.removeListener("error", idleListener); - if (!pendingItem.timedOut) { - if (isNew && this.options.verify) { - this.options.verify(client, (err) => { - if (err) { - client.release(err); - return pendingItem.callback(err, void 0, NOOP); - } - pendingItem.callback(void 0, client, client.release); - }); - } else { - pendingItem.callback(void 0, client, client.release); - } - } else { - if (isNew && this.options.verify) { - this.options.verify(client, client.release); - } else { - client.release(); - } - } - } - // returns a function that wraps _release and throws if called more than once - _releaseOnce(client, idleListener) { - let released = false; - return (err) => { - if (released) { - throwOnDoubleRelease(); - } - released = true; - this._release(client, idleListener, err); - }; - } - // release a client back to the poll, include an error - // to remove it from the pool - _release(client, idleListener, err) { - client.on("error", idleListener); - client._poolUseCount = (client._poolUseCount || 0) + 1; - this.emit("release", err, client); - if (err || this.ending || !client._queryable || client._ending || client._poolUseCount >= this.options.maxUses) { - if (client._poolUseCount >= this.options.maxUses) { - this.log("remove expended client"); - } - this._remove(client); - this._pulseQueue(); - return; - } - const isExpired = this._expired.has(client); - if (isExpired) { - this.log("remove expired client"); - this._expired.delete(client); - this._remove(client); - this._pulseQueue(); - return; - } - let tid; - if (this.options.idleTimeoutMillis) { - tid = setTimeout(() => { - this.log("remove idle client"); - this._remove(client); - }, this.options.idleTimeoutMillis); - if (this.options.allowExitOnIdle) { - tid.unref(); - } - } - if (this.options.allowExitOnIdle) { - client.unref(); - } - this._idle.push(new IdleItem(client, idleListener, tid)); - this._pulseQueue(); - } - query(text, values, cb) { - if (typeof text === "function") { - const response2 = promisify2(this.Promise, text); - setImmediate(function() { - return response2.callback(new Error("Passing a function as the first parameter to pool.query is not supported")); - }); - return response2.result; - } - if (typeof values === "function") { - cb = values; - values = void 0; - } - const response = promisify2(this.Promise, cb); - cb = response.callback; - this.connect((err, client) => { - if (err) { - return cb(err); - } - let clientReleased = false; - const onError = /* @__PURE__ */ __name((err2) => { - if (clientReleased) { - return; - } - clientReleased = true; - client.release(err2); - cb(err2); - }, "onError"); - client.once("error", onError); - this.log("dispatching query"); - try { - client.query(text, values, (err2, res) => { - this.log("query dispatched"); - client.removeListener("error", onError); - if (clientReleased) { - return; - } - clientReleased = true; - client.release(err2); - if (err2) { - return cb(err2); - } - return cb(void 0, res); - }); - } catch (err2) { - client.release(err2); - return cb(err2); - } - }); - return response.result; - } - end(cb) { - this.log("ending"); - if (this.ending) { - const err = new Error("Called end on pool more than once"); - return cb ? cb(err) : this.Promise.reject(err); - } - this.ending = true; - const promised = promisify2(this.Promise, cb); - this._endCallback = promised.callback; - this._pulseQueue(); - return promised.result; - } - get waitingCount() { - return this._pendingQueue.length; - } - get idleCount() { - return this._idle.length; - } - get expiredCount() { - return this._clients.reduce((acc, client) => acc + (this._expired.has(client) ? 1 : 0), 0); - } - get totalCount() { - return this._clients.length; - } - }; - module.exports = Pool2; - } -}); - -// shims/pg-native/index.js -var pg_native_exports = {}; -__export(pg_native_exports, { - default: () => pg_native_default -}); -var pg_native_default; -var init_pg_native = __esm({ - "shims/pg-native/index.js"() { - "use strict"; - init_shims(); - pg_native_default = {}; - } -}); - -// node_modules/pg/package.json -var require_package = __commonJS({ - "node_modules/pg/package.json"(exports, module) { - module.exports = { - name: "pg", - version: "8.8.0", - description: "PostgreSQL client - pure javascript & libpq with the same API", - keywords: [ - "database", - "libpq", - "pg", - "postgre", - "postgres", - "postgresql", - "rdbms" - ], - homepage: "https://github.com/brianc/node-postgres", - repository: { - type: "git", - url: "git://github.com/brianc/node-postgres.git", - directory: "packages/pg" - }, - author: "Brian Carlson ", - main: "./lib", - dependencies: { - "buffer-writer": "2.0.0", - "packet-reader": "1.0.0", - "pg-connection-string": "^2.5.0", - "pg-pool": "^3.5.2", - "pg-protocol": "^1.5.0", - "pg-types": "^2.1.0", - pgpass: "1.x" - }, - devDependencies: { - async: "2.6.4", - bluebird: "3.5.2", - co: "4.6.0", - "pg-copy-streams": "0.3.0" - }, - peerDependencies: { - "pg-native": ">=3.0.1" - }, - peerDependenciesMeta: { - "pg-native": { - optional: true - } - }, - scripts: { - test: "make test-all" - }, - files: [ - "lib", - "SPONSORS.md" - ], - license: "MIT", - engines: { - node: ">= 8.0.0" - }, - gitHead: "c99fb2c127ddf8d712500db2c7b9a5491a178655" - }; - } -}); - -// node_modules/pg/lib/native/query.js -var require_query2 = __commonJS({ - "node_modules/pg/lib/native/query.js"(exports, module) { - "use strict"; - init_shims(); - var EventEmitter2 = require_events().EventEmitter; - var util = (init_util(), __toCommonJS(util_exports)); - var utils = require_utils(); - var NativeQuery = module.exports = function(config, values, callback) { - EventEmitter2.call(this); - config = utils.normalizeQueryConfig(config, values, callback); - this.text = config.text; - this.values = config.values; - this.name = config.name; - this.callback = config.callback; - this.state = "new"; - this._arrayMode = config.rowMode === "array"; - this._emitRowEvents = false; - this.on( - "newListener", - function(event) { - if (event === "row") this._emitRowEvents = true; - }.bind(this) - ); - }; - util.inherits(NativeQuery, EventEmitter2); - var errorFieldMap = { - /* eslint-disable quote-props */ - sqlState: "code", - statementPosition: "position", - messagePrimary: "message", - context: "where", - schemaName: "schema", - tableName: "table", - columnName: "column", - dataTypeName: "dataType", - constraintName: "constraint", - sourceFile: "file", - sourceLine: "line", - sourceFunction: "routine" - }; - NativeQuery.prototype.handleError = function(err) { - var fields = this.native.pq.resultErrorFields(); - if (fields) { - for (var key in fields) { - var normalizedFieldName = errorFieldMap[key] || key; - err[normalizedFieldName] = fields[key]; - } - } - if (this.callback) { - this.callback(err); - } else { - this.emit("error", err); - } - this.state = "error"; - }; - NativeQuery.prototype.then = function(onSuccess, onFailure) { - return this._getPromise().then(onSuccess, onFailure); - }; - NativeQuery.prototype.catch = function(callback) { - return this._getPromise().catch(callback); - }; - NativeQuery.prototype._getPromise = function() { - if (this._promise) return this._promise; - this._promise = new Promise( - function(resolve, reject) { - this._once("end", resolve); - this._once("error", reject); - }.bind(this) - ); - return this._promise; - }; - NativeQuery.prototype.submit = function(client) { - this.state = "running"; - var self = this; - this.native = client.native; - client.native.arrayMode = this._arrayMode; - var after = /* @__PURE__ */ __name(function(err, rows, results) { - client.native.arrayMode = false; - setImmediate(function() { - self.emit("_done"); - }); - if (err) { - return self.handleError(err); - } - if (self._emitRowEvents) { - if (results.length > 1) { - rows.forEach((rowOfRows, i) => { - rowOfRows.forEach((row) => { - self.emit("row", row, results[i]); - }); - }); - } else { - rows.forEach(function(row) { - self.emit("row", row, results); - }); - } - } - self.state = "end"; - self.emit("end", results); - if (self.callback) { - self.callback(null, results); - } - }, "after"); - if (process.domain) { - after = process.domain.bind(after); - } - if (this.name) { - if (this.name.length > 63) { - console.error("Warning! Postgres only supports 63 characters for query names."); - console.error("You supplied %s (%s)", this.name, this.name.length); - console.error("This can cause conflicts and silent errors executing queries"); - } - var values = (this.values || []).map(utils.prepareValue); - if (client.namedQueries[this.name]) { - if (this.text && client.namedQueries[this.name] !== this.text) { - const err = new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`); - return after(err); - } - return client.native.execute(this.name, values, after); - } - return client.native.prepare(this.name, this.text, values.length, function(err) { - if (err) return after(err); - client.namedQueries[self.name] = self.text; - return self.native.execute(self.name, values, after); - }); - } else if (this.values) { - if (!Array.isArray(this.values)) { - const err = new Error("Query values must be an array"); - return after(err); - } - var vals = this.values.map(utils.prepareValue); - client.native.query(this.text, vals, after); - } else { - client.native.query(this.text, after); - } - }; - } -}); - -// node_modules/pg/lib/native/client.js -var require_client2 = __commonJS({ - "node_modules/pg/lib/native/client.js"(exports, module) { - "use strict"; - init_shims(); - var Native = (init_pg_native(), __toCommonJS(pg_native_exports)); - var TypeOverrides2 = require_type_overrides(); - var pkg = require_package(); - var EventEmitter2 = require_events().EventEmitter; - var util = (init_util(), __toCommonJS(util_exports)); - var ConnectionParameters2 = require_connection_parameters(); - var NativeQuery = require_query2(); - var Client3 = module.exports = function(config) { - EventEmitter2.call(this); - config = config || {}; - this._Promise = config.Promise || global.Promise; - this._types = new TypeOverrides2(config.types); - this.native = new Native({ - types: this._types - }); - this._queryQueue = []; - this._ending = false; - this._connecting = false; - this._connected = false; - this._queryable = true; - var cp = this.connectionParameters = new ConnectionParameters2(config); - this.user = cp.user; - Object.defineProperty(this, "password", { - configurable: true, - enumerable: false, - writable: true, - value: cp.password - }); - this.database = cp.database; - this.host = cp.host; - this.port = cp.port; - this.namedQueries = {}; - }; - Client3.Query = NativeQuery; - util.inherits(Client3, EventEmitter2); - Client3.prototype._errorAllQueries = function(err) { - const enqueueError = /* @__PURE__ */ __name((query) => { - process.nextTick(() => { - query.native = this.native; - query.handleError(err); - }); - }, "enqueueError"); - if (this._hasActiveQuery()) { - enqueueError(this._activeQuery); - this._activeQuery = null; - } - this._queryQueue.forEach(enqueueError); - this._queryQueue.length = 0; - }; - Client3.prototype._connect = function(cb) { - var self = this; - if (this._connecting) { - process.nextTick(() => cb(new Error("Client has already been connected. You cannot reuse a client."))); - return; - } - this._connecting = true; - this.connectionParameters.getLibpqConnectionString(function(err, conString) { - if (err) return cb(err); - self.native.connect(conString, function(err2) { - if (err2) { - self.native.end(); - return cb(err2); - } - self._connected = true; - self.native.on("error", function(err3) { - self._queryable = false; - self._errorAllQueries(err3); - self.emit("error", err3); - }); - self.native.on("notification", function(msg) { - self.emit("notification", { - channel: msg.relname, - payload: msg.extra - }); - }); - self.emit("connect"); - self._pulseQueryQueue(true); - cb(); - }); - }); - }; - Client3.prototype.connect = function(callback) { - if (callback) { - this._connect(callback); - return; - } - return new this._Promise((resolve, reject) => { - this._connect((error) => { - if (error) { - reject(error); - } else { - resolve(); - } - }); - }); - }; - Client3.prototype.query = function(config, values, callback) { - var query; - var result; - var readTimeout; - var readTimeoutTimer; - var queryCallback; - if (config === null || config === void 0) { - throw new TypeError("Client was passed a null or undefined query"); - } else if (typeof config.submit === "function") { - readTimeout = config.query_timeout || this.connectionParameters.query_timeout; - result = query = config; - if (typeof values === "function") { - config.callback = values; - } - } else { - readTimeout = this.connectionParameters.query_timeout; - query = new NativeQuery(config, values, callback); - if (!query.callback) { - let resolveOut, rejectOut; - result = new this._Promise((resolve, reject) => { - resolveOut = resolve; - rejectOut = reject; - }); - query.callback = (err, res) => err ? rejectOut(err) : resolveOut(res); - } - } - if (readTimeout) { - queryCallback = query.callback; - readTimeoutTimer = setTimeout(() => { - var error = new Error("Query read timeout"); - process.nextTick(() => { - query.handleError(error, this.connection); - }); - queryCallback(error); - query.callback = () => { - }; - var index = this._queryQueue.indexOf(query); - if (index > -1) { - this._queryQueue.splice(index, 1); - } - this._pulseQueryQueue(); - }, readTimeout); - query.callback = (err, res) => { - clearTimeout(readTimeoutTimer); - queryCallback(err, res); - }; - } - if (!this._queryable) { - query.native = this.native; - process.nextTick(() => { - query.handleError(new Error("Client has encountered a connection error and is not queryable")); - }); - return result; - } - if (this._ending) { - query.native = this.native; - process.nextTick(() => { - query.handleError(new Error("Client was closed and is not queryable")); - }); - return result; - } - this._queryQueue.push(query); - this._pulseQueryQueue(); - return result; - }; - Client3.prototype.end = function(cb) { - var self = this; - this._ending = true; - if (!this._connected) { - this.once("connect", this.end.bind(this, cb)); - } - var result; - if (!cb) { - result = new this._Promise(function(resolve, reject) { - cb = /* @__PURE__ */ __name((err) => err ? reject(err) : resolve(), "cb"); - }); - } - this.native.end(function() { - self._errorAllQueries(new Error("Connection terminated")); - process.nextTick(() => { - self.emit("end"); - if (cb) cb(); - }); - }); - return result; - }; - Client3.prototype._hasActiveQuery = function() { - return this._activeQuery && this._activeQuery.state !== "error" && this._activeQuery.state !== "end"; - }; - Client3.prototype._pulseQueryQueue = function(initialConnection) { - if (!this._connected) { - return; - } - if (this._hasActiveQuery()) { - return; - } - var query = this._queryQueue.shift(); - if (!query) { - if (!initialConnection) { - this.emit("drain"); - } - return; - } - this._activeQuery = query; - query.submit(this); - var self = this; - query.once("_done", function() { - self._pulseQueryQueue(); - }); - }; - Client3.prototype.cancel = function(query) { - if (this._activeQuery === query) { - this.native.cancel(function() { - }); - } else if (this._queryQueue.indexOf(query) !== -1) { - this._queryQueue.splice(this._queryQueue.indexOf(query), 1); - } - }; - Client3.prototype.ref = function() { - }; - Client3.prototype.unref = function() { - }; - Client3.prototype.setTypeParser = function(oid, format, parseFn) { - return this._types.setTypeParser(oid, format, parseFn); - }; - Client3.prototype.getTypeParser = function(oid, format) { - return this._types.getTypeParser(oid, format); - }; - } -}); - -// node_modules/pg/lib/native/index.js -var require_native = __commonJS({ - "node_modules/pg/lib/native/index.js"(exports, module) { - "use strict"; - init_shims(); - module.exports = require_client2(); - } -}); - -// node_modules/pg/lib/index.js -var require_lib2 = __commonJS({ - "node_modules/pg/lib/index.js"(exports, module) { - "use strict"; - init_shims(); - var Client3 = require_client(); - var defaults2 = require_defaults(); - var Connection3 = require_connection(); - var Pool2 = require_pg_pool(); - var { DatabaseError: DatabaseError2 } = require_dist(); - var poolFactory = /* @__PURE__ */ __name((Client4) => { - return class BoundPool extends Pool2 { - static { - __name(this, "BoundPool"); - } - constructor(options) { - super(options, Client4); - } - }; - }, "poolFactory"); - var PG = /* @__PURE__ */ __name(function(clientConstructor) { - this.defaults = defaults2; - this.Client = clientConstructor; - this.Query = this.Client.Query; - this.Pool = poolFactory(this.Client); - this._pools = []; - this.Connection = Connection3; - this.types = require_pg_types(); - this.DatabaseError = DatabaseError2; - }, "PG"); - if (typeof process.env.NODE_PG_FORCE_NATIVE !== "undefined") { - module.exports = new PG(require_native()); - } else { - module.exports = new PG(Client3); - Object.defineProperty(module.exports, "native", { - configurable: true, - enumerable: false, - get() { - var native = null; - try { - native = new PG(require_native()); - } catch (err) { - if (err.code !== "MODULE_NOT_FOUND") { - throw err; - } - } - Object.defineProperty(module.exports, "native", { - value: native - }); - return native; - } - }); - } - } -}); - -// src/index.ts -init_shims(); - -// node_modules/subtls/index.js -var subtls_exports = {}; -__export(subtls_exports, { - SocketReadQueue: () => Lt, - TrustedCert: () => st, - WebSocketReadQueue: () => vt, - startTls: () => he -}); -init_shims(); -function p(...r2) { - if (r2.length === 1 && r2[0] instanceof Uint8Array) return r2[0]; - let e = r2.reduce((n, a) => n + a.length, 0), t = new Uint8Array(e), i = 0; - for (let n of r2) t.set(n, i), i += n.length; - return t; -} -__name(p, "p"); -function O(r2, e) { - let t = r2.length; - if (t !== e.length) return false; - for (let i = 0; i < t; i++) if (r2[i] !== e[i]) return false; - return true; -} -__name(O, "O"); -var it = "\xB7\xB7 "; -var Nt = new TextEncoder(); -var Yt = new TextDecoder(); -var N = class { - static { - __name(this, "N"); - } - offset; - dataView; - data; - comments; - indents; - indent; - constructor(e) { - this.offset = 0, this.data = typeof e == "number" ? new Uint8Array(e) : e, this.dataView = new DataView( - this.data.buffer, - this.data.byteOffset, - this.data.byteLength - ), this.comments = {}, this.indents = {}, this.indent = 0; - } - extend(e) { - let t = typeof e == "number" ? new Uint8Array(e) : e; - this.data = p(this.data, t), this.dataView = new DataView( - this.data.buffer, - this.data.byteOffset, - this.data.byteLength - ); - } - remaining() { - return this.data.length - this.offset; - } - subarray(e) { - return this.data.subarray(this.offset, this.offset += e); - } - skip(e, t) { - return this.offset += e, t && this.comment(t), this; - } - comment(e, t = this.offset) { - throw new Error("No comments should be emitted outside of chatty mode"); - } - readBytes(e) { - return this.data.slice(this.offset, this.offset += e); - } - readUTF8String(e) { - let t = this.subarray(e); - return Yt.decode( - t - ); - } - readUTF8StringNullTerminated() { - let e = this.offset; - for (; this.data[e] !== 0; ) e++; - let t = this.readUTF8String(e - this.offset); - return this.expectUint8(0, "end of string"), t; - } - readUint8(e) { - let t = this.dataView.getUint8(this.offset); - return this.offset += 1, t; - } - readUint16(e) { - let t = this.dataView.getUint16(this.offset); - return this.offset += 2, t; - } - readUint24(e) { - let t = this.readUint8(), i = this.readUint16(); - return (t << 16) + i; - } - readUint32(e) { - let t = this.dataView.getUint32(this.offset); - return this.offset += 4, t; - } - expectBytes(e, t) { - let i = this.readBytes(e.length); - if (!O(i, e)) throw new Error("Unexpected bytes"); - } - expectUint8(e, t) { - let i = this.readUint8(); - if (i !== e) throw new Error(`Expected ${e}, got ${i}`); - } - expectUint16(e, t) { - let i = this.readUint16(); - if (i !== e) throw new Error(`Expected ${e}, got ${i}`); - } - expectUint24(e, t) { - let i = this.readUint24(); - if (i !== e) throw new Error(`Expected ${e}, got ${i}`); - } - expectUint32(e, t) { - let i = this.readUint32(); - if (i !== e) throw new Error(`Expected ${e}, got ${i}`); - } - expectLength(e, t = 1) { - let i = this.offset, n = i + e; - if (n > this.data.length) throw new Error("Expected length exceeds remaining data length"); - return this.indent += t, this.indents[i] = this.indent, [() => { - if (this.indent -= t, this.indents[this.offset] = this.indent, this.offset !== n) throw new Error( - `${e} bytes expected but ${this.offset - i} read` - ); - }, () => n - this.offset]; - } - expectLengthUint8(e) { - let t = this.readUint8(); - return this.expectLength(t); - } - expectLengthUint16(e) { - let t = this.readUint16(); - return this.expectLength(t); - } - expectLengthUint24(e) { - let t = this.readUint24(); - return this.expectLength(t); - } - expectLengthUint32(e) { - let t = this.readUint32(); - return this.expectLength(t); - } - expectLengthUint8Incl(e) { - let t = this.readUint8(); - return this.expectLength( - t - 1 - ); - } - expectLengthUint16Incl(e) { - let t = this.readUint16(); - return this.expectLength( - t - 2 - ); - } - expectLengthUint24Incl(e) { - let t = this.readUint24(); - return this.expectLength( - t - 3 - ); - } - expectLengthUint32Incl(e) { - let t = this.readUint32(); - return this.expectLength( - t - 4 - ); - } - writeBytes(e) { - return this.data.set(e, this.offset), this.offset += e.length, this; - } - writeUTF8String(e) { - let t = Nt.encode(e); - return this.writeBytes(t), this; - } - writeUTF8StringNullTerminated(e) { - let t = Nt.encode(e); - return this.writeBytes(t), this.writeUint8(0), this; - } - writeUint8(e, t) { - return this.dataView.setUint8(this.offset, e), this.offset += 1, this; - } - writeUint16(e, t) { - return this.dataView.setUint16(this.offset, e), this.offset += 2, this; - } - writeUint24(e, t) { - return this.writeUint8((e & 16711680) >> 16), this.writeUint16(e & 65535, t), this; - } - writeUint32(e, t) { - return this.dataView.setUint32(this.offset, e), this.offset += 4, this; - } - _writeLengthGeneric(e, t, i) { - let n = this.offset; - this.offset += e; - let a = this.offset; - return this.indent += 1, this.indents[a] = this.indent, () => { - let c = this.offset - (t ? n : a); - if (e === 1) this.dataView.setUint8(n, c); - else if (e === 2) this.dataView.setUint16(n, c); - else if (e === 3) this.dataView.setUint8(n, (c & 16711680) >> 16), this.dataView.setUint16(n + 1, c & 65535); - else if (e === 4) this.dataView.setUint32( - n, - c - ); - else throw new Error(`Invalid length for length field: ${e}`); - this.indent -= 1, this.indents[this.offset] = this.indent; - }; - } - writeLengthUint8(e) { - return this._writeLengthGeneric( - 1, - false, - e - ); - } - writeLengthUint16(e) { - return this._writeLengthGeneric(2, false, e); - } - writeLengthUint24(e) { - return this._writeLengthGeneric(3, false, e); - } - writeLengthUint32(e) { - return this._writeLengthGeneric( - 4, - false, - e - ); - } - writeLengthUint8Incl(e) { - return this._writeLengthGeneric(1, true, e); - } - writeLengthUint16Incl(e) { - return this._writeLengthGeneric(2, true, e); - } - writeLengthUint24Incl(e) { - return this._writeLengthGeneric( - 3, - true, - e - ); - } - writeLengthUint32Incl(e) { - return this._writeLengthGeneric(4, true, e); - } - array() { - return this.data.subarray(0, this.offset); - } - commentedString(e = false) { - let t = this.indents[0] !== void 0 ? it.repeat(this.indents[0]) : "", i = this.indents[0] ?? 0, n = e ? this.data.length : this.offset; - for (let a = 0; a < n; a++) { - t += this.data[a].toString(16).padStart(2, "0") + " "; - let c = this.comments[a + 1]; - this.indents[a + 1] !== void 0 && (i = this.indents[a + 1]), c && (t += ` ${c} -${it.repeat(i)}`); - } - return t; - } -}; -function St(r2, e, t, i = true) { - let n = new N(1024); - n.writeUint8(22, 0), n.writeUint16(769, 0); - let a = n.writeLengthUint16(); - n.writeUint8(1, 0); - let c = n.writeLengthUint24(); - n.writeUint16( - 771, - 0 - ), crypto.getRandomValues(n.subarray(32)); - let s = n.writeLengthUint8(0); - n.writeBytes( - t - ), s(); - let o = n.writeLengthUint16(0); - n.writeUint16(4865, 0), o(); - let h = n.writeLengthUint8( - 0 - ); - n.writeUint8(0, 0), h(); - let y = n.writeLengthUint16(0); - if (i) { - n.writeUint16(0, 0); - let q = n.writeLengthUint16(0), G = n.writeLengthUint16(0); - n.writeUint8(0, 0); - let D = n.writeLengthUint16( - 0 - ); - n.writeUTF8String(r2), D(), G(), q(); - } - n.writeUint16(11, 0); - let d = n.writeLengthUint16( - 0 - ), m = n.writeLengthUint8(0); - n.writeUint8(0, 0), m(), d(), n.writeUint16(10, 0); - let g = n.writeLengthUint16(0), A = n.writeLengthUint16(0); - n.writeUint16(23, 0), A(), g(), n.writeUint16( - 13, - 0 - ); - let L = n.writeLengthUint16(0), f = n.writeLengthUint16(0); - n.writeUint16(1027, 0), n.writeUint16(2052, 0), f(), L(), n.writeUint16(43, 0); - let u = n.writeLengthUint16(0), x = n.writeLengthUint8(0); - n.writeUint16(772, 0), x(), u(), n.writeUint16(51, 0); - let T = n.writeLengthUint16( - 0 - ), $ = n.writeLengthUint16(0); - n.writeUint16(23, 0); - let P = n.writeLengthUint16(0); - return n.writeBytes(new Uint8Array(e)), P(), $(), T(), y(), c(), a(), n; -} -__name(St, "St"); -function K(r2, e = "") { - return [...r2].map((t) => t.toString(16).padStart(2, "0")).join(e); -} -__name(K, "K"); -function Ut(r2, e) { - let t, i, [n] = r2.expectLength(r2.remaining()); - r2.expectUint8(2, 0); - let [ - a - ] = r2.expectLengthUint24(0); - r2.expectUint16(771, 0); - let c = r2.readBytes(32); - if (O(c, [ - 207, - 33, - 173, - 116, - 229, - 154, - 97, - 17, - 190, - 29, - 140, - 2, - 30, - 101, - 184, - 145, - 194, - 162, - 17, - 22, - 122, - 187, - 140, - 94, - 7, - 158, - 9, - 226, - 200, - 168, - 51, - 156 - ])) throw new Error("Unexpected HelloRetryRequest"); - r2.expectUint8( - e.length, - 0 - ), r2.expectBytes(e, 0), r2.expectUint16(4865, 0), r2.expectUint8(0, 0); - let [s, o] = r2.expectLengthUint16(0); - for (; o() > 0; ) { - let h = r2.readUint16(0), [y] = r2.expectLengthUint16( - 0 - ); - if (h === 43) r2.expectUint16(772, 0), i = true; - else if (h === 51) r2.expectUint16(23, 0), r2.expectUint16( - 65 - ), t = r2.readBytes(65); - else throw new Error(`Unexpected extension 0x${K([h])}`); - y(); - } - if (s(), a(), n(), i !== true) throw new Error("No TLS version provided"); - if (t === void 0) throw new Error( - "No key provided" - ); - return t; -} -__name(Ut, "Ut"); -var Ce = new RegExp(` .+|^(${it})+`, "gm"); -var rt = 16384; -var te = rt + 1 + 255; -async function ht(r2, e, t = rt) { - let n = await r2(5); - if (n === void 0) - return; - if (n.length < 5) throw new Error("TLS record header truncated"); - let a = new N( - n - ), c = a.readUint8(); - if (c < 20 || c > 24) throw new Error(`Illegal TLS record type 0x${c.toString(16)}`); - if (e !== void 0 && c !== e) throw new Error(`Unexpected TLS record type 0x${c.toString(16).padStart(2, "0")} (expected 0x${e.toString(16).padStart(2, "0")})`); - a.expectUint16(771, "TLS record version 1.2 (middlebox compatibility)"); - let s = a.readUint16(0); - if (s > t) throw new Error(`Record too long: ${s} bytes`); - let o = await r2( - s - ); - if (o === void 0 || o.length < s) throw new Error("TLS record content truncated"); - return { - headerData: n, - header: a, - type: c, - length: s, - content: o - }; -} -__name(ht, "ht"); -async function dt(r2, e, t) { - let i = await ht( - r2, - 23, - te - ); - if (i === void 0) return; - let n = new N(i.content), [a] = n.expectLength(n.remaining()); - n.skip(i.length - 16, 0), n.skip(16, 0), a(); - let c = await e.process(i.content, 16, i.headerData), s = c.length - 1; - for (; c[s] === 0; ) s -= 1; - if (s < 0) throw new Error("Decrypted message has no record type indicator (all zeroes)"); - let o = c[s], h = c.subarray(0, s); - if (!(o === 21 && h.length === 2 && h[0] === 1 && h[1] === 0)) { - if (o === 22 && h[0] === 4) return dt(r2, e, t); - if (t !== void 0 && o !== t) throw new Error(`Unexpected TLS record type 0x${o.toString(16).padStart( - 2, - "0" - )} (expected 0x${t.toString(16).padStart(2, "0")})`); - return h; - } -} -__name(dt, "dt"); -async function ee(r2, e, t) { - let i = p(r2, [t]), n = 5, s = i.length + 16, o = new N(n + s); - o.writeUint8(23, 0), o.writeUint16( - 771, - 0 - ), o.writeUint16(s, `${s} bytes follow`); - let [h] = o.expectLength(s), y = o.array(), d = await e.process(i, 16, y); - return o.writeBytes(d.subarray(0, d.length - 16)), o.writeBytes(d.subarray( - d.length - 16 - )), h(), o.array(); -} -__name(ee, "ee"); -async function At(r2, e, t) { - let i = Math.ceil(r2.length / rt), n = []; - for (let a = 0; a < i; a++) { - let c = r2.subarray(a * rt, (a + 1) * rt), s = await ee(c, e, t); - n.push( - s - ); - } - return n; -} -__name(At, "At"); -var l = crypto.subtle; -var Ht = new TextEncoder(); -async function lt(r2, e, t) { - let i = await l.importKey( - "raw", - r2, - { name: "HMAC", hash: { name: `SHA-${t}` } }, - false, - ["sign"] - ); - var n = new Uint8Array(await l.sign( - "HMAC", - i, - e - )); - return n; -} -__name(lt, "lt"); -async function ne(r2, e, t, i) { - let n = i >> 3, a = Math.ceil(t / n), c = new Uint8Array( - a * n - ), s = await l.importKey("raw", r2, { name: "HMAC", hash: { name: `SHA-${i}` } }, false, ["sign"]), o = new Uint8Array(0); - for (let h = 0; h < a; h++) { - let y = p(o, e, [h + 1]), d = await l.sign( - "HMAC", - s, - y - ), m = new Uint8Array(d); - c.set(m, n * h), o = m; - } - return c.subarray(0, t); -} -__name(ne, "ne"); -var Rt = Ht.encode( - "tls13 " -); -async function S(r2, e, t, i, n) { - let a = Ht.encode(e), c = p( - [(i & 65280) >> 8, i & 255], - [Rt.length + a.length], - Rt, - a, - [t.length], - t - ); - return ne(r2, c, i, n); -} -__name(S, "S"); -async function Kt(r2, e, t, i, n) { - let a = i >>> 3, c = new Uint8Array(a), s = await l.importKey( - "raw", - r2, - { name: "ECDH", namedCurve: "P-256" }, - false, - [] - ), o = await l.deriveBits({ - name: "ECDH", - public: s - }, e, 256), h = new Uint8Array(o), y = await l.digest("SHA-256", t), d = new Uint8Array( - y - ), m = await lt(new Uint8Array(1), c, i), g = await l.digest(`SHA-${i}`, new Uint8Array( - 0 - )), A = new Uint8Array(g), L = await S(m, "derived", A, a, i), f = await lt(L, h, i), u = await S( - f, - "c hs traffic", - d, - a, - i - ), x = await S(f, "s hs traffic", d, a, i), T = await S(u, "key", new Uint8Array( - 0 - ), n, i), $ = await S(x, "key", new Uint8Array(0), n, i), P = await S(u, "iv", new Uint8Array( - 0 - ), 12, i), q = await S(x, "iv", new Uint8Array(0), 12, i); - return { - serverHandshakeKey: $, - serverHandshakeIV: q, - clientHandshakeKey: T, - clientHandshakeIV: P, - handshakeSecret: f, - clientSecret: u, - serverSecret: x - }; -} -__name(Kt, "Kt"); -async function Tt(r2, e, t, i) { - let n = t >>> 3, a = new Uint8Array(n), c = await l.digest(`SHA-${t}`, new Uint8Array(0)), s = new Uint8Array(c), o = await S(r2, "derived", s, n, t), h = await lt( - o, - a, - t - ), y = await S(h, "c ap traffic", e, n, t), d = await S(h, "s ap traffic", e, n, t), m = await S( - y, - "key", - new Uint8Array(0), - i, - t - ), g = await S(d, "key", new Uint8Array(0), i, t), A = await S( - y, - "iv", - new Uint8Array(0), - 12, - t - ), L = await S(d, "iv", new Uint8Array(0), 12, t); - return { - serverApplicationKey: g, - serverApplicationIV: L, - clientApplicationKey: m, - clientApplicationIV: A - }; -} -__name(Tt, "Tt"); -var Z = class { - static { - __name(this, "Z"); - } - constructor(e, t, i) { - this.mode = e; - this.key = t; - this.initialIv = i; - } - recordsProcessed = 0n; - priorPromise = Promise.resolve(new Uint8Array()); - async process(e, t, i) { - let n = this.processUnsequenced(e, t, i); - return this.priorPromise = this.priorPromise.then(() => n); - } - async processUnsequenced(e, t, i) { - let n = this.recordsProcessed; - this.recordsProcessed += 1n; - let a = this.initialIv.slice(), c = BigInt(a.length), s = c - 1n; - for (let m = 0n; m < c; m++) { - let g = n >> (m << 3n); - if (g === 0n) break; - a[Number(s - m)] ^= Number(g & 0xffn); - } - let o = t << 3, h = { name: "AES-GCM", iv: a, tagLength: o, additionalData: i }, y = await l[this.mode](h, this.key, e); - return new Uint8Array(y); - } -}; -function yt(r2) { - return r2 > 64 && r2 < 91 ? r2 - 65 : r2 > 96 && r2 < 123 ? r2 - 71 : r2 > 47 && r2 < 58 ? r2 + 4 : r2 === 43 ? 62 : r2 === 47 ? 63 : r2 === 61 ? 64 : void 0; -} -__name(yt, "yt"); -function Dt(r2) { - let e = r2.length, t = 0, i = 0, n = 64, a = 64, c = 64, s = 64, o = new Uint8Array(e * 0.75); - for (; t < e; ) n = yt(r2.charCodeAt(t++)), a = yt(r2.charCodeAt( - t++ - )), c = yt(r2.charCodeAt(t++)), s = yt(r2.charCodeAt(t++)), o[i++] = n << 2 | a >> 4, o[i++] = (a & 15) << 4 | c >> 2, o[i++] = (c & 3) << 6 | s; - let h = a === 64 ? 0 : c === 64 ? 2 : s === 64 ? 1 : 0; - return o.subarray( - 0, - i - h - ); -} -__name(Dt, "Dt"); -var M = class extends N { - static { - __name(this, "M"); - } - readASN1Length(e) { - let t = this.readUint8(); - if (t < 128) return t; - let i = t & 127, n = 0; - if (i === 1) return this.readUint8(n); - if (i === 2) return this.readUint16( - n - ); - if (i === 3) return this.readUint24(n); - if (i === 4) return this.readUint32(n); - throw new Error( - `ASN.1 length fields are only supported up to 4 bytes (this one is ${i} bytes)` - ); - } - expectASN1Length(e) { - let t = this.readASN1Length(e); - return this.expectLength(t); - } - readASN1OID() { - let [e, t] = this.expectASN1Length(0), i = this.readUint8(), n = `${Math.floor(i / 40)}.${i % 40}`; - for (; t() > 0; ) { - let a = 0; - for (; ; ) { - let c = this.readUint8(); - if (a <<= 7, a += c & 127, c < 128) break; - } - n += `.${a}`; - } - return e(), n; - } - readASN1Boolean() { - let [e, t] = this.expectASN1Length(0), i = t(); - if (i !== 1) - throw new Error(`Boolean has weird length: ${i}`); - let n = this.readUint8(), a; - if (n === 255) a = true; - else if (n === 0) a = false; - else throw new Error(`Boolean has weird value: 0x${K( - [n] - )}`); - return e(), a; - } - readASN1UTCTime() { - let [e, t] = this.expectASN1Length(0), n = this.readUTF8String(t()).match(/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z$/); - if (!n) throw new Error( - "Unrecognised ASN.1 UTC time format" - ); - let [, a, c, s, o, h, y] = n, d = parseInt(a, 10), m = d + (d >= 50 ? 1900 : 2e3), g = /* @__PURE__ */ new Date(`${m}-${c}-${s}T${o}:${h}:${y}Z`); - return e(), g; - } - readASN1BitString() { - let [e, t] = this.expectASN1Length(0), i = this.readUint8(0), n = t(), a = this.readBytes(n); - if (i > 7) throw new Error(`Invalid right pad value: ${i}`); - if (i > 0) { - let c = 8 - i; - for (let s = n - 1; s > 0; s--) a[s] = 255 & a[s - 1] << c | a[s] >>> i; - a[0] = a[0] >>> i; - } - return e(), a; - } -}; -function mt(r2, e = (i, n) => n, t) { - return JSON.stringify(r2, (n, a) => e(n, typeof a != "object" || a === null || Array.isArray(a) ? a : Object.fromEntries(Object.entries(a).sort(([c], [s]) => c < s ? -1 : c > s ? 1 : 0))), t); -} -__name(mt, "mt"); -var gt = 1; -var tt = 2; -var U = 48; -var ie = 49; -var Q = 6; -var re = 19; -var se = 12; -var bt = 23; -var ft = 5; -var _ = 4; -var ut = 3; -var $t = 163; -var W = 128; -var ae = { - "2.5.4.6": "C", - "2.5.4.10": "O", - "2.5.4.11": "OU", - "2.5.4.3": "CN", - "2.5.4.7": "L", - "2.5.4.8": "ST", - "2.5.4.12": "T", - "2.5.4.42": "GN", - "2.5.4.43": "I", - "2.5.4.4": "SN", - "1.2.840.113549.1.9.1": "E-mail" -}; -function qt(r2) { - let { length: e } = r2; - if (e > 4) throw new Error(`Bit string length ${e} would overflow JS bit operators`); - let t = 0, i = 0; - for (let n = r2.length - 1; n >= 0; n--) t |= r2[n] << i, i += 8; - return t; -} -__name(qt, "qt"); -function Ct(r2, e) { - let t = {}; - r2.expectUint8(U, 0); - let [i, n] = r2.expectASN1Length( - 0 - ); - for (; n() > 0; ) { - r2.expectUint8(ie, 0); - let [a] = r2.expectASN1Length(0); - r2.expectUint8( - U, - 0 - ); - let [c] = r2.expectASN1Length(0); - r2.expectUint8(Q, 0); - let s = r2.readASN1OID(), o = ae[s] ?? s, h = r2.readUint8(); - if (h !== re) { - if (h !== se) throw new Error(`Unexpected item type in certificate ${e}: 0x${K([h])}`); - } - let [y, d] = r2.expectASN1Length(0), m = r2.readUTF8String( - d() - ); - if (y(), c(), a(), t[o] !== void 0) throw new Error(`Duplicate OID ${o} in certificate ${e}`); - t[o] = m; - } - return i(), t; -} -__name(Ct, "Ct"); -function Bt(r2, e = 0) { - let t = [], [i, n] = r2.expectASN1Length( - 0 - ); - for (; n() > 0; ) { - let a = r2.readUint8(0), [c, s] = r2.expectASN1Length(0), o; - a === (e | 2) ? o = r2.readUTF8String(s()) : o = r2.readBytes(s()), t.push({ name: o, type: a }), c(); - } - return i(), t; -} -__name(Bt, "Bt"); -function Ft(r2) { - let e = { - "1.2.840.113549.1.1.1": { name: "RSAES-PKCS1-v1_5" }, - "1.2.840.113549.1.1.5": { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-1" } }, - "1.2.840.113549.1.1.11": { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-256" } }, - "1.2.840.113549.1.1.12": { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-384" } }, - "1.2.840.113549.1.1.13": { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-512" } }, - "1.2.840.113549.1.1.10": { name: "RSA-PSS" }, - "1.2.840.113549.1.1.7": { name: "RSA-OAEP" }, - "1.2.840.10045.2.1": { name: "ECDSA", hash: { name: "SHA-1" } }, - "1.2.840.10045.4.1": { name: "ECDSA", hash: { name: "SHA-1" } }, - "1.2.840.10045.4.3.2": { name: "ECDSA", hash: { name: "SHA-256" } }, - "1.2.840.10045.4.3.3": { name: "ECDSA", hash: { - name: "SHA-384" - } }, - "1.2.840.10045.4.3.4": { name: "ECDSA", hash: { name: "SHA-512" } }, - "1.3.133.16.840.63.0.2": { name: "ECDH", kdf: "SHA-1" }, - "1.3.132.1.11.1": { name: "ECDH", kdf: "SHA-256" }, - "1.3.132.1.11.2": { name: "ECDH", kdf: "SHA-384" }, - "1.3.132.1.11.3": { name: "ECDH", kdf: "SHA-512" }, - "2.16.840.1.101.3.4.1.2": { name: "AES-CBC", length: 128 }, - "2.16.840.1.101.3.4.1.22": { name: "AES-CBC", length: 192 }, - "2.16.840.1.101.3.4.1.42": { name: "AES-CBC", length: 256 }, - "2.16.840.1.101.3.4.1.6": { name: "AES-GCM", length: 128 }, - "2.16.840.1.101.3.4.1.26": { name: "AES-GCM", length: 192 }, - "2.16.840.1.101.3.4.1.46": { name: "AES-GCM", length: 256 }, - "2.16.840.1.101.3.4.1.4": { name: "AES-CFB", length: 128 }, - "2.16.840.1.101.3.4.1.24": { name: "AES-CFB", length: 192 }, - "2.16.840.1.101.3.4.1.44": { name: "AES-CFB", length: 256 }, - "2.16.840.1.101.3.4.1.5": { name: "AES-KW", length: 128 }, - "2.16.840.1.101.3.4.1.25": { name: "AES-KW", length: 192 }, - "2.16.840.1.101.3.4.1.45": { name: "AES-KW", length: 256 }, - "1.2.840.113549.2.7": { name: "HMAC", hash: { name: "SHA-1" } }, - "1.2.840.113549.2.9": { name: "HMAC", hash: { name: "SHA-256" } }, - "1.2.840.113549.2.10": { name: "HMAC", hash: { name: "SHA-384" } }, - "1.2.840.113549.2.11": { name: "HMAC", hash: { name: "SHA-512" } }, - "1.2.840.113549.1.9.16.3.5": { name: "DH" }, - "1.3.14.3.2.26": { name: "SHA-1" }, - "2.16.840.1.101.3.4.2.1": { name: "SHA-256" }, - "2.16.840.1.101.3.4.2.2": { name: "SHA-384" }, - "2.16.840.1.101.3.4.2.3": { name: "SHA-512" }, - "1.2.840.113549.1.5.12": { name: "PBKDF2" }, - "1.2.840.10045.3.1.7": { name: "P-256" }, - "1.3.132.0.34": { name: "P-384" }, - "1.3.132.0.35": { - name: "P-521" - } - }[r2]; - if (e === void 0) throw new Error(`Unsupported algorithm identifier: ${r2}`); - return e; -} -__name(Ft, "Ft"); -function Ot(r2, e = []) { - return Object.values(r2).forEach((t) => { - typeof t == "string" ? e = [...e, t] : e = Ot(t, e); - }), e; -} -__name(Ot, "Ot"); -function Pt(r2) { - return Ot(r2).join(" / "); -} -__name(Pt, "Pt"); -var ce = [ - "digitalSignature", - "nonRepudiation", - "keyEncipherment", - "dataEncipherment", - "keyAgreement", - "keyCertSign", - "cRLSign", - "encipherOnly", - "decipherOnly" -]; -var X = class r { - static { - __name(this, "r"); - } - serialNumber; - algorithm; - issuer; - validityPeriod; - subject; - publicKey; - signature; - keyUsage; - subjectAltNames; - extKeyUsage; - authorityKeyIdentifier; - subjectKeyIdentifier; - basicConstraints; - signedData; - static distinguishedNamesAreEqual(e, t) { - return mt(e) === mt(t); - } - static readableDN(e) { - return Object.entries(e).map((t) => t.join( - "=" - )).join(", "); - } - constructor(e) { - let t = e instanceof M ? e : new M(e); - t.expectUint8( - U, - 0 - ); - let [i] = t.expectASN1Length(0), n = t.offset; - t.expectUint8(U, 0); - let [a] = t.expectASN1Length( - 0 - ); - t.expectBytes([160, 3, 2, 1, 2], 0), t.expectUint8(tt, 0); - let [c, s] = t.expectASN1Length( - 0 - ); - this.serialNumber = t.subarray(s()), c(), t.expectUint8(U, 0); - let [o, h] = t.expectASN1Length( - 0 - ); - t.expectUint8(Q, 0), this.algorithm = t.readASN1OID(), h() > 0 && (t.expectUint8(ft, 0), t.expectUint8(0, 0)), o(), this.issuer = Ct(t, "issuer"), t.expectUint8(U, 0); - let [y] = t.expectASN1Length( - 0 - ); - t.expectUint8(bt, 0); - let d = t.readASN1UTCTime(); - t.expectUint8(bt, 0); - let m = t.readASN1UTCTime(); - this.validityPeriod = { notBefore: d, notAfter: m }, y(), this.subject = Ct(t, "subject"); - let g = t.offset; - t.expectUint8(U, 0); - let [A] = t.expectASN1Length(0); - t.expectUint8(U, 0); - let [ - L, - f - ] = t.expectASN1Length(0), u = []; - for (; f() > 0; ) { - let H = t.readUint8(); - if (H === Q) { - let z = t.readASN1OID(); - u.push(z); - } else H === ft && t.expectUint8(0, 0); - } - L(), t.expectUint8(ut, 0); - let x = t.readASN1BitString(); - this.publicKey = { identifiers: u, data: x, all: t.data.subarray( - g, - t.offset - ) }, A(), t.expectUint8($t, 0); - let [T] = t.expectASN1Length(); - t.expectUint8( - U, - 0 - ); - let [$, P] = t.expectASN1Length(0); - for (; P() > 0; ) { - t.expectUint8(U, 0); - let [H, z] = t.expectASN1Length(); - t.expectUint8(Q, 0); - let B = t.readASN1OID(); - if (B === "2.5.29.17") { - t.expectUint8(_, 0); - let [k] = t.expectASN1Length(0); - t.expectUint8(U, 0); - let b = Bt(t, W); - this.subjectAltNames = b.filter((C) => C.type === (2 | W)).map((C) => C.name), k(); - } else if (B === "2.5.29.15") { - t.expectUint8( - gt, - 0 - ); - let k = t.readASN1Boolean(); - t.expectUint8(_, 0); - let [b] = t.expectASN1Length(0); - t.expectUint8(ut, 0); - let C = t.readASN1BitString(), E = qt(C), I = new Set(ce.filter((w, j) => E & 1 << j)); - b(), this.keyUsage = { critical: k, usages: I }; - } else if (B === "2.5.29.37") { - this.extKeyUsage = {}, t.expectUint8(_, 0); - let [k] = t.expectASN1Length(0); - t.expectUint8(U, 0); - let [b, C] = t.expectASN1Length(0); - for (; C() > 0; ) { - t.expectUint8(Q, 0); - let E = t.readASN1OID(); - E === "1.3.6.1.5.5.7.3.1" && (this.extKeyUsage.serverTls = true), E === "1.3.6.1.5.5.7.3.2" && (this.extKeyUsage.clientTls = true); - } - b(), k(); - } else if (B === "2.5.29.35") { - t.expectUint8(_, 0); - let [ - k - ] = t.expectASN1Length(0); - t.expectUint8(U, 0); - let [b, C] = t.expectASN1Length(0); - for (; C() > 0; ) { - let E = t.readUint8(); - if (E === (W | 0)) { - let [I, w] = t.expectASN1Length(0); - this.authorityKeyIdentifier = t.readBytes(w()), I(); - } else if (E === (W | 1)) { - let [I, w] = t.expectASN1Length(0); - t.skip( - w(), - 0 - ), I(); - } else if (E === (W | 2)) { - let [I, w] = t.expectASN1Length(0); - t.skip(w(), 0), I(); - } else if (E === (W | 33)) { - let [I, w] = t.expectASN1Length(0); - t.skip(w(), 0), I(); - } else throw new Error(`Unexpected data type ${E} in authorityKeyIdentifier certificate extension`); - } - b(), k(); - } else if (B === "2.5.29.14") { - t.expectUint8(_, 0); - let [k] = t.expectASN1Length(0); - t.expectUint8(_, 0); - let [b, C] = t.expectASN1Length(0); - this.subjectKeyIdentifier = t.readBytes(C()), b(), k(); - } else if (B === "2.5.29.19") { - let k, b = t.readUint8(); - if (b === gt && (k = t.readASN1Boolean(), b = t.readUint8()), b !== _) throw new Error("Unexpected type in certificate basic constraints"); - let [C] = t.expectASN1Length(0); - t.expectUint8(U, 0); - let [E, I] = t.expectASN1Length(), w; - I() > 0 && (t.expectUint8(gt, 0), w = t.readASN1Boolean()); - let j; - if (I() > 0) { - t.expectUint8(tt, 0); - let J = t.readASN1Length(0); - if (j = J === 1 ? t.readUint8() : J === 2 ? t.readUint16() : J === 3 ? t.readUint24() : void 0, j === void 0) throw new Error("Too many bytes in max path length in certificate basicConstraints"); - } - E(), C(), this.basicConstraints = { critical: k, ca: w, pathLength: j }; - } else - t.skip(z(), 0); - H(); - } - $(), T(), a(), this.signedData = t.data.subarray(n, t.offset), t.expectUint8( - U, - 0 - ); - let [q, G] = t.expectASN1Length(0); - t.expectUint8(Q, 0); - let D = t.readASN1OID(); - if (G() > 0 && (t.expectUint8(ft, 0), t.expectUint8(0, 0)), q(), D !== this.algorithm) throw new Error( - `Certificate specifies different signature algorithms inside (${this.algorithm}) and out (${D})` - ); - t.expectUint8(ut, 0), this.signature = t.readASN1BitString(), i(); - } - static fromPEM(e) { - let t = "[A-Z0-9 ]+", i = new RegExp(`-{5}BEGIN ${t}-{5}([a-zA-Z0-9=+\\/\\n\\r]+)-{5}END ${t}-{5}`, "g"), n = [], a = null; - for (; a = i.exec(e); ) { - let c = a[1].replace(/[\r\n]/g, ""), s = Dt(c), o = new this(s); - n.push(o); - } - return n; - } - subjectAltNameMatchingHost(e) { - let t = /[.][^.]+[.][^.]+$/; - return (this.subjectAltNames ?? []).find((i) => { - let n = i, a = e; - if (t.test(e) && t.test(n) && n.startsWith("*.") && (n = n.slice(1), a = a.slice(a.indexOf("."))), n === a) return true; - }); - } - isValidAtMoment(e = /* @__PURE__ */ new Date()) { - return e >= this.validityPeriod.notBefore && e <= this.validityPeriod.notAfter; - } - description() { - return "subject: " + r.readableDN(this.subject) + (this.subjectAltNames ? ` -subject alt names: ` + this.subjectAltNames.join(", ") : "") + (this.subjectKeyIdentifier ? ` -subject key id: ${K(this.subjectKeyIdentifier, " ")}` : "") + ` -issuer: ` + r.readableDN(this.issuer) + (this.authorityKeyIdentifier ? ` -authority key id: ${K(this.authorityKeyIdentifier, " ")}` : "") + ` -validity: ` + this.validityPeriod.notBefore.toISOString() + " \u2013 " + this.validityPeriod.notAfter.toISOString() + ` (${this.isValidAtMoment() ? "currently valid" : "not valid"})` + (this.keyUsage ? ` -key usage (${this.keyUsage.critical ? "critical" : "non-critical"}): ` + [...this.keyUsage.usages].join(", ") : "") + (this.extKeyUsage ? ` -extended key usage: TLS server \u2014\xA0${this.extKeyUsage.serverTls}, TLS client \u2014\xA0${this.extKeyUsage.clientTls}` : "") + (this.basicConstraints ? ` -basic constraints (${this.basicConstraints.critical ? "critical" : "non-critical"}): CA \u2014\xA0${this.basicConstraints.ca}, path length \u2014 ${this.basicConstraints.pathLength}` : "") + ` -signature algorithm: ` + Pt(Ft(this.algorithm)); - } - toJSON() { - return { - serialNumber: [...this.serialNumber], - algorithm: this.algorithm, - issuer: this.issuer, - validityPeriod: { notBefore: this.validityPeriod.notBefore.toISOString(), notAfter: this.validityPeriod.notAfter.toISOString() }, - subject: this.subject, - publicKey: { identifiers: this.publicKey.identifiers, data: [...this.publicKey.data], all: [...this.publicKey.all] }, - signature: [...this.signature], - keyUsage: { - critical: this.keyUsage?.critical, - usages: [...this.keyUsage?.usages ?? []] - }, - subjectAltNames: this.subjectAltNames, - extKeyUsage: this.extKeyUsage, - authorityKeyIdentifier: this.authorityKeyIdentifier && [...this.authorityKeyIdentifier], - subjectKeyIdentifier: this.subjectKeyIdentifier && [...this.subjectKeyIdentifier], - basicConstraints: this.basicConstraints, - signedData: [ - ...this.signedData - ] - }; - } -}; -var st = class extends X { - static { - __name(this, "st"); - } -}; -async function pt(r2, e, t, i, n) { - r2.expectUint8(U, 0); - let [a] = r2.expectASN1Length(0); - r2.expectUint8( - tt, - 0 - ); - let [c, s] = r2.expectASN1Length(0), o = r2.readBytes(s()); - c(), r2.expectUint8(tt, 0); - let [h, y] = r2.expectASN1Length(0), d = r2.readBytes(y()); - h(), a(); - let m = /* @__PURE__ */ __name((u, x) => u.length > x ? u.subarray(u.length - x) : u.length < x ? p(new Uint8Array(x - u.length), u) : u, "m"), g = i === "P-256" ? 32 : 48, A = p(m(o, g), m(d, g)), L = await l.importKey( - "spki", - e, - { name: "ECDSA", namedCurve: i }, - false, - ["verify"] - ); - if (await l.verify({ name: "ECDSA", hash: n }, L, A, t) !== true) throw new Error( - "ECDSA-SECP256R1-SHA256 certificate verify failed" - ); -} -__name(pt, "pt"); -async function jt(r2, e, t, i = true, n = true) { - for (let h of e) ; - let a = e[0]; - if (a.subjectAltNameMatchingHost( - r2 - ) === void 0) throw new Error(`No matching subjectAltName for ${r2}`); - if (!a.isValidAtMoment()) - throw new Error("End-user certificate is not valid now"); - if (i && !a.extKeyUsage?.serverTls) - throw new Error("End-user certificate has no TLS server extKeyUsage"); - let o = false; - for (let h of t) - ; - for (let h = 0, y = e.length; h < y; h++) { - let d = e[h], m = d.authorityKeyIdentifier, g; - if (m === void 0 ? g = t.find((f) => X.distinguishedNamesAreEqual(f.subject, d.issuer)) : g = t.find((f) => f.subjectKeyIdentifier !== void 0 && O(f.subjectKeyIdentifier, m)), g === void 0 && (g = e[h + 1]), g === void 0) throw new Error("Ran out of certificates before reaching trusted root"); - let A = g instanceof st; - if (g.isValidAtMoment() !== true) throw new Error("Signing certificate is not valid now"); - if (n && g.keyUsage?.usages.has("digitalSignature") !== true) - throw new Error("Signing certificate keyUsage does not include digital signatures"); - if (g.basicConstraints?.ca !== true) throw new Error("Signing certificate basicConstraints do not indicate a CA certificate"); - let { pathLength: L } = g.basicConstraints; - if (L !== void 0 && L < h) throw new Error("Exceeded certificate pathLength"); - if (d.algorithm === "1.2.840.10045.4.3.2" || d.algorithm === "1.2.840.10045.4.3.3") { - let f = d.algorithm === "1.2.840.10045.4.3.2" ? "SHA-256" : "SHA-384", u = g.publicKey.identifiers, x = u.includes( - "1.2.840.10045.3.1.7" - ) ? "P-256" : u.includes("1.3.132.0.34") ? "P-384" : void 0; - if (x === void 0) throw new Error("Unsupported signing key curve"); - let T = new M(d.signature); - await pt(T, g.publicKey.all, d.signedData, x, f); - } else if (d.algorithm === "1.2.840.113549.1.1.11" || d.algorithm === "1.2.840.113549.1.1.12") { - let f = d.algorithm === "1.2.840.113549.1.1.11" ? "SHA-256" : "SHA-384", u = await l.importKey("spki", g.publicKey.all, { name: "RSASSA-PKCS1-v1_5", hash: f }, false, ["verify"]); - if (await l.verify({ name: "RSASSA-PKCS1-v1_5" }, u, d.signature, d.signedData) !== true) throw new Error("RSASSA_PKCS1-v1_5-SHA256 certificate verify failed"); - } else throw new Error("Unsupported signing algorithm"); - if (A) { - o = true; - break; - } - } - return o; -} -__name(jt, "jt"); -var oe = new TextEncoder(); -async function Vt(r2, e, t, i, n, a = true, c = true) { - let s = new M(await e()); - s.expectUint8(8, 0); - let [o] = s.expectLengthUint24(), [h, y] = s.expectLengthUint16(0); - for (; y() > 0; ) { - let R = s.readUint16(0); - if (R === 0) s.expectUint16(0, 0); - else if (R === 10) { - let [V, F] = s.expectLengthUint16("groups data"); - s.skip(F(), 0), V(); - } else throw new Error(`Unsupported server encrypted extension type 0x${K([R]).padStart(4, "0")}`); - } - h(), o(), s.remaining() === 0 && s.extend(await e()); - let d = false, m = s.readUint8(); - if (m === 13) { - d = true; - let [R] = s.expectLengthUint24( - "certificate request data" - ); - s.expectUint8(0, 0); - let [V, F] = s.expectLengthUint16("certificate request extensions"); - s.skip(F(), 0), V(), R(), s.remaining() === 0 && s.extend( - await e() - ), m = s.readUint8(); - } - if (m !== 11) throw new Error(`Unexpected handshake message type 0x${K([m])}`); - let [g] = s.expectLengthUint24(0); - s.expectUint8(0, 0); - let [A, L] = s.expectLengthUint24(0), f = []; - for (; L() > 0; ) { - let [R] = s.expectLengthUint24(0), V = new X(s); - f.push(V), R(); - let [F, et] = s.expectLengthUint16(), wt = s.subarray(et()); - F(); - } - if (A(), g(), f.length === 0) throw new Error("No certificates supplied"); - let u = f[0], x = s.data.subarray( - 0, - s.offset - ), T = p(i, x), $ = await l.digest("SHA-256", T), P = new Uint8Array($), q = p(oe.encode( - " ".repeat(64) + "TLS 1.3, server CertificateVerify" - ), [0], P); - s.remaining() === 0 && s.extend(await e()), s.expectUint8(15, 0); - let [G] = s.expectLengthUint24(0), D = s.readUint16(); - if (D === 1027) { - let [R] = s.expectLengthUint16(); - await pt( - s, - u.publicKey.all, - q, - "P-256", - "SHA-256" - ), R(); - } else if (D === 2052) { - let [R, V] = s.expectLengthUint16(), F = s.subarray(V()); - R(); - let et = await l.importKey("spki", u.publicKey.all, { name: "RSA-PSS", hash: "SHA-256" }, false, ["verify"]); - if (await l.verify({ name: "RSA-PSS", saltLength: 32 }, et, F, q) !== true) - throw new Error("RSA-PSS-RSAE-SHA256 certificate verify failed"); - } else throw new Error( - `Unsupported certificate verify signature type 0x${K([D]).padStart(4, "0")}` - ); - G(); - let H = s.data.subarray(0, s.offset), z = p(i, H), B = await S(t, "finished", new Uint8Array( - 0 - ), 32, 256), k = await l.digest("SHA-256", z), b = await l.importKey("raw", B, { - name: "HMAC", - hash: { name: "SHA-256" } - }, false, ["sign"]), C = await l.sign("HMAC", b, k), E = new Uint8Array( - C - ); - s.remaining() === 0 && s.extend(await e()), s.expectUint8(20, 0); - let [I, w] = s.expectLengthUint24( - 0 - ), j = s.readBytes(w()); - if (I(), s.remaining() !== 0) throw new Error("Unexpected extra bytes in server handshake"); - if (O(j, E) !== true) throw new Error("Invalid server verify hash"); - if (!await jt(r2, f, n, a, c)) throw new Error("Validated certificate chain did not end in a trusted root"); - return [s.data, d]; -} -__name(Vt, "Vt"); -async function he(r2, e, t, i, { - useSNI: n, - requireServerTlsExtKeyUsage: a, - requireDigitalSigKeyUsage: c, - writePreData: s, - expectPreData: o, - commentPreData: h -} = {}) { - n ??= true, a ??= true, c ??= true; - let y = await l.generateKey({ name: "ECDH", namedCurve: "P-256" }, true, ["deriveKey", "deriveBits"]), d = await l.exportKey("raw", y.publicKey), m = new Uint8Array(32); - crypto.getRandomValues(m); - let A = St( - r2, - d, - m, - n - ).array(), L = s ? p(s, A) : A; - if (i(L), o) { - let v = await t(o.length); - if (!v || !O(v, o)) - throw new Error("Pre data did not match expectation"); - } - let f = await ht(t, 22); - if (f === void 0) throw new Error("Connection closed while awaiting server hello"); - let u = new N( - f.content - ), x = Ut(u, m), T = await ht(t, 20); - if (T === void 0) throw new Error("Connection closed awaiting server cipher change"); - let $ = new N(T.content), [P] = $.expectLength( - 1 - ); - $.expectUint8(1, 0), P(); - let q = A.subarray(5), G = f.content, D = p(q, G), H = await Kt( - x, - y.privateKey, - D, - 256, - 16 - ), z = await l.importKey("raw", H.serverHandshakeKey, { name: "AES-GCM" }, false, ["decrypt"]), B = new Z("decrypt", z, H.serverHandshakeIV), k = await l.importKey( - "raw", - H.clientHandshakeKey, - { name: "AES-GCM" }, - false, - ["encrypt"] - ), b = new Z( - "encrypt", - k, - H.clientHandshakeIV - ), C = /* @__PURE__ */ __name(async () => { - let v = await dt(t, B, 22); - if (v === void 0) throw new Error( - "Premature end of encrypted server handshake" - ); - return v; - }, "C"), [E, I] = await Vt( - r2, - C, - H.serverSecret, - D, - e, - a, - c - ), w = new N(6); - w.writeUint8(20, 0), w.writeUint16(771, 0); - let j = w.writeLengthUint16(); - w.writeUint8(1, 0), j(); - let J = w.array(), Y = new Uint8Array(0); - if (I) { - let v = new N(8); - v.writeUint8(11, 0); - let nt = v.writeLengthUint24("client certificate data"); - v.writeUint8( - 0, - 0 - ), v.writeUint24(0, 0), nt(), Y = v.array(); - } - let R = p(D, E, Y), V = await l.digest("SHA-256", R), F = new Uint8Array(V), et = await S( - H.clientSecret, - "finished", - new Uint8Array(0), - 32, - 256 - ), wt = await l.importKey("raw", et, { name: "HMAC", hash: { name: "SHA-256" } }, false, ["sign"]), Mt = await l.sign("HMAC", wt, F), _t = new Uint8Array(Mt), at = new N(36); - at.writeUint8( - 20, - 0 - ); - let Gt = at.writeLengthUint24(0); - at.writeBytes(_t), Gt(); - let zt = at.array(), kt = await At( - p(Y, zt), - b, - 22 - ), Et = F; - if (Y.length > 0) { - let v = R.subarray(0, R.length - Y.length), nt = await l.digest("SHA-256", v); - Et = new Uint8Array(nt); - } - let ct = await Tt( - H.handshakeSecret, - Et, - 256, - 16 - ), Jt = await l.importKey("raw", ct.clientApplicationKey, { name: "AES-GCM" }, true, ["encrypt"]), Zt = new Z("encrypt", Jt, ct.clientApplicationIV), Qt = await l.importKey( - "raw", - ct.serverApplicationKey, - { name: "AES-GCM" }, - true, - ["decrypt"] - ), Wt = new Z("decrypt", Qt, ct.serverApplicationIV), ot = false; - return [() => { - if (!ot) { - let v = p(J, ...kt); - i(v), ot = true; - } - return dt( - t, - Wt - ); - }, async (v) => { - let nt = ot; - ot = true; - let It = await At(v, Zt, 23), Xt = nt ? p(...It) : p( - J, - ...kt, - ...It - ); - i(Xt); - }]; -} -__name(he, "he"); -var xt = class { - static { - __name(this, "xt"); - } - queue; - outstandingRequest; - constructor() { - this.queue = []; - } - enqueue(e) { - this.queue.push(e), this.dequeue(); - } - dequeue() { - if (this.outstandingRequest === void 0) return; - let { resolve: e, bytes: t } = this.outstandingRequest, i = this.bytesInQueue(); - if (i < t && this.socketIsNotClosed()) return; - if (t = Math.min(t, i), t === 0) return e(void 0); - this.outstandingRequest = void 0; - let n = this.queue[0], a = n.length; - if (a === t) return this.queue.shift(), e(n); - if (a > t) return this.queue[0] = n.subarray(t), e(n.subarray(0, t)); - { - let c = new Uint8Array(t), s = t, o = 0; - for (; s > 0; ) { - let h = this.queue[0], y = h.length; - y <= s ? (this.queue.shift(), c.set( - h, - o - ), o += y, s -= y) : (this.queue[0] = h.subarray(s), c.set(h.subarray(0, s), o), s -= s, o += s); - } - return e(c); - } - } - bytesInQueue() { - return this.queue.reduce((e, t) => e + t.length, 0); - } - async read(e) { - if (this.outstandingRequest !== void 0) throw new Error("Can\u2019t read while already awaiting read"); - return new Promise((t) => { - this.outstandingRequest = { resolve: t, bytes: e }, this.dequeue(); - }); - } -}; -var vt = class extends xt { - static { - __name(this, "vt"); - } - constructor(t) { - super(); - this.socket = t; - t.addEventListener( - "message", - (i) => this.enqueue(new Uint8Array(i.data)) - ), t.addEventListener("close", () => this.dequeue()); - } - socketIsNotClosed() { - let { socket: t } = this, { readyState: i } = t; - return i <= 1; - } -}; -var Lt = class extends xt { - static { - __name(this, "Lt"); - } - constructor(t) { - super(); - this.socket = t; - t.on("data", (i) => this.enqueue( - new Uint8Array(i) - )), t.on("close", () => this.dequeue()); - } - socketIsNotClosed() { - let { socket: t } = this, { readyState: i } = t; - return i === "opening" || i === "open"; - } -}; - -// src/isrgrootx1.pem -var isrgrootx1_default = "-----BEGIN CERTIFICATE-----\nMIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw\nTzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh\ncmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4\nWhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu\nZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY\nMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc\nh77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+\n0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U\nA5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW\nT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH\nB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC\nB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv\nKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn\nOlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn\njh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw\nqHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI\nrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV\nHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq\nhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL\nubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ\n3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK\nNFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5\nORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur\nTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC\njNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc\noyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq\n4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA\nmRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d\nemyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=\n-----END CERTIFICATE-----\n"; - -// node_modules/fast-equals/dist/esm/index.mjs -init_shims(); -var getOwnPropertyNames = Object.getOwnPropertyNames; -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -function combineComparators(comparatorA, comparatorB) { - return /* @__PURE__ */ __name(function isEqual(a, b, state) { - return comparatorA(a, b, state) && comparatorB(a, b, state); - }, "isEqual"); -} -__name(combineComparators, "combineComparators"); -function createIsCircular(areItemsEqual) { - return /* @__PURE__ */ __name(function isCircular(a, b, state) { - if (!a || !b || typeof a !== "object" || typeof b !== "object") { - return areItemsEqual(a, b, state); - } - var cache = state.cache; - var cachedA = cache.get(a); - var cachedB = cache.get(b); - if (cachedA && cachedB) { - return cachedA === b && cachedB === a; - } - cache.set(a, b); - cache.set(b, a); - var result = areItemsEqual(a, b, state); - cache.delete(a); - cache.delete(b); - return result; - }, "isCircular"); -} -__name(createIsCircular, "createIsCircular"); -function getStrictProperties(object) { - return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object)); -} -__name(getStrictProperties, "getStrictProperties"); -var hasOwn = Object.hasOwn || function(object, property) { - return hasOwnProperty.call(object, property); -}; -function sameValueZeroEqual(a, b) { - return a || b ? a === b : a === b || a !== a && b !== b; -} -__name(sameValueZeroEqual, "sameValueZeroEqual"); -var OWNER = "_owner"; -var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; -var keys = Object.keys; -function areArraysEqual(a, b, state) { - var index = a.length; - if (b.length !== index) { - return false; - } - while (index-- > 0) { - if (!state.equals(a[index], b[index], index, index, a, b, state)) { - return false; - } - } - return true; -} -__name(areArraysEqual, "areArraysEqual"); -function areDatesEqual(a, b) { - return sameValueZeroEqual(a.getTime(), b.getTime()); -} -__name(areDatesEqual, "areDatesEqual"); -function areMapsEqual(a, b, state) { - if (a.size !== b.size) { - return false; - } - var matchedIndices = {}; - var aIterable = a.entries(); - var index = 0; - var aResult; - var bResult; - while (aResult = aIterable.next()) { - if (aResult.done) { - break; - } - var bIterable = b.entries(); - var hasMatch = false; - var matchIndex = 0; - while (bResult = bIterable.next()) { - if (bResult.done) { - break; - } - var _a = aResult.value, aKey = _a[0], aValue = _a[1]; - var _b = bResult.value, bKey = _b[0], bValue = _b[1]; - if (!hasMatch && !matchedIndices[matchIndex] && (hasMatch = state.equals(aKey, bKey, index, matchIndex, a, b, state) && state.equals(aValue, bValue, aKey, bKey, a, b, state))) { - matchedIndices[matchIndex] = true; - } - matchIndex++; - } - if (!hasMatch) { - return false; - } - index++; - } - return true; -} -__name(areMapsEqual, "areMapsEqual"); -function areObjectsEqual(a, b, state) { - var properties = keys(a); - var index = properties.length; - if (keys(b).length !== index) { - return false; - } - var property; - while (index-- > 0) { - property = properties[index]; - if (property === OWNER && (a.$$typeof || b.$$typeof) && a.$$typeof !== b.$$typeof) { - return false; - } - if (!hasOwn(b, property) || !state.equals(a[property], b[property], property, property, a, b, state)) { - return false; - } - } - return true; -} -__name(areObjectsEqual, "areObjectsEqual"); -function areObjectsEqualStrict(a, b, state) { - var properties = getStrictProperties(a); - var index = properties.length; - if (getStrictProperties(b).length !== index) { - return false; - } - var property; - var descriptorA; - var descriptorB; - while (index-- > 0) { - property = properties[index]; - if (property === OWNER && (a.$$typeof || b.$$typeof) && a.$$typeof !== b.$$typeof) { - return false; - } - if (!hasOwn(b, property)) { - return false; - } - if (!state.equals(a[property], b[property], property, property, a, b, state)) { - return false; - } - descriptorA = getOwnPropertyDescriptor(a, property); - descriptorB = getOwnPropertyDescriptor(b, property); - if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) { - return false; - } - } - return true; -} -__name(areObjectsEqualStrict, "areObjectsEqualStrict"); -function arePrimitiveWrappersEqual(a, b) { - return sameValueZeroEqual(a.valueOf(), b.valueOf()); -} -__name(arePrimitiveWrappersEqual, "arePrimitiveWrappersEqual"); -function areRegExpsEqual(a, b) { - return a.source === b.source && a.flags === b.flags; -} -__name(areRegExpsEqual, "areRegExpsEqual"); -function areSetsEqual(a, b, state) { - if (a.size !== b.size) { - return false; - } - var matchedIndices = {}; - var aIterable = a.values(); - var aResult; - var bResult; - while (aResult = aIterable.next()) { - if (aResult.done) { - break; - } - var bIterable = b.values(); - var hasMatch = false; - var matchIndex = 0; - while (bResult = bIterable.next()) { - if (bResult.done) { - break; - } - if (!hasMatch && !matchedIndices[matchIndex] && (hasMatch = state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state))) { - matchedIndices[matchIndex] = true; - } - matchIndex++; - } - if (!hasMatch) { - return false; - } - } - return true; -} -__name(areSetsEqual, "areSetsEqual"); -function areTypedArraysEqual(a, b) { - var index = a.length; - if (b.length !== index) { - return false; - } - while (index-- > 0) { - if (a[index] !== b[index]) { - return false; - } - } - return true; -} -__name(areTypedArraysEqual, "areTypedArraysEqual"); -var ARGUMENTS_TAG = "[object Arguments]"; -var BOOLEAN_TAG = "[object Boolean]"; -var DATE_TAG = "[object Date]"; -var MAP_TAG = "[object Map]"; -var NUMBER_TAG = "[object Number]"; -var OBJECT_TAG = "[object Object]"; -var REG_EXP_TAG = "[object RegExp]"; -var SET_TAG = "[object Set]"; -var STRING_TAG = "[object String]"; -var isArray = Array.isArray; -var isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView ? ArrayBuffer.isView : null; -var assign = Object.assign; -var getTag = Object.prototype.toString.call.bind(Object.prototype.toString); -function createEqualityComparator(_a) { - var areArraysEqual2 = _a.areArraysEqual, areDatesEqual2 = _a.areDatesEqual, areMapsEqual2 = _a.areMapsEqual, areObjectsEqual2 = _a.areObjectsEqual, arePrimitiveWrappersEqual2 = _a.arePrimitiveWrappersEqual, areRegExpsEqual2 = _a.areRegExpsEqual, areSetsEqual2 = _a.areSetsEqual, areTypedArraysEqual2 = _a.areTypedArraysEqual; - return /* @__PURE__ */ __name(function comparator(a, b, state) { - if (a === b) { - return true; - } - if (a == null || b == null || typeof a !== "object" || typeof b !== "object") { - return a !== a && b !== b; - } - var constructor = a.constructor; - if (constructor !== b.constructor) { - return false; - } - if (constructor === Object) { - return areObjectsEqual2(a, b, state); - } - if (isArray(a)) { - return areArraysEqual2(a, b, state); - } - if (isTypedArray != null && isTypedArray(a)) { - return areTypedArraysEqual2(a, b, state); - } - if (constructor === Date) { - return areDatesEqual2(a, b, state); - } - if (constructor === RegExp) { - return areRegExpsEqual2(a, b, state); - } - if (constructor === Map) { - return areMapsEqual2(a, b, state); - } - if (constructor === Set) { - return areSetsEqual2(a, b, state); - } - var tag = getTag(a); - if (tag === DATE_TAG) { - return areDatesEqual2(a, b, state); - } - if (tag === REG_EXP_TAG) { - return areRegExpsEqual2(a, b, state); - } - if (tag === MAP_TAG) { - return areMapsEqual2(a, b, state); - } - if (tag === SET_TAG) { - return areSetsEqual2(a, b, state); - } - if (tag === OBJECT_TAG) { - return typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual2(a, b, state); - } - if (tag === ARGUMENTS_TAG) { - return areObjectsEqual2(a, b, state); - } - if (tag === BOOLEAN_TAG || tag === NUMBER_TAG || tag === STRING_TAG) { - return arePrimitiveWrappersEqual2(a, b, state); - } - return false; - }, "comparator"); -} -__name(createEqualityComparator, "createEqualityComparator"); -function createEqualityComparatorConfig(_a) { - var circular = _a.circular, createCustomConfig = _a.createCustomConfig, strict = _a.strict; - var config = { - areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual, - areDatesEqual, - areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual, - areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual, - arePrimitiveWrappersEqual, - areRegExpsEqual, - areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual, - areTypedArraysEqual: strict ? areObjectsEqualStrict : areTypedArraysEqual - }; - if (createCustomConfig) { - config = assign({}, config, createCustomConfig(config)); - } - if (circular) { - var areArraysEqual$1 = createIsCircular(config.areArraysEqual); - var areMapsEqual$1 = createIsCircular(config.areMapsEqual); - var areObjectsEqual$1 = createIsCircular(config.areObjectsEqual); - var areSetsEqual$1 = createIsCircular(config.areSetsEqual); - config = assign({}, config, { - areArraysEqual: areArraysEqual$1, - areMapsEqual: areMapsEqual$1, - areObjectsEqual: areObjectsEqual$1, - areSetsEqual: areSetsEqual$1 - }); - } - return config; -} -__name(createEqualityComparatorConfig, "createEqualityComparatorConfig"); -function createInternalEqualityComparator(compare) { - return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) { - return compare(a, b, state); - }; -} -__name(createInternalEqualityComparator, "createInternalEqualityComparator"); -function createIsEqual(_a) { - var circular = _a.circular, comparator = _a.comparator, createState = _a.createState, equals = _a.equals, strict = _a.strict; - if (createState) { - return /* @__PURE__ */ __name(function isEqual(a, b) { - var _a2 = createState(), _b = _a2.cache, cache = _b === void 0 ? circular ? /* @__PURE__ */ new WeakMap() : void 0 : _b, meta = _a2.meta; - return comparator(a, b, { - cache, - equals, - meta, - strict - }); - }, "isEqual"); - } - if (circular) { - return /* @__PURE__ */ __name(function isEqual(a, b) { - return comparator(a, b, { - cache: /* @__PURE__ */ new WeakMap(), - equals, - meta: void 0, - strict - }); - }, "isEqual"); - } - var state = { - cache: void 0, - equals, - meta: void 0, - strict - }; - return /* @__PURE__ */ __name(function isEqual(a, b) { - return comparator(a, b, state); - }, "isEqual"); -} -__name(createIsEqual, "createIsEqual"); -var deepEqual = createCustomEqual(); -var strictDeepEqual = createCustomEqual({ strict: true }); -var circularDeepEqual = createCustomEqual({ circular: true }); -var strictCircularDeepEqual = createCustomEqual({ - circular: true, - strict: true -}); -var shallowEqual = createCustomEqual({ - createInternalComparator: /* @__PURE__ */ __name(function() { - return sameValueZeroEqual; - }, "createInternalComparator") -}); -var strictShallowEqual = createCustomEqual({ - strict: true, - createInternalComparator: /* @__PURE__ */ __name(function() { - return sameValueZeroEqual; - }, "createInternalComparator") -}); -var circularShallowEqual = createCustomEqual({ - circular: true, - createInternalComparator: /* @__PURE__ */ __name(function() { - return sameValueZeroEqual; - }, "createInternalComparator") -}); -var strictCircularShallowEqual = createCustomEqual({ - circular: true, - createInternalComparator: /* @__PURE__ */ __name(function() { - return sameValueZeroEqual; - }, "createInternalComparator"), - strict: true -}); -function createCustomEqual(options) { - if (options === void 0) { - options = {}; - } - var _a = options.circular, circular = _a === void 0 ? false : _a, createCustomInternalComparator = options.createInternalComparator, createState = options.createState, _b = options.strict, strict = _b === void 0 ? false : _b; - var config = createEqualityComparatorConfig(options); - var comparator = createEqualityComparator(config); - var equals = createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator); - return createIsEqual({ circular, comparator, createState, equals, strict }); -} -__name(createCustomEqual, "createCustomEqual"); - -// export/index.ts -init_shims(); -var import_pg = __toESM(require_lib2()); -init_net(); - -// export/httpQuery.ts -init_shims(); -init_url(); -init_net(); -var import_utils = __toESM(require_utils()); -var import_type_overrides = __toESM(require_type_overrides()); -var NeonDbError = class extends Error { - static { - __name(this, "NeonDbError"); - } - name = "NeonDbError"; - severity; - code; - detail; - hint; - position; - internalPosition; - internalQuery; - where; - schema; - table; - column; - dataType; - constraint; - file; - line; - routine; - sourceError; -}; -var txnArgErrMsg = "transaction() expects an array of queries, or a function returning an array of queries"; -var errorFields = [ - "severity", - "code", - "detail", - "hint", - "position", - "internalPosition", - "internalQuery", - "where", - "schema", - "table", - "column", - "dataType", - "constraint", - "file", - "line", - "routine" -]; -function neon(connectionString, { - arrayMode: neonOptArrayMode, - fullResults: neonOptFullResults, - fetchOptions: neonOptFetchOptions, - isolationLevel: neonOptIsolationLevel, - readOnly: neonOptReadOnly, - deferrable: neonOptDeferrable, - queryCallback, - resultCallback, - authToken -} = {}) { - if (!connectionString) - throw new Error( - "No database connection string was provided to `neon()`. Perhaps an environment variable has not been set?" - ); - let db; - try { - db = parse(connectionString); - } catch { - throw new Error( - "Database connection string provided to `neon()` is not a valid URL. Connection string: " + String(connectionString) - ); - } - const { protocol, username, password, hostname, port, pathname } = db; - if (protocol !== "postgres:" && protocol !== "postgresql:" || !username || !hostname || !pathname) { - throw new Error( - "Database connection string format for `neon()` should be: postgresql://user:password@host.tld/dbname?option=value" - ); - } - function resolve(strings, ...params) { - let query; - let queryOpts; - if (typeof strings === "string") { - query = strings; - queryOpts = params[1]; - params = params[0] ?? []; - } else { - query = ""; - for (let i = 0; i < strings.length; i++) { - query += strings[i]; - if (i < params.length) query += "$" + (i + 1); - } - } - params = params.map((param) => (0, import_utils.prepareValue)(param)); - const parameterizedQuery = { query, params }; - if (queryCallback) queryCallback(parameterizedQuery); - return createNeonQueryPromise(execute, parameterizedQuery, queryOpts); - } - __name(resolve, "resolve"); - resolve.transaction = async (queries2, txnOpts) => { - if (typeof queries2 === "function") queries2 = queries2(resolve); - if (!Array.isArray(queries2)) throw new Error(txnArgErrMsg); - queries2.forEach((query) => { - if (query[Symbol.toStringTag] !== "NeonQueryPromise") - throw new Error(txnArgErrMsg); - }); - const parameterizedQueries = queries2.map( - (query) => query.parameterizedQuery - ); - const opts = queries2.map((query) => query.opts ?? {}); - return execute(parameterizedQueries, opts, txnOpts); - }; - async function execute(parameterizedQuery, allSqlOpts, txnOpts) { - const { fetchEndpoint, fetchFunction } = Socket; - const url = typeof fetchEndpoint === "function" ? fetchEndpoint(hostname, port, { - jwtAuth: authToken !== void 0 - }) : fetchEndpoint; - const bodyData = Array.isArray(parameterizedQuery) ? { queries: parameterizedQuery } : parameterizedQuery; - let resolvedFetchOptions = neonOptFetchOptions ?? {}; - let resolvedArrayMode = neonOptArrayMode ?? false; - let resolvedFullResults = neonOptFullResults ?? false; - let resolvedIsolationLevel = neonOptIsolationLevel; - let resolvedReadOnly = neonOptReadOnly; - let resolvedDeferrable = neonOptDeferrable; - if (txnOpts !== void 0) { - if (txnOpts.fetchOptions !== void 0) - resolvedFetchOptions = { - ...resolvedFetchOptions, - ...txnOpts.fetchOptions - }; - if (txnOpts.arrayMode !== void 0) - resolvedArrayMode = txnOpts.arrayMode; - if (txnOpts.fullResults !== void 0) - resolvedFullResults = txnOpts.fullResults; - if (txnOpts.isolationLevel !== void 0) - resolvedIsolationLevel = txnOpts.isolationLevel; - if (txnOpts.readOnly !== void 0) resolvedReadOnly = txnOpts.readOnly; - if (txnOpts.deferrable !== void 0) - resolvedDeferrable = txnOpts.deferrable; - } - if (allSqlOpts !== void 0 && !Array.isArray(allSqlOpts) && allSqlOpts.fetchOptions !== void 0) { - resolvedFetchOptions = { - ...resolvedFetchOptions, - ...allSqlOpts.fetchOptions - }; - } - const headers = { - "Neon-Connection-String": connectionString, - "Neon-Raw-Text-Output": "true", - // because we do our own parsing with node-postgres - "Neon-Array-Mode": "true" - // this saves data and post-processing even if we return objects, not arrays - }; - if (typeof authToken === "string") { - headers["Authorization"] = `Bearer ${authToken}`; - } else if (typeof authToken === "function") { - headers["Authorization"] = `Bearer ${Promise.resolve(authToken())}`; - } - if (Array.isArray(parameterizedQuery)) { - if (resolvedIsolationLevel !== void 0) - headers["Neon-Batch-Isolation-Level"] = resolvedIsolationLevel; - if (resolvedReadOnly !== void 0) - headers["Neon-Batch-Read-Only"] = String(resolvedReadOnly); - if (resolvedDeferrable !== void 0) - headers["Neon-Batch-Deferrable"] = String(resolvedDeferrable); - } - let response; - try { - response = await (fetchFunction ?? fetch)(url, { - method: "POST", - body: JSON.stringify(bodyData), - // TODO: use json-custom-numbers to allow BigInts? - headers, - ...resolvedFetchOptions - // this is last, so it gets the final say - }); - } catch (err) { - const connectErr = new NeonDbError( - `Error connecting to database: ${err.message}` - ); - connectErr.sourceError = err; - throw connectErr; - } - if (response.ok) { - const rawResults = await response.json(); - if (Array.isArray(parameterizedQuery)) { - const resultArray = rawResults.results; - if (!Array.isArray(resultArray)) - throw new NeonDbError( - "Neon internal error: unexpected result format" - ); - return resultArray.map((result, i) => { - let sqlOpts = allSqlOpts[i] ?? {}; - let arrayMode = sqlOpts.arrayMode ?? resolvedArrayMode; - let fullResults = sqlOpts.fullResults ?? resolvedFullResults; - return processQueryResult(result, { - arrayMode, - fullResults, - parameterizedQuery: parameterizedQuery[i], - resultCallback, - types: sqlOpts.types - }); - }); - } else { - let sqlOpts = allSqlOpts ?? {}; - let arrayMode = sqlOpts.arrayMode ?? resolvedArrayMode; - let fullResults = sqlOpts.fullResults ?? resolvedFullResults; - return processQueryResult(rawResults, { - arrayMode, - fullResults, - parameterizedQuery, - resultCallback, - types: sqlOpts.types - }); - } - } else { - const { status } = response; - if (status === 400) { - const json = await response.json(); - const dbError = new NeonDbError(json.message); - for (const field of errorFields) - dbError[field] = json[field] ?? void 0; - throw dbError; - } else { - const text = await response.text(); - throw new NeonDbError(`Server error (HTTP status ${status}): ${text}`); - } - } - } - __name(execute, "execute"); - return resolve; -} -__name(neon, "neon"); -function createNeonQueryPromise(execute, parameterizedQuery, opts) { - return { - [Symbol.toStringTag]: "NeonQueryPromise", - parameterizedQuery, - opts, - then: /* @__PURE__ */ __name((resolve, reject) => execute(parameterizedQuery, opts).then(resolve, reject), "then"), - catch: /* @__PURE__ */ __name((reject) => execute(parameterizedQuery, opts).catch(reject), "catch"), - finally: /* @__PURE__ */ __name((finallyFn) => execute(parameterizedQuery, opts).finally(finallyFn), "finally") - }; -} -__name(createNeonQueryPromise, "createNeonQueryPromise"); -function processQueryResult(rawResults, { - arrayMode, - fullResults, - parameterizedQuery, - resultCallback, - types: customTypes -}) { - const types2 = new import_type_overrides.default(customTypes); - const colNames = rawResults.fields.map((field) => field.name); - const parsers = rawResults.fields.map( - (field) => types2.getTypeParser(field.dataTypeID) - ); - const rows = arrayMode === true ? ( - // maintain array-of-arrays structure - rawResults.rows.map( - (row) => row.map( - (col, i) => col === null ? null : parsers[i](col) - ) - ) - ) : ( - // turn into an object - rawResults.rows.map((row) => { - return Object.fromEntries( - row.map((col, i) => [ - colNames[i], - col === null ? null : parsers[i](col) - ]) - ); - }) - ); - if (resultCallback) - resultCallback(parameterizedQuery, rawResults, rows, { - arrayMode, - fullResults - }); - if (fullResults) { - rawResults.viaNeonFetch = true; - rawResults.rowAsArray = arrayMode; - rawResults.rows = rows; - rawResults._parsers = parsers; - rawResults._types = types2; - return rawResults; - } - return rows; -} -__name(processQueryResult, "processQueryResult"); - -// export/index.ts -var import_connection_parameters = __toESM(require_connection_parameters()); -var import_pg2 = __toESM(require_lib2()); -var NeonClient = class extends import_pg.Client { - constructor(config) { - super(config); - this.config = config; - } - static { - __name(this, "NeonClient"); - } - get neonConfig() { - return this.connection.stream; - } - connect(callback) { - const { neonConfig } = this; - if (neonConfig.forceDisablePgSSL) { - this.ssl = this.connection.ssl = false; - } - if (this.ssl && neonConfig.useSecureWebSocket) { - console.warn( - `SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string + forceDisablePgSSL = false) and the WebSocket tunnel (useSecureWebSocket = true). Double encryption will increase latency and CPU usage. It may be appropriate to disable SSL in the Postgres connection parameters or set forceDisablePgSSL = true.` - ); - } - const hasConfiguredHost = this.config?.host !== void 0 || this.config?.connectionString !== void 0 || process.env.PGHOST !== void 0; - const defaultUser = process.env.USER ?? process.env.USERNAME; - if (!hasConfiguredHost && this.host === "localhost" && this.user === defaultUser && this.database === defaultUser && this.password === null) - throw new Error( - `No database host or connection string was set, and key parameters have default values (host: localhost, user: ${defaultUser}, db: ${defaultUser}, password: null). Is an environment variable missing? Alternatively, if you intended to connect with these parameters, please set the host to 'localhost' explicitly.` - ); - const result = super.connect(callback); - const pipelineTLS = neonConfig.pipelineTLS && this.ssl; - const pipelineConnect = neonConfig.pipelineConnect === "password"; - if (!pipelineTLS && !neonConfig.pipelineConnect) return result; - const con = this.connection; - if (pipelineTLS) { - con.on("connect", () => con.stream.emit("data", "S")); - } - if (pipelineConnect) { - con.removeAllListeners("authenticationCleartextPassword"); - con.removeAllListeners("readyForQuery"); - con.once( - "readyForQuery", - () => con.on("readyForQuery", this._handleReadyForQuery.bind(this)) - ); - const connectEvent = this.ssl ? "sslconnect" : "connect"; - con.on(connectEvent, () => { - this._handleAuthCleartextPassword(); - this._handleReadyForQuery(); - }); - } - return result; - } - async _handleAuthSASLContinue(msg) { - const session = this.saslSession; - const password = this.password; - const serverData = msg.data; - if (session.message !== "SASLInitialResponse" || typeof password !== "string" || typeof serverData !== "string") - throw new Error("SASL: protocol error"); - const attrPairs = Object.fromEntries( - serverData.split(",").map((attrValue) => { - if (!/^.=/.test(attrValue)) - throw new Error("SASL: Invalid attribute pair entry"); - const name = attrValue[0]; - const value = attrValue.substring(2); - return [name, value]; - }) - ); - const nonce = attrPairs.r; - const salt = attrPairs.s; - const iterationText = attrPairs.i; - if (!nonce || !/^[!-+--~]+$/.test(nonce)) - throw new Error( - "SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable" - ); - if (!salt || !/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test( - salt - )) - throw new Error( - "SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base64" - ); - if (!iterationText || !/^[1-9][0-9]*$/.test(iterationText)) - throw new Error( - "SASL: SCRAM-SERVER-FIRST-MESSAGE: missing/invalid iteration count" - ); - if (!nonce.startsWith(session.clientNonce)) - throw new Error( - "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce" - ); - if (nonce.length === session.clientNonce.length) - throw new Error( - "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short" - ); - const iterations = parseInt(iterationText, 10); - const saltBytes = Buffer2.from(salt, "base64"); - const enc = new TextEncoder(); - const passwordBytes = enc.encode(password); - const iterHmacKey = await crypto.subtle.importKey( - "raw", - passwordBytes, - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign"] - ); - let ui1 = new Uint8Array( - await crypto.subtle.sign( - "HMAC", - iterHmacKey, - Buffer2.concat([saltBytes, Buffer2.from([0, 0, 0, 1])]) - ) - ); - let ui = ui1; - for (var i = 0; i < iterations - 1; i++) { - ui1 = new Uint8Array(await crypto.subtle.sign("HMAC", iterHmacKey, ui1)); - ui = Buffer2.from(ui.map((_2, i2) => ui[i2] ^ ui1[i2])); - } - const saltedPassword = ui; - const ckHmacKey = await crypto.subtle.importKey( - "raw", - saltedPassword, - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign"] - ); - const clientKey = new Uint8Array( - await crypto.subtle.sign("HMAC", ckHmacKey, enc.encode("Client Key")) - ); - const storedKey = await crypto.subtle.digest("SHA-256", clientKey); - const clientFirstMessageBare = "n=*,r=" + session.clientNonce; - const serverFirstMessage = "r=" + nonce + ",s=" + salt + ",i=" + iterations; - const clientFinalMessageWithoutProof = "c=biws,r=" + nonce; - const authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof; - const csHmacKey = await crypto.subtle.importKey( - "raw", - storedKey, - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign"] - ); - var clientSignature = new Uint8Array( - await crypto.subtle.sign("HMAC", csHmacKey, enc.encode(authMessage)) - ); - var clientProofBytes = Buffer2.from( - clientKey.map((_2, i2) => clientKey[i2] ^ clientSignature[i2]) - ); - var clientProof = clientProofBytes.toString("base64"); - const skHmacKey = await crypto.subtle.importKey( - "raw", - saltedPassword, - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign"] - ); - const serverKey = await crypto.subtle.sign( - "HMAC", - skHmacKey, - enc.encode("Server Key") - ); - const ssbHmacKey = await crypto.subtle.importKey( - "raw", - serverKey, - { name: "HMAC", hash: { name: "SHA-256" } }, - false, - ["sign"] - ); - var serverSignatureBytes = Buffer2.from( - await crypto.subtle.sign("HMAC", ssbHmacKey, enc.encode(authMessage)) - ); - session.message = "SASLResponse"; - session.serverSignature = serverSignatureBytes.toString("base64"); - session.response = clientFinalMessageWithoutProof + ",p=" + clientProof; - this.connection.sendSCRAMClientFinalMessage(this.saslSession.response); - } -}; -function promisify(Promise2, callback) { - if (callback) return { callback, result: void 0 }; - let rej, res; - const cb = /* @__PURE__ */ __name(function(err, client) { - err ? rej(err) : res(client); - }, "cb"); - const result = new Promise2(function(resolve, reject) { - res = resolve; - rej = reject; - }); - return { callback: cb, result }; -} -__name(promisify, "promisify"); -var NeonPool = class extends import_pg.Pool { - static { - __name(this, "NeonPool"); - } - Client = NeonClient; - hasFetchUnsupportedListeners = false; - on(event, listener) { - if (event !== "error") this.hasFetchUnsupportedListeners = true; - return super.on(event, listener); - } - // @ts-ignore -- is it even possible to make TS happy with these overloaded function types? - query(config, values, cb) { - if (!Socket.poolQueryViaFetch || this.hasFetchUnsupportedListeners || typeof config === "function") { - return super.query(config, values, cb); - } - if (typeof values === "function") { - cb = values; - values = void 0; - } - const response = promisify(this.Promise, cb); - cb = response.callback; - try { - const cp = new import_connection_parameters.default( - this.options - ); - const euc = encodeURIComponent, eu = encodeURI; - const connectionString = `postgresql://${euc(cp.user)}:${euc(cp.password)}@${euc(cp.host)}/${eu(cp.database)}`; - const queryText = typeof config === "string" ? config : config.text; - const queryValues = values ?? config.values ?? []; - const sql = neon(connectionString, { - fullResults: true, - arrayMode: config.rowMode === "array" - }); - sql(queryText, queryValues, { - types: config.types ?? this.options?.types - }).then((result) => cb(void 0, result)).catch((err) => cb(err)); - } catch (err) { - cb(err); - } - return response.result; - } -}; - -// src/util.ts -init_shims(); -async function timed(f) { - const t0 = Date.now(); - const result = await f(); - const t = Date.now() - t0; - return [t, result]; -} -__name(timed, "timed"); -async function timedRepeats(n, f, timeListener = (ms, result) => { -}) { - const results = []; - for (let i = 0; i < n; i++) { - const tPlusResult = await timed(f); - const [t, result] = tPlusResult; - timeListener(t, result); - results.push(tPlusResult); - } - const total = results.reduce((memo, [t]) => memo + t, 0); - return [total, results]; -} -__name(timedRepeats, "timedRepeats"); -async function runQuery(queryable, query) { - const { sql, test } = query; - const { rows } = await (typeof queryable === "function" ? queryable(sql) : queryable.query(sql)); - if (!test(rows)) - throw new Error( - `Result fails test -Query: ${sql} -Result: ${JSON.stringify(rows)}` - ); - return rows; -} -__name(runQuery, "runQuery"); -async function clientRunQuery(n, client, ctx2, query) { - await client.connect(); - const tPlusResults = await timedRepeats(n, () => runQuery(client, query)); - ctx2.waitUntil(client.end()); - return tPlusResults; -} -__name(clientRunQuery, "clientRunQuery"); -async function poolRunQuery(n, dbUrl, ctx2, query) { - const pool = new NeonPool({ connectionString: dbUrl }); - const tPlusResults = await timedRepeats(n, () => runQuery(pool, query)); - ctx2.waitUntil(pool.end()); - return tPlusResults; -} -__name(poolRunQuery, "poolRunQuery"); -async function httpRunQuery(n, dbUrl, ctx2, query) { - const sql = neon(dbUrl, { fullResults: true }); - const tPlusResults = await timedRepeats(n, () => runQuery(sql, query)); - return tPlusResults; -} -__name(httpRunQuery, "httpRunQuery"); - -// src/queries.ts -init_shims(); -var queries = [ - { - sql: "SELECT * FROM employees LIMIT 10", - test: /* @__PURE__ */ __name((rows) => rows.length > 1 && typeof rows[0].first_name === "string", "test") - }, - { - sql: "SELECT now()", - test: /* @__PURE__ */ __name((rows) => /^2\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d+Z$/.test(rows[0].now.toISOString()), "test") - } -]; - -// src/index.ts -async function cf(request, env, ctx2) { - let results = []; - for (const query of queries) { - const [, [[, result]]] = await poolRunQuery(1, env.NEON_DB_URL, ctx2, query); - results.push(result); - } - for (const query of queries) { - const [, [[, result]]] = await httpRunQuery(1, env.NEON_DB_URL, ctx2, query); - results.push(result); - } - return new Response(JSON.stringify(results, null, 2), { - headers: { "Content-Type": "application/json" } - }); -} -__name(cf, "cf"); -var ctx = { - waitUntil(promise) { - }, - passThroughOnException() { - } -}; -async function batchQueryTest(env, log2 = (...s) => { -}) { - const sql = neon(env.NEON_DB_URL); - const [[ra], [rb]] = await sql.transaction([ - sql`SELECT ${1}::int AS "batchInt"`, - sql`SELECT ${"hello"} AS "batchStr"` - ]); - log2("batch results:", JSON.stringify(ra), JSON.stringify(rb), "\n"); - if (ra.batchInt !== 1 || rb.batchStr !== "hello") - throw new Error("Batch query problem"); - const [[r1], [r2]] = await sql.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${"hello"} AS "batchStr"` - ]); - log2("batch results:", JSON.stringify(r1), JSON.stringify(r2), "\n"); - if (r1.batchInt !== 1 || r2.batchStr !== "hello") - throw new Error("Batch query problem"); - const emptyResult = await sql.transaction((txn) => []); - log2("empty txn result:", JSON.stringify(emptyResult), "\n"); - const [[[r3]], [[r4]]] = await sql.transaction( - (txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${"hello"} AS "batchStr"` - ], - { arrayMode: true, isolationLevel: "Serializable", readOnly: true } - ); - log2( - "array mode (via transaction options) batch results:", - JSON.stringify(r3), - JSON.stringify(r4), - "\n" - ); - if (r3 !== 1 || r4 !== "hello") throw new Error("Batch query problem"); - const sqlArr = neon(env.NEON_DB_URL, { - arrayMode: true, - isolationLevel: "RepeatableRead" - }); - const [[[r5]], [[r6]]] = await sqlArr.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${"hello"} AS "batchStr"` - ]); - log2( - "array mode (via neon options) batch results:", - JSON.stringify(r5), - JSON.stringify(r6), - "\n" - ); - if (r5 !== 1 || r6 !== "hello") throw new Error("Batch query problem"); - const sqlArr2 = neon(env.NEON_DB_URL, { arrayMode: true }); - const [[r7], [r8]] = await sqlArr2.transaction( - (txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${"hello"} AS "batchStr"` - ], - { arrayMode: false } - ); - log2( - "ordinary (via overridden options) batch results:", - JSON.stringify(r7), - JSON.stringify(r8), - "\n" - ); - if (r7.batchInt !== 1 || r8.batchStr !== "hello") - throw new Error("Batch query problem"); - const [[r9], [r10]] = await sql.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn('SELECT $1 AS "batchStr"', ["hello"], { arrayMode: true }) - ]); - log2( - "query options on individual batch queries:", - JSON.stringify(r9), - JSON.stringify(r10), - "\n" - ); - if (r9.batchInt !== 1 || r10[0] !== "hello") - throw new Error("Batch query problem"); - let queryErr = void 0; - try { - await sql.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - `SELECT 'hello' AS "batchStr"` - ]); - } catch (err) { - queryErr = err; - } - if (queryErr === void 0) - throw new Error( - "Error should have been raised for string passed to `transaction()`" - ); - log2("successfully caught invalid query passed to `transaction()`\n"); - let connErr; - try { - const urlWithBadPassword = env.NEON_DB_URL.replace(/@/, "x@"); - await neon(urlWithBadPassword).transaction((txn) => [ - txn`SELECT 'never' AS this_should_be_seen_precisely` - ]); - } catch (err) { - connErr = err; - } - if (connErr === void 0) - throw new Error("Error should have been raised for bad password"); - log2("successfully caught invalid password passed to `neon()`\n"); -} -__name(batchQueryTest, "batchQueryTest"); -async function latencies(env, useSubtls, log2 = (...s) => { -}) { - const queryRepeats = [1, 3]; - const connectRepeats = 9; - log2("Warm-up ...\n\n"); - await poolRunQuery(1, env.NEON_DB_URL, ctx, queries[0]); - let counter = 0; - log2(` +var Wa=Object.create;var st=Object.defineProperty;var Ga=Object.getOwnPropertyDescriptor;var Va=Object.getOwnPropertyNames;var za=Object.getPrototypeOf,Ja=Object.prototype.hasOwnProperty;var o=(r,e)=>st(r,"name",{value:e,configurable:!0});var le=(r,e)=>()=>(r&&(e=r(r=0)),e);var B=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),pe=(r,e)=>{for(var t in e) +st(r,t,{get:e[t],enumerable:!0})},$n=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== +"function")for(let i of Va(e))!Ja.call(r,i)&&i!==t&&st(r,i,{get:()=>e[i],enumerable:!(n= +Ga(e,i))||n.enumerable});return r};var Oe=(r,e,t)=>(t=r!=null?Wa(za(r)):{},$n(e||!r||!r.__esModule?st(t,"default",{ +value:r,enumerable:!0}):t,r)),X=r=>$n(st({},"__esModule",{value:!0}),r);var Kn=B(Pt=>{"use strict";p();Pt.byteLength=Za;Pt.toByteArray=eo;Pt.fromByteArray= +no;var Se=[],ye=[],Ya=typeof Uint8Array<"u"?Uint8Array:Array,ur="ABCDEFGHIJKLMNO\ +PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ne=0,jn=ur.length;Ne0)throw new Error("Invalid string. Length must be a multip\ +le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}o(Hn, +"getLens");function Za(r){var e=Hn(r),t=e[0],n=e[1];return(t+n)*3/4-n}o(Za,"byte\ +Length");function Xa(r,e,t){return(e+t)*3/4-t}o(Xa,"_byteLength");function eo(r){ +var e,t=Hn(r),n=t[0],i=t[1],s=new Ya(Xa(r,n,i)),a=0,u=i>0?n-4:n,c;for(c=0;c>16&255,s[a++]=e>>8&255,s[a++]=e&255;return i===2&&(e= +ye[r.charCodeAt(c)]<<2|ye[r.charCodeAt(c+1)]>>4,s[a++]=e&255),i===1&&(e=ye[r.charCodeAt( +c)]<<10|ye[r.charCodeAt(c+1)]<<4|ye[r.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]= +e&255),s}o(eo,"toByteArray");function to(r){return Se[r>>18&63]+Se[r>>12&63]+Se[r>> +6&63]+Se[r&63]}o(to,"tripletToBase64");function ro(r,e,t){for(var n,i=[],s=e;su?u:a+s));return n===1?(e=r[t-1],i.push(Se[e>>2]+ +Se[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Se[e>>10]+Se[e>>4&63]+Se[e<< +2&63]+"=")),i.join("")}o(no,"fromByteArray")});var Wn=B(cr=>{p();cr.read=function(r,e,t,n,i){var s,a,u=i*8-n-1,c=(1<> +1,h=-7,f=t?i-1:0,y=t?-1:1,m=r[e+f];for(f+=y,s=m&(1<<-h)-1,m>>=-h,h+=u;h>0;s=s*256+ +r[e+f],f+=y,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=a*256+r[e+f],f+=y,h-=8);if(s=== +0)s=1-l;else{if(s===c)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-l}return(m? +-1:1)*a*Math.pow(2,s-n)};cr.write=function(r,e,t,n,i,s){var a,u,c,l=s*8-i-1,h=(1<< +l)-1,f=h>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,b=n?1:-1,U=e<0|| +e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=h):(a=Math. +floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+f>=1?e+=y/c:e+= +y*Math.pow(2,1-f),e*c>=2&&(a++,c/=2),a+f>=h?(u=0,a=h):a+f>=1?(u=(e*c-1)*Math.pow( +2,i),a=a+f):(u=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;r[t+m]=u&255,m+=b,u/=256, +i-=8);for(a=a<0;r[t+m]=a&255,m+=b,a/=256,l-=8);r[t+m-b]|=U*128}});var ci=B(je=>{"use strict";p();var lr=Kn(),Qe=Wn(),Gn=typeof Symbol=="function"&& +typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;je.Buffer= +d;je.SlowBuffer=co;je.INSPECT_MAX_BYTES=50;var Bt=2147483647;je.kMaxLength=Bt;d. +TYPED_ARRAY_SUPPORT=io();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. +error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ +pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ +rowser support.");function io(){try{let r=new Uint8Array(1),e={foo:o(function(){ +return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf( +r,e),r.foo()===42}catch{return!1}}o(io,"typedArraySupport");Object.defineProperty( +d.prototype,"parent",{enumerable:!0,get:o(function(){if(d.isBuffer(this))return this. +buffer},"get")});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:o( +function(){if(d.isBuffer(this))return this.byteOffset},"get")});function Ae(r){if(r> +Bt)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array( +r);return Object.setPrototypeOf(e,d.prototype),e}o(Ae,"createBuffer");function d(r,e,t){ +if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" a\ +rgument must be of type string. Received type number');return pr(r)}return Yn(r, +e,t)}o(d,"Buffer");d.poolSize=8192;function Yn(r,e,t){if(typeof r=="string")return ao( +r,e);if(ArrayBuffer.isView(r))return oo(r);if(r==null)throw new TypeError("The f\ +irst argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-l\ +ike Object. Received type "+typeof r);if(Ee(r,ArrayBuffer)||r&&Ee(r.buffer,ArrayBuffer)|| +typeof SharedArrayBuffer<"u"&&(Ee(r,SharedArrayBuffer)||r&&Ee(r.buffer,SharedArrayBuffer))) +return fr(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ + must not be of type number. Received type number');let n=r.valueOf&&r.valueOf(); +if(n!=null&&n!==r)return d.from(n,e,t);let i=uo(r);if(i)return i;if(typeof Symbol< +"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return d. +from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argumen\ +t must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. \ +Received type "+typeof r)}o(Yn,"from");d.from=function(r,e,t){return Yn(r,e,t)}; +Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d, +Uint8Array);function Zn(r){if(typeof r!="number")throw new TypeError('"size" arg\ +ument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is\ + invalid for option "size"')}o(Zn,"assertSize");function so(r,e,t){return Zn(r), +r<=0?Ae(r):e!==void 0?typeof t=="string"?Ae(r).fill(e,t):Ae(r).fill(e):Ae(r)}o(so, +"alloc");d.alloc=function(r,e,t){return so(r,e,t)};function pr(r){return Zn(r),Ae( +r<0?0:yr(r)|0)}o(pr,"allocUnsafe");d.allocUnsafe=function(r){return pr(r)};d.allocUnsafeSlow= +function(r){return pr(r)};function ao(r,e){if((typeof e!="string"||e==="")&&(e="\ +utf8"),!d.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Xn(r,e)| +0,n=Ae(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}o(ao,"fromString");function hr(r){ +let e=r.length<0?0:yr(r.length)|0,t=Ae(e);for(let n=0;n= +Bt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ +Bt.toString(16)+" bytes");return r|0}o(yr,"checked");function co(r){return+r!=r&& +(r=0),d.alloc(+r)}o(co,"SlowBuffer");d.isBuffer=o(function(e){return e!=null&&e. +_isBuffer===!0&&e!==d.prototype},"isBuffer");d.compare=o(function(e,t){if(Ee(e,Uint8Array)&& +(e=d.from(e,e.offset,e.byteLength)),Ee(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)), +!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments\ + must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t. +length;for(let s=0,a=Math.min(n,i);si.length?(d.isBuffer( +a)||(a=d.from(a)),a.copy(i,s)):Uint8Array.prototype.set.call(i,a,s);else if(d.isBuffer( +a))a.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buf\ +fers');s+=a.length}return i},"concat");function Xn(r,e){if(d.isBuffer(r))return r. +length;if(ArrayBuffer.isView(r)||Ee(r,ArrayBuffer))return r.byteLength;if(typeof r!= +"string")throw new TypeError('The "string" argument must be one of type string, \ +Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length> +2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"\ +latin1":case"binary":return t;case"utf8":case"utf-8":return dr(r).length;case"uc\ +s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ +base64":return ui(r).length;default:if(i)return n?-1:dr(r).length;e=(""+e).toLowerCase(), +i=!0}}o(Xn,"byteLength");d.byteLength=Xn;function lo(r,e,t){let n=!1;if((e===void 0|| +e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| +(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return bo( +this,e,t);case"utf8":case"utf-8":return ti(this,e,t);case"ascii":return So(this, +e,t);case"latin1":case"binary":return Eo(this,e,t);case"base64":return mo(this,e, +t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xo(this,e,t);default: +if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}o( +lo,"slowToString");d.prototype._isBuffer=!0;function Me(r,e,t){let n=r[e];r[e]=r[t], +r[t]=n}o(Me,"swap");d.prototype.swap16=o(function(){let e=this.length;if(e%2!==0) +throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< +e;t+=2)Me(this,t,t+1);return this},"swap16");d.prototype.swap32=o(function(){let e=this. +length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bit\ +s");for(let t=0;tt&&(e+=" ... "),""},"inspect");Gn&&(d.prototype[Gn]=d.prototype.inspect);d.prototype.compare= +o(function(e,t,n,i,s){if(Ee(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d. +isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffe\ +r or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e? +e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0|| +s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0; +if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0; +let a=s-i,u=n-t,c=Math.min(a,u),l=this.slice(i,s),h=e.slice(t,n);for(let f=0;f2147483647?t=2147483647: +t<-2147483648&&(t=-2147483648),t=+t,mr(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t), +t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e== +"string"&&(e=d.from(e,n)),d.isBuffer(e))return e.length===0?-1:Vn(r,e,t,n,i);if(typeof e== +"number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array. +prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Vn(r, +[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}o(ei,"bid\ +irectionalIndexOf");function Vn(r,e,t,n,i){let s=1,a=r.length,u=e.length;if(n!== +void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="\ +utf-16le")){if(r.length<2||e.length<2)return-1;s=2,a/=2,u/=2,t/=2}function c(h,f){ +return s===1?h[f]:h.readUInt16BE(f*s)}o(c,"read");let l;if(i){let h=-1;for(l=t;l< +a;l++)if(c(r,l)===c(e,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===u)return h*s}else h!== +-1&&(l-=l-h),h=-1}else for(t+u>a&&(t=a-u),l=t;l>=0;l--){let h=!0;for(let f=0;fi&&(n=i)):n=i;let s=e.length;n> +s/2&&(n=s/2);let a;for(a=0;a>>0,isFinite(n)? +(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.wri\ +te(string, encoding, offset[, length]) is no longer supported");let s=this.length- +t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( +"Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"\ +hex":return ho(this,e,t,n);case"utf8":case"utf-8":return fo(this,e,t,n);case"asc\ +ii":case"latin1":case"binary":return po(this,e,t,n);case"base64":return yo(this, +e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wo(this,e,t,n);default: +if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},"\ +write");d.prototype.toJSON=o(function(){return{type:"Buffer",data:Array.prototype. +slice.call(this._arr||this,0)}},"toJSON");function mo(r,e,t){return e===0&&t===r. +length?lr.fromByteArray(r):lr.fromByteArray(r.slice(e,t))}o(mo,"base64Slice");function ti(r,e,t){ +t=Math.min(r.length,t);let n=[],i=e;for(;i239?4:s>223? +3:s>191?2:1;if(i+u<=t){let c,l,h,f;switch(u){case 1:s<128&&(a=s);break;case 2:c= +r[i+1],(c&192)===128&&(f=(s&31)<<6|c&63,f>127&&(a=f));break;case 3:c=r[i+1],l=r[i+ +2],(c&192)===128&&(l&192)===128&&(f=(s&15)<<12|(c&63)<<6|l&63,f>2047&&(f<55296|| +f>57343)&&(a=f));break;case 4:c=r[i+1],l=r[i+2],h=r[i+3],(c&192)===128&&(l&192)=== +128&&(h&192)===128&&(f=(s&15)<<18|(c&63)<<12|(l&63)<<6|h&63,f>65535&&f<1114112&& +(a=f))}}a===null?(a=65533,u=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320| +a&1023),n.push(a),i+=u}return go(n)}o(ti,"utf8Slice");var zn=4096;function go(r){ +let e=r.length;if(e<=zn)return String.fromCharCode.apply(String,r);let t="",n=0; +for(;nn)&&(t=n);let i="";for(let s=e;sn&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),tt)throw new RangeError( +"Trying to access beyond buffer length")}o(ee,"checkOffset");d.prototype.readUintLE= +d.prototype.readUIntLE=o(function(e,t,n){e=e>>>0,t=t>>>0,n||ee(e,t,this.length); +let i=this[e],s=1,a=0;for(;++a>>0,t=t>>>0, +n||ee(e,t,this.length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]* +s;return i},"readUIntBE");d.prototype.readUint8=d.prototype.readUInt8=o(function(e,t){ +return e=e>>>0,t||ee(e,1,this.length),this[e]},"readUInt8");d.prototype.readUint16LE= +d.prototype.readUInt16LE=o(function(e,t){return e=e>>>0,t||ee(e,2,this.length),this[e]| +this[e+1]<<8},"readUInt16LE");d.prototype.readUint16BE=d.prototype.readUInt16BE= +o(function(e,t){return e=e>>>0,t||ee(e,2,this.length),this[e]<<8|this[e+1]},"rea\ +dUInt16BE");d.prototype.readUint32LE=d.prototype.readUInt32LE=o(function(e,t){return e= +e>>>0,t||ee(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216}, +"readUInt32LE");d.prototype.readUint32BE=d.prototype.readUInt32BE=o(function(e,t){ +return e=e>>>0,t||ee(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<< +8|this[e+3])},"readUInt32BE");d.prototype.readBigUInt64LE=_e(o(function(e){e=e>>> +0,$e(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&at(e,this.length- +8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]* +2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,$e(e,"offset");let t=this[e], +n=this[e+7];(t===void 0||n===void 0)&&at(e,this.length-8);let i=t*2**24+this[++e]* +2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+ +n;return(BigInt(i)<>>0,t=t>>>0,n||ee(e,t,this.length);let i=this[e],s=1,a=0;for(;++a< +t&&(s*=256);)i+=this[e+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},"readInt\ +LE");d.prototype.readIntBE=o(function(e,t,n){e=e>>>0,t=t>>>0,n||ee(e,t,this.length); +let i=t,s=1,a=this[e+--i];for(;i>0&&(s*=256);)a+=this[e+--i]*s;return s*=128,a>= +s&&(a-=Math.pow(2,8*t)),a},"readIntBE");d.prototype.readInt8=o(function(e,t){return e= +e>>>0,t||ee(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8"); +d.prototype.readInt16LE=o(function(e,t){e=e>>>0,t||ee(e,2,this.length);let n=this[e]| +this[e+1]<<8;return n&32768?n|4294901760:n},"readInt16LE");d.prototype.readInt16BE= +o(function(e,t){e=e>>>0,t||ee(e,2,this.length);let n=this[e+1]|this[e]<<8;return n& +32768?n|4294901760:n},"readInt16BE");d.prototype.readInt32LE=o(function(e,t){return e= +e>>>0,t||ee(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"\ +readInt32LE");d.prototype.readInt32BE=o(function(e,t){return e=e>>>0,t||ee(e,4,this. +length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");d.prototype. +readBigInt64LE=_e(o(function(e){e=e>>>0,$e(e,"offset");let t=this[e],n=this[e+7]; +(t===void 0||n===void 0)&&at(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+ +6]*2**16+(n<<24);return(BigInt(i)<>>0,$e(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&at(e, +this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt( +i)<>>0,t||ee(e,4,this. +length),Qe.read(this,e,!0,23,4)},"readFloatLE");d.prototype.readFloatBE=o(function(e,t){ +return e=e>>>0,t||ee(e,4,this.length),Qe.read(this,e,!1,23,4)},"readFloatBE");d. +prototype.readDoubleLE=o(function(e,t){return e=e>>>0,t||ee(e,8,this.length),Qe. +read(this,e,!0,52,8)},"readDoubleLE");d.prototype.readDoubleBE=o(function(e,t){return e= +e>>>0,t||ee(e,8,this.length),Qe.read(this,e,!1,52,8)},"readDoubleBE");function he(r,e,t,n,i,s){ +if(!d.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instan\ +ce');if(e>i||er.length)throw new RangeError("Index out of range")}o(he,"checkInt");d.prototype. +writeUintLE=d.prototype.writeUIntLE=o(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0, +!i){let u=Math.pow(2,8*n)-1;he(this,e,t,n,u,0)}let s=1,a=0;for(this[t]=e&255;++a< +n&&(s*=256);)this[t+a]=e/s&255;return t+n},"writeUIntLE");d.prototype.writeUintBE= +d.prototype.writeUIntBE=o(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math. +pow(2,8*n)-1;he(this,e,t,n,u,0)}let s=n-1,a=1;for(this[t+s]=e&255;--s>=0&&(a*=256);) +this[t+s]=e/a&255;return t+n},"writeUIntBE");d.prototype.writeUint8=d.prototype. +writeUInt8=o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e,t,1,255,0),this[t]= +e&255,t+1},"writeUInt8");d.prototype.writeUint16LE=d.prototype.writeUInt16LE=o(function(e,t,n){ +return e=+e,t=t>>>0,n||he(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2}, +"writeUInt16LE");d.prototype.writeUint16BE=d.prototype.writeUInt16BE=o(function(e,t,n){ +return e=+e,t=t>>>0,n||he(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2}, +"writeUInt16BE");d.prototype.writeUint32LE=d.prototype.writeUInt32LE=o(function(e,t,n){ +return e=+e,t=t>>>0,n||he(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>> +16,this[t+1]=e>>>8,this[t]=e&255,t+4},"writeUInt32LE");d.prototype.writeUint32BE= +d.prototype.writeUInt32BE=o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e,t,4, +4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+ +4},"writeUInt32BE");function ri(r,e,t,n,i){oi(e,n,i,r,t,7);let s=Number(e&BigInt( +4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let a=Number( +e>>BigInt(32)&BigInt(4294967295));return r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]= +a,a=a>>8,r[t++]=a,t}o(ri,"wrtBigUInt64LE");function ni(r,e,t,n,i){oi(e,n,i,r,t,7); +let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>> +8,r[t+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=a,a=a>>8, +r[t+2]=a,a=a>>8,r[t+1]=a,a=a>>8,r[t]=a,t+8}o(ni,"wrtBigUInt64BE");d.prototype.writeBigUInt64LE= +_e(o(function(e,t=0){return ri(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}, +"writeBigUInt64LE"));d.prototype.writeBigUInt64BE=_e(o(function(e,t=0){return ni( +this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE"));d.prototype. +writeIntLE=o(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);he(this, +e,t,n,c-1,-c)}let s=0,a=1,u=0;for(this[t]=e&255;++s>0)-u&255;return t+n},"writeIntLE");d.prototype.writeIntBE= +o(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);he(this,e,t,n,c- +1,-c)}let s=n-1,a=1,u=0;for(this[t+s]=e&255;--s>=0&&(a*=256);)e<0&&u===0&&this[t+ +s+1]!==0&&(u=1),this[t+s]=(e/a>>0)-u&255;return t+n},"writeIntBE");d.prototype.writeInt8= +o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e,t,1,127,-128),e<0&&(e=255+e+1), +this[t]=e&255,t+1},"writeInt8");d.prototype.writeInt16LE=o(function(e,t,n){return e= ++e,t=t>>>0,n||he(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},"wr\ +iteInt16LE");d.prototype.writeInt16BE=o(function(e,t,n){return e=+e,t=t>>>0,n||he( +this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},"writeInt16BE");d.prototype. +writeInt32LE=o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e,t,4,2147483647,-2147483648), +this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},"writeInt32\ +LE");d.prototype.writeInt32BE=o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e, +t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>> +16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeInt32BE");d.prototype.writeBigInt64LE= +_e(o(function(e,t=0){return ri(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x\ +7fffffffffffffff"))},"writeBigInt64LE"));d.prototype.writeBigInt64BE=_e(o(function(e,t=0){ +return ni(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}, +"writeBigInt64BE"));function ii(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError( +"Index out of range");if(t<0)throw new RangeError("Index out of range")}o(ii,"ch\ +eckIEEE754");function si(r,e,t,n,i){return e=+e,t=t>>>0,i||ii(r,e,t,4,34028234663852886e22, +-34028234663852886e22),Qe.write(r,e,t,n,23,4),t+4}o(si,"writeFloat");d.prototype. +writeFloatLE=o(function(e,t,n){return si(this,e,t,!0,n)},"writeFloatLE");d.prototype. +writeFloatBE=o(function(e,t,n){return si(this,e,t,!1,n)},"writeFloatBE");function ai(r,e,t,n,i){ +return e=+e,t=t>>>0,i||ii(r,e,t,8,17976931348623157e292,-17976931348623157e292), +Qe.write(r,e,t,n,52,8),t+8}o(ai,"writeDouble");d.prototype.writeDoubleLE=o(function(e,t,n){ +return ai(this,e,t,!0,n)},"writeDoubleLE");d.prototype.writeDoubleBE=o(function(e,t,n){ +return ai(this,e,t,!1,n)},"writeDoubleBE");d.prototype.copy=o(function(e,t,n,i){ +if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0), +!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("Index out of ran\ +ge");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this. +length),e.length-t>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e== +"number")for(s=t;s2**32?i=Jn(String(t)):typeof t=="\ +bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i= +Jn(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Jn(r){ +let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`; +return`${r.slice(0,t)}${e}`}o(Jn,"addNumericalSeparator");function Ao(r,e,t){$e( +e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&at(e,r.length-(t+1))}o(Ao,"checkBo\ +unds");function oi(r,e,t,n,i,s){if(r>t||r +3?e===0||e===BigInt(0)?u=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:u=`>= -(2${a} \ +** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:u=`>= ${e}${a} and <= ${t}${a}`, +new ke.ERR_OUT_OF_RANGE("value",u,r)}Ao(n,i,s)}o(oi,"checkIntBI");function $e(r,e){ +if(typeof r!="number")throw new ke.ERR_INVALID_ARG_TYPE(e,"number",r)}o($e,"vali\ +dateNumber");function at(r,e,t){throw Math.floor(r)!==r?($e(r,t),new ke.ERR_OUT_OF_RANGE( +t||"offset","an integer",r)):e<0?new ke.ERR_BUFFER_OUT_OF_BOUNDS:new ke.ERR_OUT_OF_RANGE( +t||"offset",`>= ${t?1:0} and <= ${e}`,r)}o(at,"boundsError");var vo=/[^+/0-9A-Za-z-_]/g; +function Co(r){if(r=r.split("=")[0],r=r.trim().replace(vo,""),r.length<2)return""; +for(;r.length%4!==0;)r=r+"=";return r}o(Co,"base64clean");function dr(r,e){e=e|| +1/0;let t,n=r.length,i=null,s=[];for(let a=0;a55295&& +t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1=== +n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s. +push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&& +s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){ +if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s. +push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push( +t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code \ +point")}return s}o(dr,"utf8ToBytes");function _o(r){let e=[];for(let t=0;t>8,i=t%256, +s.push(i),s.push(n);return s}o(To,"utf16leToBytes");function ui(r){return lr.toByteArray( +Co(r))}o(ui,"base64ToBytes");function Rt(r,e,t,n){let i;for(i=0;i=e.length|| +i>=r.length);++i)e[i+t]=r[i];return i}o(Rt,"blitBuffer");function Ee(r,e){return r instanceof +e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name=== +e.name}o(Ee,"isInstance");function mr(r){return r!==r}o(mr,"numberIsNaN");var Lo=function(){ +let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< +16;++i)e[n+i]=r[t]+r[i]}return e}();function _e(r){return typeof BigInt>"u"?Uo:r} +o(_e,"defineBigIntMethod");function Uo(){throw new Error("BigInt not supported")} +o(Uo,"BufferBigIntNotDefined")});var _,T,L,A,w,S,p=le(()=>{"use strict";_=globalThis,T=globalThis.setImmediate??(r=>setTimeout( +r,0)),L=globalThis.clearImmediate??(r=>clearTimeout(r)),A=globalThis.crypto??{}; +A.subtle??={};w=typeof globalThis.Buffer=="function"&&typeof globalThis.Buffer.allocUnsafe== +"function"?globalThis.Buffer:ci().Buffer,S=globalThis.process??{};S.env??={};try{ +S.nextTick(()=>{})}catch{let e=Promise.resolve();S.nextTick=e.then.bind(e)}});var Ue=B((hf,Ur)=>{"use strict";p();var Ge=typeof Reflect=="object"?Reflect:null, +Bi=Ge&&typeof Ge.apply=="function"?Ge.apply:o(function(e,t,n){return Function.prototype. +apply.call(e,t,n)},"ReflectApply"),Ot;Ge&&typeof Ge.ownKeys=="function"?Ot=Ge.ownKeys: +Object.getOwnPropertySymbols?Ot=o(function(e){return Object.getOwnPropertyNames( +e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):Ot=o(function(e){return Object. +getOwnPropertyNames(e)},"ReflectOwnKeys");function _u(r){console&&console.warn&& +console.warn(r)}o(_u,"ProcessEmitWarning");var Ni=Number.isNaN||o(function(e){return e!== +e},"NumberIsNaN");function Q(){Q.init.call(this)}o(Q,"EventEmitter");Ur.exports= +Q;Ur.exports.once=Iu;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount= +0;Q.prototype._maxListeners=void 0;var Ri=10;function kt(r){if(typeof r!="functi\ +on")throw new TypeError('The "listener" argument must be of type Function. Recei\ +ved type '+typeof r)}o(kt,"checkListener");Object.defineProperty(Q,"defaultMaxLi\ +steners",{enumerable:!0,get:o(function(){return Ri},"get"),set:o(function(r){if(typeof r!= +"number"||r<0||Ni(r))throw new RangeError('The value of "defaultMaxListeners" is\ + out of range. It must be a non-negative number. Received '+r+".");Ri=r},"set")}); +Q.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). +_events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners= +this._maxListeners||void 0};Q.prototype.setMaxListeners=o(function(e){if(typeof e!= +"number"||e<0||Ni(e))throw new RangeError('The value of "n" is out of range. It \ +must be a non-negative number. Received '+e+".");return this._maxListeners=e,this}, +"setMaxListeners");function Mi(r){return r._maxListeners===void 0?Q.defaultMaxListeners: +r._maxListeners}o(Mi,"_getMaxListeners");Q.prototype.getMaxListeners=o(function(){ +return Mi(this)},"getMaxListeners");Q.prototype.emit=o(function(e){for(var t=[], +n=1;n +0&&(a=t[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+ +a.message+")":""));throw u.context=a,u}var c=s[e];if(c===void 0)return!1;if(typeof c== +"function")Bi(c,this,t);else for(var l=c.length,h=ki(c,l),n=0;n0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Po\ +ssible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners a\ +dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ +ededWarning",u.emitter=r,u.type=e,u.count=a.length,_u(u)}return r}o(Di,"_addList\ +ener");Q.prototype.addListener=o(function(e,t){return Di(this,e,t,!1)},"addListe\ +ner");Q.prototype.on=Q.prototype.addListener;Q.prototype.prependListener=o(function(e,t){ +return Di(this,e,t,!0)},"prependListener");function Tu(){if(!this.fired)return this. +target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? +this.listener.call(this.target):this.listener.apply(this.target,arguments)}o(Tu, +"onceWrapper");function qi(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, +listener:t},i=Tu.bind(n);return i.listener=t,n.wrapFn=i,i}o(qi,"_onceWrap");Q.prototype. +once=o(function(e,t){return kt(t),this.on(e,qi(this,e,t)),this},"once");Q.prototype. +prependOnceListener=o(function(e,t){return kt(t),this.prependListener(e,qi(this, +e,t)),this},"prependOnceListener");Q.prototype.removeListener=o(function(e,t){var n, +i,s,a,u;if(kt(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this; +if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): +(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= +"function"){for(s=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){u=n[a]. +listener,s=a;break}if(s<0)return this;s===0?n.shift():Lu(n,s),n.length===1&&(i[e]= +n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, +"removeListener");Q.prototype.off=Q.prototype.removeListener;Q.prototype.removeAllListeners= +o(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== +void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount= +0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]), +this;if(arguments.length===0){var s=Object.keys(n),a;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function Fi(r,e,t){ +var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== +"function"?t?[i.listener||i]:[i]:t?Uu(i):ki(i,i.length)}o(Fi,"_listeners");Q.prototype. +listeners=o(function(e){return Fi(this,e,!0)},"listeners");Q.prototype.rawListeners= +o(function(e){return Fi(this,e,!1)},"rawListeners");Q.listenerCount=function(r,e){ +return typeof r.listenerCount=="function"?r.listenerCount(e):Oi.call(r,e)};Q.prototype. +listenerCount=Oi;function Oi(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== +"function")return 1;if(t!==void 0)return t.length}return 0}o(Oi,"listenerCount"); +Q.prototype.eventNames=o(function(){return this._eventsCount>0?Ot(this._events): +[]},"eventNames");function ki(r,e){for(var t=new Array(e),n=0;nBu});var Bu,ht=le(()=>{"use strict";p();Bu={}});function ft(r){let e=1779033703,t=3144134277,n=1013904242,i=2773480762,s=1359893119, +a=2600822924,u=528734635,c=1541459225,l=0,h=0,f=[1116352408,1899447441,3049323471, +3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278, +1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078, +604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808, +3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372, +1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800, +3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, +883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, +2361852424,2428436474,2756734187,3204031479,3329325298],y=o((E,g)=>E>>>g|E<<32-g, +"rrot"),m=new Uint32Array(64),b=new Uint8Array(64),U=o(()=>{for(let M=0,$=0;M<16;M++, +$+=4)m[M]=b[$]<<24|b[$+1]<<16|b[$+2]<<8|b[$+3];for(let M=16;M<64;M++){let $=y(m[M- +15],7)^y(m[M-15],18)^m[M-15]>>>3,j=y(m[M-2],17)^y(m[M-2],19)^m[M-2]>>>10;m[M]=m[M- +16]+$+m[M-7]+j|0}let E=e,g=t,x=n,N=i,P=s,D=a,q=u,Z=c;for(let M=0;M<64;M++){let $=y( +P,6)^y(P,11)^y(P,25),j=P&D^~P&q,H=Z+$+j+f[M]+m[M]|0,K=y(E,2)^y(E,13)^y(E,22),J=E& +g^E&x^g&x,F=K+J|0;Z=q,q=D,D=P,P=N+H|0,N=x,x=g,g=E,E=H+F|0}e=e+E|0,t=t+g|0,n=n+x| +0,i=i+N|0,s=s+P|0,a=a+D|0,u=u+q|0,c=c+Z|0,h=0},"process"),v=o(E=>{typeof E=="str\ +ing"&&(E=new TextEncoder().encode(E));for(let g=0;g{if(b[h++]=128,h==64&&U(),h+8>64){for(;h<64;) +b[h++]=0;U()}for(;h<58;)b[h++]=0;let E=l*8;b[h++]=E/1099511627776&255,b[h++]=E/4294967296& +255,b[h++]=E>>>24,b[h++]=E>>>16&255,b[h++]=E>>>8&255,b[h++]=E&255,U();let g=new Uint8Array( +32);return g[0]=e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]= +t>>>16&255,g[6]=t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255, +g[11]=n&255,g[12]=i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>> +24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255,g[20]=a>>>24,g[21]=a>>>16&255,g[22]= +a>>>8&255,g[23]=a&255,g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255, +g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r=== +void 0?{add:v,digest:C}:(v(r),C())}var $i=le(()=>{"use strict";p();o(ft,"sha256")});var dt,ji=le(()=>{"use strict";p();dt=class r{static{o(this,"Md5")}static hashByteArray(e,t=!1){ +return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ +return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ +return this.onePassHasher.start().appendAsciiStr(e).end(t)}static stateIdentity=new Int32Array( +[1732584193,-271733879,-1732584194,271733878]);static buffer32Identity=new Int32Array( +[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);static hexChars="0123456789abcdef";static hexOut=[];static onePassHasher=new r;static _hex(e){ +let t=r.hexChars,n=r.hexOut,i,s,a,u;for(u=0;u<4;u+=1)for(s=u*8,i=e[u],a=0;a<8;a+= +2)n[s+1+a]=t.charAt(i&15),i>>>=4,n[s+0+a]=t.charAt(i&15),i>>>=4;return n.join("")}static _md5cycle(e,t){ +let n=e[0],i=e[1],s=e[2],a=e[3];n+=(i&s|~i&a)+t[0]-680876936|0,n=(n<<7|n>>>25)+i| +0,a+=(n&i|~n&s)+t[1]-389564586|0,a=(a<<12|a>>>20)+n|0,s+=(a&n|~a&i)+t[2]+606105819| +0,s=(s<<17|s>>>15)+a|0,i+=(s&a|~s&n)+t[3]-1044525330|0,i=(i<<22|i>>>10)+s|0,n+=(i& +s|~i&a)+t[4]-176418897|0,n=(n<<7|n>>>25)+i|0,a+=(n&i|~n&s)+t[5]+1200080426|0,a=(a<< +12|a>>>20)+n|0,s+=(a&n|~a&i)+t[6]-1473231341|0,s=(s<<17|s>>>15)+a|0,i+=(s&a|~s&n)+ +t[7]-45705983|0,i=(i<<22|i>>>10)+s|0,n+=(i&s|~i&a)+t[8]+1770035416|0,n=(n<<7|n>>> +25)+i|0,a+=(n&i|~n&s)+t[9]-1958414417|0,a=(a<<12|a>>>20)+n|0,s+=(a&n|~a&i)+t[10]- +42063|0,s=(s<<17|s>>>15)+a|0,i+=(s&a|~s&n)+t[11]-1990404162|0,i=(i<<22|i>>>10)+s| +0,n+=(i&s|~i&a)+t[12]+1804603682|0,n=(n<<7|n>>>25)+i|0,a+=(n&i|~n&s)+t[13]-40341101| +0,a=(a<<12|a>>>20)+n|0,s+=(a&n|~a&i)+t[14]-1502002290|0,s=(s<<17|s>>>15)+a|0,i+= +(s&a|~s&n)+t[15]+1236535329|0,i=(i<<22|i>>>10)+s|0,n+=(i&a|s&~a)+t[1]-165796510| +0,n=(n<<5|n>>>27)+i|0,a+=(n&s|i&~s)+t[6]-1069501632|0,a=(a<<9|a>>>23)+n|0,s+=(a& +i|n&~i)+t[11]+643717713|0,s=(s<<14|s>>>18)+a|0,i+=(s&n|a&~n)+t[0]-373897302|0,i= +(i<<20|i>>>12)+s|0,n+=(i&a|s&~a)+t[5]-701558691|0,n=(n<<5|n>>>27)+i|0,a+=(n&s|i& +~s)+t[10]+38016083|0,a=(a<<9|a>>>23)+n|0,s+=(a&i|n&~i)+t[15]-660478335|0,s=(s<<14| +s>>>18)+a|0,i+=(s&n|a&~n)+t[4]-405537848|0,i=(i<<20|i>>>12)+s|0,n+=(i&a|s&~a)+t[9]+ +568446438|0,n=(n<<5|n>>>27)+i|0,a+=(n&s|i&~s)+t[14]-1019803690|0,a=(a<<9|a>>>23)+ +n|0,s+=(a&i|n&~i)+t[3]-187363961|0,s=(s<<14|s>>>18)+a|0,i+=(s&n|a&~n)+t[8]+1163531501| +0,i=(i<<20|i>>>12)+s|0,n+=(i&a|s&~a)+t[13]-1444681467|0,n=(n<<5|n>>>27)+i|0,a+=(n& +s|i&~s)+t[2]-51403784|0,a=(a<<9|a>>>23)+n|0,s+=(a&i|n&~i)+t[7]+1735328473|0,s=(s<< +14|s>>>18)+a|0,i+=(s&n|a&~n)+t[12]-1926607734|0,i=(i<<20|i>>>12)+s|0,n+=(i^s^a)+ +t[5]-378558|0,n=(n<<4|n>>>28)+i|0,a+=(n^i^s)+t[8]-2022574463|0,a=(a<<11|a>>>21)+ +n|0,s+=(a^n^i)+t[11]+1839030562|0,s=(s<<16|s>>>16)+a|0,i+=(s^a^n)+t[14]-35309556| +0,i=(i<<23|i>>>9)+s|0,n+=(i^s^a)+t[1]-1530992060|0,n=(n<<4|n>>>28)+i|0,a+=(n^i^s)+ +t[4]+1272893353|0,a=(a<<11|a>>>21)+n|0,s+=(a^n^i)+t[7]-155497632|0,s=(s<<16|s>>> +16)+a|0,i+=(s^a^n)+t[10]-1094730640|0,i=(i<<23|i>>>9)+s|0,n+=(i^s^a)+t[13]+681279174| +0,n=(n<<4|n>>>28)+i|0,a+=(n^i^s)+t[0]-358537222|0,a=(a<<11|a>>>21)+n|0,s+=(a^n^i)+ +t[3]-722521979|0,s=(s<<16|s>>>16)+a|0,i+=(s^a^n)+t[6]+76029189|0,i=(i<<23|i>>>9)+ +s|0,n+=(i^s^a)+t[9]-640364487|0,n=(n<<4|n>>>28)+i|0,a+=(n^i^s)+t[12]-421815835|0, +a=(a<<11|a>>>21)+n|0,s+=(a^n^i)+t[15]+530742520|0,s=(s<<16|s>>>16)+a|0,i+=(s^a^n)+ +t[2]-995338651|0,i=(i<<23|i>>>9)+s|0,n+=(s^(i|~a))+t[0]-198630844|0,n=(n<<6|n>>> +26)+i|0,a+=(i^(n|~s))+t[7]+1126891415|0,a=(a<<10|a>>>22)+n|0,s+=(n^(a|~i))+t[14]- +1416354905|0,s=(s<<15|s>>>17)+a|0,i+=(a^(s|~n))+t[5]-57434055|0,i=(i<<21|i>>>11)+ +s|0,n+=(s^(i|~a))+t[12]+1700485571|0,n=(n<<6|n>>>26)+i|0,a+=(i^(n|~s))+t[3]-1894986606| +0,a=(a<<10|a>>>22)+n|0,s+=(n^(a|~i))+t[10]-1051523|0,s=(s<<15|s>>>17)+a|0,i+=(a^ +(s|~n))+t[1]-2054922799|0,i=(i<<21|i>>>11)+s|0,n+=(s^(i|~a))+t[8]+1873313359|0,n= +(n<<6|n>>>26)+i|0,a+=(i^(n|~s))+t[15]-30611744|0,a=(a<<10|a>>>22)+n|0,s+=(n^(a|~i))+ +t[6]-1560198380|0,s=(s<<15|s>>>17)+a|0,i+=(a^(s|~n))+t[13]+1309151649|0,i=(i<<21| +i>>>11)+s|0,n+=(s^(i|~a))+t[4]-145523070|0,n=(n<<6|n>>>26)+i|0,a+=(i^(n|~s))+t[11]- +1120210379|0,a=(a<<10|a>>>22)+n|0,s+=(n^(a|~i))+t[2]+718787259|0,s=(s<<15|s>>>17)+ +a|0,i+=(a^(s|~n))+t[9]-343485551|0,i=(i<<21|i>>>11)+s|0,e[0]=n+e[0]|0,e[1]=i+e[1]| +0,e[2]=s+e[2]|0,e[3]=a+e[3]|0}_dataLength=0;_bufferLength=0;_state=new Int32Array( +4);_buffer=new ArrayBuffer(68);_buffer8;_buffer32;constructor(){this._buffer8=new Uint8Array( +this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}start(){ +return this._dataLength=0,this._bufferLength=0,this._state.set(r.stateIdentity), +this}appendStr(e){let t=this._buffer8,n=this._buffer32,i=this._bufferLength,s,a; +for(a=0;a>>6)+192,t[i++]=s&63|128;else if(s<55296||s>56319)t[i++]=(s>>>12)+224,t[i++]= +s>>>6&63|128,t[i++]=s&63|128;else{if(s=(s-55296)*1024+(e.charCodeAt(++a)-56320)+ +65536,s>1114111)throw new Error("Unicode standard supports code points up to U+1\ +0FFFF");t[i++]=(s>>>18)+240,t[i++]=s>>>12&63|128,t[i++]=s>>>6&63|128,t[i++]=s&63| +128}i>=64&&(this._dataLength+=64,r._md5cycle(this._state,n),i-=64,n[0]=n[16])}return this. +_bufferLength=i,this}appendAsciiStr(e){let t=this._buffer8,n=this._buffer32,i=this. +_bufferLength,s,a=0;for(;;){for(s=Math.min(e.length-a,64-i);s--;)t[i++]=e.charCodeAt( +a++);if(i<64)break;this._dataLength+=64,r._md5cycle(this._state,n),i=0}return this. +_bufferLength=i,this}appendByteArray(e){let t=this._buffer8,n=this._buffer32,i=this. +_bufferLength,s,a=0;for(;;){for(s=Math.min(e.length-a,64-i);s--;)t[i++]=e[a++];if(i< +64)break;this._dataLength+=64,r._md5cycle(this._state,n),i=0}return this._bufferLength= +i,this}getState(){let e=this._state;return{buffer:String.fromCharCode.apply(null, +Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[ +e[0],e[1],e[2],e[3]]}}setState(e){let t=e.buffer,n=e.state,i=this._state,s;for(this. +_dataLength=e.length,this._bufferLength=e.buflen,i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]= +n[3],s=0;s>2)+1;this._dataLength+=t;let a=this._dataLength* +8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(r.buffer32Identity.subarray(s),s),t>55&& +(r._md5cycle(this._state,i),i.set(r.buffer32Identity)),a<=4294967295)i[14]=a;else{ +let u=a.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return;let c=parseInt(u[2], +16),l=parseInt(u[1],16)||0;i[14]=c,i[15]=l}return r._md5cycle(this._state,i),e?this. +_state:r._hex(this._state)}}});var Ir={};pe(Ir,{createHash:()=>Nu,createHmac:()=>Mu,randomBytes:()=>Ru});function Ru(r){ +return A.getRandomValues(w.alloc(r))}function Nu(r){if(r==="sha256")return{update:o( +function(e){return{digest:o(function(){return w.from(ft(e))},"digest")}},"update")}; +if(r==="md5")return{update:o(function(e){return{digest:o(function(){return typeof e== +"string"?dt.hashStr(e):dt.hashByteArray(e)},"digest")}},"update")};throw new Error( +`Hash type '${r}' not supported`)}function Mu(r,e){if(r!=="sha256")throw new Error( +`Only sha256 is supported (requested: '${r}')`);return{update:o(function(t){return{ +digest:o(function(){typeof e=="string"&&(e=new TextEncoder().encode(e)),typeof t== +"string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n>64)e=ft(e);else if(n< +64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array(64),s=new Uint8Array( +64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let a=new Uint8Array(t.length+ +64);a.set(i,0),a.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u.set(ft(a), +64),w.from(ft(u))},"digest")}},"update")}}var Pr=le(()=>{"use strict";p();$i();ji(); +o(Ru,"randomBytes");o(Nu,"createHash");o(Mu,"createHmac")});var Rr=B(Hi=>{"use strict";p();Hi.parse=function(r,e){return new Br(r,e).parse()}; +var Br=class r{static{o(this,"ArrayParser")}constructor(e,t){this.source=e,this. +transform=t||Du,this.position=0,this.entries=[],this.recorded=[],this.dimension= +0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this. +position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e, +escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var t;(this.recorded.length> +0||e)&&(t=this.recorded.join(""),t==="NULL"&&!e&&(t=null),t!==null&&(t=this.transform( +t)),this.entries.push(t),this.recorded=[])}consumeDimensions(){if(this.source[0]=== +"[")for(;!this.isEof();){var e=this.nextCharacter();if(e.value==="=")break}}parse(e){ +var t,n,i;for(this.consumeDimensions();!this.isEof();)if(t=this.nextCharacter(), +t.value==="{"&&!i)this.dimension++,this.dimension>1&&(n=new r(this.source.substr( +this.position-1),this.transform),this.entries.push(n.parse(!0)),this.position+=n. +position-2);else if(t.value==="}"&&!i){if(this.dimension--,!this.dimension&&(this. +newEntry(),e))return this.entries}else t.value==='"'&&!t.escaped?(i&&this.newEntry( +!0),i=!i):t.value===","&&!i?this.newEntry():this.record(t.value);if(this.dimension!== +0)throw new Error("array dimension not balanced");return this.entries}};function Du(r){ +return r}o(Du,"identity")});var Nr=B((Lf,Ki)=>{p();var qu=Rr();Ki.exports={create:o(function(r,e){return{parse:o( +function(){return qu.parse(r,e)},"parse")}},"create")}});var Vi=B((Pf,Gi)=>{"use strict";p();var Fu=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, +Ou=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ku=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,Qu=/^-?infinity$/; +Gi.exports=o(function(e){if(Qu.test(e))return Number(e.replace("i","I"));var t=Fu. +exec(e);if(!t)return $u(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=Wi(i));var s=parseInt( +t[2],10)-1,a=t[3],u=parseInt(t[4],10),c=parseInt(t[5],10),l=parseInt(t[6],10),h=t[7]; +h=h?1e3*parseFloat(h):0;var f,y=ju(e);return y!=null?(f=new Date(Date.UTC(i,s,a, +u,c,l,h)),Mr(i)&&f.setUTCFullYear(i),y!==0&&f.setTime(f.getTime()-y)):(f=new Date( +i,s,a,u,c,l,h),Mr(i)&&f.setFullYear(i)),f},"parseDate");function $u(r){var e=Ou. +exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=Wi(t));var i=parseInt(e[2], +10)-1,s=e[3],a=new Date(t,i,s);return Mr(t)&&a.setFullYear(t),a}}o($u,"getDate"); +function ju(r){if(r.endsWith("+00"))return 0;var e=ku.exec(r.split(" ")[1]);if(e){ +var t=e[1];if(t==="Z")return 0;var n=t==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt( +e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}o(ju,"timeZoneOffset");function Wi(r){ +return-(r-1)}o(Wi,"bcYearToNegativeYear");function Mr(r){return r>=0&&r<100}o(Mr, +"is0To99")});var Ji=B((Nf,zi)=>{p();zi.exports=Ku;var Hu=Object.prototype.hasOwnProperty;function Ku(r){ +for(var e=1;e{"use strict";p();var Wu=Ji();Zi.exports=Ve;function Ve(r){if(!(this instanceof +Ve))return new Ve(r);Wu(this,ic(r))}o(Ve,"PostgresInterval");var Gu=["seconds","\ +minutes","hours","days","months","years"];Ve.prototype.toPostgres=function(){var r=Gu. +filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")< +0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e=== +"seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/, +"")),t+" "+e},this).join(" ")};var Vu={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ +M",seconds:"S"},zu=["years","months","days"],Ju=["hours","minutes","seconds"];Ve. +prototype.toISOString=Ve.prototype.toISO=function(){var r=zu.map(t,this).join(""), +e=Ju.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== +"seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/, +"")),i+Vu[n]}};var Dr="([+-]?\\d+)",Yu=Dr+"\\s+years?",Zu=Dr+"\\s+mons?",Xu=Dr+"\ +\\s+days?",ec="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",tc=new RegExp([ +Yu,Zu,Xu,ec].map(function(r){return"("+r+")?"}).join("\\s*")),Yi={years:2,months:4, +days:6,hours:9,minutes:10,seconds:11,milliseconds:12},rc=["hours","minutes","sec\ +onds","milliseconds"];function nc(r){var e=r+"000000".slice(r.length);return parseInt( +e,10)/1e3}o(nc,"parseMilliseconds");function ic(r){if(!r)return{};var e=tc.exec( +r),t=e[8]==="-";return Object.keys(Yi).reduce(function(n,i){var s=Yi[i],a=e[s];return!a|| +(a=i==="milliseconds"?nc(a):parseInt(a,10),!a)||(t&&~rc.indexOf(i)&&(a*=-1),n[i]= +a),n},{})}o(ic,"parse")});var ts=B((kf,es)=>{"use strict";p();es.exports=o(function(e){if(/^\\x/.test(e))return new w( +e.substr(2),"hex");for(var t="",n=0;n{p();var pt=Rr(),yt=Nr(),Qt=Vi(),ns=Xi(),is=ts();function $t(r){ +return o(function(t){return t===null?t:r(t)},"nullAllowed")}o($t,"allowNull");function ss(r){ +return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| +r==="1"}o(ss,"parseBool");function sc(r){return r?pt.parse(r,ss):null}o(sc,"pars\ +eBoolArray");function ac(r){return parseInt(r,10)}o(ac,"parseBaseTenInt");function qr(r){ +return r?pt.parse(r,$t(ac)):null}o(qr,"parseIntegerArray");function oc(r){return r? +pt.parse(r,$t(function(e){return as(e).trim()})):null}o(oc,"parseBigIntegerArray"); +var uc=o(function(r){if(!r)return null;var e=yt.create(r,function(t){return t!== +null&&(t=Qr(t)),t});return e.parse()},"parsePointArray"),Fr=o(function(r){if(!r) +return null;var e=yt.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); +return e.parse()},"parseFloatArray"),we=o(function(r){if(!r)return null;var e=yt. +create(r);return e.parse()},"parseStringArray"),Or=o(function(r){if(!r)return null; +var e=yt.create(r,function(t){return t!==null&&(t=Qt(t)),t});return e.parse()},"\ +parseDateArray"),cc=o(function(r){if(!r)return null;var e=yt.create(r,function(t){ +return t!==null&&(t=ns(t)),t});return e.parse()},"parseIntervalArray"),lc=o(function(r){ +return r?pt.parse(r,$t(is)):null},"parseByteAArray"),kr=o(function(r){return parseInt( +r,10)},"parseInteger"),as=o(function(r){var e=String(r);return/^\d+$/.test(e)?e: +r},"parseBigInteger"),rs=o(function(r){return r?pt.parse(r,$t(JSON.parse)):null}, +"parseJsonArray"),Qr=o(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- +1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),hc=o(function(r){ +if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i{"use strict";p();var fe=1e6;function dc(r){var e=r.readInt32BE( +0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,a,u, +c,l,h;{if(s=e%fe,e=e/fe>>>0,a=4294967296*s+t,t=a/fe>>>0,u=""+(a-fe*t),t===0&&e=== +0)return n+u+i;for(c="",l=6-u.length,h=0;h>> +0,a=4294967296*s+t,t=a/fe>>>0,u=""+(a-fe*t),t===0&&e===0)return n+u+i;for(c="",l= +6-u.length,h=0;h>>0,a=4294967296*s+t,t=a/ +fe>>>0,u=""+(a-fe*t),t===0&&e===0)return n+u+i;for(c="",l=6-u.length,h=0;h{p();var pc=ls(),G=o(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(m,b,U){ +return m*Math.pow(2,U)+b};var s=t>>3,a=o(function(m){return n?~m&255:m},"inv"),u=255, +c=8-t%8;e>t%8);var l=0;t%8+e>=8&&(l=i(0,a(r[s])& +u,c));for(var h=e+t>>3,f=s+1;f0&& +(l=i(l,a(r[h])>>8-y,y)),l},"parseBits"),ds=o(function(r,e,t){var n=Math.pow(2,t- +1)-1,i=G(r,1),s=G(r,t,1);if(s===0)return 0;var a=1,u=o(function(l,h,f){l===0&&(l= +1);for(var y=1;y<=f;y++)a/=2,(h&1<0&&(l+=a);return l},"parsePrecisionBits"), +c=G(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),yc=o(function(r){return G(r,1)==1?-1* +(G(r,15,1,!0)+1):G(r,15,1)},"parseInt16"),hs=o(function(r){return G(r,1)==1?-1*(G( +r,31,1,!0)+1):G(r,31,1)},"parseInt32"),wc=o(function(r){return ds(r,23,8)},"pars\ +eFloat32"),mc=o(function(r){return ds(r,52,11)},"parseFloat64"),gc=o(function(r){ +var e=G(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,G(r,16,16)),n=0,i=[], +s=G(r,16),a=0;a>3,(i+=h<<3)>>3), +f;console.log("ERROR: ElementType not implemented: "+l)},"parseElement"),c=o(function(l,h){ +var f=[],y;if(l.length>1){var m=l.shift();for(y=0;y0},"parseBool"),bc=o(function(r){r(20,pc),r(21,yc),r(23,hs),r(26, +hs),r(1700,gc),r(700,wc),r(701,mc),r(16,Ec),r(1114,fs.bind(null,!1)),r(1184,fs.bind( +null,!0)),r(1e3,wt),r(1007,wt),r(1016,wt),r(1008,wt),r(1009,wt),r(25,Sc)},"init"); +ps.exports={init:bc}});var ms=B((Zf,ws)=>{p();ws.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, +SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, +TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, +BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186, +TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, +REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, +PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var St=B(gt=>{p();var xc=us(),Ac=ys(),vc=Nr(),Cc=ms();gt.getTypeParser=_c;gt.setTypeParser= +Tc;gt.arrayParser=vc;gt.builtins=Cc;var mt={text:{},binary:{}};function gs(r){return String( +r)}o(gs,"noParse");function _c(r,e){return e=e||"text",mt[e]&&mt[e][r]||gs}o(_c, +"getTypeParser");function Tc(r,e,t){typeof e=="function"&&(t=e,e="text"),mt[e][r]= +t}o(Tc,"setTypeParser");xc.init(function(r,e){mt.text[r]=e});Ac.init(function(r,e){ +mt.binary[r]=e})});var Et=B((nd,$r)=>{"use strict";p();$r.exports={host:"localhost",user:S.platform=== +"win32"?S.env.USERNAME:S.env.USER,database:void 0,password:null,connectionString:void 0, +port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1, +application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1, +statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1, +connect_timeout:0,keepalives:1,keepalives_idle:0};var ze=St(),Lc=ze.getTypeParser( +20,"text"),Uc=ze.getTypeParser(1016,"text");$r.exports.__defineSetter__("parseIn\ +t8",function(r){ze.setTypeParser(20,"text",r?ze.getTypeParser(23,"text"):Lc),ze. +setTypeParser(1016,"text",r?ze.getTypeParser(1007,"text"):Uc)})});var bt=B((sd,Es)=>{"use strict";p();var Ic=(Pr(),X(Ir)),Pc=Et();function Bc(r){var e=r. +replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}o(Bc,"escapeElement"); +function Ss(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> +"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Ss(r[t]):r[t]instanceof w?e+="\\\\x"+r[t]. +toString("hex"):e+=Bc(jt(r[t]));return e=e+"}",e}o(Ss,"arrayString");var jt=o(function(r,e){ +if(r==null)return null;if(r instanceof w)return r;if(ArrayBuffer.isView(r)){var t=w. +from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice( +r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?Pc.parseInputDatesAsUTC? +Mc(r):Nc(r):Array.isArray(r)?Ss(r):typeof r=="object"?Rc(r,e):r.toString()},"pre\ +pareValue");function Rc(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. +indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+ +r+'" for query');return e.push(r),jt(r.toPostgres(jt),e)}return JSON.stringify(r)} +o(Rc,"prepareObject");function oe(r,e){for(r=""+r;r.length{"use strict";p();var Hr=(Pr(),X(Ir));function Fc(r){if(r.indexOf( +"SCRAM-SHA-256")===-1)throw new Error("SASL: Only mechanism SCRAM-SHA-256 is cur\ +rently supported");let e=Hr.randomBytes(18).toString("base64");return{mechanism:"\ +SCRAM-SHA-256",clientNonce:e,response:"n,,n=*,r="+e,message:"SASLInitialResponse"}} +o(Fc,"startSession");function Oc(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( +"SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error( +"SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(typeof t!= +"string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a\ + string");let n=$c(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== +r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n\ +once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ +er nonce does not start with client nonce");var i=w.from(n.salt,"base64"),s=Kc(e, +i,n.iteration),a=Je(s,"Client Key"),u=Hc(a),c="n=*,r="+r.clientNonce,l="r="+n.nonce+ +",s="+n.salt+",i="+n.iteration,h="c=biws,r="+n.nonce,f=c+","+l+","+h,y=Je(u,f),m=As( +a,y),b=m.toString("base64"),U=Je(s,"Server Key"),v=Je(U,f);r.message="SASLRespon\ +se",r.serverSignature=v.toString("base64"),r.response=h+",p="+b}o(Oc,"continueSe\ +ssion");function kc(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ +st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ +CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=jc( +e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: s\ +erver signature does not match")}o(kc,"finalizeSession");function Qc(r){if(typeof r!= +"string")throw new TypeError("SASL: text must be a string");return r.split("").map( +(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}o(Qc,"isPrintableC\ +hars");function bs(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(r)}o(bs,"isBase64");function xs(r){if(typeof r!="string")throw new TypeError( +"SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{ +if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0], +n=e.substring(2);return[t,n]}))}o(xs,"parseAttributePairs");function $c(r){let e=xs( +r),t=e.get("r");if(t){if(!Qc(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ +E: nonce must only contain printable characters")}else throw new Error("SASL: SC\ +RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!bs(n))throw new Error( +"SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("S\ +ASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/. +test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration cou\ +nt")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); +let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}o($c,"parseServerFirstMe\ +ssage");function jc(r){let t=xs(r).get("v");if(t){if(!bs(t))throw new Error("SAS\ +L: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error( +"SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}} +o(jc,"parseServerFinalMessage");function As(r,e){if(!w.isBuffer(r))throw new TypeError( +"first argument must be a Buffer");if(!w.isBuffer(e))throw new TypeError("second\ + argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer leng\ +ths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return w. +from(r.map((t,n)=>r[n]^e[n]))}o(As,"xorBuffers");function Hc(r){return Hr.createHash( +"sha256").update(r).digest()}o(Hc,"sha256");function Je(r,e){return Hr.createHmac( +"sha256",r).update(e).digest()}o(Je,"hmacSha256");function Kc(r,e,t){for(var n=Je( +r,w.concat([e,w.from([0,0,0,1])])),i=n,s=0;sWc});function Wc(...r){return r.join("/")}var Wr=le(()=>{ +"use strict";p();o(Wc,"join")});var Gr={};pe(Gr,{stat:()=>Gc});function Gc(r,e){e(new Error("No filesystem"))}var Vr=le( +()=>{"use strict";p();o(Gc,"stat")});var zr={};pe(zr,{default:()=>Vc});var Vc,Jr=le(()=>{"use strict";p();Vc={}});var _s={};pe(_s,{StringDecoder:()=>Yr});var Yr,Ts=le(()=>{"use strict";p();Yr=class{static{ +o(this,"StringDecoder")}td;constructor(e){this.td=new TextDecoder(e)}write(e){return this. +td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}}});var Ps=B((gd,Is)=>{"use strict";p();var{Transform:zc}=(Jr(),X(zr)),{StringDecoder:Jc}=(Ts(),X(_s)), +Ie=Symbol("last"),Ht=Symbol("decoder");function Yc(r,e,t){let n;if(this.overflow){ +if(n=this[Ht].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. +overflow=!1}else this[Ie]+=this[Ht].write(r),n=this[Ie].split(this.matcher);this[Ie]= +n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ +t(new Error("maximum buffer reached"));return}t()}o(Yc,"transform");function Zc(r){ +if(this[Ie]+=this[Ht].end(),this[Ie])try{Us(this,this.mapper(this[Ie]))}catch(e){ +return r(e)}r()}o(Zc,"flush");function Us(r,e){e!==void 0&&r.push(e)}o(Us,"push"); +function Ls(r){return r}o(Ls,"noop");function Xc(r,e,t){switch(r=r||/\r?\n/,e=e|| +Ls,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== +"object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2: +typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Ls)}t=Object. +assign({},t),t.autoDestroy=!0,t.transform=Yc,t.flush=Zc,t.readableObjectMode=!0; +let n=new zc(t);return n[Ie]="",n[Ht]=new Jc("utf8"),n.matcher=r,n.mapper=e,n.maxLength= +t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ +this._writableState.errorEmitted=!1,s(i)},n}o(Xc,"split");Is.exports=Xc});var Ns=B((bd,ve)=>{"use strict";p();var Bs=(Wr(),X(Kr)),el=(Jr(),X(zr)).Stream,tl=Ps(), +Rs=(ht(),X(lt)),rl=5432,Kt=S.platform==="win32",xt=S.stderr,nl=56,il=7,sl=61440, +al=32768;function ol(r){return(r&sl)==al}o(ol,"isRegFile");var Ye=["host","port", +"database","user","password"],Zr=Ye.length,ul=Ye[Zr-1];function Xr(){var r=xt instanceof +el&&xt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` +`);xt.write(Rs.format.apply(Rs,e))}}o(Xr,"warn");Object.defineProperty(ve.exports, +"isWin",{get:o(function(){return Kt},"get"),set:o(function(r){Kt=r},"set")});ve. +exports.warnTo=function(r){var e=xt;return xt=r,e};ve.exports.getFileName=function(r){ +var e=r||S.env,t=e.PGPASSFILE||(Kt?Bs.join(e.APPDATA||"./","postgresql","pgpass.\ +conf"):Bs.join(e.HOME||"./",".pgpass"));return t};ve.exports.usePgPass=function(r,e){ +return Object.prototype.hasOwnProperty.call(S.env,"PGPASSWORD")?!1:Kt?!0:(e=e||"\ +",ol(r.mode)?r.mode&(nl|il)?(Xr('WARNING: password file "%s" has group or \ +world access; permissions should be u=rw (0600) or less',e),!1):!0:(Xr('WARNING:\ + password file "%s" is not a plain file',e),!1))};var cl=ve.exports.match=function(r,e){ +return Ye.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||rl)===Number( +e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};ve.exports.getPassword=function(r,e,t){ +var n,i=e.pipe(tl());function s(c){var l=ll(c);l&&hl(l)&&cl(r,l)&&(n=l[ul],i.end())} +o(s,"onLine");var a=o(function(){e.destroy(),t(n)},"onEnd"),u=o(function(c){e.destroy(), +Xr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. +on("data",s).on("end",a).on("error",u)};var ll=ve.exports.parseLine=function(r){ +if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,a={}, +u=!1,c=o(function(h,f,y){var m=r.substring(f,y);Object.hasOwnProperty.call(S.env, +"PGPASS_NO_DEESCAPE")||(m=m.replace(/\\([:\\])/g,"$1")),a[Ye[h]]=m},"addToObj"), +l=0;l=0&&e==":"&&t!=="\\"&&(c(n,i,l+1),i=l+2,n+=1)}return a=Object.keys(a).length=== +Zr?a:null,a},hl=ve.exports.isValidEntry=function(r){for(var e={0:function(a){return a. +length>0},1:function(a){return a==="*"?!0:(a=Number(a),isFinite(a)&&a>0&&a<9007199254740992&& +Math.floor(a)===a)},2:function(a){return a.length>0},3:function(a){return a.length> +0},4:function(a){return a.length>0}},t=0;t{"use strict";p();var vd=(Wr(),X(Kr)),Ms=(Vr(),X(Gr)),Wt=Ns(); +en.exports=function(r,e){var t=Wt.getFileName();Ms.stat(t,function(n,i){if(n||!Wt. +usePgPass(i,t))return e(void 0);var s=Ms.createReadStream(t);Wt.getPassword(r,s, +e)})};en.exports.warnTo=Wt.warnTo});var Vt=B((Td,qs)=>{"use strict";p();var fl=St();function Gt(r){this._types=r||fl, +this.text={},this.binary={}}o(Gt,"TypeOverrides");Gt.prototype.getOverrides=function(r){ +switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}}; +Gt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), +this.getOverrides(e)[r]=t};Gt.prototype.getTypeParser=function(r,e){return e=e|| +"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};qs.exports=Gt});var Fs={};pe(Fs,{default:()=>dl});var dl,Os=le(()=>{"use strict";p();dl={}});var ks={};pe(ks,{parse:()=>tn});function tn(r,e=!1){let{protocol:t}=new URL(r),n="\ +http:"+r.substring(t.length),{username:i,password:s,host:a,hostname:u,port:c,pathname:l, +search:h,searchParams:f,hash:y}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( +i),l=decodeURIComponent(l);let m=i+":"+s,b=e?Object.fromEntries(f.entries()):h;return{ +href:r,protocol:t,auth:m,username:i,password:s,host:a,hostname:u,port:c,pathname:l, +search:h,query:b,hash:y}}var rn=le(()=>{"use strict";p();o(tn,"parse")});var $s=B((Rd,Qs)=>{"use strict";p();var pl=(rn(),X(ks)),nn=(Vr(),X(Gr));function sn(r){ +if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=pl. +parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, +"%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- +1]);var i=(e.auth||":").split(":");if(t.user=i[0],t.password=i.splice(1).join(":"), +t.port=e.port,e.protocol=="socket:")return t.host=decodeURI(e.pathname),t.database= +e.query.db,t.client_encoding=e.query.encoding,t;t.host||(t.host=e.hostname);var s=e. +pathname;if(!t.host&&s&&/^%2f/i.test(s)){var a=s.split("/");t.host=decodeURIComponent( +a[0]),s=a.splice(1).join("/")}switch(s&&s.charAt(0)==="/"&&(s=s.slice(1)||null), +t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0"&& +(t.ssl=!1),(t.sslcert||t.sslkey||t.sslrootcert||t.sslmode)&&(t.ssl={}),t.sslcert&& +(t.ssl.cert=nn.readFileSync(t.sslcert).toString()),t.sslkey&&(t.ssl.key=nn.readFileSync( +t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=nn.readFileSync(t.sslrootcert).toString()), +t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ +ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} +return t}o(sn,"parse");Qs.exports=sn;sn.parse=sn});var zt=B((Dd,Ks)=>{"use strict";p();var yl=(Os(),X(Fs)),Hs=Et(),js=$s().parse,ue=o( +function(r,e,t){return t===void 0?t=S.env["PG"+r.toUpperCase()]:t===!1||(t=S.env[t]), +e[r]||t||Hs[r]},"val"),wl=o(function(){switch(S.env.PGSSLMODE){case"disable":return!1;case"\ +prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": +return{rejectUnauthorized:!1}}return Hs.ssl},"readSSLConfigFromEnvironment"),Ze=o( +function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ +teParamValue"),me=o(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Ze(n))},"ad\ +d"),an=class{static{o(this,"ConnectionParameters")}constructor(e){e=typeof e=="s\ +tring"?js(e):e||{},e.connectionString&&(e=Object.assign({},e,js(e.connectionString))), +this.user=ue("user",e),this.database=ue("database",e),this.database===void 0&&(this. +database=this.user),this.port=parseInt(ue("port",e),10),this.host=ue("host",e),Object. +defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:ue( +"password",e)}),this.binary=ue("binary",e),this.options=ue("options",e),this.ssl= +typeof e.ssl>"u"?wl():e.ssl,typeof this.ssl=="string"&&this.ssl==="true"&&(this. +ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}),this.ssl&&this. +ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this.client_encoding= +ue("client_encoding",e),this.replication=ue("replication",e),this.isDomainSocket= +!(this.host||"").indexOf("/"),this.application_name=ue("application_name",e,"PGA\ +PPNAME"),this.fallback_application_name=ue("fallback_application_name",e,!1),this. +statement_timeout=ue("statement_timeout",e,!1),this.lock_timeout=ue("lock_timeou\ +t",e,!1),this.idle_in_transaction_session_timeout=ue("idle_in_transaction_sessio\ +n_timeout",e,!1),this.query_timeout=ue("query_timeout",e,!1),e.connectionTimeoutMillis=== +void 0?this.connect_timeout=S.env.PGCONNECT_TIMEOUT||0:this.connect_timeout=Math. +floor(e.connectionTimeoutMillis/1e3),e.keepAlive===!1?this.keepalives=0:e.keepAlive=== +!0&&(this.keepalives=1),typeof e.keepAliveInitialDelayMillis=="number"&&(this.keepalives_idle= +Math.floor(e.keepAliveInitialDelayMillis/1e3))}getLibpqConnectionString(e){var t=[]; +me(t,this,"user"),me(t,this,"password"),me(t,this,"port"),me(t,this,"application\ +_name"),me(t,this,"fallback_application_name"),me(t,this,"connect_timeout"),me(t, +this,"options");var n=typeof this.ssl=="object"?this.ssl:this.ssl?{sslmode:this. +ssl}:{};if(me(t,n,"sslmode"),me(t,n,"sslca"),me(t,n,"sslkey"),me(t,n,"sslcert"), +me(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ze(this.database)),this.replication&& +t.push("replication="+Ze(this.replication)),this.host&&t.push("host="+Ze(this.host)), +this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ +ent_encoding="+Ze(this.client_encoding)),yl.lookup(this.host,function(i,s){return i? +e(i,null):(t.push("hostaddr="+Ze(s)),e(null,t.join(" ")))})}};Ks.exports=an});var Vs=B((Od,Gs)=>{"use strict";p();var ml=St(),Ws=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +on=class{static{o(this,"Result")}constructor(e,t){this.command=null,this.rowCount= +null,this.oid=null,this.rows=[],this.fields=[],this._parsers=void 0,this._types= +t,this.RowCtor=null,this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow= +this._parseRowAsArray)}addCommandComplete(e){var t;e.text?t=Ws.exec(e.text):t=Ws. +exec(e.command),t&&(this.command=t[1],t[3]?(this.oid=parseInt(t[2],10),this.rowCount= +parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt(t[2],10)))}_parseRowAsArray(e){ +for(var t=new Array(e.length),n=0,i=e.length;n{"use strict";p();var{EventEmitter:gl}=Ue(),zs=Vs(),Js=bt(),un=class extends gl{static{ +o(this,"Query")}constructor(e,t,n){super(),e=Js.normalizeQueryConfig(e,t,n),this. +text=e.text,this.values=e.values,this.rows=e.rows,this.types=e.types,this.name=e. +name,this.binary=e.binary,this.portal=e.portal||"",this.callback=e.callback,this. +_rowMode=e.rowMode,S.domain&&e.callback&&(this.callback=S.domain.bind(e.callback)), +this._result=new zs(this._rowMode,this.types),this._results=this._result,this.isPreparedStatement= +!1,this._canceledDueToError=!1,this._promise=null}requiresPreparation(){return this. +name||this.rows?!0:!this.text||!this.values?!1:this.values.length>0}_checkForMultirow(){ +this._result.command&&(Array.isArray(this._results)||(this._results=[this._result]), +this._result=new zs(this._rowMode,this.types),this._results.push(this._result))}handleRowDescription(e){ +this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this. +callback||!this.listeners("row").length}handleDataRow(e){let t;if(!this._canceledDueToError){ +try{t=this._result.parseRow(e.fields)}catch(n){this._canceledDueToError=n;return} +this.emit("row",t,this._result),this._accumulateRows&&this._result.addRow(t)}}handleCommandComplete(e,t){ +this._checkForMultirow(),this._result.addCommandComplete(e),this.rows&&t.sync()}handleEmptyQuery(e){ +this.rows&&e.sync()}handleError(e,t){if(this._canceledDueToError&&(e=this._canceledDueToError, +this._canceledDueToError=!1),this.callback)return this.callback(e);this.emit("er\ +ror",e)}handleReadyForQuery(e){if(this._canceledDueToError)return this.handleError( +this._canceledDueToError,e);if(this.callback)try{this.callback(null,this._results)}catch(t){ +S.nextTick(()=>{throw t})}this.emit("end",this._results)}submit(e){if(typeof this. +text!="string"&&typeof this.name!="string")return new Error("A query must have e\ +ither text or a name. Supplying neither is unsupported.");let t=e.parsedStatements[this. +name];return this.text&&t&&this.text!==t?new Error(`Prepared statements must be \ +unique - '${this.name}' was used for a different statement`):this.values&&!Array. +isArray(this.values)?new Error("Query values must be an array"):(this.requiresPreparation()? +this.prepare(e):e.query(this.text),null)}hasBeenParsed(e){return this.name&&e.parsedStatements[this. +name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execute( +{portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.isPreparedStatement= +!0,this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types}); +try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this. +binary,valueMapper:Js.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( +{type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ +e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};Ys.exports=un});var ta={};pe(ta,{Socket:()=>ge,isIP:()=>Sl});function Sl(r){return 0}var ea,Xs,ge, +Jt=le(()=>{"use strict";p();ea=Oe(Ue(),1);o(Sl,"isIP");Xs=/^[^.]+\./,ge=class r extends ea.EventEmitter{static{ +o(this,"Socket")}static defaults={poolQueryViaFetch:!1,fetchEndpoint:o((e,t,n)=>{ +let i;return n?.jwtAuth?i=e.replace(Xs,"apiauth."):i=e.replace(Xs,"api."),"https\ +://"+i+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0,webSocketConstructor:void 0, +wsProxy:o(e=>e+"/v2","wsProxy"),useSecureWebSocket:!0,forceDisablePgSSL:!0,coalesceWrites:!0, +pipelineConnect:"password",subtls:void 0,rootCerts:"",pipelineTLS:!1,disableSNI:!1};static opts={};opts={};static get poolQueryViaFetch(){ +return r.opts.poolQueryViaFetch??r.defaults.poolQueryViaFetch}static set poolQueryViaFetch(e){ +r.opts.poolQueryViaFetch=e}static get fetchEndpoint(){return r.opts.fetchEndpoint?? +r.defaults.fetchEndpoint}static set fetchEndpoint(e){r.opts.fetchEndpoint=e}static get fetchConnectionCache(){ +return!0}static set fetchConnectionCache(e){console.warn("The `fetchConnectionCa\ +che` option is deprecated (now always `true`)")}static get fetchFunction(){return r. +opts.fetchFunction??r.defaults.fetchFunction}static set fetchFunction(e){r.opts. +fetchFunction=e}static get webSocketConstructor(){return r.opts.webSocketConstructor?? +r.defaults.webSocketConstructor}static set webSocketConstructor(e){r.opts.webSocketConstructor= +e}get webSocketConstructor(){return this.opts.webSocketConstructor??r.webSocketConstructor}set webSocketConstructor(e){ +this.opts.webSocketConstructor=e}static get wsProxy(){return r.opts.wsProxy??r.defaults. +wsProxy}static set wsProxy(e){r.opts.wsProxy=e}get wsProxy(){return this.opts.wsProxy?? +r.wsProxy}set wsProxy(e){this.opts.wsProxy=e}static get coalesceWrites(){return r. +opts.coalesceWrites??r.defaults.coalesceWrites}static set coalesceWrites(e){r.opts. +coalesceWrites=e}get coalesceWrites(){return this.opts.coalesceWrites??r.coalesceWrites}set coalesceWrites(e){ +this.opts.coalesceWrites=e}static get useSecureWebSocket(){return r.opts.useSecureWebSocket?? +r.defaults.useSecureWebSocket}static set useSecureWebSocket(e){r.opts.useSecureWebSocket= +e}get useSecureWebSocket(){return this.opts.useSecureWebSocket??r.useSecureWebSocket}set useSecureWebSocket(e){ +this.opts.useSecureWebSocket=e}static get forceDisablePgSSL(){return r.opts.forceDisablePgSSL?? +r.defaults.forceDisablePgSSL}static set forceDisablePgSSL(e){r.opts.forceDisablePgSSL= +e}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??r.forceDisablePgSSL}set forceDisablePgSSL(e){ +this.opts.forceDisablePgSSL=e}static get disableSNI(){return r.opts.disableSNI?? +r.defaults.disableSNI}static set disableSNI(e){r.opts.disableSNI=e}get disableSNI(){ +return this.opts.disableSNI??r.disableSNI}set disableSNI(e){this.opts.disableSNI= +e}static get pipelineConnect(){return r.opts.pipelineConnect??r.defaults.pipelineConnect}static set pipelineConnect(e){ +r.opts.pipelineConnect=e}get pipelineConnect(){return this.opts.pipelineConnect?? +r.pipelineConnect}set pipelineConnect(e){this.opts.pipelineConnect=e}static get subtls(){ +return r.opts.subtls??r.defaults.subtls}static set subtls(e){r.opts.subtls=e}get subtls(){ +return this.opts.subtls??r.subtls}set subtls(e){this.opts.subtls=e}static get pipelineTLS(){ +return r.opts.pipelineTLS??r.defaults.pipelineTLS}static set pipelineTLS(e){r.opts. +pipelineTLS=e}get pipelineTLS(){return this.opts.pipelineTLS??r.pipelineTLS}set pipelineTLS(e){ +this.opts.pipelineTLS=e}static get rootCerts(){return r.opts.rootCerts??r.defaults. +rootCerts}static set rootCerts(e){r.opts.rootCerts=e}get rootCerts(){return this. +opts.rootCerts??r.rootCerts}set rootCerts(e){this.opts.rootCerts=e}wsProxyAddrForHost(e,t){ +let n=this.wsProxy;if(n===void 0)throw new Error("No WebSocket proxy is configur\ +ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ +proxy-string--host-string-port-number--string--string");return typeof n=="functi\ +on"?n(e,t):`${n}?address=${e}:${t}`}connecting=!1;pending=!0;writable=!0;encrypted=!1;authorized=!1;destroyed=!1;ws=null;writeBuffer;tlsState=0;tlsRead;tlsWrite;setNoDelay(){ +return this}setKeepAlive(){return this}ref(){return this}unref(){return this}connect(e,t,n){ +this.connecting=!0,n&&this.once("connect",n);let i=o(()=>{this.connecting=!1,this. +pending=!1,this.emit("connect"),this.emit("ready")},"handleWebSocketOpen"),s=o((u,c=!1)=>{ +u.binaryType="arraybuffer",u.addEventListener("error",l=>{this.emit("error",l),this. +emit("close")}),u.addEventListener("message",l=>{if(this.tlsState===0){let h=w.from( +l.data);this.emit("data",h)}}),u.addEventListener("close",()=>{this.emit("close")}), +c?i():u.addEventListener("open",i)},"configureWebSocket"),a;try{a=this.wsProxyAddrForHost( +t,typeof e=="string"?parseInt(e,10):e)}catch(u){this.emit("error",u),this.emit("\ +close");return}try{let c=(this.useSecureWebSocket?"wss:":"ws:")+"//"+a;if(this.webSocketConstructor!== +void 0)this.ws=new this.webSocketConstructor(c),s(this.ws);else try{this.ws=new WebSocket( +c),s(this.ws)}catch{this.ws=new __unstable_WebSocket(c),s(this.ws)}}catch(u){let l=(this. +useSecureWebSocket?"https:":"http:")+"//"+a;fetch(l,{headers:{Upgrade:"websocket"}}). +then(h=>{if(this.ws=h.webSocket,this.ws==null)throw u;this.ws.accept(),s(this.ws, +!0)}).catch(h=>{this.emit("error",new Error(`All attempts to open a WebSocket to\ + connect to the database failed. Please refer to https://github.com/neondatabase\ +/serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined\ +. Details: ${h.message}`)),this.emit("close")})}}async startTls(e){if(this.subtls=== +void 0)throw new Error("For Postgres SSL connections, you must set `neonConfig.s\ +ubtls` to the subtls library. See https://github.com/neondatabase/serverless/blo\ +b/main/CONFIG.md for more information.");this.tlsState=1;let t=this.subtls.TrustedCert. +fromPEM(this.rootCerts),n=new this.subtls.WebSocketReadQueue(this.ws),i=n.read.bind( +n),s=this.rawWrite.bind(this),[a,u]=await this.subtls.startTls(e,t,i,s,{useSNI:!this. +disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0});this.tlsRead= +a,this.tlsWrite=u,this.tlsState=2,this.encrypted=!0,this.authorized=!0,this.emit( +"secureConnection",this),this.tlsReadLoop()}async tlsReadLoop(){for(;;){let e=await this. +tlsRead();if(e===void 0)break;{let t=w.from(e);this.emit("data",t)}}}rawWrite(e){ +if(!this.coalesceWrites){this.ws.send(e);return}if(this.writeBuffer===void 0)this. +writeBuffer=e,setTimeout(()=>{this.ws.send(this.writeBuffer),this.writeBuffer=void 0}, +0);else{let t=new Uint8Array(this.writeBuffer.length+e.length);t.set(this.writeBuffer), +t.set(e,this.writeBuffer.length),this.writeBuffer=t}}write(e,t="utf8",n=i=>{}){return e. +length===0?(n(),!0):(typeof e=="string"&&(e=w.from(e,t)),this.tlsState===0?(this. +rawWrite(e),n()):this.tlsState===1?this.once("secureConnection",()=>{this.write( +e,t,n)}):(this.tlsWrite(e),n()),!0)}end(e=w.alloc(0),t="utf8",n=()=>{}){return this. +write(e,t,()=>{this.ws.close(),n()}),this}destroy(){return this.destroyed=!0,this. +end()}}});var An=B(I=>{"use strict";p();Object.defineProperty(I,"__esModule",{value:!0});I. +NoticeMessage=I.DataRowMessage=I.CommandCompleteMessage=I.ReadyForQueryMessage=I. +NotificationResponseMessage=I.BackendKeyDataMessage=I.AuthenticationMD5Password= +I.ParameterStatusMessage=I.ParameterDescriptionMessage=I.RowDescriptionMessage=I. +Field=I.CopyResponse=I.CopyDataMessage=I.DatabaseError=I.copyDone=I.emptyQuery=I. +replicationStart=I.portalSuspended=I.noData=I.closeComplete=I.bindComplete=I.parseComplete= +void 0;I.parseComplete={name:"parseComplete",length:5};I.bindComplete={name:"bin\ +dComplete",length:5};I.closeComplete={name:"closeComplete",length:5};I.noData={name:"\ +noData",length:5};I.portalSuspended={name:"portalSuspended",length:5};I.replicationStart= +{name:"replicationStart",length:4};I.emptyQuery={name:"emptyQuery",length:4};I.copyDone= +{name:"copyDone",length:4};var cn=class extends Error{static{o(this,"DatabaseErr\ +or")}constructor(e,t,n){super(e),this.length=t,this.name=n}};I.DatabaseError=cn; +var ln=class{static{o(this,"CopyDataMessage")}constructor(e,t){this.length=e,this. +chunk=t,this.name="copyData"}};I.CopyDataMessage=ln;var hn=class{static{o(this,"\ +CopyResponse")}constructor(e,t,n,i){this.length=e,this.name=t,this.binary=n,this. +columnTypes=new Array(i)}};I.CopyResponse=hn;var fn=class{static{o(this,"Field")}constructor(e,t,n,i,s,a,u){ +this.name=e,this.tableID=t,this.columnID=n,this.dataTypeID=i,this.dataTypeSize=s, +this.dataTypeModifier=a,this.format=u}};I.Field=fn;var dn=class{static{o(this,"R\ +owDescriptionMessage")}constructor(e,t){this.length=e,this.fieldCount=t,this.name= +"rowDescription",this.fields=new Array(this.fieldCount)}};I.RowDescriptionMessage= +dn;var pn=class{static{o(this,"ParameterDescriptionMessage")}constructor(e,t){this. +length=e,this.parameterCount=t,this.name="parameterDescription",this.dataTypeIDs= +new Array(this.parameterCount)}};I.ParameterDescriptionMessage=pn;var yn=class{static{ +o(this,"ParameterStatusMessage")}constructor(e,t,n){this.length=e,this.parameterName= +t,this.parameterValue=n,this.name="parameterStatus"}};I.ParameterStatusMessage=yn; +var wn=class{static{o(this,"AuthenticationMD5Password")}constructor(e,t){this.length= +e,this.salt=t,this.name="authenticationMD5Password"}};I.AuthenticationMD5Password= +wn;var mn=class{static{o(this,"BackendKeyDataMessage")}constructor(e,t,n){this.length= +e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};I.BackendKeyDataMessage= +mn;var gn=class{static{o(this,"NotificationResponseMessage")}constructor(e,t,n,i){ +this.length=e,this.processId=t,this.channel=n,this.payload=i,this.name="notifica\ +tion"}};I.NotificationResponseMessage=gn;var Sn=class{static{o(this,"ReadyForQue\ +ryMessage")}constructor(e,t){this.length=e,this.status=t,this.name="readyForQuer\ +y"}};I.ReadyForQueryMessage=Sn;var En=class{static{o(this,"CommandCompleteMessag\ +e")}constructor(e,t){this.length=e,this.text=t,this.name="commandComplete"}};I.CommandCompleteMessage= +En;var bn=class{static{o(this,"DataRowMessage")}constructor(e,t){this.length=e,this. +fields=t,this.name="dataRow",this.fieldCount=t.length}};I.DataRowMessage=bn;var xn=class{static{ +o(this,"NoticeMessage")}constructor(e,t){this.length=e,this.message=t,this.name= +"notice"}};I.NoticeMessage=xn});var ra=B(Yt=>{"use strict";p();Object.defineProperty(Yt,"__esModule",{value:!0}); +Yt.Writer=void 0;var vn=class{static{o(this,"Writer")}constructor(e=256){this.size= +e,this.offset=5,this.headerPosition=0,this.buffer=w.allocUnsafe(e)}ensure(e){var t=this. +buffer.length-this.offset;if(t>1)+e;this. +buffer=w.allocUnsafe(i),n.copy(this.buffer)}}addInt32(e){return this.ensure(4),this. +buffer[this.offset++]=e>>>24&255,this.buffer[this.offset++]=e>>>16&255,this.buffer[this. +offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0&255,this}addInt16(e){return this. +ensure(2),this.buffer[this.offset++]=e>>>8&255,this.buffer[this.offset++]=e>>>0& +255,this}addCString(e){if(!e)this.ensure(1);else{var t=w.byteLength(e);this.ensure( +t+1),this.buffer.write(e,this.offset,"utf-8"),this.offset+=t}return this.buffer[this. +offset++]=0,this}addString(e=""){var t=w.byteLength(e);return this.ensure(t),this. +buffer.write(e,this.offset),this.offset+=t,this}add(e){return this.ensure(e.length), +e.copy(this.buffer,this.offset),this.offset+=e.length,this}join(e){if(e){this.buffer[this. +headerPosition]=e;let t=this.offset-(this.headerPosition+1);this.buffer.writeInt32BE( +t,this.headerPosition+1)}return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this. +join(e);return this.offset=5,this.headerPosition=0,this.buffer=w.allocUnsafe(this. +size),t}};Yt.Writer=vn});var ia=B(Xt=>{"use strict";p();Object.defineProperty(Xt,"__esModule",{value:!0}); +Xt.serialize=void 0;var Cn=ra(),V=new Cn.Writer,El=o(r=>{V.addInt16(3).addInt16( +0);for(let n of Object.keys(r))V.addCString(n).addCString(r[n]);V.addCString("cl\ +ient_encoding").addCString("UTF8");var e=V.addCString("").flush(),t=e.length+4;return new Cn. +Writer().addInt32(t).add(e).flush()},"startup"),bl=o(()=>{let r=w.allocUnsafe(8); +return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),xl=o(r=>V. +addCString(r).flush(112),"password"),Al=o(function(r,e){return V.addCString(r).addInt32( +w.byteLength(e)).addString(e),V.flush(112)},"sendSASLInitialResponseMessage"),vl=o( +function(r){return V.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),Cl=o( +r=>V.addCString(r).flush(81),"query"),na=[],_l=o(r=>{let e=r.name||"";e.length>63&& +(console.error("Warning! Postgres only supports 63 characters for query names."), +console.error("You supplied %s (%s)",e,e.length),console.error("This can cause c\ +onflicts and silent errors executing queries"));let t=r.types||na;for(var n=t.length, +i=V.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| +"",n=r.binary||!1,i=r.values||na,s=i.length;return V.addCString(e).addCString(t), +V.addInt16(s),Tl(i,r.valueMapper),V.addInt16(s),V.add(Xe.flush()),V.addInt16(n?1: +0),V.flush(66)},"bind"),Ul=w.from([69,0,0,0,9,0,0,0,0,0]),Il=o(r=>{if(!r||!r.portal&& +!r.rows)return Ul;let e=r.portal||"",t=r.rows||0,n=w.byteLength(e),i=4+n+1+4,s=w. +allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]= +0,s.writeUInt32BE(t,s.length-4),s},"execute"),Pl=o((r,e)=>{let t=w.allocUnsafe(16); +return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE( +r,8),t.writeInt32BE(e,12),t},"cancel"),_n=o((r,e)=>{let n=4+w.byteLength(e)+1,i=w. +allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i}, +"cstringMessage"),Bl=V.addCString("P").flush(68),Rl=V.addCString("S").flush(68), +Nl=o(r=>r.name?_n(68,`${r.type}${r.name||""}`):r.type==="P"?Bl:Rl,"describe"),Ml=o( +r=>{let e=`${r.type}${r.name||""}`;return _n(67,e)},"close"),Dl=o(r=>V.add(r).flush( +100),"copyData"),ql=o(r=>_n(102,r),"copyFail"),Zt=o(r=>w.from([r,0,0,0,4]),"code\ +OnlyBuffer"),Fl=Zt(72),Ol=Zt(83),kl=Zt(88),Ql=Zt(99),$l={startup:El,password:xl, +requestSsl:bl,sendSASLInitialResponseMessage:Al,sendSCRAMClientFinalMessage:vl,query:Cl, +parse:_l,bind:Ll,execute:Il,describe:Nl,close:Ml,flush:o(()=>Fl,"flush"),sync:o( +()=>Ol,"sync"),end:o(()=>kl,"end"),copyData:Dl,copyDone:o(()=>Ql,"copyDone"),copyFail:ql, +cancel:Pl};Xt.serialize=$l});var sa=B(er=>{"use strict";p();Object.defineProperty(er,"__esModule",{value:!0}); +er.BufferReader=void 0;var jl=w.allocUnsafe(0),Tn=class{static{o(this,"BufferRea\ +der")}constructor(e=0){this.offset=e,this.buffer=jl,this.encoding="utf-8"}setBuffer(e,t){ +this.offset=e,this.buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this. +offset+=2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){ +let e=this.buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this. +buffer.toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstring(){ +let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. +toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. +offset+e);return this.offset+=e,t}};er.BufferReader=Tn});var ua=B(tr=>{"use strict";p();Object.defineProperty(tr,"__esModule",{value:!0}); +tr.Parser=void 0;var z=An(),Hl=sa(),Ln=1,Kl=4,aa=Ln+Kl,oa=w.allocUnsafe(0),Un=class{static{ +o(this,"Parser")}constructor(e){if(this.buffer=oa,this.bufferLength=0,this.bufferOffset= +0,this.reader=new Hl.BufferReader,e?.mode==="binary")throw new Error("Binary mod\ +e not supported yet");this.mode=e?.mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this. +bufferOffset+this.bufferLength,i=this.bufferOffset;for(;i+aa<=n;){let s=this.buffer[i], +a=this.buffer.readUInt32BE(i+Ln),u=Ln+a;if(u+i<=n){let c=this.handlePacket(i+aa, +s,a,this.buffer);t(c),i+=u}else break}i===n?(this.buffer=oa,this.bufferLength=0, +this.bufferOffset=0):(this.bufferLength=n-i,this.bufferOffset=i)}mergeBuffer(e){ +if(this.bufferLength>0){let t=this.bufferLength+e.byteLength;if(t+this.bufferOffset> +this.buffer.byteLength){let i;if(t<=this.buffer.byteLength&&this.bufferOffset>=this. +bufferLength)i=this.buffer;else{let s=this.buffer.byteLength*2;for(;t>=s;)s*=2;i= +w.allocUnsafe(s)}this.buffer.copy(i,0,this.bufferOffset,this.bufferOffset+this.bufferLength), +this.buffer=i,this.bufferOffset=0}e.copy(this.buffer,this.bufferOffset+this.bufferLength), +this.bufferLength=t}else this.buffer=e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,t,n,i){ +switch(t){case 50:return z.bindComplete;case 49:return z.parseComplete;case 51:return z. +closeComplete;case 110:return z.noData;case 115:return z.portalSuspended;case 99: +return z.copyDone;case 87:return z.replicationStart;case 73:return z.emptyQuery;case 68: +return this.parseDataRowMessage(e,n,i);case 67:return this.parseCommandCompleteMessage( +e,n,i);case 90:return this.parseReadyForQueryMessage(e,n,i);case 65:return this. +parseNotificationMessage(e,n,i);case 82:return this.parseAuthenticationResponse( +e,n,i);case 83:return this.parseParameterStatusMessage(e,n,i);case 75:return this. +parseBackendKeyData(e,n,i);case 69:return this.parseErrorMessage(e,n,i,"error");case 78: +return this.parseErrorMessage(e,n,i,"notice");case 84:return this.parseRowDescriptionMessage( +e,n,i);case 116:return this.parseParameterDescriptionMessage(e,n,i);case 71:return this. +parseCopyInMessage(e,n,i);case 72:return this.parseCopyOutMessage(e,n,i);case 100: +return this.parseCopyData(e,n,i);default:return new z.DatabaseError("received in\ +valid response: "+t.toString(16),n,"error")}}parseReadyForQueryMessage(e,t,n){this. +reader.setBuffer(e,n);let i=this.reader.string(1);return new z.ReadyForQueryMessage( +t,i)}parseCommandCompleteMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader. +cstring();return new z.CommandCompleteMessage(t,i)}parseCopyData(e,t,n){let i=n. +slice(e,e+(t-4));return new z.CopyDataMessage(t,i)}parseCopyInMessage(e,t,n){return this. +parseCopyMessage(e,t,n,"copyInResponse")}parseCopyOutMessage(e,t,n){return this. +parseCopyMessage(e,t,n,"copyOutResponse")}parseCopyMessage(e,t,n,i){this.reader. +setBuffer(e,n);let s=this.reader.byte()!==0,a=this.reader.int16(),u=new z.CopyResponse( +t,i,s,a);for(let c=0;c{"use strict";p();Object.defineProperty(Pe,"__esModule",{value:!0}); +Pe.DatabaseError=Pe.serialize=Pe.parse=void 0;var Wl=An();Object.defineProperty( +Pe,"DatabaseError",{enumerable:!0,get:o(function(){return Wl.DatabaseError},"get")}); +var Gl=ia();Object.defineProperty(Pe,"serialize",{enumerable:!0,get:o(function(){ +return Gl.serialize},"get")});var Vl=ua();function zl(r,e){let t=new Vl.Parser;return r. +on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}o(zl,"parse");Pe. +parse=zl});var ca={};pe(ca,{connect:()=>Jl});function Jl({socket:r,servername:e}){return r. +startTls(e),r}var la=le(()=>{"use strict";p();o(Jl,"connect")});var Bn=B((dp,da)=>{"use strict";p();var ha=(Jt(),X(ta)),Yl=Ue().EventEmitter,{parse:Zl, +serialize:te}=In(),fa=te.flush(),Xl=te.sync(),eh=te.end(),Pn=class extends Yl{static{ +o(this,"Connection")}constructor(e){super(),e=e||{},this.stream=e.stream||new ha. +Socket,this._keepAlive=e.keepAlive,this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis, +this.lastBuffer=!1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this. +_emitMessage=!1;var t=this;this.on("newListener",function(n){n==="message"&&(t._emitMessage= +!0)})}connect(e,t){var n=this;this._connecting=!0,this.stream.setNoDelay(!0),this. +stream.connect(e,t),this.stream.once("connect",function(){n._keepAlive&&n.stream. +setKeepAlive(!0,n._keepAliveInitialDelayMillis),n.emit("connect")});let i=o(function(s){ +n._ending&&(s.code==="ECONNRESET"||s.code==="EPIPE")||n.emit("error",s)},"report\ +StreamError");if(this.stream.on("error",i),this.stream.on("close",function(){n.emit( +"end")}),!this.ssl)return this.attachListeners(this.stream);this.stream.once("da\ +ta",function(s){var a=s.toString("utf8");switch(a){case"S":break;case"N":return n. +stream.end(),n.emit("error",new Error("The server does not support SSL connectio\ +ns"));default:return n.stream.end(),n.emit("error",new Error("There was an error\ + establishing an SSL connection"))}var u=(la(),X(ca));let c={socket:n.stream};n. +ssl!==!0&&(Object.assign(c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),ha.isIP(t)=== +0&&(c.servername=t);try{n.stream=u.connect(c)}catch(l){return n.emit("error",l)} +n.attachListeners(n.stream),n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){ +e.on("end",()=>{this.emit("end")}),Zl(e,t=>{var n=t.name==="error"?"errorMessage": +t.name;this._emitMessage&&this.emit("message",t),this.emit(n,t)})}requestSsl(){this. +stream.write(te.requestSsl())}startup(e){this.stream.write(te.startup(e))}cancel(e,t){ +this._send(te.cancel(e,t))}password(e){this._send(te.password(e))}sendSASLInitialResponseMessage(e,t){ +this._send(te.sendSASLInitialResponseMessage(e,t))}sendSCRAMClientFinalMessage(e){ +this._send(te.sendSCRAMClientFinalMessage(e))}_send(e){return this.stream.writable? +this.stream.write(e):!1}query(e){this._send(te.query(e))}parse(e){this._send(te. +parse(e))}bind(e){this._send(te.bind(e))}execute(e){this._send(te.execute(e))}flush(){ +this.stream.writable&&this.stream.write(fa)}sync(){this._ending=!0,this._send(fa), +this._send(Xl)}ref(){this.stream.ref()}unref(){this.stream.unref()}end(){if(this. +_ending=!0,!this._connecting||!this.stream.writable){this.stream.end();return}return this. +stream.write(eh,()=>{this.stream.end()})}close(e){this._send(te.close(e))}describe(e){ +this._send(te.describe(e))}sendCopyFromChunk(e){this._send(te.copyData(e))}endCopyFrom(){ +this._send(te.copyDone())}sendCopyFail(e){this._send(te.copyFail(e))}};da.exports= +Pn});var wa=B((mp,ya)=>{"use strict";p();var th=Ue().EventEmitter,wp=(ht(),X(lt)),rh=bt(), +Rn=Cs(),nh=Ds(),ih=Vt(),sh=zt(),pa=Zs(),ah=Et(),oh=Bn(),rr=class extends th{static{ +o(this,"Client")}constructor(e){super(),this.connectionParameters=new sh(e),this. +user=this.connectionParameters.user,this.database=this.connectionParameters.database, +this.port=this.connectionParameters.port,this.host=this.connectionParameters.host, +Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0, +value:this.connectionParameters.password}),this.replication=this.connectionParameters. +replication;var t=e||{};this._Promise=t.Promise||_.Promise,this._types=new ih(t. +types),this._ending=!1,this._connecting=!1,this._connected=!1,this._connectionError= +!1,this._queryable=!0,this.connection=t.connection||new oh({stream:t.stream,ssl:this. +connectionParameters.ssl,keepAlive:t.keepAlive||!1,keepAliveInitialDelayMillis:t. +keepAliveInitialDelayMillis||0,encoding:this.connectionParameters.client_encoding|| +"utf8"}),this.queryQueue=[],this.binary=t.binary||ah.binary,this.processID=null, +this.secretKey=null,this.ssl=this.connectionParameters.ssl||!1,this.ssl&&this.ssl. +key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this._connectionTimeoutMillis= +t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=o(n=>{S.nextTick(()=>{n.handleError( +e,this.connection)})},"enqueueError");this.activeQuery&&(t(this.activeQuery),this. +activeQuery=null),this.queryQueue.forEach(t),this.queryQueue.length=0}_connect(e){ +var t=this,n=this.connection;if(this._connectionCallback=e,this._connecting||this. +_connected){let i=new Error("Client has already been connected. You cannot reuse\ + a client.");S.nextTick(()=>{e(i)});return}this._connecting=!0,this.connectionTimeoutHandle, +this._connectionTimeoutMillis>0&&(this.connectionTimeoutHandle=setTimeout(()=>{n. +_ending=!0,n.stream.destroy(new Error("timeout expired"))},this._connectionTimeoutMillis)), +this.host&&this.host.indexOf("/")===0?n.connect(this.host+"/.s.PGSQL."+this.port): +n.connect(this.port,this.host),n.on("connect",function(){t.ssl?n.requestSsl():n. +startup(t.getStartupConf())}),n.on("sslconnect",function(){n.startup(t.getStartupConf())}), +this._attachListeners(n),n.once("end",()=>{let i=this._ending?new Error("Connect\ +ion terminated"):new Error("Connection terminated unexpectedly");clearTimeout(this. +connectionTimeoutHandle),this._errorAllQueries(i),this._ending||(this._connecting&& +!this._connectionError?this._connectionCallback?this._connectionCallback(i):this. +_handleErrorEvent(i):this._connectionError||this._handleErrorEvent(i)),S.nextTick( +()=>{this.emit("end")})})}connect(e){if(e){this._connect(e);return}return new this. +_Promise((t,n)=>{this._connect(i=>{i?n(i):t()})})}_attachListeners(e){e.on("auth\ +enticationCleartextPassword",this._handleAuthCleartextPassword.bind(this)),e.on( +"authenticationMD5Password",this._handleAuthMD5Password.bind(this)),e.on("authen\ +ticationSASL",this._handleAuthSASL.bind(this)),e.on("authenticationSASLContinue", +this._handleAuthSASLContinue.bind(this)),e.on("authenticationSASLFinal",this._handleAuthSASLFinal. +bind(this)),e.on("backendKeyData",this._handleBackendKeyData.bind(this)),e.on("e\ +rror",this._handleErrorEvent.bind(this)),e.on("errorMessage",this._handleErrorMessage. +bind(this)),e.on("readyForQuery",this._handleReadyForQuery.bind(this)),e.on("not\ +ice",this._handleNotice.bind(this)),e.on("rowDescription",this._handleRowDescription. +bind(this)),e.on("dataRow",this._handleDataRow.bind(this)),e.on("portalSuspended", +this._handlePortalSuspended.bind(this)),e.on("emptyQuery",this._handleEmptyQuery. +bind(this)),e.on("commandComplete",this._handleCommandComplete.bind(this)),e.on( +"parseComplete",this._handleParseComplete.bind(this)),e.on("copyInResponse",this. +_handleCopyInResponse.bind(this)),e.on("copyData",this._handleCopyData.bind(this)), +e.on("notification",this._handleNotification.bind(this))}_checkPgPass(e){let t=this. +connection;typeof this.password=="function"?this._Promise.resolve().then(()=>this. +password()).then(n=>{if(n!==void 0){if(typeof n!="string"){t.emit("error",new TypeError( +"Password must be a string"));return}this.connectionParameters.password=this.password= +n}else this.connectionParameters.password=this.password=null;e()}).catch(n=>{t.emit( +"error",n)}):this.password!==null?e():nh(this.connectionParameters,n=>{n!==void 0&& +(this.connectionParameters.password=this.password=n),e()})}_handleAuthCleartextPassword(e){ +this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){ +this._checkPgPass(()=>{let t=rh.postgresMd5PasswordHash(this.user,this.password, +e.salt);this.connection.password(t)})}_handleAuthSASL(e){this._checkPgPass(()=>{ +this.saslSession=Rn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( +this.saslSession.mechanism,this.saslSession.response)})}_handleAuthSASLContinue(e){ +Rn.continueSession(this.saslSession,this.password,e.data),this.connection.sendSCRAMClientFinalMessage( +this.saslSession.response)}_handleAuthSASLFinal(e){Rn.finalizeSession(this.saslSession, +e.data),this.saslSession=null}_handleBackendKeyData(e){this.processID=e.processID, +this.secretKey=e.secretKey}_handleReadyForQuery(e){this._connecting&&(this._connecting= +!1,this._connected=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback&& +(this._connectionCallback(null,this),this._connectionCallback=null),this.emit("c\ +onnect"));let{activeQuery:t}=this;this.activeQuery=null,this.readyForQuery=!0,t&& +t.handleReadyForQuery(this.connection),this._pulseQueryQueue()}_handleErrorWhileConnecting(e){ +if(!this._connectionError){if(this._connectionError=!0,clearTimeout(this.connectionTimeoutHandle), +this._connectionCallback)return this._connectionCallback(e);this.emit("error",e)}}_handleErrorEvent(e){ +if(this._connecting)return this._handleErrorWhileConnecting(e);this._queryable=!1, +this._errorAllQueries(e),this.emit("error",e)}_handleErrorMessage(e){if(this._connecting) +return this._handleErrorWhileConnecting(e);let t=this.activeQuery;if(!t){this._handleErrorEvent( +e);return}this.activeQuery=null,t.handleError(e,this.connection)}_handleRowDescription(e){ +this.activeQuery.handleRowDescription(e)}_handleDataRow(e){this.activeQuery.handleDataRow( +e)}_handlePortalSuspended(e){this.activeQuery.handlePortalSuspended(this.connection)}_handleEmptyQuery(e){ +this.activeQuery.handleEmptyQuery(this.connection)}_handleCommandComplete(e){this. +activeQuery.handleCommandComplete(e,this.connection)}_handleParseComplete(e){this. +activeQuery.name&&(this.connection.parsedStatements[this.activeQuery.name]=this. +activeQuery.text)}_handleCopyInResponse(e){this.activeQuery.handleCopyInResponse( +this.connection)}_handleCopyData(e){this.activeQuery.handleCopyData(e,this.connection)}_handleNotification(e){ +this.emit("notification",e)}_handleNotice(e){this.emit("notice",e)}getStartupConf(){ +var e=this.connectionParameters,t={user:e.user,database:e.database},n=e.application_name|| +e.fallback_application_name;return n&&(t.application_name=n),e.replication&&(t.replication= +""+e.replication),e.statement_timeout&&(t.statement_timeout=String(parseInt(e.statement_timeout, +10))),e.lock_timeout&&(t.lock_timeout=String(parseInt(e.lock_timeout,10))),e.idle_in_transaction_session_timeout&& +(t.idle_in_transaction_session_timeout=String(parseInt(e.idle_in_transaction_session_timeout, +10))),e.options&&(t.options=e.options),t}cancel(e,t){if(e.activeQuery===t){var n=this. +connection;this.host&&this.host.indexOf("/")===0?n.connect(this.host+"/.s.PGSQL."+ +this.port):n.connect(this.port,this.host),n.on("connect",function(){n.cancel(e.processID, +e.secretKey)})}else e.queryQueue.indexOf(t)!==-1&&e.queryQueue.splice(e.queryQueue. +indexOf(t),1)}setTypeParser(e,t,n){return this._types.setTypeParser(e,t,n)}getTypeParser(e,t){ +return this._types.getTypeParser(e,t)}escapeIdentifier(e){return'"'+e.replace(/"/g, +'""')+'"'}escapeLiteral(e){for(var t=!1,n="'",i=0;i{this.activeQuery.handleError(e,this.connection),this.readyForQuery= +!0,this._pulseQueryQueue()})}else this.hasExecuted&&(this.activeQuery=null,this. +emit("drain"))}query(e,t,n){var i,s,a,u,c;if(e==null)throw new TypeError("Client\ + was passed a null or undefined query");return typeof e.submit=="function"?(a=e. +query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& +(i.callback=i.callback||t)):(a=this.connectionParameters.query_timeout,i=new pa( +e,t,n),i.callback||(s=new this._Promise((l,h)=>{i.callback=(f,y)=>f?h(f):l(y)}))), +a&&(c=i.callback,u=setTimeout(()=>{var l=new Error("Query read timeout");S.nextTick( +()=>{i.handleError(l,this.connection)}),c(l),i.callback=()=>{};var h=this.queryQueue. +indexOf(i);h>-1&&this.queryQueue.splice(h,1),this._pulseQueryQueue()},a),i.callback= +(l,h)=>{clearTimeout(u),c(l,h)}),this.binary&&!i.binary&&(i.binary=!0),i._result&& +!i._result._types&&(i._result._types=this._types),this._queryable?this._ending?(S. +nextTick(()=>{i.handleError(new Error("Client was closed and is not queryable"), +this.connection)}),s):(this.queryQueue.push(i),this._pulseQueryQueue(),s):(S.nextTick( +()=>{i.handleError(new Error("Client has encountered a connection error and is n\ +ot queryable"),this.connection)}),s)}ref(){this.connection.ref()}unref(){this.connection. +unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else return this. +_Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. +destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. +_Promise(t=>{this.connection.once("end",t)})}};rr.Query=pa;ya.exports=rr});var Ea=B((Ep,Sa)=>{"use strict";p();var uh=Ue().EventEmitter,ma=o(function(){},"\ +NOOP"),ga=o((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, +"removeWhere"),Nn=class{static{o(this,"IdleItem")}constructor(e,t,n){this.client= +e,this.idleListener=t,this.timeoutId=n}},et=class{static{o(this,"PendingItem")}constructor(e){ +this.callback=e}};function ch(){throw new Error("Release called on client which \ +has already been released to the pool.")}o(ch,"throwOnDoubleRelease");function nr(r,e){ +if(e)return{callback:e,result:void 0};let t,n,i=o(function(a,u){a?t(a):n(u)},"cb"), +s=new r(function(a,u){n=a,t=u}).catch(a=>{throw Error.captureStackTrace(a),a});return{ +callback:i,result:s}}o(nr,"promisify");function lh(r,e){return o(function t(n){n. +client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional client \ +error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)},"\ +idleListener")}o(lh,"makeIdleListener");var Mn=class extends uh{static{o(this,"P\ +ool")}constructor(e,t){super(),this.options=Object.assign({},e),e!=null&&"passwo\ +rd"in e&&Object.defineProperty(this.options,"password",{configurable:!0,enumerable:!1, +writable:!0,value:e.password}),e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty( +this.options.ssl,"key",{enumerable:!1}),this.options.max=this.options.max||this. +options.poolSize||10,this.options.maxUses=this.options.maxUses||1/0,this.options. +allowExitOnIdle=this.options.allowExitOnIdle||!1,this.options.maxLifetimeSeconds= +this.options.maxLifetimeSeconds||0,this.log=this.options.log||function(){},this. +Client=this.options.Client||t||ir().Client,this.Promise=this.options.Promise||_. +Promise,typeof this.options.idleTimeoutMillis>"u"&&(this.options.idleTimeoutMillis= +1e4),this._clients=[],this._idle=[],this._expired=new WeakSet,this._pendingQueue= +[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_isFull(){return this._clients. +length>=this.options.max}_pulseQueue(){if(this.log("pulse queue"),this.ended){this. +log("pulse queue ended");return}if(this.ending){this.log("pulse queue on ending"), +this._idle.length&&this._idle.slice().map(t=>{this._remove(t.client)}),this._clients. +length||(this.ended=!0,this._endCallback());return}if(!this._pendingQueue.length){ +this.log("no queued requests");return}if(!this._idle.length&&this._isFull())return; +let e=this._pendingQueue.shift();if(this._idle.length){let t=this._idle.pop();clearTimeout( +t.timeoutId);let n=t.client;n.ref&&n.ref();let i=t.idleListener;return this._acquireClient( +n,e,i,!1)}if(!this._isFull())return this.newClient(e);throw new Error("unexpecte\ +d condition")}_remove(e){let t=ga(this._idle,n=>n.client===e);t!==void 0&&clearTimeout( +t.timeoutId),this._clients=this._clients.filter(n=>n!==e),e.end(),this.emit("rem\ +ove",e)}connect(e){if(this.ending){let i=new Error("Cannot use a pool after call\ +ing end on the pool");return e?e(i):this.Promise.reject(i)}let t=nr(this.Promise, +e),n=t.result;if(this._isFull()||this._idle.length){if(this._idle.length&&S.nextTick( +()=>this._pulseQueue()),!this.options.connectionTimeoutMillis)return this._pendingQueue. +push(new et(t.callback)),n;let i=o((u,c,l)=>{clearTimeout(a),t.callback(u,c,l)}, +"queueCallback"),s=new et(i),a=setTimeout(()=>{ga(this._pendingQueue,u=>u.callback=== +i),s.timedOut=!0,t.callback(new Error("timeout exceeded when trying to connect"))}, +this.options.connectionTimeoutMillis);return this._pendingQueue.push(s),n}return this. +newClient(new et(t.callback)),n}newClient(e){let t=new this.Client(this.options); +this._clients.push(t);let n=lh(this,t);this.log("checking client timeout");let i, +s=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{this.log("ending c\ +lient due to timeout"),s=!0,t.connection?t.connection.stream.destroy():t.end()}, +this.options.connectionTimeoutMillis)),this.log("connecting new client"),t.connect( +a=>{if(i&&clearTimeout(i),t.on("error",n),a)this.log("client failed to connect", +a),this._clients=this._clients.filter(u=>u!==t),s&&(a.message="Connection termin\ +ated due to connection timeout"),this._pulseQueue(),e.timedOut||e.callback(a,void 0, +ma);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!==0){ +let u=setTimeout(()=>{this.log("ending client due to expired lifetime"),this._expired. +add(t),this._idle.findIndex(l=>l.client===t)!==-1&&this._acquireClient(t,new et( +(l,h,f)=>f()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.once("end", +()=>clearTimeout(u))}return this._acquireClient(t,e,n,!0)}})}_acquireClient(e,t,n,i){ +i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n), +e.removeListener("error",n),t.timedOut?i&&this.options.verify?this.options.verify( +e,e.release):e.release():i&&this.options.verify?this.options.verify(e,s=>{if(s)return e. +release(s),t.callback(s,void 0,ma);t.callback(void 0,e,e.release)}):t.callback(void 0, +e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&ch(),n=!0,this._release(e, +t,i)}}_release(e,t,n){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1, +this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>= +this.options.maxUses){e._poolUseCount>=this.options.maxUses&&this.log("remove ex\ +pended client"),this._remove(e),this._pulseQueue();return}if(this._expired.has(e)){ +this.log("remove expired client"),this._expired.delete(e),this._remove(e),this._pulseQueue(); +return}let s;this.options.idleTimeoutMillis&&(s=setTimeout(()=>{this.log("remove\ + idle client"),this._remove(e)},this.options.idleTimeoutMillis),this.options.allowExitOnIdle&& +s.unref()),this.options.allowExitOnIdle&&e.unref(),this._idle.push(new Nn(e,t,s)), +this._pulseQueue()}query(e,t,n){if(typeof e=="function"){let s=nr(this.Promise,e); +return T(function(){return s.callback(new Error("Passing a function as the first\ + parameter to pool.query is not supported"))}),s.result}typeof t=="function"&&(n= +t,t=void 0);let i=nr(this.Promise,n);return n=i.callback,this.connect((s,a)=>{if(s) +return n(s);let u=!1,c=o(l=>{u||(u=!0,a.release(l),n(l))},"onError");a.once("err\ +or",c),this.log("dispatching query");try{a.query(e,t,(l,h)=>{if(this.log("query \ +dispatched"),a.removeListener("error",c),!u)return u=!0,a.release(l),l?n(l):n(void 0, +h)})}catch(l){return a.release(l),n(l)}}),i.result}end(e){if(this.log("ending"), +this.ending){let n=new Error("Called end on pool more than once");return e?e(n): +this.Promise.reject(n)}this.ending=!0;let t=nr(this.Promise,e);return this._endCallback= +t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue. +length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients. +reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients. +length}};Sa.exports=Mn});var ba={};pe(ba,{default:()=>hh});var hh,xa=le(()=>{"use strict";p();hh={}});var Aa=B((vp,fh)=>{fh.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ + client - pure javascript & libpq with the same API",keywords:["database","libpq", +"pg","postgre","postgres","postgresql","rdbms"],homepage:"https://github.com/bri\ +anc/node-postgres",repository:{type:"git",url:"git://github.com/brianc/node-post\ +gres.git",directory:"packages/pg"},author:"Brian Carlson ",main:"./lib",dependencies:{"buffer-writer":"2.0.0","packet-reader":"1.0.0", +"pg-connection-string":"^2.5.0","pg-pool":"^3.5.2","pg-protocol":"^1.5.0","pg-ty\ +pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:"\ +4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ +"pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ +.md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ +7b9a5491a178655"}});var _a=B((Cp,Ca)=>{"use strict";p();var va=Ue().EventEmitter,dh=(ht(),X(lt)),Dn=bt(), +tt=Ca.exports=function(r,e,t){va.call(this),r=Dn.normalizeQueryConfig(r,e,t),this. +text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. +state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ +newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};dh.inherits( +tt,va);var ph={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ +age",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"\ +dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"\ +routine"};tt.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); +if(e)for(var t in e){var n=ph[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. +emit("error",r),this.state="error"};tt.prototype.then=function(r,e){return this. +_getPromise().then(r,e)};tt.prototype.catch=function(r){return this._getPromise(). +catch(r)};tt.prototype._getPromise=function(){return this._promise?this._promise: +(this._promise=new Promise(function(r,e){this._once("end",r),this._once("error", +e)}.bind(this)),this._promise)};tt.prototype.submit=function(r){this.state="runn\ +ing";var e=this;this.native=r.native,r.native.arrayMode=this._arrayMode;var t=o( +function(s,a,u){if(r.native.arrayMode=!1,T(function(){e.emit("_done")}),s)return e. +handleError(s);e._emitRowEvents&&(u.length>1?a.forEach((c,l)=>{c.forEach(h=>{e.emit( +"row",h,u[l])})}):a.forEach(function(c){e.emit("row",c,u)})),e.state="end",e.emit( +"end",u),e.callback&&e.callback(null,u)},"after");if(S.domain&&(t=S.domain.bind( +t)),this.name){this.name.length>63&&(console.error("Warning! Postgres only suppo\ +rts 63 characters for query names."),console.error("You supplied %s (%s)",this.name, +this.name.length),console.error("This can cause conflicts and silent errors exec\ +uting queries"));var n=(this.values||[]).map(Dn.prepareValue);if(r.namedQueries[this. +name]){if(this.text&&r.namedQueries[this.name]!==this.text){let s=new Error(`Pre\ +pared statements must be unique - '${this.name}' was used for a different statem\ +ent`);return t(s)}return r.native.execute(this.name,n,t)}return r.native.prepare( +this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e. +text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. +values)){let s=new Error("Query values must be an array");return t(s)}var i=this. +values.map(Dn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. +text,t)}});var Ia=B((Up,Ua)=>{"use strict";p();var yh=(xa(),X(ba)),wh=Vt(),Lp=Aa(),Ta=Ue(). +EventEmitter,mh=(ht(),X(lt)),gh=zt(),La=_a(),de=Ua.exports=function(r){Ta.call(this), +r=r||{},this._Promise=r.Promise||_.Promise,this._types=new wh(r.types),this.native= +new yh({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new gh( +r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, +writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= +e.port,this.namedQueries={}};de.Query=La;mh.inherits(de,Ta);de.prototype._errorAllQueries= +function(r){let e=o(t=>{S.nextTick(()=>{t.native=this.native,t.handleError(r)})}, +"enqueueError");this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery= +null),this._queryQueue.forEach(e),this._queryQueue.length=0};de.prototype._connect= +function(r){var e=this;if(this._connecting){S.nextTick(()=>r(new Error("Client h\ +as already been connected. You cannot reuse a client.")));return}this._connecting= +!0,this.connectionParameters.getLibpqConnectionString(function(t,n){if(t)return r( +t);e.native.connect(n,function(i){if(i)return e.native.end(),r(i);e._connected=!0, +e.native.on("error",function(s){e._queryable=!1,e._errorAllQueries(s),e.emit("er\ +ror",s)}),e.native.on("notification",function(s){e.emit("notification",{channel:s. +relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};de. +prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise( +(e,t)=>{this._connect(n=>{n?t(n):e()})})};de.prototype.query=function(r,e,t){var n, +i,s,a,u;if(r==null)throw new TypeError("Client was passed a null or undefined qu\ +ery");if(typeof r.submit=="function")s=r.query_timeout||this.connectionParameters. +query_timeout,i=n=r,typeof e=="function"&&(r.callback=e);else if(s=this.connectionParameters. +query_timeout,n=new La(r,e,t),!n.callback){let c,l;i=new this._Promise((h,f)=>{c= +h,l=f}),n.callback=(h,f)=>h?l(h):c(f)}return s&&(u=n.callback,a=setTimeout(()=>{ +var c=new Error("Query read timeout");S.nextTick(()=>{n.handleError(c,this.connection)}), +u(c),n.callback=()=>{};var l=this._queryQueue.indexOf(n);l>-1&&this._queryQueue. +splice(l,1),this._pulseQueryQueue()},s),n.callback=(c,l)=>{clearTimeout(a),u(c,l)}), +this._queryable?this._ending?(n.native=this.native,S.nextTick(()=>{n.handleError( +new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.push( +n),this._pulseQueryQueue(),i):(n.native=this.native,S.nextTick(()=>{n.handleError( +new Error("Client has encountered a connection error and is not queryable"))}),i)}; +de.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( +"connect",this.end.bind(this,r));var t;return r||(t=new this._Promise(function(n,i){ +r=o(s=>s?i(s):n(),"cb")})),this.native.end(function(){e._errorAllQueries(new Error( +"Connection terminated")),S.nextTick(()=>{e.emit("end"),r&&r()})}),t};de.prototype. +_hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="\ +error"&&this._activeQuery.state!=="end"};de.prototype._pulseQueryQueue=function(r){ +if(this._connected&&!this._hasActiveQuery()){var e=this._queryQueue.shift();if(!e){ +r||this.emit("drain");return}this._activeQuery=e,e.submit(this);var t=this;e.once( +"_done",function(){t._pulseQueryQueue()})}};de.prototype.cancel=function(r){this. +_activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== +-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};de.prototype.ref=function(){}; +de.prototype.unref=function(){};de.prototype.setTypeParser=function(r,e,t){return this. +_types.setTypeParser(r,e,t)};de.prototype.getTypeParser=function(r,e){return this. +_types.getTypeParser(r,e)}});var qn=B((Bp,Pa)=>{"use strict";p();Pa.exports=Ia()});var ir=B((Mp,At)=>{"use strict";p();var Sh=wa(),Eh=Et(),bh=Bn(),xh=Ea(),{DatabaseError:Ah}=In(), +vh=o(r=>class extends xh{static{o(this,"BoundPool")}constructor(t){super(t,r)}}, +"poolFactory"),Fn=o(function(r){this.defaults=Eh,this.Client=r,this.Query=this.Client. +Query,this.Pool=vh(this.Client),this._pools=[],this.Connection=bh,this.types=St(), +this.DatabaseError=Ah},"PG");typeof S.env.NODE_PG_FORCE_NATIVE<"u"?At.exports=new Fn( +qn()):(At.exports=new Fn(Sh),Object.defineProperty(At.exports,"native",{configurable:!0, +enumerable:!1,get(){var r=null;try{r=new Fn(qn())}catch(e){if(e.code!=="MODULE_N\ +OT_FOUND")throw e}return Object.defineProperty(At.exports,"native",{value:r}),r}}))});p();var Tr={};pe(Tr,{SocketReadQueue:()=>eu,TrustedCert:()=>gi,WebSocketReadQueue:()=>Xo, +startTls:()=>Zo});p();function se(...r){if(r.length===1&&r[0]instanceof Uint8Array)return r[0];let e=r. +reduce((i,s)=>i+s.length,0),t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+= +i.length;return t}o(se,"p");function ut(r,e){let t=r.length;if(t!==e.length)return!1; +for(let n=0;nthis.data.length)throw new Error("Expected length e\ +xceeds remaining data length");return this.indent+=e,this.indents[t]=this.indent, +[()=>{if(this.indent-=e,this.indents[this.offset]=this.indent,this.offset!==n)throw new Error( +`${r} bytes expected but ${this.offset-t} read`)},()=>n-this.offset]}expectLengthUint8(r){ +let e=this.readUint8();return this.expectLength(e)}expectLengthUint16(r){let e=this. +readUint16();return this.expectLength(e)}expectLengthUint24(r){let e=this.readUint24(); +return this.expectLength(e)}expectLengthUint32(r){let e=this.readUint32();return this. +expectLength(e)}expectLengthUint8Incl(r){let e=this.readUint8();return this.expectLength( +e-1)}expectLengthUint16Incl(r){let e=this.readUint16();return this.expectLength( +e-2)}expectLengthUint24Incl(r){let e=this.readUint24();return this.expectLength( +e-3)}expectLengthUint32Incl(r){let e=this.readUint32();return this.expectLength( +e-4)}writeBytes(r){return this.data.set(r,this.offset),this.offset+=r.length,this}writeUTF8String(r){ +let e=li.encode(r);return this.writeBytes(e),this}writeUTF8StringNullTerminated(r){ +let e=li.encode(r);return this.writeBytes(e),this.writeUint8(0),this}writeUint8(r,e){ +return this.dataView.setUint8(this.offset,r),this.offset+=1,this}writeUint16(r,e){ +return this.dataView.setUint16(this.offset,r),this.offset+=2,this}writeUint24(r,e){ +return this.writeUint8((r&16711680)>>16),this.writeUint16(r&65535,e),this}writeUint32(r,e){ +return this.dataView.setUint32(this.offset,r),this.offset+=4,this}_writeLengthGeneric(r,e,t){ +let n=this.offset;this.offset+=r;let i=this.offset;return this.indent+=1,this.indents[i]= +this.indent,()=>{let s=this.offset-(e?n:i);if(r===1)this.dataView.setUint8(n,s);else if(r=== +2)this.dataView.setUint16(n,s);else if(r===3)this.dataView.setUint8(n,(s&16711680)>> +16),this.dataView.setUint16(n+1,s&65535);else if(r===4)this.dataView.setUint32(n, +s);else throw new Error(`Invalid length for length field: ${r}`);this.indent-=1, +this.indents[this.offset]=this.indent}}writeLengthUint8(r){return this._writeLengthGeneric( +1,!1,r)}writeLengthUint16(r){return this._writeLengthGeneric(2,!1,r)}writeLengthUint24(r){ +return this._writeLengthGeneric(3,!1,r)}writeLengthUint32(r){return this._writeLengthGeneric( +4,!1,r)}writeLengthUint8Incl(r){return this._writeLengthGeneric(1,!0,r)}writeLengthUint16Incl(r){ +return this._writeLengthGeneric(2,!0,r)}writeLengthUint24Incl(r){return this._writeLengthGeneric( +3,!0,r)}writeLengthUint32Incl(r){return this._writeLengthGeneric(4,!0,r)}array(){ +return this.data.subarray(0,this.offset)}commentedString(r=!1){let e=this.indents[0]!== +void 0?br.repeat(this.indents[0]):"",t=this.indents[0]??0,n=r?this.data.length:this. +offset;for(let i=0;it. +toString(16).padStart(2,"0")).join(e)}o(Te,"K");function Bo(r,e){let t,n,[i]=r.expectLength( +r.remaining());r.expectUint8(2,0);let[s]=r.expectLengthUint24(0);r.expectUint16( +771,0);let a=r.readBytes(32);if(ut(a,[207,33,173,116,229,154,97,17,190,29,140,2, +30,101,184,145,194,162,17,22,122,187,140,94,7,158,9,226,200,168,51,156]))throw new Error( +"Unexpected HelloRetryRequest");r.expectUint8(e.length,0),r.expectBytes(e,0),r.expectUint16( +4865,0),r.expectUint8(0,0);let[u,c]=r.expectLengthUint16(0);for(;c()>0;){let l=r. +readUint16(0),[h]=r.expectLengthUint16(0);if(l===43)r.expectUint16(772,0),n=!0;else if(l=== +51)r.expectUint16(23,0),r.expectUint16(65),t=r.readBytes(65);else throw new Error( +`Unexpected extension 0x${Te([l])}`);h()}if(u(),s(),i(),n!==!0)throw new Error("\ +No TLS version provided");if(t===void 0)throw new Error("No key provided");return t} +o(Bo,"Ut");var jh=new RegExp(` .+|^(${br})+`,"gm"),ot=16384,Ro=ot+1+255;async function xr(r,e,t=ot){ +let n=await r(5);if(n===void 0)return;if(n.length<5)throw new Error("TLS record \ +header truncated");let i=new be(n),s=i.readUint8();if(s<20||s>24)throw new Error( +`Illegal TLS record type 0x${s.toString(16)}`);if(e!==void 0&&s!==e)throw new Error( +`Unexpected TLS record type 0x${s.toString(16).padStart(2,"0")} (expected 0x${e. +toString(16).padStart(2,"0")})`);i.expectUint16(771,"TLS record version 1.2 (mid\ +dlebox compatibility)");let a=i.readUint16(0);if(a>t)throw new Error(`Record too\ + long: ${a} bytes`);let u=await r(a);if(u===void 0||u.length>3,s=Math.ceil(t/i),a=new Uint8Array(s*i),u=await O.importKey("raw",r,{name:"\ +HMAC",hash:{name:`SHA-${n}`}},!1,["sign"]),c=new Uint8Array(0);for(let l=0;l>8,n&255],[fi.length+s.length],fi,s,[t.length], +t);return Mo(r,a,n,i)}o(ae,"S");async function Do(r,e,t,n,i){let s=n>>>3,a=new Uint8Array( +s),u=await O.importKey("raw",r,{name:"ECDH",namedCurve:"P-256"},!1,[]),c=await O. +deriveBits({name:"ECDH",public:u},e,256),l=new Uint8Array(c),h=await O.digest("S\ +HA-256",t),f=new Uint8Array(h),y=await vr(new Uint8Array(1),a,n),m=await O.digest( +`SHA-${n}`,new Uint8Array(0)),b=new Uint8Array(m),U=await ae(y,"derived",b,s,n), +v=await vr(U,l,n),C=await ae(v,"c hs traffic",f,s,n),E=await ae(v,"s hs traffic", +f,s,n),g=await ae(C,"key",new Uint8Array(0),i,n),x=await ae(E,"key",new Uint8Array( +0),i,n),N=await ae(C,"iv",new Uint8Array(0),12,n),P=await ae(E,"iv",new Uint8Array( +0),12,n);return{serverHandshakeKey:x,serverHandshakeIV:P,clientHandshakeKey:g,clientHandshakeIV:N, +handshakeSecret:v,clientSecret:C,serverSecret:E}}o(Do,"Kt");async function qo(r,e,t,n){ +let i=t>>>3,s=new Uint8Array(i),a=await O.digest(`SHA-${t}`,new Uint8Array(0)),u=new Uint8Array( +a),c=await ae(r,"derived",u,i,t),l=await vr(c,s,t),h=await ae(l,"c ap traffic",e, +i,t),f=await ae(l,"s ap traffic",e,i,t),y=await ae(h,"key",new Uint8Array(0),n,t), +m=await ae(f,"key",new Uint8Array(0),n,t),b=await ae(h,"iv",new Uint8Array(0),12, +t),U=await ae(f,"iv",new Uint8Array(0),12,t);return{serverApplicationKey:m,serverApplicationIV:U, +clientApplicationKey:y,clientApplicationIV:b}}o(qo,"Tt");var Nt=class{static{o(this, +"Z")}constructor(r,e,t){this.mode=r,this.key=e,this.initialIv=t}recordsProcessed=0n;priorPromise=Promise. +resolve(new Uint8Array);async process(r,e,t){let n=this.processUnsequenced(r,e,t); +return this.priorPromise=this.priorPromise.then(()=>n)}async processUnsequenced(r,e,t){ +let n=this.recordsProcessed;this.recordsProcessed+=1n;let i=this.initialIv.slice(), +s=BigInt(i.length),a=s-1n;for(let h=0n;h>(h<<3n);if(f===0n)break; +i[Number(a-h)]^=Number(f&0xffn)}let u=e<<3,c={name:"AES-GCM",iv:i,tagLength:u,additionalData:t}, +l=await O[this.mode](c,this.key,r);return new Uint8Array(l)}};function Mt(r){return r> +64&&r<91?r-65:r>96&&r<123?r-71:r>47&&r<58?r+4:r===43?62:r===47?63:r===61?64:void 0} +o(Mt,"yt");function Fo(r){let e=r.length,t=0,n=0,i=64,s=64,a=64,u=64,c=new Uint8Array( +e*.75);for(;t>4,c[n++]=(s&15)<<4|a>>2,c[n++]=(a&3)<< +6|u;let l=s===64?0:a===64?2:u===64?1:0;return c.subarray(0,n-l)}o(Fo,"Dt");var Dt=class extends be{static{ +o(this,"M")}readASN1Length(r){let e=this.readUint8();if(e<128)return e;let t=e&127, +n=0;if(t===1)return this.readUint8(n);if(t===2)return this.readUint16(n);if(t=== +3)return this.readUint24(n);if(t===4)return this.readUint32(n);throw new Error(`\ +ASN.1 length fields are only supported up to 4 bytes (this one is ${t} bytes)`)}expectASN1Length(r){ +let e=this.readASN1Length(r);return this.expectLength(e)}readASN1OID(){let[r,e]=this. +expectASN1Length(0),t=this.readUint8(),n=`${Math.floor(t/40)}.${t%40}`;for(;e()> +0;){let i=0;for(;;){let s=this.readUint8();if(i<<=7,i+=s&127,s<128)break}n+=`.${i}`} +return r(),n}readASN1Boolean(){let[r,e]=this.expectASN1Length(0),t=e();if(t!==1) +throw new Error(`Boolean has weird length: ${t}`);let n=this.readUint8(),i;if(n=== +255)i=!0;else if(n===0)i=!1;else throw new Error(`Boolean has weird value: 0x${Te( +[n])}`);return r(),i}readASN1UTCTime(){let[r,e]=this.expectASN1Length(0),t=this. +readUTF8String(e()).match(/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z$/);if(!t)throw new Error( +"Unrecognised ASN.1 UTC time format");let[,n,i,s,a,u,c]=t,l=parseInt(n,10),h=l+(l>= +50?1900:2e3),f=new Date(`${h}-${i}-${s}T${a}:${u}:${c}Z`);return r(),f}readASN1BitString(){ +let[r,e]=this.expectASN1Length(0),t=this.readUint8(0),n=e(),i=this.readBytes(n); +if(t>7)throw new Error(`Invalid right pad value: ${t}`);if(t>0){let s=8-t;for(let a=n- +1;a>0;a--)i[a]=255&i[a-1]<>>t;i[0]=i[0]>>>t}return r(),i}};function di(r,e=(n,i)=>i,t){ +return JSON.stringify(r,(n,i)=>e(n,typeof i!="object"||i===null||Array.isArray(i)? +i:Object.fromEntries(Object.entries(i).sort(([s],[a])=>sa?1:0))),t)}o(di, +"mt");var gr=1,qt=2,ie=48,Oo=49,Ke=6,ko=19,Qo=12,pi=23,Sr=5,De=4,Er=3,$o=163,He=128, +jo={"2.5.4.6":"C","2.5.4.10":"O","2.5.4.11":"OU","2.5.4.3":"CN","2.5.4.7":"L","2\ +.5.4.8":"ST","2.5.4.12":"T","2.5.4.42":"GN","2.5.4.43":"I","2.5.4.4":"SN","1.2.8\ +40.113549.1.9.1":"E-mail"};function Ho(r){let{length:e}=r;if(e>4)throw new Error( +`Bit string length ${e} would overflow JS bit operators`);let t=0,n=0;for(let i=r. +length-1;i>=0;i--)t|=r[i]<0;){r.expectUint8(Oo, +0);let[s]=r.expectASN1Length(0);r.expectUint8(ie,0);let[a]=r.expectASN1Length(0); +r.expectUint8(Ke,0);let u=r.readASN1OID(),c=jo[u]??u,l=r.readUint8();if(l!==ko&& +l!==Qo)throw new Error(`Unexpected item type in certificate ${e}: 0x${Te([l])}`); +let[h,f]=r.expectASN1Length(0),y=r.readUTF8String(f());if(h(),a(),s(),t[c]!==void 0) +throw new Error(`Duplicate OID ${c} in certificate ${e}`);t[c]=y}return n(),t}o( +yi,"Ct");function Ko(r,e=0){let t=[],[n,i]=r.expectASN1Length(0);for(;i()>0;){let s=r. +readUint8(0),[a,u]=r.expectASN1Length(0),c;s===(e|2)?c=r.readUTF8String(u()):c=r. +readBytes(u()),t.push({name:c,type:s}),a()}return n(),t}o(Ko,"Bt");function Wo(r){ +let e={"1.2.840.113549.1.1.1":{name:"RSAES-PKCS1-v1_5"},"1.2.840.113549.1.1.5":{ +name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}},"1.2.840.113549.1.1.11":{name:"RSA\ +SSA-PKCS1-v1_5",hash:{name:"SHA-256"}},"1.2.840.113549.1.1.12":{name:"RSASSA-PKC\ +S1-v1_5",hash:{name:"SHA-384"}},"1.2.840.113549.1.1.13":{name:"RSASSA-PKCS1-v1_5", +hash:{name:"SHA-512"}},"1.2.840.113549.1.1.10":{name:"RSA-PSS"},"1.2.840.113549.\ +1.1.7":{name:"RSA-OAEP"},"1.2.840.10045.2.1":{name:"ECDSA",hash:{name:"SHA-1"}}, +"1.2.840.10045.4.1":{name:"ECDSA",hash:{name:"SHA-1"}},"1.2.840.10045.4.3.2":{name:"\ +ECDSA",hash:{name:"SHA-256"}},"1.2.840.10045.4.3.3":{name:"ECDSA",hash:{name:"SH\ +A-384"}},"1.2.840.10045.4.3.4":{name:"ECDSA",hash:{name:"SHA-512"}},"1.3.133.16.\ +840.63.0.2":{name:"ECDH",kdf:"SHA-1"},"1.3.132.1.11.1":{name:"ECDH",kdf:"SHA-256"}, +"1.3.132.1.11.2":{name:"ECDH",kdf:"SHA-384"},"1.3.132.1.11.3":{name:"ECDH",kdf:"\ +SHA-512"},"2.16.840.1.101.3.4.1.2":{name:"AES-CBC",length:128},"2.16.840.1.101.3\ +.4.1.22":{name:"AES-CBC",length:192},"2.16.840.1.101.3.4.1.42":{name:"AES-CBC",length:256}, +"2.16.840.1.101.3.4.1.6":{name:"AES-GCM",length:128},"2.16.840.1.101.3.4.1.26":{ +name:"AES-GCM",length:192},"2.16.840.1.101.3.4.1.46":{name:"AES-GCM",length:256}, +"2.16.840.1.101.3.4.1.4":{name:"AES-CFB",length:128},"2.16.840.1.101.3.4.1.24":{ +name:"AES-CFB",length:192},"2.16.840.1.101.3.4.1.44":{name:"AES-CFB",length:256}, +"2.16.840.1.101.3.4.1.5":{name:"AES-KW",length:128},"2.16.840.1.101.3.4.1.25":{name:"\ +AES-KW",length:192},"2.16.840.1.101.3.4.1.45":{name:"AES-KW",length:256},"1.2.84\ +0.113549.2.7":{name:"HMAC",hash:{name:"SHA-1"}},"1.2.840.113549.2.9":{name:"HMAC", +hash:{name:"SHA-256"}},"1.2.840.113549.2.10":{name:"HMAC",hash:{name:"SHA-384"}}, +"1.2.840.113549.2.11":{name:"HMAC",hash:{name:"SHA-512"}},"1.2.840.113549.1.9.16\ +.3.5":{name:"DH"},"1.3.14.3.2.26":{name:"SHA-1"},"2.16.840.1.101.3.4.2.1":{name:"\ +SHA-256"},"2.16.840.1.101.3.4.2.2":{name:"SHA-384"},"2.16.840.1.101.3.4.2.3":{name:"\ +SHA-512"},"1.2.840.113549.1.5.12":{name:"PBKDF2"},"1.2.840.10045.3.1.7":{name:"P\ +-256"},"1.3.132.0.34":{name:"P-384"},"1.3.132.0.35":{name:"P-521"}}[r];if(e===void 0) +throw new Error(`Unsupported algorithm identifier: ${r}`);return e}o(Wo,"Ft");function mi(r,e=[]){ +return Object.values(r).forEach(t=>{typeof t=="string"?e=[...e,t]:e=mi(t,e)}),e} +o(mi,"Ot");function Go(r){return mi(r).join(" / ")}o(Go,"Pt");var Vo=["digitalSi\ +gnature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","k\ +eyCertSign","cRLSign","encipherOnly","decipherOnly"],_r=class Cr{static{o(this,"\ +r")}serialNumber;algorithm;issuer;validityPeriod;subject;publicKey;signature;keyUsage;subjectAltNames;extKeyUsage;authorityKeyIdentifier;subjectKeyIdentifier;basicConstraints;signedData;static distinguishedNamesAreEqual(e,t){ +return di(e)===di(t)}static readableDN(e){return Object.entries(e).map(t=>t.join( +"=")).join(", ")}constructor(e){let t=e instanceof Dt?e:new Dt(e);t.expectUint8( +ie,0);let[n]=t.expectASN1Length(0),i=t.offset;t.expectUint8(ie,0);let[s]=t.expectASN1Length( +0);t.expectBytes([160,3,2,1,2],0),t.expectUint8(qt,0);let[a,u]=t.expectASN1Length( +0);this.serialNumber=t.subarray(u()),a(),t.expectUint8(ie,0);let[c,l]=t.expectASN1Length( +0);t.expectUint8(Ke,0),this.algorithm=t.readASN1OID(),l()>0&&(t.expectUint8(Sr,0), +t.expectUint8(0,0)),c(),this.issuer=yi(t,"issuer"),t.expectUint8(ie,0);let[h]=t. +expectASN1Length(0);t.expectUint8(pi,0);let f=t.readASN1UTCTime();t.expectUint8( +pi,0);let y=t.readASN1UTCTime();this.validityPeriod={notBefore:f,notAfter:y},h(), +this.subject=yi(t,"subject");let m=t.offset;t.expectUint8(ie,0);let[b]=t.expectASN1Length( +0);t.expectUint8(ie,0);let[U,v]=t.expectASN1Length(0),C=[];for(;v()>0;){let Z=t. +readUint8();if(Z===Ke){let M=t.readASN1OID();C.push(M)}else Z===Sr&&t.expectUint8( +0,0)}U(),t.expectUint8(Er,0);let E=t.readASN1BitString();this.publicKey={identifiers:C, +data:E,all:t.data.subarray(m,t.offset)},b(),t.expectUint8($o,0);let[g]=t.expectASN1Length(); +t.expectUint8(ie,0);let[x,N]=t.expectASN1Length(0);for(;N()>0;){t.expectUint8(ie, +0);let[Z,M]=t.expectASN1Length();t.expectUint8(Ke,0);let $=t.readASN1OID();if($=== +"2.5.29.17"){t.expectUint8(De,0);let[j]=t.expectASN1Length(0);t.expectUint8(ie,0); +let H=Ko(t,He);this.subjectAltNames=H.filter(K=>K.type===(2|He)).map(K=>K.name), +j()}else if($==="2.5.29.15"){t.expectUint8(gr,0);let j=t.readASN1Boolean();t.expectUint8( +De,0);let[H]=t.expectASN1Length(0);t.expectUint8(Er,0);let K=t.readASN1BitString(), +J=Ho(K),F=new Set(Vo.filter((Y,W)=>J&1<0;){t.expectUint8(Ke, +0);let J=t.readASN1OID();J==="1.3.6.1.5.5.7.3.1"&&(this.extKeyUsage.serverTls=!0), +J==="1.3.6.1.5.5.7.3.2"&&(this.extKeyUsage.clientTls=!0)}H(),j()}else if($==="2.\ +5.29.35"){t.expectUint8(De,0);let[j]=t.expectASN1Length(0);t.expectUint8(ie,0);let[ +H,K]=t.expectASN1Length(0);for(;K()>0;){let J=t.readUint8();if(J===(He|0)){let[F, +Y]=t.expectASN1Length(0);this.authorityKeyIdentifier=t.readBytes(Y()),F()}else if(J=== +(He|1)){let[F,Y]=t.expectASN1Length(0);t.skip(Y(),0),F()}else if(J===(He|2)){let[ +F,Y]=t.expectASN1Length(0);t.skip(Y(),0),F()}else if(J===(He|33)){let[F,Y]=t.expectASN1Length( +0);t.skip(Y(),0),F()}else throw new Error(`Unexpected data type ${J} in authorit\ +yKeyIdentifier certificate extension`)}H(),j()}else if($==="2.5.29.14"){t.expectUint8( +De,0);let[j]=t.expectASN1Length(0);t.expectUint8(De,0);let[H,K]=t.expectASN1Length( +0);this.subjectKeyIdentifier=t.readBytes(K()),H(),j()}else if($==="2.5.29.19"){let j, +H=t.readUint8();if(H===gr&&(j=t.readASN1Boolean(),H=t.readUint8()),H!==De)throw new Error( +"Unexpected type in certificate basic constraints");let[K]=t.expectASN1Length(0); +t.expectUint8(ie,0);let[J,F]=t.expectASN1Length(),Y;F()>0&&(t.expectUint8(gr,0), +Y=t.readASN1Boolean());let W;if(F()>0){t.expectUint8(qt,0);let R=t.readASN1Length( +0);if(W=R===1?t.readUint8():R===2?t.readUint16():R===3?t.readUint24():void 0,W=== +void 0)throw new Error("Too many bytes in max path length in certificate basicCo\ +nstraints")}J(),K(),this.basicConstraints={critical:j,ca:Y,pathLength:W}}else t. +skip(M(),0);Z()}x(),g(),s(),this.signedData=t.data.subarray(i,t.offset),t.expectUint8( +ie,0);let[P,D]=t.expectASN1Length(0);t.expectUint8(Ke,0);let q=t.readASN1OID();if(D()> +0&&(t.expectUint8(Sr,0),t.expectUint8(0,0)),P(),q!==this.algorithm)throw new Error( +`Certificate specifies different signature algorithms inside (${this.algorithm})\ + and out (${q})`);t.expectUint8(Er,0),this.signature=t.readASN1BitString(),n()}static fromPEM(e){ +let t="[A-Z0-9 ]+",n=new RegExp(`-{5}BEGIN ${t}-{5}([a-zA-Z0-9=+\\/\\n\\r]+)-{5}END\ + ${t}-{5}`,"g"),i=[],s=null;for(;s=n.exec(e);){let a=s[1].replace(/[\r\n]/g,""), +u=Fo(a),c=new this(u);i.push(c)}return i}subjectAltNameMatchingHost(e){let t=/[.][^.]+[.][^.]+$/; +return(this.subjectAltNames??[]).find(n=>{let i=n,s=e;if(t.test(e)&&t.test(i)&&i. +startsWith("*.")&&(i=i.slice(1),s=s.slice(s.indexOf("."))),i===s)return!0})}isValidAtMoment(e=new Date){ +return e>=this.validityPeriod.notBefore&&e<=this.validityPeriod.notAfter}description(){ +return"subject: "+Cr.readableDN(this.subject)+(this.subjectAltNames?` +subject alt names: `+this.subjectAltNames.join(", "):"")+(this.subjectKeyIdentifier? +` +subject key id: ${Te(this.subjectKeyIdentifier," ")}`:"")+` +issuer: `+Cr.readableDN(this.issuer)+(this.authorityKeyIdentifier?` +authority key id: ${Te(this.authorityKeyIdentifier," ")}`:"")+` +validity: `+this.validityPeriod.notBefore.toISOString()+" \u2013 "+this.validityPeriod. +notAfter.toISOString()+` (${this.isValidAtMoment()?"currently valid":"not valid"}\ +)`+(this.keyUsage?` +key usage (${this.keyUsage.critical?"critical":"non-critical"}): `+[...this.keyUsage. +usages].join(", "):"")+(this.extKeyUsage?` +extended key usage: TLS server \u2014\xA0${this.extKeyUsage.serverTls}, TLS clie\ +nt \u2014\xA0${this.extKeyUsage.clientTls}`:"")+(this.basicConstraints?` +basic constraints (${this.basicConstraints.critical?"critical":"non-critical"}):\ + CA \u2014\xA0${this.basicConstraints.ca}, path length \u2014 ${this.basicConstraints. +pathLength}`:"")+` +signature algorithm: `+Go(Wo(this.algorithm))}toJSON(){return{serialNumber:[...this. +serialNumber],algorithm:this.algorithm,issuer:this.issuer,validityPeriod:{notBefore:this. +validityPeriod.notBefore.toISOString(),notAfter:this.validityPeriod.notAfter.toISOString()}, +subject:this.subject,publicKey:{identifiers:this.publicKey.identifiers,data:[...this. +publicKey.data],all:[...this.publicKey.all]},signature:[...this.signature],keyUsage:{ +critical:this.keyUsage?.critical,usages:[...this.keyUsage?.usages??[]]},subjectAltNames:this. +subjectAltNames,extKeyUsage:this.extKeyUsage,authorityKeyIdentifier:this.authorityKeyIdentifier&& +[...this.authorityKeyIdentifier],subjectKeyIdentifier:this.subjectKeyIdentifier&& +[...this.subjectKeyIdentifier],basicConstraints:this.basicConstraints,signedData:[ +...this.signedData]}}},gi=class extends _r{static{o(this,"st")}};async function Si(r,e,t,n,i){ +r.expectUint8(ie,0);let[s]=r.expectASN1Length(0);r.expectUint8(qt,0);let[a,u]=r. +expectASN1Length(0),c=r.readBytes(u());a(),r.expectUint8(qt,0);let[l,h]=r.expectASN1Length( +0),f=r.readBytes(h());l(),s();let y=o((v,C)=>v.length>C?v.subarray(v.length-C):v. +length_r.distinguishedNamesAreEqual(b.subject,l.issuer)):f=t.find(b=>b.subjectKeyIdentifier!== +void 0&&ut(b.subjectKeyIdentifier,h)),f===void 0&&(f=e[u+1]),f===void 0)throw new Error( +"Ran out of certificates before reaching trusted root");let y=f instanceof gi;if(f. +isValidAtMoment()!==!0)throw new Error("Signing certificate is not valid now");if(i&& +f.keyUsage?.usages.has("digitalSignature")!==!0)throw new Error("Signing certifi\ +cate keyUsage does not include digital signatures");if(f.basicConstraints?.ca!== +!0)throw new Error("Signing certificate basicConstraints do not indicate a CA ce\ +rtificate");let{pathLength:m}=f.basicConstraints;if(m!==void 0&&m0;){let R=u. +readUint16(0);if(R===0)u.expectUint16(0,0);else if(R===10){let[k,ne]=u.expectLengthUint16( +"groups data");u.skip(ne(),0),k()}else throw new Error(`Unsupported server encry\ +pted extension type 0x${Te([R]).padStart(4,"0")}`)}l(),c(),u.remaining()===0&&u. +extend(await e());let f=!1,y=u.readUint8();if(y===13){f=!0;let[R]=u.expectLengthUint24( +"certificate request data");u.expectUint8(0,0);let[k,ne]=u.expectLengthUint16("c\ +ertificate request extensions");u.skip(ne(),0),k(),R(),u.remaining()===0&&u.extend( +await e()),y=u.readUint8()}if(y!==11)throw new Error(`Unexpected handshake messa\ +ge type 0x${Te([y])}`);let[m]=u.expectLengthUint24(0);u.expectUint8(0,0);let[b,U]=u. +expectLengthUint24(0),v=[];for(;U()>0;){let[R]=u.expectLengthUint24(0),k=new _r( +u);v.push(k),R();let[ne,ce]=u.expectLengthUint16(),Fe=u.subarray(ce());ne()}if(b(), +m(),v.length===0)throw new Error("No certificates supplied");let C=v[0],E=u.data. +subarray(0,u.offset),g=se(n,E),x=await O.digest("SHA-256",g),N=new Uint8Array(x), +P=se(Jo.encode(" ".repeat(64)+"TLS 1.3, server CertificateVerify"),[0],N);u.remaining()=== +0&&u.extend(await e()),u.expectUint8(15,0);let[D]=u.expectLengthUint24(0),q=u.readUint16(); +if(q===1027){let[R]=u.expectLengthUint16();await Si(u,C.publicKey.all,P,"P-256", +"SHA-256"),R()}else if(q===2052){let[R,k]=u.expectLengthUint16(),ne=u.subarray(k()); +R();let ce=await O.importKey("spki",C.publicKey.all,{name:"RSA-PSS",hash:"SHA-25\ +6"},!1,["verify"]);if(await O.verify({name:"RSA-PSS",saltLength:32},ce,ne,P)!==!0) +throw new Error("RSA-PSS-RSAE-SHA256 certificate verify failed")}else throw new Error( +`Unsupported certificate verify signature type 0x${Te([q]).padStart(4,"0")}`);D(); +let Z=u.data.subarray(0,u.offset),M=se(n,Z),$=await ae(t,"finished",new Uint8Array( +0),32,256),j=await O.digest("SHA-256",M),H=await O.importKey("raw",$,{name:"HMAC", +hash:{name:"SHA-256"}},!1,["sign"]),K=await O.sign("HMAC",H,j),J=new Uint8Array( +K);u.remaining()===0&&u.extend(await e()),u.expectUint8(20,0);let[F,Y]=u.expectLengthUint24( +0),W=u.readBytes(Y());if(F(),u.remaining()!==0)throw new Error("Unexpected extra\ + bytes in server handshake");if(ut(W,J)!==!0)throw new Error("Invalid server ver\ +ify hash");if(!await zo(r,v,i,s,a))throw new Error("Validated certificate chain \ +did not end in a trusted root");return[u.data,f]}o(Yo,"Vt");async function Zo(r,e,t,n,{ +useSNI:i,requireServerTlsExtKeyUsage:s,requireDigitalSigKeyUsage:a,writePreData:u, +expectPreData:c,commentPreData:l}={}){i??=!0,s??=!0,a??=!0;let h=await O.generateKey( +{name:"ECDH",namedCurve:"P-256"},!0,["deriveKey","deriveBits"]),f=await O.exportKey( +"raw",h.publicKey),y=new Uint8Array(32);A.getRandomValues(y);let m=Po(r,f,y,i).array(), +b=u?se(u,m):m;if(n(b),c){let re=await t(c.length);if(!re||!ut(re,c))throw new Error( +"Pre data did not match expectation")}let U=await xr(t,22);if(U===void 0)throw new Error( +"Connection closed while awaiting server hello");let v=new be(U.content),C=Bo(v, +y),E=await xr(t,20);if(E===void 0)throw new Error("Connection closed awaiting se\ +rver cipher change");let g=new be(E.content),[x]=g.expectLength(1);g.expectUint8( +1,0),x();let N=m.subarray(5),P=U.content,D=se(N,P),q=await Do(C,h.privateKey,D,256, +16),Z=await O.importKey("raw",q.serverHandshakeKey,{name:"AES-GCM"},!1,["decrypt"]), +M=new Nt("decrypt",Z,q.serverHandshakeIV),$=await O.importKey("raw",q.clientHandshakeKey, +{name:"AES-GCM"},!1,["encrypt"]),j=new Nt("encrypt",$,q.clientHandshakeIV),H=o(async()=>{ +let re=await Ar(t,M,22);if(re===void 0)throw new Error("Premature end of encrypt\ +ed server handshake");return re},"C"),[K,J]=await Yo(r,H,q.serverSecret,D,e,s,a), +F=new be(6);F.writeUint8(20,0),F.writeUint16(771,0);let Y=F.writeLengthUint16(); +F.writeUint8(1,0),Y();let W=F.array(),R=new Uint8Array(0);if(J){let re=new be(8); +re.writeUint8(11,0);let it=re.writeLengthUint24("client certificate data");re.writeUint8( +0,0),re.writeUint24(0,0),it(),R=re.array()}let k=se(D,K,R),ne=await O.digest("SH\ +A-256",k),ce=new Uint8Array(ne),Fe=await ae(q.clientSecret,"finished",new Uint8Array( +0),32,256),ar=await O.importKey("raw",Fe,{name:"HMAC",hash:{name:"SHA-256"}},!1, +["sign"]),or=await O.sign("HMAC",ar,ce),Fa=new Uint8Array(or),Lt=new be(36);Lt.writeUint8( +20,0);let Oa=Lt.writeLengthUint24(0);Lt.writeBytes(Fa),Oa();let ka=Lt.array(),On=await hi( +se(R,ka),j,22),kn=ce;if(R.length>0){let re=k.subarray(0,k.length-R.length),it=await O. +digest("SHA-256",re);kn=new Uint8Array(it)}let Ut=await qo(q.handshakeSecret,kn, +256,16),Qa=await O.importKey("raw",Ut.clientApplicationKey,{name:"AES-GCM"},!0,[ +"encrypt"]),$a=new Nt("encrypt",Qa,Ut.clientApplicationIV),ja=await O.importKey( +"raw",Ut.serverApplicationKey,{name:"AES-GCM"},!0,["decrypt"]),Ha=new Nt("decryp\ +t",ja,Ut.serverApplicationIV),It=!1;return[()=>{if(!It){let re=se(W,...On);n(re), +It=!0}return Ar(t,Ha)},async re=>{let it=It;It=!0;let Qn=await hi(re,$a,23),Ka=it? +se(...Qn):se(W,...On,...Qn);n(Ka)}]}o(Zo,"he");var Ei=class{static{o(this,"xt")}queue;outstandingRequest;constructor(){ +this.queue=[]}enqueue(r){this.queue.push(r),this.dequeue()}dequeue(){if(this.outstandingRequest=== +void 0)return;let{resolve:r,bytes:e}=this.outstandingRequest,t=this.bytesInQueue(); +if(te)return this.queue[0]=n.subarray(e),r(n.subarray(0,e)); +{let s=new Uint8Array(e),a=e,u=0;for(;a>0;){let c=this.queue[0],l=c.length;l<=a? +(this.queue.shift(),s.set(c,u),u+=l,a-=l):(this.queue[0]=c.subarray(a),s.set(c.subarray( +0,a),u),a-=a,u+=a)}return r(s)}}bytesInQueue(){return this.queue.reduce((r,e)=>r+ +e.length,0)}async read(r){if(this.outstandingRequest!==void 0)throw new Error("C\ +an\u2019t read while already awaiting read");return new Promise(e=>{this.outstandingRequest= +{resolve:e,bytes:r},this.dequeue()})}},Xo=class extends Ei{static{o(this,"vt")}constructor(r){ +super(),this.socket=r,r.addEventListener("message",e=>this.enqueue(new Uint8Array( +e.data))),r.addEventListener("close",()=>this.dequeue())}socketIsNotClosed(){let{ +socket:r}=this,{readyState:e}=r;return e<=1}},eu=class extends Ei{static{o(this, +"Lt")}constructor(r){super(),this.socket=r,r.on("data",e=>this.enqueue(new Uint8Array( +e))),r.on("close",()=>this.dequeue())}socketIsNotClosed(){let{socket:r}=this,{readyState:e}=r; +return e==="opening"||e==="open"}};var bi=`-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- +`;p();var ru=Object.getOwnPropertyNames,nu=Object.getOwnPropertySymbols,iu=Object.prototype. +hasOwnProperty;function xi(r,e){return o(function(n,i,s){return r(n,i,s)&&e(n,i, +s)},"isEqual")}o(xi,"combineComparators");function Ft(r){return o(function(t,n,i){ +if(!t||!n||typeof t!="object"||typeof n!="object")return r(t,n,i);var s=i.cache, +a=s.get(t),u=s.get(n);if(a&&u)return a===n&&u===t;s.set(t,n),s.set(n,t);var c=r( +t,n,i);return s.delete(t),s.delete(n),c},"isCircular")}o(Ft,"createIsCircular"); +function Ai(r){return ru(r).concat(nu(r))}o(Ai,"getStrictProperties");var Ii=Object. +hasOwn||function(r,e){return iu.call(r,e)};function We(r,e){return r||e?r===e:r=== +e||r!==r&&e!==e}o(We,"sameValueZeroEqual");var Pi="_owner",vi=Object.getOwnPropertyDescriptor, +Ci=Object.keys;function su(r,e,t){var n=r.length;if(e.length!==n)return!1;for(;n-- > +0;)if(!t.equals(r[n],e[n],n,n,r,e,t))return!1;return!0}o(su,"areArraysEqual");function au(r,e){ +return We(r.getTime(),e.getTime())}o(au,"areDatesEqual");function _i(r,e,t){if(r. +size!==e.size)return!1;for(var n={},i=r.entries(),s=0,a,u;(a=i.next())&&!a.done;){ +for(var c=e.entries(),l=!1,h=0;(u=c.next())&&!u.done;){var f=a.value,y=f[0],m=f[1], +b=u.value,U=b[0],v=b[1];!l&&!n[h]&&(l=t.equals(y,U,s,h,r,e,t)&&t.equals(m,v,y,U, +r,e,t))&&(n[h]=!0),h++}if(!l)return!1;s++}return!0}o(_i,"areMapsEqual");function ou(r,e,t){ +var n=Ci(r),i=n.length;if(Ci(e).length!==i)return!1;for(var s;i-- >0;)if(s=n[i], +s===Pi&&(r.$$typeof||e.$$typeof)&&r.$$typeof!==e.$$typeof||!Ii(e,s)||!t.equals(r[s], +e[s],s,s,r,e,t))return!1;return!0}o(ou,"areObjectsEqual");function ct(r,e,t){var n=Ai( +r),i=n.length;if(Ai(e).length!==i)return!1;for(var s,a,u;i-- >0;)if(s=n[i],s===Pi&& +(r.$$typeof||e.$$typeof)&&r.$$typeof!==e.$$typeof||!Ii(e,s)||!t.equals(r[s],e[s], +s,s,r,e,t)||(a=vi(r,s),u=vi(e,s),(a||u)&&(!a||!u||a.configurable!==u.configurable|| +a.enumerable!==u.enumerable||a.writable!==u.writable)))return!1;return!0}o(ct,"a\ +reObjectsEqualStrict");function uu(r,e){return We(r.valueOf(),e.valueOf())}o(uu, +"arePrimitiveWrappersEqual");function cu(r,e){return r.source===e.source&&r.flags=== +e.flags}o(cu,"areRegExpsEqual");function Ti(r,e,t){if(r.size!==e.size)return!1;for(var n={}, +i=r.values(),s,a;(s=i.next())&&!s.done;){for(var u=e.values(),c=!1,l=0;(a=u.next())&& +!a.done;)!c&&!n[l]&&(c=t.equals(s.value,a.value,s.value,a.value,r,e,t))&&(n[l]=!0), +l++;if(!c)return!1}return!0}o(Ti,"areSetsEqual");function lu(r,e){var t=r.length; +if(e.length!==t)return!1;for(;t-- >0;)if(r[t]!==e[t])return!1;return!0}o(lu,"are\ +TypedArraysEqual");var hu="[object Arguments]",fu="[object Boolean]",du="[object\ + Date]",pu="[object Map]",yu="[object Number]",wu="[object Object]",mu="[object \ +RegExp]",gu="[object Set]",Su="[object String]",Eu=Array.isArray,Li=typeof ArrayBuffer== +"function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Ui=Object.assign,bu=Object. +prototype.toString.call.bind(Object.prototype.toString);function xu(r){var e=r.areArraysEqual, +t=r.areDatesEqual,n=r.areMapsEqual,i=r.areObjectsEqual,s=r.arePrimitiveWrappersEqual, +a=r.areRegExpsEqual,u=r.areSetsEqual,c=r.areTypedArraysEqual;return o(function(h,f,y){ +if(h===f)return!0;if(h==null||f==null||typeof h!="object"||typeof f!="object")return h!== +h&&f!==f;var m=h.constructor;if(m!==f.constructor)return!1;if(m===Object)return i( +h,f,y);if(Eu(h))return e(h,f,y);if(Li!=null&&Li(h))return c(h,f,y);if(m===Date)return t( +h,f,y);if(m===RegExp)return a(h,f,y);if(m===Map)return n(h,f,y);if(m===Set)return u( +h,f,y);var b=bu(h);return b===du?t(h,f,y):b===mu?a(h,f,y):b===pu?n(h,f,y):b===gu? +u(h,f,y):b===wu?typeof h.then!="function"&&typeof f.then!="function"&&i(h,f,y):b=== +hu?i(h,f,y):b===fu||b===yu||b===Su?s(h,f,y):!1},"comparator")}o(xu,"createEquali\ +tyComparator");function Au(r){var e=r.circular,t=r.createCustomConfig,n=r.strict, +i={areArraysEqual:n?ct:su,areDatesEqual:au,areMapsEqual:n?xi(_i,ct):_i,areObjectsEqual:n? +ct:ou,arePrimitiveWrappersEqual:uu,areRegExpsEqual:cu,areSetsEqual:n?xi(Ti,ct):Ti, +areTypedArraysEqual:n?ct:lu};if(t&&(i=Ui({},i,t(i))),e){var s=Ft(i.areArraysEqual), +a=Ft(i.areMapsEqual),u=Ft(i.areObjectsEqual),c=Ft(i.areSetsEqual);i=Ui({},i,{areArraysEqual:s, +areMapsEqual:a,areObjectsEqual:u,areSetsEqual:c})}return i}o(Au,"createEqualityC\ +omparatorConfig");function vu(r){return function(e,t,n,i,s,a,u){return r(e,t,u)}} +o(vu,"createInternalEqualityComparator");function Cu(r){var e=r.circular,t=r.comparator, +n=r.createState,i=r.equals,s=r.strict;if(n)return o(function(c,l){var h=n(),f=h. +cache,y=f===void 0?e?new WeakMap:void 0:f,m=h.meta;return t(c,l,{cache:y,equals:i, +meta:m,strict:s})},"isEqual");if(e)return o(function(c,l){return t(c,l,{cache:new WeakMap, +equals:i,meta:void 0,strict:s})},"isEqual");var a={cache:void 0,equals:i,meta:void 0, +strict:s};return o(function(c,l){return t(c,l,a)},"isEqual")}o(Cu,"createIsEqual"); +var Lr=Le(),ef=Le({strict:!0}),tf=Le({circular:!0}),rf=Le({circular:!0,strict:!0}), +nf=Le({createInternalComparator:o(function(){return We},"createInternalComparato\ +r")}),sf=Le({strict:!0,createInternalComparator:o(function(){return We},"createI\ +nternalComparator")}),af=Le({circular:!0,createInternalComparator:o(function(){return We}, +"createInternalComparator")}),of=Le({circular:!0,createInternalComparator:o(function(){ +return We},"createInternalComparator"),strict:!0});function Le(r){r===void 0&&(r= +{});var e=r.circular,t=e===void 0?!1:e,n=r.createInternalComparator,i=r.createState, +s=r.strict,a=s===void 0?!1:s,u=Au(r),c=xu(u),l=n?n(c):vu(c);return Cu({circular:t, +comparator:c,createState:i,equals:l,strict:a})}o(Le,"createCustomEqual");p();var sr=Oe(ir());Jt();p();Jt();rn();var Na=Oe(bt()),Ma=Oe(Vt());function Ch(r){return r instanceof w?"\\x"+r.toString("hex"):r}o(Ch,"encodeBuffe\ +rsAsBytea");var Ce=class r extends Error{static{o(this,"NeonDbError")}name="Neon\ +DbError";severity;code;detail;hint;position;internalPosition;internalQuery;where;schema;table;column;dataType;constraint;file;line;routine;sourceError;constructor(e){ +super(e),"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&& +Error.captureStackTrace(this,r)}},Ba="transaction() expects an array of queries,\ + or a function returning an array of queries",_h=["severity","code","detail","hi\ +nt","position","internalPosition","internalQuery","where","schema","table","colu\ +mn","dataType","constraint","file","line","routine"];function xe(r,{arrayMode:e, +fullResults:t,fetchOptions:n,isolationLevel:i,readOnly:s,deferrable:a,queryCallback:u, +resultCallback:c,authToken:l}={}){if(!r)throw new Error("No database connection \ +string was provided to `neon()`. Perhaps an environment variable has not been se\ +t?");let h;try{h=tn(r)}catch{throw new Error("Database connection string provide\ +d to `neon()` is not a valid URL. Connection string: "+String(r))}let{protocol:f, +username:y,hostname:m,port:b,pathname:U}=h;if(f!=="postgres:"&&f!=="postgresql:"|| +!y||!m||!U)throw new Error("Database connection string format for `neon()` shoul\ +d be: postgresql://user:password@host.tld/dbname?option=value");function v(E,...g){ +let x,N;if(typeof E=="string")x=E,N=g[1],g=g[0]??[];else{x="";for(let D=0;DCh((0,Na.prepareValue)(D)));let P={ +query:x,params:g};return u&&u(P),Th(C,P,N)}o(v,"resolve"),v.transaction=async(E,g)=>{ +if(typeof E=="function"&&(E=E(v)),!Array.isArray(E))throw new Error(Ba);E.forEach( +P=>{if(P[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Ba)});let x=E. +map(P=>P.parameterizedQuery),N=E.map(P=>P.opts??{});return C(x,N,g)};async function C(E,g,x){ +let{fetchEndpoint:N,fetchFunction:P}=ge,D=Array.isArray(E)?{queries:E}:E,q=n??{}, +Z=e??!1,M=t??!1,$=i,j=s,H=a;x!==void 0&&(x.fetchOptions!==void 0&&(q={...q,...x. +fetchOptions}),x.arrayMode!==void 0&&(Z=x.arrayMode),x.fullResults!==void 0&&(M= +x.fullResults),x.isolationLevel!==void 0&&($=x.isolationLevel),x.readOnly!==void 0&& +(j=x.readOnly),x.deferrable!==void 0&&(H=x.deferrable)),g!==void 0&&!Array.isArray( +g)&&g.fetchOptions!==void 0&&(q={...q,...g.fetchOptions});let K=l;!Array.isArray( +g)&&g?.authToken!==void 0&&(K=g.authToken);let J=typeof N=="function"?N(m,b,{jwtAuth:K!== +void 0}):N,F={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Arr\ +ay-Mode":"true"},Y=await Lh(K);Y&&(F.Authorization=`Bearer ${Y}`),Array.isArray( +E)&&($!==void 0&&(F["Neon-Batch-Isolation-Level"]=$),j!==void 0&&(F["Neon-Batch-\ +Read-Only"]=String(j)),H!==void 0&&(F["Neon-Batch-Deferrable"]=String(H)));let W; +try{W=await(P??fetch)(J,{method:"POST",body:JSON.stringify(D),headers:F,...q})}catch(R){ +let k=new Ce(`Error connecting to database: ${R.message}`);throw k.sourceError=R, +k}if(W.ok){let R=await W.json();if(Array.isArray(E)){let k=R.results;if(!Array.isArray( +k))throw new Ce("Neon internal error: unexpected result format");return k.map((ne,ce)=>{ +let Fe=g[ce]??{},ar=Fe.arrayMode??Z,or=Fe.fullResults??M;return Ra(ne,{arrayMode:ar, +fullResults:or,parameterizedQuery:E[ce],resultCallback:c,types:Fe.types})})}else{ +let k=g??{},ne=k.arrayMode??Z,ce=k.fullResults??M;return Ra(R,{arrayMode:ne,fullResults:ce, +parameterizedQuery:E,resultCallback:c,types:k.types})}}else{let{status:R}=W;if(R=== +400){let k=await W.json(),ne=new Ce(k.message);for(let ce of _h)ne[ce]=k[ce]??void 0; +throw ne}else{let k=await W.text();throw new Ce(`Server error (HTTP status ${R})\ +: ${k}`)}}}return o(C,"execute"),v}o(xe,"neon");function Th(r,e,t){return{[Symbol. +toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:o((n,i)=>r(e,t). +then(n,i),"then"),catch:o(n=>r(e,t).catch(n),"catch"),finally:o(n=>r(e,t).finally( +n),"finally")}}o(Th,"createNeonQueryPromise");function Ra(r,{arrayMode:e,fullResults:t, +parameterizedQuery:n,resultCallback:i,types:s}){let a=new Ma.default(s),u=r.fields. +map(h=>h.name),c=r.fields.map(h=>a.getTypeParser(h.dataTypeID)),l=e===!0?r.rows. +map(h=>h.map((f,y)=>f===null?null:c[y](f))):r.rows.map(h=>Object.fromEntries(h.map( +(f,y)=>[u[y],f===null?null:c[y](f)])));return i&&i(n,r,l,{arrayMode:e,fullResults:t}), +t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=l,r._parsers=c,r._types=a,r):l}o(Ra,"\ +processQueryResult");async function Lh(r){if(typeof r=="string")return r;if(typeof r== +"function")try{return await Promise.resolve(r())}catch(e){let t=new Ce("Error ge\ +tting auth token.");throw e instanceof Error&&(t=new Ce(`Error getting auth toke\ +n: ${e.message}`)),t}}o(Lh,"getAuthToken");var Da=Oe(zt()),rt=Oe(ir());var Be=class extends sr.Client{constructor(t){super(t);this.config=t}static{o(this, +"NeonClient")}get neonConfig(){return this.connection.stream}connect(t){let{neonConfig:n}=this; +n.forceDisablePgSSL&&(this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&& +console.warn("SSL is enabled for both Postgres (e.g. ?sslmode=require in the con\ +nection string + forceDisablePgSSL = false) and the WebSocket tunnel (useSecureW\ +ebSocket = true). Double encryption will increase latency and CPU usage. It may \ +be appropriate to disable SSL in the Postgres connection parameters or set force\ +DisablePgSSL = true.");let i=this.config?.host!==void 0||this.config?.connectionString!== +void 0||S.env.PGHOST!==void 0,s=S.env.USER??S.env.USERNAME;if(!i&&this.host==="l\ +ocalhost"&&this.user===s&&this.database===s&&this.password===null)throw new Error( +`No database host or connection string was set, and key parameters have default \ +values (host: localhost, user: ${s}, db: ${s}, password: null). Is an environmen\ +t variable missing? Alternatively, if you intended to connect with these paramet\ +ers, please set the host to 'localhost' explicitly.`);let a=super.connect(t),u=n. +pipelineTLS&&this.ssl,c=n.pipelineConnect==="password";if(!u&&!n.pipelineConnect) +return a;let l=this.connection;if(u&&l.on("connect",()=>l.stream.emit("data","S")), +c){l.removeAllListeners("authenticationCleartextPassword"),l.removeAllListeners( +"readyForQuery"),l.once("readyForQuery",()=>l.on("readyForQuery",this._handleReadyForQuery. +bind(this)));let h=this.ssl?"sslconnect":"connect";l.on(h,()=>{this._handleAuthCleartextPassword(), +this._handleReadyForQuery()})}return a}async _handleAuthSASLContinue(t){let n=this. +saslSession,i=this.password,s=t.data;if(n.message!=="SASLInitialResponse"||typeof i!= +"string"||typeof s!="string")throw new Error("SASL: protocol error");let a=Object. +fromEntries(s.split(",").map(W=>{if(!/^.=/.test(W))throw new Error("SASL: Invali\ +d attribute pair entry");let R=W[0],k=W.substring(2);return[R,k]})),u=a.r,c=a.s, +l=a.i;if(!u||!/^[!-+--~]+$/.test(u))throw new Error("SASL: SCRAM-SERVER-FIRST-ME\ +SSAGE: nonce missing/unprintable");if(!c||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ +64");if(!l||!/^[1-9][0-9]*$/.test(l))throw new Error("SASL: SCRAM-SERVER-FIRST-M\ +ESSAGE: missing/invalid iteration count");if(!u.startsWith(n.clientNonce))throw new Error( +"SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); +if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ +SAGE: server nonce is too short");let h=parseInt(l,10),f=w.from(c,"base64"),y=new TextEncoder, +m=y.encode(i),b=await A.subtle.importKey("raw",m,{name:"HMAC",hash:{name:"SHA-25\ +6"}},!1,["sign"]),U=new Uint8Array(await A.subtle.sign("HMAC",b,w.concat([f,w.from( +[0,0,0,1])]))),v=U;for(var C=0;Cv[R]^U[R]));let E=v,g=await A.subtle.importKey( +"raw",E,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),x=new Uint8Array(await A. +subtle.sign("HMAC",g,y.encode("Client Key"))),N=await A.subtle.digest("SHA-256", +x),P="n=*,r="+n.clientNonce,D="r="+u+",s="+c+",i="+h,q="c=biws,r="+u,Z=P+","+D+"\ +,"+q,M=await A.subtle.importKey("raw",N,{name:"HMAC",hash:{name:"SHA-256"}},!1,[ +"sign"]);var $=new Uint8Array(await A.subtle.sign("HMAC",M,y.encode(Z))),j=w.from( +x.map((W,R)=>x[R]^$[R])),H=j.toString("base64");let K=await A.subtle.importKey("\ +raw",E,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),J=await A.subtle.sign("H\ +MAC",K,y.encode("Server Key")),F=await A.subtle.importKey("raw",J,{name:"HMAC",hash:{ +name:"SHA-256"}},!1,["sign"]);var Y=w.from(await A.subtle.sign("HMAC",F,y.encode( +Z)));n.message="SASLResponse",n.serverSignature=Y.toString("base64"),n.response= +q+",p="+H,this.connection.sendSCRAMClientFinalMessage(this.saslSession.response)}}; +function Uh(r,e){if(e)return{callback:e,result:void 0};let t,n,i=o(function(a,u){ +a?t(a):n(u)},"cb"),s=new r(function(a,u){n=a,t=u});return{callback:i,result:s}}o( +Uh,"promisify");var qe=class extends sr.Pool{static{o(this,"NeonPool")}Client=Be;hasFetchUnsupportedListeners=!1;on(e,t){ +return e!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(e,t)}query(e,t,n){ +if(!ge.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof e=="function") +return super.query(e,t,n);typeof t=="function"&&(n=t,t=void 0);let i=Uh(this.Promise, +n);n=i.callback;try{let s=new Da.default(this.options),a=encodeURIComponent,u=encodeURI, +c=`postgresql://${a(s.user)}:${a(s.password)}@${a(s.host)}/${u(s.database)}`,l=typeof e== +"string"?e:e.text,h=t??e.values??[];xe(c,{fullResults:!0,arrayMode:e.rowMode==="\ +array"})(l,h,{types:e.types??this.options?.types}).then(y=>n(void 0,y)).catch(y=>n( +y))}catch(s){n(s)}return i.result}};p();async function Ih(r){let e=Date.now(),t=await r();return[Date.now()-e,t]}o(Ih,"t\ +imed");async function nt(r,e,t=(n,i)=>{}){let n=[];for(let s=0;ss+a,0),n]}o(nt,"timedRepeat\ +s");async function vt(r,e){let{sql:t,test:n}=e,{rows:i}=await(typeof r=="functio\ +n"?r(t):r.query(t));if(!n(i))throw new Error(`Result fails test +Query: ${t} +Result: ${JSON.stringify(i)}`);return i}o(vt,"runQuery");async function Ct(r,e,t,n){ +await e.connect();let i=await nt(r,()=>vt(e,n));return t.waitUntil(e.end()),i}o( +Ct,"clientRunQuery");async function _t(r,e,t,n){let i=new qe({connectionString:e}), +s=await nt(r,()=>vt(i,n));return t.waitUntil(i.end()),s}o(_t,"poolRunQuery");async function qa(r,e,t,n){ +let i=xe(e,{fullResults:!0});return await nt(r,()=>vt(i,n))}o(qa,"httpRunQuery");p();var Tt=[{sql:"SELECT * FROM employees LIMIT 10",test:o(r=>r.length>1&&typeof r[0]. +first_name=="string","test")},{sql:"SELECT now()",test:o(r=>/^2\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d+Z$/. +test(r[0].now.toISOString()),"test")}];async function c0(r,e,t){let n=[];for(let i of Tt){let[,[[,s]]]=await _t(1,e.NEON_DB_URL, +t,i);n.push(s)}for(let i of Tt){let[,[[,s]]]=await qa(1,e.NEON_DB_URL,t,i);n.push( +s)}return new Response(JSON.stringify(n,null,2),{headers:{"Content-Type":"applic\ +ation/json"}})}o(c0,"cf");var Re={waitUntil(r){},passThroughOnException(){}};async function Ph(r,e=(...t)=>{}){ +let t=xe(r.NEON_DB_URL),[[n],[i]]=await t.transaction([t`SELECT ${1}::int AS "batchInt"`, +t`SELECT ${"hello"} AS "batchStr"`]);if(e("batch results:",JSON.stringify(n),JSON. +stringify(i),` +`),n.batchInt!==1||i.batchStr!=="hello")throw new Error("Batch query problem");let[ +[s],[a]]=await t.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`,x`SELECT ${"h\ +ello"} AS "batchStr"`]);if(e("batch results:",JSON.stringify(s),JSON.stringify(a), +` +`),s.batchInt!==1||a.batchStr!=="hello")throw new Error("Batch query problem");let u=await t. +transaction(x=>[]);e("empty txn result:",JSON.stringify(u),` +`);let[[[c]],[[l]]]=await t.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`,x`SELECT ${"\ +hello"} AS "batchStr"`],{arrayMode:!0,isolationLevel:"Serializable",readOnly:!0}); +if(e("array mode (via transaction options) batch results:",JSON.stringify(c),JSON. +stringify(l),` +`),c!==1||l!=="hello")throw new Error("Batch query problem");let h=xe(r.NEON_DB_URL, +{arrayMode:!0,isolationLevel:"RepeatableRead"}),[[[f]],[[y]]]=await h.transaction( +x=>[x`SELECT ${1}::int AS "batchInt"`,x`SELECT ${"hello"} AS "batchStr"`]);if(e( +"array mode (via neon options) batch results:",JSON.stringify(f),JSON.stringify( +y),` +`),f!==1||y!=="hello")throw new Error("Batch query problem");let m=xe(r.NEON_DB_URL, +{arrayMode:!0}),[[b],[U]]=await m.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`, +x`SELECT ${"hello"} AS "batchStr"`],{arrayMode:!1});if(e("ordinary (via overridd\ +en options) batch results:",JSON.stringify(b),JSON.stringify(U),` +`),b.batchInt!==1||U.batchStr!=="hello")throw new Error("Batch query problem");let[ +[v],[C]]=await t.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`,x('SELECT $1 \ +AS "batchStr"',["hello"],{arrayMode:!0})]);if(e("query options on individual bat\ +ch queries:",JSON.stringify(v),JSON.stringify(C),` +`),v.batchInt!==1||C[0]!=="hello")throw new Error("Batch query problem");let E;try{ +await t.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`,`SELECT 'hello' AS "ba\ +tchStr"`])}catch(x){E=x}if(E===void 0)throw new Error("Error should have been ra\ +ised for string passed to `transaction()`");e("successfully caught invalid query\ + passed to `transaction()`\n");let g;try{let x=r.NEON_DB_URL.replace(/@/,"x@");await xe( +x).transaction(N=>[N`SELECT 'never' AS this_should_be_seen_precisely`])}catch(x){ +g=x}if(g===void 0)throw new Error("Error should have been raised for bad passwor\ +d");e("successfully caught invalid password passed to `neon()`\n")}o(Ph,"batchQu\ +eryTest");async function l0(r,e,t=(...n)=>{}){let n=[1,3],i=9;t(`Warm-up ... + +`),await _t(1,r.NEON_DB_URL,Re,Tt[0]);let s=0;t(` ===== SQL-over-HTTP tests ===== -`); - const pgShowKeys = /* @__PURE__ */ new Set(["command", "rowCount", "rows", "fields"]); - const pool = await new NeonPool({ connectionString: env.NEON_DB_URL }); - const sql = neon(env.NEON_DB_URL, { - resultCallback: /* @__PURE__ */ __name(async (query, result, rows, opts) => { - const pgRes = await pool.query({ - text: query.query, - values: query.params, - ...opts.arrayMode ? { rowMode: "array" } : {} - }); - const commandMatches = result.command === pgRes.command; - const rowCountMatches = result.rowCount === pgRes.rowCount; - const dataTypesMatch = deepEqual( - result.fields.map((f) => f.dataTypeID), - pgRes.fields.map((f) => f.dataTypeID) - ); - const rowsMatch = deepEqual(rows, pgRes.rows); - const ok = commandMatches && rowCountMatches && rowsMatch && dataTypesMatch; - log2( - ok ? "\u2713" : "X", - JSON.stringify(query), - "\n -> us:", - JSON.stringify(rows), - "\n -> pg:", - JSON.stringify(pgRes.rows), - "\n" - ); - }, "resultCallback") - }); - const now = /* @__PURE__ */ new Date(); - await sql`SELECT ${1} AS int_uncast`; - await sql`SELECT ${1}::int AS int`; - await sql`SELECT ${1}::int8 AS int8num`; - await sql`SELECT ${1}::decimal AS decimalnum`; - await sql`SELECT ${"[1,4)"}::int4range AS int4range`; - await sql`SELECT ${"hello"} AS str`; - await sql`SELECT ${["a", "b", "c"]} AS arrstr_uncast`; - await sql`SELECT ${[[2], [4]]}::int[][] AS arrnumnested`; - await sql`SELECT ${now}::timestamptz AS timestamptznow`; - await sql`SELECT ${"16:17:18+01:00"}::timetz AS timetz`; - await sql`SELECT ${"17:18:19"}::time AS time`; - await sql`SELECT ${now}::date AS datenow`; - await sql`SELECT ${{ x: "y" }} AS obj_uncast`; - await sql`SELECT ${"11:22:33:44:55:66"}::macaddr AS macaddr`; - await sql`SELECT ${"\\xDEADBEEF"}::bytea AS bytea`; - await sql`SELECT ${"(2, 3)"}::point AS point`; - await sql`SELECT ${"<(2, 3), 1>"}::circle AS circle`; - await sql`SELECT ${"10.10.10.0/24"}::cidr AS cidr`; - await sql`SELECT ${true} AS bool_uncast`; - await sql`SELECT ${"hello"} || ' ' || ${"world"} AS greeting`; - await sql`SELECT ${[1, 2, 3]}::int[] AS arrnum`; - await sql`SELECT ${["a", "b", "c"]}::text[] AS arrstr`; - await sql`SELECT ${{ x: "y" }}::jsonb AS jsonb_obj`; - await sql`SELECT ${{ x: "y" }}::json AS json_obj`; - await sql`SELECT ${["11:22:33:44:55:66"]}::macaddr[] AS arrmacaddr`; - await sql`SELECT ${["10.10.10.0/24"]}::cidr[] AS arrcidr`; - await sql`SELECT ${true}::boolean AS bool`; - await sql`SELECT ${[now]}::timestamptz[] AS arrtstz`; - await sql`SELECT ${["(2, 3)"]}::point[] AS arrpoint`; - await sql`SELECT ${["<(2, 3), 1>"]}::circle[] AS arrcircle`; - await sql`SELECT ${["\\xDEADBEEF", "\\xDEADBEEF"]}::bytea[] AS arrbytea`; - await sql`SELECT null AS null`; - await sql`SELECT ${null} AS null`; - await sql`SELECT ${"NULL"} AS null_str`; - await sql`SELECT ${[1, 2, 3]} AS arrnum_uncast`; - await sql`SELECT ${[[2], [4]]} AS arrnumnested_uncast`; - await sql`SELECT ${now} AS timenow_uncast`; - await sql`SELECT ${now}::timestamp AS timestampnow`; - await sql("SELECT $1::timestamp AS timestampnow", [now]); - await sql("SELECT $1 || ' ' || $2 AS greeting", ["hello", "world"]); - await sql("SELECT 123 AS num"); - await sql("SELECT 123 AS num", [], { arrayMode: true, fullResults: true }); - function sqlWithRetries(sql2, timeoutMs, attempts = 3) { - return async function(strings, ...params) { - let query = ""; - for (let i = 0; i < strings.length; i++) { - query += strings[i]; - if (i < params.length) query += "$" + (i + 1); - } - for (let i = 1; ; i++) { - const abortController = new AbortController(); - const timeout = setTimeout( - () => abortController.abort("fetch timed out"), - timeoutMs - ); - try { - const { signal } = abortController; - const result = await sql2(query, params, { fetchOptions: { signal } }); - return result; - } catch (err) { - const timedOut = err.sourceError && err.sourceError instanceof DOMException && err.sourceError.name === "AbortError"; - if (!timedOut || i >= attempts) throw err; - } finally { - clearTimeout(timeout); - } - } - }; - } - __name(sqlWithRetries, "sqlWithRetries"); - const sqlRetry = sqlWithRetries(sql, 5e3); - await sqlRetry`SELECT ${"did this time out?"} AS str`; - await batchQueryTest(env, log2); - Socket.fetchFunction = (url, options) => { - console.log("custom fetch:", url, options); - return fetch(url, options); - }; - await sql`SELECT ${"customFetch"} AS str`; - const errstatement = "SELECT 123::int[] WHERE x"; - try { - await sql(errstatement); - } catch (err) { - console.log( - "Fields of this expected error should match the following error, except for having no `length` field" - ); - console.log(err); - } - try { - await poolRunQuery(1, env.NEON_DB_URL, ctx, { - sql: errstatement, - test: /* @__PURE__ */ __name(() => true, "test") - }); - } catch (err) { - console.log( - "Fields of this expected error should match the previous error, except for having an additional `length` field" - ); - console.log(err); - } - await new Promise((resolve) => setTimeout(resolve, 1e3)); - pool.end(); - log2(` +`);let a=new Set(["command","rowCount","rows","fields"]),u=await new qe({connectionString:r. +NEON_DB_URL}),c=xe(r.NEON_DB_URL,{resultCallback:o(async(m,b,U,v)=>{let C=await u. +query({text:m.query,values:m.params,...v.arrayMode?{rowMode:"array"}:{}}),E=b.command=== +C.command,g=b.rowCount===C.rowCount,x=Lr(b.fields.map(D=>D.dataTypeID),C.fields. +map(D=>D.dataTypeID)),N=Lr(U,C.rows);t(E&&g&&N&&x?"\u2713":"X",JSON.stringify(m), +` + -> us:`,JSON.stringify(U),` + -> pg:`,JSON.stringify(C.rows),` +`)},"resultCallback")}),l=new Date;await c`SELECT ${1} AS int_uncast`,await c`SELECT ${1}::int AS int`, +await c`SELECT ${1}::int8 AS int8num`,await c`SELECT ${1}::decimal AS decimalnum`, +await c`SELECT ${"[1,4)"}::int4range AS int4range`,await c`SELECT ${"hello"} AS str`, +await c`SELECT ${["a","b","c"]} AS arrstr_uncast`,await c`SELECT ${[[2],[4]]}::int[][] AS arrnumnested`, +await c`SELECT ${l}::timestamptz AS timestamptznow`,await c`SELECT ${"16:17:18+0\ +1:00"}::timetz AS timetz`,await c`SELECT ${"17:18:19"}::time AS time`,await c`SELECT ${l}::date AS datenow`, +await c`SELECT ${{x:"y"}} AS obj_uncast`,await c`SELECT ${"11:22:33:44:55:66"}::macaddr AS macaddr`, +await c`SELECT ${"\\xDEADBEEF"}::bytea AS bytea`,await c`SELECT ${"(2, 3)"}::point AS point`, +await c`SELECT ${"<(2, 3), 1>"}::circle AS circle`,await c`SELECT ${"10.10.10.0/\ +24"}::cidr AS cidr`,await c`SELECT ${!0} AS bool_uncast`,await c`SELECT ${"hello"} || ' ' || ${"\ +world"} AS greeting`,await c`SELECT ${[1,2,3]}::int[] AS arrnum`,await c`SELECT ${[ +"a","b","c"]}::text[] AS arrstr`,await c`SELECT ${{x:"y"}}::jsonb AS jsonb_obj`, +await c`SELECT ${{x:"y"}}::json AS json_obj`,await c`SELECT ${["11:22:33:44:55:6\ +6"]}::macaddr[] AS arrmacaddr`,await c`SELECT ${["10.10.10.0/24"]}::cidr[] AS arrcidr`, +await c`SELECT ${!0}::boolean AS bool`,await c`SELECT ${[l]}::timestamptz[] AS arrtstz`, +await c`SELECT ${["(2, 3)"]}::point[] AS arrpoint`,await c`SELECT ${["<(2, 3), 1\ +>"]}::circle[] AS arrcircle`,await c`SELECT ${["\\xDEADBEEF","\\xDEADBEEF"]}::bytea[] AS arrbytea`, +await c`SELECT null AS null`,await c`SELECT ${null} AS null`,await c`SELECT ${"N\ +ULL"} AS null_str`,await c`SELECT ${[1,2,3]} AS arrnum_uncast`,await c`SELECT ${[ +[2],[4]]} AS arrnumnested_uncast`,await c`SELECT ${l} AS timenow_uncast`,await c`SELECT ${l}::timestamp AS timestampnow`, +await c("SELECT $1::timestamp AS timestampnow",[l]),await c("SELECT $1 || ' ' ||\ + $2 AS greeting",["hello","world"]),await c("SELECT 123 AS num"),await c("SELECT\ + 123 AS num",[],{arrayMode:!0,fullResults:!0});function h(m,b,U=3){return async function(v,...C){ +let E="";for(let g=0;gx.abort("fetch timed out"),b);try{let{ +signal:P}=x;return await m(E,C,{fetchOptions:{signal:P}})}catch(P){if(!(P.sourceError&& +P.sourceError instanceof DOMException&&P.sourceError.name==="AbortError")||g>=U) +throw P}finally{clearTimeout(N)}}}}o(h,"sqlWithRetries"),await h(c,5e3)`SELECT ${"\ +did this time out?"} AS str`,await Ph(r,t),ge.fetchFunction=(m,b)=>(console.log( +"custom fetch:",m,b),fetch(m,b)),await c`SELECT ${"customFetch"} AS str`;let y="\ +SELECT 123::int[] WHERE x";try{await c(y)}catch(m){console.log("Fields of this e\ +xpected error should match the following error, except for having no `length` fi\ +eld"),console.log(m)}try{await _t(1,r.NEON_DB_URL,Re,{sql:y,test:o(()=>!0,"test")})}catch(m){ +console.log("Fields of this expected error should match the previous error, exce\ +pt for having an additional `length` field"),console.log(m)}await new Promise(m=>setTimeout( +m,1e3)),u.end(),t(` ===== Pool/Client tests ===== -`); - for (const query of queries) { - log2(` ------ ${query.sql} ----- - -`); - async function section(queryRepeat, f) { - const marker = String.fromCharCode( - counter + (counter > 25 ? 49 - 26 : 65) - ); - log2(`${marker} -`); - try { - await fetch(`http://localhost:443/${marker}`); - } catch { - } - log2(`Live: `); - const [, results] = await timedRepeats( - connectRepeats, - () => f(queryRepeat), - (t) => log2(`${t.toFixed()}ms `) - ); - log2("\nSorted: "); - results.map(([t]) => t).sort((a, b) => a - b).forEach((t, i) => { - log2( - i === (connectRepeats - 1) / 2 ? `${t.toFixed()}ms ` : `${t.toFixed()}ms ` - ); - }); - log2("\n\n"); - counter += 1; - } - __name(section, "section"); - async function sections(title, f) { - log2(`----- ${title} ----- - -`); - for (let queryRepeat of queryRepeats) { - log2(`${queryRepeat} quer${queryRepeat === 1 ? "y" : "ies"} \u2013 `); - await section(queryRepeat, f); - } - } - __name(sections, "sections"); - await sections("Neon/wss, no pipelining", async (n) => { - const client = new NeonClient(env.NEON_DB_URL); - client.neonConfig.pipelineConnect = false; - await clientRunQuery(n, client, ctx, query); - }); - await sections("Neon/wss, pipelined connect (default)", async (n) => { - const client = new NeonClient(env.NEON_DB_URL); - await clientRunQuery(n, client, ctx, query); - }); - await sections("Neon/wss, pipelined connect, no coalescing", async (n) => { - const client = new NeonClient(env.NEON_DB_URL); - client.neonConfig.coalesceWrites = false; - await clientRunQuery(n, client, ctx, query); - }); - await sections( - "Neon/wss, pipelined connect using Pool.query", - async (n) => { - await poolRunQuery(n, env.NEON_DB_URL, ctx, query); - } - ); - await sections( - "Neon/wss, pipelined connect using Pool.connect", - async (n) => { - const pool2 = new NeonPool({ connectionString: env.NEON_DB_URL }); - const poolClient = await pool2.connect(); - await timedRepeats(n, () => runQuery(poolClient, query)); - poolClient.release(); - ctx.waitUntil(pool2.end()); - } - ); - if (useSubtls) { - Socket.subtls = subtls_exports; - Socket.rootCerts = isrgrootx1_default; - await sections("pg/subtls, pipelined connect", async (n) => { - const client = new NeonClient(env.NEON_DB_URL); - client.neonConfig.wsProxy = (host, port) => `subtls-wsproxy.jawj.workers.dev/?address=${host}:${port}`; - client.neonConfig.forceDisablePgSSL = client.neonConfig.useSecureWebSocket = false; - client.neonConfig.pipelineTLS = false; - client.neonConfig.pipelineConnect = false; - try { - await clientRunQuery(n, client, ctx, query); - } catch (err) { - console.error(` -*** ${err.message}`); - } - }); - } - } -} -__name(latencies, "latencies"); -export { - batchQueryTest, - cf, - latencies, - Socket as neonConfig -}; +`);for(let m of Tt){t(` +----- ${m.sql} ----- + +`);async function b(v,C){let E=String.fromCharCode(s+(s>25?23:65));t(`${E} +`);try{await fetch(`http://localhost:443/${E}`)}catch{}t('Liv\ +e: ');let[,g]=await nt(i,()=>C(v),x=>t(`${x.toFixed()}\ +ms `));t(` +Sorted: `),g.map(([x])=>x).sort((x,N)=>x-N).forEach((x,N)=>{t(N===(i-1)/2?`${x.toFixed()}ms `:`${x.toFixed()}ms `)}),t(` + +`),s+=1}o(b,"section");async function U(v,C){t(`----- ${v} ----- + +`);for(let E of n)t(`${E} quer${E===1?"y":"ies"} \u2013 `),await b(E,C)}o(U,"sec\ +tions"),await U("Neon/wss, no pipelining",async v=>{let C=new Be(r.NEON_DB_URL); +C.neonConfig.pipelineConnect=!1,await Ct(v,C,Re,m)}),await U("Neon/wss, pipeline\ +d connect (default)",async v=>{let C=new Be(r.NEON_DB_URL);await Ct(v,C,Re,m)}), +await U("Neon/wss, pipelined connect, no coalescing",async v=>{let C=new Be(r.NEON_DB_URL); +C.neonConfig.coalesceWrites=!1,await Ct(v,C,Re,m)}),await U("Neon/wss, pipelined\ + connect using Pool.query",async v=>{await _t(v,r.NEON_DB_URL,Re,m)}),await U("N\ +eon/wss, pipelined connect using Pool.connect",async v=>{let C=new qe({connectionString:r. +NEON_DB_URL}),E=await C.connect();await nt(v,()=>vt(E,m)),E.release(),Re.waitUntil( +C.end())}),e&&(ge.subtls=Tr,ge.rootCerts=bi,await U("pg/subtls, pipelined connec\ +t",async v=>{let C=new Be(r.NEON_DB_URL);C.neonConfig.wsProxy=(E,g)=>`subtls-wsp\ +roxy.jawj.workers.dev/?address=${E}:${g}`,C.neonConfig.forceDisablePgSSL=C.neonConfig. +useSecureWebSocket=!1,C.neonConfig.pipelineTLS=!1,C.neonConfig.pipelineConnect=!1; +try{await Ct(v,C,Re,m)}catch(E){console.error(` +*** ${E.message}`)}}))}}o(l0,"latencies");export{Ph as batchQueryTest,c0 as cf,l0 as latencies,ge as neonConfig}; /*! Bundled license information: ieee754/index.js: diff --git a/package-lock.json b/package-lock.json index 00801ed..fdc39f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "path": "file:shims/path", "pg": "8.8.0", "pg-native": "file:shims/pg-native", - "prettier": "3.3.3", + "prettier": "^3.4.1", "serve": "^14.1.2", "stream": "file:shims/stream", "string_decoder": "file:shims/string_decoder", @@ -36,7 +36,7 @@ "@types/pg": "^8.6.5", "@types/ws": "^8.5.4", "dotenv": "^16.0.3", - "esbuild": "^0.21.1", + "esbuild": "^0.24.0", "fast-equals": "^5.0.1", "subtls": "^0.3.0", "typescript": "^5.0.4", @@ -48,6 +48,7 @@ "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.4.tgz", "integrity": "sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==", "dev": true, + "license": "MIT OR Apache-2.0", "dependencies": { "mime": "^3.0.0" }, @@ -56,13 +57,14 @@ } }, "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20240620.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240620.1.tgz", - "integrity": "sha512-YWeS2aE8jAzDefuus/3GmZcFGu3Ef94uCAoxsQuaEXNsiGM9NeAhPpKC1BJAlcv168U/Q1J+6hckcGtipf6ZcQ==", + "version": "1.20241106.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241106.1.tgz", + "integrity": "sha512-zxvaToi1m0qzAScrxFt7UvFVqU8DxrCO2CinM1yQkv5no7pA1HolpIrwZ0xOhR3ny64Is2s/J6BrRjpO5dM9Zw==", "cpu": [ "x64" ], "dev": true, + "license": "Apache-2.0", "optional": true, "os": [ "darwin" @@ -72,13 +74,14 @@ } }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20240620.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240620.1.tgz", - "integrity": "sha512-3rdND+EHpmCrwYX6hvxIBSBJ0f40tRNxond1Vfw7GiR1MJVi3gragiBx75UDFHCxfRw3J0GZ1qVlkRce2/Xbsg==", + "version": "1.20241106.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241106.1.tgz", + "integrity": "sha512-j3dg/42D/bPgfNP3cRUBxF+4waCKO/5YKwXNj+lnVOwHxDu+ne5pFw9TIkKYcWTcwn0ZUkbNZNM5rhJqRn4xbg==", "cpu": [ "arm64" ], "dev": true, + "license": "Apache-2.0", "optional": true, "os": [ "darwin" @@ -88,13 +91,14 @@ } }, "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20240620.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240620.1.tgz", - "integrity": "sha512-tURcTrXGeSbYqeM5ISVcofY20StKbVIcdxjJvNYNZ+qmSV9Fvn+zr7rRE+q64pEloVZfhsEPAlUCnFso5VV4XQ==", + "version": "1.20241106.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241106.1.tgz", + "integrity": "sha512-Ih+Ye8E1DMBXcKrJktGfGztFqHKaX1CeByqshmTbODnWKHt6O65ax3oTecUwyC0+abuyraOpAtdhHNpFMhUkmw==", "cpu": [ "x64" ], "dev": true, + "license": "Apache-2.0", "optional": true, "os": [ "linux" @@ -104,13 +108,14 @@ } }, "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20240620.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240620.1.tgz", - "integrity": "sha512-TThvkwNxaZFKhHZnNjOGqIYCOk05DDWgO+wYMuXg15ymN/KZPnCicRAkuyqiM+R1Fgc4kwe/pehjP8pbmcf6sg==", + "version": "1.20241106.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241106.1.tgz", + "integrity": "sha512-mdQFPk4+14Yywn7n1xIzI+6olWM8Ybz10R7H3h+rk0XulMumCWUCy1CzIDauOx6GyIcSgKIibYMssVHZR30ObA==", "cpu": [ "arm64" ], "dev": true, + "license": "Apache-2.0", "optional": true, "os": [ "linux" @@ -120,13 +125,14 @@ } }, "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20240620.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240620.1.tgz", - "integrity": "sha512-Y/BA9Yj0r7Al1HK3nDHcfISgFllw6NR3XMMPChev57vrVT9C9D4erBL3sUBfofHU+2U9L+ShLsl6obBpe3vvUw==", + "version": "1.20241106.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241106.1.tgz", + "integrity": "sha512-4rtcss31E/Rb/PeFocZfr+B9i1MdrkhsTBWizh8siNR4KMmkslU2xs2wPaH1z8+ErxkOsHrKRa5EPLh5rIiFeg==", "cpu": [ "x64" ], "dev": true, + "license": "Apache-2.0", "optional": true, "os": [ "win32" @@ -135,17 +141,33 @@ "node": ">=16" } }, + "node_modules/@cloudflare/workers-shared": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.8.0.tgz", + "integrity": "sha512-1OvFkNtslaMZAJsaocTmbACApgmWv55uLpNj50Pn2MGcxdAjpqykXJFQw5tKc+lGV9TDZh9oO3Rsk17IEQDzIg==", + "dev": true, + "license": "MIT OR Apache-2.0", + "dependencies": { + "mime": "^3.0.0", + "zod": "^3.22.3" + }, + "engines": { + "node": ">=16.7.0" + } + }, "node_modules/@cloudflare/workers-types": { - "version": "4.20240620.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20240620.0.tgz", - "integrity": "sha512-CQD8YS6evRob7LChvIX3gE3zYo0KVgaLDOu1SwNP1BVIS2Sa0b+FC8S1e1hhrNN8/E4chYlVN+FDAgA4KRDUEQ==", - "dev": true + "version": "4.20241112.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241112.0.tgz", + "integrity": "sha512-Q4p9bAWZrX14bSCKY9to19xl0KMU7nsO5sJ2cTVspHoypsjPUMeQCsjHjmsO2C4Myo8/LPeDvmqFmkyNAPPYZw==", + "dev": true, + "license": "MIT OR Apache-2.0" }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -158,6 +180,7 @@ "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz", "integrity": "sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==", "dev": true, + "license": "ISC", "peerDependencies": { "esbuild": "*" } @@ -167,6 +190,7 @@ "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz", "integrity": "sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==", "dev": true, + "license": "ISC", "dependencies": { "escape-string-regexp": "^4.0.0", "rollup-plugin-node-polyfills": "^0.2.1" @@ -180,6 +204,7 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -188,371 +213,411 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", + "integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "aix" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz", + "integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz", + "integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz", + "integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz", + "integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz", + "integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz", + "integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz", + "integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz", + "integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", + "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz", + "integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz", + "integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==", "cpu": [ "loong64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz", + "integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==", "cpu": [ "mips64el" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz", + "integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz", + "integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz", + "integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz", + "integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz", + "integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "netbsd" ], "engines": { - "node": ">=12" + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz", + "integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz", + "integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "openbsd" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz", + "integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "sunos" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz", + "integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz", + "integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz", + "integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ], "engines": { - "node": ">=12" + "node": ">=18" } }, "node_modules/@fastify/busboy": { @@ -560,6 +625,7 @@ "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "dev": true, + "license": "MIT", "engines": { "node": ">=14" } @@ -569,21 +635,24 @@ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -593,15 +662,17 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz", "integrity": "sha512-trOc4AAUThEz9hapPtSd7wf5tiQKvTtu5b371UxXdTuqzIh0ArcRspRP0i0Viu+LXstIQ1z96t1nsPxT9ol01g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/node": { - "version": "20.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", - "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "version": "22.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.0.tgz", + "integrity": "sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==", "dev": true, + "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.20.0" } }, "node_modules/@types/node-forge": { @@ -609,15 +680,17 @@ "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } }, "node_modules/@types/pg": { - "version": "8.11.6", - "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.11.6.tgz", - "integrity": "sha512-/2WmmBXHLsfRqzfHW7BNZ8SbYzE8OSk7i3WjFYvfgRHj7S1xj+16Je5fUKv3lVdVzk/zn9TXOqf+avFCFIE0yQ==", + "version": "8.11.10", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.11.10.tgz", + "integrity": "sha512-LczQUW4dbOQzsH2RQ5qoeJ6qJPdrcM/DcMLoqWQkMLMsq83J5lAX3LXjdkWdpscFy67JSOWDnh7Ny/sPFykmkg==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*", "pg-protocol": "*", @@ -625,10 +698,11 @@ } }, "node_modules/@types/ws": { - "version": "8.5.10", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", - "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", + "version": "8.5.13", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", + "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -636,12 +710,14 @@ "node_modules/@zeit/schemas": { "version": "2.36.0", "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", - "integrity": "sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==" + "integrity": "sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==", + "license": "MIT" }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", "dependencies": { "mime-types": "~2.1.34", "negotiator": "0.6.3" @@ -651,10 +727,11 @@ } }, "node_modules/acorn": { - "version": "8.12.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz", - "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -663,10 +740,11 @@ } }, "node_modules/acorn-walk": { - "version": "8.3.3", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", - "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", "dev": true, + "license": "MIT", "dependencies": { "acorn": "^8.11.0" }, @@ -678,6 +756,7 @@ "version": "8.12.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -693,6 +772,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "license": "ISC", "dependencies": { "string-width": "^4.1.0" } @@ -701,6 +781,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -708,12 +789,14 @@ "node_modules/ansi-align/node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" }, "node_modules/ansi-align/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -727,6 +810,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -735,9 +819,10 @@ } }, "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -749,6 +834,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "license": "MIT", "dependencies": { "color-convert": "^1.9.0" }, @@ -756,19 +842,6 @@ "node": ">=4" } }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/arch": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", @@ -786,17 +859,20 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/arg": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", - "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "license": "MIT" }, "node_modules/array-buffer-byte-length": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.5", "is-array-buffer": "^3.0.4" @@ -812,6 +888,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "license": "MIT", "dependencies": { "array-buffer-byte-length": "^1.0.1", "call-bind": "^1.0.5", @@ -834,6 +911,7 @@ "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", "dev": true, + "license": "MIT", "dependencies": { "printable-characters": "^1.0.42" } @@ -846,6 +924,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", "dependencies": { "possible-typed-array-names": "^1.0.0" }, @@ -859,7 +938,8 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" }, "node_modules/base64-js": { "version": "1.5.1", @@ -878,30 +958,21 @@ "type": "consulting", "url": "https://feross.org/support" } - ] - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + ], + "license": "MIT" }, "node_modules/blake3-wasm": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/boxen": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/boxen/-/boxen-7.0.0.tgz", "integrity": "sha512-j//dBVuyacJbvW+tvZ9HuH03fZ46QcaKvvhZickZqtB271DxJ7SNRSNxrV/dZX0085m7hISRZWbzWlJvx/rHSg==", + "license": "MIT", "dependencies": { "ansi-align": "^3.0.1", "camelcase": "^7.0.0", @@ -923,6 +994,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "license": "MIT", "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" }, @@ -934,23 +1006,12 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -969,6 +1030,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" @@ -978,6 +1040,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==", + "license": "MIT", "engines": { "node": ">=4" } @@ -986,6 +1049,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -994,6 +1058,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "license": "MIT", "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -1012,6 +1077,7 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-7.0.1.tgz", "integrity": "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==", + "license": "MIT", "engines": { "node": ">=14.16" }, @@ -1024,18 +1090,20 @@ "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", "dev": true, + "license": "MIT", "dependencies": { "debug": "^4.3.1", "tslib": "^2.2.0" } }, "node_modules/capnp-ts/node_modules/debug": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", - "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1047,15 +1115,17 @@ } }, "node_modules/capnp-ts/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -1069,6 +1139,7 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz", "integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==", + "license": "MIT", "dependencies": { "chalk": "^4.1.2" }, @@ -1083,6 +1154,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -1097,6 +1169,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1112,6 +1185,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -1122,12 +1196,14 @@ "node_modules/chalk-template/node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" }, "node_modules/chalk-template/node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1136,6 +1212,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -1144,33 +1221,26 @@ } }, "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", + "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", "dev": true, + "license": "MIT", "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "readdirp": "^4.0.1" }, "engines": { - "node": ">= 8.10.0" + "node": ">= 14.16.0" }, "funding": { "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" } }, "node_modules/cli-boxes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", + "license": "MIT", "engines": { "node": ">=10" }, @@ -1182,6 +1252,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-3.0.0.tgz", "integrity": "sha512-Su+uU5sr1jkUy1sGRpLKjKrvEOVXgSgiSInwa/qeID6aJ07yh+5NWc3h2QfjHjBnfX4LhtFcuAWKUsJ3r+fjbg==", + "license": "MIT", "dependencies": { "arch": "^2.2.0", "execa": "^5.1.1", @@ -1198,6 +1269,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", "dependencies": { "color-name": "1.1.3" } @@ -1205,12 +1277,14 @@ "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" }, "node_modules/compressible": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "license": "MIT", "dependencies": { "mime-db": ">= 1.43.0 < 2" }, @@ -1222,6 +1296,7 @@ "version": "1.7.4", "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "license": "MIT", "dependencies": { "accepts": "~1.3.5", "bytes": "3.0.0", @@ -1238,38 +1313,33 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" - }, - "node_modules/consola": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz", - "integrity": "sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==", - "dev": true, - "engines": { - "node": "^14.18.0 || >=16.10.0" - } + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "license": "MIT" }, "node_modules/content-disposition": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", "integrity": "sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA==", + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } }, "node_modules/cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "license": "MIT", "dependencies": { "nice-try": "^1.0.4", "path-key": "^2.0.1", @@ -1289,12 +1359,14 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz", "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/data-view-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.6", "es-errors": "^1.3.0", @@ -1311,6 +1383,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -1327,6 +1400,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.6", "es-errors": "^1.3.0", @@ -1340,10 +1414,11 @@ } }, "node_modules/date-fns": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-3.6.0.tgz", - "integrity": "sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", "dev": true, + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/kossnocorp" @@ -1353,6 +1428,7 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", "dependencies": { "ms": "2.0.0" } @@ -1361,6 +1437,7 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", "engines": { "node": ">=4.0.0" } @@ -1369,6 +1446,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -1385,6 +1463,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "license": "MIT", "dependencies": { "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", @@ -1401,7 +1480,8 @@ "version": "6.1.4", "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/dns": { "resolved": "shims/dns", @@ -1412,6 +1492,7 @@ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=12" }, @@ -1422,25 +1503,29 @@ "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "license": "MIT" }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "license": "MIT" }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "license": "MIT", "dependencies": { "is-arrayish": "^0.2.1" } }, "node_modules/es-abstract": { - "version": "1.23.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", - "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "version": "1.23.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.5.tgz", + "integrity": "sha512-vlmniQ0WNPwXqA0BnmwV3Ng7HxiGlh6r5U6JcTMNx8OilcAGqVJBHJcPjqOMaczU9fRuRK5Px2BdVyPRnKMMVQ==", + "license": "MIT", "dependencies": { "array-buffer-byte-length": "^1.0.1", "arraybuffer.prototype.slice": "^1.0.3", @@ -1457,7 +1542,7 @@ "function.prototype.name": "^1.1.6", "get-intrinsic": "^1.2.4", "get-symbol-description": "^1.0.2", - "globalthis": "^1.0.3", + "globalthis": "^1.0.4", "gopd": "^1.0.1", "has-property-descriptors": "^1.0.2", "has-proto": "^1.0.3", @@ -1473,10 +1558,10 @@ "is-string": "^1.0.7", "is-typed-array": "^1.1.13", "is-weakref": "^1.0.2", - "object-inspect": "^1.13.1", + "object-inspect": "^1.13.3", "object-keys": "^1.1.1", "object.assign": "^4.1.5", - "regexp.prototype.flags": "^1.5.2", + "regexp.prototype.flags": "^1.5.3", "safe-array-concat": "^1.1.2", "safe-regex-test": "^1.0.3", "string.prototype.trim": "^1.2.9", @@ -1500,6 +1585,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "license": "MIT", "dependencies": { "get-intrinsic": "^1.2.4" }, @@ -1511,6 +1597,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -1519,6 +1606,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "license": "MIT", "dependencies": { "es-errors": "^1.3.0" }, @@ -1530,6 +1618,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "license": "MIT", "dependencies": { "get-intrinsic": "^1.2.4", "has-tostringtag": "^1.0.2", @@ -1543,6 +1632,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "license": "MIT", "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -1556,47 +1646,50 @@ } }, "node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", + "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, "engines": { - "node": ">=12" + "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" + "@esbuild/aix-ppc64": "0.24.0", + "@esbuild/android-arm": "0.24.0", + "@esbuild/android-arm64": "0.24.0", + "@esbuild/android-x64": "0.24.0", + "@esbuild/darwin-arm64": "0.24.0", + "@esbuild/darwin-x64": "0.24.0", + "@esbuild/freebsd-arm64": "0.24.0", + "@esbuild/freebsd-x64": "0.24.0", + "@esbuild/linux-arm": "0.24.0", + "@esbuild/linux-arm64": "0.24.0", + "@esbuild/linux-ia32": "0.24.0", + "@esbuild/linux-loong64": "0.24.0", + "@esbuild/linux-mips64el": "0.24.0", + "@esbuild/linux-ppc64": "0.24.0", + "@esbuild/linux-riscv64": "0.24.0", + "@esbuild/linux-s390x": "0.24.0", + "@esbuild/linux-x64": "0.24.0", + "@esbuild/netbsd-x64": "0.24.0", + "@esbuild/openbsd-arm64": "0.24.0", + "@esbuild/openbsd-x64": "0.24.0", + "@esbuild/sunos-x64": "0.24.0", + "@esbuild/win32-arm64": "0.24.0", + "@esbuild/win32-ia32": "0.24.0", + "@esbuild/win32-x64": "0.24.0" } }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "license": "MIT", "engines": { "node": ">=0.8.0" } @@ -1605,12 +1698,14 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", "engines": { "node": ">=0.8.x" } @@ -1619,6 +1714,7 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "license": "MIT", "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -1638,9 +1734,10 @@ } }, "node_modules/execa/node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1654,6 +1751,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1662,6 +1760,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" }, @@ -1673,6 +1772,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1681,6 +1781,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -1696,6 +1797,7 @@ "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz", "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" }, @@ -1706,41 +1808,24 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" }, "node_modules/fast-equals": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.0.1.tgz", "integrity": "sha512-WF1Wi8PwwSY7/6Kx0vKXtw8RwuSGoM1bvDaJbu7MxDlR1vovZjIAKrnzyrThgAjm6JDTu0fVgWXDlMGspodfoQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } }, - "node_modules/fast-url-parser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", - "integrity": "sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==", - "dependencies": { - "punycode": "^1.3.2" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "license": "MIT", "dependencies": { "is-callable": "^1.1.3" } @@ -1755,6 +1840,7 @@ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1767,6 +1853,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -1775,6 +1862,7 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", @@ -1792,6 +1880,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -1800,6 +1889,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", @@ -1819,6 +1909,7 @@ "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz", "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==", "dev": true, + "license": "Unlicense", "dependencies": { "data-uri-to-buffer": "^2.0.0", "source-map": "^0.6.1" @@ -1828,6 +1919,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "license": "MIT", "engines": { "node": ">=10" }, @@ -1839,6 +1931,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.5", "es-errors": "^1.3.0", @@ -1851,28 +1944,18 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/globalthis": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "license": "MIT", "dependencies": { "define-properties": "^1.2.1", "gopd": "^1.0.1" @@ -1888,6 +1971,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "license": "MIT", "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -1898,12 +1982,14 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" }, "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -1912,6 +1998,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", "engines": { "node": ">=4" } @@ -1920,6 +2007,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", "dependencies": { "es-define-property": "^1.0.0" }, @@ -1931,6 +2019,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -1942,6 +2031,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -1953,6 +2043,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", "dependencies": { "has-symbols": "^1.0.3" }, @@ -1967,6 +2058,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, @@ -1977,12 +2069,14 @@ "node_modules/hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "license": "ISC" }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "license": "Apache-2.0", "engines": { "node": ">=10.17.0" } @@ -2004,17 +2098,20 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "BSD-3-Clause" }, "node_modules/ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "license": "ISC" }, "node_modules/internal-slot": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "hasown": "^2.0.0", @@ -2028,6 +2125,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.2.1" @@ -2042,12 +2140,29 @@ "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT" + }, + "node_modules/is-async-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", + "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/is-bigint": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "license": "MIT", "dependencies": { "has-bigints": "^1.0.1" }, @@ -2055,22 +2170,11 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/is-boolean-object": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -2086,6 +2190,7 @@ "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -2094,9 +2199,10 @@ } }, "node_modules/is-core-module": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz", - "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", + "license": "MIT", "dependencies": { "hasown": "^2.0.2" }, @@ -2111,6 +2217,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "license": "MIT", "dependencies": { "is-typed-array": "^1.1.13" }, @@ -2125,6 +2232,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "license": "MIT", "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -2139,6 +2247,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "license": "MIT", "bin": { "is-docker": "cli.js" }, @@ -2149,39 +2258,50 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, + "node_modules/is-finalizationregistry": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.0.tgz", + "integrity": "sha512-qfMdqbAQEwBw78ZyReKnlA8ezmPdb9BemzIIip/JkjaZUhitfXDkkr+3QTboW0JrSXT1QWyYShpvnNHGZ4c4yA==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "license": "MIT", "dependencies": { - "is-extglob": "^2.1.1" + "has-tostringtag": "^1.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-negative-zero": { + "node_modules/is-map": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", - "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -2189,19 +2309,23 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "license": "MIT", "engines": { - "node": ">=0.12.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-number-object": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "license": "MIT", "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -2216,6 +2340,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/is-port-reachable/-/is-port-reachable-4.0.0.tgz", "integrity": "sha512-9UoipoxYmSk6Xy7QFgRv2HDyaysmgSG75TFQs6S+3pDM7ZhKTF/bskZV+0UlABHzKjNVhPjYCLfeZUEg1wXxig==", + "license": "MIT", "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, @@ -2227,6 +2352,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -2238,10 +2364,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-shared-array-buffer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7" }, @@ -2256,6 +2395,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "license": "MIT", "engines": { "node": ">=8" }, @@ -2267,6 +2407,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "license": "MIT", "dependencies": { "has-tostringtag": "^1.0.0" }, @@ -2281,6 +2422,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "license": "MIT", "dependencies": { "has-symbols": "^1.0.2" }, @@ -2295,6 +2437,7 @@ "version": "1.1.13", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "license": "MIT", "dependencies": { "which-typed-array": "^1.1.14" }, @@ -2305,10 +2448,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.2" }, @@ -2316,10 +2472,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-weakset": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.3.tgz", + "integrity": "sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "license": "MIT", "dependencies": { "is-docker": "^2.0.0" }, @@ -2330,27 +2503,39 @@ "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "license": "MIT" }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/itty-time": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/itty-time/-/itty-time-1.0.6.tgz", + "integrity": "sha512-+P8IZaLLBtFv8hCkIjcymZOp4UJ+xW6bSlQsXGqrkmJh7vSiMFSlNne0mCYagEE0N7HDNR5jJBRxwN0oYv61Rw==", + "dev": true, + "license": "MIT" }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "license": "MIT" }, "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "license": "MIT", "dependencies": { "graceful-fs": "^4.1.2", "parse-json": "^4.0.0", @@ -2366,6 +2551,7 @@ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", "dev": true, + "license": "MIT", "dependencies": { "sourcemap-codec": "^1.4.8" } @@ -2381,13 +2567,15 @@ "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "license": "MIT" }, "node_modules/mime": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", "dev": true, + "license": "MIT", "bin": { "mime": "cli.js" }, @@ -2396,9 +2584,10 @@ } }, "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "version": "1.53.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.53.0.tgz", + "integrity": "sha512-oHlN/w+3MQ3rba9rqFr6V/ypF10LSkdwUysQL7GkXoTgIWeV+tcXGA852TBxH+gsh8UWoyhR1hKcoMJTuWflpg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -2407,6 +2596,7 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, @@ -2414,19 +2604,30 @@ "node": ">= 0.6" } }, + "node_modules/mime-types/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/miniflare": { - "version": "3.20240620.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240620.0.tgz", - "integrity": "sha512-NBMzqUE2mMlh/hIdt6U5MP+aFhEjKDq3l8CAajXAQa1WkndJdciWvzB2mfLETwoVFhMl/lphaVzyEN2AgwJpbQ==", + "version": "3.20241106.1", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241106.1.tgz", + "integrity": "sha512-dM3RBlJE8rUFxnqlPCaFCq0E7qQqEQvKbYX7W/APGCK+rLcyLmEBzC4GQR/niXdNM/oV6gdg9AA50ghnn2ALuw==", "dev": true, + "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "0.8.1", "acorn": "^8.8.0", @@ -2436,8 +2637,8 @@ "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", "undici": "^5.28.4", - "workerd": "1.20240620.1", - "ws": "^8.14.2", + "workerd": "1.20241106.1", + "ws": "^8.18.0", "youch": "^3.2.2", "zod": "^3.22.3" }, @@ -2453,6 +2654,7 @@ "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", "dev": true, + "license": "MIT", "dependencies": { "@fastify/busboy": "^2.0.0" }, @@ -2464,6 +2666,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2475,6 +2678,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -2482,21 +2686,23 @@ "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" }, "node_modules/mustache": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", "dev": true, + "license": "MIT", "bin": { "mustache": "bin/mustache" } }, "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -2504,6 +2710,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -2515,6 +2722,7 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -2526,19 +2734,15 @@ "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" - }, - "node_modules/node-fetch-native": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.4.tgz", - "integrity": "sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==", - "dev": true + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "license": "MIT" }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", "dev": true, + "license": "(BSD-3-Clause OR GPL-2.0)", "engines": { "node": ">= 6.13.0" } @@ -2547,6 +2751,7 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "license": "BSD-2-Clause", "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -2554,19 +2759,11 @@ "validate-npm-package-license": "^3.0.1" } }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/npm-run-all": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", + "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", "chalk": "^2.4.1", @@ -2591,6 +2788,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "license": "MIT", "dependencies": { "path-key": "^3.0.0" }, @@ -2602,14 +2800,16 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/object-inspect": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz", + "integrity": "sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -2621,6 +2821,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -2629,6 +2830,7 @@ "version": "4.1.5", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.5", "define-properties": "^1.2.1", @@ -2646,12 +2848,21 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true + "dev": true, + "license": "MIT" + }, + "node_modules/ohash": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.4.tgz", + "integrity": "sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==", + "dev": true, + "license": "MIT" }, "node_modules/on-headers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -2660,6 +2871,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "license": "MIT", "dependencies": { "mimic-fn": "^2.1.0" }, @@ -2673,12 +2885,14 @@ "node_modules/packet-reader": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz", - "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==" + "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==", + "license": "MIT" }, "node_modules/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "license": "MIT", "dependencies": { "error-ex": "^1.3.1", "json-parse-better-errors": "^1.0.1" @@ -2694,12 +2908,14 @@ "node_modules/path-is-inside": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==" + "integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==", + "license": "(WTFPL OR MIT)" }, "node_modules/path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "license": "MIT", "engines": { "node": ">=4" } @@ -2707,17 +2923,20 @@ "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "license": "MIT" }, "node_modules/path-to-regexp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz", - "integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==" + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.3.0.tgz", + "integrity": "sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==", + "license": "MIT" }, "node_modules/path-type": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "license": "MIT", "dependencies": { "pify": "^3.0.0" }, @@ -2729,12 +2948,14 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/pg": { "version": "8.8.0", "resolved": "https://registry.npmjs.org/pg/-/pg-8.8.0.tgz", "integrity": "sha512-UXYN0ziKj+AeNNP7VDMwrehpACThH7LUl/p8TDFpEUuSejCUIwGSfxpHsPvtM6/WXFy6SU4E5RG4IJV/TZAGjw==", + "license": "MIT", "dependencies": { "buffer-writer": "2.0.0", "packet-reader": "1.0.0", @@ -2759,12 +2980,14 @@ "node_modules/pg-connection-string": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.5.0.tgz", - "integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ==" + "integrity": "sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ==", + "license": "MIT" }, "node_modules/pg-int8": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "license": "ISC", "engines": { "node": ">=4.0.0" } @@ -2778,28 +3001,32 @@ "resolved": "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz", "integrity": "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==", "dev": true, + "license": "ISC", "engines": { "node": ">=4" } }, "node_modules/pg-pool": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.2.tgz", - "integrity": "sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==", + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.7.0.tgz", + "integrity": "sha512-ZOBQForurqh4zZWjrgSwwAtzJ7QiRX0ovFkZr2klsen3Nm0aoh33Ls0fzfv3imeH/nw/O27cjdz5kzYJfeGp/g==", + "license": "MIT", "peerDependencies": { "pg": ">=8.0" } }, "node_modules/pg-protocol": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.1.tgz", - "integrity": "sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.7.0.tgz", + "integrity": "sha512-hTK/mE36i8fDDhgDFjy6xNOG+LCorxLG3WO17tku+ij6sVHXh1jQUJ8hYAnRhNla4QVD2H8er/FOjc/+EgC6yQ==", + "license": "MIT" }, "node_modules/pg-types": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-4.0.2.tgz", "integrity": "sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng==", "dev": true, + "license": "MIT", "dependencies": { "pg-int8": "1.0.1", "pg-numeric": "1.0.2", @@ -2817,6 +3044,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "license": "MIT", "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", @@ -2832,6 +3060,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "license": "MIT", "engines": { "node": ">=4" } @@ -2840,6 +3069,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -2848,6 +3078,7 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -2856,6 +3087,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", + "license": "MIT", "dependencies": { "xtend": "^4.0.0" }, @@ -2867,26 +3099,16 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz", "integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==", + "license": "MIT", "dependencies": { "split2": "^4.1.0" } }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/pidtree": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", + "license": "MIT", "bin": { "pidtree": "bin/pidtree.js" }, @@ -2898,6 +3120,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "license": "MIT", "engines": { "node": ">=4" } @@ -2906,6 +3129,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -2915,6 +3139,7 @@ "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz", "integrity": "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" } @@ -2924,6 +3149,7 @@ "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz", "integrity": "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==", "dev": true, + "license": "MIT", "dependencies": { "obuf": "~1.1.2" }, @@ -2936,6 +3162,7 @@ "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-2.1.0.tgz", "integrity": "sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" } @@ -2945,6 +3172,7 @@ "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz", "integrity": "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" } @@ -2953,12 +3181,14 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.4.tgz", "integrity": "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", + "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", + "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, @@ -2973,17 +3203,23 @@ "version": "1.0.42", "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz", "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==", - "dev": true + "dev": true, + "license": "Unlicense" }, "node_modules/punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==" + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", + "engines": { + "node": ">=6" + } }, "node_modules/range-parser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", "integrity": "sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -2992,6 +3228,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", @@ -3006,6 +3243,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "license": "MIT", "dependencies": { "load-json-file": "^4.0.0", "normalize-package-data": "^2.3.2", @@ -3016,26 +3254,50 @@ } }, "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz", + "integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==", "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.7.tgz", + "integrity": "sha512-bMvFGIUKlc/eSfXNX+aZ+EL95/EgZzuwA0OBPTbZZDEJw/0AkentjMuM1oiRfwHrshqk4RzdgiTg5CcDalXN5g==", + "license": "MIT", "dependencies": { - "picomatch": "^2.2.1" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "which-builtin-type": "^1.1.4" }, "engines": { - "node": ">=8.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/regexp.prototype.flags": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", - "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.3.tgz", + "integrity": "sha512-vqlC04+RQoFalODCbCumG2xIOvapzVMHwsyIGM/SIE8fRhFFsXeH8/QQ+s0T0kDAhKc4k30s73/0ydkHQz6HlQ==", + "license": "MIT", "dependencies": { - "call-bind": "^1.0.6", + "call-bind": "^1.0.7", "define-properties": "^1.2.1", "es-errors": "^1.3.0", - "set-function-name": "^2.0.1" + "set-function-name": "^2.0.2" }, "engines": { "node": ">= 0.4" @@ -3048,6 +3310,7 @@ "version": "3.3.2", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz", "integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==", + "license": "MIT", "dependencies": { "rc": "^1.1.6", "safe-buffer": "^5.0.1" @@ -3057,6 +3320,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", "integrity": "sha512-ZbgR5aZEdf4UKZVBPYIgaglBmSF2Hi94s2PcIHhRGFjKYu+chjJdYfHn4rt3hB6eCKLJ8giVIIfgMa1ehDfZKA==", + "license": "MIT", "dependencies": { "rc": "^1.0.1" }, @@ -3068,6 +3332,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3076,6 +3341,7 @@ "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "license": "MIT", "dependencies": { "is-core-module": "^2.13.0", "path-parse": "^1.0.7", @@ -3093,6 +3359,7 @@ "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" } @@ -3103,6 +3370,7 @@ "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==", "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.", "dev": true, + "license": "MIT", "dependencies": { "estree-walker": "^0.6.1", "magic-string": "^0.25.3", @@ -3114,6 +3382,7 @@ "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz", "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==", "dev": true, + "license": "MIT", "dependencies": { "rollup-plugin-inject": "^3.0.0" } @@ -3123,6 +3392,7 @@ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", "dev": true, + "license": "MIT", "dependencies": { "estree-walker": "^0.6.1" } @@ -3131,6 +3401,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "get-intrinsic": "^1.2.4", @@ -3147,12 +3418,14 @@ "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" }, "node_modules/safe-regex-test": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.6", "es-errors": "^1.3.0", @@ -3170,6 +3443,7 @@ "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", "dev": true, + "license": "MIT", "dependencies": { "@types/node-forge": "^1.3.0", "node-forge": "^1" @@ -3182,14 +3456,16 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", "bin": { "semver": "bin/semver" } }, "node_modules/serve": { - "version": "14.2.3", - "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.3.tgz", - "integrity": "sha512-VqUFMC7K3LDGeGnJM9h56D3XGKb6KGgOw0cVNtA26yYXHCcpxf3xwCTUaQoWlVS7i8Jdh3GjQkOB23qsXyjoyQ==", + "version": "14.2.4", + "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.4.tgz", + "integrity": "sha512-qy1S34PJ/fcY8gjVGszDB3EXiPSk5FKhUa7tQe0UPRddxRidc2V6cNHPNewbE1D7MAkgLuWEt3Vw56vYy73tzQ==", + "license": "MIT", "dependencies": { "@zeit/schemas": "2.36.0", "ajv": "8.12.0", @@ -3200,7 +3476,7 @@ "clipboardy": "3.0.0", "compression": "1.7.4", "is-port-reachable": "4.0.0", - "serve-handler": "6.1.5", + "serve-handler": "6.1.6", "update-check": "1.5.4" }, "bin": { @@ -3211,17 +3487,17 @@ } }, "node_modules/serve-handler": { - "version": "6.1.5", - "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.5.tgz", - "integrity": "sha512-ijPFle6Hwe8zfmBxJdE+5fta53fdIY0lHISJvuikXB3VYFafRjMRpOffSPvCYsbKyBA7pvy9oYr/BT1O3EArlg==", + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.6.tgz", + "integrity": "sha512-x5RL9Y2p5+Sh3D38Fh9i/iQ5ZK+e4xuXRd/pGbM4D13tgo/MGwbttUk8emytcr1YYzBYs+apnUngBDFYfpjPuQ==", + "license": "MIT", "dependencies": { "bytes": "3.0.0", "content-disposition": "0.5.2", - "fast-url-parser": "1.1.3", "mime-types": "2.1.18", "minimatch": "3.1.2", "path-is-inside": "1.0.2", - "path-to-regexp": "2.2.1", + "path-to-regexp": "3.3.0", "range-parser": "1.2.0" } }, @@ -3229,6 +3505,7 @@ "version": "1.33.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -3237,6 +3514,7 @@ "version": "2.1.18", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "license": "MIT", "dependencies": { "mime-db": "~1.33.0" }, @@ -3248,6 +3526,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==", + "license": "MIT", "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" }, @@ -3259,6 +3538,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -3275,6 +3555,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "license": "MIT", "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -3289,6 +3570,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "license": "MIT", "dependencies": { "shebang-regex": "^1.0.0" }, @@ -3300,6 +3582,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3308,6 +3591,7 @@ "version": "1.8.1", "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3316,6 +3600,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -3332,13 +3617,15 @@ "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "license": "ISC" }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -3348,12 +3635,14 @@ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", "deprecated": "Please use @jridgewell/sourcemap-codec instead", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "license": "Apache-2.0", "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" @@ -3362,26 +3651,30 @@ "node_modules/spdx-exceptions": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", - "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==" + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "license": "CC-BY-3.0" }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "license": "MIT", "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, "node_modules/spdx-license-ids": { - "version": "3.0.18", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.18.tgz", - "integrity": "sha512-xxRs31BqRYHwiMzudOrpSiHtZ8i/GeionCBDSilhYRj+9gIcI8wCZTlXZKu9vZIVqViP3dcp9qE5G6AlIaD+TQ==" + "version": "3.0.20", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.20.tgz", + "integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==", + "license": "CC0-1.0" }, "node_modules/split2": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", "engines": { "node": ">= 10.x" } @@ -3391,6 +3684,7 @@ "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz", "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==", "dev": true, + "license": "Unlicense", "dependencies": { "as-table": "^1.0.36", "get-source": "^2.0.12" @@ -3401,6 +3695,7 @@ "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", "dev": true, + "license": "MIT", "engines": { "node": ">=4", "npm": ">=6" @@ -3418,6 +3713,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -3434,6 +3730,7 @@ "version": "3.1.6", "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.6.tgz", "integrity": "sha512-XZpspuSB7vJWhvJc9DLSlrXl1mcA2BdoY5jjnS135ydXqLoqhs96JjDtCkjJEQHvfqZIp9hBuBMgI589peyx9Q==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -3451,6 +3748,7 @@ "version": "1.2.9", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -3468,6 +3766,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -3481,6 +3780,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -3497,6 +3797,7 @@ "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -3511,6 +3812,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "license": "MIT", "engines": { "node": ">=4" } @@ -3519,6 +3821,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "license": "MIT", "engines": { "node": ">=6" } @@ -3527,6 +3830,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -3536,23 +3840,33 @@ "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.3.1.tgz", "integrity": "sha512-/HWVyVoJEKCvvLOAt3ak2kEYI5+8eLPojXrUDtYvIEIzxdAqwtYd2epVPyFqIoFV+Q+xtbcoDVubQgUFUxHxfg==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "^18.16.3" } }, "node_modules/subtls/node_modules/@types/node": { - "version": "18.19.39", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.39.tgz", - "integrity": "sha512-nPwTRDKUctxw3di5b4TfT3I0sWDiWoPQCZjXhvdkINntwr8lcoVCKsTgnXeRubKIlfnV+eN/HYk6Jb40tbcEAQ==", + "version": "18.19.66", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.66.tgz", + "integrity": "sha512-14HmtUdGxFUalGRfLLn9Gc1oNWvWh5zNbsyOLo5JV6WARSeN1QcEBKRnZm9QqNfrutgsl/hY4eJW63aZ44aBCg==", "dev": true, + "license": "MIT", "dependencies": { "undici-types": "~5.26.4" } }, + "node_modules/subtls/node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "license": "MIT" + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", "dependencies": { "has-flag": "^3.0.0" }, @@ -3564,6 +3878,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -3575,28 +3890,18 @@ "resolved": "shims/tls", "link": true }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", - "dev": true + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" }, "node_modules/type-fest": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=12.20" }, @@ -3608,6 +3913,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "es-errors": "^1.3.0", @@ -3621,6 +3927,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "for-each": "^0.3.3", @@ -3636,16 +3943,18 @@ } }, "node_modules/typed-array-byte-offset": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", - "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.3.tgz", + "integrity": "sha512-GsvTyUHTriq6o/bHcTd0vM7OQ9JEdlvluu9YISaA7+KzDzPaIzEeDFNkTfhdE3MYcNhNi0vq/LlegYgIs5yPAw==", + "license": "MIT", "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13" + "is-typed-array": "^1.1.13", + "reflect.getprototypeof": "^1.0.6" }, "engines": { "node": ">= 0.4" @@ -3655,16 +3964,17 @@ } }, "node_modules/typed-array-length": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", - "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "for-each": "^0.3.3", "gopd": "^1.0.1", - "has-proto": "^1.0.3", "is-typed-array": "^1.1.13", - "possible-typed-array-names": "^1.0.0" + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" }, "engines": { "node": ">= 0.4" @@ -3674,10 +3984,11 @@ } }, "node_modules/typescript": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", - "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3687,15 +3998,17 @@ } }, "node_modules/ufo": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", - "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==", - "dev": true + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz", + "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==", + "dev": true, + "license": "MIT" }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "license": "MIT", "dependencies": { "call-bind": "^1.0.2", "has-bigints": "^1.0.2", @@ -3707,38 +4020,40 @@ } }, "node_modules/undici": { - "version": "6.19.2", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.2.tgz", - "integrity": "sha512-JfjKqIauur3Q6biAtHJ564e3bWa8VvT+7cSiOJHFbX4Erv6CLGDpg8z+Fmg/1OI/47RA+GI2QZaF48SSaLvyBA==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.0.tgz", + "integrity": "sha512-BUgJXc752Kou3oOIuU1i+yZZypyZRqNPW0vqoMPl8VaoalSfeR0D8/t4iAS3yirs79SSMTxTag+ZC86uswv+Cw==", + "license": "MIT", "engines": { "node": ">=18.17" } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true, + "license": "MIT" }, "node_modules/unenv": { "name": "unenv-nightly", - "version": "1.10.0-1717606461.a117952", - "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-1.10.0-1717606461.a117952.tgz", - "integrity": "sha512-u3TfBX02WzbHTpaEfWEKwDijDSFAHcgXkayUZ+MVDrjhLFvgAJzFGTSTmwlEhwWi2exyRQey23ah9wELMM6etg==", + "version": "2.0.0-20241111-080453-894aa31", + "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241111-080453-894aa31.tgz", + "integrity": "sha512-0W39QQOQ9VE8kVVUpGwEG+pZcsCXk5wqNG6rDPE6Gr+fiA69LR0qERM61hW5KCOkC1/ArCFrfCGjwHyyv/bI0Q==", "dev": true, + "license": "MIT", "dependencies": { - "consola": "^3.2.3", "defu": "^6.1.4", - "mime": "^3.0.0", - "node-fetch-native": "^1.6.4", + "ohash": "^1.1.4", "pathe": "^1.1.2", - "ufo": "^1.5.3" + "ufo": "^1.5.4" } }, "node_modules/update-check": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/update-check/-/update-check-1.5.4.tgz", "integrity": "sha512-5YHsflzHP4t1G+8WGPlvKbJEbAJGCgw+Em+dGR1KmBUbr1J36SJBqlHLjR7oob7sco5hWHGQVcr9B2poIVDDTQ==", + "license": "MIT", "dependencies": { "registry-auth-token": "3.3.2", "registry-url": "3.1.0" @@ -3748,18 +4063,11 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" } }, - "node_modules/uri-js/node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, "node_modules/url": { "resolved": "shims/url", "link": true @@ -3772,6 +4080,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "license": "Apache-2.0", "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" @@ -3781,6 +4090,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -3789,6 +4099,7 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -3800,6 +4111,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "license": "MIT", "dependencies": { "is-bigint": "^1.0.1", "is-boolean-object": "^1.1.0", @@ -3811,10 +4123,56 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-builtin-type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.0.tgz", + "integrity": "sha512-I+qLGQ/vucCby4tf5HsLmGueEla4ZhwTBSqaooS+Y0BuxN4Cp+okmGuV+8mXZ84KDI9BA+oklo+RzKg0ONdSUA==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.0.5", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.1.4", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.15" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "license": "MIT", + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-typed-array": { "version": "1.1.15", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "license": "MIT", "dependencies": { "available-typed-arrays": "^1.0.7", "call-bind": "^1.0.7", @@ -3833,6 +4191,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-4.0.1.tgz", "integrity": "sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==", + "license": "MIT", "dependencies": { "string-width": "^5.0.1" }, @@ -3844,11 +4203,12 @@ } }, "node_modules/workerd": { - "version": "1.20240620.1", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240620.1.tgz", - "integrity": "sha512-Qoq+RrFNk4pvEO+kpJVn8uJ5TRE9YJx5jX5pC5LjdKlw1XeD8EdXt5k0TbByvWunZ4qgYIcF9lnVxhcDFo203g==", + "version": "1.20241106.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241106.1.tgz", + "integrity": "sha512-1GdKl0kDw8rrirr/ThcK66Kbl4/jd4h8uHx5g7YHBrnenY5SX1UPuop2cnCzYUxlg55kPjzIqqYslz1muRFgFw==", "dev": true, "hasInstallScript": true, + "license": "Apache-2.0", "bin": { "workerd": "bin/workerd" }, @@ -3856,34 +4216,38 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20240620.1", - "@cloudflare/workerd-darwin-arm64": "1.20240620.1", - "@cloudflare/workerd-linux-64": "1.20240620.1", - "@cloudflare/workerd-linux-arm64": "1.20240620.1", - "@cloudflare/workerd-windows-64": "1.20240620.1" + "@cloudflare/workerd-darwin-64": "1.20241106.1", + "@cloudflare/workerd-darwin-arm64": "1.20241106.1", + "@cloudflare/workerd-linux-64": "1.20241106.1", + "@cloudflare/workerd-linux-arm64": "1.20241106.1", + "@cloudflare/workerd-windows-64": "1.20241106.1" } }, "node_modules/wrangler": { - "version": "3.62.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.62.0.tgz", - "integrity": "sha512-TM1Bd8+GzxFw/JzwsC3i/Oss4LTWvIEWXXo1vZhx+7PHcsxdbnQGBBwPurHNJDSu2Pw22+2pCZiUGKexmgJksw==", + "version": "3.90.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.90.0.tgz", + "integrity": "sha512-E/6E9ORAl987+3kP8wDiE3L1lj9r4vQ32/dl5toIxIkSMssmPRQVdxqwgMxbxJrytbFNo8Eo6swgjd4y4nUaLg==", "dev": true, + "license": "MIT OR Apache-2.0", "dependencies": { "@cloudflare/kv-asset-handler": "0.3.4", + "@cloudflare/workers-shared": "0.8.0", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@esbuild-plugins/node-modules-polyfill": "^0.2.2", "blake3-wasm": "^2.1.5", - "chokidar": "^3.5.3", - "date-fns": "^3.6.0", + "chokidar": "^4.0.1", + "date-fns": "^4.1.0", "esbuild": "0.17.19", - "miniflare": "3.20240620.0", + "itty-time": "^1.0.6", + "miniflare": "3.20241106.1", "nanoid": "^3.3.3", - "path-to-regexp": "^6.2.0", + "path-to-regexp": "^6.3.0", "resolve": "^1.22.8", "resolve.exports": "^2.0.2", "selfsigned": "^2.0.1", "source-map": "^0.6.1", - "unenv": "npm:unenv-nightly@1.10.0-1717606461.a117952", + "unenv": "npm:unenv-nightly@2.0.0-20241111-080453-894aa31", + "workerd": "1.20241106.1", "xxhash-wasm": "^1.0.1" }, "bin": { @@ -3897,7 +4261,7 @@ "fsevents": "~2.3.2" }, "peerDependencies": { - "@cloudflare/workers-types": "^4.20240620.0" + "@cloudflare/workers-types": "^4.20241106.0" }, "peerDependenciesMeta": { "@cloudflare/workers-types": { @@ -3913,6 +4277,7 @@ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -3929,6 +4294,7 @@ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -3945,6 +4311,7 @@ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -3961,6 +4328,7 @@ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -3977,6 +4345,7 @@ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -3993,6 +4362,7 @@ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -4009,6 +4379,7 @@ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -4025,6 +4396,7 @@ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4041,6 +4413,7 @@ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4057,6 +4430,7 @@ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4073,6 +4447,7 @@ "loong64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4089,6 +4464,7 @@ "mips64el" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4105,6 +4481,7 @@ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4121,6 +4498,7 @@ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4137,6 +4515,7 @@ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4153,6 +4532,7 @@ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -4169,6 +4549,7 @@ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "netbsd" @@ -4185,6 +4566,7 @@ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "openbsd" @@ -4201,6 +4583,7 @@ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "sunos" @@ -4217,6 +4600,7 @@ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -4233,6 +4617,7 @@ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -4249,6 +4634,7 @@ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -4263,6 +4649,7 @@ "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "esbuild": "bin/esbuild" }, @@ -4295,15 +4682,17 @@ } }, "node_modules/wrangler/node_modules/path-to-regexp": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", - "dev": true + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true, + "license": "MIT" }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "license": "MIT", "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", @@ -4320,6 +4709,7 @@ "version": "6.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -4328,9 +4718,10 @@ } }, "node_modules/ws": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", - "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "license": "MIT", "engines": { "node": ">=10.0.0" }, @@ -4351,23 +4742,26 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "license": "MIT", "engines": { "node": ">=0.4" } }, "node_modules/xxhash-wasm": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz", - "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A==", - "dev": true + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz", + "integrity": "sha512-147y/6YNh+tlp6nd/2pWq38i9h6mz/EuQ6njIrmW8D1BS5nCqs0P6DG+m6zTGnNz5I+uhZ0SHxBs9BsPrwcKDA==", + "dev": true, + "license": "MIT" }, "node_modules/youch": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.3.tgz", - "integrity": "sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.4.tgz", + "integrity": "sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==", "dev": true, + "license": "MIT", "dependencies": { - "cookie": "^0.5.0", + "cookie": "^0.7.1", "mustache": "^4.2.0", "stacktracey": "^2.1.8" } @@ -4377,6 +4771,7 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index 2714916..cda1bdb 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "path": "file:shims/path", "pg": "8.8.0", "pg-native": "file:shims/pg-native", - "prettier": "3.3.3", + "prettier": "^3.4.1", "serve": "^14.1.2", "stream": "file:shims/stream", "string_decoder": "file:shims/string_decoder", @@ -43,7 +43,7 @@ "launch": "DOTENV_CONFIG_PATH=.dev.vars node -r dotenv/config --no-warnings dist/node/index.mjs", "node": "npm run build && npm run launch", "nodeDebug": "npm run buildDebug && npm run launch", - "bun": "npm run build && bun dist/node/index.mjs", + "bun": "npm run build && DOTENV_CONFIG_PATH=.dev.vars bun -r dotenv/config dist/node/index.mjs", "cfDev": "npm run build && wrangler dev", "cfDeploy": "npm run build && wrangler deploy", "format": "prettier -c .", @@ -55,7 +55,7 @@ "@types/pg": "^8.6.5", "@types/ws": "^8.5.4", "dotenv": "^16.0.3", - "esbuild": "^0.21.1", + "esbuild": "^0.24.0", "fast-equals": "^5.0.1", "subtls": "^0.3.0", "typescript": "^5.0.4", From 69bf9e639b3027686feea6d4862f42f50ef9690b Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 26 Nov 2024 13:23:35 +0000 Subject: [PATCH 03/40] Added VSCode settings to use Prettier formatting (in line with npm run format) --- .vscode/settings.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..65a1965 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.defaultFormatter": "esbenp.prettier-vscode" +} From 61fc3d2be3cfda487838985f40cf007fbd0f061b Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 26 Nov 2024 13:37:41 +0000 Subject: [PATCH 04/40] Added vitest and test and types GitHub Actions --- .github/workflows/check-format.yml | 2 +- .github/workflows/check-types.yml | 16 + .github/workflows/run-tests.yml | 16 + export/index.ts | 2 - package-lock.json | 881 +++++++++++++++++++++++++++++ package.json | 4 +- tests/test.test.ts | 5 + 7 files changed, 922 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/check-types.yml create mode 100644 .github/workflows/run-tests.yml create mode 100644 tests/test.test.ts diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml index 3e9b8a6..620739b 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/check-format.yml @@ -1,4 +1,4 @@ -name: Check Code Formatting +name: Check code formatting on: pull_request: diff --git a/.github/workflows/check-types.yml b/.github/workflows/check-types.yml new file mode 100644 index 0000000..76959a9 --- /dev/null +++ b/.github/workflows/check-types.yml @@ -0,0 +1,16 @@ +name: Check TypeScript types + +on: + pull_request: + branches: + - main + +jobs: + checks-format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + + - run: bun install + - run: bun run check diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..a4037c7 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,16 @@ +name: Run tests + +on: + pull_request: + branches: + - main + +jobs: + checks-format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + + - run: bun install + - run: bun run test diff --git a/export/index.ts b/export/index.ts index 6cec68a..5614a32 100644 --- a/export/index.ts +++ b/export/index.ts @@ -325,7 +325,6 @@ class NeonPool extends Pool { try { const cp = new ConnectionParameters( - // @ts-expect-error -- TS doesn't know about this.options this.options, ) as ConnectionParameters; const euc = encodeURIComponent, @@ -341,7 +340,6 @@ class NeonPool extends Pool { }); sql(queryText, queryValues, { - // @ts-expect-error -- TS doesn't know about this.options types: config.types ?? this.options?.types, }) .then((result) => cb(undefined, result)) diff --git a/package-lock.json b/package-lock.json index fdc39f9..6a191e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,7 @@ "fast-equals": "^5.0.1", "subtls": "^0.3.0", "typescript": "^5.0.4", + "vitest": "^2.1.6", "wrangler": "^3.0.1" } }, @@ -658,6 +659,265 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.27.4.tgz", + "integrity": "sha512-2Y3JT6f5MrQkICUyRVCw4oa0sutfAsgaSsb0Lmmy1Wi2y7X5vT9Euqw4gOsCyy0YfKURBg35nhUKZS4mDcfULw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.27.4.tgz", + "integrity": "sha512-wzKRQXISyi9UdCVRqEd0H4cMpzvHYt1f/C3CoIjES6cG++RHKhrBj2+29nPF0IB5kpy9MS71vs07fvrNGAl/iA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.27.4.tgz", + "integrity": "sha512-PlNiRQapift4LNS8DPUHuDX/IdXiLjf8mc5vdEmUR0fF/pyy2qWwzdLjB+iZquGr8LuN4LnUoSEvKRwjSVYz3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.27.4.tgz", + "integrity": "sha512-o9bH2dbdgBDJaXWJCDTNDYa171ACUdzpxSZt+u/AAeQ20Nk5x+IhA+zsGmrQtpkLiumRJEYef68gcpn2ooXhSQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.27.4.tgz", + "integrity": "sha512-NBI2/i2hT9Q+HySSHTBh52da7isru4aAAo6qC3I7QFVsuhxi2gM8t/EI9EVcILiHLj1vfi+VGGPaLOUENn7pmw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.27.4.tgz", + "integrity": "sha512-wYcC5ycW2zvqtDYrE7deary2P2UFmSh85PUpAx+dwTCO9uw3sgzD6Gv9n5X4vLaQKsrfTSZZ7Z7uynQozPVvWA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.27.4.tgz", + "integrity": "sha512-9OwUnK/xKw6DyRlgx8UizeqRFOfi9mf5TYCw1uolDaJSbUmBxP85DE6T4ouCMoN6pXw8ZoTeZCSEfSaYo+/s1w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.27.4.tgz", + "integrity": "sha512-Vgdo4fpuphS9V24WOV+KwkCVJ72u7idTgQaBoLRD0UxBAWTF9GWurJO9YD9yh00BzbkhpeXtm6na+MvJU7Z73A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.27.4.tgz", + "integrity": "sha512-pleyNgyd1kkBkw2kOqlBx+0atfIIkkExOTiifoODo6qKDSpnc6WzUY5RhHdmTdIJXBdSnh6JknnYTtmQyobrVg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.27.4.tgz", + "integrity": "sha512-caluiUXvUuVyCHr5DxL8ohaaFFzPGmgmMvwmqAITMpV/Q+tPoaHZ/PWa3t8B2WyoRcIIuu1hkaW5KkeTDNSnMA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.27.4.tgz", + "integrity": "sha512-FScrpHrO60hARyHh7s1zHE97u0KlT/RECzCKAdmI+LEoC1eDh/RDji9JgFqyO+wPDb86Oa/sXkily1+oi4FzJQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.27.4.tgz", + "integrity": "sha512-qyyprhyGb7+RBfMPeww9FlHwKkCXdKHeGgSqmIXw9VSUtvyFZ6WZRtnxgbuz76FK7LyoN8t/eINRbPUcvXB5fw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.27.4.tgz", + "integrity": "sha512-PFz+y2kb6tbh7m3A7nA9++eInGcDVZUACulf/KzDtovvdTizHpZaJty7Gp0lFwSQcrnebHOqxF1MaKZd7psVRg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.27.4.tgz", + "integrity": "sha512-Ni8mMtfo+o/G7DVtweXXV/Ol2TFf63KYjTtoZ5f078AUgJTmaIJnj4JFU7TK/9SVWTaSJGxPi5zMDgK4w+Ez7Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.27.4.tgz", + "integrity": "sha512-5AeeAF1PB9TUzD+3cROzFTnAJAcVUGLuR8ng0E0WXGkYhp6RD6L+6szYVX+64Rs0r72019KHZS1ka1q+zU/wUw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.27.4.tgz", + "integrity": "sha512-yOpVsA4K5qVwu2CaS3hHxluWIK5HQTjNV4tWjQXluMiiiu4pJj4BN98CvxohNCpcjMeTXk/ZMJBRbgRg8HBB6A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.27.4.tgz", + "integrity": "sha512-KtwEJOaHAVJlxV92rNYiG9JQwQAdhBlrjNRp7P9L8Cb4Rer3in+0A+IPhJC9y68WAi9H0sX4AiG2NTsVlmqJeQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.27.4.tgz", + "integrity": "sha512-3j4jx1TppORdTAoBJRd+/wJRGCPC0ETWkXOecJ6PPZLj6SptXkrXcNqdj0oclbKML6FkQltdz7bBA3rUSirZug==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/events": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.3.tgz", @@ -707,6 +967,149 @@ "@types/node": "*" } }, + "node_modules/@vitest/expect": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.6.tgz", + "integrity": "sha512-9M1UR9CAmrhJOMoSwVnPh2rELPKhYo0m/CSgqw9PyStpxtkwhmdM6XYlXGKeYyERY1N6EIuzkQ7e3Lm1WKCoUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "2.1.6", + "@vitest/utils": "2.1.6", + "chai": "^5.1.2", + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.6.tgz", + "integrity": "sha512-MHZp2Z+Q/A3am5oD4WSH04f9B0T7UvwEb+v5W0kCYMhtXGYbdyl2NUk1wdSMqGthmhpiThPDp/hEoVwu16+u1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "2.1.6", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.12" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0 || ^6.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/mocker/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/@vitest/mocker/node_modules/magic-string": { + "version": "0.30.14", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", + "integrity": "sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/@vitest/pretty-format": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.6.tgz", + "integrity": "sha512-exZyLcEnHgDMKc54TtHca4McV4sKT+NKAe9ix/yhd/qkYb/TP8HTyXRFDijV19qKqTZM0hPL4753zU/U8L/gAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.6.tgz", + "integrity": "sha512-SjkRGSFyrA82m5nz7To4CkRSEVWn/rwQISHoia/DB8c6IHIhaE/UNAo+7UfeaeJRE979XceGl00LNkIz09RFsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "2.1.6", + "pathe": "^1.1.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.6.tgz", + "integrity": "sha512-5JTWHw8iS9l3v4/VSuthCndw1lN/hpPB+mlgn1BUhFbobeIUj1J1V/Bj2t2ovGEmkXLTckFjQddsxS5T6LuVWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "2.1.6", + "magic-string": "^0.30.12", + "pathe": "^1.1.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot/node_modules/magic-string": { + "version": "0.30.14", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", + "integrity": "sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/@vitest/spy": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.6.tgz", + "integrity": "sha512-oTFObV8bd4SDdRka5O+mSh5w9irgx5IetrD5i+OsUUsk/shsBoHifwCzy45SAORzAhtNiprUVaK3hSCCzZh1jQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^3.0.2" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.6.tgz", + "integrity": "sha512-ixNkFy3k4vokOUTU2blIUvOgKq/N2PW8vKIjZZYsGJCMX69MRa9J2sKqX5hY/k5O5Gty3YJChepkqZ3KM9LyIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "2.1.6", + "loupe": "^3.1.2", + "tinyrainbow": "^1.2.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, "node_modules/@zeit/schemas": { "version": "2.36.0", "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", @@ -920,6 +1323,16 @@ "resolved": "shims/assert", "link": true }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -1054,6 +1467,16 @@ "node": ">= 0.8" } }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/call-bind": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", @@ -1121,6 +1544,23 @@ "dev": true, "license": "MIT" }, + "node_modules/chai": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.1.2.tgz", + "integrity": "sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -1220,6 +1660,16 @@ "node": ">=8" } }, + "node_modules/check-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, "node_modules/chokidar": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", @@ -1433,6 +1883,16 @@ "ms": "2.0.0" } }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -1602,6 +2062,13 @@ "node": ">= 0.4" } }, + "node_modules/es-module-lexer": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", + "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", @@ -1805,6 +2272,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/expect-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.1.0.tgz", + "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -2546,6 +3023,13 @@ "node": ">=4" } }, + "node_modules/loupe": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.2.tgz", + "integrity": "sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==", + "dev": true, + "license": "MIT" + }, "node_modules/magic-string": { "version": "0.25.9", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", @@ -2951,6 +3435,16 @@ "dev": true, "license": "MIT" }, + "node_modules/pathval": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, "node_modules/pg": { "version": "8.8.0", "resolved": "https://registry.npmjs.org/pg/-/pg-8.8.0.tgz", @@ -3104,6 +3598,13 @@ "split2": "^4.1.0" } }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, "node_modules/pidtree": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", @@ -3134,6 +3635,35 @@ "node": ">= 0.4" } }, + "node_modules/postcss": { + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, "node_modules/postgres-array": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz", @@ -3364,6 +3894,44 @@ "node": ">=10" } }, + "node_modules/rollup": { + "version": "4.27.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.27.4.tgz", + "integrity": "sha512-RLKxqHEMjh/RGLsDxAEsaLO3mWgyoU6x9w6n1ikAzet4B3gI2/3yP6PWY2p9QzRTh6MfEIXB3MwsOY0Iv3vNrw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.6" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.27.4", + "@rollup/rollup-android-arm64": "4.27.4", + "@rollup/rollup-darwin-arm64": "4.27.4", + "@rollup/rollup-darwin-x64": "4.27.4", + "@rollup/rollup-freebsd-arm64": "4.27.4", + "@rollup/rollup-freebsd-x64": "4.27.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.27.4", + "@rollup/rollup-linux-arm-musleabihf": "4.27.4", + "@rollup/rollup-linux-arm64-gnu": "4.27.4", + "@rollup/rollup-linux-arm64-musl": "4.27.4", + "@rollup/rollup-linux-powerpc64le-gnu": "4.27.4", + "@rollup/rollup-linux-riscv64-gnu": "4.27.4", + "@rollup/rollup-linux-s390x-gnu": "4.27.4", + "@rollup/rollup-linux-x64-gnu": "4.27.4", + "@rollup/rollup-linux-x64-musl": "4.27.4", + "@rollup/rollup-win32-arm64-msvc": "4.27.4", + "@rollup/rollup-win32-ia32-msvc": "4.27.4", + "@rollup/rollup-win32-x64-msvc": "4.27.4", + "fsevents": "~2.3.2" + } + }, "node_modules/rollup-plugin-inject": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz", @@ -3614,6 +4182,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -3630,6 +4205,16 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/sourcemap-codec": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", @@ -3679,6 +4264,13 @@ "node": ">= 10.x" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, "node_modules/stacktracey": { "version": "2.1.8", "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz", @@ -3690,6 +4282,13 @@ "get-source": "^2.0.12" } }, + "node_modules/std-env": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", + "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", + "dev": true, + "license": "MIT" + }, "node_modules/stoppable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", @@ -3886,6 +4485,50 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.1.tgz", + "integrity": "sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinypool": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.2.tgz", + "integrity": "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-1.2.0.tgz", + "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", + "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/tls": { "resolved": "shims/tls", "link": true @@ -4095,6 +4738,227 @@ "node": ">= 0.8" } }, + "node_modules/vite": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.0.tgz", + "integrity": "sha512-Q2+5yQV79EdnpbNxjD3/QHVMCBaQ3Kpd4/uL51UGuh38bIIM+s4o3FqyCzRvTRwFb+cWIUeZvaWwS9y2LD2qeQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.24.0", + "postcss": "^8.4.49", + "rollup": "^4.23.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.6.tgz", + "integrity": "sha512-DBfJY0n9JUwnyLxPSSUmEePT21j8JZp/sR9n+/gBwQU6DcQOioPdb8/pibWfXForbirSagZCilseYIwaL3f95A==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.3.7", + "es-module-lexer": "^1.5.4", + "pathe": "^1.1.2", + "vite": "^5.0.0 || ^6.0.0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite-node/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/vite-node/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/vitest": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.6.tgz", + "integrity": "sha512-isUCkvPL30J4c5O5hgONeFRsDmlw6kzFEdLQHLezmDdKQHy8Ke/B/dgdTMEgU0vm+iZ0TjW8GuK83DiahBoKWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "2.1.6", + "@vitest/mocker": "2.1.6", + "@vitest/pretty-format": "^2.1.6", + "@vitest/runner": "2.1.6", + "@vitest/snapshot": "2.1.6", + "@vitest/spy": "2.1.6", + "@vitest/utils": "2.1.6", + "chai": "^5.1.2", + "debug": "^4.3.7", + "expect-type": "^1.1.0", + "magic-string": "^0.30.12", + "pathe": "^1.1.2", + "std-env": "^3.8.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.1", + "tinypool": "^1.0.1", + "tinyrainbow": "^1.2.0", + "vite": "^5.0.0 || ^6.0.0", + "vite-node": "2.1.6", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "2.1.6", + "@vitest/ui": "2.1.6", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/magic-string": { + "version": "0.30.14", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", + "integrity": "sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/vitest/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, "node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -4187,6 +5051,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/widest-line": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-4.0.1.tgz", diff --git a/package.json b/package.json index cda1bdb..e30d2be 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "cfDev": "npm run build && wrangler dev", "cfDeploy": "npm run build && wrangler deploy", "format": "prettier -c .", - "format:fix": "prettier -w ." + "format:fix": "prettier -w .", + "test": "vitest run" }, "devDependencies": { "@cloudflare/workers-types": "^4.20230115.0", @@ -59,6 +60,7 @@ "fast-equals": "^5.0.1", "subtls": "^0.3.0", "typescript": "^5.0.4", + "vitest": "^2.1.6", "wrangler": "^3.0.1" } } diff --git a/tests/test.test.ts b/tests/test.test.ts new file mode 100644 index 0000000..44ed59e --- /dev/null +++ b/tests/test.test.ts @@ -0,0 +1,5 @@ +import { expect, test } from 'vitest'; + +test('adds 1 + 2 to equal 3', () => { + expect(1 + 2).toBe(3); +}); From f2717e8e495c8a0794aaa398726c7156c09d6444 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 26 Nov 2024 13:41:40 +0000 Subject: [PATCH 05/40] Fixed prettier issue --- export/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/export/index.ts b/export/index.ts index 5614a32..ea9ea98 100644 --- a/export/index.ts +++ b/export/index.ts @@ -324,9 +324,7 @@ class NeonPool extends Pool { cb = response.callback; try { - const cp = new ConnectionParameters( - this.options, - ) as ConnectionParameters; + const cp = new ConnectionParameters(this.options) as ConnectionParameters; const euc = encodeURIComponent, eu = encodeURI; const connectionString = `postgresql://${euc(cp.user)}:${euc(cp.password)}@${euc(cp.host)}/${eu(cp.database)}`; From 92574f363a2a82f54b3da851eaabe498c38af7ed Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 26 Nov 2024 13:44:46 +0000 Subject: [PATCH 06/40] Rename GitHub actions --- .github/workflows/check-format.yml | 2 +- .github/workflows/check-types.yml | 2 +- .github/workflows/run-tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml index 620739b..e1669b8 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/check-format.yml @@ -6,7 +6,7 @@ on: - main jobs: - checks-format: + check-format: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/check-types.yml b/.github/workflows/check-types.yml index 76959a9..f6485d9 100644 --- a/.github/workflows/check-types.yml +++ b/.github/workflows/check-types.yml @@ -6,7 +6,7 @@ on: - main jobs: - checks-format: + check-types: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a4037c7..e0fbdc8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -6,7 +6,7 @@ on: - main jobs: - checks-format: + run-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From c9a1fed2aef9fcd06275d92c778eeb3a4cb4eab9 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Fri, 6 Dec 2024 15:14:07 +0000 Subject: [PATCH 07/40] Updated README to address #108 --- README.md | 70 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index e361b09..5da601c 100644 --- a/README.md +++ b/README.md @@ -196,22 +196,25 @@ export default async (req: Request, ctx: any) => { // create a `Pool` inside the request handler const pool = new Pool({ connectionString: process.env.DATABASE_URL }); - // get and validate the `postId` query parameter - const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); - if (isNaN(postId)) return new Response('Bad request', { status: 400 }); - - // query and validate the post - const [post] = await pool.query('SELECT * FROM posts WHERE id = $1', [postId]); - if (!post) return new Response('Not found', { status: 404 }); - - // end the `Pool` inside the same request handler - // (unlike `await`, `ctx.waitUntil` won't hold up the response) - ctx.waitUntil(pool.end()); - - // return the post as JSON - return new Response(JSON.stringify(post), { - headers: { 'content-type': 'application/json' } - }); + try { + // get and validate the `postId` query parameter + const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); + if (isNaN(postId)) return new Response('Bad request', { status: 400 }); + + // query and validate the post + const { rows: [post] } = await pool.query('SELECT * FROM posts WHERE id = $1', [postId]); + if (!post) return new Response('Not found', { status: 404 }); + + // return the post as JSON + return new Response(JSON.stringify(post), { + headers: { 'content-type': 'application/json' } + }); + + } finally { + // end the `Pool` inside the same request handler + // (unlike `await`, `ctx.waitUntil` won't hold up the response) + ctx.waitUntil(pool.end()); + } } export const config = { @@ -236,22 +239,25 @@ export default async (req: Request, ctx: any) => { const client = new Client(process.env.DATABASE_URL); await client.connect(); - // get and validate the `postId` query parameter - const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); - if (isNaN(postId)) return new Response('Bad request', { status: 400 }); - - // query and validate the post - const [post] = await client.query('SELECT * FROM posts WHERE id = $1', [postId]); - if (!post) return new Response('Not found', { status: 404 }); - - // end the `Client` inside the same request handler - // (unlike `await`, `ctx.waitUntil` won't hold up the response) - ctx.waitUntil(client.end()); - - // return the post as JSON - return new Response(JSON.stringify(post), { - headers: { 'content-type': 'application/json' } - }); + try { + // get and validate the `postId` query parameter + const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); + if (isNaN(postId)) return new Response('Bad request', { status: 400 }); + + // query and validate the post + const { rows: [post] } = await client.query('SELECT * FROM posts WHERE id = $1', [postId]); + if (!post) return new Response('Not found', { status: 404 }); + + // return the post as JSON + return new Response(JSON.stringify(post), { + headers: { 'content-type': 'application/json' } + }); + + } finally { + // end the `Client` inside the same request handler + // (unlike `await`, `ctx.waitUntil` won't hold up the response) + ctx.waitUntil(client.end()); + } } export const config = { From c5d6ee7e8316be6917cef535eefd4b9da59d6ed0 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 10 Dec 2024 15:19:46 +0000 Subject: [PATCH 08/40] Refactored workflows --- .github/workflows/check-format.yml | 16 ---------------- .github/workflows/check-types.yml | 16 ---------------- .github/workflows/lint.yml | 19 +++++++++++++++++++ .github/workflows/prepare.yml | 14 ++++++++++++++ .github/workflows/{run-tests.yml => test.yml} | 7 +++---- 5 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/check-format.yml delete mode 100644 .github/workflows/check-types.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/prepare.yml rename .github/workflows/{run-tests.yml => test.yml} (50%) diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml deleted file mode 100644 index e1669b8..0000000 --- a/.github/workflows/check-format.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Check code formatting - -on: - pull_request: - branches: - - main - -jobs: - check-format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 - - - run: bun install - - run: bun run format diff --git a/.github/workflows/check-types.yml b/.github/workflows/check-types.yml deleted file mode 100644 index f6485d9..0000000 --- a/.github/workflows/check-types.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Check TypeScript types - -on: - pull_request: - branches: - - main - -jobs: - check-types: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 - - - run: bun install - - run: bun run check diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..404084c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,19 @@ +name: Lint + +on: + pull_request: + branches: + - main + +jobs: + check-format: + runs-on: ubuntu-latest + steps: + - uses: ./.github/workflows/prepare.yml + + - name: Check TypeScript types + run: bun run check + + - name: Check code formatting + run: bun run format + diff --git a/.github/workflows/prepare.yml b/.github/workflows/prepare.yml new file mode 100644 index 0000000..09c7ffb --- /dev/null +++ b/.github/workflows/prepare.yml @@ -0,0 +1,14 @@ +name: Prepare + +on: + workflow_call + +jobs: + prepare-ci-jobs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + + - name: Install package dependencies + run: bun install diff --git a/.github/workflows/run-tests.yml b/.github/workflows/test.yml similarity index 50% rename from .github/workflows/run-tests.yml rename to .github/workflows/test.yml index e0fbdc8..1e10cb0 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/test.yml @@ -9,8 +9,7 @@ jobs: run-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 + - uses: ./.github/workflows/prepare.yml - - run: bun install - - run: bun run test + - name: Run tests + run: bun run test From 77c5c0ad5453f6ce907f83b901cdc53e1365e1ff Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 10 Dec 2024 15:54:40 +0000 Subject: [PATCH 09/40] Update workflows --- .github/workflows/lint.yml | 8 +++++--- .github/workflows/test.yml | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 404084c..877a4bf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,11 +6,13 @@ on: - main jobs: - check-format: + prepare: + uses: ./.github/workflows/prepare.yml + + lint: + needs: prepare runs-on: ubuntu-latest steps: - - uses: ./.github/workflows/prepare.yml - - name: Check TypeScript types run: bun run check diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e10cb0..cb803b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,10 +6,12 @@ on: - main jobs: - run-tests: + prepare: + uses: ./.github/workflows/prepare.yml + + test: + needs: prepare runs-on: ubuntu-latest steps: - - uses: ./.github/workflows/prepare.yml - - name: Run tests run: bun run test From 24497ff00e5ad631ebe6f560a5979809aa91a1fa Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 10 Dec 2024 16:18:20 +0000 Subject: [PATCH 10/40] Fix workflows --- .github/workflows/lint.yml | 12 ++++++++---- .github/workflows/prepare.yml | 14 -------------- .github/workflows/test.yml | 14 +++++++++----- 3 files changed, 17 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/prepare.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 877a4bf..d269450 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,13 +6,17 @@ on: - main jobs: - prepare: - uses: ./.github/workflows/prepare.yml - lint: - needs: prepare runs-on: ubuntu-latest steps: + # setup + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + + - name: Install package dependencies + run: bun install + + # goal - name: Check TypeScript types run: bun run check diff --git a/.github/workflows/prepare.yml b/.github/workflows/prepare.yml deleted file mode 100644 index 09c7ffb..0000000 --- a/.github/workflows/prepare.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Prepare - -on: - workflow_call - -jobs: - prepare-ci-jobs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 - - - name: Install package dependencies - run: bun install diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb803b6..2cf54ae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Run tests +name: Test on: pull_request: @@ -6,12 +6,16 @@ on: - main jobs: - prepare: - uses: ./.github/workflows/prepare.yml - test: - needs: prepare runs-on: ubuntu-latest steps: + # setup + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + + - name: Install package dependencies + run: bun install + + # goal - name: Run tests run: bun run test From 344fdf0e00f537a759f9d3d9d11d4fedf58f1166 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 10 Dec 2024 16:19:38 +0000 Subject: [PATCH 11/40] Fixed format --- .github/workflows/lint.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d269450..50d5535 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,4 +22,3 @@ jobs: - name: Check code formatting run: bun run format - From dd0e7004a346755ce7d4626a0f204271b14cb8e0 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 12 Dec 2024 12:24:55 +0000 Subject: [PATCH 12/40] Added transaction() tests --- .gitignore | 3 +- tests/batch.test.ts | 151 ++++++++++++++++++++++++++++++++++++++++++++ tests/test.test.ts | 5 -- 3 files changed, 153 insertions(+), 6 deletions(-) create mode 100644 tests/batch.test.ts delete mode 100644 tests/test.test.ts diff --git a/.gitignore b/.gitignore index 05d3425..6d4cfbc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .dev.vars -.env.local +.env.* node_modules tmp +.DS_Store diff --git a/tests/batch.test.ts b/tests/batch.test.ts new file mode 100644 index 0000000..6617d44 --- /dev/null +++ b/tests/batch.test.ts @@ -0,0 +1,151 @@ +import { expect, test } from 'vitest'; +import { neon } from '../export' + +const DB_URL = process.env.VITE_NEON_DB_URL!; +const sql = neon(DB_URL); + +test('basic batch query with array of sql', async () => { + const [[a], [b]] = await sql.transaction([ + sql`SELECT ${1}::int AS "batchInt"`, + sql`SELECT ${'hello'} AS "batchStr"`, + ]); + expect(a.batchInt).toBe(1); + expect(b.batchStr).toBe('hello'); +}); + +test('basic batch query with function', async () => { + const [[a], [b]] = await sql.transaction((txn) => [ + txn`SELECT ${2}::int AS "batchInt"`, + txn`SELECT ${'goodbye'} AS "batchStr"`, + ]); + expect(a.batchInt).toBe(2); + expect(b.batchStr).toBe('goodbye'); +}); + +test('empty batch query with function', async () => { + const emptyResult = await sql.transaction(() => []); + expect(emptyResult).toHaveLength(0); +}); + +test('empty batch query with array', async () => { + const emptyResult = await sql.transaction([]); + expect(emptyResult).toHaveLength(0); +}); + +test('option setting on `transaction()`', async () => { + const [[[a]], [[b]]] = await sql.transaction( + (txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ], + { arrayMode: true, isolationLevel: 'Serializable', readOnly: true }, // arrayMode changes result format destructured above + ); + expect(a).toBe(1); + expect(b).toBe('hello'); +}); + +test('option setting on `neon()`', async () => { + const sqlArr = neon(DB_URL, { + arrayMode: true, // arrayMode changes result format destructured below + isolationLevel: 'RepeatableRead', + }); + const [[[a]], [[b]]] = await sqlArr.transaction((txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ]); + expect(a).toBe(1); + expect(b).toBe('hello'); +}); + +test('option setting on `transaction()` overrides option setting on `neon()`', async () => { + const sqlArr = neon(DB_URL, { arrayMode: true }); + const [[a], [b]] = await sqlArr.transaction( + (txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ], + { arrayMode: false }, + ); + expect(a.batchInt).toBe(1); + expect(b.batchStr).toBe('hello'); +}); + +test('option setting on individual queries within a batch', async () => { + const [[a], [b]] = await sql.transaction((txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn('SELECT $1 AS "batchStr"', ['hello'], { arrayMode: true }), + ]); + expect(a.batchInt).toBe(1); + expect(b[0]).toBe('hello'); +}); + +test('invalid queries passed to `transaction()` in function', async () => { + await expect( + // @ts-expect-error + sql.transaction((txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + `SELECT ${'hello'} AS "batchStr"`, // <- oops, this is a bare string + ]) + ) + .rejects.toThrowError('transaction() expects an array of queries, or a function returning an array of queries'); +}); + +test('`transaction()` using database URL with wrong user', async () => { + const urlWithBadHost = DB_URL.replace('//', '//x'); + const sqlBad = neon(urlWithBadHost); + await expect( + sqlBad.transaction((txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ]) + ) + .rejects.toThrowError('password authentication failed for user'); +}); + +test('`transaction()` using database URL with wrong password', async () => { + const urlWithBadPassword = DB_URL.replace('@', 'x@'); + const sqlBad = neon(urlWithBadPassword); + await expect( + sqlBad.transaction((txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ]) + ) + .rejects.toThrowError('password authentication failed for user'); +}); + +test('`transaction()` using database URL with wrong project', async () => { + const urlWithBadHost = DB_URL.replace('@', '@x'); + const sqlBad = neon(urlWithBadHost); + await expect( + sqlBad.transaction((txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ]) + ) + .rejects.toThrowError('password authentication failed for user'); +}); + +test('`transaction()` using database URL with wrong host', async () => { + const urlWithBadHost = DB_URL.replace('.neon.tech', '.neon.bxgpsmb.tech'); + const sqlBad = neon(urlWithBadHost); + await expect( + sqlBad.transaction((txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ]) + ) + .rejects.toThrowError('Error connecting to database: fetch failed'); +}); + +test('undefined database URL to `neon()`', async () => { + expect(() => neon(undefined as unknown as string)).toThrowError('No database connection string was provided'); +}); + +test('empty database URL to `neon()`', async () => { + expect(() => neon('')).toThrowError('No database connection string was provided'); +}); + +test('wrong-scheme database URL to `neon()`', async () => { + expect(() => neon(DB_URL.replace(/^/, 'x'))).toThrowError('Database connection string format for `neon()` should be'); +}); diff --git a/tests/test.test.ts b/tests/test.test.ts deleted file mode 100644 index 44ed59e..0000000 --- a/tests/test.test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expect, test } from 'vitest'; - -test('adds 1 + 2 to equal 3', () => { - expect(1 + 2).toBe(3); -}); From 201a86043aed2eed147ff19258862456b2bf559b Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 12 Dec 2024 15:57:16 +0000 Subject: [PATCH 13/40] Added http tests --- tests/http.test.ts | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/http.test.ts diff --git a/tests/http.test.ts b/tests/http.test.ts new file mode 100644 index 0000000..f9f2af3 --- /dev/null +++ b/tests/http.test.ts @@ -0,0 +1,72 @@ +import { expect, test } from 'vitest'; +import { neon, Pool } from '../export' + +const DB_URL = process.env.VITE_NEON_DB_URL!; +const pool = new Pool({ connectionString: DB_URL }); + +test('tagged-template http query results match WebSocket query results', { timeout: 30000 }, async () => { + + // check that http and WebSocket responses match across a range of queries, + // subject to the following known differences: + // * http results are plain Objects, not Result instances + // * http results lack `oid` and `RowCtor` fields (which are both usually `null`) + + const client = await pool.connect(); + const sql = neon(DB_URL, { fullResults: true }); + const now = new Date(); + + async function compare(queryPromise: ReturnType) { + const { query, params } = queryPromise.parameterizedQuery; + const [httpResult, wsResult] = await Promise.all([ + queryPromise, + client.query(query, params), + ]); + const httpResultWithNullExtras = { ...httpResult, oid: null, RowCtor: null }; + const wsResultAsRawObject = { ...wsResult }; + expect(httpResultWithNullExtras).toMatchObject(wsResultAsRawObject); + } + + await compare(sql`SELECT ${1} AS int_uncast`); + await compare(sql`SELECT ${1}::int AS int`); + await compare(sql`SELECT ${1}::int8 AS int8num`); + await compare(sql`SELECT ${1}::decimal AS decimalnum`); + await compare(sql`SELECT ${'[1,4)'}::int4range AS int4range`); + await compare(sql`SELECT ${'hello'} AS str`); + await compare(sql`SELECT ${['a', 'b', 'c']} AS arrstr_uncast`); + await compare(sql`SELECT ${[[2], [4]]}::int[][] AS arrnumnested`); + await compare(sql`SELECT ${now}::timestamptz AS timestamptznow`); + await compare(sql`SELECT ${'16:17:18+01:00'}::timetz AS timetz`); + await compare(sql`SELECT ${'17:18:19'}::time AS time`); + await compare(sql`SELECT ${now}::date AS datenow`); + await compare(sql`SELECT ${{ x: 'y' }} AS obj_uncast`); + await compare(sql`SELECT ${'11:22:33:44:55:66'}::macaddr AS macaddr`); + await compare(sql`SELECT ${'\\xDEADBEEF'}::bytea AS bytea`); + await compare(sql`SELECT ${'(2, 3)'}::point AS point`); + await compare(sql`SELECT ${'<(2, 3), 1>'}::circle AS circle`); + await compare(sql`SELECT ${'10.10.10.0/24'}::cidr AS cidr`); + await compare(sql`SELECT ${true} AS bool_uncast`); + await compare(sql`SELECT ${'hello'} || ' ' || ${'world'} AS greeting`); + await compare(sql`SELECT ${[1, 2, 3]}::int[] AS arrnum`); + await compare(sql`SELECT ${['a', 'b', 'c']}::text[] AS arrstr`); + await compare(sql`SELECT ${{ x: 'y' }}::jsonb AS jsonb_obj`); + await compare(sql`SELECT ${{ x: 'y' }}::json AS json_obj`); + await compare(sql`SELECT ${['11:22:33:44:55:66']}::macaddr[] AS arrmacaddr`); + await compare(sql`SELECT ${['10.10.10.0/24']}::cidr[] AS arrcidr`); + await compare(sql`SELECT ${true}::boolean AS bool`); + await compare(sql`SELECT ${[now]}::timestamptz[] AS arrtstz`); + await compare(sql`SELECT ${['(2, 3)']}::point[] AS arrpoint`); + await compare(sql`SELECT ${['<(2, 3), 1>']}::circle[] AS arrcircle`); + await compare(sql`SELECT ${['\\xDEADBEEF', '\\xDEADBEEF']}::bytea[] AS arrbytea`); + await compare(sql`SELECT null AS null`); + await compare(sql`SELECT ${null} AS null`); + await compare(sql`SELECT ${'NULL'} AS null_str`); + await compare(sql`SELECT ${[1, 2, 3]} AS arrnum_uncast`); + await compare(sql`SELECT ${[[2], [4]]} AS arrnumnested_uncast`); + await compare(sql`SELECT ${now} AS timenow_uncast`); + await compare(sql`SELECT ${now}::timestamp AS timestampnow`); + await compare(sql`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`); + await compare(sql`SELECT ${Buffer.from([65, 66, 67])} AS bytea`); + + client.release(); +}); + From 08b8abbd255123e409682e3d78d1bd902fa99355 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 12 Dec 2024 16:05:26 +0000 Subject: [PATCH 14/40] Non-tagged template http queries added to tests --- tests/http.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/http.test.ts b/tests/http.test.ts index f9f2af3..37eca61 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -67,6 +67,12 @@ test('tagged-template http query results match WebSocket query results', { timeo await compare(sql`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`); await compare(sql`SELECT ${Buffer.from([65, 66, 67])} AS bytea`); + // non-template usage + await compare(sql('SELECT $1::timestamp AS timestampnow', [now])); + await compare(sql("SELECT $1 || ' ' || $2 AS greeting", ['hello', 'world'])); + await compare(sql('SELECT 123 AS num')); + await compare(sql('SELECT 123 AS num', [])); + client.release(); }); From e9f1420d0450859899db87d46d0bd5f1aa80df1f Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 12 Dec 2024 22:16:08 +0000 Subject: [PATCH 15/40] More tests, and reporting connection errors toString() instead of message --- export/httpQuery.ts | 2 +- tests/batch.test.ts | 61 ++------------- tests/http.test.ts | 179 +++++++++++++++++++++++++++++++------------- 3 files changed, 136 insertions(+), 106 deletions(-) diff --git a/export/httpQuery.ts b/export/httpQuery.ts index 2464439..e8c1465 100644 --- a/export/httpQuery.ts +++ b/export/httpQuery.ts @@ -333,7 +333,7 @@ export function neon( }); } catch (err: any) { const connectErr = new NeonDbError( - `Error connecting to database: ${err.message}`, + `Error connecting to database: ${err}`, ); connectErr.sourceError = err; throw connectErr; diff --git a/tests/batch.test.ts b/tests/batch.test.ts index 6617d44..930da65 100644 --- a/tests/batch.test.ts +++ b/tests/batch.test.ts @@ -90,62 +90,13 @@ test('invalid queries passed to `transaction()` in function', async () => { .rejects.toThrowError('transaction() expects an array of queries, or a function returning an array of queries'); }); -test('`transaction()` using database URL with wrong user', async () => { - const urlWithBadHost = DB_URL.replace('//', '//x'); - const sqlBad = neon(urlWithBadHost); +test('invalid queries passed to `transaction()` in array', async () => { await expect( - sqlBad.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${'hello'} AS "batchStr"`, - ]) - ) - .rejects.toThrowError('password authentication failed for user'); -}); - -test('`transaction()` using database URL with wrong password', async () => { - const urlWithBadPassword = DB_URL.replace('@', 'x@'); - const sqlBad = neon(urlWithBadPassword); - await expect( - sqlBad.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${'hello'} AS "batchStr"`, - ]) - ) - .rejects.toThrowError('password authentication failed for user'); -}); - -test('`transaction()` using database URL with wrong project', async () => { - const urlWithBadHost = DB_URL.replace('@', '@x'); - const sqlBad = neon(urlWithBadHost); - await expect( - sqlBad.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${'hello'} AS "batchStr"`, - ]) - ) - .rejects.toThrowError('password authentication failed for user'); -}); - -test('`transaction()` using database URL with wrong host', async () => { - const urlWithBadHost = DB_URL.replace('.neon.tech', '.neon.bxgpsmb.tech'); - const sqlBad = neon(urlWithBadHost); - await expect( - sqlBad.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${'hello'} AS "batchStr"`, + sql.transaction([ + sql`SELECT ${1}::int AS "batchInt"`, + // @ts-expect-error + `SELECT ${'hello'} AS "batchStr"`, // <- oops, this is a bare string ]) ) - .rejects.toThrowError('Error connecting to database: fetch failed'); -}); - -test('undefined database URL to `neon()`', async () => { - expect(() => neon(undefined as unknown as string)).toThrowError('No database connection string was provided'); -}); - -test('empty database URL to `neon()`', async () => { - expect(() => neon('')).toThrowError('No database connection string was provided'); -}); - -test('wrong-scheme database URL to `neon()`', async () => { - expect(() => neon(DB_URL.replace(/^/, 'x'))).toThrowError('Database connection string format for `neon()` should be'); + .rejects.toThrowError('transaction() expects an array of queries, or a function returning an array of queries'); }); diff --git a/tests/http.test.ts b/tests/http.test.ts index 37eca61..d8f5fcc 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -2,20 +2,21 @@ import { expect, test } from 'vitest'; import { neon, Pool } from '../export' const DB_URL = process.env.VITE_NEON_DB_URL!; +const sql = neon(DB_URL); +const sqlfr = neon(DB_URL, { fullResults: true }); const pool = new Pool({ connectionString: DB_URL }); -test('tagged-template http query results match WebSocket query results', { timeout: 30000 }, async () => { - +test('http query results match WebSocket query results', { timeout: 30000 }, async () => { + // check that http and WebSocket responses match across a range of queries, // subject to the following known differences: // * http results are plain Objects, not Result instances // * http results lack `oid` and `RowCtor` fields (which are both usually `null`) - + const client = await pool.connect(); - const sql = neon(DB_URL, { fullResults: true }); const now = new Date(); - async function compare(queryPromise: ReturnType) { + async function compare(queryPromise: ReturnType) { const { query, params } = queryPromise.parameterizedQuery; const [httpResult, wsResult] = await Promise.all([ queryPromise, @@ -25,54 +26,132 @@ test('tagged-template http query results match WebSocket query results', { timeo const wsResultAsRawObject = { ...wsResult }; expect(httpResultWithNullExtras).toMatchObject(wsResultAsRawObject); } - - await compare(sql`SELECT ${1} AS int_uncast`); - await compare(sql`SELECT ${1}::int AS int`); - await compare(sql`SELECT ${1}::int8 AS int8num`); - await compare(sql`SELECT ${1}::decimal AS decimalnum`); - await compare(sql`SELECT ${'[1,4)'}::int4range AS int4range`); - await compare(sql`SELECT ${'hello'} AS str`); - await compare(sql`SELECT ${['a', 'b', 'c']} AS arrstr_uncast`); - await compare(sql`SELECT ${[[2], [4]]}::int[][] AS arrnumnested`); - await compare(sql`SELECT ${now}::timestamptz AS timestamptznow`); - await compare(sql`SELECT ${'16:17:18+01:00'}::timetz AS timetz`); - await compare(sql`SELECT ${'17:18:19'}::time AS time`); - await compare(sql`SELECT ${now}::date AS datenow`); - await compare(sql`SELECT ${{ x: 'y' }} AS obj_uncast`); - await compare(sql`SELECT ${'11:22:33:44:55:66'}::macaddr AS macaddr`); - await compare(sql`SELECT ${'\\xDEADBEEF'}::bytea AS bytea`); - await compare(sql`SELECT ${'(2, 3)'}::point AS point`); - await compare(sql`SELECT ${'<(2, 3), 1>'}::circle AS circle`); - await compare(sql`SELECT ${'10.10.10.0/24'}::cidr AS cidr`); - await compare(sql`SELECT ${true} AS bool_uncast`); - await compare(sql`SELECT ${'hello'} || ' ' || ${'world'} AS greeting`); - await compare(sql`SELECT ${[1, 2, 3]}::int[] AS arrnum`); - await compare(sql`SELECT ${['a', 'b', 'c']}::text[] AS arrstr`); - await compare(sql`SELECT ${{ x: 'y' }}::jsonb AS jsonb_obj`); - await compare(sql`SELECT ${{ x: 'y' }}::json AS json_obj`); - await compare(sql`SELECT ${['11:22:33:44:55:66']}::macaddr[] AS arrmacaddr`); - await compare(sql`SELECT ${['10.10.10.0/24']}::cidr[] AS arrcidr`); - await compare(sql`SELECT ${true}::boolean AS bool`); - await compare(sql`SELECT ${[now]}::timestamptz[] AS arrtstz`); - await compare(sql`SELECT ${['(2, 3)']}::point[] AS arrpoint`); - await compare(sql`SELECT ${['<(2, 3), 1>']}::circle[] AS arrcircle`); - await compare(sql`SELECT ${['\\xDEADBEEF', '\\xDEADBEEF']}::bytea[] AS arrbytea`); - await compare(sql`SELECT null AS null`); - await compare(sql`SELECT ${null} AS null`); - await compare(sql`SELECT ${'NULL'} AS null_str`); - await compare(sql`SELECT ${[1, 2, 3]} AS arrnum_uncast`); - await compare(sql`SELECT ${[[2], [4]]} AS arrnumnested_uncast`); - await compare(sql`SELECT ${now} AS timenow_uncast`); - await compare(sql`SELECT ${now}::timestamp AS timestampnow`); - await compare(sql`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`); - await compare(sql`SELECT ${Buffer.from([65, 66, 67])} AS bytea`); + + await compare(sqlfr`SELECT ${1} AS int_uncast`); + await compare(sqlfr`SELECT ${1}::int AS int`); + await compare(sqlfr`SELECT ${1}::int8 AS int8num`); + await compare(sqlfr`SELECT ${1}::decimal AS decimalnum`); + await compare(sqlfr`SELECT ${2n} AS bigint`); + await compare(sqlfr`SELECT ${9007199254740993n} AS bigint`); + await compare(sqlfr`SELECT ${Math.PI} AS pi`); + await compare(sqlfr`SELECT ${Math.PI}::real AS pi`); + await compare(sqlfr`SELECT ${Math.PI}::double precision AS pi`); + await compare(sqlfr`SELECT ${'[1,4)'}::int4range AS int4range`); + await compare(sqlfr`SELECT ${'hello'} AS str`); + await compare(sqlfr`SELECT ${['a', 'b', 'c']} AS arrstr_uncast`); + await compare(sqlfr`SELECT ${[[2], [4]]}::int[][] AS arrnumnested`); + await compare(sqlfr`SELECT ${now}::timestamptz AS timestamptznow`); + await compare(sqlfr`SELECT ${'16:17:18+01:00'}::timetz AS timetz`); + await compare(sqlfr`SELECT ${'17:18:19'}::time AS time`); + await compare(sqlfr`SELECT ${now}::date AS datenow`); + await compare(sqlfr`SELECT ${{ x: 'y' }} AS obj_uncast`); + await compare(sqlfr`SELECT ${'11:22:33:44:55:66'}::macaddr AS macaddr`); + await compare(sqlfr`SELECT ${'\\xDEADBEEF'}::bytea AS bytea`); + await compare(sqlfr`SELECT ${'(2, 3)'}::point AS point`); + await compare(sqlfr`SELECT ${'<(2, 3), 1>'}::circle AS circle`); + await compare(sqlfr`SELECT ${'10.10.10.0/24'}::cidr AS cidr`); + await compare(sqlfr`SELECT ${true} AS bool_uncast`); + await compare(sqlfr`SELECT ${'hello'} || ' ' || ${'world'} AS greeting`); + await compare(sqlfr`SELECT ${[1, 2, 3]}::int[] AS arrnum`); + await compare(sqlfr`SELECT ${['a', 'b', 'c']}::text[] AS arrstr`); + await compare(sqlfr`SELECT ${{ x: 'y' }}::jsonb AS jsonb_obj`); + await compare(sqlfr`SELECT ${{ x: 'y' }}::json AS json_obj`); + await compare(sqlfr`SELECT ${['11:22:33:44:55:66']}::macaddr[] AS arrmacaddr`); + await compare(sqlfr`SELECT ${['10.10.10.0/24']}::cidr[] AS arrcidr`); + await compare(sqlfr`SELECT ${true}::boolean AS bool`); + await compare(sqlfr`SELECT ${[now]}::timestamptz[] AS arrtstz`); + await compare(sqlfr`SELECT ${['(2, 3)']}::point[] AS arrpoint`); + await compare(sqlfr`SELECT ${['<(2, 3), 1>']}::circle[] AS arrcircle`); + await compare(sqlfr`SELECT ${['\\xDEADBEEF', '\\xDEADBEEF']}::bytea[] AS arrbytea`); + await compare(sqlfr`SELECT null AS null`); + await compare(sqlfr`SELECT ${null} AS null`); + await compare(sqlfr`SELECT ${'NULL'} AS null_str`); + await compare(sqlfr`SELECT ${[1, 2, 3]} AS arrnum_uncast`); + await compare(sqlfr`SELECT ${[[2], [4]]} AS arrnumnested_uncast`); + await compare(sqlfr`SELECT ${now} AS timenow_uncast`); + await compare(sqlfr`SELECT ${now}::timestamp AS timestampnow`); + await compare(sqlfr`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`); + await compare(sqlfr`SELECT ${Buffer.from([65, 66, 67])} AS bytea`); // non-template usage - await compare(sql('SELECT $1::timestamp AS timestampnow', [now])); - await compare(sql("SELECT $1 || ' ' || $2 AS greeting", ['hello', 'world'])); - await compare(sql('SELECT 123 AS num')); - await compare(sql('SELECT 123 AS num', [])); + await compare(sqlfr('SELECT $1::timestamp AS timestampnow', [now])); + await compare(sqlfr("SELECT $1 || ' ' || $2 AS greeting", ['hello', 'world'])); + await compare(sqlfr('SELECT 123 AS num')); + await compare(sqlfr('SELECT 123 AS num', [])); client.release(); }); +test('http queries with too few or too many parameters', async () => { + await expect(sql('SELECT $1', [])) + .rejects.toThrowError('bind message supplies 0 parameters'); + + await expect(sql('SELECT $1', [1, 2])) + .rejects.toThrowError('bind message supplies 2 parameters'); +}); + +test('timeout aborting an http query', { timeout: 5000 }, async () => { + const abortController = new AbortController(); + const { signal } = abortController; + setTimeout(() => abortController.abort('fetch timed out'), 250); + + await expect( + sql('SELECT pg_sleep(2)', [], { fetchOptions: { signal } }) + ).rejects.toThrow('fetch timed out'); +}); + +test('timeout not aborting an http query', { timeout: 5000 }, async () => { + const abortController = new AbortController(); + const { signal } = abortController; + const timeout = setTimeout(() => abortController.abort('fetch timed out'), 2000); + + await expect( + sql('SELECT pg_sleep(.5)', [], { fetchOptions: { signal } }) + ).resolves; + + clearTimeout(timeout); +}); + +test('database URL with wrong user to `neon()`', async () => { + const urlWithBadHost = DB_URL.replace('//', '//x'); + const sqlBad = neon(urlWithBadHost); + await expect(sqlBad`SELECT ${1}::int AS one`) + .rejects.toThrowError('password authentication failed'); +}); + +test('database URL with wrong password to `neon()`', async () => { + const urlWithBadPassword = DB_URL.replace('@', 'x@'); + const sqlBad = neon(urlWithBadPassword); + await expect(sqlBad`SELECT ${1}::int AS one`) + .rejects.toThrowError('password authentication failed'); +}); + +test('database URL with wrong project to `neon()`', async () => { + const urlWithBadHost = DB_URL.replace('@', '@x'); + const sqlBad = neon(urlWithBadHost); + await expect(sqlBad`SELECT ${1}::int AS one`) + .rejects.toThrowError('password authentication failed'); +}); + +test('database URL with wrong host to `neon()`', { timeout: 10000 }, async () => { + const urlWithBadHost = DB_URL.replace('.neon.tech', '.neon.techh'); + const sqlBad = neon(urlWithBadHost); + await expect(sqlBad`SELECT ${1}::int AS one`) + .rejects.toThrowError('fetch failed'); +}); + +test('undefined database URL', async () => { + expect(() => neon(undefined as unknown as string)) + .toThrowError('No database connection string was provided'); +}); + +test('empty database URL to `neon()`', async () => { + expect(() => neon('')) + .toThrowError('No database connection string was provided'); +}); + +test('wrong-scheme database URL to `neon()`', async () => { + expect(() => neon(DB_URL.replace(/^/, 'x'))) + .toThrowError('Database connection string format for `neon()` should be'); +}); + From 0646eafeab47a03152977a6574941cae2da32fe8 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Fri, 13 Dec 2024 10:06:17 +0000 Subject: [PATCH 16/40] More tests --- tests/http.test.ts | 83 +++++++++++++----- ...{batch.test.ts => httpTransaction.test.ts} | 0 tests/ws.test.ts | 84 +++++++++++++++++++ 3 files changed, 145 insertions(+), 22 deletions(-) rename tests/{batch.test.ts => httpTransaction.test.ts} (100%) create mode 100644 tests/ws.test.ts diff --git a/tests/http.test.ts b/tests/http.test.ts index d8f5fcc..d7d0e32 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -1,5 +1,5 @@ -import { expect, test } from 'vitest'; -import { neon, Pool } from '../export' +import { expect, test, vi } from 'vitest'; +import { neon, neonConfig, Pool } from '../export' const DB_URL = process.env.VITE_NEON_DB_URL!; const sql = neon(DB_URL); @@ -7,12 +7,9 @@ const sqlfr = neon(DB_URL, { fullResults: true }); const pool = new Pool({ connectionString: DB_URL }); test('http query results match WebSocket query results', { timeout: 30000 }, async () => { - // check that http and WebSocket responses match across a range of queries, - // subject to the following known differences: - // * http results are plain Objects, not Result instances - // * http results lack `oid` and `RowCtor` fields (which are both usually `null`) - + // subject to some known differences + const client = await pool.connect(); const now = new Date(); @@ -22,15 +19,22 @@ test('http query results match WebSocket query results', { timeout: 30000 }, asy queryPromise, client.query(query, params), ]); - const httpResultWithNullExtras = { ...httpResult, oid: null, RowCtor: null }; - const wsResultAsRawObject = { ...wsResult }; - expect(httpResultWithNullExtras).toMatchObject(wsResultAsRawObject); + + // * http results are plain Objects, not Result instances + // * http results lack `oid` and `RowCtor` fields (which are both usually `null`) + const httpResultProcessed = { ...httpResult, oid: null, RowCtor: null }; + + // * http result `fields` array contains plain Objects, not Field instances + // * http results have `"viaNeonFetch": true` + const wsResultProcessed = { ...wsResult, fields: wsResult.fields.map(f => ({ ...f })), viaNeonFetch: true }; + + expect(httpResultProcessed).toStrictEqual(wsResultProcessed); } await compare(sqlfr`SELECT ${1} AS int_uncast`); - await compare(sqlfr`SELECT ${1}::int AS int`); + await compare(sqlfr`SELECT ${-1}::int AS int`); await compare(sqlfr`SELECT ${1}::int8 AS int8num`); - await compare(sqlfr`SELECT ${1}::decimal AS decimalnum`); + await compare(sqlfr`SELECT ${-1}::decimal AS decimalnum`); await compare(sqlfr`SELECT ${2n} AS bigint`); await compare(sqlfr`SELECT ${9007199254740993n} AS bigint`); await compare(sqlfr`SELECT ${Math.PI} AS pi`); @@ -56,6 +60,7 @@ test('http query results match WebSocket query results', { timeout: 30000 }, asy await compare(sqlfr`SELECT ${['a', 'b', 'c']}::text[] AS arrstr`); await compare(sqlfr`SELECT ${{ x: 'y' }}::jsonb AS jsonb_obj`); await compare(sqlfr`SELECT ${{ x: 'y' }}::json AS json_obj`); + await compare(sqlfr`SELECT ${{ x: 'y' }} AS json_obj_uncast`); await compare(sqlfr`SELECT ${['11:22:33:44:55:66']}::macaddr[] AS arrmacaddr`); await compare(sqlfr`SELECT ${['10.10.10.0/24']}::cidr[] AS arrcidr`); await compare(sqlfr`SELECT ${true}::boolean AS bool`); @@ -71,6 +76,7 @@ test('http query results match WebSocket query results', { timeout: 30000 }, asy await compare(sqlfr`SELECT ${now} AS timenow_uncast`); await compare(sqlfr`SELECT ${now}::timestamp AS timestampnow`); await compare(sqlfr`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`); + await compare(sqlfr`SELECT ${new Uint8Array(65536).fill(128)} AS bytea`); await compare(sqlfr`SELECT ${Buffer.from([65, 66, 67])} AS bytea`); // non-template usage @@ -82,12 +88,45 @@ test('http query results match WebSocket query results', { timeout: 30000 }, asy client.release(); }); +test('custom fetch', async () => { + const fn = vi.fn(); + neonConfig.fetchFunction = (url: string, options: any) => { + fn(url); + return fetch(url, options); + }; + await expect(sql`SELECT ${'customFetch'} AS str`).resolves.toMatchObject([{ str: 'customFetch' }]); + expect(fn).toHaveBeenCalledOnce(); +}); + +test('errors match WebSocket query errors', async () => { + const q = 'SELECT 123 WHERE x'; + + await Promise.all([ + expect(sql(q)).rejects.toThrowError('column "x" does not exist'), + expect(pool.query(q)).rejects.toThrowError('column "x" does not exist'), + ]); + + // now compare all other properties (`code`, `routine`, `severity`, etc.) + const [httpErr, wsErr] = await Promise.all([ + new Promise(resolve => sql(q).catch((e: Error) => resolve(e))), + new Promise(resolve => pool.query(q).catch((e: Error) => resolve(e))), + ]) as [any, any]; + + // account for known/accepted differences + httpErr.length = wsErr.length; // http errors don't have a `length` property + httpErr.name = wsErr.name; // http errors are named 'NeonDbError' rather than plain 'error' + wsErr.sourceError = undefined; // this property is unique to http errors + + // convert the errors into ordinary Objects, because vitest compares Errors only by message + expect({ ...httpErr }).toStrictEqual({ ...wsErr }); +}); + test('http queries with too few or too many parameters', async () => { await expect(sql('SELECT $1', [])) - .rejects.toThrowError('bind message supplies 0 parameters'); + .rejects.toThrowError('bind message supplies 0 parameters'); await expect(sql('SELECT $1', [1, 2])) - .rejects.toThrowError('bind message supplies 2 parameters'); + .rejects.toThrowError('bind message supplies 2 parameters'); }); test('timeout aborting an http query', { timeout: 5000 }, async () => { @@ -107,7 +146,7 @@ test('timeout not aborting an http query', { timeout: 5000 }, async () => { await expect( sql('SELECT pg_sleep(.5)', [], { fetchOptions: { signal } }) - ).resolves; + ).resolves.toStrictEqual([{ pg_sleep: '' }]); clearTimeout(timeout); }); @@ -116,42 +155,42 @@ test('database URL with wrong user to `neon()`', async () => { const urlWithBadHost = DB_URL.replace('//', '//x'); const sqlBad = neon(urlWithBadHost); await expect(sqlBad`SELECT ${1}::int AS one`) - .rejects.toThrowError('password authentication failed'); + .rejects.toThrowError('password authentication failed'); }); test('database URL with wrong password to `neon()`', async () => { const urlWithBadPassword = DB_URL.replace('@', 'x@'); const sqlBad = neon(urlWithBadPassword); await expect(sqlBad`SELECT ${1}::int AS one`) - .rejects.toThrowError('password authentication failed'); + .rejects.toThrowError('password authentication failed'); }); test('database URL with wrong project to `neon()`', async () => { const urlWithBadHost = DB_URL.replace('@', '@x'); const sqlBad = neon(urlWithBadHost); await expect(sqlBad`SELECT ${1}::int AS one`) - .rejects.toThrowError('password authentication failed'); + .rejects.toThrowError('password authentication failed'); }); test('database URL with wrong host to `neon()`', { timeout: 10000 }, async () => { const urlWithBadHost = DB_URL.replace('.neon.tech', '.neon.techh'); const sqlBad = neon(urlWithBadHost); await expect(sqlBad`SELECT ${1}::int AS one`) - .rejects.toThrowError('fetch failed'); + .rejects.toThrowError('fetch failed'); }); test('undefined database URL', async () => { expect(() => neon(undefined as unknown as string)) - .toThrowError('No database connection string was provided'); + .toThrowError('No database connection string was provided'); }); test('empty database URL to `neon()`', async () => { expect(() => neon('')) - .toThrowError('No database connection string was provided'); + .toThrowError('No database connection string was provided'); }); test('wrong-scheme database URL to `neon()`', async () => { expect(() => neon(DB_URL.replace(/^/, 'x'))) - .toThrowError('Database connection string format for `neon()` should be'); + .toThrowError('Database connection string format for `neon()` should be'); }); diff --git a/tests/batch.test.ts b/tests/httpTransaction.test.ts similarity index 100% rename from tests/batch.test.ts rename to tests/httpTransaction.test.ts diff --git a/tests/ws.test.ts b/tests/ws.test.ts new file mode 100644 index 0000000..b09dda2 --- /dev/null +++ b/tests/ws.test.ts @@ -0,0 +1,84 @@ +import { expect, test } from 'vitest'; +import { neon, Pool as WsPool } from '../export'; +import { Pool as PgPool } from 'pg'; + +const DB_URL = process.env.VITE_NEON_DB_URL!; + +const sql = neon(DB_URL); +const wsPool = new WsPool({ connectionString: DB_URL }); +const pgPool = new PgPool({ connectionString: DB_URL }); + +test('WebSockets query results match pg/TCP query results', { timeout: 30000 }, async () => { + + // check that http and WebSocket responses match across a range of queries + + const wsClient = await wsPool.connect(); + const pgClient = await pgPool.connect(); + const now = new Date(); + + async function compare(queryPromise: ReturnType) { + const { query, params } = queryPromise.parameterizedQuery; + const [wsResult, pgResult] = await Promise.all([ + wsClient.query(query, params), + pgClient.query(query, params), + ]); + expect(wsResult).toMatchObject(pgResult); + } + + await compare(sql`SELECT ${1} AS int_uncast`); + await compare(sql`SELECT ${-1}::int AS int`); + await compare(sql`SELECT ${1}::int8 AS int8num`); + await compare(sql`SELECT ${-1}::decimal AS decimalnum`); + await compare(sql`SELECT ${2n} AS bigint`); + await compare(sql`SELECT ${9007199254740993n} AS bigint`); + await compare(sql`SELECT ${Math.PI} AS pi`); + await compare(sql`SELECT ${Math.PI}::real AS pi`); + await compare(sql`SELECT ${Math.PI}::double precision AS pi`); + await compare(sql`SELECT ${'[1,4)'}::int4range AS int4range`); + await compare(sql`SELECT ${'hello'} AS str`); + await compare(sql`SELECT ${['a', 'b', 'c']} AS arrstr_uncast`); + await compare(sql`SELECT ${[[2], [4]]}::int[][] AS arrnumnested`); + await compare(sql`SELECT ${now}::timestamptz AS timestamptznow`); + await compare(sql`SELECT ${'16:17:18+01:00'}::timetz AS timetz`); + await compare(sql`SELECT ${'17:18:19'}::time AS time`); + await compare(sql`SELECT ${now}::date AS datenow`); + await compare(sql`SELECT ${{ x: 'y' }} AS obj_uncast`); + await compare(sql`SELECT ${'11:22:33:44:55:66'}::macaddr AS macaddr`); + await compare(sql`SELECT ${'\\xDEADBEEF'}::bytea AS bytea`); + await compare(sql`SELECT ${'(2, 3)'}::point AS point`); + await compare(sql`SELECT ${'<(2, 3), 1>'}::circle AS circle`); + await compare(sql`SELECT ${'10.10.10.0/24'}::cidr AS cidr`); + await compare(sql`SELECT ${true} AS bool_uncast`); + await compare(sql`SELECT ${'hello'} || ' ' || ${'world'} AS greeting`); + await compare(sql`SELECT ${[1, 2, 3]}::int[] AS arrnum`); + await compare(sql`SELECT ${['a', 'b', 'c']}::text[] AS arrstr`); + await compare(sql`SELECT ${{ x: 'y' }}::jsonb AS jsonb_obj`); + await compare(sql`SELECT ${{ x: 'y' }}::json AS json_obj`); + await compare(sql`SELECT ${{ x: 'y' }} AS json_obj_uncast`); + await compare(sql`SELECT ${['11:22:33:44:55:66']}::macaddr[] AS arrmacaddr`); + await compare(sql`SELECT ${['10.10.10.0/24']}::cidr[] AS arrcidr`); + await compare(sql`SELECT ${true}::boolean AS bool`); + await compare(sql`SELECT ${[now]}::timestamptz[] AS arrtstz`); + await compare(sql`SELECT ${['(2, 3)']}::point[] AS arrpoint`); + await compare(sql`SELECT ${['<(2, 3), 1>']}::circle[] AS arrcircle`); + await compare(sql`SELECT ${['\\xDEADBEEF', '\\xDEADBEEF']}::bytea[] AS arrbytea`); + await compare(sql`SELECT null AS null`); + await compare(sql`SELECT ${null} AS null`); + await compare(sql`SELECT ${'NULL'} AS null_str`); + await compare(sql`SELECT ${[1, 2, 3]} AS arrnum_uncast`); + await compare(sql`SELECT ${[[2], [4]]} AS arrnumnested_uncast`); + await compare(sql`SELECT ${now} AS timenow_uncast`); + await compare(sql`SELECT ${now}::timestamp AS timestampnow`); + await compare(sql`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`); + await compare(sql`SELECT ${new Uint8Array(65536).fill(128)} AS bytea`); + await compare(sql`SELECT ${Buffer.from([65, 66, 67])} AS bytea`); + + // non-template usage + await compare(sql('SELECT $1::timestamp AS timestampnow', [now])); + await compare(sql("SELECT $1 || ' ' || $2 AS greeting", ['hello', 'world'])); + await compare(sql('SELECT 123 AS num')); + await compare(sql('SELECT 123 AS num', [])); + + wsClient.release(); + pgClient.release(); +}); From cbf65f941a8a0e2c7a3f7ce93bfb7b5a93c2b1d7 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Fri, 13 Dec 2024 18:13:03 +0000 Subject: [PATCH 17/40] Refactored sample select queries into one place --- tests/http.test.ts | 68 ++++-------------------------------------- tests/sampleSelects.ts | 59 ++++++++++++++++++++++++++++++++++++ tests/ws.test.ts | 63 ++------------------------------------ 3 files changed, 68 insertions(+), 122 deletions(-) create mode 100644 tests/sampleSelects.ts diff --git a/tests/http.test.ts b/tests/http.test.ts index d7d0e32..e854501 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -1,90 +1,34 @@ import { expect, test, vi } from 'vitest'; import { neon, neonConfig, Pool } from '../export' +import { sampleSelects } from './sampleSelects'; const DB_URL = process.env.VITE_NEON_DB_URL!; const sql = neon(DB_URL); -const sqlfr = neon(DB_URL, { fullResults: true }); +const sqlFull = neon(DB_URL, { fullResults: true }); const pool = new Pool({ connectionString: DB_URL }); test('http query results match WebSocket query results', { timeout: 30000 }, async () => { - // check that http and WebSocket responses match across a range of queries, - // subject to some known differences - const client = await pool.connect(); - const now = new Date(); - async function compare(queryPromise: ReturnType) { + for (const queryPromise of sampleSelects(sqlFull)) { const { query, params } = queryPromise.parameterizedQuery; const [httpResult, wsResult] = await Promise.all([ queryPromise, client.query(query, params), ]); + // account for known/accepted differences: // * http results are plain Objects, not Result instances // * http results lack `oid` and `RowCtor` fields (which are both usually `null`) - const httpResultProcessed = { ...httpResult, oid: null, RowCtor: null }; - // * http result `fields` array contains plain Objects, not Field instances // * http results have `"viaNeonFetch": true` + + const httpResultProcessed = { ...httpResult, oid: null, RowCtor: null }; const wsResultProcessed = { ...wsResult, fields: wsResult.fields.map(f => ({ ...f })), viaNeonFetch: true }; expect(httpResultProcessed).toStrictEqual(wsResultProcessed); } - await compare(sqlfr`SELECT ${1} AS int_uncast`); - await compare(sqlfr`SELECT ${-1}::int AS int`); - await compare(sqlfr`SELECT ${1}::int8 AS int8num`); - await compare(sqlfr`SELECT ${-1}::decimal AS decimalnum`); - await compare(sqlfr`SELECT ${2n} AS bigint`); - await compare(sqlfr`SELECT ${9007199254740993n} AS bigint`); - await compare(sqlfr`SELECT ${Math.PI} AS pi`); - await compare(sqlfr`SELECT ${Math.PI}::real AS pi`); - await compare(sqlfr`SELECT ${Math.PI}::double precision AS pi`); - await compare(sqlfr`SELECT ${'[1,4)'}::int4range AS int4range`); - await compare(sqlfr`SELECT ${'hello'} AS str`); - await compare(sqlfr`SELECT ${['a', 'b', 'c']} AS arrstr_uncast`); - await compare(sqlfr`SELECT ${[[2], [4]]}::int[][] AS arrnumnested`); - await compare(sqlfr`SELECT ${now}::timestamptz AS timestamptznow`); - await compare(sqlfr`SELECT ${'16:17:18+01:00'}::timetz AS timetz`); - await compare(sqlfr`SELECT ${'17:18:19'}::time AS time`); - await compare(sqlfr`SELECT ${now}::date AS datenow`); - await compare(sqlfr`SELECT ${{ x: 'y' }} AS obj_uncast`); - await compare(sqlfr`SELECT ${'11:22:33:44:55:66'}::macaddr AS macaddr`); - await compare(sqlfr`SELECT ${'\\xDEADBEEF'}::bytea AS bytea`); - await compare(sqlfr`SELECT ${'(2, 3)'}::point AS point`); - await compare(sqlfr`SELECT ${'<(2, 3), 1>'}::circle AS circle`); - await compare(sqlfr`SELECT ${'10.10.10.0/24'}::cidr AS cidr`); - await compare(sqlfr`SELECT ${true} AS bool_uncast`); - await compare(sqlfr`SELECT ${'hello'} || ' ' || ${'world'} AS greeting`); - await compare(sqlfr`SELECT ${[1, 2, 3]}::int[] AS arrnum`); - await compare(sqlfr`SELECT ${['a', 'b', 'c']}::text[] AS arrstr`); - await compare(sqlfr`SELECT ${{ x: 'y' }}::jsonb AS jsonb_obj`); - await compare(sqlfr`SELECT ${{ x: 'y' }}::json AS json_obj`); - await compare(sqlfr`SELECT ${{ x: 'y' }} AS json_obj_uncast`); - await compare(sqlfr`SELECT ${['11:22:33:44:55:66']}::macaddr[] AS arrmacaddr`); - await compare(sqlfr`SELECT ${['10.10.10.0/24']}::cidr[] AS arrcidr`); - await compare(sqlfr`SELECT ${true}::boolean AS bool`); - await compare(sqlfr`SELECT ${[now]}::timestamptz[] AS arrtstz`); - await compare(sqlfr`SELECT ${['(2, 3)']}::point[] AS arrpoint`); - await compare(sqlfr`SELECT ${['<(2, 3), 1>']}::circle[] AS arrcircle`); - await compare(sqlfr`SELECT ${['\\xDEADBEEF', '\\xDEADBEEF']}::bytea[] AS arrbytea`); - await compare(sqlfr`SELECT null AS null`); - await compare(sqlfr`SELECT ${null} AS null`); - await compare(sqlfr`SELECT ${'NULL'} AS null_str`); - await compare(sqlfr`SELECT ${[1, 2, 3]} AS arrnum_uncast`); - await compare(sqlfr`SELECT ${[[2], [4]]} AS arrnumnested_uncast`); - await compare(sqlfr`SELECT ${now} AS timenow_uncast`); - await compare(sqlfr`SELECT ${now}::timestamp AS timestampnow`); - await compare(sqlfr`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`); - await compare(sqlfr`SELECT ${new Uint8Array(65536).fill(128)} AS bytea`); - await compare(sqlfr`SELECT ${Buffer.from([65, 66, 67])} AS bytea`); - - // non-template usage - await compare(sqlfr('SELECT $1::timestamp AS timestampnow', [now])); - await compare(sqlfr("SELECT $1 || ' ' || $2 AS greeting", ['hello', 'world'])); - await compare(sqlfr('SELECT 123 AS num')); - await compare(sqlfr('SELECT 123 AS num', [])); - client.release(); }); diff --git a/tests/sampleSelects.ts b/tests/sampleSelects.ts new file mode 100644 index 0000000..30a239c --- /dev/null +++ b/tests/sampleSelects.ts @@ -0,0 +1,59 @@ +import type { neon } from '../export'; + +const now = new Date(); +export const sampleSelects = (sql: ReturnType) => [ + // tagged-template + sql`SELECT ${1} AS int_uncast`, + sql`SELECT ${-1}::int AS int`, + sql`SELECT ${1}::int8 AS int8num`, + sql`SELECT ${-1}::decimal AS decimalnum`, + sql`SELECT ${2n} AS bigint`, + sql`SELECT ${9007199254740993n} AS bigint`, + sql`SELECT ${Math.PI} AS pi`, + sql`SELECT ${Math.PI}::real AS pi`, + sql`SELECT ${Math.PI}::double precision AS pi`, + sql`SELECT ${'[1,4)'}::int4range AS int4range`, + sql`SELECT ${'hello'} AS str`, + sql`SELECT ${['a', 'b', 'c']} AS arrstr_uncast`, + sql`SELECT ${[[2], [4]]}::int[][] AS arrnumnested`, + sql`SELECT ${now}::timestamptz AS timestamptznow`, + sql`SELECT ${'16:17:18+01:00'}::timetz AS timetz`, + sql`SELECT ${'17:18:19'}::time AS time`, + sql`SELECT ${now}::date AS datenow`, + sql`SELECT ${{ x: 'y' }} AS obj_uncast`, + sql`SELECT ${'11:22:33:44:55:66'}::macaddr AS macaddr`, + sql`SELECT ${'\\xDEADBEEF'}::bytea AS bytea`, + sql`SELECT ${'(2, 3)'}::point AS point`, + sql`SELECT ${'<(2, 3), 1>'}::circle AS circle`, + sql`SELECT ${'10.10.10.0/24'}::cidr AS cidr`, + sql`SELECT ${true} AS bool_uncast`, + sql`SELECT ${'hello'} || ' ' || ${'world'} AS greeting`, + sql`SELECT ${[1, 2, 3]}::int[] AS arrnum`, + sql`SELECT ${['a', 'b', 'c']}::text[] AS arrstr`, + sql`SELECT ${{ x: 'y' }}::jsonb AS jsonb_obj`, + sql`SELECT ${{ x: 'y' }}::json AS json_obj`, + sql`SELECT ${{ x: 'y' }} AS json_obj_uncast`, + sql`SELECT ${['11:22:33:44:55:66']}::macaddr[] AS arrmacaddr`, + sql`SELECT ${['10.10.10.0/24']}::cidr[] AS arrcidr`, + sql`SELECT ${true}::boolean AS bool`, + sql`SELECT ${[now]}::timestamptz[] AS arrtstz`, + sql`SELECT ${['(2, 3)']}::point[] AS arrpoint`, + sql`SELECT ${['<(2, 3), 1>']}::circle[] AS arrcircle`, + sql`SELECT ${['\\xDEADBEEF', '\\xDEADBEEF']}::bytea[] AS arrbytea`, + sql`SELECT null AS null`, + sql`SELECT ${null} AS null`, + sql`SELECT ${'NULL'} AS null_str`, + sql`SELECT ${[1, 2, 3]} AS arrnum_uncast`, + sql`SELECT ${[[2], [4]]} AS arrnumnested_uncast`, + sql`SELECT ${now} AS timenow_uncast`, + sql`SELECT ${now}::timestamp AS timestampnow`, + sql`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`, + sql`SELECT ${new Uint8Array(65536).fill(128)} AS bytea`, + sql`SELECT ${Buffer.from([65, 66, 67])} AS bytea`, + + // non-tagged-template + sql('SELECT $1::timestamp AS timestampnow', [now]), + sql("SELECT $1 || ' ' || $2 AS greeting", ['hello', 'world']), + sql('SELECT 123 AS num'), + sql('SELECT 123 AS num', []), +]; diff --git a/tests/ws.test.ts b/tests/ws.test.ts index b09dda2..4c98c5a 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -1,6 +1,7 @@ import { expect, test } from 'vitest'; -import { neon, Pool as WsPool } from '../export'; import { Pool as PgPool } from 'pg'; +import { neon, Pool as WsPool } from '../export'; +import { sampleSelects } from './sampleSelects'; const DB_URL = process.env.VITE_NEON_DB_URL!; @@ -9,14 +10,10 @@ const wsPool = new WsPool({ connectionString: DB_URL }); const pgPool = new PgPool({ connectionString: DB_URL }); test('WebSockets query results match pg/TCP query results', { timeout: 30000 }, async () => { - - // check that http and WebSocket responses match across a range of queries - const wsClient = await wsPool.connect(); const pgClient = await pgPool.connect(); - const now = new Date(); - async function compare(queryPromise: ReturnType) { + for (const queryPromise of sampleSelects(sql)) { const { query, params } = queryPromise.parameterizedQuery; const [wsResult, pgResult] = await Promise.all([ wsClient.query(query, params), @@ -25,60 +22,6 @@ test('WebSockets query results match pg/TCP query results', { timeout: 30000 }, expect(wsResult).toMatchObject(pgResult); } - await compare(sql`SELECT ${1} AS int_uncast`); - await compare(sql`SELECT ${-1}::int AS int`); - await compare(sql`SELECT ${1}::int8 AS int8num`); - await compare(sql`SELECT ${-1}::decimal AS decimalnum`); - await compare(sql`SELECT ${2n} AS bigint`); - await compare(sql`SELECT ${9007199254740993n} AS bigint`); - await compare(sql`SELECT ${Math.PI} AS pi`); - await compare(sql`SELECT ${Math.PI}::real AS pi`); - await compare(sql`SELECT ${Math.PI}::double precision AS pi`); - await compare(sql`SELECT ${'[1,4)'}::int4range AS int4range`); - await compare(sql`SELECT ${'hello'} AS str`); - await compare(sql`SELECT ${['a', 'b', 'c']} AS arrstr_uncast`); - await compare(sql`SELECT ${[[2], [4]]}::int[][] AS arrnumnested`); - await compare(sql`SELECT ${now}::timestamptz AS timestamptznow`); - await compare(sql`SELECT ${'16:17:18+01:00'}::timetz AS timetz`); - await compare(sql`SELECT ${'17:18:19'}::time AS time`); - await compare(sql`SELECT ${now}::date AS datenow`); - await compare(sql`SELECT ${{ x: 'y' }} AS obj_uncast`); - await compare(sql`SELECT ${'11:22:33:44:55:66'}::macaddr AS macaddr`); - await compare(sql`SELECT ${'\\xDEADBEEF'}::bytea AS bytea`); - await compare(sql`SELECT ${'(2, 3)'}::point AS point`); - await compare(sql`SELECT ${'<(2, 3), 1>'}::circle AS circle`); - await compare(sql`SELECT ${'10.10.10.0/24'}::cidr AS cidr`); - await compare(sql`SELECT ${true} AS bool_uncast`); - await compare(sql`SELECT ${'hello'} || ' ' || ${'world'} AS greeting`); - await compare(sql`SELECT ${[1, 2, 3]}::int[] AS arrnum`); - await compare(sql`SELECT ${['a', 'b', 'c']}::text[] AS arrstr`); - await compare(sql`SELECT ${{ x: 'y' }}::jsonb AS jsonb_obj`); - await compare(sql`SELECT ${{ x: 'y' }}::json AS json_obj`); - await compare(sql`SELECT ${{ x: 'y' }} AS json_obj_uncast`); - await compare(sql`SELECT ${['11:22:33:44:55:66']}::macaddr[] AS arrmacaddr`); - await compare(sql`SELECT ${['10.10.10.0/24']}::cidr[] AS arrcidr`); - await compare(sql`SELECT ${true}::boolean AS bool`); - await compare(sql`SELECT ${[now]}::timestamptz[] AS arrtstz`); - await compare(sql`SELECT ${['(2, 3)']}::point[] AS arrpoint`); - await compare(sql`SELECT ${['<(2, 3), 1>']}::circle[] AS arrcircle`); - await compare(sql`SELECT ${['\\xDEADBEEF', '\\xDEADBEEF']}::bytea[] AS arrbytea`); - await compare(sql`SELECT null AS null`); - await compare(sql`SELECT ${null} AS null`); - await compare(sql`SELECT ${'NULL'} AS null_str`); - await compare(sql`SELECT ${[1, 2, 3]} AS arrnum_uncast`); - await compare(sql`SELECT ${[[2], [4]]} AS arrnumnested_uncast`); - await compare(sql`SELECT ${now} AS timenow_uncast`); - await compare(sql`SELECT ${now}::timestamp AS timestampnow`); - await compare(sql`SELECT ${new Uint8Array([65, 66, 67])} AS bytea`); - await compare(sql`SELECT ${new Uint8Array(65536).fill(128)} AS bytea`); - await compare(sql`SELECT ${Buffer.from([65, 66, 67])} AS bytea`); - - // non-template usage - await compare(sql('SELECT $1::timestamp AS timestampnow', [now])); - await compare(sql("SELECT $1 || ' ' || $2 AS greeting", ['hello', 'world'])); - await compare(sql('SELECT 123 AS num')); - await compare(sql('SELECT 123 AS num', [])); - wsClient.release(); pgClient.release(); }); From 9aff80f64f7a6bca80ecad61497a8db512afe9c2 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Fri, 13 Dec 2024 18:20:17 +0000 Subject: [PATCH 18/40] Changed remaining calls to toMatchObject to toStrictEqual in tests --- tests/http.test.ts | 2 +- tests/ws.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/http.test.ts b/tests/http.test.ts index e854501..ac9ad17 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -38,7 +38,7 @@ test('custom fetch', async () => { fn(url); return fetch(url, options); }; - await expect(sql`SELECT ${'customFetch'} AS str`).resolves.toMatchObject([{ str: 'customFetch' }]); + await expect(sql`SELECT ${'customFetch'} AS str`).resolves.toStrictEqual([{ str: 'customFetch' }]); expect(fn).toHaveBeenCalledOnce(); }); diff --git a/tests/ws.test.ts b/tests/ws.test.ts index 4c98c5a..38c95a7 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -19,7 +19,7 @@ test('WebSockets query results match pg/TCP query results', { timeout: 30000 }, wsClient.query(query, params), pgClient.query(query, params), ]); - expect(wsResult).toMatchObject(pgResult); + expect(wsResult).toStrictEqual(pgResult); } wsClient.release(); From 3a4889c2f632cdc90e846be34a7909874be2502d Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Mon, 16 Dec 2024 18:31:16 +0000 Subject: [PATCH 19/40] Additional tests, and began types auto-generation using api-extractor --- .prettierrc | 3 +- CONFIG.md | 15 +- README.md | 9 +- api-extractor.json | 18 + dist/dts/export/httpQuery.d.ts | 49 + dist/dts/export/index.d.ts | 49 + dist/dts/export/neonConfig.d.ts | 131 + dist/dts/shims/net/index.d.ts | 118 + dist/dts/shims/url/index.d.ts | 16 + dist/npm/index.d.mts | 689 +++--- dist/npm/index.d.ts | 685 +++--- dist/npm/package.json | 6 +- export/httpQuery.ts | 98 +- export/index.ts | 84 +- export/neonConfig.ts | 9 +- package-lock.json | 2285 +++++++++++++----- package.json | 14 +- shims/crypto/index.ts | 658 ++++- shims/crypto/md5.ts | 488 ---- shims/crypto/sha256.ts | 169 -- shims/net/index.ts | 88 +- shims/pg-native/{index.js => index.ts} | 0 shims/shims.js | 9 +- shims/string_decoder/index.ts | 6 +- shims/tls/index.ts | 8 +- shims/url/index.ts | 16 +- src/index.ts | 134 +- src/queries.ts | 3 +- src/util.ts | 41 +- tests/README.md | 19 + tests/http.test.ts | 77 +- tests/httpTransaction.test.ts | 34 +- tests/{sampleSelects.ts => sampleQueries.ts} | 4 +- tests/subtls-rootcerts.pem | 31 + tests/ws.test.ts | 144 +- tests/wsTransaction.test.ts | 8 + tsconfig.json | 11 +- 37 files changed, 3703 insertions(+), 2523 deletions(-) create mode 100644 api-extractor.json create mode 100644 dist/dts/export/httpQuery.d.ts create mode 100644 dist/dts/export/index.d.ts create mode 100644 dist/dts/export/neonConfig.d.ts create mode 100644 dist/dts/shims/net/index.d.ts create mode 100644 dist/dts/shims/url/index.d.ts delete mode 100644 shims/crypto/md5.ts delete mode 100644 shims/crypto/sha256.ts rename shims/pg-native/{index.js => index.ts} (100%) create mode 100644 tests/README.md rename tests/{sampleSelects.ts => sampleQueries.ts} (95%) create mode 100644 tests/subtls-rootcerts.pem create mode 100644 tests/wsTransaction.test.ts diff --git a/.prettierrc b/.prettierrc index 544138b..32e9fdb 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,4 @@ { - "singleQuote": true + "singleQuote": true, + "printWidth": 110 } diff --git a/CONFIG.md b/CONFIG.md index 4f56abf..ae4a8be 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -161,10 +161,7 @@ const sql = neon(process.env.DATABASE_URL); const showLatestN = 10; const [posts, tags] = await sql.transaction( - [ - sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, - sql`SELECT * FROM tags`, - ], + [sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, sql`SELECT * FROM tags`], { isolationLevel: 'RepeatableRead', readOnly: true, @@ -175,9 +172,10 @@ const [posts, tags] = await sql.transaction( Or as an example of the function case: ```javascript -const [authors, tags] = await neon(process.env.DATABASE_URL).transaction( - (txn) => [txn`SELECT * FROM authors`, txn`SELECT * FROM tags`], -); +const [authors, tags] = await neon(process.env.DATABASE_URL).transaction((txn) => [ + txn`SELECT * FROM authors`, + txn`SELECT * FROM tags`, +]); ``` The optional second argument to `transaction()`, `options`, has the same keys as the options to the ordinary query function -- `arrayMode`, `fullResults` and `fetchOptions` -- plus three additional keys that concern the transaction configuration. These transaction-related keys are: `isolationMode`, `readOnly` and `deferrable`. They are described below. Defaults for the transaction-related keys can also be set as options to the `neon` function. @@ -269,8 +267,7 @@ If connecting to a non-Neon database, the `wsProxy` option should point to [your ```javascript // either: -neonConfig.wsProxy = (host, port) => - `my-wsproxy.example.com/v1?address=${host}:${port}`; +neonConfig.wsProxy = (host, port) => `my-wsproxy.example.com/v1?address=${host}:${port}`; // or (with identical effect): neonConfig.wsProxy = 'my-wsproxy.example.com/v1'; ``` diff --git a/README.md b/README.md index 5da601c..2eef9bf 100644 --- a/README.md +++ b/README.md @@ -157,13 +157,8 @@ try { await client.query('BEGIN'); const { rows: [{ id: postId }], - } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', [ - 'Welcome', - ]); - await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [ - postId, - 's3.bucket/photo/url', - ]); + } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', ['Welcome']); + await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [postId, 's3.bucket/photo/url']); await client.query('COMMIT'); } catch (err) { await client.query('ROLLBACK'); diff --git a/api-extractor.json b/api-extractor.json new file mode 100644 index 0000000..276494b --- /dev/null +++ b/api-extractor.json @@ -0,0 +1,18 @@ +{ + "mainEntryPointFilePath": "dist/dts/export/index.d.ts", + "newlineKind": "lf", + "enumMemberOrder": "preserve", + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "dist/npm/index.d.ts" + }, + "apiReport": { + "enabled": false + }, + "docModel": { + "enabled": false + }, + "tsdocMetadata": { + "enabled": false + } +} diff --git a/dist/dts/export/httpQuery.d.ts b/dist/dts/export/httpQuery.d.ts new file mode 100644 index 0000000..05d03b3 --- /dev/null +++ b/dist/dts/export/httpQuery.d.ts @@ -0,0 +1,49 @@ +import { types as defaultTypes } from '.'; +export declare class NeonDbError extends Error { + name: "NeonDbError"; + severity: string | undefined; + code: string | undefined; + detail: string | undefined; + hint: string | undefined; + position: string | undefined; + internalPosition: string | undefined; + internalQuery: string | undefined; + where: string | undefined; + schema: string | undefined; + table: string | undefined; + column: string | undefined; + dataType: string | undefined; + constraint: string | undefined; + file: string | undefined; + line: string | undefined; + routine: string | undefined; + sourceError: Error | undefined; + constructor(message: string); +} +interface ParameterizedQuery { + query: string; + params: any[]; +} +interface HTTPQueryOptions { + arrayMode?: boolean; + fullResults?: boolean; + fetchOptions?: Record; + types?: typeof defaultTypes; + queryCallback?: (query: ParameterizedQuery) => void; + resultCallback?: (query: ParameterizedQuery, result: any, rows: any, opts: any) => void; + authToken?: string | (() => Promise | string); +} +interface HTTPTransactionOptions extends HTTPQueryOptions { + isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; + readOnly?: boolean; + deferrable?: boolean; +} +interface NeonQueryPromise extends Promise { + parameterizedQuery: ParameterizedQuery; + opts?: HTTPQueryOptions; +} +export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { + (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; + transaction(queries: NeonQueryPromise[] | ((sql: /*elided*/ any) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; +}; +export {}; diff --git a/dist/dts/export/index.d.ts b/dist/dts/export/index.d.ts new file mode 100644 index 0000000..1dc86a5 --- /dev/null +++ b/dist/dts/export/index.d.ts @@ -0,0 +1,49 @@ +import { Client, Connection, Pool } from 'pg'; +import { Socket } from '../shims/net'; +import { neon, NeonDbError } from './httpQuery'; +import type { NeonConfigGlobalAndClient } from './neonConfig'; +/** + * We export the pg library mostly unchanged, but we do make a few tweaks. + * + * (1) Connecting and querying can require a lot of network round-trips. We + * add a pipelining option for the connection (startup + auth + first query), + * but this works with cleartext password auth only. We can also pipeline TLS + * startup, but currently this works only with Neon hosts (not vanilla pg or + * pgbouncer). + * + * (2) SCRAM auth is deliberately CPU-intensive, and this is not appropriate + * for a serverless environment. In case it is still used, however, we replace + * the standard (synchronous) pg implementation with one that uses SubtleCrypto + * for repeated SHA-256 digests. This saves some time and CPU. + * + * (3) We now (experimentally) redirect Pool.query over a fetch request if the + * circumstances are right. + */ +declare interface NeonClient { + connection: Connection & { + stream: Socket; + sendSCRAMClientFinalMessage: (response: any) => void; + ssl: any; + }; + _handleReadyForQuery: any; + _handleAuthCleartextPassword: any; + startup: any; + getStartupConf: any; + saslSession: any; +} +declare class NeonClient extends Client { + config: any; + get neonConfig(): NeonConfigGlobalAndClient; + constructor(config: any); + connect(): Promise; + connect(callback: (err?: Error) => void): void; + _handleAuthSASLContinue(msg: any): Promise; +} +declare class NeonPool extends Pool { + Client: typeof NeonClient; + hasFetchUnsupportedListeners: boolean; + on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + query(config?: any, values?: any, cb?: any): any; +} +export { Socket as neonConfig, NeonPool as Pool, NeonClient as Client, neon, NeonDbError }; +export { Connection, DatabaseError, Query, ClientBase, defaults, types } from 'pg'; diff --git a/dist/dts/export/neonConfig.d.ts b/dist/dts/export/neonConfig.d.ts new file mode 100644 index 0000000..dfc246c --- /dev/null +++ b/dist/dts/export/neonConfig.d.ts @@ -0,0 +1,131 @@ +export interface NeonConfigGlobalOnly { + /** + * Set `fetchEndpoint` to set the server endpoint to be sent queries via http + * fetch. May be useful in local development (e.g. to set a port that's not + * the default 443). + * + * Provide either the full endpoint URL, or a function that takes the + * database host address and port and returns the full endpoint URL + * (including protocol). + * + * Default: `host => 'https://' + host + '/sql'` + * + */ + fetchEndpoint: string | ((host: string, port: number | string) => string); + /** + * **Experimentally**, when `poolQueryViaFetch` is `true`, and no listeners + * for the `"connect"`, `"acquire"`, `"release"` or `"remove"` events are set + * on the `Pool`, queries via `Pool.query()` will be sent by low-latency HTTP + * fetch request. + * + * Default: `false`. + */ + poolQueryViaFetch: boolean; + /** + * **Experimentally**, when `fetchConnectionCache` is `true`, queries carried + * via HTTP fetch make use of a connection cache on the server. + * + * Default: `false`. + */ + fetchConnectionCache: boolean; + /** + * The `fetchFunction` option allows you to supply an alternative function + * for making http requests. The function must accept the same arguments as + * native `fetch`. + * + * Default: `undefined`. + */ + fetchFunction: any; +} +export interface NeonConfigGlobalAndClient { + /** + * If no global `WebSocket` object is available, set `webSocketConstructor` + * to the constructor for a custom WebSocket implementation, such as those + * provided by `ws` or `undici`. + */ + webSocketConstructor: any; + /** + * Set `wsProxy` to use your own WebSocket proxy server. + * + * Provide either the proxy server’s domain name, or a function that takes + * the database host and port and returns the proxy server address (without + * protocol). + * + * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` + * + * Default: `host => host + '/v2'` + */ + wsProxy: string | ((host: string, port: number | string) => string) | undefined; + /** + * Use a secure (`wss:`) connection to the WebSocket proxy. + * + * Default: `true`. + */ + useSecureWebSocket: boolean; + /** + * Disable TLS encryption in the Postgres protocol (as set via e.g. + * `?sslmode=require` in the connection string). Connection remains secure + * if `useSecureWebSocket` is `true`. + * + * Default: `true` + */ + forceDisablePgSSL: boolean; + /** + * Pipelines the startup message, cleartext password message and first query + * when set to `"password"`. This works only for cleartext password auth. + * + * Default: `"password"`. + */ + pipelineConnect: 'password' | false; + /** + * If `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS, you must supply the subtls TLS library to this option: + * + * ``` + * import { neonConfig } from '@neondatabase/serverless'; + * import * as subtls from 'subtls'; + * neonConfig.subtls = subtls; + * ``` + * + * Default: `undefined`. + */ + subtls: any; + /** + * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is + * `false` and the Postgres connection parameters specify TLS. Currently + * compatible only with Neon hosts. + * + * Default: `false`. + */ + pipelineTLS: boolean; + /** + * Set `rootCerts` to a string comprising one or more PEM files. These are + * the trusted root certificates for a TLS connection to Postgres when + * `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS. + * + * Default: `""`. + */ + rootCerts: string; + /** + * Batch multiple network writes per run-loop into a single outgoing + * WebSocket message. + * + * Default: `true`. + */ + coalesceWrites: boolean; + /** + * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the + * Postgres connection parameters specify TLS, we send no SNI data in the + * Postgres TLS handshake. + * + * On Neon, disabling SNI and including the Neon project name in the password + * avoids CPU-intensive SCRAM authentication, but this is only relevant for + * earlier iterations of Neon's WebSocket support. + * + * Default: `false`. + */ + disableSNI: boolean; +} +export interface NeonConfig extends NeonConfigGlobalOnly, NeonConfigGlobalAndClient { +} diff --git a/dist/dts/shims/net/index.d.ts b/dist/dts/shims/net/index.d.ts new file mode 100644 index 0000000..b891b28 --- /dev/null +++ b/dist/dts/shims/net/index.d.ts @@ -0,0 +1,118 @@ +/** + * This file shims parts of the Node.js built-in net and tls packages, by + * implementing net.Socket and tls.connect() on top of WebSockets. It's + * designed to work both in browsers and in Cloudflare Workers (where + * WebSockets work a bit differently). The calling client is assumed to be pg + * (node-postgres). + */ +import { EventEmitter } from 'events'; +import type * as subtls from 'subtls'; +declare global { + const debug: boolean; + interface WebSocket { + binaryType: 'arraybuffer' | 'blob'; + accept?: () => void; + } + interface Response { + webSocket: WebSocket; + } + class __unstable_WebSocket extends WebSocket { + } +} +export declare function isIP(input: string): number; +interface FetchEndpointOptions { + jwtAuth?: boolean; +} +export interface SocketDefaults { + poolQueryViaFetch: boolean; + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchConnectionCache: boolean; + fetchFunction: any; + webSocketConstructor: typeof WebSocket | undefined; + wsProxy: string | ((host: string, port: number | string) => string); + useSecureWebSocket: boolean; + forceDisablePgSSL: boolean; + coalesceWrites: boolean; + pipelineConnect: 'password' | false; + subtls: typeof subtls | undefined; + rootCerts: string; + pipelineTLS: boolean; + disableSNI: boolean; +} +export declare class Socket extends EventEmitter { + static defaults: SocketDefaults; + static opts: Partial; + private opts; + static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; + static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); + static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; + static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); + static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); + static get fetchFunction(): SocketDefaults["fetchFunction"]; + static set fetchFunction(newValue: SocketDefaults['fetchFunction']); + static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + static get wsProxy(): SocketDefaults["wsProxy"]; + static set wsProxy(newValue: SocketDefaults['wsProxy']); + get wsProxy(): SocketDefaults["wsProxy"]; + set wsProxy(newValue: SocketDefaults['wsProxy']); + static get coalesceWrites(): SocketDefaults["coalesceWrites"]; + static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + get coalesceWrites(): SocketDefaults["coalesceWrites"]; + set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + static get disableSNI(): SocketDefaults["disableSNI"]; + static set disableSNI(newValue: SocketDefaults['disableSNI']); + get disableSNI(): SocketDefaults["disableSNI"]; + set disableSNI(newValue: SocketDefaults['disableSNI']); + static get pipelineConnect(): SocketDefaults["pipelineConnect"]; + static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + get pipelineConnect(): SocketDefaults["pipelineConnect"]; + set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + static get subtls(): SocketDefaults["subtls"]; + static set subtls(newValue: SocketDefaults['subtls']); + get subtls(): SocketDefaults["subtls"]; + set subtls(newValue: SocketDefaults['subtls']); + static get pipelineTLS(): SocketDefaults["pipelineTLS"]; + static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + get pipelineTLS(): SocketDefaults["pipelineTLS"]; + set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + static get rootCerts(): SocketDefaults["rootCerts"]; + static set rootCerts(newValue: SocketDefaults['rootCerts']); + get rootCerts(): SocketDefaults["rootCerts"]; + set rootCerts(newValue: SocketDefaults['rootCerts']); + wsProxyAddrForHost(host: string, port: number): string; + connecting: boolean; + pending: boolean; + writable: boolean; + encrypted: boolean; + authorized: boolean; + destroyed: boolean; + private ws; + private writeBuffer; + private tlsState; + private tlsRead; + private tlsWrite; + setNoDelay(): this; + setKeepAlive(): this; + ref(): this; + unref(): this; + connect(port: number | string, host: string, connectListener?: () => void): void; + startTls(host: string): Promise; + tlsReadLoop(): Promise; + rawWrite(data: Uint8Array): void; + write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; + end(data?: Buffer | string, encoding?: string, callback?: () => void): this; + destroy(): this; +} +export {}; diff --git a/dist/dts/shims/url/index.d.ts b/dist/dts/shims/url/index.d.ts new file mode 100644 index 0000000..6744d8b --- /dev/null +++ b/dist/dts/shims/url/index.d.ts @@ -0,0 +1,16 @@ +export declare function parse(url: string, parseQueryString?: boolean): { + href: string; + protocol: string; + auth: string; + username: string; + password: string; + host: string; + hostname: string; + port: string; + pathname: string; + search: string; + query: string | { + [k: string]: string; + }; + hash: string; +}; diff --git a/dist/npm/index.d.mts b/dist/npm/index.d.mts index 6c98c62..68c7421 100644 --- a/dist/npm/index.d.mts +++ b/dist/npm/index.d.mts @@ -1,437 +1,312 @@ +import { Client as Client_2 } from 'pg'; +import { ClientBase } from 'pg'; +import { Connection } from 'pg'; +import { DatabaseError } from 'pg'; +import { defaults } from 'pg'; +import { EventEmitter } from 'events'; +import { Pool as Pool_2 } from 'pg'; +import { Query } from 'pg'; +import type * as subtls from 'subtls'; +import { types } from 'pg'; -// DON'T EDIT THIS FILE -// It's a simple automatic copy of index.d.ts - - -// @neondatabase/serverless driver types, mimicking pg - -export { - BindConfig, ClientConfig, Connection, ConnectionConfig, CustomTypesConfig, Defaults, defaults, Events, ExecuteConfig, FieldDef, MessageConfig, native, Notification, PoolConfig, Query, QueryArrayConfig, QueryArrayResult, QueryConfig, QueryParse, QueryResult, QueryResultBase, - QueryResultRow, ResultBuilder, Submittable, types -} from "pg"; -export { DatabaseError } from "pg-protocol"; - -interface FetchEndpointOptions { - jwtAuth?: boolean; -} - -export interface NeonConfigGlobalOnly { - /** - * Set `fetchEndpoint` to set the server endpoint to be sent queries via http - * fetch. May be useful in local development (e.g. to set a port that's not - * the default 443). - * - * Provide either the full endpoint URL, or a function that takes the - * database host address and port and returns the full endpoint URL - * (including protocol). - * - * Default: `host => 'https://' + host + '/sql'` - * - */ - fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); - - /** - * **Experimentally**, when `poolQueryViaFetch` is `true`, and no listeners - * for the `"connect"`, `"acquire"`, `"release"` or `"remove"` events are set - * on the `Pool`, queries via `Pool.query()` will be sent by low-latency HTTP - * fetch request. - * - * Default: `false`. - */ - poolQueryViaFetch: boolean; - - /** - * **DEPRECATED**. Previously, only when `fetchConnectionCache` was `true` - * did queries carried via HTTP fetch make use of a connection pool/cache - * on the server. All queries now use the connection pool/cache: this setting - * is ignored. - * - * Default: `true`. - */ - fetchConnectionCache: boolean; - - /** - * The `fetchFunction` option allows you to supply an alternative function - * for making http requests. The function must accept the same arguments as - * native `fetch`. - * - * Default: `undefined`. - */ - fetchFunction: any; +/** + * We export the pg library mostly unchanged, but we do make a few tweaks. + * + * (1) Connecting and querying can require a lot of network round-trips. We + * add a pipelining option for the connection (startup + auth + first query), + * but this works with cleartext password auth only. We can also pipeline TLS + * startup, but currently this works only with Neon hosts (not vanilla pg or + * pgbouncer). + * + * (2) SCRAM auth is deliberately CPU-intensive, and this is not appropriate + * for a serverless environment. In case it is still used, however, we replace + * the standard (synchronous) pg implementation with one that uses SubtleCrypto + * for repeated SHA-256 digests. This saves some time and CPU. + * + * (3) We now (experimentally) redirect Pool.query over a fetch request if the + * circumstances are right. + */ +export declare interface Client { + connection: Connection & { + stream: neonConfig; + sendSCRAMClientFinalMessage: (response: any) => void; + ssl: any; + }; + _handleReadyForQuery: any; + _handleAuthCleartextPassword: any; + startup: any; + getStartupConf: any; + saslSession: any; } -export interface NeonConfigGlobalAndClient { - /** - * If no global `WebSocket` object is available, set `webSocketConstructor` - * to the constructor for a custom WebSocket implementation, such as those - * provided by `ws` or `undici`. - */ - webSocketConstructor: any; - - /** - * Set `wsProxy` to use your own WebSocket proxy server. - * - * Provide either the proxy server’s domain name, or a function that takes - * the database host and port and returns the proxy server address (without - * protocol). - * - * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` - * - * Default: `host => host + '/v2'` - */ - wsProxy: string | ((host: string, port: number | string) => string) | undefined; - - /** - * Use a secure (`wss:`) connection to the WebSocket proxy. - * - * Default: `true`. - */ - useSecureWebSocket: boolean; - - /** - * Disable TLS encryption in the Postgres protocol (as set via e.g. - * `?sslmode=require` in the connection string). Connection remains secure - * if `useSecureWebSocket` is `true`. - * - * Default: `true` - */ - forceDisablePgSSL: boolean; - - /** - * Pipelines the startup message, cleartext password message and first query - * when set to `"password"`. This works only for cleartext password auth. - * - * Default: `"password"`. - */ - pipelineConnect: "password" | false; - - /** - * If `forceDisablePgSSL` is `false` and the Postgres connection parameters - * specify TLS, you must supply the subtls TLS library to this option: - * - * ``` - * import { neonConfig } from '@neondatabase/serverless'; - * import * as subtls from 'subtls'; - * neonConfig.subtls = subtls; - * ``` - * - * Default: `undefined`. - */ - subtls: any; - - /** - * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is - * `false` and the Postgres connection parameters specify TLS. Currently - * compatible only with Neon hosts. - * - * Default: `false`. - */ - pipelineTLS: boolean; - - /** - * Set `rootCerts` to a string comprising one or more PEM files. These are - * the trusted root certificates for a TLS connection to Postgres when - * `forceDisablePgSSL` is `false` and the Postgres connection parameters - * specify TLS. - * - * Default: `""`. - */ - rootCerts: string; - - /** - * Batch multiple network writes per run-loop into a single outgoing - * WebSocket message. - * - * Default: `true`. - */ - coalesceWrites: boolean; - - /** - * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the - * Postgres connection parameters specify TLS, we send no SNI data in the - * Postgres TLS handshake. - * - * On Neon, disabling SNI and including the Neon project name in the password - * avoids CPU-intensive SCRAM authentication, but this is only relevant for - * earlier iterations of Neon's WebSocket support. - * - * Default: `false`. - */ - disableSNI: boolean; +export declare class Client extends Client_2 { + config: any; + get neonConfig(): NeonConfigGlobalAndClient; + constructor(config: any); + connect(): Promise; + connect(callback: (err?: Error) => void): void; + _handleAuthSASLContinue(msg: any): Promise; } -export interface NeonConfig extends NeonConfigGlobalOnly, NeonConfigGlobalAndClient { } +export { ClientBase } -import { - Client as PgClient, - ClientBase as PgClientBase, - Pool as PgPool, - PoolClient as PgPoolClient, - types as PgTypes -} from "pg"; +export { Connection } -export class ClientBase extends PgClientBase { - neonConfig: NeonConfigGlobalAndClient; -} +export { DatabaseError } -export class Client extends PgClient { - neonConfig: NeonConfigGlobalAndClient; -} +export { defaults } -export interface PoolClient extends PgPoolClient { - neonConfig: NeonConfigGlobalAndClient; +declare interface FetchEndpointOptions { + jwtAuth?: boolean; } -export class Pool extends PgPool { - connect(): Promise; - connect(callback: (err: Error, client: PoolClient, done: (release?: any) => void) => void): void; - on(event: 'error', listener: (err: Error, client: PoolClient) => void): this; - on(event: 'connect' | 'acquire' | 'remove', listener: (client: PoolClient) => void): this; +declare interface HTTPQueryOptions { + arrayMode?: boolean; + fullResults?: boolean; + fetchOptions?: Record; + types?: typeof types; + queryCallback?: (query: ParameterizedQuery) => void; + resultCallback?: (query: ParameterizedQuery, result: any, rows: any, opts: any) => void; + authToken?: string | (() => Promise | string); } -export const neonConfig: NeonConfig; - - -// SQL-over-HTTP - -import { FieldDef } from "pg"; - -export type QueryRows = - ArrayMode extends true ? any[][] : Record[]; - -export interface FullQueryResults { - fields: FieldDef[]; - command: string; - rowCount: number; - rows: QueryRows; - rowAsArray: ArrayMode; +declare interface HTTPTransactionOptions extends HTTPQueryOptions { + isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; + readOnly?: boolean; + deferrable?: boolean; } -export interface ParameterizedQuery { - query: string; - params: any[]; +export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { + (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; + transaction(queries: NeonQueryPromise[] | ((sql: /*elided*/ any) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; +}; + +export declare class neonConfig extends EventEmitter { + static defaults: SocketDefaults; + static opts: Partial; + private opts; + static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; + static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); + static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; + static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); + static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); + static get fetchFunction(): SocketDefaults["fetchFunction"]; + static set fetchFunction(newValue: SocketDefaults['fetchFunction']); + static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + static get wsProxy(): SocketDefaults["wsProxy"]; + static set wsProxy(newValue: SocketDefaults['wsProxy']); + get wsProxy(): SocketDefaults["wsProxy"]; + set wsProxy(newValue: SocketDefaults['wsProxy']); + static get coalesceWrites(): SocketDefaults["coalesceWrites"]; + static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + get coalesceWrites(): SocketDefaults["coalesceWrites"]; + set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + static get disableSNI(): SocketDefaults["disableSNI"]; + static set disableSNI(newValue: SocketDefaults['disableSNI']); + get disableSNI(): SocketDefaults["disableSNI"]; + set disableSNI(newValue: SocketDefaults['disableSNI']); + static get pipelineConnect(): SocketDefaults["pipelineConnect"]; + static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + get pipelineConnect(): SocketDefaults["pipelineConnect"]; + set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + static get subtls(): SocketDefaults["subtls"]; + static set subtls(newValue: SocketDefaults['subtls']); + get subtls(): SocketDefaults["subtls"]; + set subtls(newValue: SocketDefaults['subtls']); + static get pipelineTLS(): SocketDefaults["pipelineTLS"]; + static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + get pipelineTLS(): SocketDefaults["pipelineTLS"]; + set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + static get rootCerts(): SocketDefaults["rootCerts"]; + static set rootCerts(newValue: SocketDefaults['rootCerts']); + get rootCerts(): SocketDefaults["rootCerts"]; + set rootCerts(newValue: SocketDefaults['rootCerts']); + wsProxyAddrForHost(host: string, port: number): string; + connecting: boolean; + pending: boolean; + writable: boolean; + encrypted: boolean; + authorized: boolean; + destroyed: boolean; + private ws; + private writeBuffer; + private tlsState; + private tlsRead; + private tlsWrite; + setNoDelay(): this; + setKeepAlive(): this; + ref(): this; + unref(): this; + connect(port: number | string, host: string, connectListener?: () => void): void; + startTls(host: string): Promise; + tlsReadLoop(): Promise; + rawWrite(data: Uint8Array): void; + write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; + end(data?: Buffer | string, encoding?: string, callback?: () => void): this; + destroy(): this; } -export interface HTTPQueryOptions { - /** - * When `arrayMode` is `false`, which is the default, result rows are - * returned as objects whose keys represent column names, such as - * `{ id: 1 }`). - * - * When `arrayMode` is `true`, rows are returned as arrays (and keys are not - * provided), e.g. `[1]`. - */ - arrayMode?: ArrayMode; - /** - * When `fullResults` is `false`, which is the default, only result rows are - * returned, e.g. `[{ id: 1 }]`). - * - * When `fullResults` is `true`, a result object is returned that matches - * what's returned by node-postgres. This has a `rows` property, which is an - * array of result rows, plus `fields`, which provides column names and - * types, `command` and `rowCount`. - */ - fullResults?: FullResults; // default false - /** - * Any options in `fetchOptions` are merged in to the options passed to - * `fetch`. In case of conflict with what would otherwise be passed, these - * options take precedence. - */ - fetchOptions?: Record; - - /** - * JWT auth token to be passed as the Bearer token in the Authorization header - * - * Default: `undefined` - */ - authToken?: string | (() => Promise | string); - - /** - * Custom type parsers - * See https://github.com/brianc/node-pg-types - */ - types?: typeof PgTypes; +declare interface NeonConfigGlobalAndClient { + /** + * If no global `WebSocket` object is available, set `webSocketConstructor` + * to the constructor for a custom WebSocket implementation, such as those + * provided by `ws` or `undici`. + */ + webSocketConstructor: any; + /** + * Set `wsProxy` to use your own WebSocket proxy server. + * + * Provide either the proxy server’s domain name, or a function that takes + * the database host and port and returns the proxy server address (without + * protocol). + * + * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` + * + * Default: `host => host + '/v2'` + */ + wsProxy: string | ((host: string, port: number | string) => string) | undefined; + /** + * Use a secure (`wss:`) connection to the WebSocket proxy. + * + * Default: `true`. + */ + useSecureWebSocket: boolean; + /** + * Disable TLS encryption in the Postgres protocol (as set via e.g. + * `?sslmode=require` in the connection string). Connection remains secure + * if `useSecureWebSocket` is `true`. + * + * Default: `true` + */ + forceDisablePgSSL: boolean; + /** + * Pipelines the startup message, cleartext password message and first query + * when set to `"password"`. This works only for cleartext password auth. + * + * Default: `"password"`. + */ + pipelineConnect: 'password' | false; + /** + * If `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS, you must supply the subtls TLS library to this option: + * + * ``` + * import { neonConfig } from '@neondatabase/serverless'; + * import * as subtls from 'subtls'; + * neonConfig.subtls = subtls; + * ``` + * + * Default: `undefined`. + */ + subtls: any; + /** + * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is + * `false` and the Postgres connection parameters specify TLS. Currently + * compatible only with Neon hosts. + * + * Default: `false`. + */ + pipelineTLS: boolean; + /** + * Set `rootCerts` to a string comprising one or more PEM files. These are + * the trusted root certificates for a TLS connection to Postgres when + * `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS. + * + * Default: `""`. + */ + rootCerts: string; + /** + * Batch multiple network writes per run-loop into a single outgoing + * WebSocket message. + * + * Default: `true`. + */ + coalesceWrites: boolean; + /** + * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the + * Postgres connection parameters specify TLS, we send no SNI data in the + * Postgres TLS handshake. + * + * On Neon, disabling SNI and including the Neon project name in the password + * avoids CPU-intensive SCRAM authentication, but this is only relevant for + * earlier iterations of Neon's WebSocket support. + * + * Default: `false`. + */ + disableSNI: boolean; } -export interface HTTPTransactionOptions extends HTTPQueryOptions { - /** - * Postgres transaction isolation level: see https://www.postgresql.org/docs/current/transaction-iso.html. - * Note that `ReadUncommitted` actually gets you `ReadCommitted` in Postgres. - * */ - isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; - /** - * When `readOnly` is `false`, which is the default, a `READ WRITE` Postgres - * transaction is used. - * - * When `readOnly` is `true`, a `READ ONLY` Postgres transaction is used. - * */ - readOnly?: boolean; - /** - * When `deferrable` is `false`, which is the default, a `NOT DEFERRABLE` - * Postgres transaction is used. - * - * When `deferrable` is `true` (and `isolationLevel` is `Serializable` and - * `readOnly` is `true`), a `DEFERRABLE` Postgres transaction is used. - * */ - deferrable?: boolean; +export declare class NeonDbError extends Error { + name: "NeonDbError"; + severity: string | undefined; + code: string | undefined; + detail: string | undefined; + hint: string | undefined; + position: string | undefined; + internalPosition: string | undefined; + internalQuery: string | undefined; + where: string | undefined; + schema: string | undefined; + table: string | undefined; + column: string | undefined; + dataType: string | undefined; + constraint: string | undefined; + file: string | undefined; + line: string | undefined; + routine: string | undefined; + sourceError: Error | undefined; + constructor(message: string); } -export interface NeonQueryPromise extends Promise { - parameterizedQuery: ParameterizedQuery; - opts?: HTTPQueryOptions; +declare interface NeonQueryPromise extends Promise { + parameterizedQuery: ParameterizedQuery; + opts?: HTTPQueryOptions; } -export interface NeonQueryInTransaction { - // this is a simplified form of query, which has only a `parameterizedQuery` (no `opts` and not a `Promise`) - parameterizedQuery: ParameterizedQuery; +declare interface ParameterizedQuery { + query: string; + params: any[]; } -export interface NeonQueryFunctionInTransaction { - // this is a simplified form of NeonQueryFunction (below): - // * `opts` cannot be passed - // * no `transaction()` method is available - - // tagged-template function usage - (strings: TemplateStringsArray, ...params: any[]): - NeonQueryPromise : QueryRows>; - - // ordinary function usage (*no* options overrides) - (string: string, params?: any[]): - NeonQueryPromise : QueryRows>; +export declare class Pool extends Pool_2 { + Client: typeof Client; + hasFetchUnsupportedListeners: boolean; + on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + query(config?: any, values?: any, cb?: any): any; } -export interface NeonQueryFunction { - // tagged-template function usage - (strings: TemplateStringsArray, ...params: any[]): - NeonQueryPromise : QueryRows>; - - // ordinary function usage, with options overrides - ( - string: string, - params?: any[], - opts?: HTTPQueryOptions - ): NeonQueryPromise< - ArrayModeOverride, - FullResultsOverride, - FullResultsOverride extends true ? FullQueryResults : QueryRows - >; - - /** - * The `transaction()` function allows multiple queries to be submitted (over - * HTTP) as a single, non-interactive Postgres transaction. - * - * For example: - * ``` - * import { neon } from "@neondatabase/serverless"; - * const sql = neon("postgres://user:pass@host/db"); - * - * const results = await sql.transaction([ - * sql`SELECT 1 AS num`, - * sql`SELECT 'a' AS str`, - * ]); - * // -> [[{ num: 1 }], [{ str: "a" }]] - * - * // or equivalently: - * const results = await sql.transaction(txn => [ - * txn`SELECT 1 AS num`, - * txn`SELECT 'a' AS str`, - * ]); - * // -> [[{ num: 1 }], [{ str: "a" }]] - * ``` - * @param queriesOrFn Either an array of queries, or a (non-`async`) function - * that receives a query function and returns an array of queries. - * @param opts The same options that may be set on individual queries in a - * non-transaction setting -- that is, `arrayMode` `fullResults` and - * `fetchOptions` -- plus the transaction options `isolationLevel`, - * `readOnly` and `deferrable`. Note that none of these options can be set on - * individual queries within a transaction. - * @returns An array of results. The structure of each result object depends - * on the `arrayMode` and `fullResults` options. - */ - transaction: ( - queriesOrFn: NeonQueryPromise[] | // not ArrayModeOverride or FullResultsOverride: clamp these values to the current ones - ((sql: NeonQueryFunctionInTransaction) => NeonQueryInTransaction[]), - opts?: HTTPTransactionOptions - ) => Promise[] : QueryRows[]>; +export { Query } + +declare interface SocketDefaults { + poolQueryViaFetch: boolean; + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchConnectionCache: boolean; + fetchFunction: any; + webSocketConstructor: typeof WebSocket | undefined; + wsProxy: string | ((host: string, port: number | string) => string); + useSecureWebSocket: boolean; + forceDisablePgSSL: boolean; + coalesceWrites: boolean; + pipelineConnect: 'password' | false; + subtls: typeof subtls | undefined; + rootCerts: string; + pipelineTLS: boolean; + disableSNI: boolean; } -/** - * This function returns an async tagged-template function that runs a single - * SQL query (no session or transactions) with low latency over https. Support - * for multiple queries as a non-interactive transaction is provided by - * the `transaction` property of the query function. - * - * By default, the query function returns database rows directly. Types should - * match those returned by this driver (i.e. Pool or Client) over WebSockets. - * - * The returned function can also be called directly (i.e. not as a template - * function). In that case, pass it a query string with embedded `$1`, `$2` - * (etc.), followed by an array of query parameters, followed (optionally) by - * any of the same options you can pass to this function. - * - * Some examples: - * ``` - * import { neon } from "@neondatabase/serverless"; - * const h = "hello", w = "world"; - * - * // example 1: default options, tagged-template usage - * const sql = neon("postgres://user:pass@host/db"); - * const rows = await sql`SELECT ${h} || ' ' || ${w} AS greeting`; - * // -> [ { greeting: "hello world" } ] - * - * // example 2: `arrayMode` and `fullResults` options, ordinary function usage - * const options = { arrayMode: true, fullResults: true }; - * const sql = neon("postgres://user:pass@host/db", options); - * const rows = await sql("SELECT $1 || ' ' || $2 AS greeting", [h, w]); - * // -> { - * // command: "SELECT", - * // fields: [ { name: "greeting", dataTypeID: 25 } ], - * // rowAsArray: true, - * // rowCount: 1, - * // rows: [ [ "hello world" ] ] - * // } - * - * // example 3: `fetchOptions` option, ordinary function usage - * const sql = neon("postgres://user:pass@host/db"); - * const rows = await sql( - * "SELECT $1 || ' ' || $2 AS greeting", [h, w], - * { fetchOptions: { priority: "high" } } - * ); - * // -> [ { greeting: "hello world" } ] - * ``` - * - * @param connectionString this has the format `postgres://user:pass@host/db` - * @param options pass `arrayMode: true` to receive results as an array of - * arrays, instead of the default array of objects; pass `fullResults: true` - * to receive a complete result object similar to one returned by node-postgres - * (with properties `rows`, `fields`, `command`, `rowCount`, `rowAsArray`); - * pass as `fetchOptions` an object which will be merged into the options - * passed to `fetch`. - */ -export function neon( - connectionString: string, - options?: HTTPTransactionOptions, -): NeonQueryFunction; - -export class NeonDbError extends Error { - name: 'NeonDbError'; +export { types } - severity: string | undefined; - code: string | undefined; - detail: string | undefined; - hint: string | undefined; - position: string | undefined; - internalPosition: string | undefined; - internalQuery: string | undefined; - where: string | undefined; - schema: string | undefined; - table: string | undefined; - column: string | undefined; - dataType: string | undefined; - constraint: string | undefined; - file: string | undefined; - line: string | undefined; - routine: string | undefined; - - sourceError: Error | undefined; -} +export { } diff --git a/dist/npm/index.d.ts b/dist/npm/index.d.ts index ec5c7b4..68c7421 100644 --- a/dist/npm/index.d.ts +++ b/dist/npm/index.d.ts @@ -1,433 +1,312 @@ +import { Client as Client_2 } from 'pg'; +import { ClientBase } from 'pg'; +import { Connection } from 'pg'; +import { DatabaseError } from 'pg'; +import { defaults } from 'pg'; +import { EventEmitter } from 'events'; +import { Pool as Pool_2 } from 'pg'; +import { Query } from 'pg'; +import type * as subtls from 'subtls'; +import { types } from 'pg'; -// @neondatabase/serverless driver types, mimicking pg - -export { - BindConfig, ClientConfig, Connection, ConnectionConfig, CustomTypesConfig, Defaults, defaults, Events, ExecuteConfig, FieldDef, MessageConfig, native, Notification, PoolConfig, Query, QueryArrayConfig, QueryArrayResult, QueryConfig, QueryParse, QueryResult, QueryResultBase, - QueryResultRow, ResultBuilder, Submittable, types -} from "pg"; -export { DatabaseError } from "pg-protocol"; - -interface FetchEndpointOptions { - jwtAuth?: boolean; -} - -export interface NeonConfigGlobalOnly { - /** - * Set `fetchEndpoint` to set the server endpoint to be sent queries via http - * fetch. May be useful in local development (e.g. to set a port that's not - * the default 443). - * - * Provide either the full endpoint URL, or a function that takes the - * database host address and port and returns the full endpoint URL - * (including protocol). - * - * Default: `host => 'https://' + host + '/sql'` - * - */ - fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); - - /** - * **Experimentally**, when `poolQueryViaFetch` is `true`, and no listeners - * for the `"connect"`, `"acquire"`, `"release"` or `"remove"` events are set - * on the `Pool`, queries via `Pool.query()` will be sent by low-latency HTTP - * fetch request. - * - * Default: `false`. - */ - poolQueryViaFetch: boolean; - - /** - * **DEPRECATED**. Previously, only when `fetchConnectionCache` was `true` - * did queries carried via HTTP fetch make use of a connection pool/cache - * on the server. All queries now use the connection pool/cache: this setting - * is ignored. - * - * Default: `true`. - */ - fetchConnectionCache: boolean; - - /** - * The `fetchFunction` option allows you to supply an alternative function - * for making http requests. The function must accept the same arguments as - * native `fetch`. - * - * Default: `undefined`. - */ - fetchFunction: any; +/** + * We export the pg library mostly unchanged, but we do make a few tweaks. + * + * (1) Connecting and querying can require a lot of network round-trips. We + * add a pipelining option for the connection (startup + auth + first query), + * but this works with cleartext password auth only. We can also pipeline TLS + * startup, but currently this works only with Neon hosts (not vanilla pg or + * pgbouncer). + * + * (2) SCRAM auth is deliberately CPU-intensive, and this is not appropriate + * for a serverless environment. In case it is still used, however, we replace + * the standard (synchronous) pg implementation with one that uses SubtleCrypto + * for repeated SHA-256 digests. This saves some time and CPU. + * + * (3) We now (experimentally) redirect Pool.query over a fetch request if the + * circumstances are right. + */ +export declare interface Client { + connection: Connection & { + stream: neonConfig; + sendSCRAMClientFinalMessage: (response: any) => void; + ssl: any; + }; + _handleReadyForQuery: any; + _handleAuthCleartextPassword: any; + startup: any; + getStartupConf: any; + saslSession: any; } -export interface NeonConfigGlobalAndClient { - /** - * If no global `WebSocket` object is available, set `webSocketConstructor` - * to the constructor for a custom WebSocket implementation, such as those - * provided by `ws` or `undici`. - */ - webSocketConstructor: any; - - /** - * Set `wsProxy` to use your own WebSocket proxy server. - * - * Provide either the proxy server’s domain name, or a function that takes - * the database host and port and returns the proxy server address (without - * protocol). - * - * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` - * - * Default: `host => host + '/v2'` - */ - wsProxy: string | ((host: string, port: number | string) => string) | undefined; - - /** - * Use a secure (`wss:`) connection to the WebSocket proxy. - * - * Default: `true`. - */ - useSecureWebSocket: boolean; - - /** - * Disable TLS encryption in the Postgres protocol (as set via e.g. - * `?sslmode=require` in the connection string). Connection remains secure - * if `useSecureWebSocket` is `true`. - * - * Default: `true` - */ - forceDisablePgSSL: boolean; - - /** - * Pipelines the startup message, cleartext password message and first query - * when set to `"password"`. This works only for cleartext password auth. - * - * Default: `"password"`. - */ - pipelineConnect: "password" | false; - - /** - * If `forceDisablePgSSL` is `false` and the Postgres connection parameters - * specify TLS, you must supply the subtls TLS library to this option: - * - * ``` - * import { neonConfig } from '@neondatabase/serverless'; - * import * as subtls from 'subtls'; - * neonConfig.subtls = subtls; - * ``` - * - * Default: `undefined`. - */ - subtls: any; - - /** - * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is - * `false` and the Postgres connection parameters specify TLS. Currently - * compatible only with Neon hosts. - * - * Default: `false`. - */ - pipelineTLS: boolean; - - /** - * Set `rootCerts` to a string comprising one or more PEM files. These are - * the trusted root certificates for a TLS connection to Postgres when - * `forceDisablePgSSL` is `false` and the Postgres connection parameters - * specify TLS. - * - * Default: `""`. - */ - rootCerts: string; - - /** - * Batch multiple network writes per run-loop into a single outgoing - * WebSocket message. - * - * Default: `true`. - */ - coalesceWrites: boolean; - - /** - * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the - * Postgres connection parameters specify TLS, we send no SNI data in the - * Postgres TLS handshake. - * - * On Neon, disabling SNI and including the Neon project name in the password - * avoids CPU-intensive SCRAM authentication, but this is only relevant for - * earlier iterations of Neon's WebSocket support. - * - * Default: `false`. - */ - disableSNI: boolean; +export declare class Client extends Client_2 { + config: any; + get neonConfig(): NeonConfigGlobalAndClient; + constructor(config: any); + connect(): Promise; + connect(callback: (err?: Error) => void): void; + _handleAuthSASLContinue(msg: any): Promise; } -export interface NeonConfig extends NeonConfigGlobalOnly, NeonConfigGlobalAndClient { } +export { ClientBase } -import { - Client as PgClient, - ClientBase as PgClientBase, - Pool as PgPool, - PoolClient as PgPoolClient, - types as PgTypes -} from "pg"; +export { Connection } -export class ClientBase extends PgClientBase { - neonConfig: NeonConfigGlobalAndClient; -} +export { DatabaseError } -export class Client extends PgClient { - neonConfig: NeonConfigGlobalAndClient; -} +export { defaults } -export interface PoolClient extends PgPoolClient { - neonConfig: NeonConfigGlobalAndClient; +declare interface FetchEndpointOptions { + jwtAuth?: boolean; } -export class Pool extends PgPool { - connect(): Promise; - connect(callback: (err: Error, client: PoolClient, done: (release?: any) => void) => void): void; - on(event: 'error', listener: (err: Error, client: PoolClient) => void): this; - on(event: 'connect' | 'acquire' | 'remove', listener: (client: PoolClient) => void): this; +declare interface HTTPQueryOptions { + arrayMode?: boolean; + fullResults?: boolean; + fetchOptions?: Record; + types?: typeof types; + queryCallback?: (query: ParameterizedQuery) => void; + resultCallback?: (query: ParameterizedQuery, result: any, rows: any, opts: any) => void; + authToken?: string | (() => Promise | string); } -export const neonConfig: NeonConfig; - - -// SQL-over-HTTP - -import { FieldDef } from "pg"; - -export type QueryRows = - ArrayMode extends true ? any[][] : Record[]; - -export interface FullQueryResults { - fields: FieldDef[]; - command: string; - rowCount: number; - rows: QueryRows; - rowAsArray: ArrayMode; +declare interface HTTPTransactionOptions extends HTTPQueryOptions { + isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; + readOnly?: boolean; + deferrable?: boolean; } -export interface ParameterizedQuery { - query: string; - params: any[]; +export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { + (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; + transaction(queries: NeonQueryPromise[] | ((sql: /*elided*/ any) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; +}; + +export declare class neonConfig extends EventEmitter { + static defaults: SocketDefaults; + static opts: Partial; + private opts; + static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; + static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); + static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; + static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); + static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); + static get fetchFunction(): SocketDefaults["fetchFunction"]; + static set fetchFunction(newValue: SocketDefaults['fetchFunction']); + static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + static get wsProxy(): SocketDefaults["wsProxy"]; + static set wsProxy(newValue: SocketDefaults['wsProxy']); + get wsProxy(): SocketDefaults["wsProxy"]; + set wsProxy(newValue: SocketDefaults['wsProxy']); + static get coalesceWrites(): SocketDefaults["coalesceWrites"]; + static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + get coalesceWrites(): SocketDefaults["coalesceWrites"]; + set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + static get disableSNI(): SocketDefaults["disableSNI"]; + static set disableSNI(newValue: SocketDefaults['disableSNI']); + get disableSNI(): SocketDefaults["disableSNI"]; + set disableSNI(newValue: SocketDefaults['disableSNI']); + static get pipelineConnect(): SocketDefaults["pipelineConnect"]; + static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + get pipelineConnect(): SocketDefaults["pipelineConnect"]; + set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + static get subtls(): SocketDefaults["subtls"]; + static set subtls(newValue: SocketDefaults['subtls']); + get subtls(): SocketDefaults["subtls"]; + set subtls(newValue: SocketDefaults['subtls']); + static get pipelineTLS(): SocketDefaults["pipelineTLS"]; + static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + get pipelineTLS(): SocketDefaults["pipelineTLS"]; + set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + static get rootCerts(): SocketDefaults["rootCerts"]; + static set rootCerts(newValue: SocketDefaults['rootCerts']); + get rootCerts(): SocketDefaults["rootCerts"]; + set rootCerts(newValue: SocketDefaults['rootCerts']); + wsProxyAddrForHost(host: string, port: number): string; + connecting: boolean; + pending: boolean; + writable: boolean; + encrypted: boolean; + authorized: boolean; + destroyed: boolean; + private ws; + private writeBuffer; + private tlsState; + private tlsRead; + private tlsWrite; + setNoDelay(): this; + setKeepAlive(): this; + ref(): this; + unref(): this; + connect(port: number | string, host: string, connectListener?: () => void): void; + startTls(host: string): Promise; + tlsReadLoop(): Promise; + rawWrite(data: Uint8Array): void; + write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; + end(data?: Buffer | string, encoding?: string, callback?: () => void): this; + destroy(): this; } -export interface HTTPQueryOptions { - /** - * When `arrayMode` is `false`, which is the default, result rows are - * returned as objects whose keys represent column names, such as - * `{ id: 1 }`). - * - * When `arrayMode` is `true`, rows are returned as arrays (and keys are not - * provided), e.g. `[1]`. - */ - arrayMode?: ArrayMode; - /** - * When `fullResults` is `false`, which is the default, only result rows are - * returned, e.g. `[{ id: 1 }]`). - * - * When `fullResults` is `true`, a result object is returned that matches - * what's returned by node-postgres. This has a `rows` property, which is an - * array of result rows, plus `fields`, which provides column names and - * types, `command` and `rowCount`. - */ - fullResults?: FullResults; // default false - /** - * Any options in `fetchOptions` are merged in to the options passed to - * `fetch`. In case of conflict with what would otherwise be passed, these - * options take precedence. - */ - fetchOptions?: Record; - - /** - * JWT auth token to be passed as the Bearer token in the Authorization header - * - * Default: `undefined` - */ - authToken?: string | (() => Promise | string); - - /** - * Custom type parsers - * See https://github.com/brianc/node-pg-types - */ - types?: typeof PgTypes; +declare interface NeonConfigGlobalAndClient { + /** + * If no global `WebSocket` object is available, set `webSocketConstructor` + * to the constructor for a custom WebSocket implementation, such as those + * provided by `ws` or `undici`. + */ + webSocketConstructor: any; + /** + * Set `wsProxy` to use your own WebSocket proxy server. + * + * Provide either the proxy server’s domain name, or a function that takes + * the database host and port and returns the proxy server address (without + * protocol). + * + * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` + * + * Default: `host => host + '/v2'` + */ + wsProxy: string | ((host: string, port: number | string) => string) | undefined; + /** + * Use a secure (`wss:`) connection to the WebSocket proxy. + * + * Default: `true`. + */ + useSecureWebSocket: boolean; + /** + * Disable TLS encryption in the Postgres protocol (as set via e.g. + * `?sslmode=require` in the connection string). Connection remains secure + * if `useSecureWebSocket` is `true`. + * + * Default: `true` + */ + forceDisablePgSSL: boolean; + /** + * Pipelines the startup message, cleartext password message and first query + * when set to `"password"`. This works only for cleartext password auth. + * + * Default: `"password"`. + */ + pipelineConnect: 'password' | false; + /** + * If `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS, you must supply the subtls TLS library to this option: + * + * ``` + * import { neonConfig } from '@neondatabase/serverless'; + * import * as subtls from 'subtls'; + * neonConfig.subtls = subtls; + * ``` + * + * Default: `undefined`. + */ + subtls: any; + /** + * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is + * `false` and the Postgres connection parameters specify TLS. Currently + * compatible only with Neon hosts. + * + * Default: `false`. + */ + pipelineTLS: boolean; + /** + * Set `rootCerts` to a string comprising one or more PEM files. These are + * the trusted root certificates for a TLS connection to Postgres when + * `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS. + * + * Default: `""`. + */ + rootCerts: string; + /** + * Batch multiple network writes per run-loop into a single outgoing + * WebSocket message. + * + * Default: `true`. + */ + coalesceWrites: boolean; + /** + * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the + * Postgres connection parameters specify TLS, we send no SNI data in the + * Postgres TLS handshake. + * + * On Neon, disabling SNI and including the Neon project name in the password + * avoids CPU-intensive SCRAM authentication, but this is only relevant for + * earlier iterations of Neon's WebSocket support. + * + * Default: `false`. + */ + disableSNI: boolean; } -export interface HTTPTransactionOptions extends HTTPQueryOptions { - /** - * Postgres transaction isolation level: see https://www.postgresql.org/docs/current/transaction-iso.html. - * Note that `ReadUncommitted` actually gets you `ReadCommitted` in Postgres. - * */ - isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; - /** - * When `readOnly` is `false`, which is the default, a `READ WRITE` Postgres - * transaction is used. - * - * When `readOnly` is `true`, a `READ ONLY` Postgres transaction is used. - * */ - readOnly?: boolean; - /** - * When `deferrable` is `false`, which is the default, a `NOT DEFERRABLE` - * Postgres transaction is used. - * - * When `deferrable` is `true` (and `isolationLevel` is `Serializable` and - * `readOnly` is `true`), a `DEFERRABLE` Postgres transaction is used. - * */ - deferrable?: boolean; +export declare class NeonDbError extends Error { + name: "NeonDbError"; + severity: string | undefined; + code: string | undefined; + detail: string | undefined; + hint: string | undefined; + position: string | undefined; + internalPosition: string | undefined; + internalQuery: string | undefined; + where: string | undefined; + schema: string | undefined; + table: string | undefined; + column: string | undefined; + dataType: string | undefined; + constraint: string | undefined; + file: string | undefined; + line: string | undefined; + routine: string | undefined; + sourceError: Error | undefined; + constructor(message: string); } -export interface NeonQueryPromise extends Promise { - parameterizedQuery: ParameterizedQuery; - opts?: HTTPQueryOptions; +declare interface NeonQueryPromise extends Promise { + parameterizedQuery: ParameterizedQuery; + opts?: HTTPQueryOptions; } -export interface NeonQueryInTransaction { - // this is a simplified form of query, which has only a `parameterizedQuery` (no `opts` and not a `Promise`) - parameterizedQuery: ParameterizedQuery; +declare interface ParameterizedQuery { + query: string; + params: any[]; } -export interface NeonQueryFunctionInTransaction { - // this is a simplified form of NeonQueryFunction (below): - // * `opts` cannot be passed - // * no `transaction()` method is available - - // tagged-template function usage - (strings: TemplateStringsArray, ...params: any[]): - NeonQueryPromise : QueryRows>; - - // ordinary function usage (*no* options overrides) - (string: string, params?: any[]): - NeonQueryPromise : QueryRows>; +export declare class Pool extends Pool_2 { + Client: typeof Client; + hasFetchUnsupportedListeners: boolean; + on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + query(config?: any, values?: any, cb?: any): any; } -export interface NeonQueryFunction { - // tagged-template function usage - (strings: TemplateStringsArray, ...params: any[]): - NeonQueryPromise : QueryRows>; - - // ordinary function usage, with options overrides - ( - string: string, - params?: any[], - opts?: HTTPQueryOptions - ): NeonQueryPromise< - ArrayModeOverride, - FullResultsOverride, - FullResultsOverride extends true ? FullQueryResults : QueryRows - >; - - /** - * The `transaction()` function allows multiple queries to be submitted (over - * HTTP) as a single, non-interactive Postgres transaction. - * - * For example: - * ``` - * import { neon } from "@neondatabase/serverless"; - * const sql = neon("postgres://user:pass@host/db"); - * - * const results = await sql.transaction([ - * sql`SELECT 1 AS num`, - * sql`SELECT 'a' AS str`, - * ]); - * // -> [[{ num: 1 }], [{ str: "a" }]] - * - * // or equivalently: - * const results = await sql.transaction(txn => [ - * txn`SELECT 1 AS num`, - * txn`SELECT 'a' AS str`, - * ]); - * // -> [[{ num: 1 }], [{ str: "a" }]] - * ``` - * @param queriesOrFn Either an array of queries, or a (non-`async`) function - * that receives a query function and returns an array of queries. - * @param opts The same options that may be set on individual queries in a - * non-transaction setting -- that is, `arrayMode` `fullResults` and - * `fetchOptions` -- plus the transaction options `isolationLevel`, - * `readOnly` and `deferrable`. Note that none of these options can be set on - * individual queries within a transaction. - * @returns An array of results. The structure of each result object depends - * on the `arrayMode` and `fullResults` options. - */ - transaction: ( - queriesOrFn: NeonQueryPromise[] | // not ArrayModeOverride or FullResultsOverride: clamp these values to the current ones - ((sql: NeonQueryFunctionInTransaction) => NeonQueryInTransaction[]), - opts?: HTTPTransactionOptions - ) => Promise[] : QueryRows[]>; +export { Query } + +declare interface SocketDefaults { + poolQueryViaFetch: boolean; + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchConnectionCache: boolean; + fetchFunction: any; + webSocketConstructor: typeof WebSocket | undefined; + wsProxy: string | ((host: string, port: number | string) => string); + useSecureWebSocket: boolean; + forceDisablePgSSL: boolean; + coalesceWrites: boolean; + pipelineConnect: 'password' | false; + subtls: typeof subtls | undefined; + rootCerts: string; + pipelineTLS: boolean; + disableSNI: boolean; } -/** - * This function returns an async tagged-template function that runs a single - * SQL query (no session or transactions) with low latency over https. Support - * for multiple queries as a non-interactive transaction is provided by - * the `transaction` property of the query function. - * - * By default, the query function returns database rows directly. Types should - * match those returned by this driver (i.e. Pool or Client) over WebSockets. - * - * The returned function can also be called directly (i.e. not as a template - * function). In that case, pass it a query string with embedded `$1`, `$2` - * (etc.), followed by an array of query parameters, followed (optionally) by - * any of the same options you can pass to this function. - * - * Some examples: - * ``` - * import { neon } from "@neondatabase/serverless"; - * const h = "hello", w = "world"; - * - * // example 1: default options, tagged-template usage - * const sql = neon("postgres://user:pass@host/db"); - * const rows = await sql`SELECT ${h} || ' ' || ${w} AS greeting`; - * // -> [ { greeting: "hello world" } ] - * - * // example 2: `arrayMode` and `fullResults` options, ordinary function usage - * const options = { arrayMode: true, fullResults: true }; - * const sql = neon("postgres://user:pass@host/db", options); - * const rows = await sql("SELECT $1 || ' ' || $2 AS greeting", [h, w]); - * // -> { - * // command: "SELECT", - * // fields: [ { name: "greeting", dataTypeID: 25 } ], - * // rowAsArray: true, - * // rowCount: 1, - * // rows: [ [ "hello world" ] ] - * // } - * - * // example 3: `fetchOptions` option, ordinary function usage - * const sql = neon("postgres://user:pass@host/db"); - * const rows = await sql( - * "SELECT $1 || ' ' || $2 AS greeting", [h, w], - * { fetchOptions: { priority: "high" } } - * ); - * // -> [ { greeting: "hello world" } ] - * ``` - * - * @param connectionString this has the format `postgres://user:pass@host/db` - * @param options pass `arrayMode: true` to receive results as an array of - * arrays, instead of the default array of objects; pass `fullResults: true` - * to receive a complete result object similar to one returned by node-postgres - * (with properties `rows`, `fields`, `command`, `rowCount`, `rowAsArray`); - * pass as `fetchOptions` an object which will be merged into the options - * passed to `fetch`. - */ -export function neon( - connectionString: string, - options?: HTTPTransactionOptions, -): NeonQueryFunction; - -export class NeonDbError extends Error { - name: 'NeonDbError'; +export { types } - severity: string | undefined; - code: string | undefined; - detail: string | undefined; - hint: string | undefined; - position: string | undefined; - internalPosition: string | undefined; - internalQuery: string | undefined; - where: string | undefined; - schema: string | undefined; - table: string | undefined; - column: string | undefined; - dataType: string | undefined; - constraint: string | undefined; - file: string | undefined; - line: string | undefined; - routine: string | undefined; - - sourceError: Error | undefined; -} +export { } diff --git a/dist/npm/package.json b/dist/npm/package.json index 856deee..d8f3cad 100644 --- a/dist/npm/package.json +++ b/dist/npm/package.json @@ -29,7 +29,9 @@ "WebSocket", "https" ], - "dependencies": { - "@types/pg": "8.11.6" + "devDependencies": { + "@types/pg": "^22.10.2", + "subtls": "^0.3.3", + "events": "^3.3.0" } } diff --git a/export/httpQuery.ts b/export/httpQuery.ts index e8c1465..1e05735 100644 --- a/export/httpQuery.ts +++ b/export/httpQuery.ts @@ -41,10 +41,7 @@ export class NeonDbError extends Error { constructor(message: string) { super(message); - if ( - 'captureStackTrace' in Error && - typeof Error.captureStackTrace === 'function' - ) { + if ('captureStackTrace' in Error && typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, NeonDbError); } } @@ -63,12 +60,7 @@ interface HTTPQueryOptions { // these callback options are not currently exported: queryCallback?: (query: ParameterizedQuery) => void; - resultCallback?: ( - query: ParameterizedQuery, - result: any, - rows: any, - opts: any, - ) => void; + resultCallback?: (query: ParameterizedQuery, result: any, rows: any, opts: any) => void; // JWT auth token to be passed as the Bearer token in the Authorization // header @@ -77,11 +69,7 @@ interface HTTPQueryOptions { interface HTTPTransactionOptions extends HTTPQueryOptions { // note that ReadUncommitted is really ReadCommitted in Postgres: https://www.postgresql.org/docs/current/transaction-iso.html - isolationLevel?: - | 'ReadUncommitted' - | 'ReadCommitted' - | 'RepeatableRead' - | 'Serializable'; + isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; readOnly?: boolean; deferrable?: boolean; } @@ -99,8 +87,7 @@ interface ProcessQueryResultOptions { types?: typeof defaultTypes; } -const txnArgErrMsg = - 'transaction() expects an array of queries, or a function returning an array of queries'; +const txnArgErrMsg = 'transaction() expects an array of queries, or a function returning an array of queries'; const errorFields = [ 'severity', 'code', @@ -170,22 +157,14 @@ export function neon( } const { protocol, username, hostname, port, pathname } = db; - if ( - (protocol !== 'postgres:' && protocol !== 'postgresql:') || - !username || - !hostname || - !pathname - ) { + if ((protocol !== 'postgres:' && protocol !== 'postgresql:') || !username || !hostname || !pathname) { throw new Error( 'Database connection string format for `neon()` should be: postgresql://user:password@host.tld/dbname?option=value', ); } // resolve query, params and opts - function resolve( - strings: TemplateStringsArray | string, - ...params: any[] - ): NeonQueryPromise { + function resolve(strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise { let query; let queryOpts: HTTPQueryOptions | undefined; @@ -222,13 +201,10 @@ export function neon( if (!Array.isArray(queries)) throw new Error(txnArgErrMsg); queries.forEach((query) => { - if (query[Symbol.toStringTag] !== 'NeonQueryPromise') - throw new Error(txnArgErrMsg); + if (query[Symbol.toStringTag] !== 'NeonQueryPromise') throw new Error(txnArgErrMsg); }); - const parameterizedQueries = queries.map( - (query) => (query as NeonQueryPromise).parameterizedQuery, - ); + const parameterizedQueries = queries.map((query) => (query as NeonQueryPromise).parameterizedQuery); const opts = queries.map((query) => (query as NeonQueryPromise).opts ?? {}); return execute(parameterizedQueries, opts, txnOpts); }; @@ -241,9 +217,7 @@ export function neon( ) { const { fetchEndpoint, fetchFunction } = Socket; - const bodyData = Array.isArray(parameterizedQuery) - ? { queries: parameterizedQuery } - : parameterizedQuery; + const bodyData = Array.isArray(parameterizedQuery) ? { queries: parameterizedQuery } : parameterizedQuery; // --- resolve options to transaction level --- @@ -261,23 +235,15 @@ export function neon( ...resolvedFetchOptions, ...txnOpts.fetchOptions, }; - if (txnOpts.arrayMode !== undefined) - resolvedArrayMode = txnOpts.arrayMode; - if (txnOpts.fullResults !== undefined) - resolvedFullResults = txnOpts.fullResults; - if (txnOpts.isolationLevel !== undefined) - resolvedIsolationLevel = txnOpts.isolationLevel; + if (txnOpts.arrayMode !== undefined) resolvedArrayMode = txnOpts.arrayMode; + if (txnOpts.fullResults !== undefined) resolvedFullResults = txnOpts.fullResults; + if (txnOpts.isolationLevel !== undefined) resolvedIsolationLevel = txnOpts.isolationLevel; if (txnOpts.readOnly !== undefined) resolvedReadOnly = txnOpts.readOnly; - if (txnOpts.deferrable !== undefined) - resolvedDeferrable = txnOpts.deferrable; + if (txnOpts.deferrable !== undefined) resolvedDeferrable = txnOpts.deferrable; } // single query -- cannot be true at same time as `txnOpts !== undefined` above - if ( - allSqlOpts !== undefined && - !Array.isArray(allSqlOpts) && - allSqlOpts.fetchOptions !== undefined - ) { + if (allSqlOpts !== undefined && !Array.isArray(allSqlOpts) && allSqlOpts.fetchOptions !== undefined) { resolvedFetchOptions = { ...resolvedFetchOptions, ...allSqlOpts.fetchOptions, @@ -315,10 +281,8 @@ export function neon( // only send these headers for batch queries, where they matter if (resolvedIsolationLevel !== undefined) headers['Neon-Batch-Isolation-Level'] = resolvedIsolationLevel; - if (resolvedReadOnly !== undefined) - headers['Neon-Batch-Read-Only'] = String(resolvedReadOnly); - if (resolvedDeferrable !== undefined) - headers['Neon-Batch-Deferrable'] = String(resolvedDeferrable); + if (resolvedReadOnly !== undefined) headers['Neon-Batch-Read-Only'] = String(resolvedReadOnly); + if (resolvedDeferrable !== undefined) headers['Neon-Batch-Deferrable'] = String(resolvedDeferrable); } // --- run query --- @@ -332,9 +296,7 @@ export function neon( ...resolvedFetchOptions, // this is last, so it gets the final say }); } catch (err: any) { - const connectErr = new NeonDbError( - `Error connecting to database: ${err}`, - ); + const connectErr = new NeonDbError(`Error connecting to database: ${err}`); connectErr.sourceError = err; throw connectErr; } @@ -346,9 +308,7 @@ export function neon( // batch query const resultArray = rawResults.results; if (!Array.isArray(resultArray)) - throw new NeonDbError( - 'Neon internal error: unexpected result format', - ); + throw new NeonDbError('Neon internal error: unexpected result format'); return resultArray.map((result, i) => { let sqlOpts = (allSqlOpts as HTTPQueryOptions[])[i] ?? {}; let arrayMode = sqlOpts.arrayMode ?? resolvedArrayMode; @@ -379,8 +339,7 @@ export function neon( if (status === 400) { const json = (await response.json()) as any; const dbError = new NeonDbError(json.message); - for (const field of errorFields) - dbError[field] = json[field] ?? undefined; + for (const field of errorFields) dbError[field] = json[field] ?? undefined; throw dbError; } else { const text = await response.text(); @@ -401,11 +360,9 @@ function createNeonQueryPromise( [Symbol.toStringTag]: 'NeonQueryPromise', parameterizedQuery, opts, - then: (resolve, reject) => - execute(parameterizedQuery, opts).then(resolve, reject), + then: (resolve, reject) => execute(parameterizedQuery, opts).then(resolve, reject), catch: (reject) => execute(parameterizedQuery, opts).catch(reject), - finally: (finallyFn) => - execute(parameterizedQuery, opts).finally(finallyFn), + finally: (finallyFn) => execute(parameterizedQuery, opts).finally(finallyFn), } as NeonQueryPromise; } @@ -421,26 +378,19 @@ function processQueryResult( ) { const types = new TypeOverrides(customTypes); const colNames = rawResults.fields.map((field: any) => field.name); - const parsers = rawResults.fields.map((field: any) => - types.getTypeParser(field.dataTypeID), - ); + const parsers = rawResults.fields.map((field: any) => types.getTypeParser(field.dataTypeID)); // now parse and possibly restructure the rows data like node-postgres does const rows = arrayMode === true ? // maintain array-of-arrays structure rawResults.rows.map((row: any) => - row.map((col: any, i: number) => - col === null ? null : parsers[i](col), - ), + row.map((col: any, i: number) => (col === null ? null : parsers[i](col))), ) : // turn into an object rawResults.rows.map((row: any) => { return Object.fromEntries( - row.map((col: any, i: number) => [ - colNames[i], - col === null ? null : parsers[i](col), - ]), + row.map((col: any, i: number) => [colNames[i], col === null ? null : parsers[i](col)]), ); }); diff --git a/export/index.ts b/export/index.ts index ea9ea98..f0b2e63 100644 --- a/export/index.ts +++ b/export/index.ts @@ -117,9 +117,7 @@ class NeonClient extends Client { con.removeAllListeners('authenticationCleartextPassword'); con.removeAllListeners('readyForQuery'); - con.once('readyForQuery', () => - con.on('readyForQuery', this._handleReadyForQuery.bind(this)), - ); + con.once('readyForQuery', () => con.on('readyForQuery', this._handleReadyForQuery.bind(this))); const connectEvent = this.ssl ? 'sslconnect' : 'connect'; con.on(connectEvent, () => { @@ -145,8 +143,7 @@ class NeonClient extends Client { const attrPairs = Object.fromEntries( serverData.split(',').map((attrValue) => { - if (!/^.=/.test(attrValue)) - throw new Error('SASL: Invalid attribute pair entry'); + if (!/^.=/.test(attrValue)) throw new Error('SASL: Invalid attribute pair entry'); const name = attrValue[0]; const value = attrValue.substring(2); return [name, value]; @@ -158,30 +155,15 @@ class NeonClient extends Client { const iterationText = attrPairs.i; if (!nonce || !/^[!-+--~]+$/.test(nonce)) - throw new Error( - 'SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable', - ); - if ( - !salt || - !/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test( - salt, - ) - ) - throw new Error( - 'SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base64', - ); + throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable'); + if (!salt || !/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(salt)) + throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base64'); if (!iterationText || !/^[1-9][0-9]*$/.test(iterationText)) - throw new Error( - 'SASL: SCRAM-SERVER-FIRST-MESSAGE: missing/invalid iteration count', - ); + throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: missing/invalid iteration count'); if (!nonce.startsWith(session.clientNonce)) - throw new Error( - 'SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce', - ); + throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce'); if (nonce.length === session.clientNonce.length) - throw new Error( - 'SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short', - ); + throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short'); const iterations = parseInt(iterationText, 10); const saltBytes = Buffer.from(salt, 'base64'); @@ -195,11 +177,7 @@ class NeonClient extends Client { ['sign'], ); let ui1 = new Uint8Array( - await crypto.subtle.sign( - 'HMAC', - iterHmacKey, - Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])]), - ), + await crypto.subtle.sign('HMAC', iterHmacKey, Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])])), ); let ui = ui1; for (var i = 0; i < iterations - 1; i++) { @@ -215,20 +193,14 @@ class NeonClient extends Client { false, ['sign'], ); - const clientKey = new Uint8Array( - await crypto.subtle.sign('HMAC', ckHmacKey, enc.encode('Client Key')), - ); + const clientKey = new Uint8Array(await crypto.subtle.sign('HMAC', ckHmacKey, enc.encode('Client Key'))); const storedKey = await crypto.subtle.digest('SHA-256', clientKey); const clientFirstMessageBare = 'n=*,r=' + session.clientNonce; const serverFirstMessage = 'r=' + nonce + ',s=' + salt + ',i=' + iterations; const clientFinalMessageWithoutProof = 'c=biws,r=' + nonce; const authMessage = - clientFirstMessageBare + - ',' + - serverFirstMessage + - ',' + - clientFinalMessageWithoutProof; + clientFirstMessageBare + ',' + serverFirstMessage + ',' + clientFinalMessageWithoutProof; const csHmacKey = await crypto.subtle.importKey( 'raw', @@ -240,9 +212,7 @@ class NeonClient extends Client { var clientSignature = new Uint8Array( await crypto.subtle.sign('HMAC', csHmacKey, enc.encode(authMessage)), ); - var clientProofBytes = Buffer.from( - clientKey.map((_, i) => clientKey[i] ^ clientSignature[i]), - ); + var clientProofBytes = Buffer.from(clientKey.map((_, i) => clientKey[i] ^ clientSignature[i])); var clientProof = clientProofBytes.toString('base64'); const skHmacKey = await crypto.subtle.importKey( @@ -252,11 +222,7 @@ class NeonClient extends Client { false, ['sign'], ); - const serverKey = await crypto.subtle.sign( - 'HMAC', - skHmacKey, - enc.encode('Server Key'), - ); + const serverKey = await crypto.subtle.sign('HMAC', skHmacKey, enc.encode('Server Key')); const ssbHmacKey = await crypto.subtle.importKey( 'raw', serverKey, @@ -294,10 +260,7 @@ class NeonPool extends Pool { Client = NeonClient; hasFetchUnsupportedListeners = false; - on( - event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', - listener: any, - ) { + on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any) { if (event !== 'error') this.hasFetchUnsupportedListeners = true; return super.on(event as any, listener); } @@ -350,19 +313,6 @@ class NeonPool extends Pool { } } -export { - Socket as neonConfig, - NeonPool as Pool, - NeonClient as Client, - neon, - NeonDbError, -}; - -export { - Connection, - DatabaseError, - Query, - ClientBase, - defaults, - types, -} from 'pg'; +export { Socket as neonConfig, NeonPool as Pool, NeonClient as Client, neon, NeonDbError }; + +export { Connection, DatabaseError, Query, ClientBase, defaults, types } from 'pg'; diff --git a/export/neonConfig.ts b/export/neonConfig.ts index 9dc40cc..9c3ed4d 100644 --- a/export/neonConfig.ts +++ b/export/neonConfig.ts @@ -60,10 +60,7 @@ export interface NeonConfigGlobalAndClient { * * Default: `host => host + '/v2'` */ - wsProxy: - | string - | ((host: string, port: number | string) => string) - | undefined; + wsProxy: string | ((host: string, port: number | string) => string) | undefined; /** * Use a secure (`wss:`) connection to the WebSocket proxy. @@ -144,6 +141,4 @@ export interface NeonConfigGlobalAndClient { disableSNI: boolean; } -export interface NeonConfig - extends NeonConfigGlobalOnly, - NeonConfigGlobalAndClient {} +export interface NeonConfig extends NeonConfigGlobalOnly, NeonConfigGlobalAndClient {} diff --git a/package-lock.json b/package-lock.json index 6a191e6..b2dc6c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,20 +25,21 @@ "stream": "file:shims/stream", "string_decoder": "file:shims/string_decoder", "tls": "file:shims/tls", - "undici": "^6.0.1", + "undici": "^7.1.0", "url": "file:shims/url", "util": "file:shims/util", "ws": "^8.12.1" }, "devDependencies": { - "@cloudflare/workers-types": "^4.20230115.0", + "@microsoft/api-extractor": "^7.48.1", "@types/events": "^3.0.0", "@types/pg": "^8.6.5", "@types/ws": "^8.5.4", "dotenv": "^16.0.3", + "dts-bundle-generator": "^9.5.1", "esbuild": "^0.24.0", "fast-equals": "^5.0.1", - "subtls": "^0.3.0", + "subtls": "^0.3.3", "typescript": "^5.0.4", "vitest": "^2.1.6", "wrangler": "^3.0.1" @@ -58,9 +59,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20241106.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241106.1.tgz", - "integrity": "sha512-zxvaToi1m0qzAScrxFt7UvFVqU8DxrCO2CinM1yQkv5no7pA1HolpIrwZ0xOhR3ny64Is2s/J6BrRjpO5dM9Zw==", + "version": "1.20241205.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241205.0.tgz", + "integrity": "sha512-TArEZkSZkHJyEwnlWWkSpCI99cF6lJ14OVeEoI9Um/+cD9CKZLM9vCmsLeKglKheJ0KcdCnkA+DbeD15t3VaWg==", "cpu": [ "x64" ], @@ -75,9 +76,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20241106.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241106.1.tgz", - "integrity": "sha512-j3dg/42D/bPgfNP3cRUBxF+4waCKO/5YKwXNj+lnVOwHxDu+ne5pFw9TIkKYcWTcwn0ZUkbNZNM5rhJqRn4xbg==", + "version": "1.20241205.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241205.0.tgz", + "integrity": "sha512-u5eqKa9QRdA8MugfgCoD+ADDjY6EpKbv3hSYJETmmUh17l7WXjWBzv4pUvOKIX67C0UzMUy4jZYwC53MymhX3w==", "cpu": [ "arm64" ], @@ -92,9 +93,9 @@ } }, "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20241106.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241106.1.tgz", - "integrity": "sha512-Ih+Ye8E1DMBXcKrJktGfGztFqHKaX1CeByqshmTbODnWKHt6O65ax3oTecUwyC0+abuyraOpAtdhHNpFMhUkmw==", + "version": "1.20241205.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241205.0.tgz", + "integrity": "sha512-OYA7S5zpumMamWEW+IhhBU6YojIEocyE5X/YFPiTOCrDE3dsfr9t6oqNE7hxGm1VAAu+Irtl+a/5LwmBOU681w==", "cpu": [ "x64" ], @@ -109,9 +110,9 @@ } }, "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20241106.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241106.1.tgz", - "integrity": "sha512-mdQFPk4+14Yywn7n1xIzI+6olWM8Ybz10R7H3h+rk0XulMumCWUCy1CzIDauOx6GyIcSgKIibYMssVHZR30ObA==", + "version": "1.20241205.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241205.0.tgz", + "integrity": "sha512-qAzecONjFJGIAVJZKExQ5dlbic0f3d4A+GdKa+H6SoUJtPaWiE3K6WuePo4JOT7W3/Zfh25McmX+MmpMUUcM5Q==", "cpu": [ "arm64" ], @@ -126,9 +127,9 @@ } }, "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20241106.1", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241106.1.tgz", - "integrity": "sha512-4rtcss31E/Rb/PeFocZfr+B9i1MdrkhsTBWizh8siNR4KMmkslU2xs2wPaH1z8+ErxkOsHrKRa5EPLh5rIiFeg==", + "version": "1.20241205.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241205.0.tgz", + "integrity": "sha512-BEab+HiUgCdl6GXAT7EI2yaRtDPiRJlB94XLvRvXi1ZcmQqsrq6awGo6apctFo4WUL29V7c09LxmN4HQ3X2Tvg==", "cpu": [ "x64" ], @@ -143,9 +144,9 @@ } }, "node_modules/@cloudflare/workers-shared": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.8.0.tgz", - "integrity": "sha512-1OvFkNtslaMZAJsaocTmbACApgmWv55uLpNj50Pn2MGcxdAjpqykXJFQw5tKc+lGV9TDZh9oO3Rsk17IEQDzIg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.11.0.tgz", + "integrity": "sha512-A+lQ8xp7992qSeMmuQ0ssL6CPmm+ZmAv6Ddikan0n1jjpMAic+97l7xtVIsswSn9iLMFPYQ9uNN/8Fl0AgARIQ==", "dev": true, "license": "MIT OR Apache-2.0", "dependencies": { @@ -156,13 +157,6 @@ "node": ">=16.7.0" } }, - "node_modules/@cloudflare/workers-types": { - "version": "4.20241112.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241112.0.tgz", - "integrity": "sha512-Q4p9bAWZrX14bSCKY9to19xl0KMU7nsO5sJ2cTVspHoypsjPUMeQCsjHjmsO2C4Myo8/LPeDvmqFmkyNAPPYZw==", - "dev": true, - "license": "MIT OR Apache-2.0" - }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -659,10 +653,110 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@microsoft/api-extractor": { + "version": "7.48.1", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.48.1.tgz", + "integrity": "sha512-HN9Osa1WxqLM66RaqB5nPAadx+nTIQmY/XtkFdaJvusjG8Tus++QqZtD7KPZDSkhEMGHsYeSyeU8qUzCDUXPjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@microsoft/api-extractor-model": "7.30.1", + "@microsoft/tsdoc": "~0.15.1", + "@microsoft/tsdoc-config": "~0.17.1", + "@rushstack/node-core-library": "5.10.1", + "@rushstack/rig-package": "0.5.3", + "@rushstack/terminal": "0.14.4", + "@rushstack/ts-command-line": "4.23.2", + "lodash": "~4.17.15", + "minimatch": "~3.0.3", + "resolve": "~1.22.1", + "semver": "~7.5.4", + "source-map": "~0.6.1", + "typescript": "5.4.2" + }, + "bin": { + "api-extractor": "bin/api-extractor" + } + }, + "node_modules/@microsoft/api-extractor-model": { + "version": "7.30.1", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.30.1.tgz", + "integrity": "sha512-CTS2PlASJHxVY8hqHORVb1HdECWOEMcMnM6/kDkPr0RZapAFSIHhg9D4jxuE8g+OWYHtPc10LCpmde5pylTRlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@microsoft/tsdoc": "~0.15.1", + "@microsoft/tsdoc-config": "~0.17.1", + "@rushstack/node-core-library": "5.10.1" + } + }, + "node_modules/@microsoft/api-extractor/node_modules/minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@microsoft/api-extractor/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@microsoft/api-extractor/node_modules/typescript": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/@microsoft/tsdoc": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.15.1.tgz", + "integrity": "sha512-4aErSrCR/On/e5G2hDP0wjooqDdauzEbIq8hIkIe5pXV0rtWJZvdCEKL0ykZxex+IxIwBp0eGeV48hQN07dXtw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@microsoft/tsdoc-config": { + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.17.1.tgz", + "integrity": "sha512-UtjIFe0C6oYgTnad4q1QP4qXwLhe6tIpNTRStJ2RZEPIkqQPREAwE5spzVxsdn9UaEMUqhh0AqSx3X4nWAKXWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@microsoft/tsdoc": "0.15.1", + "ajv": "~8.12.0", + "jju": "~1.4.0", + "resolve": "~1.22.2" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.27.4.tgz", - "integrity": "sha512-2Y3JT6f5MrQkICUyRVCw4oa0sutfAsgaSsb0Lmmy1Wi2y7X5vT9Euqw4gOsCyy0YfKURBg35nhUKZS4mDcfULw==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.28.1.tgz", + "integrity": "sha512-2aZp8AES04KI2dy3Ss6/MDjXbwBzj+i0GqKtWXgw2/Ma6E4jJvujryO6gJAghIRVz7Vwr9Gtl/8na3nDUKpraQ==", "cpu": [ "arm" ], @@ -674,9 +768,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.27.4.tgz", - "integrity": "sha512-wzKRQXISyi9UdCVRqEd0H4cMpzvHYt1f/C3CoIjES6cG++RHKhrBj2+29nPF0IB5kpy9MS71vs07fvrNGAl/iA==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.28.1.tgz", + "integrity": "sha512-EbkK285O+1YMrg57xVA+Dp0tDBRB93/BZKph9XhMjezf6F4TpYjaUSuPt5J0fZXlSag0LmZAsTmdGGqPp4pQFA==", "cpu": [ "arm64" ], @@ -688,9 +782,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.27.4.tgz", - "integrity": "sha512-PlNiRQapift4LNS8DPUHuDX/IdXiLjf8mc5vdEmUR0fF/pyy2qWwzdLjB+iZquGr8LuN4LnUoSEvKRwjSVYz3Q==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.28.1.tgz", + "integrity": "sha512-prduvrMKU6NzMq6nxzQw445zXgaDBbMQvmKSJaxpaZ5R1QDM8w+eGxo6Y/jhT/cLoCvnZI42oEqf9KQNYz1fqQ==", "cpu": [ "arm64" ], @@ -702,9 +796,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.27.4.tgz", - "integrity": "sha512-o9bH2dbdgBDJaXWJCDTNDYa171ACUdzpxSZt+u/AAeQ20Nk5x+IhA+zsGmrQtpkLiumRJEYef68gcpn2ooXhSQ==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.28.1.tgz", + "integrity": "sha512-WsvbOunsUk0wccO/TV4o7IKgloJ942hVFK1CLatwv6TJspcCZb9umQkPdvB7FihmdxgaKR5JyxDjWpCOp4uZlQ==", "cpu": [ "x64" ], @@ -716,9 +810,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.27.4.tgz", - "integrity": "sha512-NBI2/i2hT9Q+HySSHTBh52da7isru4aAAo6qC3I7QFVsuhxi2gM8t/EI9EVcILiHLj1vfi+VGGPaLOUENn7pmw==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.28.1.tgz", + "integrity": "sha512-HTDPdY1caUcU4qK23FeeGxCdJF64cKkqajU0iBnTVxS8F7H/7BewvYoG+va1KPSL63kQ1PGNyiwKOfReavzvNA==", "cpu": [ "arm64" ], @@ -730,9 +824,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.27.4.tgz", - "integrity": "sha512-wYcC5ycW2zvqtDYrE7deary2P2UFmSh85PUpAx+dwTCO9uw3sgzD6Gv9n5X4vLaQKsrfTSZZ7Z7uynQozPVvWA==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.28.1.tgz", + "integrity": "sha512-m/uYasxkUevcFTeRSM9TeLyPe2QDuqtjkeoTpP9SW0XxUWfcYrGDMkO/m2tTw+4NMAF9P2fU3Mw4ahNvo7QmsQ==", "cpu": [ "x64" ], @@ -744,9 +838,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.27.4.tgz", - "integrity": "sha512-9OwUnK/xKw6DyRlgx8UizeqRFOfi9mf5TYCw1uolDaJSbUmBxP85DE6T4ouCMoN6pXw8ZoTeZCSEfSaYo+/s1w==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.28.1.tgz", + "integrity": "sha512-QAg11ZIt6mcmzpNE6JZBpKfJaKkqTm1A9+y9O+frdZJEuhQxiugM05gnCWiANHj4RmbgeVJpTdmKRmH/a+0QbA==", "cpu": [ "arm" ], @@ -758,9 +852,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.27.4.tgz", - "integrity": "sha512-Vgdo4fpuphS9V24WOV+KwkCVJ72u7idTgQaBoLRD0UxBAWTF9GWurJO9YD9yh00BzbkhpeXtm6na+MvJU7Z73A==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.28.1.tgz", + "integrity": "sha512-dRP9PEBfolq1dmMcFqbEPSd9VlRuVWEGSmbxVEfiq2cs2jlZAl0YNxFzAQS2OrQmsLBLAATDMb3Z6MFv5vOcXg==", "cpu": [ "arm" ], @@ -772,9 +866,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.27.4.tgz", - "integrity": "sha512-pleyNgyd1kkBkw2kOqlBx+0atfIIkkExOTiifoODo6qKDSpnc6WzUY5RhHdmTdIJXBdSnh6JknnYTtmQyobrVg==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.28.1.tgz", + "integrity": "sha512-uGr8khxO+CKT4XU8ZUH1TTEUtlktK6Kgtv0+6bIFSeiSlnGJHG1tSFSjm41uQ9sAO/5ULx9mWOz70jYLyv1QkA==", "cpu": [ "arm64" ], @@ -786,9 +880,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.27.4.tgz", - "integrity": "sha512-caluiUXvUuVyCHr5DxL8ohaaFFzPGmgmMvwmqAITMpV/Q+tPoaHZ/PWa3t8B2WyoRcIIuu1hkaW5KkeTDNSnMA==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.28.1.tgz", + "integrity": "sha512-QF54q8MYGAqMLrX2t7tNpi01nvq5RI59UBNx+3+37zoKX5KViPo/gk2QLhsuqok05sSCRluj0D00LzCwBikb0A==", "cpu": [ "arm64" ], @@ -799,10 +893,24 @@ "linux" ] }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.28.1.tgz", + "integrity": "sha512-vPul4uodvWvLhRco2w0GcyZcdyBfpfDRgNKU+p35AWEbJ/HPs1tOUrkSueVbBS0RQHAf/A+nNtDpvw95PeVKOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.27.4.tgz", - "integrity": "sha512-FScrpHrO60hARyHh7s1zHE97u0KlT/RECzCKAdmI+LEoC1eDh/RDji9JgFqyO+wPDb86Oa/sXkily1+oi4FzJQ==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.28.1.tgz", + "integrity": "sha512-pTnTdBuC2+pt1Rmm2SV7JWRqzhYpEILML4PKODqLz+C7Ou2apEV52h19CR7es+u04KlqplggmN9sqZlekg3R1A==", "cpu": [ "ppc64" ], @@ -814,9 +922,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.27.4.tgz", - "integrity": "sha512-qyyprhyGb7+RBfMPeww9FlHwKkCXdKHeGgSqmIXw9VSUtvyFZ6WZRtnxgbuz76FK7LyoN8t/eINRbPUcvXB5fw==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.28.1.tgz", + "integrity": "sha512-vWXy1Nfg7TPBSuAncfInmAI/WZDd5vOklyLJDdIRKABcZWojNDY0NJwruY2AcnCLnRJKSaBgf/GiJfauu8cQZA==", "cpu": [ "riscv64" ], @@ -828,9 +936,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.27.4.tgz", - "integrity": "sha512-PFz+y2kb6tbh7m3A7nA9++eInGcDVZUACulf/KzDtovvdTizHpZaJty7Gp0lFwSQcrnebHOqxF1MaKZd7psVRg==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.28.1.tgz", + "integrity": "sha512-/yqC2Y53oZjb0yz8PVuGOQQNOTwxcizudunl/tFs1aLvObTclTwZ0JhXF2XcPT/zuaymemCDSuuUPXJJyqeDOg==", "cpu": [ "s390x" ], @@ -842,9 +950,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.27.4.tgz", - "integrity": "sha512-Ni8mMtfo+o/G7DVtweXXV/Ol2TFf63KYjTtoZ5f078AUgJTmaIJnj4JFU7TK/9SVWTaSJGxPi5zMDgK4w+Ez7Q==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.28.1.tgz", + "integrity": "sha512-fzgeABz7rrAlKYB0y2kSEiURrI0691CSL0+KXwKwhxvj92VULEDQLpBYLHpF49MSiPG4sq5CK3qHMnb9tlCjBw==", "cpu": [ "x64" ], @@ -856,9 +964,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.27.4.tgz", - "integrity": "sha512-5AeeAF1PB9TUzD+3cROzFTnAJAcVUGLuR8ng0E0WXGkYhp6RD6L+6szYVX+64Rs0r72019KHZS1ka1q+zU/wUw==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.28.1.tgz", + "integrity": "sha512-xQTDVzSGiMlSshpJCtudbWyRfLaNiVPXt1WgdWTwWz9n0U12cI2ZVtWe/Jgwyv/6wjL7b66uu61Vg0POWVfz4g==", "cpu": [ "x64" ], @@ -870,9 +978,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.27.4.tgz", - "integrity": "sha512-yOpVsA4K5qVwu2CaS3hHxluWIK5HQTjNV4tWjQXluMiiiu4pJj4BN98CvxohNCpcjMeTXk/ZMJBRbgRg8HBB6A==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.28.1.tgz", + "integrity": "sha512-wSXmDRVupJstFP7elGMgv+2HqXelQhuNf+IS4V+nUpNVi/GUiBgDmfwD0UGN3pcAnWsgKG3I52wMOBnk1VHr/A==", "cpu": [ "arm64" ], @@ -884,9 +992,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.27.4.tgz", - "integrity": "sha512-KtwEJOaHAVJlxV92rNYiG9JQwQAdhBlrjNRp7P9L8Cb4Rer3in+0A+IPhJC9y68WAi9H0sX4AiG2NTsVlmqJeQ==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.28.1.tgz", + "integrity": "sha512-ZkyTJ/9vkgrE/Rk9vhMXhf8l9D+eAhbAVbsGsXKy2ohmJaWg0LPQLnIxRdRp/bKyr8tXuPlXhIoGlEB5XpJnGA==", "cpu": [ "ia32" ], @@ -898,9 +1006,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.27.4.tgz", - "integrity": "sha512-3j4jx1TppORdTAoBJRd+/wJRGCPC0ETWkXOecJ6PPZLj6SptXkrXcNqdj0oclbKML6FkQltdz7bBA3rUSirZug==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.28.1.tgz", + "integrity": "sha512-ZvK2jBafvttJjoIdKm/Q/Bh7IJ1Ose9IBOwpOXcOvW3ikGTQGmKDgxTC6oCAzW6PynbkKP8+um1du81XJHZ0JA==", "cpu": [ "x64" ], @@ -911,6 +1019,153 @@ "win32" ] }, + "node_modules/@rushstack/node-core-library": { + "version": "5.10.1", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-5.10.1.tgz", + "integrity": "sha512-BSb/KcyBHmUQwINrgtzo6jiH0HlGFmrUy33vO6unmceuVKTEyL2q+P0fQq2oB5hvXVWOEUhxB2QvlkZluvUEmg==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "~8.13.0", + "ajv-draft-04": "~1.0.0", + "ajv-formats": "~3.0.1", + "fs-extra": "~7.0.1", + "import-lazy": "~4.0.0", + "jju": "~1.4.0", + "resolve": "~1.22.1", + "semver": "~7.5.4" + }, + "peerDependencies": { + "@types/node": "*" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@rushstack/node-core-library/node_modules/ajv": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.13.0.tgz", + "integrity": "sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.4.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@rushstack/node-core-library/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@rushstack/rig-package": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.5.3.tgz", + "integrity": "sha512-olzSSjYrvCNxUFZowevC3uz8gvKr3WTpHQ7BkpjtRpA3wK+T0ybep/SRUMfr195gBzJm5gaXw0ZMgjIyHqJUow==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve": "~1.22.1", + "strip-json-comments": "~3.1.1" + } + }, + "node_modules/@rushstack/rig-package/node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@rushstack/terminal": { + "version": "0.14.4", + "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.14.4.tgz", + "integrity": "sha512-NxACqERW0PHq8Rpq1V6v5iTHEwkRGxenjEW+VWqRYQ8T9puUzgmGHmEZUaUEDHAe9Qyvp0/Ew04sAiQw9XjhJg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rushstack/node-core-library": "5.10.1", + "supports-color": "~8.1.1" + }, + "peerDependencies": { + "@types/node": "*" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/@rushstack/terminal/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@rushstack/terminal/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/@rushstack/ts-command-line": { + "version": "4.23.2", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.23.2.tgz", + "integrity": "sha512-JJ7XZX5K3ThBBva38aomgsPv1L7FV6XmSOcR6HtM7HDFZJkepqT65imw26h9ggGqMjsY0R9jcl30tzKcVj9aOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rushstack/terminal": "0.14.4", + "@types/argparse": "1.0.38", + "argparse": "~1.0.9", + "string-argv": "~0.3.1" + } + }, + "node_modules/@types/argparse": { + "version": "1.0.38", + "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz", + "integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", @@ -926,9 +1181,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.10.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.0.tgz", - "integrity": "sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==", + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", "dev": true, "license": "MIT", "dependencies": { @@ -968,14 +1223,14 @@ } }, "node_modules/@vitest/expect": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.6.tgz", - "integrity": "sha512-9M1UR9CAmrhJOMoSwVnPh2rELPKhYo0m/CSgqw9PyStpxtkwhmdM6XYlXGKeYyERY1N6EIuzkQ7e3Lm1WKCoUg==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.8.tgz", + "integrity": "sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.1.6", - "@vitest/utils": "2.1.6", + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", "chai": "^5.1.2", "tinyrainbow": "^1.2.0" }, @@ -984,13 +1239,13 @@ } }, "node_modules/@vitest/mocker": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.6.tgz", - "integrity": "sha512-MHZp2Z+Q/A3am5oD4WSH04f9B0T7UvwEb+v5W0kCYMhtXGYbdyl2NUk1wdSMqGthmhpiThPDp/hEoVwu16+u1A==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.8.tgz", + "integrity": "sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.1.6", + "@vitest/spy": "2.1.8", "estree-walker": "^3.0.3", "magic-string": "^0.30.12" }, @@ -999,7 +1254,7 @@ }, "peerDependencies": { "msw": "^2.4.9", - "vite": "^5.0.0 || ^6.0.0" + "vite": "^5.0.0" }, "peerDependenciesMeta": { "msw": { @@ -1010,30 +1265,10 @@ } } }, - "node_modules/@vitest/mocker/node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } - }, - "node_modules/@vitest/mocker/node_modules/magic-string": { - "version": "0.30.14", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", - "integrity": "sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" - } - }, "node_modules/@vitest/pretty-format": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.6.tgz", - "integrity": "sha512-exZyLcEnHgDMKc54TtHca4McV4sKT+NKAe9ix/yhd/qkYb/TP8HTyXRFDijV19qKqTZM0hPL4753zU/U8L/gAA==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.8.tgz", + "integrity": "sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1044,13 +1279,13 @@ } }, "node_modules/@vitest/runner": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.6.tgz", - "integrity": "sha512-SjkRGSFyrA82m5nz7To4CkRSEVWn/rwQISHoia/DB8c6IHIhaE/UNAo+7UfeaeJRE979XceGl00LNkIz09RFsA==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.8.tgz", + "integrity": "sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "2.1.6", + "@vitest/utils": "2.1.8", "pathe": "^1.1.2" }, "funding": { @@ -1058,13 +1293,13 @@ } }, "node_modules/@vitest/snapshot": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.6.tgz", - "integrity": "sha512-5JTWHw8iS9l3v4/VSuthCndw1lN/hpPB+mlgn1BUhFbobeIUj1J1V/Bj2t2ovGEmkXLTckFjQddsxS5T6LuVWw==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.8.tgz", + "integrity": "sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.1.6", + "@vitest/pretty-format": "2.1.8", "magic-string": "^0.30.12", "pathe": "^1.1.2" }, @@ -1072,20 +1307,10 @@ "url": "https://opencollective.com/vitest" } }, - "node_modules/@vitest/snapshot/node_modules/magic-string": { - "version": "0.30.14", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", - "integrity": "sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" - } - }, "node_modules/@vitest/spy": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.6.tgz", - "integrity": "sha512-oTFObV8bd4SDdRka5O+mSh5w9irgx5IetrD5i+OsUUsk/shsBoHifwCzy45SAORzAhtNiprUVaK3hSCCzZh1jQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.8.tgz", + "integrity": "sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==", "dev": true, "license": "MIT", "dependencies": { @@ -1096,13 +1321,13 @@ } }, "node_modules/@vitest/utils": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.6.tgz", - "integrity": "sha512-ixNkFy3k4vokOUTU2blIUvOgKq/N2PW8vKIjZZYsGJCMX69MRa9J2sKqX5hY/k5O5Gty3YJChepkqZ3KM9LyIQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.8.tgz", + "integrity": "sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.1.6", + "@vitest/pretty-format": "2.1.8", "loupe": "^3.1.2", "tinyrainbow": "^1.2.0" }, @@ -1171,6 +1396,39 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ajv-draft-04": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz", + "integrity": "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "ajv": "^8.5.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, "node_modules/ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", @@ -1271,6 +1529,16 @@ "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", "license": "MIT" }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, "node_modules/array-buffer-byte-length": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", @@ -1288,19 +1556,18 @@ } }, "node_modules/arraybuffer.prototype.slice": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", - "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", "license": "MIT", "dependencies": { "array-buffer-byte-length": "^1.0.1", - "call-bind": "^1.0.5", + "call-bind": "^1.0.8", "define-properties": "^1.2.1", - "es-abstract": "^1.22.3", - "es-errors": "^1.2.1", - "get-intrinsic": "^1.2.3", - "is-array-buffer": "^3.0.4", - "is-shared-array-buffer": "^1.0.2" + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" }, "engines": { "node": ">= 0.4" @@ -1478,16 +1745,44 @@ } }, "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", "license": "MIT", "dependencies": { + "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", + "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", + "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -1520,9 +1815,9 @@ } }, "node_modules/capnp-ts/node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, "license": "MIT", "dependencies": { @@ -1715,21 +2010,135 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "license": "MIT", + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", "dependencies": { - "color-name": "1.1.3" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" } }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "license": "MIT" - }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cliui/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/cliui/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "license": "MIT" + }, "node_modules/compressible": { "version": "2.0.18", "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", @@ -1948,9 +2357,9 @@ "link": true }, "node_modules/dotenv": { - "version": "16.4.5", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", - "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", "dev": true, "license": "BSD-2-Clause", "engines": { @@ -1960,6 +2369,37 @@ "url": "https://dotenvx.com" } }, + "node_modules/dts-bundle-generator": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/dts-bundle-generator/-/dts-bundle-generator-9.5.1.tgz", + "integrity": "sha512-DxpJOb2FNnEyOzMkG11sxO2dmxPjthoVWxfKqWYJ/bI/rT1rvTMktF5EKjAYrRZu6Z6t3NhOUZ0sZ5ZXevOfbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "typescript": ">=5.0.2", + "yargs": "^17.6.0" + }, + "bin": { + "dts-bundle-generator": "dist/bin/dts-bundle-generator.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.0.tgz", + "integrity": "sha512-9+Sj30DIu+4KvHqMfLUGLFYL2PkURSYMVXJyXe92nFRvlYq5hBjLEhblKB+vkd/WVlUYMWigiY07T91Fkk0+4A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -1982,57 +2422,59 @@ } }, "node_modules/es-abstract": { - "version": "1.23.5", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.5.tgz", - "integrity": "sha512-vlmniQ0WNPwXqA0BnmwV3Ng7HxiGlh6r5U6JcTMNx8OilcAGqVJBHJcPjqOMaczU9fRuRK5Px2BdVyPRnKMMVQ==", + "version": "1.23.6", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.6.tgz", + "integrity": "sha512-Ifco6n3yj2tMZDWNLyloZrytt9lqqlwvS83P3HtaETR0NUOYnIULGGHpktqYGObGy+8wc1okO25p8TjemhImvA==", "license": "MIT", "dependencies": { "array-buffer-byte-length": "^1.0.1", - "arraybuffer.prototype.slice": "^1.0.3", + "arraybuffer.prototype.slice": "^1.0.4", "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", "data-view-buffer": "^1.0.1", "data-view-byte-length": "^1.0.1", "data-view-byte-offset": "^1.0.0", - "es-define-property": "^1.0.0", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "es-set-tostringtag": "^2.0.3", - "es-to-primitive": "^1.2.1", - "function.prototype.name": "^1.1.6", - "get-intrinsic": "^1.2.4", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.7", + "get-intrinsic": "^1.2.6", "get-symbol-description": "^1.0.2", "globalthis": "^1.0.4", - "gopd": "^1.0.1", + "gopd": "^1.2.0", "has-property-descriptors": "^1.0.2", - "has-proto": "^1.0.3", - "has-symbols": "^1.0.3", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", "hasown": "^2.0.2", - "internal-slot": "^1.0.7", + "internal-slot": "^1.1.0", "is-array-buffer": "^3.0.4", "is-callable": "^1.2.7", - "is-data-view": "^1.0.1", + "is-data-view": "^1.0.2", "is-negative-zero": "^2.0.3", - "is-regex": "^1.1.4", + "is-regex": "^1.2.1", "is-shared-array-buffer": "^1.0.3", - "is-string": "^1.0.7", + "is-string": "^1.1.1", "is-typed-array": "^1.1.13", - "is-weakref": "^1.0.2", + "is-weakref": "^1.1.0", + "math-intrinsics": "^1.0.0", "object-inspect": "^1.13.3", "object-keys": "^1.1.1", "object.assign": "^4.1.5", "regexp.prototype.flags": "^1.5.3", - "safe-array-concat": "^1.1.2", - "safe-regex-test": "^1.0.3", - "string.prototype.trim": "^1.2.9", - "string.prototype.trimend": "^1.0.8", + "safe-array-concat": "^1.1.3", + "safe-regex-test": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", "string.prototype.trimstart": "^1.0.8", "typed-array-buffer": "^1.0.2", "typed-array-byte-length": "^1.0.1", - "typed-array-byte-offset": "^1.0.2", - "typed-array-length": "^1.0.6", + "typed-array-byte-offset": "^1.0.3", + "typed-array-length": "^1.0.7", "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.15" + "which-typed-array": "^1.1.16" }, "engines": { "node": ">= 0.4" @@ -2042,13 +2484,10 @@ } }, "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, "engines": { "node": ">= 0.4" } @@ -2096,14 +2535,14 @@ } }, "node_modules/es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", "license": "MIT", "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" }, "engines": { "node": ">= 0.4" @@ -2152,6 +2591,16 @@ "@esbuild/win32-x64": "0.24.0" } }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -2162,11 +2611,14 @@ } }, "node_modules/estree-walker": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", - "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } }, "node_modules/events": { "version": "3.3.0", @@ -2311,6 +2763,21 @@ "resolved": "shims/fs", "link": true }, + "node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -2336,15 +2803,16 @@ } }, "node_modules/function.prototype.name": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", - "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.7.tgz", + "integrity": "sha512-2g4x+HqTJKM9zcJqBSpjoRmdcPFtJM60J3xJisTQSXBWka5XqyBN/2tNUgma1mztTXyDuUsEtYe5qcs7xYzYQA==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "functions-have-names": "^1.2.3" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" }, "engines": { "node": ">= 0.4" @@ -2362,17 +2830,32 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.6.tgz", + "integrity": "sha512-qxsEs+9A+u85HhllWJJFicJfPDhRmjzoYdl64aMWW9yRIJmSyxdn8IEkuIM530/7T+lv0TIHd8L6Q/ra0tEoeA==", "license": "MIT", "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "dunder-proto": "^1.0.0", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -2445,12 +2928,12 @@ } }, "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.1.3" + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2493,10 +2976,13 @@ } }, "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -2505,9 +2991,9 @@ } }, "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -2578,6 +3064,16 @@ ], "license": "BSD-3-Clause" }, + "node_modules/import-lazy": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-4.0.0.tgz", + "integrity": "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", @@ -2585,27 +3081,28 @@ "license": "ISC" }, "node_modules/internal-slot": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", - "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0", - "hasown": "^2.0.0", - "side-channel": "^1.0.4" + "hasown": "^2.0.2", + "side-channel": "^1.1.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/is-array-buffer": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", - "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.1" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -2636,25 +3133,28 @@ } }, "node_modules/is-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", - "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", "license": "MIT", "dependencies": { - "has-bigints": "^1.0.1" + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/is-boolean-object": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", - "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.1.tgz", + "integrity": "sha512-l9qO6eFlUETHtuihLcYOaLKByJ1f+N4kthcU9YjHy3N+B3hWv0y/2Nd0mu/7lTFnRQHTrSdXF50HQ3bl5fEnng==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2676,9 +3176,9 @@ } }, "node_modules/is-core-module": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", - "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.0.tgz", + "integrity": "sha512-urTSINYfAYgcbLb0yDQ6egFm6h3Mo1DcF9EkyXSRjjzdHbsulg01qhwWuXdOoUBuTkbQ80KDboXa0vFJ+BDH+g==", "license": "MIT", "dependencies": { "hasown": "^2.0.2" @@ -2691,11 +3191,13 @@ } }, "node_modules/is-data-view": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", - "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", "license": "MIT", "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", "is-typed-array": "^1.1.13" }, "engines": { @@ -2706,12 +3208,13 @@ } }, "node_modules/is-date-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", - "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2799,12 +3302,13 @@ } }, "node_modules/is-number-object": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", - "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2826,13 +3330,15 @@ } }, "node_modules/is-regex": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", - "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" }, "engines": { "node": ">= 0.4" @@ -2881,12 +3387,13 @@ } }, "node_modules/is-string": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", - "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -2896,12 +3403,14 @@ } }, "node_modules/is-symbol": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", - "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", "license": "MIT", "dependencies": { - "has-symbols": "^1.0.2" + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -2938,12 +3447,15 @@ } }, "node_modules/is-weakref": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", - "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.0.tgz", + "integrity": "sha512-SXM8Nwyys6nT5WP6pltOwKytLV7FqQ4UiibxVmW+EIosHcmCqkkjViTb5SNssDlkCiEYRP1/pdWUKVvZBmsR2Q==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.2" + "call-bound": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2996,6 +3508,13 @@ "dev": true, "license": "MIT" }, + "node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", + "dev": true, + "license": "MIT" + }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -3008,6 +3527,16 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "license": "MIT" }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -3023,6 +3552,13 @@ "node": ">=4" } }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "license": "MIT" + }, "node_modules/loupe": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.2.tgz", @@ -3030,14 +3566,36 @@ "dev": true, "license": "MIT" }, - "node_modules/magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "sourcemap-codec": "^1.4.8" + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/math-intrinsics": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.0.0.tgz", + "integrity": "sha512-4MqMiKP90ybymYvsut0CH2g4XWbfLtmlCkXmtmdcDCxNB+mQcu1w/1+L/VD7vi/PSv7X2JYV7SCcR+jiPXnQtA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" } }, "node_modules/memorystream": { @@ -3107,9 +3665,9 @@ } }, "node_modules/miniflare": { - "version": "3.20241106.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241106.1.tgz", - "integrity": "sha512-dM3RBlJE8rUFxnqlPCaFCq0E7qQqEQvKbYX7W/APGCK+rLcyLmEBzC4GQR/niXdNM/oV6gdg9AA50ghnn2ALuw==", + "version": "3.20241205.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241205.0.tgz", + "integrity": "sha512-Z0cTtIf6ZrcAJ3SrOI9EUM3s4dkGhNeU6Ubl8sroYhsPVD+rtz3m5+p6McHFWCkcMff1o60X5XEKVTmkz0gbpA==", "dev": true, "license": "MIT", "dependencies": { @@ -3121,7 +3679,7 @@ "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", "undici": "^5.28.4", - "workerd": "1.20241106.1", + "workerd": "1.20241205.0", "ws": "^8.18.0", "youch": "^3.2.2", "zod": "^3.22.3" @@ -3715,9 +4273,9 @@ "license": "MIT" }, "node_modules/prettier": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", - "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", + "integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" @@ -3798,18 +4356,19 @@ } }, "node_modules/reflect.getprototypeof": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.7.tgz", - "integrity": "sha512-bMvFGIUKlc/eSfXNX+aZ+EL95/EgZzuwA0OBPTbZZDEJw/0AkentjMuM1oiRfwHrshqk4RzdgiTg5CcDalXN5g==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.8.tgz", + "integrity": "sha512-B5dj6usc5dkk8uFliwjwDHM8To5/QwdKz9JcBZ8Ic4G1f0YmeeJTtE/ZTdgRFPAfxZFiUaPhZ1Jcs4qeagItGQ==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", "define-properties": "^1.2.1", + "dunder-proto": "^1.0.0", "es-abstract": "^1.23.5", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "which-builtin-type": "^1.1.4" + "gopd": "^1.2.0", + "which-builtin-type": "^1.2.0" }, "engines": { "node": ">= 0.4" @@ -3858,6 +4417,16 @@ "node": ">=0.10.0" } }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -3868,12 +4437,12 @@ } }, "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "version": "1.22.9", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.9.tgz", + "integrity": "sha512-QxrmX1DzraFIi9PxdG5VkRfRwIgjwyud+z/iBwfRRrVmHc+P9Q7u2lSSpQ6bjr2gy5lrqIiU9vb6iAeGf2400A==", "license": "MIT", "dependencies": { - "is-core-module": "^2.13.0", + "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -3884,20 +4453,10 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/resolve.exports": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", - "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, "node_modules/rollup": { - "version": "4.27.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.27.4.tgz", - "integrity": "sha512-RLKxqHEMjh/RGLsDxAEsaLO3mWgyoU6x9w6n1ikAzet4B3gI2/3yP6PWY2p9QzRTh6MfEIXB3MwsOY0Iv3vNrw==", + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.28.1.tgz", + "integrity": "sha512-61fXYl/qNVinKmGSTHAZ6Yy8I3YIJC/r2m9feHo6SwVAVcLT5MPwOUFe7EuURA/4m0NR8lXG4BBXuo/IZEsjMg==", "dev": true, "license": "MIT", "dependencies": { @@ -3911,24 +4470,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.27.4", - "@rollup/rollup-android-arm64": "4.27.4", - "@rollup/rollup-darwin-arm64": "4.27.4", - "@rollup/rollup-darwin-x64": "4.27.4", - "@rollup/rollup-freebsd-arm64": "4.27.4", - "@rollup/rollup-freebsd-x64": "4.27.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.27.4", - "@rollup/rollup-linux-arm-musleabihf": "4.27.4", - "@rollup/rollup-linux-arm64-gnu": "4.27.4", - "@rollup/rollup-linux-arm64-musl": "4.27.4", - "@rollup/rollup-linux-powerpc64le-gnu": "4.27.4", - "@rollup/rollup-linux-riscv64-gnu": "4.27.4", - "@rollup/rollup-linux-s390x-gnu": "4.27.4", - "@rollup/rollup-linux-x64-gnu": "4.27.4", - "@rollup/rollup-linux-x64-musl": "4.27.4", - "@rollup/rollup-win32-arm64-msvc": "4.27.4", - "@rollup/rollup-win32-ia32-msvc": "4.27.4", - "@rollup/rollup-win32-x64-msvc": "4.27.4", + "@rollup/rollup-android-arm-eabi": "4.28.1", + "@rollup/rollup-android-arm64": "4.28.1", + "@rollup/rollup-darwin-arm64": "4.28.1", + "@rollup/rollup-darwin-x64": "4.28.1", + "@rollup/rollup-freebsd-arm64": "4.28.1", + "@rollup/rollup-freebsd-x64": "4.28.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.28.1", + "@rollup/rollup-linux-arm-musleabihf": "4.28.1", + "@rollup/rollup-linux-arm64-gnu": "4.28.1", + "@rollup/rollup-linux-arm64-musl": "4.28.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.28.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.28.1", + "@rollup/rollup-linux-riscv64-gnu": "4.28.1", + "@rollup/rollup-linux-s390x-gnu": "4.28.1", + "@rollup/rollup-linux-x64-gnu": "4.28.1", + "@rollup/rollup-linux-x64-musl": "4.28.1", + "@rollup/rollup-win32-arm64-msvc": "4.28.1", + "@rollup/rollup-win32-ia32-msvc": "4.28.1", + "@rollup/rollup-win32-x64-msvc": "4.28.1", "fsevents": "~2.3.2" } }, @@ -3945,6 +4505,23 @@ "rollup-pluginutils": "^2.8.1" } }, + "node_modules/rollup-plugin-inject/node_modules/estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/rollup-plugin-inject/node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, "node_modules/rollup-plugin-node-polyfills": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz", @@ -3965,15 +4542,23 @@ "estree-walker": "^0.6.1" } }, + "node_modules/rollup-pluginutils/node_modules/estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true, + "license": "MIT" + }, "node_modules/safe-array-concat": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", - "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", - "get-intrinsic": "^1.2.4", - "has-symbols": "^1.0.3", + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", "isarray": "^2.0.5" }, "engines": { @@ -3990,14 +4575,14 @@ "license": "MIT" }, "node_modules/safe-regex-test": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", - "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.6", + "call-bound": "^1.0.2", "es-errors": "^1.3.0", - "is-regex": "^1.1.4" + "is-regex": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -4156,24 +4741,81 @@ } }, "node_modules/shell-quote": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", - "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.2.tgz", + "integrity": "sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA==", "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -4264,6 +4906,13 @@ "node": ">= 10.x" } }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/stackback": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", @@ -4308,6 +4957,16 @@ "resolved": "shims/string_decoder", "link": true }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -4344,15 +5003,18 @@ } }, "node_modules/string.prototype.trim": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", - "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", "define-properties": "^1.2.1", - "es-abstract": "^1.23.0", - "es-object-atoms": "^1.0.0" + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -4362,15 +5024,19 @@ } }, "node_modules/string.prototype.trimend": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", - "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -4435,32 +5101,15 @@ } }, "node_modules/subtls": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.3.1.tgz", - "integrity": "sha512-/HWVyVoJEKCvvLOAt3ak2kEYI5+8eLPojXrUDtYvIEIzxdAqwtYd2epVPyFqIoFV+Q+xtbcoDVubQgUFUxHxfg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "^18.16.3" - } - }, - "node_modules/subtls/node_modules/@types/node": { - "version": "18.19.66", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.66.tgz", - "integrity": "sha512-14HmtUdGxFUalGRfLLn9Gc1oNWvWh5zNbsyOLo5JV6WARSeN1QcEBKRnZm9QqNfrutgsl/hY4eJW63aZ44aBCg==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.3.3.tgz", + "integrity": "sha512-d4otIuFU4Fa1k4ZMsIXXTClahHzunz7mx6+Kpn2K9s7BqFAYXP46JZhIbIebY4Z4Sas2b16CjRaKC0ZSJ8/A4w==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "@types/node": "^22.10.2" } }, - "node_modules/subtls/node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true, - "license": "MIT" - }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -4648,27 +5297,30 @@ "license": "MIT" }, "node_modules/unbox-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", - "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", + "call-bound": "^1.0.3", "has-bigints": "^1.0.2", - "has-symbols": "^1.0.3", - "which-boxed-primitive": "^1.0.2" + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/undici": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.0.tgz", - "integrity": "sha512-BUgJXc752Kou3oOIuU1i+yZZypyZRqNPW0vqoMPl8VaoalSfeR0D8/t4iAS3yirs79SSMTxTag+ZC86uswv+Cw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.1.0.tgz", + "integrity": "sha512-3+mdX2R31khuLCm2mKExSlMdJsfol7bJkIMH80tdXA74W34rT1jKemUTlYR7WY3TqsV4wfOgpatWmmB2Jl1+5g==", "license": "MIT", "engines": { - "node": ">=18.17" + "node": ">=20.18.1" } }, "node_modules/undici-types": { @@ -4680,9 +5332,9 @@ }, "node_modules/unenv": { "name": "unenv-nightly", - "version": "2.0.0-20241111-080453-894aa31", - "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241111-080453-894aa31.tgz", - "integrity": "sha512-0W39QQOQ9VE8kVVUpGwEG+pZcsCXk5wqNG6rDPE6Gr+fiA69LR0qERM61hW5KCOkC1/ArCFrfCGjwHyyv/bI0Q==", + "version": "2.0.0-20241204-140205-a5d5190", + "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241204-140205-a5d5190.tgz", + "integrity": "sha512-jpmAytLeiiW01pl5bhVn9wYJ4vtiLdhGe10oXlJBuQEX8mxjxO8BlEXGHU4vr4yEikjFP1wsomTHt/CLU8kUwg==", "dev": true, "license": "MIT", "dependencies": { @@ -4692,6 +5344,16 @@ "ufo": "^1.5.4" } }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, "node_modules/update-check": { "version": "1.5.4", "resolved": "https://registry.npmjs.org/update-check/-/update-check-1.5.4.tgz", @@ -4739,21 +5401,21 @@ } }, "node_modules/vite": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.0.tgz", - "integrity": "sha512-Q2+5yQV79EdnpbNxjD3/QHVMCBaQ3Kpd4/uL51UGuh38bIIM+s4o3FqyCzRvTRwFb+cWIUeZvaWwS9y2LD2qeQ==", + "version": "5.4.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", + "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.24.0", - "postcss": "^8.4.49", - "rollup": "^4.23.0" + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -4762,25 +5424,19 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "jiti": ">=1.21.0", + "@types/node": "^18.0.0 || >=20.0.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" + "terser": "^5.4.0" }, "peerDependenciesMeta": { "@types/node": { "optional": true }, - "jiti": { - "optional": true - }, "less": { "optional": true }, @@ -4801,19 +5457,13 @@ }, "terser": { "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true } } }, "node_modules/vite-node": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.6.tgz", - "integrity": "sha512-DBfJY0n9JUwnyLxPSSUmEePT21j8JZp/sR9n+/gBwQU6DcQOioPdb8/pibWfXForbirSagZCilseYIwaL3f95A==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.8.tgz", + "integrity": "sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg==", "dev": true, "license": "MIT", "dependencies": { @@ -4821,22 +5471,22 @@ "debug": "^4.3.7", "es-module-lexer": "^1.5.4", "pathe": "^1.1.2", - "vite": "^5.0.0 || ^6.0.0" + "vite": "^5.0.0" }, "bin": { "vite-node": "vite-node.mjs" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^18.0.0 || >=20.0.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/vite-node/node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, "license": "MIT", "dependencies": { @@ -4858,106 +5508,526 @@ "dev": true, "license": "MIT" }, - "node_modules/vitest": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.6.tgz", - "integrity": "sha512-isUCkvPL30J4c5O5hgONeFRsDmlw6kzFEdLQHLezmDdKQHy8Ke/B/dgdTMEgU0vm+iZ0TjW8GuK83DiahBoKWQ==", + "node_modules/vite/node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], "dev": true, "license": "MIT", - "dependencies": { - "@vitest/expect": "2.1.6", - "@vitest/mocker": "2.1.6", - "@vitest/pretty-format": "^2.1.6", - "@vitest/runner": "2.1.6", - "@vitest/snapshot": "2.1.6", - "@vitest/spy": "2.1.6", - "@vitest/utils": "2.1.6", - "chai": "^5.1.2", - "debug": "^4.3.7", - "expect-type": "^1.1.0", - "magic-string": "^0.30.12", - "pathe": "^1.1.2", - "std-env": "^3.8.0", - "tinybench": "^2.9.0", - "tinyexec": "^0.3.1", - "tinypool": "^1.0.1", - "tinyrainbow": "^1.2.0", - "vite": "^5.0.0 || ^6.0.0", - "vite-node": "2.1.6", - "why-is-node-running": "^2.3.0" - }, - "bin": { - "vitest": "vitest.mjs" - }, + "optional": true, + "os": [ + "aix" + ], "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "@edge-runtime/vm": "*", - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "@vitest/browser": "2.1.6", - "@vitest/ui": "2.1.6", - "happy-dom": "*", - "jsdom": "*" - }, - "peerDependenciesMeta": { - "@edge-runtime/vm": { - "optional": true - }, - "@types/node": { - "optional": true - }, - "@vitest/browser": { - "optional": true - }, - "@vitest/ui": { - "optional": true - }, - "happy-dom": { - "optional": true - }, - "jsdom": { - "optional": true - } + "node": ">=12" } }, - "node_modules/vitest/node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "node_modules/vite/node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], "dev": true, "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, + "optional": true, + "os": [ + "android" + ], "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "node": ">=12" } }, - "node_modules/vitest/node_modules/magic-string": { - "version": "0.30.14", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", - "integrity": "sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==", + "node_modules/vite/node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" } }, - "node_modules/vitest/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "node_modules/vite/node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/vitest": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.8.tgz", + "integrity": "sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/expect": "2.1.8", + "@vitest/mocker": "2.1.8", + "@vitest/pretty-format": "^2.1.8", + "@vitest/runner": "2.1.8", + "@vitest/snapshot": "2.1.8", + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", + "chai": "^5.1.2", + "debug": "^4.3.7", + "expect-type": "^1.1.0", + "magic-string": "^0.30.12", + "pathe": "^1.1.2", + "std-env": "^3.8.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.1", + "tinypool": "^1.0.1", + "tinyrainbow": "^1.2.0", + "vite": "^5.0.0", + "vite-node": "2.1.8", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/node": "^18.0.0 || >=20.0.0", + "@vitest/browser": "2.1.8", + "@vitest/ui": "2.1.8", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" }, "node_modules/which": { "version": "1.3.1", @@ -4972,40 +6042,43 @@ } }, "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", "license": "MIT", "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/which-builtin-type": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.0.tgz", - "integrity": "sha512-I+qLGQ/vucCby4tf5HsLmGueEla4ZhwTBSqaooS+Y0BuxN4Cp+okmGuV+8mXZ84KDI9BA+oklo+RzKg0ONdSUA==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bound": "^1.0.2", "function.prototype.name": "^1.1.6", "has-tostringtag": "^1.0.2", "is-async-function": "^2.0.0", - "is-date-object": "^1.0.5", + "is-date-object": "^1.1.0", "is-finalizationregistry": "^1.1.0", "is-generator-function": "^1.0.10", - "is-regex": "^1.1.4", + "is-regex": "^1.2.1", "is-weakref": "^1.0.2", "isarray": "^2.0.5", - "which-boxed-primitive": "^1.0.2", + "which-boxed-primitive": "^1.1.0", "which-collection": "^1.0.2", - "which-typed-array": "^1.1.15" + "which-typed-array": "^1.1.16" }, "engines": { "node": ">= 0.4" @@ -5033,9 +6106,9 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", - "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.16.tgz", + "integrity": "sha512-g+N+GAWiRj66DngFwHvISJd+ITsyphZvD1vChfVg6cEdnzy53GzB3oy0fUNlvhz7H7+MiqhYr26qxQShCpKTTQ==", "license": "MIT", "dependencies": { "available-typed-arrays": "^1.0.7", @@ -5084,9 +6157,9 @@ } }, "node_modules/workerd": { - "version": "1.20241106.1", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241106.1.tgz", - "integrity": "sha512-1GdKl0kDw8rrirr/ThcK66Kbl4/jd4h8uHx5g7YHBrnenY5SX1UPuop2cnCzYUxlg55kPjzIqqYslz1muRFgFw==", + "version": "1.20241205.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241205.0.tgz", + "integrity": "sha512-vso/2n0c5SdBDWiD+Sx5gM7unA6SiZXRVUHDqH1euoP/9mFVHZF8icoYsNLB87b/TX8zNgpae+I5N/xFpd9v0g==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", @@ -5097,22 +6170,22 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20241106.1", - "@cloudflare/workerd-darwin-arm64": "1.20241106.1", - "@cloudflare/workerd-linux-64": "1.20241106.1", - "@cloudflare/workerd-linux-arm64": "1.20241106.1", - "@cloudflare/workerd-windows-64": "1.20241106.1" + "@cloudflare/workerd-darwin-64": "1.20241205.0", + "@cloudflare/workerd-darwin-arm64": "1.20241205.0", + "@cloudflare/workerd-linux-64": "1.20241205.0", + "@cloudflare/workerd-linux-arm64": "1.20241205.0", + "@cloudflare/workerd-windows-64": "1.20241205.0" } }, "node_modules/wrangler": { - "version": "3.90.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.90.0.tgz", - "integrity": "sha512-E/6E9ORAl987+3kP8wDiE3L1lj9r4vQ32/dl5toIxIkSMssmPRQVdxqwgMxbxJrytbFNo8Eo6swgjd4y4nUaLg==", + "version": "3.95.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.95.0.tgz", + "integrity": "sha512-3w5852i3FNyDz421K2Qk4v5L8jjwegO5O8E1+VAQmjnm82HFNxpIRUBq0bmM7CTLvOPI/Jjcmj/eAWjQBL7QYg==", "dev": true, "license": "MIT OR Apache-2.0", "dependencies": { "@cloudflare/kv-asset-handler": "0.3.4", - "@cloudflare/workers-shared": "0.8.0", + "@cloudflare/workers-shared": "0.11.0", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@esbuild-plugins/node-modules-polyfill": "^0.2.2", "blake3-wasm": "^2.1.5", @@ -5120,15 +6193,14 @@ "date-fns": "^4.1.0", "esbuild": "0.17.19", "itty-time": "^1.0.6", - "miniflare": "3.20241106.1", + "miniflare": "3.20241205.0", "nanoid": "^3.3.3", "path-to-regexp": "^6.3.0", "resolve": "^1.22.8", - "resolve.exports": "^2.0.2", "selfsigned": "^2.0.1", "source-map": "^0.6.1", - "unenv": "npm:unenv-nightly@2.0.0-20241111-080453-894aa31", - "workerd": "1.20241106.1", + "unenv": "npm:unenv-nightly@2.0.0-20241204-140205-a5d5190", + "workerd": "1.20241205.0", "xxhash-wasm": "^1.0.1" }, "bin": { @@ -5142,7 +6214,7 @@ "fsevents": "~2.3.2" }, "peerDependencies": { - "@cloudflare/workers-types": "^4.20241106.0" + "@cloudflare/workers-types": "^4.20241205.0" }, "peerDependenciesMeta": { "@cloudflare/workers-types": { @@ -5635,6 +6707,97 @@ "dev": true, "license": "MIT" }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/youch": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.4.tgz", @@ -5648,9 +6811,9 @@ } }, "node_modules/zod": { - "version": "3.23.8", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "version": "3.24.1", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz", + "integrity": "sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==", "dev": true, "license": "MIT", "funding": { diff --git a/package.json b/package.json index e30d2be..f755f58 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "stream": "file:shims/stream", "string_decoder": "file:shims/string_decoder", "tls": "file:shims/tls", - "undici": "^6.0.1", + "undici": "^7.1.0", "url": "file:shims/url", "util": "file:shims/util", "ws": "^8.12.1" @@ -31,8 +31,8 @@ "pg-connection-string": "2.5.0" }, "scripts": { - "check": "tsc --noEmit", - "export": "npm run check && ./export.sh", + "check": "tsc --noEmit export/index.ts", + "export": "npm run check && ./export.sh && npm run makeTypes", "build": "./build.sh", "buildDebug": "./build.sh debug", "watch": "./build.sh watch", @@ -48,17 +48,19 @@ "cfDeploy": "npm run build && wrangler deploy", "format": "prettier -c .", "format:fix": "prettier -w .", - "test": "vitest run" + "makeTypes": "npx tsc && (npx @microsoft/api-extractor run --local || true) && cp dist/npm/index.d.ts dist/npm/index.d.mts", + "test": "npm run export && vitest run --no-file-parallelism" }, "devDependencies": { - "@cloudflare/workers-types": "^4.20230115.0", + "@microsoft/api-extractor": "^7.48.1", "@types/events": "^3.0.0", "@types/pg": "^8.6.5", "@types/ws": "^8.5.4", "dotenv": "^16.0.3", + "dts-bundle-generator": "^9.5.1", "esbuild": "^0.24.0", "fast-equals": "^5.0.1", - "subtls": "^0.3.0", + "subtls": "^0.3.3", "typescript": "^5.0.4", "vitest": "^2.1.6", "wrangler": "^3.0.1" diff --git a/shims/crypto/index.ts b/shims/crypto/index.ts index b60862a..de4b069 100644 --- a/shims/crypto/index.ts +++ b/shims/crypto/index.ts @@ -1,5 +1,4 @@ -import { sha256 } from './sha256'; -import { Md5 } from './md5'; +// note: sha256 and md5 are now bundled in this file since dts-generate-bundle had trouble importing them export function randomBytes(length: number) { return crypto.getRandomValues(Buffer.alloc(length)); @@ -25,9 +24,7 @@ export function createHash(type: 'sha256') { update: function (data: string | Buffer | Uint8Array) { return { digest: function () { - return typeof data === 'string' - ? Md5.hashStr(data) - : Md5.hashByteArray(data); + return typeof data === 'string' ? Md5.hashStr(data) : Md5.hashByteArray(data); }, }; }, @@ -36,8 +33,7 @@ export function createHash(type: 'sha256') { } export function createHmac(type: 'sha256', key: string | Buffer | Uint8Array) { - if (type !== 'sha256') - throw new Error(`Only sha256 is supported (requested: '${type}')`); + if (type !== 'sha256') throw new Error(`Only sha256 is supported (requested: '${type}')`); return { update: function (data: string | Buffer | Uint8Array) { return { @@ -58,8 +54,8 @@ export function createHmac(type: 'sha256', key: string | Buffer | Uint8Array) { const innerKey = new Uint8Array(64); const outerKey = new Uint8Array(64); for (let i = 0; i < 64; i++) { - innerKey[i] = 0x36 ^ key[i]; - outerKey[i] = 0x5c ^ key[i]; + innerKey[i] = 0x36 ^ key[i] as number; // cast should be unnecessary but dts-bundle-generator appears to need it + outerKey[i] = 0x5c ^ key[i] as number; // ditto } const msg = new Uint8Array(data.length + 64); @@ -76,3 +72,647 @@ export function createHmac(type: 'sha256', key: string | Buffer | Uint8Array) { }, }; } + +/* +TypeScript Md5 +============== + +Based on work by +* Joseph Myers: http://www.myersdaily.org/joseph/javascript/md5-text.html +* André Cruz: https://github.com/satazor/SparkMD5 +* Raymond Hill: https://github.com/gorhill/yamd5.js + +Effectively a TypeScrypt re-write of Raymond Hill JS Library + +The MIT License (MIT) + +Copyright (C) 2014 Raymond Hill + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + + DO WHAT YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2015 André Cruz + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT YOU WANT TO. + +*/ + +interface HasherState { + buffer: string; + buflen: number; + length: number; + state: number[]; +} + +export class Md5 { + /* GM added 2023-05-18 */ + /** + * Hash an array on the spot + * @param str String to hash + * @param raw Whether to return the value as an `Int32Array` + */ + public static hashByteArray(arr: Uint8Array, raw?: false): string; + public static hashByteArray(arr: Uint8Array, raw: true): Int32Array; + public static hashByteArray(arr: Uint8Array, raw: boolean = false) { + return this.onePassHasher.start().appendByteArray(arr).end(raw); + } + /* end GM added */ + + /** + * Hash a UTF-8 string on the spot + * @param str String to hash + * @param raw Whether to return the value as an `Int32Array` + */ + public static hashStr(str: string, raw?: false): string; + public static hashStr(str: string, raw: true): Int32Array; + public static hashStr(str: string, raw: boolean = false) { + return this.onePassHasher.start().appendStr(str).end(raw); + } + + /** + * Hash a ASCII string on the spot + * @param str String to hash + * @param raw Whether to return the value as an `Int32Array` + */ + public static hashAsciiStr(str: string, raw?: false): string; + public static hashAsciiStr(str: string, raw: true): Int32Array; + public static hashAsciiStr(str: string, raw: boolean = false) { + return this.onePassHasher.start().appendAsciiStr(str).end(raw); + } + // Private Static Variables + private static stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]); + private static buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + private static hexChars = '0123456789abcdef'; + private static hexOut: string[] = []; + + // Permanent instance is to use for one-call hashing + private static onePassHasher = new Md5(); + + private static _hex(x: Int32Array): string { + const hc = Md5.hexChars; + const ho = Md5.hexOut; + let n; + let offset; + let j; + let i; + + for (i = 0; i < 4; i += 1) { + offset = i * 8; + n = x[i]; + for (j = 0; j < 8; j += 2) { + ho[offset + 1 + j] = hc.charAt(n & 0x0f); + n >>>= 4; + ho[offset + 0 + j] = hc.charAt(n & 0x0f); + n >>>= 4; + } + } + return ho.join(''); + } + + private static _md5cycle(x: Int32Array | Uint32Array, k: Int32Array | Uint32Array) { + let a = x[0]; + let b = x[1]; + let c = x[2]; + let d = x[3]; + // ff() + a += (((b & c) | (~b & d)) + k[0] - 680876936) | 0; + a = (((a << 7) | (a >>> 25)) + b) | 0; + d += (((a & b) | (~a & c)) + k[1] - 389564586) | 0; + d = (((d << 12) | (d >>> 20)) + a) | 0; + c += (((d & a) | (~d & b)) + k[2] + 606105819) | 0; + c = (((c << 17) | (c >>> 15)) + d) | 0; + b += (((c & d) | (~c & a)) + k[3] - 1044525330) | 0; + b = (((b << 22) | (b >>> 10)) + c) | 0; + a += (((b & c) | (~b & d)) + k[4] - 176418897) | 0; + a = (((a << 7) | (a >>> 25)) + b) | 0; + d += (((a & b) | (~a & c)) + k[5] + 1200080426) | 0; + d = (((d << 12) | (d >>> 20)) + a) | 0; + c += (((d & a) | (~d & b)) + k[6] - 1473231341) | 0; + c = (((c << 17) | (c >>> 15)) + d) | 0; + b += (((c & d) | (~c & a)) + k[7] - 45705983) | 0; + b = (((b << 22) | (b >>> 10)) + c) | 0; + a += (((b & c) | (~b & d)) + k[8] + 1770035416) | 0; + a = (((a << 7) | (a >>> 25)) + b) | 0; + d += (((a & b) | (~a & c)) + k[9] - 1958414417) | 0; + d = (((d << 12) | (d >>> 20)) + a) | 0; + c += (((d & a) | (~d & b)) + k[10] - 42063) | 0; + c = (((c << 17) | (c >>> 15)) + d) | 0; + b += (((c & d) | (~c & a)) + k[11] - 1990404162) | 0; + b = (((b << 22) | (b >>> 10)) + c) | 0; + a += (((b & c) | (~b & d)) + k[12] + 1804603682) | 0; + a = (((a << 7) | (a >>> 25)) + b) | 0; + d += (((a & b) | (~a & c)) + k[13] - 40341101) | 0; + d = (((d << 12) | (d >>> 20)) + a) | 0; + c += (((d & a) | (~d & b)) + k[14] - 1502002290) | 0; + c = (((c << 17) | (c >>> 15)) + d) | 0; + b += (((c & d) | (~c & a)) + k[15] + 1236535329) | 0; + b = (((b << 22) | (b >>> 10)) + c) | 0; + // gg() + a += (((b & d) | (c & ~d)) + k[1] - 165796510) | 0; + a = (((a << 5) | (a >>> 27)) + b) | 0; + d += (((a & c) | (b & ~c)) + k[6] - 1069501632) | 0; + d = (((d << 9) | (d >>> 23)) + a) | 0; + c += (((d & b) | (a & ~b)) + k[11] + 643717713) | 0; + c = (((c << 14) | (c >>> 18)) + d) | 0; + b += (((c & a) | (d & ~a)) + k[0] - 373897302) | 0; + b = (((b << 20) | (b >>> 12)) + c) | 0; + a += (((b & d) | (c & ~d)) + k[5] - 701558691) | 0; + a = (((a << 5) | (a >>> 27)) + b) | 0; + d += (((a & c) | (b & ~c)) + k[10] + 38016083) | 0; + d = (((d << 9) | (d >>> 23)) + a) | 0; + c += (((d & b) | (a & ~b)) + k[15] - 660478335) | 0; + c = (((c << 14) | (c >>> 18)) + d) | 0; + b += (((c & a) | (d & ~a)) + k[4] - 405537848) | 0; + b = (((b << 20) | (b >>> 12)) + c) | 0; + a += (((b & d) | (c & ~d)) + k[9] + 568446438) | 0; + a = (((a << 5) | (a >>> 27)) + b) | 0; + d += (((a & c) | (b & ~c)) + k[14] - 1019803690) | 0; + d = (((d << 9) | (d >>> 23)) + a) | 0; + c += (((d & b) | (a & ~b)) + k[3] - 187363961) | 0; + c = (((c << 14) | (c >>> 18)) + d) | 0; + b += (((c & a) | (d & ~a)) + k[8] + 1163531501) | 0; + b = (((b << 20) | (b >>> 12)) + c) | 0; + a += (((b & d) | (c & ~d)) + k[13] - 1444681467) | 0; + a = (((a << 5) | (a >>> 27)) + b) | 0; + d += (((a & c) | (b & ~c)) + k[2] - 51403784) | 0; + d = (((d << 9) | (d >>> 23)) + a) | 0; + c += (((d & b) | (a & ~b)) + k[7] + 1735328473) | 0; + c = (((c << 14) | (c >>> 18)) + d) | 0; + b += (((c & a) | (d & ~a)) + k[12] - 1926607734) | 0; + b = (((b << 20) | (b >>> 12)) + c) | 0; + // hh() + a += ((b ^ c ^ d) + k[5] - 378558) | 0; + a = (((a << 4) | (a >>> 28)) + b) | 0; + d += ((a ^ b ^ c) + k[8] - 2022574463) | 0; + d = (((d << 11) | (d >>> 21)) + a) | 0; + c += ((d ^ a ^ b) + k[11] + 1839030562) | 0; + c = (((c << 16) | (c >>> 16)) + d) | 0; + b += ((c ^ d ^ a) + k[14] - 35309556) | 0; + b = (((b << 23) | (b >>> 9)) + c) | 0; + a += ((b ^ c ^ d) + k[1] - 1530992060) | 0; + a = (((a << 4) | (a >>> 28)) + b) | 0; + d += ((a ^ b ^ c) + k[4] + 1272893353) | 0; + d = (((d << 11) | (d >>> 21)) + a) | 0; + c += ((d ^ a ^ b) + k[7] - 155497632) | 0; + c = (((c << 16) | (c >>> 16)) + d) | 0; + b += ((c ^ d ^ a) + k[10] - 1094730640) | 0; + b = (((b << 23) | (b >>> 9)) + c) | 0; + a += ((b ^ c ^ d) + k[13] + 681279174) | 0; + a = (((a << 4) | (a >>> 28)) + b) | 0; + d += ((a ^ b ^ c) + k[0] - 358537222) | 0; + d = (((d << 11) | (d >>> 21)) + a) | 0; + c += ((d ^ a ^ b) + k[3] - 722521979) | 0; + c = (((c << 16) | (c >>> 16)) + d) | 0; + b += ((c ^ d ^ a) + k[6] + 76029189) | 0; + b = (((b << 23) | (b >>> 9)) + c) | 0; + a += ((b ^ c ^ d) + k[9] - 640364487) | 0; + a = (((a << 4) | (a >>> 28)) + b) | 0; + d += ((a ^ b ^ c) + k[12] - 421815835) | 0; + d = (((d << 11) | (d >>> 21)) + a) | 0; + c += ((d ^ a ^ b) + k[15] + 530742520) | 0; + c = (((c << 16) | (c >>> 16)) + d) | 0; + b += ((c ^ d ^ a) + k[2] - 995338651) | 0; + b = (((b << 23) | (b >>> 9)) + c) | 0; + // ii() + a += ((c ^ (b | ~d)) + k[0] - 198630844) | 0; + a = (((a << 6) | (a >>> 26)) + b) | 0; + d += ((b ^ (a | ~c)) + k[7] + 1126891415) | 0; + d = (((d << 10) | (d >>> 22)) + a) | 0; + c += ((a ^ (d | ~b)) + k[14] - 1416354905) | 0; + c = (((c << 15) | (c >>> 17)) + d) | 0; + b += ((d ^ (c | ~a)) + k[5] - 57434055) | 0; + b = (((b << 21) | (b >>> 11)) + c) | 0; + a += ((c ^ (b | ~d)) + k[12] + 1700485571) | 0; + a = (((a << 6) | (a >>> 26)) + b) | 0; + d += ((b ^ (a | ~c)) + k[3] - 1894986606) | 0; + d = (((d << 10) | (d >>> 22)) + a) | 0; + c += ((a ^ (d | ~b)) + k[10] - 1051523) | 0; + c = (((c << 15) | (c >>> 17)) + d) | 0; + b += ((d ^ (c | ~a)) + k[1] - 2054922799) | 0; + b = (((b << 21) | (b >>> 11)) + c) | 0; + a += ((c ^ (b | ~d)) + k[8] + 1873313359) | 0; + a = (((a << 6) | (a >>> 26)) + b) | 0; + d += ((b ^ (a | ~c)) + k[15] - 30611744) | 0; + d = (((d << 10) | (d >>> 22)) + a) | 0; + c += ((a ^ (d | ~b)) + k[6] - 1560198380) | 0; + c = (((c << 15) | (c >>> 17)) + d) | 0; + b += ((d ^ (c | ~a)) + k[13] + 1309151649) | 0; + b = (((b << 21) | (b >>> 11)) + c) | 0; + a += ((c ^ (b | ~d)) + k[4] - 145523070) | 0; + a = (((a << 6) | (a >>> 26)) + b) | 0; + d += ((b ^ (a | ~c)) + k[11] - 1120210379) | 0; + d = (((d << 10) | (d >>> 22)) + a) | 0; + c += ((a ^ (d | ~b)) + k[2] + 718787259) | 0; + c = (((c << 15) | (c >>> 17)) + d) | 0; + b += ((d ^ (c | ~a)) + k[9] - 343485551) | 0; + b = (((b << 21) | (b >>> 11)) + c) | 0; + + x[0] = (a + x[0]) | 0; + x[1] = (b + x[1]) | 0; + x[2] = (c + x[2]) | 0; + x[3] = (d + x[3]) | 0; + } + + private _dataLength = 0; + private _bufferLength = 0; + + private _state: Int32Array = new Int32Array(4); + private _buffer: ArrayBuffer = new ArrayBuffer(68); + private _buffer8: Uint8Array; + private _buffer32: Uint32Array; + + constructor() { + this._buffer8 = new Uint8Array(this._buffer, 0, 68); + this._buffer32 = new Uint32Array(this._buffer, 0, 17); + this.start(); + } + + /** + * Initialise buffer to be hashed + */ + public start() { + this._dataLength = 0; + this._bufferLength = 0; + this._state.set(Md5.stateIdentity); + return this; + } + + // Char to code point to to array conversion: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt + // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown + + /** + * Append a UTF-8 string to the hash buffer + * @param str String to append + */ + public appendStr(str: string) { + const buf8 = this._buffer8; + const buf32 = this._buffer32; + let bufLen = this._bufferLength; + let code; + let i; + + for (i = 0; i < str.length; i += 1) { + code = str.charCodeAt(i); + if (code < 128) { + buf8[bufLen++] = code; + } else if (code < 0x800) { + buf8[bufLen++] = (code >>> 6) + 0xc0; + buf8[bufLen++] = (code & 0x3f) | 0x80; + } else if (code < 0xd800 || code > 0xdbff) { + buf8[bufLen++] = (code >>> 12) + 0xe0; + buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; + buf8[bufLen++] = (code & 0x3f) | 0x80; + } else { + code = (code - 0xd800) * 0x400 + (str.charCodeAt(++i) - 0xdc00) + 0x10000; + if (code > 0x10ffff) { + throw new Error('Unicode standard supports code points up to U+10FFFF'); + } + buf8[bufLen++] = (code >>> 18) + 0xf0; + buf8[bufLen++] = ((code >>> 12) & 0x3f) | 0x80; + buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; + buf8[bufLen++] = (code & 0x3f) | 0x80; + } + if (bufLen >= 64) { + this._dataLength += 64; + Md5._md5cycle(this._state, buf32); + bufLen -= 64; + buf32[0] = buf32[16]; + } + } + this._bufferLength = bufLen; + return this; + } + + /** + * Append an ASCII string to the hash buffer + * @param str String to append + */ + public appendAsciiStr(str: string) { + const buf8 = this._buffer8; + const buf32 = this._buffer32; + let bufLen = this._bufferLength; + let i; + let j = 0; + + for (;;) { + i = Math.min(str.length - j, 64 - bufLen); + while (i--) { + buf8[bufLen++] = str.charCodeAt(j++); + } + if (bufLen < 64) { + break; + } + this._dataLength += 64; + Md5._md5cycle(this._state, buf32); + bufLen = 0; + } + this._bufferLength = bufLen; + return this; + } + + /** + * Append a byte array to the hash buffer + * @param input array to append + */ + public appendByteArray(input: Uint8Array) { + const buf8 = this._buffer8; + const buf32 = this._buffer32; + let bufLen = this._bufferLength; + let i; + let j = 0; + + for (;;) { + i = Math.min(input.length - j, 64 - bufLen); + while (i--) { + buf8[bufLen++] = input[j++]; + } + if (bufLen < 64) { + break; + } + this._dataLength += 64; + Md5._md5cycle(this._state, buf32); + bufLen = 0; + } + this._bufferLength = bufLen; + return this; + } + + /** + * Get the state of the hash buffer + */ + public getState(): HasherState { + const s = this._state; + + return { + buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)), + buflen: this._bufferLength, + length: this._dataLength, + state: [s[0], s[1], s[2], s[3]], + }; + } + + /** + * Override the current state of the hash buffer + * @param state New hash buffer state + */ + public setState(state: HasherState) { + const buf = state.buffer; + const x = state.state; + const s = this._state; + let i; + + this._dataLength = state.length; + this._bufferLength = state.buflen; + s[0] = x[0]; + s[1] = x[1]; + s[2] = x[2]; + s[3] = x[3]; + + for (i = 0; i < buf.length; i += 1) { + this._buffer8[i] = buf.charCodeAt(i); + } + } + + /** + * Hash the current state of the hash buffer and return the result + * @param raw Whether to return the value as an `Int32Array` + */ + public end(raw: boolean = false) { + const bufLen = this._bufferLength; + const buf8 = this._buffer8; + const buf32 = this._buffer32; + const i = (bufLen >> 2) + 1; + + this._dataLength += bufLen; + const dataBitsLen = this._dataLength * 8; + + buf8[bufLen] = 0x80; + buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0; + buf32.set(Md5.buffer32Identity.subarray(i), i); + + if (bufLen > 55) { + Md5._md5cycle(this._state, buf32); + buf32.set(Md5.buffer32Identity); + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + if (dataBitsLen <= 0xffffffff) { + buf32[14] = dataBitsLen; + } else { + const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/); + if (matches === null) { + return; + } + + const lo = parseInt(matches[2], 16); + const hi = parseInt(matches[1], 16) || 0; + + buf32[14] = lo; + buf32[15] = hi; + } + + Md5._md5cycle(this._state, buf32); + + return raw ? this._state : Md5._hex(this._state); + } +} + +// if (Md5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592') { +// throw new Error('Md5 self test failed.'); +// } + + +/* +Copyright 2022 Andrea Griffini + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +// sha256(data) returns the digest +// sha256() returns an object you can call .add(data) zero or more time and .digest() at the end +// digest is a 32-byte Uint8Array instance with an added .hex() function. +// Input should be either a string (that will be encoded as UTF-8) or an array-like object with values 0..255. + +export function sha256( + data?: T, +): T extends string | Uint8Array + ? Uint8Array + : { add: (data: string | Uint8Array) => void; digest: () => Uint8Array } { + let h0 = 0x6a09e667, + h1 = 0xbb67ae85, + h2 = 0x3c6ef372, + h3 = 0xa54ff53a, + h4 = 0x510e527f, + h5 = 0x9b05688c, + h6 = 0x1f83d9ab, + h7 = 0x5be0cd19, + tsz = 0, + bp = 0; + const k = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, + ], + rrot = (x: number, n: number) => (x >>> n) | (x << (32 - n)), + w = new Uint32Array(64), + buf = new Uint8Array(64), + process = () => { + for (let j = 0, r = 0; j < 16; j++, r += 4) { + w[j] = (buf[r] << 24) | (buf[r + 1] << 16) | (buf[r + 2] << 8) | buf[r + 3]; + } + for (let j = 16; j < 64; j++) { + let s0 = rrot(w[j - 15], 7) ^ rrot(w[j - 15], 18) ^ (w[j - 15] >>> 3); + let s1 = rrot(w[j - 2], 17) ^ rrot(w[j - 2], 19) ^ (w[j - 2] >>> 10); + w[j] = (w[j - 16] + s0 + w[j - 7] + s1) | 0; + } + let a = h0, + b = h1, + c = h2, + d = h3, + e = h4, + f = h5, + g = h6, + h = h7; + for (let j = 0; j < 64; j++) { + let S1 = rrot(e, 6) ^ rrot(e, 11) ^ rrot(e, 25), + ch = (e & f) ^ (~e & g), + t1 = (h + S1 + ch + k[j] + w[j]) | 0, + S0 = rrot(a, 2) ^ rrot(a, 13) ^ rrot(a, 22), + maj = (a & b) ^ (a & c) ^ (b & c), + t2 = (S0 + maj) | 0; + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + h0 = (h0 + a) | 0; + h1 = (h1 + b) | 0; + h2 = (h2 + c) | 0; + h3 = (h3 + d) | 0; + h4 = (h4 + e) | 0; + h5 = (h5 + f) | 0; + h6 = (h6 + g) | 0; + h7 = (h7 + h) | 0; + bp = 0; + }, + add = (data: string | Uint8Array) => { + if (typeof data === 'string') { + data = new TextEncoder().encode(data); + } + for (let i = 0; i < data.length; i++) { + buf[bp++] = data[i]; + if (bp === 64) process(); + } + tsz += data.length; + }, + digest = () => { + buf[bp++] = 0x80; + if (bp == 64) process(); + if (bp + 8 > 64) { + while (bp < 64) buf[bp++] = 0x00; + process(); + } + while (bp < 58) buf[bp++] = 0x00; + // Max number of bytes is 35,184,372,088,831 + let L = tsz * 8; + buf[bp++] = (L / 1099511627776) & 255; + buf[bp++] = (L / 4294967296) & 255; + buf[bp++] = L >>> 24; + buf[bp++] = (L >>> 16) & 255; + buf[bp++] = (L >>> 8) & 255; + buf[bp++] = L & 255; + process(); + let reply = new Uint8Array(32); + reply[0] = h0 >>> 24; + reply[1] = (h0 >>> 16) & 255; + reply[2] = (h0 >>> 8) & 255; + reply[3] = h0 & 255; + reply[4] = h1 >>> 24; + reply[5] = (h1 >>> 16) & 255; + reply[6] = (h1 >>> 8) & 255; + reply[7] = h1 & 255; + reply[8] = h2 >>> 24; + reply[9] = (h2 >>> 16) & 255; + reply[10] = (h2 >>> 8) & 255; + reply[11] = h2 & 255; + reply[12] = h3 >>> 24; + reply[13] = (h3 >>> 16) & 255; + reply[14] = (h3 >>> 8) & 255; + reply[15] = h3 & 255; + reply[16] = h4 >>> 24; + reply[17] = (h4 >>> 16) & 255; + reply[18] = (h4 >>> 8) & 255; + reply[19] = h4 & 255; + reply[20] = h5 >>> 24; + reply[21] = (h5 >>> 16) & 255; + reply[22] = (h5 >>> 8) & 255; + reply[23] = h5 & 255; + reply[24] = h6 >>> 24; + reply[25] = (h6 >>> 16) & 255; + reply[26] = (h6 >>> 8) & 255; + reply[27] = h6 & 255; + reply[28] = h7 >>> 24; + reply[29] = (h7 >>> 16) & 255; + reply[30] = (h7 >>> 8) & 255; + reply[31] = h7 & 255; + return reply; + }; + if (data === undefined) return { add, digest } as any; + add(data); + return digest() as any; +} diff --git a/shims/crypto/md5.ts b/shims/crypto/md5.ts deleted file mode 100644 index 1c41f7e..0000000 --- a/shims/crypto/md5.ts +++ /dev/null @@ -1,488 +0,0 @@ -/* - -TypeScript Md5 -============== - -Based on work by -* Joseph Myers: http://www.myersdaily.org/joseph/javascript/md5-text.html -* André Cruz: https://github.com/satazor/SparkMD5 -* Raymond Hill: https://github.com/gorhill/yamd5.js - -Effectively a TypeScrypt re-write of Raymond Hill JS Library - -The MIT License (MIT) - -Copyright (C) 2014 Raymond Hill - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - - - DO WHAT YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2015 André Cruz - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT YOU WANT TO. - - -*/ - -interface HasherState { - buffer: string; - buflen: number; - length: number; - state: number[]; -} - -export class Md5 { - /* GM added 2023-05-18 */ - /** - * Hash an array on the spot - * @param str String to hash - * @param raw Whether to return the value as an `Int32Array` - */ - public static hashByteArray(arr: Uint8Array, raw?: false): string; - public static hashByteArray(arr: Uint8Array, raw: true): Int32Array; - public static hashByteArray(arr: Uint8Array, raw: boolean = false) { - return this.onePassHasher.start().appendByteArray(arr).end(raw); - } - /* end GM added */ - - /** - * Hash a UTF-8 string on the spot - * @param str String to hash - * @param raw Whether to return the value as an `Int32Array` - */ - public static hashStr(str: string, raw?: false): string; - public static hashStr(str: string, raw: true): Int32Array; - public static hashStr(str: string, raw: boolean = false) { - return this.onePassHasher.start().appendStr(str).end(raw); - } - - /** - * Hash a ASCII string on the spot - * @param str String to hash - * @param raw Whether to return the value as an `Int32Array` - */ - public static hashAsciiStr(str: string, raw?: false): string; - public static hashAsciiStr(str: string, raw: true): Int32Array; - public static hashAsciiStr(str: string, raw: boolean = false) { - return this.onePassHasher.start().appendAsciiStr(str).end(raw); - } - // Private Static Variables - private static stateIdentity = new Int32Array([ - 1732584193, -271733879, -1732584194, 271733878, - ]); - private static buffer32Identity = new Int32Array([ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ]); - private static hexChars = '0123456789abcdef'; - private static hexOut: string[] = []; - - // Permanent instance is to use for one-call hashing - private static onePassHasher = new Md5(); - - private static _hex(x: Int32Array): string { - const hc = Md5.hexChars; - const ho = Md5.hexOut; - let n; - let offset; - let j; - let i; - - for (i = 0; i < 4; i += 1) { - offset = i * 8; - n = x[i]; - for (j = 0; j < 8; j += 2) { - ho[offset + 1 + j] = hc.charAt(n & 0x0f); - n >>>= 4; - ho[offset + 0 + j] = hc.charAt(n & 0x0f); - n >>>= 4; - } - } - return ho.join(''); - } - - private static _md5cycle( - x: Int32Array | Uint32Array, - k: Int32Array | Uint32Array, - ) { - let a = x[0]; - let b = x[1]; - let c = x[2]; - let d = x[3]; - // ff() - a += (((b & c) | (~b & d)) + k[0] - 680876936) | 0; - a = (((a << 7) | (a >>> 25)) + b) | 0; - d += (((a & b) | (~a & c)) + k[1] - 389564586) | 0; - d = (((d << 12) | (d >>> 20)) + a) | 0; - c += (((d & a) | (~d & b)) + k[2] + 606105819) | 0; - c = (((c << 17) | (c >>> 15)) + d) | 0; - b += (((c & d) | (~c & a)) + k[3] - 1044525330) | 0; - b = (((b << 22) | (b >>> 10)) + c) | 0; - a += (((b & c) | (~b & d)) + k[4] - 176418897) | 0; - a = (((a << 7) | (a >>> 25)) + b) | 0; - d += (((a & b) | (~a & c)) + k[5] + 1200080426) | 0; - d = (((d << 12) | (d >>> 20)) + a) | 0; - c += (((d & a) | (~d & b)) + k[6] - 1473231341) | 0; - c = (((c << 17) | (c >>> 15)) + d) | 0; - b += (((c & d) | (~c & a)) + k[7] - 45705983) | 0; - b = (((b << 22) | (b >>> 10)) + c) | 0; - a += (((b & c) | (~b & d)) + k[8] + 1770035416) | 0; - a = (((a << 7) | (a >>> 25)) + b) | 0; - d += (((a & b) | (~a & c)) + k[9] - 1958414417) | 0; - d = (((d << 12) | (d >>> 20)) + a) | 0; - c += (((d & a) | (~d & b)) + k[10] - 42063) | 0; - c = (((c << 17) | (c >>> 15)) + d) | 0; - b += (((c & d) | (~c & a)) + k[11] - 1990404162) | 0; - b = (((b << 22) | (b >>> 10)) + c) | 0; - a += (((b & c) | (~b & d)) + k[12] + 1804603682) | 0; - a = (((a << 7) | (a >>> 25)) + b) | 0; - d += (((a & b) | (~a & c)) + k[13] - 40341101) | 0; - d = (((d << 12) | (d >>> 20)) + a) | 0; - c += (((d & a) | (~d & b)) + k[14] - 1502002290) | 0; - c = (((c << 17) | (c >>> 15)) + d) | 0; - b += (((c & d) | (~c & a)) + k[15] + 1236535329) | 0; - b = (((b << 22) | (b >>> 10)) + c) | 0; - // gg() - a += (((b & d) | (c & ~d)) + k[1] - 165796510) | 0; - a = (((a << 5) | (a >>> 27)) + b) | 0; - d += (((a & c) | (b & ~c)) + k[6] - 1069501632) | 0; - d = (((d << 9) | (d >>> 23)) + a) | 0; - c += (((d & b) | (a & ~b)) + k[11] + 643717713) | 0; - c = (((c << 14) | (c >>> 18)) + d) | 0; - b += (((c & a) | (d & ~a)) + k[0] - 373897302) | 0; - b = (((b << 20) | (b >>> 12)) + c) | 0; - a += (((b & d) | (c & ~d)) + k[5] - 701558691) | 0; - a = (((a << 5) | (a >>> 27)) + b) | 0; - d += (((a & c) | (b & ~c)) + k[10] + 38016083) | 0; - d = (((d << 9) | (d >>> 23)) + a) | 0; - c += (((d & b) | (a & ~b)) + k[15] - 660478335) | 0; - c = (((c << 14) | (c >>> 18)) + d) | 0; - b += (((c & a) | (d & ~a)) + k[4] - 405537848) | 0; - b = (((b << 20) | (b >>> 12)) + c) | 0; - a += (((b & d) | (c & ~d)) + k[9] + 568446438) | 0; - a = (((a << 5) | (a >>> 27)) + b) | 0; - d += (((a & c) | (b & ~c)) + k[14] - 1019803690) | 0; - d = (((d << 9) | (d >>> 23)) + a) | 0; - c += (((d & b) | (a & ~b)) + k[3] - 187363961) | 0; - c = (((c << 14) | (c >>> 18)) + d) | 0; - b += (((c & a) | (d & ~a)) + k[8] + 1163531501) | 0; - b = (((b << 20) | (b >>> 12)) + c) | 0; - a += (((b & d) | (c & ~d)) + k[13] - 1444681467) | 0; - a = (((a << 5) | (a >>> 27)) + b) | 0; - d += (((a & c) | (b & ~c)) + k[2] - 51403784) | 0; - d = (((d << 9) | (d >>> 23)) + a) | 0; - c += (((d & b) | (a & ~b)) + k[7] + 1735328473) | 0; - c = (((c << 14) | (c >>> 18)) + d) | 0; - b += (((c & a) | (d & ~a)) + k[12] - 1926607734) | 0; - b = (((b << 20) | (b >>> 12)) + c) | 0; - // hh() - a += ((b ^ c ^ d) + k[5] - 378558) | 0; - a = (((a << 4) | (a >>> 28)) + b) | 0; - d += ((a ^ b ^ c) + k[8] - 2022574463) | 0; - d = (((d << 11) | (d >>> 21)) + a) | 0; - c += ((d ^ a ^ b) + k[11] + 1839030562) | 0; - c = (((c << 16) | (c >>> 16)) + d) | 0; - b += ((c ^ d ^ a) + k[14] - 35309556) | 0; - b = (((b << 23) | (b >>> 9)) + c) | 0; - a += ((b ^ c ^ d) + k[1] - 1530992060) | 0; - a = (((a << 4) | (a >>> 28)) + b) | 0; - d += ((a ^ b ^ c) + k[4] + 1272893353) | 0; - d = (((d << 11) | (d >>> 21)) + a) | 0; - c += ((d ^ a ^ b) + k[7] - 155497632) | 0; - c = (((c << 16) | (c >>> 16)) + d) | 0; - b += ((c ^ d ^ a) + k[10] - 1094730640) | 0; - b = (((b << 23) | (b >>> 9)) + c) | 0; - a += ((b ^ c ^ d) + k[13] + 681279174) | 0; - a = (((a << 4) | (a >>> 28)) + b) | 0; - d += ((a ^ b ^ c) + k[0] - 358537222) | 0; - d = (((d << 11) | (d >>> 21)) + a) | 0; - c += ((d ^ a ^ b) + k[3] - 722521979) | 0; - c = (((c << 16) | (c >>> 16)) + d) | 0; - b += ((c ^ d ^ a) + k[6] + 76029189) | 0; - b = (((b << 23) | (b >>> 9)) + c) | 0; - a += ((b ^ c ^ d) + k[9] - 640364487) | 0; - a = (((a << 4) | (a >>> 28)) + b) | 0; - d += ((a ^ b ^ c) + k[12] - 421815835) | 0; - d = (((d << 11) | (d >>> 21)) + a) | 0; - c += ((d ^ a ^ b) + k[15] + 530742520) | 0; - c = (((c << 16) | (c >>> 16)) + d) | 0; - b += ((c ^ d ^ a) + k[2] - 995338651) | 0; - b = (((b << 23) | (b >>> 9)) + c) | 0; - // ii() - a += ((c ^ (b | ~d)) + k[0] - 198630844) | 0; - a = (((a << 6) | (a >>> 26)) + b) | 0; - d += ((b ^ (a | ~c)) + k[7] + 1126891415) | 0; - d = (((d << 10) | (d >>> 22)) + a) | 0; - c += ((a ^ (d | ~b)) + k[14] - 1416354905) | 0; - c = (((c << 15) | (c >>> 17)) + d) | 0; - b += ((d ^ (c | ~a)) + k[5] - 57434055) | 0; - b = (((b << 21) | (b >>> 11)) + c) | 0; - a += ((c ^ (b | ~d)) + k[12] + 1700485571) | 0; - a = (((a << 6) | (a >>> 26)) + b) | 0; - d += ((b ^ (a | ~c)) + k[3] - 1894986606) | 0; - d = (((d << 10) | (d >>> 22)) + a) | 0; - c += ((a ^ (d | ~b)) + k[10] - 1051523) | 0; - c = (((c << 15) | (c >>> 17)) + d) | 0; - b += ((d ^ (c | ~a)) + k[1] - 2054922799) | 0; - b = (((b << 21) | (b >>> 11)) + c) | 0; - a += ((c ^ (b | ~d)) + k[8] + 1873313359) | 0; - a = (((a << 6) | (a >>> 26)) + b) | 0; - d += ((b ^ (a | ~c)) + k[15] - 30611744) | 0; - d = (((d << 10) | (d >>> 22)) + a) | 0; - c += ((a ^ (d | ~b)) + k[6] - 1560198380) | 0; - c = (((c << 15) | (c >>> 17)) + d) | 0; - b += ((d ^ (c | ~a)) + k[13] + 1309151649) | 0; - b = (((b << 21) | (b >>> 11)) + c) | 0; - a += ((c ^ (b | ~d)) + k[4] - 145523070) | 0; - a = (((a << 6) | (a >>> 26)) + b) | 0; - d += ((b ^ (a | ~c)) + k[11] - 1120210379) | 0; - d = (((d << 10) | (d >>> 22)) + a) | 0; - c += ((a ^ (d | ~b)) + k[2] + 718787259) | 0; - c = (((c << 15) | (c >>> 17)) + d) | 0; - b += ((d ^ (c | ~a)) + k[9] - 343485551) | 0; - b = (((b << 21) | (b >>> 11)) + c) | 0; - - x[0] = (a + x[0]) | 0; - x[1] = (b + x[1]) | 0; - x[2] = (c + x[2]) | 0; - x[3] = (d + x[3]) | 0; - } - - private _dataLength = 0; - private _bufferLength = 0; - - private _state: Int32Array = new Int32Array(4); - private _buffer: ArrayBuffer = new ArrayBuffer(68); - private _buffer8: Uint8Array; - private _buffer32: Uint32Array; - - constructor() { - this._buffer8 = new Uint8Array(this._buffer, 0, 68); - this._buffer32 = new Uint32Array(this._buffer, 0, 17); - this.start(); - } - - /** - * Initialise buffer to be hashed - */ - public start() { - this._dataLength = 0; - this._bufferLength = 0; - this._state.set(Md5.stateIdentity); - return this; - } - - // Char to code point to to array conversion: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt - // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown - - /** - * Append a UTF-8 string to the hash buffer - * @param str String to append - */ - public appendStr(str: string) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let code; - let i; - - for (i = 0; i < str.length; i += 1) { - code = str.charCodeAt(i); - if (code < 128) { - buf8[bufLen++] = code; - } else if (code < 0x800) { - buf8[bufLen++] = (code >>> 6) + 0xc0; - buf8[bufLen++] = (code & 0x3f) | 0x80; - } else if (code < 0xd800 || code > 0xdbff) { - buf8[bufLen++] = (code >>> 12) + 0xe0; - buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; - buf8[bufLen++] = (code & 0x3f) | 0x80; - } else { - code = - (code - 0xd800) * 0x400 + (str.charCodeAt(++i) - 0xdc00) + 0x10000; - if (code > 0x10ffff) { - throw new Error( - 'Unicode standard supports code points up to U+10FFFF', - ); - } - buf8[bufLen++] = (code >>> 18) + 0xf0; - buf8[bufLen++] = ((code >>> 12) & 0x3f) | 0x80; - buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; - buf8[bufLen++] = (code & 0x3f) | 0x80; - } - if (bufLen >= 64) { - this._dataLength += 64; - Md5._md5cycle(this._state, buf32); - bufLen -= 64; - buf32[0] = buf32[16]; - } - } - this._bufferLength = bufLen; - return this; - } - - /** - * Append an ASCII string to the hash buffer - * @param str String to append - */ - public appendAsciiStr(str: string) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let i; - let j = 0; - - for (;;) { - i = Math.min(str.length - j, 64 - bufLen); - while (i--) { - buf8[bufLen++] = str.charCodeAt(j++); - } - if (bufLen < 64) { - break; - } - this._dataLength += 64; - Md5._md5cycle(this._state, buf32); - bufLen = 0; - } - this._bufferLength = bufLen; - return this; - } - - /** - * Append a byte array to the hash buffer - * @param input array to append - */ - public appendByteArray(input: Uint8Array) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let i; - let j = 0; - - for (;;) { - i = Math.min(input.length - j, 64 - bufLen); - while (i--) { - buf8[bufLen++] = input[j++]; - } - if (bufLen < 64) { - break; - } - this._dataLength += 64; - Md5._md5cycle(this._state, buf32); - bufLen = 0; - } - this._bufferLength = bufLen; - return this; - } - - /** - * Get the state of the hash buffer - */ - public getState(): HasherState { - const s = this._state; - - return { - buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)), - buflen: this._bufferLength, - length: this._dataLength, - state: [s[0], s[1], s[2], s[3]], - }; - } - - /** - * Override the current state of the hash buffer - * @param state New hash buffer state - */ - public setState(state: HasherState) { - const buf = state.buffer; - const x = state.state; - const s = this._state; - let i; - - this._dataLength = state.length; - this._bufferLength = state.buflen; - s[0] = x[0]; - s[1] = x[1]; - s[2] = x[2]; - s[3] = x[3]; - - for (i = 0; i < buf.length; i += 1) { - this._buffer8[i] = buf.charCodeAt(i); - } - } - - /** - * Hash the current state of the hash buffer and return the result - * @param raw Whether to return the value as an `Int32Array` - */ - public end(raw: boolean = false) { - const bufLen = this._bufferLength; - const buf8 = this._buffer8; - const buf32 = this._buffer32; - const i = (bufLen >> 2) + 1; - - this._dataLength += bufLen; - const dataBitsLen = this._dataLength * 8; - - buf8[bufLen] = 0x80; - buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0; - buf32.set(Md5.buffer32Identity.subarray(i), i); - - if (bufLen > 55) { - Md5._md5cycle(this._state, buf32); - buf32.set(Md5.buffer32Identity); - } - - // Do the final computation based on the tail and length - // Beware that the final length may not fit in 32 bits so we take care of that - if (dataBitsLen <= 0xffffffff) { - buf32[14] = dataBitsLen; - } else { - const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/); - if (matches === null) { - return; - } - - const lo = parseInt(matches[2], 16); - const hi = parseInt(matches[1], 16) || 0; - - buf32[14] = lo; - buf32[15] = hi; - } - - Md5._md5cycle(this._state, buf32); - - return raw ? this._state : Md5._hex(this._state); - } -} - -// if (Md5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592') { -// throw new Error('Md5 self test failed.'); -// } diff --git a/shims/crypto/sha256.ts b/shims/crypto/sha256.ts deleted file mode 100644 index 40fdfd2..0000000 --- a/shims/crypto/sha256.ts +++ /dev/null @@ -1,169 +0,0 @@ -/* -Copyright 2022 Andrea Griffini - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -// sha256(data) returns the digest -// sha256() returns an object you can call .add(data) zero or more time and .digest() at the end -// digest is a 32-byte Uint8Array instance with an added .hex() function. -// Input should be either a string (that will be encoded as UTF-8) or an array-like object with values 0..255. - -export function sha256( - data?: T, -): T extends string | Uint8Array - ? Uint8Array - : { add: (data: string | Uint8Array) => void; digest: () => Uint8Array } { - let h0 = 0x6a09e667, - h1 = 0xbb67ae85, - h2 = 0x3c6ef372, - h3 = 0xa54ff53a, - h4 = 0x510e527f, - h5 = 0x9b05688c, - h6 = 0x1f83d9ab, - h7 = 0x5be0cd19, - tsz = 0, - bp = 0; - const k = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, - 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, - 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, - 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, - 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, - 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, - ], - rrot = (x: number, n: number) => (x >>> n) | (x << (32 - n)), - w = new Uint32Array(64), - buf = new Uint8Array(64), - process = () => { - for (let j = 0, r = 0; j < 16; j++, r += 4) { - w[j] = - (buf[r] << 24) | (buf[r + 1] << 16) | (buf[r + 2] << 8) | buf[r + 3]; - } - for (let j = 16; j < 64; j++) { - let s0 = rrot(w[j - 15], 7) ^ rrot(w[j - 15], 18) ^ (w[j - 15] >>> 3); - let s1 = rrot(w[j - 2], 17) ^ rrot(w[j - 2], 19) ^ (w[j - 2] >>> 10); - w[j] = (w[j - 16] + s0 + w[j - 7] + s1) | 0; - } - let a = h0, - b = h1, - c = h2, - d = h3, - e = h4, - f = h5, - g = h6, - h = h7; - for (let j = 0; j < 64; j++) { - let S1 = rrot(e, 6) ^ rrot(e, 11) ^ rrot(e, 25), - ch = (e & f) ^ (~e & g), - t1 = (h + S1 + ch + k[j] + w[j]) | 0, - S0 = rrot(a, 2) ^ rrot(a, 13) ^ rrot(a, 22), - maj = (a & b) ^ (a & c) ^ (b & c), - t2 = (S0 + maj) | 0; - h = g; - g = f; - f = e; - e = (d + t1) | 0; - d = c; - c = b; - b = a; - a = (t1 + t2) | 0; - } - h0 = (h0 + a) | 0; - h1 = (h1 + b) | 0; - h2 = (h2 + c) | 0; - h3 = (h3 + d) | 0; - h4 = (h4 + e) | 0; - h5 = (h5 + f) | 0; - h6 = (h6 + g) | 0; - h7 = (h7 + h) | 0; - bp = 0; - }, - add = (data: string | Uint8Array) => { - if (typeof data === 'string') { - data = new TextEncoder().encode(data); - } - for (let i = 0; i < data.length; i++) { - buf[bp++] = data[i]; - if (bp === 64) process(); - } - tsz += data.length; - }, - digest = () => { - buf[bp++] = 0x80; - if (bp == 64) process(); - if (bp + 8 > 64) { - while (bp < 64) buf[bp++] = 0x00; - process(); - } - while (bp < 58) buf[bp++] = 0x00; - // Max number of bytes is 35,184,372,088,831 - let L = tsz * 8; - buf[bp++] = (L / 1099511627776) & 255; - buf[bp++] = (L / 4294967296) & 255; - buf[bp++] = L >>> 24; - buf[bp++] = (L >>> 16) & 255; - buf[bp++] = (L >>> 8) & 255; - buf[bp++] = L & 255; - process(); - let reply = new Uint8Array(32); - reply[0] = h0 >>> 24; - reply[1] = (h0 >>> 16) & 255; - reply[2] = (h0 >>> 8) & 255; - reply[3] = h0 & 255; - reply[4] = h1 >>> 24; - reply[5] = (h1 >>> 16) & 255; - reply[6] = (h1 >>> 8) & 255; - reply[7] = h1 & 255; - reply[8] = h2 >>> 24; - reply[9] = (h2 >>> 16) & 255; - reply[10] = (h2 >>> 8) & 255; - reply[11] = h2 & 255; - reply[12] = h3 >>> 24; - reply[13] = (h3 >>> 16) & 255; - reply[14] = (h3 >>> 8) & 255; - reply[15] = h3 & 255; - reply[16] = h4 >>> 24; - reply[17] = (h4 >>> 16) & 255; - reply[18] = (h4 >>> 8) & 255; - reply[19] = h4 & 255; - reply[20] = h5 >>> 24; - reply[21] = (h5 >>> 16) & 255; - reply[22] = (h5 >>> 8) & 255; - reply[23] = h5 & 255; - reply[24] = h6 >>> 24; - reply[25] = (h6 >>> 16) & 255; - reply[26] = (h6 >>> 8) & 255; - reply[27] = h6 & 255; - reply[28] = h7 >>> 24; - reply[29] = (h7 >>> 16) & 255; - reply[30] = (h7 >>> 8) & 255; - reply[31] = h7 & 255; - return reply; - }; - if (data === undefined) return { add, digest } as any; - add(data); - return digest() as any; -} diff --git a/shims/net/index.ts b/shims/net/index.ts index 2136263..931b0e3 100644 --- a/shims/net/index.ts +++ b/shims/net/index.ts @@ -13,8 +13,12 @@ declare global { const debug: boolean; // e.g. --define:debug=false in esbuild command interface WebSocket { binaryType: 'arraybuffer' | 'blob'; // oddly not included in Cloudflare types - accept: () => void; + accept?: () => void; // available in Cloudflare } + interface Response { + webSocket: WebSocket; + } + class __unstable_WebSocket extends WebSocket {} } enum TlsState { @@ -26,10 +30,7 @@ enum TlsState { function hexDump(data: Uint8Array) { return ( `${data.length} bytes` + - data.reduce( - (memo, byte) => memo + ' ' + byte.toString(16).padStart(2, '0'), - '\nhex:', - ) + + data.reduce((memo, byte) => memo + ' ' + byte.toString(16).padStart(2, '0'), '\nhex:') + '\nstr: ' + new TextDecoder().decode(data) ); @@ -59,13 +60,7 @@ interface FetchEndpointOptions { export interface SocketDefaults { // these options relate to the fetch transport and take effect *only* when set globally poolQueryViaFetch: boolean; - fetchEndpoint: - | string - | (( - host: string, - port: number | string, - options?: FetchEndpointOptions, - ) => string); + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); fetchConnectionCache: boolean; fetchFunction: any; // these options relate to the WebSocket transport @@ -81,11 +76,7 @@ export interface SocketDefaults { pipelineTLS: boolean; disableSNI: boolean; } -type GlobalOnlyDefaults = - | 'poolQueryViaFetch' - | 'fetchEndpoint' - | 'fetchConnectionCache' - | 'fetchFunction'; +type GlobalOnlyDefaults = 'poolQueryViaFetch' | 'fetchEndpoint' | 'fetchConnectionCache' | 'fetchFunction'; const FIRST_WORD_REGEX = /^[^.]+\./; @@ -142,12 +133,8 @@ export class Socket extends EventEmitter { static get fetchConnectionCache() { return true; } - static set fetchConnectionCache( - newValue: SocketDefaults['fetchConnectionCache'], - ) { - console.warn( - 'The `fetchConnectionCache` option is deprecated (now always `true`)', - ); + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']) { + console.warn('The `fetchConnectionCache` option is deprecated (now always `true`)'); } static get fetchFunction() { @@ -158,13 +145,9 @@ export class Socket extends EventEmitter { } static get webSocketConstructor() { - return ( - Socket.opts.webSocketConstructor ?? Socket.defaults.webSocketConstructor - ); + return Socket.opts.webSocketConstructor ?? Socket.defaults.webSocketConstructor; } - static set webSocketConstructor( - newValue: SocketDefaults['webSocketConstructor'], - ) { + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']) { Socket.opts.webSocketConstructor = newValue; } get webSocketConstructor() { @@ -203,9 +186,7 @@ export class Socket extends EventEmitter { static get useSecureWebSocket() { return Socket.opts.useSecureWebSocket ?? Socket.defaults.useSecureWebSocket; } - static set useSecureWebSocket( - newValue: SocketDefaults['useSecureWebSocket'], - ) { + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']) { Socket.opts.useSecureWebSocket = newValue; } get useSecureWebSocket() { @@ -300,9 +281,7 @@ export class Socket extends EventEmitter { `No WebSocket proxy is configured. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#wsproxy-string--host-string-port-number--string--string`, ); } - return typeof wsProxy === 'function' - ? wsProxy(host, port) - : `${wsProxy}?address=${host}:${port}`; + return typeof wsProxy === 'function' ? wsProxy(host, port) : `${wsProxy}?address=${host}:${port}`; } connecting = false; @@ -376,10 +355,7 @@ export class Socket extends EventEmitter { let wsAddr: string; try { - wsAddr = this.wsProxyAddrForHost( - host, - typeof port === 'string' ? parseInt(port, 10) : port, - ); + wsAddr = this.wsProxyAddrForHost(host, typeof port === 'string' ? parseInt(port, 10) : port); } catch (err) { this.emit('error', err); this.emit('close'); @@ -403,7 +379,6 @@ export class Socket extends EventEmitter { } catch (err) { debug && log('new WebSocket() failed'); - // @ts-ignore -- third, how about a Vercel Edge Functions __unstable_WebSocket (as at early 2023)?Í this.ws = new __unstable_WebSocket(wsAddrFull); configureWebSocket(this.ws!); } @@ -421,7 +396,7 @@ export class Socket extends EventEmitter { this.ws = resp.webSocket; if (this.ws == null) throw err; // deliberate loose equality - this.ws.accept(); + this.ws.accept!(); // if we're here, then there's an accept method configureWebSocket(this.ws, true); debug && log('Cloudflare WebSocket opened'); }) @@ -430,7 +405,7 @@ export class Socket extends EventEmitter { this.emit( 'error', new Error( - `All attempts to open a WebSocket to connect to the database failed. Please refer to https://github.com/neondatabase/serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined. Details: ${err.message}`, + `All attempts to open a WebSocket to connect to the database failed. Please refer to https://github.com/neondatabase/serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined. Details: ${err}`, ), ); this.emit('close'); @@ -452,16 +427,10 @@ export class Socket extends EventEmitter { const networkRead = readQueue.read.bind(readQueue); const networkWrite = this.rawWrite.bind(this); - const [tlsRead, tlsWrite] = await this.subtls.startTls( - host, - rootCerts, - networkRead, - networkWrite, - { - useSNI: !this.disableSNI, - expectPreData: this.pipelineTLS ? new Uint8Array([0x53]) : undefined, // expect (and discard) an 'S' before the TLS response if pipelineTLS is set - }, - ); + const [tlsRead, tlsWrite] = await this.subtls.startTls(host, rootCerts, networkRead, networkWrite, { + useSNI: !this.disableSNI, + expectPreData: this.pipelineTLS ? new Uint8Array([0x53]) : undefined, // expect (and discard) an 'S' before the TLS response if pipelineTLS is set + }); this.tlsRead = tlsRead; this.tlsWrite = tlsWrite; @@ -512,18 +481,13 @@ export class Socket extends EventEmitter { } } - write( - data: Buffer | string, - encoding = 'utf8', - callback = (err?: any) => {}, - ) { + write(data: Buffer | string, encoding = 'utf8', callback = (err?: any) => {}) { if (data.length === 0) { callback(); return true; } - if (typeof data === 'string') - data = Buffer.from(data, encoding as BufferEncoding) as unknown as Buffer; + if (typeof data === 'string') data = Buffer.from(data, encoding as BufferEncoding) as unknown as Buffer; if (this.tlsState === TlsState.None) { debug && log('sending data direct:', data); @@ -544,11 +508,7 @@ export class Socket extends EventEmitter { return true; } - end( - data: Buffer | string = Buffer.alloc(0) as unknown as Buffer, - encoding = 'utf8', - callback = () => {}, - ) { + end(data: Buffer | string = Buffer.alloc(0) as unknown as Buffer, encoding = 'utf8', callback = () => {}) { debug && log('ending socket'); this.write(data, encoding, () => { this.ws!.close(); diff --git a/shims/pg-native/index.js b/shims/pg-native/index.ts similarity index 100% rename from shims/pg-native/index.js rename to shims/pg-native/index.ts diff --git a/shims/shims.js b/shims/shims.js index 2d5974f..f269a5d 100644 --- a/shims/shims.js +++ b/shims/shims.js @@ -1,9 +1,7 @@ export const global = globalThis; -export const setImmediate = - globalThis.setImmediate ?? ((fn) => setTimeout(fn, 0)); -export const clearImmediate = - globalThis.clearImmediate ?? ((id) => clearTimeout(id)); +export const setImmediate = globalThis.setImmediate ?? ((fn) => setTimeout(fn, 0)); +export const clearImmediate = globalThis.clearImmediate ?? ((id) => clearTimeout(id)); export const crypto = globalThis.crypto ?? {}; crypto.subtle ??= {}; @@ -12,8 +10,7 @@ crypto.subtle ??= {}; // Next.js has a booby-trapped Buffer object that just springs errors, so we test allocUnsafe as well export const Buffer = - typeof globalThis.Buffer === 'function' && - typeof globalThis.Buffer.allocUnsafe === 'function' + typeof globalThis.Buffer === 'function' && typeof globalThis.Buffer.allocUnsafe === 'function' ? globalThis.Buffer : require('buffer/').Buffer; diff --git a/shims/string_decoder/index.ts b/shims/string_decoder/index.ts index fcea224..0eb5b55 100644 --- a/shims/string_decoder/index.ts +++ b/shims/string_decoder/index.ts @@ -1,5 +1,9 @@ +declare global { + class TextDecoderClass extends TextDecoder {} +} + export class StringDecoder { - td: TextDecoder; + td: TextDecoderClass; constructor(encoding: ConstructorParameters[0]) { this.td = new TextDecoder(encoding); diff --git a/shims/tls/index.ts b/shims/tls/index.ts index 55d3a01..1ae22e3 100644 --- a/shims/tls/index.ts +++ b/shims/tls/index.ts @@ -1,10 +1,4 @@ -export function connect({ - socket, - servername, -}: { - socket: any; - servername: string; -}) { +export function connect({ socket, servername }: { socket: { startTls: (servername: string) => void }; servername: string }) { socket.startTls(servername); return socket; } diff --git a/shims/url/index.ts b/shims/url/index.ts index e871b42..af38352 100644 --- a/shims/url/index.ts +++ b/shims/url/index.ts @@ -2,24 +2,12 @@ export function parse(url: string, parseQueryString = false) { const { protocol } = new URL(url); // we now swap the protocol to http: so that `new URL()` will parse it fully const httpUrl = 'http:' + url.substring(protocol.length); - let { - username, - password, - host, - hostname, - port, - pathname, - search, - searchParams, - hash, - } = new URL(httpUrl); + let { username, password, host, hostname, port, pathname, search, searchParams, hash } = new URL(httpUrl); password = decodeURIComponent(password); username = decodeURIComponent(username); pathname = decodeURIComponent(pathname); const auth = username + ':' + password; - const query = parseQueryString - ? Object.fromEntries(searchParams.entries()) - : search; + const query = parseQueryString ? Object.fromEntries(searchParams.entries()) : search; return { href: url, protocol, diff --git a/src/index.ts b/src/index.ts index af9d7c4..dd354c6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,13 +15,7 @@ import isrgRootX1 from './isrgrootx1.pem'; import { deepEqual } from 'fast-equals'; import { Client, Pool, neon, neonConfig } from '../export'; -import { - timedRepeats, - runQuery, - clientRunQuery, - poolRunQuery, - httpRunQuery, -} from './util'; +import { timedRepeats, runQuery, clientRunQuery, poolRunQuery, httpRunQuery } from './util'; import { queries } from './queries'; import type { ExecutionContext } from '@cloudflare/workers-types'; @@ -35,11 +29,7 @@ export interface Env { // simple tests for Cloudflare Workers -export async function cf( - request: Request, - env: Env, - ctx: ExecutionContext, -): Promise { +export async function cf(request: Request, env: Env, ctx: ExecutionContext): Promise { let results: any[] = []; for (const query of queries) { @@ -73,8 +63,7 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { sql`SELECT ${'hello'} AS "batchStr"`, ]); log('batch results:', JSON.stringify(ra), JSON.stringify(rb), '\n'); - if (ra.batchInt !== 1 || rb.batchStr !== 'hello') - throw new Error('Batch query problem'); + if (ra.batchInt !== 1 || rb.batchStr !== 'hello') throw new Error('Batch query problem'); // basic batch query const [[r1], [r2]] = await sql.transaction((txn) => [ @@ -82,8 +71,7 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { txn`SELECT ${'hello'} AS "batchStr"`, ]); log('batch results:', JSON.stringify(r1), JSON.stringify(r2), '\n'); - if (r1.batchInt !== 1 || r2.batchStr !== 'hello') - throw new Error('Batch query problem'); + if (r1.batchInt !== 1 || r2.batchStr !== 'hello') throw new Error('Batch query problem'); // empty batch query const emptyResult = await sql.transaction((txn) => []); @@ -91,18 +79,10 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { // option setting on `transaction()` const [[[r3]], [[r4]]] = await sql.transaction( - (txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${'hello'} AS "batchStr"`, - ], + (txn) => [txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`], { arrayMode: true, isolationLevel: 'Serializable', readOnly: true }, ); - log( - 'array mode (via transaction options) batch results:', - JSON.stringify(r3), - JSON.stringify(r4), - '\n', - ); + log('array mode (via transaction options) batch results:', JSON.stringify(r3), JSON.stringify(r4), '\n'); if (r3 !== 1 || r4 !== 'hello') throw new Error('Batch query problem'); // option setting on `neon()` @@ -114,61 +94,36 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`, ]); - log( - 'array mode (via neon options) batch results:', - JSON.stringify(r5), - JSON.stringify(r6), - '\n', - ); + log('array mode (via neon options) batch results:', JSON.stringify(r5), JSON.stringify(r6), '\n'); if (r5 !== 1 || r6 !== 'hello') throw new Error('Batch query problem'); // option setting in transaction overrides option setting on Neon const sqlArr2 = neon(env.NEON_DB_URL, { arrayMode: true }); const [[r7], [r8]] = await sqlArr2.transaction( - (txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${'hello'} AS "batchStr"`, - ], + (txn) => [txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`], { arrayMode: false }, ); - log( - 'ordinary (via overridden options) batch results:', - JSON.stringify(r7), - JSON.stringify(r8), - '\n', - ); - if (r7.batchInt !== 1 || r8.batchStr !== 'hello') - throw new Error('Batch query problem'); + log('ordinary (via overridden options) batch results:', JSON.stringify(r7), JSON.stringify(r8), '\n'); + if (r7.batchInt !== 1 || r8.batchStr !== 'hello') throw new Error('Batch query problem'); // option setting on individual queries within a batch: should be honoured (despite types not supporting it) const [[r9], [r10]] = await sql.transaction((txn) => [ txn`SELECT ${1}::int AS "batchInt"`, txn('SELECT $1 AS "batchStr"', ['hello'], { arrayMode: true }), ]); - log( - 'query options on individual batch queries:', - JSON.stringify(r9), - JSON.stringify(r10), - '\n', - ); - if (r9.batchInt !== 1 || r10[0] !== 'hello') - throw new Error('Batch query problem'); + log('query options on individual batch queries:', JSON.stringify(r9), JSON.stringify(r10), '\n'); + if (r9.batchInt !== 1 || r10[0] !== 'hello') throw new Error('Batch query problem'); // invalid query to `transaction()` let queryErr = undefined; try { // @ts-ignore - await sql.transaction((txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - `SELECT 'hello' AS "batchStr"`, - ]); + await sql.transaction((txn) => [txn`SELECT ${1}::int AS "batchInt"`, `SELECT 'hello' AS "batchStr"`]); } catch (err) { queryErr = err; } if (queryErr === undefined) - throw new Error( - 'Error should have been raised for string passed to `transaction()`', - ); + throw new Error('Error should have been raised for string passed to `transaction()`'); log('successfully caught invalid query passed to `transaction()`\n'); // wrong DB URL @@ -181,16 +136,11 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { } catch (err) { connErr = err; } - if (connErr === undefined) - throw new Error('Error should have been raised for bad password'); + if (connErr === undefined) throw new Error('Error should have been raised for bad password'); log('successfully caught invalid password passed to `neon()`\n'); } -export async function latencies( - env: Env, - useSubtls: boolean, - log = (...s: any[]) => {}, -): Promise { +export async function latencies(env: Env, useSubtls: boolean, log = (...s: any[]) => {}): Promise { const queryRepeats = [1, 3]; const connectRepeats = 9; @@ -220,8 +170,7 @@ export async function latencies( pgRes.fields.map((f: any) => f.dataTypeID), ); const rowsMatch = deepEqual(rows, pgRes.rows); - const ok = - commandMatches && rowCountMatches && rowsMatch && dataTypesMatch; + const ok = commandMatches && rowCountMatches && rowsMatch && dataTypesMatch; log( ok ? '\u2713' : 'X', @@ -294,11 +243,7 @@ export async function latencies( await sql('SELECT 123 AS num', [], { arrayMode: true, fullResults: true }); // timeout - function sqlWithRetries( - sql: ReturnType, - timeoutMs: number, - attempts = 3, - ) { + function sqlWithRetries(sql: ReturnType, timeoutMs: number, attempts = 3) { return async function (strings: TemplateStringsArray, ...params: any[]) { // reassemble template string let query = ''; @@ -309,10 +254,7 @@ export async function latencies( // run query with timeout and retries for (let i = 1; ; i++) { const abortController = new AbortController(); - const timeout = setTimeout( - () => abortController.abort('fetch timed out'), - timeoutMs, - ); + const timeout = setTimeout(() => abortController.abort('fetch timed out'), timeoutMs); try { const { signal } = abortController; @@ -374,13 +316,8 @@ export async function latencies( for (const query of queries) { log(`\n----- ${query.sql} -----\n\n`); - async function section( - queryRepeat: number, - f: (n: number) => Promise, - ) { - const marker = String.fromCharCode( - counter + (counter > 25 ? 49 - 26 : 65), - ); // A - Z, 1 - 9 + async function section(queryRepeat: number, f: (n: number) => Promise) { + const marker = String.fromCharCode(counter + (counter > 25 ? 49 - 26 : 65)); // A - Z, 1 - 9 log(`${marker}\n`); // this will error, but makes for a handy heading in the dev tools Network pane (or Wireshark) @@ -436,23 +373,17 @@ export async function latencies( await clientRunQuery(n, client, ctx, query); }); - await sections( - 'Neon/wss, pipelined connect using Pool.query', - async (n) => { - await poolRunQuery(n, env.NEON_DB_URL, ctx, query); - }, - ); + await sections('Neon/wss, pipelined connect using Pool.query', async (n) => { + await poolRunQuery(n, env.NEON_DB_URL, ctx, query); + }); - await sections( - 'Neon/wss, pipelined connect using Pool.connect', - async (n) => { - const pool = new Pool({ connectionString: env.NEON_DB_URL }); - const poolClient = await pool.connect(); - await timedRepeats(n, () => runQuery(poolClient, query)); - poolClient.release(); - ctx.waitUntil(pool.end()); - }, - ); + await sections('Neon/wss, pipelined connect using Pool.connect', async (n) => { + const pool = new Pool({ connectionString: env.NEON_DB_URL }); + const poolClient = await pool.connect(); + await timedRepeats(n, () => runQuery(poolClient, query)); + poolClient.release(); + ctx.waitUntil(pool.end()); + }); if (useSubtls) { neonConfig.subtls = subtls; @@ -462,8 +393,7 @@ export async function latencies( const client = new Client(env.NEON_DB_URL); client.neonConfig.wsProxy = (host, port) => `subtls-wsproxy.jawj.workers.dev/?address=${host}:${port}`; - client.neonConfig.forceDisablePgSSL = - client.neonConfig.useSecureWebSocket = false; + client.neonConfig.forceDisablePgSSL = client.neonConfig.useSecureWebSocket = false; client.neonConfig.pipelineTLS = false; // only works with patched pg client.neonConfig.pipelineConnect = false; // only works with password auth, which we aren't offered this way try { diff --git a/src/queries.ts b/src/queries.ts index f3bf359..5e08719 100644 --- a/src/queries.ts +++ b/src/queries.ts @@ -10,7 +10,6 @@ export const queries: Query[] = [ }, { sql: 'SELECT now()', - test: (rows) => - /^2\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d+Z$/.test(rows[0].now.toISOString()), + test: (rows) => /^2\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d+Z$/.test(rows[0].now.toISOString()), }, ]; diff --git a/src/util.ts b/src/util.ts index 9ab6f11..f4a83ce 100644 --- a/src/util.ts +++ b/src/util.ts @@ -25,51 +25,28 @@ export async function timedRepeats( return [total, results] as const; } -export async function runQuery( - queryable: ClientBase | Pool | ReturnType, - query: Query, -) { +export async function runQuery(queryable: ClientBase | Pool | ReturnType, query: Query) { const { sql, test } = query; - const { rows } = await (typeof queryable === 'function' - ? queryable(sql) - : queryable.query(sql)); - if (!test(rows)) - throw new Error( - `Result fails test\nQuery: ${sql}\nResult: ${JSON.stringify(rows)}`, - ); + const { rows } = await (typeof queryable === 'function' ? queryable(sql) : queryable.query(sql)); + if (!test(rows)) throw new Error(`Result fails test\nQuery: ${sql}\nResult: ${JSON.stringify(rows)}`); return rows; } -export async function clientRunQuery( - n: number, - client: Client, - ctx: ExecutionContext, - query: Query, -) { +export async function clientRunQuery(n: number, client: Client, ctx: ExecutionContext, query: Query) { await client.connect(); const tPlusResults = await timedRepeats(n, () => runQuery(client, query)); ctx.waitUntil(client.end()); return tPlusResults; } -export async function poolRunQuery( - n: number, - dbUrl: string, - ctx: ExecutionContext, - query: Query, -) { +export async function poolRunQuery(n: number, dbUrl: string, ctx: ExecutionContext, query: Query) { const pool = new Pool({ connectionString: dbUrl }); const tPlusResults = await timedRepeats(n, () => runQuery(pool, query)); ctx.waitUntil(pool.end()); return tPlusResults; } -export async function httpRunQuery( - n: number, - dbUrl: string, - ctx: ExecutionContext, - query: Query, -) { +export async function httpRunQuery(n: number, dbUrl: string, ctx: ExecutionContext, query: Query) { const sql = neon(dbUrl, { fullResults: true }); const tPlusResults = await timedRepeats(n, () => runQuery(sql, query)); return tPlusResults; @@ -85,11 +62,7 @@ export function stableStringify( k, typeof v !== 'object' || v === null || Array.isArray(v) ? v - : Object.fromEntries( - Object.entries(v).sort(([ka], [kb]) => - ka < kb ? -1 : ka > kb ? 1 : 0, - ), - ), + : Object.fromEntries(Object.entries(v).sort(([ka], [kb]) => (ka < kb ? -1 : ka > kb ? 1 : 0))), ); return JSON.stringify(x, deterministicReplacer, indent); diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..78d1249 --- /dev/null +++ b/tests/README.md @@ -0,0 +1,19 @@ +We MUST test using the esbuild exported/bundled driver, because various shims are inserted only via this process. Importing the driver from `../export` thus does not test much of the code that it is intended to. + +## Platforms + +Node LTS (has WebSocket from 22 onwards) +Node 18 (first with fetch) + ws +Bun +Deno? + +Cloudflare Workers +Vercel Functions: Edge -- bare bones +Vercel Functions: Edge -- Next.js +Vercel Functions: Node -- bare bones +Vercel Functions: Node -- Next.js +AWS Lambda + +Chrome +Safari? +Firefox? diff --git a/tests/http.test.ts b/tests/http.test.ts index ac9ad17..090e74d 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -1,6 +1,6 @@ import { expect, test, vi } from 'vitest'; -import { neon, neonConfig, Pool } from '../export' -import { sampleSelects } from './sampleSelects'; +import { neon, neonConfig, Pool } from '../dist/npm'; +import { sampleQueries } from './sampleQueries'; const DB_URL = process.env.VITE_NEON_DB_URL!; const sql = neon(DB_URL); @@ -10,21 +10,22 @@ const pool = new Pool({ connectionString: DB_URL }); test('http query results match WebSocket query results', { timeout: 30000 }, async () => { const client = await pool.connect(); - for (const queryPromise of sampleSelects(sqlFull)) { + for (const queryPromise of sampleQueries(sqlFull)) { const { query, params } = queryPromise.parameterizedQuery; - const [httpResult, wsResult] = await Promise.all([ - queryPromise, - client.query(query, params), - ]); + const [httpResult, wsResult] = await Promise.all([queryPromise, client.query(query, params)]); // account for known/accepted differences: // * http results are plain Objects, not Result instances // * http results lack `oid` and `RowCtor` fields (which are both usually `null`) - // * http result `fields` array contains plain Objects, not Field instances + // * http result `fields` array contains plain Objects, not Field instances // * http results have `"viaNeonFetch": true` const httpResultProcessed = { ...httpResult, oid: null, RowCtor: null }; - const wsResultProcessed = { ...wsResult, fields: wsResult.fields.map(f => ({ ...f })), viaNeonFetch: true }; + const wsResultProcessed = { + ...wsResult, + fields: wsResult.fields.map((f) => ({ ...f })), + viaNeonFetch: true, + }; expect(httpResultProcessed).toStrictEqual(wsResultProcessed); } @@ -51,26 +52,24 @@ test('errors match WebSocket query errors', async () => { ]); // now compare all other properties (`code`, `routine`, `severity`, etc.) - const [httpErr, wsErr] = await Promise.all([ - new Promise(resolve => sql(q).catch((e: Error) => resolve(e))), - new Promise(resolve => pool.query(q).catch((e: Error) => resolve(e))), - ]) as [any, any]; + const [httpErr, wsErr] = (await Promise.all([ + new Promise((resolve) => sql(q).catch((e: Error) => resolve(e))), + new Promise((resolve) => pool.query(q).catch((e: Error) => resolve(e))), + ])) as [any, any]; // account for known/accepted differences - httpErr.length = wsErr.length; // http errors don't have a `length` property - httpErr.name = wsErr.name; // http errors are named 'NeonDbError' rather than plain 'error' - wsErr.sourceError = undefined; // this property is unique to http errors + httpErr.length = wsErr.length; // http errors don't have a `length` property + httpErr.name = wsErr.name; // http errors are named 'NeonDbError' rather than plain 'error' + wsErr.sourceError = undefined; // this property is unique to http errors // convert the errors into ordinary Objects, because vitest compares Errors only by message expect({ ...httpErr }).toStrictEqual({ ...wsErr }); }); test('http queries with too few or too many parameters', async () => { - await expect(sql('SELECT $1', [])) - .rejects.toThrowError('bind message supplies 0 parameters'); + await expect(sql('SELECT $1', [])).rejects.toThrowError('bind message supplies 0 parameters'); - await expect(sql('SELECT $1', [1, 2])) - .rejects.toThrowError('bind message supplies 2 parameters'); + await expect(sql('SELECT $1', [1, 2])).rejects.toThrowError('bind message supplies 2 parameters'); }); test('timeout aborting an http query', { timeout: 5000 }, async () => { @@ -78,9 +77,9 @@ test('timeout aborting an http query', { timeout: 5000 }, async () => { const { signal } = abortController; setTimeout(() => abortController.abort('fetch timed out'), 250); - await expect( - sql('SELECT pg_sleep(2)', [], { fetchOptions: { signal } }) - ).rejects.toThrow('fetch timed out'); + await expect(sql('SELECT pg_sleep(2)', [], { fetchOptions: { signal } })).rejects.toThrow( + 'fetch timed out', + ); }); test('timeout not aborting an http query', { timeout: 5000 }, async () => { @@ -88,9 +87,9 @@ test('timeout not aborting an http query', { timeout: 5000 }, async () => { const { signal } = abortController; const timeout = setTimeout(() => abortController.abort('fetch timed out'), 2000); - await expect( - sql('SELECT pg_sleep(.5)', [], { fetchOptions: { signal } }) - ).resolves.toStrictEqual([{ pg_sleep: '' }]); + await expect(sql('SELECT pg_sleep(.5)', [], { fetchOptions: { signal } })).resolves.toStrictEqual([ + { pg_sleep: '' }, + ]); clearTimeout(timeout); }); @@ -98,43 +97,39 @@ test('timeout not aborting an http query', { timeout: 5000 }, async () => { test('database URL with wrong user to `neon()`', async () => { const urlWithBadHost = DB_URL.replace('//', '//x'); const sqlBad = neon(urlWithBadHost); - await expect(sqlBad`SELECT ${1}::int AS one`) - .rejects.toThrowError('password authentication failed'); + await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError('password authentication failed'); }); test('database URL with wrong password to `neon()`', async () => { const urlWithBadPassword = DB_URL.replace('@', 'x@'); const sqlBad = neon(urlWithBadPassword); - await expect(sqlBad`SELECT ${1}::int AS one`) - .rejects.toThrowError('password authentication failed'); + await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError('password authentication failed'); }); test('database URL with wrong project to `neon()`', async () => { const urlWithBadHost = DB_URL.replace('@', '@x'); const sqlBad = neon(urlWithBadHost); - await expect(sqlBad`SELECT ${1}::int AS one`) - .rejects.toThrowError('password authentication failed'); + await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError('password authentication failed'); }); test('database URL with wrong host to `neon()`', { timeout: 10000 }, async () => { const urlWithBadHost = DB_URL.replace('.neon.tech', '.neon.techh'); const sqlBad = neon(urlWithBadHost); - await expect(sqlBad`SELECT ${1}::int AS one`) - .rejects.toThrowError('fetch failed'); + await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError('fetch failed'); }); test('undefined database URL', async () => { - expect(() => neon(undefined as unknown as string)) - .toThrowError('No database connection string was provided'); + expect(() => neon(undefined as unknown as string)).toThrowError( + 'No database connection string was provided', + ); }); test('empty database URL to `neon()`', async () => { - expect(() => neon('')) - .toThrowError('No database connection string was provided'); + expect(() => neon('')).toThrowError('No database connection string was provided'); }); test('wrong-scheme database URL to `neon()`', async () => { - expect(() => neon(DB_URL.replace(/^/, 'x'))) - .toThrowError('Database connection string format for `neon()` should be'); + expect(() => neon(DB_URL.replace(/^/, 'x'))).toThrowError( + 'Database connection string format for `neon()` should be', + ); }); - diff --git a/tests/httpTransaction.test.ts b/tests/httpTransaction.test.ts index 930da65..b180085 100644 --- a/tests/httpTransaction.test.ts +++ b/tests/httpTransaction.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest'; -import { neon } from '../export' +import { neon } from '../dist/npm'; const DB_URL = process.env.VITE_NEON_DB_URL!; const sql = neon(DB_URL); @@ -34,11 +34,8 @@ test('empty batch query with array', async () => { test('option setting on `transaction()`', async () => { const [[[a]], [[b]]] = await sql.transaction( - (txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${'hello'} AS "batchStr"`, - ], - { arrayMode: true, isolationLevel: 'Serializable', readOnly: true }, // arrayMode changes result format destructured above + (txn) => [txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`], + { arrayMode: true, isolationLevel: 'Serializable', readOnly: true }, // arrayMode changes result format destructured above ); expect(a).toBe(1); expect(b).toBe('hello'); @@ -46,7 +43,7 @@ test('option setting on `transaction()`', async () => { test('option setting on `neon()`', async () => { const sqlArr = neon(DB_URL, { - arrayMode: true, // arrayMode changes result format destructured below + arrayMode: true, // arrayMode changes result format destructured below isolationLevel: 'RepeatableRead', }); const [[[a]], [[b]]] = await sqlArr.transaction((txn) => [ @@ -60,10 +57,7 @@ test('option setting on `neon()`', async () => { test('option setting on `transaction()` overrides option setting on `neon()`', async () => { const sqlArr = neon(DB_URL, { arrayMode: true }); const [[a], [b]] = await sqlArr.transaction( - (txn) => [ - txn`SELECT ${1}::int AS "batchInt"`, - txn`SELECT ${'hello'} AS "batchStr"`, - ], + (txn) => [txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`], { arrayMode: false }, ); expect(a.batchInt).toBe(1); @@ -84,10 +78,11 @@ test('invalid queries passed to `transaction()` in function', async () => { // @ts-expect-error sql.transaction((txn) => [ txn`SELECT ${1}::int AS "batchInt"`, - `SELECT ${'hello'} AS "batchStr"`, // <- oops, this is a bare string - ]) - ) - .rejects.toThrowError('transaction() expects an array of queries, or a function returning an array of queries'); + `SELECT ${'hello'} AS "batchStr"`, // <- oops, this is a bare string + ]), + ).rejects.toThrowError( + 'transaction() expects an array of queries, or a function returning an array of queries', + ); }); test('invalid queries passed to `transaction()` in array', async () => { @@ -95,8 +90,9 @@ test('invalid queries passed to `transaction()` in array', async () => { sql.transaction([ sql`SELECT ${1}::int AS "batchInt"`, // @ts-expect-error - `SELECT ${'hello'} AS "batchStr"`, // <- oops, this is a bare string - ]) - ) - .rejects.toThrowError('transaction() expects an array of queries, or a function returning an array of queries'); + `SELECT ${'hello'} AS "batchStr"`, // <- oops, this is a bare string + ]), + ).rejects.toThrowError( + 'transaction() expects an array of queries, or a function returning an array of queries', + ); }); diff --git a/tests/sampleSelects.ts b/tests/sampleQueries.ts similarity index 95% rename from tests/sampleSelects.ts rename to tests/sampleQueries.ts index 30a239c..60e0105 100644 --- a/tests/sampleSelects.ts +++ b/tests/sampleQueries.ts @@ -1,7 +1,7 @@ -import type { neon } from '../export'; +import type { neon } from '../dist/npm'; const now = new Date(); -export const sampleSelects = (sql: ReturnType) => [ +export const sampleQueries = (sql: ReturnType) => [ // tagged-template sql`SELECT ${1} AS int_uncast`, sql`SELECT ${-1}::int AS int`, diff --git a/tests/subtls-rootcerts.pem b/tests/subtls-rootcerts.pem new file mode 100644 index 0000000..b85c803 --- /dev/null +++ b/tests/subtls-rootcerts.pem @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE----- diff --git a/tests/ws.test.ts b/tests/ws.test.ts index 38c95a7..cf80204 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -1,7 +1,8 @@ import { expect, test } from 'vitest'; import { Pool as PgPool } from 'pg'; -import { neon, Pool as WsPool } from '../export'; -import { sampleSelects } from './sampleSelects'; +import * as subtls from 'subtls'; +import { neon, neonConfig, Pool as WsPool, Client as WsClient } from '../dist/npm'; +import { sampleQueries } from './sampleQueries'; const DB_URL = process.env.VITE_NEON_DB_URL!; @@ -9,19 +10,132 @@ const sql = neon(DB_URL); const wsPool = new WsPool({ connectionString: DB_URL }); const pgPool = new PgPool({ connectionString: DB_URL }); -test('WebSockets query results match pg/TCP query results', { timeout: 30000 }, async () => { - const wsClient = await wsPool.connect(); - const pgClient = await pgPool.connect(); - - for (const queryPromise of sampleSelects(sql)) { - const { query, params } = queryPromise.parameterizedQuery; - const [wsResult, pgResult] = await Promise.all([ - wsClient.query(query, params), - pgClient.query(query, params), - ]); - expect(wsResult).toStrictEqual(pgResult); +test( + 'WebSockets query results match pg/TCP query results, using pool.connect()', + { timeout: 30000 }, + async () => { + const wsClient = await wsPool.connect(); + const pgClient = await pgPool.connect(); + + for (const queryPromise of sampleQueries(sql)) { + const { query, params } = queryPromise.parameterizedQuery; + const [wsResult, pgResult] = await Promise.all([ + wsClient.query(query, params), + pgClient.query(query, params), + ]); + expect(wsResult).toStrictEqual(pgResult); + } + + wsClient.release(); + pgClient.release(); + }, +); + +test('pool.query() over WebSockets', async () => { + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBeUndefined(); +}); + +test('pool.query() with poolQueryViaFetch', async () => { + try { + neonConfig.poolQueryViaFetch = true; + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBe(true); + } finally { + neonConfig.poolQueryViaFetch = false; + } +}); + +test('client.query()', async () => { + const client = new WsClient(DB_URL); + await client.connect(); + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + await client.end(); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBeUndefined(); +}); + +test('client.query() with pipelined connect (yes, no) x coalesced writes (yes, no)', async () => { + const { pipelineConnect, coalesceWrites } = neonConfig; + try { + for (const pc of ['password', false] as const) { + for (const cw of [true, false]) { + neonConfig.pipelineConnect = pc; + neonConfig.coalesceWrites = cw; + + const client = new WsClient(DB_URL); + await client.connect(); + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + await client.end(); + + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBeUndefined(); + } + } + } finally { + neonConfig.pipelineConnect = pipelineConnect; + neonConfig.coalesceWrites = coalesceWrites; } +}); + +const ISRGX1Cert = `-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE-----`; - wsClient.release(); - pgClient.release(); +test('client.query() with custom WebSocket proxy and subtls', async () => { + const { wsProxy, pipelineConnect, forceDisablePgSSL, rootCerts, subtls: origSubtls } = neonConfig; + try { + neonConfig.wsProxy = process.env.WSPROXY!; + //neonConfig.subtls = subtls; + //neonConfig.rootCerts = ISRGX1Cert; + + // Neon requires TLS for apparently-ordinary TCP connections + //neonConfig.forceDisablePgSSL = false; + + // pipelining only works with password auth, which we aren't offered this way + //neonConfig.pipelineConnect = false; + + const client = new WsClient(DB_URL); + await client.connect(); + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + await client.end(); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBeUndefined(); + } finally { + neonConfig.wsProxy = wsProxy; + neonConfig.pipelineConnect = pipelineConnect; + neonConfig.forceDisablePgSSL = forceDisablePgSSL; + neonConfig.rootCerts = rootCerts; + neonConfig.subtls = origSubtls; + } }); diff --git a/tests/wsTransaction.test.ts b/tests/wsTransaction.test.ts new file mode 100644 index 0000000..7d7fa74 --- /dev/null +++ b/tests/wsTransaction.test.ts @@ -0,0 +1,8 @@ +import { expect, test, vi } from 'vitest'; + +// client/pool.connect + transactions work +// pool.query + transaction doesn't? + +test('one plus one', async () => { + expect(1 + 1).toBe(2); +}); diff --git a/tsconfig.json b/tsconfig.json index 979442e..619a9ba 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,18 +7,17 @@ "module": "ES2022" /* Specify what module code is generated. */, "moduleResolution": "Node" /* Specify how TypeScript looks up a file from a given module specifier. */, "esModuleInterop": true, - "types": [ - "@cloudflare/workers-types" - ] /* Specify type package names to be included without being referenced in a source file. */, "resolveJsonModule": true /* Enable importing .json files */, "allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */, "checkJs": false /* Enable error reporting in type-checked JavaScript files. */, - "noEmit": true /* Disable emitting files from a compilation. */, + "declaration": true, + "emitDeclarationOnly": true, + "declarationDir": "dist/dts", "isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */, "allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */, "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, "strict": true /* Enable all strict type-checking options. */, - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": false /* Skip type checking all .d.ts files. */ }, - "exclude": ["dist"] + "files": ["export/index.ts"] } From 2520b1cd6751226d9561e3bddeb525b60583a72f Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Mon, 16 Dec 2024 22:19:35 +0000 Subject: [PATCH 20/40] Type generation fixes --- api-extractor.json | 9 ++- dist/dts/export/httpQuery.d.ts | 2 +- dist/dts/shims/net/index.d.ts | 12 --- dist/dts/shims/net/index.d.ts.orig | 118 +++++++++++++++++++++++++++++ dist/npm/index.d.mts | 2 +- dist/npm/index.d.ts | 2 +- export/httpQuery.ts | 2 +- package.json | 2 +- tests/wsTransaction.test.ts | 2 +- 9 files changed, 132 insertions(+), 19 deletions(-) create mode 100644 dist/dts/shims/net/index.d.ts.orig diff --git a/api-extractor.json b/api-extractor.json index 276494b..3171e63 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -14,5 +14,12 @@ }, "tsdocMetadata": { "enabled": false + }, + "messages": { + "extractorMessageReporting": { + "ae-wrong-input-file-type": { + "logLevel": "none" + } + } } -} +} \ No newline at end of file diff --git a/dist/dts/export/httpQuery.d.ts b/dist/dts/export/httpQuery.d.ts index 05d03b3..b05c398 100644 --- a/dist/dts/export/httpQuery.d.ts +++ b/dist/dts/export/httpQuery.d.ts @@ -44,6 +44,6 @@ interface NeonQueryPromise extends Promise { } export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; - transaction(queries: NeonQueryPromise[] | ((sql: /*elided*/ any) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; + transaction(queries: NeonQueryPromise[] | ((sql: (strings: TemplateStringsArray | string, ...params: any[]) => NeonQueryPromise) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; }; export {}; diff --git a/dist/dts/shims/net/index.d.ts b/dist/dts/shims/net/index.d.ts index b891b28..9c7c0ae 100644 --- a/dist/dts/shims/net/index.d.ts +++ b/dist/dts/shims/net/index.d.ts @@ -7,18 +7,6 @@ */ import { EventEmitter } from 'events'; import type * as subtls from 'subtls'; -declare global { - const debug: boolean; - interface WebSocket { - binaryType: 'arraybuffer' | 'blob'; - accept?: () => void; - } - interface Response { - webSocket: WebSocket; - } - class __unstable_WebSocket extends WebSocket { - } -} export declare function isIP(input: string): number; interface FetchEndpointOptions { jwtAuth?: boolean; diff --git a/dist/dts/shims/net/index.d.ts.orig b/dist/dts/shims/net/index.d.ts.orig new file mode 100644 index 0000000..b891b28 --- /dev/null +++ b/dist/dts/shims/net/index.d.ts.orig @@ -0,0 +1,118 @@ +/** + * This file shims parts of the Node.js built-in net and tls packages, by + * implementing net.Socket and tls.connect() on top of WebSockets. It's + * designed to work both in browsers and in Cloudflare Workers (where + * WebSockets work a bit differently). The calling client is assumed to be pg + * (node-postgres). + */ +import { EventEmitter } from 'events'; +import type * as subtls from 'subtls'; +declare global { + const debug: boolean; + interface WebSocket { + binaryType: 'arraybuffer' | 'blob'; + accept?: () => void; + } + interface Response { + webSocket: WebSocket; + } + class __unstable_WebSocket extends WebSocket { + } +} +export declare function isIP(input: string): number; +interface FetchEndpointOptions { + jwtAuth?: boolean; +} +export interface SocketDefaults { + poolQueryViaFetch: boolean; + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchConnectionCache: boolean; + fetchFunction: any; + webSocketConstructor: typeof WebSocket | undefined; + wsProxy: string | ((host: string, port: number | string) => string); + useSecureWebSocket: boolean; + forceDisablePgSSL: boolean; + coalesceWrites: boolean; + pipelineConnect: 'password' | false; + subtls: typeof subtls | undefined; + rootCerts: string; + pipelineTLS: boolean; + disableSNI: boolean; +} +export declare class Socket extends EventEmitter { + static defaults: SocketDefaults; + static opts: Partial; + private opts; + static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; + static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); + static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; + static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); + static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); + static get fetchFunction(): SocketDefaults["fetchFunction"]; + static set fetchFunction(newValue: SocketDefaults['fetchFunction']); + static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + static get wsProxy(): SocketDefaults["wsProxy"]; + static set wsProxy(newValue: SocketDefaults['wsProxy']); + get wsProxy(): SocketDefaults["wsProxy"]; + set wsProxy(newValue: SocketDefaults['wsProxy']); + static get coalesceWrites(): SocketDefaults["coalesceWrites"]; + static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + get coalesceWrites(): SocketDefaults["coalesceWrites"]; + set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + static get disableSNI(): SocketDefaults["disableSNI"]; + static set disableSNI(newValue: SocketDefaults['disableSNI']); + get disableSNI(): SocketDefaults["disableSNI"]; + set disableSNI(newValue: SocketDefaults['disableSNI']); + static get pipelineConnect(): SocketDefaults["pipelineConnect"]; + static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + get pipelineConnect(): SocketDefaults["pipelineConnect"]; + set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + static get subtls(): SocketDefaults["subtls"]; + static set subtls(newValue: SocketDefaults['subtls']); + get subtls(): SocketDefaults["subtls"]; + set subtls(newValue: SocketDefaults['subtls']); + static get pipelineTLS(): SocketDefaults["pipelineTLS"]; + static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + get pipelineTLS(): SocketDefaults["pipelineTLS"]; + set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + static get rootCerts(): SocketDefaults["rootCerts"]; + static set rootCerts(newValue: SocketDefaults['rootCerts']); + get rootCerts(): SocketDefaults["rootCerts"]; + set rootCerts(newValue: SocketDefaults['rootCerts']); + wsProxyAddrForHost(host: string, port: number): string; + connecting: boolean; + pending: boolean; + writable: boolean; + encrypted: boolean; + authorized: boolean; + destroyed: boolean; + private ws; + private writeBuffer; + private tlsState; + private tlsRead; + private tlsWrite; + setNoDelay(): this; + setKeepAlive(): this; + ref(): this; + unref(): this; + connect(port: number | string, host: string, connectListener?: () => void): void; + startTls(host: string): Promise; + tlsReadLoop(): Promise; + rawWrite(data: Uint8Array): void; + write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; + end(data?: Buffer | string, encoding?: string, callback?: () => void): this; + destroy(): this; +} +export {}; diff --git a/dist/npm/index.d.mts b/dist/npm/index.d.mts index 68c7421..f0e2b72 100644 --- a/dist/npm/index.d.mts +++ b/dist/npm/index.d.mts @@ -78,7 +78,7 @@ declare interface HTTPTransactionOptions extends HTTPQueryOptions { export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; - transaction(queries: NeonQueryPromise[] | ((sql: /*elided*/ any) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; + transaction(queries: NeonQueryPromise[] | ((sql: (strings: TemplateStringsArray | string, ...params: any[]) => NeonQueryPromise) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; }; export declare class neonConfig extends EventEmitter { diff --git a/dist/npm/index.d.ts b/dist/npm/index.d.ts index 68c7421..f0e2b72 100644 --- a/dist/npm/index.d.ts +++ b/dist/npm/index.d.ts @@ -78,7 +78,7 @@ declare interface HTTPTransactionOptions extends HTTPQueryOptions { export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; - transaction(queries: NeonQueryPromise[] | ((sql: /*elided*/ any) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; + transaction(queries: NeonQueryPromise[] | ((sql: (strings: TemplateStringsArray | string, ...params: any[]) => NeonQueryPromise) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; }; export declare class neonConfig extends EventEmitter { diff --git a/export/httpQuery.ts b/export/httpQuery.ts index 1e05735..57c18a1 100644 --- a/export/httpQuery.ts +++ b/export/httpQuery.ts @@ -194,7 +194,7 @@ export function neon( } resolve.transaction = async ( - queries: NeonQueryPromise[] | ((sql: typeof resolve) => NeonQueryPromise[]), + queries: NeonQueryPromise[] | ((sql: (strings: TemplateStringsArray | string, ...params: any[]) => NeonQueryPromise) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions, ) => { if (typeof queries === 'function') queries = queries(resolve); diff --git a/package.json b/package.json index f755f58..83c224a 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "cfDeploy": "npm run build && wrangler deploy", "format": "prettier -c .", "format:fix": "prettier -w .", - "makeTypes": "npx tsc && (npx @microsoft/api-extractor run --local || true) && cp dist/npm/index.d.ts dist/npm/index.d.mts", + "makeTypes": "npx tsc && sed -i.orig -r '/^declare global [{]$/,/^[}]$/d' dist/dts/shims/net/index.d.ts && npx @microsoft/api-extractor run --local && cp dist/npm/index.d.ts dist/npm/index.d.mts", "test": "npm run export && vitest run --no-file-parallelism" }, "devDependencies": { diff --git a/tests/wsTransaction.test.ts b/tests/wsTransaction.test.ts index 7d7fa74..3e3a0dd 100644 --- a/tests/wsTransaction.test.ts +++ b/tests/wsTransaction.test.ts @@ -1,4 +1,4 @@ -import { expect, test, vi } from 'vitest'; +import { expect, test } from 'vitest'; // client/pool.connect + transactions work // pool.query + transaction doesn't? From fa4aa882108870dd4b7ab3755a59e8c1e0782fe8 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 17 Dec 2024 09:15:15 +0000 Subject: [PATCH 21/40] Undid change to prettier lineWidth --- .prettierrc | 3 +- CONFIG.md | 15 +- README.md | 9 +- api-extractor.json | 2 +- dist/jsr/README.md | 79 +- dist/jsr/index.d.ts | 685 ++++----- dist/jsr/index.js | 1120 +++++++-------- dist/npm/CONFIG.md | 15 +- dist/npm/README.md | 79 +- dist/npm/index.js | 1108 +++++++-------- dist/npm/index.mjs | 1120 +++++++-------- dist/serverless.mjs | 2450 +++++++++++++++++---------------- export/httpQuery.ts | 107 +- export/index.ts | 84 +- export/neonConfig.ts | 9 +- shims/crypto/index.ts | 54 +- shims/net/index.ts | 81 +- shims/shims.js | 9 +- shims/tls/index.ts | 8 +- shims/url/index.ts | 16 +- src/index.ts | 134 +- src/queries.ts | 3 +- src/util.ts | 41 +- tests/http.test.ts | 118 +- tests/httpTransaction.test.ts | 10 +- tests/ws.test.ts | 15 +- 26 files changed, 3825 insertions(+), 3549 deletions(-) diff --git a/.prettierrc b/.prettierrc index 32e9fdb..544138b 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,3 @@ { - "singleQuote": true, - "printWidth": 110 + "singleQuote": true } diff --git a/CONFIG.md b/CONFIG.md index ae4a8be..4f56abf 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -161,7 +161,10 @@ const sql = neon(process.env.DATABASE_URL); const showLatestN = 10; const [posts, tags] = await sql.transaction( - [sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, sql`SELECT * FROM tags`], + [ + sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, + sql`SELECT * FROM tags`, + ], { isolationLevel: 'RepeatableRead', readOnly: true, @@ -172,10 +175,9 @@ const [posts, tags] = await sql.transaction( Or as an example of the function case: ```javascript -const [authors, tags] = await neon(process.env.DATABASE_URL).transaction((txn) => [ - txn`SELECT * FROM authors`, - txn`SELECT * FROM tags`, -]); +const [authors, tags] = await neon(process.env.DATABASE_URL).transaction( + (txn) => [txn`SELECT * FROM authors`, txn`SELECT * FROM tags`], +); ``` The optional second argument to `transaction()`, `options`, has the same keys as the options to the ordinary query function -- `arrayMode`, `fullResults` and `fetchOptions` -- plus three additional keys that concern the transaction configuration. These transaction-related keys are: `isolationMode`, `readOnly` and `deferrable`. They are described below. Defaults for the transaction-related keys can also be set as options to the `neon` function. @@ -267,7 +269,8 @@ If connecting to a non-Neon database, the `wsProxy` option should point to [your ```javascript // either: -neonConfig.wsProxy = (host, port) => `my-wsproxy.example.com/v1?address=${host}:${port}`; +neonConfig.wsProxy = (host, port) => + `my-wsproxy.example.com/v1?address=${host}:${port}`; // or (with identical effect): neonConfig.wsProxy = 'my-wsproxy.example.com/v1'; ``` diff --git a/README.md b/README.md index 2eef9bf..5da601c 100644 --- a/README.md +++ b/README.md @@ -157,8 +157,13 @@ try { await client.query('BEGIN'); const { rows: [{ id: postId }], - } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', ['Welcome']); - await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [postId, 's3.bucket/photo/url']); + } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', [ + 'Welcome', + ]); + await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [ + postId, + 's3.bucket/photo/url', + ]); await client.query('COMMIT'); } catch (err) { await client.query('ROLLBACK'); diff --git a/api-extractor.json b/api-extractor.json index 3171e63..07bf1f9 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -22,4 +22,4 @@ } } } -} \ No newline at end of file +} diff --git a/dist/jsr/README.md b/dist/jsr/README.md index e361b09..2eef9bf 100644 --- a/dist/jsr/README.md +++ b/dist/jsr/README.md @@ -157,13 +157,8 @@ try { await client.query('BEGIN'); const { rows: [{ id: postId }], - } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', [ - 'Welcome', - ]); - await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [ - postId, - 's3.bucket/photo/url', - ]); + } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', ['Welcome']); + await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [postId, 's3.bucket/photo/url']); await client.query('COMMIT'); } catch (err) { await client.query('ROLLBACK'); @@ -196,22 +191,25 @@ export default async (req: Request, ctx: any) => { // create a `Pool` inside the request handler const pool = new Pool({ connectionString: process.env.DATABASE_URL }); - // get and validate the `postId` query parameter - const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); - if (isNaN(postId)) return new Response('Bad request', { status: 400 }); - - // query and validate the post - const [post] = await pool.query('SELECT * FROM posts WHERE id = $1', [postId]); - if (!post) return new Response('Not found', { status: 404 }); - - // end the `Pool` inside the same request handler - // (unlike `await`, `ctx.waitUntil` won't hold up the response) - ctx.waitUntil(pool.end()); - - // return the post as JSON - return new Response(JSON.stringify(post), { - headers: { 'content-type': 'application/json' } - }); + try { + // get and validate the `postId` query parameter + const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); + if (isNaN(postId)) return new Response('Bad request', { status: 400 }); + + // query and validate the post + const { rows: [post] } = await pool.query('SELECT * FROM posts WHERE id = $1', [postId]); + if (!post) return new Response('Not found', { status: 404 }); + + // return the post as JSON + return new Response(JSON.stringify(post), { + headers: { 'content-type': 'application/json' } + }); + + } finally { + // end the `Pool` inside the same request handler + // (unlike `await`, `ctx.waitUntil` won't hold up the response) + ctx.waitUntil(pool.end()); + } } export const config = { @@ -236,22 +234,25 @@ export default async (req: Request, ctx: any) => { const client = new Client(process.env.DATABASE_URL); await client.connect(); - // get and validate the `postId` query parameter - const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); - if (isNaN(postId)) return new Response('Bad request', { status: 400 }); - - // query and validate the post - const [post] = await client.query('SELECT * FROM posts WHERE id = $1', [postId]); - if (!post) return new Response('Not found', { status: 404 }); - - // end the `Client` inside the same request handler - // (unlike `await`, `ctx.waitUntil` won't hold up the response) - ctx.waitUntil(client.end()); - - // return the post as JSON - return new Response(JSON.stringify(post), { - headers: { 'content-type': 'application/json' } - }); + try { + // get and validate the `postId` query parameter + const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); + if (isNaN(postId)) return new Response('Bad request', { status: 400 }); + + // query and validate the post + const { rows: [post] } = await client.query('SELECT * FROM posts WHERE id = $1', [postId]); + if (!post) return new Response('Not found', { status: 404 }); + + // return the post as JSON + return new Response(JSON.stringify(post), { + headers: { 'content-type': 'application/json' } + }); + + } finally { + // end the `Client` inside the same request handler + // (unlike `await`, `ctx.waitUntil` won't hold up the response) + ctx.waitUntil(client.end()); + } } export const config = { diff --git a/dist/jsr/index.d.ts b/dist/jsr/index.d.ts index ec5c7b4..f0e2b72 100644 --- a/dist/jsr/index.d.ts +++ b/dist/jsr/index.d.ts @@ -1,433 +1,312 @@ +import { Client as Client_2 } from 'pg'; +import { ClientBase } from 'pg'; +import { Connection } from 'pg'; +import { DatabaseError } from 'pg'; +import { defaults } from 'pg'; +import { EventEmitter } from 'events'; +import { Pool as Pool_2 } from 'pg'; +import { Query } from 'pg'; +import type * as subtls from 'subtls'; +import { types } from 'pg'; -// @neondatabase/serverless driver types, mimicking pg - -export { - BindConfig, ClientConfig, Connection, ConnectionConfig, CustomTypesConfig, Defaults, defaults, Events, ExecuteConfig, FieldDef, MessageConfig, native, Notification, PoolConfig, Query, QueryArrayConfig, QueryArrayResult, QueryConfig, QueryParse, QueryResult, QueryResultBase, - QueryResultRow, ResultBuilder, Submittable, types -} from "pg"; -export { DatabaseError } from "pg-protocol"; - -interface FetchEndpointOptions { - jwtAuth?: boolean; -} - -export interface NeonConfigGlobalOnly { - /** - * Set `fetchEndpoint` to set the server endpoint to be sent queries via http - * fetch. May be useful in local development (e.g. to set a port that's not - * the default 443). - * - * Provide either the full endpoint URL, or a function that takes the - * database host address and port and returns the full endpoint URL - * (including protocol). - * - * Default: `host => 'https://' + host + '/sql'` - * - */ - fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); - - /** - * **Experimentally**, when `poolQueryViaFetch` is `true`, and no listeners - * for the `"connect"`, `"acquire"`, `"release"` or `"remove"` events are set - * on the `Pool`, queries via `Pool.query()` will be sent by low-latency HTTP - * fetch request. - * - * Default: `false`. - */ - poolQueryViaFetch: boolean; - - /** - * **DEPRECATED**. Previously, only when `fetchConnectionCache` was `true` - * did queries carried via HTTP fetch make use of a connection pool/cache - * on the server. All queries now use the connection pool/cache: this setting - * is ignored. - * - * Default: `true`. - */ - fetchConnectionCache: boolean; - - /** - * The `fetchFunction` option allows you to supply an alternative function - * for making http requests. The function must accept the same arguments as - * native `fetch`. - * - * Default: `undefined`. - */ - fetchFunction: any; +/** + * We export the pg library mostly unchanged, but we do make a few tweaks. + * + * (1) Connecting and querying can require a lot of network round-trips. We + * add a pipelining option for the connection (startup + auth + first query), + * but this works with cleartext password auth only. We can also pipeline TLS + * startup, but currently this works only with Neon hosts (not vanilla pg or + * pgbouncer). + * + * (2) SCRAM auth is deliberately CPU-intensive, and this is not appropriate + * for a serverless environment. In case it is still used, however, we replace + * the standard (synchronous) pg implementation with one that uses SubtleCrypto + * for repeated SHA-256 digests. This saves some time and CPU. + * + * (3) We now (experimentally) redirect Pool.query over a fetch request if the + * circumstances are right. + */ +export declare interface Client { + connection: Connection & { + stream: neonConfig; + sendSCRAMClientFinalMessage: (response: any) => void; + ssl: any; + }; + _handleReadyForQuery: any; + _handleAuthCleartextPassword: any; + startup: any; + getStartupConf: any; + saslSession: any; } -export interface NeonConfigGlobalAndClient { - /** - * If no global `WebSocket` object is available, set `webSocketConstructor` - * to the constructor for a custom WebSocket implementation, such as those - * provided by `ws` or `undici`. - */ - webSocketConstructor: any; - - /** - * Set `wsProxy` to use your own WebSocket proxy server. - * - * Provide either the proxy server’s domain name, or a function that takes - * the database host and port and returns the proxy server address (without - * protocol). - * - * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` - * - * Default: `host => host + '/v2'` - */ - wsProxy: string | ((host: string, port: number | string) => string) | undefined; - - /** - * Use a secure (`wss:`) connection to the WebSocket proxy. - * - * Default: `true`. - */ - useSecureWebSocket: boolean; - - /** - * Disable TLS encryption in the Postgres protocol (as set via e.g. - * `?sslmode=require` in the connection string). Connection remains secure - * if `useSecureWebSocket` is `true`. - * - * Default: `true` - */ - forceDisablePgSSL: boolean; - - /** - * Pipelines the startup message, cleartext password message and first query - * when set to `"password"`. This works only for cleartext password auth. - * - * Default: `"password"`. - */ - pipelineConnect: "password" | false; - - /** - * If `forceDisablePgSSL` is `false` and the Postgres connection parameters - * specify TLS, you must supply the subtls TLS library to this option: - * - * ``` - * import { neonConfig } from '@neondatabase/serverless'; - * import * as subtls from 'subtls'; - * neonConfig.subtls = subtls; - * ``` - * - * Default: `undefined`. - */ - subtls: any; - - /** - * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is - * `false` and the Postgres connection parameters specify TLS. Currently - * compatible only with Neon hosts. - * - * Default: `false`. - */ - pipelineTLS: boolean; - - /** - * Set `rootCerts` to a string comprising one or more PEM files. These are - * the trusted root certificates for a TLS connection to Postgres when - * `forceDisablePgSSL` is `false` and the Postgres connection parameters - * specify TLS. - * - * Default: `""`. - */ - rootCerts: string; - - /** - * Batch multiple network writes per run-loop into a single outgoing - * WebSocket message. - * - * Default: `true`. - */ - coalesceWrites: boolean; - - /** - * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the - * Postgres connection parameters specify TLS, we send no SNI data in the - * Postgres TLS handshake. - * - * On Neon, disabling SNI and including the Neon project name in the password - * avoids CPU-intensive SCRAM authentication, but this is only relevant for - * earlier iterations of Neon's WebSocket support. - * - * Default: `false`. - */ - disableSNI: boolean; +export declare class Client extends Client_2 { + config: any; + get neonConfig(): NeonConfigGlobalAndClient; + constructor(config: any); + connect(): Promise; + connect(callback: (err?: Error) => void): void; + _handleAuthSASLContinue(msg: any): Promise; } -export interface NeonConfig extends NeonConfigGlobalOnly, NeonConfigGlobalAndClient { } +export { ClientBase } -import { - Client as PgClient, - ClientBase as PgClientBase, - Pool as PgPool, - PoolClient as PgPoolClient, - types as PgTypes -} from "pg"; +export { Connection } -export class ClientBase extends PgClientBase { - neonConfig: NeonConfigGlobalAndClient; -} +export { DatabaseError } -export class Client extends PgClient { - neonConfig: NeonConfigGlobalAndClient; -} +export { defaults } -export interface PoolClient extends PgPoolClient { - neonConfig: NeonConfigGlobalAndClient; +declare interface FetchEndpointOptions { + jwtAuth?: boolean; } -export class Pool extends PgPool { - connect(): Promise; - connect(callback: (err: Error, client: PoolClient, done: (release?: any) => void) => void): void; - on(event: 'error', listener: (err: Error, client: PoolClient) => void): this; - on(event: 'connect' | 'acquire' | 'remove', listener: (client: PoolClient) => void): this; +declare interface HTTPQueryOptions { + arrayMode?: boolean; + fullResults?: boolean; + fetchOptions?: Record; + types?: typeof types; + queryCallback?: (query: ParameterizedQuery) => void; + resultCallback?: (query: ParameterizedQuery, result: any, rows: any, opts: any) => void; + authToken?: string | (() => Promise | string); } -export const neonConfig: NeonConfig; - - -// SQL-over-HTTP - -import { FieldDef } from "pg"; - -export type QueryRows = - ArrayMode extends true ? any[][] : Record[]; - -export interface FullQueryResults { - fields: FieldDef[]; - command: string; - rowCount: number; - rows: QueryRows; - rowAsArray: ArrayMode; +declare interface HTTPTransactionOptions extends HTTPQueryOptions { + isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; + readOnly?: boolean; + deferrable?: boolean; } -export interface ParameterizedQuery { - query: string; - params: any[]; +export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { + (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; + transaction(queries: NeonQueryPromise[] | ((sql: (strings: TemplateStringsArray | string, ...params: any[]) => NeonQueryPromise) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; +}; + +export declare class neonConfig extends EventEmitter { + static defaults: SocketDefaults; + static opts: Partial; + private opts; + static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; + static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); + static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; + static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); + static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); + static get fetchFunction(): SocketDefaults["fetchFunction"]; + static set fetchFunction(newValue: SocketDefaults['fetchFunction']); + static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + static get wsProxy(): SocketDefaults["wsProxy"]; + static set wsProxy(newValue: SocketDefaults['wsProxy']); + get wsProxy(): SocketDefaults["wsProxy"]; + set wsProxy(newValue: SocketDefaults['wsProxy']); + static get coalesceWrites(): SocketDefaults["coalesceWrites"]; + static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + get coalesceWrites(): SocketDefaults["coalesceWrites"]; + set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + static get disableSNI(): SocketDefaults["disableSNI"]; + static set disableSNI(newValue: SocketDefaults['disableSNI']); + get disableSNI(): SocketDefaults["disableSNI"]; + set disableSNI(newValue: SocketDefaults['disableSNI']); + static get pipelineConnect(): SocketDefaults["pipelineConnect"]; + static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + get pipelineConnect(): SocketDefaults["pipelineConnect"]; + set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + static get subtls(): SocketDefaults["subtls"]; + static set subtls(newValue: SocketDefaults['subtls']); + get subtls(): SocketDefaults["subtls"]; + set subtls(newValue: SocketDefaults['subtls']); + static get pipelineTLS(): SocketDefaults["pipelineTLS"]; + static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + get pipelineTLS(): SocketDefaults["pipelineTLS"]; + set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + static get rootCerts(): SocketDefaults["rootCerts"]; + static set rootCerts(newValue: SocketDefaults['rootCerts']); + get rootCerts(): SocketDefaults["rootCerts"]; + set rootCerts(newValue: SocketDefaults['rootCerts']); + wsProxyAddrForHost(host: string, port: number): string; + connecting: boolean; + pending: boolean; + writable: boolean; + encrypted: boolean; + authorized: boolean; + destroyed: boolean; + private ws; + private writeBuffer; + private tlsState; + private tlsRead; + private tlsWrite; + setNoDelay(): this; + setKeepAlive(): this; + ref(): this; + unref(): this; + connect(port: number | string, host: string, connectListener?: () => void): void; + startTls(host: string): Promise; + tlsReadLoop(): Promise; + rawWrite(data: Uint8Array): void; + write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; + end(data?: Buffer | string, encoding?: string, callback?: () => void): this; + destroy(): this; } -export interface HTTPQueryOptions { - /** - * When `arrayMode` is `false`, which is the default, result rows are - * returned as objects whose keys represent column names, such as - * `{ id: 1 }`). - * - * When `arrayMode` is `true`, rows are returned as arrays (and keys are not - * provided), e.g. `[1]`. - */ - arrayMode?: ArrayMode; - /** - * When `fullResults` is `false`, which is the default, only result rows are - * returned, e.g. `[{ id: 1 }]`). - * - * When `fullResults` is `true`, a result object is returned that matches - * what's returned by node-postgres. This has a `rows` property, which is an - * array of result rows, plus `fields`, which provides column names and - * types, `command` and `rowCount`. - */ - fullResults?: FullResults; // default false - /** - * Any options in `fetchOptions` are merged in to the options passed to - * `fetch`. In case of conflict with what would otherwise be passed, these - * options take precedence. - */ - fetchOptions?: Record; - - /** - * JWT auth token to be passed as the Bearer token in the Authorization header - * - * Default: `undefined` - */ - authToken?: string | (() => Promise | string); - - /** - * Custom type parsers - * See https://github.com/brianc/node-pg-types - */ - types?: typeof PgTypes; +declare interface NeonConfigGlobalAndClient { + /** + * If no global `WebSocket` object is available, set `webSocketConstructor` + * to the constructor for a custom WebSocket implementation, such as those + * provided by `ws` or `undici`. + */ + webSocketConstructor: any; + /** + * Set `wsProxy` to use your own WebSocket proxy server. + * + * Provide either the proxy server’s domain name, or a function that takes + * the database host and port and returns the proxy server address (without + * protocol). + * + * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` + * + * Default: `host => host + '/v2'` + */ + wsProxy: string | ((host: string, port: number | string) => string) | undefined; + /** + * Use a secure (`wss:`) connection to the WebSocket proxy. + * + * Default: `true`. + */ + useSecureWebSocket: boolean; + /** + * Disable TLS encryption in the Postgres protocol (as set via e.g. + * `?sslmode=require` in the connection string). Connection remains secure + * if `useSecureWebSocket` is `true`. + * + * Default: `true` + */ + forceDisablePgSSL: boolean; + /** + * Pipelines the startup message, cleartext password message and first query + * when set to `"password"`. This works only for cleartext password auth. + * + * Default: `"password"`. + */ + pipelineConnect: 'password' | false; + /** + * If `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS, you must supply the subtls TLS library to this option: + * + * ``` + * import { neonConfig } from '@neondatabase/serverless'; + * import * as subtls from 'subtls'; + * neonConfig.subtls = subtls; + * ``` + * + * Default: `undefined`. + */ + subtls: any; + /** + * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is + * `false` and the Postgres connection parameters specify TLS. Currently + * compatible only with Neon hosts. + * + * Default: `false`. + */ + pipelineTLS: boolean; + /** + * Set `rootCerts` to a string comprising one or more PEM files. These are + * the trusted root certificates for a TLS connection to Postgres when + * `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS. + * + * Default: `""`. + */ + rootCerts: string; + /** + * Batch multiple network writes per run-loop into a single outgoing + * WebSocket message. + * + * Default: `true`. + */ + coalesceWrites: boolean; + /** + * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the + * Postgres connection parameters specify TLS, we send no SNI data in the + * Postgres TLS handshake. + * + * On Neon, disabling SNI and including the Neon project name in the password + * avoids CPU-intensive SCRAM authentication, but this is only relevant for + * earlier iterations of Neon's WebSocket support. + * + * Default: `false`. + */ + disableSNI: boolean; } -export interface HTTPTransactionOptions extends HTTPQueryOptions { - /** - * Postgres transaction isolation level: see https://www.postgresql.org/docs/current/transaction-iso.html. - * Note that `ReadUncommitted` actually gets you `ReadCommitted` in Postgres. - * */ - isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; - /** - * When `readOnly` is `false`, which is the default, a `READ WRITE` Postgres - * transaction is used. - * - * When `readOnly` is `true`, a `READ ONLY` Postgres transaction is used. - * */ - readOnly?: boolean; - /** - * When `deferrable` is `false`, which is the default, a `NOT DEFERRABLE` - * Postgres transaction is used. - * - * When `deferrable` is `true` (and `isolationLevel` is `Serializable` and - * `readOnly` is `true`), a `DEFERRABLE` Postgres transaction is used. - * */ - deferrable?: boolean; +export declare class NeonDbError extends Error { + name: "NeonDbError"; + severity: string | undefined; + code: string | undefined; + detail: string | undefined; + hint: string | undefined; + position: string | undefined; + internalPosition: string | undefined; + internalQuery: string | undefined; + where: string | undefined; + schema: string | undefined; + table: string | undefined; + column: string | undefined; + dataType: string | undefined; + constraint: string | undefined; + file: string | undefined; + line: string | undefined; + routine: string | undefined; + sourceError: Error | undefined; + constructor(message: string); } -export interface NeonQueryPromise extends Promise { - parameterizedQuery: ParameterizedQuery; - opts?: HTTPQueryOptions; +declare interface NeonQueryPromise extends Promise { + parameterizedQuery: ParameterizedQuery; + opts?: HTTPQueryOptions; } -export interface NeonQueryInTransaction { - // this is a simplified form of query, which has only a `parameterizedQuery` (no `opts` and not a `Promise`) - parameterizedQuery: ParameterizedQuery; +declare interface ParameterizedQuery { + query: string; + params: any[]; } -export interface NeonQueryFunctionInTransaction { - // this is a simplified form of NeonQueryFunction (below): - // * `opts` cannot be passed - // * no `transaction()` method is available - - // tagged-template function usage - (strings: TemplateStringsArray, ...params: any[]): - NeonQueryPromise : QueryRows>; - - // ordinary function usage (*no* options overrides) - (string: string, params?: any[]): - NeonQueryPromise : QueryRows>; +export declare class Pool extends Pool_2 { + Client: typeof Client; + hasFetchUnsupportedListeners: boolean; + on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + query(config?: any, values?: any, cb?: any): any; } -export interface NeonQueryFunction { - // tagged-template function usage - (strings: TemplateStringsArray, ...params: any[]): - NeonQueryPromise : QueryRows>; - - // ordinary function usage, with options overrides - ( - string: string, - params?: any[], - opts?: HTTPQueryOptions - ): NeonQueryPromise< - ArrayModeOverride, - FullResultsOverride, - FullResultsOverride extends true ? FullQueryResults : QueryRows - >; - - /** - * The `transaction()` function allows multiple queries to be submitted (over - * HTTP) as a single, non-interactive Postgres transaction. - * - * For example: - * ``` - * import { neon } from "@neondatabase/serverless"; - * const sql = neon("postgres://user:pass@host/db"); - * - * const results = await sql.transaction([ - * sql`SELECT 1 AS num`, - * sql`SELECT 'a' AS str`, - * ]); - * // -> [[{ num: 1 }], [{ str: "a" }]] - * - * // or equivalently: - * const results = await sql.transaction(txn => [ - * txn`SELECT 1 AS num`, - * txn`SELECT 'a' AS str`, - * ]); - * // -> [[{ num: 1 }], [{ str: "a" }]] - * ``` - * @param queriesOrFn Either an array of queries, or a (non-`async`) function - * that receives a query function and returns an array of queries. - * @param opts The same options that may be set on individual queries in a - * non-transaction setting -- that is, `arrayMode` `fullResults` and - * `fetchOptions` -- plus the transaction options `isolationLevel`, - * `readOnly` and `deferrable`. Note that none of these options can be set on - * individual queries within a transaction. - * @returns An array of results. The structure of each result object depends - * on the `arrayMode` and `fullResults` options. - */ - transaction: ( - queriesOrFn: NeonQueryPromise[] | // not ArrayModeOverride or FullResultsOverride: clamp these values to the current ones - ((sql: NeonQueryFunctionInTransaction) => NeonQueryInTransaction[]), - opts?: HTTPTransactionOptions - ) => Promise[] : QueryRows[]>; +export { Query } + +declare interface SocketDefaults { + poolQueryViaFetch: boolean; + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchConnectionCache: boolean; + fetchFunction: any; + webSocketConstructor: typeof WebSocket | undefined; + wsProxy: string | ((host: string, port: number | string) => string); + useSecureWebSocket: boolean; + forceDisablePgSSL: boolean; + coalesceWrites: boolean; + pipelineConnect: 'password' | false; + subtls: typeof subtls | undefined; + rootCerts: string; + pipelineTLS: boolean; + disableSNI: boolean; } -/** - * This function returns an async tagged-template function that runs a single - * SQL query (no session or transactions) with low latency over https. Support - * for multiple queries as a non-interactive transaction is provided by - * the `transaction` property of the query function. - * - * By default, the query function returns database rows directly. Types should - * match those returned by this driver (i.e. Pool or Client) over WebSockets. - * - * The returned function can also be called directly (i.e. not as a template - * function). In that case, pass it a query string with embedded `$1`, `$2` - * (etc.), followed by an array of query parameters, followed (optionally) by - * any of the same options you can pass to this function. - * - * Some examples: - * ``` - * import { neon } from "@neondatabase/serverless"; - * const h = "hello", w = "world"; - * - * // example 1: default options, tagged-template usage - * const sql = neon("postgres://user:pass@host/db"); - * const rows = await sql`SELECT ${h} || ' ' || ${w} AS greeting`; - * // -> [ { greeting: "hello world" } ] - * - * // example 2: `arrayMode` and `fullResults` options, ordinary function usage - * const options = { arrayMode: true, fullResults: true }; - * const sql = neon("postgres://user:pass@host/db", options); - * const rows = await sql("SELECT $1 || ' ' || $2 AS greeting", [h, w]); - * // -> { - * // command: "SELECT", - * // fields: [ { name: "greeting", dataTypeID: 25 } ], - * // rowAsArray: true, - * // rowCount: 1, - * // rows: [ [ "hello world" ] ] - * // } - * - * // example 3: `fetchOptions` option, ordinary function usage - * const sql = neon("postgres://user:pass@host/db"); - * const rows = await sql( - * "SELECT $1 || ' ' || $2 AS greeting", [h, w], - * { fetchOptions: { priority: "high" } } - * ); - * // -> [ { greeting: "hello world" } ] - * ``` - * - * @param connectionString this has the format `postgres://user:pass@host/db` - * @param options pass `arrayMode: true` to receive results as an array of - * arrays, instead of the default array of objects; pass `fullResults: true` - * to receive a complete result object similar to one returned by node-postgres - * (with properties `rows`, `fields`, `command`, `rowCount`, `rowAsArray`); - * pass as `fetchOptions` an object which will be merged into the options - * passed to `fetch`. - */ -export function neon( - connectionString: string, - options?: HTTPTransactionOptions, -): NeonQueryFunction; - -export class NeonDbError extends Error { - name: 'NeonDbError'; +export { types } - severity: string | undefined; - code: string | undefined; - detail: string | undefined; - hint: string | undefined; - position: string | undefined; - internalPosition: string | undefined; - internalQuery: string | undefined; - where: string | undefined; - schema: string | undefined; - table: string | undefined; - column: string | undefined; - dataType: string | undefined; - constraint: string | undefined; - file: string | undefined; - line: string | undefined; - routine: string | undefined; - - sourceError: Error | undefined; -} +export { } diff --git a/dist/jsr/index.js b/dist/jsr/index.js index 7ff28f6..9144f7e 100644 --- a/dist/jsr/index.js +++ b/dist/jsr/index.js @@ -1,30 +1,30 @@ /// -var io=Object.create;var Ce=Object.defineProperty;var so=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var ao=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty;var co=(r,e,t)=>e in r?Ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): -r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0});var z=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),se=(r,e)=>{for(var t in e) +var ro=Object.create;var Ce=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var ao=(r,e,t)=>e in r?Ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): +r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0});var te=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),se=(r,e)=>{for(var t in e) Ce(r,t,{get:e[t],enumerable:!0})},Tn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== -"function")for(let i of oo(e))!uo.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= -so(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?io(ao(r)):{},Tn(e||!r||!r.__esModule?Ce(t,"default",{ -value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>co(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=lo;st.toByteArray=po;st.fromByteArray= -go;var ae=[],re=[],ho=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ +"function")for(let i of io(e))!oo.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= +no(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?ro(so(r)):{},Tn(e||!r||!r.__esModule?Ce(t,"default",{ +value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= +yo;var ae=[],re=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ee=0,In=Rt.length;Ee0)throw new Error("Invalid string. Length must be a multip\ le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Pn, -"getLens");function lo(r){var e=Pn(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(lo,"byte\ -Length");function fo(r,e,t){return(e+t)*3/4-t}a(fo,"_byteLength");function po(r){ -var e,t=Pn(r),n=t[0],i=t[1],s=new ho(fo(r,n,i)),o=0,u=i>0?n-4:n,c;for(c=0;c0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e= re[r.charCodeAt(c)]<<2|re[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=re[r.charCodeAt( c)]<<10|re[r.charCodeAt(c+1)]<<4|re[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= -e&255),s}a(po,"toByteArray");function yo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[r>> -6&63]+ae[r&63]}a(yo,"tripletToBase64");function mo(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ +e&255),s}a(lo,"toByteArray");function fo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[r>> +6&63]+ae[r&63]}a(fo,"tripletToBase64");function po(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ ae[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ae[e>>10]+ae[e>>4&63]+ae[e<< -2&63]+"=")),i.join("")}a(go,"fromByteArray")});var Ln=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> +2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Ln=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> 1,l=-7,d=t?i-1:0,b=t?-1:1,C=r[e+d];for(d+=b,s=C&(1<<-l)-1,C>>=-l,l+=u;l>0;s=s*256+ r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== 0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? @@ -36,56 +36,56 @@ b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow 2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=B,u/=256, i-=8);for(o=o<0;r[t+C]=o&255,C+=B,o/=256,h-=8);r[t+C-B]|=Q*128}});var Kn=I(Le=>{"use strict";p();var Mt=Bn(),Pe=Ln(),Rn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Le.Buffer= -f;Le.SlowBuffer=vo;Le.INSPECT_MAX_BYTES=50;var ot=2147483647;Le.kMaxLength=ot;f. -TYPED_ARRAY_SUPPORT=wo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. +f;Le.SlowBuffer=xo;Le.INSPECT_MAX_BYTES=50;var ot=2147483647;Le.kMaxLength=ot;f. +TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ -rowser support.");function wo(){try{let r=new Uint8Array(1),e={foo:a(function(){ +rowser support.");function mo(){try{let r=new Uint8Array(1),e={foo:a(function(){ return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf( -r,e),r.foo()===42}catch{return!1}}a(wo,"typedArraySupport");Object.defineProperty( +r,e),r.foo()===42}catch{return!1}}a(mo,"typedArraySupport");Object.defineProperty( f.prototype,"parent",{enumerable:!0,get:a(function(){if(f.isBuffer(this))return this. buffer},"get")});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:a( function(){if(f.isBuffer(this))return this.byteOffset},"get")});function le(r){if(r> ot)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array( r);return Object.setPrototypeOf(e,f.prototype),e}a(le,"createBuffer");function f(r,e,t){ if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" a\ -rgument must be of type string. Received type number');return Ot(r)}return kn(r, -e,t)}a(f,"Buffer");f.poolSize=8192;function kn(r,e,t){if(typeof r=="string")return So( -r,e);if(ArrayBuffer.isView(r))return xo(r);if(r==null)throw new TypeError("The f\ +rgument must be of type string. Received type number');return Ot(r)}return Dn(r, +e,t)}a(f,"Buffer");f.poolSize=8192;function Dn(r,e,t){if(typeof r=="string")return wo( +r,e);if(ArrayBuffer.isView(r))return bo(r);if(r==null)throw new TypeError("The f\ irst argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-l\ ike Object. Received type "+typeof r);if(ue(r,ArrayBuffer)||r&&ue(r.buffer,ArrayBuffer)|| typeof SharedArrayBuffer<"u"&&(ue(r,SharedArrayBuffer)||r&&ue(r.buffer,SharedArrayBuffer))) -return kt(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ +return Dt(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ must not be of type number. Received type number');let n=r.valueOf&&r.valueOf(); -if(n!=null&&n!==r)return f.from(n,e,t);let i=Eo(r);if(i)return i;if(typeof Symbol< +if(n!=null&&n!==r)return f.from(n,e,t);let i=So(r);if(i)return i;if(typeof Symbol< "u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return f. from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argumen\ t must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. \ -Received type "+typeof r)}a(kn,"from");f.from=function(r,e,t){return kn(r,e,t)}; +Received type "+typeof r)}a(Dn,"from");f.from=function(r,e,t){return Dn(r,e,t)}; Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f, Uint8Array);function Un(r){if(typeof r!="number")throw new TypeError('"size" arg\ ument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is\ - invalid for option "size"')}a(Un,"assertSize");function bo(r,e,t){return Un(r), -r<=0?le(r):e!==void 0?typeof t=="string"?le(r).fill(e,t):le(r).fill(e):le(r)}a(bo, -"alloc");f.alloc=function(r,e,t){return bo(r,e,t)};function Ot(r){return Un(r),le( + invalid for option "size"')}a(Un,"assertSize");function go(r,e,t){return Un(r), +r<=0?le(r):e!==void 0?typeof t=="string"?le(r).fill(e,t):le(r).fill(e):le(r)}a(go, +"alloc");f.alloc=function(r,e,t){return go(r,e,t)};function Ot(r){return Un(r),le( r<0?0:Nt(r)|0)}a(Ot,"allocUnsafe");f.allocUnsafe=function(r){return Ot(r)};f.allocUnsafeSlow= -function(r){return Ot(r)};function So(r,e){if((typeof e!="string"||e==="")&&(e="\ +function(r){return Ot(r)};function wo(r,e){if((typeof e!="string"||e==="")&&(e="\ utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=On(r,e)| -0,n=le(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(So,"fromString");function Dt(r){ +0,n=le(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(wo,"fromString");function kt(r){ let e=r.length<0?0:Nt(r.length)|0,t=le(e);for(let n=0;n= +return typeof r.length!="number"||Qt(r.length)?le(0):kt(r);if(r.type==="Buffer"&& +Array.isArray(r.data))return kt(r.data)}a(So,"fromObject");function Nt(r){if(r>= ot)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ -ot.toString(16)+" bytes");return r|0}a(Nt,"checked");function vo(r){return+r!=r&& -(r=0),f.alloc(+r)}a(vo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. +ot.toString(16)+" bytes");return r|0}a(Nt,"checked");function xo(r){return+r!=r&& +(r=0),f.alloc(+r)}a(xo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. _isBuffer===!0&&e!==f.prototype},"isBuffer");f.compare=a(function(e,t){if(ue(e,Uint8Array)&& (e=f.from(e,e.offset,e.byteLength)),ue(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)), !f.isBuffer(e)||!f.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments\ @@ -108,14 +108,14 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ut(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return Vn(r).length;default:if(i)return n?-1:Ut(r).length;e=(""+e).toLowerCase(), -i=!0}}a(On,"byteLength");f.byteLength=On;function _o(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(On,"byteLength");f.byteLength=On;function Eo(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| -(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Mo( -this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Ro(this, -e,t);case"latin1":case"binary":return Fo(this,e,t);case"base64":return Bo(this,e, -t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Do(this,e,t);default: +(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( +this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Bo(this, +e,t);case"latin1":case"binary":return Lo(this,e,t);case"base64":return Io(this,e, +t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -_o,"slowToString");f.prototype._isBuffer=!0;function ve(r,e,t){let n=r[e];r[e]=r[t], +Eo,"slowToString");f.prototype._isBuffer=!0;function ve(r,e,t){let n=r[e];r[e]=r[t], r[t]=n}a(ve,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< e;t+=2)ve(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. @@ -125,7 +125,7 @@ f.prototype.swap64=a(function(){let e=this.length;if(e%8!==0)throw new RangeErro "Buffer size must be a multiple of 64-bits");for(let t=0;ti&&(n=i)):n=i;let s=e.length;n> s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)? (n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.wri\ te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return Ao(this,e,t,n);case"utf8":case"utf-8":return Co(this,e,t,n);case"asc\ -ii":case"latin1":case"binary":return To(this,e,t,n);case"base64":return Io(this, -e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Po(this,e,t,n);default: +hex":return vo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ +ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, +e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ write");f.prototype.toJSON=a(function(){return{type:"Buffer",data:Array.prototype. -slice.call(this._arr||this,0)}},"toJSON");function Bo(r,e,t){return e===0&&t===r. -length?Mt.fromByteArray(r):Mt.fromByteArray(r.slice(e,t))}a(Bo,"base64Slice");function qn(r,e,t){ +slice.call(this._arr||this,0)}},"toJSON");function Io(r,e,t){return e===0&&t===r. +length?Mt.fromByteArray(r):Mt.fromByteArray(r.slice(e,t))}a(Io,"base64Slice");function qn(r,e,t){ t=Math.min(r.length,t);let n=[],i=e;for(;i239?4:s>223? 3:s>191?2:1;if(i+u<=t){let c,h,l,d;switch(u){case 1:s<128&&(o=s);break;case 2:c= r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[i+ @@ -182,16 +182,16 @@ r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)=== 128&&(l&192)===128&&(d=(s&15)<<18|(c&63)<<12|(h&63)<<6|l&63,d>65535&&d<1114112&& (o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320| -o&1023),n.push(o),i+=u}return Lo(n)}a(qn,"utf8Slice");var Mn=4096;function Lo(r){ +o&1023),n.push(o),i+=u}return Po(n)}a(qn,"utf8Slice");var Mn=4096;function Po(r){ let e=r.length;if(e<=Mn)return String.fromCharCode.apply(String,r);let t="",n=0; -for(;nn)&&(t=n);let i="";for(let s=e;sn)&&(t=n);let i="";for(let s=e;sn&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t>>0, t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ readUInt32BE");f.prototype.readBigUInt64LE=me(a(function(e){e=e>>>0,Be(e,"offset"); -let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e,this.length-8);let i=t+ +let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Be(e,"offset");let t=this[e],n=this[e+7]; -(t===void 0||n===void 0)&&We(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* +(t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e],s=1,o=0;for(;++o>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ 1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=me(a(function(e){ -e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e, +e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Be(e,"offset"); -let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e,this.length-8);let i=(t<< +let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,t||N(e,4,this.length),Pe.read(this,e, @@ -243,61 +243,61 @@ readFloatLE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),Pe.read(this,e, t||N(e,4,this.length),Pe.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= a(function(e,t){return e=e>>>0,t||N(e,8,this.length),Pe.read(this,e,!0,52,8)},"r\ eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||N(e,8,this. -length),Pe.read(this,e,!1,52,8)},"readDoubleBE");function Y(r,e,t,n,i,s){if(!f.isBuffer( +length),Pe.read(this,e,!1,52,8)},"readDoubleBE");function z(r,e,t,n,i,s){if(!f.isBuffer( r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e< s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError( -"Index out of range")}a(Y,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= -a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e, +"Index out of range")}a(z,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= +a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e, t,n,u,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e,t,n,u,0)}let s=n-1, +if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e,t,n,u,0)}let s=n-1, o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n},"writeUI\ ntBE");f.prototype.writeUint8=f.prototype.writeUInt8=a(function(e,t,n){return e= -+e,t=t>>>0,n||Y(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= -f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, ++e,t=t>>>0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= +f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, 65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},"writeUInt16LE");f.prototype.writeUint16BE= -f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, +f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, 65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},"writeUInt16BE");f.prototype.writeUint32LE= -f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,4, +f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,4, 4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+ 4},"writeUInt32LE");f.prototype.writeUint32BE=f.prototype.writeUInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, +return e=+e,t=t>>>0,n||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function Qn(r,e,t,n,i){$n( e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8, r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]= -o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Qn,"wrtBigUInt64LE");function jn(r,e,t,n,i){ +o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Qn,"wrtBigUInt64LE");function Wn(r,e,t,n,i){ $n(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> 8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+ -3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(jn,"wrtBigUInt64BE");f. +3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(Wn,"wrtBigUInt64BE");f. prototype.writeBigUInt64LE=me(a(function(e,t=0){return Qn(this,e,t,BigInt(0),BigInt( "0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=me(a(function(e,t=0){ -return jn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); +return Wn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); f.prototype.writeIntLE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2, -8*n-1);Y(this,e,t,n,c-1,-c)}let s=0,o=1,u=0;for(this[t]=e&255;++s>0)-u&255;return t+n},"writeIntL\ E");f.prototype.writeIntBE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow( -2,8*n-1);Y(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= +2,8*n-1);z(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= 256);)e<0&&u===0&&this[t+s+1]!==0&&(u=1),this[t+s]=(e/o>>0)-u&255;return t+n},"w\ -riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this, +riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this, e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},"writeInt8");f.prototype.writeInt16LE= -a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e&255, +a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e&255, this[t+1]=e>>>8,t+2},"writeInt16LE");f.prototype.writeInt16BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, +return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, t+2},"writeInt16BE");f.prototype.writeInt32LE=a(function(e,t,n){return e=+e,t=t>>> -0,n||Y(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= +0,n||z(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= e>>>16,this[t+3]=e>>>24,t+4},"writeInt32LE");f.prototype.writeInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ +return e=+e,t=t>>>0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ 1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeIn\ t32BE");f.prototype.writeBigInt64LE=me(a(function(e,t=0){return Qn(this,e,t,-BigInt( "0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));f.prototype. -writeBigInt64BE=me(a(function(e,t=0){return jn(this,e,t,-BigInt("0x8000000000000\ -000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Wn(r,e,t,n,i,s){ +writeBigInt64BE=me(a(function(e,t=0){return Wn(this,e,t,-BigInt("0x8000000000000\ +000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function jn(r,e,t,n,i,s){ if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError( -"Index out of range")}a(Wn,"checkIEEE754");function Hn(r,e,t,n,i){return e=+e,t= -t>>>0,i||Wn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Pe.write(r,e,t,n, +"Index out of range")}a(jn,"checkIEEE754");function Hn(r,e,t,n,i){return e=+e,t= +t>>>0,i||jn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Pe.write(r,e,t,n, 23,4),t+4}a(Hn,"writeFloat");f.prototype.writeFloatLE=a(function(e,t,n){return Hn( this,e,t,!0,n)},"writeFloatLE");f.prototype.writeFloatBE=a(function(e,t,n){return Hn( -this,e,t,!1,n)},"writeFloatBE");function Gn(r,e,t,n,i){return e=+e,t=t>>>0,i||Wn( +this,e,t,!1,n)},"writeFloatBE");function Gn(r,e,t,n,i){return e=+e,t=t>>>0,i||jn( r,e,t,8,17976931348623157e292,-17976931348623157e292),Pe.write(r,e,t,n,52,8),t+8} a(Gn,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return Gn(this,e, t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return Gn( @@ -329,22 +329,22 @@ a(n,"NodeError"),n)}a(qt,"E");qt("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r ds"},RangeError);qt("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argum\ ent must be of type number. Received type ${typeof e}`},TypeError);qt("ERR_OUT_O\ F_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number. -isInteger(t)&&Math.abs(t)>2**32?i=Dn(String(t)):typeof t=="bigint"&&(i=String(t), -(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Dn(i)),i+="n"),n+=` It\ - must be ${e}. Received ${i}`,n},RangeError);function Dn(r){let e="",t=r.length, +isInteger(t)&&Math.abs(t)>2**32?i=kn(String(t)):typeof t=="bigint"&&(i=String(t), +(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=kn(i)),i+="n"),n+=` It\ + must be ${e}. Received ${i}`,n},RangeError);function kn(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(Dn,"addNumericalSeparator");function ko(r,e,t){Be(e,"offset"),(r[e]=== -void 0||r[e+t]===void 0)&&We(e,r.length-(t+1))}a(ko,"checkBounds");function $n(r,e,t,n,i,s){ +t)}${e}`}a(kn,"addNumericalSeparator");function Mo(r,e,t){Be(e,"offset"),(r[e]=== +void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function $n(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Ie.ERR_OUT_OF_RANGE( -"value",u,r)}ko(n,i,s)}a($n,"checkIntBI");function Be(r,e){if(typeof r!="number") -throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Be,"validateNumber");function We(r,e,t){ +"value",u,r)}Mo(n,i,s)}a($n,"checkIntBI");function Be(r,e){if(typeof r!="number") +throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Be,"validateNumber");function je(r,e,t){ throw Math.floor(r)!==r?(Be(r,t),new Ie.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Ie.ERR_BUFFER_OUT_OF_BOUNDS:new Ie.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? -1:0} and <= ${e}`,r)}a(We,"boundsError");var Uo=/[^+/0-9A-Za-z-_]/g;function Oo(r){ -if(r=r.split("=")[0],r=r.trim().replace(Uo,""),r.length<2)return"";for(;r.length% -4!==0;)r=r+"=";return r}a(Oo,"base64clean");function Ut(r,e){e=e||1/0;let t,n=r. +1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ +if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% +4!==0;)r=r+"=";return r}a(Do,"base64clean");function Ut(r,e){e=e||1/0;let t,n=r. length,i=null,s=[];for(let o=0;o55295&&t<57344){if(!i){ if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&& s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, @@ -353,31 +353,31 @@ s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>> 6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63| 128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}a( -Ut,"utf8ToBytes");function No(r){let e=[];for(let t=0;t>8,i=t%256,s.push(i),s.push(n);return s} -a(qo,"utf16leToBytes");function Vn(r){return Mt.toByteArray(Oo(r))}a(Vn,"base64T\ +a(Oo,"utf16leToBytes");function Vn(r){return Mt.toByteArray(Do(r))}a(Vn,"base64T\ oBytes");function at(r,e,t,n){let i;for(i=0;i=e.length||i>=r.length);++i) e[i+t]=r[i];return i}a(at,"blitBuffer");function ue(r,e){return r instanceof e|| r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name} -a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var Qo=function(){ +a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var No=function(){ let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< -16;++i)e[n+i]=r[t]+r[i]}return e}();function me(r){return typeof BigInt>"u"?jo:r} -a(me,"defineBigIntMethod");function jo(){throw new Error("BigInt not supported")} -a(jo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=z(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +16;++i)e[n+i]=r[t]+r[i]}return e}();function me(r){return typeof BigInt>"u"?qo:r} +a(me,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} +a(qo,"BufferBigIntNotDefined")});var S,x,v,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. Buffer.allocUnsafe=="function"?globalThis.Buffer:Kn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= -e.then.bind(e)}});var ge=I((nh,jt)=>{"use strict";p();var Re=typeof Reflect=="object"?Reflect:null, +e.then.bind(e)}});var ge=I((th,Wt)=>{"use strict";p();var Re=typeof Reflect=="object"?Reflect:null, zn=Re&&typeof Re.apply=="function"?Re.apply:a(function(e,t,n){return Function.prototype. apply.call(e,t,n)},"ReflectApply"),ut;Re&&typeof Re.ownKeys=="function"?ut=Re.ownKeys: Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. -getOwnPropertyNames(e)},"ReflectOwnKeys");function Wo(r){console&&console.warn&& -console.warn(r)}a(Wo,"ProcessEmitWarning");var Zn=Number.isNaN||a(function(e){return e!== -e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");jt.exports= -L;jt.exports.once=Vo;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= +getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& +console.warn(r)}a(Qo,"ProcessEmitWarning");var Zn=Number.isNaN||a(function(e){return e!== +e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");Wt.exports= +L;Wt.exports.once=Go;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= 0;L.prototype._maxListeners=void 0;var Yn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(L,"defaultMaxLi\ @@ -404,14 +404,14 @@ t,++r._eventsCount;else if(typeof o=="function"?o=s[e]=n?[t,o]:[o,t]:n?o.unshift t):o.push(t),i=Jn(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po\ ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ -ededWarning",u.emitter=r,u.type=e,u.count=o.length,Wo(u)}return r}a(Xn,"_addList\ +ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(Xn,"_addList\ ener");L.prototype.addListener=a(function(e,t){return Xn(this,e,t,!1)},"addListe\ ner");L.prototype.on=L.prototype.addListener;L.prototype.prependListener=a(function(e,t){ -return Xn(this,e,t,!0)},"prependListener");function Ho(){if(!this.fired)return this. +return Xn(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? -this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Ho, +this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, "onceWrapper");function ei(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Ho.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");L.prototype. +listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");L.prototype. once=a(function(e,t){return ct(t),this.on(e,ei(this,e,t)),this},"once");L.prototype. prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ei(this, e,t)),this},"prependOnceListener");L.prototype.removeListener=a(function(e,t){var n, @@ -419,7 +419,7 @@ i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)retu if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. -listener,s=o;break}if(s<0)return this;s===0?n.shift():Go(n,s),n.length===1&&(i[e]= +listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, "removeListener");L.prototype.off=L.prototype.removeListener;L.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== @@ -431,7 +431,7 @@ o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners( n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length- 1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ti(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?$o(i):ni(i,i.length)}a(ti,"_listeners");L.prototype. +"function"?t?[i.listener||i]:[i]:t?Ho(i):ni(i,i.length)}a(ti,"_listeners");L.prototype. listeners=a(function(e){return ti(this,e,!0)},"listeners");L.prototype.rawListeners= a(function(e){return ti(this,e,!1)},"rawListeners");L.listenerCount=function(r,e){ return typeof r.listenerCount=="function"?r.listenerCount(e):ri.call(r,e)};L.prototype. @@ -439,49 +439,62 @@ listenerCount=ri;function ri(r){var e=this._events;if(e!==void 0){var t=e[r];if( "function")return 1;if(t!==void 0)return t.length}return 0}a(ri,"listenerCount"); L.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): []},"eventNames");function ni(r,e){for(var t=new Array(e),n=0;nzo});var zo,Ge=z(()=>{"use strict";p();zo={}});function $e(r){let e=1779033703,t=3144134277,n=1013904242,i=2773480762,s=1359893119, -o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,3049323471, -3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278, -1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078, -604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808, -3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372, -1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800, -3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, -883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, -2361852424,2428436474,2756734187,3204031479,3329325298],b=a((A,g)=>A>>>g|A<<32-g, -"rrot"),C=new Uint32Array(64),B=new Uint8Array(64),Q=a(()=>{for(let R=0,$=0;R<16;R++, -$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+3];for(let R=16;R<64;R++){let $=b(C[R- -15],7)^b(C[R-15],18)^C[R-15]>>>3,ce=b(C[R-2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R- -16]+$+C[R-7]+ce|0}let A=e,g=t,P=n,K=i,k=s,j=o,ee=u,oe=c;for(let R=0;R<64;R++){let $=b( -k,6)^b(k,11)^b(k,25),ce=k&j^~k&ee,ye=oe+$+ce+d[R]+C[R]|0,Se=b(A,2)^b(A,13)^b(A,22), -je=A&g^A&P^g&P,he=Se+je|0;oe=ee,ee=j,j=k,k=K+ye|0,K=P,P=g,g=A,A=ye+he|0}e=e+A|0, -t=t+g|0,n=n+P|0,i=i+K|0,s=s+k|0,o=o+j|0,u=u+ee|0,c=c+oe|0,l=0},"process"),X=a(A=>{ -typeof A=="string"&&(A=new TextEncoder().encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){ -for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]=0;let A=h*8;B[l++]=A/1099511627776&255, -B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]=A>>>16&255,B[l++]=A>>>8&255,B[l++]= -A&255,Q();let g=new Uint8Array(32);return g[0]=e>>>24,g[1]=e>>>16&255,g[2]=e>>>8& -255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]=t>>>8&255,g[7]=t&255,g[8]=n>>>24, -g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]=i>>>24,g[13]=i>>>16&255,g[14]= -i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, -g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> -16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, -g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:de}:(X(r),de())}var si=z( -()=>{"use strict";p();a($e,"sha256")});var U,Ve,oi=z(()=>{"use strict";p();U=class U{constructor(){_(this,"_dataLength", -0);_(this,"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer", -new ArrayBuffer(68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array( -this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ +ed type '+typeof r)}a(ii,"eventTargetAgnosticAddListener")});var He={};se(He,{default:()=>Vo});var Vo,Ge=te(()=>{"use strict";p();Vo={}});var jt={};se(jt,{Md5:()=>Ve,createHash:()=>zo,createHmac:()=>Yo,randomBytes:()=>Ko, +sha256:()=>$e});function Ko(r){return w.getRandomValues(y.alloc(r))}function zo(r){ +if(r==="sha256")return{update:a(function(e){return{digest:a(function(){return y. +from($e(e))},"digest")}},"update")};if(r==="md5")return{update:a(function(e){return{ +digest:a(function(){return typeof e=="string"?Ve.hashStr(e):Ve.hashByteArray(e)}, +"digest")}},"update")};throw new Error(`Hash type '${r}' not supported`)}function Yo(r,e){ +if(r!=="sha256")throw new Error(`Only sha256 is supported (requested: '${r}')`); +return{update:a(function(t){return{digest:a(function(){typeof e=="string"&&(e=new TextEncoder(). +encode(e)),typeof t=="string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n> +64)e=$e(e);else if(n<64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array( +64),s=new Uint8Array(64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array( +t.length+64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u. +set($e(o),64),y.from($e(u))},"digest")}},"update")}}function $e(r){let e=1779033703, +t=3144134277,n=1013904242,i=2773480762,s=1359893119,o=2600822924,u=528734635,c=1541459225, +h=0,l=0,d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748, +2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103, +3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692, +1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993, +338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, +2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909, +275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063, +1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479, +3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),B=new Uint8Array( +64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+ +3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,ce=b(C[R- +2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+ce|0}let A=e,g=t,P=n,K=i,D=s, +W=o,X=u,oe=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),ce=D&W^~D&X,ye=oe+ +$+ce+d[R]+C[R]|0,Se=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,he=Se+We|0;oe=X,X=W,W= +D,D=K+ye|0,K=P,P=g,g=A,A=ye+he|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, +u=u+X|0,c=c+oe|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). +encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]= +0;let A=h*8;B[l++]=A/1099511627776&255,B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]= +A>>>16&255,B[l++]=A>>>8&255,B[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= +e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= +t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= +i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, +g[18]=s>>>8&255,g[19]=s&255,g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]= +o&255,g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]= +c>>>16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r===void 0?{add:J,digest:de}: +(J(r),de())}var U,Ve,Ht=te(()=>{"use strict";p();a(Ko,"randomBytes");a(zo,"creat\ +eHash");a(Yo,"createHmac");U=class U{constructor(){_(this,"_dataLength",0);_(this, +"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer",new ArrayBuffer( +68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array(this._buffer, +0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=U. @@ -555,21 +568,8 @@ u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return U._md5cycle(this._state,i e?this._state:U._hex(this._state)}};a(U,"Md5"),_(U,"stateIdentity",new Int32Array( [1732584193,-271733879,-1732584194,271733878])),_(U,"buffer32Identity",new Int32Array( [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(U,"hexChars","0123456789abcdef"),_(U,"hexO\ -ut",[]),_(U,"onePassHasher",new U);Ve=U});var Wt={};se(Wt,{createHash:()=>Zo,createHmac:()=>Jo,randomBytes:()=>Yo});function Yo(r){ -return w.getRandomValues(y.alloc(r))}function Zo(r){if(r==="sha256")return{update:a( -function(e){return{digest:a(function(){return y.from($e(e))},"digest")}},"update")}; -if(r==="md5")return{update:a(function(e){return{digest:a(function(){return typeof e== -"string"?Ve.hashStr(e):Ve.hashByteArray(e)},"digest")}},"update")};throw new Error( -`Hash type '${r}' not supported`)}function Jo(r,e){if(r!=="sha256")throw new Error( -`Only sha256 is supported (requested: '${r}')`);return{update:a(function(t){return{ -digest:a(function(){typeof e=="string"&&(e=new TextEncoder().encode(e)),typeof t== -"string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n>64)e=$e(e);else if(n< -64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array(64),s=new Uint8Array( -64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array(t.length+ -64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u.set($e(o), -64),y.from($e(u))},"digest")}},"update")}}var Ht=z(()=>{"use strict";p();si();oi(); -a(Yo,"randomBytes");a(Zo,"createHash");a(Jo,"createHmac")});var $t=I(ai=>{"use strict";p();ai.parse=function(r,e){return new Gt(r,e).parse()}; -var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Xo,this.position= +ut",[]),_(U,"onePassHasher",new U);Ve=U;a($e,"sha256")});var $t=I(si=>{"use strict";p();si.parse=function(r,e){return new Gt(r,e).parse()}; +var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Zo,this.position= 0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>= this.source.length}nextCharacter(){var e=this.source[this.position++];return e=== "\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){ @@ -583,97 +583,97 @@ n.parse(!0)),this.position+=n.position-2);else if(t.value==="}"&&!i){if(this.dim !this.dimension&&(this.newEntry(),e))return this.entries}else t.value==='"'&&!t. escaped?(i&&this.newEntry(!0),i=!i):t.value===","&&!i?this.newEntry():this.record( t.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this. -entries}};a(ht,"ArrayParser");var Gt=ht;function Xo(r){return r}a(Xo,"identity")});var Vt=I((Sh,ui)=>{p();var ea=$t();ui.exports={create:a(function(r,e){return{parse:a( -function(){return ea.parse(r,e)},"parse")}},"create")}});var li=I((vh,hi)=>{"use strict";p();var ta=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, -ra=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,na=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ia=/^-?infinity$/; -hi.exports=a(function(e){if(ia.test(e))return Number(e.replace("i","I"));var t=ta. -exec(e);if(!t)return sa(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=ci(i));var s=parseInt( +entries}};a(ht,"ArrayParser");var Gt=ht;function Zo(r){return r}a(Zo,"identity")});var Vt=I((hh,oi)=>{p();var Jo=$t();oi.exports={create:a(function(r,e){return{parse:a( +function(){return Jo.parse(r,e)},"parse")}},"create")}});var ci=I((ph,ui)=>{"use strict";p();var Xo=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, +ea=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ta=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ra=/^-?infinity$/; +ui.exports=a(function(e){if(ra.test(e))return Number(e.replace("i","I"));var t=Xo. +exec(e);if(!t)return na(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=ai(i));var s=parseInt( t[2],10)-1,o=t[3],u=parseInt(t[4],10),c=parseInt(t[5],10),h=parseInt(t[6],10),l=t[7]; -l=l?1e3*parseFloat(l):0;var d,b=oa(e);return b!=null?(d=new Date(Date.UTC(i,s,o, +l=l?1e3*parseFloat(l):0;var d,b=ia(e);return b!=null?(d=new Date(Date.UTC(i,s,o, u,c,h,l)),Kt(i)&&d.setUTCFullYear(i),b!==0&&d.setTime(d.getTime()-b)):(d=new Date( -i,s,o,u,c,h,l),Kt(i)&&d.setFullYear(i)),d},"parseDate");function sa(r){var e=ra. -exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=ci(t));var i=parseInt(e[2], -10)-1,s=e[3],o=new Date(t,i,s);return Kt(t)&&o.setFullYear(t),o}}a(sa,"getDate"); -function oa(r){if(r.endsWith("+00"))return 0;var e=na.exec(r.split(" ")[1]);if(e){ +i,s,o,u,c,h,l),Kt(i)&&d.setFullYear(i)),d},"parseDate");function na(r){var e=ea. +exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=ai(t));var i=parseInt(e[2], +10)-1,s=e[3],o=new Date(t,i,s);return Kt(t)&&o.setFullYear(t),o}}a(na,"getDate"); +function ia(r){if(r.endsWith("+00"))return 0;var e=ta.exec(r.split(" ")[1]);if(e){ var t=e[1];if(t==="Z")return 0;var n=t==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt( -e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(oa,"timeZoneOffset");function ci(r){ -return-(r-1)}a(ci,"bcYearToNegativeYear");function Kt(r){return r>=0&&r<100}a(Kt, -"is0To99")});var pi=I((Ch,fi)=>{p();fi.exports=ua;var aa=Object.prototype.hasOwnProperty;function ua(r){ -for(var e=1;e{"use strict";p();var ca=pi();yi.exports=Fe;function Fe(r){if(!(this instanceof -Fe))return new Fe(r);ca(this,xa(r))}a(Fe,"PostgresInterval");var ha=["seconds","\ -minutes","hours","days","months","years"];Fe.prototype.toPostgres=function(){var r=ha. +e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(ia,"timeZoneOffset");function ai(r){ +return-(r-1)}a(ai,"bcYearToNegativeYear");function Kt(r){return r>=0&&r<100}a(Kt, +"is0To99")});var li=I((mh,hi)=>{p();hi.exports=oa;var sa=Object.prototype.hasOwnProperty;function oa(r){ +for(var e=1;e{"use strict";p();var aa=li();pi.exports=Fe;function Fe(r){if(!(this instanceof +Fe))return new Fe(r);aa(this,ba(r))}a(Fe,"PostgresInterval");var ua=["seconds","\ +minutes","hours","days","months","years"];Fe.prototype.toPostgres=function(){var r=ua. filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")< 0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e=== "seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/, -"")),t+" "+e},this).join(" ")};var la={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ -M",seconds:"S"},fa=["years","months","days"],pa=["hours","minutes","seconds"];Fe. -prototype.toISOString=Fe.prototype.toISO=function(){var r=fa.map(t,this).join(""), -e=pa.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== +"")),t+" "+e},this).join(" ")};var ca={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ +M",seconds:"S"},ha=["years","months","days"],la=["hours","minutes","seconds"];Fe. +prototype.toISOString=Fe.prototype.toISO=function(){var r=ha.map(t,this).join(""), +e=la.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== "seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/, -"")),i+la[n]}};var zt="([+-]?\\d+)",da=zt+"\\s+years?",ya=zt+"\\s+mons?",ma=zt+"\ -\\s+days?",ga="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",wa=new RegExp([ -da,ya,ma,ga].map(function(r){return"("+r+")?"}).join("\\s*")),di={years:2,months:4, -days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ba=["hours","minutes","sec\ -onds","milliseconds"];function Sa(r){var e=r+"000000".slice(r.length);return parseInt( -e,10)/1e3}a(Sa,"parseMilliseconds");function xa(r){if(!r)return{};var e=wa.exec( -r),t=e[8]==="-";return Object.keys(di).reduce(function(n,i){var s=di[i],o=e[s];return!o|| -(o=i==="milliseconds"?Sa(o):parseInt(o,10),!o)||(t&&~ba.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(xa,"parse")});var wi=I((Rh,gi)=>{"use strict";p();gi.exports=a(function(e){if(/^\\x/.test(e))return new y( +"")),i+ca[n]}};var zt="([+-]?\\d+)",fa=zt+"\\s+years?",pa=zt+"\\s+mons?",da=zt+"\ +\\s+days?",ya="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",ma=new RegExp([ +fa,pa,da,ya].map(function(r){return"("+r+")?"}).join("\\s*")),fi={years:2,months:4, +days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ga=["hours","minutes","sec\ +onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return parseInt( +e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( +r),t=e[8]==="-";return Object.keys(fi).reduce(function(n,i){var s=fi[i],o=e[s];return!o|| +(o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= +o),n},{})}a(ba,"parse")});var mi=I((Eh,yi)=>{"use strict";p();yi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=$t(),ze=Vt(),lt=li(),Si=mi(),xi=wi();function ft(r){ -return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Ei(r){ +"\\";n+=Math.floor(i/2)*2}return new y(t,"binary")},"parseBytea")});var vi=I((Ah,Ei)=>{p();var Ke=$t(),ze=Vt(),lt=ci(),wi=di(),bi=mi();function ft(r){ +return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Si(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| -r==="1"}a(Ei,"parseBool");function Ea(r){return r?Ke.parse(r,Ei):null}a(Ea,"pars\ -eBoolArray");function va(r){return parseInt(r,10)}a(va,"parseBaseTenInt");function Yt(r){ -return r?Ke.parse(r,ft(va)):null}a(Yt,"parseIntegerArray");function _a(r){return r? -Ke.parse(r,ft(function(e){return vi(e).trim()})):null}a(_a,"parseBigIntegerArray"); -var Aa=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +r==="1"}a(Si,"parseBool");function Sa(r){return r?Ke.parse(r,Si):null}a(Sa,"pars\ +eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Yt(r){ +return r?Ke.parse(r,ft(xa)):null}a(Yt,"parseIntegerArray");function Ea(r){return r? +Ke.parse(r,ft(function(e){return xi(e).trim()})):null}a(Ea,"parseBigIntegerArray"); +var va=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=er(t)),t});return e.parse()},"parsePointArray"),Zt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); return e.parse()},"parseFloatArray"),ne=a(function(r){if(!r)return null;var e=ze. create(r);return e.parse()},"parseStringArray"),Jt=a(function(r){if(!r)return null; var e=ze.create(r,function(t){return t!==null&&(t=lt(t)),t});return e.parse()},"\ -parseDateArray"),Ca=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ -return t!==null&&(t=Si(t)),t});return e.parse()},"parseIntervalArray"),Ta=a(function(r){ -return r?Ke.parse(r,ft(xi)):null},"parseByteAArray"),Xt=a(function(r){return parseInt( -r,10)},"parseInteger"),vi=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: -r},"parseBigInteger"),bi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, +parseDateArray"),_a=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ +return t!==null&&(t=wi(t)),t});return e.parse()},"parseIntervalArray"),Aa=a(function(r){ +return r?Ke.parse(r,ft(bi)):null},"parseByteAArray"),Xt=a(function(r){return parseInt( +r,10)},"parseInteger"),xi=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: +r},"parseBigInteger"),gi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, "parseJsonArray"),er=a(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- -1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ia=a(function(r){ +1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ca=a(function(r){ if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i{"use strict";p();var Z=1e6;function Ba(r){var e=r.readInt32BE( +Jt),r(1185,Jt),r(1186,wi),r(1187,_a),r(17,bi),r(114,JSON.parse.bind(JSON)),r(3802, +JSON.parse.bind(JSON)),r(199,gi),r(3807,gi),r(3907,ne),r(2951,ne),r(791,ne),r(1183, +ne),r(1270,ne)},"init");Ei.exports={init:Ta}});var Ai=I((Ih,_i)=>{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,o,u, -c,h,l;{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+ -u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* -s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< -h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), +c,h,l;{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+ +u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* +s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< +h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var La=Ti(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ +e%Y,o=4294967296*s+t,u=""+o%Y,n+u+i}a(Ia,"readInt8");_i.exports=Ia});var Bi=I((Lh,Pi)=>{p();var Pa=Ai(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ return C*Math.pow(2,Q)+B};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& -(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Bi=a(function(r,e,t){var n=Math.pow(2,t- +(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Ii=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= 1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ra=a(function(r){return F(r,1)==1?-1* -(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ii=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Fa=a(function(r){return Bi(r,23,8)},"pars\ -eFloat32"),Ma=a(function(r){return Bi(r,52,11)},"parseFloat64"),Da=a(function(r){ +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ba=a(function(r){return F(r,1)==1?-1* +(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ci=a(function(r){return F(r,1)==1?-1*(F( +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),La=a(function(r){return Ii(r,23,8)},"pars\ +eFloat32"),Ra=a(function(r){return Ii(r,52,11)},"parseFloat64"),Fa=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o>3,(i+=l<<3)>>3 d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ var d=[],b;if(h.length>1){var C=h.shift();for(b=0;b0},"parseBool"),Oa=a(function(r){r(20,La),r(21,Ra),r(23,Ii),r(26, -Ii),r(1700,Da),r(700,Fa),r(701,Ma),r(16,Ua),r(1114,Pi.bind(null,!1)),r(1184,Pi.bind( -null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,ka)},"init"); -Li.exports={init:Oa}});var Mi=I((Hh,Fi)=>{p();Fi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +ay"),Ma=a(function(r){return r.toString("utf8")},"parseText"),ka=a(function(r){return r=== +null?null:F(r,8)>0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,Ba),r(23,Ci),r(26, +Ci),r(1700,Fa),r(700,La),r(701,Ra),r(16,ka),r(1114,Ti.bind(null,!1)),r(1184,Ti.bind( +null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); +Pi.exports={init:Da}});var Ri=I((Mh,Li)=>{p();Li.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -696,157 +696,157 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Na=Ai(),qa=Ri(),Qa=Vt(),ja=Mi();Je.getTypeParser=Wa;Je.setTypeParser= -Ha;Je.arrayParser=Qa;Je.builtins=ja;var Ze={text:{},binary:{}};function Di(r){return String( -r)}a(Di,"noParse");function Wa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Di}a(Wa, -"getTypeParser");function Ha(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= -t}a(Ha,"setTypeParser");Na.init(function(r,e){Ze.text[r]=e});qa.init(function(r,e){ -Ze.binary[r]=e})});var et=I((zh,tr)=>{"use strict";p();tr.exports={host:"localhost",user:m.platform=== +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=vi(),Oa=Bi(),Na=Vt(),qa=Ri();Je.getTypeParser=Qa;Je.setTypeParser= +Wa;Je.arrayParser=Na;Je.builtins=qa;var Ze={text:{},binary:{}};function Fi(r){return String( +r)}a(Fi,"noParse");function Qa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Fi}a(Qa, +"getTypeParser");function Wa(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= +t}a(Wa,"setTypeParser");Ua.init(function(r,e){Ze.text[r]=e});Oa.init(function(r,e){ +Ze.binary[r]=e})});var et=I((Nh,tr)=>{"use strict";p();tr.exports={host:"localhost",user:m.platform=== "win32"?m.env.USERNAME:m.env.USER,database:void 0,password:null,connectionString:void 0, port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1, application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1, statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1, -connect_timeout:0,keepalives:1,keepalives_idle:0};var Me=Xe(),Ga=Me.getTypeParser( -20,"text"),$a=Me.getTypeParser(1016,"text");tr.exports.__defineSetter__("parseIn\ -t8",function(r){Me.setTypeParser(20,"text",r?Me.getTypeParser(23,"text"):Ga),Me. -setTypeParser(1016,"text",r?Me.getTypeParser(1007,"text"):$a)})});var tt=I((Zh,Ui)=>{"use strict";p();var Va=(Ht(),O(Wt)),Ka=et();function za(r){var e=r. -replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(za,"escapeElement"); -function ki(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> -"u"?e=e+"NULL":Array.isArray(r[t])?e=e+ki(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. -toString("hex"):e+=za(pt(r[t]));return e=e+"}",e}a(ki,"arrayString");var pt=a(function(r,e){ +connect_timeout:0,keepalives:1,keepalives_idle:0};var Me=Xe(),ja=Me.getTypeParser( +20,"text"),Ha=Me.getTypeParser(1016,"text");tr.exports.__defineSetter__("parseIn\ +t8",function(r){Me.setTypeParser(20,"text",r?Me.getTypeParser(23,"text"):ja),Me. +setTypeParser(1016,"text",r?Me.getTypeParser(1007,"text"):Ha)})});var tt=I((Qh,ki)=>{"use strict";p();var Ga=(Ht(),O(jt)),$a=et();function Va(r){var e=r. +replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Va,"escapeElement"); +function Mi(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> +"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Mi(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. +toString("hex"):e+=Va(pt(r[t]));return e=e+"}",e}a(Mi,"arrayString");var pt=a(function(r,e){ if(r==null)return null;if(r instanceof y)return r;if(ArrayBuffer.isView(r)){var t=y. from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice( -r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?Ka.parseInputDatesAsUTC? -Ja(r):Za(r):Array.isArray(r)?ki(r):typeof r=="object"?Ya(r,e):r.toString()},"pre\ -pareValue");function Ya(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. +r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?$a.parseInputDatesAsUTC? +Ya(r):za(r):Array.isArray(r)?Mi(r):typeof r=="object"?Ka(r,e):r.toString()},"pre\ +pareValue");function Ka(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+ r+'" for query');return e.push(r),pt(r.toPostgres(pt),e)}return JSON.stringify(r)} -a(Ya,"prepareObject");function G(r,e){for(r=""+r;r.length{"use strict";p();var nr=(Ht(),O(Wt));function tu(r){if(r.indexOf( +G(r.getUTCMilliseconds(),3);return n+="+00:00",t&&(n+=" BC"),n}a(Ya,"dateToStrin\ +gUTC");function Za(r,e,t){return r=typeof r=="string"?{text:r}:r,e&&(typeof e=="\ +function"?r.callback=e:r.values=e),t&&(r.callback=t),r}a(Za,"normalizeQueryConfi\ +g");var rr=a(function(r){return Ga.createHash("md5").update(r,"utf-8").digest("h\ +ex")},"md5"),Ja=a(function(r,e,t){var n=rr(e+r),i=rr(y.concat([y.from(n),t]));return"\ +md5"+i},"postgresMd5PasswordHash");ki.exports={prepareValue:a(function(e){return pt( +e)},"prepareValueWrapper"),normalizeQueryConfig:Za,postgresMd5PasswordHash:Ja,md5:rr}});var qi=I((Hh,Ni)=>{"use strict";p();var nr=(Ht(),O(jt));function Xa(r){if(r.indexOf( "SCRAM-SHA-256")===-1)throw new Error("SASL: Only mechanism SCRAM-SHA-256 is cur\ rently supported");let e=nr.randomBytes(18).toString("base64");return{mechanism:"\ SCRAM-SHA-256",clientNonce:e,response:"n,,n=*,r="+e,message:"SASLInitialResponse"}} -a(tu,"startSession");function ru(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( +a(Xa,"startSession");function eu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( "SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(typeof t!= "string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a\ - string");let n=su(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== + string");let n=nu(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n\ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ -er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=uu(e, -i,n.iteration),o=De(s,"Client Key"),u=au(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=De(u,d),C=qi( -o,b),B=C.toString("base64"),Q=De(s,"Server Key"),X=De(Q,d);r.message="SASLRespon\ -se",r.serverSignature=X.toString("base64"),r.response=l+",p="+B}a(ru,"continueSe\ -ssion");function nu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ +er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, +i,n.iteration),o=ke(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=ke(u,d),C=Oi( +o,b),B=C.toString("base64"),Q=ke(s,"Server Key"),J=ke(Q,d);r.message="SASLRespon\ +se",r.serverSignature=J.toString("base64"),r.response=l+",p="+B}a(eu,"continueSe\ +ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ -CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=ou( +CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: s\ -erver signature does not match")}a(nu,"finalizeSession");function iu(r){if(typeof r!= +erver signature does not match")}a(tu,"finalizeSession");function ru(r){if(typeof r!= "string")throw new TypeError("SASL: text must be a string");return r.split("").map( -(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(iu,"isPrintableC\ -hars");function Oi(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(r)}a(Oi,"isBase64");function Ni(r){if(typeof r!="string")throw new TypeError( +(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(ru,"isPrintableC\ +hars");function Di(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(r)}a(Di,"isBase64");function Ui(r){if(typeof r!="string")throw new TypeError( "SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{ if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0], -n=e.substring(2);return[t,n]}))}a(Ni,"parseAttributePairs");function su(r){let e=Ni( -r),t=e.get("r");if(t){if(!iu(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ +n=e.substring(2);return[t,n]}))}a(Ui,"parseAttributePairs");function nu(r){let e=Ui( +r),t=e.get("r");if(t){if(!ru(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ E: nonce must only contain printable characters")}else throw new Error("SASL: SC\ -RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Oi(n))throw new Error( +RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Di(n))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("S\ ASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/. test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration cou\ nt")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); -let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(su,"parseServerFirstMe\ -ssage");function ou(r){let t=Ni(r).get("v");if(t){if(!Oi(t))throw new Error("SAS\ +let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(nu,"parseServerFirstMe\ +ssage");function iu(r){let t=Ui(r).get("v");if(t){if(!Di(t))throw new Error("SAS\ L: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error( "SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}} -a(ou,"parseServerFinalMessage");function qi(r,e){if(!y.isBuffer(r))throw new TypeError( +a(iu,"parseServerFinalMessage");function Oi(r,e){if(!y.isBuffer(r))throw new TypeError( "first argument must be a Buffer");if(!y.isBuffer(e))throw new TypeError("second\ argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer leng\ ths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return y. -from(r.map((t,n)=>r[n]^e[n]))}a(qi,"xorBuffers");function au(r){return nr.createHash( -"sha256").update(r).digest()}a(au,"sha256");function De(r,e){return nr.createHmac( -"sha256",r).update(e).digest()}a(De,"hmacSha256");function uu(r,e,t){for(var n=De( -r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;scu});function cu(...r){return r.join("/")}var sr=z(()=>{ -"use strict";p();a(cu,"join")});var or={};se(or,{stat:()=>hu});function hu(r,e){e(new Error("No filesystem"))}var ar=z( -()=>{"use strict";p();a(hu,"stat")});var ur={};se(ur,{default:()=>lu});var lu,cr=z(()=>{"use strict";p();lu={}});var Wi={};se(Wi,{StringDecoder:()=>hr});var lr,hr,Hi=z(()=>{"use strict";p();lr= +from(r.map((t,n)=>r[n]^e[n]))}a(Oi,"xorBuffers");function su(r){return nr.createHash( +"sha256").update(r).digest()}a(su,"sha256");function ke(r,e){return nr.createHmac( +"sha256",r).update(e).digest()}a(ke,"hmacSha256");function ou(r,e,t){for(var n=ke( +r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;sau});function au(...r){return r.join("/")}var sr=te(()=>{ +"use strict";p();a(au,"join")});var or={};se(or,{stat:()=>uu});function uu(r,e){e(new Error("No filesystem"))}var ar=te( +()=>{"use strict";p();a(uu,"stat")});var ur={};se(ur,{default:()=>cu});var cu,cr=te(()=>{"use strict";p();cu={}});var Qi={};se(Qi,{StringDecoder:()=>hr});var lr,hr,Wi=te(()=>{"use strict";p();lr= class lr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(lr,"StringDecoder"); -hr=lr});var Ki=I((hl,Vi)=>{"use strict";p();var{Transform:fu}=(cr(),O(ur)),{StringDecoder:pu}=(Hi(),O(Wi)), -we=Symbol("last"),dt=Symbol("decoder");function du(r,e,t){let n;if(this.overflow){ +hr=lr});var $i=I((el,Gi)=>{"use strict";p();var{Transform:hu}=(cr(),O(ur)),{StringDecoder:lu}=(Wi(),O(Qi)), +we=Symbol("last"),dt=Symbol("decoder");function fu(r,e,t){let n;if(this.overflow){ if(n=this[dt].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. overflow=!1}else this[we]+=this[dt].write(r),n=this[we].split(this.matcher);this[we]= -n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ -t(new Error("maximum buffer reached"));return}t()}a(du,"transform");function yu(r){ -if(this[we]+=this[dt].end(),this[we])try{$i(this,this.mapper(this[we]))}catch(e){ -return r(e)}r()}a(yu,"flush");function $i(r,e){e!==void 0&&r.push(e)}a($i,"push"); -function Gi(r){return r}a(Gi,"noop");function mu(r,e,t){switch(r=r||/\r?\n/,e=e|| -Gi,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== +t(new Error("maximum buffer reached"));return}t()}a(fu,"transform");function pu(r){ +if(this[we]+=this[dt].end(),this[we])try{Hi(this,this.mapper(this[we]))}catch(e){ +return r(e)}r()}a(pu,"flush");function Hi(r,e){e!==void 0&&r.push(e)}a(Hi,"push"); +function ji(r){return r}a(ji,"noop");function du(r,e,t){switch(r=r||/\r?\n/,e=e|| +ji,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== "object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2: -typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Gi)}t=Object. -assign({},t),t.autoDestroy=!0,t.transform=du,t.flush=yu,t.readableObjectMode=!0; -let n=new fu(t);return n[we]="",n[dt]=new pu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= +typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=ji)}t=Object. +assign({},t),t.autoDestroy=!0,t.transform=fu,t.flush=pu,t.readableObjectMode=!0; +let n=new hu(t);return n[we]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ -this._writableState.errorEmitted=!1,s(i)},n}a(mu,"split");Vi.exports=mu});var Zi=I((pl,fe)=>{"use strict";p();var zi=(sr(),O(ir)),gu=(cr(),O(ur)).Stream,wu=Ki(), -Yi=(Ge(),O(He)),bu=5432,yt=m.platform==="win32",rt=m.stderr,Su=56,xu=7,Eu=61440, -vu=32768;function _u(r){return(r&Eu)==vu}a(_u,"isRegFile");var ke=["host","port", -"database","user","password"],fr=ke.length,Au=ke[fr-1];function pr(){var r=rt instanceof -gu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` -`);rt.write(Yi.format.apply(Yi,e))}}a(pr,"warn");Object.defineProperty(fe.exports, +this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Gi.exports=du});var zi=I((nl,fe)=>{"use strict";p();var Vi=(sr(),O(ir)),yu=(cr(),O(ur)).Stream,mu=$i(), +Ki=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, +xu=32768;function Eu(r){return(r&Su)==xu}a(Eu,"isRegFile");var De=["host","port", +"database","user","password"],fr=De.length,vu=De[fr-1];function pr(){var r=rt instanceof +yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` +`);rt.write(Ki.format.apply(Ki,e))}}a(pr,"warn");Object.defineProperty(fe.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});fe. exports.warnTo=function(r){var e=rt;return rt=r,e};fe.exports.getFileName=function(r){ -var e=r||m.env,t=e.PGPASSFILE||(yt?zi.join(e.APPDATA||"./","postgresql","pgpass.\ -conf"):zi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ +var e=r||m.env,t=e.PGPASSFILE||(yt?Vi.join(e.APPDATA||"./","postgresql","pgpass.\ +conf"):Vi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",_u(r.mode)?r.mode&(Su|xu)?(pr('WARNING: password file "%s" has group or \ +",Eu(r.mode)?r.mode&(wu|bu)?(pr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(pr('WARNING:\ - password file "%s" is not a plain file',e),!1))};var Cu=fe.exports.match=function(r,e){ -return ke.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||bu)===Number( + password file "%s" is not a plain file',e),!1))};var _u=fe.exports.match=function(r,e){ +return De.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};fe.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(wu());function s(c){var h=Tu(c);h&&Iu(h)&&Cu(r,h)&&(n=h[Au],i.end())} +var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[vu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), pr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. -on("data",s).on("end",o).on("error",u)};var Tu=fe.exports.parseLine=function(r){ +on("data",s).on("end",o).on("error",u)};var Au=fe.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, u=!1,c=a(function(l,d,b){var C=r.substring(d,b);Object.hasOwnProperty.call(m.env, -"PGPASS_NO_DEESCAPE")||(C=C.replace(/\\([:\\])/g,"$1")),o[ke[l]]=C},"addToObj"), +"PGPASS_NO_DEESCAPE")||(C=C.replace(/\\([:\\])/g,"$1")),o[De[l]]=C},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== -fr?o:null,o},Iu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. +fr?o:null,o},Cu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. length>0},1:function(o){return o==="*"?!0:(o=Number(o),isFinite(o)&&o>0&&o<9007199254740992&& Math.floor(o)===o)},2:function(o){return o.length>0},3:function(o){return o.length> -0},4:function(o){return o.length>0}},t=0;t{"use strict";p();var ml=(sr(),O(ir)),Ji=(ar(),O(or)),mt=Zi(); -dr.exports=function(r,e){var t=mt.getFileName();Ji.stat(t,function(n,i){if(n||!mt. -usePgPass(i,t))return e(void 0);var s=Ji.createReadStream(t);mt.getPassword(r,s, -e)})};dr.exports.warnTo=mt.warnTo});var wt=I((bl,es)=>{"use strict";p();var Pu=Xe();function gt(r){this._types=r||Pu, +0},4:function(o){return o.length>0}},t=0;t{"use strict";p();var ol=(sr(),O(ir)),Yi=(ar(),O(or)),mt=zi(); +dr.exports=function(r,e){var t=mt.getFileName();Yi.stat(t,function(n,i){if(n||!mt. +usePgPass(i,t))return e(void 0);var s=Yi.createReadStream(t);mt.getPassword(r,s, +e)})};dr.exports.warnTo=mt.warnTo});var wt=I((cl,Ji)=>{"use strict";p();var Tu=Xe();function gt(r){this._types=r||Tu, this.text={},this.binary={}}a(gt,"TypeOverrides");gt.prototype.getOverrides=function(r){ switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}}; gt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| -"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};es.exports=gt});var ts={};se(ts,{default:()=>Bu});var Bu,rs=z(()=>{"use strict";p();Bu={}});var ns={};se(ns,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ +"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};Ji.exports=gt});var Xi={};se(Xi,{default:()=>Iu});var Iu,es=te(()=>{"use strict";p();Iu={}});var ts={};se(ts,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( i),h=decodeURIComponent(h);let C=i+":"+s,B=e?Object.fromEntries(d.entries()):l;return{ href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:B,hash:b}}var mr=z(()=>{"use strict";p();a(yr,"parse")});var ss=I((Al,is)=>{"use strict";p();var Lu=(mr(),O(ns)),gr=(ar(),O(or));function wr(r){ -if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Lu. +search:l,query:B,hash:b}}var mr=te(()=>{"use strict";p();a(yr,"parse")});var ns=I((yl,rs)=>{"use strict";p();var Pu=(mr(),O(ts)),gr=(ar(),O(or));function wr(r){ +if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- 1]);var i=(e.auth||":").split(":");if(t.user=i[0],t.password=i.splice(1).join(":"), @@ -860,19 +860,19 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=gr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(wr,"parse");is.exports=wr;wr.parse=wr});var bt=I((Il,us)=>{"use strict";p();var Ru=(rs(),O(ts)),as=et(),os=ss().parse,V=a( +return t}a(wr,"parse");rs.exports=wr;wr.parse=wr});var bt=I((wl,os)=>{"use strict";p();var Bu=(es(),O(Xi)),ss=et(),is=ns().parse,V=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||as[r]},"val"),Fu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||ss[r]},"val"),Lu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": -return{rejectUnauthorized:!1}}return as.ssl},"readSSLConfigFromEnvironment"),Ue=a( +return{rejectUnauthorized:!1}}return ss.ssl},"readSSLConfigFromEnvironment"),Ue=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ teParamValue"),ie=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Ue(n))},"ad\ -d"),Sr=class Sr{constructor(e){e=typeof e=="string"?os(e):e||{},e.connectionString&& -(e=Object.assign({},e,os(e.connectionString))),this.user=V("user",e),this.database= +d"),Sr=class Sr{constructor(e){e=typeof e=="string"?is(e):e||{},e.connectionString&& +(e=Object.assign({},e,is(e.connectionString))),this.user=V("user",e),this.database= V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Fu():e.ssl,typeof this.ssl=="st\ +options=V("options",e),this.ssl=typeof e.ssl>"u"?Lu():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. @@ -892,13 +892,13 @@ ssl}:{};if(ie(t,n,"sslmode"),ie(t,n,"sslca"),ie(t,n,"sslkey"),ie(t,n,"sslcert"), ie(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ue(this.database)),this.replication&& t.push("replication="+Ue(this.replication)),this.host&&t.push("host="+Ue(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Ue(this.client_encoding)),Ru.lookup(this.host,function(i,s){return i? +ent_encoding="+Ue(this.client_encoding)),Bu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Ue(s)),e(null,t.join(" ")))})}};a(Sr,"ConnectionPa\ -rameters");var br=Sr;us.exports=br});var ls=I((Ll,hs)=>{"use strict";p();var Mu=Xe(),cs=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +rameters");var br=Sr;os.exports=br});var cs=I((xl,us)=>{"use strict";p();var Ru=Xe(),as=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, Er=class Er{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ -var t;e.text?t=cs.exec(e.text):t=cs.exec(e.command),t&&(this.command=t[1],t[3]?(this. +var t;e.text?t=as.exec(e.text):t=as.exec(e.command),t&&(this.command=t[1],t[3]?(this. oid=parseInt(t[2],10),this.rowCount=parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt( t[2],10)))}_parseRowAsArray(e){for(var t=new Array(e.length),n=0,i=e.length;n{"use strict";p();var{EventEmitter:Du}=ge(),fs=ls(),ps=tt(),_r=class _r extends Du{constructor(e,t,n){ -super(),e=ps.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. +ext"):this._parsers[t]=Ru.getTypeParser(n.dataTypeID,n.format||"text")}}};a(Er,"\ +Result");var xr=Er;us.exports=xr});var ps=I((_l,fs)=>{"use strict";p();var{EventEmitter:Fu}=ge(),hs=cs(),ls=tt(),_r=class _r extends Fu{constructor(e,t,n){ +super(),e=ls.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& -(this.callback=m.domain.bind(e.callback)),this._result=new fs(this._rowMode,this. +(this.callback=m.domain.bind(e.callback)),this._result=new hs(this._rowMode,this. types),this._results=this._result,this.isPreparedStatement=!1,this._canceledDueToError= !1,this._promise=null}requiresPreparation(){return this.name||this.rows?!0:!this. text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&& -(Array.isArray(this._results)||(this._results=[this._result]),this._result=new fs( +(Array.isArray(this._results)||(this._results=[this._result]),this._result=new hs( this._rowMode,this.types),this._results.push(this._result))}handleRowDescription(e){ this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this. callback||!this.listeners("row").length}handleDataRow(e){let t;if(!this._canceledDueToError){ @@ -937,47 +937,47 @@ name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execut {portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.isPreparedStatement= !0,this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types}); try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this. -binary,valueMapper:ps.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( +binary,valueMapper:ls.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(_r,"Query"); -var vr=_r;ds.exports=vr});var ws={};se(ws,{Socket:()=>_e,isIP:()=>ku});function ku(r){return 0}var gs,ms,v, -_e,St=z(()=>{"use strict";p();gs=Te(ge(),1);a(ku,"isIP");ms=/^[^.]+\./,v=class v extends gs.EventEmitter{constructor(){ +var vr=_r;fs.exports=vr});var ms={};se(ms,{Socket:()=>_e,isIP:()=>Mu});function Mu(r){return 0}var ys,ds,E, +_e,St=te(()=>{"use strict";p();ys=Te(ge(),1);a(Mu,"isIP");ds=/^[^.]+\./,E=class E extends ys.EventEmitter{constructor(){ super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); _(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? -v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ -v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ +E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ -v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? -v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. -wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. -opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? -v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? -v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? -v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ -v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ -return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. -rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ +E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? +E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. +wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. +opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? +E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? +E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? +E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ +E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ +return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. +rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -998,10 +998,10 @@ then(d=>{if(this.ws=d.webSocket,this.ws==null)throw c;this.ws.accept(),o(this.ws !0)}).catch(d=>{this.emit("error",new Error(`All attempts to open a WebSocket to\ connect to the database failed. Please refer to https://github.com/neondatabase\ /serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined\ -. Details: ${d.message}`)),this.emit("close")})}}async startTls(t){if(this.subtls=== -void 0)throw new Error("For Postgres SSL connections, you must set `neonConfig.s\ -ubtls` to the subtls library. See https://github.com/neondatabase/serverless/blo\ -b/main/CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. +. Details: ${d}`)),this.emit("close")})}}async startTls(t){if(this.subtls===void 0) +throw new Error("For Postgres SSL connections, you must set `neonConfig.subtls` \ +to the subtls library. See https://github.com/neondatabase/serverless/blob/main/\ +CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. fromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i.read.bind( i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o,{useSNI:!this. disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0});this.tlsRead= @@ -1016,12 +1016,12 @@ length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this.tlsState===0?(this rawWrite(t),i()):this.tlsState===1?this.once("secureConnection",()=>{this.write( t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){return this. write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed=!0,this. -end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ -let s;return i?.jwtAuth?s=t.replace(ms,"apiauth."):s=t.replace(ms,"api."),"https\ +end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ +let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api."),"https\ ://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0,webSocketConstructor:void 0, wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0,forceDisablePgSSL:!0,coalesceWrites:!0, pipelineConnect:"password",subtls:void 0,rootCerts:"",pipelineTLS:!1,disableSNI:!1}), -_(v,"opts",{});_e=v});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +_(E,"opts",{});_e=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1036,11 +1036,11 @@ e),this.length=t,this.name=n}};a(Nr,"DatabaseError");var Ar=Nr;T.DatabaseError=A var qr=class qr{constructor(e,t){this.length=e,this.chunk=t,this.name="copyData"}}; a(qr,"CopyDataMessage");var Cr=qr;T.CopyDataMessage=Cr;var Qr=class Qr{constructor(e,t,n,i){ this.length=e,this.name=t,this.binary=n,this.columnTypes=new Array(i)}};a(Qr,"Co\ -pyResponse");var Tr=Qr;T.CopyResponse=Tr;var jr=class jr{constructor(e,t,n,i,s,o,u){ +pyResponse");var Tr=Qr;T.CopyResponse=Tr;var Wr=class Wr{constructor(e,t,n,i,s,o,u){ this.name=e,this.tableID=t,this.columnID=n,this.dataTypeID=i,this.dataTypeSize=s, -this.dataTypeModifier=o,this.format=u}};a(jr,"Field");var Ir=jr;T.Field=Ir;var Wr=class Wr{constructor(e,t){ +this.dataTypeModifier=o,this.format=u}};a(Wr,"Field");var Ir=Wr;T.Field=Ir;var jr=class jr{constructor(e,t){ this.length=e,this.fieldCount=t,this.name="rowDescription",this.fields=new Array( -this.fieldCount)}};a(Wr,"RowDescriptionMessage");var Pr=Wr;T.RowDescriptionMessage= +this.fieldCount)}};a(jr,"RowDescriptionMessage");var Pr=jr;T.RowDescriptionMessage= Pr;var Hr=class Hr{constructor(e,t){this.length=e,this.parameterCount=t,this.name= "parameterDescription",this.dataTypeIDs=new Array(this.parameterCount)}};a(Hr,"P\ arameterDescriptionMessage");var Br=Hr;T.ParameterDescriptionMessage=Br;var Gr=class Gr{constructor(e,t,n){ @@ -1053,13 +1053,13 @@ this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(V this.length=e,this.processId=t,this.channel=n,this.payload=i,this.name="notifica\ tion"}};a(Kr,"NotificationResponseMessage");var Mr=Kr;T.NotificationResponseMessage= Mr;var zr=class zr{constructor(e,t){this.length=e,this.status=t,this.name="ready\ -ForQuery"}};a(zr,"ReadyForQueryMessage");var Dr=zr;T.ReadyForQueryMessage=Dr;var Yr=class Yr{constructor(e,t){ +ForQuery"}};a(zr,"ReadyForQueryMessage");var kr=zr;T.ReadyForQueryMessage=kr;var Yr=class Yr{constructor(e,t){ this.length=e,this.text=t,this.name="commandComplete"}};a(Yr,"CommandCompleteMes\ -sage");var kr=Yr;T.CommandCompleteMessage=kr;var Zr=class Zr{constructor(e,t){this. +sage");var Dr=Yr;T.CommandCompleteMessage=Dr;var Zr=class Zr{constructor(e,t){this. length=e,this.fields=t,this.name="dataRow",this.fieldCount=t.length}};a(Zr,"Data\ RowMessage");var Ur=Zr;T.DataRowMessage=Ur;var Jr=class Jr{constructor(e,t){this. length=e,this.message=t,this.name="notice"}};a(Jr,"NoticeMessage");var Or=Jr;T.NoticeMessage= -Or});var bs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); +Or});var gs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); xt.Writer=void 0;var tn=class tn{constructor(e=256){this.size=e,this.offset=5,this. headerPosition=0,this.buffer=y.allocUnsafe(e)}ensure(e){var t=this.buffer.length- this.offset;if(t>1)+e;this.buffer=y.allocUnsafe( @@ -1075,44 +1075,44 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(tn,"Wr\ -iter");var en=tn;xt.Writer=en});var xs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); -vt.serialize=void 0;var rn=bs(),M=new rn.Writer,Uu=a(r=>{M.addInt16(3).addInt16( +iter");var en=tn;xt.Writer=en});var bs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); +vt.serialize=void 0;var rn=gs(),M=new rn.Writer,ku=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new rn. -Writer().addInt32(t).add(e).flush()},"startup"),Ou=a(()=>{let r=y.allocUnsafe(8); -return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Nu=a(r=>M. -addCString(r).flush(112),"password"),qu=a(function(r,e){return M.addCString(r).addInt32( -y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Qu=a( -function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),ju=a( -r=>M.addCString(r).flush(81),"query"),Ss=[],Wu=a(r=>{let e=r.name||"";e.length>63&& +Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); +return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Uu=a(r=>M. +addCString(r).flush(112),"password"),Ou=a(function(r,e){return M.addCString(r).addInt32( +y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Nu=a( +function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),qu=a( +r=>M.addCString(r).flush(81),"query"),ws=[],Qu=a(r=>{let e=r.name||"";e.length>63&& (console.error("Warning! Postgres only supports 63 characters for query names."), console.error("You supplied %s (%s)",e,e.length),console.error("This can cause c\ -onflicts and silent errors executing queries"));let t=r.types||Ss;for(var n=t.length, +onflicts and silent errors executing queries"));let t=r.types||ws;for(var n=t.length, i=M.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| -"",n=r.binary||!1,i=r.values||Ss,s=i.length;return M.addCString(e).addCString(t), -M.addInt16(s),Hu(i,r.valueMapper),M.addInt16(s),M.add(Oe.flush()),M.addInt16(n?1: -0),M.flush(66)},"bind"),$u=y.from([69,0,0,0,9,0,0,0,0,0]),Vu=a(r=>{if(!r||!r.portal&& -!r.rows)return $u;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. +n)),Oe.addString(n))}},"writeValues"),ju=a((r={})=>{let e=r.portal||"",t=r.statement|| +"",n=r.binary||!1,i=r.values||ws,s=i.length;return M.addCString(e).addCString(t), +M.addInt16(s),Wu(i,r.valueMapper),M.addInt16(s),M.add(Oe.flush()),M.addInt16(n?1: +0),M.flush(66)},"bind"),Hu=y.from([69,0,0,0,9,0,0,0,0,0]),Gu=a(r=>{if(!r||!r.portal&& +!r.rows)return Hu;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]= -0,s.writeUInt32BE(t,s.length-4),s},"execute"),Ku=a((r,e)=>{let t=y.allocUnsafe(16); +0,s.writeUInt32BE(t,s.length-4),s},"execute"),$u=a((r,e)=>{let t=y.allocUnsafe(16); return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE( r,8),t.writeInt32BE(e,12),t},"cancel"),nn=a((r,e)=>{let n=4+y.byteLength(e)+1,i=y. allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i}, -"cstringMessage"),zu=M.addCString("P").flush(68),Yu=M.addCString("S").flush(68), -Zu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?zu:Yu,"describe"),Ju=a( -r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),Xu=a(r=>M.add(r).flush( -100),"copyData"),ec=a(r=>nn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),tc=Et(72),rc=Et(83),nc=Et(88),ic=Et(99),sc={startup:Uu,password:Nu, -requestSsl:Ou,sendSASLInitialResponseMessage:qu,sendSCRAMClientFinalMessage:Qu,query:ju, -parse:Wu,bind:Gu,execute:Vu,describe:Zu,close:Ju,flush:a(()=>tc,"flush"),sync:a( -()=>rc,"sync"),end:a(()=>nc,"end"),copyData:Xu,copyDone:a(()=>ic,"copyDone"),copyFail:ec, -cancel:Ku};vt.serialize=sc});var Es=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); -_t.BufferReader=void 0;var oc=y.allocUnsafe(0),on=class on{constructor(e=0){this. -offset=e,this.buffer=oc,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. +"cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), +zu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( +r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),Zu=a(r=>M.add(r).flush( +100),"copyData"),Ju=a(r=>nn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),Xu=Et(72),ec=Et(83),tc=Et(88),rc=Et(99),nc={startup:ku,password:Uu, +requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, +parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( +()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, +cancel:$u};vt.serialize=nc});var Ss=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +_t.BufferReader=void 0;var ic=y.allocUnsafe(0),on=class on{constructor(e=0){this. +offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= 2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this. buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer. @@ -1120,14 +1120,14 @@ toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstrin let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(on,"BufferReader");var sn=on;_t.BufferReader= -sn});var As=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var D=Xr(),ac=Es(),an=1,uc=4,vs=an+uc,_s=y.allocUnsafe(0),cn=class cn{constructor(e){ -if(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0,this.reader=new ac.BufferReader, +sn});var vs=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); +At.Parser=void 0;var k=Xr(),sc=Ss(),an=1,oc=4,xs=an+oc,Es=y.allocUnsafe(0),cn=class cn{constructor(e){ +if(this.buffer=Es,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, -i=this.bufferOffset;for(;i+vs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( -i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+vs,s,o,this.buffer);t(c),i+=u}else -break}i===n?(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= +i=this.bufferOffset;for(;i+xs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( +i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+xs,s,o,this.buffer);t(c),i+=u}else +break}i===n?(this.buffer=Es,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer. @@ -1135,9 +1135,9 @@ byteLength*2;for(;t>=s;)s*=2;i=y.allocUnsafe(s)}this.buffer.copy(i,0,this.buffer this.bufferOffset+this.bufferLength),this.buffer=i,this.bufferOffset=0}e.copy(this. buffer,this.bufferOffset+this.bufferLength),this.bufferLength=t}else this.buffer= e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,t,n,i){switch(t){case 50: -return D.bindComplete;case 49:return D.parseComplete;case 51:return D.closeComplete;case 110: -return D.noData;case 115:return D.portalSuspended;case 99:return D.copyDone;case 87: -return D.replicationStart;case 73:return D.emptyQuery;case 68:return this.parseDataRowMessage( +return k.bindComplete;case 49:return k.parseComplete;case 51:return k.closeComplete;case 110: +return k.noData;case 115:return k.portalSuspended;case 99:return k.copyDone;case 87: +return k.replicationStart;case 73:return k.emptyQuery;case 68:return this.parseDataRowMessage( e,n,i);case 67:return this.parseCommandCompleteMessage(e,n,i);case 90:return this. parseReadyForQueryMessage(e,n,i);case 65:return this.parseNotificationMessage(e, n,i);case 82:return this.parseAuthenticationResponse(e,n,i);case 83:return this. @@ -1146,54 +1146,54 @@ return this.parseErrorMessage(e,n,i,"error");case 78:return this.parseErrorMessa e,n,i,"notice");case 84:return this.parseRowDescriptionMessage(e,n,i);case 116:return this. parseParameterDescriptionMessage(e,n,i);case 71:return this.parseCopyInMessage(e, n,i);case 72:return this.parseCopyOutMessage(e,n,i);case 100:return this.parseCopyData( -e,n,i);default:return new D.DatabaseError("received invalid response: "+t.toString( +e,n,i);default:return new k.DatabaseError("received invalid response: "+t.toString( 16),n,"error")}}parseReadyForQueryMessage(e,t,n){this.reader.setBuffer(e,n);let i=this. -reader.string(1);return new D.ReadyForQueryMessage(t,i)}parseCommandCompleteMessage(e,t,n){ -this.reader.setBuffer(e,n);let i=this.reader.cstring();return new D.CommandCompleteMessage( -t,i)}parseCopyData(e,t,n){let i=n.slice(e,e+(t-4));return new D.CopyDataMessage( +reader.string(1);return new k.ReadyForQueryMessage(t,i)}parseCommandCompleteMessage(e,t,n){ +this.reader.setBuffer(e,n);let i=this.reader.cstring();return new k.CommandCompleteMessage( +t,i)}parseCopyData(e,t,n){let i=n.slice(e,e+(t-4));return new k.CopyDataMessage( t,i)}parseCopyInMessage(e,t,n){return this.parseCopyMessage(e,t,n,"copyInRespons\ e")}parseCopyOutMessage(e,t,n){return this.parseCopyMessage(e,t,n,"copyOutRespon\ se")}parseCopyMessage(e,t,n,i){this.reader.setBuffer(e,n);let s=this.reader.byte()!== -0,o=this.reader.int16(),u=new D.CopyResponse(t,i,s,o);for(let c=0;c{"use strict";p();Object.defineProperty(be,"__esModule",{value:!0}); -be.DatabaseError=be.serialize=be.parse=void 0;var cc=Xr();Object.defineProperty( -be,"DatabaseError",{enumerable:!0,get:a(function(){return cc.DatabaseError},"get")}); -var hc=xs();Object.defineProperty(be,"serialize",{enumerable:!0,get:a(function(){ -return hc.serialize},"get")});var lc=As();function fc(r,e){let t=new lc.Parser;return r. -on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(fc,"parse");be. -parse=fc});var Cs={};se(Cs,{connect:()=>pc});function pc({socket:r,servername:e}){return r. -startTls(e),r}var Ts=z(()=>{"use strict";p();a(pc,"connect")});var pn=I((of,Bs)=>{"use strict";p();var Is=(St(),O(ws)),dc=ge().EventEmitter,{parse:yc, -serialize:q}=hn(),Ps=q.flush(),mc=q.sync(),gc=q.end(),fn=class fn extends dc{constructor(e){ -super(),e=e||{},this.stream=e.stream||new Is.Socket,this._keepAlive=e.keepAlive, +be.DatabaseError=be.serialize=be.parse=void 0;var ac=Xr();Object.defineProperty( +be,"DatabaseError",{enumerable:!0,get:a(function(){return ac.DatabaseError},"get")}); +var uc=bs();Object.defineProperty(be,"serialize",{enumerable:!0,get:a(function(){ +return uc.serialize},"get")});var cc=vs();function hc(r,e){let t=new cc.Parser;return r. +on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");be. +parse=hc});var _s={};se(_s,{connect:()=>lc});function lc({socket:r,servername:e}){return r. +startTls(e),r}var As=te(()=>{"use strict";p();a(lc,"connect")});var pn=I((zl,Is)=>{"use strict";p();var Cs=(St(),O(ms)),fc=ge().EventEmitter,{parse:pc, +serialize:q}=hn(),Ts=q.flush(),dc=q.sync(),yc=q.end(),fn=class fn extends fc{constructor(e){ +super(),e=e||{},this.stream=e.stream||new Cs.Socket,this._keepAlive=e.keepAlive, this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.lastBuffer= !1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this._emitMessage= !1;var t=this;this.on("newListener",function(n){n==="message"&&(t._emitMessage=!0)})}connect(e,t){ @@ -1206,36 +1206,36 @@ ssl)return this.attachListeners(this.stream);this.stream.once("data",function(s) var o=s.toString("utf8");switch(o){case"S":break;case"N":return n.stream.end(),n. emit("error",new Error("The server does not support SSL connections"));default:return n. stream.end(),n.emit("error",new Error("There was an error establishing an SSL co\ -nnection"))}var u=(Ts(),O(Cs));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( -c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Is.isIP(t)===0&&(c.servername=t);try{ +nnection"))}var u=(As(),O(_s));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( +c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Cs.isIP(t)===0&&(c.servername=t);try{ n.stream=u.connect(c)}catch(h){return n.emit("error",h)}n.attachListeners(n.stream), n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){e.on("end",()=>{ -this.emit("end")}),yc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& +this.emit("end")}),pc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(q.requestSsl())}startup(e){ this.stream.write(q.startup(e))}cancel(e,t){this._send(q.cancel(e,t))}password(e){ this._send(q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(q.sendSASLInitialResponseMessage( e,t))}sendSCRAMClientFinalMessage(e){this._send(q.sendSCRAMClientFinalMessage(e))}_send(e){ return this.stream.writable?this.stream.write(e):!1}query(e){this._send(q.query( e))}parse(e){this._send(q.parse(e))}bind(e){this._send(q.bind(e))}execute(e){this. -_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ps)}sync(){this. -_ending=!0,this._send(Ps),this._send(mc)}ref(){this.stream.ref()}unref(){this.stream. +_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ts)}sync(){this. +_ending=!0,this._send(Ts),this._send(dc)}ref(){this.stream.ref()}unref(){this.stream. unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. -stream.end();return}return this.stream.write(gc,()=>{this.stream.end()})}close(e){ +stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Bs.exports=ln});var Fs=I((hf,Rs)=>{"use strict";p();var wc=ge().EventEmitter,cf=(Ge(),O(He)),bc=tt(), -dn=ji(),Sc=Xi(),xc=wt(),Ec=bt(),Ls=ys(),vc=et(),_c=pn(),yn=class yn extends wc{constructor(e){ -super(),this.connectionParameters=new Ec(e),this.user=this.connectionParameters. +this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Is.exports=ln});var Ls=I((Xl,Bs)=>{"use strict";p();var mc=ge().EventEmitter,Jl=(Ge(),O(He)),gc=tt(), +dn=qi(),wc=Zi(),bc=wt(),Sc=bt(),Ps=ps(),xc=et(),Ec=pn(),yn=class yn extends mc{constructor(e){ +super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}), this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= -t.Promise||S.Promise,this._types=new xc(t.types),this._ending=!1,this._connecting= +t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new _c({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new Ec({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. -binary||vc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. +binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}), this._connectionTimeoutMillis=t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=a( n=>{m.nextTick(()=>{n.handleError(e,this.connection)})},"enqueueError");this.activeQuery&& @@ -1273,10 +1273,10 @@ let t=this.connection;typeof this.password=="function"?this._Promise.resolve().t ()=>this.password()).then(n=>{if(n!==void 0){if(typeof n!="string"){t.emit("erro\ r",new TypeError("Password must be a string"));return}this.connectionParameters. password=this.password=n}else this.connectionParameters.password=this.password=null; -e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():Sc(this.connectionParameters, +e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():wc(this.connectionParameters, n=>{n!==void 0&&(this.connectionParameters.password=this.password=n),e()})}_handleAuthCleartextPassword(e){ this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){ -this._checkPgPass(()=>{let t=bc.postgresMd5PasswordHash(this.user,this.password, +this._checkPgPass(()=>{let t=gc.postgresMd5PasswordHash(this.user,this.password, e.salt);this.connection.password(t)})}_handleAuthSASL(e){this._checkPgPass(()=>{ this.saslSession=dn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( this.saslSession.mechanism,this.saslSession.response)})}_handleAuthSASLContinue(e){ @@ -1322,7 +1322,7 @@ e&&m.nextTick(()=>{this.activeQuery.handleError(e,this.connection),this.readyFor emit("drain"))}query(e,t,n){var i,s,o,u,c;if(e==null)throw new TypeError("Client\ was passed a null or undefined query");return typeof e.submit=="function"?(o=e. query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& -(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Ls( +(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Ps( e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,b)=>d?l(d):h(b)}))), o&&(c=i.callback,u=setTimeout(()=>{var h=new Error("Query read timeout");m.nextTick( ()=>{i.handleError(h,this.connection)}),c(h),i.callback=()=>{};var l=this.queryQueue. @@ -1337,18 +1337,18 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(yn,"Client");var Ct=yn;Ct.Query= -Ls;Rs.exports=Ct});var Us=I((pf,ks)=>{"use strict";p();var Ac=ge().EventEmitter,Ms=a(function(){},"\ -NOOP"),Ds=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, +Ps;Bs.exports=Ct});var ks=I((rf,Ms)=>{"use strict";p();var vc=ge().EventEmitter,Rs=a(function(){},"\ +NOOP"),Fs=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),wn=class wn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(wn,"IdleItem");var mn=wn,bn=class bn{constructor(e){this.callback= -e}};a(bn,"PendingItem");var Ne=bn;function Cc(){throw new Error("Release called \ -on client which has already been released to the pool.")}a(Cc,"throwOnDoubleRele\ +e}};a(bn,"PendingItem");var Ne=bn;function _c(){throw new Error("Release called \ +on client which has already been released to the pool.")}a(_c,"throwOnDoubleRele\ ase");function Tt(r,e){if(e)return{callback:e,result:void 0};let t,n,i=a(function(o,u){ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.captureStackTrace( -o),o});return{callback:i,result:s}}a(Tt,"promisify");function Tc(r,e){return a(function t(n){ +o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Tc,"makeIdleListener");var Sn=class Sn extends Ac{constructor(e,t){ +"idleListener")}a(Ac,"makeIdleListener");var Sn=class Sn extends vc{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1367,25 +1367,25 @@ _pendingQueue.length){this.log("no queued requests");return}if(!this._idle.lengt this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let t=this. _idle.pop();clearTimeout(t.timeoutId);let n=t.client;n.ref&&n.ref();let i=t.idleListener; return this._acquireClient(n,e,i,!1)}if(!this._isFull())return this.newClient(e); -throw new Error("unexpected condition")}_remove(e){let t=Ds(this._idle,n=>n.client=== +throw new Error("unexpected condition")}_remove(e){let t=Fs(this._idle,n=>n.client=== e);t!==void 0&&clearTimeout(t.timeoutId),this._clients=this._clients.filter(n=>n!== e),e.end(),this.emit("remove",e)}connect(e){if(this.ending){let i=new Error("Can\ not use a pool after calling end on the pool");return e?e(i):this.Promise.reject( i)}let t=Tt(this.Promise,e),n=t.result;if(this._isFull()||this._idle.length){if(this. _idle.length&&m.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis) return this._pendingQueue.push(new Ne(t.callback)),n;let i=a((u,c,h)=>{clearTimeout( -o),t.callback(u,c,h)},"queueCallback"),s=new Ne(i),o=setTimeout(()=>{Ds(this._pendingQueue, +o),t.callback(u,c,h)},"queueCallback"),s=new Ne(i),o=setTimeout(()=>{Fs(this._pendingQueue, u=>u.callback===i),s.timedOut=!0,t.callback(new Error("timeout exceeded when try\ ing to connect"))},this.options.connectionTimeoutMillis);return this._pendingQueue. push(s),n}return this.newClient(new Ne(t.callback)),n}newClient(e){let t=new this. -Client(this.options);this._clients.push(t);let n=Tc(this,t);this.log("checking c\ +Client(this.options);this._clients.push(t);let n=Ac(this,t);this.log("checking c\ lient timeout");let i,s=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{ this.log("ending client due to timeout"),s=!0,t.connection?t.connection.stream.destroy(): t.end()},this.options.connectionTimeoutMillis)),this.log("connecting new client"), t.connect(o=>{if(i&&clearTimeout(i),t.on("error",n),o)this.log("client failed to\ connect",o),this._clients=this._clients.filter(u=>u!==t),s&&(o.message="Connect\ ion terminated due to connection timeout"),this._pulseQueue(),e.timedOut||e.callback( -o,void 0,Ms);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== +o,void 0,Rs);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== 0){let u=setTimeout(()=>{this.log("ending client due to expired lifetime"),this. _expired.add(t),this._idle.findIndex(h=>h.client===t)!==-1&&this._acquireClient( t,new Ne((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.once( @@ -1393,8 +1393,8 @@ t,new Ne((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.o i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n), e.removeListener("error",n),t.timedOut?i&&this.options.verify?this.options.verify( e,e.release):e.release():i&&this.options.verify?this.options.verify(e,s=>{if(s)return e. -release(s),t.callback(s,void 0,Ms);t.callback(void 0,e,e.release)}):t.callback(void 0, -e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&Cc(),n=!0,this._release(e, +release(s),t.callback(s,void 0,Rs);t.callback(void 0,e,e.release)}):t.callback(void 0, +e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&_c(),n=!0,this._release(e, t,i)}}_release(e,t,n){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1, this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>= this.options.maxUses){e._poolUseCount>=this.options.maxUses&&this.log("remove ex\ @@ -1416,7 +1416,7 @@ this.Promise.reject(n)}this.ending=!0;let t=Tt(this.Promise,e);return this._endC t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue. length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients. reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients. -length}};a(Sn,"Pool");var gn=Sn;ks.exports=gn});var Os={};se(Os,{default:()=>Ic});var Ic,Ns=z(()=>{"use strict";p();Ic={}});var qs=I((gf,Pc)=>{Pc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ +length}};a(Sn,"Pool");var gn=Sn;Ms.exports=gn});var Ds={};se(Ds,{default:()=>Cc});var Cc,Us=te(()=>{"use strict";p();Cc={}});var Os=I((af,Tc)=>{Tc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ client - pure javascript & libpq with the same API",keywords:["database","libpq", "pg","postgre","postgres","postgresql","rdbms"],homepage:"https://github.com/bri\ anc/node-postgres",repository:{type:"git",url:"git://github.com/brianc/node-post\ @@ -1427,16 +1427,16 @@ pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:" 4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ "pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ .md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ -7b9a5491a178655"}});var Ws=I((wf,js)=>{"use strict";p();var Qs=ge().EventEmitter,Bc=(Ge(),O(He)),xn=tt(), -qe=js.exports=function(r,e,t){Qs.call(this),r=xn.normalizeQueryConfig(r,e,t),this. +7b9a5491a178655"}});var Qs=I((uf,qs)=>{"use strict";p();var Ns=ge().EventEmitter,Ic=(Ge(),O(He)),xn=tt(), +qe=qs.exports=function(r,e,t){Ns.call(this),r=xn.normalizeQueryConfig(r,e,t),this. text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ -newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Bc.inherits( -qe,Qs);var Lc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ +newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Ic.inherits( +qe,Ns);var Pc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ age",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"\ dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"\ routine"};qe.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); -if(e)for(var t in e){var n=Lc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. +if(e)for(var t in e){var n=Pc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. emit("error",r),this.state="error"};qe.prototype.then=function(r,e){return this. _getPromise().then(r,e)};qe.prototype.catch=function(r){return this._getPromise(). catch(r)};qe.prototype._getPromise=function(){return this._promise?this._promise: @@ -1458,30 +1458,30 @@ this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. values.map(xn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Vs=I((Ef,$s)=>{"use strict";p();var Rc=(Ns(),O(Os)),Fc=wt(),xf=qs(),Hs=ge(). -EventEmitter,Mc=(Ge(),O(He)),Dc=bt(),Gs=Ws(),J=$s.exports=function(r){Hs.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Fc(r.types),this.native= -new Rc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= -!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Dc( +text,t)}});var Gs=I((ff,Hs)=>{"use strict";p();var Bc=(Us(),O(Ds)),Lc=wt(),lf=Os(),Ws=ge(). +EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),js=Qs(),Z=Hs.exports=function(r){Ws.call(this), +r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Lc(r.types),this.native= +new Bc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= -e.port,this.namedQueries={}};J.Query=Gs;Mc.inherits(J,Hs);J.prototype._errorAllQueries= +e.port,this.namedQueries={}};Z.Query=js;Rc.inherits(Z,Ws);Z.prototype._errorAllQueries= function(r){let e=a(t=>{m.nextTick(()=>{t.native=this.native,t.handleError(r)})}, "enqueueError");this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery= -null),this._queryQueue.forEach(e),this._queryQueue.length=0};J.prototype._connect= +null),this._queryQueue.forEach(e),this._queryQueue.length=0};Z.prototype._connect= function(r){var e=this;if(this._connecting){m.nextTick(()=>r(new Error("Client h\ as already been connected. You cannot reuse a client.")));return}this._connecting= !0,this.connectionParameters.getLibpqConnectionString(function(t,n){if(t)return r( t);e.native.connect(n,function(i){if(i)return e.native.end(),r(i);e._connected=!0, e.native.on("error",function(s){e._queryable=!1,e._errorAllQueries(s),e.emit("er\ ror",s)}),e.native.on("notification",function(s){e.emit("notification",{channel:s. -relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};J. +relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};Z. prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise( -(e,t)=>{this._connect(n=>{n?t(n):e()})})};J.prototype.query=function(r,e,t){var n, +(e,t)=>{this._connect(n=>{n?t(n):e()})})};Z.prototype.query=function(r,e,t){var n, i,s,o,u;if(r==null)throw new TypeError("Client was passed a null or undefined qu\ ery");if(typeof r.submit=="function")s=r.query_timeout||this.connectionParameters. query_timeout,i=n=r,typeof e=="function"&&(r.callback=e);else if(s=this.connectionParameters. -query_timeout,n=new Gs(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= +query_timeout,n=new js(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= l,h=d}),n.callback=(l,d)=>l?h(l):c(d)}return s&&(u=n.callback,o=setTimeout(()=>{ var c=new Error("Query read timeout");m.nextTick(()=>{n.handleError(c,this.connection)}), u(c),n.callback=()=>{};var h=this._queryQueue.indexOf(n);h>-1&&this._queryQueue. @@ -1490,38 +1490,38 @@ this._queryable?this._ending?(n.native=this.native,m.nextTick(()=>{n.handleError new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.push( n),this._pulseQueryQueue(),i):(n.native=this.native,m.nextTick(()=>{n.handleError( new Error("Client has encountered a connection error and is not queryable"))}),i)}; -J.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( +Z.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( "connect",this.end.bind(this,r));var t;return r||(t=new this._Promise(function(n,i){ r=a(s=>s?i(s):n(),"cb")})),this.native.end(function(){e._errorAllQueries(new Error( -"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};J.prototype. +"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};Z.prototype. _hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="\ -error"&&this._activeQuery.state!=="end"};J.prototype._pulseQueryQueue=function(r){ +error"&&this._activeQuery.state!=="end"};Z.prototype._pulseQueryQueue=function(r){ if(this._connected&&!this._hasActiveQuery()){var e=this._queryQueue.shift();if(!e){ r||this.emit("drain");return}this._activeQuery=e,e.submit(this);var t=this;e.once( -"_done",function(){t._pulseQueryQueue()})}};J.prototype.cancel=function(r){this. +"_done",function(){t._pulseQueryQueue()})}};Z.prototype.cancel=function(r){this. _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== --1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};J.prototype.ref=function(){}; -J.prototype.unref=function(){};J.prototype.setTypeParser=function(r,e,t){return this. -_types.setTypeParser(r,e,t)};J.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var En=I((Af,Ks)=>{"use strict";p();Ks.exports=Vs()});var It=I((Tf,nt)=>{"use strict";p();var kc=Fs(),Uc=et(),Oc=pn(),Nc=Us(),{DatabaseError:qc}=hn(), -Qc=a(r=>{var e;return e=class extends Nc{constructor(n){super(n,r)}},a(e,"BoundP\ -ool"),e},"poolFactory"),vn=a(function(r){this.defaults=Uc,this.Client=r,this.Query= -this.Client.Query,this.Pool=Qc(this.Client),this._pools=[],this.Connection=Oc,this. -types=Xe(),this.DatabaseError=qc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new vn(En()):(nt.exports=new vn(kc),Object.defineProperty(nt.exports,"na\ +-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; +Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. +_types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. +_types.getTypeParser(r,e)}});var En=I((yf,$s)=>{"use strict";p();$s.exports=Gs()});var It=I((gf,nt)=>{"use strict";p();var Mc=Ls(),kc=et(),Dc=pn(),Uc=ks(),{DatabaseError:Oc}=hn(), +Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ +ool"),e},"poolFactory"),vn=a(function(r){this.defaults=kc,this.Client=r,this.Query= +this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. +types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. +exports=new vn(En()):(nt.exports=new vn(Mc),Object.defineProperty(nt.exports,"na\ tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new vn(En())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});p();var Bt=Te(It());St();p();St();mr();var Zs=Te(tt()),Js=Te(wt());function jc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(jc,"encodeBuffe\ +native",{value:r}),r}}))});p();var Bt=Te(It());St();p();St();mr();var zs=Te(tt()),Ys=Te(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", "NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); _(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, "constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. -captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,zs="transaction() exp\ -ects an array of queries, or a function returning an array of queries",Wc=["seve\ +captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,Vs="transaction() exp\ +ects an array of queries, or a function returning an array of queries",Qc=["seve\ rity","code","detail","hint","position","internalPosition","internalQuery","wher\ -e","schema","table","column","dataType","constraint","file","line","routine"];function Xs(r,{ +e","schema","table","column","dataType","constraint","file","line","routine"];function Zs(r,{ arrayMode:e,fullResults:t,fetchOptions:n,isolationLevel:i,readOnly:s,deferrable:o, queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data\ base connection string was provided to `neon()`. Perhaps an environment variable\ @@ -1529,47 +1529,47 @@ base connection string was provided to `neon()`. Perhaps an environment variable n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} let{protocol:d,username:b,hostname:C,port:B,pathname:Q}=l;if(d!=="postgres:"&&d!== "postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ - `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(A,...g){ -let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let j=0;jjc((0,Zs.prepareValue)(j)));let k={ -query:P,params:g};return u&&u(k),Hc(de,k,K)}a(X,"resolve"),X.transaction=async(A,g)=>{ -if(typeof A=="function"&&(A=A(X)),!Array.isArray(A))throw new Error(zs);A.forEach( -k=>{if(k[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(zs)});let P=A. -map(k=>k.parameterizedQuery),K=A.map(k=>k.opts??{});return de(P,K,g)};async function de(A,g,P){ -let{fetchEndpoint:K,fetchFunction:k}=_e,j=Array.isArray(A)?{queries:A}:A,ee=n??{}, -oe=e??!1,R=t??!1,$=i,ce=s,ye=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, -...P.fetchOptions}),P.arrayMode!==void 0&&(oe=P.arrayMode),P.fullResults!==void 0&& -(R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& + `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ +let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;Wqc((0,zs.prepareValue)(W)));let D={ +query:P,params:g};return u&&u(D),Wc(de,D,K)}a(J,"resolve"),J.transaction=async(A,g)=>{ +if(typeof A=="function"&&(A=A(J)),!Array.isArray(A))throw new Error(Vs);A.forEach( +D=>{if(D[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Vs)});let P=A. +map(D=>D.parameterizedQuery),K=A.map(D=>D.opts??{});return de(P,K,g)};async function de(A,g,P){ +let{fetchEndpoint:K,fetchFunction:D}=_e,W=Array.isArray(A)?{queries:A}:A,X=n??{}, +oe=e??!1,R=t??!1,$=i,ce=s,ye=o;P!==void 0&&(P.fetchOptions!==void 0&&(X={...X,...P. +fetchOptions}),P.arrayMode!==void 0&&(oe=P.arrayMode),P.fullResults!==void 0&&(R= +P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& (ce=P.readOnly),P.deferrable!==void 0&&(ye=P.deferrable)),g!==void 0&&!Array.isArray( -g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let Se=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(Se=g.authToken);let je=typeof K=="function"?K(C,B,{jwtAuth:Se!== +g)&&g.fetchOptions!==void 0&&(X={...X,...g.fetchOptions});let Se=h;!Array.isArray( +g)&&g?.authToken!==void 0&&(Se=g.authToken);let We=typeof K=="function"?K(C,B,{jwtAuth:Se!== void 0}):K,he={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ -ray-Mode":"true"},it=await Gc(Se);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( +ray-Mode":"true"},it=await jc(Se);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( A)&&($!==void 0&&(he["Neon-Batch-Isolation-Level"]=$),ce!==void 0&&(he["Neon-Bat\ ch-Read-Only"]=String(ce)),ye!==void 0&&(he["Neon-Batch-Deferrable"]=String(ye))); -let te;try{te=await(k??fetch)(je,{method:"POST",body:JSON.stringify(j),headers:he, -...ee})}catch(W){let H=new pe(`Error connecting to database: ${W.message}`);throw H. -sourceError=W,H}if(te.ok){let W=await te.json();if(Array.isArray(A)){let H=W.results; -if(!Array.isArray(H))throw new pe("Neon internal error: unexpected result format"); -return H.map((Ae,xe)=>{let Lt=g[xe]??{},ro=Lt.arrayMode??oe,no=Lt.fullResults??R; -return Ys(Ae,{arrayMode:ro,fullResults:no,parameterizedQuery:A[xe],resultCallback:c, -types:Lt.types})})}else{let H=g??{},Ae=H.arrayMode??oe,xe=H.fullResults??R;return Ys( -W,{arrayMode:Ae,fullResults:xe,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{ -let{status:W}=te;if(W===400){let H=await te.json(),Ae=new pe(H.message);for(let xe of Wc) -Ae[xe]=H[xe]??void 0;throw Ae}else{let H=await te.text();throw new pe(`Server er\ -ror (HTTP status ${W}): ${H}`)}}}return a(de,"execute"),X}a(Xs,"neon");function Hc(r,e,t){ -return{[Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a( -(n,i)=>r(e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r( -e,t).finally(n),"finally")}}a(Hc,"createNeonQueryPromise");function Ys(r,{arrayMode:e, -fullResults:t,parameterizedQuery:n,resultCallback:i,types:s}){let o=new Js.default( -s),u=r.fields.map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e=== -!0?r.rows.map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries( -l.map((d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), -t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ys,"\ -processQueryResult");async function Gc(r){if(typeof r=="string")return r;if(typeof r== +let ee;try{ee=await(D??fetch)(We,{method:"POST",body:JSON.stringify(W),headers:he, +...X})}catch(j){let H=new pe(`Error connecting to database: ${j}`);throw H.sourceError= +j,H}if(ee.ok){let j=await ee.json();if(Array.isArray(A)){let H=j.results;if(!Array. +isArray(H))throw new pe("Neon internal error: unexpected result format");return H. +map((Ae,xe)=>{let Lt=g[xe]??{},eo=Lt.arrayMode??oe,to=Lt.fullResults??R;return Ks( +Ae,{arrayMode:eo,fullResults:to,parameterizedQuery:A[xe],resultCallback:c,types:Lt. +types})})}else{let H=g??{},Ae=H.arrayMode??oe,xe=H.fullResults??R;return Ks(j,{arrayMode:Ae, +fullResults:xe,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; +if(j===400){let H=await ee.json(),Ae=new pe(H.message);for(let xe of Qc)Ae[xe]=H[xe]?? +void 0;throw Ae}else{let H=await ee.text();throw new pe(`Server error (HTTP stat\ +us ${j}): ${H}`)}}}return a(de,"execute"),J}a(Zs,"neon");function Wc(r,e,t){return{ +[Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a((n,i)=>r( +e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r(e,t).finally( +n),"finally")}}a(Wc,"createNeonQueryPromise");function Ks(r,{arrayMode:e,fullResults:t, +parameterizedQuery:n,resultCallback:i,types:s}){let o=new Ys.default(s),u=r.fields. +map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e===!0?r.rows. +map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries(l.map( +(d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), +t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ks,"\ +processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new pe("Error ge\ tting auth token.");throw e instanceof Error&&(t=new pe(`Error getting auth toke\ -n: ${e.message}`)),t}}a(Gc,"getAuthToken");var to=Te(bt()),Qe=Te(It());var An=class An extends Bt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ +n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Te(bt()),Qe=Te(It());var An=class An extends Bt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& (this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ @@ -1591,8 +1591,8 @@ let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassw this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=this. saslSession,i=this.password,s=t.data;if(n.message!=="SASLInitialResponse"||typeof i!= "string"||typeof s!="string")throw new Error("SASL: protocol error");let o=Object. -fromEntries(s.split(",").map(te=>{if(!/^.=/.test(te))throw new Error("SASL: Inva\ -lid attribute pair entry");let W=te[0],H=te.substring(2);return[W,H]})),u=o.r,c=o. +fromEntries(s.split(",").map(ee=>{if(!/^.=/.test(ee))throw new Error("SASL: Inva\ +lid attribute pair entry");let j=ee[0],H=ee.substring(2);return[j,H]})),u=o.r,c=o. s,h=o.i;if(!u||!/^[!-+--~]+$/.test(u))throw new Error("SASL: SCRAM-SERVER-FIRST-\ MESSAGE: nonce missing/unprintable");if(!c||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ @@ -1603,35 +1603,35 @@ if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, C=b.encode(i),B=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ 6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",B,y.concat([d,y.from( -[0,0,0,1])]))),X=Q;for(var de=0;deX[W]^Q[W]));let A=X,g=await w.subtle.importKey( +[0,0,0,1])]))),J=Q;for(var de=0;deJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( "raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", -P),k="n=*,r="+n.clientNonce,j="r="+u+",s="+c+",i="+l,ee="c=biws,r="+u,oe=k+","+j+ -","+ee,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, +P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,oe=D+","+W+ +","+X,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, ["sign"]);var $=new Uint8Array(await w.subtle.sign("HMAC",R,b.encode(oe))),ce=y. -from(P.map((te,W)=>P[W]^$[W])),ye=ce.toString("base64");let Se=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),je=await w.subtle.sign( -"HMAC",Se,b.encode("Server Key")),he=await w.subtle.importKey("raw",je,{name:"HM\ +from(P.map((ee,j)=>P[j]^$[j])),ye=ce.toString("base64");let Se=await w.subtle.importKey( +"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),We=await w.subtle.sign( +"HMAC",Se,b.encode("Server Key")),he=await w.subtle.importKey("raw",We,{name:"HM\ AC",hash:{name:"SHA-256"}},!1,["sign"]);var it=y.from(await w.subtle.sign("HMAC", he,b.encode(oe)));n.message="SASLResponse",n.serverSignature=it.toString("base64"), -n.response=ee+",p="+ye,this.connection.sendSCRAMClientFinalMessage(this.saslSession. -response)}};a(An,"NeonClient");var _n=An;function $c(r,e){if(e)return{callback:e, +n.response=X+",p="+ye,this.connection.sendSCRAMClientFinalMessage(this.saslSession. +response)}};a(An,"NeonClient");var _n=An;function Hc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a($c,"promisify");var Cn=class Cn extends Bt.Pool{constructor(){ +n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var Cn=class Cn extends Bt.Pool{constructor(){ super(...arguments);_(this,"Client",_n);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ if(!_e.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=$c(this.Promise, -i);i=s.callback;try{let o=new to.default(this.options),u=encodeURIComponent,c=encodeURI, +return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Hc(this.Promise, +i);i=s.callback;try{let o=new Xs.default(this.options),u=encodeURIComponent,c=encodeURI, h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== -"string"?t:t.text,d=n??t.values??[];Xs(h,{fullResults:!0,arrayMode:t.rowMode==="\ +"string"?t:t.text,d=n??t.values??[];Zs(h,{fullResults:!0,arrayMode:t.rowMode==="\ array"})(l,d,{types:t.types??this.options?.types}).then(C=>i(void 0,C)).catch(C=>i( -C))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var eo=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; +C))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var Js=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; var export_Query=Qe.Query;var export_defaults=Qe.defaults;var export_types=Qe.types; export{_n as Client,export_ClientBase as ClientBase,export_Connection as Connection, -export_DatabaseError as DatabaseError,pe as NeonDbError,eo as Pool,export_Query as Query, -export_defaults as defaults,Xs as neon,_e as neonConfig,export_types as types}; +export_DatabaseError as DatabaseError,pe as NeonDbError,Js as Pool,export_Query as Query, +export_defaults as defaults,Zs as neon,_e as neonConfig,export_types as types}; /*! Bundled license information: ieee754/index.js: diff --git a/dist/npm/CONFIG.md b/dist/npm/CONFIG.md index 4f56abf..ae4a8be 100644 --- a/dist/npm/CONFIG.md +++ b/dist/npm/CONFIG.md @@ -161,10 +161,7 @@ const sql = neon(process.env.DATABASE_URL); const showLatestN = 10; const [posts, tags] = await sql.transaction( - [ - sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, - sql`SELECT * FROM tags`, - ], + [sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, sql`SELECT * FROM tags`], { isolationLevel: 'RepeatableRead', readOnly: true, @@ -175,9 +172,10 @@ const [posts, tags] = await sql.transaction( Or as an example of the function case: ```javascript -const [authors, tags] = await neon(process.env.DATABASE_URL).transaction( - (txn) => [txn`SELECT * FROM authors`, txn`SELECT * FROM tags`], -); +const [authors, tags] = await neon(process.env.DATABASE_URL).transaction((txn) => [ + txn`SELECT * FROM authors`, + txn`SELECT * FROM tags`, +]); ``` The optional second argument to `transaction()`, `options`, has the same keys as the options to the ordinary query function -- `arrayMode`, `fullResults` and `fetchOptions` -- plus three additional keys that concern the transaction configuration. These transaction-related keys are: `isolationMode`, `readOnly` and `deferrable`. They are described below. Defaults for the transaction-related keys can also be set as options to the `neon` function. @@ -269,8 +267,7 @@ If connecting to a non-Neon database, the `wsProxy` option should point to [your ```javascript // either: -neonConfig.wsProxy = (host, port) => - `my-wsproxy.example.com/v1?address=${host}:${port}`; +neonConfig.wsProxy = (host, port) => `my-wsproxy.example.com/v1?address=${host}:${port}`; // or (with identical effect): neonConfig.wsProxy = 'my-wsproxy.example.com/v1'; ``` diff --git a/dist/npm/README.md b/dist/npm/README.md index e361b09..2eef9bf 100644 --- a/dist/npm/README.md +++ b/dist/npm/README.md @@ -157,13 +157,8 @@ try { await client.query('BEGIN'); const { rows: [{ id: postId }], - } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', [ - 'Welcome', - ]); - await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [ - postId, - 's3.bucket/photo/url', - ]); + } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', ['Welcome']); + await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [postId, 's3.bucket/photo/url']); await client.query('COMMIT'); } catch (err) { await client.query('ROLLBACK'); @@ -196,22 +191,25 @@ export default async (req: Request, ctx: any) => { // create a `Pool` inside the request handler const pool = new Pool({ connectionString: process.env.DATABASE_URL }); - // get and validate the `postId` query parameter - const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); - if (isNaN(postId)) return new Response('Bad request', { status: 400 }); - - // query and validate the post - const [post] = await pool.query('SELECT * FROM posts WHERE id = $1', [postId]); - if (!post) return new Response('Not found', { status: 404 }); - - // end the `Pool` inside the same request handler - // (unlike `await`, `ctx.waitUntil` won't hold up the response) - ctx.waitUntil(pool.end()); - - // return the post as JSON - return new Response(JSON.stringify(post), { - headers: { 'content-type': 'application/json' } - }); + try { + // get and validate the `postId` query parameter + const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); + if (isNaN(postId)) return new Response('Bad request', { status: 400 }); + + // query and validate the post + const { rows: [post] } = await pool.query('SELECT * FROM posts WHERE id = $1', [postId]); + if (!post) return new Response('Not found', { status: 404 }); + + // return the post as JSON + return new Response(JSON.stringify(post), { + headers: { 'content-type': 'application/json' } + }); + + } finally { + // end the `Pool` inside the same request handler + // (unlike `await`, `ctx.waitUntil` won't hold up the response) + ctx.waitUntil(pool.end()); + } } export const config = { @@ -236,22 +234,25 @@ export default async (req: Request, ctx: any) => { const client = new Client(process.env.DATABASE_URL); await client.connect(); - // get and validate the `postId` query parameter - const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); - if (isNaN(postId)) return new Response('Bad request', { status: 400 }); - - // query and validate the post - const [post] = await client.query('SELECT * FROM posts WHERE id = $1', [postId]); - if (!post) return new Response('Not found', { status: 404 }); - - // end the `Client` inside the same request handler - // (unlike `await`, `ctx.waitUntil` won't hold up the response) - ctx.waitUntil(client.end()); - - // return the post as JSON - return new Response(JSON.stringify(post), { - headers: { 'content-type': 'application/json' } - }); + try { + // get and validate the `postId` query parameter + const postId = parseInt(new URL(req.url).searchParams.get('postId'), 10); + if (isNaN(postId)) return new Response('Bad request', { status: 400 }); + + // query and validate the post + const { rows: [post] } = await client.query('SELECT * FROM posts WHERE id = $1', [postId]); + if (!post) return new Response('Not found', { status: 404 }); + + // return the post as JSON + return new Response(JSON.stringify(post), { + headers: { 'content-type': 'application/json' } + }); + + } finally { + // end the `Client` inside the same request handler + // (unlike `await`, `ctx.waitUntil` won't hold up the response) + ctx.waitUntil(client.end()); + } } export const config = { diff --git a/dist/npm/index.js b/dist/npm/index.js index 889d230..148574c 100644 --- a/dist/npm/index.js +++ b/dist/npm/index.js @@ -1,28 +1,28 @@ -"use strict";var io=Object.create;var Te=Object.defineProperty;var so=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var ao=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty;var co=(r,e,t)=>e in r?Te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): -r[e]=t;var a=(r,e)=>Te(r,"name",{value:e,configurable:!0});var z=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),re=(r,e)=>{for(var t in e) +"use strict";var ro=Object.create;var Te=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var ao=(r,e,t)=>e in r?Te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): +r[e]=t;var a=(r,e)=>Te(r,"name",{value:e,configurable:!0});var te=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),re=(r,e)=>{for(var t in e) Te(r,t,{get:e[t],enumerable:!0})},Pn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== -"function")for(let i of oo(e))!uo.call(r,i)&&i!==t&&Te(r,i,{get:()=>e[i],enumerable:!(n= -so(e,i))||n.enumerable});return r};var Ie=(r,e,t)=>(t=r!=null?io(ao(r)):{},Pn(e||!r||!r.__esModule?Te(t,"default",{ -value:r,enumerable:!0}):t,r)),O=r=>Pn(Te({},"__esModule",{value:!0}),r);var _=(r,e,t)=>co(r,typeof e!="symbol"?e+"":e,t);var Rn=I(st=>{"use strict";p();st.byteLength=lo;st.toByteArray=po;st.fromByteArray= -go;var ue=[],ne=[],ho=typeof Uint8Array<"u"?Uint8Array:Array,Ft="ABCDEFGHIJKLMNO\ +"function")for(let i of io(e))!oo.call(r,i)&&i!==t&&Te(r,i,{get:()=>e[i],enumerable:!(n= +no(e,i))||n.enumerable});return r};var Ie=(r,e,t)=>(t=r!=null?ro(so(r)):{},Pn(e||!r||!r.__esModule?Te(t,"default",{ +value:r,enumerable:!0}):t,r)),O=r=>Pn(Te({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Rn=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= +yo;var ue=[],ne=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Ft="ABCDEFGHIJKLMNO\ PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_e=0,Bn=Ft.length;_e0)throw new Error("Invalid string. Length must be a multip\ le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Ln, -"getLens");function lo(r){var e=Ln(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(lo,"byte\ -Length");function fo(r,e,t){return(e+t)*3/4-t}a(fo,"_byteLength");function po(r){ -var e,t=Ln(r),n=t[0],i=t[1],s=new ho(fo(r,n,i)),o=0,u=i>0?n-4:n,c;for(c=0;c0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e= ne[r.charCodeAt(c)]<<2|ne[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=ne[r.charCodeAt( c)]<<10|ne[r.charCodeAt(c+1)]<<4|ne[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= -e&255),s}a(po,"toByteArray");function yo(r){return ue[r>>18&63]+ue[r>>12&63]+ue[r>> -6&63]+ue[r&63]}a(yo,"tripletToBase64");function mo(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ue[e>>2]+ +e&255),s}a(lo,"toByteArray");function fo(r){return ue[r>>18&63]+ue[r>>12&63]+ue[r>> +6&63]+ue[r&63]}a(fo,"tripletToBase64");function po(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ue[e>>2]+ ue[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ue[e>>10]+ue[e>>4&63]+ue[e<< -2&63]+"=")),i.join("")}a(go,"fromByteArray")});var Fn=I(Mt=>{p();Mt.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> +2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Fn=I(Mt=>{p();Mt.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> 1,l=-7,d=t?i-1:0,b=t?-1:1,C=r[e+d];for(d+=b,s=C&(1<<-l)-1,C>>=-l,l+=u;l>0;s=s*256+ r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== 0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? @@ -32,15 +32,15 @@ e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Mat floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=b/c:e+= b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( 2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=B,u/=256, -i-=8);for(o=o<0;r[t+C]=o&255,C+=B,o/=256,h-=8);r[t+C-B]|=Q*128}});var Yn=I(Re=>{"use strict";p();var Dt=Rn(),Be=Fn(),Mn=typeof Symbol=="function"&& +i-=8);for(o=o<0;r[t+C]=o&255,C+=B,o/=256,h-=8);r[t+C-B]|=Q*128}});var Yn=I(Re=>{"use strict";p();var kt=Rn(),Be=Fn(),Mn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Re.Buffer= -f;Re.SlowBuffer=vo;Re.INSPECT_MAX_BYTES=50;var ot=2147483647;Re.kMaxLength=ot;f. -TYPED_ARRAY_SUPPORT=wo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. +f;Re.SlowBuffer=xo;Re.INSPECT_MAX_BYTES=50;var ot=2147483647;Re.kMaxLength=ot;f. +TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ -rowser support.");function wo(){try{let r=new Uint8Array(1),e={foo:a(function(){ +rowser support.");function mo(){try{let r=new Uint8Array(1),e={foo:a(function(){ return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf( -r,e),r.foo()===42}catch{return!1}}a(wo,"typedArraySupport");Object.defineProperty( +r,e),r.foo()===42}catch{return!1}}a(mo,"typedArraySupport");Object.defineProperty( f.prototype,"parent",{enumerable:!0,get:a(function(){if(f.isBuffer(this))return this. buffer},"get")});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:a( function(){if(f.isBuffer(this))return this.byteOffset},"get")});function pe(r){if(r> @@ -48,14 +48,14 @@ ot)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e= r);return Object.setPrototypeOf(e,f.prototype),e}a(pe,"createBuffer");function f(r,e,t){ if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" a\ rgument must be of type string. Received type number');return Nt(r)}return On(r, -e,t)}a(f,"Buffer");f.poolSize=8192;function On(r,e,t){if(typeof r=="string")return So( -r,e);if(ArrayBuffer.isView(r))return xo(r);if(r==null)throw new TypeError("The f\ +e,t)}a(f,"Buffer");f.poolSize=8192;function On(r,e,t){if(typeof r=="string")return wo( +r,e);if(ArrayBuffer.isView(r))return bo(r);if(r==null)throw new TypeError("The f\ irst argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-l\ ike Object. Received type "+typeof r);if(ce(r,ArrayBuffer)||r&&ce(r.buffer,ArrayBuffer)|| typeof SharedArrayBuffer<"u"&&(ce(r,SharedArrayBuffer)||r&&ce(r.buffer,SharedArrayBuffer))) return Ut(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ must not be of type number. Received type number');let n=r.valueOf&&r.valueOf(); -if(n!=null&&n!==r)return f.from(n,e,t);let i=Eo(r);if(i)return i;if(typeof Symbol< +if(n!=null&&n!==r)return f.from(n,e,t);let i=So(r);if(i)return i;if(typeof Symbol< "u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return f. from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argumen\ t must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. \ @@ -63,27 +63,27 @@ Received type "+typeof r)}a(On,"from");f.from=function(r,e,t){return On(r,e,t)}; Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f, Uint8Array);function Nn(r){if(typeof r!="number")throw new TypeError('"size" arg\ ument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is\ - invalid for option "size"')}a(Nn,"assertSize");function bo(r,e,t){return Nn(r), -r<=0?pe(r):e!==void 0?typeof t=="string"?pe(r).fill(e,t):pe(r).fill(e):pe(r)}a(bo, -"alloc");f.alloc=function(r,e,t){return bo(r,e,t)};function Nt(r){return Nn(r),pe( + invalid for option "size"')}a(Nn,"assertSize");function go(r,e,t){return Nn(r), +r<=0?pe(r):e!==void 0?typeof t=="string"?pe(r).fill(e,t):pe(r).fill(e):pe(r)}a(go, +"alloc");f.alloc=function(r,e,t){return go(r,e,t)};function Nt(r){return Nn(r),pe( r<0?0:qt(r)|0)}a(Nt,"allocUnsafe");f.allocUnsafe=function(r){return Nt(r)};f.allocUnsafeSlow= -function(r){return Nt(r)};function So(r,e){if((typeof e!="string"||e==="")&&(e="\ +function(r){return Nt(r)};function wo(r,e){if((typeof e!="string"||e==="")&&(e="\ utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=qn(r,e)| -0,n=pe(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(So,"fromString");function kt(r){ +0,n=pe(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(wo,"fromString");function Dt(r){ let e=r.length<0?0:qt(r.length)|0,t=pe(e);for(let n=0;n= +return typeof r.length!="number"||Wt(r.length)?pe(0):Dt(r);if(r.type==="Buffer"&& +Array.isArray(r.data))return Dt(r.data)}a(So,"fromObject");function qt(r){if(r>= ot)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ -ot.toString(16)+" bytes");return r|0}a(qt,"checked");function vo(r){return+r!=r&& -(r=0),f.alloc(+r)}a(vo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. +ot.toString(16)+" bytes");return r|0}a(qt,"checked");function xo(r){return+r!=r&& +(r=0),f.alloc(+r)}a(xo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. _isBuffer===!0&&e!==f.prototype},"isBuffer");f.compare=a(function(e,t){if(ce(e,Uint8Array)&& (e=f.from(e,e.offset,e.byteLength)),ce(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)), !f.isBuffer(e)||!f.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments\ @@ -106,14 +106,14 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ot(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return zn(r).length;default:if(i)return n?-1:Ot(r).length;e=(""+e).toLowerCase(), -i=!0}}a(qn,"byteLength");f.byteLength=qn;function _o(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(qn,"byteLength");f.byteLength=qn;function Eo(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| -(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Mo( -this,e,t);case"utf8":case"utf-8":return jn(this,e,t);case"ascii":return Ro(this, -e,t);case"latin1":case"binary":return Fo(this,e,t);case"base64":return Bo(this,e, -t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Do(this,e,t);default: +(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( +this,e,t);case"utf8":case"utf-8":return Wn(this,e,t);case"ascii":return Bo(this, +e,t);case"latin1":case"binary":return Lo(this,e,t);case"base64":return Io(this,e, +t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -_o,"slowToString");f.prototype._isBuffer=!0;function Ae(r,e,t){let n=r[e];r[e]=r[t], +Eo,"slowToString");f.prototype._isBuffer=!0;function Ae(r,e,t){let n=r[e];r[e]=r[t], r[t]=n}a(Ae,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< e;t+=2)Ae(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. @@ -122,8 +122,8 @@ s");for(let t=0;t=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return let o=s-i,u=n-t,c=Math.min(o,u),h=this.slice(i,s),l=e.slice(t,n);for(let d=0;d2147483647?t=2147483647: -t<-2147483648&&(t=-2147483648),t=+t,jt(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t), +t<-2147483648&&(t=-2147483648),t=+t,Wt(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t), t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e== -"string"&&(e=f.from(e,n)),f.isBuffer(e))return e.length===0?-1:Dn(r,e,t,n,i);if(typeof e== +"string"&&(e=f.from(e,n)),f.isBuffer(e))return e.length===0?-1:kn(r,e,t,n,i);if(typeof e== "number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array. -prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Dn(r, +prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):kn(r, [e],t,n,i);throw new TypeError("val must be string, number or Buffer")}a(Qn,"bid\ -irectionalIndexOf");function Dn(r,e,t,n,i){let s=1,o=r.length,u=e.length;if(n!== +irectionalIndexOf");function kn(r,e,t,n,i){let s=1,o=r.length,u=e.length;if(n!== void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="\ utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,u/=2,t/=2}function c(l,d){ return s===1?l[d]:l.readUInt16BE(d*s)}a(c,"read");let h;if(i){let l=-1;for(h=t;h< o;h++)if(c(r,h)===c(e,l===-1?0:h-l)){if(l===-1&&(l=h),h-l+1===u)return l*s}else l!== -1&&(h-=h-l),l=-1}else for(t+u>o&&(t=o-u),h=t;h>=0;h--){let l=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n> -s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)? (n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.wri\ te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return Ao(this,e,t,n);case"utf8":case"utf-8":return Co(this,e,t,n);case"asc\ -ii":case"latin1":case"binary":return To(this,e,t,n);case"base64":return Io(this, -e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Po(this,e,t,n);default: +hex":return vo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ +ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, +e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ write");f.prototype.toJSON=a(function(){return{type:"Buffer",data:Array.prototype. -slice.call(this._arr||this,0)}},"toJSON");function Bo(r,e,t){return e===0&&t===r. -length?Dt.fromByteArray(r):Dt.fromByteArray(r.slice(e,t))}a(Bo,"base64Slice");function jn(r,e,t){ +slice.call(this._arr||this,0)}},"toJSON");function Io(r,e,t){return e===0&&t===r. +length?kt.fromByteArray(r):kt.fromByteArray(r.slice(e,t))}a(Io,"base64Slice");function Wn(r,e,t){ t=Math.min(r.length,t);let n=[],i=e;for(;i239?4:s>223? 3:s>191?2:1;if(i+u<=t){let c,h,l,d;switch(u){case 1:s<128&&(o=s);break;case 2:c= r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[i+ @@ -180,16 +180,16 @@ r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)=== 128&&(l&192)===128&&(d=(s&15)<<18|(c&63)<<12|(h&63)<<6|l&63,d>65535&&d<1114112&& (o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320| -o&1023),n.push(o),i+=u}return Lo(n)}a(jn,"utf8Slice");var kn=4096;function Lo(r){ -let e=r.length;if(e<=kn)return String.fromCharCode.apply(String,r);let t="",n=0; -for(;nn)&&(t=n);let i="";for(let s=e;sn)&&(t=n);let i="";for(let s=e;sn&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t>>0, t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ readUInt32BE");f.prototype.readBigUInt64LE=ge(a(function(e){e=e>>>0,Le(e,"offset"); -let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e,this.length-8);let i=t+ +let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Le(e,"offset");let t=this[e],n=this[e+7]; -(t===void 0||n===void 0)&&We(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* +(t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e],s=1,o=0;for(;++o>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ 1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=ge(a(function(e){ -e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e, +e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Le(e,"offset"); -let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e,this.length-8);let i=(t<< +let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,t||N(e,4,this.length),Be.read(this,e, @@ -241,52 +241,52 @@ readFloatLE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),Be.read(this,e, t||N(e,4,this.length),Be.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= a(function(e,t){return e=e>>>0,t||N(e,8,this.length),Be.read(this,e,!0,52,8)},"r\ eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||N(e,8,this. -length),Be.read(this,e,!1,52,8)},"readDoubleBE");function Y(r,e,t,n,i,s){if(!f.isBuffer( +length),Be.read(this,e,!1,52,8)},"readDoubleBE");function z(r,e,t,n,i,s){if(!f.isBuffer( r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e< s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError( -"Index out of range")}a(Y,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= -a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e, +"Index out of range")}a(z,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= +a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e, t,n,u,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e,t,n,u,0)}let s=n-1, +if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e,t,n,u,0)}let s=n-1, o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n},"writeUI\ ntBE");f.prototype.writeUint8=f.prototype.writeUInt8=a(function(e,t,n){return e= -+e,t=t>>>0,n||Y(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= -f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, ++e,t=t>>>0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= +f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, 65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},"writeUInt16LE");f.prototype.writeUint16BE= -f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, +f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, 65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},"writeUInt16BE");f.prototype.writeUint32LE= -f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,4, +f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,4, 4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+ 4},"writeUInt32LE");f.prototype.writeUint32BE=f.prototype.writeUInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, -this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function Wn(r,e,t,n,i){Kn( +return e=+e,t=t>>>0,n||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, +this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function jn(r,e,t,n,i){Kn( e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8, r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]= -o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Wn,"wrtBigUInt64LE");function Hn(r,e,t,n,i){ +o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(jn,"wrtBigUInt64LE");function Hn(r,e,t,n,i){ Kn(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> 8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+ 3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(Hn,"wrtBigUInt64BE");f. -prototype.writeBigUInt64LE=ge(a(function(e,t=0){return Wn(this,e,t,BigInt(0),BigInt( +prototype.writeBigUInt64LE=ge(a(function(e,t=0){return jn(this,e,t,BigInt(0),BigInt( "0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=ge(a(function(e,t=0){ return Hn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); f.prototype.writeIntLE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2, -8*n-1);Y(this,e,t,n,c-1,-c)}let s=0,o=1,u=0;for(this[t]=e&255;++s>0)-u&255;return t+n},"writeIntL\ E");f.prototype.writeIntBE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow( -2,8*n-1);Y(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= +2,8*n-1);z(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= 256);)e<0&&u===0&&this[t+s+1]!==0&&(u=1),this[t+s]=(e/o>>0)-u&255;return t+n},"w\ -riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this, +riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this, e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},"writeInt8");f.prototype.writeInt16LE= -a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e&255, +a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e&255, this[t+1]=e>>>8,t+2},"writeInt16LE");f.prototype.writeInt16BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, +return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, t+2},"writeInt16BE");f.prototype.writeInt32LE=a(function(e,t,n){return e=+e,t=t>>> -0,n||Y(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= +0,n||z(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= e>>>16,this[t+3]=e>>>24,t+4},"writeInt32LE");f.prototype.writeInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ +return e=+e,t=t>>>0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ 1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeIn\ -t32BE");f.prototype.writeBigInt64LE=ge(a(function(e,t=0){return Wn(this,e,t,-BigInt( +t32BE");f.prototype.writeBigInt64LE=ge(a(function(e,t=0){return jn(this,e,t,-BigInt( "0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));f.prototype. writeBigInt64BE=ge(a(function(e,t=0){return Hn(this,e,t,-BigInt("0x8000000000000\ 000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Gn(r,e,t,n,i,s){ @@ -331,18 +331,18 @@ isInteger(t)&&Math.abs(t)>2**32?i=Un(String(t)):typeof t=="bigint"&&(i=String(t) (t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Un(i)),i+="n"),n+=` It\ must be ${e}. Received ${i}`,n},RangeError);function Un(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(Un,"addNumericalSeparator");function ko(r,e,t){Le(e,"offset"),(r[e]=== -void 0||r[e+t]===void 0)&&We(e,r.length-(t+1))}a(ko,"checkBounds");function Kn(r,e,t,n,i,s){ +t)}${e}`}a(Un,"addNumericalSeparator");function Mo(r,e,t){Le(e,"offset"),(r[e]=== +void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function Kn(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Pe.ERR_OUT_OF_RANGE( -"value",u,r)}ko(n,i,s)}a(Kn,"checkIntBI");function Le(r,e){if(typeof r!="number") -throw new Pe.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Le,"validateNumber");function We(r,e,t){ +"value",u,r)}Mo(n,i,s)}a(Kn,"checkIntBI");function Le(r,e){if(typeof r!="number") +throw new Pe.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Le,"validateNumber");function je(r,e,t){ throw Math.floor(r)!==r?(Le(r,t),new Pe.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Pe.ERR_BUFFER_OUT_OF_BOUNDS:new Pe.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? -1:0} and <= ${e}`,r)}a(We,"boundsError");var Uo=/[^+/0-9A-Za-z-_]/g;function Oo(r){ -if(r=r.split("=")[0],r=r.trim().replace(Uo,""),r.length<2)return"";for(;r.length% -4!==0;)r=r+"=";return r}a(Oo,"base64clean");function Ot(r,e){e=e||1/0;let t,n=r. +1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ +if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% +4!==0;)r=r+"=";return r}a(Do,"base64clean");function Ot(r,e){e=e||1/0;let t,n=r. length,i=null,s=[];for(let o=0;o55295&&t<57344){if(!i){ if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&& s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, @@ -351,31 +351,31 @@ s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>> 6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63| 128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}a( -Ot,"utf8ToBytes");function No(r){let e=[];for(let t=0;t>8,i=t%256,s.push(i),s.push(n);return s} -a(qo,"utf16leToBytes");function zn(r){return Dt.toByteArray(Oo(r))}a(zn,"base64T\ +a(Oo,"utf16leToBytes");function zn(r){return kt.toByteArray(Do(r))}a(zn,"base64T\ oBytes");function at(r,e,t,n){let i;for(i=0;i=e.length||i>=r.length);++i) e[i+t]=r[i];return i}a(at,"blitBuffer");function ce(r,e){return r instanceof e|| r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name} -a(ce,"isInstance");function jt(r){return r!==r}a(jt,"numberIsNaN");var Qo=function(){ +a(ce,"isInstance");function Wt(r){return r!==r}a(Wt,"numberIsNaN");var No=function(){ let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< -16;++i)e[n+i]=r[t]+r[i]}return e}();function ge(r){return typeof BigInt>"u"?jo:r} -a(ge,"defineBigIntMethod");function jo(){throw new Error("BigInt not supported")} -a(jo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=z(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +16;++i)e[n+i]=r[t]+r[i]}return e}();function ge(r){return typeof BigInt>"u"?qo:r} +a(ge,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} +a(qo,"BufferBigIntNotDefined")});var S,x,v,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. Buffer.allocUnsafe=="function"?globalThis.Buffer:Yn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= -e.then.bind(e)}});var we=I((ih,Wt)=>{"use strict";p();var Fe=typeof Reflect=="object"?Reflect:null, +e.then.bind(e)}});var we=I((rh,jt)=>{"use strict";p();var Fe=typeof Reflect=="object"?Reflect:null, Zn=Fe&&typeof Fe.apply=="function"?Fe.apply:a(function(e,t,n){return Function.prototype. apply.call(e,t,n)},"ReflectApply"),ut;Fe&&typeof Fe.ownKeys=="function"?ut=Fe.ownKeys: Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. -getOwnPropertyNames(e)},"ReflectOwnKeys");function Wo(r){console&&console.warn&& -console.warn(r)}a(Wo,"ProcessEmitWarning");var Xn=Number.isNaN||a(function(e){return e!== -e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");Wt.exports= -L;Wt.exports.once=Vo;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= +getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& +console.warn(r)}a(Qo,"ProcessEmitWarning");var Xn=Number.isNaN||a(function(e){return e!== +e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");jt.exports= +L;jt.exports.once=Go;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= 0;L.prototype._maxListeners=void 0;var Jn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(L,"defaultMaxLi\ @@ -402,14 +402,14 @@ t,++r._eventsCount;else if(typeof o=="function"?o=s[e]=n?[t,o]:[o,t]:n?o.unshift t):o.push(t),i=ei(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po\ ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ -ededWarning",u.emitter=r,u.type=e,u.count=o.length,Wo(u)}return r}a(ti,"_addList\ +ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(ti,"_addList\ ener");L.prototype.addListener=a(function(e,t){return ti(this,e,t,!1)},"addListe\ ner");L.prototype.on=L.prototype.addListener;L.prototype.prependListener=a(function(e,t){ -return ti(this,e,t,!0)},"prependListener");function Ho(){if(!this.fired)return this. +return ti(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? -this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Ho, +this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, "onceWrapper");function ri(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Ho.bind(n);return i.listener=t,n.wrapFn=i,i}a(ri,"_onceWrap");L.prototype. +listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ri,"_onceWrap");L.prototype. once=a(function(e,t){return ct(t),this.on(e,ri(this,e,t)),this},"once");L.prototype. prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ri(this, e,t)),this},"prependOnceListener");L.prototype.removeListener=a(function(e,t){var n, @@ -417,7 +417,7 @@ i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)retu if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. -listener,s=o;break}if(s<0)return this;s===0?n.shift():Go(n,s),n.length===1&&(i[e]= +listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, "removeListener");L.prototype.off=L.prototype.removeListener;L.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== @@ -429,7 +429,7 @@ o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners( n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length- 1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ni(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?$o(i):si(i,i.length)}a(ni,"_listeners");L.prototype. +"function"?t?[i.listener||i]:[i]:t?Ho(i):si(i,i.length)}a(ni,"_listeners");L.prototype. listeners=a(function(e){return ni(this,e,!0)},"listeners");L.prototype.rawListeners= a(function(e){return ni(this,e,!1)},"rawListeners");L.listenerCount=function(r,e){ return typeof r.listenerCount=="function"?r.listenerCount(e):ii.call(r,e)};L.prototype. @@ -437,49 +437,62 @@ listenerCount=ii;function ii(r){var e=this._events;if(e!==void 0){var t=e[r];if( "function")return 1;if(t!==void 0)return t.length}return 0}a(ii,"listenerCount"); L.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): []},"eventNames");function si(r,e){for(var t=new Array(e),n=0;nzo});var zo,Ge=z(()=>{"use strict";p();zo={}});function $e(r){let e=1779033703,t=3144134277,n=1013904242,i=2773480762,s=1359893119, -o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,3049323471, -3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278, -1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078, -604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808, -3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372, -1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800, -3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, -883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, -2361852424,2428436474,2756734187,3204031479,3329325298],b=a((A,g)=>A>>>g|A<<32-g, -"rrot"),C=new Uint32Array(64),B=new Uint8Array(64),Q=a(()=>{for(let R=0,$=0;R<16;R++, -$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+3];for(let R=16;R<64;R++){let $=b(C[R- -15],7)^b(C[R-15],18)^C[R-15]>>>3,le=b(C[R-2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R- -16]+$+C[R-7]+le|0}let A=e,g=t,P=n,K=i,k=s,j=o,ee=u,ae=c;for(let R=0;R<64;R++){let $=b( -k,6)^b(k,11)^b(k,25),le=k&j^~k&ee,me=ae+$+le+d[R]+C[R]|0,Ee=b(A,2)^b(A,13)^b(A,22), -je=A&g^A&P^g&P,fe=Ee+je|0;ae=ee,ee=j,j=k,k=K+me|0,K=P,P=g,g=A,A=me+fe|0}e=e+A|0, -t=t+g|0,n=n+P|0,i=i+K|0,s=s+k|0,o=o+j|0,u=u+ee|0,c=c+ae|0,l=0},"process"),X=a(A=>{ -typeof A=="string"&&(A=new TextEncoder().encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){ -for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]=0;let A=h*8;B[l++]=A/1099511627776&255, -B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]=A>>>16&255,B[l++]=A>>>8&255,B[l++]= -A&255,Q();let g=new Uint8Array(32);return g[0]=e>>>24,g[1]=e>>>16&255,g[2]=e>>>8& -255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]=t>>>8&255,g[7]=t&255,g[8]=n>>>24, -g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]=i>>>24,g[13]=i>>>16&255,g[14]= -i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, -g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> -16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, -g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:ye}:(X(r),ye())}var ai=z( -()=>{"use strict";p();a($e,"sha256")});var U,Ve,ui=z(()=>{"use strict";p();U=class U{constructor(){_(this,"_dataLength", -0);_(this,"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer", -new ArrayBuffer(68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array( -this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ +ed type '+typeof r)}a(oi,"eventTargetAgnosticAddListener")});var He={};re(He,{default:()=>Vo});var Vo,Ge=te(()=>{"use strict";p();Vo={}});var Ht={};re(Ht,{Md5:()=>Ve,createHash:()=>zo,createHmac:()=>Yo,randomBytes:()=>Ko, +sha256:()=>$e});function Ko(r){return w.getRandomValues(y.alloc(r))}function zo(r){ +if(r==="sha256")return{update:a(function(e){return{digest:a(function(){return y. +from($e(e))},"digest")}},"update")};if(r==="md5")return{update:a(function(e){return{ +digest:a(function(){return typeof e=="string"?Ve.hashStr(e):Ve.hashByteArray(e)}, +"digest")}},"update")};throw new Error(`Hash type '${r}' not supported`)}function Yo(r,e){ +if(r!=="sha256")throw new Error(`Only sha256 is supported (requested: '${r}')`); +return{update:a(function(t){return{digest:a(function(){typeof e=="string"&&(e=new TextEncoder(). +encode(e)),typeof t=="string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n> +64)e=$e(e);else if(n<64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array( +64),s=new Uint8Array(64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array( +t.length+64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u. +set($e(o),64),y.from($e(u))},"digest")}},"update")}}function $e(r){let e=1779033703, +t=3144134277,n=1013904242,i=2773480762,s=1359893119,o=2600822924,u=528734635,c=1541459225, +h=0,l=0,d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748, +2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103, +3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692, +1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993, +338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, +2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909, +275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063, +1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479, +3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),B=new Uint8Array( +64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+ +3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,le=b(C[R- +2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+le|0}let A=e,g=t,P=n,K=i,D=s, +W=o,X=u,ae=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),le=D&W^~D&X,me=ae+ +$+le+d[R]+C[R]|0,Ee=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,fe=Ee+We|0;ae=X,X=W,W= +D,D=K+me|0,K=P,P=g,g=A,A=me+fe|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, +u=u+X|0,c=c+ae|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). +encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]= +0;let A=h*8;B[l++]=A/1099511627776&255,B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]= +A>>>16&255,B[l++]=A>>>8&255,B[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= +e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= +t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= +i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, +g[18]=s>>>8&255,g[19]=s&255,g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]= +o&255,g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]= +c>>>16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r===void 0?{add:J,digest:ye}: +(J(r),ye())}var U,Ve,Gt=te(()=>{"use strict";p();a(Ko,"randomBytes");a(zo,"creat\ +eHash");a(Yo,"createHmac");U=class U{constructor(){_(this,"_dataLength",0);_(this, +"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer",new ArrayBuffer( +68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array(this._buffer, +0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=U. @@ -553,21 +566,8 @@ u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return U._md5cycle(this._state,i e?this._state:U._hex(this._state)}};a(U,"Md5"),_(U,"stateIdentity",new Int32Array( [1732584193,-271733879,-1732584194,271733878])),_(U,"buffer32Identity",new Int32Array( [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(U,"hexChars","0123456789abcdef"),_(U,"hexO\ -ut",[]),_(U,"onePassHasher",new U);Ve=U});var Ht={};re(Ht,{createHash:()=>Zo,createHmac:()=>Jo,randomBytes:()=>Yo});function Yo(r){ -return w.getRandomValues(y.alloc(r))}function Zo(r){if(r==="sha256")return{update:a( -function(e){return{digest:a(function(){return y.from($e(e))},"digest")}},"update")}; -if(r==="md5")return{update:a(function(e){return{digest:a(function(){return typeof e== -"string"?Ve.hashStr(e):Ve.hashByteArray(e)},"digest")}},"update")};throw new Error( -`Hash type '${r}' not supported`)}function Jo(r,e){if(r!=="sha256")throw new Error( -`Only sha256 is supported (requested: '${r}')`);return{update:a(function(t){return{ -digest:a(function(){typeof e=="string"&&(e=new TextEncoder().encode(e)),typeof t== -"string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n>64)e=$e(e);else if(n< -64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array(64),s=new Uint8Array( -64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array(t.length+ -64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u.set($e(o), -64),y.from($e(u))},"digest")}},"update")}}var Gt=z(()=>{"use strict";p();ai();ui(); -a(Yo,"randomBytes");a(Zo,"createHash");a(Jo,"createHmac")});var Vt=I(ci=>{"use strict";p();ci.parse=function(r,e){return new $t(r,e).parse()}; -var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Xo,this.position= +ut",[]),_(U,"onePassHasher",new U);Ve=U;a($e,"sha256")});var Vt=I(ai=>{"use strict";p();ai.parse=function(r,e){return new $t(r,e).parse()}; +var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Zo,this.position= 0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>= this.source.length}nextCharacter(){var e=this.source[this.position++];return e=== "\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){ @@ -581,97 +581,97 @@ n.parse(!0)),this.position+=n.position-2);else if(t.value==="}"&&!i){if(this.dim !this.dimension&&(this.newEntry(),e))return this.entries}else t.value==='"'&&!t. escaped?(i&&this.newEntry(!0),i=!i):t.value===","&&!i?this.newEntry():this.record( t.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this. -entries}};a(ht,"ArrayParser");var $t=ht;function Xo(r){return r}a(Xo,"identity")});var Kt=I((xh,hi)=>{p();var ea=Vt();hi.exports={create:a(function(r,e){return{parse:a( -function(){return ea.parse(r,e)},"parse")}},"create")}});var pi=I((_h,fi)=>{"use strict";p();var ta=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, -ra=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,na=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ia=/^-?infinity$/; -fi.exports=a(function(e){if(ia.test(e))return Number(e.replace("i","I"));var t=ta. -exec(e);if(!t)return sa(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=li(i));var s=parseInt( +entries}};a(ht,"ArrayParser");var $t=ht;function Zo(r){return r}a(Zo,"identity")});var Kt=I((lh,ui)=>{p();var Jo=Vt();ui.exports={create:a(function(r,e){return{parse:a( +function(){return Jo.parse(r,e)},"parse")}},"create")}});var li=I((dh,hi)=>{"use strict";p();var Xo=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, +ea=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ta=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ra=/^-?infinity$/; +hi.exports=a(function(e){if(ra.test(e))return Number(e.replace("i","I"));var t=Xo. +exec(e);if(!t)return na(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=ci(i));var s=parseInt( t[2],10)-1,o=t[3],u=parseInt(t[4],10),c=parseInt(t[5],10),h=parseInt(t[6],10),l=t[7]; -l=l?1e3*parseFloat(l):0;var d,b=oa(e);return b!=null?(d=new Date(Date.UTC(i,s,o, +l=l?1e3*parseFloat(l):0;var d,b=ia(e);return b!=null?(d=new Date(Date.UTC(i,s,o, u,c,h,l)),zt(i)&&d.setUTCFullYear(i),b!==0&&d.setTime(d.getTime()-b)):(d=new Date( -i,s,o,u,c,h,l),zt(i)&&d.setFullYear(i)),d},"parseDate");function sa(r){var e=ra. -exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=li(t));var i=parseInt(e[2], -10)-1,s=e[3],o=new Date(t,i,s);return zt(t)&&o.setFullYear(t),o}}a(sa,"getDate"); -function oa(r){if(r.endsWith("+00"))return 0;var e=na.exec(r.split(" ")[1]);if(e){ +i,s,o,u,c,h,l),zt(i)&&d.setFullYear(i)),d},"parseDate");function na(r){var e=ea. +exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=ci(t));var i=parseInt(e[2], +10)-1,s=e[3],o=new Date(t,i,s);return zt(t)&&o.setFullYear(t),o}}a(na,"getDate"); +function ia(r){if(r.endsWith("+00"))return 0;var e=ta.exec(r.split(" ")[1]);if(e){ var t=e[1];if(t==="Z")return 0;var n=t==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt( -e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(oa,"timeZoneOffset");function li(r){ -return-(r-1)}a(li,"bcYearToNegativeYear");function zt(r){return r>=0&&r<100}a(zt, -"is0To99")});var yi=I((Th,di)=>{p();di.exports=ua;var aa=Object.prototype.hasOwnProperty;function ua(r){ -for(var e=1;e{"use strict";p();var ca=yi();gi.exports=Me;function Me(r){if(!(this instanceof -Me))return new Me(r);ca(this,xa(r))}a(Me,"PostgresInterval");var ha=["seconds","\ -minutes","hours","days","months","years"];Me.prototype.toPostgres=function(){var r=ha. +e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(ia,"timeZoneOffset");function ci(r){ +return-(r-1)}a(ci,"bcYearToNegativeYear");function zt(r){return r>=0&&r<100}a(zt, +"is0To99")});var pi=I((gh,fi)=>{p();fi.exports=oa;var sa=Object.prototype.hasOwnProperty;function oa(r){ +for(var e=1;e{"use strict";p();var aa=pi();yi.exports=Me;function Me(r){if(!(this instanceof +Me))return new Me(r);aa(this,ba(r))}a(Me,"PostgresInterval");var ua=["seconds","\ +minutes","hours","days","months","years"];Me.prototype.toPostgres=function(){var r=ua. filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")< 0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e=== "seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/, -"")),t+" "+e},this).join(" ")};var la={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ -M",seconds:"S"},fa=["years","months","days"],pa=["hours","minutes","seconds"];Me. -prototype.toISOString=Me.prototype.toISO=function(){var r=fa.map(t,this).join(""), -e=pa.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== +"")),t+" "+e},this).join(" ")};var ca={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ +M",seconds:"S"},ha=["years","months","days"],la=["hours","minutes","seconds"];Me. +prototype.toISOString=Me.prototype.toISO=function(){var r=ha.map(t,this).join(""), +e=la.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== "seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/, -"")),i+la[n]}};var Yt="([+-]?\\d+)",da=Yt+"\\s+years?",ya=Yt+"\\s+mons?",ma=Yt+"\ -\\s+days?",ga="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",wa=new RegExp([ -da,ya,ma,ga].map(function(r){return"("+r+")?"}).join("\\s*")),mi={years:2,months:4, -days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ba=["hours","minutes","sec\ -onds","milliseconds"];function Sa(r){var e=r+"000000".slice(r.length);return parseInt( -e,10)/1e3}a(Sa,"parseMilliseconds");function xa(r){if(!r)return{};var e=wa.exec( -r),t=e[8]==="-";return Object.keys(mi).reduce(function(n,i){var s=mi[i],o=e[s];return!o|| -(o=i==="milliseconds"?Sa(o):parseInt(o,10),!o)||(t&&~ba.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(xa,"parse")});var Si=I((Fh,bi)=>{"use strict";p();bi.exports=a(function(e){if(/^\\x/.test(e))return new y( +"")),i+ca[n]}};var Yt="([+-]?\\d+)",fa=Yt+"\\s+years?",pa=Yt+"\\s+mons?",da=Yt+"\ +\\s+days?",ya="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",ma=new RegExp([ +fa,pa,da,ya].map(function(r){return"("+r+")?"}).join("\\s*")),di={years:2,months:4, +days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ga=["hours","minutes","sec\ +onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return parseInt( +e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( +r),t=e[8]==="-";return Object.keys(di).reduce(function(n,i){var s=di[i],o=e[s];return!o|| +(o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= +o),n},{})}a(ba,"parse")});var wi=I((vh,gi)=>{"use strict";p();gi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=Vt(),ze=Kt(),lt=pi(),Ei=wi(),vi=Si();function ft(r){ -return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function _i(r){ +"\\";n+=Math.floor(i/2)*2}return new y(t,"binary")},"parseBytea")});var Ai=I((Ch,_i)=>{p();var Ke=Vt(),ze=Kt(),lt=li(),Si=mi(),xi=wi();function ft(r){ +return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Ei(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| -r==="1"}a(_i,"parseBool");function Ea(r){return r?Ke.parse(r,_i):null}a(Ea,"pars\ -eBoolArray");function va(r){return parseInt(r,10)}a(va,"parseBaseTenInt");function Zt(r){ -return r?Ke.parse(r,ft(va)):null}a(Zt,"parseIntegerArray");function _a(r){return r? -Ke.parse(r,ft(function(e){return Ai(e).trim()})):null}a(_a,"parseBigIntegerArray"); -var Aa=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +r==="1"}a(Ei,"parseBool");function Sa(r){return r?Ke.parse(r,Ei):null}a(Sa,"pars\ +eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Zt(r){ +return r?Ke.parse(r,ft(xa)):null}a(Zt,"parseIntegerArray");function Ea(r){return r? +Ke.parse(r,ft(function(e){return vi(e).trim()})):null}a(Ea,"parseBigIntegerArray"); +var va=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=tr(t)),t});return e.parse()},"parsePointArray"),Jt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); return e.parse()},"parseFloatArray"),ie=a(function(r){if(!r)return null;var e=ze. create(r);return e.parse()},"parseStringArray"),Xt=a(function(r){if(!r)return null; var e=ze.create(r,function(t){return t!==null&&(t=lt(t)),t});return e.parse()},"\ -parseDateArray"),Ca=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ -return t!==null&&(t=Ei(t)),t});return e.parse()},"parseIntervalArray"),Ta=a(function(r){ -return r?Ke.parse(r,ft(vi)):null},"parseByteAArray"),er=a(function(r){return parseInt( -r,10)},"parseInteger"),Ai=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: -r},"parseBigInteger"),xi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, +parseDateArray"),_a=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ +return t!==null&&(t=Si(t)),t});return e.parse()},"parseIntervalArray"),Aa=a(function(r){ +return r?Ke.parse(r,ft(xi)):null},"parseByteAArray"),er=a(function(r){return parseInt( +r,10)},"parseInteger"),vi=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: +r},"parseBigInteger"),bi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, "parseJsonArray"),tr=a(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- -1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ia=a(function(r){ +1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ca=a(function(r){ if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i{"use strict";p();var Z=1e6;function Ba(r){var e=r.readInt32BE( +Xt),r(1185,Xt),r(1186,Si),r(1187,_a),r(17,xi),r(114,JSON.parse.bind(JSON)),r(3802, +JSON.parse.bind(JSON)),r(199,bi),r(3807,bi),r(3907,ie),r(2951,ie),r(791,ie),r(1183, +ie),r(1270,ie)},"init");_i.exports={init:Ta}});var Ti=I((Ph,Ci)=>{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,o,u, -c,h,l;{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+ -u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* -s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< -h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), +c,h,l;{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+ +u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* +s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< +h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var La=Pi(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ +e%Y,o=4294967296*s+t,u=""+o%Y,n+u+i}a(Ia,"readInt8");Ci.exports=Ia});var Ri=I((Rh,Li)=>{p();var Pa=Ti(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ return C*Math.pow(2,Q)+B};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& -(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Ri=a(function(r,e,t){var n=Math.pow(2,t- +(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Bi=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= 1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ra=a(function(r){return F(r,1)==1?-1* -(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Bi=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Fa=a(function(r){return Ri(r,23,8)},"pars\ -eFloat32"),Ma=a(function(r){return Ri(r,52,11)},"parseFloat64"),Da=a(function(r){ +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ba=a(function(r){return F(r,1)==1?-1* +(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ii=a(function(r){return F(r,1)==1?-1*(F( +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),La=a(function(r){return Bi(r,23,8)},"pars\ +eFloat32"),Ra=a(function(r){return Bi(r,52,11)},"parseFloat64"),Fa=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o>3,(i+=l<<3)>>3 d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ var d=[],b;if(h.length>1){var C=h.shift();for(b=0;b0},"parseBool"),Oa=a(function(r){r(20,La),r(21,Ra),r(23,Bi),r(26, -Bi),r(1700,Da),r(700,Fa),r(701,Ma),r(16,Ua),r(1114,Li.bind(null,!1)),r(1184,Li.bind( -null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,ka)},"init"); -Fi.exports={init:Oa}});var ki=I((Gh,Di)=>{p();Di.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +ay"),Ma=a(function(r){return r.toString("utf8")},"parseText"),ka=a(function(r){return r=== +null?null:F(r,8)>0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,Ba),r(23,Ii),r(26, +Ii),r(1700,Fa),r(700,La),r(701,Ra),r(16,ka),r(1114,Pi.bind(null,!1)),r(1184,Pi.bind( +null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); +Li.exports={init:Da}});var Mi=I((kh,Fi)=>{p();Fi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -694,157 +694,157 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Na=Ti(),qa=Mi(),Qa=Kt(),ja=ki();Je.getTypeParser=Wa;Je.setTypeParser= -Ha;Je.arrayParser=Qa;Je.builtins=ja;var Ze={text:{},binary:{}};function Ui(r){return String( -r)}a(Ui,"noParse");function Wa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Ui}a(Wa, -"getTypeParser");function Ha(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= -t}a(Ha,"setTypeParser");Na.init(function(r,e){Ze.text[r]=e});qa.init(function(r,e){ -Ze.binary[r]=e})});var et=I((Yh,rr)=>{"use strict";p();rr.exports={host:"localhost",user:m.platform=== +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=Ai(),Oa=Ri(),Na=Kt(),qa=Mi();Je.getTypeParser=Qa;Je.setTypeParser= +Wa;Je.arrayParser=Na;Je.builtins=qa;var Ze={text:{},binary:{}};function ki(r){return String( +r)}a(ki,"noParse");function Qa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||ki}a(Qa, +"getTypeParser");function Wa(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= +t}a(Wa,"setTypeParser");Ua.init(function(r,e){Ze.text[r]=e});Oa.init(function(r,e){ +Ze.binary[r]=e})});var et=I((qh,rr)=>{"use strict";p();rr.exports={host:"localhost",user:m.platform=== "win32"?m.env.USERNAME:m.env.USER,database:void 0,password:null,connectionString:void 0, port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1, application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1, statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1, -connect_timeout:0,keepalives:1,keepalives_idle:0};var De=Xe(),Ga=De.getTypeParser( -20,"text"),$a=De.getTypeParser(1016,"text");rr.exports.__defineSetter__("parseIn\ -t8",function(r){De.setTypeParser(20,"text",r?De.getTypeParser(23,"text"):Ga),De. -setTypeParser(1016,"text",r?De.getTypeParser(1007,"text"):$a)})});var tt=I((Jh,Ni)=>{"use strict";p();var Va=(Gt(),O(Ht)),Ka=et();function za(r){var e=r. -replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(za,"escapeElement"); -function Oi(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> -"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Oi(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. -toString("hex"):e+=za(pt(r[t]));return e=e+"}",e}a(Oi,"arrayString");var pt=a(function(r,e){ +connect_timeout:0,keepalives:1,keepalives_idle:0};var ke=Xe(),ja=ke.getTypeParser( +20,"text"),Ha=ke.getTypeParser(1016,"text");rr.exports.__defineSetter__("parseIn\ +t8",function(r){ke.setTypeParser(20,"text",r?ke.getTypeParser(23,"text"):ja),ke. +setTypeParser(1016,"text",r?ke.getTypeParser(1007,"text"):Ha)})});var tt=I((Wh,Ui)=>{"use strict";p();var Ga=(Gt(),O(Ht)),$a=et();function Va(r){var e=r. +replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Va,"escapeElement"); +function Di(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> +"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Di(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. +toString("hex"):e+=Va(pt(r[t]));return e=e+"}",e}a(Di,"arrayString");var pt=a(function(r,e){ if(r==null)return null;if(r instanceof y)return r;if(ArrayBuffer.isView(r)){var t=y. from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice( -r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?Ka.parseInputDatesAsUTC? -Ja(r):Za(r):Array.isArray(r)?Oi(r):typeof r=="object"?Ya(r,e):r.toString()},"pre\ -pareValue");function Ya(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. +r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?$a.parseInputDatesAsUTC? +Ya(r):za(r):Array.isArray(r)?Di(r):typeof r=="object"?Ka(r,e):r.toString()},"pre\ +pareValue");function Ka(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+ r+'" for query');return e.push(r),pt(r.toPostgres(pt),e)}return JSON.stringify(r)} -a(Ya,"prepareObject");function G(r,e){for(r=""+r;r.length{"use strict";p();var ir=(Gt(),O(Ht));function tu(r){if(r.indexOf( +G(r.getUTCMilliseconds(),3);return n+="+00:00",t&&(n+=" BC"),n}a(Ya,"dateToStrin\ +gUTC");function Za(r,e,t){return r=typeof r=="string"?{text:r}:r,e&&(typeof e=="\ +function"?r.callback=e:r.values=e),t&&(r.callback=t),r}a(Za,"normalizeQueryConfi\ +g");var nr=a(function(r){return Ga.createHash("md5").update(r,"utf-8").digest("h\ +ex")},"md5"),Ja=a(function(r,e,t){var n=nr(e+r),i=nr(y.concat([y.from(n),t]));return"\ +md5"+i},"postgresMd5PasswordHash");Ui.exports={prepareValue:a(function(e){return pt( +e)},"prepareValueWrapper"),normalizeQueryConfig:Za,postgresMd5PasswordHash:Ja,md5:nr}});var Wi=I((Gh,Qi)=>{"use strict";p();var ir=(Gt(),O(Ht));function Xa(r){if(r.indexOf( "SCRAM-SHA-256")===-1)throw new Error("SASL: Only mechanism SCRAM-SHA-256 is cur\ rently supported");let e=ir.randomBytes(18).toString("base64");return{mechanism:"\ SCRAM-SHA-256",clientNonce:e,response:"n,,n=*,r="+e,message:"SASLInitialResponse"}} -a(tu,"startSession");function ru(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( +a(Xa,"startSession");function eu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( "SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(typeof t!= "string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a\ - string");let n=su(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== + string");let n=nu(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n\ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ -er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=uu(e, -i,n.iteration),o=ke(s,"Client Key"),u=au(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=ke(u,d),C=ji( -o,b),B=C.toString("base64"),Q=ke(s,"Server Key"),X=ke(Q,d);r.message="SASLRespon\ -se",r.serverSignature=X.toString("base64"),r.response=l+",p="+B}a(ru,"continueSe\ -ssion");function nu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ +er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, +i,n.iteration),o=De(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=De(u,d),C=qi( +o,b),B=C.toString("base64"),Q=De(s,"Server Key"),J=De(Q,d);r.message="SASLRespon\ +se",r.serverSignature=J.toString("base64"),r.response=l+",p="+B}a(eu,"continueSe\ +ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ -CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=ou( +CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: s\ -erver signature does not match")}a(nu,"finalizeSession");function iu(r){if(typeof r!= +erver signature does not match")}a(tu,"finalizeSession");function ru(r){if(typeof r!= "string")throw new TypeError("SASL: text must be a string");return r.split("").map( -(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(iu,"isPrintableC\ -hars");function qi(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(r)}a(qi,"isBase64");function Qi(r){if(typeof r!="string")throw new TypeError( +(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(ru,"isPrintableC\ +hars");function Oi(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(r)}a(Oi,"isBase64");function Ni(r){if(typeof r!="string")throw new TypeError( "SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{ if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0], -n=e.substring(2);return[t,n]}))}a(Qi,"parseAttributePairs");function su(r){let e=Qi( -r),t=e.get("r");if(t){if(!iu(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ +n=e.substring(2);return[t,n]}))}a(Ni,"parseAttributePairs");function nu(r){let e=Ni( +r),t=e.get("r");if(t){if(!ru(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ E: nonce must only contain printable characters")}else throw new Error("SASL: SC\ -RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!qi(n))throw new Error( +RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Oi(n))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("S\ ASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/. test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration cou\ nt")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); -let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(su,"parseServerFirstMe\ -ssage");function ou(r){let t=Qi(r).get("v");if(t){if(!qi(t))throw new Error("SAS\ +let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(nu,"parseServerFirstMe\ +ssage");function iu(r){let t=Ni(r).get("v");if(t){if(!Oi(t))throw new Error("SAS\ L: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error( "SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}} -a(ou,"parseServerFinalMessage");function ji(r,e){if(!y.isBuffer(r))throw new TypeError( +a(iu,"parseServerFinalMessage");function qi(r,e){if(!y.isBuffer(r))throw new TypeError( "first argument must be a Buffer");if(!y.isBuffer(e))throw new TypeError("second\ argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer leng\ ths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return y. -from(r.map((t,n)=>r[n]^e[n]))}a(ji,"xorBuffers");function au(r){return ir.createHash( -"sha256").update(r).digest()}a(au,"sha256");function ke(r,e){return ir.createHmac( -"sha256",r).update(e).digest()}a(ke,"hmacSha256");function uu(r,e,t){for(var n=ke( -r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;scu});function cu(...r){return r.join("/")}var or=z(()=>{ -"use strict";p();a(cu,"join")});var ar={};re(ar,{stat:()=>hu});function hu(r,e){e(new Error("No filesystem"))}var ur=z( -()=>{"use strict";p();a(hu,"stat")});var cr={};re(cr,{default:()=>lu});var lu,hr=z(()=>{"use strict";p();lu={}});var Gi={};re(Gi,{StringDecoder:()=>lr});var fr,lr,$i=z(()=>{"use strict";p();fr= +from(r.map((t,n)=>r[n]^e[n]))}a(qi,"xorBuffers");function su(r){return ir.createHash( +"sha256").update(r).digest()}a(su,"sha256");function De(r,e){return ir.createHmac( +"sha256",r).update(e).digest()}a(De,"hmacSha256");function ou(r,e,t){for(var n=De( +r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;sau});function au(...r){return r.join("/")}var or=te(()=>{ +"use strict";p();a(au,"join")});var ar={};re(ar,{stat:()=>uu});function uu(r,e){e(new Error("No filesystem"))}var ur=te( +()=>{"use strict";p();a(uu,"stat")});var cr={};re(cr,{default:()=>cu});var cu,hr=te(()=>{"use strict";p();cu={}});var ji={};re(ji,{StringDecoder:()=>lr});var fr,lr,Hi=te(()=>{"use strict";p();fr= class fr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(fr,"StringDecoder"); -lr=fr});var Yi=I((ll,zi)=>{"use strict";p();var{Transform:fu}=(hr(),O(cr)),{StringDecoder:pu}=($i(),O(Gi)), -be=Symbol("last"),dt=Symbol("decoder");function du(r,e,t){let n;if(this.overflow){ +lr=fr});var Ki=I((tl,Vi)=>{"use strict";p();var{Transform:hu}=(hr(),O(cr)),{StringDecoder:lu}=(Hi(),O(ji)), +be=Symbol("last"),dt=Symbol("decoder");function fu(r,e,t){let n;if(this.overflow){ if(n=this[dt].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. overflow=!1}else this[be]+=this[dt].write(r),n=this[be].split(this.matcher);this[be]= -n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ -t(new Error("maximum buffer reached"));return}t()}a(du,"transform");function yu(r){ -if(this[be]+=this[dt].end(),this[be])try{Ki(this,this.mapper(this[be]))}catch(e){ -return r(e)}r()}a(yu,"flush");function Ki(r,e){e!==void 0&&r.push(e)}a(Ki,"push"); -function Vi(r){return r}a(Vi,"noop");function mu(r,e,t){switch(r=r||/\r?\n/,e=e|| -Vi,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== +t(new Error("maximum buffer reached"));return}t()}a(fu,"transform");function pu(r){ +if(this[be]+=this[dt].end(),this[be])try{$i(this,this.mapper(this[be]))}catch(e){ +return r(e)}r()}a(pu,"flush");function $i(r,e){e!==void 0&&r.push(e)}a($i,"push"); +function Gi(r){return r}a(Gi,"noop");function du(r,e,t){switch(r=r||/\r?\n/,e=e|| +Gi,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== "object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2: -typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Vi)}t=Object. -assign({},t),t.autoDestroy=!0,t.transform=du,t.flush=yu,t.readableObjectMode=!0; -let n=new fu(t);return n[be]="",n[dt]=new pu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= +typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Gi)}t=Object. +assign({},t),t.autoDestroy=!0,t.transform=fu,t.flush=pu,t.readableObjectMode=!0; +let n=new hu(t);return n[be]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ -this._writableState.errorEmitted=!1,s(i)},n}a(mu,"split");zi.exports=mu});var Xi=I((dl,de)=>{"use strict";p();var Zi=(or(),O(sr)),gu=(hr(),O(cr)).Stream,wu=Yi(), -Ji=(Ge(),O(He)),bu=5432,yt=m.platform==="win32",rt=m.stderr,Su=56,xu=7,Eu=61440, -vu=32768;function _u(r){return(r&Eu)==vu}a(_u,"isRegFile");var Ue=["host","port", -"database","user","password"],pr=Ue.length,Au=Ue[pr-1];function dr(){var r=rt instanceof -gu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` -`);rt.write(Ji.format.apply(Ji,e))}}a(dr,"warn");Object.defineProperty(de.exports, +this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Vi.exports=du});var Zi=I((il,de)=>{"use strict";p();var zi=(or(),O(sr)),yu=(hr(),O(cr)).Stream,mu=Ki(), +Yi=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, +xu=32768;function Eu(r){return(r&Su)==xu}a(Eu,"isRegFile");var Ue=["host","port", +"database","user","password"],pr=Ue.length,vu=Ue[pr-1];function dr(){var r=rt instanceof +yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` +`);rt.write(Yi.format.apply(Yi,e))}}a(dr,"warn");Object.defineProperty(de.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});de. exports.warnTo=function(r){var e=rt;return rt=r,e};de.exports.getFileName=function(r){ -var e=r||m.env,t=e.PGPASSFILE||(yt?Zi.join(e.APPDATA||"./","postgresql","pgpass.\ -conf"):Zi.join(e.HOME||"./",".pgpass"));return t};de.exports.usePgPass=function(r,e){ +var e=r||m.env,t=e.PGPASSFILE||(yt?zi.join(e.APPDATA||"./","postgresql","pgpass.\ +conf"):zi.join(e.HOME||"./",".pgpass"));return t};de.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",_u(r.mode)?r.mode&(Su|xu)?(dr('WARNING: password file "%s" has group or \ +",Eu(r.mode)?r.mode&(wu|bu)?(dr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(dr('WARNING:\ - password file "%s" is not a plain file',e),!1))};var Cu=de.exports.match=function(r,e){ -return Ue.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||bu)===Number( + password file "%s" is not a plain file',e),!1))};var _u=de.exports.match=function(r,e){ +return Ue.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};de.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(wu());function s(c){var h=Tu(c);h&&Iu(h)&&Cu(r,h)&&(n=h[Au],i.end())} +var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[vu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), dr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. -on("data",s).on("end",o).on("error",u)};var Tu=de.exports.parseLine=function(r){ +on("data",s).on("end",o).on("error",u)};var Au=de.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, u=!1,c=a(function(l,d,b){var C=r.substring(d,b);Object.hasOwnProperty.call(m.env, "PGPASS_NO_DEESCAPE")||(C=C.replace(/\\([:\\])/g,"$1")),o[Ue[l]]=C},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== -pr?o:null,o},Iu=de.exports.isValidEntry=function(r){for(var e={0:function(o){return o. +pr?o:null,o},Cu=de.exports.isValidEntry=function(r){for(var e={0:function(o){return o. length>0},1:function(o){return o==="*"?!0:(o=Number(o),isFinite(o)&&o>0&&o<9007199254740992&& Math.floor(o)===o)},2:function(o){return o.length>0},3:function(o){return o.length> 0},4:function(o){return o.length>0}},t=0;t{"use strict";p();var gl=(or(),O(sr)),es=(ur(),O(ar)),mt=Xi(); -yr.exports=function(r,e){var t=mt.getFileName();es.stat(t,function(n,i){if(n||!mt. -usePgPass(i,t))return e(void 0);var s=es.createReadStream(t);mt.getPassword(r,s, -e)})};yr.exports.warnTo=mt.warnTo});var wt=I((Sl,rs)=>{"use strict";p();var Pu=Xe();function gt(r){this._types=r||Pu, +"",s=n(i);if(!s)return!1}return!0}});var Xi=I((ul,yr)=>{"use strict";p();var al=(or(),O(sr)),Ji=(ur(),O(ar)),mt=Zi(); +yr.exports=function(r,e){var t=mt.getFileName();Ji.stat(t,function(n,i){if(n||!mt. +usePgPass(i,t))return e(void 0);var s=Ji.createReadStream(t);mt.getPassword(r,s, +e)})};yr.exports.warnTo=mt.warnTo});var wt=I((hl,es)=>{"use strict";p();var Tu=Xe();function gt(r){this._types=r||Tu, this.text={},this.binary={}}a(gt,"TypeOverrides");gt.prototype.getOverrides=function(r){ switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}}; gt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| -"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};rs.exports=gt});var ns={};re(ns,{default:()=>Bu});var Bu,is=z(()=>{"use strict";p();Bu={}});var ss={};re(ss,{parse:()=>mr});function mr(r,e=!1){let{protocol:t}=new URL(r),n="\ +"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};es.exports=gt});var ts={};re(ts,{default:()=>Iu});var Iu,rs=te(()=>{"use strict";p();Iu={}});var ns={};re(ns,{parse:()=>mr});function mr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( i),h=decodeURIComponent(h);let C=i+":"+s,B=e?Object.fromEntries(d.entries()):l;return{ href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:B,hash:b}}var gr=z(()=>{"use strict";p();a(mr,"parse")});var as=I((Cl,os)=>{"use strict";p();var Lu=(gr(),O(ss)),wr=(ur(),O(ar));function br(r){ -if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Lu. +search:l,query:B,hash:b}}var gr=te(()=>{"use strict";p();a(mr,"parse")});var ss=I((ml,is)=>{"use strict";p();var Pu=(gr(),O(ns)),wr=(ur(),O(ar));function br(r){ +if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- 1]);var i=(e.auth||":").split(":");if(t.user=i[0],t.password=i.splice(1).join(":"), @@ -858,19 +858,19 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=wr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(br,"parse");os.exports=br;br.parse=br});var bt=I((Pl,hs)=>{"use strict";p();var Ru=(is(),O(ns)),cs=et(),us=as().parse,V=a( +return t}a(br,"parse");is.exports=br;br.parse=br});var bt=I((bl,us)=>{"use strict";p();var Bu=(rs(),O(ts)),as=et(),os=ss().parse,V=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||cs[r]},"val"),Fu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||as[r]},"val"),Lu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": -return{rejectUnauthorized:!1}}return cs.ssl},"readSSLConfigFromEnvironment"),Oe=a( +return{rejectUnauthorized:!1}}return as.ssl},"readSSLConfigFromEnvironment"),Oe=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ teParamValue"),se=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Oe(n))},"ad\ -d"),xr=class xr{constructor(e){e=typeof e=="string"?us(e):e||{},e.connectionString&& -(e=Object.assign({},e,us(e.connectionString))),this.user=V("user",e),this.database= +d"),xr=class xr{constructor(e){e=typeof e=="string"?os(e):e||{},e.connectionString&& +(e=Object.assign({},e,os(e.connectionString))),this.user=V("user",e),this.database= V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Fu():e.ssl,typeof this.ssl=="st\ +options=V("options",e),this.ssl=typeof e.ssl>"u"?Lu():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. @@ -890,13 +890,13 @@ ssl}:{};if(se(t,n,"sslmode"),se(t,n,"sslca"),se(t,n,"sslkey"),se(t,n,"sslcert"), se(t,n,"sslrootcert"),this.database&&t.push("dbname="+Oe(this.database)),this.replication&& t.push("replication="+Oe(this.replication)),this.host&&t.push("host="+Oe(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Oe(this.client_encoding)),Ru.lookup(this.host,function(i,s){return i? +ent_encoding="+Oe(this.client_encoding)),Bu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Oe(s)),e(null,t.join(" ")))})}};a(xr,"ConnectionPa\ -rameters");var Sr=xr;hs.exports=Sr});var ps=I((Rl,fs)=>{"use strict";p();var Mu=Xe(),ls=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +rameters");var Sr=xr;us.exports=Sr});var ls=I((El,hs)=>{"use strict";p();var Ru=Xe(),cs=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, vr=class vr{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ -var t;e.text?t=ls.exec(e.text):t=ls.exec(e.command),t&&(this.command=t[1],t[3]?(this. +var t;e.text?t=cs.exec(e.text):t=cs.exec(e.command),t&&(this.command=t[1],t[3]?(this. oid=parseInt(t[2],10),this.rowCount=parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt( t[2],10)))}_parseRowAsArray(e){for(var t=new Array(e.length),n=0,i=e.length;n{"use strict";p();var{EventEmitter:Du}=we(),ds=ps(),ys=tt(),Ar=class Ar extends Du{constructor(e,t,n){ -super(),e=ys.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. +ext"):this._parsers[t]=Ru.getTypeParser(n.dataTypeID,n.format||"text")}}};a(vr,"\ +Result");var Er=vr;hs.exports=Er});var ys=I((Al,ds)=>{"use strict";p();var{EventEmitter:Fu}=we(),fs=ls(),ps=tt(),Ar=class Ar extends Fu{constructor(e,t,n){ +super(),e=ps.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& -(this.callback=m.domain.bind(e.callback)),this._result=new ds(this._rowMode,this. +(this.callback=m.domain.bind(e.callback)),this._result=new fs(this._rowMode,this. types),this._results=this._result,this.isPreparedStatement=!1,this._canceledDueToError= !1,this._promise=null}requiresPreparation(){return this.name||this.rows?!0:!this. text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&& -(Array.isArray(this._results)||(this._results=[this._result]),this._result=new ds( +(Array.isArray(this._results)||(this._results=[this._result]),this._result=new fs( this._rowMode,this.types),this._results.push(this._result))}handleRowDescription(e){ this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this. callback||!this.listeners("row").length}handleDataRow(e){let t;if(!this._canceledDueToError){ @@ -935,47 +935,47 @@ name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execut {portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.isPreparedStatement= !0,this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types}); try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this. -binary,valueMapper:ys.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( +binary,valueMapper:ps.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(Ar,"Query"); -var _r=Ar;ms.exports=_r});var Ss={};re(Ss,{Socket:()=>Se,isIP:()=>ku});function ku(r){return 0}var bs,ws,v, -Se,St=z(()=>{"use strict";p();bs=Ie(we(),1);a(ku,"isIP");ws=/^[^.]+\./,v=class v extends bs.EventEmitter{constructor(){ +var _r=Ar;ds.exports=_r});var ws={};re(ws,{Socket:()=>Se,isIP:()=>Mu});function Mu(r){return 0}var gs,ms,E, +Se,St=te(()=>{"use strict";p();gs=Ie(we(),1);a(Mu,"isIP");ms=/^[^.]+\./,E=class E extends gs.EventEmitter{constructor(){ super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); _(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? -v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ -v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ +E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ -v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? -v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. -wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. -opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? -v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? -v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? -v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ -v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ -return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. -rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ +E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? +E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. +wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. +opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? +E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? +E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? +E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ +E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ +return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. +rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -996,10 +996,10 @@ then(d=>{if(this.ws=d.webSocket,this.ws==null)throw c;this.ws.accept(),o(this.ws !0)}).catch(d=>{this.emit("error",new Error(`All attempts to open a WebSocket to\ connect to the database failed. Please refer to https://github.com/neondatabase\ /serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined\ -. Details: ${d.message}`)),this.emit("close")})}}async startTls(t){if(this.subtls=== -void 0)throw new Error("For Postgres SSL connections, you must set `neonConfig.s\ -ubtls` to the subtls library. See https://github.com/neondatabase/serverless/blo\ -b/main/CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. +. Details: ${d}`)),this.emit("close")})}}async startTls(t){if(this.subtls===void 0) +throw new Error("For Postgres SSL connections, you must set `neonConfig.subtls` \ +to the subtls library. See https://github.com/neondatabase/serverless/blob/main/\ +CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. fromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i.read.bind( i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o,{useSNI:!this. disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0});this.tlsRead= @@ -1014,12 +1014,12 @@ length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this.tlsState===0?(this rawWrite(t),i()):this.tlsState===1?this.once("secureConnection",()=>{this.write( t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){return this. write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed=!0,this. -end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ -let s;return i?.jwtAuth?s=t.replace(ws,"apiauth."):s=t.replace(ws,"api."),"https\ +end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ +let s;return i?.jwtAuth?s=t.replace(ms,"apiauth."):s=t.replace(ms,"api."),"https\ ://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0,webSocketConstructor:void 0, wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0,forceDisablePgSSL:!0,coalesceWrites:!0, pipelineConnect:"password",subtls:void 0,rootCerts:"",pipelineTLS:!1,disableSNI:!1}), -_(v,"opts",{});Se=v});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +_(E,"opts",{});Se=E});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1032,11 +1032,11 @@ noData",length:5};T.portalSuspended={name:"portalSuspended",length:5};T.replicat {name:"copyDone",length:4};var qr=class qr extends Error{constructor(e,t,n){super( e),this.length=t,this.name=n}};a(qr,"DatabaseError");var Cr=qr;T.DatabaseError=Cr; var Qr=class Qr{constructor(e,t){this.length=e,this.chunk=t,this.name="copyData"}}; -a(Qr,"CopyDataMessage");var Tr=Qr;T.CopyDataMessage=Tr;var jr=class jr{constructor(e,t,n,i){ -this.length=e,this.name=t,this.binary=n,this.columnTypes=new Array(i)}};a(jr,"Co\ -pyResponse");var Ir=jr;T.CopyResponse=Ir;var Wr=class Wr{constructor(e,t,n,i,s,o,u){ +a(Qr,"CopyDataMessage");var Tr=Qr;T.CopyDataMessage=Tr;var Wr=class Wr{constructor(e,t,n,i){ +this.length=e,this.name=t,this.binary=n,this.columnTypes=new Array(i)}};a(Wr,"Co\ +pyResponse");var Ir=Wr;T.CopyResponse=Ir;var jr=class jr{constructor(e,t,n,i,s,o,u){ this.name=e,this.tableID=t,this.columnID=n,this.dataTypeID=i,this.dataTypeSize=s, -this.dataTypeModifier=o,this.format=u}};a(Wr,"Field");var Pr=Wr;T.Field=Pr;var Hr=class Hr{constructor(e,t){ +this.dataTypeModifier=o,this.format=u}};a(jr,"Field");var Pr=jr;T.Field=Pr;var Hr=class Hr{constructor(e,t){ this.length=e,this.fieldCount=t,this.name="rowDescription",this.fields=new Array( this.fieldCount)}};a(Hr,"RowDescriptionMessage");var Br=Hr;T.RowDescriptionMessage= Br;var Gr=class Gr{constructor(e,t){this.length=e,this.parameterCount=t,this.name= @@ -1049,15 +1049,15 @@ cationMD5Password");var Fr=Vr;T.AuthenticationMD5Password=Fr;var Kr=class Kr{con this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Kr, "BackendKeyDataMessage");var Mr=Kr;T.BackendKeyDataMessage=Mr;var zr=class zr{constructor(e,t,n,i){ this.length=e,this.processId=t,this.channel=n,this.payload=i,this.name="notifica\ -tion"}};a(zr,"NotificationResponseMessage");var Dr=zr;T.NotificationResponseMessage= -Dr;var Yr=class Yr{constructor(e,t){this.length=e,this.status=t,this.name="ready\ -ForQuery"}};a(Yr,"ReadyForQueryMessage");var kr=Yr;T.ReadyForQueryMessage=kr;var Zr=class Zr{constructor(e,t){ +tion"}};a(zr,"NotificationResponseMessage");var kr=zr;T.NotificationResponseMessage= +kr;var Yr=class Yr{constructor(e,t){this.length=e,this.status=t,this.name="ready\ +ForQuery"}};a(Yr,"ReadyForQueryMessage");var Dr=Yr;T.ReadyForQueryMessage=Dr;var Zr=class Zr{constructor(e,t){ this.length=e,this.text=t,this.name="commandComplete"}};a(Zr,"CommandCompleteMes\ sage");var Ur=Zr;T.CommandCompleteMessage=Ur;var Jr=class Jr{constructor(e,t){this. length=e,this.fields=t,this.name="dataRow",this.fieldCount=t.length}};a(Jr,"Data\ RowMessage");var Or=Jr;T.DataRowMessage=Or;var Xr=class Xr{constructor(e,t){this. length=e,this.message=t,this.name="notice"}};a(Xr,"NoticeMessage");var Nr=Xr;T.NoticeMessage= -Nr});var xs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); +Nr});var bs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); xt.Writer=void 0;var rn=class rn{constructor(e=256){this.size=e,this.offset=5,this. headerPosition=0,this.buffer=y.allocUnsafe(e)}ensure(e){var t=this.buffer.length- this.offset;if(t>1)+e;this.buffer=y.allocUnsafe( @@ -1073,44 +1073,44 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(rn,"Wr\ -iter");var tn=rn;xt.Writer=tn});var vs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); -vt.serialize=void 0;var nn=xs(),M=new nn.Writer,Uu=a(r=>{M.addInt16(3).addInt16( +iter");var tn=rn;xt.Writer=tn});var xs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); +vt.serialize=void 0;var nn=bs(),M=new nn.Writer,ku=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new nn. -Writer().addInt32(t).add(e).flush()},"startup"),Ou=a(()=>{let r=y.allocUnsafe(8); -return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Nu=a(r=>M. -addCString(r).flush(112),"password"),qu=a(function(r,e){return M.addCString(r).addInt32( -y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Qu=a( -function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),ju=a( -r=>M.addCString(r).flush(81),"query"),Es=[],Wu=a(r=>{let e=r.name||"";e.length>63&& +Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); +return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Uu=a(r=>M. +addCString(r).flush(112),"password"),Ou=a(function(r,e){return M.addCString(r).addInt32( +y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Nu=a( +function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),qu=a( +r=>M.addCString(r).flush(81),"query"),Ss=[],Qu=a(r=>{let e=r.name||"";e.length>63&& (console.error("Warning! Postgres only supports 63 characters for query names."), console.error("You supplied %s (%s)",e,e.length),console.error("This can cause c\ -onflicts and silent errors executing queries"));let t=r.types||Es;for(var n=t.length, +onflicts and silent errors executing queries"));let t=r.types||Ss;for(var n=t.length, i=M.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| -"",n=r.binary||!1,i=r.values||Es,s=i.length;return M.addCString(e).addCString(t), -M.addInt16(s),Hu(i,r.valueMapper),M.addInt16(s),M.add(Ne.flush()),M.addInt16(n?1: -0),M.flush(66)},"bind"),$u=y.from([69,0,0,0,9,0,0,0,0,0]),Vu=a(r=>{if(!r||!r.portal&& -!r.rows)return $u;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. +n)),Ne.addString(n))}},"writeValues"),ju=a((r={})=>{let e=r.portal||"",t=r.statement|| +"",n=r.binary||!1,i=r.values||Ss,s=i.length;return M.addCString(e).addCString(t), +M.addInt16(s),Wu(i,r.valueMapper),M.addInt16(s),M.add(Ne.flush()),M.addInt16(n?1: +0),M.flush(66)},"bind"),Hu=y.from([69,0,0,0,9,0,0,0,0,0]),Gu=a(r=>{if(!r||!r.portal&& +!r.rows)return Hu;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]= -0,s.writeUInt32BE(t,s.length-4),s},"execute"),Ku=a((r,e)=>{let t=y.allocUnsafe(16); +0,s.writeUInt32BE(t,s.length-4),s},"execute"),$u=a((r,e)=>{let t=y.allocUnsafe(16); return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE( r,8),t.writeInt32BE(e,12),t},"cancel"),sn=a((r,e)=>{let n=4+y.byteLength(e)+1,i=y. allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i}, -"cstringMessage"),zu=M.addCString("P").flush(68),Yu=M.addCString("S").flush(68), -Zu=a(r=>r.name?sn(68,`${r.type}${r.name||""}`):r.type==="P"?zu:Yu,"describe"),Ju=a( -r=>{let e=`${r.type}${r.name||""}`;return sn(67,e)},"close"),Xu=a(r=>M.add(r).flush( -100),"copyData"),ec=a(r=>sn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),tc=Et(72),rc=Et(83),nc=Et(88),ic=Et(99),sc={startup:Uu,password:Nu, -requestSsl:Ou,sendSASLInitialResponseMessage:qu,sendSCRAMClientFinalMessage:Qu,query:ju, -parse:Wu,bind:Gu,execute:Vu,describe:Zu,close:Ju,flush:a(()=>tc,"flush"),sync:a( -()=>rc,"sync"),end:a(()=>nc,"end"),copyData:Xu,copyDone:a(()=>ic,"copyDone"),copyFail:ec, -cancel:Ku};vt.serialize=sc});var _s=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); -_t.BufferReader=void 0;var oc=y.allocUnsafe(0),an=class an{constructor(e=0){this. -offset=e,this.buffer=oc,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. +"cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), +zu=a(r=>r.name?sn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( +r=>{let e=`${r.type}${r.name||""}`;return sn(67,e)},"close"),Zu=a(r=>M.add(r).flush( +100),"copyData"),Ju=a(r=>sn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),Xu=Et(72),ec=Et(83),tc=Et(88),rc=Et(99),nc={startup:ku,password:Uu, +requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, +parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( +()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, +cancel:$u};vt.serialize=nc});var Es=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +_t.BufferReader=void 0;var ic=y.allocUnsafe(0),an=class an{constructor(e=0){this. +offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= 2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this. buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer. @@ -1118,14 +1118,14 @@ toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstrin let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(an,"BufferReader");var on=an;_t.BufferReader= -on});var Ts=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var D=en(),ac=_s(),un=1,uc=4,As=un+uc,Cs=y.allocUnsafe(0),hn=class hn{constructor(e){ -if(this.buffer=Cs,this.bufferLength=0,this.bufferOffset=0,this.reader=new ac.BufferReader, +on});var As=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); +At.Parser=void 0;var k=en(),sc=Es(),un=1,oc=4,vs=un+oc,_s=y.allocUnsafe(0),hn=class hn{constructor(e){ +if(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, -i=this.bufferOffset;for(;i+As<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( -i+un),u=un+o;if(u+i<=n){let c=this.handlePacket(i+As,s,o,this.buffer);t(c),i+=u}else -break}i===n?(this.buffer=Cs,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= +i=this.bufferOffset;for(;i+vs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( +i+un),u=un+o;if(u+i<=n){let c=this.handlePacket(i+vs,s,o,this.buffer);t(c),i+=u}else +break}i===n?(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer. @@ -1133,9 +1133,9 @@ byteLength*2;for(;t>=s;)s*=2;i=y.allocUnsafe(s)}this.buffer.copy(i,0,this.buffer this.bufferOffset+this.bufferLength),this.buffer=i,this.bufferOffset=0}e.copy(this. buffer,this.bufferOffset+this.bufferLength),this.bufferLength=t}else this.buffer= e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,t,n,i){switch(t){case 50: -return D.bindComplete;case 49:return D.parseComplete;case 51:return D.closeComplete;case 110: -return D.noData;case 115:return D.portalSuspended;case 99:return D.copyDone;case 87: -return D.replicationStart;case 73:return D.emptyQuery;case 68:return this.parseDataRowMessage( +return k.bindComplete;case 49:return k.parseComplete;case 51:return k.closeComplete;case 110: +return k.noData;case 115:return k.portalSuspended;case 99:return k.copyDone;case 87: +return k.replicationStart;case 73:return k.emptyQuery;case 68:return this.parseDataRowMessage( e,n,i);case 67:return this.parseCommandCompleteMessage(e,n,i);case 90:return this. parseReadyForQueryMessage(e,n,i);case 65:return this.parseNotificationMessage(e, n,i);case 82:return this.parseAuthenticationResponse(e,n,i);case 83:return this. @@ -1144,54 +1144,54 @@ return this.parseErrorMessage(e,n,i,"error");case 78:return this.parseErrorMessa e,n,i,"notice");case 84:return this.parseRowDescriptionMessage(e,n,i);case 116:return this. parseParameterDescriptionMessage(e,n,i);case 71:return this.parseCopyInMessage(e, n,i);case 72:return this.parseCopyOutMessage(e,n,i);case 100:return this.parseCopyData( -e,n,i);default:return new D.DatabaseError("received invalid response: "+t.toString( +e,n,i);default:return new k.DatabaseError("received invalid response: "+t.toString( 16),n,"error")}}parseReadyForQueryMessage(e,t,n){this.reader.setBuffer(e,n);let i=this. -reader.string(1);return new D.ReadyForQueryMessage(t,i)}parseCommandCompleteMessage(e,t,n){ -this.reader.setBuffer(e,n);let i=this.reader.cstring();return new D.CommandCompleteMessage( -t,i)}parseCopyData(e,t,n){let i=n.slice(e,e+(t-4));return new D.CopyDataMessage( +reader.string(1);return new k.ReadyForQueryMessage(t,i)}parseCommandCompleteMessage(e,t,n){ +this.reader.setBuffer(e,n);let i=this.reader.cstring();return new k.CommandCompleteMessage( +t,i)}parseCopyData(e,t,n){let i=n.slice(e,e+(t-4));return new k.CopyDataMessage( t,i)}parseCopyInMessage(e,t,n){return this.parseCopyMessage(e,t,n,"copyInRespons\ e")}parseCopyOutMessage(e,t,n){return this.parseCopyMessage(e,t,n,"copyOutRespon\ se")}parseCopyMessage(e,t,n,i){this.reader.setBuffer(e,n);let s=this.reader.byte()!== -0,o=this.reader.int16(),u=new D.CopyResponse(t,i,s,o);for(let c=0;c{"use strict";p();Object.defineProperty(xe,"__esModule",{value:!0}); -xe.DatabaseError=xe.serialize=xe.parse=void 0;var cc=en();Object.defineProperty( -xe,"DatabaseError",{enumerable:!0,get:a(function(){return cc.DatabaseError},"get")}); -var hc=vs();Object.defineProperty(xe,"serialize",{enumerable:!0,get:a(function(){ -return hc.serialize},"get")});var lc=Ts();function fc(r,e){let t=new lc.Parser;return r. -on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(fc,"parse");xe. -parse=fc});var Is={};re(Is,{connect:()=>pc});function pc({socket:r,servername:e}){return r. -startTls(e),r}var Ps=z(()=>{"use strict";p();a(pc,"connect")});var dn=I((af,Rs)=>{"use strict";p();var Bs=(St(),O(Ss)),dc=we().EventEmitter,{parse:yc, -serialize:q}=ln(),Ls=q.flush(),mc=q.sync(),gc=q.end(),pn=class pn extends dc{constructor(e){ -super(),e=e||{},this.stream=e.stream||new Bs.Socket,this._keepAlive=e.keepAlive, +xe.DatabaseError=xe.serialize=xe.parse=void 0;var ac=en();Object.defineProperty( +xe,"DatabaseError",{enumerable:!0,get:a(function(){return ac.DatabaseError},"get")}); +var uc=xs();Object.defineProperty(xe,"serialize",{enumerable:!0,get:a(function(){ +return uc.serialize},"get")});var cc=As();function hc(r,e){let t=new cc.Parser;return r. +on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");xe. +parse=hc});var Cs={};re(Cs,{connect:()=>lc});function lc({socket:r,servername:e}){return r. +startTls(e),r}var Ts=te(()=>{"use strict";p();a(lc,"connect")});var dn=I((Yl,Bs)=>{"use strict";p();var Is=(St(),O(ws)),fc=we().EventEmitter,{parse:pc, +serialize:q}=ln(),Ps=q.flush(),dc=q.sync(),yc=q.end(),pn=class pn extends fc{constructor(e){ +super(),e=e||{},this.stream=e.stream||new Is.Socket,this._keepAlive=e.keepAlive, this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.lastBuffer= !1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this._emitMessage= !1;var t=this;this.on("newListener",function(n){n==="message"&&(t._emitMessage=!0)})}connect(e,t){ @@ -1204,36 +1204,36 @@ ssl)return this.attachListeners(this.stream);this.stream.once("data",function(s) var o=s.toString("utf8");switch(o){case"S":break;case"N":return n.stream.end(),n. emit("error",new Error("The server does not support SSL connections"));default:return n. stream.end(),n.emit("error",new Error("There was an error establishing an SSL co\ -nnection"))}var u=(Ps(),O(Is));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( -c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Bs.isIP(t)===0&&(c.servername=t);try{ +nnection"))}var u=(Ts(),O(Cs));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( +c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Is.isIP(t)===0&&(c.servername=t);try{ n.stream=u.connect(c)}catch(h){return n.emit("error",h)}n.attachListeners(n.stream), n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){e.on("end",()=>{ -this.emit("end")}),yc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& +this.emit("end")}),pc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(q.requestSsl())}startup(e){ this.stream.write(q.startup(e))}cancel(e,t){this._send(q.cancel(e,t))}password(e){ this._send(q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(q.sendSASLInitialResponseMessage( e,t))}sendSCRAMClientFinalMessage(e){this._send(q.sendSCRAMClientFinalMessage(e))}_send(e){ return this.stream.writable?this.stream.write(e):!1}query(e){this._send(q.query( e))}parse(e){this._send(q.parse(e))}bind(e){this._send(q.bind(e))}execute(e){this. -_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ls)}sync(){this. -_ending=!0,this._send(Ls),this._send(mc)}ref(){this.stream.ref()}unref(){this.stream. +_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ps)}sync(){this. +_ending=!0,this._send(Ps),this._send(dc)}ref(){this.stream.ref()}unref(){this.stream. unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. -stream.end();return}return this.stream.write(gc,()=>{this.stream.end()})}close(e){ +stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(pn,"Connection");var fn=pn;Rs.exports=fn});var Ds=I((lf,Ms)=>{"use strict";p();var wc=we().EventEmitter,hf=(Ge(),O(He)),bc=tt(), -yn=Hi(),Sc=ts(),xc=wt(),Ec=bt(),Fs=gs(),vc=et(),_c=dn(),mn=class mn extends wc{constructor(e){ -super(),this.connectionParameters=new Ec(e),this.user=this.connectionParameters. +this._send(q.copyFail(e))}};a(pn,"Connection");var fn=pn;Bs.exports=fn});var Fs=I((ef,Rs)=>{"use strict";p();var mc=we().EventEmitter,Xl=(Ge(),O(He)),gc=tt(), +yn=Wi(),wc=Xi(),bc=wt(),Sc=bt(),Ls=ys(),xc=et(),Ec=dn(),mn=class mn extends mc{constructor(e){ +super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}), this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= -t.Promise||S.Promise,this._types=new xc(t.types),this._ending=!1,this._connecting= +t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new _c({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new Ec({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. -binary||vc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. +binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}), this._connectionTimeoutMillis=t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=a( n=>{m.nextTick(()=>{n.handleError(e,this.connection)})},"enqueueError");this.activeQuery&& @@ -1271,10 +1271,10 @@ let t=this.connection;typeof this.password=="function"?this._Promise.resolve().t ()=>this.password()).then(n=>{if(n!==void 0){if(typeof n!="string"){t.emit("erro\ r",new TypeError("Password must be a string"));return}this.connectionParameters. password=this.password=n}else this.connectionParameters.password=this.password=null; -e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():Sc(this.connectionParameters, +e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():wc(this.connectionParameters, n=>{n!==void 0&&(this.connectionParameters.password=this.password=n),e()})}_handleAuthCleartextPassword(e){ this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){ -this._checkPgPass(()=>{let t=bc.postgresMd5PasswordHash(this.user,this.password, +this._checkPgPass(()=>{let t=gc.postgresMd5PasswordHash(this.user,this.password, e.salt);this.connection.password(t)})}_handleAuthSASL(e){this._checkPgPass(()=>{ this.saslSession=yn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( this.saslSession.mechanism,this.saslSession.response)})}_handleAuthSASLContinue(e){ @@ -1320,7 +1320,7 @@ e&&m.nextTick(()=>{this.activeQuery.handleError(e,this.connection),this.readyFor emit("drain"))}query(e,t,n){var i,s,o,u,c;if(e==null)throw new TypeError("Client\ was passed a null or undefined query");return typeof e.submit=="function"?(o=e. query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& -(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Fs( +(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Ls( e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,b)=>d?l(d):h(b)}))), o&&(c=i.callback,u=setTimeout(()=>{var h=new Error("Query read timeout");m.nextTick( ()=>{i.handleError(h,this.connection)}),c(h),i.callback=()=>{};var l=this.queryQueue. @@ -1335,18 +1335,18 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(mn,"Client");var Ct=mn;Ct.Query= -Fs;Ms.exports=Ct});var Ns=I((df,Os)=>{"use strict";p();var Ac=we().EventEmitter,ks=a(function(){},"\ -NOOP"),Us=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, +Ls;Rs.exports=Ct});var Us=I((nf,Ds)=>{"use strict";p();var vc=we().EventEmitter,Ms=a(function(){},"\ +NOOP"),ks=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),bn=class bn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(bn,"IdleItem");var gn=bn,Sn=class Sn{constructor(e){this.callback= -e}};a(Sn,"PendingItem");var qe=Sn;function Cc(){throw new Error("Release called \ -on client which has already been released to the pool.")}a(Cc,"throwOnDoubleRele\ +e}};a(Sn,"PendingItem");var qe=Sn;function _c(){throw new Error("Release called \ +on client which has already been released to the pool.")}a(_c,"throwOnDoubleRele\ ase");function Tt(r,e){if(e)return{callback:e,result:void 0};let t,n,i=a(function(o,u){ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.captureStackTrace( -o),o});return{callback:i,result:s}}a(Tt,"promisify");function Tc(r,e){return a(function t(n){ +o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Tc,"makeIdleListener");var xn=class xn extends Ac{constructor(e,t){ +"idleListener")}a(Ac,"makeIdleListener");var xn=class xn extends vc{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1365,25 +1365,25 @@ _pendingQueue.length){this.log("no queued requests");return}if(!this._idle.lengt this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let t=this. _idle.pop();clearTimeout(t.timeoutId);let n=t.client;n.ref&&n.ref();let i=t.idleListener; return this._acquireClient(n,e,i,!1)}if(!this._isFull())return this.newClient(e); -throw new Error("unexpected condition")}_remove(e){let t=Us(this._idle,n=>n.client=== +throw new Error("unexpected condition")}_remove(e){let t=ks(this._idle,n=>n.client=== e);t!==void 0&&clearTimeout(t.timeoutId),this._clients=this._clients.filter(n=>n!== e),e.end(),this.emit("remove",e)}connect(e){if(this.ending){let i=new Error("Can\ not use a pool after calling end on the pool");return e?e(i):this.Promise.reject( i)}let t=Tt(this.Promise,e),n=t.result;if(this._isFull()||this._idle.length){if(this. _idle.length&&m.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis) return this._pendingQueue.push(new qe(t.callback)),n;let i=a((u,c,h)=>{clearTimeout( -o),t.callback(u,c,h)},"queueCallback"),s=new qe(i),o=setTimeout(()=>{Us(this._pendingQueue, +o),t.callback(u,c,h)},"queueCallback"),s=new qe(i),o=setTimeout(()=>{ks(this._pendingQueue, u=>u.callback===i),s.timedOut=!0,t.callback(new Error("timeout exceeded when try\ ing to connect"))},this.options.connectionTimeoutMillis);return this._pendingQueue. push(s),n}return this.newClient(new qe(t.callback)),n}newClient(e){let t=new this. -Client(this.options);this._clients.push(t);let n=Tc(this,t);this.log("checking c\ +Client(this.options);this._clients.push(t);let n=Ac(this,t);this.log("checking c\ lient timeout");let i,s=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{ this.log("ending client due to timeout"),s=!0,t.connection?t.connection.stream.destroy(): t.end()},this.options.connectionTimeoutMillis)),this.log("connecting new client"), t.connect(o=>{if(i&&clearTimeout(i),t.on("error",n),o)this.log("client failed to\ connect",o),this._clients=this._clients.filter(u=>u!==t),s&&(o.message="Connect\ ion terminated due to connection timeout"),this._pulseQueue(),e.timedOut||e.callback( -o,void 0,ks);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== +o,void 0,Ms);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== 0){let u=setTimeout(()=>{this.log("ending client due to expired lifetime"),this. _expired.add(t),this._idle.findIndex(h=>h.client===t)!==-1&&this._acquireClient( t,new qe((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.once( @@ -1391,8 +1391,8 @@ t,new qe((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.o i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n), e.removeListener("error",n),t.timedOut?i&&this.options.verify?this.options.verify( e,e.release):e.release():i&&this.options.verify?this.options.verify(e,s=>{if(s)return e. -release(s),t.callback(s,void 0,ks);t.callback(void 0,e,e.release)}):t.callback(void 0, -e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&Cc(),n=!0,this._release(e, +release(s),t.callback(s,void 0,Ms);t.callback(void 0,e,e.release)}):t.callback(void 0, +e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&_c(),n=!0,this._release(e, t,i)}}_release(e,t,n){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1, this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>= this.options.maxUses){e._poolUseCount>=this.options.maxUses&&this.log("remove ex\ @@ -1414,7 +1414,7 @@ this.Promise.reject(n)}this.ending=!0;let t=Tt(this.Promise,e);return this._endC t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue. length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients. reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients. -length}};a(xn,"Pool");var wn=xn;Os.exports=wn});var qs={};re(qs,{default:()=>Ic});var Ic,Qs=z(()=>{"use strict";p();Ic={}});var js=I((wf,Pc)=>{Pc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ +length}};a(xn,"Pool");var wn=xn;Ds.exports=wn});var Os={};re(Os,{default:()=>Cc});var Cc,Ns=te(()=>{"use strict";p();Cc={}});var qs=I((uf,Tc)=>{Tc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ client - pure javascript & libpq with the same API",keywords:["database","libpq", "pg","postgre","postgres","postgresql","rdbms"],homepage:"https://github.com/bri\ anc/node-postgres",repository:{type:"git",url:"git://github.com/brianc/node-post\ @@ -1425,16 +1425,16 @@ pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:" 4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ "pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ .md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ -7b9a5491a178655"}});var Gs=I((bf,Hs)=>{"use strict";p();var Ws=we().EventEmitter,Bc=(Ge(),O(He)),En=tt(), -Qe=Hs.exports=function(r,e,t){Ws.call(this),r=En.normalizeQueryConfig(r,e,t),this. +7b9a5491a178655"}});var js=I((cf,Ws)=>{"use strict";p();var Qs=we().EventEmitter,Ic=(Ge(),O(He)),En=tt(), +Qe=Ws.exports=function(r,e,t){Qs.call(this),r=En.normalizeQueryConfig(r,e,t),this. text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ -newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Bc.inherits( -Qe,Ws);var Lc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ +newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Ic.inherits( +Qe,Qs);var Pc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ age",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"\ dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"\ routine"};Qe.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); -if(e)for(var t in e){var n=Lc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. +if(e)for(var t in e){var n=Pc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. emit("error",r),this.state="error"};Qe.prototype.then=function(r,e){return this. _getPromise().then(r,e)};Qe.prototype.catch=function(r){return this._getPromise(). catch(r)};Qe.prototype._getPromise=function(){return this._promise?this._promise: @@ -1456,30 +1456,30 @@ this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. values.map(En.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var zs=I((vf,Ks)=>{"use strict";p();var Rc=(Qs(),O(qs)),Fc=wt(),Ef=js(),$s=we(). -EventEmitter,Mc=(Ge(),O(He)),Dc=bt(),Vs=Gs(),J=Ks.exports=function(r){$s.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Fc(r.types),this.native= -new Rc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= -!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Dc( +text,t)}});var Vs=I((pf,$s)=>{"use strict";p();var Bc=(Ns(),O(Os)),Lc=wt(),ff=qs(),Hs=we(). +EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),Gs=js(),Z=$s.exports=function(r){Hs.call(this), +r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Lc(r.types),this.native= +new Bc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= -e.port,this.namedQueries={}};J.Query=Vs;Mc.inherits(J,$s);J.prototype._errorAllQueries= +e.port,this.namedQueries={}};Z.Query=Gs;Rc.inherits(Z,Hs);Z.prototype._errorAllQueries= function(r){let e=a(t=>{m.nextTick(()=>{t.native=this.native,t.handleError(r)})}, "enqueueError");this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery= -null),this._queryQueue.forEach(e),this._queryQueue.length=0};J.prototype._connect= +null),this._queryQueue.forEach(e),this._queryQueue.length=0};Z.prototype._connect= function(r){var e=this;if(this._connecting){m.nextTick(()=>r(new Error("Client h\ as already been connected. You cannot reuse a client.")));return}this._connecting= !0,this.connectionParameters.getLibpqConnectionString(function(t,n){if(t)return r( t);e.native.connect(n,function(i){if(i)return e.native.end(),r(i);e._connected=!0, e.native.on("error",function(s){e._queryable=!1,e._errorAllQueries(s),e.emit("er\ ror",s)}),e.native.on("notification",function(s){e.emit("notification",{channel:s. -relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};J. +relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};Z. prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise( -(e,t)=>{this._connect(n=>{n?t(n):e()})})};J.prototype.query=function(r,e,t){var n, +(e,t)=>{this._connect(n=>{n?t(n):e()})})};Z.prototype.query=function(r,e,t){var n, i,s,o,u;if(r==null)throw new TypeError("Client was passed a null or undefined qu\ ery");if(typeof r.submit=="function")s=r.query_timeout||this.connectionParameters. query_timeout,i=n=r,typeof e=="function"&&(r.callback=e);else if(s=this.connectionParameters. -query_timeout,n=new Vs(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= +query_timeout,n=new Gs(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= l,h=d}),n.callback=(l,d)=>l?h(l):c(d)}return s&&(u=n.callback,o=setTimeout(()=>{ var c=new Error("Query read timeout");m.nextTick(()=>{n.handleError(c,this.connection)}), u(c),n.callback=()=>{};var h=this._queryQueue.indexOf(n);h>-1&&this._queryQueue. @@ -1488,39 +1488,39 @@ this._queryable?this._ending?(n.native=this.native,m.nextTick(()=>{n.handleError new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.push( n),this._pulseQueryQueue(),i):(n.native=this.native,m.nextTick(()=>{n.handleError( new Error("Client has encountered a connection error and is not queryable"))}),i)}; -J.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( +Z.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( "connect",this.end.bind(this,r));var t;return r||(t=new this._Promise(function(n,i){ r=a(s=>s?i(s):n(),"cb")})),this.native.end(function(){e._errorAllQueries(new Error( -"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};J.prototype. +"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};Z.prototype. _hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="\ -error"&&this._activeQuery.state!=="end"};J.prototype._pulseQueryQueue=function(r){ +error"&&this._activeQuery.state!=="end"};Z.prototype._pulseQueryQueue=function(r){ if(this._connected&&!this._hasActiveQuery()){var e=this._queryQueue.shift();if(!e){ r||this.emit("drain");return}this._activeQuery=e,e.submit(this);var t=this;e.once( -"_done",function(){t._pulseQueryQueue()})}};J.prototype.cancel=function(r){this. +"_done",function(){t._pulseQueryQueue()})}};Z.prototype.cancel=function(r){this. _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== --1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};J.prototype.ref=function(){}; -J.prototype.unref=function(){};J.prototype.setTypeParser=function(r,e,t){return this. -_types.setTypeParser(r,e,t)};J.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var vn=I((Cf,Ys)=>{"use strict";p();Ys.exports=zs()});var It=I((If,nt)=>{"use strict";p();var kc=Ds(),Uc=et(),Oc=dn(),Nc=Ns(),{DatabaseError:qc}=ln(), -Qc=a(r=>{var e;return e=class extends Nc{constructor(n){super(n,r)}},a(e,"BoundP\ -ool"),e},"poolFactory"),_n=a(function(r){this.defaults=Uc,this.Client=r,this.Query= -this.Client.Query,this.Pool=Qc(this.Client),this._pools=[],this.Connection=Oc,this. -types=Xe(),this.DatabaseError=qc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new _n(vn()):(nt.exports=new _n(kc),Object.defineProperty(nt.exports,"na\ +-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; +Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. +_types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. +_types.getTypeParser(r,e)}});var vn=I((mf,Ks)=>{"use strict";p();Ks.exports=Vs()});var It=I((wf,nt)=>{"use strict";p();var Mc=Fs(),kc=et(),Dc=dn(),Uc=Us(),{DatabaseError:Oc}=ln(), +Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ +ool"),e},"poolFactory"),_n=a(function(r){this.defaults=kc,this.Client=r,this.Query= +this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. +types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. +exports=new _n(vn()):(nt.exports=new _n(Mc),Object.defineProperty(nt.exports,"na\ tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new _n(vn())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});var Vc={};re(Vc,{Client:()=>Bt,ClientBase:()=>oe.ClientBase,Connection:()=>oe.Connection, +native",{value:r}),r}}))});var Gc={};re(Gc,{Client:()=>Bt,ClientBase:()=>oe.ClientBase,Connection:()=>oe.Connection, DatabaseError:()=>oe.DatabaseError,NeonDbError:()=>he,Pool:()=>Cn,Query:()=>oe.Query, defaults:()=>oe.defaults,neon:()=>An,neonConfig:()=>Se,types:()=>oe.types});module. -exports=O(Vc);p();var Lt=Ie(It());St();p();St();gr();var Xs=Ie(tt()),eo=Ie(wt());function jc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(jc,"encodeBuffe\ +exports=O(Gc);p();var Lt=Ie(It());St();p();St();gr();var Zs=Ie(tt()),Js=Ie(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", "NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); _(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, "constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. -captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var he=Pt,Zs="transaction() exp\ -ects an array of queries, or a function returning an array of queries",Wc=["seve\ +captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var he=Pt,zs="transaction() exp\ +ects an array of queries, or a function returning an array of queries",Qc=["seve\ rity","code","detail","hint","position","internalPosition","internalQuery","wher\ e","schema","table","column","dataType","constraint","file","line","routine"];function An(r,{ arrayMode:e,fullResults:t,fetchOptions:n,isolationLevel:i,readOnly:s,deferrable:o, @@ -1530,47 +1530,47 @@ base connection string was provided to `neon()`. Perhaps an environment variable n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} let{protocol:d,username:b,hostname:C,port:B,pathname:Q}=l;if(d!=="postgres:"&&d!== "postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ - `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(A,...g){ -let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let j=0;jjc((0,Xs.prepareValue)(j)));let k={ -query:P,params:g};return u&&u(k),Hc(ye,k,K)}a(X,"resolve"),X.transaction=async(A,g)=>{ -if(typeof A=="function"&&(A=A(X)),!Array.isArray(A))throw new Error(Zs);A.forEach( -k=>{if(k[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Zs)});let P=A. -map(k=>k.parameterizedQuery),K=A.map(k=>k.opts??{});return ye(P,K,g)};async function ye(A,g,P){ -let{fetchEndpoint:K,fetchFunction:k}=Se,j=Array.isArray(A)?{queries:A}:A,ee=n??{}, -ae=e??!1,R=t??!1,$=i,le=s,me=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, -...P.fetchOptions}),P.arrayMode!==void 0&&(ae=P.arrayMode),P.fullResults!==void 0&& -(R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& + `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ +let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;Wqc((0,Zs.prepareValue)(W)));let D={ +query:P,params:g};return u&&u(D),Wc(ye,D,K)}a(J,"resolve"),J.transaction=async(A,g)=>{ +if(typeof A=="function"&&(A=A(J)),!Array.isArray(A))throw new Error(zs);A.forEach( +D=>{if(D[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(zs)});let P=A. +map(D=>D.parameterizedQuery),K=A.map(D=>D.opts??{});return ye(P,K,g)};async function ye(A,g,P){ +let{fetchEndpoint:K,fetchFunction:D}=Se,W=Array.isArray(A)?{queries:A}:A,X=n??{}, +ae=e??!1,R=t??!1,$=i,le=s,me=o;P!==void 0&&(P.fetchOptions!==void 0&&(X={...X,...P. +fetchOptions}),P.arrayMode!==void 0&&(ae=P.arrayMode),P.fullResults!==void 0&&(R= +P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& (le=P.readOnly),P.deferrable!==void 0&&(me=P.deferrable)),g!==void 0&&!Array.isArray( -g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let Ee=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(Ee=g.authToken);let je=typeof K=="function"?K(C,B,{jwtAuth:Ee!== +g)&&g.fetchOptions!==void 0&&(X={...X,...g.fetchOptions});let Ee=h;!Array.isArray( +g)&&g?.authToken!==void 0&&(Ee=g.authToken);let We=typeof K=="function"?K(C,B,{jwtAuth:Ee!== void 0}):K,fe={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ -ray-Mode":"true"},it=await Gc(Ee);it&&(fe.Authorization=`Bearer ${it}`),Array.isArray( +ray-Mode":"true"},it=await jc(Ee);it&&(fe.Authorization=`Bearer ${it}`),Array.isArray( A)&&($!==void 0&&(fe["Neon-Batch-Isolation-Level"]=$),le!==void 0&&(fe["Neon-Bat\ ch-Read-Only"]=String(le)),me!==void 0&&(fe["Neon-Batch-Deferrable"]=String(me))); -let te;try{te=await(k??fetch)(je,{method:"POST",body:JSON.stringify(j),headers:fe, -...ee})}catch(W){let H=new he(`Error connecting to database: ${W.message}`);throw H. -sourceError=W,H}if(te.ok){let W=await te.json();if(Array.isArray(A)){let H=W.results; -if(!Array.isArray(H))throw new he("Neon internal error: unexpected result format"); -return H.map((Ce,ve)=>{let Rt=g[ve]??{},ro=Rt.arrayMode??ae,no=Rt.fullResults??R; -return Js(Ce,{arrayMode:ro,fullResults:no,parameterizedQuery:A[ve],resultCallback:c, -types:Rt.types})})}else{let H=g??{},Ce=H.arrayMode??ae,ve=H.fullResults??R;return Js( -W,{arrayMode:Ce,fullResults:ve,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{ -let{status:W}=te;if(W===400){let H=await te.json(),Ce=new he(H.message);for(let ve of Wc) -Ce[ve]=H[ve]??void 0;throw Ce}else{let H=await te.text();throw new he(`Server er\ -ror (HTTP status ${W}): ${H}`)}}}return a(ye,"execute"),X}a(An,"neon");function Hc(r,e,t){ -return{[Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a( -(n,i)=>r(e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r( -e,t).finally(n),"finally")}}a(Hc,"createNeonQueryPromise");function Js(r,{arrayMode:e, -fullResults:t,parameterizedQuery:n,resultCallback:i,types:s}){let o=new eo.default( -s),u=r.fields.map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e=== -!0?r.rows.map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries( -l.map((d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), -t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Js,"\ -processQueryResult");async function Gc(r){if(typeof r=="string")return r;if(typeof r== +let ee;try{ee=await(D??fetch)(We,{method:"POST",body:JSON.stringify(W),headers:fe, +...X})}catch(j){let H=new he(`Error connecting to database: ${j}`);throw H.sourceError= +j,H}if(ee.ok){let j=await ee.json();if(Array.isArray(A)){let H=j.results;if(!Array. +isArray(H))throw new he("Neon internal error: unexpected result format");return H. +map((Ce,ve)=>{let Rt=g[ve]??{},eo=Rt.arrayMode??ae,to=Rt.fullResults??R;return Ys( +Ce,{arrayMode:eo,fullResults:to,parameterizedQuery:A[ve],resultCallback:c,types:Rt. +types})})}else{let H=g??{},Ce=H.arrayMode??ae,ve=H.fullResults??R;return Ys(j,{arrayMode:Ce, +fullResults:ve,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; +if(j===400){let H=await ee.json(),Ce=new he(H.message);for(let ve of Qc)Ce[ve]=H[ve]?? +void 0;throw Ce}else{let H=await ee.text();throw new he(`Server error (HTTP stat\ +us ${j}): ${H}`)}}}return a(ye,"execute"),J}a(An,"neon");function Wc(r,e,t){return{ +[Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a((n,i)=>r( +e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r(e,t).finally( +n),"finally")}}a(Wc,"createNeonQueryPromise");function Ys(r,{arrayMode:e,fullResults:t, +parameterizedQuery:n,resultCallback:i,types:s}){let o=new Js.default(s),u=r.fields. +map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e===!0?r.rows. +map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries(l.map( +(d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), +t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ys,"\ +processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new he("Error ge\ tting auth token.");throw e instanceof Error&&(t=new he(`Error getting auth toke\ -n: ${e.message}`)),t}}a(Gc,"getAuthToken");var to=Ie(bt()),oe=Ie(It());var Tn=class Tn extends Lt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ +n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Ie(bt()),oe=Ie(It());var Tn=class Tn extends Lt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& (this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ @@ -1592,8 +1592,8 @@ let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassw this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=this. saslSession,i=this.password,s=t.data;if(n.message!=="SASLInitialResponse"||typeof i!= "string"||typeof s!="string")throw new Error("SASL: protocol error");let o=Object. -fromEntries(s.split(",").map(te=>{if(!/^.=/.test(te))throw new Error("SASL: Inva\ -lid attribute pair entry");let W=te[0],H=te.substring(2);return[W,H]})),u=o.r,c=o. +fromEntries(s.split(",").map(ee=>{if(!/^.=/.test(ee))throw new Error("SASL: Inva\ +lid attribute pair entry");let j=ee[0],H=ee.substring(2);return[j,H]})),u=o.r,c=o. s,h=o.i;if(!u||!/^[!-+--~]+$/.test(u))throw new Error("SASL: SCRAM-SERVER-FIRST-\ MESSAGE: nonce missing/unprintable");if(!c||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ @@ -1604,27 +1604,27 @@ if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, C=b.encode(i),B=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ 6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",B,y.concat([d,y.from( -[0,0,0,1])]))),X=Q;for(var ye=0;yeX[W]^Q[W]));let A=X,g=await w.subtle.importKey( +[0,0,0,1])]))),J=Q;for(var ye=0;yeJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( "raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", -P),k="n=*,r="+n.clientNonce,j="r="+u+",s="+c+",i="+l,ee="c=biws,r="+u,ae=k+","+j+ -","+ee,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, +P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,ae=D+","+W+ +","+X,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, ["sign"]);var $=new Uint8Array(await w.subtle.sign("HMAC",R,b.encode(ae))),le=y. -from(P.map((te,W)=>P[W]^$[W])),me=le.toString("base64");let Ee=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),je=await w.subtle.sign( -"HMAC",Ee,b.encode("Server Key")),fe=await w.subtle.importKey("raw",je,{name:"HM\ +from(P.map((ee,j)=>P[j]^$[j])),me=le.toString("base64");let Ee=await w.subtle.importKey( +"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),We=await w.subtle.sign( +"HMAC",Ee,b.encode("Server Key")),fe=await w.subtle.importKey("raw",We,{name:"HM\ AC",hash:{name:"SHA-256"}},!1,["sign"]);var it=y.from(await w.subtle.sign("HMAC", fe,b.encode(ae)));n.message="SASLResponse",n.serverSignature=it.toString("base64"), -n.response=ee+",p="+me,this.connection.sendSCRAMClientFinalMessage(this.saslSession. -response)}};a(Tn,"NeonClient");var Bt=Tn;function $c(r,e){if(e)return{callback:e, +n.response=X+",p="+me,this.connection.sendSCRAMClientFinalMessage(this.saslSession. +response)}};a(Tn,"NeonClient");var Bt=Tn;function Hc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a($c,"promisify");var In=class In extends Lt.Pool{constructor(){ +n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var In=class In extends Lt.Pool{constructor(){ super(...arguments);_(this,"Client",Bt);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ if(!Se.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=$c(this.Promise, -i);i=s.callback;try{let o=new to.default(this.options),u=encodeURIComponent,c=encodeURI, +return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Hc(this.Promise, +i);i=s.callback;try{let o=new Xs.default(this.options),u=encodeURIComponent,c=encodeURI, h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== "string"?t:t.text,d=n??t.values??[];An(h,{fullResults:!0,arrayMode:t.rowMode==="\ array"})(l,d,{types:t.types??this.options?.types}).then(C=>i(void 0,C)).catch(C=>i( diff --git a/dist/npm/index.mjs b/dist/npm/index.mjs index 5fbd961..03cce33 100644 --- a/dist/npm/index.mjs +++ b/dist/npm/index.mjs @@ -1,28 +1,28 @@ -var io=Object.create;var Ce=Object.defineProperty;var so=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var ao=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty;var co=(r,e,t)=>e in r?Ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): -r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0});var z=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),se=(r,e)=>{for(var t in e) +var ro=Object.create;var Ce=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var ao=(r,e,t)=>e in r?Ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): +r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0});var te=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),se=(r,e)=>{for(var t in e) Ce(r,t,{get:e[t],enumerable:!0})},Tn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== -"function")for(let i of oo(e))!uo.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= -so(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?io(ao(r)):{},Tn(e||!r||!r.__esModule?Ce(t,"default",{ -value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>co(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=lo;st.toByteArray=po;st.fromByteArray= -go;var ae=[],re=[],ho=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ +"function")for(let i of io(e))!oo.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= +no(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?ro(so(r)):{},Tn(e||!r||!r.__esModule?Ce(t,"default",{ +value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= +yo;var ae=[],re=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ee=0,In=Rt.length;Ee0)throw new Error("Invalid string. Length must be a multip\ le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Pn, -"getLens");function lo(r){var e=Pn(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(lo,"byte\ -Length");function fo(r,e,t){return(e+t)*3/4-t}a(fo,"_byteLength");function po(r){ -var e,t=Pn(r),n=t[0],i=t[1],s=new ho(fo(r,n,i)),o=0,u=i>0?n-4:n,c;for(c=0;c0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e= re[r.charCodeAt(c)]<<2|re[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=re[r.charCodeAt( c)]<<10|re[r.charCodeAt(c+1)]<<4|re[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= -e&255),s}a(po,"toByteArray");function yo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[r>> -6&63]+ae[r&63]}a(yo,"tripletToBase64");function mo(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ +e&255),s}a(lo,"toByteArray");function fo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[r>> +6&63]+ae[r&63]}a(fo,"tripletToBase64");function po(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ ae[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ae[e>>10]+ae[e>>4&63]+ae[e<< -2&63]+"=")),i.join("")}a(go,"fromByteArray")});var Ln=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> +2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Ln=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> 1,l=-7,d=t?i-1:0,b=t?-1:1,C=r[e+d];for(d+=b,s=C&(1<<-l)-1,C>>=-l,l+=u;l>0;s=s*256+ r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== 0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? @@ -34,56 +34,56 @@ b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow 2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=B,u/=256, i-=8);for(o=o<0;r[t+C]=o&255,C+=B,o/=256,h-=8);r[t+C-B]|=Q*128}});var Kn=I(Le=>{"use strict";p();var Mt=Bn(),Pe=Ln(),Rn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Le.Buffer= -f;Le.SlowBuffer=vo;Le.INSPECT_MAX_BYTES=50;var ot=2147483647;Le.kMaxLength=ot;f. -TYPED_ARRAY_SUPPORT=wo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. +f;Le.SlowBuffer=xo;Le.INSPECT_MAX_BYTES=50;var ot=2147483647;Le.kMaxLength=ot;f. +TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ -rowser support.");function wo(){try{let r=new Uint8Array(1),e={foo:a(function(){ +rowser support.");function mo(){try{let r=new Uint8Array(1),e={foo:a(function(){ return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf( -r,e),r.foo()===42}catch{return!1}}a(wo,"typedArraySupport");Object.defineProperty( +r,e),r.foo()===42}catch{return!1}}a(mo,"typedArraySupport");Object.defineProperty( f.prototype,"parent",{enumerable:!0,get:a(function(){if(f.isBuffer(this))return this. buffer},"get")});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:a( function(){if(f.isBuffer(this))return this.byteOffset},"get")});function le(r){if(r> ot)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array( r);return Object.setPrototypeOf(e,f.prototype),e}a(le,"createBuffer");function f(r,e,t){ if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" a\ -rgument must be of type string. Received type number');return Ot(r)}return kn(r, -e,t)}a(f,"Buffer");f.poolSize=8192;function kn(r,e,t){if(typeof r=="string")return So( -r,e);if(ArrayBuffer.isView(r))return xo(r);if(r==null)throw new TypeError("The f\ +rgument must be of type string. Received type number');return Ot(r)}return Dn(r, +e,t)}a(f,"Buffer");f.poolSize=8192;function Dn(r,e,t){if(typeof r=="string")return wo( +r,e);if(ArrayBuffer.isView(r))return bo(r);if(r==null)throw new TypeError("The f\ irst argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-l\ ike Object. Received type "+typeof r);if(ue(r,ArrayBuffer)||r&&ue(r.buffer,ArrayBuffer)|| typeof SharedArrayBuffer<"u"&&(ue(r,SharedArrayBuffer)||r&&ue(r.buffer,SharedArrayBuffer))) -return kt(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ +return Dt(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ must not be of type number. Received type number');let n=r.valueOf&&r.valueOf(); -if(n!=null&&n!==r)return f.from(n,e,t);let i=Eo(r);if(i)return i;if(typeof Symbol< +if(n!=null&&n!==r)return f.from(n,e,t);let i=So(r);if(i)return i;if(typeof Symbol< "u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return f. from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argumen\ t must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. \ -Received type "+typeof r)}a(kn,"from");f.from=function(r,e,t){return kn(r,e,t)}; +Received type "+typeof r)}a(Dn,"from");f.from=function(r,e,t){return Dn(r,e,t)}; Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f, Uint8Array);function Un(r){if(typeof r!="number")throw new TypeError('"size" arg\ ument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is\ - invalid for option "size"')}a(Un,"assertSize");function bo(r,e,t){return Un(r), -r<=0?le(r):e!==void 0?typeof t=="string"?le(r).fill(e,t):le(r).fill(e):le(r)}a(bo, -"alloc");f.alloc=function(r,e,t){return bo(r,e,t)};function Ot(r){return Un(r),le( + invalid for option "size"')}a(Un,"assertSize");function go(r,e,t){return Un(r), +r<=0?le(r):e!==void 0?typeof t=="string"?le(r).fill(e,t):le(r).fill(e):le(r)}a(go, +"alloc");f.alloc=function(r,e,t){return go(r,e,t)};function Ot(r){return Un(r),le( r<0?0:Nt(r)|0)}a(Ot,"allocUnsafe");f.allocUnsafe=function(r){return Ot(r)};f.allocUnsafeSlow= -function(r){return Ot(r)};function So(r,e){if((typeof e!="string"||e==="")&&(e="\ +function(r){return Ot(r)};function wo(r,e){if((typeof e!="string"||e==="")&&(e="\ utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=On(r,e)| -0,n=le(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(So,"fromString");function Dt(r){ +0,n=le(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(wo,"fromString");function kt(r){ let e=r.length<0?0:Nt(r.length)|0,t=le(e);for(let n=0;n= +return typeof r.length!="number"||Qt(r.length)?le(0):kt(r);if(r.type==="Buffer"&& +Array.isArray(r.data))return kt(r.data)}a(So,"fromObject");function Nt(r){if(r>= ot)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ -ot.toString(16)+" bytes");return r|0}a(Nt,"checked");function vo(r){return+r!=r&& -(r=0),f.alloc(+r)}a(vo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. +ot.toString(16)+" bytes");return r|0}a(Nt,"checked");function xo(r){return+r!=r&& +(r=0),f.alloc(+r)}a(xo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. _isBuffer===!0&&e!==f.prototype},"isBuffer");f.compare=a(function(e,t){if(ue(e,Uint8Array)&& (e=f.from(e,e.offset,e.byteLength)),ue(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)), !f.isBuffer(e)||!f.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments\ @@ -106,14 +106,14 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ut(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return Vn(r).length;default:if(i)return n?-1:Ut(r).length;e=(""+e).toLowerCase(), -i=!0}}a(On,"byteLength");f.byteLength=On;function _o(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(On,"byteLength");f.byteLength=On;function Eo(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| -(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Mo( -this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Ro(this, -e,t);case"latin1":case"binary":return Fo(this,e,t);case"base64":return Bo(this,e, -t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Do(this,e,t);default: +(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( +this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Bo(this, +e,t);case"latin1":case"binary":return Lo(this,e,t);case"base64":return Io(this,e, +t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -_o,"slowToString");f.prototype._isBuffer=!0;function ve(r,e,t){let n=r[e];r[e]=r[t], +Eo,"slowToString");f.prototype._isBuffer=!0;function ve(r,e,t){let n=r[e];r[e]=r[t], r[t]=n}a(ve,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< e;t+=2)ve(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. @@ -123,7 +123,7 @@ f.prototype.swap64=a(function(){let e=this.length;if(e%8!==0)throw new RangeErro "Buffer size must be a multiple of 64-bits");for(let t=0;ti&&(n=i)):n=i;let s=e.length;n> s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)? (n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.wri\ te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return Ao(this,e,t,n);case"utf8":case"utf-8":return Co(this,e,t,n);case"asc\ -ii":case"latin1":case"binary":return To(this,e,t,n);case"base64":return Io(this, -e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Po(this,e,t,n);default: +hex":return vo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ +ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, +e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ write");f.prototype.toJSON=a(function(){return{type:"Buffer",data:Array.prototype. -slice.call(this._arr||this,0)}},"toJSON");function Bo(r,e,t){return e===0&&t===r. -length?Mt.fromByteArray(r):Mt.fromByteArray(r.slice(e,t))}a(Bo,"base64Slice");function qn(r,e,t){ +slice.call(this._arr||this,0)}},"toJSON");function Io(r,e,t){return e===0&&t===r. +length?Mt.fromByteArray(r):Mt.fromByteArray(r.slice(e,t))}a(Io,"base64Slice");function qn(r,e,t){ t=Math.min(r.length,t);let n=[],i=e;for(;i239?4:s>223? 3:s>191?2:1;if(i+u<=t){let c,h,l,d;switch(u){case 1:s<128&&(o=s);break;case 2:c= r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[i+ @@ -180,16 +180,16 @@ r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)=== 128&&(l&192)===128&&(d=(s&15)<<18|(c&63)<<12|(h&63)<<6|l&63,d>65535&&d<1114112&& (o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320| -o&1023),n.push(o),i+=u}return Lo(n)}a(qn,"utf8Slice");var Mn=4096;function Lo(r){ +o&1023),n.push(o),i+=u}return Po(n)}a(qn,"utf8Slice");var Mn=4096;function Po(r){ let e=r.length;if(e<=Mn)return String.fromCharCode.apply(String,r);let t="",n=0; -for(;nn)&&(t=n);let i="";for(let s=e;sn)&&(t=n);let i="";for(let s=e;sn&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t>>0, t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ readUInt32BE");f.prototype.readBigUInt64LE=me(a(function(e){e=e>>>0,Be(e,"offset"); -let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e,this.length-8);let i=t+ +let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Be(e,"offset");let t=this[e],n=this[e+7]; -(t===void 0||n===void 0)&&We(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* +(t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e],s=1,o=0;for(;++o>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ 1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=me(a(function(e){ -e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e, +e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Be(e,"offset"); -let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&We(e,this.length-8);let i=(t<< +let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,t||N(e,4,this.length),Pe.read(this,e, @@ -241,61 +241,61 @@ readFloatLE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),Pe.read(this,e, t||N(e,4,this.length),Pe.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= a(function(e,t){return e=e>>>0,t||N(e,8,this.length),Pe.read(this,e,!0,52,8)},"r\ eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||N(e,8,this. -length),Pe.read(this,e,!1,52,8)},"readDoubleBE");function Y(r,e,t,n,i,s){if(!f.isBuffer( +length),Pe.read(this,e,!1,52,8)},"readDoubleBE");function z(r,e,t,n,i,s){if(!f.isBuffer( r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e< s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError( -"Index out of range")}a(Y,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= -a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e, +"Index out of range")}a(z,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= +a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e, t,n,u,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e,t,n,u,0)}let s=n-1, +if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e,t,n,u,0)}let s=n-1, o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n},"writeUI\ ntBE");f.prototype.writeUint8=f.prototype.writeUInt8=a(function(e,t,n){return e= -+e,t=t>>>0,n||Y(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= -f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, ++e,t=t>>>0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= +f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, 65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},"writeUInt16LE");f.prototype.writeUint16BE= -f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, +f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, 65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},"writeUInt16BE");f.prototype.writeUint32LE= -f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,4, +f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,4, 4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+ 4},"writeUInt32LE");f.prototype.writeUint32BE=f.prototype.writeUInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, +return e=+e,t=t>>>0,n||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function Qn(r,e,t,n,i){$n( e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8, r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]= -o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Qn,"wrtBigUInt64LE");function jn(r,e,t,n,i){ +o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Qn,"wrtBigUInt64LE");function Wn(r,e,t,n,i){ $n(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> 8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+ -3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(jn,"wrtBigUInt64BE");f. +3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(Wn,"wrtBigUInt64BE");f. prototype.writeBigUInt64LE=me(a(function(e,t=0){return Qn(this,e,t,BigInt(0),BigInt( "0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=me(a(function(e,t=0){ -return jn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); +return Wn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); f.prototype.writeIntLE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2, -8*n-1);Y(this,e,t,n,c-1,-c)}let s=0,o=1,u=0;for(this[t]=e&255;++s>0)-u&255;return t+n},"writeIntL\ E");f.prototype.writeIntBE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow( -2,8*n-1);Y(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= +2,8*n-1);z(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= 256);)e<0&&u===0&&this[t+s+1]!==0&&(u=1),this[t+s]=(e/o>>0)-u&255;return t+n},"w\ -riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this, +riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this, e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},"writeInt8");f.prototype.writeInt16LE= -a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e&255, +a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e&255, this[t+1]=e>>>8,t+2},"writeInt16LE");f.prototype.writeInt16BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, +return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, t+2},"writeInt16BE");f.prototype.writeInt32LE=a(function(e,t,n){return e=+e,t=t>>> -0,n||Y(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= +0,n||z(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= e>>>16,this[t+3]=e>>>24,t+4},"writeInt32LE");f.prototype.writeInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ +return e=+e,t=t>>>0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ 1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeIn\ t32BE");f.prototype.writeBigInt64LE=me(a(function(e,t=0){return Qn(this,e,t,-BigInt( "0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));f.prototype. -writeBigInt64BE=me(a(function(e,t=0){return jn(this,e,t,-BigInt("0x8000000000000\ -000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Wn(r,e,t,n,i,s){ +writeBigInt64BE=me(a(function(e,t=0){return Wn(this,e,t,-BigInt("0x8000000000000\ +000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function jn(r,e,t,n,i,s){ if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError( -"Index out of range")}a(Wn,"checkIEEE754");function Hn(r,e,t,n,i){return e=+e,t= -t>>>0,i||Wn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Pe.write(r,e,t,n, +"Index out of range")}a(jn,"checkIEEE754");function Hn(r,e,t,n,i){return e=+e,t= +t>>>0,i||jn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Pe.write(r,e,t,n, 23,4),t+4}a(Hn,"writeFloat");f.prototype.writeFloatLE=a(function(e,t,n){return Hn( this,e,t,!0,n)},"writeFloatLE");f.prototype.writeFloatBE=a(function(e,t,n){return Hn( -this,e,t,!1,n)},"writeFloatBE");function Gn(r,e,t,n,i){return e=+e,t=t>>>0,i||Wn( +this,e,t,!1,n)},"writeFloatBE");function Gn(r,e,t,n,i){return e=+e,t=t>>>0,i||jn( r,e,t,8,17976931348623157e292,-17976931348623157e292),Pe.write(r,e,t,n,52,8),t+8} a(Gn,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return Gn(this,e, t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return Gn( @@ -327,22 +327,22 @@ a(n,"NodeError"),n)}a(qt,"E");qt("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r ds"},RangeError);qt("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argum\ ent must be of type number. Received type ${typeof e}`},TypeError);qt("ERR_OUT_O\ F_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number. -isInteger(t)&&Math.abs(t)>2**32?i=Dn(String(t)):typeof t=="bigint"&&(i=String(t), -(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Dn(i)),i+="n"),n+=` It\ - must be ${e}. Received ${i}`,n},RangeError);function Dn(r){let e="",t=r.length, +isInteger(t)&&Math.abs(t)>2**32?i=kn(String(t)):typeof t=="bigint"&&(i=String(t), +(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=kn(i)),i+="n"),n+=` It\ + must be ${e}. Received ${i}`,n},RangeError);function kn(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(Dn,"addNumericalSeparator");function ko(r,e,t){Be(e,"offset"),(r[e]=== -void 0||r[e+t]===void 0)&&We(e,r.length-(t+1))}a(ko,"checkBounds");function $n(r,e,t,n,i,s){ +t)}${e}`}a(kn,"addNumericalSeparator");function Mo(r,e,t){Be(e,"offset"),(r[e]=== +void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function $n(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Ie.ERR_OUT_OF_RANGE( -"value",u,r)}ko(n,i,s)}a($n,"checkIntBI");function Be(r,e){if(typeof r!="number") -throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Be,"validateNumber");function We(r,e,t){ +"value",u,r)}Mo(n,i,s)}a($n,"checkIntBI");function Be(r,e){if(typeof r!="number") +throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Be,"validateNumber");function je(r,e,t){ throw Math.floor(r)!==r?(Be(r,t),new Ie.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Ie.ERR_BUFFER_OUT_OF_BOUNDS:new Ie.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? -1:0} and <= ${e}`,r)}a(We,"boundsError");var Uo=/[^+/0-9A-Za-z-_]/g;function Oo(r){ -if(r=r.split("=")[0],r=r.trim().replace(Uo,""),r.length<2)return"";for(;r.length% -4!==0;)r=r+"=";return r}a(Oo,"base64clean");function Ut(r,e){e=e||1/0;let t,n=r. +1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ +if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% +4!==0;)r=r+"=";return r}a(Do,"base64clean");function Ut(r,e){e=e||1/0;let t,n=r. length,i=null,s=[];for(let o=0;o55295&&t<57344){if(!i){ if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&& s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, @@ -351,31 +351,31 @@ s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>> 6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63| 128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}a( -Ut,"utf8ToBytes");function No(r){let e=[];for(let t=0;t>8,i=t%256,s.push(i),s.push(n);return s} -a(qo,"utf16leToBytes");function Vn(r){return Mt.toByteArray(Oo(r))}a(Vn,"base64T\ +a(Oo,"utf16leToBytes");function Vn(r){return Mt.toByteArray(Do(r))}a(Vn,"base64T\ oBytes");function at(r,e,t,n){let i;for(i=0;i=e.length||i>=r.length);++i) e[i+t]=r[i];return i}a(at,"blitBuffer");function ue(r,e){return r instanceof e|| r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name} -a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var Qo=function(){ +a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var No=function(){ let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< -16;++i)e[n+i]=r[t]+r[i]}return e}();function me(r){return typeof BigInt>"u"?jo:r} -a(me,"defineBigIntMethod");function jo(){throw new Error("BigInt not supported")} -a(jo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=z(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +16;++i)e[n+i]=r[t]+r[i]}return e}();function me(r){return typeof BigInt>"u"?qo:r} +a(me,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} +a(qo,"BufferBigIntNotDefined")});var S,x,v,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. Buffer.allocUnsafe=="function"?globalThis.Buffer:Kn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= -e.then.bind(e)}});var ge=I((nh,jt)=>{"use strict";p();var Re=typeof Reflect=="object"?Reflect:null, +e.then.bind(e)}});var ge=I((th,Wt)=>{"use strict";p();var Re=typeof Reflect=="object"?Reflect:null, zn=Re&&typeof Re.apply=="function"?Re.apply:a(function(e,t,n){return Function.prototype. apply.call(e,t,n)},"ReflectApply"),ut;Re&&typeof Re.ownKeys=="function"?ut=Re.ownKeys: Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. -getOwnPropertyNames(e)},"ReflectOwnKeys");function Wo(r){console&&console.warn&& -console.warn(r)}a(Wo,"ProcessEmitWarning");var Zn=Number.isNaN||a(function(e){return e!== -e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");jt.exports= -L;jt.exports.once=Vo;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= +getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& +console.warn(r)}a(Qo,"ProcessEmitWarning");var Zn=Number.isNaN||a(function(e){return e!== +e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");Wt.exports= +L;Wt.exports.once=Go;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= 0;L.prototype._maxListeners=void 0;var Yn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(L,"defaultMaxLi\ @@ -402,14 +402,14 @@ t,++r._eventsCount;else if(typeof o=="function"?o=s[e]=n?[t,o]:[o,t]:n?o.unshift t):o.push(t),i=Jn(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po\ ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ -ededWarning",u.emitter=r,u.type=e,u.count=o.length,Wo(u)}return r}a(Xn,"_addList\ +ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(Xn,"_addList\ ener");L.prototype.addListener=a(function(e,t){return Xn(this,e,t,!1)},"addListe\ ner");L.prototype.on=L.prototype.addListener;L.prototype.prependListener=a(function(e,t){ -return Xn(this,e,t,!0)},"prependListener");function Ho(){if(!this.fired)return this. +return Xn(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? -this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Ho, +this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, "onceWrapper");function ei(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Ho.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");L.prototype. +listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");L.prototype. once=a(function(e,t){return ct(t),this.on(e,ei(this,e,t)),this},"once");L.prototype. prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ei(this, e,t)),this},"prependOnceListener");L.prototype.removeListener=a(function(e,t){var n, @@ -417,7 +417,7 @@ i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)retu if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. -listener,s=o;break}if(s<0)return this;s===0?n.shift():Go(n,s),n.length===1&&(i[e]= +listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, "removeListener");L.prototype.off=L.prototype.removeListener;L.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== @@ -429,7 +429,7 @@ o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners( n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length- 1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ti(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?$o(i):ni(i,i.length)}a(ti,"_listeners");L.prototype. +"function"?t?[i.listener||i]:[i]:t?Ho(i):ni(i,i.length)}a(ti,"_listeners");L.prototype. listeners=a(function(e){return ti(this,e,!0)},"listeners");L.prototype.rawListeners= a(function(e){return ti(this,e,!1)},"rawListeners");L.listenerCount=function(r,e){ return typeof r.listenerCount=="function"?r.listenerCount(e):ri.call(r,e)};L.prototype. @@ -437,49 +437,62 @@ listenerCount=ri;function ri(r){var e=this._events;if(e!==void 0){var t=e[r];if( "function")return 1;if(t!==void 0)return t.length}return 0}a(ri,"listenerCount"); L.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): []},"eventNames");function ni(r,e){for(var t=new Array(e),n=0;nzo});var zo,Ge=z(()=>{"use strict";p();zo={}});function $e(r){let e=1779033703,t=3144134277,n=1013904242,i=2773480762,s=1359893119, -o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,3049323471, -3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278, -1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078, -604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808, -3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372, -1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800, -3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, -883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, -2361852424,2428436474,2756734187,3204031479,3329325298],b=a((A,g)=>A>>>g|A<<32-g, -"rrot"),C=new Uint32Array(64),B=new Uint8Array(64),Q=a(()=>{for(let R=0,$=0;R<16;R++, -$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+3];for(let R=16;R<64;R++){let $=b(C[R- -15],7)^b(C[R-15],18)^C[R-15]>>>3,ce=b(C[R-2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R- -16]+$+C[R-7]+ce|0}let A=e,g=t,P=n,K=i,k=s,j=o,ee=u,oe=c;for(let R=0;R<64;R++){let $=b( -k,6)^b(k,11)^b(k,25),ce=k&j^~k&ee,ye=oe+$+ce+d[R]+C[R]|0,Se=b(A,2)^b(A,13)^b(A,22), -je=A&g^A&P^g&P,he=Se+je|0;oe=ee,ee=j,j=k,k=K+ye|0,K=P,P=g,g=A,A=ye+he|0}e=e+A|0, -t=t+g|0,n=n+P|0,i=i+K|0,s=s+k|0,o=o+j|0,u=u+ee|0,c=c+oe|0,l=0},"process"),X=a(A=>{ -typeof A=="string"&&(A=new TextEncoder().encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){ -for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]=0;let A=h*8;B[l++]=A/1099511627776&255, -B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]=A>>>16&255,B[l++]=A>>>8&255,B[l++]= -A&255,Q();let g=new Uint8Array(32);return g[0]=e>>>24,g[1]=e>>>16&255,g[2]=e>>>8& -255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]=t>>>8&255,g[7]=t&255,g[8]=n>>>24, -g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]=i>>>24,g[13]=i>>>16&255,g[14]= -i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, -g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> -16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, -g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:de}:(X(r),de())}var si=z( -()=>{"use strict";p();a($e,"sha256")});var U,Ve,oi=z(()=>{"use strict";p();U=class U{constructor(){_(this,"_dataLength", -0);_(this,"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer", -new ArrayBuffer(68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array( -this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ +ed type '+typeof r)}a(ii,"eventTargetAgnosticAddListener")});var He={};se(He,{default:()=>Vo});var Vo,Ge=te(()=>{"use strict";p();Vo={}});var jt={};se(jt,{Md5:()=>Ve,createHash:()=>zo,createHmac:()=>Yo,randomBytes:()=>Ko, +sha256:()=>$e});function Ko(r){return w.getRandomValues(y.alloc(r))}function zo(r){ +if(r==="sha256")return{update:a(function(e){return{digest:a(function(){return y. +from($e(e))},"digest")}},"update")};if(r==="md5")return{update:a(function(e){return{ +digest:a(function(){return typeof e=="string"?Ve.hashStr(e):Ve.hashByteArray(e)}, +"digest")}},"update")};throw new Error(`Hash type '${r}' not supported`)}function Yo(r,e){ +if(r!=="sha256")throw new Error(`Only sha256 is supported (requested: '${r}')`); +return{update:a(function(t){return{digest:a(function(){typeof e=="string"&&(e=new TextEncoder(). +encode(e)),typeof t=="string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n> +64)e=$e(e);else if(n<64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array( +64),s=new Uint8Array(64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array( +t.length+64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u. +set($e(o),64),y.from($e(u))},"digest")}},"update")}}function $e(r){let e=1779033703, +t=3144134277,n=1013904242,i=2773480762,s=1359893119,o=2600822924,u=528734635,c=1541459225, +h=0,l=0,d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748, +2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103, +3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692, +1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993, +338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, +2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909, +275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063, +1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479, +3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),B=new Uint8Array( +64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+ +3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,ce=b(C[R- +2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+ce|0}let A=e,g=t,P=n,K=i,D=s, +W=o,X=u,oe=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),ce=D&W^~D&X,ye=oe+ +$+ce+d[R]+C[R]|0,Se=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,he=Se+We|0;oe=X,X=W,W= +D,D=K+ye|0,K=P,P=g,g=A,A=ye+he|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, +u=u+X|0,c=c+oe|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). +encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]= +0;let A=h*8;B[l++]=A/1099511627776&255,B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]= +A>>>16&255,B[l++]=A>>>8&255,B[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= +e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= +t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= +i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, +g[18]=s>>>8&255,g[19]=s&255,g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]= +o&255,g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]= +c>>>16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r===void 0?{add:J,digest:de}: +(J(r),de())}var U,Ve,Ht=te(()=>{"use strict";p();a(Ko,"randomBytes");a(zo,"creat\ +eHash");a(Yo,"createHmac");U=class U{constructor(){_(this,"_dataLength",0);_(this, +"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer",new ArrayBuffer( +68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array(this._buffer, +0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=U. @@ -553,21 +566,8 @@ u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return U._md5cycle(this._state,i e?this._state:U._hex(this._state)}};a(U,"Md5"),_(U,"stateIdentity",new Int32Array( [1732584193,-271733879,-1732584194,271733878])),_(U,"buffer32Identity",new Int32Array( [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(U,"hexChars","0123456789abcdef"),_(U,"hexO\ -ut",[]),_(U,"onePassHasher",new U);Ve=U});var Wt={};se(Wt,{createHash:()=>Zo,createHmac:()=>Jo,randomBytes:()=>Yo});function Yo(r){ -return w.getRandomValues(y.alloc(r))}function Zo(r){if(r==="sha256")return{update:a( -function(e){return{digest:a(function(){return y.from($e(e))},"digest")}},"update")}; -if(r==="md5")return{update:a(function(e){return{digest:a(function(){return typeof e== -"string"?Ve.hashStr(e):Ve.hashByteArray(e)},"digest")}},"update")};throw new Error( -`Hash type '${r}' not supported`)}function Jo(r,e){if(r!=="sha256")throw new Error( -`Only sha256 is supported (requested: '${r}')`);return{update:a(function(t){return{ -digest:a(function(){typeof e=="string"&&(e=new TextEncoder().encode(e)),typeof t== -"string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n>64)e=$e(e);else if(n< -64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array(64),s=new Uint8Array( -64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array(t.length+ -64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u.set($e(o), -64),y.from($e(u))},"digest")}},"update")}}var Ht=z(()=>{"use strict";p();si();oi(); -a(Yo,"randomBytes");a(Zo,"createHash");a(Jo,"createHmac")});var $t=I(ai=>{"use strict";p();ai.parse=function(r,e){return new Gt(r,e).parse()}; -var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Xo,this.position= +ut",[]),_(U,"onePassHasher",new U);Ve=U;a($e,"sha256")});var $t=I(si=>{"use strict";p();si.parse=function(r,e){return new Gt(r,e).parse()}; +var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Zo,this.position= 0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>= this.source.length}nextCharacter(){var e=this.source[this.position++];return e=== "\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){ @@ -581,97 +581,97 @@ n.parse(!0)),this.position+=n.position-2);else if(t.value==="}"&&!i){if(this.dim !this.dimension&&(this.newEntry(),e))return this.entries}else t.value==='"'&&!t. escaped?(i&&this.newEntry(!0),i=!i):t.value===","&&!i?this.newEntry():this.record( t.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this. -entries}};a(ht,"ArrayParser");var Gt=ht;function Xo(r){return r}a(Xo,"identity")});var Vt=I((Sh,ui)=>{p();var ea=$t();ui.exports={create:a(function(r,e){return{parse:a( -function(){return ea.parse(r,e)},"parse")}},"create")}});var li=I((vh,hi)=>{"use strict";p();var ta=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, -ra=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,na=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ia=/^-?infinity$/; -hi.exports=a(function(e){if(ia.test(e))return Number(e.replace("i","I"));var t=ta. -exec(e);if(!t)return sa(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=ci(i));var s=parseInt( +entries}};a(ht,"ArrayParser");var Gt=ht;function Zo(r){return r}a(Zo,"identity")});var Vt=I((hh,oi)=>{p();var Jo=$t();oi.exports={create:a(function(r,e){return{parse:a( +function(){return Jo.parse(r,e)},"parse")}},"create")}});var ci=I((ph,ui)=>{"use strict";p();var Xo=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, +ea=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ta=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ra=/^-?infinity$/; +ui.exports=a(function(e){if(ra.test(e))return Number(e.replace("i","I"));var t=Xo. +exec(e);if(!t)return na(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=ai(i));var s=parseInt( t[2],10)-1,o=t[3],u=parseInt(t[4],10),c=parseInt(t[5],10),h=parseInt(t[6],10),l=t[7]; -l=l?1e3*parseFloat(l):0;var d,b=oa(e);return b!=null?(d=new Date(Date.UTC(i,s,o, +l=l?1e3*parseFloat(l):0;var d,b=ia(e);return b!=null?(d=new Date(Date.UTC(i,s,o, u,c,h,l)),Kt(i)&&d.setUTCFullYear(i),b!==0&&d.setTime(d.getTime()-b)):(d=new Date( -i,s,o,u,c,h,l),Kt(i)&&d.setFullYear(i)),d},"parseDate");function sa(r){var e=ra. -exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=ci(t));var i=parseInt(e[2], -10)-1,s=e[3],o=new Date(t,i,s);return Kt(t)&&o.setFullYear(t),o}}a(sa,"getDate"); -function oa(r){if(r.endsWith("+00"))return 0;var e=na.exec(r.split(" ")[1]);if(e){ +i,s,o,u,c,h,l),Kt(i)&&d.setFullYear(i)),d},"parseDate");function na(r){var e=ea. +exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=ai(t));var i=parseInt(e[2], +10)-1,s=e[3],o=new Date(t,i,s);return Kt(t)&&o.setFullYear(t),o}}a(na,"getDate"); +function ia(r){if(r.endsWith("+00"))return 0;var e=ta.exec(r.split(" ")[1]);if(e){ var t=e[1];if(t==="Z")return 0;var n=t==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt( -e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(oa,"timeZoneOffset");function ci(r){ -return-(r-1)}a(ci,"bcYearToNegativeYear");function Kt(r){return r>=0&&r<100}a(Kt, -"is0To99")});var pi=I((Ch,fi)=>{p();fi.exports=ua;var aa=Object.prototype.hasOwnProperty;function ua(r){ -for(var e=1;e{"use strict";p();var ca=pi();yi.exports=Fe;function Fe(r){if(!(this instanceof -Fe))return new Fe(r);ca(this,xa(r))}a(Fe,"PostgresInterval");var ha=["seconds","\ -minutes","hours","days","months","years"];Fe.prototype.toPostgres=function(){var r=ha. +e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(ia,"timeZoneOffset");function ai(r){ +return-(r-1)}a(ai,"bcYearToNegativeYear");function Kt(r){return r>=0&&r<100}a(Kt, +"is0To99")});var li=I((mh,hi)=>{p();hi.exports=oa;var sa=Object.prototype.hasOwnProperty;function oa(r){ +for(var e=1;e{"use strict";p();var aa=li();pi.exports=Fe;function Fe(r){if(!(this instanceof +Fe))return new Fe(r);aa(this,ba(r))}a(Fe,"PostgresInterval");var ua=["seconds","\ +minutes","hours","days","months","years"];Fe.prototype.toPostgres=function(){var r=ua. filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")< 0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e=== "seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/, -"")),t+" "+e},this).join(" ")};var la={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ -M",seconds:"S"},fa=["years","months","days"],pa=["hours","minutes","seconds"];Fe. -prototype.toISOString=Fe.prototype.toISO=function(){var r=fa.map(t,this).join(""), -e=pa.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== +"")),t+" "+e},this).join(" ")};var ca={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ +M",seconds:"S"},ha=["years","months","days"],la=["hours","minutes","seconds"];Fe. +prototype.toISOString=Fe.prototype.toISO=function(){var r=ha.map(t,this).join(""), +e=la.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== "seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/, -"")),i+la[n]}};var zt="([+-]?\\d+)",da=zt+"\\s+years?",ya=zt+"\\s+mons?",ma=zt+"\ -\\s+days?",ga="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",wa=new RegExp([ -da,ya,ma,ga].map(function(r){return"("+r+")?"}).join("\\s*")),di={years:2,months:4, -days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ba=["hours","minutes","sec\ -onds","milliseconds"];function Sa(r){var e=r+"000000".slice(r.length);return parseInt( -e,10)/1e3}a(Sa,"parseMilliseconds");function xa(r){if(!r)return{};var e=wa.exec( -r),t=e[8]==="-";return Object.keys(di).reduce(function(n,i){var s=di[i],o=e[s];return!o|| -(o=i==="milliseconds"?Sa(o):parseInt(o,10),!o)||(t&&~ba.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(xa,"parse")});var wi=I((Rh,gi)=>{"use strict";p();gi.exports=a(function(e){if(/^\\x/.test(e))return new y( +"")),i+ca[n]}};var zt="([+-]?\\d+)",fa=zt+"\\s+years?",pa=zt+"\\s+mons?",da=zt+"\ +\\s+days?",ya="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",ma=new RegExp([ +fa,pa,da,ya].map(function(r){return"("+r+")?"}).join("\\s*")),fi={years:2,months:4, +days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ga=["hours","minutes","sec\ +onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return parseInt( +e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( +r),t=e[8]==="-";return Object.keys(fi).reduce(function(n,i){var s=fi[i],o=e[s];return!o|| +(o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= +o),n},{})}a(ba,"parse")});var mi=I((Eh,yi)=>{"use strict";p();yi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=$t(),ze=Vt(),lt=li(),Si=mi(),xi=wi();function ft(r){ -return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Ei(r){ +"\\";n+=Math.floor(i/2)*2}return new y(t,"binary")},"parseBytea")});var vi=I((Ah,Ei)=>{p();var Ke=$t(),ze=Vt(),lt=ci(),wi=di(),bi=mi();function ft(r){ +return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Si(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| -r==="1"}a(Ei,"parseBool");function Ea(r){return r?Ke.parse(r,Ei):null}a(Ea,"pars\ -eBoolArray");function va(r){return parseInt(r,10)}a(va,"parseBaseTenInt");function Yt(r){ -return r?Ke.parse(r,ft(va)):null}a(Yt,"parseIntegerArray");function _a(r){return r? -Ke.parse(r,ft(function(e){return vi(e).trim()})):null}a(_a,"parseBigIntegerArray"); -var Aa=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +r==="1"}a(Si,"parseBool");function Sa(r){return r?Ke.parse(r,Si):null}a(Sa,"pars\ +eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Yt(r){ +return r?Ke.parse(r,ft(xa)):null}a(Yt,"parseIntegerArray");function Ea(r){return r? +Ke.parse(r,ft(function(e){return xi(e).trim()})):null}a(Ea,"parseBigIntegerArray"); +var va=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=er(t)),t});return e.parse()},"parsePointArray"),Zt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); return e.parse()},"parseFloatArray"),ne=a(function(r){if(!r)return null;var e=ze. create(r);return e.parse()},"parseStringArray"),Jt=a(function(r){if(!r)return null; var e=ze.create(r,function(t){return t!==null&&(t=lt(t)),t});return e.parse()},"\ -parseDateArray"),Ca=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ -return t!==null&&(t=Si(t)),t});return e.parse()},"parseIntervalArray"),Ta=a(function(r){ -return r?Ke.parse(r,ft(xi)):null},"parseByteAArray"),Xt=a(function(r){return parseInt( -r,10)},"parseInteger"),vi=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: -r},"parseBigInteger"),bi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, +parseDateArray"),_a=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ +return t!==null&&(t=wi(t)),t});return e.parse()},"parseIntervalArray"),Aa=a(function(r){ +return r?Ke.parse(r,ft(bi)):null},"parseByteAArray"),Xt=a(function(r){return parseInt( +r,10)},"parseInteger"),xi=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: +r},"parseBigInteger"),gi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, "parseJsonArray"),er=a(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- -1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ia=a(function(r){ +1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ca=a(function(r){ if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i{"use strict";p();var Z=1e6;function Ba(r){var e=r.readInt32BE( +Jt),r(1185,Jt),r(1186,wi),r(1187,_a),r(17,bi),r(114,JSON.parse.bind(JSON)),r(3802, +JSON.parse.bind(JSON)),r(199,gi),r(3807,gi),r(3907,ne),r(2951,ne),r(791,ne),r(1183, +ne),r(1270,ne)},"init");Ei.exports={init:Ta}});var Ai=I((Ih,_i)=>{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,o,u, -c,h,l;{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+ -u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* -s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< -h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), +c,h,l;{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+ +u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* +s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< +h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var La=Ti(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ +e%Y,o=4294967296*s+t,u=""+o%Y,n+u+i}a(Ia,"readInt8");_i.exports=Ia});var Bi=I((Lh,Pi)=>{p();var Pa=Ai(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ return C*Math.pow(2,Q)+B};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& -(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Bi=a(function(r,e,t){var n=Math.pow(2,t- +(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Ii=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= 1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ra=a(function(r){return F(r,1)==1?-1* -(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ii=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Fa=a(function(r){return Bi(r,23,8)},"pars\ -eFloat32"),Ma=a(function(r){return Bi(r,52,11)},"parseFloat64"),Da=a(function(r){ +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ba=a(function(r){return F(r,1)==1?-1* +(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ci=a(function(r){return F(r,1)==1?-1*(F( +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),La=a(function(r){return Ii(r,23,8)},"pars\ +eFloat32"),Ra=a(function(r){return Ii(r,52,11)},"parseFloat64"),Fa=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o>3,(i+=l<<3)>>3 d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ var d=[],b;if(h.length>1){var C=h.shift();for(b=0;b0},"parseBool"),Oa=a(function(r){r(20,La),r(21,Ra),r(23,Ii),r(26, -Ii),r(1700,Da),r(700,Fa),r(701,Ma),r(16,Ua),r(1114,Pi.bind(null,!1)),r(1184,Pi.bind( -null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,ka)},"init"); -Li.exports={init:Oa}});var Mi=I((Hh,Fi)=>{p();Fi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +ay"),Ma=a(function(r){return r.toString("utf8")},"parseText"),ka=a(function(r){return r=== +null?null:F(r,8)>0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,Ba),r(23,Ci),r(26, +Ci),r(1700,Fa),r(700,La),r(701,Ra),r(16,ka),r(1114,Ti.bind(null,!1)),r(1184,Ti.bind( +null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); +Pi.exports={init:Da}});var Ri=I((Mh,Li)=>{p();Li.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -694,157 +694,157 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Na=Ai(),qa=Ri(),Qa=Vt(),ja=Mi();Je.getTypeParser=Wa;Je.setTypeParser= -Ha;Je.arrayParser=Qa;Je.builtins=ja;var Ze={text:{},binary:{}};function Di(r){return String( -r)}a(Di,"noParse");function Wa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Di}a(Wa, -"getTypeParser");function Ha(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= -t}a(Ha,"setTypeParser");Na.init(function(r,e){Ze.text[r]=e});qa.init(function(r,e){ -Ze.binary[r]=e})});var et=I((zh,tr)=>{"use strict";p();tr.exports={host:"localhost",user:m.platform=== +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=vi(),Oa=Bi(),Na=Vt(),qa=Ri();Je.getTypeParser=Qa;Je.setTypeParser= +Wa;Je.arrayParser=Na;Je.builtins=qa;var Ze={text:{},binary:{}};function Fi(r){return String( +r)}a(Fi,"noParse");function Qa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Fi}a(Qa, +"getTypeParser");function Wa(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= +t}a(Wa,"setTypeParser");Ua.init(function(r,e){Ze.text[r]=e});Oa.init(function(r,e){ +Ze.binary[r]=e})});var et=I((Nh,tr)=>{"use strict";p();tr.exports={host:"localhost",user:m.platform=== "win32"?m.env.USERNAME:m.env.USER,database:void 0,password:null,connectionString:void 0, port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1, application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1, statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1, -connect_timeout:0,keepalives:1,keepalives_idle:0};var Me=Xe(),Ga=Me.getTypeParser( -20,"text"),$a=Me.getTypeParser(1016,"text");tr.exports.__defineSetter__("parseIn\ -t8",function(r){Me.setTypeParser(20,"text",r?Me.getTypeParser(23,"text"):Ga),Me. -setTypeParser(1016,"text",r?Me.getTypeParser(1007,"text"):$a)})});var tt=I((Zh,Ui)=>{"use strict";p();var Va=(Ht(),O(Wt)),Ka=et();function za(r){var e=r. -replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(za,"escapeElement"); -function ki(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> -"u"?e=e+"NULL":Array.isArray(r[t])?e=e+ki(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. -toString("hex"):e+=za(pt(r[t]));return e=e+"}",e}a(ki,"arrayString");var pt=a(function(r,e){ +connect_timeout:0,keepalives:1,keepalives_idle:0};var Me=Xe(),ja=Me.getTypeParser( +20,"text"),Ha=Me.getTypeParser(1016,"text");tr.exports.__defineSetter__("parseIn\ +t8",function(r){Me.setTypeParser(20,"text",r?Me.getTypeParser(23,"text"):ja),Me. +setTypeParser(1016,"text",r?Me.getTypeParser(1007,"text"):Ha)})});var tt=I((Qh,ki)=>{"use strict";p();var Ga=(Ht(),O(jt)),$a=et();function Va(r){var e=r. +replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Va,"escapeElement"); +function Mi(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> +"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Mi(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. +toString("hex"):e+=Va(pt(r[t]));return e=e+"}",e}a(Mi,"arrayString");var pt=a(function(r,e){ if(r==null)return null;if(r instanceof y)return r;if(ArrayBuffer.isView(r)){var t=y. from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice( -r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?Ka.parseInputDatesAsUTC? -Ja(r):Za(r):Array.isArray(r)?ki(r):typeof r=="object"?Ya(r,e):r.toString()},"pre\ -pareValue");function Ya(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. +r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?$a.parseInputDatesAsUTC? +Ya(r):za(r):Array.isArray(r)?Mi(r):typeof r=="object"?Ka(r,e):r.toString()},"pre\ +pareValue");function Ka(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+ r+'" for query');return e.push(r),pt(r.toPostgres(pt),e)}return JSON.stringify(r)} -a(Ya,"prepareObject");function G(r,e){for(r=""+r;r.length{"use strict";p();var nr=(Ht(),O(Wt));function tu(r){if(r.indexOf( +G(r.getUTCMilliseconds(),3);return n+="+00:00",t&&(n+=" BC"),n}a(Ya,"dateToStrin\ +gUTC");function Za(r,e,t){return r=typeof r=="string"?{text:r}:r,e&&(typeof e=="\ +function"?r.callback=e:r.values=e),t&&(r.callback=t),r}a(Za,"normalizeQueryConfi\ +g");var rr=a(function(r){return Ga.createHash("md5").update(r,"utf-8").digest("h\ +ex")},"md5"),Ja=a(function(r,e,t){var n=rr(e+r),i=rr(y.concat([y.from(n),t]));return"\ +md5"+i},"postgresMd5PasswordHash");ki.exports={prepareValue:a(function(e){return pt( +e)},"prepareValueWrapper"),normalizeQueryConfig:Za,postgresMd5PasswordHash:Ja,md5:rr}});var qi=I((Hh,Ni)=>{"use strict";p();var nr=(Ht(),O(jt));function Xa(r){if(r.indexOf( "SCRAM-SHA-256")===-1)throw new Error("SASL: Only mechanism SCRAM-SHA-256 is cur\ rently supported");let e=nr.randomBytes(18).toString("base64");return{mechanism:"\ SCRAM-SHA-256",clientNonce:e,response:"n,,n=*,r="+e,message:"SASLInitialResponse"}} -a(tu,"startSession");function ru(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( +a(Xa,"startSession");function eu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( "SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(typeof t!= "string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a\ - string");let n=su(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== + string");let n=nu(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n\ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ -er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=uu(e, -i,n.iteration),o=De(s,"Client Key"),u=au(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=De(u,d),C=qi( -o,b),B=C.toString("base64"),Q=De(s,"Server Key"),X=De(Q,d);r.message="SASLRespon\ -se",r.serverSignature=X.toString("base64"),r.response=l+",p="+B}a(ru,"continueSe\ -ssion");function nu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ +er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, +i,n.iteration),o=ke(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=ke(u,d),C=Oi( +o,b),B=C.toString("base64"),Q=ke(s,"Server Key"),J=ke(Q,d);r.message="SASLRespon\ +se",r.serverSignature=J.toString("base64"),r.response=l+",p="+B}a(eu,"continueSe\ +ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ -CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=ou( +CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: s\ -erver signature does not match")}a(nu,"finalizeSession");function iu(r){if(typeof r!= +erver signature does not match")}a(tu,"finalizeSession");function ru(r){if(typeof r!= "string")throw new TypeError("SASL: text must be a string");return r.split("").map( -(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(iu,"isPrintableC\ -hars");function Oi(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(r)}a(Oi,"isBase64");function Ni(r){if(typeof r!="string")throw new TypeError( +(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(ru,"isPrintableC\ +hars");function Di(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(r)}a(Di,"isBase64");function Ui(r){if(typeof r!="string")throw new TypeError( "SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{ if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0], -n=e.substring(2);return[t,n]}))}a(Ni,"parseAttributePairs");function su(r){let e=Ni( -r),t=e.get("r");if(t){if(!iu(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ +n=e.substring(2);return[t,n]}))}a(Ui,"parseAttributePairs");function nu(r){let e=Ui( +r),t=e.get("r");if(t){if(!ru(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ E: nonce must only contain printable characters")}else throw new Error("SASL: SC\ -RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Oi(n))throw new Error( +RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Di(n))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("S\ ASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/. test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration cou\ nt")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); -let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(su,"parseServerFirstMe\ -ssage");function ou(r){let t=Ni(r).get("v");if(t){if(!Oi(t))throw new Error("SAS\ +let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(nu,"parseServerFirstMe\ +ssage");function iu(r){let t=Ui(r).get("v");if(t){if(!Di(t))throw new Error("SAS\ L: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error( "SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}} -a(ou,"parseServerFinalMessage");function qi(r,e){if(!y.isBuffer(r))throw new TypeError( +a(iu,"parseServerFinalMessage");function Oi(r,e){if(!y.isBuffer(r))throw new TypeError( "first argument must be a Buffer");if(!y.isBuffer(e))throw new TypeError("second\ argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer leng\ ths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return y. -from(r.map((t,n)=>r[n]^e[n]))}a(qi,"xorBuffers");function au(r){return nr.createHash( -"sha256").update(r).digest()}a(au,"sha256");function De(r,e){return nr.createHmac( -"sha256",r).update(e).digest()}a(De,"hmacSha256");function uu(r,e,t){for(var n=De( -r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;scu});function cu(...r){return r.join("/")}var sr=z(()=>{ -"use strict";p();a(cu,"join")});var or={};se(or,{stat:()=>hu});function hu(r,e){e(new Error("No filesystem"))}var ar=z( -()=>{"use strict";p();a(hu,"stat")});var ur={};se(ur,{default:()=>lu});var lu,cr=z(()=>{"use strict";p();lu={}});var Wi={};se(Wi,{StringDecoder:()=>hr});var lr,hr,Hi=z(()=>{"use strict";p();lr= +from(r.map((t,n)=>r[n]^e[n]))}a(Oi,"xorBuffers");function su(r){return nr.createHash( +"sha256").update(r).digest()}a(su,"sha256");function ke(r,e){return nr.createHmac( +"sha256",r).update(e).digest()}a(ke,"hmacSha256");function ou(r,e,t){for(var n=ke( +r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;sau});function au(...r){return r.join("/")}var sr=te(()=>{ +"use strict";p();a(au,"join")});var or={};se(or,{stat:()=>uu});function uu(r,e){e(new Error("No filesystem"))}var ar=te( +()=>{"use strict";p();a(uu,"stat")});var ur={};se(ur,{default:()=>cu});var cu,cr=te(()=>{"use strict";p();cu={}});var Qi={};se(Qi,{StringDecoder:()=>hr});var lr,hr,Wi=te(()=>{"use strict";p();lr= class lr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(lr,"StringDecoder"); -hr=lr});var Ki=I((hl,Vi)=>{"use strict";p();var{Transform:fu}=(cr(),O(ur)),{StringDecoder:pu}=(Hi(),O(Wi)), -we=Symbol("last"),dt=Symbol("decoder");function du(r,e,t){let n;if(this.overflow){ +hr=lr});var $i=I((el,Gi)=>{"use strict";p();var{Transform:hu}=(cr(),O(ur)),{StringDecoder:lu}=(Wi(),O(Qi)), +we=Symbol("last"),dt=Symbol("decoder");function fu(r,e,t){let n;if(this.overflow){ if(n=this[dt].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. overflow=!1}else this[we]+=this[dt].write(r),n=this[we].split(this.matcher);this[we]= -n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ -t(new Error("maximum buffer reached"));return}t()}a(du,"transform");function yu(r){ -if(this[we]+=this[dt].end(),this[we])try{$i(this,this.mapper(this[we]))}catch(e){ -return r(e)}r()}a(yu,"flush");function $i(r,e){e!==void 0&&r.push(e)}a($i,"push"); -function Gi(r){return r}a(Gi,"noop");function mu(r,e,t){switch(r=r||/\r?\n/,e=e|| -Gi,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== +t(new Error("maximum buffer reached"));return}t()}a(fu,"transform");function pu(r){ +if(this[we]+=this[dt].end(),this[we])try{Hi(this,this.mapper(this[we]))}catch(e){ +return r(e)}r()}a(pu,"flush");function Hi(r,e){e!==void 0&&r.push(e)}a(Hi,"push"); +function ji(r){return r}a(ji,"noop");function du(r,e,t){switch(r=r||/\r?\n/,e=e|| +ji,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== "object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2: -typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Gi)}t=Object. -assign({},t),t.autoDestroy=!0,t.transform=du,t.flush=yu,t.readableObjectMode=!0; -let n=new fu(t);return n[we]="",n[dt]=new pu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= +typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=ji)}t=Object. +assign({},t),t.autoDestroy=!0,t.transform=fu,t.flush=pu,t.readableObjectMode=!0; +let n=new hu(t);return n[we]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ -this._writableState.errorEmitted=!1,s(i)},n}a(mu,"split");Vi.exports=mu});var Zi=I((pl,fe)=>{"use strict";p();var zi=(sr(),O(ir)),gu=(cr(),O(ur)).Stream,wu=Ki(), -Yi=(Ge(),O(He)),bu=5432,yt=m.platform==="win32",rt=m.stderr,Su=56,xu=7,Eu=61440, -vu=32768;function _u(r){return(r&Eu)==vu}a(_u,"isRegFile");var ke=["host","port", -"database","user","password"],fr=ke.length,Au=ke[fr-1];function pr(){var r=rt instanceof -gu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` -`);rt.write(Yi.format.apply(Yi,e))}}a(pr,"warn");Object.defineProperty(fe.exports, +this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Gi.exports=du});var zi=I((nl,fe)=>{"use strict";p();var Vi=(sr(),O(ir)),yu=(cr(),O(ur)).Stream,mu=$i(), +Ki=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, +xu=32768;function Eu(r){return(r&Su)==xu}a(Eu,"isRegFile");var De=["host","port", +"database","user","password"],fr=De.length,vu=De[fr-1];function pr(){var r=rt instanceof +yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` +`);rt.write(Ki.format.apply(Ki,e))}}a(pr,"warn");Object.defineProperty(fe.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});fe. exports.warnTo=function(r){var e=rt;return rt=r,e};fe.exports.getFileName=function(r){ -var e=r||m.env,t=e.PGPASSFILE||(yt?zi.join(e.APPDATA||"./","postgresql","pgpass.\ -conf"):zi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ +var e=r||m.env,t=e.PGPASSFILE||(yt?Vi.join(e.APPDATA||"./","postgresql","pgpass.\ +conf"):Vi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",_u(r.mode)?r.mode&(Su|xu)?(pr('WARNING: password file "%s" has group or \ +",Eu(r.mode)?r.mode&(wu|bu)?(pr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(pr('WARNING:\ - password file "%s" is not a plain file',e),!1))};var Cu=fe.exports.match=function(r,e){ -return ke.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||bu)===Number( + password file "%s" is not a plain file',e),!1))};var _u=fe.exports.match=function(r,e){ +return De.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};fe.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(wu());function s(c){var h=Tu(c);h&&Iu(h)&&Cu(r,h)&&(n=h[Au],i.end())} +var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[vu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), pr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. -on("data",s).on("end",o).on("error",u)};var Tu=fe.exports.parseLine=function(r){ +on("data",s).on("end",o).on("error",u)};var Au=fe.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, u=!1,c=a(function(l,d,b){var C=r.substring(d,b);Object.hasOwnProperty.call(m.env, -"PGPASS_NO_DEESCAPE")||(C=C.replace(/\\([:\\])/g,"$1")),o[ke[l]]=C},"addToObj"), +"PGPASS_NO_DEESCAPE")||(C=C.replace(/\\([:\\])/g,"$1")),o[De[l]]=C},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== -fr?o:null,o},Iu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. +fr?o:null,o},Cu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. length>0},1:function(o){return o==="*"?!0:(o=Number(o),isFinite(o)&&o>0&&o<9007199254740992&& Math.floor(o)===o)},2:function(o){return o.length>0},3:function(o){return o.length> -0},4:function(o){return o.length>0}},t=0;t{"use strict";p();var ml=(sr(),O(ir)),Ji=(ar(),O(or)),mt=Zi(); -dr.exports=function(r,e){var t=mt.getFileName();Ji.stat(t,function(n,i){if(n||!mt. -usePgPass(i,t))return e(void 0);var s=Ji.createReadStream(t);mt.getPassword(r,s, -e)})};dr.exports.warnTo=mt.warnTo});var wt=I((bl,es)=>{"use strict";p();var Pu=Xe();function gt(r){this._types=r||Pu, +0},4:function(o){return o.length>0}},t=0;t{"use strict";p();var ol=(sr(),O(ir)),Yi=(ar(),O(or)),mt=zi(); +dr.exports=function(r,e){var t=mt.getFileName();Yi.stat(t,function(n,i){if(n||!mt. +usePgPass(i,t))return e(void 0);var s=Yi.createReadStream(t);mt.getPassword(r,s, +e)})};dr.exports.warnTo=mt.warnTo});var wt=I((cl,Ji)=>{"use strict";p();var Tu=Xe();function gt(r){this._types=r||Tu, this.text={},this.binary={}}a(gt,"TypeOverrides");gt.prototype.getOverrides=function(r){ switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}}; gt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| -"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};es.exports=gt});var ts={};se(ts,{default:()=>Bu});var Bu,rs=z(()=>{"use strict";p();Bu={}});var ns={};se(ns,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ +"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};Ji.exports=gt});var Xi={};se(Xi,{default:()=>Iu});var Iu,es=te(()=>{"use strict";p();Iu={}});var ts={};se(ts,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( i),h=decodeURIComponent(h);let C=i+":"+s,B=e?Object.fromEntries(d.entries()):l;return{ href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:B,hash:b}}var mr=z(()=>{"use strict";p();a(yr,"parse")});var ss=I((Al,is)=>{"use strict";p();var Lu=(mr(),O(ns)),gr=(ar(),O(or));function wr(r){ -if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Lu. +search:l,query:B,hash:b}}var mr=te(()=>{"use strict";p();a(yr,"parse")});var ns=I((yl,rs)=>{"use strict";p();var Pu=(mr(),O(ts)),gr=(ar(),O(or));function wr(r){ +if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- 1]);var i=(e.auth||":").split(":");if(t.user=i[0],t.password=i.splice(1).join(":"), @@ -858,19 +858,19 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=gr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(wr,"parse");is.exports=wr;wr.parse=wr});var bt=I((Il,us)=>{"use strict";p();var Ru=(rs(),O(ts)),as=et(),os=ss().parse,V=a( +return t}a(wr,"parse");rs.exports=wr;wr.parse=wr});var bt=I((wl,os)=>{"use strict";p();var Bu=(es(),O(Xi)),ss=et(),is=ns().parse,V=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||as[r]},"val"),Fu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||ss[r]},"val"),Lu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": -return{rejectUnauthorized:!1}}return as.ssl},"readSSLConfigFromEnvironment"),Ue=a( +return{rejectUnauthorized:!1}}return ss.ssl},"readSSLConfigFromEnvironment"),Ue=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ teParamValue"),ie=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Ue(n))},"ad\ -d"),Sr=class Sr{constructor(e){e=typeof e=="string"?os(e):e||{},e.connectionString&& -(e=Object.assign({},e,os(e.connectionString))),this.user=V("user",e),this.database= +d"),Sr=class Sr{constructor(e){e=typeof e=="string"?is(e):e||{},e.connectionString&& +(e=Object.assign({},e,is(e.connectionString))),this.user=V("user",e),this.database= V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Fu():e.ssl,typeof this.ssl=="st\ +options=V("options",e),this.ssl=typeof e.ssl>"u"?Lu():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. @@ -890,13 +890,13 @@ ssl}:{};if(ie(t,n,"sslmode"),ie(t,n,"sslca"),ie(t,n,"sslkey"),ie(t,n,"sslcert"), ie(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ue(this.database)),this.replication&& t.push("replication="+Ue(this.replication)),this.host&&t.push("host="+Ue(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Ue(this.client_encoding)),Ru.lookup(this.host,function(i,s){return i? +ent_encoding="+Ue(this.client_encoding)),Bu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Ue(s)),e(null,t.join(" ")))})}};a(Sr,"ConnectionPa\ -rameters");var br=Sr;us.exports=br});var ls=I((Ll,hs)=>{"use strict";p();var Mu=Xe(),cs=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +rameters");var br=Sr;os.exports=br});var cs=I((xl,us)=>{"use strict";p();var Ru=Xe(),as=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, Er=class Er{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ -var t;e.text?t=cs.exec(e.text):t=cs.exec(e.command),t&&(this.command=t[1],t[3]?(this. +var t;e.text?t=as.exec(e.text):t=as.exec(e.command),t&&(this.command=t[1],t[3]?(this. oid=parseInt(t[2],10),this.rowCount=parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt( t[2],10)))}_parseRowAsArray(e){for(var t=new Array(e.length),n=0,i=e.length;n{"use strict";p();var{EventEmitter:Du}=ge(),fs=ls(),ps=tt(),_r=class _r extends Du{constructor(e,t,n){ -super(),e=ps.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. +ext"):this._parsers[t]=Ru.getTypeParser(n.dataTypeID,n.format||"text")}}};a(Er,"\ +Result");var xr=Er;us.exports=xr});var ps=I((_l,fs)=>{"use strict";p();var{EventEmitter:Fu}=ge(),hs=cs(),ls=tt(),_r=class _r extends Fu{constructor(e,t,n){ +super(),e=ls.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& -(this.callback=m.domain.bind(e.callback)),this._result=new fs(this._rowMode,this. +(this.callback=m.domain.bind(e.callback)),this._result=new hs(this._rowMode,this. types),this._results=this._result,this.isPreparedStatement=!1,this._canceledDueToError= !1,this._promise=null}requiresPreparation(){return this.name||this.rows?!0:!this. text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&& -(Array.isArray(this._results)||(this._results=[this._result]),this._result=new fs( +(Array.isArray(this._results)||(this._results=[this._result]),this._result=new hs( this._rowMode,this.types),this._results.push(this._result))}handleRowDescription(e){ this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this. callback||!this.listeners("row").length}handleDataRow(e){let t;if(!this._canceledDueToError){ @@ -935,47 +935,47 @@ name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execut {portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.isPreparedStatement= !0,this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types}); try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this. -binary,valueMapper:ps.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( +binary,valueMapper:ls.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(_r,"Query"); -var vr=_r;ds.exports=vr});var ws={};se(ws,{Socket:()=>_e,isIP:()=>ku});function ku(r){return 0}var gs,ms,v, -_e,St=z(()=>{"use strict";p();gs=Te(ge(),1);a(ku,"isIP");ms=/^[^.]+\./,v=class v extends gs.EventEmitter{constructor(){ +var vr=_r;fs.exports=vr});var ms={};se(ms,{Socket:()=>_e,isIP:()=>Mu});function Mu(r){return 0}var ys,ds,E, +_e,St=te(()=>{"use strict";p();ys=Te(ge(),1);a(Mu,"isIP");ds=/^[^.]+\./,E=class E extends ys.EventEmitter{constructor(){ super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); _(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? -v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ -v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ +E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ -v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? -v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. -wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. -opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? -v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? -v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? -v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ -v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ -return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. -rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ +E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? +E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. +wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. +opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? +E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? +E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? +E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ +E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ +return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. +rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -996,10 +996,10 @@ then(d=>{if(this.ws=d.webSocket,this.ws==null)throw c;this.ws.accept(),o(this.ws !0)}).catch(d=>{this.emit("error",new Error(`All attempts to open a WebSocket to\ connect to the database failed. Please refer to https://github.com/neondatabase\ /serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined\ -. Details: ${d.message}`)),this.emit("close")})}}async startTls(t){if(this.subtls=== -void 0)throw new Error("For Postgres SSL connections, you must set `neonConfig.s\ -ubtls` to the subtls library. See https://github.com/neondatabase/serverless/blo\ -b/main/CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. +. Details: ${d}`)),this.emit("close")})}}async startTls(t){if(this.subtls===void 0) +throw new Error("For Postgres SSL connections, you must set `neonConfig.subtls` \ +to the subtls library. See https://github.com/neondatabase/serverless/blob/main/\ +CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. fromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i.read.bind( i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o,{useSNI:!this. disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0});this.tlsRead= @@ -1014,12 +1014,12 @@ length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this.tlsState===0?(this rawWrite(t),i()):this.tlsState===1?this.once("secureConnection",()=>{this.write( t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){return this. write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed=!0,this. -end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ -let s;return i?.jwtAuth?s=t.replace(ms,"apiauth."):s=t.replace(ms,"api."),"https\ +end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ +let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api."),"https\ ://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0,webSocketConstructor:void 0, wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0,forceDisablePgSSL:!0,coalesceWrites:!0, pipelineConnect:"password",subtls:void 0,rootCerts:"",pipelineTLS:!1,disableSNI:!1}), -_(v,"opts",{});_e=v});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +_(E,"opts",{});_e=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1034,11 +1034,11 @@ e),this.length=t,this.name=n}};a(Nr,"DatabaseError");var Ar=Nr;T.DatabaseError=A var qr=class qr{constructor(e,t){this.length=e,this.chunk=t,this.name="copyData"}}; a(qr,"CopyDataMessage");var Cr=qr;T.CopyDataMessage=Cr;var Qr=class Qr{constructor(e,t,n,i){ this.length=e,this.name=t,this.binary=n,this.columnTypes=new Array(i)}};a(Qr,"Co\ -pyResponse");var Tr=Qr;T.CopyResponse=Tr;var jr=class jr{constructor(e,t,n,i,s,o,u){ +pyResponse");var Tr=Qr;T.CopyResponse=Tr;var Wr=class Wr{constructor(e,t,n,i,s,o,u){ this.name=e,this.tableID=t,this.columnID=n,this.dataTypeID=i,this.dataTypeSize=s, -this.dataTypeModifier=o,this.format=u}};a(jr,"Field");var Ir=jr;T.Field=Ir;var Wr=class Wr{constructor(e,t){ +this.dataTypeModifier=o,this.format=u}};a(Wr,"Field");var Ir=Wr;T.Field=Ir;var jr=class jr{constructor(e,t){ this.length=e,this.fieldCount=t,this.name="rowDescription",this.fields=new Array( -this.fieldCount)}};a(Wr,"RowDescriptionMessage");var Pr=Wr;T.RowDescriptionMessage= +this.fieldCount)}};a(jr,"RowDescriptionMessage");var Pr=jr;T.RowDescriptionMessage= Pr;var Hr=class Hr{constructor(e,t){this.length=e,this.parameterCount=t,this.name= "parameterDescription",this.dataTypeIDs=new Array(this.parameterCount)}};a(Hr,"P\ arameterDescriptionMessage");var Br=Hr;T.ParameterDescriptionMessage=Br;var Gr=class Gr{constructor(e,t,n){ @@ -1051,13 +1051,13 @@ this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(V this.length=e,this.processId=t,this.channel=n,this.payload=i,this.name="notifica\ tion"}};a(Kr,"NotificationResponseMessage");var Mr=Kr;T.NotificationResponseMessage= Mr;var zr=class zr{constructor(e,t){this.length=e,this.status=t,this.name="ready\ -ForQuery"}};a(zr,"ReadyForQueryMessage");var Dr=zr;T.ReadyForQueryMessage=Dr;var Yr=class Yr{constructor(e,t){ +ForQuery"}};a(zr,"ReadyForQueryMessage");var kr=zr;T.ReadyForQueryMessage=kr;var Yr=class Yr{constructor(e,t){ this.length=e,this.text=t,this.name="commandComplete"}};a(Yr,"CommandCompleteMes\ -sage");var kr=Yr;T.CommandCompleteMessage=kr;var Zr=class Zr{constructor(e,t){this. +sage");var Dr=Yr;T.CommandCompleteMessage=Dr;var Zr=class Zr{constructor(e,t){this. length=e,this.fields=t,this.name="dataRow",this.fieldCount=t.length}};a(Zr,"Data\ RowMessage");var Ur=Zr;T.DataRowMessage=Ur;var Jr=class Jr{constructor(e,t){this. length=e,this.message=t,this.name="notice"}};a(Jr,"NoticeMessage");var Or=Jr;T.NoticeMessage= -Or});var bs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); +Or});var gs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); xt.Writer=void 0;var tn=class tn{constructor(e=256){this.size=e,this.offset=5,this. headerPosition=0,this.buffer=y.allocUnsafe(e)}ensure(e){var t=this.buffer.length- this.offset;if(t>1)+e;this.buffer=y.allocUnsafe( @@ -1073,44 +1073,44 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(tn,"Wr\ -iter");var en=tn;xt.Writer=en});var xs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); -vt.serialize=void 0;var rn=bs(),M=new rn.Writer,Uu=a(r=>{M.addInt16(3).addInt16( +iter");var en=tn;xt.Writer=en});var bs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); +vt.serialize=void 0;var rn=gs(),M=new rn.Writer,ku=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new rn. -Writer().addInt32(t).add(e).flush()},"startup"),Ou=a(()=>{let r=y.allocUnsafe(8); -return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Nu=a(r=>M. -addCString(r).flush(112),"password"),qu=a(function(r,e){return M.addCString(r).addInt32( -y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Qu=a( -function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),ju=a( -r=>M.addCString(r).flush(81),"query"),Ss=[],Wu=a(r=>{let e=r.name||"";e.length>63&& +Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); +return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Uu=a(r=>M. +addCString(r).flush(112),"password"),Ou=a(function(r,e){return M.addCString(r).addInt32( +y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Nu=a( +function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),qu=a( +r=>M.addCString(r).flush(81),"query"),ws=[],Qu=a(r=>{let e=r.name||"";e.length>63&& (console.error("Warning! Postgres only supports 63 characters for query names."), console.error("You supplied %s (%s)",e,e.length),console.error("This can cause c\ -onflicts and silent errors executing queries"));let t=r.types||Ss;for(var n=t.length, +onflicts and silent errors executing queries"));let t=r.types||ws;for(var n=t.length, i=M.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| -"",n=r.binary||!1,i=r.values||Ss,s=i.length;return M.addCString(e).addCString(t), -M.addInt16(s),Hu(i,r.valueMapper),M.addInt16(s),M.add(Oe.flush()),M.addInt16(n?1: -0),M.flush(66)},"bind"),$u=y.from([69,0,0,0,9,0,0,0,0,0]),Vu=a(r=>{if(!r||!r.portal&& -!r.rows)return $u;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. +n)),Oe.addString(n))}},"writeValues"),ju=a((r={})=>{let e=r.portal||"",t=r.statement|| +"",n=r.binary||!1,i=r.values||ws,s=i.length;return M.addCString(e).addCString(t), +M.addInt16(s),Wu(i,r.valueMapper),M.addInt16(s),M.add(Oe.flush()),M.addInt16(n?1: +0),M.flush(66)},"bind"),Hu=y.from([69,0,0,0,9,0,0,0,0,0]),Gu=a(r=>{if(!r||!r.portal&& +!r.rows)return Hu;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]= -0,s.writeUInt32BE(t,s.length-4),s},"execute"),Ku=a((r,e)=>{let t=y.allocUnsafe(16); +0,s.writeUInt32BE(t,s.length-4),s},"execute"),$u=a((r,e)=>{let t=y.allocUnsafe(16); return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE( r,8),t.writeInt32BE(e,12),t},"cancel"),nn=a((r,e)=>{let n=4+y.byteLength(e)+1,i=y. allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i}, -"cstringMessage"),zu=M.addCString("P").flush(68),Yu=M.addCString("S").flush(68), -Zu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?zu:Yu,"describe"),Ju=a( -r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),Xu=a(r=>M.add(r).flush( -100),"copyData"),ec=a(r=>nn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),tc=Et(72),rc=Et(83),nc=Et(88),ic=Et(99),sc={startup:Uu,password:Nu, -requestSsl:Ou,sendSASLInitialResponseMessage:qu,sendSCRAMClientFinalMessage:Qu,query:ju, -parse:Wu,bind:Gu,execute:Vu,describe:Zu,close:Ju,flush:a(()=>tc,"flush"),sync:a( -()=>rc,"sync"),end:a(()=>nc,"end"),copyData:Xu,copyDone:a(()=>ic,"copyDone"),copyFail:ec, -cancel:Ku};vt.serialize=sc});var Es=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); -_t.BufferReader=void 0;var oc=y.allocUnsafe(0),on=class on{constructor(e=0){this. -offset=e,this.buffer=oc,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. +"cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), +zu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( +r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),Zu=a(r=>M.add(r).flush( +100),"copyData"),Ju=a(r=>nn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),Xu=Et(72),ec=Et(83),tc=Et(88),rc=Et(99),nc={startup:ku,password:Uu, +requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, +parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( +()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, +cancel:$u};vt.serialize=nc});var Ss=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +_t.BufferReader=void 0;var ic=y.allocUnsafe(0),on=class on{constructor(e=0){this. +offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= 2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this. buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer. @@ -1118,14 +1118,14 @@ toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstrin let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(on,"BufferReader");var sn=on;_t.BufferReader= -sn});var As=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var D=Xr(),ac=Es(),an=1,uc=4,vs=an+uc,_s=y.allocUnsafe(0),cn=class cn{constructor(e){ -if(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0,this.reader=new ac.BufferReader, +sn});var vs=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); +At.Parser=void 0;var k=Xr(),sc=Ss(),an=1,oc=4,xs=an+oc,Es=y.allocUnsafe(0),cn=class cn{constructor(e){ +if(this.buffer=Es,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, -i=this.bufferOffset;for(;i+vs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( -i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+vs,s,o,this.buffer);t(c),i+=u}else -break}i===n?(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= +i=this.bufferOffset;for(;i+xs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( +i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+xs,s,o,this.buffer);t(c),i+=u}else +break}i===n?(this.buffer=Es,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer. @@ -1133,9 +1133,9 @@ byteLength*2;for(;t>=s;)s*=2;i=y.allocUnsafe(s)}this.buffer.copy(i,0,this.buffer this.bufferOffset+this.bufferLength),this.buffer=i,this.bufferOffset=0}e.copy(this. buffer,this.bufferOffset+this.bufferLength),this.bufferLength=t}else this.buffer= e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,t,n,i){switch(t){case 50: -return D.bindComplete;case 49:return D.parseComplete;case 51:return D.closeComplete;case 110: -return D.noData;case 115:return D.portalSuspended;case 99:return D.copyDone;case 87: -return D.replicationStart;case 73:return D.emptyQuery;case 68:return this.parseDataRowMessage( +return k.bindComplete;case 49:return k.parseComplete;case 51:return k.closeComplete;case 110: +return k.noData;case 115:return k.portalSuspended;case 99:return k.copyDone;case 87: +return k.replicationStart;case 73:return k.emptyQuery;case 68:return this.parseDataRowMessage( e,n,i);case 67:return this.parseCommandCompleteMessage(e,n,i);case 90:return this. parseReadyForQueryMessage(e,n,i);case 65:return this.parseNotificationMessage(e, n,i);case 82:return this.parseAuthenticationResponse(e,n,i);case 83:return this. @@ -1144,54 +1144,54 @@ return this.parseErrorMessage(e,n,i,"error");case 78:return this.parseErrorMessa e,n,i,"notice");case 84:return this.parseRowDescriptionMessage(e,n,i);case 116:return this. parseParameterDescriptionMessage(e,n,i);case 71:return this.parseCopyInMessage(e, n,i);case 72:return this.parseCopyOutMessage(e,n,i);case 100:return this.parseCopyData( -e,n,i);default:return new D.DatabaseError("received invalid response: "+t.toString( +e,n,i);default:return new k.DatabaseError("received invalid response: "+t.toString( 16),n,"error")}}parseReadyForQueryMessage(e,t,n){this.reader.setBuffer(e,n);let i=this. -reader.string(1);return new D.ReadyForQueryMessage(t,i)}parseCommandCompleteMessage(e,t,n){ -this.reader.setBuffer(e,n);let i=this.reader.cstring();return new D.CommandCompleteMessage( -t,i)}parseCopyData(e,t,n){let i=n.slice(e,e+(t-4));return new D.CopyDataMessage( +reader.string(1);return new k.ReadyForQueryMessage(t,i)}parseCommandCompleteMessage(e,t,n){ +this.reader.setBuffer(e,n);let i=this.reader.cstring();return new k.CommandCompleteMessage( +t,i)}parseCopyData(e,t,n){let i=n.slice(e,e+(t-4));return new k.CopyDataMessage( t,i)}parseCopyInMessage(e,t,n){return this.parseCopyMessage(e,t,n,"copyInRespons\ e")}parseCopyOutMessage(e,t,n){return this.parseCopyMessage(e,t,n,"copyOutRespon\ se")}parseCopyMessage(e,t,n,i){this.reader.setBuffer(e,n);let s=this.reader.byte()!== -0,o=this.reader.int16(),u=new D.CopyResponse(t,i,s,o);for(let c=0;c{"use strict";p();Object.defineProperty(be,"__esModule",{value:!0}); -be.DatabaseError=be.serialize=be.parse=void 0;var cc=Xr();Object.defineProperty( -be,"DatabaseError",{enumerable:!0,get:a(function(){return cc.DatabaseError},"get")}); -var hc=xs();Object.defineProperty(be,"serialize",{enumerable:!0,get:a(function(){ -return hc.serialize},"get")});var lc=As();function fc(r,e){let t=new lc.Parser;return r. -on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(fc,"parse");be. -parse=fc});var Cs={};se(Cs,{connect:()=>pc});function pc({socket:r,servername:e}){return r. -startTls(e),r}var Ts=z(()=>{"use strict";p();a(pc,"connect")});var pn=I((of,Bs)=>{"use strict";p();var Is=(St(),O(ws)),dc=ge().EventEmitter,{parse:yc, -serialize:q}=hn(),Ps=q.flush(),mc=q.sync(),gc=q.end(),fn=class fn extends dc{constructor(e){ -super(),e=e||{},this.stream=e.stream||new Is.Socket,this._keepAlive=e.keepAlive, +be.DatabaseError=be.serialize=be.parse=void 0;var ac=Xr();Object.defineProperty( +be,"DatabaseError",{enumerable:!0,get:a(function(){return ac.DatabaseError},"get")}); +var uc=bs();Object.defineProperty(be,"serialize",{enumerable:!0,get:a(function(){ +return uc.serialize},"get")});var cc=vs();function hc(r,e){let t=new cc.Parser;return r. +on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");be. +parse=hc});var _s={};se(_s,{connect:()=>lc});function lc({socket:r,servername:e}){return r. +startTls(e),r}var As=te(()=>{"use strict";p();a(lc,"connect")});var pn=I((zl,Is)=>{"use strict";p();var Cs=(St(),O(ms)),fc=ge().EventEmitter,{parse:pc, +serialize:q}=hn(),Ts=q.flush(),dc=q.sync(),yc=q.end(),fn=class fn extends fc{constructor(e){ +super(),e=e||{},this.stream=e.stream||new Cs.Socket,this._keepAlive=e.keepAlive, this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.lastBuffer= !1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this._emitMessage= !1;var t=this;this.on("newListener",function(n){n==="message"&&(t._emitMessage=!0)})}connect(e,t){ @@ -1204,36 +1204,36 @@ ssl)return this.attachListeners(this.stream);this.stream.once("data",function(s) var o=s.toString("utf8");switch(o){case"S":break;case"N":return n.stream.end(),n. emit("error",new Error("The server does not support SSL connections"));default:return n. stream.end(),n.emit("error",new Error("There was an error establishing an SSL co\ -nnection"))}var u=(Ts(),O(Cs));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( -c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Is.isIP(t)===0&&(c.servername=t);try{ +nnection"))}var u=(As(),O(_s));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( +c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Cs.isIP(t)===0&&(c.servername=t);try{ n.stream=u.connect(c)}catch(h){return n.emit("error",h)}n.attachListeners(n.stream), n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){e.on("end",()=>{ -this.emit("end")}),yc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& +this.emit("end")}),pc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(q.requestSsl())}startup(e){ this.stream.write(q.startup(e))}cancel(e,t){this._send(q.cancel(e,t))}password(e){ this._send(q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(q.sendSASLInitialResponseMessage( e,t))}sendSCRAMClientFinalMessage(e){this._send(q.sendSCRAMClientFinalMessage(e))}_send(e){ return this.stream.writable?this.stream.write(e):!1}query(e){this._send(q.query( e))}parse(e){this._send(q.parse(e))}bind(e){this._send(q.bind(e))}execute(e){this. -_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ps)}sync(){this. -_ending=!0,this._send(Ps),this._send(mc)}ref(){this.stream.ref()}unref(){this.stream. +_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ts)}sync(){this. +_ending=!0,this._send(Ts),this._send(dc)}ref(){this.stream.ref()}unref(){this.stream. unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. -stream.end();return}return this.stream.write(gc,()=>{this.stream.end()})}close(e){ +stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Bs.exports=ln});var Fs=I((hf,Rs)=>{"use strict";p();var wc=ge().EventEmitter,cf=(Ge(),O(He)),bc=tt(), -dn=ji(),Sc=Xi(),xc=wt(),Ec=bt(),Ls=ys(),vc=et(),_c=pn(),yn=class yn extends wc{constructor(e){ -super(),this.connectionParameters=new Ec(e),this.user=this.connectionParameters. +this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Is.exports=ln});var Ls=I((Xl,Bs)=>{"use strict";p();var mc=ge().EventEmitter,Jl=(Ge(),O(He)),gc=tt(), +dn=qi(),wc=Zi(),bc=wt(),Sc=bt(),Ps=ps(),xc=et(),Ec=pn(),yn=class yn extends mc{constructor(e){ +super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}), this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= -t.Promise||S.Promise,this._types=new xc(t.types),this._ending=!1,this._connecting= +t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new _c({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new Ec({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. -binary||vc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. +binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}), this._connectionTimeoutMillis=t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=a( n=>{m.nextTick(()=>{n.handleError(e,this.connection)})},"enqueueError");this.activeQuery&& @@ -1271,10 +1271,10 @@ let t=this.connection;typeof this.password=="function"?this._Promise.resolve().t ()=>this.password()).then(n=>{if(n!==void 0){if(typeof n!="string"){t.emit("erro\ r",new TypeError("Password must be a string"));return}this.connectionParameters. password=this.password=n}else this.connectionParameters.password=this.password=null; -e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():Sc(this.connectionParameters, +e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():wc(this.connectionParameters, n=>{n!==void 0&&(this.connectionParameters.password=this.password=n),e()})}_handleAuthCleartextPassword(e){ this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){ -this._checkPgPass(()=>{let t=bc.postgresMd5PasswordHash(this.user,this.password, +this._checkPgPass(()=>{let t=gc.postgresMd5PasswordHash(this.user,this.password, e.salt);this.connection.password(t)})}_handleAuthSASL(e){this._checkPgPass(()=>{ this.saslSession=dn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( this.saslSession.mechanism,this.saslSession.response)})}_handleAuthSASLContinue(e){ @@ -1320,7 +1320,7 @@ e&&m.nextTick(()=>{this.activeQuery.handleError(e,this.connection),this.readyFor emit("drain"))}query(e,t,n){var i,s,o,u,c;if(e==null)throw new TypeError("Client\ was passed a null or undefined query");return typeof e.submit=="function"?(o=e. query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& -(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Ls( +(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Ps( e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,b)=>d?l(d):h(b)}))), o&&(c=i.callback,u=setTimeout(()=>{var h=new Error("Query read timeout");m.nextTick( ()=>{i.handleError(h,this.connection)}),c(h),i.callback=()=>{};var l=this.queryQueue. @@ -1335,18 +1335,18 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(yn,"Client");var Ct=yn;Ct.Query= -Ls;Rs.exports=Ct});var Us=I((pf,ks)=>{"use strict";p();var Ac=ge().EventEmitter,Ms=a(function(){},"\ -NOOP"),Ds=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, +Ps;Bs.exports=Ct});var ks=I((rf,Ms)=>{"use strict";p();var vc=ge().EventEmitter,Rs=a(function(){},"\ +NOOP"),Fs=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),wn=class wn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(wn,"IdleItem");var mn=wn,bn=class bn{constructor(e){this.callback= -e}};a(bn,"PendingItem");var Ne=bn;function Cc(){throw new Error("Release called \ -on client which has already been released to the pool.")}a(Cc,"throwOnDoubleRele\ +e}};a(bn,"PendingItem");var Ne=bn;function _c(){throw new Error("Release called \ +on client which has already been released to the pool.")}a(_c,"throwOnDoubleRele\ ase");function Tt(r,e){if(e)return{callback:e,result:void 0};let t,n,i=a(function(o,u){ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.captureStackTrace( -o),o});return{callback:i,result:s}}a(Tt,"promisify");function Tc(r,e){return a(function t(n){ +o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Tc,"makeIdleListener");var Sn=class Sn extends Ac{constructor(e,t){ +"idleListener")}a(Ac,"makeIdleListener");var Sn=class Sn extends vc{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1365,25 +1365,25 @@ _pendingQueue.length){this.log("no queued requests");return}if(!this._idle.lengt this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let t=this. _idle.pop();clearTimeout(t.timeoutId);let n=t.client;n.ref&&n.ref();let i=t.idleListener; return this._acquireClient(n,e,i,!1)}if(!this._isFull())return this.newClient(e); -throw new Error("unexpected condition")}_remove(e){let t=Ds(this._idle,n=>n.client=== +throw new Error("unexpected condition")}_remove(e){let t=Fs(this._idle,n=>n.client=== e);t!==void 0&&clearTimeout(t.timeoutId),this._clients=this._clients.filter(n=>n!== e),e.end(),this.emit("remove",e)}connect(e){if(this.ending){let i=new Error("Can\ not use a pool after calling end on the pool");return e?e(i):this.Promise.reject( i)}let t=Tt(this.Promise,e),n=t.result;if(this._isFull()||this._idle.length){if(this. _idle.length&&m.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis) return this._pendingQueue.push(new Ne(t.callback)),n;let i=a((u,c,h)=>{clearTimeout( -o),t.callback(u,c,h)},"queueCallback"),s=new Ne(i),o=setTimeout(()=>{Ds(this._pendingQueue, +o),t.callback(u,c,h)},"queueCallback"),s=new Ne(i),o=setTimeout(()=>{Fs(this._pendingQueue, u=>u.callback===i),s.timedOut=!0,t.callback(new Error("timeout exceeded when try\ ing to connect"))},this.options.connectionTimeoutMillis);return this._pendingQueue. push(s),n}return this.newClient(new Ne(t.callback)),n}newClient(e){let t=new this. -Client(this.options);this._clients.push(t);let n=Tc(this,t);this.log("checking c\ +Client(this.options);this._clients.push(t);let n=Ac(this,t);this.log("checking c\ lient timeout");let i,s=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{ this.log("ending client due to timeout"),s=!0,t.connection?t.connection.stream.destroy(): t.end()},this.options.connectionTimeoutMillis)),this.log("connecting new client"), t.connect(o=>{if(i&&clearTimeout(i),t.on("error",n),o)this.log("client failed to\ connect",o),this._clients=this._clients.filter(u=>u!==t),s&&(o.message="Connect\ ion terminated due to connection timeout"),this._pulseQueue(),e.timedOut||e.callback( -o,void 0,Ms);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== +o,void 0,Rs);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== 0){let u=setTimeout(()=>{this.log("ending client due to expired lifetime"),this. _expired.add(t),this._idle.findIndex(h=>h.client===t)!==-1&&this._acquireClient( t,new Ne((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.once( @@ -1391,8 +1391,8 @@ t,new Ne((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.o i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n), e.removeListener("error",n),t.timedOut?i&&this.options.verify?this.options.verify( e,e.release):e.release():i&&this.options.verify?this.options.verify(e,s=>{if(s)return e. -release(s),t.callback(s,void 0,Ms);t.callback(void 0,e,e.release)}):t.callback(void 0, -e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&Cc(),n=!0,this._release(e, +release(s),t.callback(s,void 0,Rs);t.callback(void 0,e,e.release)}):t.callback(void 0, +e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&_c(),n=!0,this._release(e, t,i)}}_release(e,t,n){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1, this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>= this.options.maxUses){e._poolUseCount>=this.options.maxUses&&this.log("remove ex\ @@ -1414,7 +1414,7 @@ this.Promise.reject(n)}this.ending=!0;let t=Tt(this.Promise,e);return this._endC t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue. length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients. reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients. -length}};a(Sn,"Pool");var gn=Sn;ks.exports=gn});var Os={};se(Os,{default:()=>Ic});var Ic,Ns=z(()=>{"use strict";p();Ic={}});var qs=I((gf,Pc)=>{Pc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ +length}};a(Sn,"Pool");var gn=Sn;Ms.exports=gn});var Ds={};se(Ds,{default:()=>Cc});var Cc,Us=te(()=>{"use strict";p();Cc={}});var Os=I((af,Tc)=>{Tc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ client - pure javascript & libpq with the same API",keywords:["database","libpq", "pg","postgre","postgres","postgresql","rdbms"],homepage:"https://github.com/bri\ anc/node-postgres",repository:{type:"git",url:"git://github.com/brianc/node-post\ @@ -1425,16 +1425,16 @@ pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:" 4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ "pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ .md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ -7b9a5491a178655"}});var Ws=I((wf,js)=>{"use strict";p();var Qs=ge().EventEmitter,Bc=(Ge(),O(He)),xn=tt(), -qe=js.exports=function(r,e,t){Qs.call(this),r=xn.normalizeQueryConfig(r,e,t),this. +7b9a5491a178655"}});var Qs=I((uf,qs)=>{"use strict";p();var Ns=ge().EventEmitter,Ic=(Ge(),O(He)),xn=tt(), +qe=qs.exports=function(r,e,t){Ns.call(this),r=xn.normalizeQueryConfig(r,e,t),this. text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ -newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Bc.inherits( -qe,Qs);var Lc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ +newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Ic.inherits( +qe,Ns);var Pc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ age",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"\ dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"\ routine"};qe.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); -if(e)for(var t in e){var n=Lc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. +if(e)for(var t in e){var n=Pc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. emit("error",r),this.state="error"};qe.prototype.then=function(r,e){return this. _getPromise().then(r,e)};qe.prototype.catch=function(r){return this._getPromise(). catch(r)};qe.prototype._getPromise=function(){return this._promise?this._promise: @@ -1456,30 +1456,30 @@ this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. values.map(xn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Vs=I((Ef,$s)=>{"use strict";p();var Rc=(Ns(),O(Os)),Fc=wt(),xf=qs(),Hs=ge(). -EventEmitter,Mc=(Ge(),O(He)),Dc=bt(),Gs=Ws(),J=$s.exports=function(r){Hs.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Fc(r.types),this.native= -new Rc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= -!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Dc( +text,t)}});var Gs=I((ff,Hs)=>{"use strict";p();var Bc=(Us(),O(Ds)),Lc=wt(),lf=Os(),Ws=ge(). +EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),js=Qs(),Z=Hs.exports=function(r){Ws.call(this), +r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Lc(r.types),this.native= +new Bc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= -e.port,this.namedQueries={}};J.Query=Gs;Mc.inherits(J,Hs);J.prototype._errorAllQueries= +e.port,this.namedQueries={}};Z.Query=js;Rc.inherits(Z,Ws);Z.prototype._errorAllQueries= function(r){let e=a(t=>{m.nextTick(()=>{t.native=this.native,t.handleError(r)})}, "enqueueError");this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery= -null),this._queryQueue.forEach(e),this._queryQueue.length=0};J.prototype._connect= +null),this._queryQueue.forEach(e),this._queryQueue.length=0};Z.prototype._connect= function(r){var e=this;if(this._connecting){m.nextTick(()=>r(new Error("Client h\ as already been connected. You cannot reuse a client.")));return}this._connecting= !0,this.connectionParameters.getLibpqConnectionString(function(t,n){if(t)return r( t);e.native.connect(n,function(i){if(i)return e.native.end(),r(i);e._connected=!0, e.native.on("error",function(s){e._queryable=!1,e._errorAllQueries(s),e.emit("er\ ror",s)}),e.native.on("notification",function(s){e.emit("notification",{channel:s. -relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};J. +relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};Z. prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise( -(e,t)=>{this._connect(n=>{n?t(n):e()})})};J.prototype.query=function(r,e,t){var n, +(e,t)=>{this._connect(n=>{n?t(n):e()})})};Z.prototype.query=function(r,e,t){var n, i,s,o,u;if(r==null)throw new TypeError("Client was passed a null or undefined qu\ ery");if(typeof r.submit=="function")s=r.query_timeout||this.connectionParameters. query_timeout,i=n=r,typeof e=="function"&&(r.callback=e);else if(s=this.connectionParameters. -query_timeout,n=new Gs(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= +query_timeout,n=new js(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= l,h=d}),n.callback=(l,d)=>l?h(l):c(d)}return s&&(u=n.callback,o=setTimeout(()=>{ var c=new Error("Query read timeout");m.nextTick(()=>{n.handleError(c,this.connection)}), u(c),n.callback=()=>{};var h=this._queryQueue.indexOf(n);h>-1&&this._queryQueue. @@ -1488,38 +1488,38 @@ this._queryable?this._ending?(n.native=this.native,m.nextTick(()=>{n.handleError new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.push( n),this._pulseQueryQueue(),i):(n.native=this.native,m.nextTick(()=>{n.handleError( new Error("Client has encountered a connection error and is not queryable"))}),i)}; -J.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( +Z.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( "connect",this.end.bind(this,r));var t;return r||(t=new this._Promise(function(n,i){ r=a(s=>s?i(s):n(),"cb")})),this.native.end(function(){e._errorAllQueries(new Error( -"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};J.prototype. +"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};Z.prototype. _hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="\ -error"&&this._activeQuery.state!=="end"};J.prototype._pulseQueryQueue=function(r){ +error"&&this._activeQuery.state!=="end"};Z.prototype._pulseQueryQueue=function(r){ if(this._connected&&!this._hasActiveQuery()){var e=this._queryQueue.shift();if(!e){ r||this.emit("drain");return}this._activeQuery=e,e.submit(this);var t=this;e.once( -"_done",function(){t._pulseQueryQueue()})}};J.prototype.cancel=function(r){this. +"_done",function(){t._pulseQueryQueue()})}};Z.prototype.cancel=function(r){this. _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== --1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};J.prototype.ref=function(){}; -J.prototype.unref=function(){};J.prototype.setTypeParser=function(r,e,t){return this. -_types.setTypeParser(r,e,t)};J.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var En=I((Af,Ks)=>{"use strict";p();Ks.exports=Vs()});var It=I((Tf,nt)=>{"use strict";p();var kc=Fs(),Uc=et(),Oc=pn(),Nc=Us(),{DatabaseError:qc}=hn(), -Qc=a(r=>{var e;return e=class extends Nc{constructor(n){super(n,r)}},a(e,"BoundP\ -ool"),e},"poolFactory"),vn=a(function(r){this.defaults=Uc,this.Client=r,this.Query= -this.Client.Query,this.Pool=Qc(this.Client),this._pools=[],this.Connection=Oc,this. -types=Xe(),this.DatabaseError=qc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new vn(En()):(nt.exports=new vn(kc),Object.defineProperty(nt.exports,"na\ +-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; +Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. +_types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. +_types.getTypeParser(r,e)}});var En=I((yf,$s)=>{"use strict";p();$s.exports=Gs()});var It=I((gf,nt)=>{"use strict";p();var Mc=Ls(),kc=et(),Dc=pn(),Uc=ks(),{DatabaseError:Oc}=hn(), +Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ +ool"),e},"poolFactory"),vn=a(function(r){this.defaults=kc,this.Client=r,this.Query= +this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. +types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. +exports=new vn(En()):(nt.exports=new vn(Mc),Object.defineProperty(nt.exports,"na\ tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new vn(En())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});p();var Bt=Te(It());St();p();St();mr();var Zs=Te(tt()),Js=Te(wt());function jc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(jc,"encodeBuffe\ +native",{value:r}),r}}))});p();var Bt=Te(It());St();p();St();mr();var zs=Te(tt()),Ys=Te(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", "NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); _(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, "constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. -captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,zs="transaction() exp\ -ects an array of queries, or a function returning an array of queries",Wc=["seve\ +captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,Vs="transaction() exp\ +ects an array of queries, or a function returning an array of queries",Qc=["seve\ rity","code","detail","hint","position","internalPosition","internalQuery","wher\ -e","schema","table","column","dataType","constraint","file","line","routine"];function Xs(r,{ +e","schema","table","column","dataType","constraint","file","line","routine"];function Zs(r,{ arrayMode:e,fullResults:t,fetchOptions:n,isolationLevel:i,readOnly:s,deferrable:o, queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data\ base connection string was provided to `neon()`. Perhaps an environment variable\ @@ -1527,47 +1527,47 @@ base connection string was provided to `neon()`. Perhaps an environment variable n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} let{protocol:d,username:b,hostname:C,port:B,pathname:Q}=l;if(d!=="postgres:"&&d!== "postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ - `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(A,...g){ -let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let j=0;jjc((0,Zs.prepareValue)(j)));let k={ -query:P,params:g};return u&&u(k),Hc(de,k,K)}a(X,"resolve"),X.transaction=async(A,g)=>{ -if(typeof A=="function"&&(A=A(X)),!Array.isArray(A))throw new Error(zs);A.forEach( -k=>{if(k[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(zs)});let P=A. -map(k=>k.parameterizedQuery),K=A.map(k=>k.opts??{});return de(P,K,g)};async function de(A,g,P){ -let{fetchEndpoint:K,fetchFunction:k}=_e,j=Array.isArray(A)?{queries:A}:A,ee=n??{}, -oe=e??!1,R=t??!1,$=i,ce=s,ye=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, -...P.fetchOptions}),P.arrayMode!==void 0&&(oe=P.arrayMode),P.fullResults!==void 0&& -(R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& + `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ +let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;Wqc((0,zs.prepareValue)(W)));let D={ +query:P,params:g};return u&&u(D),Wc(de,D,K)}a(J,"resolve"),J.transaction=async(A,g)=>{ +if(typeof A=="function"&&(A=A(J)),!Array.isArray(A))throw new Error(Vs);A.forEach( +D=>{if(D[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Vs)});let P=A. +map(D=>D.parameterizedQuery),K=A.map(D=>D.opts??{});return de(P,K,g)};async function de(A,g,P){ +let{fetchEndpoint:K,fetchFunction:D}=_e,W=Array.isArray(A)?{queries:A}:A,X=n??{}, +oe=e??!1,R=t??!1,$=i,ce=s,ye=o;P!==void 0&&(P.fetchOptions!==void 0&&(X={...X,...P. +fetchOptions}),P.arrayMode!==void 0&&(oe=P.arrayMode),P.fullResults!==void 0&&(R= +P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& (ce=P.readOnly),P.deferrable!==void 0&&(ye=P.deferrable)),g!==void 0&&!Array.isArray( -g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let Se=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(Se=g.authToken);let je=typeof K=="function"?K(C,B,{jwtAuth:Se!== +g)&&g.fetchOptions!==void 0&&(X={...X,...g.fetchOptions});let Se=h;!Array.isArray( +g)&&g?.authToken!==void 0&&(Se=g.authToken);let We=typeof K=="function"?K(C,B,{jwtAuth:Se!== void 0}):K,he={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ -ray-Mode":"true"},it=await Gc(Se);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( +ray-Mode":"true"},it=await jc(Se);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( A)&&($!==void 0&&(he["Neon-Batch-Isolation-Level"]=$),ce!==void 0&&(he["Neon-Bat\ ch-Read-Only"]=String(ce)),ye!==void 0&&(he["Neon-Batch-Deferrable"]=String(ye))); -let te;try{te=await(k??fetch)(je,{method:"POST",body:JSON.stringify(j),headers:he, -...ee})}catch(W){let H=new pe(`Error connecting to database: ${W.message}`);throw H. -sourceError=W,H}if(te.ok){let W=await te.json();if(Array.isArray(A)){let H=W.results; -if(!Array.isArray(H))throw new pe("Neon internal error: unexpected result format"); -return H.map((Ae,xe)=>{let Lt=g[xe]??{},ro=Lt.arrayMode??oe,no=Lt.fullResults??R; -return Ys(Ae,{arrayMode:ro,fullResults:no,parameterizedQuery:A[xe],resultCallback:c, -types:Lt.types})})}else{let H=g??{},Ae=H.arrayMode??oe,xe=H.fullResults??R;return Ys( -W,{arrayMode:Ae,fullResults:xe,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{ -let{status:W}=te;if(W===400){let H=await te.json(),Ae=new pe(H.message);for(let xe of Wc) -Ae[xe]=H[xe]??void 0;throw Ae}else{let H=await te.text();throw new pe(`Server er\ -ror (HTTP status ${W}): ${H}`)}}}return a(de,"execute"),X}a(Xs,"neon");function Hc(r,e,t){ -return{[Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a( -(n,i)=>r(e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r( -e,t).finally(n),"finally")}}a(Hc,"createNeonQueryPromise");function Ys(r,{arrayMode:e, -fullResults:t,parameterizedQuery:n,resultCallback:i,types:s}){let o=new Js.default( -s),u=r.fields.map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e=== -!0?r.rows.map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries( -l.map((d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), -t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ys,"\ -processQueryResult");async function Gc(r){if(typeof r=="string")return r;if(typeof r== +let ee;try{ee=await(D??fetch)(We,{method:"POST",body:JSON.stringify(W),headers:he, +...X})}catch(j){let H=new pe(`Error connecting to database: ${j}`);throw H.sourceError= +j,H}if(ee.ok){let j=await ee.json();if(Array.isArray(A)){let H=j.results;if(!Array. +isArray(H))throw new pe("Neon internal error: unexpected result format");return H. +map((Ae,xe)=>{let Lt=g[xe]??{},eo=Lt.arrayMode??oe,to=Lt.fullResults??R;return Ks( +Ae,{arrayMode:eo,fullResults:to,parameterizedQuery:A[xe],resultCallback:c,types:Lt. +types})})}else{let H=g??{},Ae=H.arrayMode??oe,xe=H.fullResults??R;return Ks(j,{arrayMode:Ae, +fullResults:xe,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; +if(j===400){let H=await ee.json(),Ae=new pe(H.message);for(let xe of Qc)Ae[xe]=H[xe]?? +void 0;throw Ae}else{let H=await ee.text();throw new pe(`Server error (HTTP stat\ +us ${j}): ${H}`)}}}return a(de,"execute"),J}a(Zs,"neon");function Wc(r,e,t){return{ +[Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a((n,i)=>r( +e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r(e,t).finally( +n),"finally")}}a(Wc,"createNeonQueryPromise");function Ks(r,{arrayMode:e,fullResults:t, +parameterizedQuery:n,resultCallback:i,types:s}){let o=new Ys.default(s),u=r.fields. +map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e===!0?r.rows. +map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries(l.map( +(d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), +t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ks,"\ +processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new pe("Error ge\ tting auth token.");throw e instanceof Error&&(t=new pe(`Error getting auth toke\ -n: ${e.message}`)),t}}a(Gc,"getAuthToken");var to=Te(bt()),Qe=Te(It());var An=class An extends Bt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ +n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Te(bt()),Qe=Te(It());var An=class An extends Bt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& (this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ @@ -1589,8 +1589,8 @@ let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassw this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=this. saslSession,i=this.password,s=t.data;if(n.message!=="SASLInitialResponse"||typeof i!= "string"||typeof s!="string")throw new Error("SASL: protocol error");let o=Object. -fromEntries(s.split(",").map(te=>{if(!/^.=/.test(te))throw new Error("SASL: Inva\ -lid attribute pair entry");let W=te[0],H=te.substring(2);return[W,H]})),u=o.r,c=o. +fromEntries(s.split(",").map(ee=>{if(!/^.=/.test(ee))throw new Error("SASL: Inva\ +lid attribute pair entry");let j=ee[0],H=ee.substring(2);return[j,H]})),u=o.r,c=o. s,h=o.i;if(!u||!/^[!-+--~]+$/.test(u))throw new Error("SASL: SCRAM-SERVER-FIRST-\ MESSAGE: nonce missing/unprintable");if(!c||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ @@ -1601,35 +1601,35 @@ if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, C=b.encode(i),B=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ 6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",B,y.concat([d,y.from( -[0,0,0,1])]))),X=Q;for(var de=0;deX[W]^Q[W]));let A=X,g=await w.subtle.importKey( +[0,0,0,1])]))),J=Q;for(var de=0;deJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( "raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", -P),k="n=*,r="+n.clientNonce,j="r="+u+",s="+c+",i="+l,ee="c=biws,r="+u,oe=k+","+j+ -","+ee,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, +P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,oe=D+","+W+ +","+X,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, ["sign"]);var $=new Uint8Array(await w.subtle.sign("HMAC",R,b.encode(oe))),ce=y. -from(P.map((te,W)=>P[W]^$[W])),ye=ce.toString("base64");let Se=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),je=await w.subtle.sign( -"HMAC",Se,b.encode("Server Key")),he=await w.subtle.importKey("raw",je,{name:"HM\ +from(P.map((ee,j)=>P[j]^$[j])),ye=ce.toString("base64");let Se=await w.subtle.importKey( +"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),We=await w.subtle.sign( +"HMAC",Se,b.encode("Server Key")),he=await w.subtle.importKey("raw",We,{name:"HM\ AC",hash:{name:"SHA-256"}},!1,["sign"]);var it=y.from(await w.subtle.sign("HMAC", he,b.encode(oe)));n.message="SASLResponse",n.serverSignature=it.toString("base64"), -n.response=ee+",p="+ye,this.connection.sendSCRAMClientFinalMessage(this.saslSession. -response)}};a(An,"NeonClient");var _n=An;function $c(r,e){if(e)return{callback:e, +n.response=X+",p="+ye,this.connection.sendSCRAMClientFinalMessage(this.saslSession. +response)}};a(An,"NeonClient");var _n=An;function Hc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a($c,"promisify");var Cn=class Cn extends Bt.Pool{constructor(){ +n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var Cn=class Cn extends Bt.Pool{constructor(){ super(...arguments);_(this,"Client",_n);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ if(!_e.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=$c(this.Promise, -i);i=s.callback;try{let o=new to.default(this.options),u=encodeURIComponent,c=encodeURI, +return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Hc(this.Promise, +i);i=s.callback;try{let o=new Xs.default(this.options),u=encodeURIComponent,c=encodeURI, h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== -"string"?t:t.text,d=n??t.values??[];Xs(h,{fullResults:!0,arrayMode:t.rowMode==="\ +"string"?t:t.text,d=n??t.values??[];Zs(h,{fullResults:!0,arrayMode:t.rowMode==="\ array"})(l,d,{types:t.types??this.options?.types}).then(C=>i(void 0,C)).catch(C=>i( -C))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var eo=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; +C))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var Js=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; var export_Query=Qe.Query;var export_defaults=Qe.defaults;var export_types=Qe.types; export{_n as Client,export_ClientBase as ClientBase,export_Connection as Connection, -export_DatabaseError as DatabaseError,pe as NeonDbError,eo as Pool,export_Query as Query, -export_defaults as defaults,Xs as neon,_e as neonConfig,export_types as types}; +export_DatabaseError as DatabaseError,pe as NeonDbError,Js as Pool,export_Query as Query, +export_defaults as defaults,Zs as neon,_e as neonConfig,export_types as types}; /*! Bundled license information: ieee754/index.js: diff --git a/dist/serverless.mjs b/dist/serverless.mjs index d58ec68..0c36f42 100644 --- a/dist/serverless.mjs +++ b/dist/serverless.mjs @@ -1,90 +1,90 @@ -var Wa=Object.create;var st=Object.defineProperty;var Ga=Object.getOwnPropertyDescriptor;var Va=Object.getOwnPropertyNames;var za=Object.getPrototypeOf,Ja=Object.prototype.hasOwnProperty;var o=(r,e)=>st(r,"name",{value:e,configurable:!0});var le=(r,e)=>()=>(r&&(e=r(r=0)),e);var B=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),pe=(r,e)=>{for(var t in e) -st(r,t,{get:e[t],enumerable:!0})},$n=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== -"function")for(let i of Va(e))!Ja.call(r,i)&&i!==t&&st(r,i,{get:()=>e[i],enumerable:!(n= -Ga(e,i))||n.enumerable});return r};var Oe=(r,e,t)=>(t=r!=null?Wa(za(r)):{},$n(e||!r||!r.__esModule?st(t,"default",{ -value:r,enumerable:!0}):t,r)),X=r=>$n(st({},"__esModule",{value:!0}),r);var Kn=B(Pt=>{"use strict";p();Pt.byteLength=Za;Pt.toByteArray=eo;Pt.fromByteArray= -no;var Se=[],ye=[],Ya=typeof Uint8Array<"u"?Uint8Array:Array,ur="ABCDEFGHIJKLMNO\ -PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ne=0,jn=ur.length;Neot(r,"name",{value:e,configurable:!0});var ye=(r,e)=>()=>(r&&(e=r(r=0)),e);var R=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),me=(r,e)=>{for(var t in e) +ot(r,t,{get:e[t],enumerable:!0})},Hn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== +"function")for(let i of za(e))!Ya.call(r,i)&&i!==t&&ot(r,i,{get:()=>e[i],enumerable:!(n= +Va(e,i))||n.enumerable});return r};var Qe=(r,e,t)=>(t=r!=null?Ga(Ja(r)):{},Hn(e||!r||!r.__esModule?ot(t,"default",{ +value:r,enumerable:!0}):t,r)),te=r=>Hn(ot({},"__esModule",{value:!0}),r);var Gn=R(Nt=>{"use strict";y();Nt.byteLength=Xa;Nt.toByteArray=to;Nt.fromByteArray= +io;var Ee=[],we=[],Za=typeof Uint8Array<"u"?Uint8Array:Array,lr="ABCDEFGHIJKLMNO\ +PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(qe=0,Kn=lr.length;qe0)throw new Error("Invalid string. Length must be a multip\ -le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}o(Hn, -"getLens");function Za(r){var e=Hn(r),t=e[0],n=e[1];return(t+n)*3/4-n}o(Za,"byte\ -Length");function Xa(r,e,t){return(e+t)*3/4-t}o(Xa,"_byteLength");function eo(r){ -var e,t=Hn(r),n=t[0],i=t[1],s=new Ya(Xa(r,n,i)),a=0,u=i>0?n-4:n,c;for(c=0;c0?n-4:n,c;for(c=0;c>16&255,s[a++]=e>>8&255,s[a++]=e&255;return i===2&&(e= -ye[r.charCodeAt(c)]<<2|ye[r.charCodeAt(c+1)]>>4,s[a++]=e&255),i===1&&(e=ye[r.charCodeAt( -c)]<<10|ye[r.charCodeAt(c+1)]<<4|ye[r.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]= -e&255),s}o(eo,"toByteArray");function to(r){return Se[r>>18&63]+Se[r>>12&63]+Se[r>> -6&63]+Se[r&63]}o(to,"tripletToBase64");function ro(r,e,t){for(var n,i=[],s=e;su?u:a+s));return n===1?(e=r[t-1],i.push(Se[e>>2]+ -Se[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Se[e>>10]+Se[e>>4&63]+Se[e<< -2&63]+"=")),i.join("")}o(no,"fromByteArray")});var Wn=B(cr=>{p();cr.read=function(r,e,t,n,i){var s,a,u=i*8-n-1,c=(1<> -1,h=-7,f=t?i-1:0,y=t?-1:1,m=r[e+f];for(f+=y,s=m&(1<<-h)-1,m>>=-h,h+=u;h>0;s=s*256+ -r[e+f],f+=y,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=a*256+r[e+f],f+=y,h-=8);if(s=== +we[r.charCodeAt(c)]<<2|we[r.charCodeAt(c+1)]>>4,s[a++]=e&255),i===1&&(e=we[r.charCodeAt( +c)]<<10|we[r.charCodeAt(c+1)]<<4|we[r.charCodeAt(c+2)]>>2,s[a++]=e>>8&255,s[a++]= +e&255),s}o(to,"toByteArray");function ro(r){return Ee[r>>18&63]+Ee[r>>12&63]+Ee[r>> +6&63]+Ee[r&63]}o(ro,"tripletToBase64");function no(r,e,t){for(var n,i=[],s=e;su?u:a+s));return n===1?(e=r[t-1],i.push(Ee[e>>2]+ +Ee[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Ee[e>>10]+Ee[e>>4&63]+Ee[e<< +2&63]+"=")),i.join("")}o(io,"fromByteArray")});var Vn=R(hr=>{y();hr.read=function(r,e,t,n,i){var s,a,u=i*8-n-1,c=(1<> +1,h=-7,f=t?i-1:0,p=t?-1:1,m=r[e+f];for(f+=p,s=m&(1<<-h)-1,m>>=-h,h+=u;h>0;s=s*256+ +r[e+f],f+=p,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=a*256+r[e+f],f+=p,h-=8);if(s=== 0)s=1-l;else{if(s===c)return a?NaN:(m?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-l}return(m? --1:1)*a*Math.pow(2,s-n)};cr.write=function(r,e,t,n,i,s){var a,u,c,l=s*8-i-1,h=(1<< -l)-1,f=h>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,b=n?1:-1,U=e<0|| +-1:1)*a*Math.pow(2,s-n)};hr.write=function(r,e,t,n,i,s){var a,u,c,l=s*8-i-1,h=(1<< +l)-1,f=h>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,x=n?1:-1,L=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=h):(a=Math. -floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+f>=1?e+=y/c:e+= -y*Math.pow(2,1-f),e*c>=2&&(a++,c/=2),a+f>=h?(u=0,a=h):a+f>=1?(u=(e*c-1)*Math.pow( -2,i),a=a+f):(u=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;r[t+m]=u&255,m+=b,u/=256, -i-=8);for(a=a<0;r[t+m]=a&255,m+=b,a/=256,l-=8);r[t+m-b]|=U*128}});var ci=B(je=>{"use strict";p();var lr=Kn(),Qe=Wn(),Gn=typeof Symbol=="function"&& -typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;je.Buffer= -d;je.SlowBuffer=co;je.INSPECT_MAX_BYTES=50;var Bt=2147483647;je.kMaxLength=Bt;d. -TYPED_ARRAY_SUPPORT=io();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. +floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+f>=1?e+=p/c:e+= +p*Math.pow(2,1-f),e*c>=2&&(a++,c/=2),a+f>=h?(u=0,a=h):a+f>=1?(u=(e*c-1)*Math.pow( +2,i),a=a+f):(u=e*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;r[t+m]=u&255,m+=x,u/=256, +i-=8);for(a=a<0;r[t+m]=a&255,m+=x,a/=256,l-=8);r[t+m-x]|=L*128}});var hi=R(Ke=>{"use strict";y();var fr=Gn(),je=Vn(),zn=typeof Symbol=="function"&& +typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ke.Buffer= +d;Ke.SlowBuffer=lo;Ke.INSPECT_MAX_BYTES=50;var Mt=2147483647;Ke.kMaxLength=Mt;d. +TYPED_ARRAY_SUPPORT=so();!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ -rowser support.");function io(){try{let r=new Uint8Array(1),e={foo:o(function(){ +rowser support.");function so(){try{let r=new Uint8Array(1),e={foo:o(function(){ return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf( -r,e),r.foo()===42}catch{return!1}}o(io,"typedArraySupport");Object.defineProperty( +r,e),r.foo()===42}catch{return!1}}o(so,"typedArraySupport");Object.defineProperty( d.prototype,"parent",{enumerable:!0,get:o(function(){if(d.isBuffer(this))return this. buffer},"get")});Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:o( -function(){if(d.isBuffer(this))return this.byteOffset},"get")});function Ae(r){if(r> -Bt)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array( -r);return Object.setPrototypeOf(e,d.prototype),e}o(Ae,"createBuffer");function d(r,e,t){ +function(){if(d.isBuffer(this))return this.byteOffset},"get")});function Ce(r){if(r> +Mt)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array( +r);return Object.setPrototypeOf(e,d.prototype),e}o(Ce,"createBuffer");function d(r,e,t){ if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" a\ -rgument must be of type string. Received type number');return pr(r)}return Yn(r, -e,t)}o(d,"Buffer");d.poolSize=8192;function Yn(r,e,t){if(typeof r=="string")return ao( -r,e);if(ArrayBuffer.isView(r))return oo(r);if(r==null)throw new TypeError("The f\ +rgument must be of type string. Received type number');return mr(r)}return Xn(r, +e,t)}o(d,"Buffer");d.poolSize=8192;function Xn(r,e,t){if(typeof r=="string")return oo( +r,e);if(ArrayBuffer.isView(r))return uo(r);if(r==null)throw new TypeError("The f\ irst argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-l\ -ike Object. Received type "+typeof r);if(Ee(r,ArrayBuffer)||r&&Ee(r.buffer,ArrayBuffer)|| -typeof SharedArrayBuffer<"u"&&(Ee(r,SharedArrayBuffer)||r&&Ee(r.buffer,SharedArrayBuffer))) -return fr(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ +ike Object. Received type "+typeof r);if(xe(r,ArrayBuffer)||r&&xe(r.buffer,ArrayBuffer)|| +typeof SharedArrayBuffer<"u"&&(xe(r,SharedArrayBuffer)||r&&xe(r.buffer,SharedArrayBuffer))) +return pr(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ must not be of type number. Received type number');let n=r.valueOf&&r.valueOf(); -if(n!=null&&n!==r)return d.from(n,e,t);let i=uo(r);if(i)return i;if(typeof Symbol< +if(n!=null&&n!==r)return d.from(n,e,t);let i=co(r);if(i)return i;if(typeof Symbol< "u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return d. from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argumen\ t must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. \ -Received type "+typeof r)}o(Yn,"from");d.from=function(r,e,t){return Yn(r,e,t)}; +Received type "+typeof r)}o(Xn,"from");d.from=function(r,e,t){return Xn(r,e,t)}; Object.setPrototypeOf(d.prototype,Uint8Array.prototype);Object.setPrototypeOf(d, -Uint8Array);function Zn(r){if(typeof r!="number")throw new TypeError('"size" arg\ +Uint8Array);function ei(r){if(typeof r!="number")throw new TypeError('"size" arg\ ument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is\ - invalid for option "size"')}o(Zn,"assertSize");function so(r,e,t){return Zn(r), -r<=0?Ae(r):e!==void 0?typeof t=="string"?Ae(r).fill(e,t):Ae(r).fill(e):Ae(r)}o(so, -"alloc");d.alloc=function(r,e,t){return so(r,e,t)};function pr(r){return Zn(r),Ae( -r<0?0:yr(r)|0)}o(pr,"allocUnsafe");d.allocUnsafe=function(r){return pr(r)};d.allocUnsafeSlow= -function(r){return pr(r)};function ao(r,e){if((typeof e!="string"||e==="")&&(e="\ -utf8"),!d.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Xn(r,e)| -0,n=Ae(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}o(ao,"fromString");function hr(r){ -let e=r.length<0?0:yr(r.length)|0,t=Ae(e);for(let n=0;n= -Bt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ -Bt.toString(16)+" bytes");return r|0}o(yr,"checked");function co(r){return+r!=r&& -(r=0),d.alloc(+r)}o(co,"SlowBuffer");d.isBuffer=o(function(e){return e!=null&&e. -_isBuffer===!0&&e!==d.prototype},"isBuffer");d.compare=o(function(e,t){if(Ee(e,Uint8Array)&& -(e=d.from(e,e.offset,e.byteLength)),Ee(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)), +n,d.prototype),n}o(pr,"fromArrayBuffer");function co(r){if(d.isBuffer(r)){let e=wr( +r.length)|0,t=Ce(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0) +return typeof r.length!="number"||Sr(r.length)?Ce(0):dr(r);if(r.type==="Buffer"&& +Array.isArray(r.data))return dr(r.data)}o(co,"fromObject");function wr(r){if(r>= +Mt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ +Mt.toString(16)+" bytes");return r|0}o(wr,"checked");function lo(r){return+r!=r&& +(r=0),d.alloc(+r)}o(lo,"SlowBuffer");d.isBuffer=o(function(e){return e!=null&&e. +_isBuffer===!0&&e!==d.prototype},"isBuffer");d.compare=o(function(e,t){if(xe(e,Uint8Array)&& +(e=d.from(e,e.offset,e.byteLength)),xe(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)), !d.isBuffer(e)||!d.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments\ must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t. length;for(let s=0,a=Math.min(n,i);si.length?(d.isBuffer( +for(n=0;ni.length?(d.isBuffer( a)||(a=d.from(a)),a.copy(i,s)):Uint8Array.prototype.set.call(i,a,s);else if(d.isBuffer( a))a.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buf\ -fers');s+=a.length}return i},"concat");function Xn(r,e){if(d.isBuffer(r))return r. -length;if(ArrayBuffer.isView(r)||Ee(r,ArrayBuffer))return r.byteLength;if(typeof r!= +fers');s+=a.length}return i},"concat");function ti(r,e){if(d.isBuffer(r))return r. +length;if(ArrayBuffer.isView(r)||xe(r,ArrayBuffer))return r.byteLength;if(typeof r!= "string")throw new TypeError('The "string" argument must be one of type string, \ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length> 2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"\ -latin1":case"binary":return t;case"utf8":case"utf-8":return dr(r).length;case"uc\ +latin1":case"binary":return t;case"utf8":case"utf-8":return yr(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ -base64":return ui(r).length;default:if(i)return n?-1:dr(r).length;e=(""+e).toLowerCase(), -i=!0}}o(Xn,"byteLength");d.byteLength=Xn;function lo(r,e,t){let n=!1;if((e===void 0|| +base64":return li(r).length;default:if(i)return n?-1:yr(r).length;e=(""+e).toLowerCase(), +i=!0}}o(ti,"byteLength");d.byteLength=ti;function ho(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| -(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return bo( -this,e,t);case"utf8":case"utf-8":return ti(this,e,t);case"ascii":return So(this, -e,t);case"latin1":case"binary":return Eo(this,e,t);case"base64":return mo(this,e, -t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xo(this,e,t);default: +(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return xo( +this,e,t);case"utf8":case"utf-8":return ni(this,e,t);case"ascii":return bo(this, +e,t);case"latin1":case"binary":return Eo(this,e,t);case"base64":return go(this,e, +t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ao(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}o( -lo,"slowToString");d.prototype._isBuffer=!0;function Me(r,e,t){let n=r[e];r[e]=r[t], -r[t]=n}o(Me,"swap");d.prototype.swap16=o(function(){let e=this.length;if(e%2!==0) +ho,"slowToString");d.prototype._isBuffer=!0;function ke(r,e,t){let n=r[e];r[e]=r[t], +r[t]=n}o(ke,"swap");d.prototype.swap16=o(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< -e;t+=2)Me(this,t,t+1);return this},"swap16");d.prototype.swap32=o(function(){let e=this. +e;t+=2)ke(this,t,t+1);return this},"swap16");d.prototype.swap32=o(function(){let e=this. length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bit\ -s");for(let t=0;tt&&(e+=" ... "),""},"inspect");Gn&&(d.prototype[Gn]=d.prototype.inspect);d.prototype.compare= -o(function(e,t,n,i,s){if(Ee(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d. +e+">"},"inspect");zn&&(d.prototype[zn]=d.prototype.inspect);d.prototype.compare= +o(function(e,t,n,i,s){if(xe(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d. isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffe\ r or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e? e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0|| s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0; if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0; let a=s-i,u=n-t,c=Math.min(a,u),l=this.slice(i,s),h=e.slice(t,n);for(let f=0;f2147483647?t=2147483647: -t<-2147483648&&(t=-2147483648),t=+t,mr(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t), +t<-2147483648&&(t=-2147483648),t=+t,Sr(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t), t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e== -"string"&&(e=d.from(e,n)),d.isBuffer(e))return e.length===0?-1:Vn(r,e,t,n,i);if(typeof e== +"string"&&(e=d.from(e,n)),d.isBuffer(e))return e.length===0?-1:Jn(r,e,t,n,i);if(typeof e== "number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array. -prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Vn(r, -[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}o(ei,"bid\ -irectionalIndexOf");function Vn(r,e,t,n,i){let s=1,a=r.length,u=e.length;if(n!== +prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Jn(r, +[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}o(ri,"bid\ +irectionalIndexOf");function Jn(r,e,t,n,i){let s=1,a=r.length,u=e.length;if(n!== void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="\ utf-16le")){if(r.length<2||e.length<2)return-1;s=2,a/=2,u/=2,t/=2}function c(h,f){ return s===1?h[f]:h.readUInt16BE(f*s)}o(c,"read");let l;if(i){let h=-1;for(l=t;l< a;l++)if(c(r,l)===c(e,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===u)return h*s}else h!== -1&&(l-=l-h),h=-1}else for(t+u>a&&(t=a-u),l=t;l>=0;l--){let h=!0;for(let f=0;fi&&(n=i)):n=i;let s=e.length;n> -s/2&&(n=s/2);let a;for(a=0;a>>0,isFinite(n)? (n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.wri\ te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let a=!1;for(;;)switch(i){case"\ -hex":return ho(this,e,t,n);case"utf8":case"utf-8":return fo(this,e,t,n);case"asc\ -ii":case"latin1":case"binary":return po(this,e,t,n);case"base64":return yo(this, +hex":return fo(this,e,t,n);case"utf8":case"utf-8":return po(this,e,t,n);case"asc\ +ii":case"latin1":case"binary":return yo(this,e,t,n);case"base64":return mo(this, e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wo(this,e,t,n);default: if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},"\ write");d.prototype.toJSON=o(function(){return{type:"Buffer",data:Array.prototype. -slice.call(this._arr||this,0)}},"toJSON");function mo(r,e,t){return e===0&&t===r. -length?lr.fromByteArray(r):lr.fromByteArray(r.slice(e,t))}o(mo,"base64Slice");function ti(r,e,t){ +slice.call(this._arr||this,0)}},"toJSON");function go(r,e,t){return e===0&&t===r. +length?fr.fromByteArray(r):fr.fromByteArray(r.slice(e,t))}o(go,"base64Slice");function ni(r,e,t){ t=Math.min(r.length,t);let n=[],i=e;for(;i239?4:s>223? 3:s>191?2:1;if(i+u<=t){let c,l,h,f;switch(u){case 1:s<128&&(a=s);break;case 2:c= r[i+1],(c&192)===128&&(f=(s&31)<<6|c&63,f>127&&(a=f));break;case 3:c=r[i+1],l=r[i+ @@ -179,126 +179,126 @@ r[i+1],(c&192)===128&&(f=(s&31)<<6|c&63,f>127&&(a=f));break;case 3:c=r[i+1],l=r[ f>57343)&&(a=f));break;case 4:c=r[i+1],l=r[i+2],h=r[i+3],(c&192)===128&&(l&192)=== 128&&(h&192)===128&&(f=(s&15)<<18|(c&63)<<12|(l&63)<<6|h&63,f>65535&&f<1114112&& (a=f))}}a===null?(a=65533,u=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320| -a&1023),n.push(a),i+=u}return go(n)}o(ti,"utf8Slice");var zn=4096;function go(r){ -let e=r.length;if(e<=zn)return String.fromCharCode.apply(String,r);let t="",n=0; -for(;nn)&&(t=n);let i="";for(let s=e;sn)&&(t=n);let i="";for(let s=e;sn&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),tt)throw new RangeError( -"Trying to access beyond buffer length")}o(ee,"checkOffset");d.prototype.readUintLE= -d.prototype.readUIntLE=o(function(e,t,n){e=e>>>0,t=t>>>0,n||ee(e,t,this.length); +"Trying to access beyond buffer length")}o(re,"checkOffset");d.prototype.readUintLE= +d.prototype.readUIntLE=o(function(e,t,n){e=e>>>0,t=t>>>0,n||re(e,t,this.length); let i=this[e],s=1,a=0;for(;++a>>0,t=t>>>0, -n||ee(e,t,this.length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]* +n||re(e,t,this.length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]* s;return i},"readUIntBE");d.prototype.readUint8=d.prototype.readUInt8=o(function(e,t){ -return e=e>>>0,t||ee(e,1,this.length),this[e]},"readUInt8");d.prototype.readUint16LE= -d.prototype.readUInt16LE=o(function(e,t){return e=e>>>0,t||ee(e,2,this.length),this[e]| +return e=e>>>0,t||re(e,1,this.length),this[e]},"readUInt8");d.prototype.readUint16LE= +d.prototype.readUInt16LE=o(function(e,t){return e=e>>>0,t||re(e,2,this.length),this[e]| this[e+1]<<8},"readUInt16LE");d.prototype.readUint16BE=d.prototype.readUInt16BE= -o(function(e,t){return e=e>>>0,t||ee(e,2,this.length),this[e]<<8|this[e+1]},"rea\ +o(function(e,t){return e=e>>>0,t||re(e,2,this.length),this[e]<<8|this[e+1]},"rea\ dUInt16BE");d.prototype.readUint32LE=d.prototype.readUInt32LE=o(function(e,t){return e= -e>>>0,t||ee(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216}, +e>>>0,t||re(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216}, "readUInt32LE");d.prototype.readUint32BE=d.prototype.readUInt32BE=o(function(e,t){ -return e=e>>>0,t||ee(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<< -8|this[e+3])},"readUInt32BE");d.prototype.readBigUInt64LE=_e(o(function(e){e=e>>> -0,$e(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&at(e,this.length- +return e=e>>>0,t||re(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<< +8|this[e+3])},"readUInt32BE");d.prototype.readBigUInt64LE=Ue(o(function(e){e=e>>> +0,He(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ut(e,this.length- 8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]* 2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,$e(e,"offset");let t=this[e], -n=this[e+7];(t===void 0||n===void 0)&&at(e,this.length-8);let i=t*2**24+this[++e]* +Int64LE"));d.prototype.readBigUInt64BE=Ue(o(function(e){e=e>>>0,He(e,"offset");let t=this[e], +n=this[e+7];(t===void 0||n===void 0)&&ut(e,this.length-8);let i=t*2**24+this[++e]* 2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+ n;return(BigInt(i)<>>0,t=t>>>0,n||ee(e,t,this.length);let i=this[e],s=1,a=0;for(;++a< +o(function(e,t,n){e=e>>>0,t=t>>>0,n||re(e,t,this.length);let i=this[e],s=1,a=0;for(;++a< t&&(s*=256);)i+=this[e+a]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i},"readInt\ -LE");d.prototype.readIntBE=o(function(e,t,n){e=e>>>0,t=t>>>0,n||ee(e,t,this.length); +LE");d.prototype.readIntBE=o(function(e,t,n){e=e>>>0,t=t>>>0,n||re(e,t,this.length); let i=t,s=1,a=this[e+--i];for(;i>0&&(s*=256);)a+=this[e+--i]*s;return s*=128,a>= s&&(a-=Math.pow(2,8*t)),a},"readIntBE");d.prototype.readInt8=o(function(e,t){return e= -e>>>0,t||ee(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8"); -d.prototype.readInt16LE=o(function(e,t){e=e>>>0,t||ee(e,2,this.length);let n=this[e]| +e>>>0,t||re(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8"); +d.prototype.readInt16LE=o(function(e,t){e=e>>>0,t||re(e,2,this.length);let n=this[e]| this[e+1]<<8;return n&32768?n|4294901760:n},"readInt16LE");d.prototype.readInt16BE= -o(function(e,t){e=e>>>0,t||ee(e,2,this.length);let n=this[e+1]|this[e]<<8;return n& +o(function(e,t){e=e>>>0,t||re(e,2,this.length);let n=this[e+1]|this[e]<<8;return n& 32768?n|4294901760:n},"readInt16BE");d.prototype.readInt32LE=o(function(e,t){return e= -e>>>0,t||ee(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"\ -readInt32LE");d.prototype.readInt32BE=o(function(e,t){return e=e>>>0,t||ee(e,4,this. +e>>>0,t||re(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"\ +readInt32LE");d.prototype.readInt32BE=o(function(e,t){return e=e>>>0,t||re(e,4,this. length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");d.prototype. -readBigInt64LE=_e(o(function(e){e=e>>>0,$e(e,"offset");let t=this[e],n=this[e+7]; -(t===void 0||n===void 0)&&at(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+ +readBigInt64LE=Ue(o(function(e){e=e>>>0,He(e,"offset");let t=this[e],n=this[e+7]; +(t===void 0||n===void 0)&&ut(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+ 6]*2**16+(n<<24);return(BigInt(i)<>>0,$e(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&at(e, +2**16+this[++e]*2**24)},"readBigInt64LE"));d.prototype.readBigInt64BE=Ue(o(function(e){ +e=e>>>0,He(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ut(e, this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt( i)<>>0,t||ee(e,4,this. -length),Qe.read(this,e,!0,23,4)},"readFloatLE");d.prototype.readFloatBE=o(function(e,t){ -return e=e>>>0,t||ee(e,4,this.length),Qe.read(this,e,!1,23,4)},"readFloatBE");d. -prototype.readDoubleLE=o(function(e,t){return e=e>>>0,t||ee(e,8,this.length),Qe. +igInt64BE"));d.prototype.readFloatLE=o(function(e,t){return e=e>>>0,t||re(e,4,this. +length),je.read(this,e,!0,23,4)},"readFloatLE");d.prototype.readFloatBE=o(function(e,t){ +return e=e>>>0,t||re(e,4,this.length),je.read(this,e,!1,23,4)},"readFloatBE");d. +prototype.readDoubleLE=o(function(e,t){return e=e>>>0,t||re(e,8,this.length),je. read(this,e,!0,52,8)},"readDoubleLE");d.prototype.readDoubleBE=o(function(e,t){return e= -e>>>0,t||ee(e,8,this.length),Qe.read(this,e,!1,52,8)},"readDoubleBE");function he(r,e,t,n,i,s){ +e>>>0,t||re(e,8,this.length),je.read(this,e,!1,52,8)},"readDoubleBE");function fe(r,e,t,n,i,s){ if(!d.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instan\ ce');if(e>i||er.length)throw new RangeError("Index out of range")}o(he,"checkInt");d.prototype. +n>r.length)throw new RangeError("Index out of range")}o(fe,"checkInt");d.prototype. writeUintLE=d.prototype.writeUIntLE=o(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0, -!i){let u=Math.pow(2,8*n)-1;he(this,e,t,n,u,0)}let s=1,a=0;for(this[t]=e&255;++a< +!i){let u=Math.pow(2,8*n)-1;fe(this,e,t,n,u,0)}let s=1,a=0;for(this[t]=e&255;++a< n&&(s*=256);)this[t+a]=e/s&255;return t+n},"writeUIntLE");d.prototype.writeUintBE= d.prototype.writeUIntBE=o(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math. -pow(2,8*n)-1;he(this,e,t,n,u,0)}let s=n-1,a=1;for(this[t+s]=e&255;--s>=0&&(a*=256);) +pow(2,8*n)-1;fe(this,e,t,n,u,0)}let s=n-1,a=1;for(this[t+s]=e&255;--s>=0&&(a*=256);) this[t+s]=e/a&255;return t+n},"writeUIntBE");d.prototype.writeUint8=d.prototype. -writeUInt8=o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e,t,1,255,0),this[t]= +writeUInt8=o(function(e,t,n){return e=+e,t=t>>>0,n||fe(this,e,t,1,255,0),this[t]= e&255,t+1},"writeUInt8");d.prototype.writeUint16LE=d.prototype.writeUInt16LE=o(function(e,t,n){ -return e=+e,t=t>>>0,n||he(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2}, +return e=+e,t=t>>>0,n||fe(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2}, "writeUInt16LE");d.prototype.writeUint16BE=d.prototype.writeUInt16BE=o(function(e,t,n){ -return e=+e,t=t>>>0,n||he(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2}, +return e=+e,t=t>>>0,n||fe(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2}, "writeUInt16BE");d.prototype.writeUint32LE=d.prototype.writeUInt32LE=o(function(e,t,n){ -return e=+e,t=t>>>0,n||he(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>> +return e=+e,t=t>>>0,n||fe(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>> 16,this[t+1]=e>>>8,this[t]=e&255,t+4},"writeUInt32LE");d.prototype.writeUint32BE= -d.prototype.writeUInt32BE=o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e,t,4, +d.prototype.writeUInt32BE=o(function(e,t,n){return e=+e,t=t>>>0,n||fe(this,e,t,4, 4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+ -4},"writeUInt32BE");function ri(r,e,t,n,i){oi(e,n,i,r,t,7);let s=Number(e&BigInt( +4},"writeUInt32BE");function ii(r,e,t,n,i){ci(e,n,i,r,t,7);let s=Number(e&BigInt( 4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let a=Number( e>>BigInt(32)&BigInt(4294967295));return r[t++]=a,a=a>>8,r[t++]=a,a=a>>8,r[t++]= -a,a=a>>8,r[t++]=a,t}o(ri,"wrtBigUInt64LE");function ni(r,e,t,n,i){oi(e,n,i,r,t,7); +a,a=a>>8,r[t++]=a,t}o(ii,"wrtBigUInt64LE");function si(r,e,t,n,i){ci(e,n,i,r,t,7); let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>> 8,r[t+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=a,a=a>>8, -r[t+2]=a,a=a>>8,r[t+1]=a,a=a>>8,r[t]=a,t+8}o(ni,"wrtBigUInt64BE");d.prototype.writeBigUInt64LE= -_e(o(function(e,t=0){return ri(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}, -"writeBigUInt64LE"));d.prototype.writeBigUInt64BE=_e(o(function(e,t=0){return ni( +r[t+2]=a,a=a>>8,r[t+1]=a,a=a>>8,r[t]=a,t+8}o(si,"wrtBigUInt64BE");d.prototype.writeBigUInt64LE= +Ue(o(function(e,t=0){return ii(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}, +"writeBigUInt64LE"));d.prototype.writeBigUInt64BE=Ue(o(function(e,t=0){return si( this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE"));d.prototype. -writeIntLE=o(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);he(this, +writeIntLE=o(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);fe(this, e,t,n,c-1,-c)}let s=0,a=1,u=0;for(this[t]=e&255;++s>0)-u&255;return t+n},"writeIntLE");d.prototype.writeIntBE= -o(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);he(this,e,t,n,c- +o(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2,8*n-1);fe(this,e,t,n,c- 1,-c)}let s=n-1,a=1,u=0;for(this[t+s]=e&255;--s>=0&&(a*=256);)e<0&&u===0&&this[t+ s+1]!==0&&(u=1),this[t+s]=(e/a>>0)-u&255;return t+n},"writeIntBE");d.prototype.writeInt8= -o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e,t,1,127,-128),e<0&&(e=255+e+1), +o(function(e,t,n){return e=+e,t=t>>>0,n||fe(this,e,t,1,127,-128),e<0&&(e=255+e+1), this[t]=e&255,t+1},"writeInt8");d.prototype.writeInt16LE=o(function(e,t,n){return e= -+e,t=t>>>0,n||he(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},"wr\ -iteInt16LE");d.prototype.writeInt16BE=o(function(e,t,n){return e=+e,t=t>>>0,n||he( ++e,t=t>>>0,n||fe(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},"wr\ +iteInt16LE");d.prototype.writeInt16BE=o(function(e,t,n){return e=+e,t=t>>>0,n||fe( this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},"writeInt16BE");d.prototype. -writeInt32LE=o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e,t,4,2147483647,-2147483648), +writeInt32LE=o(function(e,t,n){return e=+e,t=t>>>0,n||fe(this,e,t,4,2147483647,-2147483648), this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},"writeInt32\ -LE");d.prototype.writeInt32BE=o(function(e,t,n){return e=+e,t=t>>>0,n||he(this,e, +LE");d.prototype.writeInt32BE=o(function(e,t,n){return e=+e,t=t>>>0,n||fe(this,e, t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>> 16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeInt32BE");d.prototype.writeBigInt64LE= -_e(o(function(e,t=0){return ri(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x\ -7fffffffffffffff"))},"writeBigInt64LE"));d.prototype.writeBigInt64BE=_e(o(function(e,t=0){ -return ni(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}, -"writeBigInt64BE"));function ii(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError( -"Index out of range");if(t<0)throw new RangeError("Index out of range")}o(ii,"ch\ -eckIEEE754");function si(r,e,t,n,i){return e=+e,t=t>>>0,i||ii(r,e,t,4,34028234663852886e22, --34028234663852886e22),Qe.write(r,e,t,n,23,4),t+4}o(si,"writeFloat");d.prototype. -writeFloatLE=o(function(e,t,n){return si(this,e,t,!0,n)},"writeFloatLE");d.prototype. -writeFloatBE=o(function(e,t,n){return si(this,e,t,!1,n)},"writeFloatBE");function ai(r,e,t,n,i){ -return e=+e,t=t>>>0,i||ii(r,e,t,8,17976931348623157e292,-17976931348623157e292), -Qe.write(r,e,t,n,52,8),t+8}o(ai,"writeDouble");d.prototype.writeDoubleLE=o(function(e,t,n){ -return ai(this,e,t,!0,n)},"writeDoubleLE");d.prototype.writeDoubleBE=o(function(e,t,n){ -return ai(this,e,t,!1,n)},"writeDoubleBE");d.prototype.copy=o(function(e,t,n,i){ +Ue(o(function(e,t=0){return ii(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x\ +7fffffffffffffff"))},"writeBigInt64LE"));d.prototype.writeBigInt64BE=Ue(o(function(e,t=0){ +return si(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}, +"writeBigInt64BE"));function ai(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError( +"Index out of range");if(t<0)throw new RangeError("Index out of range")}o(ai,"ch\ +eckIEEE754");function oi(r,e,t,n,i){return e=+e,t=t>>>0,i||ai(r,e,t,4,34028234663852886e22, +-34028234663852886e22),je.write(r,e,t,n,23,4),t+4}o(oi,"writeFloat");d.prototype. +writeFloatLE=o(function(e,t,n){return oi(this,e,t,!0,n)},"writeFloatLE");d.prototype. +writeFloatBE=o(function(e,t,n){return oi(this,e,t,!1,n)},"writeFloatBE");function ui(r,e,t,n,i){ +return e=+e,t=t>>>0,i||ai(r,e,t,8,17976931348623157e292,-17976931348623157e292), +je.write(r,e,t,n,52,8),t+8}o(ui,"writeDouble");d.prototype.writeDoubleLE=o(function(e,t,n){ +return ui(this,e,t,!0,n)},"writeDoubleLE");d.prototype.writeDoubleBE=o(function(e,t,n){ +return ui(this,e,t,!1,n)},"writeDoubleBE");d.prototype.copy=o(function(e,t,n,i){ if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0), !i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e== "number")for(s=t;s2**32?i=Jn(String(t)):typeof t=="\ +gr("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range\ +.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=Zn(String(t)):typeof t=="\ bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i= -Jn(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Jn(r){ +Zn(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Zn(r){ let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`; -return`${r.slice(0,t)}${e}`}o(Jn,"addNumericalSeparator");function Ao(r,e,t){$e( -e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&at(e,r.length-(t+1))}o(Ao,"checkBo\ -unds");function oi(r,e,t,n,i,s){if(r>t||r +return`${r.slice(0,t)}${e}`}o(Zn,"addNumericalSeparator");function vo(r,e,t){He( +e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&ut(e,r.length-(t+1))}o(vo,"checkBo\ +unds");function ci(r,e,t,n,i,s){if(r>t||r 3?e===0||e===BigInt(0)?u=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:u=`>= -(2${a} \ ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:u=`>= ${e}${a} and <= ${t}${a}`, -new ke.ERR_OUT_OF_RANGE("value",u,r)}Ao(n,i,s)}o(oi,"checkIntBI");function $e(r,e){ -if(typeof r!="number")throw new ke.ERR_INVALID_ARG_TYPE(e,"number",r)}o($e,"vali\ -dateNumber");function at(r,e,t){throw Math.floor(r)!==r?($e(r,t),new ke.ERR_OUT_OF_RANGE( -t||"offset","an integer",r)):e<0?new ke.ERR_BUFFER_OUT_OF_BOUNDS:new ke.ERR_OUT_OF_RANGE( -t||"offset",`>= ${t?1:0} and <= ${e}`,r)}o(at,"boundsError");var vo=/[^+/0-9A-Za-z-_]/g; -function Co(r){if(r=r.split("=")[0],r=r.trim().replace(vo,""),r.length<2)return""; -for(;r.length%4!==0;)r=r+"=";return r}o(Co,"base64clean");function dr(r,e){e=e|| +new $e.ERR_OUT_OF_RANGE("value",u,r)}vo(n,i,s)}o(ci,"checkIntBI");function He(r,e){ +if(typeof r!="number")throw new $e.ERR_INVALID_ARG_TYPE(e,"number",r)}o(He,"vali\ +dateNumber");function ut(r,e,t){throw Math.floor(r)!==r?(He(r,t),new $e.ERR_OUT_OF_RANGE( +t||"offset","an integer",r)):e<0?new $e.ERR_BUFFER_OUT_OF_BOUNDS:new $e.ERR_OUT_OF_RANGE( +t||"offset",`>= ${t?1:0} and <= ${e}`,r)}o(ut,"boundsError");var Co=/[^+/0-9A-Za-z-_]/g; +function _o(r){if(r=r.split("=")[0],r=r.trim().replace(Co,""),r.length<2)return""; +for(;r.length%4!==0;)r=r+"=";return r}o(_o,"base64clean");function yr(r,e){e=e|| 1/0;let t,n=r.length,i=null,s=[];for(let a=0;a55295&& t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1=== n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s. @@ -350,74 +350,74 @@ s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048) if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s. push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push( t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code \ -point")}return s}o(dr,"utf8ToBytes");function _o(r){let e=[];for(let t=0;t>8,i=t%256, -s.push(i),s.push(n);return s}o(To,"utf16leToBytes");function ui(r){return lr.toByteArray( -Co(r))}o(ui,"base64ToBytes");function Rt(r,e,t,n){let i;for(i=0;i=e.length|| -i>=r.length);++i)e[i+t]=r[i];return i}o(Rt,"blitBuffer");function Ee(r,e){return r instanceof +s.push(i),s.push(n);return s}o(Uo,"utf16leToBytes");function li(r){return fr.toByteArray( +_o(r))}o(li,"base64ToBytes");function Dt(r,e,t,n){let i;for(i=0;i=e.length|| +i>=r.length);++i)e[i+t]=r[i];return i}o(Dt,"blitBuffer");function xe(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name=== -e.name}o(Ee,"isInstance");function mr(r){return r!==r}o(mr,"numberIsNaN");var Lo=function(){ +e.name}o(xe,"isInstance");function Sr(r){return r!==r}o(Sr,"numberIsNaN");var Lo=function(){ let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< -16;++i)e[n+i]=r[t]+r[i]}return e}();function _e(r){return typeof BigInt>"u"?Uo:r} -o(_e,"defineBigIntMethod");function Uo(){throw new Error("BigInt not supported")} -o(Uo,"BufferBigIntNotDefined")});var _,T,L,A,w,S,p=le(()=>{"use strict";_=globalThis,T=globalThis.setImmediate??(r=>setTimeout( -r,0)),L=globalThis.clearImmediate??(r=>clearTimeout(r)),A=globalThis.crypto??{}; +16;++i)e[n+i]=r[t]+r[i]}return e}();function Ue(r){return typeof BigInt>"u"?Io:r} +o(Ue,"defineBigIntMethod");function Io(){throw new Error("BigInt not supported")} +o(Io,"BufferBigIntNotDefined")});var _,T,U,A,w,S,y=ye(()=>{"use strict";_=globalThis,T=globalThis.setImmediate??(r=>setTimeout( +r,0)),U=globalThis.clearImmediate??(r=>clearTimeout(r)),A=globalThis.crypto??{}; A.subtle??={};w=typeof globalThis.Buffer=="function"&&typeof globalThis.Buffer.allocUnsafe== -"function"?globalThis.Buffer:ci().Buffer,S=globalThis.process??{};S.env??={};try{ -S.nextTick(()=>{})}catch{let e=Promise.resolve();S.nextTick=e.then.bind(e)}});var Ue=B((hf,Ur)=>{"use strict";p();var Ge=typeof Reflect=="object"?Reflect:null, -Bi=Ge&&typeof Ge.apply=="function"?Ge.apply:o(function(e,t,n){return Function.prototype. -apply.call(e,t,n)},"ReflectApply"),Ot;Ge&&typeof Ge.ownKeys=="function"?Ot=Ge.ownKeys: -Object.getOwnPropertySymbols?Ot=o(function(e){return Object.getOwnPropertyNames( -e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):Ot=o(function(e){return Object. -getOwnPropertyNames(e)},"ReflectOwnKeys");function _u(r){console&&console.warn&& -console.warn(r)}o(_u,"ProcessEmitWarning");var Ni=Number.isNaN||o(function(e){return e!== -e},"NumberIsNaN");function Q(){Q.init.call(this)}o(Q,"EventEmitter");Ur.exports= -Q;Ur.exports.once=Iu;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount= -0;Q.prototype._maxListeners=void 0;var Ri=10;function kt(r){if(typeof r!="functi\ +"function"?globalThis.Buffer:hi().Buffer,S=globalThis.process??{};S.env??={};try{ +S.nextTick(()=>{})}catch{let e=Promise.resolve();S.nextTick=e.then.bind(e)}});var Be=R((bf,Pr)=>{"use strict";y();var ze=typeof Reflect=="object"?Reflect:null, +Ni=ze&&typeof ze.apply=="function"?ze.apply:o(function(e,t,n){return Function.prototype. +apply.call(e,t,n)},"ReflectApply"),Qt;ze&&typeof ze.ownKeys=="function"?Qt=ze.ownKeys: +Object.getOwnPropertySymbols?Qt=o(function(e){return Object.getOwnPropertyNames( +e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):Qt=o(function(e){return Object. +getOwnPropertyNames(e)},"ReflectOwnKeys");function Nu(r){console&&console.warn&& +console.warn(r)}o(Nu,"ProcessEmitWarning");var Di=Number.isNaN||o(function(e){return e!== +e},"NumberIsNaN");function O(){O.init.call(this)}o(O,"EventEmitter");Pr.exports= +O;Pr.exports.once=qu;O.EventEmitter=O;O.prototype._events=void 0;O.prototype._eventsCount= +0;O.prototype._maxListeners=void 0;var Mi=10;function $t(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ -ved type '+typeof r)}o(kt,"checkListener");Object.defineProperty(Q,"defaultMaxLi\ -steners",{enumerable:!0,get:o(function(){return Ri},"get"),set:o(function(r){if(typeof r!= -"number"||r<0||Ni(r))throw new RangeError('The value of "defaultMaxListeners" is\ - out of range. It must be a non-negative number. Received '+r+".");Ri=r},"set")}); -Q.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). +ved type '+typeof r)}o($t,"checkListener");Object.defineProperty(O,"defaultMaxLi\ +steners",{enumerable:!0,get:o(function(){return Mi},"get"),set:o(function(r){if(typeof r!= +"number"||r<0||Di(r))throw new RangeError('The value of "defaultMaxListeners" is\ + out of range. It must be a non-negative number. Received '+r+".");Mi=r},"set")}); +O.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). _events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners= -this._maxListeners||void 0};Q.prototype.setMaxListeners=o(function(e){if(typeof e!= -"number"||e<0||Ni(e))throw new RangeError('The value of "n" is out of range. It \ +this._maxListeners||void 0};O.prototype.setMaxListeners=o(function(e){if(typeof e!= +"number"||e<0||Di(e))throw new RangeError('The value of "n" is out of range. It \ must be a non-negative number. Received '+e+".");return this._maxListeners=e,this}, -"setMaxListeners");function Mi(r){return r._maxListeners===void 0?Q.defaultMaxListeners: -r._maxListeners}o(Mi,"_getMaxListeners");Q.prototype.getMaxListeners=o(function(){ -return Mi(this)},"getMaxListeners");Q.prototype.emit=o(function(e){for(var t=[], +"setMaxListeners");function Fi(r){return r._maxListeners===void 0?O.defaultMaxListeners: +r._maxListeners}o(Fi,"_getMaxListeners");O.prototype.getMaxListeners=o(function(){ +return Fi(this)},"getMaxListeners");O.prototype.emit=o(function(e){for(var t=[], n=1;n 0&&(a=t[0]),a instanceof Error)throw a;var u=new Error("Unhandled error."+(a?" ("+ a.message+")":""));throw u.context=a,u}var c=s[e];if(c===void 0)return!1;if(typeof c== -"function")Bi(c,this,t);else for(var l=c.length,h=ki(c,l),n=0;n0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Po\ +t):a.push(t),i=Fi(r),i>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Po\ ssible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ -ededWarning",u.emitter=r,u.type=e,u.count=a.length,_u(u)}return r}o(Di,"_addList\ -ener");Q.prototype.addListener=o(function(e,t){return Di(this,e,t,!1)},"addListe\ -ner");Q.prototype.on=Q.prototype.addListener;Q.prototype.prependListener=o(function(e,t){ -return Di(this,e,t,!0)},"prependListener");function Tu(){if(!this.fired)return this. +ededWarning",u.emitter=r,u.type=e,u.count=a.length,Nu(u)}return r}o(qi,"_addList\ +ener");O.prototype.addListener=o(function(e,t){return qi(this,e,t,!1)},"addListe\ +ner");O.prototype.on=O.prototype.addListener;O.prototype.prependListener=o(function(e,t){ +return qi(this,e,t,!0)},"prependListener");function Mu(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? -this.listener.call(this.target):this.listener.apply(this.target,arguments)}o(Tu, -"onceWrapper");function qi(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Tu.bind(n);return i.listener=t,n.wrapFn=i,i}o(qi,"_onceWrap");Q.prototype. -once=o(function(e,t){return kt(t),this.on(e,qi(this,e,t)),this},"once");Q.prototype. -prependOnceListener=o(function(e,t){return kt(t),this.prependListener(e,qi(this, -e,t)),this},"prependOnceListener");Q.prototype.removeListener=o(function(e,t){var n, -i,s,a,u;if(kt(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this; +this.listener.call(this.target):this.listener.apply(this.target,arguments)}o(Mu, +"onceWrapper");function ki(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, +listener:t},i=Mu.bind(n);return i.listener=t,n.wrapFn=i,i}o(ki,"_onceWrap");O.prototype. +once=o(function(e,t){return $t(t),this.on(e,ki(this,e,t)),this},"once");O.prototype. +prependOnceListener=o(function(e,t){return $t(t),this.prependListener(e,ki(this, +e,t)),this},"prependOnceListener");O.prototype.removeListener=o(function(e,t){var n, +i,s,a,u;if($t(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this; if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){u=n[a]. -listener,s=a;break}if(s<0)return this;s===0?n.shift():Lu(n,s),n.length===1&&(i[e]= +listener,s=a;break}if(s<0)return this;s===0?n.shift():Du(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, -"removeListener");Q.prototype.off=Q.prototype.removeListener;Q.prototype.removeAllListeners= +"removeListener");O.prototype.off=O.prototype.removeListener;O.prototype.removeAllListeners= o(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount= 0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]), @@ -425,55 +425,69 @@ this;if(arguments.length===0){var s=Object.keys(n),a;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function Fi(r,e,t){ +1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function Oi(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?Uu(i):ki(i,i.length)}o(Fi,"_listeners");Q.prototype. -listeners=o(function(e){return Fi(this,e,!0)},"listeners");Q.prototype.rawListeners= -o(function(e){return Fi(this,e,!1)},"rawListeners");Q.listenerCount=function(r,e){ -return typeof r.listenerCount=="function"?r.listenerCount(e):Oi.call(r,e)};Q.prototype. -listenerCount=Oi;function Oi(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== -"function")return 1;if(t!==void 0)return t.length}return 0}o(Oi,"listenerCount"); -Q.prototype.eventNames=o(function(){return this._eventsCount>0?Ot(this._events): -[]},"eventNames");function ki(r,e){for(var t=new Array(e),n=0;n0?Qt(this._events): +[]},"eventNames");function $i(r,e){for(var t=new Array(e),n=0;nBu});var Bu,ht=le(()=>{"use strict";p();Bu={}});function ft(r){let e=1779033703,t=3144134277,n=1013904242,i=2773480762,s=1359893119, -a=2600822924,u=528734635,c=1541459225,l=0,h=0,f=[1116352408,1899447441,3049323471, -3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278, -1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078, -604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808, -3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372, -1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800, -3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, -883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, -2361852424,2428436474,2756734187,3204031479,3329325298],y=o((E,g)=>E>>>g|E<<32-g, -"rrot"),m=new Uint32Array(64),b=new Uint8Array(64),U=o(()=>{for(let M=0,$=0;M<16;M++, -$+=4)m[M]=b[$]<<24|b[$+1]<<16|b[$+2]<<8|b[$+3];for(let M=16;M<64;M++){let $=y(m[M- -15],7)^y(m[M-15],18)^m[M-15]>>>3,j=y(m[M-2],17)^y(m[M-2],19)^m[M-2]>>>10;m[M]=m[M- -16]+$+m[M-7]+j|0}let E=e,g=t,x=n,N=i,P=s,D=a,q=u,Z=c;for(let M=0;M<64;M++){let $=y( -P,6)^y(P,11)^y(P,25),j=P&D^~P&q,H=Z+$+j+f[M]+m[M]|0,K=y(E,2)^y(E,13)^y(E,22),J=E& -g^E&x^g&x,F=K+J|0;Z=q,q=D,D=P,P=N+H|0,N=x,x=g,g=E,E=H+F|0}e=e+E|0,t=t+g|0,n=n+x| -0,i=i+N|0,s=s+P|0,a=a+D|0,u=u+q|0,c=c+Z|0,h=0},"process"),v=o(E=>{typeof E=="str\ -ing"&&(E=new TextEncoder().encode(E));for(let g=0;g{if(b[h++]=128,h==64&&U(),h+8>64){for(;h<64;) -b[h++]=0;U()}for(;h<58;)b[h++]=0;let E=l*8;b[h++]=E/1099511627776&255,b[h++]=E/4294967296& -255,b[h++]=E>>>24,b[h++]=E>>>16&255,b[h++]=E>>>8&255,b[h++]=E&255,U();let g=new Uint8Array( -32);return g[0]=e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]= -t>>>16&255,g[6]=t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255, -g[11]=n&255,g[12]=i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>> -24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255,g[20]=a>>>24,g[21]=a>>>16&255,g[22]= -a>>>8&255,g[23]=a&255,g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255, -g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r=== -void 0?{add:v,digest:C}:(v(r),C())}var $i=le(()=>{"use strict";p();o(ft,"sha256")});var dt,ji=le(()=>{"use strict";p();dt=class r{static{o(this,"Md5")}static hashByteArray(e,t=!1){ +ed type '+typeof r)}o(ji,"eventTargetAgnosticAddListener")});var dt={};me(dt,{default:()=>Ou});var Ou,pt=ye(()=>{"use strict";y();Ou={}});var Br={};me(Br,{Md5:()=>mt,createHash:()=>$u,createHmac:()=>ju,randomBytes:()=>Qu, +sha256:()=>yt});function Qu(r){return A.getRandomValues(w.alloc(r))}function $u(r){ +if(r==="sha256")return{update:o(function(e){return{digest:o(function(){return w. +from(yt(e))},"digest")}},"update")};if(r==="md5")return{update:o(function(e){return{ +digest:o(function(){return typeof e=="string"?mt.hashStr(e):mt.hashByteArray(e)}, +"digest")}},"update")};throw new Error(`Hash type '${r}' not supported`)}function ju(r,e){ +if(r!=="sha256")throw new Error(`Only sha256 is supported (requested: '${r}')`); +return{update:o(function(t){return{digest:o(function(){typeof e=="string"&&(e=new TextEncoder(). +encode(e)),typeof t=="string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n> +64)e=yt(e);else if(n<64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array( +64),s=new Uint8Array(64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let a=new Uint8Array( +t.length+64);a.set(i,0),a.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u. +set(yt(a),64),w.from(yt(u))},"digest")}},"update")}}function yt(r){let e=1779033703, +t=3144134277,n=1013904242,i=2773480762,s=1359893119,a=2600822924,u=528734635,c=1541459225, +l=0,h=0,f=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748, +2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103, +3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692, +1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993, +338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, +2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909, +275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063, +1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479, +3329325298],p=o((b,g)=>b>>>g|b<<32-g,"rrot"),m=new Uint32Array(64),x=new Uint8Array( +64),L=o(()=>{for(let D=0,G=0;D<16;D++,G+=4)m[D]=x[G]<<24|x[G+1]<<16|x[G+2]<<8|x[G+ +3];for(let D=16;D<64;D++){let G=p(m[D-15],7)^p(m[D-15],18)^m[D-15]>>>3,ie=p(m[D- +2],17)^p(m[D-2],19)^m[D-2]>>>10;m[D]=m[D-16]+G+m[D-7]+ie|0}let b=e,g=t,E=n,M=i,B=s, +F=a,H=u,Z=c;for(let D=0;D<64;D++){let G=p(B,6)^p(B,11)^p(B,25),ie=B&F^~B&H,ee=Z+ +G+ie+f[D]+m[D]|0,K=p(b,2)^p(b,13)^p(b,22),$=b&g^b&E^g&E,Q=K+$|0;Z=H,H=F,F=B,B=M+ +ee|0,M=E,E=g,g=b,b=ee+Q|0}e=e+b|0,t=t+g|0,n=n+E|0,i=i+M|0,s=s+B|0,a=a+F|0,u=u+H| +0,c=c+Z|0,h=0},"process"),v=o(b=>{typeof b=="string"&&(b=new TextEncoder().encode( +b));for(let g=0;g{ +if(x[h++]=128,h==64&&L(),h+8>64){for(;h<64;)x[h++]=0;L()}for(;h<58;)x[h++]=0;let b=l* +8;x[h++]=b/1099511627776&255,x[h++]=b/4294967296&255,x[h++]=b>>>24,x[h++]=b>>>16& +255,x[h++]=b>>>8&255,x[h++]=b&255,L();let g=new Uint8Array(32);return g[0]=e>>>24, +g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]=t>>>8& +255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]=i>>> +24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]= +s>>>8&255,g[19]=s&255,g[20]=a>>>24,g[21]=a>>>16&255,g[22]=a>>>8&255,g[23]=a&255, +g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>> +16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r===void 0?{add:v,digest:C}: +(v(r),C())}var mt,Rr=ye(()=>{"use strict";y();o(Qu,"randomBytes");o($u,"createHa\ +sh");o(ju,"createHmac");mt=class r{static{o(this,"Md5")}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ return this.onePassHasher.start().appendAsciiStr(e).end(t)}static stateIdentity=new Int32Array( @@ -549,22 +563,9 @@ n=this._buffer8,i=this._buffer32,s=(t>>2)+1;this._dataLength+=t;let a=this._data (r._md5cycle(this._state,i),i.set(r.buffer32Identity)),a<=4294967295)i[14]=a;else{ let u=a.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return;let c=parseInt(u[2], 16),l=parseInt(u[1],16)||0;i[14]=c,i[15]=l}return r._md5cycle(this._state,i),e?this. -_state:r._hex(this._state)}}});var Ir={};pe(Ir,{createHash:()=>Nu,createHmac:()=>Mu,randomBytes:()=>Ru});function Ru(r){ -return A.getRandomValues(w.alloc(r))}function Nu(r){if(r==="sha256")return{update:o( -function(e){return{digest:o(function(){return w.from(ft(e))},"digest")}},"update")}; -if(r==="md5")return{update:o(function(e){return{digest:o(function(){return typeof e== -"string"?dt.hashStr(e):dt.hashByteArray(e)},"digest")}},"update")};throw new Error( -`Hash type '${r}' not supported`)}function Mu(r,e){if(r!=="sha256")throw new Error( -`Only sha256 is supported (requested: '${r}')`);return{update:o(function(t){return{ -digest:o(function(){typeof e=="string"&&(e=new TextEncoder().encode(e)),typeof t== -"string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n>64)e=ft(e);else if(n< -64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array(64),s=new Uint8Array( -64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let a=new Uint8Array(t.length+ -64);a.set(i,0),a.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u.set(ft(a), -64),w.from(ft(u))},"digest")}},"update")}}var Pr=le(()=>{"use strict";p();$i();ji(); -o(Ru,"randomBytes");o(Nu,"createHash");o(Mu,"createHmac")});var Rr=B(Hi=>{"use strict";p();Hi.parse=function(r,e){return new Br(r,e).parse()}; -var Br=class r{static{o(this,"ArrayParser")}constructor(e,t){this.source=e,this. -transform=t||Du,this.position=0,this.entries=[],this.recorded=[],this.dimension= +_state:r._hex(this._state)}};o(yt,"sha256")});var Mr=R(Hi=>{"use strict";y();Hi.parse=function(r,e){return new Nr(r,e).parse()}; +var Nr=class r{static{o(this,"ArrayParser")}constructor(e,t){this.source=e,this. +transform=t||Hu,this.position=0,this.entries=[],this.recorded=[],this.dimension= 0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this. position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e, escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var t;(this.recorded.length> @@ -577,114 +578,114 @@ this.position-1),this.transform),this.entries.push(n.parse(!0)),this.position+=n position-2);else if(t.value==="}"&&!i){if(this.dimension--,!this.dimension&&(this. newEntry(),e))return this.entries}else t.value==='"'&&!t.escaped?(i&&this.newEntry( !0),i=!i):t.value===","&&!i?this.newEntry():this.record(t.value);if(this.dimension!== -0)throw new Error("array dimension not balanced");return this.entries}};function Du(r){ -return r}o(Du,"identity")});var Nr=B((Lf,Ki)=>{p();var qu=Rr();Ki.exports={create:o(function(r,e){return{parse:o( -function(){return qu.parse(r,e)},"parse")}},"create")}});var Vi=B((Pf,Gi)=>{"use strict";p();var Fu=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, -Ou=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ku=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,Qu=/^-?infinity$/; -Gi.exports=o(function(e){if(Qu.test(e))return Number(e.replace("i","I"));var t=Fu. -exec(e);if(!t)return $u(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=Wi(i));var s=parseInt( +0)throw new Error("array dimension not balanced");return this.entries}};function Hu(r){ +return r}o(Hu,"identity")});var Dr=R((Lf,Ki)=>{y();var Ku=Mr();Ki.exports={create:o(function(r,e){return{parse:o( +function(){return Ku.parse(r,e)},"parse")}},"create")}});var Vi=R((Bf,Gi)=>{"use strict";y();var Wu=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, +Gu=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,Vu=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,zu=/^-?infinity$/; +Gi.exports=o(function(e){if(zu.test(e))return Number(e.replace("i","I"));var t=Wu. +exec(e);if(!t)return Ju(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=Wi(i));var s=parseInt( t[2],10)-1,a=t[3],u=parseInt(t[4],10),c=parseInt(t[5],10),l=parseInt(t[6],10),h=t[7]; -h=h?1e3*parseFloat(h):0;var f,y=ju(e);return y!=null?(f=new Date(Date.UTC(i,s,a, -u,c,l,h)),Mr(i)&&f.setUTCFullYear(i),y!==0&&f.setTime(f.getTime()-y)):(f=new Date( -i,s,a,u,c,l,h),Mr(i)&&f.setFullYear(i)),f},"parseDate");function $u(r){var e=Ou. +h=h?1e3*parseFloat(h):0;var f,p=Yu(e);return p!=null?(f=new Date(Date.UTC(i,s,a, +u,c,l,h)),Fr(i)&&f.setUTCFullYear(i),p!==0&&f.setTime(f.getTime()-p)):(f=new Date( +i,s,a,u,c,l,h),Fr(i)&&f.setFullYear(i)),f},"parseDate");function Ju(r){var e=Gu. exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=Wi(t));var i=parseInt(e[2], -10)-1,s=e[3],a=new Date(t,i,s);return Mr(t)&&a.setFullYear(t),a}}o($u,"getDate"); -function ju(r){if(r.endsWith("+00"))return 0;var e=ku.exec(r.split(" ")[1]);if(e){ +10)-1,s=e[3],a=new Date(t,i,s);return Fr(t)&&a.setFullYear(t),a}}o(Ju,"getDate"); +function Yu(r){if(r.endsWith("+00"))return 0;var e=Vu.exec(r.split(" ")[1]);if(e){ var t=e[1];if(t==="Z")return 0;var n=t==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt( -e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}o(ju,"timeZoneOffset");function Wi(r){ -return-(r-1)}o(Wi,"bcYearToNegativeYear");function Mr(r){return r>=0&&r<100}o(Mr, -"is0To99")});var Ji=B((Nf,zi)=>{p();zi.exports=Ku;var Hu=Object.prototype.hasOwnProperty;function Ku(r){ -for(var e=1;e{"use strict";p();var Wu=Ji();Zi.exports=Ve;function Ve(r){if(!(this instanceof -Ve))return new Ve(r);Wu(this,ic(r))}o(Ve,"PostgresInterval");var Gu=["seconds","\ -minutes","hours","days","months","years"];Ve.prototype.toPostgres=function(){var r=Gu. +e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}o(Yu,"timeZoneOffset");function Wi(r){ +return-(r-1)}o(Wi,"bcYearToNegativeYear");function Fr(r){return r>=0&&r<100}o(Fr, +"is0To99")});var Ji=R((Mf,zi)=>{y();zi.exports=Xu;var Zu=Object.prototype.hasOwnProperty;function Xu(r){ +for(var e=1;e{"use strict";y();var ec=Ji();Zi.exports=Je;function Je(r){if(!(this instanceof +Je))return new Je(r);ec(this,fc(r))}o(Je,"PostgresInterval");var tc=["seconds","\ +minutes","hours","days","months","years"];Je.prototype.toPostgres=function(){var r=tc. filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")< 0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e=== "seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/, -"")),t+" "+e},this).join(" ")};var Vu={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ -M",seconds:"S"},zu=["years","months","days"],Ju=["hours","minutes","seconds"];Ve. -prototype.toISOString=Ve.prototype.toISO=function(){var r=zu.map(t,this).join(""), -e=Ju.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== +"")),t+" "+e},this).join(" ")};var rc={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ +M",seconds:"S"},nc=["years","months","days"],ic=["hours","minutes","seconds"];Je. +prototype.toISOString=Je.prototype.toISO=function(){var r=nc.map(t,this).join(""), +e=ic.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== "seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/, -"")),i+Vu[n]}};var Dr="([+-]?\\d+)",Yu=Dr+"\\s+years?",Zu=Dr+"\\s+mons?",Xu=Dr+"\ -\\s+days?",ec="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",tc=new RegExp([ -Yu,Zu,Xu,ec].map(function(r){return"("+r+")?"}).join("\\s*")),Yi={years:2,months:4, -days:6,hours:9,minutes:10,seconds:11,milliseconds:12},rc=["hours","minutes","sec\ -onds","milliseconds"];function nc(r){var e=r+"000000".slice(r.length);return parseInt( -e,10)/1e3}o(nc,"parseMilliseconds");function ic(r){if(!r)return{};var e=tc.exec( +"")),i+rc[n]}};var qr="([+-]?\\d+)",sc=qr+"\\s+years?",ac=qr+"\\s+mons?",oc=qr+"\ +\\s+days?",uc="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",cc=new RegExp([ +sc,ac,oc,uc].map(function(r){return"("+r+")?"}).join("\\s*")),Yi={years:2,months:4, +days:6,hours:9,minutes:10,seconds:11,milliseconds:12},lc=["hours","minutes","sec\ +onds","milliseconds"];function hc(r){var e=r+"000000".slice(r.length);return parseInt( +e,10)/1e3}o(hc,"parseMilliseconds");function fc(r){if(!r)return{};var e=cc.exec( r),t=e[8]==="-";return Object.keys(Yi).reduce(function(n,i){var s=Yi[i],a=e[s];return!a|| -(a=i==="milliseconds"?nc(a):parseInt(a,10),!a)||(t&&~rc.indexOf(i)&&(a*=-1),n[i]= -a),n},{})}o(ic,"parse")});var ts=B((kf,es)=>{"use strict";p();es.exports=o(function(e){if(/^\\x/.test(e))return new w( +(a=i==="milliseconds"?hc(a):parseInt(a,10),!a)||(t&&~lc.indexOf(i)&&(a*=-1),n[i]= +a),n},{})}o(fc,"parse")});var ts=R((Qf,es)=>{"use strict";y();es.exports=o(function(e){if(/^\\x/.test(e))return new w( e.substr(2),"hex");for(var t="",n=0;n{p();var pt=Rr(),yt=Nr(),Qt=Vi(),ns=Xi(),is=ts();function $t(r){ -return o(function(t){return t===null?t:r(t)},"nullAllowed")}o($t,"allowNull");function ss(r){ +"\\";n+=Math.floor(i/2)*2}return new w(t,"binary")},"parseBytea")});var us=R((Hf,os)=>{y();var wt=Mr(),gt=Dr(),jt=Vi(),ns=Xi(),is=ts();function Ht(r){ +return o(function(t){return t===null?t:r(t)},"nullAllowed")}o(Ht,"allowNull");function ss(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| -r==="1"}o(ss,"parseBool");function sc(r){return r?pt.parse(r,ss):null}o(sc,"pars\ -eBoolArray");function ac(r){return parseInt(r,10)}o(ac,"parseBaseTenInt");function qr(r){ -return r?pt.parse(r,$t(ac)):null}o(qr,"parseIntegerArray");function oc(r){return r? -pt.parse(r,$t(function(e){return as(e).trim()})):null}o(oc,"parseBigIntegerArray"); -var uc=o(function(r){if(!r)return null;var e=yt.create(r,function(t){return t!== -null&&(t=Qr(t)),t});return e.parse()},"parsePointArray"),Fr=o(function(r){if(!r) -return null;var e=yt.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); -return e.parse()},"parseFloatArray"),we=o(function(r){if(!r)return null;var e=yt. -create(r);return e.parse()},"parseStringArray"),Or=o(function(r){if(!r)return null; -var e=yt.create(r,function(t){return t!==null&&(t=Qt(t)),t});return e.parse()},"\ -parseDateArray"),cc=o(function(r){if(!r)return null;var e=yt.create(r,function(t){ -return t!==null&&(t=ns(t)),t});return e.parse()},"parseIntervalArray"),lc=o(function(r){ -return r?pt.parse(r,$t(is)):null},"parseByteAArray"),kr=o(function(r){return parseInt( +r==="1"}o(ss,"parseBool");function dc(r){return r?wt.parse(r,ss):null}o(dc,"pars\ +eBoolArray");function pc(r){return parseInt(r,10)}o(pc,"parseBaseTenInt");function kr(r){ +return r?wt.parse(r,Ht(pc)):null}o(kr,"parseIntegerArray");function yc(r){return r? +wt.parse(r,Ht(function(e){return as(e).trim()})):null}o(yc,"parseBigIntegerArray"); +var mc=o(function(r){if(!r)return null;var e=gt.create(r,function(t){return t!== +null&&(t=jr(t)),t});return e.parse()},"parsePointArray"),Or=o(function(r){if(!r) +return null;var e=gt.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); +return e.parse()},"parseFloatArray"),ge=o(function(r){if(!r)return null;var e=gt. +create(r);return e.parse()},"parseStringArray"),Qr=o(function(r){if(!r)return null; +var e=gt.create(r,function(t){return t!==null&&(t=jt(t)),t});return e.parse()},"\ +parseDateArray"),wc=o(function(r){if(!r)return null;var e=gt.create(r,function(t){ +return t!==null&&(t=ns(t)),t});return e.parse()},"parseIntervalArray"),gc=o(function(r){ +return r?wt.parse(r,Ht(is)):null},"parseByteAArray"),$r=o(function(r){return parseInt( r,10)},"parseInteger"),as=o(function(r){var e=String(r);return/^\d+$/.test(e)?e: -r},"parseBigInteger"),rs=o(function(r){return r?pt.parse(r,$t(JSON.parse)):null}, -"parseJsonArray"),Qr=o(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- -1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),hc=o(function(r){ +r},"parseBigInteger"),rs=o(function(r){return r?wt.parse(r,Ht(JSON.parse)):null}, +"parseJsonArray"),jr=o(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- +1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Sc=o(function(r){ if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i{"use strict";p();var fe=1e6;function dc(r){var e=r.readInt32BE( +var s=jr(e);return s.radius=parseFloat(t),s},"parseCircle"),bc=o(function(r){r(20, +as),r(21,$r),r(23,$r),r(26,$r),r(700,parseFloat),r(701,parseFloat),r(16,ss),r(1082, +jt),r(1114,jt),r(1184,jt),r(600,jr),r(651,ge),r(718,Sc),r(1e3,dc),r(1001,gc),r(1005, +kr),r(1007,kr),r(1028,kr),r(1016,yc),r(1017,mc),r(1021,Or),r(1022,Or),r(1231,Or), +r(1014,ge),r(1015,ge),r(1008,ge),r(1009,ge),r(1040,ge),r(1041,ge),r(1115,Qr),r(1182, +Qr),r(1185,Qr),r(1186,ns),r(1187,wc),r(17,is),r(114,JSON.parse.bind(JSON)),r(3802, +JSON.parse.bind(JSON)),r(199,rs),r(3807,rs),r(3907,ge),r(2951,ge),r(791,ge),r(1183, +ge),r(1270,ge)},"init");os.exports={init:bc}});var ls=R((Gf,cs)=>{"use strict";y();var de=1e6;function Ec(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,a,u, -c,l,h;{if(s=e%fe,e=e/fe>>>0,a=4294967296*s+t,t=a/fe>>>0,u=""+(a-fe*t),t===0&&e=== -0)return n+u+i;for(c="",l=6-u.length,h=0;h>> -0,a=4294967296*s+t,t=a/fe>>>0,u=""+(a-fe*t),t===0&&e===0)return n+u+i;for(c="",l= -6-u.length,h=0;h>>0,a=4294967296*s+t,t=a/ -fe>>>0,u=""+(a-fe*t),t===0&&e===0)return n+u+i;for(c="",l=6-u.length,h=0;h{p();var pc=ls(),G=o(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(m,b,U){ -return m*Math.pow(2,U)+b};var s=t>>3,a=o(function(m){return n?~m&255:m},"inv"),u=255, +c,l,h;{if(s=e%de,e=e/de>>>0,a=4294967296*s+t,t=a/de>>>0,u=""+(a-de*t),t===0&&e=== +0)return n+u+i;for(c="",l=6-u.length,h=0;h>> +0,a=4294967296*s+t,t=a/de>>>0,u=""+(a-de*t),t===0&&e===0)return n+u+i;for(c="",l= +6-u.length,h=0;h>>0,a=4294967296*s+t,t=a/ +de>>>0,u=""+(a-de*t),t===0&&e===0)return n+u+i;for(c="",l=6-u.length,h=0;h{y();var xc=ls(),z=o(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(m,x,L){ +return m*Math.pow(2,L)+x};var s=t>>3,a=o(function(m){return n?~m&255:m},"inv"),u=255, c=8-t%8;e>t%8);var l=0;t%8+e>=8&&(l=i(0,a(r[s])& -u,c));for(var h=e+t>>3,f=s+1;f0&& -(l=i(l,a(r[h])>>8-y,y)),l},"parseBits"),ds=o(function(r,e,t){var n=Math.pow(2,t- -1)-1,i=G(r,1),s=G(r,t,1);if(s===0)return 0;var a=1,u=o(function(l,h,f){l===0&&(l= -1);for(var y=1;y<=f;y++)a/=2,(h&1<0&&(l+=a);return l},"parsePrecisionBits"), -c=G(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),yc=o(function(r){return G(r,1)==1?-1* -(G(r,15,1,!0)+1):G(r,15,1)},"parseInt16"),hs=o(function(r){return G(r,1)==1?-1*(G( -r,31,1,!0)+1):G(r,31,1)},"parseInt32"),wc=o(function(r){return ds(r,23,8)},"pars\ -eFloat32"),mc=o(function(r){return ds(r,52,11)},"parseFloat64"),gc=o(function(r){ -var e=G(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,G(r,16,16)),n=0,i=[], -s=G(r,16),a=0;a>3,f=s+1;f0&& +(l=i(l,a(r[h])>>8-p,p)),l},"parseBits"),ds=o(function(r,e,t){var n=Math.pow(2,t- +1)-1,i=z(r,1),s=z(r,t,1);if(s===0)return 0;var a=1,u=o(function(l,h,f){l===0&&(l= +1);for(var p=1;p<=f;p++)a/=2,(h&1<0&&(l+=a);return l},"parsePrecisionBits"), +c=z(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ac=o(function(r){return z(r,1)==1?-1* +(z(r,15,1,!0)+1):z(r,15,1)},"parseInt16"),hs=o(function(r){return z(r,1)==1?-1*(z( +r,31,1,!0)+1):z(r,31,1)},"parseInt32"),vc=o(function(r){return ds(r,23,8)},"pars\ +eFloat32"),Cc=o(function(r){return ds(r,52,11)},"parseFloat64"),_c=o(function(r){ +var e=z(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,z(r,16,16)),n=0,i=[], +s=z(r,16),a=0;a>3,(i+=h<<3)>>3), +return this.usec},i},"parseDate"),St=o(function(r){for(var e=z(r,32),t=z(r,32,32), +n=z(r,32,64),i=96,s=[],a=0;a>3,(i+=h<<3)>>3), f;console.log("ERROR: ElementType not implemented: "+l)},"parseElement"),c=o(function(l,h){ -var f=[],y;if(l.length>1){var m=l.shift();for(y=0;y0},"parseBool"),bc=o(function(r){r(20,pc),r(21,yc),r(23,hs),r(26, -hs),r(1700,gc),r(700,wc),r(701,mc),r(16,Ec),r(1114,fs.bind(null,!1)),r(1184,fs.bind( -null,!0)),r(1e3,wt),r(1007,wt),r(1016,wt),r(1008,wt),r(1009,wt),r(25,Sc)},"init"); -ps.exports={init:bc}});var ms=B((Zf,ws)=>{p();ws.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +var f=[],p;if(l.length>1){var m=l.shift();for(p=0;p0},"parseBool"),Lc=o(function(r){r(20,xc),r(21,Ac),r(23,hs),r(26, +hs),r(1700,_c),r(700,vc),r(701,Cc),r(16,Uc),r(1114,fs.bind(null,!1)),r(1184,fs.bind( +null,!0)),r(1e3,St),r(1007,St),r(1016,St),r(1008,St),r(1009,St),r(25,Tc)},"init"); +ps.exports={init:Lc}});var ws=R((Xf,ms)=>{y();ms.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -692,156 +693,157 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var St=B(gt=>{p();var xc=us(),Ac=ys(),vc=Nr(),Cc=ms();gt.getTypeParser=_c;gt.setTypeParser= -Tc;gt.arrayParser=vc;gt.builtins=Cc;var mt={text:{},binary:{}};function gs(r){return String( -r)}o(gs,"noParse");function _c(r,e){return e=e||"text",mt[e]&&mt[e][r]||gs}o(_c, -"getTypeParser");function Tc(r,e,t){typeof e=="function"&&(t=e,e="text"),mt[e][r]= -t}o(Tc,"setTypeParser");xc.init(function(r,e){mt.text[r]=e});Ac.init(function(r,e){ -mt.binary[r]=e})});var Et=B((nd,$r)=>{"use strict";p();$r.exports={host:"localhost",user:S.platform=== +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var xt=R(Et=>{y();var Ic=us(),Pc=ys(),Bc=Dr(),Rc=ws();Et.getTypeParser=Nc;Et.setTypeParser= +Mc;Et.arrayParser=Bc;Et.builtins=Rc;var bt={text:{},binary:{}};function gs(r){return String( +r)}o(gs,"noParse");function Nc(r,e){return e=e||"text",bt[e]&&bt[e][r]||gs}o(Nc, +"getTypeParser");function Mc(r,e,t){typeof e=="function"&&(t=e,e="text"),bt[e][r]= +t}o(Mc,"setTypeParser");Ic.init(function(r,e){bt.text[r]=e});Pc.init(function(r,e){ +bt.binary[r]=e})});var At=R((id,Hr)=>{"use strict";y();Hr.exports={host:"localhost",user:S.platform=== "win32"?S.env.USERNAME:S.env.USER,database:void 0,password:null,connectionString:void 0, port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1, application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1, statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1, -connect_timeout:0,keepalives:1,keepalives_idle:0};var ze=St(),Lc=ze.getTypeParser( -20,"text"),Uc=ze.getTypeParser(1016,"text");$r.exports.__defineSetter__("parseIn\ -t8",function(r){ze.setTypeParser(20,"text",r?ze.getTypeParser(23,"text"):Lc),ze. -setTypeParser(1016,"text",r?ze.getTypeParser(1007,"text"):Uc)})});var bt=B((sd,Es)=>{"use strict";p();var Ic=(Pr(),X(Ir)),Pc=Et();function Bc(r){var e=r. -replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}o(Bc,"escapeElement"); -function Ss(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> -"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Ss(r[t]):r[t]instanceof w?e+="\\\\x"+r[t]. -toString("hex"):e+=Bc(jt(r[t]));return e=e+"}",e}o(Ss,"arrayString");var jt=o(function(r,e){ -if(r==null)return null;if(r instanceof w)return r;if(ArrayBuffer.isView(r)){var t=w. -from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice( -r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?Pc.parseInputDatesAsUTC? -Mc(r):Nc(r):Array.isArray(r)?Ss(r):typeof r=="object"?Rc(r,e):r.toString()},"pre\ -pareValue");function Rc(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. -indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+ -r+'" for query');return e.push(r),jt(r.toPostgres(jt),e)}return JSON.stringify(r)} -o(Rc,"prepareObject");function oe(r,e){for(r=""+r;r.length{"use strict";p();var Hr=(Pr(),X(Ir));function Fc(r){if(r.indexOf( +connect_timeout:0,keepalives:1,keepalives_idle:0};var Ye=xt(),Dc=Ye.getTypeParser( +20,"text"),Fc=Ye.getTypeParser(1016,"text");Hr.exports.__defineSetter__("parseIn\ +t8",function(r){Ye.setTypeParser(20,"text",r?Ye.getTypeParser(23,"text"):Dc),Ye. +setTypeParser(1016,"text",r?Ye.getTypeParser(1007,"text"):Fc)})});var vt=R((ad,bs)=>{"use strict";y();var qc=(Rr(),te(Br)),kc=At();function Oc(r){ +var e=r.replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}o(Oc,"escapeEl\ +ement");function Ss(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null|| +typeof r[t]>"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Ss(r[t]):r[t]instanceof w?e+= +"\\\\x"+r[t].toString("hex"):e+=Oc(Kt(r[t]));return e=e+"}",e}o(Ss,"arrayString"); +var Kt=o(function(r,e){if(r==null)return null;if(r instanceof w)return r;if(ArrayBuffer. +isView(r)){var t=w.from(r.buffer,r.byteOffset,r.byteLength);return t.length===r. +byteLength?t:t.slice(r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof +Date?kc.parseInputDatesAsUTC?jc(r):$c(r):Array.isArray(r)?Ss(r):typeof r=="objec\ +t"?Qc(r,e):r.toString()},"prepareValue");function Qc(r,e){if(r&&typeof r.toPostgres== +"function"){if(e=e||[],e.indexOf(r)!==-1)throw new Error('circular reference det\ +ected while preparing "'+r+'" for query');return e.push(r),Kt(r.toPostgres(Kt),e)} +return JSON.stringify(r)}o(Qc,"prepareObject");function ce(r,e){for(r=""+r;r.length< +e;)r="0"+r;return r}o(ce,"pad");function $c(r){var e=-r.getTimezoneOffset(),t=r. +getFullYear(),n=t<1;n&&(t=Math.abs(t)+1);var i=ce(t,4)+"-"+ce(r.getMonth()+1,2)+ +"-"+ce(r.getDate(),2)+"T"+ce(r.getHours(),2)+":"+ce(r.getMinutes(),2)+":"+ce(r.getSeconds(), +2)+"."+ce(r.getMilliseconds(),3);return e<0?(i+="-",e*=-1):i+="+",i+=ce(Math.floor( +e/60),2)+":"+ce(e%60,2),n&&(i+=" BC"),i}o($c,"dateToString");function jc(r){var e=r. +getUTCFullYear(),t=e<1;t&&(e=Math.abs(e)+1);var n=ce(e,4)+"-"+ce(r.getUTCMonth()+ +1,2)+"-"+ce(r.getUTCDate(),2)+"T"+ce(r.getUTCHours(),2)+":"+ce(r.getUTCMinutes(), +2)+":"+ce(r.getUTCSeconds(),2)+"."+ce(r.getUTCMilliseconds(),3);return n+="+00:0\ +0",t&&(n+=" BC"),n}o(jc,"dateToStringUTC");function Hc(r,e,t){return r=typeof r== +"string"?{text:r}:r,e&&(typeof e=="function"?r.callback=e:r.values=e),t&&(r.callback= +t),r}o(Hc,"normalizeQueryConfig");var Kr=o(function(r){return qc.createHash("md5"). +update(r,"utf-8").digest("hex")},"md5"),Kc=o(function(r,e,t){var n=Kr(e+r),i=Kr( +w.concat([w.from(n),t]));return"md5"+i},"postgresMd5PasswordHash");bs.exports={prepareValue:o( +function(e){return Kt(e)},"prepareValueWrapper"),normalizeQueryConfig:Hc,postgresMd5PasswordHash:Kc, +md5:Kr}});var Cs=R((cd,vs)=>{"use strict";y();var Wr=(Rr(),te(Br));function Wc(r){if(r.indexOf( "SCRAM-SHA-256")===-1)throw new Error("SASL: Only mechanism SCRAM-SHA-256 is cur\ -rently supported");let e=Hr.randomBytes(18).toString("base64");return{mechanism:"\ +rently supported");let e=Wr.randomBytes(18).toString("base64");return{mechanism:"\ SCRAM-SHA-256",clientNonce:e,response:"n,,n=*,r="+e,message:"SASLInitialResponse"}} -o(Fc,"startSession");function Oc(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( +o(Wc,"startSession");function Gc(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( "SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(typeof t!= "string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a\ - string");let n=$c(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== + string");let n=Jc(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n\ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ -er nonce does not start with client nonce");var i=w.from(n.salt,"base64"),s=Kc(e, -i,n.iteration),a=Je(s,"Client Key"),u=Hc(a),c="n=*,r="+r.clientNonce,l="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,h="c=biws,r="+n.nonce,f=c+","+l+","+h,y=Je(u,f),m=As( -a,y),b=m.toString("base64"),U=Je(s,"Server Key"),v=Je(U,f);r.message="SASLRespon\ -se",r.serverSignature=v.toString("base64"),r.response=h+",p="+b}o(Oc,"continueSe\ -ssion");function kc(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ +er nonce does not start with client nonce");var i=w.from(n.salt,"base64"),s=Xc(e, +i,n.iteration),a=Ze(s,"Client Key"),u=Zc(a),c="n=*,r="+r.clientNonce,l="r="+n.nonce+ +",s="+n.salt+",i="+n.iteration,h="c=biws,r="+n.nonce,f=c+","+l+","+h,p=Ze(u,f),m=As( +a,p),x=m.toString("base64"),L=Ze(s,"Server Key"),v=Ze(L,f);r.message="SASLRespon\ +se",r.serverSignature=v.toString("base64"),r.response=h+",p="+x}o(Gc,"continueSe\ +ssion");function Vc(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ -CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=jc( +CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=Yc( e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: s\ -erver signature does not match")}o(kc,"finalizeSession");function Qc(r){if(typeof r!= +erver signature does not match")}o(Vc,"finalizeSession");function zc(r){if(typeof r!= "string")throw new TypeError("SASL: text must be a string");return r.split("").map( -(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}o(Qc,"isPrintableC\ -hars");function bs(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(r)}o(bs,"isBase64");function xs(r){if(typeof r!="string")throw new TypeError( +(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}o(zc,"isPrintableC\ +hars");function Es(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(r)}o(Es,"isBase64");function xs(r){if(typeof r!="string")throw new TypeError( "SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{ if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0], -n=e.substring(2);return[t,n]}))}o(xs,"parseAttributePairs");function $c(r){let e=xs( -r),t=e.get("r");if(t){if(!Qc(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ +n=e.substring(2);return[t,n]}))}o(xs,"parseAttributePairs");function Jc(r){let e=xs( +r),t=e.get("r");if(t){if(!zc(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ E: nonce must only contain printable characters")}else throw new Error("SASL: SC\ -RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!bs(n))throw new Error( +RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Es(n))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("S\ ASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/. test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration cou\ nt")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); -let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}o($c,"parseServerFirstMe\ -ssage");function jc(r){let t=xs(r).get("v");if(t){if(!bs(t))throw new Error("SAS\ +let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}o(Jc,"parseServerFirstMe\ +ssage");function Yc(r){let t=xs(r).get("v");if(t){if(!Es(t))throw new Error("SAS\ L: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error( "SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}} -o(jc,"parseServerFinalMessage");function As(r,e){if(!w.isBuffer(r))throw new TypeError( +o(Yc,"parseServerFinalMessage");function As(r,e){if(!w.isBuffer(r))throw new TypeError( "first argument must be a Buffer");if(!w.isBuffer(e))throw new TypeError("second\ argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer leng\ ths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return w. -from(r.map((t,n)=>r[n]^e[n]))}o(As,"xorBuffers");function Hc(r){return Hr.createHash( -"sha256").update(r).digest()}o(Hc,"sha256");function Je(r,e){return Hr.createHmac( -"sha256",r).update(e).digest()}o(Je,"hmacSha256");function Kc(r,e,t){for(var n=Je( -r,w.concat([e,w.from([0,0,0,1])])),i=n,s=0;sWc});function Wc(...r){return r.join("/")}var Wr=le(()=>{ -"use strict";p();o(Wc,"join")});var Gr={};pe(Gr,{stat:()=>Gc});function Gc(r,e){e(new Error("No filesystem"))}var Vr=le( -()=>{"use strict";p();o(Gc,"stat")});var zr={};pe(zr,{default:()=>Vc});var Vc,Jr=le(()=>{"use strict";p();Vc={}});var _s={};pe(_s,{StringDecoder:()=>Yr});var Yr,Ts=le(()=>{"use strict";p();Yr=class{static{ +from(r.map((t,n)=>r[n]^e[n]))}o(As,"xorBuffers");function Zc(r){return Wr.createHash( +"sha256").update(r).digest()}o(Zc,"sha256");function Ze(r,e){return Wr.createHmac( +"sha256",r).update(e).digest()}o(Ze,"hmacSha256");function Xc(r,e,t){for(var n=Ze( +r,w.concat([e,w.from([0,0,0,1])])),i=n,s=0;sel});function el(...r){return r.join("/")}var Vr=ye(()=>{ +"use strict";y();o(el,"join")});var zr={};me(zr,{stat:()=>tl});function tl(r,e){e(new Error("No filesystem"))}var Jr=ye( +()=>{"use strict";y();o(tl,"stat")});var Yr={};me(Yr,{default:()=>rl});var rl,Zr=ye(()=>{"use strict";y();rl={}});var _s={};me(_s,{StringDecoder:()=>Xr});var Xr,Ts=ye(()=>{"use strict";y();Xr=class{static{ o(this,"StringDecoder")}td;constructor(e){this.td=new TextDecoder(e)}write(e){return this. -td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}}});var Ps=B((gd,Is)=>{"use strict";p();var{Transform:zc}=(Jr(),X(zr)),{StringDecoder:Jc}=(Ts(),X(_s)), -Ie=Symbol("last"),Ht=Symbol("decoder");function Yc(r,e,t){let n;if(this.overflow){ -if(n=this[Ht].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. -overflow=!1}else this[Ie]+=this[Ht].write(r),n=this[Ie].split(this.matcher);this[Ie]= -n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ -t(new Error("maximum buffer reached"));return}t()}o(Yc,"transform");function Zc(r){ -if(this[Ie]+=this[Ht].end(),this[Ie])try{Us(this,this.mapper(this[Ie]))}catch(e){ -return r(e)}r()}o(Zc,"flush");function Us(r,e){e!==void 0&&r.push(e)}o(Us,"push"); -function Ls(r){return r}o(Ls,"noop");function Xc(r,e,t){switch(r=r||/\r?\n/,e=e|| -Ls,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== +td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}}});var Ps=R((Sd,Is)=>{"use strict";y();var{Transform:nl}=(Zr(),te(Yr)),{StringDecoder:il}=(Ts(),te(_s)), +Re=Symbol("last"),Wt=Symbol("decoder");function sl(r,e,t){let n;if(this.overflow){ +if(n=this[Wt].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. +overflow=!1}else this[Re]+=this[Wt].write(r),n=this[Re].split(this.matcher);this[Re]= +n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ +t(new Error("maximum buffer reached"));return}t()}o(sl,"transform");function al(r){ +if(this[Re]+=this[Wt].end(),this[Re])try{Ls(this,this.mapper(this[Re]))}catch(e){ +return r(e)}r()}o(al,"flush");function Ls(r,e){e!==void 0&&r.push(e)}o(Ls,"push"); +function Us(r){return r}o(Us,"noop");function ol(r,e,t){switch(r=r||/\r?\n/,e=e|| +Us,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== "object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2: -typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Ls)}t=Object. -assign({},t),t.autoDestroy=!0,t.transform=Yc,t.flush=Zc,t.readableObjectMode=!0; -let n=new zc(t);return n[Ie]="",n[Ht]=new Jc("utf8"),n.matcher=r,n.mapper=e,n.maxLength= +typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Us)}t=Object. +assign({},t),t.autoDestroy=!0,t.transform=sl,t.flush=al,t.readableObjectMode=!0; +let n=new nl(t);return n[Re]="",n[Wt]=new il("utf8"),n.matcher=r,n.mapper=e,n.maxLength= t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ -this._writableState.errorEmitted=!1,s(i)},n}o(Xc,"split");Is.exports=Xc});var Ns=B((bd,ve)=>{"use strict";p();var Bs=(Wr(),X(Kr)),el=(Jr(),X(zr)).Stream,tl=Ps(), -Rs=(ht(),X(lt)),rl=5432,Kt=S.platform==="win32",xt=S.stderr,nl=56,il=7,sl=61440, -al=32768;function ol(r){return(r&sl)==al}o(ol,"isRegFile");var Ye=["host","port", -"database","user","password"],Zr=Ye.length,ul=Ye[Zr-1];function Xr(){var r=xt instanceof -el&&xt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` -`);xt.write(Rs.format.apply(Rs,e))}}o(Xr,"warn");Object.defineProperty(ve.exports, -"isWin",{get:o(function(){return Kt},"get"),set:o(function(r){Kt=r},"set")});ve. -exports.warnTo=function(r){var e=xt;return xt=r,e};ve.exports.getFileName=function(r){ -var e=r||S.env,t=e.PGPASSFILE||(Kt?Bs.join(e.APPDATA||"./","postgresql","pgpass.\ -conf"):Bs.join(e.HOME||"./",".pgpass"));return t};ve.exports.usePgPass=function(r,e){ -return Object.prototype.hasOwnProperty.call(S.env,"PGPASSWORD")?!1:Kt?!0:(e=e||"\ -",ol(r.mode)?r.mode&(nl|il)?(Xr('WARNING: password file "%s" has group or \ -world access; permissions should be u=rw (0600) or less',e),!1):!0:(Xr('WARNING:\ - password file "%s" is not a plain file',e),!1))};var cl=ve.exports.match=function(r,e){ -return Ye.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||rl)===Number( -e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};ve.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(tl());function s(c){var l=ll(c);l&&hl(l)&&cl(r,l)&&(n=l[ul],i.end())} +this._writableState.errorEmitted=!1,s(i)},n}o(ol,"split");Is.exports=ol});var Ns=R((xd,_e)=>{"use strict";y();var Bs=(Vr(),te(Gr)),ul=(Zr(),te(Yr)).Stream, +cl=Ps(),Rs=(pt(),te(dt)),ll=5432,Gt=S.platform==="win32",Ct=S.stderr,hl=56,fl=7, +dl=61440,pl=32768;function yl(r){return(r&dl)==pl}o(yl,"isRegFile");var Xe=["hos\ +t","port","database","user","password"],en=Xe.length,ml=Xe[en-1];function tn(){var r=Ct instanceof +ul&&Ct.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` +`);Ct.write(Rs.format.apply(Rs,e))}}o(tn,"warn");Object.defineProperty(_e.exports, +"isWin",{get:o(function(){return Gt},"get"),set:o(function(r){Gt=r},"set")});_e. +exports.warnTo=function(r){var e=Ct;return Ct=r,e};_e.exports.getFileName=function(r){ +var e=r||S.env,t=e.PGPASSFILE||(Gt?Bs.join(e.APPDATA||"./","postgresql","pgpass.\ +conf"):Bs.join(e.HOME||"./",".pgpass"));return t};_e.exports.usePgPass=function(r,e){ +return Object.prototype.hasOwnProperty.call(S.env,"PGPASSWORD")?!1:Gt?!0:(e=e||"\ +",yl(r.mode)?r.mode&(hl|fl)?(tn('WARNING: password file "%s" has group or \ +world access; permissions should be u=rw (0600) or less',e),!1):!0:(tn('WARNING:\ + password file "%s" is not a plain file',e),!1))};var wl=_e.exports.match=function(r,e){ +return Xe.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||ll)===Number( +e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};_e.exports.getPassword=function(r,e,t){ +var n,i=e.pipe(cl());function s(c){var l=gl(c);l&&Sl(l)&&wl(r,l)&&(n=l[ml],i.end())} o(s,"onLine");var a=o(function(){e.destroy(),t(n)},"onEnd"),u=o(function(c){e.destroy(), -Xr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. -on("data",s).on("end",a).on("error",u)};var ll=ve.exports.parseLine=function(r){ +tn("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. +on("data",s).on("end",a).on("error",u)};var gl=_e.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,a={}, -u=!1,c=o(function(h,f,y){var m=r.substring(f,y);Object.hasOwnProperty.call(S.env, -"PGPASS_NO_DEESCAPE")||(m=m.replace(/\\([:\\])/g,"$1")),a[Ye[h]]=m},"addToObj"), -l=0;l=0&&e==":"&&t!=="\\"&&(c(n,i,l+1),i=l+2,n+=1)}return a=Object.keys(a).length=== -Zr?a:null,a},hl=ve.exports.isValidEntry=function(r){for(var e={0:function(a){return a. +en?a:null,a},Sl=_e.exports.isValidEntry=function(r){for(var e={0:function(a){return a. length>0},1:function(a){return a==="*"?!0:(a=Number(a),isFinite(a)&&a>0&&a<9007199254740992&& Math.floor(a)===a)},2:function(a){return a.length>0},3:function(a){return a.length> -0},4:function(a){return a.length>0}},t=0;t{"use strict";p();var vd=(Wr(),X(Kr)),Ms=(Vr(),X(Gr)),Wt=Ns(); -en.exports=function(r,e){var t=Wt.getFileName();Ms.stat(t,function(n,i){if(n||!Wt. -usePgPass(i,t))return e(void 0);var s=Ms.createReadStream(t);Wt.getPassword(r,s, -e)})};en.exports.warnTo=Wt.warnTo});var Vt=B((Td,qs)=>{"use strict";p();var fl=St();function Gt(r){this._types=r||fl, -this.text={},this.binary={}}o(Gt,"TypeOverrides");Gt.prototype.getOverrides=function(r){ +0},4:function(a){return a.length>0}},t=0;t{"use strict";y();var Cd=(Vr(),te(Gr)),Ms=(Jr(),te(zr)),Vt=Ns(); +rn.exports=function(r,e){var t=Vt.getFileName();Ms.stat(t,function(n,i){if(n||!Vt. +usePgPass(i,t))return e(void 0);var s=Ms.createReadStream(t);Vt.getPassword(r,s, +e)})};rn.exports.warnTo=Vt.warnTo});var Jt=R((Ud,Fs)=>{"use strict";y();var bl=xt();function zt(r){this._types=r||bl, +this.text={},this.binary={}}o(zt,"TypeOverrides");zt.prototype.getOverrides=function(r){ switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}}; -Gt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), -this.getOverrides(e)[r]=t};Gt.prototype.getTypeParser=function(r,e){return e=e|| -"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};qs.exports=Gt});var Fs={};pe(Fs,{default:()=>dl});var dl,Os=le(()=>{"use strict";p();dl={}});var ks={};pe(ks,{parse:()=>tn});function tn(r,e=!1){let{protocol:t}=new URL(r),n="\ +zt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), +this.getOverrides(e)[r]=t};zt.prototype.getTypeParser=function(r,e){return e=e|| +"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};Fs.exports=zt});var qs={};me(qs,{default:()=>El});var El,ks=ye(()=>{"use strict";y();El={}});var Os={};me(Os,{parse:()=>nn});function nn(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:a,hostname:u,port:c,pathname:l, -search:h,searchParams:f,hash:y}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),l=decodeURIComponent(l);let m=i+":"+s,b=e?Object.fromEntries(f.entries()):h;return{ +search:h,searchParams:f,hash:p}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( +i),l=decodeURIComponent(l);let m=i+":"+s,x=e?Object.fromEntries(f.entries()):h;return{ href:r,protocol:t,auth:m,username:i,password:s,host:a,hostname:u,port:c,pathname:l, -search:h,query:b,hash:y}}var rn=le(()=>{"use strict";p();o(tn,"parse")});var $s=B((Rd,Qs)=>{"use strict";p();var pl=(rn(),X(ks)),nn=(Vr(),X(Gr));function sn(r){ -if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=pl. +search:h,query:x,hash:p}}var sn=ye(()=>{"use strict";y();o(nn,"parse")});var $s=R((Nd,Qs)=>{"use strict";y();var xl=(sn(),te(Os)),an=(Jr(),te(zr));function on(r){ +if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=xl. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- 1]);var i=(e.auth||":").split(":");if(t.user=i[0],t.password=i.splice(1).join(":"), @@ -851,46 +853,46 @@ pathname;if(!t.host&&s&&/^%2f/i.test(s)){var a=s.split("/");t.host=decodeURIComp a[0]),s=a.splice(1).join("/")}switch(s&&s.charAt(0)==="/"&&(s=s.slice(1)||null), t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0"&& (t.ssl=!1),(t.sslcert||t.sslkey||t.sslrootcert||t.sslmode)&&(t.ssl={}),t.sslcert&& -(t.ssl.cert=nn.readFileSync(t.sslcert).toString()),t.sslkey&&(t.ssl.key=nn.readFileSync( -t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=nn.readFileSync(t.sslrootcert).toString()), +(t.ssl.cert=an.readFileSync(t.sslcert).toString()),t.sslkey&&(t.ssl.key=an.readFileSync( +t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=an.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}o(sn,"parse");Qs.exports=sn;sn.parse=sn});var zt=B((Dd,Ks)=>{"use strict";p();var yl=(Os(),X(Fs)),Hs=Et(),js=$s().parse,ue=o( +return t}o(on,"parse");Qs.exports=on;on.parse=on});var Yt=R((Fd,Ks)=>{"use strict";y();var Al=(ks(),te(qs)),Hs=At(),js=$s().parse,he=o( function(r,e,t){return t===void 0?t=S.env["PG"+r.toUpperCase()]:t===!1||(t=S.env[t]), -e[r]||t||Hs[r]},"val"),wl=o(function(){switch(S.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||Hs[r]},"val"),vl=o(function(){switch(S.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": -return{rejectUnauthorized:!1}}return Hs.ssl},"readSSLConfigFromEnvironment"),Ze=o( +return{rejectUnauthorized:!1}}return Hs.ssl},"readSSLConfigFromEnvironment"),et=o( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ -teParamValue"),me=o(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Ze(n))},"ad\ -d"),an=class{static{o(this,"ConnectionParameters")}constructor(e){e=typeof e=="s\ +teParamValue"),Se=o(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+et(n))},"ad\ +d"),un=class{static{o(this,"ConnectionParameters")}constructor(e){e=typeof e=="s\ tring"?js(e):e||{},e.connectionString&&(e=Object.assign({},e,js(e.connectionString))), -this.user=ue("user",e),this.database=ue("database",e),this.database===void 0&&(this. -database=this.user),this.port=parseInt(ue("port",e),10),this.host=ue("host",e),Object. -defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:ue( -"password",e)}),this.binary=ue("binary",e),this.options=ue("options",e),this.ssl= -typeof e.ssl>"u"?wl():e.ssl,typeof this.ssl=="string"&&this.ssl==="true"&&(this. +this.user=he("user",e),this.database=he("database",e),this.database===void 0&&(this. +database=this.user),this.port=parseInt(he("port",e),10),this.host=he("host",e),Object. +defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:he( +"password",e)}),this.binary=he("binary",e),this.options=he("options",e),this.ssl= +typeof e.ssl>"u"?vl():e.ssl,typeof this.ssl=="string"&&this.ssl==="true"&&(this. ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}),this.ssl&&this. ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this.client_encoding= -ue("client_encoding",e),this.replication=ue("replication",e),this.isDomainSocket= -!(this.host||"").indexOf("/"),this.application_name=ue("application_name",e,"PGA\ -PPNAME"),this.fallback_application_name=ue("fallback_application_name",e,!1),this. -statement_timeout=ue("statement_timeout",e,!1),this.lock_timeout=ue("lock_timeou\ -t",e,!1),this.idle_in_transaction_session_timeout=ue("idle_in_transaction_sessio\ -n_timeout",e,!1),this.query_timeout=ue("query_timeout",e,!1),e.connectionTimeoutMillis=== +he("client_encoding",e),this.replication=he("replication",e),this.isDomainSocket= +!(this.host||"").indexOf("/"),this.application_name=he("application_name",e,"PGA\ +PPNAME"),this.fallback_application_name=he("fallback_application_name",e,!1),this. +statement_timeout=he("statement_timeout",e,!1),this.lock_timeout=he("lock_timeou\ +t",e,!1),this.idle_in_transaction_session_timeout=he("idle_in_transaction_sessio\ +n_timeout",e,!1),this.query_timeout=he("query_timeout",e,!1),e.connectionTimeoutMillis=== void 0?this.connect_timeout=S.env.PGCONNECT_TIMEOUT||0:this.connect_timeout=Math. floor(e.connectionTimeoutMillis/1e3),e.keepAlive===!1?this.keepalives=0:e.keepAlive=== !0&&(this.keepalives=1),typeof e.keepAliveInitialDelayMillis=="number"&&(this.keepalives_idle= Math.floor(e.keepAliveInitialDelayMillis/1e3))}getLibpqConnectionString(e){var t=[]; -me(t,this,"user"),me(t,this,"password"),me(t,this,"port"),me(t,this,"application\ -_name"),me(t,this,"fallback_application_name"),me(t,this,"connect_timeout"),me(t, +Se(t,this,"user"),Se(t,this,"password"),Se(t,this,"port"),Se(t,this,"application\ +_name"),Se(t,this,"fallback_application_name"),Se(t,this,"connect_timeout"),Se(t, this,"options");var n=typeof this.ssl=="object"?this.ssl:this.ssl?{sslmode:this. -ssl}:{};if(me(t,n,"sslmode"),me(t,n,"sslca"),me(t,n,"sslkey"),me(t,n,"sslcert"), -me(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ze(this.database)),this.replication&& -t.push("replication="+Ze(this.replication)),this.host&&t.push("host="+Ze(this.host)), +ssl}:{};if(Se(t,n,"sslmode"),Se(t,n,"sslca"),Se(t,n,"sslkey"),Se(t,n,"sslcert"), +Se(t,n,"sslrootcert"),this.database&&t.push("dbname="+et(this.database)),this.replication&& +t.push("replication="+et(this.replication)),this.host&&t.push("host="+et(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Ze(this.client_encoding)),yl.lookup(this.host,function(i,s){return i? -e(i,null):(t.push("hostaddr="+Ze(s)),e(null,t.join(" ")))})}};Ks.exports=an});var Vs=B((Od,Gs)=>{"use strict";p();var ml=St(),Ws=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, -on=class{static{o(this,"Result")}constructor(e,t){this.command=null,this.rowCount= +ent_encoding="+et(this.client_encoding)),Al.lookup(this.host,function(i,s){return i? +e(i,null):(t.push("hostaddr="+et(s)),e(null,t.join(" ")))})}};Ks.exports=un});var Vs=R((Od,Gs)=>{"use strict";y();var Cl=xt(),Ws=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +cn=class{static{o(this,"Result")}constructor(e,t){this.command=null,this.rowCount= null,this.oid=null,this.rows=[],this.fields=[],this._parsers=void 0,this._types= t,this.RowCtor=null,this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow= this._parseRowAsArray)}addCommandComplete(e){var t;e.text?t=Ws.exec(e.text):t=Ws. @@ -901,8 +903,8 @@ _parsers[n](s):t[n]=null}return t}parseRow(e){for(var t={},n=0,i=e.length;n{"use strict";p();var{EventEmitter:gl}=Ue(),zs=Vs(),Js=bt(),un=class extends gl{static{ +this._types.getTypeParser(n.dataTypeID,n.format||"text"):this._parsers[t]=Cl.getTypeParser( +n.dataTypeID,n.format||"text")}}};Gs.exports=cn});var Zs=R((jd,Ys)=>{"use strict";y();var{EventEmitter:_l}=Be(),zs=Vs(),Js=vt(),ln=class extends _l{static{ o(this,"Query")}constructor(e,t,n){super(),e=Js.normalizeQueryConfig(e,t,n),this. text=e.text,this.values=e.values,this.rows=e.rows,this.types=e.types,this.name=e. name,this.binary=e.binary,this.portal=e.portal||"",this.callback=e.callback,this. @@ -934,8 +936,8 @@ name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execut try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this. binary,valueMapper:Js.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ -e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};Ys.exports=un});var ta={};pe(ta,{Socket:()=>ge,isIP:()=>Sl});function Sl(r){return 0}var ea,Xs,ge, -Jt=le(()=>{"use strict";p();ea=Oe(Ue(),1);o(Sl,"isIP");Xs=/^[^.]+\./,ge=class r extends ea.EventEmitter{static{ +e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};Ys.exports=ln});var ta={};me(ta,{Socket:()=>be,isIP:()=>Tl});function Tl(r){return 0}var ea,Xs,be, +Zt=ye(()=>{"use strict";y();ea=Qe(Be(),1);o(Tl,"isIP");Xs=/^[^.]+\./,be=class r extends ea.EventEmitter{static{ o(this,"Socket")}static defaults={poolQueryViaFetch:!1,fetchEndpoint:o((e,t,n)=>{ let i;return n?.jwtAuth?i=e.replace(Xs,"apiauth."):i=e.replace(Xs,"api."),"https\ ://"+i+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0,webSocketConstructor:void 0, @@ -994,10 +996,10 @@ then(h=>{if(this.ws=h.webSocket,this.ws==null)throw u;this.ws.accept(),s(this.ws !0)}).catch(h=>{this.emit("error",new Error(`All attempts to open a WebSocket to\ connect to the database failed. Please refer to https://github.com/neondatabase\ /serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined\ -. Details: ${h.message}`)),this.emit("close")})}}async startTls(e){if(this.subtls=== -void 0)throw new Error("For Postgres SSL connections, you must set `neonConfig.s\ -ubtls` to the subtls library. See https://github.com/neondatabase/serverless/blo\ -b/main/CONFIG.md for more information.");this.tlsState=1;let t=this.subtls.TrustedCert. +. Details: ${h}`)),this.emit("close")})}}async startTls(e){if(this.subtls===void 0) +throw new Error("For Postgres SSL connections, you must set `neonConfig.subtls` \ +to the subtls library. See https://github.com/neondatabase/serverless/blob/main/\ +CONFIG.md for more information.");this.tlsState=1;let t=this.subtls.TrustedCert. fromPEM(this.rootCerts),n=new this.subtls.WebSocketReadQueue(this.ws),i=n.read.bind( n),s=this.rawWrite.bind(this),[a,u]=await this.subtls.startTls(e,t,i,s,{useSNI:!this. disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0});this.tlsRead= @@ -1012,7 +1014,7 @@ length===0?(n(),!0):(typeof e=="string"&&(e=w.from(e,t)),this.tlsState===0?(this rawWrite(e),n()):this.tlsState===1?this.once("secureConnection",()=>{this.write( e,t,n)}):(this.tlsWrite(e),n()),!0)}end(e=w.alloc(0),t="utf8",n=()=>{}){return this. write(e,t,()=>{this.ws.close(),n()}),this}destroy(){return this.destroyed=!0,this. -end()}}});var An=B(I=>{"use strict";p();Object.defineProperty(I,"__esModule",{value:!0});I. +end()}}});var Cn=R(I=>{"use strict";y();Object.defineProperty(I,"__esModule",{value:!0});I. NoticeMessage=I.DataRowMessage=I.CommandCompleteMessage=I.ReadyForQueryMessage=I. NotificationResponseMessage=I.BackendKeyDataMessage=I.AuthenticationMD5Password= I.ParameterStatusMessage=I.ParameterDescriptionMessage=I.RowDescriptionMessage=I. @@ -1022,36 +1024,36 @@ void 0;I.parseComplete={name:"parseComplete",length:5};I.bindComplete={name:"bin dComplete",length:5};I.closeComplete={name:"closeComplete",length:5};I.noData={name:"\ noData",length:5};I.portalSuspended={name:"portalSuspended",length:5};I.replicationStart= {name:"replicationStart",length:4};I.emptyQuery={name:"emptyQuery",length:4};I.copyDone= -{name:"copyDone",length:4};var cn=class extends Error{static{o(this,"DatabaseErr\ -or")}constructor(e,t,n){super(e),this.length=t,this.name=n}};I.DatabaseError=cn; -var ln=class{static{o(this,"CopyDataMessage")}constructor(e,t){this.length=e,this. -chunk=t,this.name="copyData"}};I.CopyDataMessage=ln;var hn=class{static{o(this,"\ +{name:"copyDone",length:4};var hn=class extends Error{static{o(this,"DatabaseErr\ +or")}constructor(e,t,n){super(e),this.length=t,this.name=n}};I.DatabaseError=hn; +var fn=class{static{o(this,"CopyDataMessage")}constructor(e,t){this.length=e,this. +chunk=t,this.name="copyData"}};I.CopyDataMessage=fn;var dn=class{static{o(this,"\ CopyResponse")}constructor(e,t,n,i){this.length=e,this.name=t,this.binary=n,this. -columnTypes=new Array(i)}};I.CopyResponse=hn;var fn=class{static{o(this,"Field")}constructor(e,t,n,i,s,a,u){ +columnTypes=new Array(i)}};I.CopyResponse=dn;var pn=class{static{o(this,"Field")}constructor(e,t,n,i,s,a,u){ this.name=e,this.tableID=t,this.columnID=n,this.dataTypeID=i,this.dataTypeSize=s, -this.dataTypeModifier=a,this.format=u}};I.Field=fn;var dn=class{static{o(this,"R\ +this.dataTypeModifier=a,this.format=u}};I.Field=pn;var yn=class{static{o(this,"R\ owDescriptionMessage")}constructor(e,t){this.length=e,this.fieldCount=t,this.name= "rowDescription",this.fields=new Array(this.fieldCount)}};I.RowDescriptionMessage= -dn;var pn=class{static{o(this,"ParameterDescriptionMessage")}constructor(e,t){this. +yn;var mn=class{static{o(this,"ParameterDescriptionMessage")}constructor(e,t){this. length=e,this.parameterCount=t,this.name="parameterDescription",this.dataTypeIDs= -new Array(this.parameterCount)}};I.ParameterDescriptionMessage=pn;var yn=class{static{ +new Array(this.parameterCount)}};I.ParameterDescriptionMessage=mn;var wn=class{static{ o(this,"ParameterStatusMessage")}constructor(e,t,n){this.length=e,this.parameterName= -t,this.parameterValue=n,this.name="parameterStatus"}};I.ParameterStatusMessage=yn; -var wn=class{static{o(this,"AuthenticationMD5Password")}constructor(e,t){this.length= +t,this.parameterValue=n,this.name="parameterStatus"}};I.ParameterStatusMessage=wn; +var gn=class{static{o(this,"AuthenticationMD5Password")}constructor(e,t){this.length= e,this.salt=t,this.name="authenticationMD5Password"}};I.AuthenticationMD5Password= -wn;var mn=class{static{o(this,"BackendKeyDataMessage")}constructor(e,t,n){this.length= +gn;var Sn=class{static{o(this,"BackendKeyDataMessage")}constructor(e,t,n){this.length= e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};I.BackendKeyDataMessage= -mn;var gn=class{static{o(this,"NotificationResponseMessage")}constructor(e,t,n,i){ +Sn;var bn=class{static{o(this,"NotificationResponseMessage")}constructor(e,t,n,i){ this.length=e,this.processId=t,this.channel=n,this.payload=i,this.name="notifica\ -tion"}};I.NotificationResponseMessage=gn;var Sn=class{static{o(this,"ReadyForQue\ +tion"}};I.NotificationResponseMessage=bn;var En=class{static{o(this,"ReadyForQue\ ryMessage")}constructor(e,t){this.length=e,this.status=t,this.name="readyForQuer\ -y"}};I.ReadyForQueryMessage=Sn;var En=class{static{o(this,"CommandCompleteMessag\ +y"}};I.ReadyForQueryMessage=En;var xn=class{static{o(this,"CommandCompleteMessag\ e")}constructor(e,t){this.length=e,this.text=t,this.name="commandComplete"}};I.CommandCompleteMessage= -En;var bn=class{static{o(this,"DataRowMessage")}constructor(e,t){this.length=e,this. -fields=t,this.name="dataRow",this.fieldCount=t.length}};I.DataRowMessage=bn;var xn=class{static{ +xn;var An=class{static{o(this,"DataRowMessage")}constructor(e,t){this.length=e,this. +fields=t,this.name="dataRow",this.fieldCount=t.length}};I.DataRowMessage=An;var vn=class{static{ o(this,"NoticeMessage")}constructor(e,t){this.length=e,this.message=t,this.name= -"notice"}};I.NoticeMessage=xn});var ra=B(Yt=>{"use strict";p();Object.defineProperty(Yt,"__esModule",{value:!0}); -Yt.Writer=void 0;var vn=class{static{o(this,"Writer")}constructor(e=256){this.size= +"notice"}};I.NoticeMessage=vn});var ra=R(Xt=>{"use strict";y();Object.defineProperty(Xt,"__esModule",{value:!0}); +Xt.Writer=void 0;var _n=class{static{o(this,"Writer")}constructor(e=256){this.size= e,this.offset=5,this.headerPosition=0,this.buffer=w.allocUnsafe(e)}ensure(e){var t=this. buffer.length-this.offset;if(t>1)+e;this. buffer=w.allocUnsafe(i),n.copy(this.buffer)}}addInt32(e){return this.ensure(4),this. @@ -1066,57 +1068,57 @@ e.copy(this.buffer,this.offset),this.offset+=e.length,this}join(e){if(e){this.bu headerPosition]=e;let t=this.offset-(this.headerPosition+1);this.buffer.writeInt32BE( t,this.headerPosition+1)}return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this. join(e);return this.offset=5,this.headerPosition=0,this.buffer=w.allocUnsafe(this. -size),t}};Yt.Writer=vn});var ia=B(Xt=>{"use strict";p();Object.defineProperty(Xt,"__esModule",{value:!0}); -Xt.serialize=void 0;var Cn=ra(),V=new Cn.Writer,El=o(r=>{V.addInt16(3).addInt16( -0);for(let n of Object.keys(r))V.addCString(n).addCString(r[n]);V.addCString("cl\ -ient_encoding").addCString("UTF8");var e=V.addCString("").flush(),t=e.length+4;return new Cn. -Writer().addInt32(t).add(e).flush()},"startup"),bl=o(()=>{let r=w.allocUnsafe(8); -return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),xl=o(r=>V. -addCString(r).flush(112),"password"),Al=o(function(r,e){return V.addCString(r).addInt32( -w.byteLength(e)).addString(e),V.flush(112)},"sendSASLInitialResponseMessage"),vl=o( -function(r){return V.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),Cl=o( -r=>V.addCString(r).flush(81),"query"),na=[],_l=o(r=>{let e=r.name||"";e.length>63&& +size),t}};Xt.Writer=_n});var ia=R(tr=>{"use strict";y();Object.defineProperty(tr,"__esModule",{value:!0}); +tr.serialize=void 0;var Tn=ra(),J=new Tn.Writer,Ul=o(r=>{J.addInt16(3).addInt16( +0);for(let n of Object.keys(r))J.addCString(n).addCString(r[n]);J.addCString("cl\ +ient_encoding").addCString("UTF8");var e=J.addCString("").flush(),t=e.length+4;return new Tn. +Writer().addInt32(t).add(e).flush()},"startup"),Ll=o(()=>{let r=w.allocUnsafe(8); +return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Il=o(r=>J. +addCString(r).flush(112),"password"),Pl=o(function(r,e){return J.addCString(r).addInt32( +w.byteLength(e)).addString(e),J.flush(112)},"sendSASLInitialResponseMessage"),Bl=o( +function(r){return J.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),Rl=o( +r=>J.addCString(r).flush(81),"query"),na=[],Nl=o(r=>{let e=r.name||"";e.length>63&& (console.error("Warning! Postgres only supports 63 characters for query names."), console.error("You supplied %s (%s)",e,e.length),console.error("This can cause c\ onflicts and silent errors executing queries"));let t=r.types||na;for(var n=t.length, -i=V.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| -"",n=r.binary||!1,i=r.values||na,s=i.length;return V.addCString(e).addCString(t), -V.addInt16(s),Tl(i,r.valueMapper),V.addInt16(s),V.add(Xe.flush()),V.addInt16(n?1: -0),V.flush(66)},"bind"),Ul=w.from([69,0,0,0,9,0,0,0,0,0]),Il=o(r=>{if(!r||!r.portal&& -!r.rows)return Ul;let e=r.portal||"",t=r.rows||0,n=w.byteLength(e),i=4+n+1+4,s=w. +i=J.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| +"",n=r.binary||!1,i=r.values||na,s=i.length;return J.addCString(e).addCString(t), +J.addInt16(s),Ml(i,r.valueMapper),J.addInt16(s),J.add(tt.flush()),J.addInt16(n?1: +0),J.flush(66)},"bind"),Fl=w.from([69,0,0,0,9,0,0,0,0,0]),ql=o(r=>{if(!r||!r.portal&& +!r.rows)return Fl;let e=r.portal||"",t=r.rows||0,n=w.byteLength(e),i=4+n+1+4,s=w. allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]= -0,s.writeUInt32BE(t,s.length-4),s},"execute"),Pl=o((r,e)=>{let t=w.allocUnsafe(16); +0,s.writeUInt32BE(t,s.length-4),s},"execute"),kl=o((r,e)=>{let t=w.allocUnsafe(16); return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE( -r,8),t.writeInt32BE(e,12),t},"cancel"),_n=o((r,e)=>{let n=4+w.byteLength(e)+1,i=w. +r,8),t.writeInt32BE(e,12),t},"cancel"),Un=o((r,e)=>{let n=4+w.byteLength(e)+1,i=w. allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i}, -"cstringMessage"),Bl=V.addCString("P").flush(68),Rl=V.addCString("S").flush(68), -Nl=o(r=>r.name?_n(68,`${r.type}${r.name||""}`):r.type==="P"?Bl:Rl,"describe"),Ml=o( -r=>{let e=`${r.type}${r.name||""}`;return _n(67,e)},"close"),Dl=o(r=>V.add(r).flush( -100),"copyData"),ql=o(r=>_n(102,r),"copyFail"),Zt=o(r=>w.from([r,0,0,0,4]),"code\ -OnlyBuffer"),Fl=Zt(72),Ol=Zt(83),kl=Zt(88),Ql=Zt(99),$l={startup:El,password:xl, -requestSsl:bl,sendSASLInitialResponseMessage:Al,sendSCRAMClientFinalMessage:vl,query:Cl, -parse:_l,bind:Ll,execute:Il,describe:Nl,close:Ml,flush:o(()=>Fl,"flush"),sync:o( -()=>Ol,"sync"),end:o(()=>kl,"end"),copyData:Dl,copyDone:o(()=>Ql,"copyDone"),copyFail:ql, -cancel:Pl};Xt.serialize=$l});var sa=B(er=>{"use strict";p();Object.defineProperty(er,"__esModule",{value:!0}); -er.BufferReader=void 0;var jl=w.allocUnsafe(0),Tn=class{static{o(this,"BufferRea\ -der")}constructor(e=0){this.offset=e,this.buffer=jl,this.encoding="utf-8"}setBuffer(e,t){ +"cstringMessage"),Ol=J.addCString("P").flush(68),Ql=J.addCString("S").flush(68), +$l=o(r=>r.name?Un(68,`${r.type}${r.name||""}`):r.type==="P"?Ol:Ql,"describe"),jl=o( +r=>{let e=`${r.type}${r.name||""}`;return Un(67,e)},"close"),Hl=o(r=>J.add(r).flush( +100),"copyData"),Kl=o(r=>Un(102,r),"copyFail"),er=o(r=>w.from([r,0,0,0,4]),"code\ +OnlyBuffer"),Wl=er(72),Gl=er(83),Vl=er(88),zl=er(99),Jl={startup:Ul,password:Il, +requestSsl:Ll,sendSASLInitialResponseMessage:Pl,sendSCRAMClientFinalMessage:Bl,query:Rl, +parse:Nl,bind:Dl,execute:ql,describe:$l,close:jl,flush:o(()=>Wl,"flush"),sync:o( +()=>Gl,"sync"),end:o(()=>Vl,"end"),copyData:Hl,copyDone:o(()=>zl,"copyDone"),copyFail:Kl, +cancel:kl};tr.serialize=Jl});var sa=R(rr=>{"use strict";y();Object.defineProperty(rr,"__esModule",{value:!0}); +rr.BufferReader=void 0;var Yl=w.allocUnsafe(0),Ln=class{static{o(this,"BufferRea\ +der")}constructor(e=0){this.offset=e,this.buffer=Yl,this.encoding="utf-8"}setBuffer(e,t){ this.offset=e,this.buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this. offset+=2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){ let e=this.buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this. buffer.toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstring(){ let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. -offset+e);return this.offset+=e,t}};er.BufferReader=Tn});var ua=B(tr=>{"use strict";p();Object.defineProperty(tr,"__esModule",{value:!0}); -tr.Parser=void 0;var z=An(),Hl=sa(),Ln=1,Kl=4,aa=Ln+Kl,oa=w.allocUnsafe(0),Un=class{static{ +offset+e);return this.offset+=e,t}};rr.BufferReader=Ln});var ua=R(nr=>{"use strict";y();Object.defineProperty(nr,"__esModule",{value:!0}); +nr.Parser=void 0;var Y=Cn(),Zl=sa(),In=1,Xl=4,aa=In+Xl,oa=w.allocUnsafe(0),Pn=class{static{ o(this,"Parser")}constructor(e){if(this.buffer=oa,this.bufferLength=0,this.bufferOffset= -0,this.reader=new Hl.BufferReader,e?.mode==="binary")throw new Error("Binary mod\ +0,this.reader=new Zl.BufferReader,e?.mode==="binary")throw new Error("Binary mod\ e not supported yet");this.mode=e?.mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this. bufferOffset+this.bufferLength,i=this.bufferOffset;for(;i+aa<=n;){let s=this.buffer[i], -a=this.buffer.readUInt32BE(i+Ln),u=Ln+a;if(u+i<=n){let c=this.handlePacket(i+aa, +a=this.buffer.readUInt32BE(i+In),u=In+a;if(u+i<=n){let c=this.handlePacket(i+aa, s,a,this.buffer);t(c),i+=u}else break}i===n?(this.buffer=oa,this.bufferLength=0, this.bufferOffset=0):(this.bufferLength=n-i,this.bufferOffset=i)}mergeBuffer(e){ if(this.bufferLength>0){let t=this.bufferLength+e.byteLength;if(t+this.bufferOffset> @@ -1125,9 +1127,9 @@ bufferLength)i=this.buffer;else{let s=this.buffer.byteLength*2;for(;t>=s;)s*=2;i w.allocUnsafe(s)}this.buffer.copy(i,0,this.bufferOffset,this.bufferOffset+this.bufferLength), this.buffer=i,this.bufferOffset=0}e.copy(this.buffer,this.bufferOffset+this.bufferLength), this.bufferLength=t}else this.buffer=e,this.bufferOffset=0,this.bufferLength=e.byteLength}handlePacket(e,t,n,i){ -switch(t){case 50:return z.bindComplete;case 49:return z.parseComplete;case 51:return z. -closeComplete;case 110:return z.noData;case 115:return z.portalSuspended;case 99: -return z.copyDone;case 87:return z.replicationStart;case 73:return z.emptyQuery;case 68: +switch(t){case 50:return Y.bindComplete;case 49:return Y.parseComplete;case 51:return Y. +closeComplete;case 110:return Y.noData;case 115:return Y.portalSuspended;case 99: +return Y.copyDone;case 87:return Y.replicationStart;case 73:return Y.emptyQuery;case 68: return this.parseDataRowMessage(e,n,i);case 67:return this.parseCommandCompleteMessage( e,n,i);case 90:return this.parseReadyForQueryMessage(e,n,i);case 65:return this. parseNotificationMessage(e,n,i);case 82:return this.parseAuthenticationResponse( @@ -1136,54 +1138,54 @@ parseBackendKeyData(e,n,i);case 69:return this.parseErrorMessage(e,n,i,"error"); return this.parseErrorMessage(e,n,i,"notice");case 84:return this.parseRowDescriptionMessage( e,n,i);case 116:return this.parseParameterDescriptionMessage(e,n,i);case 71:return this. parseCopyInMessage(e,n,i);case 72:return this.parseCopyOutMessage(e,n,i);case 100: -return this.parseCopyData(e,n,i);default:return new z.DatabaseError("received in\ +return this.parseCopyData(e,n,i);default:return new Y.DatabaseError("received in\ valid response: "+t.toString(16),n,"error")}}parseReadyForQueryMessage(e,t,n){this. -reader.setBuffer(e,n);let i=this.reader.string(1);return new z.ReadyForQueryMessage( +reader.setBuffer(e,n);let i=this.reader.string(1);return new Y.ReadyForQueryMessage( t,i)}parseCommandCompleteMessage(e,t,n){this.reader.setBuffer(e,n);let i=this.reader. -cstring();return new z.CommandCompleteMessage(t,i)}parseCopyData(e,t,n){let i=n. -slice(e,e+(t-4));return new z.CopyDataMessage(t,i)}parseCopyInMessage(e,t,n){return this. +cstring();return new Y.CommandCompleteMessage(t,i)}parseCopyData(e,t,n){let i=n. +slice(e,e+(t-4));return new Y.CopyDataMessage(t,i)}parseCopyInMessage(e,t,n){return this. parseCopyMessage(e,t,n,"copyInResponse")}parseCopyOutMessage(e,t,n){return this. parseCopyMessage(e,t,n,"copyOutResponse")}parseCopyMessage(e,t,n,i){this.reader. -setBuffer(e,n);let s=this.reader.byte()!==0,a=this.reader.int16(),u=new z.CopyResponse( +setBuffer(e,n);let s=this.reader.byte()!==0,a=this.reader.int16(),u=new Y.CopyResponse( t,i,s,a);for(let c=0;c{"use strict";p();Object.defineProperty(Pe,"__esModule",{value:!0}); -Pe.DatabaseError=Pe.serialize=Pe.parse=void 0;var Wl=An();Object.defineProperty( -Pe,"DatabaseError",{enumerable:!0,get:o(function(){return Wl.DatabaseError},"get")}); -var Gl=ia();Object.defineProperty(Pe,"serialize",{enumerable:!0,get:o(function(){ -return Gl.serialize},"get")});var Vl=ua();function zl(r,e){let t=new Vl.Parser;return r. -on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}o(zl,"parse");Pe. -parse=zl});var ca={};pe(ca,{connect:()=>Jl});function Jl({socket:r,servername:e}){return r. -startTls(e),r}var la=le(()=>{"use strict";p();o(Jl,"connect")});var Bn=B((dp,da)=>{"use strict";p();var ha=(Jt(),X(ta)),Yl=Ue().EventEmitter,{parse:Zl, -serialize:te}=In(),fa=te.flush(),Xl=te.sync(),eh=te.end(),Pn=class extends Yl{static{ +routine=s.R,c}};nr.Parser=Pn});var Bn=R(Ne=>{"use strict";y();Object.defineProperty(Ne,"__esModule",{value:!0}); +Ne.DatabaseError=Ne.serialize=Ne.parse=void 0;var eh=Cn();Object.defineProperty( +Ne,"DatabaseError",{enumerable:!0,get:o(function(){return eh.DatabaseError},"get")}); +var th=ia();Object.defineProperty(Ne,"serialize",{enumerable:!0,get:o(function(){ +return th.serialize},"get")});var rh=ua();function nh(r,e){let t=new rh.Parser;return r. +on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}o(nh,"parse");Ne. +parse=nh});var ca={};me(ca,{connect:()=>ih});function ih({socket:r,servername:e}){return r. +startTls(e),r}var la=ye(()=>{"use strict";y();o(ih,"connect")});var Nn=R((pp,da)=>{"use strict";y();var ha=(Zt(),te(ta)),sh=Be().EventEmitter,{parse:ah, +serialize:ne}=Bn(),fa=ne.flush(),oh=ne.sync(),uh=ne.end(),Rn=class extends sh{static{ o(this,"Connection")}constructor(e){super(),e=e||{},this.stream=e.stream||new ha. Socket,this._keepAlive=e.keepAlive,this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis, this.lastBuffer=!1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this. @@ -1197,37 +1199,37 @@ StreamError");if(this.stream.on("error",i),this.stream.on("close",function(){n.e ta",function(s){var a=s.toString("utf8");switch(a){case"S":break;case"N":return n. stream.end(),n.emit("error",new Error("The server does not support SSL connectio\ ns"));default:return n.stream.end(),n.emit("error",new Error("There was an error\ - establishing an SSL connection"))}var u=(la(),X(ca));let c={socket:n.stream};n. + establishing an SSL connection"))}var u=(la(),te(ca));let c={socket:n.stream};n. ssl!==!0&&(Object.assign(c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),ha.isIP(t)=== 0&&(c.servername=t);try{n.stream=u.connect(c)}catch(l){return n.emit("error",l)} n.attachListeners(n.stream),n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){ -e.on("end",()=>{this.emit("end")}),Zl(e,t=>{var n=t.name==="error"?"errorMessage": +e.on("end",()=>{this.emit("end")}),ah(e,t=>{var n=t.name==="error"?"errorMessage": t.name;this._emitMessage&&this.emit("message",t),this.emit(n,t)})}requestSsl(){this. -stream.write(te.requestSsl())}startup(e){this.stream.write(te.startup(e))}cancel(e,t){ -this._send(te.cancel(e,t))}password(e){this._send(te.password(e))}sendSASLInitialResponseMessage(e,t){ -this._send(te.sendSASLInitialResponseMessage(e,t))}sendSCRAMClientFinalMessage(e){ -this._send(te.sendSCRAMClientFinalMessage(e))}_send(e){return this.stream.writable? -this.stream.write(e):!1}query(e){this._send(te.query(e))}parse(e){this._send(te. -parse(e))}bind(e){this._send(te.bind(e))}execute(e){this._send(te.execute(e))}flush(){ +stream.write(ne.requestSsl())}startup(e){this.stream.write(ne.startup(e))}cancel(e,t){ +this._send(ne.cancel(e,t))}password(e){this._send(ne.password(e))}sendSASLInitialResponseMessage(e,t){ +this._send(ne.sendSASLInitialResponseMessage(e,t))}sendSCRAMClientFinalMessage(e){ +this._send(ne.sendSCRAMClientFinalMessage(e))}_send(e){return this.stream.writable? +this.stream.write(e):!1}query(e){this._send(ne.query(e))}parse(e){this._send(ne. +parse(e))}bind(e){this._send(ne.bind(e))}execute(e){this._send(ne.execute(e))}flush(){ this.stream.writable&&this.stream.write(fa)}sync(){this._ending=!0,this._send(fa), -this._send(Xl)}ref(){this.stream.ref()}unref(){this.stream.unref()}end(){if(this. +this._send(oh)}ref(){this.stream.ref()}unref(){this.stream.unref()}end(){if(this. _ending=!0,!this._connecting||!this.stream.writable){this.stream.end();return}return this. -stream.write(eh,()=>{this.stream.end()})}close(e){this._send(te.close(e))}describe(e){ -this._send(te.describe(e))}sendCopyFromChunk(e){this._send(te.copyData(e))}endCopyFrom(){ -this._send(te.copyDone())}sendCopyFail(e){this._send(te.copyFail(e))}};da.exports= -Pn});var wa=B((mp,ya)=>{"use strict";p();var th=Ue().EventEmitter,wp=(ht(),X(lt)),rh=bt(), -Rn=Cs(),nh=Ds(),ih=Vt(),sh=zt(),pa=Zs(),ah=Et(),oh=Bn(),rr=class extends th{static{ -o(this,"Client")}constructor(e){super(),this.connectionParameters=new sh(e),this. +stream.write(uh,()=>{this.stream.end()})}close(e){this._send(ne.close(e))}describe(e){ +this._send(ne.describe(e))}sendCopyFromChunk(e){this._send(ne.copyData(e))}endCopyFrom(){ +this._send(ne.copyDone())}sendCopyFail(e){this._send(ne.copyFail(e))}};da.exports= +Rn});var ma=R((gp,ya)=>{"use strict";y();var ch=Be().EventEmitter,wp=(pt(),te(dt)),lh=vt(), +Mn=Cs(),hh=Ds(),fh=Jt(),dh=Yt(),pa=Zs(),ph=At(),yh=Nn(),ir=class extends ch{static{ +o(this,"Client")}constructor(e){super(),this.connectionParameters=new dh(e),this. user=this.connectionParameters.user,this.database=this.connectionParameters.database, this.port=this.connectionParameters.port,this.host=this.connectionParameters.host, Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0, value:this.connectionParameters.password}),this.replication=this.connectionParameters. -replication;var t=e||{};this._Promise=t.Promise||_.Promise,this._types=new ih(t. +replication;var t=e||{};this._Promise=t.Promise||_.Promise,this._types=new fh(t. types),this._ending=!1,this._connecting=!1,this._connected=!1,this._connectionError= -!1,this._queryable=!0,this.connection=t.connection||new oh({stream:t.stream,ssl:this. +!1,this._queryable=!0,this.connection=t.connection||new yh({stream:t.stream,ssl:this. connectionParameters.ssl,keepAlive:t.keepAlive||!1,keepAliveInitialDelayMillis:t. keepAliveInitialDelayMillis||0,encoding:this.connectionParameters.client_encoding|| -"utf8"}),this.queryQueue=[],this.binary=t.binary||ah.binary,this.processID=null, +"utf8"}),this.queryQueue=[],this.binary=t.binary||ph.binary,this.processID=null, this.secretKey=null,this.ssl=this.connectionParameters.ssl||!1,this.ssl&&this.ssl. key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this._connectionTimeoutMillis= t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=o(n=>{S.nextTick(()=>{n.handleError( @@ -1266,15 +1268,15 @@ connection;typeof this.password=="function"?this._Promise.resolve().then(()=>thi password()).then(n=>{if(n!==void 0){if(typeof n!="string"){t.emit("error",new TypeError( "Password must be a string"));return}this.connectionParameters.password=this.password= n}else this.connectionParameters.password=this.password=null;e()}).catch(n=>{t.emit( -"error",n)}):this.password!==null?e():nh(this.connectionParameters,n=>{n!==void 0&& +"error",n)}):this.password!==null?e():hh(this.connectionParameters,n=>{n!==void 0&& (this.connectionParameters.password=this.password=n),e()})}_handleAuthCleartextPassword(e){ this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){ -this._checkPgPass(()=>{let t=rh.postgresMd5PasswordHash(this.user,this.password, +this._checkPgPass(()=>{let t=lh.postgresMd5PasswordHash(this.user,this.password, e.salt);this.connection.password(t)})}_handleAuthSASL(e){this._checkPgPass(()=>{ -this.saslSession=Rn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( +this.saslSession=Mn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( this.saslSession.mechanism,this.saslSession.response)})}_handleAuthSASLContinue(e){ -Rn.continueSession(this.saslSession,this.password,e.data),this.connection.sendSCRAMClientFinalMessage( -this.saslSession.response)}_handleAuthSASLFinal(e){Rn.finalizeSession(this.saslSession, +Mn.continueSession(this.saslSession,this.password,e.data),this.connection.sendSCRAMClientFinalMessage( +this.saslSession.response)}_handleAuthSASLFinal(e){Mn.finalizeSession(this.saslSession, e.data),this.saslSession=null}_handleBackendKeyData(e){this.processID=e.processID, this.secretKey=e.secretKey}_handleReadyForQuery(e){this._connecting&&(this._connecting= !1,this._connected=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback&& @@ -1316,7 +1318,7 @@ emit("drain"))}query(e,t,n){var i,s,a,u,c;if(e==null)throw new TypeError("Client was passed a null or undefined query");return typeof e.submit=="function"?(a=e. query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& (i.callback=i.callback||t)):(a=this.connectionParameters.query_timeout,i=new pa( -e,t,n),i.callback||(s=new this._Promise((l,h)=>{i.callback=(f,y)=>f?h(f):l(y)}))), +e,t,n),i.callback||(s=new this._Promise((l,h)=>{i.callback=(f,p)=>f?h(f):l(p)}))), a&&(c=i.callback,u=setTimeout(()=>{var l=new Error("Query read timeout");S.nextTick( ()=>{i.handleError(l,this.connection)}),c(l),i.callback=()=>{};var h=this.queryQueue. indexOf(i);h>-1&&this.queryQueue.splice(h,1),this._pulseQueryQueue()},a),i.callback= @@ -1329,18 +1331,18 @@ ot queryable"),this.connection)}),s)}ref(){this.connection.ref()}unref(){this.co unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else return this. _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. -_Promise(t=>{this.connection.once("end",t)})}};rr.Query=pa;ya.exports=rr});var Ea=B((Ep,Sa)=>{"use strict";p();var uh=Ue().EventEmitter,ma=o(function(){},"\ +_Promise(t=>{this.connection.once("end",t)})}};ir.Query=pa;ya.exports=ir});var ba=R((Ep,Sa)=>{"use strict";y();var mh=Be().EventEmitter,wa=o(function(){},"\ NOOP"),ga=o((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, -"removeWhere"),Nn=class{static{o(this,"IdleItem")}constructor(e,t,n){this.client= -e,this.idleListener=t,this.timeoutId=n}},et=class{static{o(this,"PendingItem")}constructor(e){ -this.callback=e}};function ch(){throw new Error("Release called on client which \ -has already been released to the pool.")}o(ch,"throwOnDoubleRelease");function nr(r,e){ +"removeWhere"),Dn=class{static{o(this,"IdleItem")}constructor(e,t,n){this.client= +e,this.idleListener=t,this.timeoutId=n}},rt=class{static{o(this,"PendingItem")}constructor(e){ +this.callback=e}};function wh(){throw new Error("Release called on client which \ +has already been released to the pool.")}o(wh,"throwOnDoubleRelease");function sr(r,e){ if(e)return{callback:e,result:void 0};let t,n,i=o(function(a,u){a?t(a):n(u)},"cb"), s=new r(function(a,u){n=a,t=u}).catch(a=>{throw Error.captureStackTrace(a),a});return{ -callback:i,result:s}}o(nr,"promisify");function lh(r,e){return o(function t(n){n. +callback:i,result:s}}o(sr,"promisify");function gh(r,e){return o(function t(n){n. client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional client \ error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)},"\ -idleListener")}o(lh,"makeIdleListener");var Mn=class extends uh{static{o(this,"P\ +idleListener")}o(gh,"makeIdleListener");var Fn=class extends mh{static{o(this,"P\ ool")}constructor(e,t){super(),this.options=Object.assign({},e),e!=null&&"passwo\ rd"in e&&Object.defineProperty(this.options,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty( @@ -1348,7 +1350,7 @@ this.options.ssl,"key",{enumerable:!1}),this.options.max=this.options.max||this. options.poolSize||10,this.options.maxUses=this.options.maxUses||1/0,this.options. allowExitOnIdle=this.options.allowExitOnIdle||!1,this.options.maxLifetimeSeconds= this.options.maxLifetimeSeconds||0,this.log=this.options.log||function(){},this. -Client=this.options.Client||t||ir().Client,this.Promise=this.options.Promise||_. +Client=this.options.Client||t||ar().Client,this.Promise=this.options.Promise||_. Promise,typeof this.options.idleTimeoutMillis>"u"&&(this.options.idleTimeoutMillis= 1e4),this._clients=[],this._idle=[],this._expired=new WeakSet,this._pendingQueue= [],this._endCallback=void 0,this.ending=!1,this.ended=!1}_isFull(){return this._clients. @@ -1363,31 +1365,31 @@ n,e,i,!1)}if(!this._isFull())return this.newClient(e);throw new Error("unexpecte d condition")}_remove(e){let t=ga(this._idle,n=>n.client===e);t!==void 0&&clearTimeout( t.timeoutId),this._clients=this._clients.filter(n=>n!==e),e.end(),this.emit("rem\ ove",e)}connect(e){if(this.ending){let i=new Error("Cannot use a pool after call\ -ing end on the pool");return e?e(i):this.Promise.reject(i)}let t=nr(this.Promise, +ing end on the pool");return e?e(i):this.Promise.reject(i)}let t=sr(this.Promise, e),n=t.result;if(this._isFull()||this._idle.length){if(this._idle.length&&S.nextTick( ()=>this._pulseQueue()),!this.options.connectionTimeoutMillis)return this._pendingQueue. -push(new et(t.callback)),n;let i=o((u,c,l)=>{clearTimeout(a),t.callback(u,c,l)}, -"queueCallback"),s=new et(i),a=setTimeout(()=>{ga(this._pendingQueue,u=>u.callback=== +push(new rt(t.callback)),n;let i=o((u,c,l)=>{clearTimeout(a),t.callback(u,c,l)}, +"queueCallback"),s=new rt(i),a=setTimeout(()=>{ga(this._pendingQueue,u=>u.callback=== i),s.timedOut=!0,t.callback(new Error("timeout exceeded when trying to connect"))}, this.options.connectionTimeoutMillis);return this._pendingQueue.push(s),n}return this. -newClient(new et(t.callback)),n}newClient(e){let t=new this.Client(this.options); -this._clients.push(t);let n=lh(this,t);this.log("checking client timeout");let i, +newClient(new rt(t.callback)),n}newClient(e){let t=new this.Client(this.options); +this._clients.push(t);let n=gh(this,t);this.log("checking client timeout");let i, s=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{this.log("ending c\ lient due to timeout"),s=!0,t.connection?t.connection.stream.destroy():t.end()}, this.options.connectionTimeoutMillis)),this.log("connecting new client"),t.connect( a=>{if(i&&clearTimeout(i),t.on("error",n),a)this.log("client failed to connect", a),this._clients=this._clients.filter(u=>u!==t),s&&(a.message="Connection termin\ ated due to connection timeout"),this._pulseQueue(),e.timedOut||e.callback(a,void 0, -ma);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!==0){ +wa);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!==0){ let u=setTimeout(()=>{this.log("ending client due to expired lifetime"),this._expired. -add(t),this._idle.findIndex(l=>l.client===t)!==-1&&this._acquireClient(t,new et( +add(t),this._idle.findIndex(l=>l.client===t)!==-1&&this._acquireClient(t,new rt( (l,h,f)=>f()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.once("end", ()=>clearTimeout(u))}return this._acquireClient(t,e,n,!0)}})}_acquireClient(e,t,n,i){ i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n), e.removeListener("error",n),t.timedOut?i&&this.options.verify?this.options.verify( e,e.release):e.release():i&&this.options.verify?this.options.verify(e,s=>{if(s)return e. -release(s),t.callback(s,void 0,ma);t.callback(void 0,e,e.release)}):t.callback(void 0, -e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&ch(),n=!0,this._release(e, +release(s),t.callback(s,void 0,wa);t.callback(void 0,e,e.release)}):t.callback(void 0, +e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&wh(),n=!0,this._release(e, t,i)}}_release(e,t,n){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1, this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>= this.options.maxUses){e._poolUseCount>=this.options.maxUses&&this.log("remove ex\ @@ -1395,21 +1397,21 @@ pended client"),this._remove(e),this._pulseQueue();return}if(this._expired.has(e this.log("remove expired client"),this._expired.delete(e),this._remove(e),this._pulseQueue(); return}let s;this.options.idleTimeoutMillis&&(s=setTimeout(()=>{this.log("remove\ idle client"),this._remove(e)},this.options.idleTimeoutMillis),this.options.allowExitOnIdle&& -s.unref()),this.options.allowExitOnIdle&&e.unref(),this._idle.push(new Nn(e,t,s)), -this._pulseQueue()}query(e,t,n){if(typeof e=="function"){let s=nr(this.Promise,e); +s.unref()),this.options.allowExitOnIdle&&e.unref(),this._idle.push(new Dn(e,t,s)), +this._pulseQueue()}query(e,t,n){if(typeof e=="function"){let s=sr(this.Promise,e); return T(function(){return s.callback(new Error("Passing a function as the first\ parameter to pool.query is not supported"))}),s.result}typeof t=="function"&&(n= -t,t=void 0);let i=nr(this.Promise,n);return n=i.callback,this.connect((s,a)=>{if(s) +t,t=void 0);let i=sr(this.Promise,n);return n=i.callback,this.connect((s,a)=>{if(s) return n(s);let u=!1,c=o(l=>{u||(u=!0,a.release(l),n(l))},"onError");a.once("err\ or",c),this.log("dispatching query");try{a.query(e,t,(l,h)=>{if(this.log("query \ dispatched"),a.removeListener("error",c),!u)return u=!0,a.release(l),l?n(l):n(void 0, h)})}catch(l){return a.release(l),n(l)}}),i.result}end(e){if(this.log("ending"), this.ending){let n=new Error("Called end on pool more than once");return e?e(n): -this.Promise.reject(n)}this.ending=!0;let t=nr(this.Promise,e);return this._endCallback= +this.Promise.reject(n)}this.ending=!0;let t=sr(this.Promise,e);return this._endCallback= t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue. length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients. reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients. -length}};Sa.exports=Mn});var ba={};pe(ba,{default:()=>hh});var hh,xa=le(()=>{"use strict";p();hh={}});var Aa=B((vp,fh)=>{fh.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ +length}};Sa.exports=Fn});var Ea={};me(Ea,{default:()=>Sh});var Sh,xa=ye(()=>{"use strict";y();Sh={}});var Aa=R((Cp,bh)=>{bh.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ client - pure javascript & libpq with the same API",keywords:["database","libpq", "pg","postgre","postgres","postgresql","rdbms"],homepage:"https://github.com/bri\ anc/node-postgres",repository:{type:"git",url:"git://github.com/brianc/node-post\ @@ -1420,21 +1422,21 @@ pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:" 4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ "pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ .md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ -7b9a5491a178655"}});var _a=B((Cp,Ca)=>{"use strict";p();var va=Ue().EventEmitter,dh=(ht(),X(lt)),Dn=bt(), -tt=Ca.exports=function(r,e,t){va.call(this),r=Dn.normalizeQueryConfig(r,e,t),this. +7b9a5491a178655"}});var _a=R((_p,Ca)=>{"use strict";y();var va=Be().EventEmitter,Eh=(pt(),te(dt)),qn=vt(), +nt=Ca.exports=function(r,e,t){va.call(this),r=qn.normalizeQueryConfig(r,e,t),this. text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ -newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};dh.inherits( -tt,va);var ph={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ +newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Eh.inherits( +nt,va);var xh={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ age",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"\ dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"\ -routine"};tt.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); -if(e)for(var t in e){var n=ph[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. -emit("error",r),this.state="error"};tt.prototype.then=function(r,e){return this. -_getPromise().then(r,e)};tt.prototype.catch=function(r){return this._getPromise(). -catch(r)};tt.prototype._getPromise=function(){return this._promise?this._promise: +routine"};nt.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); +if(e)for(var t in e){var n=xh[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. +emit("error",r),this.state="error"};nt.prototype.then=function(r,e){return this. +_getPromise().then(r,e)};nt.prototype.catch=function(r){return this._getPromise(). +catch(r)};nt.prototype._getPromise=function(){return this._promise?this._promise: (this._promise=new Promise(function(r,e){this._once("end",r),this._once("error", -e)}.bind(this)),this._promise)};tt.prototype.submit=function(r){this.state="runn\ +e)}.bind(this)),this._promise)};nt.prototype.submit=function(r){this.state="runn\ ing";var e=this;this.native=r.native,r.native.arrayMode=this._arrayMode;var t=o( function(s,a,u){if(r.native.arrayMode=!1,T(function(){e.emit("_done")}),s)return e. handleError(s);e._emitRowEvents&&(u.length>1?a.forEach((c,l)=>{c.forEach(h=>{e.emit( @@ -1443,38 +1445,38 @@ handleError(s);e._emitRowEvents&&(u.length>1?a.forEach((c,l)=>{c.forEach(h=>{e.e t)),this.name){this.name.length>63&&(console.error("Warning! Postgres only suppo\ rts 63 characters for query names."),console.error("You supplied %s (%s)",this.name, this.name.length),console.error("This can cause conflicts and silent errors exec\ -uting queries"));var n=(this.values||[]).map(Dn.prepareValue);if(r.namedQueries[this. +uting queries"));var n=(this.values||[]).map(qn.prepareValue);if(r.namedQueries[this. name]){if(this.text&&r.namedQueries[this.name]!==this.text){let s=new Error(`Pre\ pared statements must be unique - '${this.name}' was used for a different statem\ ent`);return t(s)}return r.native.execute(this.name,n,t)}return r.native.prepare( this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e. text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. -values.map(Dn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Ia=B((Up,Ua)=>{"use strict";p();var yh=(xa(),X(ba)),wh=Vt(),Lp=Aa(),Ta=Ue(). -EventEmitter,mh=(ht(),X(lt)),gh=zt(),La=_a(),de=Ua.exports=function(r){Ta.call(this), -r=r||{},this._Promise=r.Promise||_.Promise,this._types=new wh(r.types),this.native= -new yh({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= -!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new gh( +values.map(qn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. +text,t)}});var Ia=R((Ip,La)=>{"use strict";y();var Ah=(xa(),te(Ea)),vh=Jt(),Lp=Aa(),Ta=Be(). +EventEmitter,Ch=(pt(),te(dt)),_h=Yt(),Ua=_a(),pe=La.exports=function(r){Ta.call( +this),r=r||{},this._Promise=r.Promise||_.Promise,this._types=new vh(r.types),this. +native=new Ah({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new _h( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= -e.port,this.namedQueries={}};de.Query=La;mh.inherits(de,Ta);de.prototype._errorAllQueries= +e.port,this.namedQueries={}};pe.Query=Ua;Ch.inherits(pe,Ta);pe.prototype._errorAllQueries= function(r){let e=o(t=>{S.nextTick(()=>{t.native=this.native,t.handleError(r)})}, "enqueueError");this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery= -null),this._queryQueue.forEach(e),this._queryQueue.length=0};de.prototype._connect= +null),this._queryQueue.forEach(e),this._queryQueue.length=0};pe.prototype._connect= function(r){var e=this;if(this._connecting){S.nextTick(()=>r(new Error("Client h\ as already been connected. You cannot reuse a client.")));return}this._connecting= !0,this.connectionParameters.getLibpqConnectionString(function(t,n){if(t)return r( t);e.native.connect(n,function(i){if(i)return e.native.end(),r(i);e._connected=!0, e.native.on("error",function(s){e._queryable=!1,e._errorAllQueries(s),e.emit("er\ ror",s)}),e.native.on("notification",function(s){e.emit("notification",{channel:s. -relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};de. +relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};pe. prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise( -(e,t)=>{this._connect(n=>{n?t(n):e()})})};de.prototype.query=function(r,e,t){var n, +(e,t)=>{this._connect(n=>{n?t(n):e()})})};pe.prototype.query=function(r,e,t){var n, i,s,a,u;if(r==null)throw new TypeError("Client was passed a null or undefined qu\ ery");if(typeof r.submit=="function")s=r.query_timeout||this.connectionParameters. query_timeout,i=n=r,typeof e=="function"&&(r.callback=e);else if(s=this.connectionParameters. -query_timeout,n=new La(r,e,t),!n.callback){let c,l;i=new this._Promise((h,f)=>{c= +query_timeout,n=new Ua(r,e,t),!n.callback){let c,l;i=new this._Promise((h,f)=>{c= h,l=f}),n.callback=(h,f)=>h?l(h):c(f)}return s&&(u=n.callback,a=setTimeout(()=>{ var c=new Error("Query read timeout");S.nextTick(()=>{n.handleError(c,this.connection)}), u(c),n.callback=()=>{};var l=this._queryQueue.indexOf(n);l>-1&&this._queryQueue. @@ -1483,72 +1485,83 @@ this._queryable?this._ending?(n.native=this.native,S.nextTick(()=>{n.handleError new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.push( n),this._pulseQueryQueue(),i):(n.native=this.native,S.nextTick(()=>{n.handleError( new Error("Client has encountered a connection error and is not queryable"))}),i)}; -de.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( +pe.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( "connect",this.end.bind(this,r));var t;return r||(t=new this._Promise(function(n,i){ r=o(s=>s?i(s):n(),"cb")})),this.native.end(function(){e._errorAllQueries(new Error( -"Connection terminated")),S.nextTick(()=>{e.emit("end"),r&&r()})}),t};de.prototype. +"Connection terminated")),S.nextTick(()=>{e.emit("end"),r&&r()})}),t};pe.prototype. _hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="\ -error"&&this._activeQuery.state!=="end"};de.prototype._pulseQueryQueue=function(r){ +error"&&this._activeQuery.state!=="end"};pe.prototype._pulseQueryQueue=function(r){ if(this._connected&&!this._hasActiveQuery()){var e=this._queryQueue.shift();if(!e){ r||this.emit("drain");return}this._activeQuery=e,e.submit(this);var t=this;e.once( -"_done",function(){t._pulseQueryQueue()})}};de.prototype.cancel=function(r){this. +"_done",function(){t._pulseQueryQueue()})}};pe.prototype.cancel=function(r){this. _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== --1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};de.prototype.ref=function(){}; -de.prototype.unref=function(){};de.prototype.setTypeParser=function(r,e,t){return this. -_types.setTypeParser(r,e,t)};de.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var qn=B((Bp,Pa)=>{"use strict";p();Pa.exports=Ia()});var ir=B((Mp,At)=>{"use strict";p();var Sh=wa(),Eh=Et(),bh=Bn(),xh=Ea(),{DatabaseError:Ah}=In(), -vh=o(r=>class extends xh{static{o(this,"BoundPool")}constructor(t){super(t,r)}}, -"poolFactory"),Fn=o(function(r){this.defaults=Eh,this.Client=r,this.Query=this.Client. -Query,this.Pool=vh(this.Client),this._pools=[],this.Connection=bh,this.types=St(), -this.DatabaseError=Ah},"PG");typeof S.env.NODE_PG_FORCE_NATIVE<"u"?At.exports=new Fn( -qn()):(At.exports=new Fn(Sh),Object.defineProperty(At.exports,"native",{configurable:!0, -enumerable:!1,get(){var r=null;try{r=new Fn(qn())}catch(e){if(e.code!=="MODULE_N\ -OT_FOUND")throw e}return Object.defineProperty(At.exports,"native",{value:r}),r}}))});p();var Tr={};pe(Tr,{SocketReadQueue:()=>eu,TrustedCert:()=>gi,WebSocketReadQueue:()=>Xo, -startTls:()=>Zo});p();function se(...r){if(r.length===1&&r[0]instanceof Uint8Array)return r[0];let e=r. +-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};pe.prototype.ref=function(){}; +pe.prototype.unref=function(){};pe.prototype.setTypeParser=function(r,e,t){return this. +_types.setTypeParser(r,e,t)};pe.prototype.getTypeParser=function(r,e){return this. +_types.getTypeParser(r,e)}});var kn=R((Rp,Pa)=>{"use strict";y();Pa.exports=Ia()});var ar=R((Dp,_t)=>{"use strict";y();var Th=ma(),Uh=At(),Lh=Nn(),Ih=ba(),{DatabaseError:Ph}=Bn(), +Bh=o(r=>class extends Ih{static{o(this,"BoundPool")}constructor(t){super(t,r)}}, +"poolFactory"),On=o(function(r){this.defaults=Uh,this.Client=r,this.Query=this.Client. +Query,this.Pool=Bh(this.Client),this._pools=[],this.Connection=Lh,this.types=xt(), +this.DatabaseError=Ph},"PG");typeof S.env.NODE_PG_FORCE_NATIVE<"u"?_t.exports=new On( +kn()):(_t.exports=new On(Th),Object.defineProperty(_t.exports,"native",{configurable:!0, +enumerable:!1,get(){var r=null;try{r=new On(kn())}catch(e){if(e.code!=="MODULE_N\ +OT_FOUND")throw e}return Object.defineProperty(_t.exports,"native",{value:r}),r}}))});y();var Lr={};me(Lr,{SocketReadQueue:()=>ou,TrustedCert:()=>ht,WebSocketReadQueue:()=>au, +base64Decode:()=>Si,hexFromU8:()=>X,stableStringify:()=>uu,startTls:()=>su,u8FromHex:()=>Ie}); +y();var Po=Object.defineProperty,Bo=o((r,e,t)=>e in r?Po(r,e,{enumerable:!0,configurable:!0, +writable:!0,value:t}):r[e]=t,"re"),j=o((r,e,t)=>Bo(r,typeof e!="symbol"?e+"":e,t), +"u");function oe(...r){if(r.length===1&&r[0]instanceof Uint8Array)return r[0];let e=r. reduce((i,s)=>i+s.length,0),t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+= -i.length;return t}o(se,"p");function ut(r,e){let t=r.length;if(t!==e.length)return!1; -for(let n=0;nthis.data.length)throw new Error("Expected length e\ -xceeds remaining data length");return this.indent+=e,this.indents[t]=this.indent, -[()=>{if(this.indent-=e,this.indents[this.offset]=this.indent,this.offset!==n)throw new Error( -`${r} bytes expected but ${this.offset-t} read`)},()=>n-this.offset]}expectLengthUint8(r){ -let e=this.readUint8();return this.expectLength(e)}expectLengthUint16(r){let e=this. -readUint16();return this.expectLength(e)}expectLengthUint24(r){let e=this.readUint24(); -return this.expectLength(e)}expectLengthUint32(r){let e=this.readUint32();return this. -expectLength(e)}expectLengthUint8Incl(r){let e=this.readUint8();return this.expectLength( -e-1)}expectLengthUint16Incl(r){let e=this.readUint16();return this.expectLength( -e-2)}expectLengthUint24Incl(r){let e=this.readUint24();return this.expectLength( -e-3)}expectLengthUint32Incl(r){let e=this.readUint32();return this.expectLength( -e-4)}writeBytes(r){return this.data.set(r,this.offset),this.offset+=r.length,this}writeUTF8String(r){ -let e=li.encode(r);return this.writeBytes(e),this}writeUTF8StringNullTerminated(r){ -let e=li.encode(r);return this.writeBytes(e),this.writeUint8(0),this}writeUint8(r,e){ -return this.dataView.setUint8(this.offset,r),this.offset+=1,this}writeUint16(r,e){ -return this.dataView.setUint16(this.offset,r),this.offset+=2,this}writeUint24(r,e){ -return this.writeUint8((r&16711680)>>16),this.writeUint16(r&65535,e),this}writeUint32(r,e){ -return this.dataView.setUint32(this.offset,r),this.offset+=4,this}_writeLengthGeneric(r,e,t){ -let n=this.offset;this.offset+=r;let i=this.offset;return this.indent+=1,this.indents[i]= -this.indent,()=>{let s=this.offset-(e?n:i);if(r===1)this.dataView.setUint8(n,s);else if(r=== +i.length;return t}o(oe,"U");function kt(r,e){let t=r.length;if(t!==e.length)return!1; +for(let n=0;nthis.data.length){let t=this. +data;this.data=new Uint8Array(this.length*2+e),this.data.set(t)}this.data.set(r, +this.length),this.length+=r.length}getData(){return this.data.subarray(0,this.length)}}, +Ar="\xB7\xB7 ",fi=new TextEncoder,No=new TextDecoder,Ae=class{static{o(this,"D")}constructor(r){ +j(this,"offset"),j(this,"dataView"),j(this,"data"),j(this,"comments"),j(this,"in\ +dents"),j(this,"indent"),this.offset=0,this.data=typeof r=="number"?new Uint8Array( +r):r,this.dataView=new DataView(this.data.buffer,this.data.byteOffset,this.data. +byteLength),this.comments={},this.indents={},this.indent=0}extend(r){let e=typeof r== +"number"?new Uint8Array(r):r;this.data=oe(this.data,e),this.dataView=new DataView( +this.data.buffer,this.data.byteOffset,this.data.byteLength)}remaining(){return this. +data.length-this.offset}subarray(r){return this.data.subarray(this.offset,this.offset+= +r)}skip(r,e){return this.offset+=r,e&&this.comment(e),this}comment(r,e=this.offset){ +throw new Error("No comments should be emitted outside of chatty mode")}lengthComment(r,e,t=!1){ +return r===1?`${r} byte${e?` of ${e}`:""} ${t?"starts here":"follows"}`:`${r===0? +"no":r} bytes${e?` of ${e}`:""} ${t?"start here":"follow"}`}readBytes(r){return this. +data.slice(this.offset,this.offset+=r)}readUTF8String(r){let e=this.subarray(r); +return No.decode(e)}readUTF8StringNullTerminated(){let r=this.offset;for(;this.data[r]!== +0;)r++;let e=this.readUTF8String(r-this.offset);return this.expectUint8(0,"end o\ +f string"),e}readUint8(r){let e=this.dataView.getUint8(this.offset);return this. +offset+=1,e}readUint16(r){let e=this.dataView.getUint16(this.offset);return this. +offset+=2,e}readUint24(r){let e=this.readUint8(),t=this.readUint16();return(e<<16)+ +t}readUint32(r){let e=this.dataView.getUint32(this.offset);return this.offset+=4, +e}expectBytes(r,e){let t=this.readBytes(r.length);if(!kt(t,r))throw new Error("U\ +nexpected bytes")}expectUint8(r,e){let t=this.readUint8();if(t!==r)throw new Error( +`Expected ${r}, got ${t}`)}expectUint16(r,e){let t=this.readUint16();if(t!==r)throw new Error( +`Expected ${r}, got ${t}`)}expectUint24(r,e){let t=this.readUint24();if(t!==r)throw new Error( +`Expected ${r}, got ${t}`)}expectUint32(r,e){let t=this.readUint32();if(t!==r)throw new Error( +`Expected ${r}, got ${t}`)}expectLength(r,e=1){let t=this.offset,n=t+r;if(n>this. +data.length)throw new Error("Expected length exceeds remaining data length");return this. +indent+=e,this.indents[t]=this.indent,[()=>{if(this.indent-=e,this.indents[this. +offset]=this.indent,this.offset!==n)throw new Error(`${r} bytes expected but ${this. +offset-t} read`)},()=>n-this.offset]}expectLengthUint8(r){let e=this.readUint8(); +return this.expectLength(e)}expectLengthUint16(r){let e=this.readUint16();return this. +expectLength(e)}expectLengthUint24(r){let e=this.readUint24();return this.expectLength( +e)}expectLengthUint32(r){let e=this.readUint32();return this.expectLength(e)}expectLengthUint8Incl(r){ +let e=this.readUint8();return this.expectLength(e-1)}expectLengthUint16Incl(r){let e=this. +readUint16();return this.expectLength(e-2)}expectLengthUint24Incl(r){let e=this. +readUint24();return this.expectLength(e-3)}expectLengthUint32Incl(r){let e=this. +readUint32();return this.expectLength(e-4)}writeBytes(r){return this.data.set(r, +this.offset),this.offset+=r.length,this}writeUTF8String(r){let e=fi.encode(r);return this. +writeBytes(e),this}writeUTF8StringNullTerminated(r){let e=fi.encode(r);return this. +writeBytes(e),this.writeUint8(0),this}writeUint8(r,e){return this.dataView.setUint8( +this.offset,r),this.offset+=1,this}writeUint16(r,e){return this.dataView.setUint16( +this.offset,r),this.offset+=2,this}writeUint24(r,e){return this.writeUint8((r&16711680)>> +16),this.writeUint16(r&65535,e),this}writeUint32(r,e){return this.dataView.setUint32( +this.offset,r),this.offset+=4,this}_writeLengthGeneric(r,e,t){let n=this.offset; +this.offset+=r;let i=this.offset;return this.indent+=1,this.indents[i]=this.indent, +()=>{let s=this.offset-(e?n:i);if(r===1)this.dataView.setUint8(n,s);else if(r=== 2)this.dataView.setUint16(n,s);else if(r===3)this.dataView.setUint8(n,(s&16711680)>> 16),this.dataView.setUint16(n+1,s&65535);else if(r===4)this.dataView.setUint32(n, s);else throw new Error(`Invalid length for length field: ${r}`);this.indent-=1, @@ -1559,126 +1572,136 @@ return this._writeLengthGeneric(3,!1,r)}writeLengthUint32(r){return this._writeL return this._writeLengthGeneric(2,!0,r)}writeLengthUint24Incl(r){return this._writeLengthGeneric( 3,!0,r)}writeLengthUint32Incl(r){return this._writeLengthGeneric(4,!0,r)}array(){ return this.data.subarray(0,this.offset)}commentedString(r=!1){let e=this.indents[0]!== -void 0?br.repeat(this.indents[0]):"",t=this.indents[0]??0,n=r?this.data.length:this. +void 0?Ar.repeat(this.indents[0]):"",t=this.indents[0]??0,n=r?this.data.length:this. offset;for(let i=0;it. -toString(16).padStart(2,"0")).join(e)}o(Te,"K");function Bo(r,e){let t,n,[i]=r.expectLength( -r.remaining());r.expectUint8(2,0);let[s]=r.expectLengthUint24(0);r.expectUint16( -771,0);let a=r.readBytes(32);if(ut(a,[207,33,173,116,229,154,97,17,190,29,140,2, -30,101,184,145,194,162,17,22,122,187,140,94,7,158,9,226,200,168,51,156]))throw new Error( -"Unexpected HelloRetryRequest");r.expectUint8(e.length,0),r.expectBytes(e,0),r.expectUint16( -4865,0),r.expectUint8(0,0);let[u,c]=r.expectLengthUint16(0);for(;c()>0;){let l=r. -readUint16(0),[h]=r.expectLengthUint16(0);if(l===43)r.expectUint16(772,0),n=!0;else if(l=== -51)r.expectUint16(23,0),r.expectUint16(65),t=r.readBytes(65);else throw new Error( -`Unexpected extension 0x${Te([l])}`);h()}if(u(),s(),i(),n!==!0)throw new Error("\ -No TLS version provided");if(t===void 0)throw new Error("No key provided");return t} -o(Bo,"Ut");var jh=new RegExp(` .+|^(${br})+`,"gm"),ot=16384,Ro=ot+1+255;async function xr(r,e,t=ot){ -let n=await r(5);if(n===void 0)return;if(n.length<5)throw new Error("TLS record \ -header truncated");let i=new be(n),s=i.readUint8();if(s<20||s>24)throw new Error( -`Illegal TLS record type 0x${s.toString(16)}`);if(e!==void 0&&s!==e)throw new Error( -`Unexpected TLS record type 0x${s.toString(16).padStart(2,"0")} (expected 0x${e. -toString(16).padStart(2,"0")})`);i.expectUint16(771,"TLS record version 1.2 (mid\ -dlebox compatibility)");let a=i.readUint16(0);if(a>t)throw new Error(`Record too\ - long: ${a} bytes`);let u=await r(a);if(u===void 0||u.length>3,s=Math.ceil(t/i),a=new Uint8Array(s*i),u=await O.importKey("raw",r,{name:"\ +${Ar.repeat(t)}`)}return e}};function Mo(r,e,t,n=!0){let i=new Ae(1024);i.writeUint8( +22,0),i.writeUint16(769,0);let s=i.writeLengthUint16("TLS record");i.writeUint8( +1,0);let a=i.writeLengthUint24();i.writeUint16(771,0),A.getRandomValues(i.subarray( +32));let u=i.writeLengthUint8(0);i.writeBytes(t),u();let c=i.writeLengthUint16(0); +i.writeUint16(4865,0),c();let l=i.writeLengthUint8(0);i.writeUint8(0,0),l();let h=i. +writeLengthUint16(0);if(n){i.writeUint16(0,0);let B=i.writeLengthUint16(0),F=i.writeLengthUint16( +0);i.writeUint8(0,0);let H=i.writeLengthUint16(0);i.writeUTF8String(r),H(),F(),B()} +i.writeUint16(11,0);let f=i.writeLengthUint16(0),p=i.writeLengthUint8(0);i.writeUint8( +0,0),p(),f(),i.writeUint16(10,0);let m=i.writeLengthUint16(0),x=i.writeLengthUint16( +0);i.writeUint16(23,0),x(),m(),i.writeUint16(13,0);let L=i.writeLengthUint16(0), +v=i.writeLengthUint16(0);i.writeUint16(1027,0),i.writeUint16(2052,0),v(),L(),i.writeUint16( +43,0);let C=i.writeLengthUint16(0),b=i.writeLengthUint8(0);i.writeUint16(772,0), +b(),C(),i.writeUint16(51,0);let g=i.writeLengthUint16(0),E=i.writeLengthUint16(0); +i.writeUint16(23,0);let M=i.writeLengthUint16(0);return i.writeBytes(e),M(),E(), +g(),h(),a(),s(),i}o(Mo,"bt");function Ie(r){return new Uint8Array(Array.from(r.matchAll( +/[0-9a-f]/g)).map(e=>parseInt(e[0],16)))}o(Ie,"z");function X(r,e=""){return[...r]. +map(t=>t.toString(16).padStart(2,"0")).join(e)}o(X,"f");function Do(r,e){let t,n, +[i]=r.expectLength(r.remaining());r.expectUint8(2,0);let[s]=r.expectLengthUint24( +0);r.expectUint16(771,0);let a=r.readBytes(32);if(kt(a,[207,33,173,116,229,154,97, +17,190,29,140,2,30,101,184,145,194,162,17,22,122,187,140,94,7,158,9,226,200,168, +51,156]))throw new Error("Unexpected HelloRetryRequest");r.expectUint8(e.length, +0),r.expectBytes(e,0),r.expectUint16(4865,0),r.expectUint8(0,0);let[u,c]=r.expectLengthUint16( +0);for(;c()>0;){let l=r.readUint16(0),[h]=r.expectLengthUint16(0);if(l===43)r.expectUint16( +772,0),n=!0;else if(l===51){r.expectUint16(23,0);let[f,p]=r.expectLengthUint16("\ +key share"),m=p();if(m!==65)throw new Error(`Expected 65 bytes of key share, but\ + got ${m}`);t=r.readBytes(m),f()}else throw new Error(`Unexpected extension 0x${X( +[l])}`);h()}if(u(),s(),i(),n!==!0)throw new Error("No TLS version provided");if(t=== +void 0)throw new Error("No key provided");return t}o(Do,"At");var Yh=new RegExp( +` .+|^(${Ar})+`,"gm"),ct=16384,Fo=ct+1+255;async function vr(r,e,t=ct){let n=await r( +5);if(n===void 0)return;if(n.length<5)throw new Error("TLS record header truncat\ +ed");let i=new Ae(n),s=i.readUint8();if(s<20||s>24)throw new Error(`Illegal TLS \ +record type 0x${s.toString(16)}`);if(e!==void 0&&s!==e)throw new Error(`Unexpect\ +ed TLS record type 0x${s.toString(16).padStart(2,"0")} (expected 0x${e.toString( +16).padStart(2,"0")})`);i.expectUint16(771,"TLS record version 1.2 (middlebox co\ +mpatibility)");let a=i.readUint16();if(a>t)throw new Error(`Record too long: ${a}\ + bytes`);let u=await r(a);if(u===void 0||u.length>3,s=Math.ceil(t/i),a=new Uint8Array(s*i),u=await q.importKey("raw",r,{name:"\ HMAC",hash:{name:`SHA-${n}`}},!1,["sign"]),c=new Uint8Array(0);for(let l=0;l>8,n&255],[fi.length+s.length],fi,s,[t.length], -t);return Mo(r,a,n,i)}o(ae,"S");async function Do(r,e,t,n,i){let s=n>>>3,a=new Uint8Array( -s),u=await O.importKey("raw",r,{name:"ECDH",namedCurve:"P-256"},!1,[]),c=await O. -deriveBits({name:"ECDH",public:u},e,256),l=new Uint8Array(c),h=await O.digest("S\ -HA-256",t),f=new Uint8Array(h),y=await vr(new Uint8Array(1),a,n),m=await O.digest( -`SHA-${n}`,new Uint8Array(0)),b=new Uint8Array(m),U=await ae(y,"derived",b,s,n), -v=await vr(U,l,n),C=await ae(v,"c hs traffic",f,s,n),E=await ae(v,"s hs traffic", -f,s,n),g=await ae(C,"key",new Uint8Array(0),i,n),x=await ae(E,"key",new Uint8Array( -0),i,n),N=await ae(C,"iv",new Uint8Array(0),12,n),P=await ae(E,"iv",new Uint8Array( -0),12,n);return{serverHandshakeKey:x,serverHandshakeIV:P,clientHandshakeKey:g,clientHandshakeIV:N, -handshakeSecret:v,clientSecret:C,serverSecret:E}}o(Do,"Kt");async function qo(r,e,t,n){ -let i=t>>>3,s=new Uint8Array(i),a=await O.digest(`SHA-${t}`,new Uint8Array(0)),u=new Uint8Array( -a),c=await ae(r,"derived",u,i,t),l=await vr(c,s,t),h=await ae(l,"c ap traffic",e, -i,t),f=await ae(l,"s ap traffic",e,i,t),y=await ae(h,"key",new Uint8Array(0),n,t), -m=await ae(f,"key",new Uint8Array(0),n,t),b=await ae(h,"iv",new Uint8Array(0),12, -t),U=await ae(f,"iv",new Uint8Array(0),12,t);return{serverApplicationKey:m,serverApplicationIV:U, -clientApplicationKey:y,clientApplicationIV:b}}o(qo,"Tt");var Nt=class{static{o(this, -"Z")}constructor(r,e,t){this.mode=r,this.key=e,this.initialIv=t}recordsProcessed=0n;priorPromise=Promise. -resolve(new Uint8Array);async process(r,e,t){let n=this.processUnsequenced(r,e,t); -return this.priorPromise=this.priorPromise.then(()=>n)}async processUnsequenced(r,e,t){ +let h=oe(c,e,[l+1]),f=await q.sign("HMAC",u,h),p=new Uint8Array(f);a.set(p,i*l), +c=p}return a.subarray(0,t)}o(ko,"oe");var pi=gi.encode("tls13 ");async function ue(r,e,t,n,i){ +let s=gi.encode(e),a=oe([(n&65280)>>8,n&255],[pi.length+s.length],pi,s,[t.length], +t);return ko(r,a,n,i)}o(ue,"I");async function Oo(r,e,t,n,i){let s=n>>>3,a=new Uint8Array( +s),u=await q.importKey("raw",r,{name:"ECDH",namedCurve:"P-256"},!1,[]),c=await q. +deriveBits({name:"ECDH",public:u},e,256),l=new Uint8Array(c),h=await q.digest("S\ +HA-256",t),f=new Uint8Array(h),p=await _r(new Uint8Array(1),a,n),m=await q.digest( +`SHA-${n}`,new Uint8Array(0)),x=new Uint8Array(m),L=await ue(p,"derived",x,s,n), +v=await _r(L,l,n),C=await ue(v,"c hs traffic",f,s,n),b=await ue(v,"s hs traffic", +f,s,n),g=await ue(C,"key",new Uint8Array(0),i,n),E=await ue(b,"key",new Uint8Array( +0),i,n),M=await ue(C,"iv",new Uint8Array(0),12,n),B=await ue(b,"iv",new Uint8Array( +0),12,n);return{serverHandshakeKey:E,serverHandshakeIV:B,clientHandshakeKey:g,clientHandshakeIV:M, +handshakeSecret:v,clientSecret:C,serverSecret:b}}o(Oo,"Pt");async function Qo(r,e,t,n){ +let i=t>>>3,s=new Uint8Array(i),a=await q.digest(`SHA-${t}`,new Uint8Array(0)),u=new Uint8Array( +a),c=await ue(r,"derived",u,i,t),l=await _r(c,s,t),h=await ue(l,"c ap traffic",e, +i,t),f=await ue(l,"s ap traffic",e,i,t),p=await ue(h,"key",new Uint8Array(0),n,t), +m=await ue(f,"key",new Uint8Array(0),n,t),x=await ue(h,"iv",new Uint8Array(0),12, +t),L=await ue(f,"iv",new Uint8Array(0),12,t);return{serverApplicationKey:m,serverApplicationIV:L, +clientApplicationKey:p,clientApplicationIV:x}}o(Qo,"Ot");var Ft=class{static{o(this, +"tt")}constructor(r,e,t){this.mode=r,this.key=e,this.initialIv=t,j(this,"records\ +Processed",0n),j(this,"priorPromise",Promise.resolve(new Uint8Array))}async process(r,e,t){ +return this.sequence(this.processUnsequenced(r,e,t))}async sequence(r){let e=this. +priorPromise.then(()=>r);return this.priorPromise=e,e}async processUnsequenced(r,e,t){ let n=this.recordsProcessed;this.recordsProcessed+=1n;let i=this.initialIv.slice(), s=BigInt(i.length),a=s-1n;for(let h=0n;h>(h<<3n);if(f===0n)break; i[Number(a-h)]^=Number(f&0xffn)}let u=e<<3,c={name:"AES-GCM",iv:i,tagLength:u,additionalData:t}, -l=await O[this.mode](c,this.key,r);return new Uint8Array(l)}};function Mt(r){return r> -64&&r<91?r-65:r>96&&r<123?r-71:r>47&&r<58?r+4:r===43?62:r===47?63:r===61?64:void 0} -o(Mt,"yt");function Fo(r){let e=r.length,t=0,n=0,i=64,s=64,a=64,u=64,c=new Uint8Array( -e*.75);for(;t>4,c[n++]=(s&15)<<4|a>>2,c[n++]=(a&3)<< -6|u;let l=s===64?0:a===64?2:u===64?1:0;return c.subarray(0,n-l)}o(Fo,"Dt");var Dt=class extends be{static{ -o(this,"M")}readASN1Length(r){let e=this.readUint8();if(e<128)return e;let t=e&127, -n=0;if(t===1)return this.readUint8(n);if(t===2)return this.readUint16(n);if(t=== -3)return this.readUint24(n);if(t===4)return this.readUint32(n);throw new Error(`\ -ASN.1 length fields are only supported up to 4 bytes (this one is ${t} bytes)`)}expectASN1Length(r){ -let e=this.readASN1Length(r);return this.expectLength(e)}readASN1OID(){let[r,e]=this. -expectASN1Length(0),t=this.readUint8(),n=`${Math.floor(t/40)}.${t%40}`;for(;e()> -0;){let i=0;for(;;){let s=this.readUint8();if(i<<=7,i+=s&127,s<128)break}n+=`.${i}`} -return r(),n}readASN1Boolean(){let[r,e]=this.expectASN1Length(0),t=e();if(t!==1) -throw new Error(`Boolean has weird length: ${t}`);let n=this.readUint8(),i;if(n=== -255)i=!0;else if(n===0)i=!1;else throw new Error(`Boolean has weird value: 0x${Te( -[n])}`);return r(),i}readASN1UTCTime(){let[r,e]=this.expectASN1Length(0),t=this. -readUTF8String(e()).match(/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z$/);if(!t)throw new Error( -"Unrecognised ASN.1 UTC time format");let[,n,i,s,a,u,c]=t,l=parseInt(n,10),h=l+(l>= -50?1900:2e3),f=new Date(`${h}-${i}-${s}T${a}:${u}:${c}Z`);return r(),f}readASN1BitString(){ +l=await q[this.mode](c,this.key,r);return new Uint8Array(l)}};function $o(r){throw new Error( +`Invalid base 64 character: ${String.fromCharCode(r)}`)}o($o,"he");function jo(r){ +return r>64&&r<91?r-65:r>96&&r<123?r-71:r>47&&r<58?r+4:r===43?62:r===47?63:r===61? +64:$o(r)}o(jo,"de");function Si(r,e=jo,t=!0){let n=r.length;t&&(r+="=".repeat(n% +4));let i=0,s=0,a=64,u=64,c=64,l=64,h=new Uint8Array(n*.75);for(;i>4,h[s++]=(u&15)<<4|c>>2,h[s++]=(c&3)<<6|l;let f=u===64?0:c===64?2:l===64? +1:0;return h.subarray(0,s-f)}o(Si,"vt");var lt=class extends Ae{static{o(this,"M")}readASN1Length(r){ +let e=this.readUint8();if(e<128)return e;let t=e&127,n=0;if(t===1)return this.readUint8( +n);if(t===2)return this.readUint16(n);if(t===3)return this.readUint24(n);if(t=== +4)return this.readUint32(n);throw new Error(`ASN.1 length fields are only suppor\ +ted up to 4 bytes (this one is ${t} bytes)`)}expectASN1Length(r){let e=this.readASN1Length( +r);return this.expectLength(e)}readASN1OID(r){let[e,t]=this.expectASN1Length(0), +n=this.readUint8(),i=`${Math.floor(n/40)}.${n%40}`;for(;t()>0;){let s=0;for(;;){ +let a=this.readUint8();if(s<<=7,s+=a&127,a<128)break}i+=`.${s}`}return e(),i}readASN1Boolean(r){ +let[e,t]=this.expectASN1Length(0),n=t();if(n!==1)throw new Error(`Boolean has we\ +ird length: ${n}`);let i=this.readUint8(),s;if(i===255)s=!0;else if(i===0)s=!1;else +throw new Error(`Boolean has weird value: 0x${X([i])}`);return e(),s}readASN1UTCTime(){ +let[r,e]=this.expectASN1Length(0),t=this.readUTF8String(e()).match(/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z$/); +if(!t)throw new Error("Unrecognised ASN.1 UTC time format");let[,n,i,s,a,u,c]=t, +l=parseInt(n,10),h=l+(l>=50?1900:2e3),f=new Date(`${h}-${i}-${s}T${a}:${u}:${c}Z`); +return r(),f}readASN1GeneralizedTime(){let[r,e]=this.expectASN1Length(0),t=this. +readUTF8String(e()).match(/^([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?([0-9]{2})?([.][0-9]+)?(Z)?([-+][0-9]+)?$/); +if(!t)throw new Error("Unrecognised ASN.1 generalized time format");let[,n,i,s,a, +u,c,l,h,f]=t;if(c===void 0&&l!==void 0)throw new Error("Invalid ASN.1 generalize\ +d time format (fraction without seconds)");if(h!==void 0&&f!==void 0)throw new Error( +"Invalid ASN.1 generalized time format (Z and timezone)");let p=new Date(`${n}-${i}\ +-${s}T${a}:${u??"00"}:${c??"00"}${l??""}${f??"Z"}`);return r(),p}readASN1BitString(){ let[r,e]=this.expectASN1Length(0),t=this.readUint8(0),n=e(),i=this.readBytes(n); if(t>7)throw new Error(`Invalid right pad value: ${t}`);if(t>0){let s=8-t;for(let a=n- -1;a>0;a--)i[a]=255&i[a-1]<>>t;i[0]=i[0]>>>t}return r(),i}};function di(r,e=(n,i)=>i,t){ -return JSON.stringify(r,(n,i)=>e(n,typeof i!="object"||i===null||Array.isArray(i)? -i:Object.fromEntries(Object.entries(i).sort(([s],[a])=>sa?1:0))),t)}o(di, -"mt");var gr=1,qt=2,ie=48,Oo=49,Ke=6,ko=19,Qo=12,pi=23,Sr=5,De=4,Er=3,$o=163,He=128, -jo={"2.5.4.6":"C","2.5.4.10":"O","2.5.4.11":"OU","2.5.4.3":"CN","2.5.4.7":"L","2\ -.5.4.8":"ST","2.5.4.12":"T","2.5.4.42":"GN","2.5.4.43":"I","2.5.4.4":"SN","1.2.8\ -40.113549.1.9.1":"E-mail"};function Ho(r){let{length:e}=r;if(e>4)throw new Error( -`Bit string length ${e} would overflow JS bit operators`);let t=0,n=0;for(let i=r. -length-1;i>=0;i--)t|=r[i]<0;){r.expectUint8(Oo, -0);let[s]=r.expectASN1Length(0);r.expectUint8(ie,0);let[a]=r.expectASN1Length(0); -r.expectUint8(Ke,0);let u=r.readASN1OID(),c=jo[u]??u,l=r.readUint8();if(l!==ko&& -l!==Qo)throw new Error(`Unexpected item type in certificate ${e}: 0x${Te([l])}`); -let[h,f]=r.expectASN1Length(0),y=r.readUTF8String(f());if(h(),a(),s(),t[c]!==void 0) -throw new Error(`Duplicate OID ${c} in certificate ${e}`);t[c]=y}return n(),t}o( -yi,"Ct");function Ko(r,e=0){let t=[],[n,i]=r.expectASN1Length(0);for(;i()>0;){let s=r. -readUint8(0),[a,u]=r.expectASN1Length(0),c;s===(e|2)?c=r.readUTF8String(u()):c=r. -readBytes(u()),t.push({name:c,type:s}),a()}return n(),t}o(Ko,"Bt");function Wo(r){ +1;a>0;a--)i[a]=255&i[a-1]<>>t;i[0]=i[0]>>>t}return r(),i}},br=1,qt=2,ae=48, +Ho=49,Ge=6,Ko=19,Wo=20,Go=12,Vo=22,yi=23,mi=24,Er=5,Le=4,xr=3,zo=163,We=128,Jo={ +"2.5.4.6":"C","2.5.4.10":"O","2.5.4.11":"OU","2.5.4.3":"CN","2.5.4.7":"L","2.5.4\ +.8":"ST","2.5.4.12":"T","2.5.4.42":"GN","2.5.4.43":"I","2.5.4.4":"SN","1.2.840.1\ +13549.1.9.1":"MAIL","2.5.4.5":"SERIALNUMBER"};function Yo(r){let{length:e}=r;if(e> +4)throw new Error(`Bit string length ${e} would overflow JS bit operators`);let t=0, +n=0;for(let i=r.length-1;i>=0;i--)t|=r[i]<0;){r.expectUint8( +Ho,0);let[s]=r.expectASN1Length(0);r.expectUint8(ae,0);let[a]=r.expectASN1Length( +0);r.expectUint8(Ge,0);let u=r.readASN1OID(),c=Jo[u]??u,l=r.readUint8();if(l!==Ko&& +l!==Go&&l!==Vo&&l!==Wo)throw new Error(`Unexpected item type in certificate ${e}\ +: 0x${X([l])}`);let[h,f]=r.expectASN1Length(0),p=r.readUTF8String(f());h(),a(),s(); +let m=t[c];m===void 0?t[c]=p:typeof m=="string"?t[c]=[m,p]:m.push(p)}return n(), +t}o(wi,"It");function Zo(r,e=0){let t=[],[n,i]=r.expectASN1Length(0);for(;i()>0;){ +let s=r.readUint8(0),[a,u]=r.expectASN1Length(0),c;s===(e|2)?c=r.readUTF8String( +u()):c=r.readBytes(u()),t.push({name:c,type:s}),a()}return n(),t}o(Zo,"jt");function Xo(r){ let e={"1.2.840.113549.1.1.1":{name:"RSAES-PKCS1-v1_5"},"1.2.840.113549.1.1.5":{ name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}},"1.2.840.113549.1.1.11":{name:"RSA\ SSA-PKCS1-v1_5",hash:{name:"SHA-256"}},"1.2.840.113549.1.1.12":{name:"RSASSA-PKC\ @@ -1705,70 +1728,88 @@ hash:{name:"SHA-256"}},"1.2.840.113549.2.10":{name:"HMAC",hash:{name:"SHA-384"}} SHA-256"},"2.16.840.1.101.3.4.2.2":{name:"SHA-384"},"2.16.840.1.101.3.4.2.3":{name:"\ SHA-512"},"1.2.840.113549.1.5.12":{name:"PBKDF2"},"1.2.840.10045.3.1.7":{name:"P\ -256"},"1.3.132.0.34":{name:"P-384"},"1.3.132.0.35":{name:"P-521"}}[r];if(e===void 0) -throw new Error(`Unsupported algorithm identifier: ${r}`);return e}o(Wo,"Ft");function mi(r,e=[]){ -return Object.values(r).forEach(t=>{typeof t=="string"?e=[...e,t]:e=mi(t,e)}),e} -o(mi,"Ot");function Go(r){return mi(r).join(" / ")}o(Go,"Pt");var Vo=["digitalSi\ +throw new Error(`Unsupported algorithm identifier: ${r}`);return e}o(Xo,"Mt");function bi(r,e=[]){ +return Object.values(r).forEach(t=>{typeof t=="string"?e=[...e,t]:e=bi(t,e)}),e} +o(bi,"Vt");function eu(r){return bi(r).join(" / ")}o(eu,"_t");var tu=["digitalSi\ gnature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","k\ -eyCertSign","cRLSign","encipherOnly","decipherOnly"],_r=class Cr{static{o(this,"\ -r")}serialNumber;algorithm;issuer;validityPeriod;subject;publicKey;signature;keyUsage;subjectAltNames;extKeyUsage;authorityKeyIdentifier;subjectKeyIdentifier;basicConstraints;signedData;static distinguishedNamesAreEqual(e,t){ -return di(e)===di(t)}static readableDN(e){return Object.entries(e).map(t=>t.join( -"=")).join(", ")}constructor(e){let t=e instanceof Dt?e:new Dt(e);t.expectUint8( -ie,0);let[n]=t.expectASN1Length(0),i=t.offset;t.expectUint8(ie,0);let[s]=t.expectASN1Length( -0);t.expectBytes([160,3,2,1,2],0),t.expectUint8(qt,0);let[a,u]=t.expectASN1Length( -0);this.serialNumber=t.subarray(u()),a(),t.expectUint8(ie,0);let[c,l]=t.expectASN1Length( -0);t.expectUint8(Ke,0),this.algorithm=t.readASN1OID(),l()>0&&(t.expectUint8(Sr,0), -t.expectUint8(0,0)),c(),this.issuer=yi(t,"issuer"),t.expectUint8(ie,0);let[h]=t. -expectASN1Length(0);t.expectUint8(pi,0);let f=t.readASN1UTCTime();t.expectUint8( -pi,0);let y=t.readASN1UTCTime();this.validityPeriod={notBefore:f,notAfter:y},h(), -this.subject=yi(t,"subject");let m=t.offset;t.expectUint8(ie,0);let[b]=t.expectASN1Length( -0);t.expectUint8(ie,0);let[U,v]=t.expectASN1Length(0),C=[];for(;v()>0;){let Z=t. -readUint8();if(Z===Ke){let M=t.readASN1OID();C.push(M)}else Z===Sr&&t.expectUint8( -0,0)}U(),t.expectUint8(Er,0);let E=t.readASN1BitString();this.publicKey={identifiers:C, -data:E,all:t.data.subarray(m,t.offset)},b(),t.expectUint8($o,0);let[g]=t.expectASN1Length(); -t.expectUint8(ie,0);let[x,N]=t.expectASN1Length(0);for(;N()>0;){t.expectUint8(ie, -0);let[Z,M]=t.expectASN1Length();t.expectUint8(Ke,0);let $=t.readASN1OID();if($=== -"2.5.29.17"){t.expectUint8(De,0);let[j]=t.expectASN1Length(0);t.expectUint8(ie,0); -let H=Ko(t,He);this.subjectAltNames=H.filter(K=>K.type===(2|He)).map(K=>K.name), -j()}else if($==="2.5.29.15"){t.expectUint8(gr,0);let j=t.readASN1Boolean();t.expectUint8( -De,0);let[H]=t.expectASN1Length(0);t.expectUint8(Er,0);let K=t.readASN1BitString(), -J=Ho(K),F=new Set(Vo.filter((Y,W)=>J&1<0;){t.expectUint8(Ke, -0);let J=t.readASN1OID();J==="1.3.6.1.5.5.7.3.1"&&(this.extKeyUsage.serverTls=!0), -J==="1.3.6.1.5.5.7.3.2"&&(this.extKeyUsage.clientTls=!0)}H(),j()}else if($==="2.\ -5.29.35"){t.expectUint8(De,0);let[j]=t.expectASN1Length(0);t.expectUint8(ie,0);let[ -H,K]=t.expectASN1Length(0);for(;K()>0;){let J=t.readUint8();if(J===(He|0)){let[F, -Y]=t.expectASN1Length(0);this.authorityKeyIdentifier=t.readBytes(Y()),F()}else if(J=== -(He|1)){let[F,Y]=t.expectASN1Length(0);t.skip(Y(),0),F()}else if(J===(He|2)){let[ -F,Y]=t.expectASN1Length(0);t.skip(Y(),0),F()}else if(J===(He|33)){let[F,Y]=t.expectASN1Length( -0);t.skip(Y(),0),F()}else throw new Error(`Unexpected data type ${J} in authorit\ -yKeyIdentifier certificate extension`)}H(),j()}else if($==="2.5.29.14"){t.expectUint8( -De,0);let[j]=t.expectASN1Length(0);t.expectUint8(De,0);let[H,K]=t.expectASN1Length( -0);this.subjectKeyIdentifier=t.readBytes(K()),H(),j()}else if($==="2.5.29.19"){let j, -H=t.readUint8();if(H===gr&&(j=t.readASN1Boolean(),H=t.readUint8()),H!==De)throw new Error( -"Unexpected type in certificate basic constraints");let[K]=t.expectASN1Length(0); -t.expectUint8(ie,0);let[J,F]=t.expectASN1Length(),Y;F()>0&&(t.expectUint8(gr,0), -Y=t.readASN1Boolean());let W;if(F()>0){t.expectUint8(qt,0);let R=t.readASN1Length( -0);if(W=R===1?t.readUint8():R===2?t.readUint16():R===3?t.readUint24():void 0,W=== +eyCertSign","cRLSign","encipherOnly","decipherOnly"],Tr=class Ur{static{o(this,"\ +r")}constructor(e){if(j(this,"serialNumber"),j(this,"algorithm"),j(this,"issuer"), +j(this,"validityPeriod"),j(this,"subject"),j(this,"publicKey"),j(this,"signature"), +j(this,"keyUsage"),j(this,"subjectAltNames"),j(this,"extKeyUsage"),j(this,"autho\ +rityKeyIdentifier"),j(this,"subjectKeyIdentifier"),j(this,"basicConstraints"),j( +this,"signedData"),e instanceof lt||e instanceof Uint8Array){let t=e instanceof lt? +e:new lt(e);t.expectUint8(ae,0);let[n]=t.expectASN1Length(0),i=t.offset;t.expectUint8( +ae,0);let[s]=t.expectASN1Length(0);t.expectBytes([160,3,2,1,2],0),t.expectUint8( +qt,0);let[a,u]=t.expectASN1Length(0);this.serialNumber=t.subarray(u()),a(),t.expectUint8( +ae,0);let[c,l]=t.expectASN1Length(0);t.expectUint8(Ge,0),this.algorithm=t.readASN1OID(), +l()>0&&(t.expectUint8(Er,0),t.expectUint8(0,0)),c(),this.issuer=wi(t,"issuer");let h, +f;t.expectUint8(ae,0);let[p]=t.expectASN1Length(0),m=t.readUint8();if(m===yi)h=t. +readASN1UTCTime();else if(m===mi)h=t.readASN1GeneralizedTime();else throw new Error( +`Unexpected validity start type 0x${X([m])}`);let x=t.readUint8();if(x===yi)f=t. +readASN1UTCTime();else if(x===mi)f=t.readASN1GeneralizedTime();else throw new Error( +`Unexpected validity end type 0x${X([x])}`);this.validityPeriod={notBefore:h,notAfter:f}, +p(),this.subject=wi(t,"subject");let L=t.offset;t.expectUint8(ae,0);let[v]=t.expectASN1Length( +0);t.expectUint8(ae,0);let[C,b]=t.expectASN1Length(0),g=[];for(;b()>0;){let G=t. +readUint8();if(G===Ge){let ie=t.readASN1OID();g.push(ie)}else G===Er&&t.expectUint8( +0,0)}C(),t.expectUint8(xr,0);let E=t.readASN1BitString();this.publicKey={identifiers:g, +data:E,all:t.data.subarray(L,t.offset)},v(),t.expectUint8(zo,0);let[M]=t.expectASN1Length(); +t.expectUint8(ae,0);let[B,F]=t.expectASN1Length(0);for(;F()>0;){t.expectUint8(ae, +0);let[G,ie]=t.expectASN1Length();t.expectUint8(Ge,0);let ee=t.readASN1OID();if(ee=== +"2.5.29.17"){t.expectUint8(Le,0);let[K]=t.expectASN1Length(0);t.expectUint8(ae,0); +let $=Zo(t,We);this.subjectAltNames=$.filter(Q=>Q.type===(2|We)).map(Q=>Q.name), +K()}else if(ee==="2.5.29.15"){let K,$=t.readUint8();if($===br&&(K=t.readASN1Boolean( +0),$=t.readUint8()),$!==Le)throw new Error(`Expected 0x${X([Le])}, got 0x${X([$])}`); +let[Q]=t.expectASN1Length(0);t.expectUint8(xr,0);let W=t.readASN1BitString(),k=Yo( +W),P=new Set(tu.filter((N,V)=>k&1<0;){t.expectUint8(Ge, +0);let W=t.readASN1OID();W==="1.3.6.1.5.5.7.3.1"&&(this.extKeyUsage.serverTls=!0), +W==="1.3.6.1.5.5.7.3.2"&&(this.extKeyUsage.clientTls=!0)}$(),K()}else if(ee==="2\ +.5.29.35"){t.expectUint8(Le,0);let[K]=t.expectASN1Length(0);t.expectUint8(ae,0); +let[$,Q]=t.expectASN1Length(0);for(;Q()>0;){let W=t.readUint8();if(W===(We|0)){let[ +k,P]=t.expectASN1Length(0);this.authorityKeyIdentifier=t.readBytes(P()),k()}else if(W=== +(We|1)){let[k,P]=t.expectASN1Length(0);t.skip(P(),0),k()}else if(W===(We|2)){let[ +k,P]=t.expectASN1Length(0);t.skip(P(),0),k()}else if(W===(We|33)){let[k,P]=t.expectASN1Length( +0);t.skip(P(),0),k()}else throw new Error(`Unexpected data type ${W} in authorit\ +yKeyIdentifier certificate extension`)}$(),K()}else if(ee==="2.5.29.14"){t.expectUint8( +Le,0);let[K]=t.expectASN1Length(0);t.expectUint8(Le,0);let[$,Q]=t.expectASN1Length( +0);this.subjectKeyIdentifier=t.readBytes(Q()),$(),K()}else if(ee==="2.5.29.19"){ +let K,$=t.readUint8();if($===br&&(K=t.readASN1Boolean(0),$=t.readUint8()),$!==Le) +throw new Error("Unexpected type in certificate basic constraints");let[Q]=t.expectASN1Length( +0);t.expectUint8(ae,0);let[W,k]=t.expectASN1Length(),P;k()>0&&(t.expectUint8(br, +0),P=t.readASN1Boolean(0));let N;if(k()>0){t.expectUint8(qt,0);let V=t.readASN1Length( +0);if(N=V===1?t.readUint8():V===2?t.readUint16():V===3?t.readUint24():void 0,N=== void 0)throw new Error("Too many bytes in max path length in certificate basicCo\ -nstraints")}J(),K(),this.basicConstraints={critical:j,ca:Y,pathLength:W}}else t. -skip(M(),0);Z()}x(),g(),s(),this.signedData=t.data.subarray(i,t.offset),t.expectUint8( -ie,0);let[P,D]=t.expectASN1Length(0);t.expectUint8(Ke,0);let q=t.readASN1OID();if(D()> -0&&(t.expectUint8(Sr,0),t.expectUint8(0,0)),P(),q!==this.algorithm)throw new Error( -`Certificate specifies different signature algorithms inside (${this.algorithm})\ - and out (${q})`);t.expectUint8(Er,0),this.signature=t.readASN1BitString(),n()}static fromPEM(e){ -let t="[A-Z0-9 ]+",n=new RegExp(`-{5}BEGIN ${t}-{5}([a-zA-Z0-9=+\\/\\n\\r]+)-{5}END\ - ${t}-{5}`,"g"),i=[],s=null;for(;s=n.exec(e);){let a=s[1].replace(/[\r\n]/g,""), -u=Fo(a),c=new this(u);i.push(c)}return i}subjectAltNameMatchingHost(e){let t=/[.][^.]+[.][^.]+$/; -return(this.subjectAltNames??[]).find(n=>{let i=n,s=e;if(t.test(e)&&t.test(i)&&i. -startsWith("*.")&&(i=i.slice(1),s=s.slice(s.indexOf("."))),i===s)return!0})}isValidAtMoment(e=new Date){ +nstraints")}W(),Q(),this.basicConstraints={critical:K,ca:P,pathLength:N}}else t. +skip(ie(),0);G()}B(),M(),s(),this.signedData=t.data.subarray(i,t.offset),t.expectUint8( +ae,0);let[H,Z]=t.expectASN1Length(0);t.expectUint8(Ge,0);let D=t.readASN1OID(0); +if(Z()>0&&(t.expectUint8(Er,0),t.expectUint8(0,0)),H(),D!==this.algorithm)throw new Error( +`Certificate specifies different signature algorithms inside(${this.algorithm}) \ +and out(${D})`);t.expectUint8(xr,0),this.signature=t.readASN1BitString(),n()}else +this.serialNumber=Ie(e.serialNumber),this.algorithm=e.algorithm,this.issuer=e.issuer, +this.validityPeriod={notBefore:new Date(e.validityPeriod.notBefore),notAfter:new Date( +e.validityPeriod.notAfter)},this.subject=e.subject,this.publicKey={identifiers:e. +publicKey.identifiers,data:Ie(e.publicKey.data),all:Ie(e.publicKey.all)},this.signature= +Ie(e.signature),this.keyUsage={critical:e.keyUsage.critical,usages:new Set(e.keyUsage. +usages)},this.subjectAltNames=e.subjectAltNames,this.extKeyUsage=e.extKeyUsage,e. +authorityKeyIdentifier&&(this.authorityKeyIdentifier=Ie(e.authorityKeyIdentifier)), +e.subjectKeyIdentifier&&(this.subjectKeyIdentifier=Ie(e.subjectKeyIdentifier)),this. +basicConstraints=e.basicConstraints,this.signedData=Ie(e.signedData)}static distinguishedNamesAreEqual(e,t){ +return this.stringFromDistinguishedName(e)===this.stringFromDistinguishedName(t)}static stringFromDistinguishedName(e){ +return Object.entries(e).map(([t,n])=>typeof n=="string"?`${t}=${n.trim().replace( +/[\\,]/g,"\\$&")}`:n.map(i=>`${t}=${i.trim().replace(/[\\,]/g,"\\$&")}`).join(",\ + ")).join(", ")}subjectAltNameMatchingHost(e){let t=/[.][^.]+[.][^.]+$/;return(this. +subjectAltNames??[]).find(n=>{let i=n,s=e;if(t.test(e)&&t.test(i)&&i.startsWith( +"*.")&&(i=i.slice(1),s=s.slice(s.indexOf("."))),i===s)return!0})}isValidAtMoment(e=new Date){ return e>=this.validityPeriod.notBefore&&e<=this.validityPeriod.notAfter}description(){ -return"subject: "+Cr.readableDN(this.subject)+(this.subjectAltNames?` +return"subject: "+Ur.stringFromDistinguishedName(this.subject)+(this.subjectAltNames? +` subject alt names: `+this.subjectAltNames.join(", "):"")+(this.subjectKeyIdentifier? ` -subject key id: ${Te(this.subjectKeyIdentifier," ")}`:"")+` -issuer: `+Cr.readableDN(this.issuer)+(this.authorityKeyIdentifier?` -authority key id: ${Te(this.authorityKeyIdentifier," ")}`:"")+` +subject key id: ${X(this.subjectKeyIdentifier," ")}`:"")+` +issuer: `+Ur.stringFromDistinguishedName(this.issuer)+(this.authorityKeyIdentifier? +` +authority key id: ${X(this.authorityKeyIdentifier," ")}`:"")+` validity: `+this.validityPeriod.notBefore.toISOString()+" \u2013 "+this.validityPeriod. notAfter.toISOString()+` (${this.isValidAtMoment()?"currently valid":"not valid"}\ )`+(this.keyUsage?` @@ -1779,109 +1820,120 @@ nt \u2014\xA0${this.extKeyUsage.clientTls}`:"")+(this.basicConstraints?` basic constraints (${this.basicConstraints.critical?"critical":"non-critical"}):\ CA \u2014\xA0${this.basicConstraints.ca}, path length \u2014 ${this.basicConstraints. pathLength}`:"")+` -signature algorithm: `+Go(Wo(this.algorithm))}toJSON(){return{serialNumber:[...this. -serialNumber],algorithm:this.algorithm,issuer:this.issuer,validityPeriod:{notBefore:this. +signature algorithm: `+eu(Xo(this.algorithm))}toJSON(){return{serialNumber:X(this. +serialNumber),algorithm:this.algorithm,issuer:this.issuer,validityPeriod:{notBefore:this. validityPeriod.notBefore.toISOString(),notAfter:this.validityPeriod.notAfter.toISOString()}, -subject:this.subject,publicKey:{identifiers:this.publicKey.identifiers,data:[...this. -publicKey.data],all:[...this.publicKey.all]},signature:[...this.signature],keyUsage:{ +subject:this.subject,publicKey:{identifiers:this.publicKey.identifiers,data:X(this. +publicKey.data),all:X(this.publicKey.all)},signature:X(this.signature),keyUsage:{ critical:this.keyUsage?.critical,usages:[...this.keyUsage?.usages??[]]},subjectAltNames:this. subjectAltNames,extKeyUsage:this.extKeyUsage,authorityKeyIdentifier:this.authorityKeyIdentifier&& -[...this.authorityKeyIdentifier],subjectKeyIdentifier:this.subjectKeyIdentifier&& -[...this.subjectKeyIdentifier],basicConstraints:this.basicConstraints,signedData:[ -...this.signedData]}}},gi=class extends _r{static{o(this,"st")}};async function Si(r,e,t,n,i){ -r.expectUint8(ie,0);let[s]=r.expectASN1Length(0);r.expectUint8(qt,0);let[a,u]=r. +X(this.authorityKeyIdentifier),subjectKeyIdentifier:this.subjectKeyIdentifier&&X( +this.subjectKeyIdentifier),basicConstraints:this.basicConstraints,signedData:X(this. +signedData)}}static uint8ArraysFromPEM(e){let t="[A-Z0-9 ]+",n=new RegExp(`-----\ +BEGIN ${t}-----([a-zA-Z0-9=+\\/\\n\\r]+)-----END ${t}-----`,"g"),i=[],s=null;for(;s= +n.exec(e);){let a=s[1].replace(/[\r\n]/g,""),u=Si(a);i.push(u)}return i}static fromPEM(e){ +return this.uint8ArraysFromPEM(e).map(t=>new this(t))}},ht=class extends Tr{static{ +o(this,"Q")}static databaseFromPEM(r){let e=this.uint8ArraysFromPEM(r),t=[0],n={}, +i=new Ro;for(let a of e){let u=new this(a),c=t.length-1;u.subjectKeyIdentifier&& +(n[X(u.subjectKeyIdentifier)]=c),n[this.stringFromDistinguishedName(u.subject)]= +c,i.append(a),t[t.length]=t[c]+a.length}let s=i.getData();return{index:{offsets:t, +subjects:n},data:s}}static findInDatabase(r,e){let{index:{subjects:t,offsets:n}, +data:i}=e,s=typeof r=="string"?r:Tr.stringFromDistinguishedName(r),a=t[s];if(a=== +void 0)return;let u=n[a],c=n[a+1],l=i.subarray(u,c);return new this(l)}};async function Ei(r,e,t,n,i){ +r.expectUint8(ae,0);let[s]=r.expectASN1Length(0);r.expectUint8(qt,0);let[a,u]=r. expectASN1Length(0),c=r.readBytes(u());a(),r.expectUint8(qt,0);let[l,h]=r.expectASN1Length( -0),f=r.readBytes(h());l(),s();let y=o((v,C)=>v.length>C?v.subarray(v.length-C):v. -lengthv.length>C?v.subarray(v.length-C):v. +length_r.distinguishedNamesAreEqual(b.subject,l.issuer)):f=t.find(b=>b.subjectKeyIdentifier!== -void 0&&ut(b.subjectKeyIdentifier,h)),f===void 0&&(f=e[u+1]),f===void 0)throw new Error( -"Ran out of certificates before reaching trusted root");let y=f instanceof gi;if(f. +"End-user certificate has no TLS server extKeyUsage");let a=!1;for(let u=0,c=e.length;u< +c;u++){let l=e[u],h=l.authorityKeyIdentifier,f;if(h===void 0?f=ht.findInDatabase( +l.issuer,t):f=ht.findInDatabase(X(h),t),f===void 0&&(f=e[u+1]),f===void 0)throw new Error( +"Ran out of certificates before reaching trusted root");let p=f instanceof ht;if(f. isValidAtMoment()!==!0)throw new Error("Signing certificate is not valid now");if(i&& f.keyUsage?.usages.has("digitalSignature")!==!0)throw new Error("Signing certifi\ cate keyUsage does not include digital signatures");if(f.basicConstraints?.ca!== !0)throw new Error("Signing certificate basicConstraints do not indicate a CA ce\ rtificate");let{pathLength:m}=f.basicConstraints;if(m!==void 0&&m0;){let R=u. -readUint16(0);if(R===0)u.expectUint16(0,0);else if(R===10){let[k,ne]=u.expectLengthUint16( -"groups data");u.skip(ne(),0),k()}else throw new Error(`Unsupported server encry\ -pted extension type 0x${Te([R]).padStart(4,"0")}`)}l(),c(),u.remaining()===0&&u. -extend(await e());let f=!1,y=u.readUint8();if(y===13){f=!0;let[R]=u.expectLengthUint24( -"certificate request data");u.expectUint8(0,0);let[k,ne]=u.expectLengthUint16("c\ -ertificate request extensions");u.skip(ne(),0),k(),R(),u.remaining()===0&&u.extend( -await e()),y=u.readUint8()}if(y!==11)throw new Error(`Unexpected handshake messa\ -ge type 0x${Te([y])}`);let[m]=u.expectLengthUint24(0);u.expectUint8(0,0);let[b,U]=u. -expectLengthUint24(0),v=[];for(;U()>0;){let[R]=u.expectLengthUint24(0),k=new _r( -u);v.push(k),R();let[ne,ce]=u.expectLengthUint16(),Fe=u.subarray(ce());ne()}if(b(), -m(),v.length===0)throw new Error("No certificates supplied");let C=v[0],E=u.data. -subarray(0,u.offset),g=se(n,E),x=await O.digest("SHA-256",g),N=new Uint8Array(x), -P=se(Jo.encode(" ".repeat(64)+"TLS 1.3, server CertificateVerify"),[0],N);u.remaining()=== -0&&u.extend(await e()),u.expectUint8(15,0);let[D]=u.expectLengthUint24(0),q=u.readUint16(); -if(q===1027){let[R]=u.expectLengthUint16();await Si(u,C.publicKey.all,P,"P-256", -"SHA-256"),R()}else if(q===2052){let[R,k]=u.expectLengthUint16(),ne=u.subarray(k()); -R();let ce=await O.importKey("spki",C.publicKey.all,{name:"RSA-PSS",hash:"SHA-25\ -6"},!1,["verify"]);if(await O.verify({name:"RSA-PSS",saltLength:32},ce,ne,P)!==!0) -throw new Error("RSA-PSS-RSAE-SHA256 certificate verify failed")}else throw new Error( -`Unsupported certificate verify signature type 0x${Te([q]).padStart(4,"0")}`);D(); -let Z=u.data.subarray(0,u.offset),M=se(n,Z),$=await ae(t,"finished",new Uint8Array( -0),32,256),j=await O.digest("SHA-256",M),H=await O.importKey("raw",$,{name:"HMAC", -hash:{name:"SHA-256"}},!1,["sign"]),K=await O.sign("HMAC",H,j),J=new Uint8Array( -K);u.remaining()===0&&u.extend(await e()),u.expectUint8(20,0);let[F,Y]=u.expectLengthUint24( -0),W=u.readBytes(Y());if(F(),u.remaining()!==0)throw new Error("Unexpected extra\ - bytes in server handshake");if(ut(W,J)!==!0)throw new Error("Invalid server ver\ -ify hash");if(!await zo(r,v,i,s,a))throw new Error("Validated certificate chain \ -did not end in a trusted root");return[u.data,f]}o(Yo,"Vt");async function Zo(r,e,t,n,{ -useSNI:i,requireServerTlsExtKeyUsage:s,requireDigitalSigKeyUsage:a,writePreData:u, -expectPreData:c,commentPreData:l}={}){i??=!0,s??=!0,a??=!0;let h=await O.generateKey( -{name:"ECDH",namedCurve:"P-256"},!0,["deriveKey","deriveBits"]),f=await O.exportKey( -"raw",h.publicKey),y=new Uint8Array(32);A.getRandomValues(y);let m=Po(r,f,y,i).array(), -b=u?se(u,m):m;if(n(b),c){let re=await t(c.length);if(!re||!ut(re,c))throw new Error( -"Pre data did not match expectation")}let U=await xr(t,22);if(U===void 0)throw new Error( -"Connection closed while awaiting server hello");let v=new be(U.content),C=Bo(v, -y),E=await xr(t,20);if(E===void 0)throw new Error("Connection closed awaiting se\ -rver cipher change");let g=new be(E.content),[x]=g.expectLength(1);g.expectUint8( -1,0),x();let N=m.subarray(5),P=U.content,D=se(N,P),q=await Do(C,h.privateKey,D,256, -16),Z=await O.importKey("raw",q.serverHandshakeKey,{name:"AES-GCM"},!1,["decrypt"]), -M=new Nt("decrypt",Z,q.serverHandshakeIV),$=await O.importKey("raw",q.clientHandshakeKey, -{name:"AES-GCM"},!1,["encrypt"]),j=new Nt("encrypt",$,q.clientHandshakeIV),H=o(async()=>{ -let re=await Ar(t,M,22);if(re===void 0)throw new Error("Premature end of encrypt\ -ed server handshake");return re},"C"),[K,J]=await Yo(r,H,q.serverSecret,D,e,s,a), -F=new be(6);F.writeUint8(20,0),F.writeUint16(771,0);let Y=F.writeLengthUint16(); -F.writeUint8(1,0),Y();let W=F.array(),R=new Uint8Array(0);if(J){let re=new be(8); -re.writeUint8(11,0);let it=re.writeLengthUint24("client certificate data");re.writeUint8( -0,0),re.writeUint24(0,0),it(),R=re.array()}let k=se(D,K,R),ne=await O.digest("SH\ -A-256",k),ce=new Uint8Array(ne),Fe=await ae(q.clientSecret,"finished",new Uint8Array( -0),32,256),ar=await O.importKey("raw",Fe,{name:"HMAC",hash:{name:"SHA-256"}},!1, -["sign"]),or=await O.sign("HMAC",ar,ce),Fa=new Uint8Array(or),Lt=new be(36);Lt.writeUint8( -20,0);let Oa=Lt.writeLengthUint24(0);Lt.writeBytes(Fa),Oa();let ka=Lt.array(),On=await hi( -se(R,ka),j,22),kn=ce;if(R.length>0){let re=k.subarray(0,k.length-R.length),it=await O. -digest("SHA-256",re);kn=new Uint8Array(it)}let Ut=await qo(q.handshakeSecret,kn, -256,16),Qa=await O.importKey("raw",Ut.clientApplicationKey,{name:"AES-GCM"},!0,[ -"encrypt"]),$a=new Nt("encrypt",Qa,Ut.clientApplicationIV),ja=await O.importKey( -"raw",Ut.serverApplicationKey,{name:"AES-GCM"},!0,["decrypt"]),Ha=new Nt("decryp\ -t",ja,Ut.serverApplicationIV),It=!1;return[()=>{if(!It){let re=se(W,...On);n(re), -It=!0}return Ar(t,Ha)},async re=>{let it=It;It=!0;let Qn=await hi(re,$a,23),Ka=it? -se(...Qn):se(W,...On,...Qn);n(Ka)}]}o(Zo,"he");var Ei=class{static{o(this,"xt")}queue;outstandingRequest;constructor(){ -this.queue=[]}enqueue(r){this.queue.push(r),this.dequeue()}dequeue(){if(this.outstandingRequest=== +pported signing algorithm");if(p){a=!0;break}}return a}o(ru,"zt");var nu=new TextEncoder; +async function iu(r,e,t,n,i,s=!0,a=!0){let u=new lt(await e());u.expectUint8(8,0); +let[c]=u.expectLengthUint24(),[l,h]=u.expectLengthUint16(0);for(;h()>0;){let P=u. +readUint16(0);if(P===0)u.expectUint16(0,0);else if(P===10){let[N]=u.expectLengthUint16( +0),[V,le]=u.expectLengthUint16(0);for(;le()>0;){let Fe=u.readUint16()}V(),N()}else +throw new Error(`Unsupported server encrypted extension type 0x${X([P]).padStart( +4,"0")}`)}l(),c(),u.remaining()===0&&u.extend(await e());let f=!1,p=u.readUint8(); +if(p===13){f=!0;let[P]=u.expectLengthUint24("certificate request data");u.expectUint8( +0,0);let[N,V]=u.expectLengthUint16("certificate request extensions");u.skip(V(), +0),N(),P(),u.remaining()===0&&u.extend(await e()),p=u.readUint8()}if(p!==11)throw new Error( +`Unexpected handshake message type 0x${X([p])}`);let[m]=u.expectLengthUint24(0); +u.expectUint8(0,0);let[x,L]=u.expectLengthUint24(0),v=[];for(;L()>0;){let[P]=u.expectLengthUint24( +0),N=new Tr(u);v.push(N),P();let[V,le]=u.expectLengthUint16("certificate extensi\ +ons");u.skip(le()),V()}if(x(),m(),v.length===0)throw new Error("No certificates \ +supplied");let C=v[0],b=u.data.subarray(0,u.offset),g=oe(n,b),E=await q.digest("\ +SHA-256",g),M=new Uint8Array(E),B=oe(nu.encode(" ".repeat(64)+"TLS 1.3, server C\ +ertificateVerify"),[0],M);u.remaining()===0&&u.extend(await e()),u.expectUint8(15, +0);let[F]=u.expectLengthUint24(0),H=u.readUint16();if(H===1027){let[P]=u.expectLengthUint16(); +await Ei(u,C.publicKey.all,B,"P-256","SHA-256"),P()}else if(H===2052){let[P,N]=u. +expectLengthUint16(),V=u.subarray(N());P();let le=await q.importKey("spki",C.publicKey. +all,{name:"RSA-PSS",hash:"SHA-256"},!1,["verify"]);if(await q.verify({name:"RSA-\ +PSS",saltLength:32},le,V,B)!==!0)throw new Error("RSA-PSS-RSAE-SHA256 certificat\ +e verify failed")}else throw new Error(`Unsupported certificate verify signature\ + type 0x${X([H]).padStart(4,"0")}`);F();let Z=u.data.subarray(0,u.offset),D=oe(n, +Z),G=await ue(t,"finished",new Uint8Array(0),32,256),ie=await q.digest("SHA-256", +D),ee=await q.importKey("raw",G,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]), +K=await q.sign("HMAC",ee,ie),$=new Uint8Array(K);u.remaining()===0&&u.extend(await e()), +u.expectUint8(20,0);let[Q,W]=u.expectLengthUint24(0),k=u.readBytes(W());if(Q(),u. +remaining()!==0)throw new Error("Unexpected extra bytes in server handshake");if(kt( +k,$)!==!0)throw new Error("Invalid server verify hash");if(!await ru(r,v,i,s,a)) +throw new Error("Validated certificate chain did not end in a trusted root");return[ +u.data,f]}o(iu,"Gt");async function su(r,e,t,n,{useSNI:i,requireServerTlsExtKeyUsage:s, +requireDigitalSigKeyUsage:a,writePreData:u,expectPreData:c,commentPreData:l}={}){ +i??(i=!0),s??(s=!0),a??(a=!0),typeof e=="string"&&(e=ht.databaseFromPEM(e));let h=await q. +generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey","deriveBits"]),f=await q. +exportKey("raw",h.publicKey),p=new Uint8Array(f),m=new Uint8Array(32);A.getRandomValues( +m);let x=Mo(r,p,m,i).array(),L=u?oe(u,x):x;if(n(L),c){let se=await t(c.length);if(!se|| +!kt(se,c))throw new Error("Pre data did not match expectation")}let v=await vr(t, +22);if(v===void 0)throw new Error("Connection closed while awaiting server hello"); +let C=new Ae(v.content),b=Do(C,m),g=await vr(t,20);if(g===void 0)throw new Error( +"Connection closed awaiting server cipher change");let E=new Ae(g.content),[M]=E. +expectLength(1);E.expectUint8(1,0),M();let B=x.subarray(5),F=v.content,H=oe(B,F), +Z=await Oo(b,h.privateKey,H,256,16),D=await q.importKey("raw",Z.serverHandshakeKey, +{name:"AES-GCM"},!1,["decrypt"]),G=new Ft("decrypt",D,Z.serverHandshakeIV),ie=await q. +importKey("raw",Z.clientHandshakeKey,{name:"AES-GCM"},!1,["encrypt"]),ee=new Ft( +"encrypt",ie,Z.clientHandshakeIV),K=o(async()=>{let se=await Cr(t,G,22);if(se=== +void 0)throw new Error("Premature end of encrypted server handshake");return se}, +"S"),[$,Q]=await iu(r,K,Z.serverSecret,H,e,s,a),W=new Ae(6);W.writeUint8(20,0),W. +writeUint16(771,0);let k=W.writeLengthUint16();W.writeUint8(1,0),k();let P=W.array(), +N=new Uint8Array(0);if(Q){let se=new Ae(8);se.writeUint8(11,0);let at=se.writeLengthUint24( +"client certificate data");se.writeUint8(0,0),se.writeUint24(0,0),at(),N=se.array()} +let V=oe(H,$,N),le=await q.digest("SHA-256",V),Fe=new Uint8Array(le),ur=await ue( +Z.clientSecret,"finished",new Uint8Array(0),32,256),cr=await q.importKey("raw",ur, +{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),qa=await q.sign("HMAC",cr,Fe),ka=new Uint8Array( +qa),Pt=new Ae(36);Pt.writeUint8(20,0);let Oa=Pt.writeLengthUint24(0);Pt.writeBytes( +ka),Oa();let Qa=Pt.array(),Qn=await di(oe(N,Qa),ee,22),$n=Fe;if(N.length>0){let se=V. +subarray(0,V.length-N.length),at=await q.digest("SHA-256",se);$n=new Uint8Array( +at)}let Bt=await Qo(Z.handshakeSecret,$n,256,16),$a=await q.importKey("raw",Bt.clientApplicationKey, +{name:"AES-GCM"},!0,["encrypt"]),ja=new Ft("encrypt",$a,Bt.clientApplicationIV), +Ha=await q.importKey("raw",Bt.serverApplicationKey,{name:"AES-GCM"},!0,["decrypt"]), +Ka=new Ft("decrypt",Ha,Bt.serverApplicationIV),Rt=!1;return[()=>{if(!Rt){let se=oe( +P,...Qn);n(se),Rt=!0}return Cr(t,Ka)},async se=>{let at=Rt;Rt=!0;let jn=await di( +se,ja,23),Wa=at?oe(...jn):oe(P,...Qn,...jn);n(Wa)}]}o(su,"Se");var xi=class{static{ +o(this,"wt")}constructor(){j(this,"queue"),j(this,"outstandingRequest"),this.queue= +[]}enqueue(r){this.queue.push(r),this.dequeue()}dequeue(){if(this.outstandingRequest=== void 0)return;let{resolve:r,bytes:e}=this.outstandingRequest,t=this.bytesInQueue(); if(te)return this.queue[0]=n.subarray(e),r(n.subarray(0,e)); 0,a),u),a-=a,u+=a)}return r(s)}}bytesInQueue(){return this.queue.reduce((r,e)=>r+ e.length,0)}async read(r){if(this.outstandingRequest!==void 0)throw new Error("C\ an\u2019t read while already awaiting read");return new Promise(e=>{this.outstandingRequest= -{resolve:e,bytes:r},this.dequeue()})}},Xo=class extends Ei{static{o(this,"vt")}constructor(r){ +{resolve:e,bytes:r},this.dequeue()})}},au=class extends xi{static{o(this,"Rt")}constructor(r){ super(),this.socket=r,r.addEventListener("message",e=>this.enqueue(new Uint8Array( e.data))),r.addEventListener("close",()=>this.dequeue())}socketIsNotClosed(){let{ -socket:r}=this,{readyState:e}=r;return e<=1}},eu=class extends Ei{static{o(this, -"Lt")}constructor(r){super(),this.socket=r,r.on("data",e=>this.enqueue(new Uint8Array( +socket:r}=this,{readyState:e}=r;return e<=1}},ou=class extends xi{static{o(this, +"Et")}constructor(r){super(),this.socket=r,r.on("data",e=>this.enqueue(new Uint8Array( e))),r.on("close",()=>this.dequeue())}socketIsNotClosed(){let{socket:r}=this,{readyState:e}=r; -return e==="opening"||e==="open"}};var bi=`-----BEGIN CERTIFICATE----- +return e==="opening"||e==="open"}};function uu(r,e=(n,i)=>i,t){return JSON.stringify( +r,(n,i)=>e(n,typeof i!="object"||i===null||Array.isArray(i)?i:Object.fromEntries( +Object.entries(i).sort(([s],[a])=>sa?1:0))),t)}o(uu,"Qt");var Ai=`-----BEGIN CERTIFICATE----- MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 @@ -1928,127 +1982,127 @@ oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= -----END CERTIFICATE----- -`;p();var ru=Object.getOwnPropertyNames,nu=Object.getOwnPropertySymbols,iu=Object.prototype. -hasOwnProperty;function xi(r,e){return o(function(n,i,s){return r(n,i,s)&&e(n,i, -s)},"isEqual")}o(xi,"combineComparators");function Ft(r){return o(function(t,n,i){ +`;y();var lu=Object.getOwnPropertyNames,hu=Object.getOwnPropertySymbols,fu=Object.prototype. +hasOwnProperty;function vi(r,e){return o(function(n,i,s){return r(n,i,s)&&e(n,i, +s)},"isEqual")}o(vi,"combineComparators");function Ot(r){return o(function(t,n,i){ if(!t||!n||typeof t!="object"||typeof n!="object")return r(t,n,i);var s=i.cache, a=s.get(t),u=s.get(n);if(a&&u)return a===n&&u===t;s.set(t,n),s.set(n,t);var c=r( -t,n,i);return s.delete(t),s.delete(n),c},"isCircular")}o(Ft,"createIsCircular"); -function Ai(r){return ru(r).concat(nu(r))}o(Ai,"getStrictProperties");var Ii=Object. -hasOwn||function(r,e){return iu.call(r,e)};function We(r,e){return r||e?r===e:r=== -e||r!==r&&e!==e}o(We,"sameValueZeroEqual");var Pi="_owner",vi=Object.getOwnPropertyDescriptor, -Ci=Object.keys;function su(r,e,t){var n=r.length;if(e.length!==n)return!1;for(;n-- > -0;)if(!t.equals(r[n],e[n],n,n,r,e,t))return!1;return!0}o(su,"areArraysEqual");function au(r,e){ -return We(r.getTime(),e.getTime())}o(au,"areDatesEqual");function _i(r,e,t){if(r. +t,n,i);return s.delete(t),s.delete(n),c},"isCircular")}o(Ot,"createIsCircular"); +function Ci(r){return lu(r).concat(hu(r))}o(Ci,"getStrictProperties");var Bi=Object. +hasOwn||function(r,e){return fu.call(r,e)};function Ve(r,e){return r||e?r===e:r=== +e||r!==r&&e!==e}o(Ve,"sameValueZeroEqual");var Ri="_owner",_i=Object.getOwnPropertyDescriptor, +Ti=Object.keys;function du(r,e,t){var n=r.length;if(e.length!==n)return!1;for(;n-- > +0;)if(!t.equals(r[n],e[n],n,n,r,e,t))return!1;return!0}o(du,"areArraysEqual");function pu(r,e){ +return Ve(r.getTime(),e.getTime())}o(pu,"areDatesEqual");function Ui(r,e,t){if(r. size!==e.size)return!1;for(var n={},i=r.entries(),s=0,a,u;(a=i.next())&&!a.done;){ -for(var c=e.entries(),l=!1,h=0;(u=c.next())&&!u.done;){var f=a.value,y=f[0],m=f[1], -b=u.value,U=b[0],v=b[1];!l&&!n[h]&&(l=t.equals(y,U,s,h,r,e,t)&&t.equals(m,v,y,U, -r,e,t))&&(n[h]=!0),h++}if(!l)return!1;s++}return!0}o(_i,"areMapsEqual");function ou(r,e,t){ -var n=Ci(r),i=n.length;if(Ci(e).length!==i)return!1;for(var s;i-- >0;)if(s=n[i], -s===Pi&&(r.$$typeof||e.$$typeof)&&r.$$typeof!==e.$$typeof||!Ii(e,s)||!t.equals(r[s], -e[s],s,s,r,e,t))return!1;return!0}o(ou,"areObjectsEqual");function ct(r,e,t){var n=Ai( -r),i=n.length;if(Ai(e).length!==i)return!1;for(var s,a,u;i-- >0;)if(s=n[i],s===Pi&& -(r.$$typeof||e.$$typeof)&&r.$$typeof!==e.$$typeof||!Ii(e,s)||!t.equals(r[s],e[s], -s,s,r,e,t)||(a=vi(r,s),u=vi(e,s),(a||u)&&(!a||!u||a.configurable!==u.configurable|| -a.enumerable!==u.enumerable||a.writable!==u.writable)))return!1;return!0}o(ct,"a\ -reObjectsEqualStrict");function uu(r,e){return We(r.valueOf(),e.valueOf())}o(uu, -"arePrimitiveWrappersEqual");function cu(r,e){return r.source===e.source&&r.flags=== -e.flags}o(cu,"areRegExpsEqual");function Ti(r,e,t){if(r.size!==e.size)return!1;for(var n={}, +for(var c=e.entries(),l=!1,h=0;(u=c.next())&&!u.done;){var f=a.value,p=f[0],m=f[1], +x=u.value,L=x[0],v=x[1];!l&&!n[h]&&(l=t.equals(p,L,s,h,r,e,t)&&t.equals(m,v,p,L, +r,e,t))&&(n[h]=!0),h++}if(!l)return!1;s++}return!0}o(Ui,"areMapsEqual");function yu(r,e,t){ +var n=Ti(r),i=n.length;if(Ti(e).length!==i)return!1;for(var s;i-- >0;)if(s=n[i], +s===Ri&&(r.$$typeof||e.$$typeof)&&r.$$typeof!==e.$$typeof||!Bi(e,s)||!t.equals(r[s], +e[s],s,s,r,e,t))return!1;return!0}o(yu,"areObjectsEqual");function ft(r,e,t){var n=Ci( +r),i=n.length;if(Ci(e).length!==i)return!1;for(var s,a,u;i-- >0;)if(s=n[i],s===Ri&& +(r.$$typeof||e.$$typeof)&&r.$$typeof!==e.$$typeof||!Bi(e,s)||!t.equals(r[s],e[s], +s,s,r,e,t)||(a=_i(r,s),u=_i(e,s),(a||u)&&(!a||!u||a.configurable!==u.configurable|| +a.enumerable!==u.enumerable||a.writable!==u.writable)))return!1;return!0}o(ft,"a\ +reObjectsEqualStrict");function mu(r,e){return Ve(r.valueOf(),e.valueOf())}o(mu, +"arePrimitiveWrappersEqual");function wu(r,e){return r.source===e.source&&r.flags=== +e.flags}o(wu,"areRegExpsEqual");function Li(r,e,t){if(r.size!==e.size)return!1;for(var n={}, i=r.values(),s,a;(s=i.next())&&!s.done;){for(var u=e.values(),c=!1,l=0;(a=u.next())&& !a.done;)!c&&!n[l]&&(c=t.equals(s.value,a.value,s.value,a.value,r,e,t))&&(n[l]=!0), -l++;if(!c)return!1}return!0}o(Ti,"areSetsEqual");function lu(r,e){var t=r.length; -if(e.length!==t)return!1;for(;t-- >0;)if(r[t]!==e[t])return!1;return!0}o(lu,"are\ -TypedArraysEqual");var hu="[object Arguments]",fu="[object Boolean]",du="[object\ - Date]",pu="[object Map]",yu="[object Number]",wu="[object Object]",mu="[object \ -RegExp]",gu="[object Set]",Su="[object String]",Eu=Array.isArray,Li=typeof ArrayBuffer== -"function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Ui=Object.assign,bu=Object. -prototype.toString.call.bind(Object.prototype.toString);function xu(r){var e=r.areArraysEqual, +l++;if(!c)return!1}return!0}o(Li,"areSetsEqual");function gu(r,e){var t=r.length; +if(e.length!==t)return!1;for(;t-- >0;)if(r[t]!==e[t])return!1;return!0}o(gu,"are\ +TypedArraysEqual");var Su="[object Arguments]",bu="[object Boolean]",Eu="[object\ + Date]",xu="[object Map]",Au="[object Number]",vu="[object Object]",Cu="[object \ +RegExp]",_u="[object Set]",Tu="[object String]",Uu=Array.isArray,Ii=typeof ArrayBuffer== +"function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Pi=Object.assign,Lu=Object. +prototype.toString.call.bind(Object.prototype.toString);function Iu(r){var e=r.areArraysEqual, t=r.areDatesEqual,n=r.areMapsEqual,i=r.areObjectsEqual,s=r.arePrimitiveWrappersEqual, -a=r.areRegExpsEqual,u=r.areSetsEqual,c=r.areTypedArraysEqual;return o(function(h,f,y){ +a=r.areRegExpsEqual,u=r.areSetsEqual,c=r.areTypedArraysEqual;return o(function(h,f,p){ if(h===f)return!0;if(h==null||f==null||typeof h!="object"||typeof f!="object")return h!== h&&f!==f;var m=h.constructor;if(m!==f.constructor)return!1;if(m===Object)return i( -h,f,y);if(Eu(h))return e(h,f,y);if(Li!=null&&Li(h))return c(h,f,y);if(m===Date)return t( -h,f,y);if(m===RegExp)return a(h,f,y);if(m===Map)return n(h,f,y);if(m===Set)return u( -h,f,y);var b=bu(h);return b===du?t(h,f,y):b===mu?a(h,f,y):b===pu?n(h,f,y):b===gu? -u(h,f,y):b===wu?typeof h.then!="function"&&typeof f.then!="function"&&i(h,f,y):b=== -hu?i(h,f,y):b===fu||b===yu||b===Su?s(h,f,y):!1},"comparator")}o(xu,"createEquali\ -tyComparator");function Au(r){var e=r.circular,t=r.createCustomConfig,n=r.strict, -i={areArraysEqual:n?ct:su,areDatesEqual:au,areMapsEqual:n?xi(_i,ct):_i,areObjectsEqual:n? -ct:ou,arePrimitiveWrappersEqual:uu,areRegExpsEqual:cu,areSetsEqual:n?xi(Ti,ct):Ti, -areTypedArraysEqual:n?ct:lu};if(t&&(i=Ui({},i,t(i))),e){var s=Ft(i.areArraysEqual), -a=Ft(i.areMapsEqual),u=Ft(i.areObjectsEqual),c=Ft(i.areSetsEqual);i=Ui({},i,{areArraysEqual:s, -areMapsEqual:a,areObjectsEqual:u,areSetsEqual:c})}return i}o(Au,"createEqualityC\ -omparatorConfig");function vu(r){return function(e,t,n,i,s,a,u){return r(e,t,u)}} -o(vu,"createInternalEqualityComparator");function Cu(r){var e=r.circular,t=r.comparator, +h,f,p);if(Uu(h))return e(h,f,p);if(Ii!=null&&Ii(h))return c(h,f,p);if(m===Date)return t( +h,f,p);if(m===RegExp)return a(h,f,p);if(m===Map)return n(h,f,p);if(m===Set)return u( +h,f,p);var x=Lu(h);return x===Eu?t(h,f,p):x===Cu?a(h,f,p):x===xu?n(h,f,p):x===_u? +u(h,f,p):x===vu?typeof h.then!="function"&&typeof f.then!="function"&&i(h,f,p):x=== +Su?i(h,f,p):x===bu||x===Au||x===Tu?s(h,f,p):!1},"comparator")}o(Iu,"createEquali\ +tyComparator");function Pu(r){var e=r.circular,t=r.createCustomConfig,n=r.strict, +i={areArraysEqual:n?ft:du,areDatesEqual:pu,areMapsEqual:n?vi(Ui,ft):Ui,areObjectsEqual:n? +ft:yu,arePrimitiveWrappersEqual:mu,areRegExpsEqual:wu,areSetsEqual:n?vi(Li,ft):Li, +areTypedArraysEqual:n?ft:gu};if(t&&(i=Pi({},i,t(i))),e){var s=Ot(i.areArraysEqual), +a=Ot(i.areMapsEqual),u=Ot(i.areObjectsEqual),c=Ot(i.areSetsEqual);i=Pi({},i,{areArraysEqual:s, +areMapsEqual:a,areObjectsEqual:u,areSetsEqual:c})}return i}o(Pu,"createEqualityC\ +omparatorConfig");function Bu(r){return function(e,t,n,i,s,a,u){return r(e,t,u)}} +o(Bu,"createInternalEqualityComparator");function Ru(r){var e=r.circular,t=r.comparator, n=r.createState,i=r.equals,s=r.strict;if(n)return o(function(c,l){var h=n(),f=h. -cache,y=f===void 0?e?new WeakMap:void 0:f,m=h.meta;return t(c,l,{cache:y,equals:i, +cache,p=f===void 0?e?new WeakMap:void 0:f,m=h.meta;return t(c,l,{cache:p,equals:i, meta:m,strict:s})},"isEqual");if(e)return o(function(c,l){return t(c,l,{cache:new WeakMap, equals:i,meta:void 0,strict:s})},"isEqual");var a={cache:void 0,equals:i,meta:void 0, -strict:s};return o(function(c,l){return t(c,l,a)},"isEqual")}o(Cu,"createIsEqual"); -var Lr=Le(),ef=Le({strict:!0}),tf=Le({circular:!0}),rf=Le({circular:!0,strict:!0}), -nf=Le({createInternalComparator:o(function(){return We},"createInternalComparato\ -r")}),sf=Le({strict:!0,createInternalComparator:o(function(){return We},"createI\ -nternalComparator")}),af=Le({circular:!0,createInternalComparator:o(function(){return We}, -"createInternalComparator")}),of=Le({circular:!0,createInternalComparator:o(function(){ -return We},"createInternalComparator"),strict:!0});function Le(r){r===void 0&&(r= +strict:s};return o(function(c,l){return t(c,l,a)},"isEqual")}o(Ru,"createIsEqual"); +var Ir=Pe(),lf=Pe({strict:!0}),hf=Pe({circular:!0}),ff=Pe({circular:!0,strict:!0}), +df=Pe({createInternalComparator:o(function(){return Ve},"createInternalComparato\ +r")}),pf=Pe({strict:!0,createInternalComparator:o(function(){return Ve},"createI\ +nternalComparator")}),yf=Pe({circular:!0,createInternalComparator:o(function(){return Ve}, +"createInternalComparator")}),mf=Pe({circular:!0,createInternalComparator:o(function(){ +return Ve},"createInternalComparator"),strict:!0});function Pe(r){r===void 0&&(r= {});var e=r.circular,t=e===void 0?!1:e,n=r.createInternalComparator,i=r.createState, -s=r.strict,a=s===void 0?!1:s,u=Au(r),c=xu(u),l=n?n(c):vu(c);return Cu({circular:t, -comparator:c,createState:i,equals:l,strict:a})}o(Le,"createCustomEqual");p();var sr=Oe(ir());Jt();p();Jt();rn();var Na=Oe(bt()),Ma=Oe(Vt());function Ch(r){return r instanceof w?"\\x"+r.toString("hex"):r}o(Ch,"encodeBuffe\ -rsAsBytea");var Ce=class r extends Error{static{o(this,"NeonDbError")}name="Neon\ +s=r.strict,a=s===void 0?!1:s,u=Pu(r),c=Iu(u),l=n?n(c):Bu(c);return Ru({circular:t, +comparator:c,createState:i,equals:l,strict:a})}o(Pe,"createCustomEqual");y();var or=Qe(ar());Zt();y();Zt();sn();var Na=Qe(vt()),Ma=Qe(Jt());function Rh(r){return r instanceof w?"\\x"+r.toString("hex"):r}o(Rh,"encodeBuffe\ +rsAsBytea");var Te=class r extends Error{static{o(this,"NeonDbError")}name="Neon\ DbError";severity;code;detail;hint;position;internalPosition;internalQuery;where;schema;table;column;dataType;constraint;file;line;routine;sourceError;constructor(e){ super(e),"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&& Error.captureStackTrace(this,r)}},Ba="transaction() expects an array of queries,\ - or a function returning an array of queries",_h=["severity","code","detail","hi\ + or a function returning an array of queries",Nh=["severity","code","detail","hi\ nt","position","internalPosition","internalQuery","where","schema","table","colu\ -mn","dataType","constraint","file","line","routine"];function xe(r,{arrayMode:e, +mn","dataType","constraint","file","line","routine"];function ve(r,{arrayMode:e, fullResults:t,fetchOptions:n,isolationLevel:i,readOnly:s,deferrable:a,queryCallback:u, resultCallback:c,authToken:l}={}){if(!r)throw new Error("No database connection \ string was provided to `neon()`. Perhaps an environment variable has not been se\ -t?");let h;try{h=tn(r)}catch{throw new Error("Database connection string provide\ +t?");let h;try{h=nn(r)}catch{throw new Error("Database connection string provide\ d to `neon()` is not a valid URL. Connection string: "+String(r))}let{protocol:f, -username:y,hostname:m,port:b,pathname:U}=h;if(f!=="postgres:"&&f!=="postgresql:"|| -!y||!m||!U)throw new Error("Database connection string format for `neon()` shoul\ -d be: postgresql://user:password@host.tld/dbname?option=value");function v(E,...g){ -let x,N;if(typeof E=="string")x=E,N=g[1],g=g[0]??[];else{x="";for(let D=0;DCh((0,Na.prepareValue)(D)));let P={ -query:x,params:g};return u&&u(P),Th(C,P,N)}o(v,"resolve"),v.transaction=async(E,g)=>{ -if(typeof E=="function"&&(E=E(v)),!Array.isArray(E))throw new Error(Ba);E.forEach( -P=>{if(P[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Ba)});let x=E. -map(P=>P.parameterizedQuery),N=E.map(P=>P.opts??{});return C(x,N,g)};async function C(E,g,x){ -let{fetchEndpoint:N,fetchFunction:P}=ge,D=Array.isArray(E)?{queries:E}:E,q=n??{}, -Z=e??!1,M=t??!1,$=i,j=s,H=a;x!==void 0&&(x.fetchOptions!==void 0&&(q={...q,...x. -fetchOptions}),x.arrayMode!==void 0&&(Z=x.arrayMode),x.fullResults!==void 0&&(M= -x.fullResults),x.isolationLevel!==void 0&&($=x.isolationLevel),x.readOnly!==void 0&& -(j=x.readOnly),x.deferrable!==void 0&&(H=x.deferrable)),g!==void 0&&!Array.isArray( -g)&&g.fetchOptions!==void 0&&(q={...q,...g.fetchOptions});let K=l;!Array.isArray( -g)&&g?.authToken!==void 0&&(K=g.authToken);let J=typeof N=="function"?N(m,b,{jwtAuth:K!== -void 0}):N,F={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Arr\ -ay-Mode":"true"},Y=await Lh(K);Y&&(F.Authorization=`Bearer ${Y}`),Array.isArray( -E)&&($!==void 0&&(F["Neon-Batch-Isolation-Level"]=$),j!==void 0&&(F["Neon-Batch-\ -Read-Only"]=String(j)),H!==void 0&&(F["Neon-Batch-Deferrable"]=String(H)));let W; -try{W=await(P??fetch)(J,{method:"POST",body:JSON.stringify(D),headers:F,...q})}catch(R){ -let k=new Ce(`Error connecting to database: ${R.message}`);throw k.sourceError=R, -k}if(W.ok){let R=await W.json();if(Array.isArray(E)){let k=R.results;if(!Array.isArray( -k))throw new Ce("Neon internal error: unexpected result format");return k.map((ne,ce)=>{ -let Fe=g[ce]??{},ar=Fe.arrayMode??Z,or=Fe.fullResults??M;return Ra(ne,{arrayMode:ar, -fullResults:or,parameterizedQuery:E[ce],resultCallback:c,types:Fe.types})})}else{ -let k=g??{},ne=k.arrayMode??Z,ce=k.fullResults??M;return Ra(R,{arrayMode:ne,fullResults:ce, -parameterizedQuery:E,resultCallback:c,types:k.types})}}else{let{status:R}=W;if(R=== -400){let k=await W.json(),ne=new Ce(k.message);for(let ce of _h)ne[ce]=k[ce]??void 0; -throw ne}else{let k=await W.text();throw new Ce(`Server error (HTTP status ${R})\ -: ${k}`)}}}return o(C,"execute"),v}o(xe,"neon");function Th(r,e,t){return{[Symbol. +username:p,hostname:m,port:x,pathname:L}=h;if(f!=="postgres:"&&f!=="postgresql:"|| +!p||!m||!L)throw new Error("Database connection string format for `neon()` shoul\ +d be: postgresql://user:password@host.tld/dbname?option=value");function v(b,...g){ +let E,M;if(typeof b=="string")E=b,M=g[1],g=g[0]??[];else{E="";for(let F=0;FRh((0,Na.prepareValue)(F)));let B={ +query:E,params:g};return u&&u(B),Mh(C,B,M)}o(v,"resolve"),v.transaction=async(b,g)=>{ +if(typeof b=="function"&&(b=b(v)),!Array.isArray(b))throw new Error(Ba);b.forEach( +B=>{if(B[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Ba)});let E=b. +map(B=>B.parameterizedQuery),M=b.map(B=>B.opts??{});return C(E,M,g)};async function C(b,g,E){ +let{fetchEndpoint:M,fetchFunction:B}=be,F=Array.isArray(b)?{queries:b}:b,H=n??{}, +Z=e??!1,D=t??!1,G=i,ie=s,ee=a;E!==void 0&&(E.fetchOptions!==void 0&&(H={...H,...E. +fetchOptions}),E.arrayMode!==void 0&&(Z=E.arrayMode),E.fullResults!==void 0&&(D= +E.fullResults),E.isolationLevel!==void 0&&(G=E.isolationLevel),E.readOnly!==void 0&& +(ie=E.readOnly),E.deferrable!==void 0&&(ee=E.deferrable)),g!==void 0&&!Array.isArray( +g)&&g.fetchOptions!==void 0&&(H={...H,...g.fetchOptions});let K=l;!Array.isArray( +g)&&g?.authToken!==void 0&&(K=g.authToken);let $=typeof M=="function"?M(m,x,{jwtAuth:K!== +void 0}):M,Q={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Arr\ +ay-Mode":"true"},W=await Dh(K);W&&(Q.Authorization=`Bearer ${W}`),Array.isArray( +b)&&(G!==void 0&&(Q["Neon-Batch-Isolation-Level"]=G),ie!==void 0&&(Q["Neon-Batch\ +-Read-Only"]=String(ie)),ee!==void 0&&(Q["Neon-Batch-Deferrable"]=String(ee)));let k; +try{k=await(B??fetch)($,{method:"POST",body:JSON.stringify(F),headers:Q,...H})}catch(P){ +let N=new Te(`Error connecting to database: ${P}`);throw N.sourceError=P,N}if(k. +ok){let P=await k.json();if(Array.isArray(b)){let N=P.results;if(!Array.isArray( +N))throw new Te("Neon internal error: unexpected result format");return N.map((V,le)=>{ +let Fe=g[le]??{},ur=Fe.arrayMode??Z,cr=Fe.fullResults??D;return Ra(V,{arrayMode:ur, +fullResults:cr,parameterizedQuery:b[le],resultCallback:c,types:Fe.types})})}else{ +let N=g??{},V=N.arrayMode??Z,le=N.fullResults??D;return Ra(P,{arrayMode:V,fullResults:le, +parameterizedQuery:b,resultCallback:c,types:N.types})}}else{let{status:P}=k;if(P=== +400){let N=await k.json(),V=new Te(N.message);for(let le of Nh)V[le]=N[le]??void 0; +throw V}else{let N=await k.text();throw new Te(`Server error (HTTP status ${P}):\ + ${N}`)}}}return o(C,"execute"),v}o(ve,"neon");function Mh(r,e,t){return{[Symbol. toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:o((n,i)=>r(e,t). then(n,i),"then"),catch:o(n=>r(e,t).catch(n),"catch"),finally:o(n=>r(e,t).finally( -n),"finally")}}o(Th,"createNeonQueryPromise");function Ra(r,{arrayMode:e,fullResults:t, +n),"finally")}}o(Mh,"createNeonQueryPromise");function Ra(r,{arrayMode:e,fullResults:t, parameterizedQuery:n,resultCallback:i,types:s}){let a=new Ma.default(s),u=r.fields. map(h=>h.name),c=r.fields.map(h=>a.getTypeParser(h.dataTypeID)),l=e===!0?r.rows. -map(h=>h.map((f,y)=>f===null?null:c[y](f))):r.rows.map(h=>Object.fromEntries(h.map( -(f,y)=>[u[y],f===null?null:c[y](f)])));return i&&i(n,r,l,{arrayMode:e,fullResults:t}), +map(h=>h.map((f,p)=>f===null?null:c[p](f))):r.rows.map(h=>Object.fromEntries(h.map( +(f,p)=>[u[p],f===null?null:c[p](f)])));return i&&i(n,r,l,{arrayMode:e,fullResults:t}), t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=l,r._parsers=c,r._types=a,r):l}o(Ra,"\ -processQueryResult");async function Lh(r){if(typeof r=="string")return r;if(typeof r== -"function")try{return await Promise.resolve(r())}catch(e){let t=new Ce("Error ge\ -tting auth token.");throw e instanceof Error&&(t=new Ce(`Error getting auth toke\ -n: ${e.message}`)),t}}o(Lh,"getAuthToken");var Da=Oe(zt()),rt=Oe(ir());var Be=class extends sr.Client{constructor(t){super(t);this.config=t}static{o(this, +processQueryResult");async function Dh(r){if(typeof r=="string")return r;if(typeof r== +"function")try{return await Promise.resolve(r())}catch(e){let t=new Te("Error ge\ +tting auth token.");throw e instanceof Error&&(t=new Te(`Error getting auth toke\ +n: ${e.message}`)),t}}o(Dh,"getAuthToken");var Da=Qe(Yt()),it=Qe(ar());var Me=class extends or.Client{constructor(t){super(t);this.config=t}static{o(this, "NeonClient")}get neonConfig(){return this.connection.stream}connect(t){let{neonConfig:n}=this; n.forceDisablePgSSL&&(this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&& console.warn("SSL is enabled for both Postgres (e.g. ?sslmode=require in the con\ @@ -2070,8 +2124,8 @@ bind(this)));let h=this.ssl?"sslconnect":"connect";l.on(h,()=>{this._handleAuthC this._handleReadyForQuery()})}return a}async _handleAuthSASLContinue(t){let n=this. saslSession,i=this.password,s=t.data;if(n.message!=="SASLInitialResponse"||typeof i!= "string"||typeof s!="string")throw new Error("SASL: protocol error");let a=Object. -fromEntries(s.split(",").map(W=>{if(!/^.=/.test(W))throw new Error("SASL: Invali\ -d attribute pair entry");let R=W[0],k=W.substring(2);return[R,k]})),u=a.r,c=a.s, +fromEntries(s.split(",").map(k=>{if(!/^.=/.test(k))throw new Error("SASL: Invali\ +d attribute pair entry");let P=k[0],N=k.substring(2);return[P,N]})),u=a.r,c=a.s, l=a.i;if(!u||!/^[!-+--~]+$/.test(u))throw new Error("SASL: SCRAM-SERVER-FIRST-ME\ SSAGE: nonce missing/unprintable");if(!c||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ @@ -2079,94 +2133,94 @@ test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base ESSAGE: missing/invalid iteration count");if(!u.startsWith(n.clientNonce))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ -SAGE: server nonce is too short");let h=parseInt(l,10),f=w.from(c,"base64"),y=new TextEncoder, -m=y.encode(i),b=await A.subtle.importKey("raw",m,{name:"HMAC",hash:{name:"SHA-25\ -6"}},!1,["sign"]),U=new Uint8Array(await A.subtle.sign("HMAC",b,w.concat([f,w.from( -[0,0,0,1])]))),v=U;for(var C=0;Cv[R]^U[R]));let E=v,g=await A.subtle.importKey( -"raw",E,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),x=new Uint8Array(await A. -subtle.sign("HMAC",g,y.encode("Client Key"))),N=await A.subtle.digest("SHA-256", -x),P="n=*,r="+n.clientNonce,D="r="+u+",s="+c+",i="+h,q="c=biws,r="+u,Z=P+","+D+"\ -,"+q,M=await A.subtle.importKey("raw",N,{name:"HMAC",hash:{name:"SHA-256"}},!1,[ -"sign"]);var $=new Uint8Array(await A.subtle.sign("HMAC",M,y.encode(Z))),j=w.from( -x.map((W,R)=>x[R]^$[R])),H=j.toString("base64");let K=await A.subtle.importKey("\ -raw",E,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),J=await A.subtle.sign("H\ -MAC",K,y.encode("Server Key")),F=await A.subtle.importKey("raw",J,{name:"HMAC",hash:{ -name:"SHA-256"}},!1,["sign"]);var Y=w.from(await A.subtle.sign("HMAC",F,y.encode( -Z)));n.message="SASLResponse",n.serverSignature=Y.toString("base64"),n.response= -q+",p="+H,this.connection.sendSCRAMClientFinalMessage(this.saslSession.response)}}; -function Uh(r,e){if(e)return{callback:e,result:void 0};let t,n,i=o(function(a,u){ +SAGE: server nonce is too short");let h=parseInt(l,10),f=w.from(c,"base64"),p=new TextEncoder, +m=p.encode(i),x=await A.subtle.importKey("raw",m,{name:"HMAC",hash:{name:"SHA-25\ +6"}},!1,["sign"]),L=new Uint8Array(await A.subtle.sign("HMAC",x,w.concat([f,w.from( +[0,0,0,1])]))),v=L;for(var C=0;Cv[P]^L[P]));let b=v,g=await A.subtle.importKey( +"raw",b,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),E=new Uint8Array(await A. +subtle.sign("HMAC",g,p.encode("Client Key"))),M=await A.subtle.digest("SHA-256", +E),B="n=*,r="+n.clientNonce,F="r="+u+",s="+c+",i="+h,H="c=biws,r="+u,Z=B+","+F+"\ +,"+H,D=await A.subtle.importKey("raw",M,{name:"HMAC",hash:{name:"SHA-256"}},!1,[ +"sign"]);var G=new Uint8Array(await A.subtle.sign("HMAC",D,p.encode(Z))),ie=w.from( +E.map((k,P)=>E[P]^G[P])),ee=ie.toString("base64");let K=await A.subtle.importKey( +"raw",b,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),$=await A.subtle.sign("\ +HMAC",K,p.encode("Server Key")),Q=await A.subtle.importKey("raw",$,{name:"HMAC", +hash:{name:"SHA-256"}},!1,["sign"]);var W=w.from(await A.subtle.sign("HMAC",Q,p. +encode(Z)));n.message="SASLResponse",n.serverSignature=W.toString("base64"),n.response= +H+",p="+ee,this.connection.sendSCRAMClientFinalMessage(this.saslSession.response)}}; +function Fh(r,e){if(e)return{callback:e,result:void 0};let t,n,i=o(function(a,u){ a?t(a):n(u)},"cb"),s=new r(function(a,u){n=a,t=u});return{callback:i,result:s}}o( -Uh,"promisify");var qe=class extends sr.Pool{static{o(this,"NeonPool")}Client=Be;hasFetchUnsupportedListeners=!1;on(e,t){ +Fh,"promisify");var Oe=class extends or.Pool{static{o(this,"NeonPool")}Client=Me;hasFetchUnsupportedListeners=!1;on(e,t){ return e!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(e,t)}query(e,t,n){ -if(!ge.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof e=="function") -return super.query(e,t,n);typeof t=="function"&&(n=t,t=void 0);let i=Uh(this.Promise, +if(!be.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof e=="function") +return super.query(e,t,n);typeof t=="function"&&(n=t,t=void 0);let i=Fh(this.Promise, n);n=i.callback;try{let s=new Da.default(this.options),a=encodeURIComponent,u=encodeURI, c=`postgresql://${a(s.user)}:${a(s.password)}@${a(s.host)}/${u(s.database)}`,l=typeof e== -"string"?e:e.text,h=t??e.values??[];xe(c,{fullResults:!0,arrayMode:e.rowMode==="\ -array"})(l,h,{types:e.types??this.options?.types}).then(y=>n(void 0,y)).catch(y=>n( -y))}catch(s){n(s)}return i.result}};p();async function Ih(r){let e=Date.now(),t=await r();return[Date.now()-e,t]}o(Ih,"t\ -imed");async function nt(r,e,t=(n,i)=>{}){let n=[];for(let s=0;ss+a,0),n]}o(nt,"timedRepeat\ -s");async function vt(r,e){let{sql:t,test:n}=e,{rows:i}=await(typeof r=="functio\ +"string"?e:e.text,h=t??e.values??[];ve(c,{fullResults:!0,arrayMode:e.rowMode==="\ +array"})(l,h,{types:e.types??this.options?.types}).then(p=>n(void 0,p)).catch(p=>n( +p))}catch(s){n(s)}return i.result}};y();async function qh(r){let e=Date.now(),t=await r();return[Date.now()-e,t]}o(qh,"t\ +imed");async function st(r,e,t=(n,i)=>{}){let n=[];for(let s=0;ss+a,0),n]}o(st,"timedRepeat\ +s");async function Tt(r,e){let{sql:t,test:n}=e,{rows:i}=await(typeof r=="functio\ n"?r(t):r.query(t));if(!n(i))throw new Error(`Result fails test Query: ${t} -Result: ${JSON.stringify(i)}`);return i}o(vt,"runQuery");async function Ct(r,e,t,n){ -await e.connect();let i=await nt(r,()=>vt(e,n));return t.waitUntil(e.end()),i}o( -Ct,"clientRunQuery");async function _t(r,e,t,n){let i=new qe({connectionString:e}), -s=await nt(r,()=>vt(i,n));return t.waitUntil(i.end()),s}o(_t,"poolRunQuery");async function qa(r,e,t,n){ -let i=xe(e,{fullResults:!0});return await nt(r,()=>vt(i,n))}o(qa,"httpRunQuery");p();var Tt=[{sql:"SELECT * FROM employees LIMIT 10",test:o(r=>r.length>1&&typeof r[0]. +Result: ${JSON.stringify(i)}`);return i}o(Tt,"runQuery");async function Ut(r,e,t,n){ +await e.connect();let i=await st(r,()=>Tt(e,n));return t.waitUntil(e.end()),i}o( +Ut,"clientRunQuery");async function Lt(r,e,t,n){let i=new Oe({connectionString:e}), +s=await st(r,()=>Tt(i,n));return t.waitUntil(i.end()),s}o(Lt,"poolRunQuery");async function Fa(r,e,t,n){ +let i=ve(e,{fullResults:!0});return await st(r,()=>Tt(i,n))}o(Fa,"httpRunQuery");y();var It=[{sql:"SELECT * FROM employees LIMIT 10",test:o(r=>r.length>1&&typeof r[0]. first_name=="string","test")},{sql:"SELECT now()",test:o(r=>/^2\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d+Z$/. -test(r[0].now.toISOString()),"test")}];async function c0(r,e,t){let n=[];for(let i of Tt){let[,[[,s]]]=await _t(1,e.NEON_DB_URL, -t,i);n.push(s)}for(let i of Tt){let[,[[,s]]]=await qa(1,e.NEON_DB_URL,t,i);n.push( +test(r[0].now.toISOString()),"test")}];async function l0(r,e,t){let n=[];for(let i of It){let[,[[,s]]]=await Lt(1,e.NEON_DB_URL, +t,i);n.push(s)}for(let i of It){let[,[[,s]]]=await Fa(1,e.NEON_DB_URL,t,i);n.push( s)}return new Response(JSON.stringify(n,null,2),{headers:{"Content-Type":"applic\ -ation/json"}})}o(c0,"cf");var Re={waitUntil(r){},passThroughOnException(){}};async function Ph(r,e=(...t)=>{}){ -let t=xe(r.NEON_DB_URL),[[n],[i]]=await t.transaction([t`SELECT ${1}::int AS "batchInt"`, +ation/json"}})}o(l0,"cf");var De={waitUntil(r){},passThroughOnException(){}};async function kh(r,e=(...t)=>{}){ +let t=ve(r.NEON_DB_URL),[[n],[i]]=await t.transaction([t`SELECT ${1}::int AS "batchInt"`, t`SELECT ${"hello"} AS "batchStr"`]);if(e("batch results:",JSON.stringify(n),JSON. stringify(i),` `),n.batchInt!==1||i.batchStr!=="hello")throw new Error("Batch query problem");let[ -[s],[a]]=await t.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`,x`SELECT ${"h\ +[s],[a]]=await t.transaction(E=>[E`SELECT ${1}::int AS "batchInt"`,E`SELECT ${"h\ ello"} AS "batchStr"`]);if(e("batch results:",JSON.stringify(s),JSON.stringify(a), ` `),s.batchInt!==1||a.batchStr!=="hello")throw new Error("Batch query problem");let u=await t. -transaction(x=>[]);e("empty txn result:",JSON.stringify(u),` -`);let[[[c]],[[l]]]=await t.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`,x`SELECT ${"\ +transaction(E=>[]);e("empty txn result:",JSON.stringify(u),` +`);let[[[c]],[[l]]]=await t.transaction(E=>[E`SELECT ${1}::int AS "batchInt"`,E`SELECT ${"\ hello"} AS "batchStr"`],{arrayMode:!0,isolationLevel:"Serializable",readOnly:!0}); if(e("array mode (via transaction options) batch results:",JSON.stringify(c),JSON. stringify(l),` -`),c!==1||l!=="hello")throw new Error("Batch query problem");let h=xe(r.NEON_DB_URL, -{arrayMode:!0,isolationLevel:"RepeatableRead"}),[[[f]],[[y]]]=await h.transaction( -x=>[x`SELECT ${1}::int AS "batchInt"`,x`SELECT ${"hello"} AS "batchStr"`]);if(e( +`),c!==1||l!=="hello")throw new Error("Batch query problem");let h=ve(r.NEON_DB_URL, +{arrayMode:!0,isolationLevel:"RepeatableRead"}),[[[f]],[[p]]]=await h.transaction( +E=>[E`SELECT ${1}::int AS "batchInt"`,E`SELECT ${"hello"} AS "batchStr"`]);if(e( "array mode (via neon options) batch results:",JSON.stringify(f),JSON.stringify( -y),` -`),f!==1||y!=="hello")throw new Error("Batch query problem");let m=xe(r.NEON_DB_URL, -{arrayMode:!0}),[[b],[U]]=await m.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`, -x`SELECT ${"hello"} AS "batchStr"`],{arrayMode:!1});if(e("ordinary (via overridd\ -en options) batch results:",JSON.stringify(b),JSON.stringify(U),` -`),b.batchInt!==1||U.batchStr!=="hello")throw new Error("Batch query problem");let[ -[v],[C]]=await t.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`,x('SELECT $1 \ +p),` +`),f!==1||p!=="hello")throw new Error("Batch query problem");let m=ve(r.NEON_DB_URL, +{arrayMode:!0}),[[x],[L]]=await m.transaction(E=>[E`SELECT ${1}::int AS "batchInt"`, +E`SELECT ${"hello"} AS "batchStr"`],{arrayMode:!1});if(e("ordinary (via overridd\ +en options) batch results:",JSON.stringify(x),JSON.stringify(L),` +`),x.batchInt!==1||L.batchStr!=="hello")throw new Error("Batch query problem");let[ +[v],[C]]=await t.transaction(E=>[E`SELECT ${1}::int AS "batchInt"`,E('SELECT $1 \ AS "batchStr"',["hello"],{arrayMode:!0})]);if(e("query options on individual bat\ ch queries:",JSON.stringify(v),JSON.stringify(C),` -`),v.batchInt!==1||C[0]!=="hello")throw new Error("Batch query problem");let E;try{ -await t.transaction(x=>[x`SELECT ${1}::int AS "batchInt"`,`SELECT 'hello' AS "ba\ -tchStr"`])}catch(x){E=x}if(E===void 0)throw new Error("Error should have been ra\ +`),v.batchInt!==1||C[0]!=="hello")throw new Error("Batch query problem");let b;try{ +await t.transaction(E=>[E`SELECT ${1}::int AS "batchInt"`,`SELECT 'hello' AS "ba\ +tchStr"`])}catch(E){b=E}if(b===void 0)throw new Error("Error should have been ra\ ised for string passed to `transaction()`");e("successfully caught invalid query\ - passed to `transaction()`\n");let g;try{let x=r.NEON_DB_URL.replace(/@/,"x@");await xe( -x).transaction(N=>[N`SELECT 'never' AS this_should_be_seen_precisely`])}catch(x){ -g=x}if(g===void 0)throw new Error("Error should have been raised for bad passwor\ -d");e("successfully caught invalid password passed to `neon()`\n")}o(Ph,"batchQu\ -eryTest");async function l0(r,e,t=(...n)=>{}){let n=[1,3],i=9;t(`Warm-up ... + passed to `transaction()`\n");let g;try{let E=r.NEON_DB_URL.replace(/@/,"x@");await ve( +E).transaction(M=>[M`SELECT 'never' AS this_should_be_seen_precisely`])}catch(E){ +g=E}if(g===void 0)throw new Error("Error should have been raised for bad passwor\ +d");e("successfully caught invalid password passed to `neon()`\n")}o(kh,"batchQu\ +eryTest");async function h0(r,e,t=(...n)=>{}){let n=[1,3],i=9;t(`Warm-up ... -`),await _t(1,r.NEON_DB_URL,Re,Tt[0]);let s=0;t(` +`),await Lt(1,r.NEON_DB_URL,De,It[0]);let s=0;t(` ===== SQL-over-HTTP tests ===== -`);let a=new Set(["command","rowCount","rows","fields"]),u=await new qe({connectionString:r. -NEON_DB_URL}),c=xe(r.NEON_DB_URL,{resultCallback:o(async(m,b,U,v)=>{let C=await u. -query({text:m.query,values:m.params,...v.arrayMode?{rowMode:"array"}:{}}),E=b.command=== -C.command,g=b.rowCount===C.rowCount,x=Lr(b.fields.map(D=>D.dataTypeID),C.fields. -map(D=>D.dataTypeID)),N=Lr(U,C.rows);t(E&&g&&N&&x?"\u2713":"X",JSON.stringify(m), +`);let a=new Set(["command","rowCount","rows","fields"]),u=await new Oe({connectionString:r. +NEON_DB_URL}),c=ve(r.NEON_DB_URL,{resultCallback:o(async(m,x,L,v)=>{let C=await u. +query({text:m.query,values:m.params,...v.arrayMode?{rowMode:"array"}:{}}),b=x.command=== +C.command,g=x.rowCount===C.rowCount,E=Ir(x.fields.map(F=>F.dataTypeID),C.fields. +map(F=>F.dataTypeID)),M=Ir(L,C.rows);t(b&&g&&M&&E?"\u2713":"X",JSON.stringify(m), ` - -> us:`,JSON.stringify(U),` + -> us:`,JSON.stringify(L),` -> pg:`,JSON.stringify(C.rows),` `)},"resultCallback")}),l=new Date;await c`SELECT ${1} AS int_uncast`,await c`SELECT ${1}::int AS int`, await c`SELECT ${1}::int8 AS int8num`,await c`SELECT ${1}::decimal AS decimalnum`, @@ -2190,49 +2244,49 @@ ULL"} AS null_str`,await c`SELECT ${[1,2,3]} AS arrnum_uncast`,await c`SELECT ${ [2],[4]]} AS arrnumnested_uncast`,await c`SELECT ${l} AS timenow_uncast`,await c`SELECT ${l}::timestamp AS timestampnow`, await c("SELECT $1::timestamp AS timestampnow",[l]),await c("SELECT $1 || ' ' ||\ $2 AS greeting",["hello","world"]),await c("SELECT 123 AS num"),await c("SELECT\ - 123 AS num",[],{arrayMode:!0,fullResults:!0});function h(m,b,U=3){return async function(v,...C){ -let E="";for(let g=0;gx.abort("fetch timed out"),b);try{let{ -signal:P}=x;return await m(E,C,{fetchOptions:{signal:P}})}catch(P){if(!(P.sourceError&& -P.sourceError instanceof DOMException&&P.sourceError.name==="AbortError")||g>=U) -throw P}finally{clearTimeout(N)}}}}o(h,"sqlWithRetries"),await h(c,5e3)`SELECT ${"\ -did this time out?"} AS str`,await Ph(r,t),ge.fetchFunction=(m,b)=>(console.log( -"custom fetch:",m,b),fetch(m,b)),await c`SELECT ${"customFetch"} AS str`;let y="\ -SELECT 123::int[] WHERE x";try{await c(y)}catch(m){console.log("Fields of this e\ + 123 AS num",[],{arrayMode:!0,fullResults:!0});function h(m,x,L=3){return async function(v,...C){ +let b="";for(let g=0;gE.abort("fetch timed out"),x);try{let{ +signal:B}=E;return await m(b,C,{fetchOptions:{signal:B}})}catch(B){if(!(B.sourceError&& +B.sourceError instanceof DOMException&&B.sourceError.name==="AbortError")||g>=L) +throw B}finally{clearTimeout(M)}}}}o(h,"sqlWithRetries"),await h(c,5e3)`SELECT ${"\ +did this time out?"} AS str`,await kh(r,t),be.fetchFunction=(m,x)=>(console.log( +"custom fetch:",m,x),fetch(m,x)),await c`SELECT ${"customFetch"} AS str`;let p="\ +SELECT 123::int[] WHERE x";try{await c(p)}catch(m){console.log("Fields of this e\ xpected error should match the following error, except for having no `length` fi\ -eld"),console.log(m)}try{await _t(1,r.NEON_DB_URL,Re,{sql:y,test:o(()=>!0,"test")})}catch(m){ +eld"),console.log(m)}try{await Lt(1,r.NEON_DB_URL,De,{sql:p,test:o(()=>!0,"test")})}catch(m){ console.log("Fields of this expected error should match the previous error, exce\ pt for having an additional `length` field"),console.log(m)}await new Promise(m=>setTimeout( m,1e3)),u.end(),t(` ===== Pool/Client tests ===== -`);for(let m of Tt){t(` +`);for(let m of It){t(` ----- ${m.sql} ----- -`);async function b(v,C){let E=String.fromCharCode(s+(s>25?23:65));t(`${E} -`);try{await fetch(`http://localhost:443/${E}`)}catch{}t('Liv\ -e: ');let[,g]=await nt(i,()=>C(v),x=>t(`${x.toFixed()}\ +`);async function x(v,C){let b=String.fromCharCode(s+(s>25?23:65));t(`${b} +`);try{await fetch(`http://localhost:443/${b}`)}catch{}t('Liv\ +e: ');let[,g]=await st(i,()=>C(v),E=>t(`${E.toFixed()}\ ms `));t(` -Sorted: `),g.map(([x])=>x).sort((x,N)=>x-N).forEach((x,N)=>{t(N===(i-1)/2?`${x.toFixed()}ms `:`${x.toFixed()}ms `)}),t(` +Sorted: `),g.map(([E])=>E).sort((E,M)=>E-M).forEach((E,M)=>{t(M===(i-1)/2?`${E.toFixed()}ms `:`${E.toFixed()}ms `)}),t(` -`),s+=1}o(b,"section");async function U(v,C){t(`----- ${v} ----- +`),s+=1}o(x,"section");async function L(v,C){t(`----- ${v} ----- -`);for(let E of n)t(`${E} quer${E===1?"y":"ies"} \u2013 `),await b(E,C)}o(U,"sec\ -tions"),await U("Neon/wss, no pipelining",async v=>{let C=new Be(r.NEON_DB_URL); -C.neonConfig.pipelineConnect=!1,await Ct(v,C,Re,m)}),await U("Neon/wss, pipeline\ -d connect (default)",async v=>{let C=new Be(r.NEON_DB_URL);await Ct(v,C,Re,m)}), -await U("Neon/wss, pipelined connect, no coalescing",async v=>{let C=new Be(r.NEON_DB_URL); -C.neonConfig.coalesceWrites=!1,await Ct(v,C,Re,m)}),await U("Neon/wss, pipelined\ - connect using Pool.query",async v=>{await _t(v,r.NEON_DB_URL,Re,m)}),await U("N\ -eon/wss, pipelined connect using Pool.connect",async v=>{let C=new qe({connectionString:r. -NEON_DB_URL}),E=await C.connect();await nt(v,()=>vt(E,m)),E.release(),Re.waitUntil( -C.end())}),e&&(ge.subtls=Tr,ge.rootCerts=bi,await U("pg/subtls, pipelined connec\ -t",async v=>{let C=new Be(r.NEON_DB_URL);C.neonConfig.wsProxy=(E,g)=>`subtls-wsp\ -roxy.jawj.workers.dev/?address=${E}:${g}`,C.neonConfig.forceDisablePgSSL=C.neonConfig. +`);for(let b of n)t(`${b} quer${b===1?"y":"ies"} \u2013 `),await x(b,C)}o(L,"sec\ +tions"),await L("Neon/wss, no pipelining",async v=>{let C=new Me(r.NEON_DB_URL); +C.neonConfig.pipelineConnect=!1,await Ut(v,C,De,m)}),await L("Neon/wss, pipeline\ +d connect (default)",async v=>{let C=new Me(r.NEON_DB_URL);await Ut(v,C,De,m)}), +await L("Neon/wss, pipelined connect, no coalescing",async v=>{let C=new Me(r.NEON_DB_URL); +C.neonConfig.coalesceWrites=!1,await Ut(v,C,De,m)}),await L("Neon/wss, pipelined\ + connect using Pool.query",async v=>{await Lt(v,r.NEON_DB_URL,De,m)}),await L("N\ +eon/wss, pipelined connect using Pool.connect",async v=>{let C=new Oe({connectionString:r. +NEON_DB_URL}),b=await C.connect();await st(v,()=>Tt(b,m)),b.release(),De.waitUntil( +C.end())}),e&&(be.subtls=Lr,be.rootCerts=Ai,await L("pg/subtls, pipelined connec\ +t",async v=>{let C=new Me(r.NEON_DB_URL);C.neonConfig.wsProxy=(b,g)=>`subtls-wsp\ +roxy.jawj.workers.dev/?address=${b}:${g}`,C.neonConfig.forceDisablePgSSL=C.neonConfig. useSecureWebSocket=!1,C.neonConfig.pipelineTLS=!1,C.neonConfig.pipelineConnect=!1; -try{await Ct(v,C,Re,m)}catch(E){console.error(` -*** ${E.message}`)}}))}}o(l0,"latencies");export{Ph as batchQueryTest,c0 as cf,l0 as latencies,ge as neonConfig}; +try{await Ut(v,C,De,m)}catch(b){console.error(` +*** ${b.message}`)}}))}}o(h0,"latencies");export{kh as batchQueryTest,l0 as cf,h0 as latencies,be as neonConfig}; /*! Bundled license information: ieee754/index.js: diff --git a/export/httpQuery.ts b/export/httpQuery.ts index 57c18a1..57ffba8 100644 --- a/export/httpQuery.ts +++ b/export/httpQuery.ts @@ -41,7 +41,10 @@ export class NeonDbError extends Error { constructor(message: string) { super(message); - if ('captureStackTrace' in Error && typeof Error.captureStackTrace === 'function') { + if ( + 'captureStackTrace' in Error && + typeof Error.captureStackTrace === 'function' + ) { Error.captureStackTrace(this, NeonDbError); } } @@ -60,7 +63,12 @@ interface HTTPQueryOptions { // these callback options are not currently exported: queryCallback?: (query: ParameterizedQuery) => void; - resultCallback?: (query: ParameterizedQuery, result: any, rows: any, opts: any) => void; + resultCallback?: ( + query: ParameterizedQuery, + result: any, + rows: any, + opts: any, + ) => void; // JWT auth token to be passed as the Bearer token in the Authorization // header @@ -69,7 +77,11 @@ interface HTTPQueryOptions { interface HTTPTransactionOptions extends HTTPQueryOptions { // note that ReadUncommitted is really ReadCommitted in Postgres: https://www.postgresql.org/docs/current/transaction-iso.html - isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; + isolationLevel?: + | 'ReadUncommitted' + | 'ReadCommitted' + | 'RepeatableRead' + | 'Serializable'; readOnly?: boolean; deferrable?: boolean; } @@ -87,7 +99,8 @@ interface ProcessQueryResultOptions { types?: typeof defaultTypes; } -const txnArgErrMsg = 'transaction() expects an array of queries, or a function returning an array of queries'; +const txnArgErrMsg = + 'transaction() expects an array of queries, or a function returning an array of queries'; const errorFields = [ 'severity', 'code', @@ -157,14 +170,22 @@ export function neon( } const { protocol, username, hostname, port, pathname } = db; - if ((protocol !== 'postgres:' && protocol !== 'postgresql:') || !username || !hostname || !pathname) { + if ( + (protocol !== 'postgres:' && protocol !== 'postgresql:') || + !username || + !hostname || + !pathname + ) { throw new Error( 'Database connection string format for `neon()` should be: postgresql://user:password@host.tld/dbname?option=value', ); } // resolve query, params and opts - function resolve(strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise { + function resolve( + strings: TemplateStringsArray | string, + ...params: any[] + ): NeonQueryPromise { let query; let queryOpts: HTTPQueryOptions | undefined; @@ -194,17 +215,27 @@ export function neon( } resolve.transaction = async ( - queries: NeonQueryPromise[] | ((sql: (strings: TemplateStringsArray | string, ...params: any[]) => NeonQueryPromise) => NeonQueryPromise[]), + queries: + | NeonQueryPromise[] + | (( + sql: ( + strings: TemplateStringsArray | string, + ...params: any[] + ) => NeonQueryPromise, + ) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions, ) => { if (typeof queries === 'function') queries = queries(resolve); if (!Array.isArray(queries)) throw new Error(txnArgErrMsg); queries.forEach((query) => { - if (query[Symbol.toStringTag] !== 'NeonQueryPromise') throw new Error(txnArgErrMsg); + if (query[Symbol.toStringTag] !== 'NeonQueryPromise') + throw new Error(txnArgErrMsg); }); - const parameterizedQueries = queries.map((query) => (query as NeonQueryPromise).parameterizedQuery); + const parameterizedQueries = queries.map( + (query) => (query as NeonQueryPromise).parameterizedQuery, + ); const opts = queries.map((query) => (query as NeonQueryPromise).opts ?? {}); return execute(parameterizedQueries, opts, txnOpts); }; @@ -217,7 +248,9 @@ export function neon( ) { const { fetchEndpoint, fetchFunction } = Socket; - const bodyData = Array.isArray(parameterizedQuery) ? { queries: parameterizedQuery } : parameterizedQuery; + const bodyData = Array.isArray(parameterizedQuery) + ? { queries: parameterizedQuery } + : parameterizedQuery; // --- resolve options to transaction level --- @@ -235,15 +268,23 @@ export function neon( ...resolvedFetchOptions, ...txnOpts.fetchOptions, }; - if (txnOpts.arrayMode !== undefined) resolvedArrayMode = txnOpts.arrayMode; - if (txnOpts.fullResults !== undefined) resolvedFullResults = txnOpts.fullResults; - if (txnOpts.isolationLevel !== undefined) resolvedIsolationLevel = txnOpts.isolationLevel; + if (txnOpts.arrayMode !== undefined) + resolvedArrayMode = txnOpts.arrayMode; + if (txnOpts.fullResults !== undefined) + resolvedFullResults = txnOpts.fullResults; + if (txnOpts.isolationLevel !== undefined) + resolvedIsolationLevel = txnOpts.isolationLevel; if (txnOpts.readOnly !== undefined) resolvedReadOnly = txnOpts.readOnly; - if (txnOpts.deferrable !== undefined) resolvedDeferrable = txnOpts.deferrable; + if (txnOpts.deferrable !== undefined) + resolvedDeferrable = txnOpts.deferrable; } // single query -- cannot be true at same time as `txnOpts !== undefined` above - if (allSqlOpts !== undefined && !Array.isArray(allSqlOpts) && allSqlOpts.fetchOptions !== undefined) { + if ( + allSqlOpts !== undefined && + !Array.isArray(allSqlOpts) && + allSqlOpts.fetchOptions !== undefined + ) { resolvedFetchOptions = { ...resolvedFetchOptions, ...allSqlOpts.fetchOptions, @@ -281,8 +322,10 @@ export function neon( // only send these headers for batch queries, where they matter if (resolvedIsolationLevel !== undefined) headers['Neon-Batch-Isolation-Level'] = resolvedIsolationLevel; - if (resolvedReadOnly !== undefined) headers['Neon-Batch-Read-Only'] = String(resolvedReadOnly); - if (resolvedDeferrable !== undefined) headers['Neon-Batch-Deferrable'] = String(resolvedDeferrable); + if (resolvedReadOnly !== undefined) + headers['Neon-Batch-Read-Only'] = String(resolvedReadOnly); + if (resolvedDeferrable !== undefined) + headers['Neon-Batch-Deferrable'] = String(resolvedDeferrable); } // --- run query --- @@ -296,7 +339,9 @@ export function neon( ...resolvedFetchOptions, // this is last, so it gets the final say }); } catch (err: any) { - const connectErr = new NeonDbError(`Error connecting to database: ${err}`); + const connectErr = new NeonDbError( + `Error connecting to database: ${err}`, + ); connectErr.sourceError = err; throw connectErr; } @@ -308,7 +353,9 @@ export function neon( // batch query const resultArray = rawResults.results; if (!Array.isArray(resultArray)) - throw new NeonDbError('Neon internal error: unexpected result format'); + throw new NeonDbError( + 'Neon internal error: unexpected result format', + ); return resultArray.map((result, i) => { let sqlOpts = (allSqlOpts as HTTPQueryOptions[])[i] ?? {}; let arrayMode = sqlOpts.arrayMode ?? resolvedArrayMode; @@ -339,7 +386,8 @@ export function neon( if (status === 400) { const json = (await response.json()) as any; const dbError = new NeonDbError(json.message); - for (const field of errorFields) dbError[field] = json[field] ?? undefined; + for (const field of errorFields) + dbError[field] = json[field] ?? undefined; throw dbError; } else { const text = await response.text(); @@ -360,9 +408,11 @@ function createNeonQueryPromise( [Symbol.toStringTag]: 'NeonQueryPromise', parameterizedQuery, opts, - then: (resolve, reject) => execute(parameterizedQuery, opts).then(resolve, reject), + then: (resolve, reject) => + execute(parameterizedQuery, opts).then(resolve, reject), catch: (reject) => execute(parameterizedQuery, opts).catch(reject), - finally: (finallyFn) => execute(parameterizedQuery, opts).finally(finallyFn), + finally: (finallyFn) => + execute(parameterizedQuery, opts).finally(finallyFn), } as NeonQueryPromise; } @@ -378,19 +428,26 @@ function processQueryResult( ) { const types = new TypeOverrides(customTypes); const colNames = rawResults.fields.map((field: any) => field.name); - const parsers = rawResults.fields.map((field: any) => types.getTypeParser(field.dataTypeID)); + const parsers = rawResults.fields.map((field: any) => + types.getTypeParser(field.dataTypeID), + ); // now parse and possibly restructure the rows data like node-postgres does const rows = arrayMode === true ? // maintain array-of-arrays structure rawResults.rows.map((row: any) => - row.map((col: any, i: number) => (col === null ? null : parsers[i](col))), + row.map((col: any, i: number) => + col === null ? null : parsers[i](col), + ), ) : // turn into an object rawResults.rows.map((row: any) => { return Object.fromEntries( - row.map((col: any, i: number) => [colNames[i], col === null ? null : parsers[i](col)]), + row.map((col: any, i: number) => [ + colNames[i], + col === null ? null : parsers[i](col), + ]), ); }); diff --git a/export/index.ts b/export/index.ts index f0b2e63..ea9ea98 100644 --- a/export/index.ts +++ b/export/index.ts @@ -117,7 +117,9 @@ class NeonClient extends Client { con.removeAllListeners('authenticationCleartextPassword'); con.removeAllListeners('readyForQuery'); - con.once('readyForQuery', () => con.on('readyForQuery', this._handleReadyForQuery.bind(this))); + con.once('readyForQuery', () => + con.on('readyForQuery', this._handleReadyForQuery.bind(this)), + ); const connectEvent = this.ssl ? 'sslconnect' : 'connect'; con.on(connectEvent, () => { @@ -143,7 +145,8 @@ class NeonClient extends Client { const attrPairs = Object.fromEntries( serverData.split(',').map((attrValue) => { - if (!/^.=/.test(attrValue)) throw new Error('SASL: Invalid attribute pair entry'); + if (!/^.=/.test(attrValue)) + throw new Error('SASL: Invalid attribute pair entry'); const name = attrValue[0]; const value = attrValue.substring(2); return [name, value]; @@ -155,15 +158,30 @@ class NeonClient extends Client { const iterationText = attrPairs.i; if (!nonce || !/^[!-+--~]+$/.test(nonce)) - throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable'); - if (!salt || !/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(salt)) - throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base64'); + throw new Error( + 'SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable', + ); + if ( + !salt || + !/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test( + salt, + ) + ) + throw new Error( + 'SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base64', + ); if (!iterationText || !/^[1-9][0-9]*$/.test(iterationText)) - throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: missing/invalid iteration count'); + throw new Error( + 'SASL: SCRAM-SERVER-FIRST-MESSAGE: missing/invalid iteration count', + ); if (!nonce.startsWith(session.clientNonce)) - throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce'); + throw new Error( + 'SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce', + ); if (nonce.length === session.clientNonce.length) - throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short'); + throw new Error( + 'SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short', + ); const iterations = parseInt(iterationText, 10); const saltBytes = Buffer.from(salt, 'base64'); @@ -177,7 +195,11 @@ class NeonClient extends Client { ['sign'], ); let ui1 = new Uint8Array( - await crypto.subtle.sign('HMAC', iterHmacKey, Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])])), + await crypto.subtle.sign( + 'HMAC', + iterHmacKey, + Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])]), + ), ); let ui = ui1; for (var i = 0; i < iterations - 1; i++) { @@ -193,14 +215,20 @@ class NeonClient extends Client { false, ['sign'], ); - const clientKey = new Uint8Array(await crypto.subtle.sign('HMAC', ckHmacKey, enc.encode('Client Key'))); + const clientKey = new Uint8Array( + await crypto.subtle.sign('HMAC', ckHmacKey, enc.encode('Client Key')), + ); const storedKey = await crypto.subtle.digest('SHA-256', clientKey); const clientFirstMessageBare = 'n=*,r=' + session.clientNonce; const serverFirstMessage = 'r=' + nonce + ',s=' + salt + ',i=' + iterations; const clientFinalMessageWithoutProof = 'c=biws,r=' + nonce; const authMessage = - clientFirstMessageBare + ',' + serverFirstMessage + ',' + clientFinalMessageWithoutProof; + clientFirstMessageBare + + ',' + + serverFirstMessage + + ',' + + clientFinalMessageWithoutProof; const csHmacKey = await crypto.subtle.importKey( 'raw', @@ -212,7 +240,9 @@ class NeonClient extends Client { var clientSignature = new Uint8Array( await crypto.subtle.sign('HMAC', csHmacKey, enc.encode(authMessage)), ); - var clientProofBytes = Buffer.from(clientKey.map((_, i) => clientKey[i] ^ clientSignature[i])); + var clientProofBytes = Buffer.from( + clientKey.map((_, i) => clientKey[i] ^ clientSignature[i]), + ); var clientProof = clientProofBytes.toString('base64'); const skHmacKey = await crypto.subtle.importKey( @@ -222,7 +252,11 @@ class NeonClient extends Client { false, ['sign'], ); - const serverKey = await crypto.subtle.sign('HMAC', skHmacKey, enc.encode('Server Key')); + const serverKey = await crypto.subtle.sign( + 'HMAC', + skHmacKey, + enc.encode('Server Key'), + ); const ssbHmacKey = await crypto.subtle.importKey( 'raw', serverKey, @@ -260,7 +294,10 @@ class NeonPool extends Pool { Client = NeonClient; hasFetchUnsupportedListeners = false; - on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any) { + on( + event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', + listener: any, + ) { if (event !== 'error') this.hasFetchUnsupportedListeners = true; return super.on(event as any, listener); } @@ -313,6 +350,19 @@ class NeonPool extends Pool { } } -export { Socket as neonConfig, NeonPool as Pool, NeonClient as Client, neon, NeonDbError }; - -export { Connection, DatabaseError, Query, ClientBase, defaults, types } from 'pg'; +export { + Socket as neonConfig, + NeonPool as Pool, + NeonClient as Client, + neon, + NeonDbError, +}; + +export { + Connection, + DatabaseError, + Query, + ClientBase, + defaults, + types, +} from 'pg'; diff --git a/export/neonConfig.ts b/export/neonConfig.ts index 9c3ed4d..9dc40cc 100644 --- a/export/neonConfig.ts +++ b/export/neonConfig.ts @@ -60,7 +60,10 @@ export interface NeonConfigGlobalAndClient { * * Default: `host => host + '/v2'` */ - wsProxy: string | ((host: string, port: number | string) => string) | undefined; + wsProxy: + | string + | ((host: string, port: number | string) => string) + | undefined; /** * Use a secure (`wss:`) connection to the WebSocket proxy. @@ -141,4 +144,6 @@ export interface NeonConfigGlobalAndClient { disableSNI: boolean; } -export interface NeonConfig extends NeonConfigGlobalOnly, NeonConfigGlobalAndClient {} +export interface NeonConfig + extends NeonConfigGlobalOnly, + NeonConfigGlobalAndClient {} diff --git a/shims/crypto/index.ts b/shims/crypto/index.ts index de4b069..86d4b8b 100644 --- a/shims/crypto/index.ts +++ b/shims/crypto/index.ts @@ -24,7 +24,9 @@ export function createHash(type: 'sha256') { update: function (data: string | Buffer | Uint8Array) { return { digest: function () { - return typeof data === 'string' ? Md5.hashStr(data) : Md5.hashByteArray(data); + return typeof data === 'string' + ? Md5.hashStr(data) + : Md5.hashByteArray(data); }, }; }, @@ -33,7 +35,8 @@ export function createHash(type: 'sha256') { } export function createHmac(type: 'sha256', key: string | Buffer | Uint8Array) { - if (type !== 'sha256') throw new Error(`Only sha256 is supported (requested: '${type}')`); + if (type !== 'sha256') + throw new Error(`Only sha256 is supported (requested: '${type}')`); return { update: function (data: string | Buffer | Uint8Array) { return { @@ -54,8 +57,8 @@ export function createHmac(type: 'sha256', key: string | Buffer | Uint8Array) { const innerKey = new Uint8Array(64); const outerKey = new Uint8Array(64); for (let i = 0; i < 64; i++) { - innerKey[i] = 0x36 ^ key[i] as number; // cast should be unnecessary but dts-bundle-generator appears to need it - outerKey[i] = 0x5c ^ key[i] as number; // ditto + innerKey[i] = 0x36 ^ (key[i] as number); // cast should be unnecessary but dts-bundle-generator appears to need it + outerKey[i] = 0x5c ^ (key[i] as number); // ditto } const msg = new Uint8Array(data.length + 64); @@ -167,8 +170,12 @@ export class Md5 { return this.onePassHasher.start().appendAsciiStr(str).end(raw); } // Private Static Variables - private static stateIdentity = new Int32Array([1732584193, -271733879, -1732584194, 271733878]); - private static buffer32Identity = new Int32Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + private static stateIdentity = new Int32Array([ + 1732584193, -271733879, -1732584194, 271733878, + ]); + private static buffer32Identity = new Int32Array([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ]); private static hexChars = '0123456789abcdef'; private static hexOut: string[] = []; @@ -196,7 +203,10 @@ export class Md5 { return ho.join(''); } - private static _md5cycle(x: Int32Array | Uint32Array, k: Int32Array | Uint32Array) { + private static _md5cycle( + x: Int32Array | Uint32Array, + k: Int32Array | Uint32Array, + ) { let a = x[0]; let b = x[1]; let c = x[2]; @@ -391,9 +401,12 @@ export class Md5 { buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; buf8[bufLen++] = (code & 0x3f) | 0x80; } else { - code = (code - 0xd800) * 0x400 + (str.charCodeAt(++i) - 0xdc00) + 0x10000; + code = + (code - 0xd800) * 0x400 + (str.charCodeAt(++i) - 0xdc00) + 0x10000; if (code > 0x10ffff) { - throw new Error('Unicode standard supports code points up to U+10FFFF'); + throw new Error( + 'Unicode standard supports code points up to U+10FFFF', + ); } buf8[bufLen++] = (code >>> 18) + 0xf0; buf8[bufLen++] = ((code >>> 12) & 0x3f) | 0x80; @@ -550,7 +563,6 @@ export class Md5 { // throw new Error('Md5 self test failed.'); // } - /* Copyright 2022 Andrea Griffini @@ -595,21 +607,25 @@ export function sha256( tsz = 0, bp = 0; const k = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, + 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, + 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, + 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, + 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, ], rrot = (x: number, n: number) => (x >>> n) | (x << (32 - n)), w = new Uint32Array(64), buf = new Uint8Array(64), process = () => { for (let j = 0, r = 0; j < 16; j++, r += 4) { - w[j] = (buf[r] << 24) | (buf[r + 1] << 16) | (buf[r + 2] << 8) | buf[r + 3]; + w[j] = + (buf[r] << 24) | (buf[r + 1] << 16) | (buf[r + 2] << 8) | buf[r + 3]; } for (let j = 16; j < 64; j++) { let s0 = rrot(w[j - 15], 7) ^ rrot(w[j - 15], 18) ^ (w[j - 15] >>> 3); diff --git a/shims/net/index.ts b/shims/net/index.ts index 931b0e3..6612e82 100644 --- a/shims/net/index.ts +++ b/shims/net/index.ts @@ -13,7 +13,7 @@ declare global { const debug: boolean; // e.g. --define:debug=false in esbuild command interface WebSocket { binaryType: 'arraybuffer' | 'blob'; // oddly not included in Cloudflare types - accept?: () => void; // available in Cloudflare + accept?: () => void; // available in Cloudflare } interface Response { webSocket: WebSocket; @@ -30,7 +30,10 @@ enum TlsState { function hexDump(data: Uint8Array) { return ( `${data.length} bytes` + - data.reduce((memo, byte) => memo + ' ' + byte.toString(16).padStart(2, '0'), '\nhex:') + + data.reduce( + (memo, byte) => memo + ' ' + byte.toString(16).padStart(2, '0'), + '\nhex:', + ) + '\nstr: ' + new TextDecoder().decode(data) ); @@ -60,7 +63,13 @@ interface FetchEndpointOptions { export interface SocketDefaults { // these options relate to the fetch transport and take effect *only* when set globally poolQueryViaFetch: boolean; - fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchEndpoint: + | string + | (( + host: string, + port: number | string, + options?: FetchEndpointOptions, + ) => string); fetchConnectionCache: boolean; fetchFunction: any; // these options relate to the WebSocket transport @@ -76,7 +85,11 @@ export interface SocketDefaults { pipelineTLS: boolean; disableSNI: boolean; } -type GlobalOnlyDefaults = 'poolQueryViaFetch' | 'fetchEndpoint' | 'fetchConnectionCache' | 'fetchFunction'; +type GlobalOnlyDefaults = + | 'poolQueryViaFetch' + | 'fetchEndpoint' + | 'fetchConnectionCache' + | 'fetchFunction'; const FIRST_WORD_REGEX = /^[^.]+\./; @@ -133,8 +146,12 @@ export class Socket extends EventEmitter { static get fetchConnectionCache() { return true; } - static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']) { - console.warn('The `fetchConnectionCache` option is deprecated (now always `true`)'); + static set fetchConnectionCache( + newValue: SocketDefaults['fetchConnectionCache'], + ) { + console.warn( + 'The `fetchConnectionCache` option is deprecated (now always `true`)', + ); } static get fetchFunction() { @@ -145,9 +162,13 @@ export class Socket extends EventEmitter { } static get webSocketConstructor() { - return Socket.opts.webSocketConstructor ?? Socket.defaults.webSocketConstructor; + return ( + Socket.opts.webSocketConstructor ?? Socket.defaults.webSocketConstructor + ); } - static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']) { + static set webSocketConstructor( + newValue: SocketDefaults['webSocketConstructor'], + ) { Socket.opts.webSocketConstructor = newValue; } get webSocketConstructor() { @@ -186,7 +207,9 @@ export class Socket extends EventEmitter { static get useSecureWebSocket() { return Socket.opts.useSecureWebSocket ?? Socket.defaults.useSecureWebSocket; } - static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']) { + static set useSecureWebSocket( + newValue: SocketDefaults['useSecureWebSocket'], + ) { Socket.opts.useSecureWebSocket = newValue; } get useSecureWebSocket() { @@ -281,7 +304,9 @@ export class Socket extends EventEmitter { `No WebSocket proxy is configured. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#wsproxy-string--host-string-port-number--string--string`, ); } - return typeof wsProxy === 'function' ? wsProxy(host, port) : `${wsProxy}?address=${host}:${port}`; + return typeof wsProxy === 'function' + ? wsProxy(host, port) + : `${wsProxy}?address=${host}:${port}`; } connecting = false; @@ -355,7 +380,10 @@ export class Socket extends EventEmitter { let wsAddr: string; try { - wsAddr = this.wsProxyAddrForHost(host, typeof port === 'string' ? parseInt(port, 10) : port); + wsAddr = this.wsProxyAddrForHost( + host, + typeof port === 'string' ? parseInt(port, 10) : port, + ); } catch (err) { this.emit('error', err); this.emit('close'); @@ -396,7 +424,7 @@ export class Socket extends EventEmitter { this.ws = resp.webSocket; if (this.ws == null) throw err; // deliberate loose equality - this.ws.accept!(); // if we're here, then there's an accept method + this.ws.accept!(); // if we're here, then there's an accept method configureWebSocket(this.ws, true); debug && log('Cloudflare WebSocket opened'); }) @@ -427,10 +455,16 @@ export class Socket extends EventEmitter { const networkRead = readQueue.read.bind(readQueue); const networkWrite = this.rawWrite.bind(this); - const [tlsRead, tlsWrite] = await this.subtls.startTls(host, rootCerts, networkRead, networkWrite, { - useSNI: !this.disableSNI, - expectPreData: this.pipelineTLS ? new Uint8Array([0x53]) : undefined, // expect (and discard) an 'S' before the TLS response if pipelineTLS is set - }); + const [tlsRead, tlsWrite] = await this.subtls.startTls( + host, + rootCerts, + networkRead, + networkWrite, + { + useSNI: !this.disableSNI, + expectPreData: this.pipelineTLS ? new Uint8Array([0x53]) : undefined, // expect (and discard) an 'S' before the TLS response if pipelineTLS is set + }, + ); this.tlsRead = tlsRead; this.tlsWrite = tlsWrite; @@ -481,13 +515,18 @@ export class Socket extends EventEmitter { } } - write(data: Buffer | string, encoding = 'utf8', callback = (err?: any) => {}) { + write( + data: Buffer | string, + encoding = 'utf8', + callback = (err?: any) => {}, + ) { if (data.length === 0) { callback(); return true; } - if (typeof data === 'string') data = Buffer.from(data, encoding as BufferEncoding) as unknown as Buffer; + if (typeof data === 'string') + data = Buffer.from(data, encoding as BufferEncoding) as unknown as Buffer; if (this.tlsState === TlsState.None) { debug && log('sending data direct:', data); @@ -508,7 +547,11 @@ export class Socket extends EventEmitter { return true; } - end(data: Buffer | string = Buffer.alloc(0) as unknown as Buffer, encoding = 'utf8', callback = () => {}) { + end( + data: Buffer | string = Buffer.alloc(0) as unknown as Buffer, + encoding = 'utf8', + callback = () => {}, + ) { debug && log('ending socket'); this.write(data, encoding, () => { this.ws!.close(); diff --git a/shims/shims.js b/shims/shims.js index f269a5d..2d5974f 100644 --- a/shims/shims.js +++ b/shims/shims.js @@ -1,7 +1,9 @@ export const global = globalThis; -export const setImmediate = globalThis.setImmediate ?? ((fn) => setTimeout(fn, 0)); -export const clearImmediate = globalThis.clearImmediate ?? ((id) => clearTimeout(id)); +export const setImmediate = + globalThis.setImmediate ?? ((fn) => setTimeout(fn, 0)); +export const clearImmediate = + globalThis.clearImmediate ?? ((id) => clearTimeout(id)); export const crypto = globalThis.crypto ?? {}; crypto.subtle ??= {}; @@ -10,7 +12,8 @@ crypto.subtle ??= {}; // Next.js has a booby-trapped Buffer object that just springs errors, so we test allocUnsafe as well export const Buffer = - typeof globalThis.Buffer === 'function' && typeof globalThis.Buffer.allocUnsafe === 'function' + typeof globalThis.Buffer === 'function' && + typeof globalThis.Buffer.allocUnsafe === 'function' ? globalThis.Buffer : require('buffer/').Buffer; diff --git a/shims/tls/index.ts b/shims/tls/index.ts index 1ae22e3..04bbb14 100644 --- a/shims/tls/index.ts +++ b/shims/tls/index.ts @@ -1,4 +1,10 @@ -export function connect({ socket, servername }: { socket: { startTls: (servername: string) => void }; servername: string }) { +export function connect({ + socket, + servername, +}: { + socket: { startTls: (servername: string) => void }; + servername: string; +}) { socket.startTls(servername); return socket; } diff --git a/shims/url/index.ts b/shims/url/index.ts index af38352..e871b42 100644 --- a/shims/url/index.ts +++ b/shims/url/index.ts @@ -2,12 +2,24 @@ export function parse(url: string, parseQueryString = false) { const { protocol } = new URL(url); // we now swap the protocol to http: so that `new URL()` will parse it fully const httpUrl = 'http:' + url.substring(protocol.length); - let { username, password, host, hostname, port, pathname, search, searchParams, hash } = new URL(httpUrl); + let { + username, + password, + host, + hostname, + port, + pathname, + search, + searchParams, + hash, + } = new URL(httpUrl); password = decodeURIComponent(password); username = decodeURIComponent(username); pathname = decodeURIComponent(pathname); const auth = username + ':' + password; - const query = parseQueryString ? Object.fromEntries(searchParams.entries()) : search; + const query = parseQueryString + ? Object.fromEntries(searchParams.entries()) + : search; return { href: url, protocol, diff --git a/src/index.ts b/src/index.ts index dd354c6..af9d7c4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,13 @@ import isrgRootX1 from './isrgrootx1.pem'; import { deepEqual } from 'fast-equals'; import { Client, Pool, neon, neonConfig } from '../export'; -import { timedRepeats, runQuery, clientRunQuery, poolRunQuery, httpRunQuery } from './util'; +import { + timedRepeats, + runQuery, + clientRunQuery, + poolRunQuery, + httpRunQuery, +} from './util'; import { queries } from './queries'; import type { ExecutionContext } from '@cloudflare/workers-types'; @@ -29,7 +35,11 @@ export interface Env { // simple tests for Cloudflare Workers -export async function cf(request: Request, env: Env, ctx: ExecutionContext): Promise { +export async function cf( + request: Request, + env: Env, + ctx: ExecutionContext, +): Promise { let results: any[] = []; for (const query of queries) { @@ -63,7 +73,8 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { sql`SELECT ${'hello'} AS "batchStr"`, ]); log('batch results:', JSON.stringify(ra), JSON.stringify(rb), '\n'); - if (ra.batchInt !== 1 || rb.batchStr !== 'hello') throw new Error('Batch query problem'); + if (ra.batchInt !== 1 || rb.batchStr !== 'hello') + throw new Error('Batch query problem'); // basic batch query const [[r1], [r2]] = await sql.transaction((txn) => [ @@ -71,7 +82,8 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { txn`SELECT ${'hello'} AS "batchStr"`, ]); log('batch results:', JSON.stringify(r1), JSON.stringify(r2), '\n'); - if (r1.batchInt !== 1 || r2.batchStr !== 'hello') throw new Error('Batch query problem'); + if (r1.batchInt !== 1 || r2.batchStr !== 'hello') + throw new Error('Batch query problem'); // empty batch query const emptyResult = await sql.transaction((txn) => []); @@ -79,10 +91,18 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { // option setting on `transaction()` const [[[r3]], [[r4]]] = await sql.transaction( - (txn) => [txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`], + (txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ], { arrayMode: true, isolationLevel: 'Serializable', readOnly: true }, ); - log('array mode (via transaction options) batch results:', JSON.stringify(r3), JSON.stringify(r4), '\n'); + log( + 'array mode (via transaction options) batch results:', + JSON.stringify(r3), + JSON.stringify(r4), + '\n', + ); if (r3 !== 1 || r4 !== 'hello') throw new Error('Batch query problem'); // option setting on `neon()` @@ -94,36 +114,61 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`, ]); - log('array mode (via neon options) batch results:', JSON.stringify(r5), JSON.stringify(r6), '\n'); + log( + 'array mode (via neon options) batch results:', + JSON.stringify(r5), + JSON.stringify(r6), + '\n', + ); if (r5 !== 1 || r6 !== 'hello') throw new Error('Batch query problem'); // option setting in transaction overrides option setting on Neon const sqlArr2 = neon(env.NEON_DB_URL, { arrayMode: true }); const [[r7], [r8]] = await sqlArr2.transaction( - (txn) => [txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`], + (txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ], { arrayMode: false }, ); - log('ordinary (via overridden options) batch results:', JSON.stringify(r7), JSON.stringify(r8), '\n'); - if (r7.batchInt !== 1 || r8.batchStr !== 'hello') throw new Error('Batch query problem'); + log( + 'ordinary (via overridden options) batch results:', + JSON.stringify(r7), + JSON.stringify(r8), + '\n', + ); + if (r7.batchInt !== 1 || r8.batchStr !== 'hello') + throw new Error('Batch query problem'); // option setting on individual queries within a batch: should be honoured (despite types not supporting it) const [[r9], [r10]] = await sql.transaction((txn) => [ txn`SELECT ${1}::int AS "batchInt"`, txn('SELECT $1 AS "batchStr"', ['hello'], { arrayMode: true }), ]); - log('query options on individual batch queries:', JSON.stringify(r9), JSON.stringify(r10), '\n'); - if (r9.batchInt !== 1 || r10[0] !== 'hello') throw new Error('Batch query problem'); + log( + 'query options on individual batch queries:', + JSON.stringify(r9), + JSON.stringify(r10), + '\n', + ); + if (r9.batchInt !== 1 || r10[0] !== 'hello') + throw new Error('Batch query problem'); // invalid query to `transaction()` let queryErr = undefined; try { // @ts-ignore - await sql.transaction((txn) => [txn`SELECT ${1}::int AS "batchInt"`, `SELECT 'hello' AS "batchStr"`]); + await sql.transaction((txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + `SELECT 'hello' AS "batchStr"`, + ]); } catch (err) { queryErr = err; } if (queryErr === undefined) - throw new Error('Error should have been raised for string passed to `transaction()`'); + throw new Error( + 'Error should have been raised for string passed to `transaction()`', + ); log('successfully caught invalid query passed to `transaction()`\n'); // wrong DB URL @@ -136,11 +181,16 @@ export async function batchQueryTest(env: Env, log = (...s: any[]) => {}) { } catch (err) { connErr = err; } - if (connErr === undefined) throw new Error('Error should have been raised for bad password'); + if (connErr === undefined) + throw new Error('Error should have been raised for bad password'); log('successfully caught invalid password passed to `neon()`\n'); } -export async function latencies(env: Env, useSubtls: boolean, log = (...s: any[]) => {}): Promise { +export async function latencies( + env: Env, + useSubtls: boolean, + log = (...s: any[]) => {}, +): Promise { const queryRepeats = [1, 3]; const connectRepeats = 9; @@ -170,7 +220,8 @@ export async function latencies(env: Env, useSubtls: boolean, log = (...s: any[] pgRes.fields.map((f: any) => f.dataTypeID), ); const rowsMatch = deepEqual(rows, pgRes.rows); - const ok = commandMatches && rowCountMatches && rowsMatch && dataTypesMatch; + const ok = + commandMatches && rowCountMatches && rowsMatch && dataTypesMatch; log( ok ? '\u2713' : 'X', @@ -243,7 +294,11 @@ export async function latencies(env: Env, useSubtls: boolean, log = (...s: any[] await sql('SELECT 123 AS num', [], { arrayMode: true, fullResults: true }); // timeout - function sqlWithRetries(sql: ReturnType, timeoutMs: number, attempts = 3) { + function sqlWithRetries( + sql: ReturnType, + timeoutMs: number, + attempts = 3, + ) { return async function (strings: TemplateStringsArray, ...params: any[]) { // reassemble template string let query = ''; @@ -254,7 +309,10 @@ export async function latencies(env: Env, useSubtls: boolean, log = (...s: any[] // run query with timeout and retries for (let i = 1; ; i++) { const abortController = new AbortController(); - const timeout = setTimeout(() => abortController.abort('fetch timed out'), timeoutMs); + const timeout = setTimeout( + () => abortController.abort('fetch timed out'), + timeoutMs, + ); try { const { signal } = abortController; @@ -316,8 +374,13 @@ export async function latencies(env: Env, useSubtls: boolean, log = (...s: any[] for (const query of queries) { log(`\n----- ${query.sql} -----\n\n`); - async function section(queryRepeat: number, f: (n: number) => Promise) { - const marker = String.fromCharCode(counter + (counter > 25 ? 49 - 26 : 65)); // A - Z, 1 - 9 + async function section( + queryRepeat: number, + f: (n: number) => Promise, + ) { + const marker = String.fromCharCode( + counter + (counter > 25 ? 49 - 26 : 65), + ); // A - Z, 1 - 9 log(`${marker}\n`); // this will error, but makes for a handy heading in the dev tools Network pane (or Wireshark) @@ -373,17 +436,23 @@ export async function latencies(env: Env, useSubtls: boolean, log = (...s: any[] await clientRunQuery(n, client, ctx, query); }); - await sections('Neon/wss, pipelined connect using Pool.query', async (n) => { - await poolRunQuery(n, env.NEON_DB_URL, ctx, query); - }); + await sections( + 'Neon/wss, pipelined connect using Pool.query', + async (n) => { + await poolRunQuery(n, env.NEON_DB_URL, ctx, query); + }, + ); - await sections('Neon/wss, pipelined connect using Pool.connect', async (n) => { - const pool = new Pool({ connectionString: env.NEON_DB_URL }); - const poolClient = await pool.connect(); - await timedRepeats(n, () => runQuery(poolClient, query)); - poolClient.release(); - ctx.waitUntil(pool.end()); - }); + await sections( + 'Neon/wss, pipelined connect using Pool.connect', + async (n) => { + const pool = new Pool({ connectionString: env.NEON_DB_URL }); + const poolClient = await pool.connect(); + await timedRepeats(n, () => runQuery(poolClient, query)); + poolClient.release(); + ctx.waitUntil(pool.end()); + }, + ); if (useSubtls) { neonConfig.subtls = subtls; @@ -393,7 +462,8 @@ export async function latencies(env: Env, useSubtls: boolean, log = (...s: any[] const client = new Client(env.NEON_DB_URL); client.neonConfig.wsProxy = (host, port) => `subtls-wsproxy.jawj.workers.dev/?address=${host}:${port}`; - client.neonConfig.forceDisablePgSSL = client.neonConfig.useSecureWebSocket = false; + client.neonConfig.forceDisablePgSSL = + client.neonConfig.useSecureWebSocket = false; client.neonConfig.pipelineTLS = false; // only works with patched pg client.neonConfig.pipelineConnect = false; // only works with password auth, which we aren't offered this way try { diff --git a/src/queries.ts b/src/queries.ts index 5e08719..f3bf359 100644 --- a/src/queries.ts +++ b/src/queries.ts @@ -10,6 +10,7 @@ export const queries: Query[] = [ }, { sql: 'SELECT now()', - test: (rows) => /^2\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d+Z$/.test(rows[0].now.toISOString()), + test: (rows) => + /^2\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d.\d+Z$/.test(rows[0].now.toISOString()), }, ]; diff --git a/src/util.ts b/src/util.ts index f4a83ce..9ab6f11 100644 --- a/src/util.ts +++ b/src/util.ts @@ -25,28 +25,51 @@ export async function timedRepeats( return [total, results] as const; } -export async function runQuery(queryable: ClientBase | Pool | ReturnType, query: Query) { +export async function runQuery( + queryable: ClientBase | Pool | ReturnType, + query: Query, +) { const { sql, test } = query; - const { rows } = await (typeof queryable === 'function' ? queryable(sql) : queryable.query(sql)); - if (!test(rows)) throw new Error(`Result fails test\nQuery: ${sql}\nResult: ${JSON.stringify(rows)}`); + const { rows } = await (typeof queryable === 'function' + ? queryable(sql) + : queryable.query(sql)); + if (!test(rows)) + throw new Error( + `Result fails test\nQuery: ${sql}\nResult: ${JSON.stringify(rows)}`, + ); return rows; } -export async function clientRunQuery(n: number, client: Client, ctx: ExecutionContext, query: Query) { +export async function clientRunQuery( + n: number, + client: Client, + ctx: ExecutionContext, + query: Query, +) { await client.connect(); const tPlusResults = await timedRepeats(n, () => runQuery(client, query)); ctx.waitUntil(client.end()); return tPlusResults; } -export async function poolRunQuery(n: number, dbUrl: string, ctx: ExecutionContext, query: Query) { +export async function poolRunQuery( + n: number, + dbUrl: string, + ctx: ExecutionContext, + query: Query, +) { const pool = new Pool({ connectionString: dbUrl }); const tPlusResults = await timedRepeats(n, () => runQuery(pool, query)); ctx.waitUntil(pool.end()); return tPlusResults; } -export async function httpRunQuery(n: number, dbUrl: string, ctx: ExecutionContext, query: Query) { +export async function httpRunQuery( + n: number, + dbUrl: string, + ctx: ExecutionContext, + query: Query, +) { const sql = neon(dbUrl, { fullResults: true }); const tPlusResults = await timedRepeats(n, () => runQuery(sql, query)); return tPlusResults; @@ -62,7 +85,11 @@ export function stableStringify( k, typeof v !== 'object' || v === null || Array.isArray(v) ? v - : Object.fromEntries(Object.entries(v).sort(([ka], [kb]) => (ka < kb ? -1 : ka > kb ? 1 : 0))), + : Object.fromEntries( + Object.entries(v).sort(([ka], [kb]) => + ka < kb ? -1 : ka > kb ? 1 : 0, + ), + ), ); return JSON.stringify(x, deterministicReplacer, indent); diff --git a/tests/http.test.ts b/tests/http.test.ts index 090e74d..4c07971 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -7,31 +7,38 @@ const sql = neon(DB_URL); const sqlFull = neon(DB_URL, { fullResults: true }); const pool = new Pool({ connectionString: DB_URL }); -test('http query results match WebSocket query results', { timeout: 30000 }, async () => { - const client = await pool.connect(); - - for (const queryPromise of sampleQueries(sqlFull)) { - const { query, params } = queryPromise.parameterizedQuery; - const [httpResult, wsResult] = await Promise.all([queryPromise, client.query(query, params)]); - - // account for known/accepted differences: - // * http results are plain Objects, not Result instances - // * http results lack `oid` and `RowCtor` fields (which are both usually `null`) - // * http result `fields` array contains plain Objects, not Field instances - // * http results have `"viaNeonFetch": true` - - const httpResultProcessed = { ...httpResult, oid: null, RowCtor: null }; - const wsResultProcessed = { - ...wsResult, - fields: wsResult.fields.map((f) => ({ ...f })), - viaNeonFetch: true, - }; - - expect(httpResultProcessed).toStrictEqual(wsResultProcessed); - } - - client.release(); -}); +test( + 'http query results match WebSocket query results', + { timeout: 30000 }, + async () => { + const client = await pool.connect(); + + for (const queryPromise of sampleQueries(sqlFull)) { + const { query, params } = queryPromise.parameterizedQuery; + const [httpResult, wsResult] = await Promise.all([ + queryPromise, + client.query(query, params), + ]); + + // account for known/accepted differences: + // * http results are plain Objects, not Result instances + // * http results lack `oid` and `RowCtor` fields (which are both usually `null`) + // * http result `fields` array contains plain Objects, not Field instances + // * http results have `"viaNeonFetch": true` + + const httpResultProcessed = { ...httpResult, oid: null, RowCtor: null }; + const wsResultProcessed = { + ...wsResult, + fields: wsResult.fields.map((f) => ({ ...f })), + viaNeonFetch: true, + }; + + expect(httpResultProcessed).toStrictEqual(wsResultProcessed); + } + + client.release(); + }, +); test('custom fetch', async () => { const fn = vi.fn(); @@ -39,7 +46,9 @@ test('custom fetch', async () => { fn(url); return fetch(url, options); }; - await expect(sql`SELECT ${'customFetch'} AS str`).resolves.toStrictEqual([{ str: 'customFetch' }]); + await expect(sql`SELECT ${'customFetch'} AS str`).resolves.toStrictEqual([ + { str: 'customFetch' }, + ]); expect(fn).toHaveBeenCalledOnce(); }); @@ -67,9 +76,13 @@ test('errors match WebSocket query errors', async () => { }); test('http queries with too few or too many parameters', async () => { - await expect(sql('SELECT $1', [])).rejects.toThrowError('bind message supplies 0 parameters'); + await expect(sql('SELECT $1', [])).rejects.toThrowError( + 'bind message supplies 0 parameters', + ); - await expect(sql('SELECT $1', [1, 2])).rejects.toThrowError('bind message supplies 2 parameters'); + await expect(sql('SELECT $1', [1, 2])).rejects.toThrowError( + 'bind message supplies 2 parameters', + ); }); test('timeout aborting an http query', { timeout: 5000 }, async () => { @@ -77,19 +90,22 @@ test('timeout aborting an http query', { timeout: 5000 }, async () => { const { signal } = abortController; setTimeout(() => abortController.abort('fetch timed out'), 250); - await expect(sql('SELECT pg_sleep(2)', [], { fetchOptions: { signal } })).rejects.toThrow( - 'fetch timed out', - ); + await expect( + sql('SELECT pg_sleep(2)', [], { fetchOptions: { signal } }), + ).rejects.toThrow('fetch timed out'); }); test('timeout not aborting an http query', { timeout: 5000 }, async () => { const abortController = new AbortController(); const { signal } = abortController; - const timeout = setTimeout(() => abortController.abort('fetch timed out'), 2000); + const timeout = setTimeout( + () => abortController.abort('fetch timed out'), + 2000, + ); - await expect(sql('SELECT pg_sleep(.5)', [], { fetchOptions: { signal } })).resolves.toStrictEqual([ - { pg_sleep: '' }, - ]); + await expect( + sql('SELECT pg_sleep(.5)', [], { fetchOptions: { signal } }), + ).resolves.toStrictEqual([{ pg_sleep: '' }]); clearTimeout(timeout); }); @@ -97,26 +113,38 @@ test('timeout not aborting an http query', { timeout: 5000 }, async () => { test('database URL with wrong user to `neon()`', async () => { const urlWithBadHost = DB_URL.replace('//', '//x'); const sqlBad = neon(urlWithBadHost); - await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError('password authentication failed'); + await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError( + 'password authentication failed', + ); }); test('database URL with wrong password to `neon()`', async () => { const urlWithBadPassword = DB_URL.replace('@', 'x@'); const sqlBad = neon(urlWithBadPassword); - await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError('password authentication failed'); + await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError( + 'password authentication failed', + ); }); test('database URL with wrong project to `neon()`', async () => { const urlWithBadHost = DB_URL.replace('@', '@x'); const sqlBad = neon(urlWithBadHost); - await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError('password authentication failed'); + await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError( + 'password authentication failed', + ); }); -test('database URL with wrong host to `neon()`', { timeout: 10000 }, async () => { - const urlWithBadHost = DB_URL.replace('.neon.tech', '.neon.techh'); - const sqlBad = neon(urlWithBadHost); - await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError('fetch failed'); -}); +test( + 'database URL with wrong host to `neon()`', + { timeout: 10000 }, + async () => { + const urlWithBadHost = DB_URL.replace('.neon.tech', '.neon.techh'); + const sqlBad = neon(urlWithBadHost); + await expect(sqlBad`SELECT ${1}::int AS one`).rejects.toThrowError( + 'fetch failed', + ); + }, +); test('undefined database URL', async () => { expect(() => neon(undefined as unknown as string)).toThrowError( @@ -125,7 +153,9 @@ test('undefined database URL', async () => { }); test('empty database URL to `neon()`', async () => { - expect(() => neon('')).toThrowError('No database connection string was provided'); + expect(() => neon('')).toThrowError( + 'No database connection string was provided', + ); }); test('wrong-scheme database URL to `neon()`', async () => { diff --git a/tests/httpTransaction.test.ts b/tests/httpTransaction.test.ts index b180085..7ddae1c 100644 --- a/tests/httpTransaction.test.ts +++ b/tests/httpTransaction.test.ts @@ -34,7 +34,10 @@ test('empty batch query with array', async () => { test('option setting on `transaction()`', async () => { const [[[a]], [[b]]] = await sql.transaction( - (txn) => [txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`], + (txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ], { arrayMode: true, isolationLevel: 'Serializable', readOnly: true }, // arrayMode changes result format destructured above ); expect(a).toBe(1); @@ -57,7 +60,10 @@ test('option setting on `neon()`', async () => { test('option setting on `transaction()` overrides option setting on `neon()`', async () => { const sqlArr = neon(DB_URL, { arrayMode: true }); const [[a], [b]] = await sqlArr.transaction( - (txn) => [txn`SELECT ${1}::int AS "batchInt"`, txn`SELECT ${'hello'} AS "batchStr"`], + (txn) => [ + txn`SELECT ${1}::int AS "batchInt"`, + txn`SELECT ${'hello'} AS "batchStr"`, + ], { arrayMode: false }, ); expect(a.batchInt).toBe(1); diff --git a/tests/ws.test.ts b/tests/ws.test.ts index cf80204..4fa7763 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -1,7 +1,12 @@ import { expect, test } from 'vitest'; import { Pool as PgPool } from 'pg'; import * as subtls from 'subtls'; -import { neon, neonConfig, Pool as WsPool, Client as WsClient } from '../dist/npm'; +import { + neon, + neonConfig, + Pool as WsPool, + Client as WsClient, +} from '../dist/npm'; import { sampleQueries } from './sampleQueries'; const DB_URL = process.env.VITE_NEON_DB_URL!; @@ -113,7 +118,13 @@ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= -----END CERTIFICATE-----`; test('client.query() with custom WebSocket proxy and subtls', async () => { - const { wsProxy, pipelineConnect, forceDisablePgSSL, rootCerts, subtls: origSubtls } = neonConfig; + const { + wsProxy, + pipelineConnect, + forceDisablePgSSL, + rootCerts, + subtls: origSubtls, + } = neonConfig; try { neonConfig.wsProxy = process.env.WSPROXY!; //neonConfig.subtls = subtls; From 8c4a4141f5f016f796c8a5c1b5d457eea98a1369 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 17 Dec 2024 14:25:05 +0000 Subject: [PATCH 22/40] Fixed subtls usage -- and got custom wsProxy/subtls test working --- dist/dts/export/index.d.ts | 4 +-- dist/jsr/README.md | 9 +++-- dist/jsr/index.js | 40 +++++++++++------------ dist/npm/CONFIG.md | 15 +++++---- dist/npm/README.md | 9 +++-- dist/npm/index.js | 40 +++++++++++------------ dist/npm/index.mjs | 40 +++++++++++------------ package-lock.json | 8 ++--- package.json | 2 +- shims/net/index.ts | 2 +- tests/ws.test.ts | 67 ++++++++++++++++++++------------------ 11 files changed, 127 insertions(+), 109 deletions(-) diff --git a/dist/dts/export/index.d.ts b/dist/dts/export/index.d.ts index 1dc86a5..761e01a 100644 --- a/dist/dts/export/index.d.ts +++ b/dist/dts/export/index.d.ts @@ -45,5 +45,5 @@ declare class NeonPool extends Pool { on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; query(config?: any, values?: any, cb?: any): any; } -export { Socket as neonConfig, NeonPool as Pool, NeonClient as Client, neon, NeonDbError }; -export { Connection, DatabaseError, Query, ClientBase, defaults, types } from 'pg'; +export { Socket as neonConfig, NeonPool as Pool, NeonClient as Client, neon, NeonDbError, }; +export { Connection, DatabaseError, Query, ClientBase, defaults, types, } from 'pg'; diff --git a/dist/jsr/README.md b/dist/jsr/README.md index 2eef9bf..5da601c 100644 --- a/dist/jsr/README.md +++ b/dist/jsr/README.md @@ -157,8 +157,13 @@ try { await client.query('BEGIN'); const { rows: [{ id: postId }], - } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', ['Welcome']); - await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [postId, 's3.bucket/photo/url']); + } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', [ + 'Welcome', + ]); + await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [ + postId, + 's3.bucket/photo/url', + ]); await client.query('COMMIT'); } catch (err) { await client.query('ROLLBACK'); diff --git a/dist/jsr/index.js b/dist/jsr/index.js index 9144f7e..f952463 100644 --- a/dist/jsr/index.js +++ b/dist/jsr/index.js @@ -1002,26 +1002,26 @@ then(d=>{if(this.ws=d.webSocket,this.ws==null)throw c;this.ws.accept(),o(this.ws throw new Error("For Postgres SSL connections, you must set `neonConfig.subtls` \ to the subtls library. See https://github.com/neondatabase/serverless/blob/main/\ CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. -fromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i.read.bind( -i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o,{useSNI:!this. -disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0});this.tlsRead= -u,this.tlsWrite=c,this.tlsState=2,this.encrypted=!0,this.authorized=!0,this.emit( -"secureConnection",this),this.tlsReadLoop()}async tlsReadLoop(){for(;;){let t=await this. -tlsRead();if(t===void 0)break;{let n=y.from(t);this.emit("data",n)}}}rawWrite(t){ -if(!this.coalesceWrites){this.ws.send(t);return}if(this.writeBuffer===void 0)this. -writeBuffer=t,setTimeout(()=>{this.ws.send(this.writeBuffer),this.writeBuffer=void 0}, -0);else{let n=new Uint8Array(this.writeBuffer.length+t.length);n.set(this.writeBuffer), -n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf8",i=s=>{}){return t. -length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this.tlsState===0?(this. -rawWrite(t),i()):this.tlsState===1?this.once("secureConnection",()=>{this.write( -t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){return this. -write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed=!0,this. -end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ -let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api."),"https\ -://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0,webSocketConstructor:void 0, -wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0,forceDisablePgSSL:!0,coalesceWrites:!0, -pipelineConnect:"password",subtls:void 0,rootCerts:"",pipelineTLS:!1,disableSNI:!1}), -_(E,"opts",{});_e=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +databaseFromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i. +read.bind(i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o, +{useSNI:!this.disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0}); +this.tlsRead=u,this.tlsWrite=c,this.tlsState=2,this.encrypted=!0,this.authorized= +!0,this.emit("secureConnection",this),this.tlsReadLoop()}async tlsReadLoop(){for(;;){ +let t=await this.tlsRead();if(t===void 0)break;{let n=y.from(t);this.emit("data", +n)}}}rawWrite(t){if(!this.coalesceWrites){this.ws.send(t);return}if(this.writeBuffer=== +void 0)this.writeBuffer=t,setTimeout(()=>{this.ws.send(this.writeBuffer),this.writeBuffer= +void 0},0);else{let n=new Uint8Array(this.writeBuffer.length+t.length);n.set(this. +writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf\ +8",i=s=>{}){return t.length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this. +tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ +n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ +return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= +!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api\ +."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, +webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, +forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});_e=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. diff --git a/dist/npm/CONFIG.md b/dist/npm/CONFIG.md index ae4a8be..4f56abf 100644 --- a/dist/npm/CONFIG.md +++ b/dist/npm/CONFIG.md @@ -161,7 +161,10 @@ const sql = neon(process.env.DATABASE_URL); const showLatestN = 10; const [posts, tags] = await sql.transaction( - [sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, sql`SELECT * FROM tags`], + [ + sql`SELECT * FROM posts ORDER BY posted_at DESC LIMIT ${showLatestN}`, + sql`SELECT * FROM tags`, + ], { isolationLevel: 'RepeatableRead', readOnly: true, @@ -172,10 +175,9 @@ const [posts, tags] = await sql.transaction( Or as an example of the function case: ```javascript -const [authors, tags] = await neon(process.env.DATABASE_URL).transaction((txn) => [ - txn`SELECT * FROM authors`, - txn`SELECT * FROM tags`, -]); +const [authors, tags] = await neon(process.env.DATABASE_URL).transaction( + (txn) => [txn`SELECT * FROM authors`, txn`SELECT * FROM tags`], +); ``` The optional second argument to `transaction()`, `options`, has the same keys as the options to the ordinary query function -- `arrayMode`, `fullResults` and `fetchOptions` -- plus three additional keys that concern the transaction configuration. These transaction-related keys are: `isolationMode`, `readOnly` and `deferrable`. They are described below. Defaults for the transaction-related keys can also be set as options to the `neon` function. @@ -267,7 +269,8 @@ If connecting to a non-Neon database, the `wsProxy` option should point to [your ```javascript // either: -neonConfig.wsProxy = (host, port) => `my-wsproxy.example.com/v1?address=${host}:${port}`; +neonConfig.wsProxy = (host, port) => + `my-wsproxy.example.com/v1?address=${host}:${port}`; // or (with identical effect): neonConfig.wsProxy = 'my-wsproxy.example.com/v1'; ``` diff --git a/dist/npm/README.md b/dist/npm/README.md index 2eef9bf..5da601c 100644 --- a/dist/npm/README.md +++ b/dist/npm/README.md @@ -157,8 +157,13 @@ try { await client.query('BEGIN'); const { rows: [{ id: postId }], - } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', ['Welcome']); - await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [postId, 's3.bucket/photo/url']); + } = await client.query('INSERT INTO posts (title) VALUES ($1) RETURNING id', [ + 'Welcome', + ]); + await client.query('INSERT INTO photos (post_id, url) VALUES ($1, $2)', [ + postId, + 's3.bucket/photo/url', + ]); await client.query('COMMIT'); } catch (err) { await client.query('ROLLBACK'); diff --git a/dist/npm/index.js b/dist/npm/index.js index 148574c..ce76bcc 100644 --- a/dist/npm/index.js +++ b/dist/npm/index.js @@ -1000,26 +1000,26 @@ then(d=>{if(this.ws=d.webSocket,this.ws==null)throw c;this.ws.accept(),o(this.ws throw new Error("For Postgres SSL connections, you must set `neonConfig.subtls` \ to the subtls library. See https://github.com/neondatabase/serverless/blob/main/\ CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. -fromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i.read.bind( -i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o,{useSNI:!this. -disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0});this.tlsRead= -u,this.tlsWrite=c,this.tlsState=2,this.encrypted=!0,this.authorized=!0,this.emit( -"secureConnection",this),this.tlsReadLoop()}async tlsReadLoop(){for(;;){let t=await this. -tlsRead();if(t===void 0)break;{let n=y.from(t);this.emit("data",n)}}}rawWrite(t){ -if(!this.coalesceWrites){this.ws.send(t);return}if(this.writeBuffer===void 0)this. -writeBuffer=t,setTimeout(()=>{this.ws.send(this.writeBuffer),this.writeBuffer=void 0}, -0);else{let n=new Uint8Array(this.writeBuffer.length+t.length);n.set(this.writeBuffer), -n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf8",i=s=>{}){return t. -length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this.tlsState===0?(this. -rawWrite(t),i()):this.tlsState===1?this.once("secureConnection",()=>{this.write( -t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){return this. -write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed=!0,this. -end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ -let s;return i?.jwtAuth?s=t.replace(ms,"apiauth."):s=t.replace(ms,"api."),"https\ -://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0,webSocketConstructor:void 0, -wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0,forceDisablePgSSL:!0,coalesceWrites:!0, -pipelineConnect:"password",subtls:void 0,rootCerts:"",pipelineTLS:!1,disableSNI:!1}), -_(E,"opts",{});Se=E});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +databaseFromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i. +read.bind(i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o, +{useSNI:!this.disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0}); +this.tlsRead=u,this.tlsWrite=c,this.tlsState=2,this.encrypted=!0,this.authorized= +!0,this.emit("secureConnection",this),this.tlsReadLoop()}async tlsReadLoop(){for(;;){ +let t=await this.tlsRead();if(t===void 0)break;{let n=y.from(t);this.emit("data", +n)}}}rawWrite(t){if(!this.coalesceWrites){this.ws.send(t);return}if(this.writeBuffer=== +void 0)this.writeBuffer=t,setTimeout(()=>{this.ws.send(this.writeBuffer),this.writeBuffer= +void 0},0);else{let n=new Uint8Array(this.writeBuffer.length+t.length);n.set(this. +writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf\ +8",i=s=>{}){return t.length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this. +tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ +n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ +return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= +!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ms,"apiauth."):s=t.replace(ms,"api\ +."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, +webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, +forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});Se=E});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. diff --git a/dist/npm/index.mjs b/dist/npm/index.mjs index 03cce33..62e24e8 100644 --- a/dist/npm/index.mjs +++ b/dist/npm/index.mjs @@ -1000,26 +1000,26 @@ then(d=>{if(this.ws=d.webSocket,this.ws==null)throw c;this.ws.accept(),o(this.ws throw new Error("For Postgres SSL connections, you must set `neonConfig.subtls` \ to the subtls library. See https://github.com/neondatabase/serverless/blob/main/\ CONFIG.md for more information.");this.tlsState=1;let n=this.subtls.TrustedCert. -fromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i.read.bind( -i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o,{useSNI:!this. -disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0});this.tlsRead= -u,this.tlsWrite=c,this.tlsState=2,this.encrypted=!0,this.authorized=!0,this.emit( -"secureConnection",this),this.tlsReadLoop()}async tlsReadLoop(){for(;;){let t=await this. -tlsRead();if(t===void 0)break;{let n=y.from(t);this.emit("data",n)}}}rawWrite(t){ -if(!this.coalesceWrites){this.ws.send(t);return}if(this.writeBuffer===void 0)this. -writeBuffer=t,setTimeout(()=>{this.ws.send(this.writeBuffer),this.writeBuffer=void 0}, -0);else{let n=new Uint8Array(this.writeBuffer.length+t.length);n.set(this.writeBuffer), -n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf8",i=s=>{}){return t. -length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this.tlsState===0?(this. -rawWrite(t),i()):this.tlsState===1?this.once("secureConnection",()=>{this.write( -t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){return this. -write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed=!0,this. -end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a((t,n,i)=>{ -let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api."),"https\ -://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0,webSocketConstructor:void 0, -wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0,forceDisablePgSSL:!0,coalesceWrites:!0, -pipelineConnect:"password",subtls:void 0,rootCerts:"",pipelineTLS:!1,disableSNI:!1}), -_(E,"opts",{});_e=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +databaseFromPEM(this.rootCerts),i=new this.subtls.WebSocketReadQueue(this.ws),s=i. +read.bind(i),o=this.rawWrite.bind(this),[u,c]=await this.subtls.startTls(t,n,s,o, +{useSNI:!this.disableSNI,expectPreData:this.pipelineTLS?new Uint8Array([83]):void 0}); +this.tlsRead=u,this.tlsWrite=c,this.tlsState=2,this.encrypted=!0,this.authorized= +!0,this.emit("secureConnection",this),this.tlsReadLoop()}async tlsReadLoop(){for(;;){ +let t=await this.tlsRead();if(t===void 0)break;{let n=y.from(t);this.emit("data", +n)}}}rawWrite(t){if(!this.coalesceWrites){this.ws.send(t);return}if(this.writeBuffer=== +void 0)this.writeBuffer=t,setTimeout(()=>{this.ws.send(this.writeBuffer),this.writeBuffer= +void 0},0);else{let n=new Uint8Array(this.writeBuffer.length+t.length);n.set(this. +writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf\ +8",i=s=>{}){return t.length===0?(i(),!0):(typeof t=="string"&&(t=y.from(t,n)),this. +tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ +n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ +return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= +!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api\ +."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, +webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, +forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});_e=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. diff --git a/package-lock.json b/package-lock.json index b2dc6c0..c962069 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "dts-bundle-generator": "^9.5.1", "esbuild": "^0.24.0", "fast-equals": "^5.0.1", - "subtls": "^0.3.3", + "subtls": "^0.4.0", "typescript": "^5.0.4", "vitest": "^2.1.6", "wrangler": "^3.0.1" @@ -5101,9 +5101,9 @@ } }, "node_modules/subtls": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.3.3.tgz", - "integrity": "sha512-d4otIuFU4Fa1k4ZMsIXXTClahHzunz7mx6+Kpn2K9s7BqFAYXP46JZhIbIebY4Z4Sas2b16CjRaKC0ZSJ8/A4w==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.4.0.tgz", + "integrity": "sha512-MW9CxlL9+G/9M/X2vMt1N3N6oZKMTnbYVAEABnLqCU9uSmzJILOxCcmPPVwcsnkse6SIOvfSSxcZ7dryagk/Pg==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 83c224a..879325a 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "dts-bundle-generator": "^9.5.1", "esbuild": "^0.24.0", "fast-equals": "^5.0.1", - "subtls": "^0.3.3", + "subtls": "^0.4.0", "typescript": "^5.0.4", "vitest": "^2.1.6", "wrangler": "^3.0.1" diff --git a/shims/net/index.ts b/shims/net/index.ts index 6612e82..a5b41fe 100644 --- a/shims/net/index.ts +++ b/shims/net/index.ts @@ -450,7 +450,7 @@ export class Socket extends EventEmitter { this.tlsState = TlsState.Handshake; - const rootCerts = this.subtls.TrustedCert.fromPEM(this.rootCerts); + const rootCerts = this.subtls.TrustedCert.databaseFromPEM(this.rootCerts); const readQueue = new this.subtls.WebSocketReadQueue(this.ws!); const networkRead = readQueue.read.bind(readQueue); const networkWrite = this.rawWrite.bind(this); diff --git a/tests/ws.test.ts b/tests/ws.test.ts index 4fa7763..b08932a 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -15,6 +15,24 @@ const sql = neon(DB_URL); const wsPool = new WsPool({ connectionString: DB_URL }); const pgPool = new PgPool({ connectionString: DB_URL }); +function recursiveTransform(x: any, transform: (x: any) => any) { + if (Array.isArray(x)) { + return x.map((item) => recursiveTransform(item, transform)); + } else if (x !== null && typeof x === 'object') { + return Object.fromEntries( + Object.entries(x).map(([k, v]) => [k, recursiveTransform(v, transform)]), + ); + } else { + return transform(x); + } +} + +function functionsToPlaceholders(x: any) { + return recursiveTransform(x, (x) => + typeof x === 'function' ? `__fn_arity_${x.length}__` : x, + ); +} + test( 'WebSockets query results match pg/TCP query results, using pool.connect()', { timeout: 30000 }, @@ -28,7 +46,11 @@ test( wsClient.query(query, params), pgClient.query(query, params), ]); - expect(wsResult).toStrictEqual(pgResult); + + // unprocessed results don't strictly match because functions are minified by ws driver + expect(functionsToPlaceholders(wsResult)).toStrictEqual( + functionsToPlaceholders(pgResult), + ); } wsClient.release(); @@ -53,6 +75,8 @@ test('pool.query() with poolQueryViaFetch', async () => { } }); +// TODO: poolQueryViaFetch with contra-indications + test('client.query()', async () => { const client = new WsClient(DB_URL); await client.connect(); @@ -118,35 +142,16 @@ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= -----END CERTIFICATE-----`; test('client.query() with custom WebSocket proxy and subtls', async () => { - const { - wsProxy, - pipelineConnect, - forceDisablePgSSL, - rootCerts, - subtls: origSubtls, - } = neonConfig; - try { - neonConfig.wsProxy = process.env.WSPROXY!; - //neonConfig.subtls = subtls; - //neonConfig.rootCerts = ISRGX1Cert; - - // Neon requires TLS for apparently-ordinary TCP connections - //neonConfig.forceDisablePgSSL = false; - - // pipelining only works with password auth, which we aren't offered this way - //neonConfig.pipelineConnect = false; + const client = new WsClient(DB_URL); + client.neonConfig.wsProxy = process.env.VITE_WSPROXY!; + client.neonConfig.forceDisablePgSSL = false; + client.neonConfig.pipelineConnect = false; + client.neonConfig.subtls = subtls; + client.neonConfig.rootCerts = ISRGX1Cert; - const client = new WsClient(DB_URL); - await client.connect(); - const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); - await client.end(); - expect(wsResult.rows).toStrictEqual([{ one: 1 }]); - expect(wsResult.viaNeonFetch).toBeUndefined(); - } finally { - neonConfig.wsProxy = wsProxy; - neonConfig.pipelineConnect = pipelineConnect; - neonConfig.forceDisablePgSSL = forceDisablePgSSL; - neonConfig.rootCerts = rootCerts; - neonConfig.subtls = origSubtls; - } + await client.connect(); + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + await client.end(); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBeUndefined(); }); From ca374e5f85c7d2708b51901b1559653dd18758ef Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 17 Dec 2024 15:24:54 +0000 Subject: [PATCH 23/40] Moved types generation to export.sh script --- export.sh | 31 +++--- package-lock.json | 246 ---------------------------------------------- package.json | 6 +- src/index.ts | 4 +- 4 files changed, 19 insertions(+), 268 deletions(-) diff --git a/export.sh b/export.sh index 5be7b08..4d56508 100755 --- a/export.sh +++ b/export.sh @@ -9,7 +9,7 @@ else fi -# CJS code: index.js +# == CJS code: index.js == npx esbuild export/index.ts \ --format=cjs \ @@ -21,7 +21,7 @@ npx esbuild export/index.ts \ $DEBUG_ARG $MINIFY_ARG -# ESM code: index.mjs +# == ESM code: index.mjs == npx esbuild export/index.ts \ --format=esm \ @@ -32,25 +32,28 @@ npx esbuild export/index.ts \ --outfile=dist/npm/index.mjs \ $DEBUG_ARG $MINIFY_ARG -# CJS TS types: index.d.ts -# updated manually +# == types == +npx tsc -# ESM TS types: index.d.mts +# remove global declarations from types +sed -i.orig -r '/^declare global [{]$/,/^[}]$/d' dist/dts/shims/net/index.d.ts -echo " -// DON'T EDIT THIS FILE -// It's a simple automatic copy of index.d.ts -" > dist/npm/index.d.mts -cat dist/npm/index.d.ts >> dist/npm/index.d.mts +# bundle types into one file +echo "Note: warnings are expected from api-extractor" +npx @microsoft/api-extractor run --local +# copy .d.dt (for CJS) to .m.ts (for ESM) +cp dist/npm/index.d.ts dist/npm/index.d.mts -# static assets + +# == static assets == cp LICENSE README.md CHANGELOG.md CONFIG.md DEPLOY.md DEVELOP.md dist/npm/ -# Prepare jsr package + +# == JSR package == cp dist/npm/index.d.ts dist/jsr/ echo "/// @@ -59,8 +62,8 @@ cat dist/npm/index.mjs >> dist/jsr/index.js cp LICENSE README.md dist/jsr/ -# Note: --keep-names adds about 10KB to the bundle size, but it gives us error -# messages and stack traces with no short, cryptic variable names +# Note: --keep-names for esbuild adds about 10KB to the bundle size, but it +# gives us error messages + stack traces with no short, cryptic variable names # WITHOUT (see `xe`, `pe`): diff --git a/package-lock.json b/package-lock.json index c962069..fce7fd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,6 @@ "@types/pg": "^8.6.5", "@types/ws": "^8.5.4", "dotenv": "^16.0.3", - "dts-bundle-generator": "^9.5.1", "esbuild": "^0.24.0", "fast-equals": "^5.0.1", "subtls": "^0.4.0", @@ -2010,120 +2009,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/cliui/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/cliui/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/cliui/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", @@ -2369,23 +2254,6 @@ "url": "https://dotenvx.com" } }, - "node_modules/dts-bundle-generator": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/dts-bundle-generator/-/dts-bundle-generator-9.5.1.tgz", - "integrity": "sha512-DxpJOb2FNnEyOzMkG11sxO2dmxPjthoVWxfKqWYJ/bI/rT1rvTMktF5EKjAYrRZu6Z6t3NhOUZ0sZ5ZXevOfbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "typescript": ">=5.0.2", - "yargs": "^17.6.0" - }, - "bin": { - "dts-bundle-generator": "dist/bin/dts-bundle-generator.js" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/dunder-proto": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.0.tgz", @@ -2591,16 +2459,6 @@ "@esbuild/win32-x64": "0.24.0" } }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -2830,16 +2688,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, "node_modules/get-intrinsic": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.6.tgz", @@ -4417,16 +4265,6 @@ "node": ">=0.10.0" } }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -6707,16 +6545,6 @@ "dev": true, "license": "MIT" }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -6724,80 +6552,6 @@ "dev": true, "license": "ISC" }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/youch": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.4.tgz", diff --git a/package.json b/package.json index 879325a..3c039d4 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,6 @@ }, "scripts": { "check": "tsc --noEmit export/index.ts", - "export": "npm run check && ./export.sh && npm run makeTypes", "build": "./build.sh", "buildDebug": "./build.sh debug", "watch": "./build.sh watch", @@ -43,13 +42,11 @@ "launch": "DOTENV_CONFIG_PATH=.dev.vars node -r dotenv/config --no-warnings dist/node/index.mjs", "node": "npm run build && npm run launch", "nodeDebug": "npm run buildDebug && npm run launch", - "bun": "npm run build && DOTENV_CONFIG_PATH=.dev.vars bun -r dotenv/config dist/node/index.mjs", "cfDev": "npm run build && wrangler dev", "cfDeploy": "npm run build && wrangler deploy", "format": "prettier -c .", "format:fix": "prettier -w .", - "makeTypes": "npx tsc && sed -i.orig -r '/^declare global [{]$/,/^[}]$/d' dist/dts/shims/net/index.d.ts && npx @microsoft/api-extractor run --local && cp dist/npm/index.d.ts dist/npm/index.d.mts", - "test": "npm run export && vitest run --no-file-parallelism" + "test": "./export.sh && vitest run --no-file-parallelism" }, "devDependencies": { "@microsoft/api-extractor": "^7.48.1", @@ -57,7 +54,6 @@ "@types/pg": "^8.6.5", "@types/ws": "^8.5.4", "dotenv": "^16.0.3", - "dts-bundle-generator": "^9.5.1", "esbuild": "^0.24.0", "fast-equals": "^5.0.1", "subtls": "^0.4.0", diff --git a/src/index.ts b/src/index.ts index af9d7c4..08b0c7a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -24,8 +24,6 @@ import { } from './util'; import { queries } from './queries'; -import type { ExecutionContext } from '@cloudflare/workers-types'; - export { neonConfig } from '../export'; export interface Env { @@ -38,7 +36,7 @@ export interface Env { export async function cf( request: Request, env: Env, - ctx: ExecutionContext, + ctx: any, ): Promise { let results: any[] = []; From b71ff7aa2ccfeb71936ff5f3719d80e5b394d8c4 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 14:30:29 +0000 Subject: [PATCH 24/40] Work on auto-generated types --- api-extractor.json | 2 +- dist/dts/_extracted.d.ts | 537 +++++++++++++++++++++++++++++ dist/dts/export/index.d.ts.orig | 49 +++ dist/dts/ext/events.d.ts | 22 ++ dist/dts/ext/pg.d.ts | 325 +++++++++++++++++ dist/dts/ext/subtls.d.ts | 215 ++++++++++++ dist/dts/shims/net/index.d.ts | 2 +- dist/dts/shims/net/index.d.ts.orig | 118 ------- dist/dts/subtls.d.ts | 215 ++++++++++++ dist/jsr/index.d.ts | 229 +++++++++++- dist/npm/index.d.mts | 229 +++++++++++- dist/npm/index.d.ts | 229 +++++++++++- dist/npm/package-lock.json | 239 ++++++++----- dist/npm/package.json | 7 +- export.sh | 26 +- 15 files changed, 2233 insertions(+), 211 deletions(-) create mode 100644 dist/dts/_extracted.d.ts create mode 100644 dist/dts/export/index.d.ts.orig create mode 100644 dist/dts/ext/events.d.ts create mode 100644 dist/dts/ext/pg.d.ts create mode 100644 dist/dts/ext/subtls.d.ts delete mode 100644 dist/dts/shims/net/index.d.ts.orig create mode 100644 dist/dts/subtls.d.ts diff --git a/api-extractor.json b/api-extractor.json index 07bf1f9..92ea45d 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -4,7 +4,7 @@ "enumMemberOrder": "preserve", "dtsRollup": { "enabled": true, - "untrimmedFilePath": "dist/npm/index.d.ts" + "untrimmedFilePath": "dist/dts/_extracted.d.ts" }, "apiReport": { "enabled": false diff --git a/dist/dts/_extracted.d.ts b/dist/dts/_extracted.d.ts new file mode 100644 index 0000000..3a047e1 --- /dev/null +++ b/dist/dts/_extracted.d.ts @@ -0,0 +1,537 @@ +import { Client as Client_2 } from 'pg'; +import { ClientBase } from 'pg'; +import { Connection } from 'pg'; +import { DatabaseError } from 'pg'; +import { defaults } from 'pg'; +import { EventEmitter } from 'events'; +import { Pool as Pool_2 } from 'pg'; +import { Query } from 'pg'; +import type { Socket } from 'net'; +import { types } from 'pg'; + +declare const allKeyUsages: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"]; + +declare class ASN1Bytes extends Bytes { + readASN1Length(comment?: string): number; + expectASN1Length(comment?: string): readonly [() => void, () => number]; + readASN1OID(comment?: string): string; + readASN1Boolean(comment?: string): boolean; + readASN1UTCTime(): Date; + readASN1GeneralizedTime(): Date; + readASN1BitString(): Uint8Array; +} + +declare function base64Decode(input: string, charCodes?: typeof stdCharCodes, autoPad?: boolean): Uint8Array; + +declare class Bytes { + offset: number; + dataView: DataView; + data: Uint8Array; + comments: Record; + indents: Record; + indent: number; + constructor(arrayOrMaxBytes: number | Uint8Array); + extend(arrayOrMaxBytes: number | Uint8Array): void; + remaining(): number; + subarray(length: number): Uint8Array; + skip(length: number, comment?: string): this; + comment(s: string, offset?: number): this; + lengthComment(length: number, comment?: string, inclusive?: boolean): string; + readBytes(length: number): Uint8Array; + readUTF8String(length: number): string; + readUTF8StringNullTerminated(): string; + readUint8(comment?: string): number; + readUint16(comment?: string): number; + readUint24(comment?: string): number; + readUint32(comment?: string): number; + expectBytes(expected: Uint8Array | number[], comment?: string): void; + expectUint8(expectedValue: number, comment?: string): void; + expectUint16(expectedValue: number, comment?: string): void; + expectUint24(expectedValue: number, comment?: string): void; + expectUint32(expectedValue: number, comment?: string): void; + expectLength(length: number, indentDelta?: number): readonly [() => void, () => number]; + expectLengthUint8(comment?: string): readonly [() => void, () => number]; + expectLengthUint16(comment?: string): readonly [() => void, () => number]; + expectLengthUint24(comment?: string): readonly [() => void, () => number]; + expectLengthUint32(comment?: string): readonly [() => void, () => number]; + expectLengthUint8Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint16Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint24Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint32Incl(comment?: string): readonly [() => void, () => number]; + writeBytes(bytes: number[] | Uint8Array): this; + writeUTF8String(s: string): this; + writeUTF8StringNullTerminated(s: string): this; + writeUint8(value: number, comment?: string): Bytes; + writeUint16(value: number, comment?: string): Bytes; + writeUint24(value: number, comment?: string): Bytes; + writeUint32(value: number, comment?: string): Bytes; + _writeLengthGeneric(lengthBytes: 1 | 2 | 3 | 4, inclusive: boolean, comment?: string): () => void; + writeLengthUint8(comment?: string): () => void; + writeLengthUint16(comment?: string): () => void; + writeLengthUint24(comment?: string): () => void; + writeLengthUint32(comment?: string): () => void; + writeLengthUint8Incl(comment?: string): () => void; + writeLengthUint16Incl(comment?: string): () => void; + writeLengthUint24Incl(comment?: string): () => void; + writeLengthUint32Incl(comment?: string): () => void; + array(): Uint8Array; + commentedString(all?: boolean): string; +} + +declare class Cert { + serialNumber: Uint8Array; + algorithm: OID; + issuer: DistinguishedName; + validityPeriod: { + notBefore: Date; + notAfter: Date; + }; + subject: DistinguishedName; + publicKey: { + identifiers: OID[]; + data: Uint8Array; + all: Uint8Array; + }; + signature: Uint8Array; + keyUsage?: { + critical?: boolean; + usages: Set; + }; + subjectAltNames?: string[]; + extKeyUsage?: { + clientTls?: true; + serverTls?: true; + }; + authorityKeyIdentifier?: Uint8Array; + subjectKeyIdentifier?: Uint8Array; + basicConstraints?: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: Uint8Array; + static distinguishedNamesAreEqual(dn1: DistinguishedName, dn2: DistinguishedName): boolean; + static stringFromDistinguishedName(dn: DistinguishedName): string; + constructor(certData: Uint8Array | ASN1Bytes | CertJSON); + subjectAltNameMatchingHost(host: string): string | undefined; + isValidAtMoment(moment?: Date): boolean; + description(): string; + toJSON(): { + serialNumber: string; + algorithm: string; + issuer: DistinguishedName; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + subject: DistinguishedName; + publicKey: { + identifiers: string[]; + data: string; + all: string; + }; + signature: string; + keyUsage: { + critical: boolean | undefined; + usages: ("digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly")[]; + }; + subjectAltNames: string[] | undefined; + extKeyUsage: { + clientTls?: true; + serverTls?: true; + } | undefined; + authorityKeyIdentifier: string | undefined; + subjectKeyIdentifier: string | undefined; + basicConstraints: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: string; + }; + static uint8ArraysFromPEM(pem: string): Uint8Array[]; + static fromPEM(pem: string): Cert[]; +} + +declare type CertJSON = ReturnType; + +/** + * We export the pg library mostly unchanged, but we do make a few tweaks. + * + * (1) Connecting and querying can require a lot of network round-trips. We + * add a pipelining option for the connection (startup + auth + first query), + * but this works with cleartext password auth only. We can also pipeline TLS + * startup, but currently this works only with Neon hosts (not vanilla pg or + * pgbouncer). + * + * (2) SCRAM auth is deliberately CPU-intensive, and this is not appropriate + * for a serverless environment. In case it is still used, however, we replace + * the standard (synchronous) pg implementation with one that uses SubtleCrypto + * for repeated SHA-256 digests. This saves some time and CPU. + * + * (3) We now (experimentally) redirect Pool.query over a fetch request if the + * circumstances are right. + */ +export declare interface Client { + connection: Connection & { + stream: neonConfig; + sendSCRAMClientFinalMessage: (response: any) => void; + ssl: any; + }; + _handleReadyForQuery: any; + _handleAuthCleartextPassword: any; + startup: any; + getStartupConf: any; + saslSession: any; +} + +export declare class Client extends Client_2 { + config: any; + get neonConfig(): NeonConfigGlobalAndClient; + constructor(config: any); + connect(): Promise; + connect(callback: (err?: Error) => void): void; + _handleAuthSASLContinue(msg: any): Promise; +} + +export { ClientBase } + +export { Connection } + +export { DatabaseError } + +declare interface DataRequest { + bytes: number; + resolve: (data: Uint8Array | undefined) => void; +} + +export { defaults } + +declare type DistinguishedName = Record; + +declare interface FetchEndpointOptions { + jwtAuth?: boolean; +} + +declare function hexFromU8(u8: Uint8Array | number[], spacer?: string): string; + +declare interface HTTPQueryOptions { + arrayMode?: boolean; + fullResults?: boolean; + fetchOptions?: Record; + types?: typeof types; + queryCallback?: (query: ParameterizedQuery) => void; + resultCallback?: (query: ParameterizedQuery, result: any, rows: any, opts: any) => void; + authToken?: string | (() => Promise | string); +} + +declare interface HTTPTransactionOptions extends HTTPQueryOptions { + isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; + readOnly?: boolean; + deferrable?: boolean; +} + +export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { + (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; + transaction(queries: NeonQueryPromise[] | ((sql: (strings: TemplateStringsArray | string, ...params: any[]) => NeonQueryPromise) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; +}; + +export declare class neonConfig extends EventEmitter { + static defaults: SocketDefaults; + static opts: Partial; + private opts; + static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; + static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); + static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; + static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); + static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); + static get fetchFunction(): SocketDefaults["fetchFunction"]; + static set fetchFunction(newValue: SocketDefaults['fetchFunction']); + static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + static get wsProxy(): SocketDefaults["wsProxy"]; + static set wsProxy(newValue: SocketDefaults['wsProxy']); + get wsProxy(): SocketDefaults["wsProxy"]; + set wsProxy(newValue: SocketDefaults['wsProxy']); + static get coalesceWrites(): SocketDefaults["coalesceWrites"]; + static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + get coalesceWrites(): SocketDefaults["coalesceWrites"]; + set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + static get disableSNI(): SocketDefaults["disableSNI"]; + static set disableSNI(newValue: SocketDefaults['disableSNI']); + get disableSNI(): SocketDefaults["disableSNI"]; + set disableSNI(newValue: SocketDefaults['disableSNI']); + static get pipelineConnect(): SocketDefaults["pipelineConnect"]; + static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + get pipelineConnect(): SocketDefaults["pipelineConnect"]; + set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + static get subtls(): SocketDefaults["subtls"]; + static set subtls(newValue: SocketDefaults['subtls']); + get subtls(): SocketDefaults["subtls"]; + set subtls(newValue: SocketDefaults['subtls']); + static get pipelineTLS(): SocketDefaults["pipelineTLS"]; + static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + get pipelineTLS(): SocketDefaults["pipelineTLS"]; + set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + static get rootCerts(): SocketDefaults["rootCerts"]; + static set rootCerts(newValue: SocketDefaults['rootCerts']); + get rootCerts(): SocketDefaults["rootCerts"]; + set rootCerts(newValue: SocketDefaults['rootCerts']); + wsProxyAddrForHost(host: string, port: number): string; + connecting: boolean; + pending: boolean; + writable: boolean; + encrypted: boolean; + authorized: boolean; + destroyed: boolean; + private ws; + private writeBuffer; + private tlsState; + private tlsRead; + private tlsWrite; + setNoDelay(): this; + setKeepAlive(): this; + ref(): this; + unref(): this; + connect(port: number | string, host: string, connectListener?: () => void): void; + startTls(host: string): Promise; + tlsReadLoop(): Promise; + rawWrite(data: Uint8Array): void; + write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; + end(data?: Buffer | string, encoding?: string, callback?: () => void): this; + destroy(): this; +} + +declare interface NeonConfigGlobalAndClient { + /** + * If no global `WebSocket` object is available, set `webSocketConstructor` + * to the constructor for a custom WebSocket implementation, such as those + * provided by `ws` or `undici`. + */ + webSocketConstructor: any; + /** + * Set `wsProxy` to use your own WebSocket proxy server. + * + * Provide either the proxy server’s domain name, or a function that takes + * the database host and port and returns the proxy server address (without + * protocol). + * + * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` + * + * Default: `host => host + '/v2'` + */ + wsProxy: string | ((host: string, port: number | string) => string) | undefined; + /** + * Use a secure (`wss:`) connection to the WebSocket proxy. + * + * Default: `true`. + */ + useSecureWebSocket: boolean; + /** + * Disable TLS encryption in the Postgres protocol (as set via e.g. + * `?sslmode=require` in the connection string). Connection remains secure + * if `useSecureWebSocket` is `true`. + * + * Default: `true` + */ + forceDisablePgSSL: boolean; + /** + * Pipelines the startup message, cleartext password message and first query + * when set to `"password"`. This works only for cleartext password auth. + * + * Default: `"password"`. + */ + pipelineConnect: 'password' | false; + /** + * If `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS, you must supply the subtls TLS library to this option: + * + * ``` + * import { neonConfig } from '@neondatabase/serverless'; + * import * as subtls from 'subtls'; + * neonConfig.subtls = subtls; + * ``` + * + * Default: `undefined`. + */ + subtls: any; + /** + * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is + * `false` and the Postgres connection parameters specify TLS. Currently + * compatible only with Neon hosts. + * + * Default: `false`. + */ + pipelineTLS: boolean; + /** + * Set `rootCerts` to a string comprising one or more PEM files. These are + * the trusted root certificates for a TLS connection to Postgres when + * `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS. + * + * Default: `""`. + */ + rootCerts: string; + /** + * Batch multiple network writes per run-loop into a single outgoing + * WebSocket message. + * + * Default: `true`. + */ + coalesceWrites: boolean; + /** + * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the + * Postgres connection parameters specify TLS, we send no SNI data in the + * Postgres TLS handshake. + * + * On Neon, disabling SNI and including the Neon project name in the password + * avoids CPU-intensive SCRAM authentication, but this is only relevant for + * earlier iterations of Neon's WebSocket support. + * + * Default: `false`. + */ + disableSNI: boolean; +} + +export declare class NeonDbError extends Error { + name: "NeonDbError"; + severity: string | undefined; + code: string | undefined; + detail: string | undefined; + hint: string | undefined; + position: string | undefined; + internalPosition: string | undefined; + internalQuery: string | undefined; + where: string | undefined; + schema: string | undefined; + table: string | undefined; + column: string | undefined; + dataType: string | undefined; + constraint: string | undefined; + file: string | undefined; + line: string | undefined; + routine: string | undefined; + sourceError: Error | undefined; + constructor(message: string); +} + +declare interface NeonQueryPromise extends Promise { + parameterizedQuery: ParameterizedQuery; + opts?: HTTPQueryOptions; +} + +declare type OID = string; + +declare interface ParameterizedQuery { + query: string; + params: any[]; +} + +export declare class Pool extends Pool_2 { + Client: typeof Client; + hasFetchUnsupportedListeners: boolean; + on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + query(config?: any, values?: any, cb?: any): any; +} + +export { Query } + +declare abstract class ReadQueue { + queue: Uint8Array[]; + outstandingRequest: DataRequest | undefined; + constructor(); + abstract socketIsNotClosed(): boolean; + enqueue(data: Uint8Array): void; + dequeue(): void; + bytesInQueue(): number; + read(bytes: number): Promise | undefined>; +} + +declare type RootCertsData = Uint8Array; + +declare interface RootCertsDatabase { + index: RootCertsIndex; + data: RootCertsData; +} + +declare interface RootCertsIndex { + offsets: number[]; + subjects: Record; +} + +declare interface SocketDefaults { + poolQueryViaFetch: boolean; + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchConnectionCache: boolean; + fetchFunction: any; + webSocketConstructor: typeof WebSocket | undefined; + wsProxy: string | ((host: string, port: number | string) => string); + useSecureWebSocket: boolean; + forceDisablePgSSL: boolean; + coalesceWrites: boolean; + pipelineConnect: 'password' | false; + subtls: typeof subtls | undefined; + rootCerts: string; + pipelineTLS: boolean; + disableSNI: boolean; +} + +declare class SocketReadQueue extends ReadQueue { + private socket; + constructor(socket: Socket); + socketIsNotClosed(): boolean; +} + +declare function stableStringify(x: any, replacer?: (key: string, value: any) => any, indent?: string | number): string; + +declare function startTls(host: string, rootCertsDatabase: RootCertsDatabase | string, networkRead: (bytes: number) => Promise, networkWrite: (data: Uint8Array) => void, { useSNI, requireServerTlsExtKeyUsage, requireDigitalSigKeyUsage, writePreData, expectPreData, commentPreData }?: { + useSNI?: boolean; + requireServerTlsExtKeyUsage?: boolean; + requireDigitalSigKeyUsage?: boolean; + writePreData?: Uint8Array; + expectPreData?: Uint8Array; + commentPreData?: string; +}): Promise Promise | undefined>, (data: Uint8Array) => Promise]>; + +declare function stdCharCodes(charCode: number): number | void; + +declare namespace subtls { + export { + base64Decode, + hexFromU8, + stableStringify, + startTls, + u8FromHex, + SocketReadQueue, + TrustedCert, + WebSocketReadQueue + } +} + +declare class TrustedCert extends Cert { + static databaseFromPEM(pem: string): RootCertsDatabase; + static findInDatabase(subjectOrSubjectKeyId: DistinguishedName | string, db: RootCertsDatabase): TrustedCert | undefined; +} + +export { types } + +declare function u8FromHex(hex: string): Uint8Array; + +declare class WebSocketReadQueue extends ReadQueue { + private socket; + constructor(socket: WebSocket); + socketIsNotClosed(): boolean; +} + +export { } diff --git a/dist/dts/export/index.d.ts.orig b/dist/dts/export/index.d.ts.orig new file mode 100644 index 0000000..761e01a --- /dev/null +++ b/dist/dts/export/index.d.ts.orig @@ -0,0 +1,49 @@ +import { Client, Connection, Pool } from 'pg'; +import { Socket } from '../shims/net'; +import { neon, NeonDbError } from './httpQuery'; +import type { NeonConfigGlobalAndClient } from './neonConfig'; +/** + * We export the pg library mostly unchanged, but we do make a few tweaks. + * + * (1) Connecting and querying can require a lot of network round-trips. We + * add a pipelining option for the connection (startup + auth + first query), + * but this works with cleartext password auth only. We can also pipeline TLS + * startup, but currently this works only with Neon hosts (not vanilla pg or + * pgbouncer). + * + * (2) SCRAM auth is deliberately CPU-intensive, and this is not appropriate + * for a serverless environment. In case it is still used, however, we replace + * the standard (synchronous) pg implementation with one that uses SubtleCrypto + * for repeated SHA-256 digests. This saves some time and CPU. + * + * (3) We now (experimentally) redirect Pool.query over a fetch request if the + * circumstances are right. + */ +declare interface NeonClient { + connection: Connection & { + stream: Socket; + sendSCRAMClientFinalMessage: (response: any) => void; + ssl: any; + }; + _handleReadyForQuery: any; + _handleAuthCleartextPassword: any; + startup: any; + getStartupConf: any; + saslSession: any; +} +declare class NeonClient extends Client { + config: any; + get neonConfig(): NeonConfigGlobalAndClient; + constructor(config: any); + connect(): Promise; + connect(callback: (err?: Error) => void): void; + _handleAuthSASLContinue(msg: any): Promise; +} +declare class NeonPool extends Pool { + Client: typeof NeonClient; + hasFetchUnsupportedListeners: boolean; + on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + query(config?: any, values?: any, cb?: any): any; +} +export { Socket as neonConfig, NeonPool as Pool, NeonClient as Client, neon, NeonDbError, }; +export { Connection, DatabaseError, Query, ClientBase, defaults, types, } from 'pg'; diff --git a/dist/dts/ext/events.d.ts b/dist/dts/ext/events.d.ts new file mode 100644 index 0000000..d04af49 --- /dev/null +++ b/dist/dts/ext/events.d.ts @@ -0,0 +1,22 @@ +export type Listener = (...args: any[]) => void; + +export class EventEmitter { + static listenerCount(emitter: EventEmitter, type: string | number): number; + static defaultMaxListeners: number; + + eventNames(): Array; + setMaxListeners(n: number): this; + getMaxListeners(): number; + emit(type: string | number, ...args: any[]): boolean; + addListener(type: string | number, listener: Listener): this; + on(type: string | number, listener: Listener): this; + once(type: string | number, listener: Listener): this; + prependListener(type: string | number, listener: Listener): this; + prependOnceListener(type: string | number, listener: Listener): this; + removeListener(type: string | number, listener: Listener): this; + off(type: string | number, listener: Listener): this; + removeAllListeners(type?: string | number): this; + listeners(type: string | number): Listener[]; + listenerCount(type: string | number): number; + rawListeners(type: string | number): Listener[]; +} diff --git a/dist/dts/ext/pg.d.ts b/dist/dts/ext/pg.d.ts new file mode 100644 index 0000000..94a942e --- /dev/null +++ b/dist/dts/ext/pg.d.ts @@ -0,0 +1,325 @@ +/// + +import events = require("events"); +import stream = require("stream"); +import pgTypes = require("pg-types"); +import { NoticeMessage } from "pg-protocol/dist/messages"; + +import { ConnectionOptions } from "tls"; + +export type QueryConfigValues = T extends Array ? T : never; + +export interface ClientConfig { + user?: string | undefined; + database?: string | undefined; + password?: string | (() => string | Promise) | undefined; + port?: number | undefined; + host?: string | undefined; + connectionString?: string | undefined; + keepAlive?: boolean | undefined; + stream?: () => stream.Duplex | stream.Duplex | undefined; + statement_timeout?: false | number | undefined; + ssl?: boolean | ConnectionOptions | undefined; + query_timeout?: number | undefined; + keepAliveInitialDelayMillis?: number | undefined; + idle_in_transaction_session_timeout?: number | undefined; + application_name?: string | undefined; + connectionTimeoutMillis?: number | undefined; + types?: CustomTypesConfig | undefined; + options?: string | undefined; +} + +export type ConnectionConfig = ClientConfig; + +export interface Defaults extends ClientConfig { + poolSize?: number | undefined; + poolIdleTimeout?: number | undefined; + reapIntervalMillis?: number | undefined; + binary?: boolean | undefined; + parseInt8?: boolean | undefined; + parseInputDatesAsUTC?: boolean | undefined; +} + +export interface PoolConfig extends ClientConfig { + // properties from module 'node-pool' + max?: number | undefined; + min?: number | undefined; + idleTimeoutMillis?: number | undefined | null; + log?: ((...messages: any[]) => void) | undefined; + Promise?: PromiseConstructorLike | undefined; + allowExitOnIdle?: boolean | undefined; + maxUses?: number | undefined; + maxLifetimeSeconds?: number | undefined; + Client?: (new() => ClientBase) | undefined; +} + +export interface QueryConfig { + name?: string | undefined; + text: string; + values?: QueryConfigValues; + types?: CustomTypesConfig | undefined; +} + +export interface CustomTypesConfig { + getTypeParser: typeof pgTypes.getTypeParser; +} + +export interface Submittable { + submit: (connection: Connection) => void; +} + +export interface QueryArrayConfig extends QueryConfig { + rowMode: "array"; +} + +export interface FieldDef { + name: string; + tableID: number; + columnID: number; + dataTypeID: number; + dataTypeSize: number; + dataTypeModifier: number; + format: string; +} + +export interface QueryResultBase { + command: string; + rowCount: number | null; + oid: number; + fields: FieldDef[]; +} + +export interface QueryResultRow { + [column: string]: any; +} + +export interface QueryResult extends QueryResultBase { + rows: R[]; +} + +export interface QueryArrayResult extends QueryResultBase { + rows: R[]; +} + +export interface Notification { + processId: number; + channel: string; + payload?: string | undefined; +} + +export interface ResultBuilder extends QueryResult { + addRow(row: R): void; +} + +export interface QueryParse { + name: string; + text: string; + types: string[]; +} + +type ValueMapper = (param: any, index: number) => any; + +export interface BindConfig { + portal?: string | undefined; + statement?: string | undefined; + binary?: string | undefined; + values?: Array | undefined; + valueMapper?: ValueMapper | undefined; +} + +export interface ExecuteConfig { + portal?: string | undefined; + rows?: string | undefined; +} + +export interface MessageConfig { + type: string; + name?: string | undefined; +} + +export function escapeIdentifier(str: string): string; + +export function escapeLiteral(str: string): string; + +export class Connection extends events.EventEmitter { + readonly stream: stream.Duplex; + + constructor(config?: ConnectionConfig); + + bind(config: BindConfig | null, more: boolean): void; + execute(config: ExecuteConfig | null, more: boolean): void; + parse(query: QueryParse, more: boolean): void; + + query(text: string): void; + + describe(msg: MessageConfig, more: boolean): void; + close(msg: MessageConfig, more: boolean): void; + + flush(): void; + sync(): void; + end(): void; +} + +export interface PoolOptions extends PoolConfig { + max: number; + maxUses: number; + allowExitOnIdle: boolean; + maxLifetimeSeconds: number; + idleTimeoutMillis: number | null; +} + +/** + * {@link https://node-postgres.com/apis/pool} + */ +export class Pool extends events.EventEmitter { + /** + * Every field of the config object is entirely optional. + * The config passed to the pool is also passed to every client + * instance within the pool when the pool creates that client. + */ + constructor(config?: PoolConfig); + + readonly totalCount: number; + readonly idleCount: number; + readonly waitingCount: number; + readonly expiredCount: number; + + readonly ending: boolean; + readonly ended: boolean; + + options: PoolOptions; + + connect(): Promise; + connect( + callback: (err: Error | undefined, client: PoolClient | undefined, done: (release?: any) => void) => void, + ): void; + + end(): Promise; + end(callback: () => void): void; + + query(queryStream: T): T; + // tslint:disable:no-unnecessary-generics + query( + queryConfig: QueryArrayConfig, + values?: QueryConfigValues, + ): Promise>; + query( + queryConfig: QueryConfig, + ): Promise>; + query( + queryTextOrConfig: string | QueryConfig, + values?: QueryConfigValues, + ): Promise>; + query( + queryConfig: QueryArrayConfig, + callback: (err: Error, result: QueryArrayResult) => void, + ): void; + query( + queryTextOrConfig: string | QueryConfig, + callback: (err: Error, result: QueryResult) => void, + ): void; + query( + queryText: string, + values: QueryConfigValues, + callback: (err: Error, result: QueryResult) => void, + ): void; + // tslint:enable:no-unnecessary-generics + + on(event: "release" | "error", listener: (err: Error, client: PoolClient) => void): this; + on(event: "connect" | "acquire" | "remove", listener: (client: PoolClient) => void): this; +} + +export class ClientBase extends events.EventEmitter { + constructor(config?: string | ClientConfig); + + connect(): Promise; + connect(callback: (err: Error) => void): void; + + query(queryStream: T): T; + // tslint:disable:no-unnecessary-generics + query( + queryConfig: QueryArrayConfig, + values?: QueryConfigValues, + ): Promise>; + query( + queryConfig: QueryConfig, + ): Promise>; + query( + queryTextOrConfig: string | QueryConfig, + values?: QueryConfigValues, + ): Promise>; + query( + queryConfig: QueryArrayConfig, + callback: (err: Error, result: QueryArrayResult) => void, + ): void; + query( + queryTextOrConfig: string | QueryConfig, + callback: (err: Error, result: QueryResult) => void, + ): void; + query( + queryText: string, + values: QueryConfigValues, + callback: (err: Error, result: QueryResult) => void, + ): void; + // tslint:enable:no-unnecessary-generics + + copyFrom(queryText: string): stream.Writable; + copyTo(queryText: string): stream.Readable; + + pauseDrain(): void; + resumeDrain(): void; + + escapeIdentifier: typeof escapeIdentifier; + escapeLiteral: typeof escapeLiteral; + setTypeParser: typeof pgTypes.setTypeParser; + getTypeParser: typeof pgTypes.getTypeParser; + + on(event: "drain", listener: () => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "notice", listener: (notice: NoticeMessage) => void): this; + on(event: "notification", listener: (message: Notification) => void): this; + // tslint:disable-next-line unified-signatures + on(event: "end", listener: () => void): this; +} + +export class Client extends ClientBase { + user?: string | undefined; + database?: string | undefined; + port: number; + host: string; + password?: string | undefined; + ssl: boolean; + + constructor(config?: string | ClientConfig); + + end(): Promise; + end(callback: (err: Error) => void): void; +} + +export interface PoolClient extends ClientBase { + release(err?: Error | boolean): void; +} + +export class Query extends events.EventEmitter + implements Submittable +{ + constructor(queryTextOrConfig?: string | QueryConfig, values?: QueryConfigValues); + submit: (connection: Connection) => void; + on(event: "row", listener: (row: R, result?: ResultBuilder) => void): this; + on(event: "error", listener: (err: Error) => void): this; + on(event: "end", listener: (result: ResultBuilder) => void): this; +} + +export class Events extends events.EventEmitter { + on(event: "error", listener: (err: Error, client: Client) => void): this; +} + +export const types: typeof pgTypes; + +export const defaults: Defaults & ClientConfig; + +import * as Pg from "."; + +export const native: typeof Pg | null; + +export { DatabaseError } from "pg-protocol"; diff --git a/dist/dts/ext/subtls.d.ts b/dist/dts/ext/subtls.d.ts new file mode 100644 index 0000000..f40e94b --- /dev/null +++ b/dist/dts/ext/subtls.d.ts @@ -0,0 +1,215 @@ +import type { Socket } from 'net'; + +declare const allKeyUsages: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"]; + +declare class ASN1Bytes extends Bytes { + readASN1Length(comment?: string): number; + expectASN1Length(comment?: string): readonly [() => void, () => number]; + readASN1OID(comment?: string): string; + readASN1Boolean(comment?: string): boolean; + readASN1UTCTime(): Date; + readASN1GeneralizedTime(): Date; + readASN1BitString(): Uint8Array; +} + +export declare function base64Decode(input: string, charCodes?: typeof stdCharCodes, autoPad?: boolean): Uint8Array; + +declare class Bytes { + offset: number; + dataView: DataView; + data: Uint8Array; + comments: Record; + indents: Record; + indent: number; + constructor(arrayOrMaxBytes: number | Uint8Array); + extend(arrayOrMaxBytes: number | Uint8Array): void; + remaining(): number; + subarray(length: number): Uint8Array; + skip(length: number, comment?: string): this; + comment(s: string, offset?: number): this; + lengthComment(length: number, comment?: string, inclusive?: boolean): string; + readBytes(length: number): Uint8Array; + readUTF8String(length: number): string; + readUTF8StringNullTerminated(): string; + readUint8(comment?: string): number; + readUint16(comment?: string): number; + readUint24(comment?: string): number; + readUint32(comment?: string): number; + expectBytes(expected: Uint8Array | number[], comment?: string): void; + expectUint8(expectedValue: number, comment?: string): void; + expectUint16(expectedValue: number, comment?: string): void; + expectUint24(expectedValue: number, comment?: string): void; + expectUint32(expectedValue: number, comment?: string): void; + expectLength(length: number, indentDelta?: number): readonly [() => void, () => number]; + expectLengthUint8(comment?: string): readonly [() => void, () => number]; + expectLengthUint16(comment?: string): readonly [() => void, () => number]; + expectLengthUint24(comment?: string): readonly [() => void, () => number]; + expectLengthUint32(comment?: string): readonly [() => void, () => number]; + expectLengthUint8Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint16Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint24Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint32Incl(comment?: string): readonly [() => void, () => number]; + writeBytes(bytes: number[] | Uint8Array): this; + writeUTF8String(s: string): this; + writeUTF8StringNullTerminated(s: string): this; + writeUint8(value: number, comment?: string): Bytes; + writeUint16(value: number, comment?: string): Bytes; + writeUint24(value: number, comment?: string): Bytes; + writeUint32(value: number, comment?: string): Bytes; + _writeLengthGeneric(lengthBytes: 1 | 2 | 3 | 4, inclusive: boolean, comment?: string): () => void; + writeLengthUint8(comment?: string): () => void; + writeLengthUint16(comment?: string): () => void; + writeLengthUint24(comment?: string): () => void; + writeLengthUint32(comment?: string): () => void; + writeLengthUint8Incl(comment?: string): () => void; + writeLengthUint16Incl(comment?: string): () => void; + writeLengthUint24Incl(comment?: string): () => void; + writeLengthUint32Incl(comment?: string): () => void; + array(): Uint8Array; + commentedString(all?: boolean): string; +} + +declare class Cert { + serialNumber: Uint8Array; + algorithm: OID; + issuer: DistinguishedName; + validityPeriod: { + notBefore: Date; + notAfter: Date; + }; + subject: DistinguishedName; + publicKey: { + identifiers: OID[]; + data: Uint8Array; + all: Uint8Array; + }; + signature: Uint8Array; + keyUsage?: { + critical?: boolean; + usages: Set; + }; + subjectAltNames?: string[]; + extKeyUsage?: { + clientTls?: true; + serverTls?: true; + }; + authorityKeyIdentifier?: Uint8Array; + subjectKeyIdentifier?: Uint8Array; + basicConstraints?: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: Uint8Array; + static distinguishedNamesAreEqual(dn1: DistinguishedName, dn2: DistinguishedName): boolean; + static stringFromDistinguishedName(dn: DistinguishedName): string; + constructor(certData: Uint8Array | ASN1Bytes | CertJSON); + subjectAltNameMatchingHost(host: string): string | undefined; + isValidAtMoment(moment?: Date): boolean; + description(): string; + toJSON(): { + serialNumber: string; + algorithm: string; + issuer: DistinguishedName; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + subject: DistinguishedName; + publicKey: { + identifiers: string[]; + data: string; + all: string; + }; + signature: string; + keyUsage: { + critical: boolean | undefined; + usages: ("digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly")[]; + }; + subjectAltNames: string[] | undefined; + extKeyUsage: { + clientTls?: true; + serverTls?: true; + } | undefined; + authorityKeyIdentifier: string | undefined; + subjectKeyIdentifier: string | undefined; + basicConstraints: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: string; + }; + static uint8ArraysFromPEM(pem: string): Uint8Array[]; + static fromPEM(pem: string): Cert[]; +} + +declare type CertJSON = ReturnType; + +declare interface DataRequest { + bytes: number; + resolve: (data: Uint8Array | undefined) => void; +} + +declare type DistinguishedName = Record; + +export declare function hexFromU8(u8: Uint8Array | number[], spacer?: string): string; + +declare type OID = string; + +declare abstract class ReadQueue { + queue: Uint8Array[]; + outstandingRequest: DataRequest | undefined; + constructor(); + abstract socketIsNotClosed(): boolean; + enqueue(data: Uint8Array): void; + dequeue(): void; + bytesInQueue(): number; + read(bytes: number): Promise | undefined>; +} + +declare type RootCertsData = Uint8Array; + +declare interface RootCertsDatabase { + index: RootCertsIndex; + data: RootCertsData; +} + +declare interface RootCertsIndex { + offsets: number[]; + subjects: Record; +} + +export declare class SocketReadQueue extends ReadQueue { + private socket; + constructor(socket: Socket); + socketIsNotClosed(): boolean; +} + +export declare function stableStringify(x: any, replacer?: (key: string, value: any) => any, indent?: string | number): string; + +export declare function startTls(host: string, rootCertsDatabase: RootCertsDatabase | string, networkRead: (bytes: number) => Promise, networkWrite: (data: Uint8Array) => void, { useSNI, requireServerTlsExtKeyUsage, requireDigitalSigKeyUsage, writePreData, expectPreData, commentPreData }?: { + useSNI?: boolean; + requireServerTlsExtKeyUsage?: boolean; + requireDigitalSigKeyUsage?: boolean; + writePreData?: Uint8Array; + expectPreData?: Uint8Array; + commentPreData?: string; +}): Promise Promise | undefined>, (data: Uint8Array) => Promise]>; + +declare function stdCharCodes(charCode: number): number | void; + +export declare class TrustedCert extends Cert { + static databaseFromPEM(pem: string): RootCertsDatabase; + static findInDatabase(subjectOrSubjectKeyId: DistinguishedName | string, db: RootCertsDatabase): TrustedCert | undefined; +} + +export declare function u8FromHex(hex: string): Uint8Array; + +export declare class WebSocketReadQueue extends ReadQueue { + private socket; + constructor(socket: WebSocket); + socketIsNotClosed(): boolean; +} + +export { } diff --git a/dist/dts/shims/net/index.d.ts b/dist/dts/shims/net/index.d.ts index 9c7c0ae..34cfac8 100644 --- a/dist/dts/shims/net/index.d.ts +++ b/dist/dts/shims/net/index.d.ts @@ -6,7 +6,7 @@ * (node-postgres). */ import { EventEmitter } from 'events'; -import type * as subtls from 'subtls'; +import type * as subtls from '../../subtls.d.ts'; export declare function isIP(input: string): number; interface FetchEndpointOptions { jwtAuth?: boolean; diff --git a/dist/dts/shims/net/index.d.ts.orig b/dist/dts/shims/net/index.d.ts.orig deleted file mode 100644 index b891b28..0000000 --- a/dist/dts/shims/net/index.d.ts.orig +++ /dev/null @@ -1,118 +0,0 @@ -/** - * This file shims parts of the Node.js built-in net and tls packages, by - * implementing net.Socket and tls.connect() on top of WebSockets. It's - * designed to work both in browsers and in Cloudflare Workers (where - * WebSockets work a bit differently). The calling client is assumed to be pg - * (node-postgres). - */ -import { EventEmitter } from 'events'; -import type * as subtls from 'subtls'; -declare global { - const debug: boolean; - interface WebSocket { - binaryType: 'arraybuffer' | 'blob'; - accept?: () => void; - } - interface Response { - webSocket: WebSocket; - } - class __unstable_WebSocket extends WebSocket { - } -} -export declare function isIP(input: string): number; -interface FetchEndpointOptions { - jwtAuth?: boolean; -} -export interface SocketDefaults { - poolQueryViaFetch: boolean; - fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); - fetchConnectionCache: boolean; - fetchFunction: any; - webSocketConstructor: typeof WebSocket | undefined; - wsProxy: string | ((host: string, port: number | string) => string); - useSecureWebSocket: boolean; - forceDisablePgSSL: boolean; - coalesceWrites: boolean; - pipelineConnect: 'password' | false; - subtls: typeof subtls | undefined; - rootCerts: string; - pipelineTLS: boolean; - disableSNI: boolean; -} -export declare class Socket extends EventEmitter { - static defaults: SocketDefaults; - static opts: Partial; - private opts; - static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; - static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); - static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; - static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); - static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; - static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); - static get fetchFunction(): SocketDefaults["fetchFunction"]; - static set fetchFunction(newValue: SocketDefaults['fetchFunction']); - static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; - static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); - get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; - set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); - static get wsProxy(): SocketDefaults["wsProxy"]; - static set wsProxy(newValue: SocketDefaults['wsProxy']); - get wsProxy(): SocketDefaults["wsProxy"]; - set wsProxy(newValue: SocketDefaults['wsProxy']); - static get coalesceWrites(): SocketDefaults["coalesceWrites"]; - static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); - get coalesceWrites(): SocketDefaults["coalesceWrites"]; - set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); - static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; - static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); - get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; - set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); - static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; - static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); - get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; - set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); - static get disableSNI(): SocketDefaults["disableSNI"]; - static set disableSNI(newValue: SocketDefaults['disableSNI']); - get disableSNI(): SocketDefaults["disableSNI"]; - set disableSNI(newValue: SocketDefaults['disableSNI']); - static get pipelineConnect(): SocketDefaults["pipelineConnect"]; - static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); - get pipelineConnect(): SocketDefaults["pipelineConnect"]; - set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); - static get subtls(): SocketDefaults["subtls"]; - static set subtls(newValue: SocketDefaults['subtls']); - get subtls(): SocketDefaults["subtls"]; - set subtls(newValue: SocketDefaults['subtls']); - static get pipelineTLS(): SocketDefaults["pipelineTLS"]; - static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); - get pipelineTLS(): SocketDefaults["pipelineTLS"]; - set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); - static get rootCerts(): SocketDefaults["rootCerts"]; - static set rootCerts(newValue: SocketDefaults['rootCerts']); - get rootCerts(): SocketDefaults["rootCerts"]; - set rootCerts(newValue: SocketDefaults['rootCerts']); - wsProxyAddrForHost(host: string, port: number): string; - connecting: boolean; - pending: boolean; - writable: boolean; - encrypted: boolean; - authorized: boolean; - destroyed: boolean; - private ws; - private writeBuffer; - private tlsState; - private tlsRead; - private tlsWrite; - setNoDelay(): this; - setKeepAlive(): this; - ref(): this; - unref(): this; - connect(port: number | string, host: string, connectListener?: () => void): void; - startTls(host: string): Promise; - tlsReadLoop(): Promise; - rawWrite(data: Uint8Array): void; - write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; - end(data?: Buffer | string, encoding?: string, callback?: () => void): this; - destroy(): this; -} -export {}; diff --git a/dist/dts/subtls.d.ts b/dist/dts/subtls.d.ts new file mode 100644 index 0000000..f40e94b --- /dev/null +++ b/dist/dts/subtls.d.ts @@ -0,0 +1,215 @@ +import type { Socket } from 'net'; + +declare const allKeyUsages: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"]; + +declare class ASN1Bytes extends Bytes { + readASN1Length(comment?: string): number; + expectASN1Length(comment?: string): readonly [() => void, () => number]; + readASN1OID(comment?: string): string; + readASN1Boolean(comment?: string): boolean; + readASN1UTCTime(): Date; + readASN1GeneralizedTime(): Date; + readASN1BitString(): Uint8Array; +} + +export declare function base64Decode(input: string, charCodes?: typeof stdCharCodes, autoPad?: boolean): Uint8Array; + +declare class Bytes { + offset: number; + dataView: DataView; + data: Uint8Array; + comments: Record; + indents: Record; + indent: number; + constructor(arrayOrMaxBytes: number | Uint8Array); + extend(arrayOrMaxBytes: number | Uint8Array): void; + remaining(): number; + subarray(length: number): Uint8Array; + skip(length: number, comment?: string): this; + comment(s: string, offset?: number): this; + lengthComment(length: number, comment?: string, inclusive?: boolean): string; + readBytes(length: number): Uint8Array; + readUTF8String(length: number): string; + readUTF8StringNullTerminated(): string; + readUint8(comment?: string): number; + readUint16(comment?: string): number; + readUint24(comment?: string): number; + readUint32(comment?: string): number; + expectBytes(expected: Uint8Array | number[], comment?: string): void; + expectUint8(expectedValue: number, comment?: string): void; + expectUint16(expectedValue: number, comment?: string): void; + expectUint24(expectedValue: number, comment?: string): void; + expectUint32(expectedValue: number, comment?: string): void; + expectLength(length: number, indentDelta?: number): readonly [() => void, () => number]; + expectLengthUint8(comment?: string): readonly [() => void, () => number]; + expectLengthUint16(comment?: string): readonly [() => void, () => number]; + expectLengthUint24(comment?: string): readonly [() => void, () => number]; + expectLengthUint32(comment?: string): readonly [() => void, () => number]; + expectLengthUint8Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint16Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint24Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint32Incl(comment?: string): readonly [() => void, () => number]; + writeBytes(bytes: number[] | Uint8Array): this; + writeUTF8String(s: string): this; + writeUTF8StringNullTerminated(s: string): this; + writeUint8(value: number, comment?: string): Bytes; + writeUint16(value: number, comment?: string): Bytes; + writeUint24(value: number, comment?: string): Bytes; + writeUint32(value: number, comment?: string): Bytes; + _writeLengthGeneric(lengthBytes: 1 | 2 | 3 | 4, inclusive: boolean, comment?: string): () => void; + writeLengthUint8(comment?: string): () => void; + writeLengthUint16(comment?: string): () => void; + writeLengthUint24(comment?: string): () => void; + writeLengthUint32(comment?: string): () => void; + writeLengthUint8Incl(comment?: string): () => void; + writeLengthUint16Incl(comment?: string): () => void; + writeLengthUint24Incl(comment?: string): () => void; + writeLengthUint32Incl(comment?: string): () => void; + array(): Uint8Array; + commentedString(all?: boolean): string; +} + +declare class Cert { + serialNumber: Uint8Array; + algorithm: OID; + issuer: DistinguishedName; + validityPeriod: { + notBefore: Date; + notAfter: Date; + }; + subject: DistinguishedName; + publicKey: { + identifiers: OID[]; + data: Uint8Array; + all: Uint8Array; + }; + signature: Uint8Array; + keyUsage?: { + critical?: boolean; + usages: Set; + }; + subjectAltNames?: string[]; + extKeyUsage?: { + clientTls?: true; + serverTls?: true; + }; + authorityKeyIdentifier?: Uint8Array; + subjectKeyIdentifier?: Uint8Array; + basicConstraints?: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: Uint8Array; + static distinguishedNamesAreEqual(dn1: DistinguishedName, dn2: DistinguishedName): boolean; + static stringFromDistinguishedName(dn: DistinguishedName): string; + constructor(certData: Uint8Array | ASN1Bytes | CertJSON); + subjectAltNameMatchingHost(host: string): string | undefined; + isValidAtMoment(moment?: Date): boolean; + description(): string; + toJSON(): { + serialNumber: string; + algorithm: string; + issuer: DistinguishedName; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + subject: DistinguishedName; + publicKey: { + identifiers: string[]; + data: string; + all: string; + }; + signature: string; + keyUsage: { + critical: boolean | undefined; + usages: ("digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly")[]; + }; + subjectAltNames: string[] | undefined; + extKeyUsage: { + clientTls?: true; + serverTls?: true; + } | undefined; + authorityKeyIdentifier: string | undefined; + subjectKeyIdentifier: string | undefined; + basicConstraints: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: string; + }; + static uint8ArraysFromPEM(pem: string): Uint8Array[]; + static fromPEM(pem: string): Cert[]; +} + +declare type CertJSON = ReturnType; + +declare interface DataRequest { + bytes: number; + resolve: (data: Uint8Array | undefined) => void; +} + +declare type DistinguishedName = Record; + +export declare function hexFromU8(u8: Uint8Array | number[], spacer?: string): string; + +declare type OID = string; + +declare abstract class ReadQueue { + queue: Uint8Array[]; + outstandingRequest: DataRequest | undefined; + constructor(); + abstract socketIsNotClosed(): boolean; + enqueue(data: Uint8Array): void; + dequeue(): void; + bytesInQueue(): number; + read(bytes: number): Promise | undefined>; +} + +declare type RootCertsData = Uint8Array; + +declare interface RootCertsDatabase { + index: RootCertsIndex; + data: RootCertsData; +} + +declare interface RootCertsIndex { + offsets: number[]; + subjects: Record; +} + +export declare class SocketReadQueue extends ReadQueue { + private socket; + constructor(socket: Socket); + socketIsNotClosed(): boolean; +} + +export declare function stableStringify(x: any, replacer?: (key: string, value: any) => any, indent?: string | number): string; + +export declare function startTls(host: string, rootCertsDatabase: RootCertsDatabase | string, networkRead: (bytes: number) => Promise, networkWrite: (data: Uint8Array) => void, { useSNI, requireServerTlsExtKeyUsage, requireDigitalSigKeyUsage, writePreData, expectPreData, commentPreData }?: { + useSNI?: boolean; + requireServerTlsExtKeyUsage?: boolean; + requireDigitalSigKeyUsage?: boolean; + writePreData?: Uint8Array; + expectPreData?: Uint8Array; + commentPreData?: string; +}): Promise Promise | undefined>, (data: Uint8Array) => Promise]>; + +declare function stdCharCodes(charCode: number): number | void; + +export declare class TrustedCert extends Cert { + static databaseFromPEM(pem: string): RootCertsDatabase; + static findInDatabase(subjectOrSubjectKeyId: DistinguishedName | string, db: RootCertsDatabase): TrustedCert | undefined; +} + +export declare function u8FromHex(hex: string): Uint8Array; + +export declare class WebSocketReadQueue extends ReadQueue { + private socket; + constructor(socket: WebSocket); + socketIsNotClosed(): boolean; +} + +export { } diff --git a/dist/jsr/index.d.ts b/dist/jsr/index.d.ts index f0e2b72..89b1371 100644 --- a/dist/jsr/index.d.ts +++ b/dist/jsr/index.d.ts @@ -1,3 +1,5 @@ +/// + import { Client as Client_2 } from 'pg'; import { ClientBase } from 'pg'; import { Connection } from 'pg'; @@ -6,9 +8,155 @@ import { defaults } from 'pg'; import { EventEmitter } from 'events'; import { Pool as Pool_2 } from 'pg'; import { Query } from 'pg'; -import type * as subtls from 'subtls'; +import type { Socket } from 'net'; import { types } from 'pg'; +declare const allKeyUsages: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"]; + +declare class ASN1Bytes extends Bytes { + readASN1Length(comment?: string): number; + expectASN1Length(comment?: string): readonly [() => void, () => number]; + readASN1OID(comment?: string): string; + readASN1Boolean(comment?: string): boolean; + readASN1UTCTime(): Date; + readASN1GeneralizedTime(): Date; + readASN1BitString(): Uint8Array; +} + +declare function base64Decode(input: string, charCodes?: typeof stdCharCodes, autoPad?: boolean): Uint8Array; + +declare class Bytes { + offset: number; + dataView: DataView; + data: Uint8Array; + comments: Record; + indents: Record; + indent: number; + constructor(arrayOrMaxBytes: number | Uint8Array); + extend(arrayOrMaxBytes: number | Uint8Array): void; + remaining(): number; + subarray(length: number): Uint8Array; + skip(length: number, comment?: string): this; + comment(s: string, offset?: number): this; + lengthComment(length: number, comment?: string, inclusive?: boolean): string; + readBytes(length: number): Uint8Array; + readUTF8String(length: number): string; + readUTF8StringNullTerminated(): string; + readUint8(comment?: string): number; + readUint16(comment?: string): number; + readUint24(comment?: string): number; + readUint32(comment?: string): number; + expectBytes(expected: Uint8Array | number[], comment?: string): void; + expectUint8(expectedValue: number, comment?: string): void; + expectUint16(expectedValue: number, comment?: string): void; + expectUint24(expectedValue: number, comment?: string): void; + expectUint32(expectedValue: number, comment?: string): void; + expectLength(length: number, indentDelta?: number): readonly [() => void, () => number]; + expectLengthUint8(comment?: string): readonly [() => void, () => number]; + expectLengthUint16(comment?: string): readonly [() => void, () => number]; + expectLengthUint24(comment?: string): readonly [() => void, () => number]; + expectLengthUint32(comment?: string): readonly [() => void, () => number]; + expectLengthUint8Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint16Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint24Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint32Incl(comment?: string): readonly [() => void, () => number]; + writeBytes(bytes: number[] | Uint8Array): this; + writeUTF8String(s: string): this; + writeUTF8StringNullTerminated(s: string): this; + writeUint8(value: number, comment?: string): Bytes; + writeUint16(value: number, comment?: string): Bytes; + writeUint24(value: number, comment?: string): Bytes; + writeUint32(value: number, comment?: string): Bytes; + _writeLengthGeneric(lengthBytes: 1 | 2 | 3 | 4, inclusive: boolean, comment?: string): () => void; + writeLengthUint8(comment?: string): () => void; + writeLengthUint16(comment?: string): () => void; + writeLengthUint24(comment?: string): () => void; + writeLengthUint32(comment?: string): () => void; + writeLengthUint8Incl(comment?: string): () => void; + writeLengthUint16Incl(comment?: string): () => void; + writeLengthUint24Incl(comment?: string): () => void; + writeLengthUint32Incl(comment?: string): () => void; + array(): Uint8Array; + commentedString(all?: boolean): string; +} + +declare class Cert { + serialNumber: Uint8Array; + algorithm: OID; + issuer: DistinguishedName; + validityPeriod: { + notBefore: Date; + notAfter: Date; + }; + subject: DistinguishedName; + publicKey: { + identifiers: OID[]; + data: Uint8Array; + all: Uint8Array; + }; + signature: Uint8Array; + keyUsage?: { + critical?: boolean; + usages: Set; + }; + subjectAltNames?: string[]; + extKeyUsage?: { + clientTls?: true; + serverTls?: true; + }; + authorityKeyIdentifier?: Uint8Array; + subjectKeyIdentifier?: Uint8Array; + basicConstraints?: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: Uint8Array; + static distinguishedNamesAreEqual(dn1: DistinguishedName, dn2: DistinguishedName): boolean; + static stringFromDistinguishedName(dn: DistinguishedName): string; + constructor(certData: Uint8Array | ASN1Bytes | CertJSON); + subjectAltNameMatchingHost(host: string): string | undefined; + isValidAtMoment(moment?: Date): boolean; + description(): string; + toJSON(): { + serialNumber: string; + algorithm: string; + issuer: DistinguishedName; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + subject: DistinguishedName; + publicKey: { + identifiers: string[]; + data: string; + all: string; + }; + signature: string; + keyUsage: { + critical: boolean | undefined; + usages: ("digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly")[]; + }; + subjectAltNames: string[] | undefined; + extKeyUsage: { + clientTls?: true; + serverTls?: true; + } | undefined; + authorityKeyIdentifier: string | undefined; + subjectKeyIdentifier: string | undefined; + basicConstraints: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: string; + }; + static uint8ArraysFromPEM(pem: string): Uint8Array[]; + static fromPEM(pem: string): Cert[]; +} + +declare type CertJSON = ReturnType; + /** * We export the pg library mostly unchanged, but we do make a few tweaks. * @@ -54,12 +202,21 @@ export { Connection } export { DatabaseError } +declare interface DataRequest { + bytes: number; + resolve: (data: Uint8Array | undefined) => void; +} + export { defaults } +declare type DistinguishedName = Record; + declare interface FetchEndpointOptions { jwtAuth?: boolean; } +declare function hexFromU8(u8: Uint8Array | number[], spacer?: string): string; + declare interface HTTPQueryOptions { arrayMode?: boolean; fullResults?: boolean; @@ -276,6 +433,8 @@ declare interface NeonQueryPromise extends Promise { opts?: HTTPQueryOptions; } +declare type OID = string; + declare interface ParameterizedQuery { query: string; params: any[]; @@ -290,6 +449,29 @@ export declare class Pool extends Pool_2 { export { Query } +declare abstract class ReadQueue { + queue: Uint8Array[]; + outstandingRequest: DataRequest | undefined; + constructor(); + abstract socketIsNotClosed(): boolean; + enqueue(data: Uint8Array): void; + dequeue(): void; + bytesInQueue(): number; + read(bytes: number): Promise | undefined>; +} + +declare type RootCertsData = Uint8Array; + +declare interface RootCertsDatabase { + index: RootCertsIndex; + data: RootCertsData; +} + +declare interface RootCertsIndex { + offsets: number[]; + subjects: Record; +} + declare interface SocketDefaults { poolQueryViaFetch: boolean; fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); @@ -307,6 +489,51 @@ declare interface SocketDefaults { disableSNI: boolean; } +declare class SocketReadQueue extends ReadQueue { + private socket; + constructor(socket: Socket); + socketIsNotClosed(): boolean; +} + +declare function stableStringify(x: any, replacer?: (key: string, value: any) => any, indent?: string | number): string; + +declare function startTls(host: string, rootCertsDatabase: RootCertsDatabase | string, networkRead: (bytes: number) => Promise, networkWrite: (data: Uint8Array) => void, { useSNI, requireServerTlsExtKeyUsage, requireDigitalSigKeyUsage, writePreData, expectPreData, commentPreData }?: { + useSNI?: boolean; + requireServerTlsExtKeyUsage?: boolean; + requireDigitalSigKeyUsage?: boolean; + writePreData?: Uint8Array; + expectPreData?: Uint8Array; + commentPreData?: string; +}): Promise Promise | undefined>, (data: Uint8Array) => Promise]>; + +declare function stdCharCodes(charCode: number): number | void; + +declare namespace subtls { + export { + base64Decode, + hexFromU8, + stableStringify, + startTls, + u8FromHex, + SocketReadQueue, + TrustedCert, + WebSocketReadQueue + } +} + +declare class TrustedCert extends Cert { + static databaseFromPEM(pem: string): RootCertsDatabase; + static findInDatabase(subjectOrSubjectKeyId: DistinguishedName | string, db: RootCertsDatabase): TrustedCert | undefined; +} + export { types } +declare function u8FromHex(hex: string): Uint8Array; + +declare class WebSocketReadQueue extends ReadQueue { + private socket; + constructor(socket: WebSocket); + socketIsNotClosed(): boolean; +} + export { } diff --git a/dist/npm/index.d.mts b/dist/npm/index.d.mts index f0e2b72..89b1371 100644 --- a/dist/npm/index.d.mts +++ b/dist/npm/index.d.mts @@ -1,3 +1,5 @@ +/// + import { Client as Client_2 } from 'pg'; import { ClientBase } from 'pg'; import { Connection } from 'pg'; @@ -6,9 +8,155 @@ import { defaults } from 'pg'; import { EventEmitter } from 'events'; import { Pool as Pool_2 } from 'pg'; import { Query } from 'pg'; -import type * as subtls from 'subtls'; +import type { Socket } from 'net'; import { types } from 'pg'; +declare const allKeyUsages: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"]; + +declare class ASN1Bytes extends Bytes { + readASN1Length(comment?: string): number; + expectASN1Length(comment?: string): readonly [() => void, () => number]; + readASN1OID(comment?: string): string; + readASN1Boolean(comment?: string): boolean; + readASN1UTCTime(): Date; + readASN1GeneralizedTime(): Date; + readASN1BitString(): Uint8Array; +} + +declare function base64Decode(input: string, charCodes?: typeof stdCharCodes, autoPad?: boolean): Uint8Array; + +declare class Bytes { + offset: number; + dataView: DataView; + data: Uint8Array; + comments: Record; + indents: Record; + indent: number; + constructor(arrayOrMaxBytes: number | Uint8Array); + extend(arrayOrMaxBytes: number | Uint8Array): void; + remaining(): number; + subarray(length: number): Uint8Array; + skip(length: number, comment?: string): this; + comment(s: string, offset?: number): this; + lengthComment(length: number, comment?: string, inclusive?: boolean): string; + readBytes(length: number): Uint8Array; + readUTF8String(length: number): string; + readUTF8StringNullTerminated(): string; + readUint8(comment?: string): number; + readUint16(comment?: string): number; + readUint24(comment?: string): number; + readUint32(comment?: string): number; + expectBytes(expected: Uint8Array | number[], comment?: string): void; + expectUint8(expectedValue: number, comment?: string): void; + expectUint16(expectedValue: number, comment?: string): void; + expectUint24(expectedValue: number, comment?: string): void; + expectUint32(expectedValue: number, comment?: string): void; + expectLength(length: number, indentDelta?: number): readonly [() => void, () => number]; + expectLengthUint8(comment?: string): readonly [() => void, () => number]; + expectLengthUint16(comment?: string): readonly [() => void, () => number]; + expectLengthUint24(comment?: string): readonly [() => void, () => number]; + expectLengthUint32(comment?: string): readonly [() => void, () => number]; + expectLengthUint8Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint16Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint24Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint32Incl(comment?: string): readonly [() => void, () => number]; + writeBytes(bytes: number[] | Uint8Array): this; + writeUTF8String(s: string): this; + writeUTF8StringNullTerminated(s: string): this; + writeUint8(value: number, comment?: string): Bytes; + writeUint16(value: number, comment?: string): Bytes; + writeUint24(value: number, comment?: string): Bytes; + writeUint32(value: number, comment?: string): Bytes; + _writeLengthGeneric(lengthBytes: 1 | 2 | 3 | 4, inclusive: boolean, comment?: string): () => void; + writeLengthUint8(comment?: string): () => void; + writeLengthUint16(comment?: string): () => void; + writeLengthUint24(comment?: string): () => void; + writeLengthUint32(comment?: string): () => void; + writeLengthUint8Incl(comment?: string): () => void; + writeLengthUint16Incl(comment?: string): () => void; + writeLengthUint24Incl(comment?: string): () => void; + writeLengthUint32Incl(comment?: string): () => void; + array(): Uint8Array; + commentedString(all?: boolean): string; +} + +declare class Cert { + serialNumber: Uint8Array; + algorithm: OID; + issuer: DistinguishedName; + validityPeriod: { + notBefore: Date; + notAfter: Date; + }; + subject: DistinguishedName; + publicKey: { + identifiers: OID[]; + data: Uint8Array; + all: Uint8Array; + }; + signature: Uint8Array; + keyUsage?: { + critical?: boolean; + usages: Set; + }; + subjectAltNames?: string[]; + extKeyUsage?: { + clientTls?: true; + serverTls?: true; + }; + authorityKeyIdentifier?: Uint8Array; + subjectKeyIdentifier?: Uint8Array; + basicConstraints?: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: Uint8Array; + static distinguishedNamesAreEqual(dn1: DistinguishedName, dn2: DistinguishedName): boolean; + static stringFromDistinguishedName(dn: DistinguishedName): string; + constructor(certData: Uint8Array | ASN1Bytes | CertJSON); + subjectAltNameMatchingHost(host: string): string | undefined; + isValidAtMoment(moment?: Date): boolean; + description(): string; + toJSON(): { + serialNumber: string; + algorithm: string; + issuer: DistinguishedName; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + subject: DistinguishedName; + publicKey: { + identifiers: string[]; + data: string; + all: string; + }; + signature: string; + keyUsage: { + critical: boolean | undefined; + usages: ("digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly")[]; + }; + subjectAltNames: string[] | undefined; + extKeyUsage: { + clientTls?: true; + serverTls?: true; + } | undefined; + authorityKeyIdentifier: string | undefined; + subjectKeyIdentifier: string | undefined; + basicConstraints: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: string; + }; + static uint8ArraysFromPEM(pem: string): Uint8Array[]; + static fromPEM(pem: string): Cert[]; +} + +declare type CertJSON = ReturnType; + /** * We export the pg library mostly unchanged, but we do make a few tweaks. * @@ -54,12 +202,21 @@ export { Connection } export { DatabaseError } +declare interface DataRequest { + bytes: number; + resolve: (data: Uint8Array | undefined) => void; +} + export { defaults } +declare type DistinguishedName = Record; + declare interface FetchEndpointOptions { jwtAuth?: boolean; } +declare function hexFromU8(u8: Uint8Array | number[], spacer?: string): string; + declare interface HTTPQueryOptions { arrayMode?: boolean; fullResults?: boolean; @@ -276,6 +433,8 @@ declare interface NeonQueryPromise extends Promise { opts?: HTTPQueryOptions; } +declare type OID = string; + declare interface ParameterizedQuery { query: string; params: any[]; @@ -290,6 +449,29 @@ export declare class Pool extends Pool_2 { export { Query } +declare abstract class ReadQueue { + queue: Uint8Array[]; + outstandingRequest: DataRequest | undefined; + constructor(); + abstract socketIsNotClosed(): boolean; + enqueue(data: Uint8Array): void; + dequeue(): void; + bytesInQueue(): number; + read(bytes: number): Promise | undefined>; +} + +declare type RootCertsData = Uint8Array; + +declare interface RootCertsDatabase { + index: RootCertsIndex; + data: RootCertsData; +} + +declare interface RootCertsIndex { + offsets: number[]; + subjects: Record; +} + declare interface SocketDefaults { poolQueryViaFetch: boolean; fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); @@ -307,6 +489,51 @@ declare interface SocketDefaults { disableSNI: boolean; } +declare class SocketReadQueue extends ReadQueue { + private socket; + constructor(socket: Socket); + socketIsNotClosed(): boolean; +} + +declare function stableStringify(x: any, replacer?: (key: string, value: any) => any, indent?: string | number): string; + +declare function startTls(host: string, rootCertsDatabase: RootCertsDatabase | string, networkRead: (bytes: number) => Promise, networkWrite: (data: Uint8Array) => void, { useSNI, requireServerTlsExtKeyUsage, requireDigitalSigKeyUsage, writePreData, expectPreData, commentPreData }?: { + useSNI?: boolean; + requireServerTlsExtKeyUsage?: boolean; + requireDigitalSigKeyUsage?: boolean; + writePreData?: Uint8Array; + expectPreData?: Uint8Array; + commentPreData?: string; +}): Promise Promise | undefined>, (data: Uint8Array) => Promise]>; + +declare function stdCharCodes(charCode: number): number | void; + +declare namespace subtls { + export { + base64Decode, + hexFromU8, + stableStringify, + startTls, + u8FromHex, + SocketReadQueue, + TrustedCert, + WebSocketReadQueue + } +} + +declare class TrustedCert extends Cert { + static databaseFromPEM(pem: string): RootCertsDatabase; + static findInDatabase(subjectOrSubjectKeyId: DistinguishedName | string, db: RootCertsDatabase): TrustedCert | undefined; +} + export { types } +declare function u8FromHex(hex: string): Uint8Array; + +declare class WebSocketReadQueue extends ReadQueue { + private socket; + constructor(socket: WebSocket); + socketIsNotClosed(): boolean; +} + export { } diff --git a/dist/npm/index.d.ts b/dist/npm/index.d.ts index f0e2b72..89b1371 100644 --- a/dist/npm/index.d.ts +++ b/dist/npm/index.d.ts @@ -1,3 +1,5 @@ +/// + import { Client as Client_2 } from 'pg'; import { ClientBase } from 'pg'; import { Connection } from 'pg'; @@ -6,9 +8,155 @@ import { defaults } from 'pg'; import { EventEmitter } from 'events'; import { Pool as Pool_2 } from 'pg'; import { Query } from 'pg'; -import type * as subtls from 'subtls'; +import type { Socket } from 'net'; import { types } from 'pg'; +declare const allKeyUsages: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"]; + +declare class ASN1Bytes extends Bytes { + readASN1Length(comment?: string): number; + expectASN1Length(comment?: string): readonly [() => void, () => number]; + readASN1OID(comment?: string): string; + readASN1Boolean(comment?: string): boolean; + readASN1UTCTime(): Date; + readASN1GeneralizedTime(): Date; + readASN1BitString(): Uint8Array; +} + +declare function base64Decode(input: string, charCodes?: typeof stdCharCodes, autoPad?: boolean): Uint8Array; + +declare class Bytes { + offset: number; + dataView: DataView; + data: Uint8Array; + comments: Record; + indents: Record; + indent: number; + constructor(arrayOrMaxBytes: number | Uint8Array); + extend(arrayOrMaxBytes: number | Uint8Array): void; + remaining(): number; + subarray(length: number): Uint8Array; + skip(length: number, comment?: string): this; + comment(s: string, offset?: number): this; + lengthComment(length: number, comment?: string, inclusive?: boolean): string; + readBytes(length: number): Uint8Array; + readUTF8String(length: number): string; + readUTF8StringNullTerminated(): string; + readUint8(comment?: string): number; + readUint16(comment?: string): number; + readUint24(comment?: string): number; + readUint32(comment?: string): number; + expectBytes(expected: Uint8Array | number[], comment?: string): void; + expectUint8(expectedValue: number, comment?: string): void; + expectUint16(expectedValue: number, comment?: string): void; + expectUint24(expectedValue: number, comment?: string): void; + expectUint32(expectedValue: number, comment?: string): void; + expectLength(length: number, indentDelta?: number): readonly [() => void, () => number]; + expectLengthUint8(comment?: string): readonly [() => void, () => number]; + expectLengthUint16(comment?: string): readonly [() => void, () => number]; + expectLengthUint24(comment?: string): readonly [() => void, () => number]; + expectLengthUint32(comment?: string): readonly [() => void, () => number]; + expectLengthUint8Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint16Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint24Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint32Incl(comment?: string): readonly [() => void, () => number]; + writeBytes(bytes: number[] | Uint8Array): this; + writeUTF8String(s: string): this; + writeUTF8StringNullTerminated(s: string): this; + writeUint8(value: number, comment?: string): Bytes; + writeUint16(value: number, comment?: string): Bytes; + writeUint24(value: number, comment?: string): Bytes; + writeUint32(value: number, comment?: string): Bytes; + _writeLengthGeneric(lengthBytes: 1 | 2 | 3 | 4, inclusive: boolean, comment?: string): () => void; + writeLengthUint8(comment?: string): () => void; + writeLengthUint16(comment?: string): () => void; + writeLengthUint24(comment?: string): () => void; + writeLengthUint32(comment?: string): () => void; + writeLengthUint8Incl(comment?: string): () => void; + writeLengthUint16Incl(comment?: string): () => void; + writeLengthUint24Incl(comment?: string): () => void; + writeLengthUint32Incl(comment?: string): () => void; + array(): Uint8Array; + commentedString(all?: boolean): string; +} + +declare class Cert { + serialNumber: Uint8Array; + algorithm: OID; + issuer: DistinguishedName; + validityPeriod: { + notBefore: Date; + notAfter: Date; + }; + subject: DistinguishedName; + publicKey: { + identifiers: OID[]; + data: Uint8Array; + all: Uint8Array; + }; + signature: Uint8Array; + keyUsage?: { + critical?: boolean; + usages: Set; + }; + subjectAltNames?: string[]; + extKeyUsage?: { + clientTls?: true; + serverTls?: true; + }; + authorityKeyIdentifier?: Uint8Array; + subjectKeyIdentifier?: Uint8Array; + basicConstraints?: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: Uint8Array; + static distinguishedNamesAreEqual(dn1: DistinguishedName, dn2: DistinguishedName): boolean; + static stringFromDistinguishedName(dn: DistinguishedName): string; + constructor(certData: Uint8Array | ASN1Bytes | CertJSON); + subjectAltNameMatchingHost(host: string): string | undefined; + isValidAtMoment(moment?: Date): boolean; + description(): string; + toJSON(): { + serialNumber: string; + algorithm: string; + issuer: DistinguishedName; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + subject: DistinguishedName; + publicKey: { + identifiers: string[]; + data: string; + all: string; + }; + signature: string; + keyUsage: { + critical: boolean | undefined; + usages: ("digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly")[]; + }; + subjectAltNames: string[] | undefined; + extKeyUsage: { + clientTls?: true; + serverTls?: true; + } | undefined; + authorityKeyIdentifier: string | undefined; + subjectKeyIdentifier: string | undefined; + basicConstraints: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: string; + }; + static uint8ArraysFromPEM(pem: string): Uint8Array[]; + static fromPEM(pem: string): Cert[]; +} + +declare type CertJSON = ReturnType; + /** * We export the pg library mostly unchanged, but we do make a few tweaks. * @@ -54,12 +202,21 @@ export { Connection } export { DatabaseError } +declare interface DataRequest { + bytes: number; + resolve: (data: Uint8Array | undefined) => void; +} + export { defaults } +declare type DistinguishedName = Record; + declare interface FetchEndpointOptions { jwtAuth?: boolean; } +declare function hexFromU8(u8: Uint8Array | number[], spacer?: string): string; + declare interface HTTPQueryOptions { arrayMode?: boolean; fullResults?: boolean; @@ -276,6 +433,8 @@ declare interface NeonQueryPromise extends Promise { opts?: HTTPQueryOptions; } +declare type OID = string; + declare interface ParameterizedQuery { query: string; params: any[]; @@ -290,6 +449,29 @@ export declare class Pool extends Pool_2 { export { Query } +declare abstract class ReadQueue { + queue: Uint8Array[]; + outstandingRequest: DataRequest | undefined; + constructor(); + abstract socketIsNotClosed(): boolean; + enqueue(data: Uint8Array): void; + dequeue(): void; + bytesInQueue(): number; + read(bytes: number): Promise | undefined>; +} + +declare type RootCertsData = Uint8Array; + +declare interface RootCertsDatabase { + index: RootCertsIndex; + data: RootCertsData; +} + +declare interface RootCertsIndex { + offsets: number[]; + subjects: Record; +} + declare interface SocketDefaults { poolQueryViaFetch: boolean; fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); @@ -307,6 +489,51 @@ declare interface SocketDefaults { disableSNI: boolean; } +declare class SocketReadQueue extends ReadQueue { + private socket; + constructor(socket: Socket); + socketIsNotClosed(): boolean; +} + +declare function stableStringify(x: any, replacer?: (key: string, value: any) => any, indent?: string | number): string; + +declare function startTls(host: string, rootCertsDatabase: RootCertsDatabase | string, networkRead: (bytes: number) => Promise, networkWrite: (data: Uint8Array) => void, { useSNI, requireServerTlsExtKeyUsage, requireDigitalSigKeyUsage, writePreData, expectPreData, commentPreData }?: { + useSNI?: boolean; + requireServerTlsExtKeyUsage?: boolean; + requireDigitalSigKeyUsage?: boolean; + writePreData?: Uint8Array; + expectPreData?: Uint8Array; + commentPreData?: string; +}): Promise Promise | undefined>, (data: Uint8Array) => Promise]>; + +declare function stdCharCodes(charCode: number): number | void; + +declare namespace subtls { + export { + base64Decode, + hexFromU8, + stableStringify, + startTls, + u8FromHex, + SocketReadQueue, + TrustedCert, + WebSocketReadQueue + } +} + +declare class TrustedCert extends Cert { + static databaseFromPEM(pem: string): RootCertsDatabase; + static findInDatabase(subjectOrSubjectKeyId: DistinguishedName | string, db: RootCertsDatabase): TrustedCert | undefined; +} + export { types } +declare function u8FromHex(hex: string): Uint8Array; + +declare class WebSocketReadQueue extends ReadQueue { + private socket; + constructor(socket: WebSocket); + socketIsNotClosed(): boolean; +} + export { } diff --git a/dist/npm/package-lock.json b/dist/npm/package-lock.json index 116b66c..0ba99bc 100644 --- a/dist/npm/package-lock.json +++ b/dist/npm/package-lock.json @@ -8,162 +8,241 @@ "name": "@neondatabase/serverless", "version": "0.10.4", "license": "MIT", - "dependencies": { - "@types/pg": "^8.6.6" + "devDependencies": { + "@types/node": "^22.10.2", + "@types/pg": "^8.11.10" } }, "node_modules/@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } }, "node_modules/@types/pg": { - "version": "8.6.6", - "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.6.6.tgz", - "integrity": "sha512-O2xNmXebtwVekJDD+02udOncjVcMZQuTEQEMpKJ0ZRf5E7/9JJX3izhKUcUifBkyKpljyUM6BTgy2trmviKlpw==", + "version": "8.11.10", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.11.10.tgz", + "integrity": "sha512-LczQUW4dbOQzsH2RQ5qoeJ6qJPdrcM/DcMLoqWQkMLMsq83J5lAX3LXjdkWdpscFy67JSOWDnh7Ny/sPFykmkg==", + "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*", "pg-protocol": "*", - "pg-types": "^2.2.0" + "pg-types": "^4.0.1" } }, + "node_modules/obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true, + "license": "MIT" + }, "node_modules/pg-int8": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "dev": true, + "license": "ISC", "engines": { "node": ">=4.0.0" } }, + "node_modules/pg-numeric": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz", + "integrity": "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=4" + } + }, "node_modules/pg-protocol": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.0.tgz", - "integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==" + "integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==", + "dev": true }, "node_modules/pg-types": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", - "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-4.0.2.tgz", + "integrity": "sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng==", + "dev": true, + "license": "MIT", "dependencies": { "pg-int8": "1.0.1", - "postgres-array": "~2.0.0", - "postgres-bytea": "~1.0.0", - "postgres-date": "~1.0.4", - "postgres-interval": "^1.1.0" + "pg-numeric": "1.0.2", + "postgres-array": "~3.0.1", + "postgres-bytea": "~3.0.0", + "postgres-date": "~2.1.0", + "postgres-interval": "^3.0.0", + "postgres-range": "^1.1.1" }, "engines": { - "node": ">=4" + "node": ">=10" } }, "node_modules/postgres-array": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", - "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz", + "integrity": "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=12" } }, "node_modules/postgres-bytea": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", - "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz", + "integrity": "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "obuf": "~1.1.2" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 6" } }, "node_modules/postgres-date": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", - "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-2.1.0.tgz", + "integrity": "sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=12" } }, "node_modules/postgres-interval": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", - "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", - "dependencies": { - "xtend": "^4.0.0" - }, + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz", + "integrity": "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=12" } }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "engines": { - "node": ">=0.4" - } + "node_modules/postgres-range": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.4.tgz", + "integrity": "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true, + "license": "MIT" } }, "dependencies": { "@types/node": { - "version": "18.15.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz", - "integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==" + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "dev": true, + "requires": { + "undici-types": "~6.20.0" + } }, "@types/pg": { - "version": "8.6.6", - "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.6.6.tgz", - "integrity": "sha512-O2xNmXebtwVekJDD+02udOncjVcMZQuTEQEMpKJ0ZRf5E7/9JJX3izhKUcUifBkyKpljyUM6BTgy2trmviKlpw==", + "version": "8.11.10", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.11.10.tgz", + "integrity": "sha512-LczQUW4dbOQzsH2RQ5qoeJ6qJPdrcM/DcMLoqWQkMLMsq83J5lAX3LXjdkWdpscFy67JSOWDnh7Ny/sPFykmkg==", + "dev": true, "requires": { "@types/node": "*", "pg-protocol": "*", - "pg-types": "^2.2.0" + "pg-types": "^4.0.1" } }, + "obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, "pg-int8": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz", - "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==" + "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==", + "dev": true + }, + "pg-numeric": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz", + "integrity": "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==", + "dev": true }, "pg-protocol": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.6.0.tgz", - "integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==" + "integrity": "sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q==", + "dev": true }, "pg-types": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz", - "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-4.0.2.tgz", + "integrity": "sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng==", + "dev": true, "requires": { "pg-int8": "1.0.1", - "postgres-array": "~2.0.0", - "postgres-bytea": "~1.0.0", - "postgres-date": "~1.0.4", - "postgres-interval": "^1.1.0" + "pg-numeric": "1.0.2", + "postgres-array": "~3.0.1", + "postgres-bytea": "~3.0.0", + "postgres-date": "~2.1.0", + "postgres-interval": "^3.0.0", + "postgres-range": "^1.1.1" } }, "postgres-array": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz", - "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==" + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz", + "integrity": "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==", + "dev": true }, "postgres-bytea": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz", - "integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz", + "integrity": "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==", + "dev": true, + "requires": { + "obuf": "~1.1.2" + } }, "postgres-date": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz", - "integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-2.1.0.tgz", + "integrity": "sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA==", + "dev": true }, "postgres-interval": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz", - "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==", - "requires": { - "xtend": "^4.0.0" - } - }, - "xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz", + "integrity": "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==", + "dev": true + }, + "postgres-range": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.4.tgz", + "integrity": "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w==", + "dev": true + }, + "undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true } } } diff --git a/dist/npm/package.json b/dist/npm/package.json index d8f3cad..268c000 100644 --- a/dist/npm/package.json +++ b/dist/npm/package.json @@ -29,9 +29,8 @@ "WebSocket", "https" ], - "devDependencies": { - "@types/pg": "^22.10.2", - "subtls": "^0.3.3", - "events": "^3.3.0" + "dependencies": { + "@types/node": "^22.10.2", + "@types/pg": "^8.8.0" } } diff --git a/export.sh b/export.sh index 4d56508..f0f1f33 100755 --- a/export.sh +++ b/export.sh @@ -35,16 +35,34 @@ npx esbuild export/index.ts \ # == types == +# note: we run sed with -i.orig and then rm because this is Mac/BSD and GNU compatible + npx tsc -# remove global declarations from types -sed -i.orig -r '/^declare global [{]$/,/^[}]$/d' dist/dts/shims/net/index.d.ts +# remove global declarations from types and replace subtls types with local ones +cp node_modules/subtls/index.d.ts dist/dts/subtls.d.ts + +sed -i.orig -r \ + -e "/^declare global [{]$/,/^[}]$/d" \ + -e "s| from 'subtls';| from '../../subtls.d.ts';|g" \ + dist/dts/shims/net/index.d.ts + +rm dist/dts/shims/net/index.d.ts.orig # bundle types into one file -echo "Note: warnings are expected from api-extractor" +echo +echo "Note: warnings are expected from api-extractor:" npx @microsoft/api-extractor run --local -# copy .d.dt (for CJS) to .m.ts (for ESM) +# remove appendage +sed -i.orig -r \ + -e '/^export [{] *[}]$/d' \ + dist/npm/index.d.ts + +rm dist/npm/index.d.ts.orig + +# copy to .d.ts (for CJS) and .d.mts (for ESM) +(echo '/// '; echo; cat dist/dts/_extracted.d.ts) > dist/npm/index.d.ts cp dist/npm/index.d.ts dist/npm/index.d.mts From 3b6d2d50ef33fa0fdf15e554e21476532ea434df Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 14:41:47 +0000 Subject: [PATCH 25/40] Tweaked types generation --- api-extractor.json | 5 +- dist/dts/_extracted.d.ts | 1 - dist/dts/_extracted.d.ts.orig | 537 +++++++++++++++++++++++++++++ dist/dts/shims/net/index.d.ts | 2 +- dist/dts/shims/net/index.d.ts.orig | 118 +++++++ dist/jsr/index.d.ts | 1 - dist/npm/index.d.mts | 1 - dist/npm/index.d.ts | 1 - export.sh | 14 +- 9 files changed, 663 insertions(+), 17 deletions(-) create mode 100644 dist/dts/_extracted.d.ts.orig create mode 100644 dist/dts/shims/net/index.d.ts.orig diff --git a/api-extractor.json b/api-extractor.json index 92ea45d..9e29160 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -2,6 +2,9 @@ "mainEntryPointFilePath": "dist/dts/export/index.d.ts", "newlineKind": "lf", "enumMemberOrder": "preserve", + "bundledPackages": [ + "subtls" + ], "dtsRollup": { "enabled": true, "untrimmedFilePath": "dist/dts/_extracted.d.ts" @@ -22,4 +25,4 @@ } } } -} +} \ No newline at end of file diff --git a/dist/dts/_extracted.d.ts b/dist/dts/_extracted.d.ts index 3a047e1..fad484d 100644 --- a/dist/dts/_extracted.d.ts +++ b/dist/dts/_extracted.d.ts @@ -534,4 +534,3 @@ declare class WebSocketReadQueue extends ReadQueue { socketIsNotClosed(): boolean; } -export { } diff --git a/dist/dts/_extracted.d.ts.orig b/dist/dts/_extracted.d.ts.orig new file mode 100644 index 0000000..3a047e1 --- /dev/null +++ b/dist/dts/_extracted.d.ts.orig @@ -0,0 +1,537 @@ +import { Client as Client_2 } from 'pg'; +import { ClientBase } from 'pg'; +import { Connection } from 'pg'; +import { DatabaseError } from 'pg'; +import { defaults } from 'pg'; +import { EventEmitter } from 'events'; +import { Pool as Pool_2 } from 'pg'; +import { Query } from 'pg'; +import type { Socket } from 'net'; +import { types } from 'pg'; + +declare const allKeyUsages: readonly ["digitalSignature", "nonRepudiation", "keyEncipherment", "dataEncipherment", "keyAgreement", "keyCertSign", "cRLSign", "encipherOnly", "decipherOnly"]; + +declare class ASN1Bytes extends Bytes { + readASN1Length(comment?: string): number; + expectASN1Length(comment?: string): readonly [() => void, () => number]; + readASN1OID(comment?: string): string; + readASN1Boolean(comment?: string): boolean; + readASN1UTCTime(): Date; + readASN1GeneralizedTime(): Date; + readASN1BitString(): Uint8Array; +} + +declare function base64Decode(input: string, charCodes?: typeof stdCharCodes, autoPad?: boolean): Uint8Array; + +declare class Bytes { + offset: number; + dataView: DataView; + data: Uint8Array; + comments: Record; + indents: Record; + indent: number; + constructor(arrayOrMaxBytes: number | Uint8Array); + extend(arrayOrMaxBytes: number | Uint8Array): void; + remaining(): number; + subarray(length: number): Uint8Array; + skip(length: number, comment?: string): this; + comment(s: string, offset?: number): this; + lengthComment(length: number, comment?: string, inclusive?: boolean): string; + readBytes(length: number): Uint8Array; + readUTF8String(length: number): string; + readUTF8StringNullTerminated(): string; + readUint8(comment?: string): number; + readUint16(comment?: string): number; + readUint24(comment?: string): number; + readUint32(comment?: string): number; + expectBytes(expected: Uint8Array | number[], comment?: string): void; + expectUint8(expectedValue: number, comment?: string): void; + expectUint16(expectedValue: number, comment?: string): void; + expectUint24(expectedValue: number, comment?: string): void; + expectUint32(expectedValue: number, comment?: string): void; + expectLength(length: number, indentDelta?: number): readonly [() => void, () => number]; + expectLengthUint8(comment?: string): readonly [() => void, () => number]; + expectLengthUint16(comment?: string): readonly [() => void, () => number]; + expectLengthUint24(comment?: string): readonly [() => void, () => number]; + expectLengthUint32(comment?: string): readonly [() => void, () => number]; + expectLengthUint8Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint16Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint24Incl(comment?: string): readonly [() => void, () => number]; + expectLengthUint32Incl(comment?: string): readonly [() => void, () => number]; + writeBytes(bytes: number[] | Uint8Array): this; + writeUTF8String(s: string): this; + writeUTF8StringNullTerminated(s: string): this; + writeUint8(value: number, comment?: string): Bytes; + writeUint16(value: number, comment?: string): Bytes; + writeUint24(value: number, comment?: string): Bytes; + writeUint32(value: number, comment?: string): Bytes; + _writeLengthGeneric(lengthBytes: 1 | 2 | 3 | 4, inclusive: boolean, comment?: string): () => void; + writeLengthUint8(comment?: string): () => void; + writeLengthUint16(comment?: string): () => void; + writeLengthUint24(comment?: string): () => void; + writeLengthUint32(comment?: string): () => void; + writeLengthUint8Incl(comment?: string): () => void; + writeLengthUint16Incl(comment?: string): () => void; + writeLengthUint24Incl(comment?: string): () => void; + writeLengthUint32Incl(comment?: string): () => void; + array(): Uint8Array; + commentedString(all?: boolean): string; +} + +declare class Cert { + serialNumber: Uint8Array; + algorithm: OID; + issuer: DistinguishedName; + validityPeriod: { + notBefore: Date; + notAfter: Date; + }; + subject: DistinguishedName; + publicKey: { + identifiers: OID[]; + data: Uint8Array; + all: Uint8Array; + }; + signature: Uint8Array; + keyUsage?: { + critical?: boolean; + usages: Set; + }; + subjectAltNames?: string[]; + extKeyUsage?: { + clientTls?: true; + serverTls?: true; + }; + authorityKeyIdentifier?: Uint8Array; + subjectKeyIdentifier?: Uint8Array; + basicConstraints?: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: Uint8Array; + static distinguishedNamesAreEqual(dn1: DistinguishedName, dn2: DistinguishedName): boolean; + static stringFromDistinguishedName(dn: DistinguishedName): string; + constructor(certData: Uint8Array | ASN1Bytes | CertJSON); + subjectAltNameMatchingHost(host: string): string | undefined; + isValidAtMoment(moment?: Date): boolean; + description(): string; + toJSON(): { + serialNumber: string; + algorithm: string; + issuer: DistinguishedName; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + subject: DistinguishedName; + publicKey: { + identifiers: string[]; + data: string; + all: string; + }; + signature: string; + keyUsage: { + critical: boolean | undefined; + usages: ("digitalSignature" | "nonRepudiation" | "keyEncipherment" | "dataEncipherment" | "keyAgreement" | "keyCertSign" | "cRLSign" | "encipherOnly" | "decipherOnly")[]; + }; + subjectAltNames: string[] | undefined; + extKeyUsage: { + clientTls?: true; + serverTls?: true; + } | undefined; + authorityKeyIdentifier: string | undefined; + subjectKeyIdentifier: string | undefined; + basicConstraints: { + critical?: boolean; + ca?: boolean; + pathLength?: number; + } | undefined; + signedData: string; + }; + static uint8ArraysFromPEM(pem: string): Uint8Array[]; + static fromPEM(pem: string): Cert[]; +} + +declare type CertJSON = ReturnType; + +/** + * We export the pg library mostly unchanged, but we do make a few tweaks. + * + * (1) Connecting and querying can require a lot of network round-trips. We + * add a pipelining option for the connection (startup + auth + first query), + * but this works with cleartext password auth only. We can also pipeline TLS + * startup, but currently this works only with Neon hosts (not vanilla pg or + * pgbouncer). + * + * (2) SCRAM auth is deliberately CPU-intensive, and this is not appropriate + * for a serverless environment. In case it is still used, however, we replace + * the standard (synchronous) pg implementation with one that uses SubtleCrypto + * for repeated SHA-256 digests. This saves some time and CPU. + * + * (3) We now (experimentally) redirect Pool.query over a fetch request if the + * circumstances are right. + */ +export declare interface Client { + connection: Connection & { + stream: neonConfig; + sendSCRAMClientFinalMessage: (response: any) => void; + ssl: any; + }; + _handleReadyForQuery: any; + _handleAuthCleartextPassword: any; + startup: any; + getStartupConf: any; + saslSession: any; +} + +export declare class Client extends Client_2 { + config: any; + get neonConfig(): NeonConfigGlobalAndClient; + constructor(config: any); + connect(): Promise; + connect(callback: (err?: Error) => void): void; + _handleAuthSASLContinue(msg: any): Promise; +} + +export { ClientBase } + +export { Connection } + +export { DatabaseError } + +declare interface DataRequest { + bytes: number; + resolve: (data: Uint8Array | undefined) => void; +} + +export { defaults } + +declare type DistinguishedName = Record; + +declare interface FetchEndpointOptions { + jwtAuth?: boolean; +} + +declare function hexFromU8(u8: Uint8Array | number[], spacer?: string): string; + +declare interface HTTPQueryOptions { + arrayMode?: boolean; + fullResults?: boolean; + fetchOptions?: Record; + types?: typeof types; + queryCallback?: (query: ParameterizedQuery) => void; + resultCallback?: (query: ParameterizedQuery, result: any, rows: any, opts: any) => void; + authToken?: string | (() => Promise | string); +} + +declare interface HTTPTransactionOptions extends HTTPQueryOptions { + isolationLevel?: 'ReadUncommitted' | 'ReadCommitted' | 'RepeatableRead' | 'Serializable'; + readOnly?: boolean; + deferrable?: boolean; +} + +export declare function neon(connectionString: string, { arrayMode: neonOptArrayMode, fullResults: neonOptFullResults, fetchOptions: neonOptFetchOptions, isolationLevel: neonOptIsolationLevel, readOnly: neonOptReadOnly, deferrable: neonOptDeferrable, queryCallback, resultCallback, authToken, }?: HTTPTransactionOptions): { + (strings: TemplateStringsArray | string, ...params: any[]): NeonQueryPromise; + transaction(queries: NeonQueryPromise[] | ((sql: (strings: TemplateStringsArray | string, ...params: any[]) => NeonQueryPromise) => NeonQueryPromise[]), txnOpts?: HTTPTransactionOptions): Promise; +}; + +export declare class neonConfig extends EventEmitter { + static defaults: SocketDefaults; + static opts: Partial; + private opts; + static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; + static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); + static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; + static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); + static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); + static get fetchFunction(): SocketDefaults["fetchFunction"]; + static set fetchFunction(newValue: SocketDefaults['fetchFunction']); + static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + static get wsProxy(): SocketDefaults["wsProxy"]; + static set wsProxy(newValue: SocketDefaults['wsProxy']); + get wsProxy(): SocketDefaults["wsProxy"]; + set wsProxy(newValue: SocketDefaults['wsProxy']); + static get coalesceWrites(): SocketDefaults["coalesceWrites"]; + static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + get coalesceWrites(): SocketDefaults["coalesceWrites"]; + set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + static get disableSNI(): SocketDefaults["disableSNI"]; + static set disableSNI(newValue: SocketDefaults['disableSNI']); + get disableSNI(): SocketDefaults["disableSNI"]; + set disableSNI(newValue: SocketDefaults['disableSNI']); + static get pipelineConnect(): SocketDefaults["pipelineConnect"]; + static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + get pipelineConnect(): SocketDefaults["pipelineConnect"]; + set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + static get subtls(): SocketDefaults["subtls"]; + static set subtls(newValue: SocketDefaults['subtls']); + get subtls(): SocketDefaults["subtls"]; + set subtls(newValue: SocketDefaults['subtls']); + static get pipelineTLS(): SocketDefaults["pipelineTLS"]; + static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + get pipelineTLS(): SocketDefaults["pipelineTLS"]; + set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + static get rootCerts(): SocketDefaults["rootCerts"]; + static set rootCerts(newValue: SocketDefaults['rootCerts']); + get rootCerts(): SocketDefaults["rootCerts"]; + set rootCerts(newValue: SocketDefaults['rootCerts']); + wsProxyAddrForHost(host: string, port: number): string; + connecting: boolean; + pending: boolean; + writable: boolean; + encrypted: boolean; + authorized: boolean; + destroyed: boolean; + private ws; + private writeBuffer; + private tlsState; + private tlsRead; + private tlsWrite; + setNoDelay(): this; + setKeepAlive(): this; + ref(): this; + unref(): this; + connect(port: number | string, host: string, connectListener?: () => void): void; + startTls(host: string): Promise; + tlsReadLoop(): Promise; + rawWrite(data: Uint8Array): void; + write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; + end(data?: Buffer | string, encoding?: string, callback?: () => void): this; + destroy(): this; +} + +declare interface NeonConfigGlobalAndClient { + /** + * If no global `WebSocket` object is available, set `webSocketConstructor` + * to the constructor for a custom WebSocket implementation, such as those + * provided by `ws` or `undici`. + */ + webSocketConstructor: any; + /** + * Set `wsProxy` to use your own WebSocket proxy server. + * + * Provide either the proxy server’s domain name, or a function that takes + * the database host and port and returns the proxy server address (without + * protocol). + * + * Example: `(host, port) => "myproxy.example.net?address=" + host + ":" + port` + * + * Default: `host => host + '/v2'` + */ + wsProxy: string | ((host: string, port: number | string) => string) | undefined; + /** + * Use a secure (`wss:`) connection to the WebSocket proxy. + * + * Default: `true`. + */ + useSecureWebSocket: boolean; + /** + * Disable TLS encryption in the Postgres protocol (as set via e.g. + * `?sslmode=require` in the connection string). Connection remains secure + * if `useSecureWebSocket` is `true`. + * + * Default: `true` + */ + forceDisablePgSSL: boolean; + /** + * Pipelines the startup message, cleartext password message and first query + * when set to `"password"`. This works only for cleartext password auth. + * + * Default: `"password"`. + */ + pipelineConnect: 'password' | false; + /** + * If `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS, you must supply the subtls TLS library to this option: + * + * ``` + * import { neonConfig } from '@neondatabase/serverless'; + * import * as subtls from 'subtls'; + * neonConfig.subtls = subtls; + * ``` + * + * Default: `undefined`. + */ + subtls: any; + /** + * Pipeline the pg SSL request and TLS handshake when `forceDisablePgSSL` is + * `false` and the Postgres connection parameters specify TLS. Currently + * compatible only with Neon hosts. + * + * Default: `false`. + */ + pipelineTLS: boolean; + /** + * Set `rootCerts` to a string comprising one or more PEM files. These are + * the trusted root certificates for a TLS connection to Postgres when + * `forceDisablePgSSL` is `false` and the Postgres connection parameters + * specify TLS. + * + * Default: `""`. + */ + rootCerts: string; + /** + * Batch multiple network writes per run-loop into a single outgoing + * WebSocket message. + * + * Default: `true`. + */ + coalesceWrites: boolean; + /** + * When `disableSNI` is `true`, `forceDisablePgSSL` is `false` and the + * Postgres connection parameters specify TLS, we send no SNI data in the + * Postgres TLS handshake. + * + * On Neon, disabling SNI and including the Neon project name in the password + * avoids CPU-intensive SCRAM authentication, but this is only relevant for + * earlier iterations of Neon's WebSocket support. + * + * Default: `false`. + */ + disableSNI: boolean; +} + +export declare class NeonDbError extends Error { + name: "NeonDbError"; + severity: string | undefined; + code: string | undefined; + detail: string | undefined; + hint: string | undefined; + position: string | undefined; + internalPosition: string | undefined; + internalQuery: string | undefined; + where: string | undefined; + schema: string | undefined; + table: string | undefined; + column: string | undefined; + dataType: string | undefined; + constraint: string | undefined; + file: string | undefined; + line: string | undefined; + routine: string | undefined; + sourceError: Error | undefined; + constructor(message: string); +} + +declare interface NeonQueryPromise extends Promise { + parameterizedQuery: ParameterizedQuery; + opts?: HTTPQueryOptions; +} + +declare type OID = string; + +declare interface ParameterizedQuery { + query: string; + params: any[]; +} + +export declare class Pool extends Pool_2 { + Client: typeof Client; + hasFetchUnsupportedListeners: boolean; + on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + query(config?: any, values?: any, cb?: any): any; +} + +export { Query } + +declare abstract class ReadQueue { + queue: Uint8Array[]; + outstandingRequest: DataRequest | undefined; + constructor(); + abstract socketIsNotClosed(): boolean; + enqueue(data: Uint8Array): void; + dequeue(): void; + bytesInQueue(): number; + read(bytes: number): Promise | undefined>; +} + +declare type RootCertsData = Uint8Array; + +declare interface RootCertsDatabase { + index: RootCertsIndex; + data: RootCertsData; +} + +declare interface RootCertsIndex { + offsets: number[]; + subjects: Record; +} + +declare interface SocketDefaults { + poolQueryViaFetch: boolean; + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchConnectionCache: boolean; + fetchFunction: any; + webSocketConstructor: typeof WebSocket | undefined; + wsProxy: string | ((host: string, port: number | string) => string); + useSecureWebSocket: boolean; + forceDisablePgSSL: boolean; + coalesceWrites: boolean; + pipelineConnect: 'password' | false; + subtls: typeof subtls | undefined; + rootCerts: string; + pipelineTLS: boolean; + disableSNI: boolean; +} + +declare class SocketReadQueue extends ReadQueue { + private socket; + constructor(socket: Socket); + socketIsNotClosed(): boolean; +} + +declare function stableStringify(x: any, replacer?: (key: string, value: any) => any, indent?: string | number): string; + +declare function startTls(host: string, rootCertsDatabase: RootCertsDatabase | string, networkRead: (bytes: number) => Promise, networkWrite: (data: Uint8Array) => void, { useSNI, requireServerTlsExtKeyUsage, requireDigitalSigKeyUsage, writePreData, expectPreData, commentPreData }?: { + useSNI?: boolean; + requireServerTlsExtKeyUsage?: boolean; + requireDigitalSigKeyUsage?: boolean; + writePreData?: Uint8Array; + expectPreData?: Uint8Array; + commentPreData?: string; +}): Promise Promise | undefined>, (data: Uint8Array) => Promise]>; + +declare function stdCharCodes(charCode: number): number | void; + +declare namespace subtls { + export { + base64Decode, + hexFromU8, + stableStringify, + startTls, + u8FromHex, + SocketReadQueue, + TrustedCert, + WebSocketReadQueue + } +} + +declare class TrustedCert extends Cert { + static databaseFromPEM(pem: string): RootCertsDatabase; + static findInDatabase(subjectOrSubjectKeyId: DistinguishedName | string, db: RootCertsDatabase): TrustedCert | undefined; +} + +export { types } + +declare function u8FromHex(hex: string): Uint8Array; + +declare class WebSocketReadQueue extends ReadQueue { + private socket; + constructor(socket: WebSocket); + socketIsNotClosed(): boolean; +} + +export { } diff --git a/dist/dts/shims/net/index.d.ts b/dist/dts/shims/net/index.d.ts index 34cfac8..9c7c0ae 100644 --- a/dist/dts/shims/net/index.d.ts +++ b/dist/dts/shims/net/index.d.ts @@ -6,7 +6,7 @@ * (node-postgres). */ import { EventEmitter } from 'events'; -import type * as subtls from '../../subtls.d.ts'; +import type * as subtls from 'subtls'; export declare function isIP(input: string): number; interface FetchEndpointOptions { jwtAuth?: boolean; diff --git a/dist/dts/shims/net/index.d.ts.orig b/dist/dts/shims/net/index.d.ts.orig new file mode 100644 index 0000000..b891b28 --- /dev/null +++ b/dist/dts/shims/net/index.d.ts.orig @@ -0,0 +1,118 @@ +/** + * This file shims parts of the Node.js built-in net and tls packages, by + * implementing net.Socket and tls.connect() on top of WebSockets. It's + * designed to work both in browsers and in Cloudflare Workers (where + * WebSockets work a bit differently). The calling client is assumed to be pg + * (node-postgres). + */ +import { EventEmitter } from 'events'; +import type * as subtls from 'subtls'; +declare global { + const debug: boolean; + interface WebSocket { + binaryType: 'arraybuffer' | 'blob'; + accept?: () => void; + } + interface Response { + webSocket: WebSocket; + } + class __unstable_WebSocket extends WebSocket { + } +} +export declare function isIP(input: string): number; +interface FetchEndpointOptions { + jwtAuth?: boolean; +} +export interface SocketDefaults { + poolQueryViaFetch: boolean; + fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); + fetchConnectionCache: boolean; + fetchFunction: any; + webSocketConstructor: typeof WebSocket | undefined; + wsProxy: string | ((host: string, port: number | string) => string); + useSecureWebSocket: boolean; + forceDisablePgSSL: boolean; + coalesceWrites: boolean; + pipelineConnect: 'password' | false; + subtls: typeof subtls | undefined; + rootCerts: string; + pipelineTLS: boolean; + disableSNI: boolean; +} +export declare class Socket extends EventEmitter { + static defaults: SocketDefaults; + static opts: Partial; + private opts; + static get poolQueryViaFetch(): SocketDefaults["poolQueryViaFetch"]; + static set poolQueryViaFetch(newValue: SocketDefaults['poolQueryViaFetch']); + static get fetchEndpoint(): SocketDefaults["fetchEndpoint"]; + static set fetchEndpoint(newValue: SocketDefaults['fetchEndpoint']); + static get fetchConnectionCache(): SocketDefaults["fetchConnectionCache"]; + static set fetchConnectionCache(newValue: SocketDefaults['fetchConnectionCache']); + static get fetchFunction(): SocketDefaults["fetchFunction"]; + static set fetchFunction(newValue: SocketDefaults['fetchFunction']); + static get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + static set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + get webSocketConstructor(): SocketDefaults["webSocketConstructor"]; + set webSocketConstructor(newValue: SocketDefaults['webSocketConstructor']); + static get wsProxy(): SocketDefaults["wsProxy"]; + static set wsProxy(newValue: SocketDefaults['wsProxy']); + get wsProxy(): SocketDefaults["wsProxy"]; + set wsProxy(newValue: SocketDefaults['wsProxy']); + static get coalesceWrites(): SocketDefaults["coalesceWrites"]; + static set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + get coalesceWrites(): SocketDefaults["coalesceWrites"]; + set coalesceWrites(newValue: SocketDefaults['coalesceWrites']); + static get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + static set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + get useSecureWebSocket(): SocketDefaults["useSecureWebSocket"]; + set useSecureWebSocket(newValue: SocketDefaults['useSecureWebSocket']); + static get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + static set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + get forceDisablePgSSL(): SocketDefaults["forceDisablePgSSL"]; + set forceDisablePgSSL(newValue: SocketDefaults['forceDisablePgSSL']); + static get disableSNI(): SocketDefaults["disableSNI"]; + static set disableSNI(newValue: SocketDefaults['disableSNI']); + get disableSNI(): SocketDefaults["disableSNI"]; + set disableSNI(newValue: SocketDefaults['disableSNI']); + static get pipelineConnect(): SocketDefaults["pipelineConnect"]; + static set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + get pipelineConnect(): SocketDefaults["pipelineConnect"]; + set pipelineConnect(newValue: SocketDefaults['pipelineConnect']); + static get subtls(): SocketDefaults["subtls"]; + static set subtls(newValue: SocketDefaults['subtls']); + get subtls(): SocketDefaults["subtls"]; + set subtls(newValue: SocketDefaults['subtls']); + static get pipelineTLS(): SocketDefaults["pipelineTLS"]; + static set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + get pipelineTLS(): SocketDefaults["pipelineTLS"]; + set pipelineTLS(newValue: SocketDefaults['pipelineTLS']); + static get rootCerts(): SocketDefaults["rootCerts"]; + static set rootCerts(newValue: SocketDefaults['rootCerts']); + get rootCerts(): SocketDefaults["rootCerts"]; + set rootCerts(newValue: SocketDefaults['rootCerts']); + wsProxyAddrForHost(host: string, port: number): string; + connecting: boolean; + pending: boolean; + writable: boolean; + encrypted: boolean; + authorized: boolean; + destroyed: boolean; + private ws; + private writeBuffer; + private tlsState; + private tlsRead; + private tlsWrite; + setNoDelay(): this; + setKeepAlive(): this; + ref(): this; + unref(): this; + connect(port: number | string, host: string, connectListener?: () => void): void; + startTls(host: string): Promise; + tlsReadLoop(): Promise; + rawWrite(data: Uint8Array): void; + write(data: Buffer | string, encoding?: string, callback?: (err?: any) => void): boolean; + end(data?: Buffer | string, encoding?: string, callback?: () => void): this; + destroy(): this; +} +export {}; diff --git a/dist/jsr/index.d.ts b/dist/jsr/index.d.ts index 89b1371..3e1bb52 100644 --- a/dist/jsr/index.d.ts +++ b/dist/jsr/index.d.ts @@ -536,4 +536,3 @@ declare class WebSocketReadQueue extends ReadQueue { socketIsNotClosed(): boolean; } -export { } diff --git a/dist/npm/index.d.mts b/dist/npm/index.d.mts index 89b1371..3e1bb52 100644 --- a/dist/npm/index.d.mts +++ b/dist/npm/index.d.mts @@ -536,4 +536,3 @@ declare class WebSocketReadQueue extends ReadQueue { socketIsNotClosed(): boolean; } -export { } diff --git a/dist/npm/index.d.ts b/dist/npm/index.d.ts index 89b1371..3e1bb52 100644 --- a/dist/npm/index.d.ts +++ b/dist/npm/index.d.ts @@ -536,4 +536,3 @@ declare class WebSocketReadQueue extends ReadQueue { socketIsNotClosed(): boolean; } -export { } diff --git a/export.sh b/export.sh index f0f1f33..2d0b110 100755 --- a/export.sh +++ b/export.sh @@ -35,31 +35,23 @@ npx esbuild export/index.ts \ # == types == -# note: we run sed with -i.orig and then rm because this is Mac/BSD and GNU compatible - npx tsc -# remove global declarations from types and replace subtls types with local ones -cp node_modules/subtls/index.d.ts dist/dts/subtls.d.ts +# remove global declarations from types sed -i.orig -r \ -e "/^declare global [{]$/,/^[}]$/d" \ - -e "s| from 'subtls';| from '../../subtls.d.ts';|g" \ dist/dts/shims/net/index.d.ts -rm dist/dts/shims/net/index.d.ts.orig - # bundle types into one file echo -echo "Note: warnings are expected from api-extractor:" +echo "Note: some warnings are expected from api-extractor:" npx @microsoft/api-extractor run --local # remove appendage sed -i.orig -r \ -e '/^export [{] *[}]$/d' \ - dist/npm/index.d.ts - -rm dist/npm/index.d.ts.orig + dist/dts/_extracted.d.ts # copy to .d.ts (for CJS) and .d.mts (for ESM) (echo '/// '; echo; cat dist/dts/_extracted.d.ts) > dist/npm/index.d.ts From d29753b2d41e704eb751cb67875f4de9ddbf01dd Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 15:15:11 +0000 Subject: [PATCH 26/40] Added env var/secret for test workflow --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2cf54ae..3b5d7af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,4 +18,7 @@ jobs: # goal - name: Run tests + env: + VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }} + VITE_WSPROXY: ${{ vars.VITE_WSPROXY }} run: bun run test From afbca1970c87374f7fc80312ad7f89dfc95fa92b Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 17:16:33 +0000 Subject: [PATCH 27/40] Relaxed WebSocket types to accept anything reasonable --- api-extractor.json | 6 +- dist/dts/_extracted.d.ts | 14 +- dist/dts/_extracted.d.ts.orig | 14 +- dist/dts/shims/net/index.d.ts | 12 +- dist/dts/shims/net/index.d.ts.orig | 21 +- dist/jsr/index.d.ts | 14 +- dist/jsr/index.js | 324 +++++++++++++------------- dist/npm/index.d.mts | 14 +- dist/npm/index.d.ts | 14 +- dist/npm/index.js | 360 ++++++++++++++--------------- dist/npm/index.mjs | 324 +++++++++++++------------- shims/net/index.ts | 42 ++-- tests/README.md | 4 + tests/ws.test.ts | 11 +- 14 files changed, 633 insertions(+), 541 deletions(-) diff --git a/api-extractor.json b/api-extractor.json index 9e29160..6708a7a 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -2,9 +2,7 @@ "mainEntryPointFilePath": "dist/dts/export/index.d.ts", "newlineKind": "lf", "enumMemberOrder": "preserve", - "bundledPackages": [ - "subtls" - ], + "bundledPackages": ["subtls"], "dtsRollup": { "enabled": true, "untrimmedFilePath": "dist/dts/_extracted.d.ts" @@ -25,4 +23,4 @@ } } } -} \ No newline at end of file +} diff --git a/dist/dts/_extracted.d.ts b/dist/dts/_extracted.d.ts index fad484d..3a3a170 100644 --- a/dist/dts/_extracted.d.ts +++ b/dist/dts/_extracted.d.ts @@ -475,7 +475,7 @@ declare interface SocketDefaults { fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); fetchConnectionCache: boolean; fetchFunction: any; - webSocketConstructor: typeof WebSocket | undefined; + webSocketConstructor: WebSocketConstructor | undefined; wsProxy: string | ((host: string, port: number | string) => string); useSecureWebSocket: boolean; forceDisablePgSSL: boolean; @@ -528,6 +528,18 @@ export { types } declare function u8FromHex(hex: string): Uint8Array; +declare interface WebSocketConstructor { + new (...args: any[]): WebSocketLike; +} + +declare interface WebSocketLike { + readonly readyState: number; + binaryType: string; + close(code?: number, reason?: string): void; + send(data: any): void; + addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (this: WebSocketLike, ev: any) => any, options?: any): void; +} + declare class WebSocketReadQueue extends ReadQueue { private socket; constructor(socket: WebSocket); diff --git a/dist/dts/_extracted.d.ts.orig b/dist/dts/_extracted.d.ts.orig index 3a047e1..48160cb 100644 --- a/dist/dts/_extracted.d.ts.orig +++ b/dist/dts/_extracted.d.ts.orig @@ -475,7 +475,7 @@ declare interface SocketDefaults { fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); fetchConnectionCache: boolean; fetchFunction: any; - webSocketConstructor: typeof WebSocket | undefined; + webSocketConstructor: WebSocketConstructor | undefined; wsProxy: string | ((host: string, port: number | string) => string); useSecureWebSocket: boolean; forceDisablePgSSL: boolean; @@ -528,6 +528,18 @@ export { types } declare function u8FromHex(hex: string): Uint8Array; +declare interface WebSocketConstructor { + new (...args: any[]): WebSocketLike; +} + +declare interface WebSocketLike { + readonly readyState: number; + binaryType: string; + close(code?: number, reason?: string): void; + send(data: any): void; + addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (this: WebSocketLike, ev: any) => any, options?: any): void; +} + declare class WebSocketReadQueue extends ReadQueue { private socket; constructor(socket: WebSocket); diff --git a/dist/dts/shims/net/index.d.ts b/dist/dts/shims/net/index.d.ts index 9c7c0ae..a435356 100644 --- a/dist/dts/shims/net/index.d.ts +++ b/dist/dts/shims/net/index.d.ts @@ -7,6 +7,16 @@ */ import { EventEmitter } from 'events'; import type * as subtls from 'subtls'; +interface WebSocketLike { + readonly readyState: number; + binaryType: string; + close(code?: number, reason?: string): void; + send(data: any): void; + addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (this: WebSocketLike, ev: any) => any, options?: any): void; +} +interface WebSocketConstructor { + new (...args: any[]): WebSocketLike; +} export declare function isIP(input: string): number; interface FetchEndpointOptions { jwtAuth?: boolean; @@ -16,7 +26,7 @@ export interface SocketDefaults { fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); fetchConnectionCache: boolean; fetchFunction: any; - webSocketConstructor: typeof WebSocket | undefined; + webSocketConstructor: WebSocketConstructor | undefined; wsProxy: string | ((host: string, port: number | string) => string); useSecureWebSocket: boolean; forceDisablePgSSL: boolean; diff --git a/dist/dts/shims/net/index.d.ts.orig b/dist/dts/shims/net/index.d.ts.orig index b891b28..a9094bb 100644 --- a/dist/dts/shims/net/index.d.ts.orig +++ b/dist/dts/shims/net/index.d.ts.orig @@ -9,15 +9,16 @@ import { EventEmitter } from 'events'; import type * as subtls from 'subtls'; declare global { const debug: boolean; - interface WebSocket { - binaryType: 'arraybuffer' | 'blob'; - accept?: () => void; - } - interface Response { - webSocket: WebSocket; - } - class __unstable_WebSocket extends WebSocket { - } +} +interface WebSocketLike { + readonly readyState: number; + binaryType: string; + close(code?: number, reason?: string): void; + send(data: any): void; + addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (this: WebSocketLike, ev: any) => any, options?: any): void; +} +interface WebSocketConstructor { + new (...args: any[]): WebSocketLike; } export declare function isIP(input: string): number; interface FetchEndpointOptions { @@ -28,7 +29,7 @@ export interface SocketDefaults { fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); fetchConnectionCache: boolean; fetchFunction: any; - webSocketConstructor: typeof WebSocket | undefined; + webSocketConstructor: WebSocketConstructor | undefined; wsProxy: string | ((host: string, port: number | string) => string); useSecureWebSocket: boolean; forceDisablePgSSL: boolean; diff --git a/dist/jsr/index.d.ts b/dist/jsr/index.d.ts index 3e1bb52..791327f 100644 --- a/dist/jsr/index.d.ts +++ b/dist/jsr/index.d.ts @@ -477,7 +477,7 @@ declare interface SocketDefaults { fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); fetchConnectionCache: boolean; fetchFunction: any; - webSocketConstructor: typeof WebSocket | undefined; + webSocketConstructor: WebSocketConstructor | undefined; wsProxy: string | ((host: string, port: number | string) => string); useSecureWebSocket: boolean; forceDisablePgSSL: boolean; @@ -530,6 +530,18 @@ export { types } declare function u8FromHex(hex: string): Uint8Array; +declare interface WebSocketConstructor { + new (...args: any[]): WebSocketLike; +} + +declare interface WebSocketLike { + readonly readyState: number; + binaryType: string; + close(code?: number, reason?: string): void; + send(data: any): void; + addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (this: WebSocketLike, ev: any) => any, options?: any): void; +} + declare class WebSocketReadQueue extends ReadQueue { private socket; constructor(socket: WebSocket); diff --git a/dist/jsr/index.js b/dist/jsr/index.js index f952463..9583a89 100644 --- a/dist/jsr/index.js +++ b/dist/jsr/index.js @@ -5,10 +5,10 @@ r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0});var te=(r,e)=>()=>(r& Ce(r,t,{get:e[t],enumerable:!0})},Tn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== "function")for(let i of io(e))!oo.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= no(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?ro(so(r)):{},Tn(e||!r||!r.__esModule?Ce(t,"default",{ -value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= +value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Ln=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= yo;var ae=[],re=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ -PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ee=0,In=Rt.length;Ee0)throw new Error("Invalid string. Length must be a multip\ le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Pn, "getLens");function co(r){var e=Pn(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(co,"byte\ @@ -24,19 +24,19 @@ e&255),s}a(lo,"toByteArray");function fo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[ "")}a(po,"encodeChunk");function yo(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0, u=t-n;ou?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ ae[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ae[e>>10]+ae[e>>4&63]+ae[e<< -2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Ln=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> +2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Bn=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> 1,l=-7,d=t?i-1:0,b=t?-1:1,C=r[e+d];for(d+=b,s=C&(1<<-l)-1,C>>=-l,l+=u;l>0;s=s*256+ r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== 0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? -1:1)*o*Math.pow(2,s-n)};Ft.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,B=n?1:-1,Q=e<0|| +h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,L=n?1:-1,Q=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=b/c:e+= b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=B,u/=256, -i-=8);for(o=o<0;r[t+C]=o&255,C+=B,o/=256,h-=8);r[t+C-B]|=Q*128}});var Kn=I(Le=>{"use strict";p();var Mt=Bn(),Pe=Ln(),Rn=typeof Symbol=="function"&& -typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Le.Buffer= -f;Le.SlowBuffer=xo;Le.INSPECT_MAX_BYTES=50;var ot=2147483647;Le.kMaxLength=ot;f. +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=L,u/=256, +i-=8);for(o=o<0;r[t+C]=o&255,C+=L,o/=256,h-=8);r[t+C-L]|=Q*128}});var Kn=I(Be=>{"use strict";p();var Mt=Ln(),Pe=Bn(),Rn=typeof Symbol=="function"&& +typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Be.Buffer= +f;Be.SlowBuffer=xo;Be.INSPECT_MAX_BYTES=50;var ot=2147483647;Be.kMaxLength=ot;f. TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ @@ -108,27 +108,27 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ut(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return Vn(r).length;default:if(i)return n?-1:Ut(r).length;e=(""+e).toLowerCase(), -i=!0}}a(On,"byteLength");f.byteLength=On;function Eo(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(On,"byteLength");f.byteLength=On;function vo(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| (t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( -this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Bo(this, -e,t);case"latin1":case"binary":return Lo(this,e,t);case"base64":return Io(this,e, +this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Lo(this, +e,t);case"latin1":case"binary":return Bo(this,e,t);case"base64":return Io(this,e, t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -Eo,"slowToString");f.prototype._isBuffer=!0;function ve(r,e,t){let n=r[e];r[e]=r[t], -r[t]=n}a(ve,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) +vo,"slowToString");f.prototype._isBuffer=!0;function Ee(r,e,t){let n=r[e];r[e]=r[t], +r[t]=n}a(Ee,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< -e;t+=2)ve(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. +e;t+=2)Ee(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bit\ -s");for(let t=0;tt&&(e+=" ... "),""},"inspect");Rn&&(f.prototype[Rn]=f.prototype.inspect);f.prototype.compare= a(function(e,t,n,i,s){if(ue(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f. @@ -155,10 +155,10 @@ o;h++)if(c(r,h)===c(e,l===-1?0:h-l)){if(l===-1&&(l=h),h-l+1===u)return l*s}else if(c(r,h+d)!==c(e,d)){l=!1;break}if(l)return h}return-1}a(Fn,"arrayIndexOf");f.prototype. includes=a(function(e,t,n){return this.indexOf(e,t,n)!==-1},"includes");f.prototype. indexOf=a(function(e,t,n){return Nn(this,e,t,n,!0)},"indexOf");f.prototype.lastIndexOf= -a(function(e,t,n){return Nn(this,e,t,n,!1)},"lastIndexOf");function vo(r,e,t,n){ +a(function(e,t,n){return Nn(this,e,t,n,!1)},"lastIndexOf");function Eo(r,e,t,n){ t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n> s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n) te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return vo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ +hex":return Eo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ @@ -185,10 +185,10 @@ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)= o&1023),n.push(o),i+=u}return Po(n)}a(qn,"utf8Slice");var Mn=4096;function Po(r){ let e=r.length;if(e<=Mn)return String.fromCharCode.apply(String,r);let t="",n=0; for(;nn)&&(t=n);let i="";for(let s=e;s>>0,t||N(e,4,th length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE"); f.prototype.readUint32BE=f.prototype.readUInt32BE=a(function(e,t){return e=e>>>0, t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ -readUInt32BE");f.prototype.readBigUInt64LE=me(a(function(e){e=e>>>0,Be(e,"offset"); +readUInt32BE");f.prototype.readBigUInt64LE=me(a(function(e){e=e>>>0,Le(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Be(e,"offset");let t=this[e],n=this[e+7]; +readBigUInt64BE=me(a(function(e){e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7]; (t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ 1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=me(a(function(e){ -e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, +e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Be(e,"offset"); +igInt64LE"));f.prototype.readBigInt64BE=me(a(function(e){e=e>>>0,Le(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<2**32?i=kn(String(t)):typeof t=="bigint"&&(i=String(t) (t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=kn(i)),i+="n"),n+=` It\ must be ${e}. Received ${i}`,n},RangeError);function kn(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(kn,"addNumericalSeparator");function Mo(r,e,t){Be(e,"offset"),(r[e]=== +t)}${e}`}a(kn,"addNumericalSeparator");function Mo(r,e,t){Le(e,"offset"),(r[e]=== void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function $n(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Ie.ERR_OUT_OF_RANGE( -"value",u,r)}Mo(n,i,s)}a($n,"checkIntBI");function Be(r,e){if(typeof r!="number") -throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Be,"validateNumber");function je(r,e,t){ -throw Math.floor(r)!==r?(Be(r,t),new Ie.ERR_OUT_OF_RANGE(t||"offset","an integer", +"value",u,r)}Mo(n,i,s)}a($n,"checkIntBI");function Le(r,e){if(typeof r!="number") +throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Le,"validateNumber");function je(r,e,t){ +throw Math.floor(r)!==r?(Le(r,t),new Ie.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Ie.ERR_BUFFER_OUT_OF_BOUNDS:new Ie.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? 1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% @@ -364,8 +364,8 @@ a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var No=functi let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< 16;++i)e[n+i]=r[t]+r[i]}return e}();function me(r){return typeof BigInt>"u"?qo:r} a(me,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} -a(qo,"BufferBigIntNotDefined")});var S,x,v,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +a(qo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. Buffer.allocUnsafe=="function"?globalThis.Buffer:Kn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= @@ -376,22 +376,22 @@ Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& console.warn(r)}a(Qo,"ProcessEmitWarning");var Zn=Number.isNaN||a(function(e){return e!== -e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");Wt.exports= -L;Wt.exports.once=Go;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= -0;L.prototype._maxListeners=void 0;var Yn=10;function ct(r){if(typeof r!="functi\ +e},"NumberIsNaN");function B(){B.init.call(this)}a(B,"EventEmitter");Wt.exports= +B;Wt.exports.once=Go;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= +0;B.prototype._maxListeners=void 0;var Yn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ -ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(L,"defaultMaxLi\ +ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(B,"defaultMaxLi\ steners",{enumerable:!0,get:a(function(){return Yn},"get"),set:a(function(r){if(typeof r!= "number"||r<0||Zn(r))throw new RangeError('The value of "defaultMaxListeners" is\ out of range. It must be a non-negative number. Received '+r+".");Yn=r},"set")}); -L.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). +B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). _events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners= -this._maxListeners||void 0};L.prototype.setMaxListeners=a(function(e){if(typeof e!= +this._maxListeners||void 0};B.prototype.setMaxListeners=a(function(e){if(typeof e!= "number"||e<0||Zn(e))throw new RangeError('The value of "n" is out of range. It \ must be a non-negative number. Received '+e+".");return this._maxListeners=e,this}, -"setMaxListeners");function Jn(r){return r._maxListeners===void 0?L.defaultMaxListeners: -r._maxListeners}a(Jn,"_getMaxListeners");L.prototype.getMaxListeners=a(function(){ -return Jn(this)},"getMaxListeners");L.prototype.emit=a(function(e){for(var t=[], +"setMaxListeners");function Jn(r){return r._maxListeners===void 0?B.defaultMaxListeners: +r._maxListeners}a(Jn,"_getMaxListeners");B.prototype.getMaxListeners=a(function(){ +return Jn(this)},"getMaxListeners");B.prototype.emit=a(function(e){for(var t=[], n=1;n 0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+ @@ -405,23 +405,23 @@ t):o.push(t),i=Jn(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(Xn,"_addList\ -ener");L.prototype.addListener=a(function(e,t){return Xn(this,e,t,!1)},"addListe\ -ner");L.prototype.on=L.prototype.addListener;L.prototype.prependListener=a(function(e,t){ +ener");B.prototype.addListener=a(function(e,t){return Xn(this,e,t,!1)},"addListe\ +ner");B.prototype.on=B.prototype.addListener;B.prototype.prependListener=a(function(e,t){ return Xn(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, "onceWrapper");function ei(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");L.prototype. -once=a(function(e,t){return ct(t),this.on(e,ei(this,e,t)),this},"once");L.prototype. +listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");B.prototype. +once=a(function(e,t){return ct(t),this.on(e,ei(this,e,t)),this},"once");B.prototype. prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ei(this, -e,t)),this},"prependOnceListener");L.prototype.removeListener=a(function(e,t){var n, +e,t)),this},"prependOnceListener");B.prototype.removeListener=a(function(e,t){var n, i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this; if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, -"removeListener");L.prototype.off=L.prototype.removeListener;L.prototype.removeAllListeners= +"removeListener");B.prototype.off=B.prototype.removeListener;B.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount= 0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]), @@ -431,13 +431,13 @@ o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners( n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length- 1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ti(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?Ho(i):ni(i,i.length)}a(ti,"_listeners");L.prototype. -listeners=a(function(e){return ti(this,e,!0)},"listeners");L.prototype.rawListeners= -a(function(e){return ti(this,e,!1)},"rawListeners");L.listenerCount=function(r,e){ -return typeof r.listenerCount=="function"?r.listenerCount(e):ri.call(r,e)};L.prototype. +"function"?t?[i.listener||i]:[i]:t?Ho(i):ni(i,i.length)}a(ti,"_listeners");B.prototype. +listeners=a(function(e){return ti(this,e,!0)},"listeners");B.prototype.rawListeners= +a(function(e){return ti(this,e,!1)},"rawListeners");B.listenerCount=function(r,e){ +return typeof r.listenerCount=="function"?r.listenerCount(e):ri.call(r,e)};B.prototype. listenerCount=ri;function ri(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== "function")return 1;if(t!==void 0)return t.length}return 0}a(ri,"listenerCount"); -L.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): +B.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): []},"eventNames");function ni(r,e){for(var t=new Array(e),n=0;nA>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),B=new Uint8Array( -64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+ +3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),L=new Uint8Array( +64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+ 3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,ce=b(C[R- 2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+ce|0}let A=e,g=t,P=n,K=i,D=s, W=o,X=u,oe=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),ce=D&W^~D&X,ye=oe+ $+ce+d[R]+C[R]|0,Se=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,he=Se+We|0;oe=X,X=W,W= D,D=K+ye|0,K=P,P=g,g=A,A=ye+he|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, u=u+X|0,c=c+oe|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). -encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]= -0;let A=h*8;B[l++]=A/1099511627776&255,B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]= -A>>>16&255,B[l++]=A>>>8&255,B[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= +encode(A));for(let g=0;g{if(L[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)L[l++]=0;Q()}for(;l<58;)L[l++]= +0;let A=h*8;L[l++]=A/1099511627776&255,L[l++]=A/4294967296&255,L[l++]=A>>>24,L[l++]= +A>>>16&255,L[l++]=A>>>8&255,L[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, @@ -619,18 +619,18 @@ onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return par e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( r),t=e[8]==="-";return Object.keys(fi).reduce(function(n,i){var s=fi[i],o=e[s];return!o|| (o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(ba,"parse")});var mi=I((Eh,yi)=>{"use strict";p();yi.exports=a(function(e){if(/^\\x/.test(e))return new y( +o),n},{})}a(ba,"parse")});var mi=I((vh,yi)=>{"use strict";p();yi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=$t(),ze=Vt(),lt=ci(),wi=di(),bi=mi();function ft(r){ +"\\";n+=Math.floor(i/2)*2}return new y(t,"binary")},"parseBytea")});var Ei=I((Ah,vi)=>{p();var Ke=$t(),ze=Vt(),lt=ci(),wi=di(),bi=mi();function ft(r){ return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Si(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| r==="1"}a(Si,"parseBool");function Sa(r){return r?Ke.parse(r,Si):null}a(Sa,"pars\ eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Yt(r){ -return r?Ke.parse(r,ft(xa)):null}a(Yt,"parseIntegerArray");function Ea(r){return r? -Ke.parse(r,ft(function(e){return xi(e).trim()})):null}a(Ea,"parseBigIntegerArray"); -var va=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +return r?Ke.parse(r,ft(xa)):null}a(Yt,"parseIntegerArray");function va(r){return r? +Ke.parse(r,ft(function(e){return xi(e).trim()})):null}a(va,"parseBigIntegerArray"); +var Ea=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=er(t)),t});return e.parse()},"parsePointArray"),Zt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); return e.parse()},"parseFloatArray"),ne=a(function(r){if(!r)return null;var e=ze. @@ -648,28 +648,28 @@ if(n||(e+=r[i]),r[i]===")"){n=!0;continue}else if(!n)continue;r[i]!==","&&(t+=r[ var s=er(e);return s.radius=parseFloat(t),s},"parseCircle"),Ta=a(function(r){r(20, xi),r(21,Xt),r(23,Xt),r(26,Xt),r(700,parseFloat),r(701,parseFloat),r(16,Si),r(1082, lt),r(1114,lt),r(1184,lt),r(600,er),r(651,ne),r(718,Ca),r(1e3,Sa),r(1001,Aa),r(1005, -Yt),r(1007,Yt),r(1028,Yt),r(1016,Ea),r(1017,va),r(1021,Zt),r(1022,Zt),r(1231,Zt), +Yt),r(1007,Yt),r(1028,Yt),r(1016,va),r(1017,Ea),r(1021,Zt),r(1022,Zt),r(1231,Zt), r(1014,ne),r(1015,ne),r(1008,ne),r(1009,ne),r(1040,ne),r(1041,ne),r(1115,Jt),r(1182, Jt),r(1185,Jt),r(1186,wi),r(1187,_a),r(17,bi),r(114,JSON.parse.bind(JSON)),r(3802, JSON.parse.bind(JSON)),r(199,gi),r(3807,gi),r(3907,ne),r(2951,ne),r(791,ne),r(1183, -ne),r(1270,ne)},"init");Ei.exports={init:Ta}});var Ai=I((Ih,_i)=>{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( +ne),r(1270,ne)},"init");vi.exports={init:Ta}});var Ai=I((Ih,_i)=>{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,o,u, c,h,l;{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+ u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Pa=Ai(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ -return C*Math.pow(2,Q)+B};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, +e%Y,o=4294967296*s+t,u=""+o%Y,n+u+i}a(Ia,"readInt8");_i.exports=Ia});var Li=I((Bh,Pi)=>{p();var Pa=Ai(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,L,Q){ +return C*Math.pow(2,Q)+L};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& (h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Ii=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= 1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ba=a(function(r){return F(r,1)==1?-1* +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),La=a(function(r){return F(r,1)==1?-1* (F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ci=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),La=a(function(r){return Ii(r,23,8)},"pars\ +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Ba=a(function(r){return Ii(r,23,8)},"pars\ eFloat32"),Ra=a(function(r){return Ii(r,52,11)},"parseFloat64"),Fa=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o1){var C=h.shift();for(b=0;b0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,Ba),r(23,Ci),r(26, -Ci),r(1700,Fa),r(700,La),r(701,Ra),r(16,ka),r(1114,Ti.bind(null,!1)),r(1184,Ti.bind( +null?null:F(r,8)>0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,La),r(23,Ci),r(26, +Ci),r(1700,Fa),r(700,Ba),r(701,Ra),r(16,ka),r(1114,Ti.bind(null,!1)),r(1184,Ti.bind( null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); -Pi.exports={init:Da}});var Ri=I((Mh,Li)=>{p();Li.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +Pi.exports={init:Da}});var Ri=I((Mh,Bi)=>{p();Bi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -696,7 +696,7 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=vi(),Oa=Bi(),Na=Vt(),qa=Ri();Je.getTypeParser=Qa;Je.setTypeParser= +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=Ei(),Oa=Li(),Na=Vt(),qa=Ri();Je.getTypeParser=Qa;Je.setTypeParser= Wa;Je.arrayParser=Na;Je.builtins=qa;var Ze={text:{},binary:{}};function Fi(r){return String( r)}a(Fi,"noParse");function Qa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Fi}a(Qa, "getTypeParser");function Wa(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= @@ -749,8 +749,8 @@ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, i,n.iteration),o=ke(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ ",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=ke(u,d),C=Oi( -o,b),B=C.toString("base64"),Q=ke(s,"Server Key"),J=ke(Q,d);r.message="SASLRespon\ -se",r.serverSignature=J.toString("base64"),r.response=l+",p="+B}a(eu,"continueSe\ +o,b),L=C.toString("base64"),Q=ke(s,"Server Key"),J=ke(Q,d);r.message="SASLRespon\ +se",r.serverSignature=J.toString("base64"),r.response=l+",p="+L}a(eu,"continueSe\ ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( @@ -805,8 +805,8 @@ let n=new hu(t);return n[we]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.ma t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Gi.exports=du});var zi=I((nl,fe)=>{"use strict";p();var Vi=(sr(),O(ir)),yu=(cr(),O(ur)).Stream,mu=$i(), Ki=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, -xu=32768;function Eu(r){return(r&Su)==xu}a(Eu,"isRegFile");var De=["host","port", -"database","user","password"],fr=De.length,vu=De[fr-1];function pr(){var r=rt instanceof +xu=32768;function vu(r){return(r&Su)==xu}a(vu,"isRegFile");var De=["host","port", +"database","user","password"],fr=De.length,Eu=De[fr-1];function pr(){var r=rt instanceof yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` `);rt.write(Ki.format.apply(Ki,e))}}a(pr,"warn");Object.defineProperty(fe.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});fe. @@ -814,12 +814,12 @@ exports.warnTo=function(r){var e=rt;return rt=r,e};fe.exports.getFileName=functi var e=r||m.env,t=e.PGPASSFILE||(yt?Vi.join(e.APPDATA||"./","postgresql","pgpass.\ conf"):Vi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",Eu(r.mode)?r.mode&(wu|bu)?(pr('WARNING: password file "%s" has group or \ +",vu(r.mode)?r.mode&(wu|bu)?(pr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(pr('WARNING:\ password file "%s" is not a plain file',e),!1))};var _u=fe.exports.match=function(r,e){ return De.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};fe.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[vu],i.end())} +var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[Eu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), pr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. on("data",s).on("end",o).on("error",u)};var Au=fe.exports.parseLine=function(r){ @@ -843,9 +843,9 @@ this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| "text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};Ji.exports=gt});var Xi={};se(Xi,{default:()=>Iu});var Iu,es=te(()=>{"use strict";p();Iu={}});var ts={};se(ts,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let C=i+":"+s,B=e?Object.fromEntries(d.entries()):l;return{ +i),h=decodeURIComponent(h);let C=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:B,hash:b}}var mr=te(()=>{"use strict";p();a(yr,"parse")});var ns=I((yl,rs)=>{"use strict";p();var Pu=(mr(),O(ts)),gr=(ar(),O(or));function wr(r){ +search:l,query:L,hash:b}}var mr=te(()=>{"use strict";p();a(yr,"parse")});var ns=I((yl,rs)=>{"use strict";p();var Pu=(mr(),O(ts)),gr=(ar(),O(or));function wr(r){ if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- @@ -860,9 +860,9 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=gr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(wr,"parse");rs.exports=wr;wr.parse=wr});var bt=I((wl,os)=>{"use strict";p();var Bu=(es(),O(Xi)),ss=et(),is=ns().parse,V=a( +return t}a(wr,"parse");rs.exports=wr;wr.parse=wr});var bt=I((wl,os)=>{"use strict";p();var Lu=(es(),O(Xi)),ss=et(),is=ns().parse,V=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||ss[r]},"val"),Lu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||ss[r]},"val"),Bu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": return{rejectUnauthorized:!1}}return ss.ssl},"readSSLConfigFromEnvironment"),Ue=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ @@ -872,7 +872,7 @@ d"),Sr=class Sr{constructor(e){e=typeof e=="string"?is(e):e||{},e.connectionStri V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Lu():e.ssl,typeof this.ssl=="st\ +options=V("options",e),this.ssl=typeof e.ssl>"u"?Bu():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. @@ -892,10 +892,10 @@ ssl}:{};if(ie(t,n,"sslmode"),ie(t,n,"sslca"),ie(t,n,"sslkey"),ie(t,n,"sslcert"), ie(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ue(this.database)),this.replication&& t.push("replication="+Ue(this.replication)),this.host&&t.push("host="+Ue(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Ue(this.client_encoding)),Bu.lookup(this.host,function(i,s){return i? +ent_encoding="+Ue(this.client_encoding)),Lu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Ue(s)),e(null,t.join(" ")))})}};a(Sr,"ConnectionPa\ rameters");var br=Sr;os.exports=br});var cs=I((xl,us)=>{"use strict";p();var Ru=Xe(),as=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, -Er=class Er{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, +vr=class vr{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ var t;e.text?t=as.exec(e.text):t=as.exec(e.command),t&&(this.command=t[1],t[3]?(this. @@ -906,8 +906,8 @@ n=0,i=e.length;n{"use strict";p();var{EventEmitter:Fu}=ge(),hs=cs(),ls=tt(),_r=class _r extends Fu{constructor(e,t,n){ +ext"):this._parsers[t]=Ru.getTypeParser(n.dataTypeID,n.format||"text")}}};a(vr,"\ +Result");var xr=vr;us.exports=xr});var ps=I((_l,fs)=>{"use strict";p();var{EventEmitter:Fu}=ge(),hs=cs(),ls=tt(),_r=class _r extends Fu{constructor(e,t,n){ super(),e=ls.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& @@ -940,44 +940,44 @@ try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:thi binary,valueMapper:ls.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(_r,"Query"); -var vr=_r;fs.exports=vr});var ms={};se(ms,{Socket:()=>_e,isIP:()=>Mu});function Mu(r){return 0}var ys,ds,E, -_e,St=te(()=>{"use strict";p();ys=Te(ge(),1);a(Mu,"isIP");ds=/^[^.]+\./,E=class E extends ys.EventEmitter{constructor(){ +var Er=_r;fs.exports=Er});var ms={};se(ms,{Socket:()=>_e,isIP:()=>Mu});function Mu(r){return 0}var ys,ds,v, +_e,St=te(()=>{"use strict";p();ys=Te(ge(),1);a(Mu,"isIP");ds=/^[^.]+\./,v=class v extends ys.EventEmitter{constructor(){ super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); _(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? -E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ -E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? +v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ +v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ -E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? -E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. -wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. -opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? -E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? -E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? -E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ -E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ -return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. -rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ +v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? +v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. +wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. +opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? +v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? +v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? +v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ +v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ +return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. +rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -1016,12 +1016,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +!0,this.end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( (t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});_e=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(v,"opts",{});_e=v});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1043,9 +1043,9 @@ this.length=e,this.fieldCount=t,this.name="rowDescription",this.fields=new Array this.fieldCount)}};a(jr,"RowDescriptionMessage");var Pr=jr;T.RowDescriptionMessage= Pr;var Hr=class Hr{constructor(e,t){this.length=e,this.parameterCount=t,this.name= "parameterDescription",this.dataTypeIDs=new Array(this.parameterCount)}};a(Hr,"P\ -arameterDescriptionMessage");var Br=Hr;T.ParameterDescriptionMessage=Br;var Gr=class Gr{constructor(e,t,n){ +arameterDescriptionMessage");var Lr=Hr;T.ParameterDescriptionMessage=Lr;var Gr=class Gr{constructor(e,t,n){ this.length=e,this.parameterName=t,this.parameterValue=n,this.name="parameterSta\ -tus"}};a(Gr,"ParameterStatusMessage");var Lr=Gr;T.ParameterStatusMessage=Lr;var $r=class $r{constructor(e,t){ +tus"}};a(Gr,"ParameterStatusMessage");var Br=Gr;T.ParameterStatusMessage=Br;var $r=class $r{constructor(e,t){ this.length=e,this.salt=t,this.name="authenticationMD5Password"}};a($r,"Authenti\ cationMD5Password");var Rr=$r;T.AuthenticationMD5Password=Rr;var Vr=class Vr{constructor(e,t,n){ this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Vr, @@ -1075,8 +1075,8 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(tn,"Wr\ -iter");var en=tn;xt.Writer=en});var bs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); -vt.serialize=void 0;var rn=gs(),M=new rn.Writer,ku=a(r=>{M.addInt16(3).addInt16( +iter");var en=tn;xt.Writer=en});var bs=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); +Et.serialize=void 0;var rn=gs(),M=new rn.Writer,ku=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new rn. Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); @@ -1105,12 +1105,12 @@ allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i "cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), zu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),Zu=a(r=>M.add(r).flush( -100),"copyData"),Ju=a(r=>nn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),Xu=Et(72),ec=Et(83),tc=Et(88),rc=Et(99),nc={startup:ku,password:Uu, +100),"copyData"),Ju=a(r=>nn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),Xu=vt(72),ec=vt(83),tc=vt(88),rc=vt(99),nc={startup:ku,password:Uu, requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( ()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, -cancel:$u};vt.serialize=nc});var Ss=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +cancel:$u};Et.serialize=nc});var Ss=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); _t.BufferReader=void 0;var ic=y.allocUnsafe(0),on=class on{constructor(e=0){this. offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= @@ -1120,14 +1120,14 @@ toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstrin let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(on,"BufferReader");var sn=on;_t.BufferReader= -sn});var vs=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var k=Xr(),sc=Ss(),an=1,oc=4,xs=an+oc,Es=y.allocUnsafe(0),cn=class cn{constructor(e){ -if(this.buffer=Es,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, +sn});var Es=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); +At.Parser=void 0;var k=Xr(),sc=Ss(),an=1,oc=4,xs=an+oc,vs=y.allocUnsafe(0),cn=class cn{constructor(e){ +if(this.buffer=vs,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, i=this.bufferOffset;for(;i+xs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+xs,s,o,this.buffer);t(c),i+=u}else -break}i===n?(this.buffer=Es,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= +break}i===n?(this.buffer=vs,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer. @@ -1188,7 +1188,7 @@ line=s.L,c.routine=s.R,c}};a(cn,"Parser");var un=cn;At.Parser=un});var hn=I(be=> be.DatabaseError=be.serialize=be.parse=void 0;var ac=Xr();Object.defineProperty( be,"DatabaseError",{enumerable:!0,get:a(function(){return ac.DatabaseError},"get")}); var uc=bs();Object.defineProperty(be,"serialize",{enumerable:!0,get:a(function(){ -return uc.serialize},"get")});var cc=vs();function hc(r,e){let t=new cc.Parser;return r. +return uc.serialize},"get")});var cc=Es();function hc(r,e){let t=new cc.Parser;return r. on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");be. parse=hc});var _s={};se(_s,{connect:()=>lc});function lc({socket:r,servername:e}){return r. startTls(e),r}var As=te(()=>{"use strict";p();a(lc,"connect")});var pn=I((zl,Is)=>{"use strict";p();var Cs=(St(),O(ms)),fc=ge().EventEmitter,{parse:pc, @@ -1223,8 +1223,8 @@ unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Is.exports=ln});var Ls=I((Xl,Bs)=>{"use strict";p();var mc=ge().EventEmitter,Jl=(Ge(),O(He)),gc=tt(), -dn=qi(),wc=Zi(),bc=wt(),Sc=bt(),Ps=ps(),xc=et(),Ec=pn(),yn=class yn extends mc{constructor(e){ +this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Is.exports=ln});var Bs=I((Xl,Ls)=>{"use strict";p();var mc=ge().EventEmitter,Jl=(Ge(),O(He)),gc=tt(), +dn=qi(),wc=Zi(),bc=wt(),Sc=bt(),Ps=ps(),xc=et(),vc=pn(),yn=class yn extends mc{constructor(e){ super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ @@ -1232,7 +1232,7 @@ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.p this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new Ec({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new vc({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. @@ -1337,7 +1337,7 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(yn,"Client");var Ct=yn;Ct.Query= -Ps;Bs.exports=Ct});var ks=I((rf,Ms)=>{"use strict";p();var vc=ge().EventEmitter,Rs=a(function(){},"\ +Ps;Ls.exports=Ct});var ks=I((rf,Ms)=>{"use strict";p();var Ec=ge().EventEmitter,Rs=a(function(){},"\ NOOP"),Fs=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),wn=class wn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(wn,"IdleItem");var mn=wn,bn=class bn{constructor(e){this.callback= @@ -1348,7 +1348,7 @@ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.capture o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Ac,"makeIdleListener");var Sn=class Sn extends vc{constructor(e,t){ +"idleListener")}a(Ac,"makeIdleListener");var Sn=class Sn extends Ec{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1458,10 +1458,10 @@ this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. values.map(xn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Gs=I((ff,Hs)=>{"use strict";p();var Bc=(Us(),O(Ds)),Lc=wt(),lf=Os(),Ws=ge(). +text,t)}});var Gs=I((ff,Hs)=>{"use strict";p();var Lc=(Us(),O(Ds)),Bc=wt(),lf=Os(),Ws=ge(). EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),js=Qs(),Z=Hs.exports=function(r){Ws.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Lc(r.types),this.native= -new Bc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Bc(r.types),this.native= +new Lc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= !1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= @@ -1503,15 +1503,15 @@ _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== -1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. _types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var En=I((yf,$s)=>{"use strict";p();$s.exports=Gs()});var It=I((gf,nt)=>{"use strict";p();var Mc=Ls(),kc=et(),Dc=pn(),Uc=ks(),{DatabaseError:Oc}=hn(), +_types.getTypeParser(r,e)}});var vn=I((yf,$s)=>{"use strict";p();$s.exports=Gs()});var It=I((gf,nt)=>{"use strict";p();var Mc=Bs(),kc=et(),Dc=pn(),Uc=ks(),{DatabaseError:Oc}=hn(), Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ -ool"),e},"poolFactory"),vn=a(function(r){this.defaults=kc,this.Client=r,this.Query= +ool"),e},"poolFactory"),En=a(function(r){this.defaults=kc,this.Client=r,this.Query= this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new vn(En()):(nt.exports=new vn(Mc),Object.defineProperty(nt.exports,"na\ -tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new vn(En())}catch(e){ +exports=new En(vn()):(nt.exports=new En(Mc),Object.defineProperty(nt.exports,"na\ +tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new En(vn())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});p();var Bt=Te(It());St();p();St();mr();var zs=Te(tt()),Ys=Te(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ +native",{value:r}),r}}))});p();var Lt=Te(It());St();p();St();mr();var zs=Te(tt()),Ys=Te(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", "NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); _(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ @@ -1527,7 +1527,7 @@ queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=yr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:b,hostname:C,port:B,pathname:Q}=l;if(d!=="postgres:"&&d!== +let{protocol:d,username:b,hostname:C,port:L,pathname:Q}=l;if(d!=="postgres:"&&d!== "postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;W{let Lt=g[xe]??{},eo=Lt.arrayMode??oe,to=Lt.fullResults??R;return Ks( -Ae,{arrayMode:eo,fullResults:to,parameterizedQuery:A[xe],resultCallback:c,types:Lt. +map((Ae,xe)=>{let Bt=g[xe]??{},eo=Bt.arrayMode??oe,to=Bt.fullResults??R;return Ks( +Ae,{arrayMode:eo,fullResults:to,parameterizedQuery:A[xe],resultCallback:c,types:Bt. types})})}else{let H=g??{},Ae=H.arrayMode??oe,xe=H.fullResults??R;return Ks(j,{arrayMode:Ae, fullResults:xe,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; if(j===400){let H=await ee.json(),Ae=new pe(H.message);for(let xe of Qc)Ae[xe]=H[xe]?? @@ -1569,7 +1569,7 @@ t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ks," processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new pe("Error ge\ tting auth token.");throw e instanceof Error&&(t=new pe(`Error getting auth toke\ -n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Te(bt()),Qe=Te(It());var An=class An extends Bt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ +n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Te(bt()),Qe=Te(It());var An=class An extends Lt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& (this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ @@ -1601,10 +1601,10 @@ ESSAGE: missing/invalid iteration count");if(!u.startsWith(n.clientNonce))throw "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, -C=b.encode(i),B=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ -6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",B,y.concat([d,y.from( +C=b.encode(i),L=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ +6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",L,y.concat([d,y.from( [0,0,0,1])]))),J=Q;for(var de=0;deJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( +"HMAC",L,Q)),J=y.from(J.map((ee,j)=>J[j]^Q[j]));let A=J,g=await w.subtle.importKey( "raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,oe=D+","+W+ @@ -1618,7 +1618,7 @@ he,b.encode(oe)));n.message="SASLResponse",n.serverSignature=it.toString("base64 n.response=X+",p="+ye,this.connection.sendSCRAMClientFinalMessage(this.saslSession. response)}};a(An,"NeonClient");var _n=An;function Hc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var Cn=class Cn extends Bt.Pool{constructor(){ +n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var Cn=class Cn extends Lt.Pool{constructor(){ super(...arguments);_(this,"Client",_n);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ if(!_e.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") diff --git a/dist/npm/index.d.mts b/dist/npm/index.d.mts index 3e1bb52..791327f 100644 --- a/dist/npm/index.d.mts +++ b/dist/npm/index.d.mts @@ -477,7 +477,7 @@ declare interface SocketDefaults { fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); fetchConnectionCache: boolean; fetchFunction: any; - webSocketConstructor: typeof WebSocket | undefined; + webSocketConstructor: WebSocketConstructor | undefined; wsProxy: string | ((host: string, port: number | string) => string); useSecureWebSocket: boolean; forceDisablePgSSL: boolean; @@ -530,6 +530,18 @@ export { types } declare function u8FromHex(hex: string): Uint8Array; +declare interface WebSocketConstructor { + new (...args: any[]): WebSocketLike; +} + +declare interface WebSocketLike { + readonly readyState: number; + binaryType: string; + close(code?: number, reason?: string): void; + send(data: any): void; + addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (this: WebSocketLike, ev: any) => any, options?: any): void; +} + declare class WebSocketReadQueue extends ReadQueue { private socket; constructor(socket: WebSocket); diff --git a/dist/npm/index.d.ts b/dist/npm/index.d.ts index 3e1bb52..791327f 100644 --- a/dist/npm/index.d.ts +++ b/dist/npm/index.d.ts @@ -477,7 +477,7 @@ declare interface SocketDefaults { fetchEndpoint: string | ((host: string, port: number | string, options?: FetchEndpointOptions) => string); fetchConnectionCache: boolean; fetchFunction: any; - webSocketConstructor: typeof WebSocket | undefined; + webSocketConstructor: WebSocketConstructor | undefined; wsProxy: string | ((host: string, port: number | string) => string); useSecureWebSocket: boolean; forceDisablePgSSL: boolean; @@ -530,6 +530,18 @@ export { types } declare function u8FromHex(hex: string): Uint8Array; +declare interface WebSocketConstructor { + new (...args: any[]): WebSocketLike; +} + +declare interface WebSocketLike { + readonly readyState: number; + binaryType: string; + close(code?: number, reason?: string): void; + send(data: any): void; + addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (this: WebSocketLike, ev: any) => any, options?: any): void; +} + declare class WebSocketReadQueue extends ReadQueue { private socket; constructor(socket: WebSocket); diff --git a/dist/npm/index.js b/dist/npm/index.js index ce76bcc..0a381ca 100644 --- a/dist/npm/index.js +++ b/dist/npm/index.js @@ -5,13 +5,13 @@ Te(r,t,{get:e[t],enumerable:!0})},Pn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeo no(e,i))||n.enumerable});return r};var Ie=(r,e,t)=>(t=r!=null?ro(so(r)):{},Pn(e||!r||!r.__esModule?Te(t,"default",{ value:r,enumerable:!0}):t,r)),O=r=>Pn(Te({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Rn=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= yo;var ue=[],ne=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Ft="ABCDEFGHIJKLMNO\ -PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_e=0,Bn=Ft.length;_e0)throw new Error("Invalid string. Length must be a multip\ -le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Ln, -"getLens");function co(r){var e=Ln(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(co,"byte\ +le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Bn, +"getLens");function co(r){var e=Bn(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(co,"byte\ Length");function ho(r,e,t){return(e+t)*3/4-t}a(ho,"_byteLength");function lo(r){ -var e,t=Ln(r),n=t[0],i=t[1],s=new uo(ho(r,n,i)),o=0,u=i>0?n-4:n,c;for(c=0;c0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e= ne[r.charCodeAt(c)]<<2|ne[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=ne[r.charCodeAt( @@ -27,12 +27,12 @@ ue[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ue[e>>10]+ue[e>>4&63]+ue[ r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== 0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? -1:1)*o*Math.pow(2,s-n)};Mt.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,B=n?1:-1,Q=e<0|| +h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,L=n?1:-1,Q=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=b/c:e+= b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=B,u/=256, -i-=8);for(o=o<0;r[t+C]=o&255,C+=B,o/=256,h-=8);r[t+C-B]|=Q*128}});var Yn=I(Re=>{"use strict";p();var kt=Rn(),Be=Fn(),Mn=typeof Symbol=="function"&& +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=L,u/=256, +i-=8);for(o=o<0;r[t+C]=o&255,C+=L,o/=256,h-=8);r[t+C-L]|=Q*128}});var Yn=I(Re=>{"use strict";p();var kt=Rn(),Le=Fn(),Mn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Re.Buffer= f;Re.SlowBuffer=xo;Re.INSPECT_MAX_BYTES=50;var ot=2147483647;Re.kMaxLength=ot;f. TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. @@ -106,14 +106,14 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ot(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return zn(r).length;default:if(i)return n?-1:Ot(r).length;e=(""+e).toLowerCase(), -i=!0}}a(qn,"byteLength");f.byteLength=qn;function Eo(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(qn,"byteLength");f.byteLength=qn;function vo(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| (t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( -this,e,t);case"utf8":case"utf-8":return Wn(this,e,t);case"ascii":return Bo(this, -e,t);case"latin1":case"binary":return Lo(this,e,t);case"base64":return Io(this,e, +this,e,t);case"utf8":case"utf-8":return Wn(this,e,t);case"ascii":return Lo(this, +e,t);case"latin1":case"binary":return Bo(this,e,t);case"base64":return Io(this,e, t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -Eo,"slowToString");f.prototype._isBuffer=!0;function Ae(r,e,t){let n=r[e];r[e]=r[t], +vo,"slowToString");f.prototype._isBuffer=!0;function Ae(r,e,t){let n=r[e];r[e]=r[t], r[t]=n}a(Ae,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< e;t+=2)Ae(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. @@ -123,7 +123,7 @@ f.prototype.swap64=a(function(){let e=this.length;if(e%8!==0)throw new RangeErro "Buffer size must be a multiple of 64-bits");for(let t=0;ti&&(n=i)):n=i;let s=e.length;n> s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n) te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return vo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ +hex":return Eo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ @@ -183,10 +183,10 @@ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)= o&1023),n.push(o),i+=u}return Po(n)}a(Wn,"utf8Slice");var Dn=4096;function Po(r){ let e=r.length;if(e<=Dn)return String.fromCharCode.apply(String,r);let t="",n=0; for(;nn)&&(t=n);let i="";for(let s=e;s>>0,t||N(e,4,th length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE"); f.prototype.readUint32BE=f.prototype.readUInt32BE=a(function(e,t){return e=e>>>0, t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ -readUInt32BE");f.prototype.readBigUInt64LE=ge(a(function(e){e=e>>>0,Le(e,"offset"); +readUInt32BE");f.prototype.readBigUInt64LE=ge(a(function(e){e=e>>>0,Be(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Le(e,"offset");let t=this[e],n=this[e+7]; +readBigUInt64BE=ge(a(function(e){e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7]; (t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ 1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=ge(a(function(e){ -e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, +e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Le(e,"offset"); +igInt64LE"));f.prototype.readBigInt64BE=ge(a(function(e){e=e>>>0,Be(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,t||N(e,4,this.length),Be.read(this,e, +readFloatLE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),Le.read(this,e, !0,23,4)},"readFloatLE");f.prototype.readFloatBE=a(function(e,t){return e=e>>>0, -t||N(e,4,this.length),Be.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= -a(function(e,t){return e=e>>>0,t||N(e,8,this.length),Be.read(this,e,!0,52,8)},"r\ +t||N(e,4,this.length),Le.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= +a(function(e,t){return e=e>>>0,t||N(e,8,this.length),Le.read(this,e,!0,52,8)},"r\ eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||N(e,8,this. -length),Be.read(this,e,!1,52,8)},"readDoubleBE");function z(r,e,t,n,i,s){if(!f.isBuffer( +length),Le.read(this,e,!1,52,8)},"readDoubleBE");function z(r,e,t,n,i,s){if(!f.isBuffer( r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e< s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError( "Index out of range")}a(z,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= @@ -292,11 +292,11 @@ writeBigInt64BE=ge(a(function(e,t=0){return Hn(this,e,t,-BigInt("0x8000000000000 000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Gn(r,e,t,n,i,s){ if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError( "Index out of range")}a(Gn,"checkIEEE754");function $n(r,e,t,n,i){return e=+e,t= -t>>>0,i||Gn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Be.write(r,e,t,n, +t>>>0,i||Gn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Le.write(r,e,t,n, 23,4),t+4}a($n,"writeFloat");f.prototype.writeFloatLE=a(function(e,t,n){return $n( this,e,t,!0,n)},"writeFloatLE");f.prototype.writeFloatBE=a(function(e,t,n){return $n( this,e,t,!1,n)},"writeFloatBE");function Vn(r,e,t,n,i){return e=+e,t=t>>>0,i||Gn( -r,e,t,8,17976931348623157e292,-17976931348623157e292),Be.write(r,e,t,n,52,8),t+8} +r,e,t,8,17976931348623157e292,-17976931348623157e292),Le.write(r,e,t,n,52,8),t+8} a(Vn,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return Vn(this,e, t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return Vn( this,e,t,!1,n)},"writeDoubleBE");f.prototype.copy=a(function(e,t,n,i){if(!f.isBuffer( @@ -331,14 +331,14 @@ isInteger(t)&&Math.abs(t)>2**32?i=Un(String(t)):typeof t=="bigint"&&(i=String(t) (t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Un(i)),i+="n"),n+=` It\ must be ${e}. Received ${i}`,n},RangeError);function Un(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(Un,"addNumericalSeparator");function Mo(r,e,t){Le(e,"offset"),(r[e]=== +t)}${e}`}a(Un,"addNumericalSeparator");function Mo(r,e,t){Be(e,"offset"),(r[e]=== void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function Kn(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Pe.ERR_OUT_OF_RANGE( -"value",u,r)}Mo(n,i,s)}a(Kn,"checkIntBI");function Le(r,e){if(typeof r!="number") -throw new Pe.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Le,"validateNumber");function je(r,e,t){ -throw Math.floor(r)!==r?(Le(r,t),new Pe.ERR_OUT_OF_RANGE(t||"offset","an integer", +"value",u,r)}Mo(n,i,s)}a(Kn,"checkIntBI");function Be(r,e){if(typeof r!="number") +throw new Pe.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Be,"validateNumber");function je(r,e,t){ +throw Math.floor(r)!==r?(Be(r,t),new Pe.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Pe.ERR_BUFFER_OUT_OF_BOUNDS:new Pe.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? 1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% @@ -362,8 +362,8 @@ a(ce,"isInstance");function Wt(r){return r!==r}a(Wt,"numberIsNaN");var No=functi let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< 16;++i)e[n+i]=r[t]+r[i]}return e}();function ge(r){return typeof BigInt>"u"?qo:r} a(ge,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} -a(qo,"BufferBigIntNotDefined")});var S,x,v,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +a(qo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. Buffer.allocUnsafe=="function"?globalThis.Buffer:Yn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= @@ -374,22 +374,22 @@ Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& console.warn(r)}a(Qo,"ProcessEmitWarning");var Xn=Number.isNaN||a(function(e){return e!== -e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");jt.exports= -L;jt.exports.once=Go;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= -0;L.prototype._maxListeners=void 0;var Jn=10;function ct(r){if(typeof r!="functi\ +e},"NumberIsNaN");function B(){B.init.call(this)}a(B,"EventEmitter");jt.exports= +B;jt.exports.once=Go;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= +0;B.prototype._maxListeners=void 0;var Jn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ -ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(L,"defaultMaxLi\ +ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(B,"defaultMaxLi\ steners",{enumerable:!0,get:a(function(){return Jn},"get"),set:a(function(r){if(typeof r!= "number"||r<0||Xn(r))throw new RangeError('The value of "defaultMaxListeners" is\ out of range. It must be a non-negative number. Received '+r+".");Jn=r},"set")}); -L.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). +B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). _events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners= -this._maxListeners||void 0};L.prototype.setMaxListeners=a(function(e){if(typeof e!= +this._maxListeners||void 0};B.prototype.setMaxListeners=a(function(e){if(typeof e!= "number"||e<0||Xn(e))throw new RangeError('The value of "n" is out of range. It \ must be a non-negative number. Received '+e+".");return this._maxListeners=e,this}, -"setMaxListeners");function ei(r){return r._maxListeners===void 0?L.defaultMaxListeners: -r._maxListeners}a(ei,"_getMaxListeners");L.prototype.getMaxListeners=a(function(){ -return ei(this)},"getMaxListeners");L.prototype.emit=a(function(e){for(var t=[], +"setMaxListeners");function ei(r){return r._maxListeners===void 0?B.defaultMaxListeners: +r._maxListeners}a(ei,"_getMaxListeners");B.prototype.getMaxListeners=a(function(){ +return ei(this)},"getMaxListeners");B.prototype.emit=a(function(e){for(var t=[], n=1;n 0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+ @@ -403,23 +403,23 @@ t):o.push(t),i=ei(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(ti,"_addList\ -ener");L.prototype.addListener=a(function(e,t){return ti(this,e,t,!1)},"addListe\ -ner");L.prototype.on=L.prototype.addListener;L.prototype.prependListener=a(function(e,t){ +ener");B.prototype.addListener=a(function(e,t){return ti(this,e,t,!1)},"addListe\ +ner");B.prototype.on=B.prototype.addListener;B.prototype.prependListener=a(function(e,t){ return ti(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, "onceWrapper");function ri(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ri,"_onceWrap");L.prototype. -once=a(function(e,t){return ct(t),this.on(e,ri(this,e,t)),this},"once");L.prototype. +listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ri,"_onceWrap");B.prototype. +once=a(function(e,t){return ct(t),this.on(e,ri(this,e,t)),this},"once");B.prototype. prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ri(this, -e,t)),this},"prependOnceListener");L.prototype.removeListener=a(function(e,t){var n, +e,t)),this},"prependOnceListener");B.prototype.removeListener=a(function(e,t){var n, i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this; if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, -"removeListener");L.prototype.off=L.prototype.removeListener;L.prototype.removeAllListeners= +"removeListener");B.prototype.off=B.prototype.removeListener;B.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount= 0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]), @@ -429,13 +429,13 @@ o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners( n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length- 1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ni(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?Ho(i):si(i,i.length)}a(ni,"_listeners");L.prototype. -listeners=a(function(e){return ni(this,e,!0)},"listeners");L.prototype.rawListeners= -a(function(e){return ni(this,e,!1)},"rawListeners");L.listenerCount=function(r,e){ -return typeof r.listenerCount=="function"?r.listenerCount(e):ii.call(r,e)};L.prototype. +"function"?t?[i.listener||i]:[i]:t?Ho(i):si(i,i.length)}a(ni,"_listeners");B.prototype. +listeners=a(function(e){return ni(this,e,!0)},"listeners");B.prototype.rawListeners= +a(function(e){return ni(this,e,!1)},"rawListeners");B.listenerCount=function(r,e){ +return typeof r.listenerCount=="function"?r.listenerCount(e):ii.call(r,e)};B.prototype. listenerCount=ii;function ii(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== "function")return 1;if(t!==void 0)return t.length}return 0}a(ii,"listenerCount"); -L.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): +B.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): []},"eventNames");function si(r,e){for(var t=new Array(e),n=0;nA>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),B=new Uint8Array( -64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+ +3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),L=new Uint8Array( +64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+ 3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,le=b(C[R- 2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+le|0}let A=e,g=t,P=n,K=i,D=s, W=o,X=u,ae=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),le=D&W^~D&X,me=ae+ -$+le+d[R]+C[R]|0,Ee=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,fe=Ee+We|0;ae=X,X=W,W= +$+le+d[R]+C[R]|0,ve=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,fe=ve+We|0;ae=X,X=W,W= D,D=K+me|0,K=P,P=g,g=A,A=me+fe|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, u=u+X|0,c=c+ae|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). -encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]= -0;let A=h*8;B[l++]=A/1099511627776&255,B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]= -A>>>16&255,B[l++]=A>>>8&255,B[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= +encode(A));for(let g=0;g{if(L[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)L[l++]=0;Q()}for(;l<58;)L[l++]= +0;let A=h*8;L[l++]=A/1099511627776&255,L[l++]=A/4294967296&255,L[l++]=A>>>24,L[l++]= +A>>>16&255,L[l++]=A>>>8&255,L[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, @@ -617,18 +617,18 @@ onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return par e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( r),t=e[8]==="-";return Object.keys(di).reduce(function(n,i){var s=di[i],o=e[s];return!o|| (o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(ba,"parse")});var wi=I((vh,gi)=>{"use strict";p();gi.exports=a(function(e){if(/^\\x/.test(e))return new y( +o),n},{})}a(ba,"parse")});var wi=I((Eh,gi)=>{"use strict";p();gi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=Vt(),ze=Kt(),lt=li(),Si=mi(),xi=wi();function ft(r){ -return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Ei(r){ +return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function vi(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| -r==="1"}a(Ei,"parseBool");function Sa(r){return r?Ke.parse(r,Ei):null}a(Sa,"pars\ +r==="1"}a(vi,"parseBool");function Sa(r){return r?Ke.parse(r,vi):null}a(Sa,"pars\ eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Zt(r){ -return r?Ke.parse(r,ft(xa)):null}a(Zt,"parseIntegerArray");function Ea(r){return r? -Ke.parse(r,ft(function(e){return vi(e).trim()})):null}a(Ea,"parseBigIntegerArray"); -var va=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +return r?Ke.parse(r,ft(xa)):null}a(Zt,"parseIntegerArray");function va(r){return r? +Ke.parse(r,ft(function(e){return Ei(e).trim()})):null}a(va,"parseBigIntegerArray"); +var Ea=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=tr(t)),t});return e.parse()},"parsePointArray"),Jt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); return e.parse()},"parseFloatArray"),ie=a(function(r){if(!r)return null;var e=ze. @@ -637,16 +637,16 @@ var e=ze.create(r,function(t){return t!==null&&(t=lt(t)),t});return e.parse()}," parseDateArray"),_a=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ return t!==null&&(t=Si(t)),t});return e.parse()},"parseIntervalArray"),Aa=a(function(r){ return r?Ke.parse(r,ft(xi)):null},"parseByteAArray"),er=a(function(r){return parseInt( -r,10)},"parseInteger"),vi=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: +r,10)},"parseInteger"),Ei=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: r},"parseBigInteger"),bi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, "parseJsonArray"),tr=a(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- 1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ca=a(function(r){ if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i>>0,o=42949 s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Pa=Ti(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ -return C*Math.pow(2,Q)+B};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, +e%Y,o=4294967296*s+t,u=""+o%Y,n+u+i}a(Ia,"readInt8");Ci.exports=Ia});var Ri=I((Rh,Bi)=>{p();var Pa=Ti(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,L,Q){ +return C*Math.pow(2,Q)+L};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& -(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Bi=a(function(r,e,t){var n=Math.pow(2,t- +(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Li=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= 1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ba=a(function(r){return F(r,1)==1?-1* +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),La=a(function(r){return F(r,1)==1?-1* (F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ii=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),La=a(function(r){return Bi(r,23,8)},"pars\ -eFloat32"),Ra=a(function(r){return Bi(r,52,11)},"parseFloat64"),Fa=a(function(r){ +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Ba=a(function(r){return Li(r,23,8)},"pars\ +eFloat32"),Ra=a(function(r){return Li(r,52,11)},"parseFloat64"),Fa=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o1){var C=h.shift();for(b=0;b0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,Ba),r(23,Ii),r(26, -Ii),r(1700,Fa),r(700,La),r(701,Ra),r(16,ka),r(1114,Pi.bind(null,!1)),r(1184,Pi.bind( +null?null:F(r,8)>0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,La),r(23,Ii),r(26, +Ii),r(1700,Fa),r(700,Ba),r(701,Ra),r(16,ka),r(1114,Pi.bind(null,!1)),r(1184,Pi.bind( null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); -Li.exports={init:Da}});var Mi=I((kh,Fi)=>{p();Fi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +Bi.exports={init:Da}});var Mi=I((kh,Fi)=>{p();Fi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -747,8 +747,8 @@ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, i,n.iteration),o=De(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ ",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=De(u,d),C=qi( -o,b),B=C.toString("base64"),Q=De(s,"Server Key"),J=De(Q,d);r.message="SASLRespon\ -se",r.serverSignature=J.toString("base64"),r.response=l+",p="+B}a(eu,"continueSe\ +o,b),L=C.toString("base64"),Q=De(s,"Server Key"),J=De(Q,d);r.message="SASLRespon\ +se",r.serverSignature=J.toString("base64"),r.response=l+",p="+L}a(eu,"continueSe\ ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( @@ -803,8 +803,8 @@ let n=new hu(t);return n[be]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.ma t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Vi.exports=du});var Zi=I((il,de)=>{"use strict";p();var zi=(or(),O(sr)),yu=(hr(),O(cr)).Stream,mu=Ki(), Yi=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, -xu=32768;function Eu(r){return(r&Su)==xu}a(Eu,"isRegFile");var Ue=["host","port", -"database","user","password"],pr=Ue.length,vu=Ue[pr-1];function dr(){var r=rt instanceof +xu=32768;function vu(r){return(r&Su)==xu}a(vu,"isRegFile");var Ue=["host","port", +"database","user","password"],pr=Ue.length,Eu=Ue[pr-1];function dr(){var r=rt instanceof yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` `);rt.write(Yi.format.apply(Yi,e))}}a(dr,"warn");Object.defineProperty(de.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});de. @@ -812,12 +812,12 @@ exports.warnTo=function(r){var e=rt;return rt=r,e};de.exports.getFileName=functi var e=r||m.env,t=e.PGPASSFILE||(yt?zi.join(e.APPDATA||"./","postgresql","pgpass.\ conf"):zi.join(e.HOME||"./",".pgpass"));return t};de.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",Eu(r.mode)?r.mode&(wu|bu)?(dr('WARNING: password file "%s" has group or \ +",vu(r.mode)?r.mode&(wu|bu)?(dr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(dr('WARNING:\ password file "%s" is not a plain file',e),!1))};var _u=de.exports.match=function(r,e){ return Ue.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};de.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[vu],i.end())} +var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[Eu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), dr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. on("data",s).on("end",o).on("error",u)};var Au=de.exports.parseLine=function(r){ @@ -841,9 +841,9 @@ this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| "text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};es.exports=gt});var ts={};re(ts,{default:()=>Iu});var Iu,rs=te(()=>{"use strict";p();Iu={}});var ns={};re(ns,{parse:()=>mr});function mr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let C=i+":"+s,B=e?Object.fromEntries(d.entries()):l;return{ +i),h=decodeURIComponent(h);let C=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:B,hash:b}}var gr=te(()=>{"use strict";p();a(mr,"parse")});var ss=I((ml,is)=>{"use strict";p();var Pu=(gr(),O(ns)),wr=(ur(),O(ar));function br(r){ +search:l,query:L,hash:b}}var gr=te(()=>{"use strict";p();a(mr,"parse")});var ss=I((ml,is)=>{"use strict";p();var Pu=(gr(),O(ns)),wr=(ur(),O(ar));function br(r){ if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- @@ -858,9 +858,9 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=wr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(br,"parse");is.exports=br;br.parse=br});var bt=I((bl,us)=>{"use strict";p();var Bu=(rs(),O(ts)),as=et(),os=ss().parse,V=a( +return t}a(br,"parse");is.exports=br;br.parse=br});var bt=I((bl,us)=>{"use strict";p();var Lu=(rs(),O(ts)),as=et(),os=ss().parse,V=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||as[r]},"val"),Lu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||as[r]},"val"),Bu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": return{rejectUnauthorized:!1}}return as.ssl},"readSSLConfigFromEnvironment"),Oe=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ @@ -870,7 +870,7 @@ d"),xr=class xr{constructor(e){e=typeof e=="string"?os(e):e||{},e.connectionStri V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Lu():e.ssl,typeof this.ssl=="st\ +options=V("options",e),this.ssl=typeof e.ssl>"u"?Bu():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. @@ -890,10 +890,10 @@ ssl}:{};if(se(t,n,"sslmode"),se(t,n,"sslca"),se(t,n,"sslkey"),se(t,n,"sslcert"), se(t,n,"sslrootcert"),this.database&&t.push("dbname="+Oe(this.database)),this.replication&& t.push("replication="+Oe(this.replication)),this.host&&t.push("host="+Oe(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Oe(this.client_encoding)),Bu.lookup(this.host,function(i,s){return i? +ent_encoding="+Oe(this.client_encoding)),Lu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Oe(s)),e(null,t.join(" ")))})}};a(xr,"ConnectionPa\ -rameters");var Sr=xr;us.exports=Sr});var ls=I((El,hs)=>{"use strict";p();var Ru=Xe(),cs=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, -vr=class vr{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, +rameters");var Sr=xr;us.exports=Sr});var ls=I((vl,hs)=>{"use strict";p();var Ru=Xe(),cs=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +Er=class Er{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ var t;e.text?t=cs.exec(e.text):t=cs.exec(e.command),t&&(this.command=t[1],t[3]?(this. @@ -904,8 +904,8 @@ n=0,i=e.length;n{"use strict";p();var{EventEmitter:Fu}=we(),fs=ls(),ps=tt(),Ar=class Ar extends Fu{constructor(e,t,n){ +ext"):this._parsers[t]=Ru.getTypeParser(n.dataTypeID,n.format||"text")}}};a(Er,"\ +Result");var vr=Er;hs.exports=vr});var ys=I((Al,ds)=>{"use strict";p();var{EventEmitter:Fu}=we(),fs=ls(),ps=tt(),Ar=class Ar extends Fu{constructor(e,t,n){ super(),e=ps.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& @@ -938,44 +938,44 @@ try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:thi binary,valueMapper:ps.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(Ar,"Query"); -var _r=Ar;ds.exports=_r});var ws={};re(ws,{Socket:()=>Se,isIP:()=>Mu});function Mu(r){return 0}var gs,ms,E, -Se,St=te(()=>{"use strict";p();gs=Ie(we(),1);a(Mu,"isIP");ms=/^[^.]+\./,E=class E extends gs.EventEmitter{constructor(){ +var _r=Ar;ds.exports=_r});var ws={};re(ws,{Socket:()=>Se,isIP:()=>Mu});function Mu(r){return 0}var gs,ms,v, +Se,St=te(()=>{"use strict";p();gs=Ie(we(),1);a(Mu,"isIP");ms=/^[^.]+\./,v=class v extends gs.EventEmitter{constructor(){ super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); _(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? -E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ -E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? +v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ +v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ -E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? -E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. -wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. -opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? -E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? -E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? -E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ -E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ -return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. -rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ +v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? +v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. +wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. +opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? +v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? +v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? +v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ +v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ +return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. +rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -1014,12 +1014,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +!0,this.end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( (t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ms,"apiauth."):s=t.replace(ms,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});Se=E});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(v,"opts",{});Se=v});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1038,10 +1038,10 @@ pyResponse");var Ir=Wr;T.CopyResponse=Ir;var jr=class jr{constructor(e,t,n,i,s,o this.name=e,this.tableID=t,this.columnID=n,this.dataTypeID=i,this.dataTypeSize=s, this.dataTypeModifier=o,this.format=u}};a(jr,"Field");var Pr=jr;T.Field=Pr;var Hr=class Hr{constructor(e,t){ this.length=e,this.fieldCount=t,this.name="rowDescription",this.fields=new Array( -this.fieldCount)}};a(Hr,"RowDescriptionMessage");var Br=Hr;T.RowDescriptionMessage= -Br;var Gr=class Gr{constructor(e,t){this.length=e,this.parameterCount=t,this.name= +this.fieldCount)}};a(Hr,"RowDescriptionMessage");var Lr=Hr;T.RowDescriptionMessage= +Lr;var Gr=class Gr{constructor(e,t){this.length=e,this.parameterCount=t,this.name= "parameterDescription",this.dataTypeIDs=new Array(this.parameterCount)}};a(Gr,"P\ -arameterDescriptionMessage");var Lr=Gr;T.ParameterDescriptionMessage=Lr;var $r=class $r{constructor(e,t,n){ +arameterDescriptionMessage");var Br=Gr;T.ParameterDescriptionMessage=Br;var $r=class $r{constructor(e,t,n){ this.length=e,this.parameterName=t,this.parameterValue=n,this.name="parameterSta\ tus"}};a($r,"ParameterStatusMessage");var Rr=$r;T.ParameterStatusMessage=Rr;var Vr=class Vr{constructor(e,t){ this.length=e,this.salt=t,this.name="authenticationMD5Password"}};a(Vr,"Authenti\ @@ -1073,8 +1073,8 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(rn,"Wr\ -iter");var tn=rn;xt.Writer=tn});var xs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); -vt.serialize=void 0;var nn=bs(),M=new nn.Writer,ku=a(r=>{M.addInt16(3).addInt16( +iter");var tn=rn;xt.Writer=tn});var xs=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); +Et.serialize=void 0;var nn=bs(),M=new nn.Writer,ku=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new nn. Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); @@ -1103,12 +1103,12 @@ allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i "cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), zu=a(r=>r.name?sn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( r=>{let e=`${r.type}${r.name||""}`;return sn(67,e)},"close"),Zu=a(r=>M.add(r).flush( -100),"copyData"),Ju=a(r=>sn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),Xu=Et(72),ec=Et(83),tc=Et(88),rc=Et(99),nc={startup:ku,password:Uu, +100),"copyData"),Ju=a(r=>sn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),Xu=vt(72),ec=vt(83),tc=vt(88),rc=vt(99),nc={startup:ku,password:Uu, requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( ()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, -cancel:$u};vt.serialize=nc});var Es=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +cancel:$u};Et.serialize=nc});var vs=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); _t.BufferReader=void 0;var ic=y.allocUnsafe(0),an=class an{constructor(e=0){this. offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= @@ -1119,12 +1119,12 @@ let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buff toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(an,"BufferReader");var on=an;_t.BufferReader= on});var As=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var k=en(),sc=Es(),un=1,oc=4,vs=un+oc,_s=y.allocUnsafe(0),hn=class hn{constructor(e){ +At.Parser=void 0;var k=en(),sc=vs(),un=1,oc=4,Es=un+oc,_s=y.allocUnsafe(0),hn=class hn{constructor(e){ if(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, -i=this.bufferOffset;for(;i+vs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( -i+un),u=un+o;if(u+i<=n){let c=this.handlePacket(i+vs,s,o,this.buffer);t(c),i+=u}else +i=this.bufferOffset;for(;i+Es<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( +i+un),u=un+o;if(u+i<=n){let c=this.handlePacket(i+Es,s,o,this.buffer);t(c),i+=u}else break}i===n?(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. @@ -1189,7 +1189,7 @@ var uc=xs();Object.defineProperty(xe,"serialize",{enumerable:!0,get:a(function() return uc.serialize},"get")});var cc=As();function hc(r,e){let t=new cc.Parser;return r. on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");xe. parse=hc});var Cs={};re(Cs,{connect:()=>lc});function lc({socket:r,servername:e}){return r. -startTls(e),r}var Ts=te(()=>{"use strict";p();a(lc,"connect")});var dn=I((Yl,Bs)=>{"use strict";p();var Is=(St(),O(ws)),fc=we().EventEmitter,{parse:pc, +startTls(e),r}var Ts=te(()=>{"use strict";p();a(lc,"connect")});var dn=I((Yl,Ls)=>{"use strict";p();var Is=(St(),O(ws)),fc=we().EventEmitter,{parse:pc, serialize:q}=ln(),Ps=q.flush(),dc=q.sync(),yc=q.end(),pn=class pn extends fc{constructor(e){ super(),e=e||{},this.stream=e.stream||new Is.Socket,this._keepAlive=e.keepAlive, this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.lastBuffer= @@ -1221,8 +1221,8 @@ unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(pn,"Connection");var fn=pn;Bs.exports=fn});var Fs=I((ef,Rs)=>{"use strict";p();var mc=we().EventEmitter,Xl=(Ge(),O(He)),gc=tt(), -yn=Wi(),wc=Xi(),bc=wt(),Sc=bt(),Ls=ys(),xc=et(),Ec=dn(),mn=class mn extends mc{constructor(e){ +this._send(q.copyFail(e))}};a(pn,"Connection");var fn=pn;Ls.exports=fn});var Fs=I((ef,Rs)=>{"use strict";p();var mc=we().EventEmitter,Xl=(Ge(),O(He)),gc=tt(), +yn=Wi(),wc=Xi(),bc=wt(),Sc=bt(),Bs=ys(),xc=et(),vc=dn(),mn=class mn extends mc{constructor(e){ super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ @@ -1230,7 +1230,7 @@ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.p this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new Ec({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new vc({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. @@ -1320,7 +1320,7 @@ e&&m.nextTick(()=>{this.activeQuery.handleError(e,this.connection),this.readyFor emit("drain"))}query(e,t,n){var i,s,o,u,c;if(e==null)throw new TypeError("Client\ was passed a null or undefined query");return typeof e.submit=="function"?(o=e. query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& -(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Ls( +(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Bs( e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,b)=>d?l(d):h(b)}))), o&&(c=i.callback,u=setTimeout(()=>{var h=new Error("Query read timeout");m.nextTick( ()=>{i.handleError(h,this.connection)}),c(h),i.callback=()=>{};var l=this.queryQueue. @@ -1335,7 +1335,7 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(mn,"Client");var Ct=mn;Ct.Query= -Ls;Rs.exports=Ct});var Us=I((nf,Ds)=>{"use strict";p();var vc=we().EventEmitter,Ms=a(function(){},"\ +Bs;Rs.exports=Ct});var Us=I((nf,Ds)=>{"use strict";p();var Ec=we().EventEmitter,Ms=a(function(){},"\ NOOP"),ks=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),bn=class bn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(bn,"IdleItem");var gn=bn,Sn=class Sn{constructor(e){this.callback= @@ -1346,7 +1346,7 @@ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.capture o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Ac,"makeIdleListener");var xn=class xn extends vc{constructor(e,t){ +"idleListener")}a(Ac,"makeIdleListener");var xn=class xn extends Ec{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1425,8 +1425,8 @@ pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:" 4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ "pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ .md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ -7b9a5491a178655"}});var js=I((cf,Ws)=>{"use strict";p();var Qs=we().EventEmitter,Ic=(Ge(),O(He)),En=tt(), -Qe=Ws.exports=function(r,e,t){Qs.call(this),r=En.normalizeQueryConfig(r,e,t),this. +7b9a5491a178655"}});var js=I((cf,Ws)=>{"use strict";p();var Qs=we().EventEmitter,Ic=(Ge(),O(He)),vn=tt(), +Qe=Ws.exports=function(r,e,t){Qs.call(this),r=vn.normalizeQueryConfig(r,e,t),this. text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Ic.inherits( @@ -1448,18 +1448,18 @@ handleError(s);e._emitRowEvents&&(u.length>1?o.forEach((c,h)=>{c.forEach(l=>{e.e t)),this.name){this.name.length>63&&(console.error("Warning! Postgres only suppo\ rts 63 characters for query names."),console.error("You supplied %s (%s)",this.name, this.name.length),console.error("This can cause conflicts and silent errors exec\ -uting queries"));var n=(this.values||[]).map(En.prepareValue);if(r.namedQueries[this. +uting queries"));var n=(this.values||[]).map(vn.prepareValue);if(r.namedQueries[this. name]){if(this.text&&r.namedQueries[this.name]!==this.text){let s=new Error(`Pre\ pared statements must be unique - '${this.name}' was used for a different statem\ ent`);return t(s)}return r.native.execute(this.name,n,t)}return r.native.prepare( this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e. text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. -values.map(En.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Vs=I((pf,$s)=>{"use strict";p();var Bc=(Ns(),O(Os)),Lc=wt(),ff=qs(),Hs=we(). +values.map(vn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. +text,t)}});var Vs=I((pf,$s)=>{"use strict";p();var Lc=(Ns(),O(Os)),Bc=wt(),ff=qs(),Hs=we(). EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),Gs=js(),Z=$s.exports=function(r){Hs.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Lc(r.types),this.native= -new Bc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Bc(r.types),this.native= +new Lc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= !1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= @@ -1501,18 +1501,18 @@ _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== -1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. _types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var vn=I((mf,Ks)=>{"use strict";p();Ks.exports=Vs()});var It=I((wf,nt)=>{"use strict";p();var Mc=Fs(),kc=et(),Dc=dn(),Uc=Us(),{DatabaseError:Oc}=ln(), +_types.getTypeParser(r,e)}});var En=I((mf,Ks)=>{"use strict";p();Ks.exports=Vs()});var It=I((wf,nt)=>{"use strict";p();var Mc=Fs(),kc=et(),Dc=dn(),Uc=Us(),{DatabaseError:Oc}=ln(), Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ ool"),e},"poolFactory"),_n=a(function(r){this.defaults=kc,this.Client=r,this.Query= this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new _n(vn()):(nt.exports=new _n(Mc),Object.defineProperty(nt.exports,"na\ -tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new _n(vn())}catch(e){ +exports=new _n(En()):(nt.exports=new _n(Mc),Object.defineProperty(nt.exports,"na\ +tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new _n(En())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});var Gc={};re(Gc,{Client:()=>Bt,ClientBase:()=>oe.ClientBase,Connection:()=>oe.Connection, +native",{value:r}),r}}))});var Gc={};re(Gc,{Client:()=>Lt,ClientBase:()=>oe.ClientBase,Connection:()=>oe.Connection, DatabaseError:()=>oe.DatabaseError,NeonDbError:()=>he,Pool:()=>Cn,Query:()=>oe.Query, defaults:()=>oe.defaults,neon:()=>An,neonConfig:()=>Se,types:()=>oe.types});module. -exports=O(Gc);p();var Lt=Ie(It());St();p();St();gr();var Zs=Ie(tt()),Js=Ie(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ +exports=O(Gc);p();var Bt=Ie(It());St();p();St();gr();var Zs=Ie(tt()),Js=Ie(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", "NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); _(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ @@ -1528,7 +1528,7 @@ queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=mr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:b,hostname:C,port:B,pathname:Q}=l;if(d!=="postgres:"&&d!== +let{protocol:d,username:b,hostname:C,port:L,pathname:Q}=l;if(d!=="postgres:"&&d!== "postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;W{let Rt=g[ve]??{},eo=Rt.arrayMode??ae,to=Rt.fullResults??R;return Ys( -Ce,{arrayMode:eo,fullResults:to,parameterizedQuery:A[ve],resultCallback:c,types:Rt. -types})})}else{let H=g??{},Ce=H.arrayMode??ae,ve=H.fullResults??R;return Ys(j,{arrayMode:Ce, -fullResults:ve,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; -if(j===400){let H=await ee.json(),Ce=new he(H.message);for(let ve of Qc)Ce[ve]=H[ve]?? +map((Ce,Ee)=>{let Rt=g[Ee]??{},eo=Rt.arrayMode??ae,to=Rt.fullResults??R;return Ys( +Ce,{arrayMode:eo,fullResults:to,parameterizedQuery:A[Ee],resultCallback:c,types:Rt. +types})})}else{let H=g??{},Ce=H.arrayMode??ae,Ee=H.fullResults??R;return Ys(j,{arrayMode:Ce, +fullResults:Ee,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; +if(j===400){let H=await ee.json(),Ce=new he(H.message);for(let Ee of Qc)Ce[Ee]=H[Ee]?? void 0;throw Ce}else{let H=await ee.text();throw new he(`Server error (HTTP stat\ us ${j}): ${H}`)}}}return a(ye,"execute"),J}a(An,"neon");function Wc(r,e,t){return{ [Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a((n,i)=>r( @@ -1570,7 +1570,7 @@ t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ys," processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new he("Error ge\ tting auth token.");throw e instanceof Error&&(t=new he(`Error getting auth toke\ -n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Ie(bt()),oe=Ie(It());var Tn=class Tn extends Lt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ +n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Ie(bt()),oe=Ie(It());var Tn=class Tn extends Bt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& (this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ @@ -1602,25 +1602,25 @@ ESSAGE: missing/invalid iteration count");if(!u.startsWith(n.clientNonce))throw "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, -C=b.encode(i),B=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ -6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",B,y.concat([d,y.from( +C=b.encode(i),L=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ +6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",L,y.concat([d,y.from( [0,0,0,1])]))),J=Q;for(var ye=0;yeJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( +"HMAC",L,Q)),J=y.from(J.map((ee,j)=>J[j]^Q[j]));let A=J,g=await w.subtle.importKey( "raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,ae=D+","+W+ ","+X,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, ["sign"]);var $=new Uint8Array(await w.subtle.sign("HMAC",R,b.encode(ae))),le=y. -from(P.map((ee,j)=>P[j]^$[j])),me=le.toString("base64");let Ee=await w.subtle.importKey( +from(P.map((ee,j)=>P[j]^$[j])),me=le.toString("base64");let ve=await w.subtle.importKey( "raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),We=await w.subtle.sign( -"HMAC",Ee,b.encode("Server Key")),fe=await w.subtle.importKey("raw",We,{name:"HM\ +"HMAC",ve,b.encode("Server Key")),fe=await w.subtle.importKey("raw",We,{name:"HM\ AC",hash:{name:"SHA-256"}},!1,["sign"]);var it=y.from(await w.subtle.sign("HMAC", fe,b.encode(ae)));n.message="SASLResponse",n.serverSignature=it.toString("base64"), n.response=X+",p="+me,this.connection.sendSCRAMClientFinalMessage(this.saslSession. -response)}};a(Tn,"NeonClient");var Bt=Tn;function Hc(r,e){if(e)return{callback:e, +response)}};a(Tn,"NeonClient");var Lt=Tn;function Hc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var In=class In extends Lt.Pool{constructor(){ -super(...arguments);_(this,"Client",Bt);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ +n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var In=class In extends Bt.Pool{constructor(){ +super(...arguments);_(this,"Client",Lt);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ if(!Se.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Hc(this.Promise, diff --git a/dist/npm/index.mjs b/dist/npm/index.mjs index 62e24e8..d214ea2 100644 --- a/dist/npm/index.mjs +++ b/dist/npm/index.mjs @@ -3,10 +3,10 @@ r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0});var te=(r,e)=>()=>(r& Ce(r,t,{get:e[t],enumerable:!0})},Tn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== "function")for(let i of io(e))!oo.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= no(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?ro(so(r)):{},Tn(e||!r||!r.__esModule?Ce(t,"default",{ -value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= +value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Ln=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= yo;var ae=[],re=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ -PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ee=0,In=Rt.length;Ee0)throw new Error("Invalid string. Length must be a multip\ le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Pn, "getLens");function co(r){var e=Pn(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(co,"byte\ @@ -22,19 +22,19 @@ e&255),s}a(lo,"toByteArray");function fo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[ "")}a(po,"encodeChunk");function yo(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0, u=t-n;ou?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ ae[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ae[e>>10]+ae[e>>4&63]+ae[e<< -2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Ln=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> +2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Bn=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> 1,l=-7,d=t?i-1:0,b=t?-1:1,C=r[e+d];for(d+=b,s=C&(1<<-l)-1,C>>=-l,l+=u;l>0;s=s*256+ r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== 0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? -1:1)*o*Math.pow(2,s-n)};Ft.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,B=n?1:-1,Q=e<0|| +h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,L=n?1:-1,Q=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=b/c:e+= b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=B,u/=256, -i-=8);for(o=o<0;r[t+C]=o&255,C+=B,o/=256,h-=8);r[t+C-B]|=Q*128}});var Kn=I(Le=>{"use strict";p();var Mt=Bn(),Pe=Ln(),Rn=typeof Symbol=="function"&& -typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Le.Buffer= -f;Le.SlowBuffer=xo;Le.INSPECT_MAX_BYTES=50;var ot=2147483647;Le.kMaxLength=ot;f. +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=L,u/=256, +i-=8);for(o=o<0;r[t+C]=o&255,C+=L,o/=256,h-=8);r[t+C-L]|=Q*128}});var Kn=I(Be=>{"use strict";p();var Mt=Ln(),Pe=Bn(),Rn=typeof Symbol=="function"&& +typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Be.Buffer= +f;Be.SlowBuffer=xo;Be.INSPECT_MAX_BYTES=50;var ot=2147483647;Be.kMaxLength=ot;f. TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ @@ -106,27 +106,27 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ut(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return Vn(r).length;default:if(i)return n?-1:Ut(r).length;e=(""+e).toLowerCase(), -i=!0}}a(On,"byteLength");f.byteLength=On;function Eo(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(On,"byteLength");f.byteLength=On;function vo(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| (t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( -this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Bo(this, -e,t);case"latin1":case"binary":return Lo(this,e,t);case"base64":return Io(this,e, +this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Lo(this, +e,t);case"latin1":case"binary":return Bo(this,e,t);case"base64":return Io(this,e, t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -Eo,"slowToString");f.prototype._isBuffer=!0;function ve(r,e,t){let n=r[e];r[e]=r[t], -r[t]=n}a(ve,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) +vo,"slowToString");f.prototype._isBuffer=!0;function Ee(r,e,t){let n=r[e];r[e]=r[t], +r[t]=n}a(Ee,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< -e;t+=2)ve(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. +e;t+=2)Ee(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bit\ -s");for(let t=0;tt&&(e+=" ... "),""},"inspect");Rn&&(f.prototype[Rn]=f.prototype.inspect);f.prototype.compare= a(function(e,t,n,i,s){if(ue(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f. @@ -153,10 +153,10 @@ o;h++)if(c(r,h)===c(e,l===-1?0:h-l)){if(l===-1&&(l=h),h-l+1===u)return l*s}else if(c(r,h+d)!==c(e,d)){l=!1;break}if(l)return h}return-1}a(Fn,"arrayIndexOf");f.prototype. includes=a(function(e,t,n){return this.indexOf(e,t,n)!==-1},"includes");f.prototype. indexOf=a(function(e,t,n){return Nn(this,e,t,n,!0)},"indexOf");f.prototype.lastIndexOf= -a(function(e,t,n){return Nn(this,e,t,n,!1)},"lastIndexOf");function vo(r,e,t,n){ +a(function(e,t,n){return Nn(this,e,t,n,!1)},"lastIndexOf");function Eo(r,e,t,n){ t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n> s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n) te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return vo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ +hex":return Eo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ @@ -183,10 +183,10 @@ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)= o&1023),n.push(o),i+=u}return Po(n)}a(qn,"utf8Slice");var Mn=4096;function Po(r){ let e=r.length;if(e<=Mn)return String.fromCharCode.apply(String,r);let t="",n=0; for(;nn)&&(t=n);let i="";for(let s=e;s>>0,t||N(e,4,th length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE"); f.prototype.readUint32BE=f.prototype.readUInt32BE=a(function(e,t){return e=e>>>0, t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ -readUInt32BE");f.prototype.readBigUInt64LE=me(a(function(e){e=e>>>0,Be(e,"offset"); +readUInt32BE");f.prototype.readBigUInt64LE=me(a(function(e){e=e>>>0,Le(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Be(e,"offset");let t=this[e],n=this[e+7]; +readBigUInt64BE=me(a(function(e){e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7]; (t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ 1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=me(a(function(e){ -e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, +e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Be(e,"offset"); +igInt64LE"));f.prototype.readBigInt64BE=me(a(function(e){e=e>>>0,Le(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<2**32?i=kn(String(t)):typeof t=="bigint"&&(i=String(t) (t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=kn(i)),i+="n"),n+=` It\ must be ${e}. Received ${i}`,n},RangeError);function kn(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(kn,"addNumericalSeparator");function Mo(r,e,t){Be(e,"offset"),(r[e]=== +t)}${e}`}a(kn,"addNumericalSeparator");function Mo(r,e,t){Le(e,"offset"),(r[e]=== void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function $n(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Ie.ERR_OUT_OF_RANGE( -"value",u,r)}Mo(n,i,s)}a($n,"checkIntBI");function Be(r,e){if(typeof r!="number") -throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Be,"validateNumber");function je(r,e,t){ -throw Math.floor(r)!==r?(Be(r,t),new Ie.ERR_OUT_OF_RANGE(t||"offset","an integer", +"value",u,r)}Mo(n,i,s)}a($n,"checkIntBI");function Le(r,e){if(typeof r!="number") +throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Le,"validateNumber");function je(r,e,t){ +throw Math.floor(r)!==r?(Le(r,t),new Ie.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Ie.ERR_BUFFER_OUT_OF_BOUNDS:new Ie.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? 1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% @@ -362,8 +362,8 @@ a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var No=functi let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< 16;++i)e[n+i]=r[t]+r[i]}return e}();function me(r){return typeof BigInt>"u"?qo:r} a(me,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} -a(qo,"BufferBigIntNotDefined")});var S,x,v,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +a(qo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. Buffer.allocUnsafe=="function"?globalThis.Buffer:Kn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= @@ -374,22 +374,22 @@ Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& console.warn(r)}a(Qo,"ProcessEmitWarning");var Zn=Number.isNaN||a(function(e){return e!== -e},"NumberIsNaN");function L(){L.init.call(this)}a(L,"EventEmitter");Wt.exports= -L;Wt.exports.once=Go;L.EventEmitter=L;L.prototype._events=void 0;L.prototype._eventsCount= -0;L.prototype._maxListeners=void 0;var Yn=10;function ct(r){if(typeof r!="functi\ +e},"NumberIsNaN");function B(){B.init.call(this)}a(B,"EventEmitter");Wt.exports= +B;Wt.exports.once=Go;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= +0;B.prototype._maxListeners=void 0;var Yn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ -ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(L,"defaultMaxLi\ +ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(B,"defaultMaxLi\ steners",{enumerable:!0,get:a(function(){return Yn},"get"),set:a(function(r){if(typeof r!= "number"||r<0||Zn(r))throw new RangeError('The value of "defaultMaxListeners" is\ out of range. It must be a non-negative number. Received '+r+".");Yn=r},"set")}); -L.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). +B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). _events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners= -this._maxListeners||void 0};L.prototype.setMaxListeners=a(function(e){if(typeof e!= +this._maxListeners||void 0};B.prototype.setMaxListeners=a(function(e){if(typeof e!= "number"||e<0||Zn(e))throw new RangeError('The value of "n" is out of range. It \ must be a non-negative number. Received '+e+".");return this._maxListeners=e,this}, -"setMaxListeners");function Jn(r){return r._maxListeners===void 0?L.defaultMaxListeners: -r._maxListeners}a(Jn,"_getMaxListeners");L.prototype.getMaxListeners=a(function(){ -return Jn(this)},"getMaxListeners");L.prototype.emit=a(function(e){for(var t=[], +"setMaxListeners");function Jn(r){return r._maxListeners===void 0?B.defaultMaxListeners: +r._maxListeners}a(Jn,"_getMaxListeners");B.prototype.getMaxListeners=a(function(){ +return Jn(this)},"getMaxListeners");B.prototype.emit=a(function(e){for(var t=[], n=1;n 0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+ @@ -403,23 +403,23 @@ t):o.push(t),i=Jn(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(Xn,"_addList\ -ener");L.prototype.addListener=a(function(e,t){return Xn(this,e,t,!1)},"addListe\ -ner");L.prototype.on=L.prototype.addListener;L.prototype.prependListener=a(function(e,t){ +ener");B.prototype.addListener=a(function(e,t){return Xn(this,e,t,!1)},"addListe\ +ner");B.prototype.on=B.prototype.addListener;B.prototype.prependListener=a(function(e,t){ return Xn(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, "onceWrapper");function ei(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");L.prototype. -once=a(function(e,t){return ct(t),this.on(e,ei(this,e,t)),this},"once");L.prototype. +listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");B.prototype. +once=a(function(e,t){return ct(t),this.on(e,ei(this,e,t)),this},"once");B.prototype. prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ei(this, -e,t)),this},"prependOnceListener");L.prototype.removeListener=a(function(e,t){var n, +e,t)),this},"prependOnceListener");B.prototype.removeListener=a(function(e,t){var n, i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this; if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, -"removeListener");L.prototype.off=L.prototype.removeListener;L.prototype.removeAllListeners= +"removeListener");B.prototype.off=B.prototype.removeListener;B.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount= 0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]), @@ -429,13 +429,13 @@ o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners( n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length- 1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ti(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?Ho(i):ni(i,i.length)}a(ti,"_listeners");L.prototype. -listeners=a(function(e){return ti(this,e,!0)},"listeners");L.prototype.rawListeners= -a(function(e){return ti(this,e,!1)},"rawListeners");L.listenerCount=function(r,e){ -return typeof r.listenerCount=="function"?r.listenerCount(e):ri.call(r,e)};L.prototype. +"function"?t?[i.listener||i]:[i]:t?Ho(i):ni(i,i.length)}a(ti,"_listeners");B.prototype. +listeners=a(function(e){return ti(this,e,!0)},"listeners");B.prototype.rawListeners= +a(function(e){return ti(this,e,!1)},"rawListeners");B.listenerCount=function(r,e){ +return typeof r.listenerCount=="function"?r.listenerCount(e):ri.call(r,e)};B.prototype. listenerCount=ri;function ri(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== "function")return 1;if(t!==void 0)return t.length}return 0}a(ri,"listenerCount"); -L.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): +B.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): []},"eventNames");function ni(r,e){for(var t=new Array(e),n=0;nA>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),B=new Uint8Array( -64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=B[$]<<24|B[$+1]<<16|B[$+2]<<8|B[$+ +3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),L=new Uint8Array( +64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+ 3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,ce=b(C[R- 2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+ce|0}let A=e,g=t,P=n,K=i,D=s, W=o,X=u,oe=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),ce=D&W^~D&X,ye=oe+ $+ce+d[R]+C[R]|0,Se=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,he=Se+We|0;oe=X,X=W,W= D,D=K+ye|0,K=P,P=g,g=A,A=ye+he|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, u=u+X|0,c=c+oe|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). -encode(A));for(let g=0;g{if(B[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)B[l++]=0;Q()}for(;l<58;)B[l++]= -0;let A=h*8;B[l++]=A/1099511627776&255,B[l++]=A/4294967296&255,B[l++]=A>>>24,B[l++]= -A>>>16&255,B[l++]=A>>>8&255,B[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= +encode(A));for(let g=0;g{if(L[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)L[l++]=0;Q()}for(;l<58;)L[l++]= +0;let A=h*8;L[l++]=A/1099511627776&255,L[l++]=A/4294967296&255,L[l++]=A>>>24,L[l++]= +A>>>16&255,L[l++]=A>>>8&255,L[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, @@ -617,18 +617,18 @@ onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return par e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( r),t=e[8]==="-";return Object.keys(fi).reduce(function(n,i){var s=fi[i],o=e[s];return!o|| (o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(ba,"parse")});var mi=I((Eh,yi)=>{"use strict";p();yi.exports=a(function(e){if(/^\\x/.test(e))return new y( +o),n},{})}a(ba,"parse")});var mi=I((vh,yi)=>{"use strict";p();yi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=$t(),ze=Vt(),lt=ci(),wi=di(),bi=mi();function ft(r){ +"\\";n+=Math.floor(i/2)*2}return new y(t,"binary")},"parseBytea")});var Ei=I((Ah,vi)=>{p();var Ke=$t(),ze=Vt(),lt=ci(),wi=di(),bi=mi();function ft(r){ return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Si(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| r==="1"}a(Si,"parseBool");function Sa(r){return r?Ke.parse(r,Si):null}a(Sa,"pars\ eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Yt(r){ -return r?Ke.parse(r,ft(xa)):null}a(Yt,"parseIntegerArray");function Ea(r){return r? -Ke.parse(r,ft(function(e){return xi(e).trim()})):null}a(Ea,"parseBigIntegerArray"); -var va=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +return r?Ke.parse(r,ft(xa)):null}a(Yt,"parseIntegerArray");function va(r){return r? +Ke.parse(r,ft(function(e){return xi(e).trim()})):null}a(va,"parseBigIntegerArray"); +var Ea=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=er(t)),t});return e.parse()},"parsePointArray"),Zt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); return e.parse()},"parseFloatArray"),ne=a(function(r){if(!r)return null;var e=ze. @@ -646,28 +646,28 @@ if(n||(e+=r[i]),r[i]===")"){n=!0;continue}else if(!n)continue;r[i]!==","&&(t+=r[ var s=er(e);return s.radius=parseFloat(t),s},"parseCircle"),Ta=a(function(r){r(20, xi),r(21,Xt),r(23,Xt),r(26,Xt),r(700,parseFloat),r(701,parseFloat),r(16,Si),r(1082, lt),r(1114,lt),r(1184,lt),r(600,er),r(651,ne),r(718,Ca),r(1e3,Sa),r(1001,Aa),r(1005, -Yt),r(1007,Yt),r(1028,Yt),r(1016,Ea),r(1017,va),r(1021,Zt),r(1022,Zt),r(1231,Zt), +Yt),r(1007,Yt),r(1028,Yt),r(1016,va),r(1017,Ea),r(1021,Zt),r(1022,Zt),r(1231,Zt), r(1014,ne),r(1015,ne),r(1008,ne),r(1009,ne),r(1040,ne),r(1041,ne),r(1115,Jt),r(1182, Jt),r(1185,Jt),r(1186,wi),r(1187,_a),r(17,bi),r(114,JSON.parse.bind(JSON)),r(3802, JSON.parse.bind(JSON)),r(199,gi),r(3807,gi),r(3907,ne),r(2951,ne),r(791,ne),r(1183, -ne),r(1270,ne)},"init");Ei.exports={init:Ta}});var Ai=I((Ih,_i)=>{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( +ne),r(1270,ne)},"init");vi.exports={init:Ta}});var Ai=I((Ih,_i)=>{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,o,u, c,h,l;{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+ u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Pa=Ai(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,B,Q){ -return C*Math.pow(2,Q)+B};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, +e%Y,o=4294967296*s+t,u=""+o%Y,n+u+i}a(Ia,"readInt8");_i.exports=Ia});var Li=I((Bh,Pi)=>{p();var Pa=Ai(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,L,Q){ +return C*Math.pow(2,Q)+L};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& (h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Ii=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= 1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ba=a(function(r){return F(r,1)==1?-1* +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),La=a(function(r){return F(r,1)==1?-1* (F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ci=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),La=a(function(r){return Ii(r,23,8)},"pars\ +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Ba=a(function(r){return Ii(r,23,8)},"pars\ eFloat32"),Ra=a(function(r){return Ii(r,52,11)},"parseFloat64"),Fa=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o1){var C=h.shift();for(b=0;b0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,Ba),r(23,Ci),r(26, -Ci),r(1700,Fa),r(700,La),r(701,Ra),r(16,ka),r(1114,Ti.bind(null,!1)),r(1184,Ti.bind( +null?null:F(r,8)>0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,La),r(23,Ci),r(26, +Ci),r(1700,Fa),r(700,Ba),r(701,Ra),r(16,ka),r(1114,Ti.bind(null,!1)),r(1184,Ti.bind( null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); -Pi.exports={init:Da}});var Ri=I((Mh,Li)=>{p();Li.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +Pi.exports={init:Da}});var Ri=I((Mh,Bi)=>{p();Bi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -694,7 +694,7 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=vi(),Oa=Bi(),Na=Vt(),qa=Ri();Je.getTypeParser=Qa;Je.setTypeParser= +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=Ei(),Oa=Li(),Na=Vt(),qa=Ri();Je.getTypeParser=Qa;Je.setTypeParser= Wa;Je.arrayParser=Na;Je.builtins=qa;var Ze={text:{},binary:{}};function Fi(r){return String( r)}a(Fi,"noParse");function Qa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Fi}a(Qa, "getTypeParser");function Wa(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= @@ -747,8 +747,8 @@ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, i,n.iteration),o=ke(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ ",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=ke(u,d),C=Oi( -o,b),B=C.toString("base64"),Q=ke(s,"Server Key"),J=ke(Q,d);r.message="SASLRespon\ -se",r.serverSignature=J.toString("base64"),r.response=l+",p="+B}a(eu,"continueSe\ +o,b),L=C.toString("base64"),Q=ke(s,"Server Key"),J=ke(Q,d);r.message="SASLRespon\ +se",r.serverSignature=J.toString("base64"),r.response=l+",p="+L}a(eu,"continueSe\ ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( @@ -803,8 +803,8 @@ let n=new hu(t);return n[we]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.ma t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Gi.exports=du});var zi=I((nl,fe)=>{"use strict";p();var Vi=(sr(),O(ir)),yu=(cr(),O(ur)).Stream,mu=$i(), Ki=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, -xu=32768;function Eu(r){return(r&Su)==xu}a(Eu,"isRegFile");var De=["host","port", -"database","user","password"],fr=De.length,vu=De[fr-1];function pr(){var r=rt instanceof +xu=32768;function vu(r){return(r&Su)==xu}a(vu,"isRegFile");var De=["host","port", +"database","user","password"],fr=De.length,Eu=De[fr-1];function pr(){var r=rt instanceof yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` `);rt.write(Ki.format.apply(Ki,e))}}a(pr,"warn");Object.defineProperty(fe.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});fe. @@ -812,12 +812,12 @@ exports.warnTo=function(r){var e=rt;return rt=r,e};fe.exports.getFileName=functi var e=r||m.env,t=e.PGPASSFILE||(yt?Vi.join(e.APPDATA||"./","postgresql","pgpass.\ conf"):Vi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",Eu(r.mode)?r.mode&(wu|bu)?(pr('WARNING: password file "%s" has group or \ +",vu(r.mode)?r.mode&(wu|bu)?(pr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(pr('WARNING:\ password file "%s" is not a plain file',e),!1))};var _u=fe.exports.match=function(r,e){ return De.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};fe.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[vu],i.end())} +var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[Eu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), pr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. on("data",s).on("end",o).on("error",u)};var Au=fe.exports.parseLine=function(r){ @@ -841,9 +841,9 @@ this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| "text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};Ji.exports=gt});var Xi={};se(Xi,{default:()=>Iu});var Iu,es=te(()=>{"use strict";p();Iu={}});var ts={};se(ts,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let C=i+":"+s,B=e?Object.fromEntries(d.entries()):l;return{ +i),h=decodeURIComponent(h);let C=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:B,hash:b}}var mr=te(()=>{"use strict";p();a(yr,"parse")});var ns=I((yl,rs)=>{"use strict";p();var Pu=(mr(),O(ts)),gr=(ar(),O(or));function wr(r){ +search:l,query:L,hash:b}}var mr=te(()=>{"use strict";p();a(yr,"parse")});var ns=I((yl,rs)=>{"use strict";p();var Pu=(mr(),O(ts)),gr=(ar(),O(or));function wr(r){ if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- @@ -858,9 +858,9 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=gr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(wr,"parse");rs.exports=wr;wr.parse=wr});var bt=I((wl,os)=>{"use strict";p();var Bu=(es(),O(Xi)),ss=et(),is=ns().parse,V=a( +return t}a(wr,"parse");rs.exports=wr;wr.parse=wr});var bt=I((wl,os)=>{"use strict";p();var Lu=(es(),O(Xi)),ss=et(),is=ns().parse,V=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||ss[r]},"val"),Lu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||ss[r]},"val"),Bu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": return{rejectUnauthorized:!1}}return ss.ssl},"readSSLConfigFromEnvironment"),Ue=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ @@ -870,7 +870,7 @@ d"),Sr=class Sr{constructor(e){e=typeof e=="string"?is(e):e||{},e.connectionStri V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Lu():e.ssl,typeof this.ssl=="st\ +options=V("options",e),this.ssl=typeof e.ssl>"u"?Bu():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. @@ -890,10 +890,10 @@ ssl}:{};if(ie(t,n,"sslmode"),ie(t,n,"sslca"),ie(t,n,"sslkey"),ie(t,n,"sslcert"), ie(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ue(this.database)),this.replication&& t.push("replication="+Ue(this.replication)),this.host&&t.push("host="+Ue(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Ue(this.client_encoding)),Bu.lookup(this.host,function(i,s){return i? +ent_encoding="+Ue(this.client_encoding)),Lu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Ue(s)),e(null,t.join(" ")))})}};a(Sr,"ConnectionPa\ rameters");var br=Sr;os.exports=br});var cs=I((xl,us)=>{"use strict";p();var Ru=Xe(),as=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, -Er=class Er{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, +vr=class vr{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ var t;e.text?t=as.exec(e.text):t=as.exec(e.command),t&&(this.command=t[1],t[3]?(this. @@ -904,8 +904,8 @@ n=0,i=e.length;n{"use strict";p();var{EventEmitter:Fu}=ge(),hs=cs(),ls=tt(),_r=class _r extends Fu{constructor(e,t,n){ +ext"):this._parsers[t]=Ru.getTypeParser(n.dataTypeID,n.format||"text")}}};a(vr,"\ +Result");var xr=vr;us.exports=xr});var ps=I((_l,fs)=>{"use strict";p();var{EventEmitter:Fu}=ge(),hs=cs(),ls=tt(),_r=class _r extends Fu{constructor(e,t,n){ super(),e=ls.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& @@ -938,44 +938,44 @@ try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:thi binary,valueMapper:ls.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(_r,"Query"); -var vr=_r;fs.exports=vr});var ms={};se(ms,{Socket:()=>_e,isIP:()=>Mu});function Mu(r){return 0}var ys,ds,E, -_e,St=te(()=>{"use strict";p();ys=Te(ge(),1);a(Mu,"isIP");ds=/^[^.]+\./,E=class E extends ys.EventEmitter{constructor(){ +var Er=_r;fs.exports=Er});var ms={};se(ms,{Socket:()=>_e,isIP:()=>Mu});function Mu(r){return 0}var ys,ds,v, +_e,St=te(()=>{"use strict";p();ys=Te(ge(),1);a(Mu,"isIP");ds=/^[^.]+\./,v=class v extends ys.EventEmitter{constructor(){ super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); _(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? -E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ -E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? +v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ +v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ -E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? -E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. -wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. -opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? -E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? -E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? -E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ -E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ -return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. -rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ +v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? +v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. +wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. +opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? +v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? +v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? +v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ +v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ +return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. +rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -1014,12 +1014,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +!0,this.end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( (t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});_e=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(v,"opts",{});_e=v});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1041,9 +1041,9 @@ this.length=e,this.fieldCount=t,this.name="rowDescription",this.fields=new Array this.fieldCount)}};a(jr,"RowDescriptionMessage");var Pr=jr;T.RowDescriptionMessage= Pr;var Hr=class Hr{constructor(e,t){this.length=e,this.parameterCount=t,this.name= "parameterDescription",this.dataTypeIDs=new Array(this.parameterCount)}};a(Hr,"P\ -arameterDescriptionMessage");var Br=Hr;T.ParameterDescriptionMessage=Br;var Gr=class Gr{constructor(e,t,n){ +arameterDescriptionMessage");var Lr=Hr;T.ParameterDescriptionMessage=Lr;var Gr=class Gr{constructor(e,t,n){ this.length=e,this.parameterName=t,this.parameterValue=n,this.name="parameterSta\ -tus"}};a(Gr,"ParameterStatusMessage");var Lr=Gr;T.ParameterStatusMessage=Lr;var $r=class $r{constructor(e,t){ +tus"}};a(Gr,"ParameterStatusMessage");var Br=Gr;T.ParameterStatusMessage=Br;var $r=class $r{constructor(e,t){ this.length=e,this.salt=t,this.name="authenticationMD5Password"}};a($r,"Authenti\ cationMD5Password");var Rr=$r;T.AuthenticationMD5Password=Rr;var Vr=class Vr{constructor(e,t,n){ this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Vr, @@ -1073,8 +1073,8 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(tn,"Wr\ -iter");var en=tn;xt.Writer=en});var bs=I(vt=>{"use strict";p();Object.defineProperty(vt,"__esModule",{value:!0}); -vt.serialize=void 0;var rn=gs(),M=new rn.Writer,ku=a(r=>{M.addInt16(3).addInt16( +iter");var en=tn;xt.Writer=en});var bs=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); +Et.serialize=void 0;var rn=gs(),M=new rn.Writer,ku=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new rn. Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); @@ -1103,12 +1103,12 @@ allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i "cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), zu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),Zu=a(r=>M.add(r).flush( -100),"copyData"),Ju=a(r=>nn(102,r),"copyFail"),Et=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),Xu=Et(72),ec=Et(83),tc=Et(88),rc=Et(99),nc={startup:ku,password:Uu, +100),"copyData"),Ju=a(r=>nn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),Xu=vt(72),ec=vt(83),tc=vt(88),rc=vt(99),nc={startup:ku,password:Uu, requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( ()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, -cancel:$u};vt.serialize=nc});var Ss=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +cancel:$u};Et.serialize=nc});var Ss=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); _t.BufferReader=void 0;var ic=y.allocUnsafe(0),on=class on{constructor(e=0){this. offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= @@ -1118,14 +1118,14 @@ toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstrin let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(on,"BufferReader");var sn=on;_t.BufferReader= -sn});var vs=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var k=Xr(),sc=Ss(),an=1,oc=4,xs=an+oc,Es=y.allocUnsafe(0),cn=class cn{constructor(e){ -if(this.buffer=Es,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, +sn});var Es=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); +At.Parser=void 0;var k=Xr(),sc=Ss(),an=1,oc=4,xs=an+oc,vs=y.allocUnsafe(0),cn=class cn{constructor(e){ +if(this.buffer=vs,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, i=this.bufferOffset;for(;i+xs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+xs,s,o,this.buffer);t(c),i+=u}else -break}i===n?(this.buffer=Es,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= +break}i===n?(this.buffer=vs,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer. @@ -1186,7 +1186,7 @@ line=s.L,c.routine=s.R,c}};a(cn,"Parser");var un=cn;At.Parser=un});var hn=I(be=> be.DatabaseError=be.serialize=be.parse=void 0;var ac=Xr();Object.defineProperty( be,"DatabaseError",{enumerable:!0,get:a(function(){return ac.DatabaseError},"get")}); var uc=bs();Object.defineProperty(be,"serialize",{enumerable:!0,get:a(function(){ -return uc.serialize},"get")});var cc=vs();function hc(r,e){let t=new cc.Parser;return r. +return uc.serialize},"get")});var cc=Es();function hc(r,e){let t=new cc.Parser;return r. on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");be. parse=hc});var _s={};se(_s,{connect:()=>lc});function lc({socket:r,servername:e}){return r. startTls(e),r}var As=te(()=>{"use strict";p();a(lc,"connect")});var pn=I((zl,Is)=>{"use strict";p();var Cs=(St(),O(ms)),fc=ge().EventEmitter,{parse:pc, @@ -1221,8 +1221,8 @@ unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Is.exports=ln});var Ls=I((Xl,Bs)=>{"use strict";p();var mc=ge().EventEmitter,Jl=(Ge(),O(He)),gc=tt(), -dn=qi(),wc=Zi(),bc=wt(),Sc=bt(),Ps=ps(),xc=et(),Ec=pn(),yn=class yn extends mc{constructor(e){ +this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Is.exports=ln});var Bs=I((Xl,Ls)=>{"use strict";p();var mc=ge().EventEmitter,Jl=(Ge(),O(He)),gc=tt(), +dn=qi(),wc=Zi(),bc=wt(),Sc=bt(),Ps=ps(),xc=et(),vc=pn(),yn=class yn extends mc{constructor(e){ super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ @@ -1230,7 +1230,7 @@ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.p this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new Ec({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new vc({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. @@ -1335,7 +1335,7 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(yn,"Client");var Ct=yn;Ct.Query= -Ps;Bs.exports=Ct});var ks=I((rf,Ms)=>{"use strict";p();var vc=ge().EventEmitter,Rs=a(function(){},"\ +Ps;Ls.exports=Ct});var ks=I((rf,Ms)=>{"use strict";p();var Ec=ge().EventEmitter,Rs=a(function(){},"\ NOOP"),Fs=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),wn=class wn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(wn,"IdleItem");var mn=wn,bn=class bn{constructor(e){this.callback= @@ -1346,7 +1346,7 @@ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.capture o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Ac,"makeIdleListener");var Sn=class Sn extends vc{constructor(e,t){ +"idleListener")}a(Ac,"makeIdleListener");var Sn=class Sn extends Ec{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1456,10 +1456,10 @@ this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. values.map(xn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Gs=I((ff,Hs)=>{"use strict";p();var Bc=(Us(),O(Ds)),Lc=wt(),lf=Os(),Ws=ge(). +text,t)}});var Gs=I((ff,Hs)=>{"use strict";p();var Lc=(Us(),O(Ds)),Bc=wt(),lf=Os(),Ws=ge(). EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),js=Qs(),Z=Hs.exports=function(r){Ws.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Lc(r.types),this.native= -new Bc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Bc(r.types),this.native= +new Lc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= !1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= @@ -1501,15 +1501,15 @@ _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== -1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. _types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var En=I((yf,$s)=>{"use strict";p();$s.exports=Gs()});var It=I((gf,nt)=>{"use strict";p();var Mc=Ls(),kc=et(),Dc=pn(),Uc=ks(),{DatabaseError:Oc}=hn(), +_types.getTypeParser(r,e)}});var vn=I((yf,$s)=>{"use strict";p();$s.exports=Gs()});var It=I((gf,nt)=>{"use strict";p();var Mc=Bs(),kc=et(),Dc=pn(),Uc=ks(),{DatabaseError:Oc}=hn(), Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ -ool"),e},"poolFactory"),vn=a(function(r){this.defaults=kc,this.Client=r,this.Query= +ool"),e},"poolFactory"),En=a(function(r){this.defaults=kc,this.Client=r,this.Query= this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new vn(En()):(nt.exports=new vn(Mc),Object.defineProperty(nt.exports,"na\ -tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new vn(En())}catch(e){ +exports=new En(vn()):(nt.exports=new En(Mc),Object.defineProperty(nt.exports,"na\ +tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new En(vn())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});p();var Bt=Te(It());St();p();St();mr();var zs=Te(tt()),Ys=Te(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ +native",{value:r}),r}}))});p();var Lt=Te(It());St();p();St();mr();var zs=Te(tt()),Ys=Te(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", "NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); _(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ @@ -1525,7 +1525,7 @@ queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=yr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:b,hostname:C,port:B,pathname:Q}=l;if(d!=="postgres:"&&d!== +let{protocol:d,username:b,hostname:C,port:L,pathname:Q}=l;if(d!=="postgres:"&&d!== "postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;W{let Lt=g[xe]??{},eo=Lt.arrayMode??oe,to=Lt.fullResults??R;return Ks( -Ae,{arrayMode:eo,fullResults:to,parameterizedQuery:A[xe],resultCallback:c,types:Lt. +map((Ae,xe)=>{let Bt=g[xe]??{},eo=Bt.arrayMode??oe,to=Bt.fullResults??R;return Ks( +Ae,{arrayMode:eo,fullResults:to,parameterizedQuery:A[xe],resultCallback:c,types:Bt. types})})}else{let H=g??{},Ae=H.arrayMode??oe,xe=H.fullResults??R;return Ks(j,{arrayMode:Ae, fullResults:xe,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; if(j===400){let H=await ee.json(),Ae=new pe(H.message);for(let xe of Qc)Ae[xe]=H[xe]?? @@ -1567,7 +1567,7 @@ t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ks," processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new pe("Error ge\ tting auth token.");throw e instanceof Error&&(t=new pe(`Error getting auth toke\ -n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Te(bt()),Qe=Te(It());var An=class An extends Bt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ +n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Te(bt()),Qe=Te(It());var An=class An extends Lt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& (this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ @@ -1599,10 +1599,10 @@ ESSAGE: missing/invalid iteration count");if(!u.startsWith(n.clientNonce))throw "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, -C=b.encode(i),B=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ -6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",B,y.concat([d,y.from( +C=b.encode(i),L=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ +6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",L,y.concat([d,y.from( [0,0,0,1])]))),J=Q;for(var de=0;deJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( +"HMAC",L,Q)),J=y.from(J.map((ee,j)=>J[j]^Q[j]));let A=J,g=await w.subtle.importKey( "raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,oe=D+","+W+ @@ -1616,7 +1616,7 @@ he,b.encode(oe)));n.message="SASLResponse",n.serverSignature=it.toString("base64 n.response=X+",p="+ye,this.connection.sendSCRAMClientFinalMessage(this.saslSession. response)}};a(An,"NeonClient");var _n=An;function Hc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var Cn=class Cn extends Bt.Pool{constructor(){ +n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var Cn=class Cn extends Lt.Pool{constructor(){ super(...arguments);_(this,"Client",_n);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ if(!_e.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") diff --git a/shims/net/index.ts b/shims/net/index.ts index a5b41fe..c1cc7a2 100644 --- a/shims/net/index.ts +++ b/shims/net/index.ts @@ -11,14 +11,24 @@ import type * as subtls from 'subtls'; declare global { const debug: boolean; // e.g. --define:debug=false in esbuild command - interface WebSocket { - binaryType: 'arraybuffer' | 'blob'; // oddly not included in Cloudflare types - accept?: () => void; // available in Cloudflare - } - interface Response { - webSocket: WebSocket; - } - class __unstable_WebSocket extends WebSocket {} +} + +interface WebSocketLike { + // we define our own WebSocket type because different implementations have + // different signatures and we want to be compatible with any of them + readonly readyState: number; + binaryType: string; + close(code?: number, reason?: string): void; + send(data: any): void; + addEventListener( + type: 'open' | 'message' | 'close' | 'error', + listener: (this: WebSocketLike, ev: any) => any, + options?: any, + ): void; +} + +interface WebSocketConstructor { + new (...args: any[]): WebSocketLike; } enum TlsState { @@ -73,7 +83,7 @@ export interface SocketDefaults { fetchConnectionCache: boolean; fetchFunction: any; // these options relate to the WebSocket transport - webSocketConstructor: typeof WebSocket | undefined; + webSocketConstructor: WebSocketConstructor | undefined; wsProxy: string | ((host: string, port: number | string) => string); useSecureWebSocket: boolean; forceDisablePgSSL: boolean; @@ -316,7 +326,7 @@ export class Socket extends EventEmitter { authorized = false; destroyed = false; - private ws: WebSocket | null = null; + private ws: WebSocketLike | null = null; private writeBuffer: Uint8Array | undefined; // used only if coalesceWrites === true private tlsState = TlsState.None; private tlsRead: undefined | (() => Promise); @@ -351,7 +361,7 @@ export class Socket extends EventEmitter { this.emit('ready'); }; - const configureWebSocket = (ws: WebSocket, immediateOpen = false) => { + const configureWebSocket = (ws: WebSocketLike, immediateOpen = false) => { ws.binaryType = 'arraybuffer'; ws.addEventListener('error', (err) => { @@ -402,11 +412,12 @@ export class Socket extends EventEmitter { } else { try { // second, try a common-or-garden WebSocket, e.g. in a web browser - this.ws = new WebSocket(wsAddrFull); - configureWebSocket(this.ws); + this.ws = new WebSocket(wsAddrFull) as any; + configureWebSocket(this.ws!); } catch (err) { debug && log('new WebSocket() failed'); + // @ts-expect-error -- unknown Vercel-specific object this.ws = new __unstable_WebSocket(wsAddrFull); configureWebSocket(this.ws!); } @@ -420,10 +431,11 @@ export class Socket extends EventEmitter { fetch(fetchAddrFull, { headers: { Upgrade: 'websocket' } }) .then((resp) => { - // @ts-ignore webSocket is defined in the Cloudflare types, but there are conflicts + // @ts-ignore unknown Cloudflare-specific property this.ws = resp.webSocket; if (this.ws == null) throw err; // deliberate loose equality + // @ts-expect-error node types don't include this method on Cloudflare this.ws.accept!(); // if we're here, then there's an accept method configureWebSocket(this.ws, true); debug && log('Cloudflare WebSocket opened'); @@ -451,7 +463,7 @@ export class Socket extends EventEmitter { this.tlsState = TlsState.Handshake; const rootCerts = this.subtls.TrustedCert.databaseFromPEM(this.rootCerts); - const readQueue = new this.subtls.WebSocketReadQueue(this.ws!); + const readQueue = new this.subtls.WebSocketReadQueue(this.ws! as any); const networkRead = readQueue.read.bind(readQueue); const networkWrite = this.rawWrite.bind(this); diff --git a/tests/README.md b/tests/README.md index 78d1249..66e9e8d 100644 --- a/tests/README.md +++ b/tests/README.md @@ -17,3 +17,7 @@ AWS Lambda Chrome Safari? Firefox? + +Prisma +Drizzle +... diff --git a/tests/ws.test.ts b/tests/ws.test.ts index b08932a..5b9a0fd 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -1,13 +1,13 @@ -import { expect, test } from 'vitest'; +import { expect, test, beforeAll } from 'vitest'; import { Pool as PgPool } from 'pg'; import * as subtls from 'subtls'; +import { sampleQueries } from './sampleQueries'; import { neon, neonConfig, Pool as WsPool, Client as WsClient, } from '../dist/npm'; -import { sampleQueries } from './sampleQueries'; const DB_URL = process.env.VITE_NEON_DB_URL!; @@ -33,6 +33,13 @@ function functionsToPlaceholders(x: any) { ); } +beforeAll(async () => { + if (typeof WebSocket !== 'function') { + const { WebSocket } = await import('ws'); + neonConfig.webSocketConstructor = WebSocket; + } +}); + test( 'WebSockets query results match pg/TCP query results, using pool.connect()', { timeout: 30000 }, From bcf0060ea2e748ca5f11199e481787eb367c8d10 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 17:21:12 +0000 Subject: [PATCH 28/40] Added WebSocket shim for http tests --- tests/http.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/http.test.ts b/tests/http.test.ts index 4c07971..a79e87a 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -1,4 +1,4 @@ -import { expect, test, vi } from 'vitest'; +import { expect, test, vi, beforeAll } from 'vitest'; import { neon, neonConfig, Pool } from '../dist/npm'; import { sampleQueries } from './sampleQueries'; @@ -7,6 +7,13 @@ const sql = neon(DB_URL); const sqlFull = neon(DB_URL, { fullResults: true }); const pool = new Pool({ connectionString: DB_URL }); +beforeAll(async () => { + if (typeof WebSocket !== 'function') { + const { WebSocket } = await import('ws'); + neonConfig.webSocketConstructor = WebSocket; + } +}); + test( 'http query results match WebSocket query results', { timeout: 30000 }, From 6af67df4574f6d654e3f69fb7dd58369d19a7417 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 17:28:26 +0000 Subject: [PATCH 29/40] Refactired out WebSocket shimming --- tests/http.test.ts | 8 ++------ tests/ws.test.ts | 8 ++------ tests/ws.ts | 11 +++++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 tests/ws.ts diff --git a/tests/http.test.ts b/tests/http.test.ts index a79e87a..88a4b86 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -1,18 +1,14 @@ import { expect, test, vi, beforeAll } from 'vitest'; import { neon, neonConfig, Pool } from '../dist/npm'; import { sampleQueries } from './sampleQueries'; +import { shimWebSocket } from './ws'; const DB_URL = process.env.VITE_NEON_DB_URL!; const sql = neon(DB_URL); const sqlFull = neon(DB_URL, { fullResults: true }); const pool = new Pool({ connectionString: DB_URL }); -beforeAll(async () => { - if (typeof WebSocket !== 'function') { - const { WebSocket } = await import('ws'); - neonConfig.webSocketConstructor = WebSocket; - } -}); +beforeAll(shimWebSocket); test( 'http query results match WebSocket query results', diff --git a/tests/ws.test.ts b/tests/ws.test.ts index 5b9a0fd..cf2092f 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -2,6 +2,7 @@ import { expect, test, beforeAll } from 'vitest'; import { Pool as PgPool } from 'pg'; import * as subtls from 'subtls'; import { sampleQueries } from './sampleQueries'; +import { shimWebSocket } from './ws'; import { neon, neonConfig, @@ -33,12 +34,7 @@ function functionsToPlaceholders(x: any) { ); } -beforeAll(async () => { - if (typeof WebSocket !== 'function') { - const { WebSocket } = await import('ws'); - neonConfig.webSocketConstructor = WebSocket; - } -}); +beforeAll(shimWebSocket); test( 'WebSockets query results match pg/TCP query results, using pool.connect()', diff --git a/tests/ws.ts b/tests/ws.ts new file mode 100644 index 0000000..99c2159 --- /dev/null +++ b/tests/ws.ts @@ -0,0 +1,11 @@ +import { neonConfig } from '../dist/npm'; + +export async function shimWebSocket() { + if (typeof WebSocket !== 'function') { + console.info('Native WebSocket not found: importing ws for neonConfig.webSocketConstructor'); + const { WebSocket } = await import('ws'); + neonConfig.webSocketConstructor = WebSocket; + } else { + console.info('Using native WebSocket'); + } +} From f8ba0b0126bebfaeafdf55fdde79b269622b5c92 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 18:00:43 +0000 Subject: [PATCH 30/40] Run CI tests in node (incl edge-runtime), not bun --- .github/workflows/test.yml | 37 ++++++++++++++++++++++++++++++++----- package-lock.json | 22 ++++++++++++++++++++++ package.json | 4 +++- 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3b5d7af..c9cf21f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,19 +6,46 @@ on: - main jobs: - test: + test-node-20: runs-on: ubuntu-latest steps: # setup - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 + - uses: actions/setup-node@v4 + with: + node-version: 20 - name: Install package dependencies - run: bun install + run: npm install # goal - - name: Run tests + - name: Run tests in Node 20 (no native WebSocket), node environment env: VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }} VITE_WSPROXY: ${{ vars.VITE_WSPROXY }} - run: bun run test + run: npm run testNode + + test-node-lts: + runs-on: ubuntu-latest + steps: + # setup + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts + + - name: Install package dependencies + run: npm install + + # goal + - name: Run tests in Node LTS, node environment + env: + VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }} + VITE_WSPROXY: ${{ vars.VITE_WSPROXY }} + run: npm run testNode + + - name: Run tests in Node LTS, edge-runtime environment + env: + VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }} + VITE_WSPROXY: ${{ vars.VITE_WSPROXY }} + run: npm run testEdge diff --git a/package-lock.json b/package-lock.json index fce7fd5..f51d819 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "ws": "^8.12.1" }, "devDependencies": { + "@edge-runtime/vm": "^5.0.0", "@microsoft/api-extractor": "^7.48.1", "@types/events": "^3.0.0", "@types/pg": "^8.6.5", @@ -169,6 +170,27 @@ "node": ">=12" } }, + "node_modules/@edge-runtime/primitives": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@edge-runtime/primitives/-/primitives-6.0.0.tgz", + "integrity": "sha512-FqoxaBT+prPBHBwE1WXS1ocnu/VLTQyZ6NMUBAdbP7N2hsFTTxMC/jMu2D/8GAlMQfxeuppcPuCUk/HO3fpIvA==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@edge-runtime/vm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@edge-runtime/vm/-/vm-5.0.0.tgz", + "integrity": "sha512-NKBGBSIKUG584qrS1tyxVpX/AKJKQw5HgjYEnPLC0QsTw79JrGn+qUr8CXFb955Iy7GUdiiUv1rJ6JBGvaKb6w==", + "dev": true, + "dependencies": { + "@edge-runtime/primitives": "6.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild-plugins/node-globals-polyfill": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz", diff --git a/package.json b/package.json index 3c039d4..11b1100 100644 --- a/package.json +++ b/package.json @@ -46,9 +46,11 @@ "cfDeploy": "npm run build && wrangler deploy", "format": "prettier -c .", "format:fix": "prettier -w .", - "test": "./export.sh && vitest run --no-file-parallelism" + "testNode": "./export.sh && vitest run --environment=node --no-file-parallelism", + "testEdge": "./export.sh && vitest run --environment=edge-runtime --no-file-parallelism" }, "devDependencies": { + "@edge-runtime/vm": "^5.0.0", "@microsoft/api-extractor": "^7.48.1", "@types/events": "^3.0.0", "@types/pg": "^8.6.5", From 357ade9317e0d9c243035e31dd34b19e8cc6158c Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 18:03:29 +0000 Subject: [PATCH 31/40] Fixed Node LTS version specification in test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c9cf21f..7a86369 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: lts + node-version: lts/* - name: Install package dependencies run: npm install From 85f390baf90a320ee54a3cbb820da53f9f87f483 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 18:34:37 +0000 Subject: [PATCH 32/40] format:fix --- tests/ws.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/ws.ts b/tests/ws.ts index 99c2159..aa9fabb 100644 --- a/tests/ws.ts +++ b/tests/ws.ts @@ -2,7 +2,9 @@ import { neonConfig } from '../dist/npm'; export async function shimWebSocket() { if (typeof WebSocket !== 'function') { - console.info('Native WebSocket not found: importing ws for neonConfig.webSocketConstructor'); + console.info( + 'Native WebSocket not found: importing ws for neonConfig.webSocketConstructor', + ); const { WebSocket } = await import('ws'); neonConfig.webSocketConstructor = WebSocket; } else { From eb9ad9f27d1e068b727293c59c387838c80face4 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Wed, 18 Dec 2024 18:48:55 +0000 Subject: [PATCH 33/40] fixing check script --- package.json | 2 +- shims/net/index.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 11b1100..4f7bb78 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "pg-connection-string": "2.5.0" }, "scripts": { - "check": "tsc --noEmit export/index.ts", + "check": "tsc --noEmit", "build": "./build.sh", "buildDebug": "./build.sh debug", "watch": "./build.sh watch", diff --git a/shims/net/index.ts b/shims/net/index.ts index c1cc7a2..f8055f8 100644 --- a/shims/net/index.ts +++ b/shims/net/index.ts @@ -417,7 +417,7 @@ export class Socket extends EventEmitter { } catch (err) { debug && log('new WebSocket() failed'); - // @ts-expect-error -- unknown Vercel-specific object + // @ts-ignore -- unknown Vercel-specific object this.ws = new __unstable_WebSocket(wsAddrFull); configureWebSocket(this.ws!); } @@ -431,12 +431,12 @@ export class Socket extends EventEmitter { fetch(fetchAddrFull, { headers: { Upgrade: 'websocket' } }) .then((resp) => { - // @ts-ignore unknown Cloudflare-specific property + // @ts-ignore -- unknown Cloudflare-specific property this.ws = resp.webSocket; if (this.ws == null) throw err; // deliberate loose equality - // @ts-expect-error node types don't include this method on Cloudflare - this.ws.accept!(); // if we're here, then there's an accept method + // @ts-ignore -- unknown Cloudflare-specific method + this.ws.accept!(); configureWebSocket(this.ws, true); debug && log('Cloudflare WebSocket opened'); }) From 04774b8c2616751729ccbdf4c8dd2f26434c9645 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 19 Dec 2024 13:33:24 +0000 Subject: [PATCH 34/40] Test on Node 18, not Node 20 --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7a86369..9f301b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,20 +6,20 @@ on: - main jobs: - test-node-20: + test-node-18: runs-on: ubuntu-latest steps: # setup - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 18 - name: Install package dependencies run: npm install # goal - - name: Run tests in Node 20 (no native WebSocket), node environment + - name: Run tests in Node 18 (no native WebSocket), node environment env: VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }} VITE_WSPROXY: ${{ vars.VITE_WSPROXY }} From e22873fd309fac6c6f43e5375b67853859576070 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 19 Dec 2024 16:38:43 +0000 Subject: [PATCH 35/40] Fixed driver and tests to work in Node 18 --- dist/dts/_extracted.d.ts | 15 + dist/dts/_extracted.d.ts.orig | 15 + dist/jsr/index.d.ts | 15 + dist/jsr/index.js | 1452 +++++++++++++++++---------------- dist/npm/index.d.mts | 15 + dist/npm/index.d.ts | 15 + dist/npm/index.js | 1343 +++++++++++++++--------------- dist/npm/index.mjs | 1452 +++++++++++++++++---------------- export/index.ts | 33 +- package-lock.json | 409 +++++----- package.json | 2 +- shims/crypto/index.ts | 674 +-------------- shims/crypto/md5.ts | 486 +++++++++++ shims/crypto/sha256.ts | 169 ++++ tests/http.test.ts | 29 +- 15 files changed, 3103 insertions(+), 3021 deletions(-) create mode 100644 shims/crypto/md5.ts create mode 100644 shims/crypto/sha256.ts diff --git a/dist/dts/_extracted.d.ts b/dist/dts/_extracted.d.ts index 3a3a170..920375e 100644 --- a/dist/dts/_extracted.d.ts +++ b/dist/dts/_extracted.d.ts @@ -1,3 +1,5 @@ +/// + import { Client as Client_2 } from 'pg'; import { ClientBase } from 'pg'; import { Connection } from 'pg'; @@ -512,7 +514,20 @@ declare namespace subtls { hexFromU8, stableStringify, startTls, + stdCharCodes, u8FromHex, + allKeyUsages, + ASN1Bytes, + Bytes, + Cert, + CertJSON, + DataRequest, + DistinguishedName, + OID, + ReadQueue, + RootCertsData, + RootCertsDatabase, + RootCertsIndex, SocketReadQueue, TrustedCert, WebSocketReadQueue diff --git a/dist/dts/_extracted.d.ts.orig b/dist/dts/_extracted.d.ts.orig index 48160cb..d2f7eb9 100644 --- a/dist/dts/_extracted.d.ts.orig +++ b/dist/dts/_extracted.d.ts.orig @@ -1,3 +1,5 @@ +/// + import { Client as Client_2 } from 'pg'; import { ClientBase } from 'pg'; import { Connection } from 'pg'; @@ -512,7 +514,20 @@ declare namespace subtls { hexFromU8, stableStringify, startTls, + stdCharCodes, u8FromHex, + allKeyUsages, + ASN1Bytes, + Bytes, + Cert, + CertJSON, + DataRequest, + DistinguishedName, + OID, + ReadQueue, + RootCertsData, + RootCertsDatabase, + RootCertsIndex, SocketReadQueue, TrustedCert, WebSocketReadQueue diff --git a/dist/jsr/index.d.ts b/dist/jsr/index.d.ts index 791327f..c503ef4 100644 --- a/dist/jsr/index.d.ts +++ b/dist/jsr/index.d.ts @@ -1,5 +1,7 @@ /// +/// + import { Client as Client_2 } from 'pg'; import { ClientBase } from 'pg'; import { Connection } from 'pg'; @@ -514,7 +516,20 @@ declare namespace subtls { hexFromU8, stableStringify, startTls, + stdCharCodes, u8FromHex, + allKeyUsages, + ASN1Bytes, + Bytes, + Cert, + CertJSON, + DataRequest, + DistinguishedName, + OID, + ReadQueue, + RootCertsData, + RootCertsDatabase, + RootCertsIndex, SocketReadQueue, TrustedCert, WebSocketReadQueue diff --git a/dist/jsr/index.js b/dist/jsr/index.js index 9583a89..8966195 100644 --- a/dist/jsr/index.js +++ b/dist/jsr/index.js @@ -1,91 +1,94 @@ /// -var ro=Object.create;var Ce=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var ao=(r,e,t)=>e in r?Ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): -r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0});var te=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),se=(r,e)=>{for(var t in e) -Ce(r,t,{get:e[t],enumerable:!0})},Tn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== -"function")for(let i of io(e))!oo.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= -no(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?ro(so(r)):{},Tn(e||!r||!r.__esModule?Ce(t,"default",{ -value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Ln=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= -yo;var ae=[],re=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ -PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ve=0,In=Rt.length;vee in r?Ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): +r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0}),Tn=(r=>typeof require<"u"?require: +typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)( +function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error( +'Dynamic require of "'+r+'" is not supported')});var z=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ie=(r,e)=>{for(var t in e) +Ce(r,t,{get:e[t],enumerable:!0})},In=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== +"function")for(let i of ao(e))!co.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= +oo(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?so(uo(r)):{},In(e||!r||!r.__esModule?Ce(t,"default",{ +value:r,enumerable:!0}):t,r)),N=r=>In(Ce({},"__esModule",{value:!0}),r);var A=(r,e,t)=>ho(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=fo;st.toByteArray=yo;st.fromByteArray= +wo;var ae=[],te=[],lo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ +PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ee=0,Pn=Rt.length;Ee0)throw new Error("Invalid string. Length must be a multip\ -le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Pn, -"getLens");function co(r){var e=Pn(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(co,"byte\ -Length");function ho(r,e,t){return(e+t)*3/4-t}a(ho,"_byteLength");function lo(r){ -var e,t=Pn(r),n=t[0],i=t[1],s=new uo(ho(r,n,i)),o=0,u=i>0?n-4:n,c;for(c=0;c0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e= -re[r.charCodeAt(c)]<<2|re[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=re[r.charCodeAt( -c)]<<10|re[r.charCodeAt(c+1)]<<4|re[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= -e&255),s}a(lo,"toByteArray");function fo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[r>> -6&63]+ae[r&63]}a(fo,"tripletToBase64");function po(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ +te[r.charCodeAt(c)]<<2|te[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=te[r.charCodeAt( +c)]<<10|te[r.charCodeAt(c+1)]<<4|te[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= +e&255),s}a(yo,"toByteArray");function mo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[r>> +6&63]+ae[r&63]}a(mo,"tripletToBase64");function go(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ ae[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ae[e>>10]+ae[e>>4&63]+ae[e<< -2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Bn=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> -1,l=-7,d=t?i-1:0,b=t?-1:1,C=r[e+d];for(d+=b,s=C&(1<<-l)-1,C>>=-l,l+=u;l>0;s=s*256+ -r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== -0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? +2&63]+"=")),i.join("")}a(wo,"fromByteArray")});var Rn=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> +1,l=-7,d=t?i-1:0,S=t?-1:1,_=r[e+d];for(d+=S,s=_&(1<<-l)-1,_>>=-l,l+=u;l>0;s=s*256+ +r[e+d],d+=S,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=S,l-=8);if(s=== +0)s=1-h;else{if(s===c)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(_? -1:1)*o*Math.pow(2,s-n)};Ft.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,L=n?1:-1,Q=e<0|| +h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,L=n?1:-1,G=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. -floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=b/c:e+= -b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=L,u/=256, -i-=8);for(o=o<0;r[t+C]=o&255,C+=L,o/=256,h-=8);r[t+C-L]|=Q*128}});var Kn=I(Be=>{"use strict";p();var Mt=Ln(),Pe=Bn(),Rn=typeof Symbol=="function"&& +floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=S/c:e+= +S*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+_]=u&255,_+=L,u/=256, +i-=8);for(o=o<0;r[t+_]=o&255,_+=L,o/=256,h-=8);r[t+_-L]|=G*128}});var zn=I(Be=>{"use strict";p();var Mt=Bn(),Pe=Rn(),Fn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Be.Buffer= -f;Be.SlowBuffer=xo;Be.INSPECT_MAX_BYTES=50;var ot=2147483647;Be.kMaxLength=ot;f. -TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. +f;Be.SlowBuffer=_o;Be.INSPECT_MAX_BYTES=50;var ot=2147483647;Be.kMaxLength=ot;f. +TYPED_ARRAY_SUPPORT=bo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ -rowser support.");function mo(){try{let r=new Uint8Array(1),e={foo:a(function(){ +rowser support.");function bo(){try{let r=new Uint8Array(1),e={foo:a(function(){ return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf( -r,e),r.foo()===42}catch{return!1}}a(mo,"typedArraySupport");Object.defineProperty( +r,e),r.foo()===42}catch{return!1}}a(bo,"typedArraySupport");Object.defineProperty( f.prototype,"parent",{enumerable:!0,get:a(function(){if(f.isBuffer(this))return this. buffer},"get")});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:a( function(){if(f.isBuffer(this))return this.byteOffset},"get")});function le(r){if(r> ot)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array( r);return Object.setPrototypeOf(e,f.prototype),e}a(le,"createBuffer");function f(r,e,t){ if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" a\ -rgument must be of type string. Received type number');return Ot(r)}return Dn(r, -e,t)}a(f,"Buffer");f.poolSize=8192;function Dn(r,e,t){if(typeof r=="string")return wo( -r,e);if(ArrayBuffer.isView(r))return bo(r);if(r==null)throw new TypeError("The f\ +rgument must be of type string. Received type number');return Ot(r)}return Un(r, +e,t)}a(f,"Buffer");f.poolSize=8192;function Un(r,e,t){if(typeof r=="string")return xo( +r,e);if(ArrayBuffer.isView(r))return vo(r);if(r==null)throw new TypeError("The f\ irst argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-l\ ike Object. Received type "+typeof r);if(ue(r,ArrayBuffer)||r&&ue(r.buffer,ArrayBuffer)|| typeof SharedArrayBuffer<"u"&&(ue(r,SharedArrayBuffer)||r&&ue(r.buffer,SharedArrayBuffer))) return Dt(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ must not be of type number. Received type number');let n=r.valueOf&&r.valueOf(); -if(n!=null&&n!==r)return f.from(n,e,t);let i=So(r);if(i)return i;if(typeof Symbol< +if(n!=null&&n!==r)return f.from(n,e,t);let i=Eo(r);if(i)return i;if(typeof Symbol< "u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return f. from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argumen\ t must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. \ -Received type "+typeof r)}a(Dn,"from");f.from=function(r,e,t){return Dn(r,e,t)}; +Received type "+typeof r)}a(Un,"from");f.from=function(r,e,t){return Un(r,e,t)}; Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f, -Uint8Array);function Un(r){if(typeof r!="number")throw new TypeError('"size" arg\ +Uint8Array);function On(r){if(typeof r!="number")throw new TypeError('"size" arg\ ument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is\ - invalid for option "size"')}a(Un,"assertSize");function go(r,e,t){return Un(r), -r<=0?le(r):e!==void 0?typeof t=="string"?le(r).fill(e,t):le(r).fill(e):le(r)}a(go, -"alloc");f.alloc=function(r,e,t){return go(r,e,t)};function Ot(r){return Un(r),le( + invalid for option "size"')}a(On,"assertSize");function So(r,e,t){return On(r), +r<=0?le(r):e!==void 0?typeof t=="string"?le(r).fill(e,t):le(r).fill(e):le(r)}a(So, +"alloc");f.alloc=function(r,e,t){return So(r,e,t)};function Ot(r){return On(r),le( r<0?0:Nt(r)|0)}a(Ot,"allocUnsafe");f.allocUnsafe=function(r){return Ot(r)};f.allocUnsafeSlow= -function(r){return Ot(r)};function wo(r,e){if((typeof e!="string"||e==="")&&(e="\ -utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=On(r,e)| -0,n=le(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(wo,"fromString");function kt(r){ +function(r){return Ot(r)};function xo(r,e){if((typeof e!="string"||e==="")&&(e="\ +utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Nn(r,e)| +0,n=le(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(xo,"fromString");function kt(r){ let e=r.length<0?0:Nt(r.length)|0,t=le(e);for(let n=0;n= +Array.isArray(r.data))return kt(r.data)}a(Eo,"fromObject");function Nt(r){if(r>= ot)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ -ot.toString(16)+" bytes");return r|0}a(Nt,"checked");function xo(r){return+r!=r&& -(r=0),f.alloc(+r)}a(xo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. +ot.toString(16)+" bytes");return r|0}a(Nt,"checked");function _o(r){return+r!=r&& +(r=0),f.alloc(+r)}a(_o,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. _isBuffer===!0&&e!==f.prototype},"isBuffer");f.compare=a(function(e,t){if(ue(e,Uint8Array)&& (e=f.from(e,e.offset,e.byteLength)),ue(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)), !f.isBuffer(e)||!f.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments\ @@ -100,7 +103,7 @@ if(t===void 0)for(t=0,n=0;ni.length?(f.isBuffer( o)||(o=f.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(f.isBuffer( o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buf\ -fers');s+=o.length}return i},"concat");function On(r,e){if(f.isBuffer(r))return r. +fers');s+=o.length}return i},"concat");function Nn(r,e){if(f.isBuffer(r))return r. length;if(ArrayBuffer.isView(r)||ue(r,ArrayBuffer))return r.byteLength;if(typeof r!= "string")throw new TypeError('The "string" argument must be one of type string, \ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length> @@ -108,29 +111,29 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ut(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return Vn(r).length;default:if(i)return n?-1:Ut(r).length;e=(""+e).toLowerCase(), -i=!0}}a(On,"byteLength");f.byteLength=On;function vo(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(Nn,"byteLength");f.byteLength=Nn;function Ao(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| -(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( -this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Lo(this, -e,t);case"latin1":case"binary":return Bo(this,e,t);case"base64":return Io(this,e, -t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: +(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return ko( +this,e,t);case"utf8":case"utf-8":return Qn(this,e,t);case"ascii":return Fo(this, +e,t);case"latin1":case"binary":return Mo(this,e,t);case"base64":return Bo(this,e, +t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Do(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -vo,"slowToString");f.prototype._isBuffer=!0;function Ee(r,e,t){let n=r[e];r[e]=r[t], -r[t]=n}a(Ee,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) +Ao,"slowToString");f.prototype._isBuffer=!0;function _e(r,e,t){let n=r[e];r[e]=r[t], +r[t]=n}a(_e,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< -e;t+=2)Ee(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. +e;t+=2)_e(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bit\ -s");for(let t=0;tt&&(e+=" ... "),""},"inspect");Rn&&(f.prototype[Rn]=f.prototype.inspect);f.prototype.compare= +e+">"},"inspect");Fn&&(f.prototype[Fn]=f.prototype.inspect);f.prototype.compare= a(function(e,t,n,i,s){if(ue(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f. isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffe\ r or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e? @@ -138,43 +141,43 @@ e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0|| s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0; if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0; let o=s-i,u=n-t,c=Math.min(o,u),h=this.slice(i,s),l=e.slice(t,n);for(let d=0;d2147483647?t=2147483647: t<-2147483648&&(t=-2147483648),t=+t,Qt(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t), t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e== -"string"&&(e=f.from(e,n)),f.isBuffer(e))return e.length===0?-1:Fn(r,e,t,n,i);if(typeof e== +"string"&&(e=f.from(e,n)),f.isBuffer(e))return e.length===0?-1:Mn(r,e,t,n,i);if(typeof e== "number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array. -prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Fn(r, -[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}a(Nn,"bid\ -irectionalIndexOf");function Fn(r,e,t,n,i){let s=1,o=r.length,u=e.length;if(n!== +prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Mn(r, +[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}a(qn,"bid\ +irectionalIndexOf");function Mn(r,e,t,n,i){let s=1,o=r.length,u=e.length;if(n!== void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="\ utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,u/=2,t/=2}function c(l,d){ return s===1?l[d]:l.readUInt16BE(d*s)}a(c,"read");let h;if(i){let l=-1;for(h=t;h< o;h++)if(c(r,h)===c(e,l===-1?0:h-l)){if(l===-1&&(l=h),h-l+1===u)return l*s}else l!== -1&&(h-=h-l),l=-1}else for(t+u>o&&(t=o-u),h=t;h>=0;h--){let l=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n> s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)? (n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.wri\ te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return Eo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ -ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, -e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: +hex":return Co(this,e,t,n);case"utf8":case"utf-8":return To(this,e,t,n);case"asc\ +ii":case"latin1":case"binary":return Io(this,e,t,n);case"base64":return Po(this, +e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lo(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ write");f.prototype.toJSON=a(function(){return{type:"Buffer",data:Array.prototype. -slice.call(this._arr||this,0)}},"toJSON");function Io(r,e,t){return e===0&&t===r. -length?Mt.fromByteArray(r):Mt.fromByteArray(r.slice(e,t))}a(Io,"base64Slice");function qn(r,e,t){ +slice.call(this._arr||this,0)}},"toJSON");function Bo(r,e,t){return e===0&&t===r. +length?Mt.fromByteArray(r):Mt.fromByteArray(r.slice(e,t))}a(Bo,"base64Slice");function Qn(r,e,t){ t=Math.min(r.length,t);let n=[],i=e;for(;i239?4:s>223? 3:s>191?2:1;if(i+u<=t){let c,h,l,d;switch(u){case 1:s<128&&(o=s);break;case 2:c= r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[i+ @@ -182,125 +185,125 @@ r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)=== 128&&(l&192)===128&&(d=(s&15)<<18|(c&63)<<12|(h&63)<<6|l&63,d>65535&&d<1114112&& (o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320| -o&1023),n.push(o),i+=u}return Po(n)}a(qn,"utf8Slice");var Mn=4096;function Po(r){ -let e=r.length;if(e<=Mn)return String.fromCharCode.apply(String,r);let t="",n=0; -for(;nn)&&(t=n);let i="";for(let s=e;sn)&&(t=n);let i="";for(let s=e;sn&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),tt)throw new RangeError( -"Trying to access beyond buffer length")}a(N,"checkOffset");f.prototype.readUintLE= -f.prototype.readUIntLE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e], +"Trying to access beyond buffer length")}a(q,"checkOffset");f.prototype.readUintLE= +f.prototype.readUIntLE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this.length);let i=this[e], s=1,o=0;for(;++o>>0,t=t>>>0,n||N(e,t,this. +readUintBE=f.prototype.readUIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this. length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]*s;return i},"re\ adUIntBE");f.prototype.readUint8=f.prototype.readUInt8=a(function(e,t){return e= -e>>>0,t||N(e,1,this.length),this[e]},"readUInt8");f.prototype.readUint16LE=f.prototype. -readUInt16LE=a(function(e,t){return e=e>>>0,t||N(e,2,this.length),this[e]|this[e+ +e>>>0,t||q(e,1,this.length),this[e]},"readUInt8");f.prototype.readUint16LE=f.prototype. +readUInt16LE=a(function(e,t){return e=e>>>0,t||q(e,2,this.length),this[e]|this[e+ 1]<<8},"readUInt16LE");f.prototype.readUint16BE=f.prototype.readUInt16BE=a(function(e,t){ -return e=e>>>0,t||N(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");f.prototype. -readUint32LE=f.prototype.readUInt32LE=a(function(e,t){return e=e>>>0,t||N(e,4,this. +return e=e>>>0,t||q(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");f.prototype. +readUint32LE=f.prototype.readUInt32LE=a(function(e,t){return e=e>>>0,t||q(e,4,this. length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE"); f.prototype.readUint32BE=f.prototype.readUInt32BE=a(function(e,t){return e=e>>>0, -t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ -readUInt32BE");f.prototype.readBigUInt64LE=me(a(function(e){e=e>>>0,Le(e,"offset"); +t||q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ +readUInt32BE");f.prototype.readBigUInt64LE=ge(a(function(e){e=e>>>0,Le(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Le(e,"offset");let t=this[e],n=this[e+7]; +readBigUInt64BE=ge(a(function(e){e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7]; (t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,n||q(e,t,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*t)),i},"readIntLE");f.prototype. -readIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||N(e,t,this.length);let i=t,s=1,o=this[e+ +readIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this.length);let i=t,s=1,o=this[e+ --i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)), -o},"readIntBE");f.prototype.readInt8=a(function(e,t){return e=e>>>0,t||N(e,1,this. +o},"readIntBE");f.prototype.readInt8=a(function(e,t){return e=e>>>0,t||q(e,1,this. length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8");f.prototype.readInt16LE= -a(function(e,t){e=e>>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return n& +a(function(e,t){e=e>>>0,t||q(e,2,this.length);let n=this[e]|this[e+1]<<8;return n& 32768?n|4294901760:n},"readInt16LE");f.prototype.readInt16BE=a(function(e,t){e=e>>> -0,t||N(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n}, -"readInt16BE");f.prototype.readInt32LE=a(function(e,t){return e=e>>>0,t||N(e,4,this. +0,t||q(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n}, +"readInt16BE");f.prototype.readInt32LE=a(function(e,t){return e=e>>>0,t||q(e,4,this. length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. -readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ -1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=me(a(function(e){ +readInt32BE=a(function(e,t){return e=e>>>0,t||q(e,4,this.length),this[e]<<24|this[e+ +1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=ge(a(function(e){ e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Le(e,"offset"); +igInt64LE"));f.prototype.readBigInt64BE=ge(a(function(e){e=e>>>0,Le(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,t||N(e,4,this.length),Pe.read(this,e, +readFloatLE=a(function(e,t){return e=e>>>0,t||q(e,4,this.length),Pe.read(this,e, !0,23,4)},"readFloatLE");f.prototype.readFloatBE=a(function(e,t){return e=e>>>0, -t||N(e,4,this.length),Pe.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= -a(function(e,t){return e=e>>>0,t||N(e,8,this.length),Pe.read(this,e,!0,52,8)},"r\ -eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||N(e,8,this. -length),Pe.read(this,e,!1,52,8)},"readDoubleBE");function z(r,e,t,n,i,s){if(!f.isBuffer( +t||q(e,4,this.length),Pe.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= +a(function(e,t){return e=e>>>0,t||q(e,8,this.length),Pe.read(this,e,!0,52,8)},"r\ +eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||q(e,8,this. +length),Pe.read(this,e,!1,52,8)},"readDoubleBE");function Y(r,e,t,n,i,s){if(!f.isBuffer( r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e< s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError( -"Index out of range")}a(z,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= -a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e, +"Index out of range")}a(Y,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= +a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e, t,n,u,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e,t,n,u,0)}let s=n-1, +if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e,t,n,u,0)}let s=n-1, o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n},"writeUI\ ntBE");f.prototype.writeUint8=f.prototype.writeUInt8=a(function(e,t,n){return e= -+e,t=t>>>0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= -f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, ++e,t=t>>>0,n||Y(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= +f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, 65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},"writeUInt16LE");f.prototype.writeUint16BE= -f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, +f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, 65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},"writeUInt16BE");f.prototype.writeUint32LE= -f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,4, +f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,4, 4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+ 4},"writeUInt32LE");f.prototype.writeUint32BE=f.prototype.writeUInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, -this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function Qn(r,e,t,n,i){$n( +return e=+e,t=t>>>0,n||Y(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, +this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function Wn(r,e,t,n,i){Kn( e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8, r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]= -o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Qn,"wrtBigUInt64LE");function Wn(r,e,t,n,i){ -$n(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> +o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Wn,"wrtBigUInt64LE");function jn(r,e,t,n,i){ +Kn(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> 8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+ -3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(Wn,"wrtBigUInt64BE");f. -prototype.writeBigUInt64LE=me(a(function(e,t=0){return Qn(this,e,t,BigInt(0),BigInt( -"0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=me(a(function(e,t=0){ -return Wn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); +3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(jn,"wrtBigUInt64BE");f. +prototype.writeBigUInt64LE=ge(a(function(e,t=0){return Wn(this,e,t,BigInt(0),BigInt( +"0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=ge(a(function(e,t=0){ +return jn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); f.prototype.writeIntLE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2, -8*n-1);z(this,e,t,n,c-1,-c)}let s=0,o=1,u=0;for(this[t]=e&255;++s>0)-u&255;return t+n},"writeIntL\ E");f.prototype.writeIntBE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow( -2,8*n-1);z(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= +2,8*n-1);Y(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= 256);)e<0&&u===0&&this[t+s+1]!==0&&(u=1),this[t+s]=(e/o>>0)-u&255;return t+n},"w\ -riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this, +riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this, e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},"writeInt8");f.prototype.writeInt16LE= -a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e&255, +a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e&255, this[t+1]=e>>>8,t+2},"writeInt16LE");f.prototype.writeInt16BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, +return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, t+2},"writeInt16BE");f.prototype.writeInt32LE=a(function(e,t,n){return e=+e,t=t>>> -0,n||z(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= +0,n||Y(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= e>>>16,this[t+3]=e>>>24,t+4},"writeInt32LE");f.prototype.writeInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ +return e=+e,t=t>>>0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ 1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeIn\ -t32BE");f.prototype.writeBigInt64LE=me(a(function(e,t=0){return Qn(this,e,t,-BigInt( +t32BE");f.prototype.writeBigInt64LE=ge(a(function(e,t=0){return Wn(this,e,t,-BigInt( "0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));f.prototype. -writeBigInt64BE=me(a(function(e,t=0){return Wn(this,e,t,-BigInt("0x8000000000000\ -000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function jn(r,e,t,n,i,s){ +writeBigInt64BE=ge(a(function(e,t=0){return jn(this,e,t,-BigInt("0x8000000000000\ +000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Hn(r,e,t,n,i,s){ if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError( -"Index out of range")}a(jn,"checkIEEE754");function Hn(r,e,t,n,i){return e=+e,t= -t>>>0,i||jn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Pe.write(r,e,t,n, -23,4),t+4}a(Hn,"writeFloat");f.prototype.writeFloatLE=a(function(e,t,n){return Hn( -this,e,t,!0,n)},"writeFloatLE");f.prototype.writeFloatBE=a(function(e,t,n){return Hn( -this,e,t,!1,n)},"writeFloatBE");function Gn(r,e,t,n,i){return e=+e,t=t>>>0,i||jn( +"Index out of range")}a(Hn,"checkIEEE754");function Gn(r,e,t,n,i){return e=+e,t= +t>>>0,i||Hn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Pe.write(r,e,t,n, +23,4),t+4}a(Gn,"writeFloat");f.prototype.writeFloatLE=a(function(e,t,n){return Gn( +this,e,t,!0,n)},"writeFloatLE");f.prototype.writeFloatBE=a(function(e,t,n){return Gn( +this,e,t,!1,n)},"writeFloatBE");function $n(r,e,t,n,i){return e=+e,t=t>>>0,i||Hn( r,e,t,8,17976931348623157e292,-17976931348623157e292),Pe.write(r,e,t,n,52,8),t+8} -a(Gn,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return Gn(this,e, -t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return Gn( +a($n,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return $n(this,e, +t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return $n( this,e,t,!1,n)},"writeDoubleBE");f.prototype.copy=a(function(e,t,n,i){if(!f.isBuffer( e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i= this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i2**32?i=kn(String(t)):typeof t=="bigint"&&(i=String(t), -(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=kn(i)),i+="n"),n+=` It\ - must be ${e}. Received ${i}`,n},RangeError);function kn(r){let e="",t=r.length, +isInteger(t)&&Math.abs(t)>2**32?i=Dn(String(t)):typeof t=="bigint"&&(i=String(t), +(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Dn(i)),i+="n"),n+=` It\ + must be ${e}. Received ${i}`,n},RangeError);function Dn(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(kn,"addNumericalSeparator");function Mo(r,e,t){Le(e,"offset"),(r[e]=== -void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function $n(r,e,t,n,i,s){ +t)}${e}`}a(Dn,"addNumericalSeparator");function Uo(r,e,t){Le(e,"offset"),(r[e]=== +void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Uo,"checkBounds");function Kn(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Ie.ERR_OUT_OF_RANGE( -"value",u,r)}Mo(n,i,s)}a($n,"checkIntBI");function Le(r,e){if(typeof r!="number") +"value",u,r)}Uo(n,i,s)}a(Kn,"checkIntBI");function Le(r,e){if(typeof r!="number") throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Le,"validateNumber");function je(r,e,t){ throw Math.floor(r)!==r?(Le(r,t),new Ie.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Ie.ERR_BUFFER_OUT_OF_BOUNDS:new Ie.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? -1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ -if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% -4!==0;)r=r+"=";return r}a(Do,"base64clean");function Ut(r,e){e=e||1/0;let t,n=r. +1:0} and <= ${e}`,r)}a(je,"boundsError");var Oo=/[^+/0-9A-Za-z-_]/g;function No(r){ +if(r=r.split("=")[0],r=r.trim().replace(Oo,""),r.length<2)return"";for(;r.length% +4!==0;)r=r+"=";return r}a(No,"base64clean");function Ut(r,e){e=e||1/0;let t,n=r. length,i=null,s=[];for(let o=0;o55295&&t<57344){if(!i){ if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&& s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, @@ -353,73 +356,73 @@ s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>> 6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63| 128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}a( -Ut,"utf8ToBytes");function Uo(r){let e=[];for(let t=0;t>8,i=t%256,s.push(i),s.push(n);return s} -a(Oo,"utf16leToBytes");function Vn(r){return Mt.toByteArray(Do(r))}a(Vn,"base64T\ +a(Qo,"utf16leToBytes");function Vn(r){return Mt.toByteArray(No(r))}a(Vn,"base64T\ oBytes");function at(r,e,t,n){let i;for(i=0;i=e.length||i>=r.length);++i) e[i+t]=r[i];return i}a(at,"blitBuffer");function ue(r,e){return r instanceof e|| r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name} -a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var No=function(){ +a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var Wo=function(){ let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< -16;++i)e[n+i]=r[t]+r[i]}return e}();function me(r){return typeof BigInt>"u"?qo:r} -a(me,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} -a(qo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +16;++i)e[n+i]=r[t]+r[i]}return e}();function ge(r){return typeof BigInt>"u"?jo:r} +a(ge,"defineBigIntMethod");function jo(){throw new Error("BigInt not supported")} +a(jo,"BufferBigIntNotDefined")});var b,x,v,w,y,m,p=z(()=>{"use strict";b=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. -Buffer.allocUnsafe=="function"?globalThis.Buffer:Kn().Buffer,m=globalThis.process?? +Buffer.allocUnsafe=="function"?globalThis.Buffer:zn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= -e.then.bind(e)}});var ge=I((th,Wt)=>{"use strict";p();var Re=typeof Reflect=="object"?Reflect:null, -zn=Re&&typeof Re.apply=="function"?Re.apply:a(function(e,t,n){return Function.prototype. +e.then.bind(e)}});var we=I((oh,Wt)=>{"use strict";p();var Re=typeof Reflect=="object"?Reflect:null, +Yn=Re&&typeof Re.apply=="function"?Re.apply:a(function(e,t,n){return Function.prototype. apply.call(e,t,n)},"ReflectApply"),ut;Re&&typeof Re.ownKeys=="function"?ut=Re.ownKeys: Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. -getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& -console.warn(r)}a(Qo,"ProcessEmitWarning");var Zn=Number.isNaN||a(function(e){return e!== +getOwnPropertyNames(e)},"ReflectOwnKeys");function Ho(r){console&&console.warn&& +console.warn(r)}a(Ho,"ProcessEmitWarning");var Jn=Number.isNaN||a(function(e){return e!== e},"NumberIsNaN");function B(){B.init.call(this)}a(B,"EventEmitter");Wt.exports= -B;Wt.exports.once=Go;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= -0;B.prototype._maxListeners=void 0;var Yn=10;function ct(r){if(typeof r!="functi\ +B;Wt.exports.once=Vo;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= +0;B.prototype._maxListeners=void 0;var Zn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(B,"defaultMaxLi\ -steners",{enumerable:!0,get:a(function(){return Yn},"get"),set:a(function(r){if(typeof r!= -"number"||r<0||Zn(r))throw new RangeError('The value of "defaultMaxListeners" is\ - out of range. It must be a non-negative number. Received '+r+".");Yn=r},"set")}); +steners",{enumerable:!0,get:a(function(){return Zn},"get"),set:a(function(r){if(typeof r!= +"number"||r<0||Jn(r))throw new RangeError('The value of "defaultMaxListeners" is\ + out of range. It must be a non-negative number. Received '+r+".");Zn=r},"set")}); B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). _events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners= this._maxListeners||void 0};B.prototype.setMaxListeners=a(function(e){if(typeof e!= -"number"||e<0||Zn(e))throw new RangeError('The value of "n" is out of range. It \ +"number"||e<0||Jn(e))throw new RangeError('The value of "n" is out of range. It \ must be a non-negative number. Received '+e+".");return this._maxListeners=e,this}, -"setMaxListeners");function Jn(r){return r._maxListeners===void 0?B.defaultMaxListeners: -r._maxListeners}a(Jn,"_getMaxListeners");B.prototype.getMaxListeners=a(function(){ -return Jn(this)},"getMaxListeners");B.prototype.emit=a(function(e){for(var t=[], +"setMaxListeners");function Xn(r){return r._maxListeners===void 0?B.defaultMaxListeners: +r._maxListeners}a(Xn,"_getMaxListeners");B.prototype.getMaxListeners=a(function(){ +return Xn(this)},"getMaxListeners");B.prototype.emit=a(function(e){for(var t=[], n=1;n 0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+ o.message+")":""));throw u.context=o,u}var c=s[e];if(c===void 0)return!1;if(typeof c== -"function")zn(c,this,t);else for(var h=c.length,l=ni(c,h),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po\ +t):o.push(t),i=Xn(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po\ ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ -ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(Xn,"_addList\ -ener");B.prototype.addListener=a(function(e,t){return Xn(this,e,t,!1)},"addListe\ +ededWarning",u.emitter=r,u.type=e,u.count=o.length,Ho(u)}return r}a(ei,"_addList\ +ener");B.prototype.addListener=a(function(e,t){return ei(this,e,t,!1)},"addListe\ ner");B.prototype.on=B.prototype.addListener;B.prototype.prependListener=a(function(e,t){ -return Xn(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. +return ei(this,e,t,!0)},"prependListener");function Go(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? -this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, -"onceWrapper");function ei(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");B.prototype. -once=a(function(e,t){return ct(t),this.on(e,ei(this,e,t)),this},"once");B.prototype. -prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ei(this, +this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Go, +"onceWrapper");function ti(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, +listener:t},i=Go.bind(n);return i.listener=t,n.wrapFn=i,i}a(ti,"_onceWrap");B.prototype. +once=a(function(e,t){return ct(t),this.on(e,ti(this,e,t)),this},"once");B.prototype. +prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ti(this, e,t)),this},"prependOnceListener");B.prototype.removeListener=a(function(e,t){var n, i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this; if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. -listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= +listener,s=o;break}if(s<0)return this;s===0?n.shift():$o(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, "removeListener");B.prototype.off=B.prototype.removeListener;B.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== @@ -429,76 +432,63 @@ this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ti(r,e,t){ +1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ri(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?Ho(i):ni(i,i.length)}a(ti,"_listeners");B.prototype. -listeners=a(function(e){return ti(this,e,!0)},"listeners");B.prototype.rawListeners= -a(function(e){return ti(this,e,!1)},"rawListeners");B.listenerCount=function(r,e){ -return typeof r.listenerCount=="function"?r.listenerCount(e):ri.call(r,e)};B.prototype. -listenerCount=ri;function ri(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== -"function")return 1;if(t!==void 0)return t.length}return 0}a(ri,"listenerCount"); +"function"?t?[i.listener||i]:[i]:t?Ko(i):ii(i,i.length)}a(ri,"_listeners");B.prototype. +listeners=a(function(e){return ri(this,e,!0)},"listeners");B.prototype.rawListeners= +a(function(e){return ri(this,e,!1)},"rawListeners");B.listenerCount=function(r,e){ +return typeof r.listenerCount=="function"?r.listenerCount(e):ni.call(r,e)};B.prototype. +listenerCount=ni;function ni(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== +"function")return 1;if(t!==void 0)return t.length}return 0}a(ni,"listenerCount"); B.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): -[]},"eventNames");function ni(r,e){for(var t=new Array(e),n=0;nVo});var Vo,Ge=te(()=>{"use strict";p();Vo={}});var jt={};se(jt,{Md5:()=>Ve,createHash:()=>zo,createHmac:()=>Yo,randomBytes:()=>Ko, -sha256:()=>$e});function Ko(r){return w.getRandomValues(y.alloc(r))}function zo(r){ -if(r==="sha256")return{update:a(function(e){return{digest:a(function(){return y. -from($e(e))},"digest")}},"update")};if(r==="md5")return{update:a(function(e){return{ -digest:a(function(){return typeof e=="string"?Ve.hashStr(e):Ve.hashByteArray(e)}, -"digest")}},"update")};throw new Error(`Hash type '${r}' not supported`)}function Yo(r,e){ -if(r!=="sha256")throw new Error(`Only sha256 is supported (requested: '${r}')`); -return{update:a(function(t){return{digest:a(function(){typeof e=="string"&&(e=new TextEncoder(). -encode(e)),typeof t=="string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n> -64)e=$e(e);else if(n<64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array( -64),s=new Uint8Array(64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array( -t.length+64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u. -set($e(o),64),y.from($e(u))},"digest")}},"update")}}function $e(r){let e=1779033703, -t=3144134277,n=1013904242,i=2773480762,s=1359893119,o=2600822924,u=528734635,c=1541459225, -h=0,l=0,d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748, -2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103, -3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692, -1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993, -338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, -2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909, -275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063, -1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479, -3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),L=new Uint8Array( -64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+ -3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,ce=b(C[R- -2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+ce|0}let A=e,g=t,P=n,K=i,D=s, -W=o,X=u,oe=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),ce=D&W^~D&X,ye=oe+ -$+ce+d[R]+C[R]|0,Se=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,he=Se+We|0;oe=X,X=W,W= -D,D=K+ye|0,K=P,P=g,g=A,A=ye+he|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, -u=u+X|0,c=c+oe|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). -encode(A));for(let g=0;g{if(L[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)L[l++]=0;Q()}for(;l<58;)L[l++]= -0;let A=h*8;L[l++]=A/1099511627776&255,L[l++]=A/4294967296&255,L[l++]=A>>>24,L[l++]= -A>>>16&255,L[l++]=A>>>8&255,L[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= -e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= -t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= -i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, -g[18]=s>>>8&255,g[19]=s&255,g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]= -o&255,g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]= -c>>>16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r===void 0?{add:J,digest:de}: -(J(r),de())}var U,Ve,Ht=te(()=>{"use strict";p();a(Ko,"randomBytes");a(zo,"creat\ -eHash");a(Yo,"createHmac");U=class U{constructor(){_(this,"_dataLength",0);_(this, -"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer",new ArrayBuffer( -68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array(this._buffer, -0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ +ed type '+typeof r)}a(si,"eventTargetAgnosticAddListener")});var He={};ie(He,{default:()=>Yo});var Yo,Ge=z(()=>{"use strict";p();Yo={}});function $e(r){let e=1779033703,t=3144134277,n=1013904242,i=2773480762,s=1359893119, +o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,3049323471, +3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278, +1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078, +604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808, +3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372, +1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800, +3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, +883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, +2361852424,2428436474,2756734187,3204031479,3329325298],S=a((C,g)=>C>>>g|C<<32-g, +"rrot"),_=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, +$+=4)_[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(_[R- +15],7)^S(_[R-15],18)^_[R-15]>>>3,ce=S(_[R-2],17)^S(_[R-2],19)^_[R-2]>>>10;_[R]=_[R- +16]+$+_[R-7]+ce|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,oe=c;for(let R=0;R<64;R++){let $=S( +U,6)^S(U,11)^S(U,25),ce=U&j^~U&ee,de=oe+$+ce+d[R]+_[R]|0,xe=S(C,2)^S(C,13)^S(C,22), +We=C&g^C&P^g&P,he=xe+We|0;oe=ee,ee=j,j=U,U=W+de|0,W=P,P=g,g=C,C=de+he|0}e=e+C|0, +t=t+g|0,n=n+P|0,i=i+W|0,s=s+U|0,o=o+j|0,u=u+ee|0,c=c+oe|0,l=0},"process"),X=a(C=>{ +typeof C=="string"&&(C=new TextEncoder().encode(C));for(let g=0;g{if(L[l++]=128,l==64&&G(),l+8>64){ +for(;l<64;)L[l++]=0;G()}for(;l<58;)L[l++]=0;let C=h*8;L[l++]=C/1099511627776&255, +L[l++]=C/4294967296&255,L[l++]=C>>>24,L[l++]=C>>>16&255,L[l++]=C>>>8&255,L[l++]= +C&255,G();let g=new Uint8Array(32);return g[0]=e>>>24,g[1]=e>>>16&255,g[2]=e>>>8& +255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]=t>>>8&255,g[7]=t&255,g[8]=n>>>24, +g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]=i>>>24,g[13]=i>>>16&255,g[14]= +i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, +g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> +16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, +g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:se}:(X(r),se())}var oi=z( +()=>{"use strict";p();a($e,"sha256")});var O,Ke,ai=z(()=>{"use strict";p();O=class O{constructor(){A(this,"_dataLength", +0);A(this,"_bufferLength",0);A(this,"_state",new Int32Array(4));A(this,"_buffer", +new ArrayBuffer(68));A(this,"_buffer8");A(this,"_buffer32");this._buffer8=new Uint8Array( +this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ -return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=U. -hexChars,n=U.hexOut,i,s,o,u;for(u=0;u<4;u+=1)for(s=u*8,i=e[u],o=0;o<8;o+=2)n[s+1+ +return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=O. +hexChars,n=O.hexOut,i,s,o,u;for(u=0;u<4;u+=1)for(s=u*8,i=e[u],o=0;o<8;o+=2)n[s+1+ o]=t.charAt(i&15),i>>>=4,n[s+0+o]=t.charAt(i&15),i>>>=4;return n.join("")}static _md5cycle(e,t){ let n=e[0],i=e[1],s=e[2],o=e[3];n+=(i&s|~i&o)+t[0]-680876936|0,n=(n<<7|n>>>25)+i| 0,o+=(n&i|~n&s)+t[1]-389564586|0,o=(o<<12|o>>>20)+n|0,s+=(o&n|~o&i)+t[2]+606105819| @@ -542,34 +532,48 @@ i>>>11)+s|0,n+=(s^(i|~o))+t[4]-145523070|0,n=(n<<6|n>>>26)+i|0,o+=(i^(n|~s))+t[1 1120210379|0,o=(o<<10|o>>>22)+n|0,s+=(n^(o|~i))+t[2]+718787259|0,s=(s<<15|s>>>17)+ o|0,i+=(o^(s|~n))+t[9]-343485551|0,i=(i<<21|i>>>11)+s|0,e[0]=n+e[0]|0,e[1]=i+e[1]| 0,e[2]=s+e[2]|0,e[3]=o+e[3]|0}start(){return this._dataLength=0,this._bufferLength= -0,this._state.set(U.stateIdentity),this}appendStr(e){let t=this._buffer8,n=this. +0,this._state.set(O.stateIdentity),this}appendStr(e){let t=this._buffer8,n=this. _buffer32,i=this._bufferLength,s,o;for(o=0;o>>6)+192,t[i++]=s&63|128;else if(s<55296|| s>56319)t[i++]=(s>>>12)+224,t[i++]=s>>>6&63|128,t[i++]=s&63|128;else{if(s=(s-55296)* 1024+(e.charCodeAt(++o)-56320)+65536,s>1114111)throw new Error("Unicode standard\ supports code points up to U+10FFFF");t[i++]=(s>>>18)+240,t[i++]=s>>>12&63|128, -t[i++]=s>>>6&63|128,t[i++]=s&63|128}i>=64&&(this._dataLength+=64,U._md5cycle(this. +t[i++]=s>>>6&63|128,t[i++]=s&63|128}i>=64&&(this._dataLength+=64,O._md5cycle(this. _state,n),i-=64,n[0]=n[16])}return this._bufferLength=i,this}appendAsciiStr(e){let t=this. _buffer8,n=this._buffer32,i=this._bufferLength,s,o=0;for(;;){for(s=Math.min(e.length- -o,64-i);s--;)t[i++]=e.charCodeAt(o++);if(i<64)break;this._dataLength+=64,U._md5cycle( +o,64-i);s--;)t[i++]=e.charCodeAt(o++);if(i<64)break;this._dataLength+=64,O._md5cycle( this._state,n),i=0}return this._bufferLength=i,this}appendByteArray(e){let t=this. _buffer8,n=this._buffer32,i=this._bufferLength,s,o=0;for(;;){for(s=Math.min(e.length- -o,64-i);s--;)t[i++]=e[o++];if(i<64)break;this._dataLength+=64,U._md5cycle(this._state, +o,64-i);s--;)t[i++]=e[o++];if(i<64)break;this._dataLength+=64,O._md5cycle(this._state, n),i=0}return this._bufferLength=i,this}getState(){let e=this._state;return{buffer:String. fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this. _dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){let t=e.buffer,n=e.state,i=this. _state,s;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=n[0],i[1]= n[1],i[2]=n[2],i[3]=n[3],s=0;s>2)+1;this._dataLength+= -t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(U.buffer32Identity. -subarray(s),s),t>55&&(U._md5cycle(this._state,i),i.set(U.buffer32Identity)),o<=4294967295) +t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(O.buffer32Identity. +subarray(s),s),t>55&&(O._md5cycle(this._state,i),i.set(O.buffer32Identity)),o<=4294967295) i[14]=o;else{let u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return;let c=parseInt( -u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return U._md5cycle(this._state,i), -e?this._state:U._hex(this._state)}};a(U,"Md5"),_(U,"stateIdentity",new Int32Array( -[1732584193,-271733879,-1732584194,271733878])),_(U,"buffer32Identity",new Int32Array( -[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(U,"hexChars","0123456789abcdef"),_(U,"hexO\ -ut",[]),_(U,"onePassHasher",new U);Ve=U;a($e,"sha256")});var $t=I(si=>{"use strict";p();si.parse=function(r,e){return new Gt(r,e).parse()}; -var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Zo,this.position= +u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return O._md5cycle(this._state,i), +e?this._state:O._hex(this._state)}};a(O,"Md5"),A(O,"stateIdentity",new Int32Array( +[1732584193,-271733879,-1732584194,271733878])),A(O,"buffer32Identity",new Int32Array( +[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),A(O,"hexChars","0123456789abcdef"),A(O,"hexO\ +ut",[]),A(O,"onePassHasher",new O);Ke=O});var jt={};ie(jt,{createHash:()=>Xo,createHmac:()=>ea,randomBytes:()=>Jo});function Jo(r){ +return typeof w<"u"&&w.randomBytes!==void 0?(w.webcrypto??w).getRandomValues(y.alloc( +r)):Tn(Zo).randomBytes(r)}function Xo(r){if(r==="sha256")return{update:a(function(e){ +return{digest:a(function(){return y.from($e(e))},"digest")}},"update")};if(r==="\ +md5")return{update:a(function(e){return{digest:a(function(){return typeof e=="st\ +ring"?Ke.hashStr(e):Ke.hashByteArray(e)},"digest")}},"update")};throw new Error( +`Hash type '${r}' not supported`)}function ea(r,e){if(r!=="sha256")throw new Error( +`Only sha256 is supported (requested: '${r}')`);return{update:a(function(t){return{ +digest:a(function(){typeof e=="string"&&(e=new TextEncoder().encode(e)),typeof t== +"string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n>64)e=$e(e);else if(n< +64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array(64),s=new Uint8Array( +64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array(t.length+ +64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u.set($e(o), +64),y.from($e(u))},"digest")}},"update")}}var Zo,Ht=z(()=>{"use strict";p();oi(); +ai();Zo="node:crypto";a(Jo,"randomBytes");a(Xo,"createHash");a(ea,"createHmac")});var $t=I(ui=>{"use strict";p();ui.parse=function(r,e){return new Gt(r,e).parse()}; +var ht=class ht{constructor(e,t){this.source=e,this.transform=t||ta,this.position= 0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>= this.source.length}nextCharacter(){var e=this.source[this.position++];return e=== "\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){ @@ -583,97 +587,97 @@ n.parse(!0)),this.position+=n.position-2);else if(t.value==="}"&&!i){if(this.dim !this.dimension&&(this.newEntry(),e))return this.entries}else t.value==='"'&&!t. escaped?(i&&this.newEntry(!0),i=!i):t.value===","&&!i?this.newEntry():this.record( t.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this. -entries}};a(ht,"ArrayParser");var Gt=ht;function Zo(r){return r}a(Zo,"identity")});var Vt=I((hh,oi)=>{p();var Jo=$t();oi.exports={create:a(function(r,e){return{parse:a( -function(){return Jo.parse(r,e)},"parse")}},"create")}});var ci=I((ph,ui)=>{"use strict";p();var Xo=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, -ea=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ta=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ra=/^-?infinity$/; -ui.exports=a(function(e){if(ra.test(e))return Number(e.replace("i","I"));var t=Xo. -exec(e);if(!t)return na(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=ai(i));var s=parseInt( +entries}};a(ht,"ArrayParser");var Gt=ht;function ta(r){return r}a(ta,"identity")});var Kt=I((Eh,ci)=>{p();var ra=$t();ci.exports={create:a(function(r,e){return{parse:a( +function(){return ra.parse(r,e)},"parse")}},"create")}});var fi=I((Ch,li)=>{"use strict";p();var na=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, +ia=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,sa=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,oa=/^-?infinity$/; +li.exports=a(function(e){if(oa.test(e))return Number(e.replace("i","I"));var t=na. +exec(e);if(!t)return aa(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=hi(i));var s=parseInt( t[2],10)-1,o=t[3],u=parseInt(t[4],10),c=parseInt(t[5],10),h=parseInt(t[6],10),l=t[7]; -l=l?1e3*parseFloat(l):0;var d,b=ia(e);return b!=null?(d=new Date(Date.UTC(i,s,o, -u,c,h,l)),Kt(i)&&d.setUTCFullYear(i),b!==0&&d.setTime(d.getTime()-b)):(d=new Date( -i,s,o,u,c,h,l),Kt(i)&&d.setFullYear(i)),d},"parseDate");function na(r){var e=ea. -exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=ai(t));var i=parseInt(e[2], -10)-1,s=e[3],o=new Date(t,i,s);return Kt(t)&&o.setFullYear(t),o}}a(na,"getDate"); -function ia(r){if(r.endsWith("+00"))return 0;var e=ta.exec(r.split(" ")[1]);if(e){ +l=l?1e3*parseFloat(l):0;var d,S=ua(e);return S!=null?(d=new Date(Date.UTC(i,s,o, +u,c,h,l)),Vt(i)&&d.setUTCFullYear(i),S!==0&&d.setTime(d.getTime()-S)):(d=new Date( +i,s,o,u,c,h,l),Vt(i)&&d.setFullYear(i)),d},"parseDate");function aa(r){var e=ia. +exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=hi(t));var i=parseInt(e[2], +10)-1,s=e[3],o=new Date(t,i,s);return Vt(t)&&o.setFullYear(t),o}}a(aa,"getDate"); +function ua(r){if(r.endsWith("+00"))return 0;var e=sa.exec(r.split(" ")[1]);if(e){ var t=e[1];if(t==="Z")return 0;var n=t==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt( -e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(ia,"timeZoneOffset");function ai(r){ -return-(r-1)}a(ai,"bcYearToNegativeYear");function Kt(r){return r>=0&&r<100}a(Kt, -"is0To99")});var li=I((mh,hi)=>{p();hi.exports=oa;var sa=Object.prototype.hasOwnProperty;function oa(r){ -for(var e=1;e{"use strict";p();var aa=li();pi.exports=Fe;function Fe(r){if(!(this instanceof -Fe))return new Fe(r);aa(this,ba(r))}a(Fe,"PostgresInterval");var ua=["seconds","\ -minutes","hours","days","months","years"];Fe.prototype.toPostgres=function(){var r=ua. +e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(ua,"timeZoneOffset");function hi(r){ +return-(r-1)}a(hi,"bcYearToNegativeYear");function Vt(r){return r>=0&&r<100}a(Vt, +"is0To99")});var di=I((Ph,pi)=>{p();pi.exports=ha;var ca=Object.prototype.hasOwnProperty;function ha(r){ +for(var e=1;e{"use strict";p();var la=di();mi.exports=Fe;function Fe(r){if(!(this instanceof +Fe))return new Fe(r);la(this,Ea(r))}a(Fe,"PostgresInterval");var fa=["seconds","\ +minutes","hours","days","months","years"];Fe.prototype.toPostgres=function(){var r=fa. filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")< 0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e=== "seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/, -"")),t+" "+e},this).join(" ")};var ca={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ -M",seconds:"S"},ha=["years","months","days"],la=["hours","minutes","seconds"];Fe. -prototype.toISOString=Fe.prototype.toISO=function(){var r=ha.map(t,this).join(""), -e=la.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== +"")),t+" "+e},this).join(" ")};var pa={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ +M",seconds:"S"},da=["years","months","days"],ya=["hours","minutes","seconds"];Fe. +prototype.toISOString=Fe.prototype.toISO=function(){var r=da.map(t,this).join(""), +e=ya.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== "seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/, -"")),i+ca[n]}};var zt="([+-]?\\d+)",fa=zt+"\\s+years?",pa=zt+"\\s+mons?",da=zt+"\ -\\s+days?",ya="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",ma=new RegExp([ -fa,pa,da,ya].map(function(r){return"("+r+")?"}).join("\\s*")),fi={years:2,months:4, -days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ga=["hours","minutes","sec\ -onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return parseInt( -e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( -r),t=e[8]==="-";return Object.keys(fi).reduce(function(n,i){var s=fi[i],o=e[s];return!o|| -(o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(ba,"parse")});var mi=I((vh,yi)=>{"use strict";p();yi.exports=a(function(e){if(/^\\x/.test(e))return new y( +"")),i+pa[n]}};var zt="([+-]?\\d+)",ma=zt+"\\s+years?",ga=zt+"\\s+mons?",wa=zt+"\ +\\s+days?",ba="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",Sa=new RegExp([ +ma,ga,wa,ba].map(function(r){return"("+r+")?"}).join("\\s*")),yi={years:2,months:4, +days:6,hours:9,minutes:10,seconds:11,milliseconds:12},xa=["hours","minutes","sec\ +onds","milliseconds"];function va(r){var e=r+"000000".slice(r.length);return parseInt( +e,10)/1e3}a(va,"parseMilliseconds");function Ea(r){if(!r)return{};var e=Sa.exec( +r),t=e[8]==="-";return Object.keys(yi).reduce(function(n,i){var s=yi[i],o=e[s];return!o|| +(o=i==="milliseconds"?va(o):parseInt(o,10),!o)||(t&&~xa.indexOf(i)&&(o*=-1),n[i]= +o),n},{})}a(Ea,"parse")});var bi=I((kh,wi)=>{"use strict";p();wi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=$t(),ze=Vt(),lt=ci(),wi=di(),bi=mi();function ft(r){ -return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Si(r){ +"\\";n+=Math.floor(i/2)*2}return new y(t,"binary")},"parseBytea")});var Ci=I((Oh,Ai)=>{p();var Ve=$t(),ze=Kt(),lt=fi(),xi=gi(),vi=bi();function ft(r){ +return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Ei(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| -r==="1"}a(Si,"parseBool");function Sa(r){return r?Ke.parse(r,Si):null}a(Sa,"pars\ -eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Yt(r){ -return r?Ke.parse(r,ft(xa)):null}a(Yt,"parseIntegerArray");function va(r){return r? -Ke.parse(r,ft(function(e){return xi(e).trim()})):null}a(va,"parseBigIntegerArray"); -var Ea=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +r==="1"}a(Ei,"parseBool");function _a(r){return r?Ve.parse(r,Ei):null}a(_a,"pars\ +eBoolArray");function Aa(r){return parseInt(r,10)}a(Aa,"parseBaseTenInt");function Yt(r){ +return r?Ve.parse(r,ft(Aa)):null}a(Yt,"parseIntegerArray");function Ca(r){return r? +Ve.parse(r,ft(function(e){return _i(e).trim()})):null}a(Ca,"parseBigIntegerArray"); +var Ta=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=er(t)),t});return e.parse()},"parsePointArray"),Zt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); -return e.parse()},"parseFloatArray"),ne=a(function(r){if(!r)return null;var e=ze. +return e.parse()},"parseFloatArray"),re=a(function(r){if(!r)return null;var e=ze. create(r);return e.parse()},"parseStringArray"),Jt=a(function(r){if(!r)return null; var e=ze.create(r,function(t){return t!==null&&(t=lt(t)),t});return e.parse()},"\ -parseDateArray"),_a=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ -return t!==null&&(t=wi(t)),t});return e.parse()},"parseIntervalArray"),Aa=a(function(r){ -return r?Ke.parse(r,ft(bi)):null},"parseByteAArray"),Xt=a(function(r){return parseInt( -r,10)},"parseInteger"),xi=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: -r},"parseBigInteger"),gi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, +parseDateArray"),Ia=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ +return t!==null&&(t=xi(t)),t});return e.parse()},"parseIntervalArray"),Pa=a(function(r){ +return r?Ve.parse(r,ft(vi)):null},"parseByteAArray"),Xt=a(function(r){return parseInt( +r,10)},"parseInteger"),_i=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: +r},"parseBigInteger"),Si=a(function(r){return r?Ve.parse(r,ft(JSON.parse)):null}, "parseJsonArray"),er=a(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- -1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ca=a(function(r){ +1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),La=a(function(r){ if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( +var s=er(e);return s.radius=parseFloat(t),s},"parseCircle"),Ba=a(function(r){r(20, +_i),r(21,Xt),r(23,Xt),r(26,Xt),r(700,parseFloat),r(701,parseFloat),r(16,Ei),r(1082, +lt),r(1114,lt),r(1184,lt),r(600,er),r(651,re),r(718,La),r(1e3,_a),r(1001,Pa),r(1005, +Yt),r(1007,Yt),r(1028,Yt),r(1016,Ca),r(1017,Ta),r(1021,Zt),r(1022,Zt),r(1231,Zt), +r(1014,re),r(1015,re),r(1008,re),r(1009,re),r(1040,re),r(1041,re),r(1115,Jt),r(1182, +Jt),r(1185,Jt),r(1186,xi),r(1187,Ia),r(17,vi),r(114,JSON.parse.bind(JSON)),r(3802, +JSON.parse.bind(JSON)),r(199,Si),r(3807,Si),r(3907,re),r(2951,re),r(791,re),r(1183, +re),r(1270,re)},"init");Ai.exports={init:Ba}});var Ii=I((Qh,Ti)=>{"use strict";p();var Z=1e6;function Ra(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,o,u, -c,h,l;{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+ -u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* -s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< -h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), +c,h,l;{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+ +u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* +s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< +h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Pa=Ai(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,L,Q){ -return C*Math.pow(2,Q)+L};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, +e%Z,o=4294967296*s+t,u=""+o%Z,n+u+i}a(Ra,"readInt8");Ti.exports=Ra});var Fi=I((Hh,Ri)=>{p();var Fa=Ii(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(_,L,G){ +return _*Math.pow(2,G)+L};var s=t>>3,o=a(function(_){return n?~_&255:_},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& -u,c));for(var l=e+t>>3,d=s+1;d0&& -(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Ii=a(function(r,e,t){var n=Math.pow(2,t- +u,c));for(var l=e+t>>3,d=s+1;d0&& +(h=i(h,o(r[l])>>8-S,S)),h},"parseBits"),Bi=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= -1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), +1);for(var S=1;S<=d;S++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),La=a(function(r){return F(r,1)==1?-1* -(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ci=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Ba=a(function(r){return Ii(r,23,8)},"pars\ -eFloat32"),Ra=a(function(r){return Ii(r,52,11)},"parseFloat64"),Fa=a(function(r){ +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ma=a(function(r){return F(r,1)==1?-1* +(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Pi=a(function(r){return F(r,1)==1?-1*(F( +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),ka=a(function(r){return Bi(r,23,8)},"pars\ +eFloat32"),Da=a(function(r){return Bi(r,52,11)},"parseFloat64"),Ua=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o>3,(i+=l<<3)>>3), d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ -var d=[],b;if(h.length>1){var C=h.shift();for(b=0;b0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,La),r(23,Ci),r(26, -Ci),r(1700,Fa),r(700,Ba),r(701,Ra),r(16,ka),r(1114,Ti.bind(null,!1)),r(1184,Ti.bind( -null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); -Pi.exports={init:Da}});var Ri=I((Mh,Bi)=>{p();Bi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +var d=[],S;if(h.length>1){var _=h.shift();for(S=0;S<_;S++)d[S]=c(h,l);h.unshift( +_)}else for(S=0;S0},"parseBool"),qa=a(function(r){r(20,Fa),r(21,Ma),r(23,Pi),r(26, +Pi),r(1700,Ua),r(700,ka),r(701,Da),r(16,Na),r(1114,Li.bind(null,!1)),r(1184,Li.bind( +null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Oa)},"init"); +Ri.exports={init:qa}});var ki=I((Kh,Mi)=>{p();Mi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -696,157 +700,157 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=Ei(),Oa=Li(),Na=Vt(),qa=Ri();Je.getTypeParser=Qa;Je.setTypeParser= -Wa;Je.arrayParser=Na;Je.builtins=qa;var Ze={text:{},binary:{}};function Fi(r){return String( -r)}a(Fi,"noParse");function Qa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Fi}a(Qa, -"getTypeParser");function Wa(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= -t}a(Wa,"setTypeParser");Ua.init(function(r,e){Ze.text[r]=e});Oa.init(function(r,e){ -Ze.binary[r]=e})});var et=I((Nh,tr)=>{"use strict";p();tr.exports={host:"localhost",user:m.platform=== +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Qa=Ci(),Wa=Fi(),ja=Kt(),Ha=ki();Je.getTypeParser=Ga;Je.setTypeParser= +$a;Je.arrayParser=ja;Je.builtins=Ha;var Ze={text:{},binary:{}};function Di(r){return String( +r)}a(Di,"noParse");function Ga(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Di}a(Ga, +"getTypeParser");function $a(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= +t}a($a,"setTypeParser");Qa.init(function(r,e){Ze.text[r]=e});Wa.init(function(r,e){ +Ze.binary[r]=e})});var et=I((Jh,tr)=>{"use strict";p();tr.exports={host:"localhost",user:m.platform=== "win32"?m.env.USERNAME:m.env.USER,database:void 0,password:null,connectionString:void 0, port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1, application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1, statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1, -connect_timeout:0,keepalives:1,keepalives_idle:0};var Me=Xe(),ja=Me.getTypeParser( -20,"text"),Ha=Me.getTypeParser(1016,"text");tr.exports.__defineSetter__("parseIn\ -t8",function(r){Me.setTypeParser(20,"text",r?Me.getTypeParser(23,"text"):ja),Me. -setTypeParser(1016,"text",r?Me.getTypeParser(1007,"text"):Ha)})});var tt=I((Qh,ki)=>{"use strict";p();var Ga=(Ht(),O(jt)),$a=et();function Va(r){var e=r. -replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Va,"escapeElement"); -function Mi(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> -"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Mi(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. -toString("hex"):e+=Va(pt(r[t]));return e=e+"}",e}a(Mi,"arrayString");var pt=a(function(r,e){ +connect_timeout:0,keepalives:1,keepalives_idle:0};var Me=Xe(),Ka=Me.getTypeParser( +20,"text"),Va=Me.getTypeParser(1016,"text");tr.exports.__defineSetter__("parseIn\ +t8",function(r){Me.setTypeParser(20,"text",r?Me.getTypeParser(23,"text"):Ka),Me. +setTypeParser(1016,"text",r?Me.getTypeParser(1007,"text"):Va)})});var tt=I((el,Oi)=>{"use strict";p();var za=(Ht(),N(jt)),Ya=et();function Za(r){var e=r. +replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Za,"escapeElement"); +function Ui(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> +"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Ui(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. +toString("hex"):e+=Za(pt(r[t]));return e=e+"}",e}a(Ui,"arrayString");var pt=a(function(r,e){ if(r==null)return null;if(r instanceof y)return r;if(ArrayBuffer.isView(r)){var t=y. from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice( -r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?$a.parseInputDatesAsUTC? -Ya(r):za(r):Array.isArray(r)?Mi(r):typeof r=="object"?Ka(r,e):r.toString()},"pre\ -pareValue");function Ka(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. +r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?Ya.parseInputDatesAsUTC? +eu(r):Xa(r):Array.isArray(r)?Ui(r):typeof r=="object"?Ja(r,e):r.toString()},"pre\ +pareValue");function Ja(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+ r+'" for query');return e.push(r),pt(r.toPostgres(pt),e)}return JSON.stringify(r)} -a(Ka,"prepareObject");function G(r,e){for(r=""+r;r.length{"use strict";p();var nr=(Ht(),O(jt));function Xa(r){if(r.indexOf( +a(Ja,"prepareObject");function H(r,e){for(r=""+r;r.length{"use strict";p();var nr=(Ht(),N(jt));function nu(r){if(r.indexOf( "SCRAM-SHA-256")===-1)throw new Error("SASL: Only mechanism SCRAM-SHA-256 is cur\ rently supported");let e=nr.randomBytes(18).toString("base64");return{mechanism:"\ SCRAM-SHA-256",clientNonce:e,response:"n,,n=*,r="+e,message:"SASLInitialResponse"}} -a(Xa,"startSession");function eu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( +a(nu,"startSession");function iu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( "SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(typeof t!= "string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a\ - string");let n=nu(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== + string");let n=au(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n\ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ -er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, -i,n.iteration),o=ke(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=ke(u,d),C=Oi( -o,b),L=C.toString("base64"),Q=ke(s,"Server Key"),J=ke(Q,d);r.message="SASLRespon\ -se",r.serverSignature=J.toString("base64"),r.response=l+",p="+L}a(eu,"continueSe\ -ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ +er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=hu(e, +i,n.iteration),o=ke(s,"Client Key"),u=cu(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=ke(u,d),_=Qi( +o,S),L=_.toString("base64"),G=ke(s,"Server Key"),X=ke(G,d);r.message="SASLRespon\ +se",r.serverSignature=X.toString("base64"),r.response=l+",p="+L}a(iu,"continueSe\ +ssion");function su(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ -CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( +CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=uu( e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: s\ -erver signature does not match")}a(tu,"finalizeSession");function ru(r){if(typeof r!= +erver signature does not match")}a(su,"finalizeSession");function ou(r){if(typeof r!= "string")throw new TypeError("SASL: text must be a string");return r.split("").map( -(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(ru,"isPrintableC\ -hars");function Di(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(r)}a(Di,"isBase64");function Ui(r){if(typeof r!="string")throw new TypeError( +(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(ou,"isPrintableC\ +hars");function Ni(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(r)}a(Ni,"isBase64");function qi(r){if(typeof r!="string")throw new TypeError( "SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{ if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0], -n=e.substring(2);return[t,n]}))}a(Ui,"parseAttributePairs");function nu(r){let e=Ui( -r),t=e.get("r");if(t){if(!ru(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ +n=e.substring(2);return[t,n]}))}a(qi,"parseAttributePairs");function au(r){let e=qi( +r),t=e.get("r");if(t){if(!ou(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ E: nonce must only contain printable characters")}else throw new Error("SASL: SC\ -RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Di(n))throw new Error( +RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Ni(n))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("S\ ASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/. test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration cou\ nt")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); -let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(nu,"parseServerFirstMe\ -ssage");function iu(r){let t=Ui(r).get("v");if(t){if(!Di(t))throw new Error("SAS\ +let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(au,"parseServerFirstMe\ +ssage");function uu(r){let t=qi(r).get("v");if(t){if(!Ni(t))throw new Error("SAS\ L: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error( "SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}} -a(iu,"parseServerFinalMessage");function Oi(r,e){if(!y.isBuffer(r))throw new TypeError( +a(uu,"parseServerFinalMessage");function Qi(r,e){if(!y.isBuffer(r))throw new TypeError( "first argument must be a Buffer");if(!y.isBuffer(e))throw new TypeError("second\ argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer leng\ ths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return y. -from(r.map((t,n)=>r[n]^e[n]))}a(Oi,"xorBuffers");function su(r){return nr.createHash( -"sha256").update(r).digest()}a(su,"sha256");function ke(r,e){return nr.createHmac( -"sha256",r).update(e).digest()}a(ke,"hmacSha256");function ou(r,e,t){for(var n=ke( -r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;sau});function au(...r){return r.join("/")}var sr=te(()=>{ -"use strict";p();a(au,"join")});var or={};se(or,{stat:()=>uu});function uu(r,e){e(new Error("No filesystem"))}var ar=te( -()=>{"use strict";p();a(uu,"stat")});var ur={};se(ur,{default:()=>cu});var cu,cr=te(()=>{"use strict";p();cu={}});var Qi={};se(Qi,{StringDecoder:()=>hr});var lr,hr,Wi=te(()=>{"use strict";p();lr= -class lr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. +from(r.map((t,n)=>r[n]^e[n]))}a(Qi,"xorBuffers");function cu(r){return nr.createHash( +"sha256").update(r).digest()}a(cu,"sha256");function ke(r,e){return nr.createHmac( +"sha256",r).update(e).digest()}a(ke,"hmacSha256");function hu(r,e,t){for(var n=ke( +r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;slu});function lu(...r){return r.join("/")}var sr=z(()=>{ +"use strict";p();a(lu,"join")});var or={};ie(or,{stat:()=>fu});function fu(r,e){e(new Error("No filesystem"))}var ar=z( +()=>{"use strict";p();a(fu,"stat")});var ur={};ie(ur,{default:()=>pu});var pu,cr=z(()=>{"use strict";p();pu={}});var Hi={};ie(Hi,{StringDecoder:()=>hr});var lr,hr,Gi=z(()=>{"use strict";p();lr= +class lr{constructor(e){A(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(lr,"StringDecoder"); -hr=lr});var $i=I((el,Gi)=>{"use strict";p();var{Transform:hu}=(cr(),O(ur)),{StringDecoder:lu}=(Wi(),O(Qi)), -we=Symbol("last"),dt=Symbol("decoder");function fu(r,e,t){let n;if(this.overflow){ +hr=lr});var zi=I((pl,Vi)=>{"use strict";p();var{Transform:du}=(cr(),N(ur)),{StringDecoder:yu}=(Gi(),N(Hi)), +be=Symbol("last"),dt=Symbol("decoder");function mu(r,e,t){let n;if(this.overflow){ if(n=this[dt].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. -overflow=!1}else this[we]+=this[dt].write(r),n=this[we].split(this.matcher);this[we]= -n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ -t(new Error("maximum buffer reached"));return}t()}a(fu,"transform");function pu(r){ -if(this[we]+=this[dt].end(),this[we])try{Hi(this,this.mapper(this[we]))}catch(e){ -return r(e)}r()}a(pu,"flush");function Hi(r,e){e!==void 0&&r.push(e)}a(Hi,"push"); -function ji(r){return r}a(ji,"noop");function du(r,e,t){switch(r=r||/\r?\n/,e=e|| -ji,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== +overflow=!1}else this[be]+=this[dt].write(r),n=this[be].split(this.matcher);this[be]= +n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ +t(new Error("maximum buffer reached"));return}t()}a(mu,"transform");function gu(r){ +if(this[be]+=this[dt].end(),this[be])try{Ki(this,this.mapper(this[be]))}catch(e){ +return r(e)}r()}a(gu,"flush");function Ki(r,e){e!==void 0&&r.push(e)}a(Ki,"push"); +function $i(r){return r}a($i,"noop");function wu(r,e,t){switch(r=r||/\r?\n/,e=e|| +$i,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== "object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2: -typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=ji)}t=Object. -assign({},t),t.autoDestroy=!0,t.transform=fu,t.flush=pu,t.readableObjectMode=!0; -let n=new hu(t);return n[we]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= +typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=$i)}t=Object. +assign({},t),t.autoDestroy=!0,t.transform=mu,t.flush=gu,t.readableObjectMode=!0; +let n=new du(t);return n[be]="",n[dt]=new yu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ -this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Gi.exports=du});var zi=I((nl,fe)=>{"use strict";p();var Vi=(sr(),O(ir)),yu=(cr(),O(ur)).Stream,mu=$i(), -Ki=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, -xu=32768;function vu(r){return(r&Su)==xu}a(vu,"isRegFile");var De=["host","port", -"database","user","password"],fr=De.length,Eu=De[fr-1];function pr(){var r=rt instanceof -yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` -`);rt.write(Ki.format.apply(Ki,e))}}a(pr,"warn");Object.defineProperty(fe.exports, +this._writableState.errorEmitted=!1,s(i)},n}a(wu,"split");Vi.exports=wu});var Ji=I((ml,fe)=>{"use strict";p();var Yi=(sr(),N(ir)),bu=(cr(),N(ur)).Stream,Su=zi(), +Zi=(Ge(),N(He)),xu=5432,yt=m.platform==="win32",rt=m.stderr,vu=56,Eu=7,_u=61440, +Au=32768;function Cu(r){return(r&_u)==Au}a(Cu,"isRegFile");var De=["host","port", +"database","user","password"],fr=De.length,Tu=De[fr-1];function pr(){var r=rt instanceof +bu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` +`);rt.write(Zi.format.apply(Zi,e))}}a(pr,"warn");Object.defineProperty(fe.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});fe. exports.warnTo=function(r){var e=rt;return rt=r,e};fe.exports.getFileName=function(r){ -var e=r||m.env,t=e.PGPASSFILE||(yt?Vi.join(e.APPDATA||"./","postgresql","pgpass.\ -conf"):Vi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ +var e=r||m.env,t=e.PGPASSFILE||(yt?Yi.join(e.APPDATA||"./","postgresql","pgpass.\ +conf"):Yi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",vu(r.mode)?r.mode&(wu|bu)?(pr('WARNING: password file "%s" has group or \ +",Cu(r.mode)?r.mode&(vu|Eu)?(pr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(pr('WARNING:\ - password file "%s" is not a plain file',e),!1))};var _u=fe.exports.match=function(r,e){ -return De.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( + password file "%s" is not a plain file',e),!1))};var Iu=fe.exports.match=function(r,e){ +return De.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||xu)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};fe.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[Eu],i.end())} +var n,i=e.pipe(Su());function s(c){var h=Pu(c);h&&Lu(h)&&Iu(r,h)&&(n=h[Tu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), pr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. -on("data",s).on("end",o).on("error",u)};var Au=fe.exports.parseLine=function(r){ +on("data",s).on("end",o).on("error",u)};var Pu=fe.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, -u=!1,c=a(function(l,d,b){var C=r.substring(d,b);Object.hasOwnProperty.call(m.env, -"PGPASS_NO_DEESCAPE")||(C=C.replace(/\\([:\\])/g,"$1")),o[De[l]]=C},"addToObj"), +u=!1,c=a(function(l,d,S){var _=r.substring(d,S);Object.hasOwnProperty.call(m.env, +"PGPASS_NO_DEESCAPE")||(_=_.replace(/\\([:\\])/g,"$1")),o[De[l]]=_},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== -fr?o:null,o},Cu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. +fr?o:null,o},Lu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. length>0},1:function(o){return o==="*"?!0:(o=Number(o),isFinite(o)&&o>0&&o<9007199254740992&& Math.floor(o)===o)},2:function(o){return o.length>0},3:function(o){return o.length> 0},4:function(o){return o.length>0}},t=0;t{"use strict";p();var ol=(sr(),O(ir)),Yi=(ar(),O(or)),mt=zi(); -dr.exports=function(r,e){var t=mt.getFileName();Yi.stat(t,function(n,i){if(n||!mt. -usePgPass(i,t))return e(void 0);var s=Yi.createReadStream(t);mt.getPassword(r,s, -e)})};dr.exports.warnTo=mt.warnTo});var wt=I((cl,Ji)=>{"use strict";p();var Tu=Xe();function gt(r){this._types=r||Tu, +"",s=n(i);if(!s)return!1}return!0}});var es=I((Sl,dr)=>{"use strict";p();var bl=(sr(),N(ir)),Xi=(ar(),N(or)),mt=Ji(); +dr.exports=function(r,e){var t=mt.getFileName();Xi.stat(t,function(n,i){if(n||!mt. +usePgPass(i,t))return e(void 0);var s=Xi.createReadStream(t);mt.getPassword(r,s, +e)})};dr.exports.warnTo=mt.warnTo});var wt=I((vl,ts)=>{"use strict";p();var Bu=Xe();function gt(r){this._types=r||Bu, this.text={},this.binary={}}a(gt,"TypeOverrides");gt.prototype.getOverrides=function(r){ switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}}; gt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| -"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};Ji.exports=gt});var Xi={};se(Xi,{default:()=>Iu});var Iu,es=te(()=>{"use strict";p();Iu={}});var ts={};se(ts,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ +"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};ts.exports=gt});var rs={};ie(rs,{default:()=>Ru});var Ru,ns=z(()=>{"use strict";p();Ru={}});var is={};ie(is,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let C=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ -href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:L,hash:b}}var mr=te(()=>{"use strict";p();a(yr,"parse")});var ns=I((yl,rs)=>{"use strict";p();var Pu=(mr(),O(ts)),gr=(ar(),O(or));function wr(r){ -if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. +search:l,searchParams:d,hash:S}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( +i),h=decodeURIComponent(h);let _=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ +href:r,protocol:t,auth:_,username:i,password:s,host:o,hostname:u,port:c,pathname:h, +search:l,query:L,hash:S}}var mr=z(()=>{"use strict";p();a(yr,"parse")});var os=I((Il,ss)=>{"use strict";p();var Fu=(mr(),N(is)),gr=(ar(),N(or));function wr(r){ +if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Fu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- 1]);var i=(e.auth||":").split(":");if(t.user=i[0],t.password=i.splice(1).join(":"), @@ -860,45 +864,45 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=gr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(wr,"parse");rs.exports=wr;wr.parse=wr});var bt=I((wl,os)=>{"use strict";p();var Lu=(es(),O(Xi)),ss=et(),is=ns().parse,V=a( +return t}a(wr,"parse");ss.exports=wr;wr.parse=wr});var bt=I((Bl,cs)=>{"use strict";p();var Mu=(ns(),N(rs)),us=et(),as=os().parse,K=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||ss[r]},"val"),Bu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||us[r]},"val"),ku=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": -return{rejectUnauthorized:!1}}return ss.ssl},"readSSLConfigFromEnvironment"),Ue=a( +return{rejectUnauthorized:!1}}return us.ssl},"readSSLConfigFromEnvironment"),Ue=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ -teParamValue"),ie=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Ue(n))},"ad\ -d"),Sr=class Sr{constructor(e){e=typeof e=="string"?is(e):e||{},e.connectionString&& -(e=Object.assign({},e,is(e.connectionString))),this.user=V("user",e),this.database= -V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( -V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, -enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Bu():e.ssl,typeof this.ssl=="st\ +teParamValue"),ne=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Ue(n))},"ad\ +d"),Sr=class Sr{constructor(e){e=typeof e=="string"?as(e):e||{},e.connectionString&& +(e=Object.assign({},e,as(e.connectionString))),this.user=K("user",e),this.database= +K("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( +K("port",e),10),this.host=K("host",e),Object.defineProperty(this,"password",{configurable:!0, +enumerable:!1,writable:!0,value:K("password",e)}),this.binary=K("binary",e),this. +options=K("options",e),this.ssl=typeof e.ssl>"u"?ku():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. -client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. -isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=V("applicatio\ -n_name",e,"PGAPPNAME"),this.fallback_application_name=V("fallback_application_na\ -me",e,!1),this.statement_timeout=V("statement_timeout",e,!1),this.lock_timeout=V( -"lock_timeout",e,!1),this.idle_in_transaction_session_timeout=V("idle_in_transac\ -tion_session_timeout",e,!1),this.query_timeout=V("query_timeout",e,!1),e.connectionTimeoutMillis=== +client_encoding=K("client_encoding",e),this.replication=K("replication",e),this. +isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=K("applicatio\ +n_name",e,"PGAPPNAME"),this.fallback_application_name=K("fallback_application_na\ +me",e,!1),this.statement_timeout=K("statement_timeout",e,!1),this.lock_timeout=K( +"lock_timeout",e,!1),this.idle_in_transaction_session_timeout=K("idle_in_transac\ +tion_session_timeout",e,!1),this.query_timeout=K("query_timeout",e,!1),e.connectionTimeoutMillis=== void 0?this.connect_timeout=m.env.PGCONNECT_TIMEOUT||0:this.connect_timeout=Math. floor(e.connectionTimeoutMillis/1e3),e.keepAlive===!1?this.keepalives=0:e.keepAlive=== !0&&(this.keepalives=1),typeof e.keepAliveInitialDelayMillis=="number"&&(this.keepalives_idle= Math.floor(e.keepAliveInitialDelayMillis/1e3))}getLibpqConnectionString(e){var t=[]; -ie(t,this,"user"),ie(t,this,"password"),ie(t,this,"port"),ie(t,this,"application\ -_name"),ie(t,this,"fallback_application_name"),ie(t,this,"connect_timeout"),ie(t, +ne(t,this,"user"),ne(t,this,"password"),ne(t,this,"port"),ne(t,this,"application\ +_name"),ne(t,this,"fallback_application_name"),ne(t,this,"connect_timeout"),ne(t, this,"options");var n=typeof this.ssl=="object"?this.ssl:this.ssl?{sslmode:this. -ssl}:{};if(ie(t,n,"sslmode"),ie(t,n,"sslca"),ie(t,n,"sslkey"),ie(t,n,"sslcert"), -ie(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ue(this.database)),this.replication&& +ssl}:{};if(ne(t,n,"sslmode"),ne(t,n,"sslca"),ne(t,n,"sslkey"),ne(t,n,"sslcert"), +ne(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ue(this.database)),this.replication&& t.push("replication="+Ue(this.replication)),this.host&&t.push("host="+Ue(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Ue(this.client_encoding)),Lu.lookup(this.host,function(i,s){return i? +ent_encoding="+Ue(this.client_encoding)),Mu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Ue(s)),e(null,t.join(" ")))})}};a(Sr,"ConnectionPa\ -rameters");var br=Sr;os.exports=br});var cs=I((xl,us)=>{"use strict";p();var Ru=Xe(),as=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +rameters");var br=Sr;cs.exports=br});var fs=I((Ml,ls)=>{"use strict";p();var Du=Xe(),hs=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, vr=class vr{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ -var t;e.text?t=as.exec(e.text):t=as.exec(e.command),t&&(this.command=t[1],t[3]?(this. +var t;e.text?t=hs.exec(e.text):t=hs.exec(e.command),t&&(this.command=t[1],t[3]?(this. oid=parseInt(t[2],10),this.rowCount=parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt( t[2],10)))}_parseRowAsArray(e){for(var t=new Array(e.length),n=0,i=e.length;n{"use strict";p();var{EventEmitter:Fu}=ge(),hs=cs(),ls=tt(),_r=class _r extends Fu{constructor(e,t,n){ -super(),e=ls.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. +ext"):this._parsers[t]=Du.getTypeParser(n.dataTypeID,n.format||"text")}}};a(vr,"\ +Result");var xr=vr;ls.exports=xr});var ms=I((Ul,ys)=>{"use strict";p();var{EventEmitter:Uu}=we(),ps=fs(),ds=tt(),_r=class _r extends Uu{constructor(e,t,n){ +super(),e=ds.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& -(this.callback=m.domain.bind(e.callback)),this._result=new hs(this._rowMode,this. +(this.callback=m.domain.bind(e.callback)),this._result=new ps(this._rowMode,this. types),this._results=this._result,this.isPreparedStatement=!1,this._canceledDueToError= !1,this._promise=null}requiresPreparation(){return this.name||this.rows?!0:!this. text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&& -(Array.isArray(this._results)||(this._results=[this._result]),this._result=new hs( +(Array.isArray(this._results)||(this._results=[this._result]),this._result=new ps( this._rowMode,this.types),this._results.push(this._result))}handleRowDescription(e){ this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this. callback||!this.listeners("row").length}handleDataRow(e){let t;if(!this._canceledDueToError){ @@ -937,47 +941,47 @@ name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execut {portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.isPreparedStatement= !0,this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types}); try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this. -binary,valueMapper:ls.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( +binary,valueMapper:ds.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(_r,"Query"); -var Er=_r;fs.exports=Er});var ms={};se(ms,{Socket:()=>_e,isIP:()=>Mu});function Mu(r){return 0}var ys,ds,v, -_e,St=te(()=>{"use strict";p();ys=Te(ge(),1);a(Mu,"isIP");ds=/^[^.]+\./,v=class v extends ys.EventEmitter{constructor(){ -super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); -_(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ -troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? -v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ -v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +var Er=_r;ys.exports=Er});var bs={};ie(bs,{Socket:()=>Ae,isIP:()=>Ou});function Ou(r){return 0}var ws,gs,E, +Ae,St=z(()=>{"use strict";p();ws=Te(we(),1);a(Ou,"isIP");gs=/^[^.]+\./,E=class E extends ws.EventEmitter{constructor(){ +super(...arguments);A(this,"opts",{});A(this,"connecting",!1);A(this,"pending",!0); +A(this,"writable",!0);A(this,"encrypted",!1);A(this,"authorized",!1);A(this,"des\ +troyed",!1);A(this,"ws",null);A(this,"writeBuffer");A(this,"tlsState",0);A(this, +"tlsRead");A(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ +E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ -v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? -v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. -wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. -opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? -v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? -v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? -v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ -v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ -return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. -rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ +E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? +E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. +wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. +opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? +E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? +E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? +E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ +E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ +return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. +rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -1016,12 +1020,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( -(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api\ +!0,this.end()}};a(E,"Socket"),A(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(gs,"apiauth."):s=t.replace(gs,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(v,"opts",{});_e=v});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),A(E,"opts",{});Ae=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1047,11 +1051,11 @@ arameterDescriptionMessage");var Lr=Hr;T.ParameterDescriptionMessage=Lr;var Gr=c this.length=e,this.parameterName=t,this.parameterValue=n,this.name="parameterSta\ tus"}};a(Gr,"ParameterStatusMessage");var Br=Gr;T.ParameterStatusMessage=Br;var $r=class $r{constructor(e,t){ this.length=e,this.salt=t,this.name="authenticationMD5Password"}};a($r,"Authenti\ -cationMD5Password");var Rr=$r;T.AuthenticationMD5Password=Rr;var Vr=class Vr{constructor(e,t,n){ -this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Vr, -"BackendKeyDataMessage");var Fr=Vr;T.BackendKeyDataMessage=Fr;var Kr=class Kr{constructor(e,t,n,i){ +cationMD5Password");var Rr=$r;T.AuthenticationMD5Password=Rr;var Kr=class Kr{constructor(e,t,n){ +this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Kr, +"BackendKeyDataMessage");var Fr=Kr;T.BackendKeyDataMessage=Fr;var Vr=class Vr{constructor(e,t,n,i){ this.length=e,this.processId=t,this.channel=n,this.payload=i,this.name="notifica\ -tion"}};a(Kr,"NotificationResponseMessage");var Mr=Kr;T.NotificationResponseMessage= +tion"}};a(Vr,"NotificationResponseMessage");var Mr=Vr;T.NotificationResponseMessage= Mr;var zr=class zr{constructor(e,t){this.length=e,this.status=t,this.name="ready\ ForQuery"}};a(zr,"ReadyForQueryMessage");var kr=zr;T.ReadyForQueryMessage=kr;var Yr=class Yr{constructor(e,t){ this.length=e,this.text=t,this.name="commandComplete"}};a(Yr,"CommandCompleteMes\ @@ -1059,7 +1063,7 @@ sage");var Dr=Yr;T.CommandCompleteMessage=Dr;var Zr=class Zr{constructor(e,t){th length=e,this.fields=t,this.name="dataRow",this.fieldCount=t.length}};a(Zr,"Data\ RowMessage");var Ur=Zr;T.DataRowMessage=Ur;var Jr=class Jr{constructor(e,t){this. length=e,this.message=t,this.name="notice"}};a(Jr,"NoticeMessage");var Or=Jr;T.NoticeMessage= -Or});var gs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); +Or});var Ss=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); xt.Writer=void 0;var tn=class tn{constructor(e=256){this.size=e,this.offset=5,this. headerPosition=0,this.buffer=y.allocUnsafe(e)}ensure(e){var t=this.buffer.length- this.offset;if(t>1)+e;this.buffer=y.allocUnsafe( @@ -1075,44 +1079,44 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(tn,"Wr\ -iter");var en=tn;xt.Writer=en});var bs=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); -Et.serialize=void 0;var rn=gs(),M=new rn.Writer,ku=a(r=>{M.addInt16(3).addInt16( +iter");var en=tn;xt.Writer=en});var vs=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); +Et.serialize=void 0;var rn=Ss(),M=new rn.Writer,Nu=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new rn. -Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); -return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Uu=a(r=>M. -addCString(r).flush(112),"password"),Ou=a(function(r,e){return M.addCString(r).addInt32( -y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Nu=a( -function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),qu=a( -r=>M.addCString(r).flush(81),"query"),ws=[],Qu=a(r=>{let e=r.name||"";e.length>63&& +Writer().addInt32(t).add(e).flush()},"startup"),qu=a(()=>{let r=y.allocUnsafe(8); +return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Qu=a(r=>M. +addCString(r).flush(112),"password"),Wu=a(function(r,e){return M.addCString(r).addInt32( +y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),ju=a( +function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),Hu=a( +r=>M.addCString(r).flush(81),"query"),xs=[],Gu=a(r=>{let e=r.name||"";e.length>63&& (console.error("Warning! Postgres only supports 63 characters for query names."), console.error("You supplied %s (%s)",e,e.length),console.error("This can cause c\ -onflicts and silent errors executing queries"));let t=r.types||ws;for(var n=t.length, +onflicts and silent errors executing queries"));let t=r.types||xs;for(var n=t.length, i=M.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| -"",n=r.binary||!1,i=r.values||ws,s=i.length;return M.addCString(e).addCString(t), -M.addInt16(s),Wu(i,r.valueMapper),M.addInt16(s),M.add(Oe.flush()),M.addInt16(n?1: -0),M.flush(66)},"bind"),Hu=y.from([69,0,0,0,9,0,0,0,0,0]),Gu=a(r=>{if(!r||!r.portal&& -!r.rows)return Hu;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. +n)),Oe.addString(n))}},"writeValues"),Ku=a((r={})=>{let e=r.portal||"",t=r.statement|| +"",n=r.binary||!1,i=r.values||xs,s=i.length;return M.addCString(e).addCString(t), +M.addInt16(s),$u(i,r.valueMapper),M.addInt16(s),M.add(Oe.flush()),M.addInt16(n?1: +0),M.flush(66)},"bind"),Vu=y.from([69,0,0,0,9,0,0,0,0,0]),zu=a(r=>{if(!r||!r.portal&& +!r.rows)return Vu;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]= -0,s.writeUInt32BE(t,s.length-4),s},"execute"),$u=a((r,e)=>{let t=y.allocUnsafe(16); +0,s.writeUInt32BE(t,s.length-4),s},"execute"),Yu=a((r,e)=>{let t=y.allocUnsafe(16); return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE( r,8),t.writeInt32BE(e,12),t},"cancel"),nn=a((r,e)=>{let n=4+y.byteLength(e)+1,i=y. allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i}, -"cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), -zu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( -r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),Zu=a(r=>M.add(r).flush( -100),"copyData"),Ju=a(r=>nn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),Xu=vt(72),ec=vt(83),tc=vt(88),rc=vt(99),nc={startup:ku,password:Uu, -requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, -parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( -()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, -cancel:$u};Et.serialize=nc});var Ss=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); -_t.BufferReader=void 0;var ic=y.allocUnsafe(0),on=class on{constructor(e=0){this. -offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. +"cstringMessage"),Zu=M.addCString("P").flush(68),Ju=M.addCString("S").flush(68), +Xu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?Zu:Ju,"describe"),ec=a( +r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),tc=a(r=>M.add(r).flush( +100),"copyData"),rc=a(r=>nn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),nc=vt(72),ic=vt(83),sc=vt(88),oc=vt(99),ac={startup:Nu,password:Qu, +requestSsl:qu,sendSASLInitialResponseMessage:Wu,sendSCRAMClientFinalMessage:ju,query:Hu, +parse:Gu,bind:Ku,execute:zu,describe:Xu,close:ec,flush:a(()=>nc,"flush"),sync:a( +()=>ic,"sync"),end:a(()=>sc,"end"),copyData:tc,copyDone:a(()=>oc,"copyDone"),copyFail:rc, +cancel:Yu};Et.serialize=ac});var Es=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +_t.BufferReader=void 0;var uc=y.allocUnsafe(0),on=class on{constructor(e=0){this. +offset=e,this.buffer=uc,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= 2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this. buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer. @@ -1120,14 +1124,14 @@ toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstrin let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(on,"BufferReader");var sn=on;_t.BufferReader= -sn});var Es=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var k=Xr(),sc=Ss(),an=1,oc=4,xs=an+oc,vs=y.allocUnsafe(0),cn=class cn{constructor(e){ -if(this.buffer=vs,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, +sn});var Cs=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); +At.Parser=void 0;var k=Xr(),cc=Es(),an=1,hc=4,_s=an+hc,As=y.allocUnsafe(0),cn=class cn{constructor(e){ +if(this.buffer=As,this.bufferLength=0,this.bufferOffset=0,this.reader=new cc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, -i=this.bufferOffset;for(;i+xs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( -i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+xs,s,o,this.buffer);t(c),i+=u}else -break}i===n?(this.buffer=vs,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= +i=this.bufferOffset;for(;i+_s<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( +i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+_s,s,o,this.buffer);t(c),i+=u}else +break}i===n?(this.buffer=As,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer. @@ -1184,16 +1188,16 @@ this.reader.cstring(),o=this.reader.string(1);let u=s.M,c=i==="notice"?new k.Not t,u):new k.DatabaseError(u,t,i);return c.severity=s.S,c.code=s.C,c.detail=s.D,c. hint=s.H,c.position=s.P,c.internalPosition=s.p,c.internalQuery=s.q,c.where=s.W,c. schema=s.s,c.table=s.t,c.column=s.c,c.dataType=s.d,c.constraint=s.n,c.file=s.F,c. -line=s.L,c.routine=s.R,c}};a(cn,"Parser");var un=cn;At.Parser=un});var hn=I(be=>{"use strict";p();Object.defineProperty(be,"__esModule",{value:!0}); -be.DatabaseError=be.serialize=be.parse=void 0;var ac=Xr();Object.defineProperty( -be,"DatabaseError",{enumerable:!0,get:a(function(){return ac.DatabaseError},"get")}); -var uc=bs();Object.defineProperty(be,"serialize",{enumerable:!0,get:a(function(){ -return uc.serialize},"get")});var cc=Es();function hc(r,e){let t=new cc.Parser;return r. -on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");be. -parse=hc});var _s={};se(_s,{connect:()=>lc});function lc({socket:r,servername:e}){return r. -startTls(e),r}var As=te(()=>{"use strict";p();a(lc,"connect")});var pn=I((zl,Is)=>{"use strict";p();var Cs=(St(),O(ms)),fc=ge().EventEmitter,{parse:pc, -serialize:q}=hn(),Ts=q.flush(),dc=q.sync(),yc=q.end(),fn=class fn extends fc{constructor(e){ -super(),e=e||{},this.stream=e.stream||new Cs.Socket,this._keepAlive=e.keepAlive, +line=s.L,c.routine=s.R,c}};a(cn,"Parser");var un=cn;At.Parser=un});var hn=I(Se=>{"use strict";p();Object.defineProperty(Se,"__esModule",{value:!0}); +Se.DatabaseError=Se.serialize=Se.parse=void 0;var lc=Xr();Object.defineProperty( +Se,"DatabaseError",{enumerable:!0,get:a(function(){return lc.DatabaseError},"get")}); +var fc=vs();Object.defineProperty(Se,"serialize",{enumerable:!0,get:a(function(){ +return fc.serialize},"get")});var pc=Cs();function dc(r,e){let t=new pc.Parser;return r. +on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(dc,"parse");Se. +parse=dc});var Ts={};ie(Ts,{connect:()=>yc});function yc({socket:r,servername:e}){return r. +startTls(e),r}var Is=z(()=>{"use strict";p();a(yc,"connect")});var pn=I((cf,Bs)=>{"use strict";p();var Ps=(St(),N(bs)),mc=we().EventEmitter,{parse:gc, +serialize:Q}=hn(),Ls=Q.flush(),wc=Q.sync(),bc=Q.end(),fn=class fn extends mc{constructor(e){ +super(),e=e||{},this.stream=e.stream||new Ps.Socket,this._keepAlive=e.keepAlive, this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.lastBuffer= !1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this._emitMessage= !1;var t=this;this.on("newListener",function(n){n==="message"&&(t._emitMessage=!0)})}connect(e,t){ @@ -1206,36 +1210,36 @@ ssl)return this.attachListeners(this.stream);this.stream.once("data",function(s) var o=s.toString("utf8");switch(o){case"S":break;case"N":return n.stream.end(),n. emit("error",new Error("The server does not support SSL connections"));default:return n. stream.end(),n.emit("error",new Error("There was an error establishing an SSL co\ -nnection"))}var u=(As(),O(_s));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( -c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Cs.isIP(t)===0&&(c.servername=t);try{ +nnection"))}var u=(Is(),N(Ts));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( +c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Ps.isIP(t)===0&&(c.servername=t);try{ n.stream=u.connect(c)}catch(h){return n.emit("error",h)}n.attachListeners(n.stream), n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){e.on("end",()=>{ -this.emit("end")}),pc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& -this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(q.requestSsl())}startup(e){ -this.stream.write(q.startup(e))}cancel(e,t){this._send(q.cancel(e,t))}password(e){ -this._send(q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(q.sendSASLInitialResponseMessage( -e,t))}sendSCRAMClientFinalMessage(e){this._send(q.sendSCRAMClientFinalMessage(e))}_send(e){ -return this.stream.writable?this.stream.write(e):!1}query(e){this._send(q.query( -e))}parse(e){this._send(q.parse(e))}bind(e){this._send(q.bind(e))}execute(e){this. -_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ts)}sync(){this. -_ending=!0,this._send(Ts),this._send(dc)}ref(){this.stream.ref()}unref(){this.stream. +this.emit("end")}),gc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& +this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(Q.requestSsl())}startup(e){ +this.stream.write(Q.startup(e))}cancel(e,t){this._send(Q.cancel(e,t))}password(e){ +this._send(Q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(Q.sendSASLInitialResponseMessage( +e,t))}sendSCRAMClientFinalMessage(e){this._send(Q.sendSCRAMClientFinalMessage(e))}_send(e){ +return this.stream.writable?this.stream.write(e):!1}query(e){this._send(Q.query( +e))}parse(e){this._send(Q.parse(e))}bind(e){this._send(Q.bind(e))}execute(e){this. +_send(Q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ls)}sync(){this. +_ending=!0,this._send(Ls),this._send(wc)}ref(){this.stream.ref()}unref(){this.stream. unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. -stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ -this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ -this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Is.exports=ln});var Bs=I((Xl,Ls)=>{"use strict";p();var mc=ge().EventEmitter,Jl=(Ge(),O(He)),gc=tt(), -dn=qi(),wc=Zi(),bc=wt(),Sc=bt(),Ps=ps(),xc=et(),vc=pn(),yn=class yn extends mc{constructor(e){ -super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. +stream.end();return}return this.stream.write(bc,()=>{this.stream.end()})}close(e){ +this._send(Q.close(e))}describe(e){this._send(Q.describe(e))}sendCopyFromChunk(e){ +this._send(Q.copyData(e))}endCopyFrom(){this._send(Q.copyDone())}sendCopyFail(e){ +this._send(Q.copyFail(e))}};a(fn,"Connection");var ln=fn;Bs.exports=ln});var Ms=I((pf,Fs)=>{"use strict";p();var Sc=we().EventEmitter,ff=(Ge(),N(He)),xc=tt(), +dn=ji(),vc=es(),Ec=wt(),_c=bt(),Rs=ms(),Ac=et(),Cc=pn(),yn=class yn extends Sc{constructor(e){ +super(),this.connectionParameters=new _c(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}), this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= -t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= +t.Promise||b.Promise,this._types=new Ec(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new vc({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new Cc({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. -binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. +binary||Ac.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}), this._connectionTimeoutMillis=t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=a( n=>{m.nextTick(()=>{n.handleError(e,this.connection)})},"enqueueError");this.activeQuery&& @@ -1273,10 +1277,10 @@ let t=this.connection;typeof this.password=="function"?this._Promise.resolve().t ()=>this.password()).then(n=>{if(n!==void 0){if(typeof n!="string"){t.emit("erro\ r",new TypeError("Password must be a string"));return}this.connectionParameters. password=this.password=n}else this.connectionParameters.password=this.password=null; -e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():wc(this.connectionParameters, +e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():vc(this.connectionParameters, n=>{n!==void 0&&(this.connectionParameters.password=this.password=n),e()})}_handleAuthCleartextPassword(e){ this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){ -this._checkPgPass(()=>{let t=gc.postgresMd5PasswordHash(this.user,this.password, +this._checkPgPass(()=>{let t=xc.postgresMd5PasswordHash(this.user,this.password, e.salt);this.connection.password(t)})}_handleAuthSASL(e){this._checkPgPass(()=>{ this.saslSession=dn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( this.saslSession.mechanism,this.saslSession.response)})}_handleAuthSASLContinue(e){ @@ -1322,8 +1326,8 @@ e&&m.nextTick(()=>{this.activeQuery.handleError(e,this.connection),this.readyFor emit("drain"))}query(e,t,n){var i,s,o,u,c;if(e==null)throw new TypeError("Client\ was passed a null or undefined query");return typeof e.submit=="function"?(o=e. query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& -(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Ps( -e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,b)=>d?l(d):h(b)}))), +(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Rs( +e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,S)=>d?l(d):h(S)}))), o&&(c=i.callback,u=setTimeout(()=>{var h=new Error("Query read timeout");m.nextTick( ()=>{i.handleError(h,this.connection)}),c(h),i.callback=()=>{};var l=this.queryQueue. indexOf(i);l>-1&&this.queryQueue.splice(l,1),this._pulseQueryQueue()},o),i.callback= @@ -1337,18 +1341,18 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(yn,"Client");var Ct=yn;Ct.Query= -Ps;Ls.exports=Ct});var ks=I((rf,Ms)=>{"use strict";p();var Ec=ge().EventEmitter,Rs=a(function(){},"\ -NOOP"),Fs=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, +Rs;Fs.exports=Ct});var Os=I((mf,Us)=>{"use strict";p();var Tc=we().EventEmitter,ks=a(function(){},"\ +NOOP"),Ds=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),wn=class wn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(wn,"IdleItem");var mn=wn,bn=class bn{constructor(e){this.callback= -e}};a(bn,"PendingItem");var Ne=bn;function _c(){throw new Error("Release called \ -on client which has already been released to the pool.")}a(_c,"throwOnDoubleRele\ +e}};a(bn,"PendingItem");var Ne=bn;function Ic(){throw new Error("Release called \ +on client which has already been released to the pool.")}a(Ic,"throwOnDoubleRele\ ase");function Tt(r,e){if(e)return{callback:e,result:void 0};let t,n,i=a(function(o,u){ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.captureStackTrace( -o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ +o),o});return{callback:i,result:s}}a(Tt,"promisify");function Pc(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Ac,"makeIdleListener");var Sn=class Sn extends Ec{constructor(e,t){ +"idleListener")}a(Pc,"makeIdleListener");var Sn=class Sn extends Tc{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1356,7 +1360,7 @@ this.options.max=this.options.max||this.options.poolSize||10,this.options.maxUse this.options.maxUses||1/0,this.options.allowExitOnIdle=this.options.allowExitOnIdle|| !1,this.options.maxLifetimeSeconds=this.options.maxLifetimeSeconds||0,this.log=this. options.log||function(){},this.Client=this.options.Client||t||It().Client,this.Promise= -this.options.Promise||S.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this. +this.options.Promise||b.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this. options.idleTimeoutMillis=1e4),this._clients=[],this._idle=[],this._expired=new WeakSet, this._pendingQueue=[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_isFull(){ return this._clients.length>=this.options.max}_pulseQueue(){if(this.log("pulse q\ @@ -1367,25 +1371,25 @@ _pendingQueue.length){this.log("no queued requests");return}if(!this._idle.lengt this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let t=this. _idle.pop();clearTimeout(t.timeoutId);let n=t.client;n.ref&&n.ref();let i=t.idleListener; return this._acquireClient(n,e,i,!1)}if(!this._isFull())return this.newClient(e); -throw new Error("unexpected condition")}_remove(e){let t=Fs(this._idle,n=>n.client=== +throw new Error("unexpected condition")}_remove(e){let t=Ds(this._idle,n=>n.client=== e);t!==void 0&&clearTimeout(t.timeoutId),this._clients=this._clients.filter(n=>n!== e),e.end(),this.emit("remove",e)}connect(e){if(this.ending){let i=new Error("Can\ not use a pool after calling end on the pool");return e?e(i):this.Promise.reject( i)}let t=Tt(this.Promise,e),n=t.result;if(this._isFull()||this._idle.length){if(this. _idle.length&&m.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis) return this._pendingQueue.push(new Ne(t.callback)),n;let i=a((u,c,h)=>{clearTimeout( -o),t.callback(u,c,h)},"queueCallback"),s=new Ne(i),o=setTimeout(()=>{Fs(this._pendingQueue, +o),t.callback(u,c,h)},"queueCallback"),s=new Ne(i),o=setTimeout(()=>{Ds(this._pendingQueue, u=>u.callback===i),s.timedOut=!0,t.callback(new Error("timeout exceeded when try\ ing to connect"))},this.options.connectionTimeoutMillis);return this._pendingQueue. push(s),n}return this.newClient(new Ne(t.callback)),n}newClient(e){let t=new this. -Client(this.options);this._clients.push(t);let n=Ac(this,t);this.log("checking c\ +Client(this.options);this._clients.push(t);let n=Pc(this,t);this.log("checking c\ lient timeout");let i,s=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{ this.log("ending client due to timeout"),s=!0,t.connection?t.connection.stream.destroy(): t.end()},this.options.connectionTimeoutMillis)),this.log("connecting new client"), t.connect(o=>{if(i&&clearTimeout(i),t.on("error",n),o)this.log("client failed to\ connect",o),this._clients=this._clients.filter(u=>u!==t),s&&(o.message="Connect\ ion terminated due to connection timeout"),this._pulseQueue(),e.timedOut||e.callback( -o,void 0,Rs);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== +o,void 0,ks);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== 0){let u=setTimeout(()=>{this.log("ending client due to expired lifetime"),this. _expired.add(t),this._idle.findIndex(h=>h.client===t)!==-1&&this._acquireClient( t,new Ne((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.once( @@ -1393,8 +1397,8 @@ t,new Ne((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.o i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n), e.removeListener("error",n),t.timedOut?i&&this.options.verify?this.options.verify( e,e.release):e.release():i&&this.options.verify?this.options.verify(e,s=>{if(s)return e. -release(s),t.callback(s,void 0,Rs);t.callback(void 0,e,e.release)}):t.callback(void 0, -e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&_c(),n=!0,this._release(e, +release(s),t.callback(s,void 0,ks);t.callback(void 0,e,e.release)}):t.callback(void 0, +e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&Ic(),n=!0,this._release(e, t,i)}}_release(e,t,n){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1, this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>= this.options.maxUses){e._poolUseCount>=this.options.maxUses&&this.log("remove ex\ @@ -1416,7 +1420,7 @@ this.Promise.reject(n)}this.ending=!0;let t=Tt(this.Promise,e);return this._endC t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue. length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients. reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients. -length}};a(Sn,"Pool");var gn=Sn;Ms.exports=gn});var Ds={};se(Ds,{default:()=>Cc});var Cc,Us=te(()=>{"use strict";p();Cc={}});var Os=I((af,Tc)=>{Tc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ +length}};a(Sn,"Pool");var gn=Sn;Us.exports=gn});var Ns={};ie(Ns,{default:()=>Lc});var Lc,qs=z(()=>{"use strict";p();Lc={}});var Qs=I((Sf,Bc)=>{Bc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ client - pure javascript & libpq with the same API",keywords:["database","libpq", "pg","postgre","postgres","postgresql","rdbms"],homepage:"https://github.com/bri\ anc/node-postgres",repository:{type:"git",url:"git://github.com/brianc/node-post\ @@ -1427,16 +1431,16 @@ pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:" 4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ "pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ .md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ -7b9a5491a178655"}});var Qs=I((uf,qs)=>{"use strict";p();var Ns=ge().EventEmitter,Ic=(Ge(),O(He)),xn=tt(), -qe=qs.exports=function(r,e,t){Ns.call(this),r=xn.normalizeQueryConfig(r,e,t),this. +7b9a5491a178655"}});var Hs=I((xf,js)=>{"use strict";p();var Ws=we().EventEmitter,Rc=(Ge(),N(He)),xn=tt(), +qe=js.exports=function(r,e,t){Ws.call(this),r=xn.normalizeQueryConfig(r,e,t),this. text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ -newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Ic.inherits( -qe,Ns);var Pc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ +newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Rc.inherits( +qe,Ws);var Fc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ age",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"\ dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"\ routine"};qe.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); -if(e)for(var t in e){var n=Pc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. +if(e)for(var t in e){var n=Fc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. emit("error",r),this.state="error"};qe.prototype.then=function(r,e){return this. _getPromise().then(r,e)};qe.prototype.catch=function(r){return this._getPromise(). catch(r)};qe.prototype._getPromise=function(){return this._promise?this._promise: @@ -1458,30 +1462,30 @@ this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. values.map(xn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Gs=I((ff,Hs)=>{"use strict";p();var Lc=(Us(),O(Ds)),Bc=wt(),lf=Os(),Ws=ge(). -EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),js=Qs(),Z=Hs.exports=function(r){Ws.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Bc(r.types),this.native= -new Lc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= -!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( +text,t)}});var Vs=I((Af,Ks)=>{"use strict";p();var Mc=(qs(),N(Ns)),kc=wt(),_f=Qs(),Gs=we(). +EventEmitter,Dc=(Ge(),N(He)),Uc=bt(),$s=Hs(),J=Ks.exports=function(r){Gs.call(this), +r=r||{},this._Promise=r.Promise||b.Promise,this._types=new kc(r.types),this.native= +new Mc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Uc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= -e.port,this.namedQueries={}};Z.Query=js;Rc.inherits(Z,Ws);Z.prototype._errorAllQueries= +e.port,this.namedQueries={}};J.Query=$s;Dc.inherits(J,Gs);J.prototype._errorAllQueries= function(r){let e=a(t=>{m.nextTick(()=>{t.native=this.native,t.handleError(r)})}, "enqueueError");this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery= -null),this._queryQueue.forEach(e),this._queryQueue.length=0};Z.prototype._connect= +null),this._queryQueue.forEach(e),this._queryQueue.length=0};J.prototype._connect= function(r){var e=this;if(this._connecting){m.nextTick(()=>r(new Error("Client h\ as already been connected. You cannot reuse a client.")));return}this._connecting= !0,this.connectionParameters.getLibpqConnectionString(function(t,n){if(t)return r( t);e.native.connect(n,function(i){if(i)return e.native.end(),r(i);e._connected=!0, e.native.on("error",function(s){e._queryable=!1,e._errorAllQueries(s),e.emit("er\ ror",s)}),e.native.on("notification",function(s){e.emit("notification",{channel:s. -relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};Z. +relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};J. prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise( -(e,t)=>{this._connect(n=>{n?t(n):e()})})};Z.prototype.query=function(r,e,t){var n, +(e,t)=>{this._connect(n=>{n?t(n):e()})})};J.prototype.query=function(r,e,t){var n, i,s,o,u;if(r==null)throw new TypeError("Client was passed a null or undefined qu\ ery");if(typeof r.submit=="function")s=r.query_timeout||this.connectionParameters. query_timeout,i=n=r,typeof e=="function"&&(r.callback=e);else if(s=this.connectionParameters. -query_timeout,n=new js(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= +query_timeout,n=new $s(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= l,h=d}),n.callback=(l,d)=>l?h(l):c(d)}return s&&(u=n.callback,o=setTimeout(()=>{ var c=new Error("Query read timeout");m.nextTick(()=>{n.handleError(c,this.connection)}), u(c),n.callback=()=>{};var h=this._queryQueue.indexOf(n);h>-1&&this._queryQueue. @@ -1490,148 +1494,148 @@ this._queryable?this._ending?(n.native=this.native,m.nextTick(()=>{n.handleError new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.push( n),this._pulseQueryQueue(),i):(n.native=this.native,m.nextTick(()=>{n.handleError( new Error("Client has encountered a connection error and is not queryable"))}),i)}; -Z.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( +J.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( "connect",this.end.bind(this,r));var t;return r||(t=new this._Promise(function(n,i){ r=a(s=>s?i(s):n(),"cb")})),this.native.end(function(){e._errorAllQueries(new Error( -"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};Z.prototype. +"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};J.prototype. _hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="\ -error"&&this._activeQuery.state!=="end"};Z.prototype._pulseQueryQueue=function(r){ +error"&&this._activeQuery.state!=="end"};J.prototype._pulseQueryQueue=function(r){ if(this._connected&&!this._hasActiveQuery()){var e=this._queryQueue.shift();if(!e){ r||this.emit("drain");return}this._activeQuery=e,e.submit(this);var t=this;e.once( -"_done",function(){t._pulseQueryQueue()})}};Z.prototype.cancel=function(r){this. +"_done",function(){t._pulseQueryQueue()})}};J.prototype.cancel=function(r){this. _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== --1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; -Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. -_types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var vn=I((yf,$s)=>{"use strict";p();$s.exports=Gs()});var It=I((gf,nt)=>{"use strict";p();var Mc=Bs(),kc=et(),Dc=pn(),Uc=ks(),{DatabaseError:Oc}=hn(), -Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ -ool"),e},"poolFactory"),En=a(function(r){this.defaults=kc,this.Client=r,this.Query= -this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. -types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new En(vn()):(nt.exports=new En(Mc),Object.defineProperty(nt.exports,"na\ +-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};J.prototype.ref=function(){}; +J.prototype.unref=function(){};J.prototype.setTypeParser=function(r,e,t){return this. +_types.setTypeParser(r,e,t)};J.prototype.getTypeParser=function(r,e){return this. +_types.getTypeParser(r,e)}});var vn=I((If,zs)=>{"use strict";p();zs.exports=Vs()});var It=I((Lf,nt)=>{"use strict";p();var Oc=Ms(),Nc=et(),qc=pn(),Qc=Os(),{DatabaseError:Wc}=hn(), +jc=a(r=>{var e;return e=class extends Qc{constructor(n){super(n,r)}},a(e,"BoundP\ +ool"),e},"poolFactory"),En=a(function(r){this.defaults=Nc,this.Client=r,this.Query= +this.Client.Query,this.Pool=jc(this.Client),this._pools=[],this.Connection=qc,this. +types=Xe(),this.DatabaseError=Wc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. +exports=new En(vn()):(nt.exports=new En(Oc),Object.defineProperty(nt.exports,"na\ tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new En(vn())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});p();var Lt=Te(It());St();p();St();mr();var zs=Te(tt()),Ys=Te(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ -rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", -"NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); -_(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ -ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, -"constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ +native",{value:r}),r}}))});p();var Lt=Te(It());St();p();St();mr();var Js=Te(tt()),Xs=Te(wt());function Hc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(Hc,"encodeBuffe\ +rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);A(this,"name", +"NeonDbError");A(this,"severity");A(this,"code");A(this,"detail");A(this,"hint"); +A(this,"position");A(this,"internalPosition");A(this,"internalQuery");A(this,"wh\ +ere");A(this,"schema");A(this,"table");A(this,"column");A(this,"dataType");A(this, +"constraint");A(this,"file");A(this,"line");A(this,"routine");A(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. -captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,Vs="transaction() exp\ -ects an array of queries, or a function returning an array of queries",Qc=["seve\ +captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,Ys="transaction() exp\ +ects an array of queries, or a function returning an array of queries",Gc=["seve\ rity","code","detail","hint","position","internalPosition","internalQuery","wher\ -e","schema","table","column","dataType","constraint","file","line","routine"];function Zs(r,{ +e","schema","table","column","dataType","constraint","file","line","routine"];function eo(r,{ arrayMode:e,fullResults:t,fetchOptions:n,isolationLevel:i,readOnly:s,deferrable:o, queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data\ base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=yr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:b,hostname:C,port:L,pathname:Q}=l;if(d!=="postgres:"&&d!== -"postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ - `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ -let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;Wqc((0,zs.prepareValue)(W)));let D={ -query:P,params:g};return u&&u(D),Wc(de,D,K)}a(J,"resolve"),J.transaction=async(A,g)=>{ -if(typeof A=="function"&&(A=A(J)),!Array.isArray(A))throw new Error(Vs);A.forEach( -D=>{if(D[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Vs)});let P=A. -map(D=>D.parameterizedQuery),K=A.map(D=>D.opts??{});return de(P,K,g)};async function de(A,g,P){ -let{fetchEndpoint:K,fetchFunction:D}=_e,W=Array.isArray(A)?{queries:A}:A,X=n??{}, -oe=e??!1,R=t??!1,$=i,ce=s,ye=o;P!==void 0&&(P.fetchOptions!==void 0&&(X={...X,...P. -fetchOptions}),P.arrayMode!==void 0&&(oe=P.arrayMode),P.fullResults!==void 0&&(R= -P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& -(ce=P.readOnly),P.deferrable!==void 0&&(ye=P.deferrable)),g!==void 0&&!Array.isArray( -g)&&g.fetchOptions!==void 0&&(X={...X,...g.fetchOptions});let Se=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(Se=g.authToken);let We=typeof K=="function"?K(C,L,{jwtAuth:Se!== -void 0}):K,he={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ -ray-Mode":"true"},it=await jc(Se);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( -A)&&($!==void 0&&(he["Neon-Batch-Isolation-Level"]=$),ce!==void 0&&(he["Neon-Bat\ -ch-Read-Only"]=String(ce)),ye!==void 0&&(he["Neon-Batch-Deferrable"]=String(ye))); -let ee;try{ee=await(D??fetch)(We,{method:"POST",body:JSON.stringify(W),headers:he, -...X})}catch(j){let H=new pe(`Error connecting to database: ${j}`);throw H.sourceError= -j,H}if(ee.ok){let j=await ee.json();if(Array.isArray(A)){let H=j.results;if(!Array. -isArray(H))throw new pe("Neon internal error: unexpected result format");return H. -map((Ae,xe)=>{let Bt=g[xe]??{},eo=Bt.arrayMode??oe,to=Bt.fullResults??R;return Ks( -Ae,{arrayMode:eo,fullResults:to,parameterizedQuery:A[xe],resultCallback:c,types:Bt. -types})})}else{let H=g??{},Ae=H.arrayMode??oe,xe=H.fullResults??R;return Ks(j,{arrayMode:Ae, -fullResults:xe,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; -if(j===400){let H=await ee.json(),Ae=new pe(H.message);for(let xe of Qc)Ae[xe]=H[xe]?? -void 0;throw Ae}else{let H=await ee.text();throw new pe(`Server error (HTTP stat\ -us ${j}): ${H}`)}}}return a(de,"execute"),J}a(Zs,"neon");function Wc(r,e,t){return{ +let{protocol:d,username:S,hostname:_,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== +"postgresql:"||!S||!_||!G)throw new Error("Database connection string format for\ + `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(C,...g){ +let P,W;if(typeof C=="string")P=C,W=g[1],g=g[0]??[];else{P="";for(let j=0;jHc((0,Js.prepareValue)(j)));let U={ +query:P,params:g};return u&&u(U),$c(se,U,W)}a(X,"resolve"),X.transaction=async(C,g)=>{ +if(typeof C=="function"&&(C=C(X)),!Array.isArray(C))throw new Error(Ys);C.forEach( +U=>{if(U[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Ys)});let P=C. +map(U=>U.parameterizedQuery),W=C.map(U=>U.opts??{});return se(P,W,g)};async function se(C,g,P){ +let{fetchEndpoint:W,fetchFunction:U}=Ae,j=Array.isArray(C)?{queries:C}:C,ee=n??{}, +oe=e??!1,R=t??!1,$=i,ce=s,de=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, +...P.fetchOptions}),P.arrayMode!==void 0&&(oe=P.arrayMode),P.fullResults!==void 0&& +(R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& +(ce=P.readOnly),P.deferrable!==void 0&&(de=P.deferrable)),g!==void 0&&!Array.isArray( +g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let xe=h;!Array.isArray( +g)&&g?.authToken!==void 0&&(xe=g.authToken);let We=typeof W=="function"?W(_,L,{jwtAuth:xe!== +void 0}):W,he={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ +ray-Mode":"true"},it=await Kc(xe);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( +C)&&($!==void 0&&(he["Neon-Batch-Isolation-Level"]=$),ce!==void 0&&(he["Neon-Bat\ +ch-Read-Only"]=String(ce)),de!==void 0&&(he["Neon-Batch-Deferrable"]=String(de))); +let ye;try{ye=await(U??fetch)(We,{method:"POST",body:JSON.stringify(j),headers:he, +...ee})}catch(V){let D=new pe(`Error connecting to database: ${V}`);throw D.sourceError= +V,D}if(ye.ok){let V=await ye.json();if(Array.isArray(C)){let D=V.results;if(!Array. +isArray(D))throw new pe("Neon internal error: unexpected result format");return D. +map((me,ve)=>{let Bt=g[ve]??{},no=Bt.arrayMode??oe,io=Bt.fullResults??R;return Zs( +me,{arrayMode:no,fullResults:io,parameterizedQuery:C[ve],resultCallback:c,types:Bt. +types})})}else{let D=g??{},me=D.arrayMode??oe,ve=D.fullResults??R;return Zs(V,{arrayMode:me, +fullResults:ve,parameterizedQuery:C,resultCallback:c,types:D.types})}}else{let{status:V}=ye; +if(V===400){let D=await ye.json(),me=new pe(D.message);for(let ve of Gc)me[ve]=D[ve]?? +void 0;throw me}else{let D=await ye.text();throw new pe(`Server error (HTTP stat\ +us ${V}): ${D}`)}}}return a(se,"execute"),X}a(eo,"neon");function $c(r,e,t){return{ [Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a((n,i)=>r( e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r(e,t).finally( -n),"finally")}}a(Wc,"createNeonQueryPromise");function Ks(r,{arrayMode:e,fullResults:t, -parameterizedQuery:n,resultCallback:i,types:s}){let o=new Ys.default(s),u=r.fields. +n),"finally")}}a($c,"createNeonQueryPromise");function Zs(r,{arrayMode:e,fullResults:t, +parameterizedQuery:n,resultCallback:i,types:s}){let o=new Xs.default(s),u=r.fields. map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e===!0?r.rows. -map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries(l.map( -(d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), -t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ks,"\ -processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== +map(l=>l.map((d,S)=>d===null?null:c[S](d))):r.rows.map(l=>Object.fromEntries(l.map( +(d,S)=>[u[S],d===null?null:c[S](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), +t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Zs,"\ +processQueryResult");async function Kc(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new pe("Error ge\ tting auth token.");throw e instanceof Error&&(t=new pe(`Error getting auth toke\ -n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Te(bt()),Qe=Te(It());var An=class An extends Lt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ -return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& -(this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ -SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ - + forceDisablePgSSL = false) and the WebSocket tunnel (useSecureWebSocket = tru\ -e). Double encryption will increase latency and CPU usage. It may be appropriate\ - to disable SSL in the Postgres connection parameters or set forceDisablePgSSL =\ - true.");let i=this.config?.host!==void 0||this.config?.connectionString!==void 0|| -m.env.PGHOST!==void 0,s=m.env.USER??m.env.USERNAME;if(!i&&this.host==="localhost"&& -this.user===s&&this.database===s&&this.password===null)throw new Error(`No datab\ -ase host or connection string was set, and key parameters have default values (h\ -ost: localhost, user: ${s}, db: ${s}, password: null). Is an environment variabl\ -e missing? Alternatively, if you intended to connect with these parameters, plea\ -se set the host to 'localhost' explicitly.`);let o=super.connect(t),u=n.pipelineTLS&& -this.ssl,c=n.pipelineConnect==="password";if(!u&&!n.pipelineConnect)return o;let h=this. -connection;if(u&&h.on("connect",()=>h.stream.emit("data","S")),c){h.removeAllListeners( -"authenticationCleartextPassword"),h.removeAllListeners("readyForQuery"),h.once( -"readyForQuery",()=>h.on("readyForQuery",this._handleReadyForQuery.bind(this))); -let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassword(), -this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=this. -saslSession,i=this.password,s=t.data;if(n.message!=="SASLInitialResponse"||typeof i!= -"string"||typeof s!="string")throw new Error("SASL: protocol error");let o=Object. -fromEntries(s.split(",").map(ee=>{if(!/^.=/.test(ee))throw new Error("SASL: Inva\ -lid attribute pair entry");let j=ee[0],H=ee.substring(2);return[j,H]})),u=o.r,c=o. -s,h=o.i;if(!u||!/^[!-+--~]+$/.test(u))throw new Error("SASL: SCRAM-SERVER-FIRST-\ -MESSAGE: nonce missing/unprintable");if(!c||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ -64");if(!h||!/^[1-9][0-9]*$/.test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-M\ -ESSAGE: missing/invalid iteration count");if(!u.startsWith(n.clientNonce))throw new Error( +n: ${e.message}`)),t}}a(Kc,"getAuthToken");var ro=Te(bt()),Qe=Te(It());var Vc="node:crypto",An=class An extends Lt.Client{constructor(t){super(t);this. +config=t}get neonConfig(){return this.connection.stream}connect(t){let{neonConfig:n}=this; +n.forceDisablePgSSL&&(this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&& +console.warn("SSL is enabled for both Postgres (e.g. ?sslmode=require in the con\ +nection string + forceDisablePgSSL = false) and the WebSocket tunnel (useSecureW\ +ebSocket = true). Double encryption will increase latency and CPU usage. It may \ +be appropriate to disable SSL in the Postgres connection parameters or set force\ +DisablePgSSL = true.");let i=this.config?.host!==void 0||this.config?.connectionString!== +void 0||m.env.PGHOST!==void 0,s=m.env.USER??m.env.USERNAME;if(!i&&this.host==="l\ +ocalhost"&&this.user===s&&this.database===s&&this.password===null)throw new Error( +`No database host or connection string was set, and key parameters have default \ +values (host: localhost, user: ${s}, db: ${s}, password: null). Is an environmen\ +t variable missing? Alternatively, if you intended to connect with these paramet\ +ers, please set the host to 'localhost' explicitly.`);let o=super.connect(t),u=n. +pipelineTLS&&this.ssl,c=n.pipelineConnect==="password";if(!u&&!n.pipelineConnect) +return o;let h=this.connection;if(u&&h.on("connect",()=>h.stream.emit("data","S")), +c){h.removeAllListeners("authenticationCleartextPassword"),h.removeAllListeners( +"readyForQuery"),h.once("readyForQuery",()=>h.on("readyForQuery",this._handleReadyForQuery. +bind(this)));let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassword(), +this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=typeof w< +"u"&&w.subtle!==void 0&&w.subtle.importKey!==void 0?w.subtle:(await import(Vc)). +webcrypto.subtle,i=this.saslSession,s=this.password,o=t.data;if(i.message!=="SAS\ +LInitialResponse"||typeof s!="string"||typeof o!="string")throw new Error("SASL:\ + protocol error");let u=Object.fromEntries(o.split(",").map(V=>{if(!/^.=/.test(V)) +throw new Error("SASL: Invalid attribute pair entry");let D=V[0],me=V.substring( +2);return[D,me]})),c=u.r,h=u.s,l=u.i;if(!c||!/^[!-+--~]+$/.test(c))throw new Error( +"SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable");if(!h||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ +64");if(!l||!/^[1-9][0-9]*$/.test(l))throw new Error("SASL: SCRAM-SERVER-FIRST-M\ +ESSAGE: missing/invalid iteration count");if(!c.startsWith(i.clientNonce))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); -if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ -SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, -C=b.encode(i),L=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ -6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",L,y.concat([d,y.from( -[0,0,0,1])]))),J=Q;for(var de=0;deJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. -subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", -P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,oe=D+","+W+ -","+X,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, -["sign"]);var $=new Uint8Array(await w.subtle.sign("HMAC",R,b.encode(oe))),ce=y. -from(P.map((ee,j)=>P[j]^$[j])),ye=ce.toString("base64");let Se=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),We=await w.subtle.sign( -"HMAC",Se,b.encode("Server Key")),he=await w.subtle.importKey("raw",We,{name:"HM\ -AC",hash:{name:"SHA-256"}},!1,["sign"]);var it=y.from(await w.subtle.sign("HMAC", -he,b.encode(oe)));n.message="SASLResponse",n.serverSignature=it.toString("base64"), -n.response=X+",p="+ye,this.connection.sendSCRAMClientFinalMessage(this.saslSession. -response)}};a(An,"NeonClient");var _n=An;function Hc(r,e){if(e)return{callback:e, +if(c.length===i.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ +SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),_=new TextEncoder, +L=_.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, +["sign"]),X=new Uint8Array(await n.sign("HMAC",G,y.concat([S,y.from([0,0,0,1])]))), +se=X;for(var C=0;Cse[D]^X[D]));let g=se,P=await n.importKey("raw",g,{name:"HMAC",hash:{ +name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,_.encode("C\ +lient Key"))),U=await n.digest("SHA-256",W),j="n=*,r="+i.clientNonce,ee="r="+c+"\ +,s="+h+",i="+d,oe="c=biws,r="+c,R=j+","+ee+","+oe,$=await n.importKey("raw",U,{name:"\ +HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var ce=new Uint8Array(await n.sign("HM\ +AC",$,_.encode(R))),de=y.from(W.map((V,D)=>W[D]^ce[D])),xe=de.toString("base64"); +let We=await n.importKey("raw",g,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]), +he=await n.sign("HMAC",We,_.encode("Server Key")),it=await n.importKey("raw",he, +{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var ye=y.from(await n.sign("HMA\ +C",it,_.encode(R)));i.message="SASLResponse",i.serverSignature=ye.toString("base\ +64"),i.response=oe+",p="+xe,this.connection.sendSCRAMClientFinalMessage(this.saslSession. +response)}};a(An,"NeonClient");var _n=An;function zc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var Cn=class Cn extends Lt.Pool{constructor(){ -super(...arguments);_(this,"Client",_n);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ +n=o,t=u});return{callback:i,result:s}}a(zc,"promisify");var Cn=class Cn extends Lt.Pool{constructor(){ +super(...arguments);A(this,"Client",_n);A(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ -if(!_e.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Hc(this.Promise, -i);i=s.callback;try{let o=new Xs.default(this.options),u=encodeURIComponent,c=encodeURI, +if(!Ae.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") +return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=zc(this.Promise, +i);i=s.callback;try{let o=new ro.default(this.options),u=encodeURIComponent,c=encodeURI, h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== -"string"?t:t.text,d=n??t.values??[];Zs(h,{fullResults:!0,arrayMode:t.rowMode==="\ -array"})(l,d,{types:t.types??this.options?.types}).then(C=>i(void 0,C)).catch(C=>i( -C))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var Js=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; +"string"?t:t.text,d=n??t.values??[];eo(h,{fullResults:!0,arrayMode:t.rowMode==="\ +array"})(l,d,{types:t.types??this.options?.types}).then(_=>i(void 0,_)).catch(_=>i( +_))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var to=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; var export_Query=Qe.Query;var export_defaults=Qe.defaults;var export_types=Qe.types; export{_n as Client,export_ClientBase as ClientBase,export_Connection as Connection, -export_DatabaseError as DatabaseError,pe as NeonDbError,Js as Pool,export_Query as Query, -export_defaults as defaults,Zs as neon,_e as neonConfig,export_types as types}; +export_DatabaseError as DatabaseError,pe as NeonDbError,to as Pool,export_Query as Query, +export_defaults as defaults,eo as neon,Ae as neonConfig,export_types as types}; /*! Bundled license information: ieee754/index.js: diff --git a/dist/npm/index.d.mts b/dist/npm/index.d.mts index 791327f..c503ef4 100644 --- a/dist/npm/index.d.mts +++ b/dist/npm/index.d.mts @@ -1,5 +1,7 @@ /// +/// + import { Client as Client_2 } from 'pg'; import { ClientBase } from 'pg'; import { Connection } from 'pg'; @@ -514,7 +516,20 @@ declare namespace subtls { hexFromU8, stableStringify, startTls, + stdCharCodes, u8FromHex, + allKeyUsages, + ASN1Bytes, + Bytes, + Cert, + CertJSON, + DataRequest, + DistinguishedName, + OID, + ReadQueue, + RootCertsData, + RootCertsDatabase, + RootCertsIndex, SocketReadQueue, TrustedCert, WebSocketReadQueue diff --git a/dist/npm/index.d.ts b/dist/npm/index.d.ts index 791327f..c503ef4 100644 --- a/dist/npm/index.d.ts +++ b/dist/npm/index.d.ts @@ -1,5 +1,7 @@ /// +/// + import { Client as Client_2 } from 'pg'; import { ClientBase } from 'pg'; import { Connection } from 'pg'; @@ -514,7 +516,20 @@ declare namespace subtls { hexFromU8, stableStringify, startTls, + stdCharCodes, u8FromHex, + allKeyUsages, + ASN1Bytes, + Bytes, + Cert, + CertJSON, + DataRequest, + DistinguishedName, + OID, + ReadQueue, + RootCertsData, + RootCertsDatabase, + RootCertsIndex, SocketReadQueue, TrustedCert, WebSocketReadQueue diff --git a/dist/npm/index.js b/dist/npm/index.js index 0a381ca..68bf68f 100644 --- a/dist/npm/index.js +++ b/dist/npm/index.js @@ -1,46 +1,46 @@ -"use strict";var ro=Object.create;var Te=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var ao=(r,e,t)=>e in r?Te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): -r[e]=t;var a=(r,e)=>Te(r,"name",{value:e,configurable:!0});var te=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),re=(r,e)=>{for(var t in e) +"use strict";var io=Object.create;var Te=Object.defineProperty;var so=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var ao=Object.getPrototypeOf,uo=Object.prototype.hasOwnProperty;var co=(r,e,t)=>e in r?Te(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): +r[e]=t;var a=(r,e)=>Te(r,"name",{value:e,configurable:!0});var z=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),te=(r,e)=>{for(var t in e) Te(r,t,{get:e[t],enumerable:!0})},Pn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== -"function")for(let i of io(e))!oo.call(r,i)&&i!==t&&Te(r,i,{get:()=>e[i],enumerable:!(n= -no(e,i))||n.enumerable});return r};var Ie=(r,e,t)=>(t=r!=null?ro(so(r)):{},Pn(e||!r||!r.__esModule?Te(t,"default",{ -value:r,enumerable:!0}):t,r)),O=r=>Pn(Te({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Rn=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= -yo;var ue=[],ne=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Ft="ABCDEFGHIJKLMNO\ -PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_e=0,Ln=Ft.length;_ee[i],enumerable:!(n= +so(e,i))||n.enumerable});return r};var Ie=(r,e,t)=>(t=r!=null?io(ao(r)):{},Pn(e||!r||!r.__esModule?Te(t,"default",{ +value:r,enumerable:!0}):t,r)),N=r=>Pn(Te({},"__esModule",{value:!0}),r);var A=(r,e,t)=>co(r,typeof e!="symbol"?e+"":e,t);var Rn=I(st=>{"use strict";p();st.byteLength=lo;st.toByteArray=po;st.fromByteArray= +go;var ue=[],re=[],ho=typeof Uint8Array<"u"?Uint8Array:Array,Ft="ABCDEFGHIJKLMNO\ +PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ae=0,Ln=Ft.length;Ae0)throw new Error("Invalid string. Length must be a multip\ le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Bn, -"getLens");function co(r){var e=Bn(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(co,"byte\ -Length");function ho(r,e,t){return(e+t)*3/4-t}a(ho,"_byteLength");function lo(r){ -var e,t=Bn(r),n=t[0],i=t[1],s=new uo(ho(r,n,i)),o=0,u=i>0?n-4:n,c;for(c=0;c0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e= -ne[r.charCodeAt(c)]<<2|ne[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=ne[r.charCodeAt( -c)]<<10|ne[r.charCodeAt(c+1)]<<4|ne[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= -e&255),s}a(lo,"toByteArray");function fo(r){return ue[r>>18&63]+ue[r>>12&63]+ue[r>> -6&63]+ue[r&63]}a(fo,"tripletToBase64");function po(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ue[e>>2]+ +re[r.charCodeAt(c)]<<2|re[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=re[r.charCodeAt( +c)]<<10|re[r.charCodeAt(c+1)]<<4|re[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= +e&255),s}a(po,"toByteArray");function yo(r){return ue[r>>18&63]+ue[r>>12&63]+ue[r>> +6&63]+ue[r&63]}a(yo,"tripletToBase64");function mo(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ue[e>>2]+ ue[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ue[e>>10]+ue[e>>4&63]+ue[e<< -2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Fn=I(Mt=>{p();Mt.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> -1,l=-7,d=t?i-1:0,b=t?-1:1,C=r[e+d];for(d+=b,s=C&(1<<-l)-1,C>>=-l,l+=u;l>0;s=s*256+ -r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== -0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? +2&63]+"=")),i.join("")}a(go,"fromByteArray")});var Fn=I(Mt=>{p();Mt.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> +1,l=-7,d=t?i-1:0,S=t?-1:1,_=r[e+d];for(d+=S,s=_&(1<<-l)-1,_>>=-l,l+=u;l>0;s=s*256+ +r[e+d],d+=S,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=S,l-=8);if(s=== +0)s=1-h;else{if(s===c)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(_? -1:1)*o*Math.pow(2,s-n)};Mt.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,L=n?1:-1,Q=e<0|| +h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,L=n?1:-1,G=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. -floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=b/c:e+= -b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=L,u/=256, -i-=8);for(o=o<0;r[t+C]=o&255,C+=L,o/=256,h-=8);r[t+C-L]|=Q*128}});var Yn=I(Re=>{"use strict";p();var kt=Rn(),Le=Fn(),Mn=typeof Symbol=="function"&& +floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=S/c:e+= +S*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+_]=u&255,_+=L,u/=256, +i-=8);for(o=o<0;r[t+_]=o&255,_+=L,o/=256,h-=8);r[t+_-L]|=G*128}});var Yn=I(Re=>{"use strict";p();var kt=Rn(),Le=Fn(),Mn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Re.Buffer= -f;Re.SlowBuffer=xo;Re.INSPECT_MAX_BYTES=50;var ot=2147483647;Re.kMaxLength=ot;f. -TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. +f;Re.SlowBuffer=Eo;Re.INSPECT_MAX_BYTES=50;var ot=2147483647;Re.kMaxLength=ot;f. +TYPED_ARRAY_SUPPORT=wo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ -rowser support.");function mo(){try{let r=new Uint8Array(1),e={foo:a(function(){ +rowser support.");function wo(){try{let r=new Uint8Array(1),e={foo:a(function(){ return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf( -r,e),r.foo()===42}catch{return!1}}a(mo,"typedArraySupport");Object.defineProperty( +r,e),r.foo()===42}catch{return!1}}a(wo,"typedArraySupport");Object.defineProperty( f.prototype,"parent",{enumerable:!0,get:a(function(){if(f.isBuffer(this))return this. buffer},"get")});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:a( function(){if(f.isBuffer(this))return this.byteOffset},"get")});function pe(r){if(r> @@ -48,14 +48,14 @@ ot)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e= r);return Object.setPrototypeOf(e,f.prototype),e}a(pe,"createBuffer");function f(r,e,t){ if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" a\ rgument must be of type string. Received type number');return Nt(r)}return On(r, -e,t)}a(f,"Buffer");f.poolSize=8192;function On(r,e,t){if(typeof r=="string")return wo( -r,e);if(ArrayBuffer.isView(r))return bo(r);if(r==null)throw new TypeError("The f\ +e,t)}a(f,"Buffer");f.poolSize=8192;function On(r,e,t){if(typeof r=="string")return So( +r,e);if(ArrayBuffer.isView(r))return xo(r);if(r==null)throw new TypeError("The f\ irst argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-l\ ike Object. Received type "+typeof r);if(ce(r,ArrayBuffer)||r&&ce(r.buffer,ArrayBuffer)|| typeof SharedArrayBuffer<"u"&&(ce(r,SharedArrayBuffer)||r&&ce(r.buffer,SharedArrayBuffer))) return Ut(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ must not be of type number. Received type number');let n=r.valueOf&&r.valueOf(); -if(n!=null&&n!==r)return f.from(n,e,t);let i=So(r);if(i)return i;if(typeof Symbol< +if(n!=null&&n!==r)return f.from(n,e,t);let i=vo(r);if(i)return i;if(typeof Symbol< "u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return f. from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argumen\ t must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. \ @@ -63,27 +63,27 @@ Received type "+typeof r)}a(On,"from");f.from=function(r,e,t){return On(r,e,t)}; Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f, Uint8Array);function Nn(r){if(typeof r!="number")throw new TypeError('"size" arg\ ument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is\ - invalid for option "size"')}a(Nn,"assertSize");function go(r,e,t){return Nn(r), -r<=0?pe(r):e!==void 0?typeof t=="string"?pe(r).fill(e,t):pe(r).fill(e):pe(r)}a(go, -"alloc");f.alloc=function(r,e,t){return go(r,e,t)};function Nt(r){return Nn(r),pe( + invalid for option "size"')}a(Nn,"assertSize");function bo(r,e,t){return Nn(r), +r<=0?pe(r):e!==void 0?typeof t=="string"?pe(r).fill(e,t):pe(r).fill(e):pe(r)}a(bo, +"alloc");f.alloc=function(r,e,t){return bo(r,e,t)};function Nt(r){return Nn(r),pe( r<0?0:qt(r)|0)}a(Nt,"allocUnsafe");f.allocUnsafe=function(r){return Nt(r)};f.allocUnsafeSlow= -function(r){return Nt(r)};function wo(r,e){if((typeof e!="string"||e==="")&&(e="\ +function(r){return Nt(r)};function So(r,e){if((typeof e!="string"||e==="")&&(e="\ utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=qn(r,e)| -0,n=pe(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(wo,"fromString");function Dt(r){ +0,n=pe(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(So,"fromString");function Dt(r){ let e=r.length<0?0:qt(r.length)|0,t=pe(e);for(let n=0;n= +Array.isArray(r.data))return Dt(r.data)}a(vo,"fromObject");function qt(r){if(r>= ot)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ -ot.toString(16)+" bytes");return r|0}a(qt,"checked");function xo(r){return+r!=r&& -(r=0),f.alloc(+r)}a(xo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. +ot.toString(16)+" bytes");return r|0}a(qt,"checked");function Eo(r){return+r!=r&& +(r=0),f.alloc(+r)}a(Eo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. _isBuffer===!0&&e!==f.prototype},"isBuffer");f.compare=a(function(e,t){if(ce(e,Uint8Array)&& (e=f.from(e,e.offset,e.byteLength)),ce(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)), !f.isBuffer(e)||!f.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments\ @@ -106,24 +106,24 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ot(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return zn(r).length;default:if(i)return n?-1:Ot(r).length;e=(""+e).toLowerCase(), -i=!0}}a(qn,"byteLength");f.byteLength=qn;function vo(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(qn,"byteLength");f.byteLength=qn;function _o(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| -(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( -this,e,t);case"utf8":case"utf-8":return Wn(this,e,t);case"ascii":return Lo(this, -e,t);case"latin1":case"binary":return Bo(this,e,t);case"base64":return Io(this,e, -t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: +(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Mo( +this,e,t);case"utf8":case"utf-8":return Wn(this,e,t);case"ascii":return Ro(this, +e,t);case"latin1":case"binary":return Fo(this,e,t);case"base64":return Lo(this,e, +t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ko(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -vo,"slowToString");f.prototype._isBuffer=!0;function Ae(r,e,t){let n=r[e];r[e]=r[t], -r[t]=n}a(Ae,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) +_o,"slowToString");f.prototype._isBuffer=!0;function Ce(r,e,t){let n=r[e];r[e]=r[t], +r[t]=n}a(Ce,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< -e;t+=2)Ae(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. +e;t+=2)Ce(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bit\ -s");for(let t=0;ti&&(n=i)):n=i;let s=e.length;n> s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)? (n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.wri\ te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return Eo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ -ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, -e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: +hex":return Ao(this,e,t,n);case"utf8":case"utf-8":return Co(this,e,t,n);case"asc\ +ii":case"latin1":case"binary":return To(this,e,t,n);case"base64":return Io(this, +e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Po(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ write");f.prototype.toJSON=a(function(){return{type:"Buffer",data:Array.prototype. -slice.call(this._arr||this,0)}},"toJSON");function Io(r,e,t){return e===0&&t===r. -length?kt.fromByteArray(r):kt.fromByteArray(r.slice(e,t))}a(Io,"base64Slice");function Wn(r,e,t){ +slice.call(this._arr||this,0)}},"toJSON");function Lo(r,e,t){return e===0&&t===r. +length?kt.fromByteArray(r):kt.fromByteArray(r.slice(e,t))}a(Lo,"base64Slice");function Wn(r,e,t){ t=Math.min(r.length,t);let n=[],i=e;for(;i239?4:s>223? 3:s>191?2:1;if(i+u<=t){let c,h,l,d;switch(u){case 1:s<128&&(o=s);break;case 2:c= r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[i+ @@ -180,125 +180,125 @@ r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)=== 128&&(l&192)===128&&(d=(s&15)<<18|(c&63)<<12|(h&63)<<6|l&63,d>65535&&d<1114112&& (o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320| -o&1023),n.push(o),i+=u}return Po(n)}a(Wn,"utf8Slice");var Dn=4096;function Po(r){ +o&1023),n.push(o),i+=u}return Bo(n)}a(Wn,"utf8Slice");var Dn=4096;function Bo(r){ let e=r.length;if(e<=Dn)return String.fromCharCode.apply(String,r);let t="",n=0; -for(;nn)&&(t=n);let i="";for(let s=e;sn)&&(t=n);let i="";for(let s=e;sn&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),tt)throw new RangeError( -"Trying to access beyond buffer length")}a(N,"checkOffset");f.prototype.readUintLE= -f.prototype.readUIntLE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e], +"Trying to access beyond buffer length")}a(q,"checkOffset");f.prototype.readUintLE= +f.prototype.readUIntLE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this.length);let i=this[e], s=1,o=0;for(;++o>>0,t=t>>>0,n||N(e,t,this. +readUintBE=f.prototype.readUIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this. length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]*s;return i},"re\ adUIntBE");f.prototype.readUint8=f.prototype.readUInt8=a(function(e,t){return e= -e>>>0,t||N(e,1,this.length),this[e]},"readUInt8");f.prototype.readUint16LE=f.prototype. -readUInt16LE=a(function(e,t){return e=e>>>0,t||N(e,2,this.length),this[e]|this[e+ +e>>>0,t||q(e,1,this.length),this[e]},"readUInt8");f.prototype.readUint16LE=f.prototype. +readUInt16LE=a(function(e,t){return e=e>>>0,t||q(e,2,this.length),this[e]|this[e+ 1]<<8},"readUInt16LE");f.prototype.readUint16BE=f.prototype.readUInt16BE=a(function(e,t){ -return e=e>>>0,t||N(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");f.prototype. -readUint32LE=f.prototype.readUInt32LE=a(function(e,t){return e=e>>>0,t||N(e,4,this. +return e=e>>>0,t||q(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");f.prototype. +readUint32LE=f.prototype.readUInt32LE=a(function(e,t){return e=e>>>0,t||q(e,4,this. length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE"); f.prototype.readUint32BE=f.prototype.readUInt32BE=a(function(e,t){return e=e>>>0, -t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ -readUInt32BE");f.prototype.readBigUInt64LE=ge(a(function(e){e=e>>>0,Be(e,"offset"); +t||q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ +readUInt32BE");f.prototype.readBigUInt64LE=we(a(function(e){e=e>>>0,Be(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Be(e,"offset");let t=this[e],n=this[e+7]; +readBigUInt64BE=we(a(function(e){e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7]; (t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,n||q(e,t,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*t)),i},"readIntLE");f.prototype. -readIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||N(e,t,this.length);let i=t,s=1,o=this[e+ +readIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this.length);let i=t,s=1,o=this[e+ --i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)), -o},"readIntBE");f.prototype.readInt8=a(function(e,t){return e=e>>>0,t||N(e,1,this. +o},"readIntBE");f.prototype.readInt8=a(function(e,t){return e=e>>>0,t||q(e,1,this. length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8");f.prototype.readInt16LE= -a(function(e,t){e=e>>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return n& +a(function(e,t){e=e>>>0,t||q(e,2,this.length);let n=this[e]|this[e+1]<<8;return n& 32768?n|4294901760:n},"readInt16LE");f.prototype.readInt16BE=a(function(e,t){e=e>>> -0,t||N(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n}, -"readInt16BE");f.prototype.readInt32LE=a(function(e,t){return e=e>>>0,t||N(e,4,this. +0,t||q(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n}, +"readInt16BE");f.prototype.readInt32LE=a(function(e,t){return e=e>>>0,t||q(e,4,this. length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. -readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ -1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=ge(a(function(e){ +readInt32BE=a(function(e,t){return e=e>>>0,t||q(e,4,this.length),this[e]<<24|this[e+ +1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=we(a(function(e){ e=e>>>0,Be(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Be(e,"offset"); +igInt64LE"));f.prototype.readBigInt64BE=we(a(function(e){e=e>>>0,Be(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,t||N(e,4,this.length),Le.read(this,e, +readFloatLE=a(function(e,t){return e=e>>>0,t||q(e,4,this.length),Le.read(this,e, !0,23,4)},"readFloatLE");f.prototype.readFloatBE=a(function(e,t){return e=e>>>0, -t||N(e,4,this.length),Le.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= -a(function(e,t){return e=e>>>0,t||N(e,8,this.length),Le.read(this,e,!0,52,8)},"r\ -eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||N(e,8,this. -length),Le.read(this,e,!1,52,8)},"readDoubleBE");function z(r,e,t,n,i,s){if(!f.isBuffer( +t||q(e,4,this.length),Le.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= +a(function(e,t){return e=e>>>0,t||q(e,8,this.length),Le.read(this,e,!0,52,8)},"r\ +eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||q(e,8,this. +length),Le.read(this,e,!1,52,8)},"readDoubleBE");function Y(r,e,t,n,i,s){if(!f.isBuffer( r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e< s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError( -"Index out of range")}a(z,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= -a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e, +"Index out of range")}a(Y,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= +a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e, t,n,u,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e,t,n,u,0)}let s=n-1, +if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e,t,n,u,0)}let s=n-1, o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n},"writeUI\ ntBE");f.prototype.writeUint8=f.prototype.writeUInt8=a(function(e,t,n){return e= -+e,t=t>>>0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= -f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, ++e,t=t>>>0,n||Y(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= +f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, 65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},"writeUInt16LE");f.prototype.writeUint16BE= -f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, +f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, 65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},"writeUInt16BE");f.prototype.writeUint32LE= -f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,4, +f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,4, 4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+ 4},"writeUInt32LE");f.prototype.writeUint32BE=f.prototype.writeUInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, -this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function jn(r,e,t,n,i){Kn( +return e=+e,t=t>>>0,n||Y(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, +this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function jn(r,e,t,n,i){Vn( e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8, r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]= o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(jn,"wrtBigUInt64LE");function Hn(r,e,t,n,i){ -Kn(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> +Vn(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> 8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+ 3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(Hn,"wrtBigUInt64BE");f. -prototype.writeBigUInt64LE=ge(a(function(e,t=0){return jn(this,e,t,BigInt(0),BigInt( -"0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=ge(a(function(e,t=0){ +prototype.writeBigUInt64LE=we(a(function(e,t=0){return jn(this,e,t,BigInt(0),BigInt( +"0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=we(a(function(e,t=0){ return Hn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); f.prototype.writeIntLE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2, -8*n-1);z(this,e,t,n,c-1,-c)}let s=0,o=1,u=0;for(this[t]=e&255;++s>0)-u&255;return t+n},"writeIntL\ E");f.prototype.writeIntBE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow( -2,8*n-1);z(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= +2,8*n-1);Y(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= 256);)e<0&&u===0&&this[t+s+1]!==0&&(u=1),this[t+s]=(e/o>>0)-u&255;return t+n},"w\ -riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this, +riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this, e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},"writeInt8");f.prototype.writeInt16LE= -a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e&255, +a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e&255, this[t+1]=e>>>8,t+2},"writeInt16LE");f.prototype.writeInt16BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, +return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, t+2},"writeInt16BE");f.prototype.writeInt32LE=a(function(e,t,n){return e=+e,t=t>>> -0,n||z(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= +0,n||Y(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= e>>>16,this[t+3]=e>>>24,t+4},"writeInt32LE");f.prototype.writeInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ +return e=+e,t=t>>>0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ 1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeIn\ -t32BE");f.prototype.writeBigInt64LE=ge(a(function(e,t=0){return jn(this,e,t,-BigInt( +t32BE");f.prototype.writeBigInt64LE=we(a(function(e,t=0){return jn(this,e,t,-BigInt( "0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));f.prototype. -writeBigInt64BE=ge(a(function(e,t=0){return Hn(this,e,t,-BigInt("0x8000000000000\ +writeBigInt64BE=we(a(function(e,t=0){return Hn(this,e,t,-BigInt("0x8000000000000\ 000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Gn(r,e,t,n,i,s){ if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError( "Index out of range")}a(Gn,"checkIEEE754");function $n(r,e,t,n,i){return e=+e,t= t>>>0,i||Gn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Le.write(r,e,t,n, 23,4),t+4}a($n,"writeFloat");f.prototype.writeFloatLE=a(function(e,t,n){return $n( this,e,t,!0,n)},"writeFloatLE");f.prototype.writeFloatBE=a(function(e,t,n){return $n( -this,e,t,!1,n)},"writeFloatBE");function Vn(r,e,t,n,i){return e=+e,t=t>>>0,i||Gn( +this,e,t,!1,n)},"writeFloatBE");function Kn(r,e,t,n,i){return e=+e,t=t>>>0,i||Gn( r,e,t,8,17976931348623157e292,-17976931348623157e292),Le.write(r,e,t,n,52,8),t+8} -a(Vn,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return Vn(this,e, -t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return Vn( +a(Kn,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return Kn(this,e, +t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return Kn( this,e,t,!1,n)},"writeDoubleBE");f.prototype.copy=a(function(e,t,n,i){if(!f.isBuffer( e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i= this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i2**32?i=Un(String(t)):typeof t=="bigint"&&(i=String(t) (t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Un(i)),i+="n"),n+=` It\ must be ${e}. Received ${i}`,n},RangeError);function Un(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(Un,"addNumericalSeparator");function Mo(r,e,t){Be(e,"offset"),(r[e]=== -void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function Kn(r,e,t,n,i,s){ +t)}${e}`}a(Un,"addNumericalSeparator");function Do(r,e,t){Be(e,"offset"),(r[e]=== +void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Do,"checkBounds");function Vn(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Pe.ERR_OUT_OF_RANGE( -"value",u,r)}Mo(n,i,s)}a(Kn,"checkIntBI");function Be(r,e){if(typeof r!="number") +"value",u,r)}Do(n,i,s)}a(Vn,"checkIntBI");function Be(r,e){if(typeof r!="number") throw new Pe.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Be,"validateNumber");function je(r,e,t){ throw Math.floor(r)!==r?(Be(r,t),new Pe.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Pe.ERR_BUFFER_OUT_OF_BOUNDS:new Pe.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? -1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ -if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% -4!==0;)r=r+"=";return r}a(Do,"base64clean");function Ot(r,e){e=e||1/0;let t,n=r. +1:0} and <= ${e}`,r)}a(je,"boundsError");var Uo=/[^+/0-9A-Za-z-_]/g;function Oo(r){ +if(r=r.split("=")[0],r=r.trim().replace(Uo,""),r.length<2)return"";for(;r.length% +4!==0;)r=r+"=";return r}a(Oo,"base64clean");function Ot(r,e){e=e||1/0;let t,n=r. length,i=null,s=[];for(let o=0;o55295&&t<57344){if(!i){ if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&& s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, @@ -351,31 +351,31 @@ s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>> 6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63| 128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}a( -Ot,"utf8ToBytes");function Uo(r){let e=[];for(let t=0;t>8,i=t%256,s.push(i),s.push(n);return s} -a(Oo,"utf16leToBytes");function zn(r){return kt.toByteArray(Do(r))}a(zn,"base64T\ +a(qo,"utf16leToBytes");function zn(r){return kt.toByteArray(Oo(r))}a(zn,"base64T\ oBytes");function at(r,e,t,n){let i;for(i=0;i=e.length||i>=r.length);++i) e[i+t]=r[i];return i}a(at,"blitBuffer");function ce(r,e){return r instanceof e|| r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name} -a(ce,"isInstance");function Wt(r){return r!==r}a(Wt,"numberIsNaN");var No=function(){ +a(ce,"isInstance");function Wt(r){return r!==r}a(Wt,"numberIsNaN");var Qo=function(){ let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< -16;++i)e[n+i]=r[t]+r[i]}return e}();function ge(r){return typeof BigInt>"u"?qo:r} -a(ge,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} -a(qo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +16;++i)e[n+i]=r[t]+r[i]}return e}();function we(r){return typeof BigInt>"u"?Wo:r} +a(we,"defineBigIntMethod");function Wo(){throw new Error("BigInt not supported")} +a(Wo,"BufferBigIntNotDefined")});var b,x,v,w,y,m,p=z(()=>{"use strict";b=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. Buffer.allocUnsafe=="function"?globalThis.Buffer:Yn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= -e.then.bind(e)}});var we=I((rh,jt)=>{"use strict";p();var Fe=typeof Reflect=="object"?Reflect:null, +e.then.bind(e)}});var be=I((oh,jt)=>{"use strict";p();var Fe=typeof Reflect=="object"?Reflect:null, Zn=Fe&&typeof Fe.apply=="function"?Fe.apply:a(function(e,t,n){return Function.prototype. apply.call(e,t,n)},"ReflectApply"),ut;Fe&&typeof Fe.ownKeys=="function"?ut=Fe.ownKeys: Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. -getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& -console.warn(r)}a(Qo,"ProcessEmitWarning");var Xn=Number.isNaN||a(function(e){return e!== +getOwnPropertyNames(e)},"ReflectOwnKeys");function jo(r){console&&console.warn&& +console.warn(r)}a(jo,"ProcessEmitWarning");var Xn=Number.isNaN||a(function(e){return e!== e},"NumberIsNaN");function B(){B.init.call(this)}a(B,"EventEmitter");jt.exports= -B;jt.exports.once=Go;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= +B;jt.exports.once=Ko;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= 0;B.prototype._maxListeners=void 0;var Jn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(B,"defaultMaxLi\ @@ -402,14 +402,14 @@ t,++r._eventsCount;else if(typeof o=="function"?o=s[e]=n?[t,o]:[o,t]:n?o.unshift t):o.push(t),i=ei(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po\ ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ -ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(ti,"_addList\ +ededWarning",u.emitter=r,u.type=e,u.count=o.length,jo(u)}return r}a(ti,"_addList\ ener");B.prototype.addListener=a(function(e,t){return ti(this,e,t,!1)},"addListe\ ner");B.prototype.on=B.prototype.addListener;B.prototype.prependListener=a(function(e,t){ -return ti(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. +return ti(this,e,t,!0)},"prependListener");function Ho(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? -this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, +this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Ho, "onceWrapper");function ri(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ri,"_onceWrap");B.prototype. +listener:t},i=Ho.bind(n);return i.listener=t,n.wrapFn=i,i}a(ri,"_onceWrap");B.prototype. once=a(function(e,t){return ct(t),this.on(e,ri(this,e,t)),this},"once");B.prototype. prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ri(this, e,t)),this},"prependOnceListener");B.prototype.removeListener=a(function(e,t){var n, @@ -417,7 +417,7 @@ i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)retu if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. -listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= +listener,s=o;break}if(s<0)return this;s===0?n.shift():Go(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, "removeListener");B.prototype.off=B.prototype.removeListener;B.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== @@ -429,7 +429,7 @@ o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners( n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length- 1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ni(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?Ho(i):si(i,i.length)}a(ni,"_listeners");B.prototype. +"function"?t?[i.listener||i]:[i]:t?$o(i):si(i,i.length)}a(ni,"_listeners");B.prototype. listeners=a(function(e){return ni(this,e,!0)},"listeners");B.prototype.rawListeners= a(function(e){return ni(this,e,!1)},"rawListeners");B.listenerCount=function(r,e){ return typeof r.listenerCount=="function"?r.listenerCount(e):ii.call(r,e)};B.prototype. @@ -437,66 +437,53 @@ listenerCount=ii;function ii(r){var e=this._events;if(e!==void 0){var t=e[r];if( "function")return 1;if(t!==void 0)return t.length}return 0}a(ii,"listenerCount"); B.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): []},"eventNames");function si(r,e){for(var t=new Array(e),n=0;nVo});var Vo,Ge=te(()=>{"use strict";p();Vo={}});var Ht={};re(Ht,{Md5:()=>Ve,createHash:()=>zo,createHmac:()=>Yo,randomBytes:()=>Ko, -sha256:()=>$e});function Ko(r){return w.getRandomValues(y.alloc(r))}function zo(r){ -if(r==="sha256")return{update:a(function(e){return{digest:a(function(){return y. -from($e(e))},"digest")}},"update")};if(r==="md5")return{update:a(function(e){return{ -digest:a(function(){return typeof e=="string"?Ve.hashStr(e):Ve.hashByteArray(e)}, -"digest")}},"update")};throw new Error(`Hash type '${r}' not supported`)}function Yo(r,e){ -if(r!=="sha256")throw new Error(`Only sha256 is supported (requested: '${r}')`); -return{update:a(function(t){return{digest:a(function(){typeof e=="string"&&(e=new TextEncoder(). -encode(e)),typeof t=="string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n> -64)e=$e(e);else if(n<64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array( -64),s=new Uint8Array(64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array( -t.length+64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u. -set($e(o),64),y.from($e(u))},"digest")}},"update")}}function $e(r){let e=1779033703, -t=3144134277,n=1013904242,i=2773480762,s=1359893119,o=2600822924,u=528734635,c=1541459225, -h=0,l=0,d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748, -2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103, -3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692, -1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993, -338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, -2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909, -275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063, -1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479, -3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),L=new Uint8Array( -64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+ -3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,le=b(C[R- -2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+le|0}let A=e,g=t,P=n,K=i,D=s, -W=o,X=u,ae=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),le=D&W^~D&X,me=ae+ -$+le+d[R]+C[R]|0,ve=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,fe=ve+We|0;ae=X,X=W,W= -D,D=K+me|0,K=P,P=g,g=A,A=me+fe|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, -u=u+X|0,c=c+ae|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). -encode(A));for(let g=0;g{if(L[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)L[l++]=0;Q()}for(;l<58;)L[l++]= -0;let A=h*8;L[l++]=A/1099511627776&255,L[l++]=A/4294967296&255,L[l++]=A>>>24,L[l++]= -A>>>16&255,L[l++]=A>>>8&255,L[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= -e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= -t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= -i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, -g[18]=s>>>8&255,g[19]=s&255,g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]= -o&255,g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]= -c>>>16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r===void 0?{add:J,digest:ye}: -(J(r),ye())}var U,Ve,Gt=te(()=>{"use strict";p();a(Ko,"randomBytes");a(zo,"creat\ -eHash");a(Yo,"createHmac");U=class U{constructor(){_(this,"_dataLength",0);_(this, -"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer",new ArrayBuffer( -68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array(this._buffer, -0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ +ed type '+typeof r)}a(oi,"eventTargetAgnosticAddListener")});var He={};te(He,{default:()=>zo});var zo,Ge=z(()=>{"use strict";p();zo={}});function $e(r){let e=1779033703,t=3144134277,n=1013904242,i=2773480762,s=1359893119, +o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,3049323471, +3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278, +1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078, +604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808, +3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372, +1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800, +3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, +883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, +2361852424,2428436474,2756734187,3204031479,3329325298],S=a((C,g)=>C>>>g|C<<32-g, +"rrot"),_=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, +$+=4)_[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(_[R- +15],7)^S(_[R-15],18)^_[R-15]>>>3,le=S(_[R-2],17)^S(_[R-2],19)^_[R-2]>>>10;_[R]=_[R- +16]+$+_[R-7]+le|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,ae=c;for(let R=0;R<64;R++){let $=S( +U,6)^S(U,11)^S(U,25),le=U&j^~U&ee,ye=ae+$+le+d[R]+_[R]|0,Ee=S(C,2)^S(C,13)^S(C,22), +We=C&g^C&P^g&P,fe=Ee+We|0;ae=ee,ee=j,j=U,U=W+ye|0,W=P,P=g,g=C,C=ye+fe|0}e=e+C|0, +t=t+g|0,n=n+P|0,i=i+W|0,s=s+U|0,o=o+j|0,u=u+ee|0,c=c+ae|0,l=0},"process"),X=a(C=>{ +typeof C=="string"&&(C=new TextEncoder().encode(C));for(let g=0;g{if(L[l++]=128,l==64&&G(),l+8>64){ +for(;l<64;)L[l++]=0;G()}for(;l<58;)L[l++]=0;let C=h*8;L[l++]=C/1099511627776&255, +L[l++]=C/4294967296&255,L[l++]=C>>>24,L[l++]=C>>>16&255,L[l++]=C>>>8&255,L[l++]= +C&255,G();let g=new Uint8Array(32);return g[0]=e>>>24,g[1]=e>>>16&255,g[2]=e>>>8& +255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]=t>>>8&255,g[7]=t&255,g[8]=n>>>24, +g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]=i>>>24,g[13]=i>>>16&255,g[14]= +i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, +g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> +16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, +g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:oe}:(X(r),oe())}var ai=z( +()=>{"use strict";p();a($e,"sha256")});var O,Ke,ui=z(()=>{"use strict";p();O=class O{constructor(){A(this,"_dataLength", +0);A(this,"_bufferLength",0);A(this,"_state",new Int32Array(4));A(this,"_buffer", +new ArrayBuffer(68));A(this,"_buffer8");A(this,"_buffer32");this._buffer8=new Uint8Array( +this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ -return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=U. -hexChars,n=U.hexOut,i,s,o,u;for(u=0;u<4;u+=1)for(s=u*8,i=e[u],o=0;o<8;o+=2)n[s+1+ +return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=O. +hexChars,n=O.hexOut,i,s,o,u;for(u=0;u<4;u+=1)for(s=u*8,i=e[u],o=0;o<8;o+=2)n[s+1+ o]=t.charAt(i&15),i>>>=4,n[s+0+o]=t.charAt(i&15),i>>>=4;return n.join("")}static _md5cycle(e,t){ let n=e[0],i=e[1],s=e[2],o=e[3];n+=(i&s|~i&o)+t[0]-680876936|0,n=(n<<7|n>>>25)+i| 0,o+=(n&i|~n&s)+t[1]-389564586|0,o=(o<<12|o>>>20)+n|0,s+=(o&n|~o&i)+t[2]+606105819| @@ -540,34 +527,48 @@ i>>>11)+s|0,n+=(s^(i|~o))+t[4]-145523070|0,n=(n<<6|n>>>26)+i|0,o+=(i^(n|~s))+t[1 1120210379|0,o=(o<<10|o>>>22)+n|0,s+=(n^(o|~i))+t[2]+718787259|0,s=(s<<15|s>>>17)+ o|0,i+=(o^(s|~n))+t[9]-343485551|0,i=(i<<21|i>>>11)+s|0,e[0]=n+e[0]|0,e[1]=i+e[1]| 0,e[2]=s+e[2]|0,e[3]=o+e[3]|0}start(){return this._dataLength=0,this._bufferLength= -0,this._state.set(U.stateIdentity),this}appendStr(e){let t=this._buffer8,n=this. +0,this._state.set(O.stateIdentity),this}appendStr(e){let t=this._buffer8,n=this. _buffer32,i=this._bufferLength,s,o;for(o=0;o>>6)+192,t[i++]=s&63|128;else if(s<55296|| s>56319)t[i++]=(s>>>12)+224,t[i++]=s>>>6&63|128,t[i++]=s&63|128;else{if(s=(s-55296)* 1024+(e.charCodeAt(++o)-56320)+65536,s>1114111)throw new Error("Unicode standard\ supports code points up to U+10FFFF");t[i++]=(s>>>18)+240,t[i++]=s>>>12&63|128, -t[i++]=s>>>6&63|128,t[i++]=s&63|128}i>=64&&(this._dataLength+=64,U._md5cycle(this. +t[i++]=s>>>6&63|128,t[i++]=s&63|128}i>=64&&(this._dataLength+=64,O._md5cycle(this. _state,n),i-=64,n[0]=n[16])}return this._bufferLength=i,this}appendAsciiStr(e){let t=this. _buffer8,n=this._buffer32,i=this._bufferLength,s,o=0;for(;;){for(s=Math.min(e.length- -o,64-i);s--;)t[i++]=e.charCodeAt(o++);if(i<64)break;this._dataLength+=64,U._md5cycle( +o,64-i);s--;)t[i++]=e.charCodeAt(o++);if(i<64)break;this._dataLength+=64,O._md5cycle( this._state,n),i=0}return this._bufferLength=i,this}appendByteArray(e){let t=this. _buffer8,n=this._buffer32,i=this._bufferLength,s,o=0;for(;;){for(s=Math.min(e.length- -o,64-i);s--;)t[i++]=e[o++];if(i<64)break;this._dataLength+=64,U._md5cycle(this._state, +o,64-i);s--;)t[i++]=e[o++];if(i<64)break;this._dataLength+=64,O._md5cycle(this._state, n),i=0}return this._bufferLength=i,this}getState(){let e=this._state;return{buffer:String. fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this. _dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){let t=e.buffer,n=e.state,i=this. _state,s;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=n[0],i[1]= n[1],i[2]=n[2],i[3]=n[3],s=0;s>2)+1;this._dataLength+= -t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(U.buffer32Identity. -subarray(s),s),t>55&&(U._md5cycle(this._state,i),i.set(U.buffer32Identity)),o<=4294967295) +t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(O.buffer32Identity. +subarray(s),s),t>55&&(O._md5cycle(this._state,i),i.set(O.buffer32Identity)),o<=4294967295) i[14]=o;else{let u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return;let c=parseInt( -u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return U._md5cycle(this._state,i), -e?this._state:U._hex(this._state)}};a(U,"Md5"),_(U,"stateIdentity",new Int32Array( -[1732584193,-271733879,-1732584194,271733878])),_(U,"buffer32Identity",new Int32Array( -[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(U,"hexChars","0123456789abcdef"),_(U,"hexO\ -ut",[]),_(U,"onePassHasher",new U);Ve=U;a($e,"sha256")});var Vt=I(ai=>{"use strict";p();ai.parse=function(r,e){return new $t(r,e).parse()}; -var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Zo,this.position= +u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return O._md5cycle(this._state,i), +e?this._state:O._hex(this._state)}};a(O,"Md5"),A(O,"stateIdentity",new Int32Array( +[1732584193,-271733879,-1732584194,271733878])),A(O,"buffer32Identity",new Int32Array( +[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),A(O,"hexChars","0123456789abcdef"),A(O,"hexO\ +ut",[]),A(O,"onePassHasher",new O);Ke=O});var Ht={};te(Ht,{createHash:()=>Jo,createHmac:()=>Xo,randomBytes:()=>Zo});function Zo(r){ +return typeof w<"u"&&w.randomBytes!==void 0?(w.webcrypto??w).getRandomValues(y.alloc( +r)):require(Yo).randomBytes(r)}function Jo(r){if(r==="sha256")return{update:a(function(e){ +return{digest:a(function(){return y.from($e(e))},"digest")}},"update")};if(r==="\ +md5")return{update:a(function(e){return{digest:a(function(){return typeof e=="st\ +ring"?Ke.hashStr(e):Ke.hashByteArray(e)},"digest")}},"update")};throw new Error( +`Hash type '${r}' not supported`)}function Xo(r,e){if(r!=="sha256")throw new Error( +`Only sha256 is supported (requested: '${r}')`);return{update:a(function(t){return{ +digest:a(function(){typeof e=="string"&&(e=new TextEncoder().encode(e)),typeof t== +"string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n>64)e=$e(e);else if(n< +64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array(64),s=new Uint8Array( +64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array(t.length+ +64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u.set($e(o), +64),y.from($e(u))},"digest")}},"update")}}var Yo,Gt=z(()=>{"use strict";p();ai(); +ui();Yo="node:crypto";a(Zo,"randomBytes");a(Jo,"createHash");a(Xo,"createHmac")});var Kt=I(ci=>{"use strict";p();ci.parse=function(r,e){return new $t(r,e).parse()}; +var ht=class ht{constructor(e,t){this.source=e,this.transform=t||ea,this.position= 0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>= this.source.length}nextCharacter(){var e=this.source[this.position++];return e=== "\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){ @@ -581,97 +582,97 @@ n.parse(!0)),this.position+=n.position-2);else if(t.value==="}"&&!i){if(this.dim !this.dimension&&(this.newEntry(),e))return this.entries}else t.value==='"'&&!t. escaped?(i&&this.newEntry(!0),i=!i):t.value===","&&!i?this.newEntry():this.record( t.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this. -entries}};a(ht,"ArrayParser");var $t=ht;function Zo(r){return r}a(Zo,"identity")});var Kt=I((lh,ui)=>{p();var Jo=Vt();ui.exports={create:a(function(r,e){return{parse:a( -function(){return Jo.parse(r,e)},"parse")}},"create")}});var li=I((dh,hi)=>{"use strict";p();var Xo=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, -ea=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ta=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ra=/^-?infinity$/; -hi.exports=a(function(e){if(ra.test(e))return Number(e.replace("i","I"));var t=Xo. -exec(e);if(!t)return na(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=ci(i));var s=parseInt( +entries}};a(ht,"ArrayParser");var $t=ht;function ea(r){return r}a(ea,"identity")});var Vt=I((Eh,hi)=>{p();var ta=Kt();hi.exports={create:a(function(r,e){return{parse:a( +function(){return ta.parse(r,e)},"parse")}},"create")}});var pi=I((Ch,fi)=>{"use strict";p();var ra=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, +na=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ia=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,sa=/^-?infinity$/; +fi.exports=a(function(e){if(sa.test(e))return Number(e.replace("i","I"));var t=ra. +exec(e);if(!t)return oa(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=li(i));var s=parseInt( t[2],10)-1,o=t[3],u=parseInt(t[4],10),c=parseInt(t[5],10),h=parseInt(t[6],10),l=t[7]; -l=l?1e3*parseFloat(l):0;var d,b=ia(e);return b!=null?(d=new Date(Date.UTC(i,s,o, -u,c,h,l)),zt(i)&&d.setUTCFullYear(i),b!==0&&d.setTime(d.getTime()-b)):(d=new Date( -i,s,o,u,c,h,l),zt(i)&&d.setFullYear(i)),d},"parseDate");function na(r){var e=ea. -exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=ci(t));var i=parseInt(e[2], -10)-1,s=e[3],o=new Date(t,i,s);return zt(t)&&o.setFullYear(t),o}}a(na,"getDate"); -function ia(r){if(r.endsWith("+00"))return 0;var e=ta.exec(r.split(" ")[1]);if(e){ +l=l?1e3*parseFloat(l):0;var d,S=aa(e);return S!=null?(d=new Date(Date.UTC(i,s,o, +u,c,h,l)),zt(i)&&d.setUTCFullYear(i),S!==0&&d.setTime(d.getTime()-S)):(d=new Date( +i,s,o,u,c,h,l),zt(i)&&d.setFullYear(i)),d},"parseDate");function oa(r){var e=na. +exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=li(t));var i=parseInt(e[2], +10)-1,s=e[3],o=new Date(t,i,s);return zt(t)&&o.setFullYear(t),o}}a(oa,"getDate"); +function aa(r){if(r.endsWith("+00"))return 0;var e=ia.exec(r.split(" ")[1]);if(e){ var t=e[1];if(t==="Z")return 0;var n=t==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt( -e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(ia,"timeZoneOffset");function ci(r){ -return-(r-1)}a(ci,"bcYearToNegativeYear");function zt(r){return r>=0&&r<100}a(zt, -"is0To99")});var pi=I((gh,fi)=>{p();fi.exports=oa;var sa=Object.prototype.hasOwnProperty;function oa(r){ -for(var e=1;e{"use strict";p();var aa=pi();yi.exports=Me;function Me(r){if(!(this instanceof -Me))return new Me(r);aa(this,ba(r))}a(Me,"PostgresInterval");var ua=["seconds","\ -minutes","hours","days","months","years"];Me.prototype.toPostgres=function(){var r=ua. +e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(aa,"timeZoneOffset");function li(r){ +return-(r-1)}a(li,"bcYearToNegativeYear");function zt(r){return r>=0&&r<100}a(zt, +"is0To99")});var yi=I((Ph,di)=>{p();di.exports=ca;var ua=Object.prototype.hasOwnProperty;function ca(r){ +for(var e=1;e{"use strict";p();var ha=yi();gi.exports=Me;function Me(r){if(!(this instanceof +Me))return new Me(r);ha(this,va(r))}a(Me,"PostgresInterval");var la=["seconds","\ +minutes","hours","days","months","years"];Me.prototype.toPostgres=function(){var r=la. filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")< 0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e=== "seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/, -"")),t+" "+e},this).join(" ")};var ca={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ -M",seconds:"S"},ha=["years","months","days"],la=["hours","minutes","seconds"];Me. -prototype.toISOString=Me.prototype.toISO=function(){var r=ha.map(t,this).join(""), -e=la.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== +"")),t+" "+e},this).join(" ")};var fa={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ +M",seconds:"S"},pa=["years","months","days"],da=["hours","minutes","seconds"];Me. +prototype.toISOString=Me.prototype.toISO=function(){var r=pa.map(t,this).join(""), +e=da.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== "seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/, -"")),i+ca[n]}};var Yt="([+-]?\\d+)",fa=Yt+"\\s+years?",pa=Yt+"\\s+mons?",da=Yt+"\ -\\s+days?",ya="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",ma=new RegExp([ -fa,pa,da,ya].map(function(r){return"("+r+")?"}).join("\\s*")),di={years:2,months:4, -days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ga=["hours","minutes","sec\ -onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return parseInt( -e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( -r),t=e[8]==="-";return Object.keys(di).reduce(function(n,i){var s=di[i],o=e[s];return!o|| -(o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(ba,"parse")});var wi=I((Eh,gi)=>{"use strict";p();gi.exports=a(function(e){if(/^\\x/.test(e))return new y( +"")),i+fa[n]}};var Yt="([+-]?\\d+)",ya=Yt+"\\s+years?",ma=Yt+"\\s+mons?",ga=Yt+"\ +\\s+days?",wa="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",ba=new RegExp([ +ya,ma,ga,wa].map(function(r){return"("+r+")?"}).join("\\s*")),mi={years:2,months:4, +days:6,hours:9,minutes:10,seconds:11,milliseconds:12},Sa=["hours","minutes","sec\ +onds","milliseconds"];function xa(r){var e=r+"000000".slice(r.length);return parseInt( +e,10)/1e3}a(xa,"parseMilliseconds");function va(r){if(!r)return{};var e=ba.exec( +r),t=e[8]==="-";return Object.keys(mi).reduce(function(n,i){var s=mi[i],o=e[s];return!o|| +(o=i==="milliseconds"?xa(o):parseInt(o,10),!o)||(t&&~Sa.indexOf(i)&&(o*=-1),n[i]= +o),n},{})}a(va,"parse")});var Si=I((kh,bi)=>{"use strict";p();bi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=Vt(),ze=Kt(),lt=li(),Si=mi(),xi=wi();function ft(r){ -return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function vi(r){ +"\\";n+=Math.floor(i/2)*2}return new y(t,"binary")},"parseBytea")});var Ti=I((Oh,Ci)=>{p();var Ve=Kt(),ze=Vt(),lt=pi(),vi=wi(),Ei=Si();function ft(r){ +return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function _i(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| -r==="1"}a(vi,"parseBool");function Sa(r){return r?Ke.parse(r,vi):null}a(Sa,"pars\ -eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Zt(r){ -return r?Ke.parse(r,ft(xa)):null}a(Zt,"parseIntegerArray");function va(r){return r? -Ke.parse(r,ft(function(e){return Ei(e).trim()})):null}a(va,"parseBigIntegerArray"); -var Ea=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +r==="1"}a(_i,"parseBool");function Ea(r){return r?Ve.parse(r,_i):null}a(Ea,"pars\ +eBoolArray");function _a(r){return parseInt(r,10)}a(_a,"parseBaseTenInt");function Zt(r){ +return r?Ve.parse(r,ft(_a)):null}a(Zt,"parseIntegerArray");function Aa(r){return r? +Ve.parse(r,ft(function(e){return Ai(e).trim()})):null}a(Aa,"parseBigIntegerArray"); +var Ca=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=tr(t)),t});return e.parse()},"parsePointArray"),Jt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); -return e.parse()},"parseFloatArray"),ie=a(function(r){if(!r)return null;var e=ze. +return e.parse()},"parseFloatArray"),ne=a(function(r){if(!r)return null;var e=ze. create(r);return e.parse()},"parseStringArray"),Xt=a(function(r){if(!r)return null; var e=ze.create(r,function(t){return t!==null&&(t=lt(t)),t});return e.parse()},"\ -parseDateArray"),_a=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ -return t!==null&&(t=Si(t)),t});return e.parse()},"parseIntervalArray"),Aa=a(function(r){ -return r?Ke.parse(r,ft(xi)):null},"parseByteAArray"),er=a(function(r){return parseInt( -r,10)},"parseInteger"),Ei=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: -r},"parseBigInteger"),bi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, +parseDateArray"),Ta=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ +return t!==null&&(t=vi(t)),t});return e.parse()},"parseIntervalArray"),Ia=a(function(r){ +return r?Ve.parse(r,ft(Ei)):null},"parseByteAArray"),er=a(function(r){return parseInt( +r,10)},"parseInteger"),Ai=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: +r},"parseBigInteger"),xi=a(function(r){return r?Ve.parse(r,ft(JSON.parse)):null}, "parseJsonArray"),tr=a(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- -1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ca=a(function(r){ +1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Pa=a(function(r){ if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( +var s=tr(e);return s.radius=parseFloat(t),s},"parseCircle"),La=a(function(r){r(20, +Ai),r(21,er),r(23,er),r(26,er),r(700,parseFloat),r(701,parseFloat),r(16,_i),r(1082, +lt),r(1114,lt),r(1184,lt),r(600,tr),r(651,ne),r(718,Pa),r(1e3,Ea),r(1001,Ia),r(1005, +Zt),r(1007,Zt),r(1028,Zt),r(1016,Aa),r(1017,Ca),r(1021,Jt),r(1022,Jt),r(1231,Jt), +r(1014,ne),r(1015,ne),r(1008,ne),r(1009,ne),r(1040,ne),r(1041,ne),r(1115,Xt),r(1182, +Xt),r(1185,Xt),r(1186,vi),r(1187,Ta),r(17,Ei),r(114,JSON.parse.bind(JSON)),r(3802, +JSON.parse.bind(JSON)),r(199,xi),r(3807,xi),r(3907,ne),r(2951,ne),r(791,ne),r(1183, +ne),r(1270,ne)},"init");Ci.exports={init:La}});var Pi=I((Qh,Ii)=>{"use strict";p();var Z=1e6;function Ba(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,o,u, -c,h,l;{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+ -u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* -s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< -h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), +c,h,l;{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+ +u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* +s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< +h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Pa=Ti(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,L,Q){ -return C*Math.pow(2,Q)+L};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, +e%Z,o=4294967296*s+t,u=""+o%Z,n+u+i}a(Ba,"readInt8");Ii.exports=Ba});var Mi=I((Hh,Fi)=>{p();var Ra=Pi(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(_,L,G){ +return _*Math.pow(2,G)+L};var s=t>>3,o=a(function(_){return n?~_&255:_},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& -u,c));for(var l=e+t>>3,d=s+1;d0&& -(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Li=a(function(r,e,t){var n=Math.pow(2,t- +u,c));for(var l=e+t>>3,d=s+1;d0&& +(h=i(h,o(r[l])>>8-S,S)),h},"parseBits"),Ri=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= -1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), +1);for(var S=1;S<=d;S++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),La=a(function(r){return F(r,1)==1?-1* -(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ii=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Ba=a(function(r){return Li(r,23,8)},"pars\ -eFloat32"),Ra=a(function(r){return Li(r,52,11)},"parseFloat64"),Fa=a(function(r){ +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Fa=a(function(r){return F(r,1)==1?-1* +(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Li=a(function(r){return F(r,1)==1?-1*(F( +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Ma=a(function(r){return Ri(r,23,8)},"pars\ +eFloat32"),ka=a(function(r){return Ri(r,52,11)},"parseFloat64"),Da=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o>3,(i+=l<<3)>>3), d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ -var d=[],b;if(h.length>1){var C=h.shift();for(b=0;b0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,La),r(23,Ii),r(26, -Ii),r(1700,Fa),r(700,Ba),r(701,Ra),r(16,ka),r(1114,Pi.bind(null,!1)),r(1184,Pi.bind( -null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); -Bi.exports={init:Da}});var Mi=I((kh,Fi)=>{p();Fi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +var d=[],S;if(h.length>1){var _=h.shift();for(S=0;S<_;S++)d[S]=c(h,l);h.unshift( +_)}else for(S=0;S0},"parseBool"),Na=a(function(r){r(20,Ra),r(21,Fa),r(23,Li),r(26, +Li),r(1700,Da),r(700,Ma),r(701,ka),r(16,Oa),r(1114,Bi.bind(null,!1)),r(1184,Bi.bind( +null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ua)},"init"); +Fi.exports={init:Na}});var Di=I((Kh,ki)=>{p();ki.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -694,157 +695,157 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=Ai(),Oa=Ri(),Na=Kt(),qa=Mi();Je.getTypeParser=Qa;Je.setTypeParser= -Wa;Je.arrayParser=Na;Je.builtins=qa;var Ze={text:{},binary:{}};function ki(r){return String( -r)}a(ki,"noParse");function Qa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||ki}a(Qa, -"getTypeParser");function Wa(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= -t}a(Wa,"setTypeParser");Ua.init(function(r,e){Ze.text[r]=e});Oa.init(function(r,e){ -Ze.binary[r]=e})});var et=I((qh,rr)=>{"use strict";p();rr.exports={host:"localhost",user:m.platform=== +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var qa=Ti(),Qa=Mi(),Wa=Vt(),ja=Di();Je.getTypeParser=Ha;Je.setTypeParser= +Ga;Je.arrayParser=Wa;Je.builtins=ja;var Ze={text:{},binary:{}};function Ui(r){return String( +r)}a(Ui,"noParse");function Ha(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Ui}a(Ha, +"getTypeParser");function Ga(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= +t}a(Ga,"setTypeParser");qa.init(function(r,e){Ze.text[r]=e});Qa.init(function(r,e){ +Ze.binary[r]=e})});var et=I((Jh,rr)=>{"use strict";p();rr.exports={host:"localhost",user:m.platform=== "win32"?m.env.USERNAME:m.env.USER,database:void 0,password:null,connectionString:void 0, port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1, application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1, statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1, -connect_timeout:0,keepalives:1,keepalives_idle:0};var ke=Xe(),ja=ke.getTypeParser( -20,"text"),Ha=ke.getTypeParser(1016,"text");rr.exports.__defineSetter__("parseIn\ -t8",function(r){ke.setTypeParser(20,"text",r?ke.getTypeParser(23,"text"):ja),ke. -setTypeParser(1016,"text",r?ke.getTypeParser(1007,"text"):Ha)})});var tt=I((Wh,Ui)=>{"use strict";p();var Ga=(Gt(),O(Ht)),$a=et();function Va(r){var e=r. -replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Va,"escapeElement"); -function Di(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> -"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Di(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. -toString("hex"):e+=Va(pt(r[t]));return e=e+"}",e}a(Di,"arrayString");var pt=a(function(r,e){ +connect_timeout:0,keepalives:1,keepalives_idle:0};var ke=Xe(),$a=ke.getTypeParser( +20,"text"),Ka=ke.getTypeParser(1016,"text");rr.exports.__defineSetter__("parseIn\ +t8",function(r){ke.setTypeParser(20,"text",r?ke.getTypeParser(23,"text"):$a),ke. +setTypeParser(1016,"text",r?ke.getTypeParser(1007,"text"):Ka)})});var tt=I((el,Ni)=>{"use strict";p();var Va=(Gt(),N(Ht)),za=et();function Ya(r){var e=r. +replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Ya,"escapeElement"); +function Oi(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> +"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Oi(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. +toString("hex"):e+=Ya(pt(r[t]));return e=e+"}",e}a(Oi,"arrayString");var pt=a(function(r,e){ if(r==null)return null;if(r instanceof y)return r;if(ArrayBuffer.isView(r)){var t=y. from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice( -r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?$a.parseInputDatesAsUTC? -Ya(r):za(r):Array.isArray(r)?Di(r):typeof r=="object"?Ka(r,e):r.toString()},"pre\ -pareValue");function Ka(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. +r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?za.parseInputDatesAsUTC? +Xa(r):Ja(r):Array.isArray(r)?Oi(r):typeof r=="object"?Za(r,e):r.toString()},"pre\ +pareValue");function Za(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+ r+'" for query');return e.push(r),pt(r.toPostgres(pt),e)}return JSON.stringify(r)} -a(Ka,"prepareObject");function G(r,e){for(r=""+r;r.length{"use strict";p();var ir=(Gt(),O(Ht));function Xa(r){if(r.indexOf( +a(Za,"prepareObject");function H(r,e){for(r=""+r;r.length{"use strict";p();var ir=(Gt(),N(Ht));function ru(r){if(r.indexOf( "SCRAM-SHA-256")===-1)throw new Error("SASL: Only mechanism SCRAM-SHA-256 is cur\ rently supported");let e=ir.randomBytes(18).toString("base64");return{mechanism:"\ SCRAM-SHA-256",clientNonce:e,response:"n,,n=*,r="+e,message:"SASLInitialResponse"}} -a(Xa,"startSession");function eu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( +a(ru,"startSession");function nu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( "SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(typeof t!= "string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a\ - string");let n=nu(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== + string");let n=ou(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n\ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ -er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, -i,n.iteration),o=De(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=De(u,d),C=qi( -o,b),L=C.toString("base64"),Q=De(s,"Server Key"),J=De(Q,d);r.message="SASLRespon\ -se",r.serverSignature=J.toString("base64"),r.response=l+",p="+L}a(eu,"continueSe\ -ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ +er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=cu(e, +i,n.iteration),o=De(s,"Client Key"),u=uu(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=De(u,d),_=Wi( +o,S),L=_.toString("base64"),G=De(s,"Server Key"),X=De(G,d);r.message="SASLRespon\ +se",r.serverSignature=X.toString("base64"),r.response=l+",p="+L}a(nu,"continueSe\ +ssion");function iu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ -CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( +CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=au( e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: s\ -erver signature does not match")}a(tu,"finalizeSession");function ru(r){if(typeof r!= +erver signature does not match")}a(iu,"finalizeSession");function su(r){if(typeof r!= "string")throw new TypeError("SASL: text must be a string");return r.split("").map( -(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(ru,"isPrintableC\ -hars");function Oi(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(r)}a(Oi,"isBase64");function Ni(r){if(typeof r!="string")throw new TypeError( +(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(su,"isPrintableC\ +hars");function qi(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(r)}a(qi,"isBase64");function Qi(r){if(typeof r!="string")throw new TypeError( "SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{ if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0], -n=e.substring(2);return[t,n]}))}a(Ni,"parseAttributePairs");function nu(r){let e=Ni( -r),t=e.get("r");if(t){if(!ru(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ +n=e.substring(2);return[t,n]}))}a(Qi,"parseAttributePairs");function ou(r){let e=Qi( +r),t=e.get("r");if(t){if(!su(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ E: nonce must only contain printable characters")}else throw new Error("SASL: SC\ -RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Oi(n))throw new Error( +RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!qi(n))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("S\ ASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/. test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration cou\ nt")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); -let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(nu,"parseServerFirstMe\ -ssage");function iu(r){let t=Ni(r).get("v");if(t){if(!Oi(t))throw new Error("SAS\ +let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(ou,"parseServerFirstMe\ +ssage");function au(r){let t=Qi(r).get("v");if(t){if(!qi(t))throw new Error("SAS\ L: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error( "SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}} -a(iu,"parseServerFinalMessage");function qi(r,e){if(!y.isBuffer(r))throw new TypeError( +a(au,"parseServerFinalMessage");function Wi(r,e){if(!y.isBuffer(r))throw new TypeError( "first argument must be a Buffer");if(!y.isBuffer(e))throw new TypeError("second\ argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer leng\ ths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return y. -from(r.map((t,n)=>r[n]^e[n]))}a(qi,"xorBuffers");function su(r){return ir.createHash( -"sha256").update(r).digest()}a(su,"sha256");function De(r,e){return ir.createHmac( -"sha256",r).update(e).digest()}a(De,"hmacSha256");function ou(r,e,t){for(var n=De( -r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;sau});function au(...r){return r.join("/")}var or=te(()=>{ -"use strict";p();a(au,"join")});var ar={};re(ar,{stat:()=>uu});function uu(r,e){e(new Error("No filesystem"))}var ur=te( -()=>{"use strict";p();a(uu,"stat")});var cr={};re(cr,{default:()=>cu});var cu,hr=te(()=>{"use strict";p();cu={}});var ji={};re(ji,{StringDecoder:()=>lr});var fr,lr,Hi=te(()=>{"use strict";p();fr= -class fr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. +from(r.map((t,n)=>r[n]^e[n]))}a(Wi,"xorBuffers");function uu(r){return ir.createHash( +"sha256").update(r).digest()}a(uu,"sha256");function De(r,e){return ir.createHmac( +"sha256",r).update(e).digest()}a(De,"hmacSha256");function cu(r,e,t){for(var n=De( +r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;shu});function hu(...r){return r.join("/")}var or=z(()=>{ +"use strict";p();a(hu,"join")});var ar={};te(ar,{stat:()=>lu});function lu(r,e){e(new Error("No filesystem"))}var ur=z( +()=>{"use strict";p();a(lu,"stat")});var cr={};te(cr,{default:()=>fu});var fu,hr=z(()=>{"use strict";p();fu={}});var Gi={};te(Gi,{StringDecoder:()=>lr});var fr,lr,$i=z(()=>{"use strict";p();fr= +class fr{constructor(e){A(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(fr,"StringDecoder"); -lr=fr});var Ki=I((tl,Vi)=>{"use strict";p();var{Transform:hu}=(hr(),O(cr)),{StringDecoder:lu}=(Hi(),O(ji)), -be=Symbol("last"),dt=Symbol("decoder");function fu(r,e,t){let n;if(this.overflow){ +lr=fr});var Yi=I((pl,zi)=>{"use strict";p();var{Transform:pu}=(hr(),N(cr)),{StringDecoder:du}=($i(),N(Gi)), +Se=Symbol("last"),dt=Symbol("decoder");function yu(r,e,t){let n;if(this.overflow){ if(n=this[dt].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. -overflow=!1}else this[be]+=this[dt].write(r),n=this[be].split(this.matcher);this[be]= -n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ -t(new Error("maximum buffer reached"));return}t()}a(fu,"transform");function pu(r){ -if(this[be]+=this[dt].end(),this[be])try{$i(this,this.mapper(this[be]))}catch(e){ -return r(e)}r()}a(pu,"flush");function $i(r,e){e!==void 0&&r.push(e)}a($i,"push"); -function Gi(r){return r}a(Gi,"noop");function du(r,e,t){switch(r=r||/\r?\n/,e=e|| -Gi,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== +overflow=!1}else this[Se]+=this[dt].write(r),n=this[Se].split(this.matcher);this[Se]= +n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ +t(new Error("maximum buffer reached"));return}t()}a(yu,"transform");function mu(r){ +if(this[Se]+=this[dt].end(),this[Se])try{Vi(this,this.mapper(this[Se]))}catch(e){ +return r(e)}r()}a(mu,"flush");function Vi(r,e){e!==void 0&&r.push(e)}a(Vi,"push"); +function Ki(r){return r}a(Ki,"noop");function gu(r,e,t){switch(r=r||/\r?\n/,e=e|| +Ki,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== "object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2: -typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Gi)}t=Object. -assign({},t),t.autoDestroy=!0,t.transform=fu,t.flush=pu,t.readableObjectMode=!0; -let n=new hu(t);return n[be]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= +typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=Ki)}t=Object. +assign({},t),t.autoDestroy=!0,t.transform=yu,t.flush=mu,t.readableObjectMode=!0; +let n=new pu(t);return n[Se]="",n[dt]=new du("utf8"),n.matcher=r,n.mapper=e,n.maxLength= t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ -this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Vi.exports=du});var Zi=I((il,de)=>{"use strict";p();var zi=(or(),O(sr)),yu=(hr(),O(cr)).Stream,mu=Ki(), -Yi=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, -xu=32768;function vu(r){return(r&Su)==xu}a(vu,"isRegFile");var Ue=["host","port", -"database","user","password"],pr=Ue.length,Eu=Ue[pr-1];function dr(){var r=rt instanceof -yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` -`);rt.write(Yi.format.apply(Yi,e))}}a(dr,"warn");Object.defineProperty(de.exports, +this._writableState.errorEmitted=!1,s(i)},n}a(gu,"split");zi.exports=gu});var Xi=I((ml,de)=>{"use strict";p();var Zi=(or(),N(sr)),wu=(hr(),N(cr)).Stream,bu=Yi(), +Ji=(Ge(),N(He)),Su=5432,yt=m.platform==="win32",rt=m.stderr,xu=56,vu=7,Eu=61440, +_u=32768;function Au(r){return(r&Eu)==_u}a(Au,"isRegFile");var Ue=["host","port", +"database","user","password"],pr=Ue.length,Cu=Ue[pr-1];function dr(){var r=rt instanceof +wu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` +`);rt.write(Ji.format.apply(Ji,e))}}a(dr,"warn");Object.defineProperty(de.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});de. exports.warnTo=function(r){var e=rt;return rt=r,e};de.exports.getFileName=function(r){ -var e=r||m.env,t=e.PGPASSFILE||(yt?zi.join(e.APPDATA||"./","postgresql","pgpass.\ -conf"):zi.join(e.HOME||"./",".pgpass"));return t};de.exports.usePgPass=function(r,e){ +var e=r||m.env,t=e.PGPASSFILE||(yt?Zi.join(e.APPDATA||"./","postgresql","pgpass.\ +conf"):Zi.join(e.HOME||"./",".pgpass"));return t};de.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",vu(r.mode)?r.mode&(wu|bu)?(dr('WARNING: password file "%s" has group or \ +",Au(r.mode)?r.mode&(xu|vu)?(dr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(dr('WARNING:\ - password file "%s" is not a plain file',e),!1))};var _u=de.exports.match=function(r,e){ -return Ue.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( + password file "%s" is not a plain file',e),!1))};var Tu=de.exports.match=function(r,e){ +return Ue.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||Su)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};de.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[Eu],i.end())} +var n,i=e.pipe(bu());function s(c){var h=Iu(c);h&&Pu(h)&&Tu(r,h)&&(n=h[Cu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), dr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. -on("data",s).on("end",o).on("error",u)};var Au=de.exports.parseLine=function(r){ +on("data",s).on("end",o).on("error",u)};var Iu=de.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, -u=!1,c=a(function(l,d,b){var C=r.substring(d,b);Object.hasOwnProperty.call(m.env, -"PGPASS_NO_DEESCAPE")||(C=C.replace(/\\([:\\])/g,"$1")),o[Ue[l]]=C},"addToObj"), +u=!1,c=a(function(l,d,S){var _=r.substring(d,S);Object.hasOwnProperty.call(m.env, +"PGPASS_NO_DEESCAPE")||(_=_.replace(/\\([:\\])/g,"$1")),o[Ue[l]]=_},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== -pr?o:null,o},Cu=de.exports.isValidEntry=function(r){for(var e={0:function(o){return o. +pr?o:null,o},Pu=de.exports.isValidEntry=function(r){for(var e={0:function(o){return o. length>0},1:function(o){return o==="*"?!0:(o=Number(o),isFinite(o)&&o>0&&o<9007199254740992&& Math.floor(o)===o)},2:function(o){return o.length>0},3:function(o){return o.length> 0},4:function(o){return o.length>0}},t=0;t{"use strict";p();var al=(or(),O(sr)),Ji=(ur(),O(ar)),mt=Zi(); -yr.exports=function(r,e){var t=mt.getFileName();Ji.stat(t,function(n,i){if(n||!mt. -usePgPass(i,t))return e(void 0);var s=Ji.createReadStream(t);mt.getPassword(r,s, -e)})};yr.exports.warnTo=mt.warnTo});var wt=I((hl,es)=>{"use strict";p();var Tu=Xe();function gt(r){this._types=r||Tu, +"",s=n(i);if(!s)return!1}return!0}});var ts=I((Sl,yr)=>{"use strict";p();var bl=(or(),N(sr)),es=(ur(),N(ar)),mt=Xi(); +yr.exports=function(r,e){var t=mt.getFileName();es.stat(t,function(n,i){if(n||!mt. +usePgPass(i,t))return e(void 0);var s=es.createReadStream(t);mt.getPassword(r,s, +e)})};yr.exports.warnTo=mt.warnTo});var wt=I((vl,rs)=>{"use strict";p();var Lu=Xe();function gt(r){this._types=r||Lu, this.text={},this.binary={}}a(gt,"TypeOverrides");gt.prototype.getOverrides=function(r){ switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}}; gt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| -"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};es.exports=gt});var ts={};re(ts,{default:()=>Iu});var Iu,rs=te(()=>{"use strict";p();Iu={}});var ns={};re(ns,{parse:()=>mr});function mr(r,e=!1){let{protocol:t}=new URL(r),n="\ +"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};rs.exports=gt});var ns={};te(ns,{default:()=>Bu});var Bu,is=z(()=>{"use strict";p();Bu={}});var ss={};te(ss,{parse:()=>mr});function mr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let C=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ -href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:L,hash:b}}var gr=te(()=>{"use strict";p();a(mr,"parse")});var ss=I((ml,is)=>{"use strict";p();var Pu=(gr(),O(ns)),wr=(ur(),O(ar));function br(r){ -if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. +search:l,searchParams:d,hash:S}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( +i),h=decodeURIComponent(h);let _=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ +href:r,protocol:t,auth:_,username:i,password:s,host:o,hostname:u,port:c,pathname:h, +search:l,query:L,hash:S}}var gr=z(()=>{"use strict";p();a(mr,"parse")});var as=I((Il,os)=>{"use strict";p();var Ru=(gr(),N(ss)),wr=(ur(),N(ar));function br(r){ +if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Ru. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- 1]);var i=(e.auth||":").split(":");if(t.user=i[0],t.password=i.splice(1).join(":"), @@ -858,45 +859,45 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=wr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(br,"parse");is.exports=br;br.parse=br});var bt=I((bl,us)=>{"use strict";p();var Lu=(rs(),O(ts)),as=et(),os=ss().parse,V=a( +return t}a(br,"parse");os.exports=br;br.parse=br});var bt=I((Bl,hs)=>{"use strict";p();var Fu=(is(),N(ns)),cs=et(),us=as().parse,K=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||as[r]},"val"),Bu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||cs[r]},"val"),Mu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": -return{rejectUnauthorized:!1}}return as.ssl},"readSSLConfigFromEnvironment"),Oe=a( +return{rejectUnauthorized:!1}}return cs.ssl},"readSSLConfigFromEnvironment"),Oe=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ -teParamValue"),se=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Oe(n))},"ad\ -d"),xr=class xr{constructor(e){e=typeof e=="string"?os(e):e||{},e.connectionString&& -(e=Object.assign({},e,os(e.connectionString))),this.user=V("user",e),this.database= -V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( -V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, -enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Bu():e.ssl,typeof this.ssl=="st\ +teParamValue"),ie=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Oe(n))},"ad\ +d"),xr=class xr{constructor(e){e=typeof e=="string"?us(e):e||{},e.connectionString&& +(e=Object.assign({},e,us(e.connectionString))),this.user=K("user",e),this.database= +K("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( +K("port",e),10),this.host=K("host",e),Object.defineProperty(this,"password",{configurable:!0, +enumerable:!1,writable:!0,value:K("password",e)}),this.binary=K("binary",e),this. +options=K("options",e),this.ssl=typeof e.ssl>"u"?Mu():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. -client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. -isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=V("applicatio\ -n_name",e,"PGAPPNAME"),this.fallback_application_name=V("fallback_application_na\ -me",e,!1),this.statement_timeout=V("statement_timeout",e,!1),this.lock_timeout=V( -"lock_timeout",e,!1),this.idle_in_transaction_session_timeout=V("idle_in_transac\ -tion_session_timeout",e,!1),this.query_timeout=V("query_timeout",e,!1),e.connectionTimeoutMillis=== +client_encoding=K("client_encoding",e),this.replication=K("replication",e),this. +isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=K("applicatio\ +n_name",e,"PGAPPNAME"),this.fallback_application_name=K("fallback_application_na\ +me",e,!1),this.statement_timeout=K("statement_timeout",e,!1),this.lock_timeout=K( +"lock_timeout",e,!1),this.idle_in_transaction_session_timeout=K("idle_in_transac\ +tion_session_timeout",e,!1),this.query_timeout=K("query_timeout",e,!1),e.connectionTimeoutMillis=== void 0?this.connect_timeout=m.env.PGCONNECT_TIMEOUT||0:this.connect_timeout=Math. floor(e.connectionTimeoutMillis/1e3),e.keepAlive===!1?this.keepalives=0:e.keepAlive=== !0&&(this.keepalives=1),typeof e.keepAliveInitialDelayMillis=="number"&&(this.keepalives_idle= Math.floor(e.keepAliveInitialDelayMillis/1e3))}getLibpqConnectionString(e){var t=[]; -se(t,this,"user"),se(t,this,"password"),se(t,this,"port"),se(t,this,"application\ -_name"),se(t,this,"fallback_application_name"),se(t,this,"connect_timeout"),se(t, +ie(t,this,"user"),ie(t,this,"password"),ie(t,this,"port"),ie(t,this,"application\ +_name"),ie(t,this,"fallback_application_name"),ie(t,this,"connect_timeout"),ie(t, this,"options");var n=typeof this.ssl=="object"?this.ssl:this.ssl?{sslmode:this. -ssl}:{};if(se(t,n,"sslmode"),se(t,n,"sslca"),se(t,n,"sslkey"),se(t,n,"sslcert"), -se(t,n,"sslrootcert"),this.database&&t.push("dbname="+Oe(this.database)),this.replication&& +ssl}:{};if(ie(t,n,"sslmode"),ie(t,n,"sslca"),ie(t,n,"sslkey"),ie(t,n,"sslcert"), +ie(t,n,"sslrootcert"),this.database&&t.push("dbname="+Oe(this.database)),this.replication&& t.push("replication="+Oe(this.replication)),this.host&&t.push("host="+Oe(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Oe(this.client_encoding)),Lu.lookup(this.host,function(i,s){return i? +ent_encoding="+Oe(this.client_encoding)),Fu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Oe(s)),e(null,t.join(" ")))})}};a(xr,"ConnectionPa\ -rameters");var Sr=xr;us.exports=Sr});var ls=I((vl,hs)=>{"use strict";p();var Ru=Xe(),cs=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +rameters");var Sr=xr;hs.exports=Sr});var ps=I((Ml,fs)=>{"use strict";p();var ku=Xe(),ls=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, Er=class Er{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ -var t;e.text?t=cs.exec(e.text):t=cs.exec(e.command),t&&(this.command=t[1],t[3]?(this. +var t;e.text?t=ls.exec(e.text):t=ls.exec(e.command),t&&(this.command=t[1],t[3]?(this. oid=parseInt(t[2],10),this.rowCount=parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt( t[2],10)))}_parseRowAsArray(e){for(var t=new Array(e.length),n=0,i=e.length;n{"use strict";p();var{EventEmitter:Fu}=we(),fs=ls(),ps=tt(),Ar=class Ar extends Fu{constructor(e,t,n){ -super(),e=ps.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. +ext"):this._parsers[t]=ku.getTypeParser(n.dataTypeID,n.format||"text")}}};a(Er,"\ +Result");var vr=Er;fs.exports=vr});var gs=I((Ul,ms)=>{"use strict";p();var{EventEmitter:Du}=be(),ds=ps(),ys=tt(),Ar=class Ar extends Du{constructor(e,t,n){ +super(),e=ys.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& -(this.callback=m.domain.bind(e.callback)),this._result=new fs(this._rowMode,this. +(this.callback=m.domain.bind(e.callback)),this._result=new ds(this._rowMode,this. types),this._results=this._result,this.isPreparedStatement=!1,this._canceledDueToError= !1,this._promise=null}requiresPreparation(){return this.name||this.rows?!0:!this. text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&& -(Array.isArray(this._results)||(this._results=[this._result]),this._result=new fs( +(Array.isArray(this._results)||(this._results=[this._result]),this._result=new ds( this._rowMode,this.types),this._results.push(this._result))}handleRowDescription(e){ this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this. callback||!this.listeners("row").length}handleDataRow(e){let t;if(!this._canceledDueToError){ @@ -935,47 +936,47 @@ name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execut {portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.isPreparedStatement= !0,this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types}); try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this. -binary,valueMapper:ps.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( +binary,valueMapper:ys.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(Ar,"Query"); -var _r=Ar;ds.exports=_r});var ws={};re(ws,{Socket:()=>Se,isIP:()=>Mu});function Mu(r){return 0}var gs,ms,v, -Se,St=te(()=>{"use strict";p();gs=Ie(we(),1);a(Mu,"isIP");ms=/^[^.]+\./,v=class v extends gs.EventEmitter{constructor(){ -super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); -_(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ -troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? -v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ -v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +var _r=Ar;ms.exports=_r});var Ss={};te(Ss,{Socket:()=>xe,isIP:()=>Uu});function Uu(r){return 0}var bs,ws,E, +xe,St=z(()=>{"use strict";p();bs=Ie(be(),1);a(Uu,"isIP");ws=/^[^.]+\./,E=class E extends bs.EventEmitter{constructor(){ +super(...arguments);A(this,"opts",{});A(this,"connecting",!1);A(this,"pending",!0); +A(this,"writable",!0);A(this,"encrypted",!1);A(this,"authorized",!1);A(this,"des\ +troyed",!1);A(this,"ws",null);A(this,"writeBuffer");A(this,"tlsState",0);A(this, +"tlsRead");A(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ +E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ -v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? -v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. -wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. -opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? -v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? -v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? -v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ -v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ -return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. -rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ +E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? +E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. +wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. +opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? +E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? +E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? +E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ +E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ +return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. +rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -1014,12 +1015,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( -(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ms,"apiauth."):s=t.replace(ms,"api\ +!0,this.end()}};a(E,"Socket"),A(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ws,"apiauth."):s=t.replace(ws,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(v,"opts",{});Se=v});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),A(E,"opts",{});xe=E});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1043,11 +1044,11 @@ Lr;var Gr=class Gr{constructor(e,t){this.length=e,this.parameterCount=t,this.nam "parameterDescription",this.dataTypeIDs=new Array(this.parameterCount)}};a(Gr,"P\ arameterDescriptionMessage");var Br=Gr;T.ParameterDescriptionMessage=Br;var $r=class $r{constructor(e,t,n){ this.length=e,this.parameterName=t,this.parameterValue=n,this.name="parameterSta\ -tus"}};a($r,"ParameterStatusMessage");var Rr=$r;T.ParameterStatusMessage=Rr;var Vr=class Vr{constructor(e,t){ -this.length=e,this.salt=t,this.name="authenticationMD5Password"}};a(Vr,"Authenti\ -cationMD5Password");var Fr=Vr;T.AuthenticationMD5Password=Fr;var Kr=class Kr{constructor(e,t,n){ -this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Kr, -"BackendKeyDataMessage");var Mr=Kr;T.BackendKeyDataMessage=Mr;var zr=class zr{constructor(e,t,n,i){ +tus"}};a($r,"ParameterStatusMessage");var Rr=$r;T.ParameterStatusMessage=Rr;var Kr=class Kr{constructor(e,t){ +this.length=e,this.salt=t,this.name="authenticationMD5Password"}};a(Kr,"Authenti\ +cationMD5Password");var Fr=Kr;T.AuthenticationMD5Password=Fr;var Vr=class Vr{constructor(e,t,n){ +this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Vr, +"BackendKeyDataMessage");var Mr=Vr;T.BackendKeyDataMessage=Mr;var zr=class zr{constructor(e,t,n,i){ this.length=e,this.processId=t,this.channel=n,this.payload=i,this.name="notifica\ tion"}};a(zr,"NotificationResponseMessage");var kr=zr;T.NotificationResponseMessage= kr;var Yr=class Yr{constructor(e,t){this.length=e,this.status=t,this.name="ready\ @@ -1057,7 +1058,7 @@ sage");var Ur=Zr;T.CommandCompleteMessage=Ur;var Jr=class Jr{constructor(e,t){th length=e,this.fields=t,this.name="dataRow",this.fieldCount=t.length}};a(Jr,"Data\ RowMessage");var Or=Jr;T.DataRowMessage=Or;var Xr=class Xr{constructor(e,t){this. length=e,this.message=t,this.name="notice"}};a(Xr,"NoticeMessage");var Nr=Xr;T.NoticeMessage= -Nr});var bs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); +Nr});var xs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); xt.Writer=void 0;var rn=class rn{constructor(e=256){this.size=e,this.offset=5,this. headerPosition=0,this.buffer=y.allocUnsafe(e)}ensure(e){var t=this.buffer.length- this.offset;if(t>1)+e;this.buffer=y.allocUnsafe( @@ -1073,44 +1074,44 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(rn,"Wr\ -iter");var tn=rn;xt.Writer=tn});var xs=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); -Et.serialize=void 0;var nn=bs(),M=new nn.Writer,ku=a(r=>{M.addInt16(3).addInt16( +iter");var tn=rn;xt.Writer=tn});var Es=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); +Et.serialize=void 0;var nn=xs(),M=new nn.Writer,Ou=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new nn. -Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); -return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Uu=a(r=>M. -addCString(r).flush(112),"password"),Ou=a(function(r,e){return M.addCString(r).addInt32( -y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Nu=a( -function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),qu=a( -r=>M.addCString(r).flush(81),"query"),Ss=[],Qu=a(r=>{let e=r.name||"";e.length>63&& +Writer().addInt32(t).add(e).flush()},"startup"),Nu=a(()=>{let r=y.allocUnsafe(8); +return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),qu=a(r=>M. +addCString(r).flush(112),"password"),Qu=a(function(r,e){return M.addCString(r).addInt32( +y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Wu=a( +function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),ju=a( +r=>M.addCString(r).flush(81),"query"),vs=[],Hu=a(r=>{let e=r.name||"";e.length>63&& (console.error("Warning! Postgres only supports 63 characters for query names."), console.error("You supplied %s (%s)",e,e.length),console.error("This can cause c\ -onflicts and silent errors executing queries"));let t=r.types||Ss;for(var n=t.length, +onflicts and silent errors executing queries"));let t=r.types||vs;for(var n=t.length, i=M.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| -"",n=r.binary||!1,i=r.values||Ss,s=i.length;return M.addCString(e).addCString(t), -M.addInt16(s),Wu(i,r.valueMapper),M.addInt16(s),M.add(Ne.flush()),M.addInt16(n?1: -0),M.flush(66)},"bind"),Hu=y.from([69,0,0,0,9,0,0,0,0,0]),Gu=a(r=>{if(!r||!r.portal&& -!r.rows)return Hu;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. +n)),Ne.addString(n))}},"writeValues"),$u=a((r={})=>{let e=r.portal||"",t=r.statement|| +"",n=r.binary||!1,i=r.values||vs,s=i.length;return M.addCString(e).addCString(t), +M.addInt16(s),Gu(i,r.valueMapper),M.addInt16(s),M.add(Ne.flush()),M.addInt16(n?1: +0),M.flush(66)},"bind"),Ku=y.from([69,0,0,0,9,0,0,0,0,0]),Vu=a(r=>{if(!r||!r.portal&& +!r.rows)return Ku;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]= -0,s.writeUInt32BE(t,s.length-4),s},"execute"),$u=a((r,e)=>{let t=y.allocUnsafe(16); +0,s.writeUInt32BE(t,s.length-4),s},"execute"),zu=a((r,e)=>{let t=y.allocUnsafe(16); return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE( r,8),t.writeInt32BE(e,12),t},"cancel"),sn=a((r,e)=>{let n=4+y.byteLength(e)+1,i=y. allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i}, -"cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), -zu=a(r=>r.name?sn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( -r=>{let e=`${r.type}${r.name||""}`;return sn(67,e)},"close"),Zu=a(r=>M.add(r).flush( -100),"copyData"),Ju=a(r=>sn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),Xu=vt(72),ec=vt(83),tc=vt(88),rc=vt(99),nc={startup:ku,password:Uu, -requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, -parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( -()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, -cancel:$u};Et.serialize=nc});var vs=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); -_t.BufferReader=void 0;var ic=y.allocUnsafe(0),an=class an{constructor(e=0){this. -offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. +"cstringMessage"),Yu=M.addCString("P").flush(68),Zu=M.addCString("S").flush(68), +Ju=a(r=>r.name?sn(68,`${r.type}${r.name||""}`):r.type==="P"?Yu:Zu,"describe"),Xu=a( +r=>{let e=`${r.type}${r.name||""}`;return sn(67,e)},"close"),ec=a(r=>M.add(r).flush( +100),"copyData"),tc=a(r=>sn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),rc=vt(72),nc=vt(83),ic=vt(88),sc=vt(99),oc={startup:Ou,password:qu, +requestSsl:Nu,sendSASLInitialResponseMessage:Qu,sendSCRAMClientFinalMessage:Wu,query:ju, +parse:Hu,bind:$u,execute:Vu,describe:Ju,close:Xu,flush:a(()=>rc,"flush"),sync:a( +()=>nc,"sync"),end:a(()=>ic,"end"),copyData:ec,copyDone:a(()=>sc,"copyDone"),copyFail:tc, +cancel:zu};Et.serialize=oc});var _s=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +_t.BufferReader=void 0;var ac=y.allocUnsafe(0),an=class an{constructor(e=0){this. +offset=e,this.buffer=ac,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= 2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this. buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer. @@ -1118,14 +1119,14 @@ toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstrin let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(an,"BufferReader");var on=an;_t.BufferReader= -on});var As=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var k=en(),sc=vs(),un=1,oc=4,Es=un+oc,_s=y.allocUnsafe(0),hn=class hn{constructor(e){ -if(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, +on});var Ts=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); +At.Parser=void 0;var k=en(),uc=_s(),un=1,cc=4,As=un+cc,Cs=y.allocUnsafe(0),hn=class hn{constructor(e){ +if(this.buffer=Cs,this.bufferLength=0,this.bufferOffset=0,this.reader=new uc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, -i=this.bufferOffset;for(;i+Es<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( -i+un),u=un+o;if(u+i<=n){let c=this.handlePacket(i+Es,s,o,this.buffer);t(c),i+=u}else -break}i===n?(this.buffer=_s,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= +i=this.bufferOffset;for(;i+As<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( +i+un),u=un+o;if(u+i<=n){let c=this.handlePacket(i+As,s,o,this.buffer);t(c),i+=u}else +break}i===n?(this.buffer=Cs,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer. @@ -1182,16 +1183,16 @@ this.reader.cstring(),o=this.reader.string(1);let u=s.M,c=i==="notice"?new k.Not t,u):new k.DatabaseError(u,t,i);return c.severity=s.S,c.code=s.C,c.detail=s.D,c. hint=s.H,c.position=s.P,c.internalPosition=s.p,c.internalQuery=s.q,c.where=s.W,c. schema=s.s,c.table=s.t,c.column=s.c,c.dataType=s.d,c.constraint=s.n,c.file=s.F,c. -line=s.L,c.routine=s.R,c}};a(hn,"Parser");var cn=hn;At.Parser=cn});var ln=I(xe=>{"use strict";p();Object.defineProperty(xe,"__esModule",{value:!0}); -xe.DatabaseError=xe.serialize=xe.parse=void 0;var ac=en();Object.defineProperty( -xe,"DatabaseError",{enumerable:!0,get:a(function(){return ac.DatabaseError},"get")}); -var uc=xs();Object.defineProperty(xe,"serialize",{enumerable:!0,get:a(function(){ -return uc.serialize},"get")});var cc=As();function hc(r,e){let t=new cc.Parser;return r. -on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");xe. -parse=hc});var Cs={};re(Cs,{connect:()=>lc});function lc({socket:r,servername:e}){return r. -startTls(e),r}var Ts=te(()=>{"use strict";p();a(lc,"connect")});var dn=I((Yl,Ls)=>{"use strict";p();var Is=(St(),O(ws)),fc=we().EventEmitter,{parse:pc, -serialize:q}=ln(),Ps=q.flush(),dc=q.sync(),yc=q.end(),pn=class pn extends fc{constructor(e){ -super(),e=e||{},this.stream=e.stream||new Is.Socket,this._keepAlive=e.keepAlive, +line=s.L,c.routine=s.R,c}};a(hn,"Parser");var cn=hn;At.Parser=cn});var ln=I(ve=>{"use strict";p();Object.defineProperty(ve,"__esModule",{value:!0}); +ve.DatabaseError=ve.serialize=ve.parse=void 0;var hc=en();Object.defineProperty( +ve,"DatabaseError",{enumerable:!0,get:a(function(){return hc.DatabaseError},"get")}); +var lc=Es();Object.defineProperty(ve,"serialize",{enumerable:!0,get:a(function(){ +return lc.serialize},"get")});var fc=Ts();function pc(r,e){let t=new fc.Parser;return r. +on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(pc,"parse");ve. +parse=pc});var Is={};te(Is,{connect:()=>dc});function dc({socket:r,servername:e}){return r. +startTls(e),r}var Ps=z(()=>{"use strict";p();a(dc,"connect")});var dn=I((cf,Rs)=>{"use strict";p();var Ls=(St(),N(Ss)),yc=be().EventEmitter,{parse:mc, +serialize:Q}=ln(),Bs=Q.flush(),gc=Q.sync(),wc=Q.end(),pn=class pn extends yc{constructor(e){ +super(),e=e||{},this.stream=e.stream||new Ls.Socket,this._keepAlive=e.keepAlive, this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.lastBuffer= !1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this._emitMessage= !1;var t=this;this.on("newListener",function(n){n==="message"&&(t._emitMessage=!0)})}connect(e,t){ @@ -1204,36 +1205,36 @@ ssl)return this.attachListeners(this.stream);this.stream.once("data",function(s) var o=s.toString("utf8");switch(o){case"S":break;case"N":return n.stream.end(),n. emit("error",new Error("The server does not support SSL connections"));default:return n. stream.end(),n.emit("error",new Error("There was an error establishing an SSL co\ -nnection"))}var u=(Ts(),O(Cs));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( -c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Is.isIP(t)===0&&(c.servername=t);try{ +nnection"))}var u=(Ps(),N(Is));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( +c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Ls.isIP(t)===0&&(c.servername=t);try{ n.stream=u.connect(c)}catch(h){return n.emit("error",h)}n.attachListeners(n.stream), n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){e.on("end",()=>{ -this.emit("end")}),pc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& -this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(q.requestSsl())}startup(e){ -this.stream.write(q.startup(e))}cancel(e,t){this._send(q.cancel(e,t))}password(e){ -this._send(q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(q.sendSASLInitialResponseMessage( -e,t))}sendSCRAMClientFinalMessage(e){this._send(q.sendSCRAMClientFinalMessage(e))}_send(e){ -return this.stream.writable?this.stream.write(e):!1}query(e){this._send(q.query( -e))}parse(e){this._send(q.parse(e))}bind(e){this._send(q.bind(e))}execute(e){this. -_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ps)}sync(){this. -_ending=!0,this._send(Ps),this._send(dc)}ref(){this.stream.ref()}unref(){this.stream. +this.emit("end")}),mc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& +this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(Q.requestSsl())}startup(e){ +this.stream.write(Q.startup(e))}cancel(e,t){this._send(Q.cancel(e,t))}password(e){ +this._send(Q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(Q.sendSASLInitialResponseMessage( +e,t))}sendSCRAMClientFinalMessage(e){this._send(Q.sendSCRAMClientFinalMessage(e))}_send(e){ +return this.stream.writable?this.stream.write(e):!1}query(e){this._send(Q.query( +e))}parse(e){this._send(Q.parse(e))}bind(e){this._send(Q.bind(e))}execute(e){this. +_send(Q.execute(e))}flush(){this.stream.writable&&this.stream.write(Bs)}sync(){this. +_ending=!0,this._send(Bs),this._send(gc)}ref(){this.stream.ref()}unref(){this.stream. unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. -stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ -this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ -this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(pn,"Connection");var fn=pn;Ls.exports=fn});var Fs=I((ef,Rs)=>{"use strict";p();var mc=we().EventEmitter,Xl=(Ge(),O(He)),gc=tt(), -yn=Wi(),wc=Xi(),bc=wt(),Sc=bt(),Bs=ys(),xc=et(),vc=dn(),mn=class mn extends mc{constructor(e){ -super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. +stream.end();return}return this.stream.write(wc,()=>{this.stream.end()})}close(e){ +this._send(Q.close(e))}describe(e){this._send(Q.describe(e))}sendCopyFromChunk(e){ +this._send(Q.copyData(e))}endCopyFrom(){this._send(Q.copyDone())}sendCopyFail(e){ +this._send(Q.copyFail(e))}};a(pn,"Connection");var fn=pn;Rs.exports=fn});var ks=I((pf,Ms)=>{"use strict";p();var bc=be().EventEmitter,ff=(Ge(),N(He)),Sc=tt(), +yn=Hi(),xc=ts(),vc=wt(),Ec=bt(),Fs=gs(),_c=et(),Ac=dn(),mn=class mn extends bc{constructor(e){ +super(),this.connectionParameters=new Ec(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}), this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= -t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= +t.Promise||b.Promise,this._types=new vc(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new vc({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new Ac({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. -binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. +binary||_c.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}), this._connectionTimeoutMillis=t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=a( n=>{m.nextTick(()=>{n.handleError(e,this.connection)})},"enqueueError");this.activeQuery&& @@ -1271,10 +1272,10 @@ let t=this.connection;typeof this.password=="function"?this._Promise.resolve().t ()=>this.password()).then(n=>{if(n!==void 0){if(typeof n!="string"){t.emit("erro\ r",new TypeError("Password must be a string"));return}this.connectionParameters. password=this.password=n}else this.connectionParameters.password=this.password=null; -e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():wc(this.connectionParameters, +e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():xc(this.connectionParameters, n=>{n!==void 0&&(this.connectionParameters.password=this.password=n),e()})}_handleAuthCleartextPassword(e){ this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){ -this._checkPgPass(()=>{let t=gc.postgresMd5PasswordHash(this.user,this.password, +this._checkPgPass(()=>{let t=Sc.postgresMd5PasswordHash(this.user,this.password, e.salt);this.connection.password(t)})}_handleAuthSASL(e){this._checkPgPass(()=>{ this.saslSession=yn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( this.saslSession.mechanism,this.saslSession.response)})}_handleAuthSASLContinue(e){ @@ -1320,8 +1321,8 @@ e&&m.nextTick(()=>{this.activeQuery.handleError(e,this.connection),this.readyFor emit("drain"))}query(e,t,n){var i,s,o,u,c;if(e==null)throw new TypeError("Client\ was passed a null or undefined query");return typeof e.submit=="function"?(o=e. query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& -(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Bs( -e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,b)=>d?l(d):h(b)}))), +(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Fs( +e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,S)=>d?l(d):h(S)}))), o&&(c=i.callback,u=setTimeout(()=>{var h=new Error("Query read timeout");m.nextTick( ()=>{i.handleError(h,this.connection)}),c(h),i.callback=()=>{};var l=this.queryQueue. indexOf(i);l>-1&&this.queryQueue.splice(l,1),this._pulseQueryQueue()},o),i.callback= @@ -1335,18 +1336,18 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(mn,"Client");var Ct=mn;Ct.Query= -Bs;Rs.exports=Ct});var Us=I((nf,Ds)=>{"use strict";p();var Ec=we().EventEmitter,Ms=a(function(){},"\ -NOOP"),ks=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, +Fs;Ms.exports=Ct});var Ns=I((mf,Os)=>{"use strict";p();var Cc=be().EventEmitter,Ds=a(function(){},"\ +NOOP"),Us=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),bn=class bn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(bn,"IdleItem");var gn=bn,Sn=class Sn{constructor(e){this.callback= -e}};a(Sn,"PendingItem");var qe=Sn;function _c(){throw new Error("Release called \ -on client which has already been released to the pool.")}a(_c,"throwOnDoubleRele\ +e}};a(Sn,"PendingItem");var qe=Sn;function Tc(){throw new Error("Release called \ +on client which has already been released to the pool.")}a(Tc,"throwOnDoubleRele\ ase");function Tt(r,e){if(e)return{callback:e,result:void 0};let t,n,i=a(function(o,u){ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.captureStackTrace( -o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ +o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ic(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Ac,"makeIdleListener");var xn=class xn extends Ec{constructor(e,t){ +"idleListener")}a(Ic,"makeIdleListener");var xn=class xn extends Cc{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1354,7 +1355,7 @@ this.options.max=this.options.max||this.options.poolSize||10,this.options.maxUse this.options.maxUses||1/0,this.options.allowExitOnIdle=this.options.allowExitOnIdle|| !1,this.options.maxLifetimeSeconds=this.options.maxLifetimeSeconds||0,this.log=this. options.log||function(){},this.Client=this.options.Client||t||It().Client,this.Promise= -this.options.Promise||S.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this. +this.options.Promise||b.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this. options.idleTimeoutMillis=1e4),this._clients=[],this._idle=[],this._expired=new WeakSet, this._pendingQueue=[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_isFull(){ return this._clients.length>=this.options.max}_pulseQueue(){if(this.log("pulse q\ @@ -1365,25 +1366,25 @@ _pendingQueue.length){this.log("no queued requests");return}if(!this._idle.lengt this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let t=this. _idle.pop();clearTimeout(t.timeoutId);let n=t.client;n.ref&&n.ref();let i=t.idleListener; return this._acquireClient(n,e,i,!1)}if(!this._isFull())return this.newClient(e); -throw new Error("unexpected condition")}_remove(e){let t=ks(this._idle,n=>n.client=== +throw new Error("unexpected condition")}_remove(e){let t=Us(this._idle,n=>n.client=== e);t!==void 0&&clearTimeout(t.timeoutId),this._clients=this._clients.filter(n=>n!== e),e.end(),this.emit("remove",e)}connect(e){if(this.ending){let i=new Error("Can\ not use a pool after calling end on the pool");return e?e(i):this.Promise.reject( i)}let t=Tt(this.Promise,e),n=t.result;if(this._isFull()||this._idle.length){if(this. _idle.length&&m.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis) return this._pendingQueue.push(new qe(t.callback)),n;let i=a((u,c,h)=>{clearTimeout( -o),t.callback(u,c,h)},"queueCallback"),s=new qe(i),o=setTimeout(()=>{ks(this._pendingQueue, +o),t.callback(u,c,h)},"queueCallback"),s=new qe(i),o=setTimeout(()=>{Us(this._pendingQueue, u=>u.callback===i),s.timedOut=!0,t.callback(new Error("timeout exceeded when try\ ing to connect"))},this.options.connectionTimeoutMillis);return this._pendingQueue. push(s),n}return this.newClient(new qe(t.callback)),n}newClient(e){let t=new this. -Client(this.options);this._clients.push(t);let n=Ac(this,t);this.log("checking c\ +Client(this.options);this._clients.push(t);let n=Ic(this,t);this.log("checking c\ lient timeout");let i,s=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{ this.log("ending client due to timeout"),s=!0,t.connection?t.connection.stream.destroy(): t.end()},this.options.connectionTimeoutMillis)),this.log("connecting new client"), t.connect(o=>{if(i&&clearTimeout(i),t.on("error",n),o)this.log("client failed to\ connect",o),this._clients=this._clients.filter(u=>u!==t),s&&(o.message="Connect\ ion terminated due to connection timeout"),this._pulseQueue(),e.timedOut||e.callback( -o,void 0,Ms);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== +o,void 0,Ds);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== 0){let u=setTimeout(()=>{this.log("ending client due to expired lifetime"),this. _expired.add(t),this._idle.findIndex(h=>h.client===t)!==-1&&this._acquireClient( t,new qe((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.once( @@ -1391,8 +1392,8 @@ t,new qe((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.o i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n), e.removeListener("error",n),t.timedOut?i&&this.options.verify?this.options.verify( e,e.release):e.release():i&&this.options.verify?this.options.verify(e,s=>{if(s)return e. -release(s),t.callback(s,void 0,Ms);t.callback(void 0,e,e.release)}):t.callback(void 0, -e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&_c(),n=!0,this._release(e, +release(s),t.callback(s,void 0,Ds);t.callback(void 0,e,e.release)}):t.callback(void 0, +e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&Tc(),n=!0,this._release(e, t,i)}}_release(e,t,n){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1, this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>= this.options.maxUses){e._poolUseCount>=this.options.maxUses&&this.log("remove ex\ @@ -1414,7 +1415,7 @@ this.Promise.reject(n)}this.ending=!0;let t=Tt(this.Promise,e);return this._endC t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue. length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients. reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients. -length}};a(xn,"Pool");var wn=xn;Ds.exports=wn});var Os={};re(Os,{default:()=>Cc});var Cc,Ns=te(()=>{"use strict";p();Cc={}});var qs=I((uf,Tc)=>{Tc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ +length}};a(xn,"Pool");var wn=xn;Os.exports=wn});var qs={};te(qs,{default:()=>Pc});var Pc,Qs=z(()=>{"use strict";p();Pc={}});var Ws=I((Sf,Lc)=>{Lc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ client - pure javascript & libpq with the same API",keywords:["database","libpq", "pg","postgre","postgres","postgresql","rdbms"],homepage:"https://github.com/bri\ anc/node-postgres",repository:{type:"git",url:"git://github.com/brianc/node-post\ @@ -1425,16 +1426,16 @@ pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:" 4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ "pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ .md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ -7b9a5491a178655"}});var js=I((cf,Ws)=>{"use strict";p();var Qs=we().EventEmitter,Ic=(Ge(),O(He)),vn=tt(), -Qe=Ws.exports=function(r,e,t){Qs.call(this),r=vn.normalizeQueryConfig(r,e,t),this. +7b9a5491a178655"}});var Gs=I((xf,Hs)=>{"use strict";p();var js=be().EventEmitter,Bc=(Ge(),N(He)),vn=tt(), +Qe=Hs.exports=function(r,e,t){js.call(this),r=vn.normalizeQueryConfig(r,e,t),this. text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ -newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Ic.inherits( -Qe,Qs);var Pc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ +newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Bc.inherits( +Qe,js);var Rc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ age",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"\ dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"\ routine"};Qe.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); -if(e)for(var t in e){var n=Pc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. +if(e)for(var t in e){var n=Rc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. emit("error",r),this.state="error"};Qe.prototype.then=function(r,e){return this. _getPromise().then(r,e)};Qe.prototype.catch=function(r){return this._getPromise(). catch(r)};Qe.prototype._getPromise=function(){return this._promise?this._promise: @@ -1456,30 +1457,30 @@ this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. values.map(vn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Vs=I((pf,$s)=>{"use strict";p();var Lc=(Ns(),O(Os)),Bc=wt(),ff=qs(),Hs=we(). -EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),Gs=js(),Z=$s.exports=function(r){Hs.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Bc(r.types),this.native= -new Lc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= -!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( +text,t)}});var zs=I((Af,Vs)=>{"use strict";p();var Fc=(Qs(),N(qs)),Mc=wt(),_f=Ws(),$s=be(). +EventEmitter,kc=(Ge(),N(He)),Dc=bt(),Ks=Gs(),J=Vs.exports=function(r){$s.call(this), +r=r||{},this._Promise=r.Promise||b.Promise,this._types=new Mc(r.types),this.native= +new Fc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Dc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= -e.port,this.namedQueries={}};Z.Query=Gs;Rc.inherits(Z,Hs);Z.prototype._errorAllQueries= +e.port,this.namedQueries={}};J.Query=Ks;kc.inherits(J,$s);J.prototype._errorAllQueries= function(r){let e=a(t=>{m.nextTick(()=>{t.native=this.native,t.handleError(r)})}, "enqueueError");this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery= -null),this._queryQueue.forEach(e),this._queryQueue.length=0};Z.prototype._connect= +null),this._queryQueue.forEach(e),this._queryQueue.length=0};J.prototype._connect= function(r){var e=this;if(this._connecting){m.nextTick(()=>r(new Error("Client h\ as already been connected. You cannot reuse a client.")));return}this._connecting= !0,this.connectionParameters.getLibpqConnectionString(function(t,n){if(t)return r( t);e.native.connect(n,function(i){if(i)return e.native.end(),r(i);e._connected=!0, e.native.on("error",function(s){e._queryable=!1,e._errorAllQueries(s),e.emit("er\ ror",s)}),e.native.on("notification",function(s){e.emit("notification",{channel:s. -relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};Z. +relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};J. prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise( -(e,t)=>{this._connect(n=>{n?t(n):e()})})};Z.prototype.query=function(r,e,t){var n, +(e,t)=>{this._connect(n=>{n?t(n):e()})})};J.prototype.query=function(r,e,t){var n, i,s,o,u;if(r==null)throw new TypeError("Client was passed a null or undefined qu\ ery");if(typeof r.submit=="function")s=r.query_timeout||this.connectionParameters. query_timeout,i=n=r,typeof e=="function"&&(r.callback=e);else if(s=this.connectionParameters. -query_timeout,n=new Gs(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= +query_timeout,n=new Ks(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= l,h=d}),n.callback=(l,d)=>l?h(l):c(d)}return s&&(u=n.callback,o=setTimeout(()=>{ var c=new Error("Query read timeout");m.nextTick(()=>{n.handleError(c,this.connection)}), u(c),n.callback=()=>{};var h=this._queryQueue.indexOf(n);h>-1&&this._queryQueue. @@ -1488,39 +1489,39 @@ this._queryable?this._ending?(n.native=this.native,m.nextTick(()=>{n.handleError new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.push( n),this._pulseQueryQueue(),i):(n.native=this.native,m.nextTick(()=>{n.handleError( new Error("Client has encountered a connection error and is not queryable"))}),i)}; -Z.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( +J.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( "connect",this.end.bind(this,r));var t;return r||(t=new this._Promise(function(n,i){ r=a(s=>s?i(s):n(),"cb")})),this.native.end(function(){e._errorAllQueries(new Error( -"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};Z.prototype. +"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};J.prototype. _hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="\ -error"&&this._activeQuery.state!=="end"};Z.prototype._pulseQueryQueue=function(r){ +error"&&this._activeQuery.state!=="end"};J.prototype._pulseQueryQueue=function(r){ if(this._connected&&!this._hasActiveQuery()){var e=this._queryQueue.shift();if(!e){ r||this.emit("drain");return}this._activeQuery=e,e.submit(this);var t=this;e.once( -"_done",function(){t._pulseQueryQueue()})}};Z.prototype.cancel=function(r){this. +"_done",function(){t._pulseQueryQueue()})}};J.prototype.cancel=function(r){this. _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== --1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; -Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. -_types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var En=I((mf,Ks)=>{"use strict";p();Ks.exports=Vs()});var It=I((wf,nt)=>{"use strict";p();var Mc=Fs(),kc=et(),Dc=dn(),Uc=Us(),{DatabaseError:Oc}=ln(), -Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ -ool"),e},"poolFactory"),_n=a(function(r){this.defaults=kc,this.Client=r,this.Query= -this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. -types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new _n(En()):(nt.exports=new _n(Mc),Object.defineProperty(nt.exports,"na\ +-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};J.prototype.ref=function(){}; +J.prototype.unref=function(){};J.prototype.setTypeParser=function(r,e,t){return this. +_types.setTypeParser(r,e,t)};J.prototype.getTypeParser=function(r,e){return this. +_types.getTypeParser(r,e)}});var En=I((If,Ys)=>{"use strict";p();Ys.exports=zs()});var It=I((Lf,nt)=>{"use strict";p();var Uc=ks(),Oc=et(),Nc=dn(),qc=Ns(),{DatabaseError:Qc}=ln(), +Wc=a(r=>{var e;return e=class extends qc{constructor(n){super(n,r)}},a(e,"BoundP\ +ool"),e},"poolFactory"),_n=a(function(r){this.defaults=Oc,this.Client=r,this.Query= +this.Client.Query,this.Pool=Wc(this.Client),this._pools=[],this.Connection=Nc,this. +types=Xe(),this.DatabaseError=Qc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. +exports=new _n(En()):(nt.exports=new _n(Uc),Object.defineProperty(nt.exports,"na\ tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new _n(En())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});var Gc={};re(Gc,{Client:()=>Lt,ClientBase:()=>oe.ClientBase,Connection:()=>oe.Connection, -DatabaseError:()=>oe.DatabaseError,NeonDbError:()=>he,Pool:()=>Cn,Query:()=>oe.Query, -defaults:()=>oe.defaults,neon:()=>An,neonConfig:()=>Se,types:()=>oe.types});module. -exports=O(Gc);p();var Bt=Ie(It());St();p();St();gr();var Zs=Ie(tt()),Js=Ie(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ -rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", -"NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); -_(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ -ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, -"constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ +native",{value:r}),r}}))});var zc={};te(zc,{Client:()=>Lt,ClientBase:()=>se.ClientBase,Connection:()=>se.Connection, +DatabaseError:()=>se.DatabaseError,NeonDbError:()=>he,Pool:()=>Cn,Query:()=>se.Query, +defaults:()=>se.defaults,neon:()=>An,neonConfig:()=>xe,types:()=>se.types});module. +exports=N(zc);p();var Bt=Ie(It());St();p();St();gr();var Xs=Ie(tt()),eo=Ie(wt());function jc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(jc,"encodeBuffe\ +rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);A(this,"name", +"NeonDbError");A(this,"severity");A(this,"code");A(this,"detail");A(this,"hint"); +A(this,"position");A(this,"internalPosition");A(this,"internalQuery");A(this,"wh\ +ere");A(this,"schema");A(this,"table");A(this,"column");A(this,"dataType");A(this, +"constraint");A(this,"file");A(this,"line");A(this,"routine");A(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. -captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var he=Pt,zs="transaction() exp\ -ects an array of queries, or a function returning an array of queries",Qc=["seve\ +captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var he=Pt,Zs="transaction() exp\ +ects an array of queries, or a function returning an array of queries",Hc=["seve\ rity","code","detail","hint","position","internalPosition","internalQuery","wher\ e","schema","table","column","dataType","constraint","file","line","routine"];function An(r,{ arrayMode:e,fullResults:t,fetchOptions:n,isolationLevel:i,readOnly:s,deferrable:o, @@ -1528,107 +1529,107 @@ queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=mr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:b,hostname:C,port:L,pathname:Q}=l;if(d!=="postgres:"&&d!== -"postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ - `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ -let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;Wqc((0,Zs.prepareValue)(W)));let D={ -query:P,params:g};return u&&u(D),Wc(ye,D,K)}a(J,"resolve"),J.transaction=async(A,g)=>{ -if(typeof A=="function"&&(A=A(J)),!Array.isArray(A))throw new Error(zs);A.forEach( -D=>{if(D[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(zs)});let P=A. -map(D=>D.parameterizedQuery),K=A.map(D=>D.opts??{});return ye(P,K,g)};async function ye(A,g,P){ -let{fetchEndpoint:K,fetchFunction:D}=Se,W=Array.isArray(A)?{queries:A}:A,X=n??{}, -ae=e??!1,R=t??!1,$=i,le=s,me=o;P!==void 0&&(P.fetchOptions!==void 0&&(X={...X,...P. -fetchOptions}),P.arrayMode!==void 0&&(ae=P.arrayMode),P.fullResults!==void 0&&(R= -P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& -(le=P.readOnly),P.deferrable!==void 0&&(me=P.deferrable)),g!==void 0&&!Array.isArray( -g)&&g.fetchOptions!==void 0&&(X={...X,...g.fetchOptions});let ve=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(ve=g.authToken);let We=typeof K=="function"?K(C,L,{jwtAuth:ve!== -void 0}):K,fe={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ -ray-Mode":"true"},it=await jc(ve);it&&(fe.Authorization=`Bearer ${it}`),Array.isArray( -A)&&($!==void 0&&(fe["Neon-Batch-Isolation-Level"]=$),le!==void 0&&(fe["Neon-Bat\ -ch-Read-Only"]=String(le)),me!==void 0&&(fe["Neon-Batch-Deferrable"]=String(me))); -let ee;try{ee=await(D??fetch)(We,{method:"POST",body:JSON.stringify(W),headers:fe, -...X})}catch(j){let H=new he(`Error connecting to database: ${j}`);throw H.sourceError= -j,H}if(ee.ok){let j=await ee.json();if(Array.isArray(A)){let H=j.results;if(!Array. -isArray(H))throw new he("Neon internal error: unexpected result format");return H. -map((Ce,Ee)=>{let Rt=g[Ee]??{},eo=Rt.arrayMode??ae,to=Rt.fullResults??R;return Ys( -Ce,{arrayMode:eo,fullResults:to,parameterizedQuery:A[Ee],resultCallback:c,types:Rt. -types})})}else{let H=g??{},Ce=H.arrayMode??ae,Ee=H.fullResults??R;return Ys(j,{arrayMode:Ce, -fullResults:Ee,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; -if(j===400){let H=await ee.json(),Ce=new he(H.message);for(let Ee of Qc)Ce[Ee]=H[Ee]?? -void 0;throw Ce}else{let H=await ee.text();throw new he(`Server error (HTTP stat\ -us ${j}): ${H}`)}}}return a(ye,"execute"),J}a(An,"neon");function Wc(r,e,t){return{ +let{protocol:d,username:S,hostname:_,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== +"postgresql:"||!S||!_||!G)throw new Error("Database connection string format for\ + `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(C,...g){ +let P,W;if(typeof C=="string")P=C,W=g[1],g=g[0]??[];else{P="";for(let j=0;jjc((0,Xs.prepareValue)(j)));let U={ +query:P,params:g};return u&&u(U),Gc(oe,U,W)}a(X,"resolve"),X.transaction=async(C,g)=>{ +if(typeof C=="function"&&(C=C(X)),!Array.isArray(C))throw new Error(Zs);C.forEach( +U=>{if(U[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Zs)});let P=C. +map(U=>U.parameterizedQuery),W=C.map(U=>U.opts??{});return oe(P,W,g)};async function oe(C,g,P){ +let{fetchEndpoint:W,fetchFunction:U}=xe,j=Array.isArray(C)?{queries:C}:C,ee=n??{}, +ae=e??!1,R=t??!1,$=i,le=s,ye=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, +...P.fetchOptions}),P.arrayMode!==void 0&&(ae=P.arrayMode),P.fullResults!==void 0&& +(R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& +(le=P.readOnly),P.deferrable!==void 0&&(ye=P.deferrable)),g!==void 0&&!Array.isArray( +g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let Ee=h;!Array.isArray( +g)&&g?.authToken!==void 0&&(Ee=g.authToken);let We=typeof W=="function"?W(_,L,{jwtAuth:Ee!== +void 0}):W,fe={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ +ray-Mode":"true"},it=await $c(Ee);it&&(fe.Authorization=`Bearer ${it}`),Array.isArray( +C)&&($!==void 0&&(fe["Neon-Batch-Isolation-Level"]=$),le!==void 0&&(fe["Neon-Bat\ +ch-Read-Only"]=String(le)),ye!==void 0&&(fe["Neon-Batch-Deferrable"]=String(ye))); +let me;try{me=await(U??fetch)(We,{method:"POST",body:JSON.stringify(j),headers:fe, +...ee})}catch(V){let D=new he(`Error connecting to database: ${V}`);throw D.sourceError= +V,D}if(me.ok){let V=await me.json();if(Array.isArray(C)){let D=V.results;if(!Array. +isArray(D))throw new he("Neon internal error: unexpected result format");return D. +map((ge,_e)=>{let Rt=g[_e]??{},ro=Rt.arrayMode??ae,no=Rt.fullResults??R;return Js( +ge,{arrayMode:ro,fullResults:no,parameterizedQuery:C[_e],resultCallback:c,types:Rt. +types})})}else{let D=g??{},ge=D.arrayMode??ae,_e=D.fullResults??R;return Js(V,{arrayMode:ge, +fullResults:_e,parameterizedQuery:C,resultCallback:c,types:D.types})}}else{let{status:V}=me; +if(V===400){let D=await me.json(),ge=new he(D.message);for(let _e of Hc)ge[_e]=D[_e]?? +void 0;throw ge}else{let D=await me.text();throw new he(`Server error (HTTP stat\ +us ${V}): ${D}`)}}}return a(oe,"execute"),X}a(An,"neon");function Gc(r,e,t){return{ [Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a((n,i)=>r( e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r(e,t).finally( -n),"finally")}}a(Wc,"createNeonQueryPromise");function Ys(r,{arrayMode:e,fullResults:t, -parameterizedQuery:n,resultCallback:i,types:s}){let o=new Js.default(s),u=r.fields. +n),"finally")}}a(Gc,"createNeonQueryPromise");function Js(r,{arrayMode:e,fullResults:t, +parameterizedQuery:n,resultCallback:i,types:s}){let o=new eo.default(s),u=r.fields. map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e===!0?r.rows. -map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries(l.map( -(d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), -t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ys,"\ -processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== +map(l=>l.map((d,S)=>d===null?null:c[S](d))):r.rows.map(l=>Object.fromEntries(l.map( +(d,S)=>[u[S],d===null?null:c[S](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), +t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Js,"\ +processQueryResult");async function $c(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new he("Error ge\ tting auth token.");throw e instanceof Error&&(t=new he(`Error getting auth toke\ -n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Ie(bt()),oe=Ie(It());var Tn=class Tn extends Bt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ -return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& -(this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ -SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ - + forceDisablePgSSL = false) and the WebSocket tunnel (useSecureWebSocket = tru\ -e). Double encryption will increase latency and CPU usage. It may be appropriate\ - to disable SSL in the Postgres connection parameters or set forceDisablePgSSL =\ - true.");let i=this.config?.host!==void 0||this.config?.connectionString!==void 0|| -m.env.PGHOST!==void 0,s=m.env.USER??m.env.USERNAME;if(!i&&this.host==="localhost"&& -this.user===s&&this.database===s&&this.password===null)throw new Error(`No datab\ -ase host or connection string was set, and key parameters have default values (h\ -ost: localhost, user: ${s}, db: ${s}, password: null). Is an environment variabl\ -e missing? Alternatively, if you intended to connect with these parameters, plea\ -se set the host to 'localhost' explicitly.`);let o=super.connect(t),u=n.pipelineTLS&& -this.ssl,c=n.pipelineConnect==="password";if(!u&&!n.pipelineConnect)return o;let h=this. -connection;if(u&&h.on("connect",()=>h.stream.emit("data","S")),c){h.removeAllListeners( -"authenticationCleartextPassword"),h.removeAllListeners("readyForQuery"),h.once( -"readyForQuery",()=>h.on("readyForQuery",this._handleReadyForQuery.bind(this))); -let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassword(), -this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=this. -saslSession,i=this.password,s=t.data;if(n.message!=="SASLInitialResponse"||typeof i!= -"string"||typeof s!="string")throw new Error("SASL: protocol error");let o=Object. -fromEntries(s.split(",").map(ee=>{if(!/^.=/.test(ee))throw new Error("SASL: Inva\ -lid attribute pair entry");let j=ee[0],H=ee.substring(2);return[j,H]})),u=o.r,c=o. -s,h=o.i;if(!u||!/^[!-+--~]+$/.test(u))throw new Error("SASL: SCRAM-SERVER-FIRST-\ -MESSAGE: nonce missing/unprintable");if(!c||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ -64");if(!h||!/^[1-9][0-9]*$/.test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-M\ -ESSAGE: missing/invalid iteration count");if(!u.startsWith(n.clientNonce))throw new Error( +n: ${e.message}`)),t}}a($c,"getAuthToken");var to=Ie(bt()),se=Ie(It());var Kc="node:crypto",Tn=class Tn extends Bt.Client{constructor(t){super(t);this. +config=t}get neonConfig(){return this.connection.stream}connect(t){let{neonConfig:n}=this; +n.forceDisablePgSSL&&(this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&& +console.warn("SSL is enabled for both Postgres (e.g. ?sslmode=require in the con\ +nection string + forceDisablePgSSL = false) and the WebSocket tunnel (useSecureW\ +ebSocket = true). Double encryption will increase latency and CPU usage. It may \ +be appropriate to disable SSL in the Postgres connection parameters or set force\ +DisablePgSSL = true.");let i=this.config?.host!==void 0||this.config?.connectionString!== +void 0||m.env.PGHOST!==void 0,s=m.env.USER??m.env.USERNAME;if(!i&&this.host==="l\ +ocalhost"&&this.user===s&&this.database===s&&this.password===null)throw new Error( +`No database host or connection string was set, and key parameters have default \ +values (host: localhost, user: ${s}, db: ${s}, password: null). Is an environmen\ +t variable missing? Alternatively, if you intended to connect with these paramet\ +ers, please set the host to 'localhost' explicitly.`);let o=super.connect(t),u=n. +pipelineTLS&&this.ssl,c=n.pipelineConnect==="password";if(!u&&!n.pipelineConnect) +return o;let h=this.connection;if(u&&h.on("connect",()=>h.stream.emit("data","S")), +c){h.removeAllListeners("authenticationCleartextPassword"),h.removeAllListeners( +"readyForQuery"),h.once("readyForQuery",()=>h.on("readyForQuery",this._handleReadyForQuery. +bind(this)));let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassword(), +this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=typeof w< +"u"&&w.subtle!==void 0&&w.subtle.importKey!==void 0?w.subtle:(await import(Kc)). +webcrypto.subtle,i=this.saslSession,s=this.password,o=t.data;if(i.message!=="SAS\ +LInitialResponse"||typeof s!="string"||typeof o!="string")throw new Error("SASL:\ + protocol error");let u=Object.fromEntries(o.split(",").map(V=>{if(!/^.=/.test(V)) +throw new Error("SASL: Invalid attribute pair entry");let D=V[0],ge=V.substring( +2);return[D,ge]})),c=u.r,h=u.s,l=u.i;if(!c||!/^[!-+--~]+$/.test(c))throw new Error( +"SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable");if(!h||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ +64");if(!l||!/^[1-9][0-9]*$/.test(l))throw new Error("SASL: SCRAM-SERVER-FIRST-M\ +ESSAGE: missing/invalid iteration count");if(!c.startsWith(i.clientNonce))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); -if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ -SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, -C=b.encode(i),L=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ -6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",L,y.concat([d,y.from( -[0,0,0,1])]))),J=Q;for(var ye=0;yeJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. -subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", -P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,ae=D+","+W+ -","+X,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, -["sign"]);var $=new Uint8Array(await w.subtle.sign("HMAC",R,b.encode(ae))),le=y. -from(P.map((ee,j)=>P[j]^$[j])),me=le.toString("base64");let ve=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),We=await w.subtle.sign( -"HMAC",ve,b.encode("Server Key")),fe=await w.subtle.importKey("raw",We,{name:"HM\ -AC",hash:{name:"SHA-256"}},!1,["sign"]);var it=y.from(await w.subtle.sign("HMAC", -fe,b.encode(ae)));n.message="SASLResponse",n.serverSignature=it.toString("base64"), -n.response=X+",p="+me,this.connection.sendSCRAMClientFinalMessage(this.saslSession. -response)}};a(Tn,"NeonClient");var Lt=Tn;function Hc(r,e){if(e)return{callback:e, +if(c.length===i.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ +SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),_=new TextEncoder, +L=_.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, +["sign"]),X=new Uint8Array(await n.sign("HMAC",G,y.concat([S,y.from([0,0,0,1])]))), +oe=X;for(var C=0;Coe[D]^X[D]));let g=oe,P=await n.importKey("raw",g,{name:"HMAC",hash:{ +name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,_.encode("C\ +lient Key"))),U=await n.digest("SHA-256",W),j="n=*,r="+i.clientNonce,ee="r="+c+"\ +,s="+h+",i="+d,ae="c=biws,r="+c,R=j+","+ee+","+ae,$=await n.importKey("raw",U,{name:"\ +HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var le=new Uint8Array(await n.sign("HM\ +AC",$,_.encode(R))),ye=y.from(W.map((V,D)=>W[D]^le[D])),Ee=ye.toString("base64"); +let We=await n.importKey("raw",g,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]), +fe=await n.sign("HMAC",We,_.encode("Server Key")),it=await n.importKey("raw",fe, +{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var me=y.from(await n.sign("HMA\ +C",it,_.encode(R)));i.message="SASLResponse",i.serverSignature=me.toString("base\ +64"),i.response=ae+",p="+Ee,this.connection.sendSCRAMClientFinalMessage(this.saslSession. +response)}};a(Tn,"NeonClient");var Lt=Tn;function Vc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var In=class In extends Bt.Pool{constructor(){ -super(...arguments);_(this,"Client",Lt);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ +n=o,t=u});return{callback:i,result:s}}a(Vc,"promisify");var In=class In extends Bt.Pool{constructor(){ +super(...arguments);A(this,"Client",Lt);A(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ -if(!Se.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Hc(this.Promise, -i);i=s.callback;try{let o=new Xs.default(this.options),u=encodeURIComponent,c=encodeURI, +if(!xe.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") +return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Vc(this.Promise, +i);i=s.callback;try{let o=new to.default(this.options),u=encodeURIComponent,c=encodeURI, h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== "string"?t:t.text,d=n??t.values??[];An(h,{fullResults:!0,arrayMode:t.rowMode==="\ -array"})(l,d,{types:t.types??this.options?.types}).then(C=>i(void 0,C)).catch(C=>i( -C))}catch(o){i(o)}return s.result}};a(In,"NeonPool");var Cn=In; +array"})(l,d,{types:t.types??this.options?.types}).then(_=>i(void 0,_)).catch(_=>i( +_))}catch(o){i(o)}return s.result}};a(In,"NeonPool");var Cn=In; /*! Bundled license information: ieee754/index.js: diff --git a/dist/npm/index.mjs b/dist/npm/index.mjs index d214ea2..3b90a42 100644 --- a/dist/npm/index.mjs +++ b/dist/npm/index.mjs @@ -1,89 +1,92 @@ -var ro=Object.create;var Ce=Object.defineProperty;var no=Object.getOwnPropertyDescriptor;var io=Object.getOwnPropertyNames;var so=Object.getPrototypeOf,oo=Object.prototype.hasOwnProperty;var ao=(r,e,t)=>e in r?Ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): -r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0});var te=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),se=(r,e)=>{for(var t in e) -Ce(r,t,{get:e[t],enumerable:!0})},Tn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== -"function")for(let i of io(e))!oo.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= -no(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?ro(so(r)):{},Tn(e||!r||!r.__esModule?Ce(t,"default",{ -value:r,enumerable:!0}):t,r)),O=r=>Tn(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ao(r,typeof e!="symbol"?e+"":e,t);var Ln=I(st=>{"use strict";p();st.byteLength=co;st.toByteArray=lo;st.fromByteArray= -yo;var ae=[],re=[],uo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ -PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ve=0,In=Rt.length;vee in r?Ce(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}): +r[e]=t;var a=(r,e)=>Ce(r,"name",{value:e,configurable:!0}),Tn=(r=>typeof require<"u"?require: +typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)( +function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error( +'Dynamic require of "'+r+'" is not supported')});var z=(r,e)=>()=>(r&&(e=r(r=0)),e);var I=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ie=(r,e)=>{for(var t in e) +Ce(r,t,{get:e[t],enumerable:!0})},In=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== +"function")for(let i of ao(e))!co.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= +oo(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?so(uo(r)):{},In(e||!r||!r.__esModule?Ce(t,"default",{ +value:r,enumerable:!0}):t,r)),N=r=>In(Ce({},"__esModule",{value:!0}),r);var A=(r,e,t)=>ho(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=fo;st.toByteArray=yo;st.fromByteArray= +wo;var ae=[],te=[],lo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ +PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ee=0,Pn=Rt.length;Ee0)throw new Error("Invalid string. Length must be a multip\ -le of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}a(Pn, -"getLens");function co(r){var e=Pn(r),t=e[0],n=e[1];return(t+n)*3/4-n}a(co,"byte\ -Length");function ho(r,e,t){return(e+t)*3/4-t}a(ho,"_byteLength");function lo(r){ -var e,t=Pn(r),n=t[0],i=t[1],s=new uo(ho(r,n,i)),o=0,u=i>0?n-4:n,c;for(c=0;c0?n-4:n,c;for(c=0;c>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e= -re[r.charCodeAt(c)]<<2|re[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=re[r.charCodeAt( -c)]<<10|re[r.charCodeAt(c+1)]<<4|re[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= -e&255),s}a(lo,"toByteArray");function fo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[r>> -6&63]+ae[r&63]}a(fo,"tripletToBase64");function po(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ +te[r.charCodeAt(c)]<<2|te[r.charCodeAt(c+1)]>>4,s[o++]=e&255),i===1&&(e=te[r.charCodeAt( +c)]<<10|te[r.charCodeAt(c+1)]<<4|te[r.charCodeAt(c+2)]>>2,s[o++]=e>>8&255,s[o++]= +e&255),s}a(yo,"toByteArray");function mo(r){return ae[r>>18&63]+ae[r>>12&63]+ae[r>> +6&63]+ae[r&63]}a(mo,"tripletToBase64");function go(r,e,t){for(var n,i=[],s=e;su?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ ae[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ae[e>>10]+ae[e>>4&63]+ae[e<< -2&63]+"=")),i.join("")}a(yo,"fromByteArray")});var Bn=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> -1,l=-7,d=t?i-1:0,b=t?-1:1,C=r[e+d];for(d+=b,s=C&(1<<-l)-1,C>>=-l,l+=u;l>0;s=s*256+ -r[e+d],d+=b,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=b,l-=8);if(s=== -0)s=1-h;else{if(s===c)return o?NaN:(C?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(C? +2&63]+"=")),i.join("")}a(wo,"fromByteArray")});var Rn=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> +1,l=-7,d=t?i-1:0,S=t?-1:1,_=r[e+d];for(d+=S,s=_&(1<<-l)-1,_>>=-l,l+=u;l>0;s=s*256+ +r[e+d],d+=S,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=S,l-=8);if(s=== +0)s=1-h;else{if(s===c)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(_? -1:1)*o*Math.pow(2,s-n)};Ft.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,C=n?0:s-1,L=n?1:-1,Q=e<0|| +h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,L=n?1:-1,G=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. -floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=b/c:e+= -b*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+C]=u&255,C+=L,u/=256, -i-=8);for(o=o<0;r[t+C]=o&255,C+=L,o/=256,h-=8);r[t+C-L]|=Q*128}});var Kn=I(Be=>{"use strict";p();var Mt=Ln(),Pe=Bn(),Rn=typeof Symbol=="function"&& +floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=S/c:e+= +S*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+_]=u&255,_+=L,u/=256, +i-=8);for(o=o<0;r[t+_]=o&255,_+=L,o/=256,h-=8);r[t+_-L]|=G*128}});var zn=I(Be=>{"use strict";p();var Mt=Bn(),Pe=Rn(),Fn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Be.Buffer= -f;Be.SlowBuffer=xo;Be.INSPECT_MAX_BYTES=50;var ot=2147483647;Be.kMaxLength=ot;f. -TYPED_ARRAY_SUPPORT=mo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. +f;Be.SlowBuffer=_o;Be.INSPECT_MAX_BYTES=50;var ot=2147483647;Be.kMaxLength=ot;f. +TYPED_ARRAY_SUPPORT=bo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. error=="function"&&console.error("This browser lacks typed array (Uint8Array) su\ pport which is required by `buffer` v5.x. Use `buffer` v4.x if you require old b\ -rowser support.");function mo(){try{let r=new Uint8Array(1),e={foo:a(function(){ +rowser support.");function bo(){try{let r=new Uint8Array(1),e={foo:a(function(){ return 42},"foo")};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf( -r,e),r.foo()===42}catch{return!1}}a(mo,"typedArraySupport");Object.defineProperty( +r,e),r.foo()===42}catch{return!1}}a(bo,"typedArraySupport");Object.defineProperty( f.prototype,"parent",{enumerable:!0,get:a(function(){if(f.isBuffer(this))return this. buffer},"get")});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:a( function(){if(f.isBuffer(this))return this.byteOffset},"get")});function le(r){if(r> ot)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array( r);return Object.setPrototypeOf(e,f.prototype),e}a(le,"createBuffer");function f(r,e,t){ if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" a\ -rgument must be of type string. Received type number');return Ot(r)}return Dn(r, -e,t)}a(f,"Buffer");f.poolSize=8192;function Dn(r,e,t){if(typeof r=="string")return wo( -r,e);if(ArrayBuffer.isView(r))return bo(r);if(r==null)throw new TypeError("The f\ +rgument must be of type string. Received type number');return Ot(r)}return Un(r, +e,t)}a(f,"Buffer");f.poolSize=8192;function Un(r,e,t){if(typeof r=="string")return xo( +r,e);if(ArrayBuffer.isView(r))return vo(r);if(r==null)throw new TypeError("The f\ irst argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-l\ ike Object. Received type "+typeof r);if(ue(r,ArrayBuffer)||r&&ue(r.buffer,ArrayBuffer)|| typeof SharedArrayBuffer<"u"&&(ue(r,SharedArrayBuffer)||r&&ue(r.buffer,SharedArrayBuffer))) return Dt(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument\ must not be of type number. Received type number');let n=r.valueOf&&r.valueOf(); -if(n!=null&&n!==r)return f.from(n,e,t);let i=So(r);if(i)return i;if(typeof Symbol< +if(n!=null&&n!==r)return f.from(n,e,t);let i=Eo(r);if(i)return i;if(typeof Symbol< "u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return f. from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argumen\ t must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. \ -Received type "+typeof r)}a(Dn,"from");f.from=function(r,e,t){return Dn(r,e,t)}; +Received type "+typeof r)}a(Un,"from");f.from=function(r,e,t){return Un(r,e,t)}; Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f, -Uint8Array);function Un(r){if(typeof r!="number")throw new TypeError('"size" arg\ +Uint8Array);function On(r){if(typeof r!="number")throw new TypeError('"size" arg\ ument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is\ - invalid for option "size"')}a(Un,"assertSize");function go(r,e,t){return Un(r), -r<=0?le(r):e!==void 0?typeof t=="string"?le(r).fill(e,t):le(r).fill(e):le(r)}a(go, -"alloc");f.alloc=function(r,e,t){return go(r,e,t)};function Ot(r){return Un(r),le( + invalid for option "size"')}a(On,"assertSize");function So(r,e,t){return On(r), +r<=0?le(r):e!==void 0?typeof t=="string"?le(r).fill(e,t):le(r).fill(e):le(r)}a(So, +"alloc");f.alloc=function(r,e,t){return So(r,e,t)};function Ot(r){return On(r),le( r<0?0:Nt(r)|0)}a(Ot,"allocUnsafe");f.allocUnsafe=function(r){return Ot(r)};f.allocUnsafeSlow= -function(r){return Ot(r)};function wo(r,e){if((typeof e!="string"||e==="")&&(e="\ -utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=On(r,e)| -0,n=le(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(wo,"fromString");function kt(r){ +function(r){return Ot(r)};function xo(r,e){if((typeof e!="string"||e==="")&&(e="\ +utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Nn(r,e)| +0,n=le(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}a(xo,"fromString");function kt(r){ let e=r.length<0?0:Nt(r.length)|0,t=le(e);for(let n=0;n= +Array.isArray(r.data))return kt(r.data)}a(Eo,"fromObject");function Nt(r){if(r>= ot)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ -ot.toString(16)+" bytes");return r|0}a(Nt,"checked");function xo(r){return+r!=r&& -(r=0),f.alloc(+r)}a(xo,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. +ot.toString(16)+" bytes");return r|0}a(Nt,"checked");function _o(r){return+r!=r&& +(r=0),f.alloc(+r)}a(_o,"SlowBuffer");f.isBuffer=a(function(e){return e!=null&&e. _isBuffer===!0&&e!==f.prototype},"isBuffer");f.compare=a(function(e,t){if(ue(e,Uint8Array)&& (e=f.from(e,e.offset,e.byteLength)),ue(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)), !f.isBuffer(e)||!f.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments\ @@ -98,7 +101,7 @@ if(t===void 0)for(t=0,n=0;ni.length?(f.isBuffer( o)||(o=f.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(f.isBuffer( o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buf\ -fers');s+=o.length}return i},"concat");function On(r,e){if(f.isBuffer(r))return r. +fers');s+=o.length}return i},"concat");function Nn(r,e){if(f.isBuffer(r))return r. length;if(ArrayBuffer.isView(r)||ue(r,ArrayBuffer))return r.byteLength;if(typeof r!= "string")throw new TypeError('The "string" argument must be one of type string, \ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length> @@ -106,29 +109,29 @@ Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.len latin1":case"binary":return t;case"utf8":case"utf-8":return Ut(r).length;case"uc\ s2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"\ base64":return Vn(r).length;default:if(i)return n?-1:Ut(r).length;e=(""+e).toLowerCase(), -i=!0}}a(On,"byteLength");f.byteLength=On;function vo(r,e,t){let n=!1;if((e===void 0|| +i=!0}}a(Nn,"byteLength");f.byteLength=Nn;function Ao(r,e,t){let n=!1;if((e===void 0|| e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)|| -(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Ro( -this,e,t);case"utf8":case"utf-8":return qn(this,e,t);case"ascii":return Lo(this, -e,t);case"latin1":case"binary":return Bo(this,e,t);case"base64":return Io(this,e, -t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fo(this,e,t);default: +(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return ko( +this,e,t);case"utf8":case"utf-8":return Qn(this,e,t);case"ascii":return Fo(this, +e,t);case"latin1":case"binary":return Mo(this,e,t);case"base64":return Bo(this,e, +t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Do(this,e,t);default: if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}a( -vo,"slowToString");f.prototype._isBuffer=!0;function Ee(r,e,t){let n=r[e];r[e]=r[t], -r[t]=n}a(Ee,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) +Ao,"slowToString");f.prototype._isBuffer=!0;function _e(r,e,t){let n=r[e];r[e]=r[t], +r[t]=n}a(_e,"swap");f.prototype.swap16=a(function(){let e=this.length;if(e%2!==0) throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t< -e;t+=2)Ee(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. +e;t+=2)_e(this,t,t+1);return this},"swap16");f.prototype.swap32=a(function(){let e=this. length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bit\ -s");for(let t=0;tt&&(e+=" ... "),""},"inspect");Rn&&(f.prototype[Rn]=f.prototype.inspect);f.prototype.compare= +e+">"},"inspect");Fn&&(f.prototype[Fn]=f.prototype.inspect);f.prototype.compare= a(function(e,t,n,i,s){if(ue(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f. isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffe\ r or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e? @@ -136,43 +139,43 @@ e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0|| s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0; if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0; let o=s-i,u=n-t,c=Math.min(o,u),h=this.slice(i,s),l=e.slice(t,n);for(let d=0;d2147483647?t=2147483647: t<-2147483648&&(t=-2147483648),t=+t,Qt(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t), t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e== -"string"&&(e=f.from(e,n)),f.isBuffer(e))return e.length===0?-1:Fn(r,e,t,n,i);if(typeof e== +"string"&&(e=f.from(e,n)),f.isBuffer(e))return e.length===0?-1:Mn(r,e,t,n,i);if(typeof e== "number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array. -prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Fn(r, -[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}a(Nn,"bid\ -irectionalIndexOf");function Fn(r,e,t,n,i){let s=1,o=r.length,u=e.length;if(n!== +prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Mn(r, +[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}a(qn,"bid\ +irectionalIndexOf");function Mn(r,e,t,n,i){let s=1,o=r.length,u=e.length;if(n!== void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="\ utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,u/=2,t/=2}function c(l,d){ return s===1?l[d]:l.readUInt16BE(d*s)}a(c,"read");let h;if(i){let l=-1;for(h=t;h< o;h++)if(c(r,h)===c(e,l===-1?0:h-l)){if(l===-1&&(l=h),h-l+1===u)return l*s}else l!== -1&&(h-=h-l),l=-1}else for(t+u>o&&(t=o-u),h=t;h>=0;h--){let l=!0;for(let d=0;di&&(n=i)):n=i;let s=e.length;n> s/2&&(n=s/2);let o;for(o=0;o>>0,isFinite(n)? (n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.wri\ te(string, encoding, offset[, length]) is no longer supported");let s=this.length- t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError( "Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"\ -hex":return Eo(this,e,t,n);case"utf8":case"utf-8":return _o(this,e,t,n);case"asc\ -ii":case"latin1":case"binary":return Ao(this,e,t,n);case"base64":return Co(this, -e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return To(this,e,t,n);default: +hex":return Co(this,e,t,n);case"utf8":case"utf-8":return To(this,e,t,n);case"asc\ +ii":case"latin1":case"binary":return Io(this,e,t,n);case"base64":return Po(this, +e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lo(this,e,t,n);default: if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},"\ write");f.prototype.toJSON=a(function(){return{type:"Buffer",data:Array.prototype. -slice.call(this._arr||this,0)}},"toJSON");function Io(r,e,t){return e===0&&t===r. -length?Mt.fromByteArray(r):Mt.fromByteArray(r.slice(e,t))}a(Io,"base64Slice");function qn(r,e,t){ +slice.call(this._arr||this,0)}},"toJSON");function Bo(r,e,t){return e===0&&t===r. +length?Mt.fromByteArray(r):Mt.fromByteArray(r.slice(e,t))}a(Bo,"base64Slice");function Qn(r,e,t){ t=Math.min(r.length,t);let n=[],i=e;for(;i239?4:s>223? 3:s>191?2:1;if(i+u<=t){let c,h,l,d;switch(u){case 1:s<128&&(o=s);break;case 2:c= r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[i+ @@ -180,125 +183,125 @@ r[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[i+1],h=r[ d>57343)&&(o=d));break;case 4:c=r[i+1],h=r[i+2],l=r[i+3],(c&192)===128&&(h&192)=== 128&&(l&192)===128&&(d=(s&15)<<18|(c&63)<<12|(h&63)<<6|l&63,d>65535&&d<1114112&& (o=d))}}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320| -o&1023),n.push(o),i+=u}return Po(n)}a(qn,"utf8Slice");var Mn=4096;function Po(r){ -let e=r.length;if(e<=Mn)return String.fromCharCode.apply(String,r);let t="",n=0; -for(;nn)&&(t=n);let i="";for(let s=e;sn)&&(t=n);let i="";for(let s=e;sn&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),tt)throw new RangeError( -"Trying to access beyond buffer length")}a(N,"checkOffset");f.prototype.readUintLE= -f.prototype.readUIntLE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e], +"Trying to access beyond buffer length")}a(q,"checkOffset");f.prototype.readUintLE= +f.prototype.readUIntLE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this.length);let i=this[e], s=1,o=0;for(;++o>>0,t=t>>>0,n||N(e,t,this. +readUintBE=f.prototype.readUIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this. length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]*s;return i},"re\ adUIntBE");f.prototype.readUint8=f.prototype.readUInt8=a(function(e,t){return e= -e>>>0,t||N(e,1,this.length),this[e]},"readUInt8");f.prototype.readUint16LE=f.prototype. -readUInt16LE=a(function(e,t){return e=e>>>0,t||N(e,2,this.length),this[e]|this[e+ +e>>>0,t||q(e,1,this.length),this[e]},"readUInt8");f.prototype.readUint16LE=f.prototype. +readUInt16LE=a(function(e,t){return e=e>>>0,t||q(e,2,this.length),this[e]|this[e+ 1]<<8},"readUInt16LE");f.prototype.readUint16BE=f.prototype.readUInt16BE=a(function(e,t){ -return e=e>>>0,t||N(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");f.prototype. -readUint32LE=f.prototype.readUInt32LE=a(function(e,t){return e=e>>>0,t||N(e,4,this. +return e=e>>>0,t||q(e,2,this.length),this[e]<<8|this[e+1]},"readUInt16BE");f.prototype. +readUint32LE=f.prototype.readUInt32LE=a(function(e,t){return e=e>>>0,t||q(e,4,this. length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},"readUInt32LE"); f.prototype.readUint32BE=f.prototype.readUInt32BE=a(function(e,t){return e=e>>>0, -t||N(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ -readUInt32BE");f.prototype.readBigUInt64LE=me(a(function(e){e=e>>>0,Le(e,"offset"); +t||q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},"\ +readUInt32BE");f.prototype.readBigUInt64LE=ge(a(function(e){e=e>>>0,Le(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=t+ this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]* 2**16+n*2**24;return BigInt(i)+(BigInt(s)<>>0,Le(e,"offset");let t=this[e],n=this[e+7]; +readBigUInt64BE=ge(a(function(e){e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7]; (t===void 0||n===void 0)&&je(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]* 2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt( i)<>>0,t=t>>>0,n||N(e,t,this.length);let i=this[e],s=1,o=0;for(;++o>>0,t=t>>>0,n||q(e,t,this.length);let i=this[e],s=1,o=0;for(;++o=s&&(i-=Math.pow(2,8*t)),i},"readIntLE");f.prototype. -readIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||N(e,t,this.length);let i=t,s=1,o=this[e+ +readIntBE=a(function(e,t,n){e=e>>>0,t=t>>>0,n||q(e,t,this.length);let i=t,s=1,o=this[e+ --i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)), -o},"readIntBE");f.prototype.readInt8=a(function(e,t){return e=e>>>0,t||N(e,1,this. +o},"readIntBE");f.prototype.readInt8=a(function(e,t){return e=e>>>0,t||q(e,1,this. length),this[e]&128?(255-this[e]+1)*-1:this[e]},"readInt8");f.prototype.readInt16LE= -a(function(e,t){e=e>>>0,t||N(e,2,this.length);let n=this[e]|this[e+1]<<8;return n& +a(function(e,t){e=e>>>0,t||q(e,2,this.length);let n=this[e]|this[e+1]<<8;return n& 32768?n|4294901760:n},"readInt16LE");f.prototype.readInt16BE=a(function(e,t){e=e>>> -0,t||N(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n}, -"readInt16BE");f.prototype.readInt32LE=a(function(e,t){return e=e>>>0,t||N(e,4,this. +0,t||q(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n}, +"readInt16BE");f.prototype.readInt32LE=a(function(e,t){return e=e>>>0,t||q(e,4,this. length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},"readInt32LE");f.prototype. -readInt32BE=a(function(e,t){return e=e>>>0,t||N(e,4,this.length),this[e]<<24|this[e+ -1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=me(a(function(e){ +readInt32BE=a(function(e,t){return e=e>>>0,t||q(e,4,this.length),this[e]<<24|this[e+ +1]<<16|this[e+2]<<8|this[e+3]},"readInt32BE");f.prototype.readBigInt64LE=ge(a(function(e){ e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e, this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt( i)<>>0,Le(e,"offset"); +igInt64LE"));f.prototype.readBigInt64BE=ge(a(function(e){e=e>>>0,Le(e,"offset"); let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&je(e,this.length-8);let i=(t<< 24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,t||N(e,4,this.length),Pe.read(this,e, +readFloatLE=a(function(e,t){return e=e>>>0,t||q(e,4,this.length),Pe.read(this,e, !0,23,4)},"readFloatLE");f.prototype.readFloatBE=a(function(e,t){return e=e>>>0, -t||N(e,4,this.length),Pe.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= -a(function(e,t){return e=e>>>0,t||N(e,8,this.length),Pe.read(this,e,!0,52,8)},"r\ -eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||N(e,8,this. -length),Pe.read(this,e,!1,52,8)},"readDoubleBE");function z(r,e,t,n,i,s){if(!f.isBuffer( +t||q(e,4,this.length),Pe.read(this,e,!1,23,4)},"readFloatBE");f.prototype.readDoubleLE= +a(function(e,t){return e=e>>>0,t||q(e,8,this.length),Pe.read(this,e,!0,52,8)},"r\ +eadDoubleLE");f.prototype.readDoubleBE=a(function(e,t){return e=e>>>0,t||q(e,8,this. +length),Pe.read(this,e,!1,52,8)},"readDoubleBE");function Y(r,e,t,n,i,s){if(!f.isBuffer( r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e< s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError( -"Index out of range")}a(z,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= -a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e, +"Index out of range")}a(Y,"checkInt");f.prototype.writeUintLE=f.prototype.writeUIntLE= +a(function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e, t,n,u,0)}let s=1,o=0;for(this[t]=e&255;++o>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;z(this,e,t,n,u,0)}let s=n-1, +if(e=+e,t=t>>>0,n=n>>>0,!i){let u=Math.pow(2,8*n)-1;Y(this,e,t,n,u,0)}let s=n-1, o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n},"writeUI\ ntBE");f.prototype.writeUint8=f.prototype.writeUInt8=a(function(e,t,n){return e= -+e,t=t>>>0,n||z(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= -f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, ++e,t=t>>>0,n||Y(this,e,t,1,255,0),this[t]=e&255,t+1},"writeUInt8");f.prototype.writeUint16LE= +f.prototype.writeUInt16LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, 65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},"writeUInt16LE");f.prototype.writeUint16BE= -f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2, +f.prototype.writeUInt16BE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2, 65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},"writeUInt16BE");f.prototype.writeUint32LE= -f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,4, +f.prototype.writeUInt32LE=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,4, 4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+ 4},"writeUInt32LE");f.prototype.writeUint32BE=f.prototype.writeUInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, -this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function Qn(r,e,t,n,i){$n( +return e=+e,t=t>>>0,n||Y(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16, +this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeUInt32BE");function Wn(r,e,t,n,i){Kn( e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8, r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]= -o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Qn,"wrtBigUInt64LE");function Wn(r,e,t,n,i){ -$n(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> +o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}a(Wn,"wrtBigUInt64LE");function jn(r,e,t,n,i){ +Kn(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>> 8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+ -3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(Wn,"wrtBigUInt64BE");f. -prototype.writeBigUInt64LE=me(a(function(e,t=0){return Qn(this,e,t,BigInt(0),BigInt( -"0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=me(a(function(e,t=0){ -return Wn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); +3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}a(jn,"wrtBigUInt64BE");f. +prototype.writeBigUInt64LE=ge(a(function(e,t=0){return Wn(this,e,t,BigInt(0),BigInt( +"0xffffffffffffffff"))},"writeBigUInt64LE"));f.prototype.writeBigUInt64BE=ge(a(function(e,t=0){ +return jn(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))},"writeBigUInt64BE")); f.prototype.writeIntLE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow(2, -8*n-1);z(this,e,t,n,c-1,-c)}let s=0,o=1,u=0;for(this[t]=e&255;++s>0)-u&255;return t+n},"writeIntL\ E");f.prototype.writeIntBE=a(function(e,t,n,i){if(e=+e,t=t>>>0,!i){let c=Math.pow( -2,8*n-1);z(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= +2,8*n-1);Y(this,e,t,n,c-1,-c)}let s=n-1,o=1,u=0;for(this[t+s]=e&255;--s>=0&&(o*= 256);)e<0&&u===0&&this[t+s+1]!==0&&(u=1),this[t+s]=(e/o>>0)-u&255;return t+n},"w\ -riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||z(this, +riteIntBE");f.prototype.writeInt8=a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this, e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},"writeInt8");f.prototype.writeInt16LE= -a(function(e,t,n){return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e&255, +a(function(e,t,n){return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e&255, this[t+1]=e>>>8,t+2},"writeInt16LE");f.prototype.writeInt16BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, +return e=+e,t=t>>>0,n||Y(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255, t+2},"writeInt16BE");f.prototype.writeInt32LE=a(function(e,t,n){return e=+e,t=t>>> -0,n||z(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= +0,n||Y(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]= e>>>16,this[t+3]=e>>>24,t+4},"writeInt32LE");f.prototype.writeInt32BE=a(function(e,t,n){ -return e=+e,t=t>>>0,n||z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ +return e=+e,t=t>>>0,n||Y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+ 1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},"writeIn\ -t32BE");f.prototype.writeBigInt64LE=me(a(function(e,t=0){return Qn(this,e,t,-BigInt( +t32BE");f.prototype.writeBigInt64LE=ge(a(function(e,t=0){return Wn(this,e,t,-BigInt( "0x8000000000000000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64LE"));f.prototype. -writeBigInt64BE=me(a(function(e,t=0){return Wn(this,e,t,-BigInt("0x8000000000000\ -000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function jn(r,e,t,n,i,s){ +writeBigInt64BE=ge(a(function(e,t=0){return jn(this,e,t,-BigInt("0x8000000000000\ +000"),BigInt("0x7fffffffffffffff"))},"writeBigInt64BE"));function Hn(r,e,t,n,i,s){ if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError( -"Index out of range")}a(jn,"checkIEEE754");function Hn(r,e,t,n,i){return e=+e,t= -t>>>0,i||jn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Pe.write(r,e,t,n, -23,4),t+4}a(Hn,"writeFloat");f.prototype.writeFloatLE=a(function(e,t,n){return Hn( -this,e,t,!0,n)},"writeFloatLE");f.prototype.writeFloatBE=a(function(e,t,n){return Hn( -this,e,t,!1,n)},"writeFloatBE");function Gn(r,e,t,n,i){return e=+e,t=t>>>0,i||jn( +"Index out of range")}a(Hn,"checkIEEE754");function Gn(r,e,t,n,i){return e=+e,t= +t>>>0,i||Hn(r,e,t,4,34028234663852886e22,-34028234663852886e22),Pe.write(r,e,t,n, +23,4),t+4}a(Gn,"writeFloat");f.prototype.writeFloatLE=a(function(e,t,n){return Gn( +this,e,t,!0,n)},"writeFloatLE");f.prototype.writeFloatBE=a(function(e,t,n){return Gn( +this,e,t,!1,n)},"writeFloatBE");function $n(r,e,t,n,i){return e=+e,t=t>>>0,i||Hn( r,e,t,8,17976931348623157e292,-17976931348623157e292),Pe.write(r,e,t,n,52,8),t+8} -a(Gn,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return Gn(this,e, -t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return Gn( +a($n,"writeDouble");f.prototype.writeDoubleLE=a(function(e,t,n){return $n(this,e, +t,!0,n)},"writeDoubleLE");f.prototype.writeDoubleBE=a(function(e,t,n){return $n( this,e,t,!1,n)},"writeDoubleBE");f.prototype.copy=a(function(e,t,n,i){if(!f.isBuffer( e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i= this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i2**32?i=kn(String(t)):typeof t=="bigint"&&(i=String(t), -(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=kn(i)),i+="n"),n+=` It\ - must be ${e}. Received ${i}`,n},RangeError);function kn(r){let e="",t=r.length, +isInteger(t)&&Math.abs(t)>2**32?i=Dn(String(t)):typeof t=="bigint"&&(i=String(t), +(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Dn(i)),i+="n"),n+=` It\ + must be ${e}. Received ${i}`,n},RangeError);function Dn(r){let e="",t=r.length, n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0, -t)}${e}`}a(kn,"addNumericalSeparator");function Mo(r,e,t){Le(e,"offset"),(r[e]=== -void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Mo,"checkBounds");function $n(r,e,t,n,i,s){ +t)}${e}`}a(Dn,"addNumericalSeparator");function Uo(r,e,t){Le(e,"offset"),(r[e]=== +void 0||r[e+t]===void 0)&&je(e,r.length-(t+1))}a(Uo,"checkBounds");function Kn(r,e,t,n,i,s){ if(r>t||r3?e===0||e===BigInt(0)?u= `>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:u=`>= -(2${o} ** ${(s+1)*8-1}${o}) and \ < 2 ** ${(s+1)*8-1}${o}`:u=`>= ${e}${o} and <= ${t}${o}`,new Ie.ERR_OUT_OF_RANGE( -"value",u,r)}Mo(n,i,s)}a($n,"checkIntBI");function Le(r,e){if(typeof r!="number") +"value",u,r)}Uo(n,i,s)}a(Kn,"checkIntBI");function Le(r,e){if(typeof r!="number") throw new Ie.ERR_INVALID_ARG_TYPE(e,"number",r)}a(Le,"validateNumber");function je(r,e,t){ throw Math.floor(r)!==r?(Le(r,t),new Ie.ERR_OUT_OF_RANGE(t||"offset","an integer", r)):e<0?new Ie.ERR_BUFFER_OUT_OF_BOUNDS:new Ie.ERR_OUT_OF_RANGE(t||"offset",`>= ${t? -1:0} and <= ${e}`,r)}a(je,"boundsError");var ko=/[^+/0-9A-Za-z-_]/g;function Do(r){ -if(r=r.split("=")[0],r=r.trim().replace(ko,""),r.length<2)return"";for(;r.length% -4!==0;)r=r+"=";return r}a(Do,"base64clean");function Ut(r,e){e=e||1/0;let t,n=r. +1:0} and <= ${e}`,r)}a(je,"boundsError");var Oo=/[^+/0-9A-Za-z-_]/g;function No(r){ +if(r=r.split("=")[0],r=r.trim().replace(Oo,""),r.length<2)return"";for(;r.length% +4!==0;)r=r+"=";return r}a(No,"base64clean");function Ut(r,e){e=e||1/0;let t,n=r. length,i=null,s=[];for(let o=0;o55295&&t<57344){if(!i){ if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&& s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, @@ -351,73 +354,73 @@ s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191, s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>> 6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63| 128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}a( -Ut,"utf8ToBytes");function Uo(r){let e=[];for(let t=0;t>8,i=t%256,s.push(i),s.push(n);return s} -a(Oo,"utf16leToBytes");function Vn(r){return Mt.toByteArray(Do(r))}a(Vn,"base64T\ +a(Qo,"utf16leToBytes");function Vn(r){return Mt.toByteArray(No(r))}a(Vn,"base64T\ oBytes");function at(r,e,t,n){let i;for(i=0;i=e.length||i>=r.length);++i) e[i+t]=r[i];return i}a(at,"blitBuffer");function ue(r,e){return r instanceof e|| r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name} -a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var No=function(){ +a(ue,"isInstance");function Qt(r){return r!==r}a(Qt,"numberIsNaN");var Wo=function(){ let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i< -16;++i)e[n+i]=r[t]+r[i]}return e}();function me(r){return typeof BigInt>"u"?qo:r} -a(me,"defineBigIntMethod");function qo(){throw new Error("BigInt not supported")} -a(qo,"BufferBigIntNotDefined")});var S,x,E,w,y,m,p=te(()=>{"use strict";S=globalThis,x=globalThis.setImmediate??(r=>setTimeout( -r,0)),E=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; +16;++i)e[n+i]=r[t]+r[i]}return e}();function ge(r){return typeof BigInt>"u"?jo:r} +a(ge,"defineBigIntMethod");function jo(){throw new Error("BigInt not supported")} +a(jo,"BufferBigIntNotDefined")});var b,x,v,w,y,m,p=z(()=>{"use strict";b=globalThis,x=globalThis.setImmediate??(r=>setTimeout( +r,0)),v=globalThis.clearImmediate??(r=>clearTimeout(r)),w=globalThis.crypto??{}; w.subtle??(w.subtle={});y=typeof globalThis.Buffer=="function"&&typeof globalThis. -Buffer.allocUnsafe=="function"?globalThis.Buffer:Kn().Buffer,m=globalThis.process?? +Buffer.allocUnsafe=="function"?globalThis.Buffer:zn().Buffer,m=globalThis.process?? {};m.env??(m.env={});try{m.nextTick(()=>{})}catch{let e=Promise.resolve();m.nextTick= -e.then.bind(e)}});var ge=I((th,Wt)=>{"use strict";p();var Re=typeof Reflect=="object"?Reflect:null, -zn=Re&&typeof Re.apply=="function"?Re.apply:a(function(e,t,n){return Function.prototype. +e.then.bind(e)}});var we=I((oh,Wt)=>{"use strict";p();var Re=typeof Reflect=="object"?Reflect:null, +Yn=Re&&typeof Re.apply=="function"?Re.apply:a(function(e,t,n){return Function.prototype. apply.call(e,t,n)},"ReflectApply"),ut;Re&&typeof Re.ownKeys=="function"?ut=Re.ownKeys: Object.getOwnPropertySymbols?ut=a(function(e){return Object.getOwnPropertyNames( e).concat(Object.getOwnPropertySymbols(e))},"ReflectOwnKeys"):ut=a(function(e){return Object. -getOwnPropertyNames(e)},"ReflectOwnKeys");function Qo(r){console&&console.warn&& -console.warn(r)}a(Qo,"ProcessEmitWarning");var Zn=Number.isNaN||a(function(e){return e!== +getOwnPropertyNames(e)},"ReflectOwnKeys");function Ho(r){console&&console.warn&& +console.warn(r)}a(Ho,"ProcessEmitWarning");var Jn=Number.isNaN||a(function(e){return e!== e},"NumberIsNaN");function B(){B.init.call(this)}a(B,"EventEmitter");Wt.exports= -B;Wt.exports.once=Go;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= -0;B.prototype._maxListeners=void 0;var Yn=10;function ct(r){if(typeof r!="functi\ +B;Wt.exports.once=Vo;B.EventEmitter=B;B.prototype._events=void 0;B.prototype._eventsCount= +0;B.prototype._maxListeners=void 0;var Zn=10;function ct(r){if(typeof r!="functi\ on")throw new TypeError('The "listener" argument must be of type Function. Recei\ ved type '+typeof r)}a(ct,"checkListener");Object.defineProperty(B,"defaultMaxLi\ -steners",{enumerable:!0,get:a(function(){return Yn},"get"),set:a(function(r){if(typeof r!= -"number"||r<0||Zn(r))throw new RangeError('The value of "defaultMaxListeners" is\ - out of range. It must be a non-negative number. Received '+r+".");Yn=r},"set")}); +steners",{enumerable:!0,get:a(function(){return Zn},"get"),set:a(function(r){if(typeof r!= +"number"||r<0||Jn(r))throw new RangeError('The value of "defaultMaxListeners" is\ + out of range. It must be a non-negative number. Received '+r+".");Zn=r},"set")}); B.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this). _events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners= this._maxListeners||void 0};B.prototype.setMaxListeners=a(function(e){if(typeof e!= -"number"||e<0||Zn(e))throw new RangeError('The value of "n" is out of range. It \ +"number"||e<0||Jn(e))throw new RangeError('The value of "n" is out of range. It \ must be a non-negative number. Received '+e+".");return this._maxListeners=e,this}, -"setMaxListeners");function Jn(r){return r._maxListeners===void 0?B.defaultMaxListeners: -r._maxListeners}a(Jn,"_getMaxListeners");B.prototype.getMaxListeners=a(function(){ -return Jn(this)},"getMaxListeners");B.prototype.emit=a(function(e){for(var t=[], +"setMaxListeners");function Xn(r){return r._maxListeners===void 0?B.defaultMaxListeners: +r._maxListeners}a(Xn,"_getMaxListeners");B.prototype.getMaxListeners=a(function(){ +return Xn(this)},"getMaxListeners");B.prototype.emit=a(function(e){for(var t=[], n=1;n 0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+ o.message+")":""));throw u.context=o,u}var c=s[e];if(c===void 0)return!1;if(typeof c== -"function")zn(c,this,t);else for(var h=c.length,l=ni(c,h),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po\ +t):o.push(t),i=Xn(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Po\ ssible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners a\ dded. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExce\ -ededWarning",u.emitter=r,u.type=e,u.count=o.length,Qo(u)}return r}a(Xn,"_addList\ -ener");B.prototype.addListener=a(function(e,t){return Xn(this,e,t,!1)},"addListe\ +ededWarning",u.emitter=r,u.type=e,u.count=o.length,Ho(u)}return r}a(ei,"_addList\ +ener");B.prototype.addListener=a(function(e,t){return ei(this,e,t,!1)},"addListe\ ner");B.prototype.on=B.prototype.addListener;B.prototype.prependListener=a(function(e,t){ -return Xn(this,e,t,!0)},"prependListener");function Wo(){if(!this.fired)return this. +return ei(this,e,t,!0)},"prependListener");function Go(){if(!this.fired)return this. target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0? -this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Wo, -"onceWrapper");function ei(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, -listener:t},i=Wo.bind(n);return i.listener=t,n.wrapFn=i,i}a(ei,"_onceWrap");B.prototype. -once=a(function(e,t){return ct(t),this.on(e,ei(this,e,t)),this},"once");B.prototype. -prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ei(this, +this.listener.call(this.target):this.listener.apply(this.target,arguments)}a(Go, +"onceWrapper");function ti(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e, +listener:t},i=Go.bind(n);return i.listener=t,n.wrapFn=i,i}a(ti,"_onceWrap");B.prototype. +once=a(function(e,t){return ct(t),this.on(e,ti(this,e,t)),this},"once");B.prototype. +prependOnceListener=a(function(e,t){return ct(t),this.prependListener(e,ti(this, e,t)),this},"prependOnceListener");B.prototype.removeListener=a(function(e,t){var n, i,s,o,u;if(ct(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this; if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null): (delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!= "function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){u=n[o]. -listener,s=o;break}if(s<0)return this;s===0?n.shift():jo(n,s),n.length===1&&(i[e]= +listener,s=o;break}if(s<0)return this;s===0?n.shift():$o(n,s),n.length===1&&(i[e]= n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||t)}return this}, "removeListener");B.prototype.off=B.prototype.removeListener;B.prototype.removeAllListeners= a(function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener=== @@ -427,76 +430,63 @@ this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ti(r,e,t){ +1;i>=0;i--)this.removeListener(e,t[i]);return this},"removeAllListeners");function ri(r,e,t){ var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i== -"function"?t?[i.listener||i]:[i]:t?Ho(i):ni(i,i.length)}a(ti,"_listeners");B.prototype. -listeners=a(function(e){return ti(this,e,!0)},"listeners");B.prototype.rawListeners= -a(function(e){return ti(this,e,!1)},"rawListeners");B.listenerCount=function(r,e){ -return typeof r.listenerCount=="function"?r.listenerCount(e):ri.call(r,e)};B.prototype. -listenerCount=ri;function ri(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== -"function")return 1;if(t!==void 0)return t.length}return 0}a(ri,"listenerCount"); +"function"?t?[i.listener||i]:[i]:t?Ko(i):ii(i,i.length)}a(ri,"_listeners");B.prototype. +listeners=a(function(e){return ri(this,e,!0)},"listeners");B.prototype.rawListeners= +a(function(e){return ri(this,e,!1)},"rawListeners");B.listenerCount=function(r,e){ +return typeof r.listenerCount=="function"?r.listenerCount(e):ni.call(r,e)};B.prototype. +listenerCount=ni;function ni(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t== +"function")return 1;if(t!==void 0)return t.length}return 0}a(ni,"listenerCount"); B.prototype.eventNames=a(function(){return this._eventsCount>0?ut(this._events): -[]},"eventNames");function ni(r,e){for(var t=new Array(e),n=0;nVo});var Vo,Ge=te(()=>{"use strict";p();Vo={}});var jt={};se(jt,{Md5:()=>Ve,createHash:()=>zo,createHmac:()=>Yo,randomBytes:()=>Ko, -sha256:()=>$e});function Ko(r){return w.getRandomValues(y.alloc(r))}function zo(r){ -if(r==="sha256")return{update:a(function(e){return{digest:a(function(){return y. -from($e(e))},"digest")}},"update")};if(r==="md5")return{update:a(function(e){return{ -digest:a(function(){return typeof e=="string"?Ve.hashStr(e):Ve.hashByteArray(e)}, -"digest")}},"update")};throw new Error(`Hash type '${r}' not supported`)}function Yo(r,e){ -if(r!=="sha256")throw new Error(`Only sha256 is supported (requested: '${r}')`); -return{update:a(function(t){return{digest:a(function(){typeof e=="string"&&(e=new TextEncoder(). -encode(e)),typeof t=="string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n> -64)e=$e(e);else if(n<64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array( -64),s=new Uint8Array(64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array( -t.length+64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u. -set($e(o),64),y.from($e(u))},"digest")}},"update")}}function $e(r){let e=1779033703, -t=3144134277,n=1013904242,i=2773480762,s=1359893119,o=2600822924,u=528734635,c=1541459225, -h=0,l=0,d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748, -2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103, -3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692, -1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993, -338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350, -2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909, -275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063, -1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479, -3329325298],b=a((A,g)=>A>>>g|A<<32-g,"rrot"),C=new Uint32Array(64),L=new Uint8Array( -64),Q=a(()=>{for(let R=0,$=0;R<16;R++,$+=4)C[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+ -3];for(let R=16;R<64;R++){let $=b(C[R-15],7)^b(C[R-15],18)^C[R-15]>>>3,ce=b(C[R- -2],17)^b(C[R-2],19)^C[R-2]>>>10;C[R]=C[R-16]+$+C[R-7]+ce|0}let A=e,g=t,P=n,K=i,D=s, -W=o,X=u,oe=c;for(let R=0;R<64;R++){let $=b(D,6)^b(D,11)^b(D,25),ce=D&W^~D&X,ye=oe+ -$+ce+d[R]+C[R]|0,Se=b(A,2)^b(A,13)^b(A,22),We=A&g^A&P^g&P,he=Se+We|0;oe=X,X=W,W= -D,D=K+ye|0,K=P,P=g,g=A,A=ye+he|0}e=e+A|0,t=t+g|0,n=n+P|0,i=i+K|0,s=s+D|0,o=o+W|0, -u=u+X|0,c=c+oe|0,l=0},"process"),J=a(A=>{typeof A=="string"&&(A=new TextEncoder(). -encode(A));for(let g=0;g{if(L[l++]=128,l==64&&Q(),l+8>64){for(;l<64;)L[l++]=0;Q()}for(;l<58;)L[l++]= -0;let A=h*8;L[l++]=A/1099511627776&255,L[l++]=A/4294967296&255,L[l++]=A>>>24,L[l++]= -A>>>16&255,L[l++]=A>>>8&255,L[l++]=A&255,Q();let g=new Uint8Array(32);return g[0]= -e>>>24,g[1]=e>>>16&255,g[2]=e>>>8&255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]= -t>>>8&255,g[7]=t&255,g[8]=n>>>24,g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]= -i>>>24,g[13]=i>>>16&255,g[14]=i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255, -g[18]=s>>>8&255,g[19]=s&255,g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]= -o&255,g[24]=u>>>24,g[25]=u>>>16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]= -c>>>16&255,g[30]=c>>>8&255,g[31]=c&255,g},"digest");return r===void 0?{add:J,digest:de}: -(J(r),de())}var U,Ve,Ht=te(()=>{"use strict";p();a(Ko,"randomBytes");a(zo,"creat\ -eHash");a(Yo,"createHmac");U=class U{constructor(){_(this,"_dataLength",0);_(this, -"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer",new ArrayBuffer( -68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array(this._buffer, -0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ +ed type '+typeof r)}a(si,"eventTargetAgnosticAddListener")});var He={};ie(He,{default:()=>Yo});var Yo,Ge=z(()=>{"use strict";p();Yo={}});function $e(r){let e=1779033703,t=3144134277,n=1013904242,i=2773480762,s=1359893119, +o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,3049323471, +3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278, +1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078, +604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808, +3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372, +1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800, +3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, +883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, +2361852424,2428436474,2756734187,3204031479,3329325298],S=a((C,g)=>C>>>g|C<<32-g, +"rrot"),_=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, +$+=4)_[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(_[R- +15],7)^S(_[R-15],18)^_[R-15]>>>3,ce=S(_[R-2],17)^S(_[R-2],19)^_[R-2]>>>10;_[R]=_[R- +16]+$+_[R-7]+ce|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,oe=c;for(let R=0;R<64;R++){let $=S( +U,6)^S(U,11)^S(U,25),ce=U&j^~U&ee,de=oe+$+ce+d[R]+_[R]|0,xe=S(C,2)^S(C,13)^S(C,22), +We=C&g^C&P^g&P,he=xe+We|0;oe=ee,ee=j,j=U,U=W+de|0,W=P,P=g,g=C,C=de+he|0}e=e+C|0, +t=t+g|0,n=n+P|0,i=i+W|0,s=s+U|0,o=o+j|0,u=u+ee|0,c=c+oe|0,l=0},"process"),X=a(C=>{ +typeof C=="string"&&(C=new TextEncoder().encode(C));for(let g=0;g{if(L[l++]=128,l==64&&G(),l+8>64){ +for(;l<64;)L[l++]=0;G()}for(;l<58;)L[l++]=0;let C=h*8;L[l++]=C/1099511627776&255, +L[l++]=C/4294967296&255,L[l++]=C>>>24,L[l++]=C>>>16&255,L[l++]=C>>>8&255,L[l++]= +C&255,G();let g=new Uint8Array(32);return g[0]=e>>>24,g[1]=e>>>16&255,g[2]=e>>>8& +255,g[3]=e&255,g[4]=t>>>24,g[5]=t>>>16&255,g[6]=t>>>8&255,g[7]=t&255,g[8]=n>>>24, +g[9]=n>>>16&255,g[10]=n>>>8&255,g[11]=n&255,g[12]=i>>>24,g[13]=i>>>16&255,g[14]= +i>>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, +g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> +16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, +g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:se}:(X(r),se())}var oi=z( +()=>{"use strict";p();a($e,"sha256")});var O,Ke,ai=z(()=>{"use strict";p();O=class O{constructor(){A(this,"_dataLength", +0);A(this,"_bufferLength",0);A(this,"_state",new Int32Array(4));A(this,"_buffer", +new ArrayBuffer(68));A(this,"_buffer8");A(this,"_buffer32");this._buffer8=new Uint8Array( +this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ -return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=U. -hexChars,n=U.hexOut,i,s,o,u;for(u=0;u<4;u+=1)for(s=u*8,i=e[u],o=0;o<8;o+=2)n[s+1+ +return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){let t=O. +hexChars,n=O.hexOut,i,s,o,u;for(u=0;u<4;u+=1)for(s=u*8,i=e[u],o=0;o<8;o+=2)n[s+1+ o]=t.charAt(i&15),i>>>=4,n[s+0+o]=t.charAt(i&15),i>>>=4;return n.join("")}static _md5cycle(e,t){ let n=e[0],i=e[1],s=e[2],o=e[3];n+=(i&s|~i&o)+t[0]-680876936|0,n=(n<<7|n>>>25)+i| 0,o+=(n&i|~n&s)+t[1]-389564586|0,o=(o<<12|o>>>20)+n|0,s+=(o&n|~o&i)+t[2]+606105819| @@ -540,34 +530,48 @@ i>>>11)+s|0,n+=(s^(i|~o))+t[4]-145523070|0,n=(n<<6|n>>>26)+i|0,o+=(i^(n|~s))+t[1 1120210379|0,o=(o<<10|o>>>22)+n|0,s+=(n^(o|~i))+t[2]+718787259|0,s=(s<<15|s>>>17)+ o|0,i+=(o^(s|~n))+t[9]-343485551|0,i=(i<<21|i>>>11)+s|0,e[0]=n+e[0]|0,e[1]=i+e[1]| 0,e[2]=s+e[2]|0,e[3]=o+e[3]|0}start(){return this._dataLength=0,this._bufferLength= -0,this._state.set(U.stateIdentity),this}appendStr(e){let t=this._buffer8,n=this. +0,this._state.set(O.stateIdentity),this}appendStr(e){let t=this._buffer8,n=this. _buffer32,i=this._bufferLength,s,o;for(o=0;o>>6)+192,t[i++]=s&63|128;else if(s<55296|| s>56319)t[i++]=(s>>>12)+224,t[i++]=s>>>6&63|128,t[i++]=s&63|128;else{if(s=(s-55296)* 1024+(e.charCodeAt(++o)-56320)+65536,s>1114111)throw new Error("Unicode standard\ supports code points up to U+10FFFF");t[i++]=(s>>>18)+240,t[i++]=s>>>12&63|128, -t[i++]=s>>>6&63|128,t[i++]=s&63|128}i>=64&&(this._dataLength+=64,U._md5cycle(this. +t[i++]=s>>>6&63|128,t[i++]=s&63|128}i>=64&&(this._dataLength+=64,O._md5cycle(this. _state,n),i-=64,n[0]=n[16])}return this._bufferLength=i,this}appendAsciiStr(e){let t=this. _buffer8,n=this._buffer32,i=this._bufferLength,s,o=0;for(;;){for(s=Math.min(e.length- -o,64-i);s--;)t[i++]=e.charCodeAt(o++);if(i<64)break;this._dataLength+=64,U._md5cycle( +o,64-i);s--;)t[i++]=e.charCodeAt(o++);if(i<64)break;this._dataLength+=64,O._md5cycle( this._state,n),i=0}return this._bufferLength=i,this}appendByteArray(e){let t=this. _buffer8,n=this._buffer32,i=this._bufferLength,s,o=0;for(;;){for(s=Math.min(e.length- -o,64-i);s--;)t[i++]=e[o++];if(i<64)break;this._dataLength+=64,U._md5cycle(this._state, +o,64-i);s--;)t[i++]=e[o++];if(i<64)break;this._dataLength+=64,O._md5cycle(this._state, n),i=0}return this._bufferLength=i,this}getState(){let e=this._state;return{buffer:String. fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this. _dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){let t=e.buffer,n=e.state,i=this. _state,s;for(this._dataLength=e.length,this._bufferLength=e.buflen,i[0]=n[0],i[1]= n[1],i[2]=n[2],i[3]=n[3],s=0;s>2)+1;this._dataLength+= -t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(U.buffer32Identity. -subarray(s),s),t>55&&(U._md5cycle(this._state,i),i.set(U.buffer32Identity)),o<=4294967295) +t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(O.buffer32Identity. +subarray(s),s),t>55&&(O._md5cycle(this._state,i),i.set(O.buffer32Identity)),o<=4294967295) i[14]=o;else{let u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return;let c=parseInt( -u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return U._md5cycle(this._state,i), -e?this._state:U._hex(this._state)}};a(U,"Md5"),_(U,"stateIdentity",new Int32Array( -[1732584193,-271733879,-1732584194,271733878])),_(U,"buffer32Identity",new Int32Array( -[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(U,"hexChars","0123456789abcdef"),_(U,"hexO\ -ut",[]),_(U,"onePassHasher",new U);Ve=U;a($e,"sha256")});var $t=I(si=>{"use strict";p();si.parse=function(r,e){return new Gt(r,e).parse()}; -var ht=class ht{constructor(e,t){this.source=e,this.transform=t||Zo,this.position= +u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return O._md5cycle(this._state,i), +e?this._state:O._hex(this._state)}};a(O,"Md5"),A(O,"stateIdentity",new Int32Array( +[1732584193,-271733879,-1732584194,271733878])),A(O,"buffer32Identity",new Int32Array( +[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),A(O,"hexChars","0123456789abcdef"),A(O,"hexO\ +ut",[]),A(O,"onePassHasher",new O);Ke=O});var jt={};ie(jt,{createHash:()=>Xo,createHmac:()=>ea,randomBytes:()=>Jo});function Jo(r){ +return typeof w<"u"&&w.randomBytes!==void 0?(w.webcrypto??w).getRandomValues(y.alloc( +r)):Tn(Zo).randomBytes(r)}function Xo(r){if(r==="sha256")return{update:a(function(e){ +return{digest:a(function(){return y.from($e(e))},"digest")}},"update")};if(r==="\ +md5")return{update:a(function(e){return{digest:a(function(){return typeof e=="st\ +ring"?Ke.hashStr(e):Ke.hashByteArray(e)},"digest")}},"update")};throw new Error( +`Hash type '${r}' not supported`)}function ea(r,e){if(r!=="sha256")throw new Error( +`Only sha256 is supported (requested: '${r}')`);return{update:a(function(t){return{ +digest:a(function(){typeof e=="string"&&(e=new TextEncoder().encode(e)),typeof t== +"string"&&(t=new TextEncoder().encode(t));let n=e.length;if(n>64)e=$e(e);else if(n< +64){let c=new Uint8Array(64);c.set(e),e=c}let i=new Uint8Array(64),s=new Uint8Array( +64);for(let c=0;c<64;c++)i[c]=54^e[c],s[c]=92^e[c];let o=new Uint8Array(t.length+ +64);o.set(i,0),o.set(t,64);let u=new Uint8Array(96);return u.set(s,0),u.set($e(o), +64),y.from($e(u))},"digest")}},"update")}}var Zo,Ht=z(()=>{"use strict";p();oi(); +ai();Zo="node:crypto";a(Jo,"randomBytes");a(Xo,"createHash");a(ea,"createHmac")});var $t=I(ui=>{"use strict";p();ui.parse=function(r,e){return new Gt(r,e).parse()}; +var ht=class ht{constructor(e,t){this.source=e,this.transform=t||ta,this.position= 0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>= this.source.length}nextCharacter(){var e=this.source[this.position++];return e=== "\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){ @@ -581,97 +585,97 @@ n.parse(!0)),this.position+=n.position-2);else if(t.value==="}"&&!i){if(this.dim !this.dimension&&(this.newEntry(),e))return this.entries}else t.value==='"'&&!t. escaped?(i&&this.newEntry(!0),i=!i):t.value===","&&!i?this.newEntry():this.record( t.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this. -entries}};a(ht,"ArrayParser");var Gt=ht;function Zo(r){return r}a(Zo,"identity")});var Vt=I((hh,oi)=>{p();var Jo=$t();oi.exports={create:a(function(r,e){return{parse:a( -function(){return Jo.parse(r,e)},"parse")}},"create")}});var ci=I((ph,ui)=>{"use strict";p();var Xo=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, -ea=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,ta=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,ra=/^-?infinity$/; -ui.exports=a(function(e){if(ra.test(e))return Number(e.replace("i","I"));var t=Xo. -exec(e);if(!t)return na(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=ai(i));var s=parseInt( +entries}};a(ht,"ArrayParser");var Gt=ht;function ta(r){return r}a(ta,"identity")});var Kt=I((Eh,ci)=>{p();var ra=$t();ci.exports={create:a(function(r,e){return{parse:a( +function(){return ra.parse(r,e)},"parse")}},"create")}});var fi=I((Ch,li)=>{"use strict";p();var na=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/, +ia=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,sa=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,oa=/^-?infinity$/; +li.exports=a(function(e){if(oa.test(e))return Number(e.replace("i","I"));var t=na. +exec(e);if(!t)return aa(e)||null;var n=!!t[8],i=parseInt(t[1],10);n&&(i=hi(i));var s=parseInt( t[2],10)-1,o=t[3],u=parseInt(t[4],10),c=parseInt(t[5],10),h=parseInt(t[6],10),l=t[7]; -l=l?1e3*parseFloat(l):0;var d,b=ia(e);return b!=null?(d=new Date(Date.UTC(i,s,o, -u,c,h,l)),Kt(i)&&d.setUTCFullYear(i),b!==0&&d.setTime(d.getTime()-b)):(d=new Date( -i,s,o,u,c,h,l),Kt(i)&&d.setFullYear(i)),d},"parseDate");function na(r){var e=ea. -exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=ai(t));var i=parseInt(e[2], -10)-1,s=e[3],o=new Date(t,i,s);return Kt(t)&&o.setFullYear(t),o}}a(na,"getDate"); -function ia(r){if(r.endsWith("+00"))return 0;var e=ta.exec(r.split(" ")[1]);if(e){ +l=l?1e3*parseFloat(l):0;var d,S=ua(e);return S!=null?(d=new Date(Date.UTC(i,s,o, +u,c,h,l)),Vt(i)&&d.setUTCFullYear(i),S!==0&&d.setTime(d.getTime()-S)):(d=new Date( +i,s,o,u,c,h,l),Vt(i)&&d.setFullYear(i)),d},"parseDate");function aa(r){var e=ia. +exec(r);if(e){var t=parseInt(e[1],10),n=!!e[4];n&&(t=hi(t));var i=parseInt(e[2], +10)-1,s=e[3],o=new Date(t,i,s);return Vt(t)&&o.setFullYear(t),o}}a(aa,"getDate"); +function ua(r){if(r.endsWith("+00"))return 0;var e=sa.exec(r.split(" ")[1]);if(e){ var t=e[1];if(t==="Z")return 0;var n=t==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt( -e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(ia,"timeZoneOffset");function ai(r){ -return-(r-1)}a(ai,"bcYearToNegativeYear");function Kt(r){return r>=0&&r<100}a(Kt, -"is0To99")});var li=I((mh,hi)=>{p();hi.exports=oa;var sa=Object.prototype.hasOwnProperty;function oa(r){ -for(var e=1;e{"use strict";p();var aa=li();pi.exports=Fe;function Fe(r){if(!(this instanceof -Fe))return new Fe(r);aa(this,ba(r))}a(Fe,"PostgresInterval");var ua=["seconds","\ -minutes","hours","days","months","years"];Fe.prototype.toPostgres=function(){var r=ua. +e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}a(ua,"timeZoneOffset");function hi(r){ +return-(r-1)}a(hi,"bcYearToNegativeYear");function Vt(r){return r>=0&&r<100}a(Vt, +"is0To99")});var di=I((Ph,pi)=>{p();pi.exports=ha;var ca=Object.prototype.hasOwnProperty;function ha(r){ +for(var e=1;e{"use strict";p();var la=di();mi.exports=Fe;function Fe(r){if(!(this instanceof +Fe))return new Fe(r);la(this,Ea(r))}a(Fe,"PostgresInterval");var fa=["seconds","\ +minutes","hours","days","months","years"];Fe.prototype.toPostgres=function(){var r=fa. filter(this.hasOwnProperty,this);return this.milliseconds&&r.indexOf("seconds")< 0&&r.push("seconds"),r.length===0?"0":r.map(function(e){var t=this[e]||0;return e=== "seconds"&&this.milliseconds&&(t=(t+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/, -"")),t+" "+e},this).join(" ")};var ca={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ -M",seconds:"S"},ha=["years","months","days"],la=["hours","minutes","seconds"];Fe. -prototype.toISOString=Fe.prototype.toISO=function(){var r=ha.map(t,this).join(""), -e=la.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== +"")),t+" "+e},this).join(" ")};var pa={years:"Y",months:"M",days:"D",hours:"H",minutes:"\ +M",seconds:"S"},da=["years","months","days"],ya=["hours","minutes","seconds"];Fe. +prototype.toISOString=Fe.prototype.toISO=function(){var r=da.map(t,this).join(""), +e=ya.map(t,this).join("");return"P"+r+"T"+e;function t(n){var i=this[n]||0;return n=== "seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/, -"")),i+ca[n]}};var zt="([+-]?\\d+)",fa=zt+"\\s+years?",pa=zt+"\\s+mons?",da=zt+"\ -\\s+days?",ya="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",ma=new RegExp([ -fa,pa,da,ya].map(function(r){return"("+r+")?"}).join("\\s*")),fi={years:2,months:4, -days:6,hours:9,minutes:10,seconds:11,milliseconds:12},ga=["hours","minutes","sec\ -onds","milliseconds"];function wa(r){var e=r+"000000".slice(r.length);return parseInt( -e,10)/1e3}a(wa,"parseMilliseconds");function ba(r){if(!r)return{};var e=ma.exec( -r),t=e[8]==="-";return Object.keys(fi).reduce(function(n,i){var s=fi[i],o=e[s];return!o|| -(o=i==="milliseconds"?wa(o):parseInt(o,10),!o)||(t&&~ga.indexOf(i)&&(o*=-1),n[i]= -o),n},{})}a(ba,"parse")});var mi=I((vh,yi)=>{"use strict";p();yi.exports=a(function(e){if(/^\\x/.test(e))return new y( +"")),i+pa[n]}};var zt="([+-]?\\d+)",ma=zt+"\\s+years?",ga=zt+"\\s+mons?",wa=zt+"\ +\\s+days?",ba="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",Sa=new RegExp([ +ma,ga,wa,ba].map(function(r){return"("+r+")?"}).join("\\s*")),yi={years:2,months:4, +days:6,hours:9,minutes:10,seconds:11,milliseconds:12},xa=["hours","minutes","sec\ +onds","milliseconds"];function va(r){var e=r+"000000".slice(r.length);return parseInt( +e,10)/1e3}a(va,"parseMilliseconds");function Ea(r){if(!r)return{};var e=Sa.exec( +r),t=e[8]==="-";return Object.keys(yi).reduce(function(n,i){var s=yi[i],o=e[s];return!o|| +(o=i==="milliseconds"?va(o):parseInt(o,10),!o)||(t&&~xa.indexOf(i)&&(o*=-1),n[i]= +o),n},{})}a(Ea,"parse")});var bi=I((kh,wi)=>{"use strict";p();wi.exports=a(function(e){if(/^\\x/.test(e))return new y( e.substr(2),"hex");for(var t="",n=0;n{p();var Ke=$t(),ze=Vt(),lt=ci(),wi=di(),bi=mi();function ft(r){ -return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Si(r){ +"\\";n+=Math.floor(i/2)*2}return new y(t,"binary")},"parseBytea")});var Ci=I((Oh,Ai)=>{p();var Ve=$t(),ze=Kt(),lt=fi(),xi=gi(),vi=bi();function ft(r){ +return a(function(t){return t===null?t:r(t)},"nullAllowed")}a(ft,"allowNull");function Ei(r){ return r===null?r:r==="TRUE"||r==="t"||r==="true"||r==="y"||r==="yes"||r==="on"|| -r==="1"}a(Si,"parseBool");function Sa(r){return r?Ke.parse(r,Si):null}a(Sa,"pars\ -eBoolArray");function xa(r){return parseInt(r,10)}a(xa,"parseBaseTenInt");function Yt(r){ -return r?Ke.parse(r,ft(xa)):null}a(Yt,"parseIntegerArray");function va(r){return r? -Ke.parse(r,ft(function(e){return xi(e).trim()})):null}a(va,"parseBigIntegerArray"); -var Ea=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== +r==="1"}a(Ei,"parseBool");function _a(r){return r?Ve.parse(r,Ei):null}a(_a,"pars\ +eBoolArray");function Aa(r){return parseInt(r,10)}a(Aa,"parseBaseTenInt");function Yt(r){ +return r?Ve.parse(r,ft(Aa)):null}a(Yt,"parseIntegerArray");function Ca(r){return r? +Ve.parse(r,ft(function(e){return _i(e).trim()})):null}a(Ca,"parseBigIntegerArray"); +var Ta=a(function(r){if(!r)return null;var e=ze.create(r,function(t){return t!== null&&(t=er(t)),t});return e.parse()},"parsePointArray"),Zt=a(function(r){if(!r) return null;var e=ze.create(r,function(t){return t!==null&&(t=parseFloat(t)),t}); -return e.parse()},"parseFloatArray"),ne=a(function(r){if(!r)return null;var e=ze. +return e.parse()},"parseFloatArray"),re=a(function(r){if(!r)return null;var e=ze. create(r);return e.parse()},"parseStringArray"),Jt=a(function(r){if(!r)return null; var e=ze.create(r,function(t){return t!==null&&(t=lt(t)),t});return e.parse()},"\ -parseDateArray"),_a=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ -return t!==null&&(t=wi(t)),t});return e.parse()},"parseIntervalArray"),Aa=a(function(r){ -return r?Ke.parse(r,ft(bi)):null},"parseByteAArray"),Xt=a(function(r){return parseInt( -r,10)},"parseInteger"),xi=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: -r},"parseBigInteger"),gi=a(function(r){return r?Ke.parse(r,ft(JSON.parse)):null}, +parseDateArray"),Ia=a(function(r){if(!r)return null;var e=ze.create(r,function(t){ +return t!==null&&(t=xi(t)),t});return e.parse()},"parseIntervalArray"),Pa=a(function(r){ +return r?Ve.parse(r,ft(vi)):null},"parseByteAArray"),Xt=a(function(r){return parseInt( +r,10)},"parseInteger"),_i=a(function(r){var e=String(r);return/^\d+$/.test(e)?e: +r},"parseBigInteger"),Si=a(function(r){return r?Ve.parse(r,ft(JSON.parse)):null}, "parseJsonArray"),er=a(function(r){return r[0]!=="("?null:(r=r.substring(1,r.length- -1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),Ca=a(function(r){ +1).split(","),{x:parseFloat(r[0]),y:parseFloat(r[1])})},"parsePoint"),La=a(function(r){ if(r[0]!=="<"&&r[1]!=="(")return null;for(var e="(",t="",n=!1,i=2;i{"use strict";p();var Y=1e6;function Ia(r){var e=r.readInt32BE( +var s=er(e);return s.radius=parseFloat(t),s},"parseCircle"),Ba=a(function(r){r(20, +_i),r(21,Xt),r(23,Xt),r(26,Xt),r(700,parseFloat),r(701,parseFloat),r(16,Ei),r(1082, +lt),r(1114,lt),r(1184,lt),r(600,er),r(651,re),r(718,La),r(1e3,_a),r(1001,Pa),r(1005, +Yt),r(1007,Yt),r(1028,Yt),r(1016,Ca),r(1017,Ta),r(1021,Zt),r(1022,Zt),r(1231,Zt), +r(1014,re),r(1015,re),r(1008,re),r(1009,re),r(1040,re),r(1041,re),r(1115,Jt),r(1182, +Jt),r(1185,Jt),r(1186,xi),r(1187,Ia),r(17,vi),r(114,JSON.parse.bind(JSON)),r(3802, +JSON.parse.bind(JSON)),r(199,Si),r(3807,Si),r(3907,re),r(2951,re),r(791,re),r(1183, +re),r(1270,re)},"init");Ai.exports={init:Ba}});var Ii=I((Qh,Ti)=>{"use strict";p();var Z=1e6;function Ra(r){var e=r.readInt32BE( 0),t=r.readUInt32BE(4),n="";e<0&&(e=~e+(t===0),t=~t+1>>>0,n="-");var i="",s,o,u, -c,h,l;{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+ -u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* -s+t,t=o/Y>>>0,u=""+(o-Y*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< -h;l++)c+="0";i=c+u+i}{if(s=e%Y,e=e/Y>>>0,o=4294967296*s+t,t=o/Y>>>0,u=""+(o-Y*t), +c,h,l;{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+ +u+i;for(c="",h=6-u.length,l=0;l>>0,o=4294967296* +s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< +h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Pa=Ai(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(C,L,Q){ -return C*Math.pow(2,Q)+L};var s=t>>3,o=a(function(C){return n?~C&255:C},"inv"),u=255, +e%Z,o=4294967296*s+t,u=""+o%Z,n+u+i}a(Ra,"readInt8");Ti.exports=Ra});var Fi=I((Hh,Ri)=>{p();var Fa=Ii(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(_,L,G){ +return _*Math.pow(2,G)+L};var s=t>>3,o=a(function(_){return n?~_&255:_},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& -u,c));for(var l=e+t>>3,d=s+1;d0&& -(h=i(h,o(r[l])>>8-b,b)),h},"parseBits"),Ii=a(function(r,e,t){var n=Math.pow(2,t- +u,c));for(var l=e+t>>3,d=s+1;d0&& +(h=i(h,o(r[l])>>8-S,S)),h},"parseBits"),Bi=a(function(r,e,t){var n=Math.pow(2,t- 1)-1,i=F(r,1),s=F(r,t,1);if(s===0)return 0;var o=1,u=a(function(h,l,d){h===0&&(h= -1);for(var b=1;b<=d;b++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), +1);for(var S=1;S<=d;S++)o/=2,(l&1<0&&(h+=o);return h},"parsePrecisionBits"), c=F(r,e,t+1,!1,u);return s==Math.pow(2,t+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1: --1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),La=a(function(r){return F(r,1)==1?-1* -(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Ci=a(function(r){return F(r,1)==1?-1*(F( -r,31,1,!0)+1):F(r,31,1)},"parseInt32"),Ba=a(function(r){return Ii(r,23,8)},"pars\ -eFloat32"),Ra=a(function(r){return Ii(r,52,11)},"parseFloat64"),Fa=a(function(r){ +-1)*Math.pow(2,s-n)*c},"parseFloatFromBits"),Ma=a(function(r){return F(r,1)==1?-1* +(F(r,15,1,!0)+1):F(r,15,1)},"parseInt16"),Pi=a(function(r){return F(r,1)==1?-1*(F( +r,31,1,!0)+1):F(r,31,1)},"parseInt32"),ka=a(function(r){return Bi(r,23,8)},"pars\ +eFloat32"),Da=a(function(r){return Bi(r,52,11)},"parseFloat64"),Ua=a(function(r){ var e=F(r,16,32);if(e==49152)return NaN;for(var t=Math.pow(1e4,F(r,16,16)),n=0,i=[], s=F(r,16),o=0;o>3,(i+=l<<3)>>3), d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ -var d=[],b;if(h.length>1){var C=h.shift();for(b=0;b0},"parseBool"),Da=a(function(r){r(20,Pa),r(21,La),r(23,Ci),r(26, -Ci),r(1700,Fa),r(700,Ba),r(701,Ra),r(16,ka),r(1114,Ti.bind(null,!1)),r(1184,Ti.bind( -null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Ma)},"init"); -Pi.exports={init:Da}});var Ri=I((Mh,Bi)=>{p();Bi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, +var d=[],S;if(h.length>1){var _=h.shift();for(S=0;S<_;S++)d[S]=c(h,l);h.unshift( +_)}else for(S=0;S0},"parseBool"),qa=a(function(r){r(20,Fa),r(21,Ma),r(23,Pi),r(26, +Pi),r(1700,Ua),r(700,ka),r(701,Da),r(16,Na),r(1114,Li.bind(null,!1)),r(1184,Li.bind( +null,!0)),r(1e3,Ye),r(1007,Ye),r(1016,Ye),r(1008,Ye),r(1009,Ye),r(25,Oa)},"init"); +Ri.exports={init:qa}});var ki=I((Kh,Mi)=>{p();Mi.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23, REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194, SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703, TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033, @@ -694,157 +698,157 @@ BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INT TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203, REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220, PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642, -REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Ua=Ei(),Oa=Li(),Na=Vt(),qa=Ri();Je.getTypeParser=Qa;Je.setTypeParser= -Wa;Je.arrayParser=Na;Je.builtins=qa;var Ze={text:{},binary:{}};function Fi(r){return String( -r)}a(Fi,"noParse");function Qa(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Fi}a(Qa, -"getTypeParser");function Wa(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= -t}a(Wa,"setTypeParser");Ua.init(function(r,e){Ze.text[r]=e});Oa.init(function(r,e){ -Ze.binary[r]=e})});var et=I((Nh,tr)=>{"use strict";p();tr.exports={host:"localhost",user:m.platform=== +REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var Xe=I(Je=>{p();var Qa=Ci(),Wa=Fi(),ja=Kt(),Ha=ki();Je.getTypeParser=Ga;Je.setTypeParser= +$a;Je.arrayParser=ja;Je.builtins=Ha;var Ze={text:{},binary:{}};function Di(r){return String( +r)}a(Di,"noParse");function Ga(r,e){return e=e||"text",Ze[e]&&Ze[e][r]||Di}a(Ga, +"getTypeParser");function $a(r,e,t){typeof e=="function"&&(t=e,e="text"),Ze[e][r]= +t}a($a,"setTypeParser");Qa.init(function(r,e){Ze.text[r]=e});Wa.init(function(r,e){ +Ze.binary[r]=e})});var et=I((Jh,tr)=>{"use strict";p();tr.exports={host:"localhost",user:m.platform=== "win32"?m.env.USERNAME:m.env.USER,database:void 0,password:null,connectionString:void 0, port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1, application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1, statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1, -connect_timeout:0,keepalives:1,keepalives_idle:0};var Me=Xe(),ja=Me.getTypeParser( -20,"text"),Ha=Me.getTypeParser(1016,"text");tr.exports.__defineSetter__("parseIn\ -t8",function(r){Me.setTypeParser(20,"text",r?Me.getTypeParser(23,"text"):ja),Me. -setTypeParser(1016,"text",r?Me.getTypeParser(1007,"text"):Ha)})});var tt=I((Qh,ki)=>{"use strict";p();var Ga=(Ht(),O(jt)),$a=et();function Va(r){var e=r. -replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Va,"escapeElement"); -function Mi(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> -"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Mi(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. -toString("hex"):e+=Va(pt(r[t]));return e=e+"}",e}a(Mi,"arrayString");var pt=a(function(r,e){ +connect_timeout:0,keepalives:1,keepalives_idle:0};var Me=Xe(),Ka=Me.getTypeParser( +20,"text"),Va=Me.getTypeParser(1016,"text");tr.exports.__defineSetter__("parseIn\ +t8",function(r){Me.setTypeParser(20,"text",r?Me.getTypeParser(23,"text"):Ka),Me. +setTypeParser(1016,"text",r?Me.getTypeParser(1007,"text"):Va)})});var tt=I((el,Oi)=>{"use strict";p();var za=(Ht(),N(jt)),Ya=et();function Za(r){var e=r. +replace(/\\/g,"\\\\").replace(/"/g,'\\"');return'"'+e+'"'}a(Za,"escapeElement"); +function Ui(r){for(var e="{",t=0;t0&&(e=e+","),r[t]===null||typeof r[t]> +"u"?e=e+"NULL":Array.isArray(r[t])?e=e+Ui(r[t]):r[t]instanceof y?e+="\\\\x"+r[t]. +toString("hex"):e+=Za(pt(r[t]));return e=e+"}",e}a(Ui,"arrayString");var pt=a(function(r,e){ if(r==null)return null;if(r instanceof y)return r;if(ArrayBuffer.isView(r)){var t=y. from(r.buffer,r.byteOffset,r.byteLength);return t.length===r.byteLength?t:t.slice( -r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?$a.parseInputDatesAsUTC? -Ya(r):za(r):Array.isArray(r)?Mi(r):typeof r=="object"?Ka(r,e):r.toString()},"pre\ -pareValue");function Ka(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. +r.byteOffset,r.byteOffset+r.byteLength)}return r instanceof Date?Ya.parseInputDatesAsUTC? +eu(r):Xa(r):Array.isArray(r)?Ui(r):typeof r=="object"?Ja(r,e):r.toString()},"pre\ +pareValue");function Ja(r,e){if(r&&typeof r.toPostgres=="function"){if(e=e||[],e. indexOf(r)!==-1)throw new Error('circular reference detected while preparing "'+ r+'" for query');return e.push(r),pt(r.toPostgres(pt),e)}return JSON.stringify(r)} -a(Ka,"prepareObject");function G(r,e){for(r=""+r;r.length{"use strict";p();var nr=(Ht(),O(jt));function Xa(r){if(r.indexOf( +a(Ja,"prepareObject");function H(r,e){for(r=""+r;r.length{"use strict";p();var nr=(Ht(),N(jt));function nu(r){if(r.indexOf( "SCRAM-SHA-256")===-1)throw new Error("SASL: Only mechanism SCRAM-SHA-256 is cur\ rently supported");let e=nr.randomBytes(18).toString("base64");return{mechanism:"\ SCRAM-SHA-256",clientNonce:e,response:"n,,n=*,r="+e,message:"SASLInitialResponse"}} -a(Xa,"startSession");function eu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( +a(nu,"startSession");function iu(r,e,t){if(r.message!=="SASLInitialResponse")throw new Error( "SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(typeof t!= "string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a\ - string");let n=nu(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== + string");let n=au(t);if(n.nonce.startsWith(r.clientNonce)){if(n.nonce.length=== r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n\ once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ -er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=ou(e, -i,n.iteration),o=ke(s,"Client Key"),u=su(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,b=ke(u,d),C=Oi( -o,b),L=C.toString("base64"),Q=ke(s,"Server Key"),J=ke(Q,d);r.message="SASLRespon\ -se",r.serverSignature=J.toString("base64"),r.response=l+",p="+L}a(eu,"continueSe\ -ssion");function tu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ +er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=hu(e, +i,n.iteration),o=ke(s,"Client Key"),u=cu(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=ke(u,d),_=Qi( +o,S),L=_.toString("base64"),G=ke(s,"Server Key"),X=ke(G,d);r.message="SASLRespon\ +se",r.serverSignature=X.toString("base64"),r.response=l+",p="+L}a(iu,"continueSe\ +ssion");function su(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ -CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=iu( +CRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:t}=uu( e);if(t!==r.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: s\ -erver signature does not match")}a(tu,"finalizeSession");function ru(r){if(typeof r!= +erver signature does not match")}a(su,"finalizeSession");function ou(r){if(typeof r!= "string")throw new TypeError("SASL: text must be a string");return r.split("").map( -(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(ru,"isPrintableC\ -hars");function Di(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(r)}a(Di,"isBase64");function Ui(r){if(typeof r!="string")throw new TypeError( +(e,t)=>r.charCodeAt(t)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}a(ou,"isPrintableC\ +hars");function Ni(r){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(r)}a(Ni,"isBase64");function qi(r){if(typeof r!="string")throw new TypeError( "SASL: attribute pairs text must be a string");return new Map(r.split(",").map(e=>{ if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let t=e[0], -n=e.substring(2);return[t,n]}))}a(Ui,"parseAttributePairs");function nu(r){let e=Ui( -r),t=e.get("r");if(t){if(!ru(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ +n=e.substring(2);return[t,n]}))}a(qi,"parseAttributePairs");function au(r){let e=qi( +r),t=e.get("r");if(t){if(!ou(t))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAG\ E: nonce must only contain printable characters")}else throw new Error("SASL: SC\ -RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Di(n))throw new Error( +RAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Ni(n))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("S\ ASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/. test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration cou\ nt")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing"); -let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(nu,"parseServerFirstMe\ -ssage");function iu(r){let t=Ui(r).get("v");if(t){if(!Di(t))throw new Error("SAS\ +let s=parseInt(i,10);return{nonce:t,salt:n,iteration:s}}a(au,"parseServerFirstMe\ +ssage");function uu(r){let t=qi(r).get("v");if(t){if(!Ni(t))throw new Error("SAS\ L: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error( "SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:t}} -a(iu,"parseServerFinalMessage");function Oi(r,e){if(!y.isBuffer(r))throw new TypeError( +a(uu,"parseServerFinalMessage");function Qi(r,e){if(!y.isBuffer(r))throw new TypeError( "first argument must be a Buffer");if(!y.isBuffer(e))throw new TypeError("second\ argument must be a Buffer");if(r.length!==e.length)throw new Error("Buffer leng\ ths must match");if(r.length===0)throw new Error("Buffers cannot be empty");return y. -from(r.map((t,n)=>r[n]^e[n]))}a(Oi,"xorBuffers");function su(r){return nr.createHash( -"sha256").update(r).digest()}a(su,"sha256");function ke(r,e){return nr.createHmac( -"sha256",r).update(e).digest()}a(ke,"hmacSha256");function ou(r,e,t){for(var n=ke( -r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;sau});function au(...r){return r.join("/")}var sr=te(()=>{ -"use strict";p();a(au,"join")});var or={};se(or,{stat:()=>uu});function uu(r,e){e(new Error("No filesystem"))}var ar=te( -()=>{"use strict";p();a(uu,"stat")});var ur={};se(ur,{default:()=>cu});var cu,cr=te(()=>{"use strict";p();cu={}});var Qi={};se(Qi,{StringDecoder:()=>hr});var lr,hr,Wi=te(()=>{"use strict";p();lr= -class lr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. +from(r.map((t,n)=>r[n]^e[n]))}a(Qi,"xorBuffers");function cu(r){return nr.createHash( +"sha256").update(r).digest()}a(cu,"sha256");function ke(r,e){return nr.createHmac( +"sha256",r).update(e).digest()}a(ke,"hmacSha256");function hu(r,e,t){for(var n=ke( +r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;slu});function lu(...r){return r.join("/")}var sr=z(()=>{ +"use strict";p();a(lu,"join")});var or={};ie(or,{stat:()=>fu});function fu(r,e){e(new Error("No filesystem"))}var ar=z( +()=>{"use strict";p();a(fu,"stat")});var ur={};ie(ur,{default:()=>pu});var pu,cr=z(()=>{"use strict";p();pu={}});var Hi={};ie(Hi,{StringDecoder:()=>hr});var lr,hr,Gi=z(()=>{"use strict";p();lr= +class lr{constructor(e){A(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(lr,"StringDecoder"); -hr=lr});var $i=I((el,Gi)=>{"use strict";p();var{Transform:hu}=(cr(),O(ur)),{StringDecoder:lu}=(Wi(),O(Qi)), -we=Symbol("last"),dt=Symbol("decoder");function fu(r,e,t){let n;if(this.overflow){ +hr=lr});var zi=I((pl,Vi)=>{"use strict";p();var{Transform:du}=(cr(),N(ur)),{StringDecoder:yu}=(Gi(),N(Hi)), +be=Symbol("last"),dt=Symbol("decoder");function mu(r,e,t){let n;if(this.overflow){ if(n=this[dt].write(r).split(this.matcher),n.length===1)return t();n.shift(),this. -overflow=!1}else this[we]+=this[dt].write(r),n=this[we].split(this.matcher);this[we]= -n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ -t(new Error("maximum buffer reached"));return}t()}a(fu,"transform");function pu(r){ -if(this[we]+=this[dt].end(),this[we])try{Hi(this,this.mapper(this[we]))}catch(e){ -return r(e)}r()}a(pu,"flush");function Hi(r,e){e!==void 0&&r.push(e)}a(Hi,"push"); -function ji(r){return r}a(ji,"noop");function du(r,e,t){switch(r=r||/\r?\n/,e=e|| -ji,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== +overflow=!1}else this[be]+=this[dt].write(r),n=this[be].split(this.matcher);this[be]= +n.pop();for(let i=0;ithis.maxLength,this.overflow&&!this.skipOverflow){ +t(new Error("maximum buffer reached"));return}t()}a(mu,"transform");function gu(r){ +if(this[be]+=this[dt].end(),this[be])try{Ki(this,this.mapper(this[be]))}catch(e){ +return r(e)}r()}a(gu,"flush");function Ki(r,e){e!==void 0&&r.push(e)}a(Ki,"push"); +function $i(r){return r}a($i,"noop");function wu(r,e,t){switch(r=r||/\r?\n/,e=e|| +$i,t=t||{},arguments.length){case 1:typeof r=="function"?(e=r,r=/\r?\n/):typeof r== "object"&&!(r instanceof RegExp)&&!r[Symbol.split]&&(t=r,r=/\r?\n/);break;case 2: -typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=ji)}t=Object. -assign({},t),t.autoDestroy=!0,t.transform=fu,t.flush=pu,t.readableObjectMode=!0; -let n=new hu(t);return n[we]="",n[dt]=new lu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= +typeof r=="function"?(t=e,e=r,r=/\r?\n/):typeof e=="object"&&(t=e,e=$i)}t=Object. +assign({},t),t.autoDestroy=!0,t.transform=mu,t.flush=gu,t.readableObjectMode=!0; +let n=new du(t);return n[be]="",n[dt]=new yu("utf8"),n.matcher=r,n.mapper=e,n.maxLength= t.maxLength,n.skipOverflow=t.skipOverflow||!1,n.overflow=!1,n._destroy=function(i,s){ -this._writableState.errorEmitted=!1,s(i)},n}a(du,"split");Gi.exports=du});var zi=I((nl,fe)=>{"use strict";p();var Vi=(sr(),O(ir)),yu=(cr(),O(ur)).Stream,mu=$i(), -Ki=(Ge(),O(He)),gu=5432,yt=m.platform==="win32",rt=m.stderr,wu=56,bu=7,Su=61440, -xu=32768;function vu(r){return(r&Su)==xu}a(vu,"isRegFile");var De=["host","port", -"database","user","password"],fr=De.length,Eu=De[fr-1];function pr(){var r=rt instanceof -yu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` -`);rt.write(Ki.format.apply(Ki,e))}}a(pr,"warn");Object.defineProperty(fe.exports, +this._writableState.errorEmitted=!1,s(i)},n}a(wu,"split");Vi.exports=wu});var Ji=I((ml,fe)=>{"use strict";p();var Yi=(sr(),N(ir)),bu=(cr(),N(ur)).Stream,Su=zi(), +Zi=(Ge(),N(He)),xu=5432,yt=m.platform==="win32",rt=m.stderr,vu=56,Eu=7,_u=61440, +Au=32768;function Cu(r){return(r&_u)==Au}a(Cu,"isRegFile");var De=["host","port", +"database","user","password"],fr=De.length,Tu=De[fr-1];function pr(){var r=rt instanceof +bu&&rt.writable===!0;if(r){var e=Array.prototype.slice.call(arguments).concat(` +`);rt.write(Zi.format.apply(Zi,e))}}a(pr,"warn");Object.defineProperty(fe.exports, "isWin",{get:a(function(){return yt},"get"),set:a(function(r){yt=r},"set")});fe. exports.warnTo=function(r){var e=rt;return rt=r,e};fe.exports.getFileName=function(r){ -var e=r||m.env,t=e.PGPASSFILE||(yt?Vi.join(e.APPDATA||"./","postgresql","pgpass.\ -conf"):Vi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ +var e=r||m.env,t=e.PGPASSFILE||(yt?Yi.join(e.APPDATA||"./","postgresql","pgpass.\ +conf"):Yi.join(e.HOME||"./",".pgpass"));return t};fe.exports.usePgPass=function(r,e){ return Object.prototype.hasOwnProperty.call(m.env,"PGPASSWORD")?!1:yt?!0:(e=e||"\ -",vu(r.mode)?r.mode&(wu|bu)?(pr('WARNING: password file "%s" has group or \ +",Cu(r.mode)?r.mode&(vu|Eu)?(pr('WARNING: password file "%s" has group or \ world access; permissions should be u=rw (0600) or less',e),!1):!0:(pr('WARNING:\ - password file "%s" is not a plain file',e),!1))};var _u=fe.exports.match=function(r,e){ -return De.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||gu)===Number( + password file "%s" is not a plain file',e),!1))};var Iu=fe.exports.match=function(r,e){ +return De.slice(0,-1).reduce(function(t,n,i){return i==1&&Number(r[n]||xu)===Number( e[n])?t&&!0:t&&(e[n]==="*"||e[n]===r[n])},!0)};fe.exports.getPassword=function(r,e,t){ -var n,i=e.pipe(mu());function s(c){var h=Au(c);h&&Cu(h)&&_u(r,h)&&(n=h[Eu],i.end())} +var n,i=e.pipe(Su());function s(c){var h=Pu(c);h&&Lu(h)&&Iu(r,h)&&(n=h[Tu],i.end())} a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.destroy(), pr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. -on("data",s).on("end",o).on("error",u)};var Au=fe.exports.parseLine=function(r){ +on("data",s).on("end",o).on("error",u)};var Pu=fe.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, -u=!1,c=a(function(l,d,b){var C=r.substring(d,b);Object.hasOwnProperty.call(m.env, -"PGPASS_NO_DEESCAPE")||(C=C.replace(/\\([:\\])/g,"$1")),o[De[l]]=C},"addToObj"), +u=!1,c=a(function(l,d,S){var _=r.substring(d,S);Object.hasOwnProperty.call(m.env, +"PGPASS_NO_DEESCAPE")||(_=_.replace(/\\([:\\])/g,"$1")),o[De[l]]=_},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== -fr?o:null,o},Cu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. +fr?o:null,o},Lu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. length>0},1:function(o){return o==="*"?!0:(o=Number(o),isFinite(o)&&o>0&&o<9007199254740992&& Math.floor(o)===o)},2:function(o){return o.length>0},3:function(o){return o.length> 0},4:function(o){return o.length>0}},t=0;t{"use strict";p();var ol=(sr(),O(ir)),Yi=(ar(),O(or)),mt=zi(); -dr.exports=function(r,e){var t=mt.getFileName();Yi.stat(t,function(n,i){if(n||!mt. -usePgPass(i,t))return e(void 0);var s=Yi.createReadStream(t);mt.getPassword(r,s, -e)})};dr.exports.warnTo=mt.warnTo});var wt=I((cl,Ji)=>{"use strict";p();var Tu=Xe();function gt(r){this._types=r||Tu, +"",s=n(i);if(!s)return!1}return!0}});var es=I((Sl,dr)=>{"use strict";p();var bl=(sr(),N(ir)),Xi=(ar(),N(or)),mt=Ji(); +dr.exports=function(r,e){var t=mt.getFileName();Xi.stat(t,function(n,i){if(n||!mt. +usePgPass(i,t))return e(void 0);var s=Xi.createReadStream(t);mt.getPassword(r,s, +e)})};dr.exports.warnTo=mt.warnTo});var wt=I((vl,ts)=>{"use strict";p();var Bu=Xe();function gt(r){this._types=r||Bu, this.text={},this.binary={}}a(gt,"TypeOverrides");gt.prototype.getOverrides=function(r){ switch(r){case"text":return this.text;case"binary":return this.binary;default:return{}}}; gt.prototype.setTypeParser=function(r,e,t){typeof e=="function"&&(t=e,e="text"), this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| -"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};Ji.exports=gt});var Xi={};se(Xi,{default:()=>Iu});var Iu,es=te(()=>{"use strict";p();Iu={}});var ts={};se(ts,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ +"text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};ts.exports=gt});var rs={};ie(rs,{default:()=>Ru});var Ru,ns=z(()=>{"use strict";p();Ru={}});var is={};ie(is,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,searchParams:d,hash:b}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let C=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ -href:r,protocol:t,auth:C,username:i,password:s,host:o,hostname:u,port:c,pathname:h, -search:l,query:L,hash:b}}var mr=te(()=>{"use strict";p();a(yr,"parse")});var ns=I((yl,rs)=>{"use strict";p();var Pu=(mr(),O(ts)),gr=(ar(),O(or));function wr(r){ -if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Pu. +search:l,searchParams:d,hash:S}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( +i),h=decodeURIComponent(h);let _=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ +href:r,protocol:t,auth:_,username:i,password:s,host:o,hostname:u,port:c,pathname:h, +search:l,query:L,hash:S}}var mr=z(()=>{"use strict";p();a(yr,"parse")});var os=I((Il,ss)=>{"use strict";p();var Fu=(mr(),N(is)),gr=(ar(),N(or));function wr(r){ +if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Fu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, "%$1"):r,!0),t=e.query;for(var n in t)Array.isArray(t[n])&&(t[n]=t[n][t[n].length- 1]);var i=(e.auth||":").split(":");if(t.user=i[0],t.password=i.splice(1).join(":"), @@ -858,45 +862,45 @@ t.database=s&&decodeURI(s),(t.ssl==="true"||t.ssl==="1")&&(t.ssl=!0),t.ssl==="0" t.sslkey).toString()),t.sslrootcert&&(t.ssl.ca=gr.readFileSync(t.sslrootcert).toString()), t.sslmode){case"disable":{t.ssl=!1;break}case"prefer":case"require":case"verify-\ ca":case"verify-full":break;case"no-verify":{t.ssl.rejectUnauthorized=!1;break}} -return t}a(wr,"parse");rs.exports=wr;wr.parse=wr});var bt=I((wl,os)=>{"use strict";p();var Lu=(es(),O(Xi)),ss=et(),is=ns().parse,V=a( +return t}a(wr,"parse");ss.exports=wr;wr.parse=wr});var bt=I((Bl,cs)=>{"use strict";p();var Mu=(ns(),N(rs)),us=et(),as=os().parse,K=a( function(r,e,t){return t===void 0?t=m.env["PG"+r.toUpperCase()]:t===!1||(t=m.env[t]), -e[r]||t||ss[r]},"val"),Bu=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ +e[r]||t||us[r]},"val"),ku=a(function(){switch(m.env.PGSSLMODE){case"disable":return!1;case"\ prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify": -return{rejectUnauthorized:!1}}return ss.ssl},"readSSLConfigFromEnvironment"),Ue=a( +return{rejectUnauthorized:!1}}return us.ssl},"readSSLConfigFromEnvironment"),Ue=a( function(r){return"'"+(""+r).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},"quo\ -teParamValue"),ie=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Ue(n))},"ad\ -d"),Sr=class Sr{constructor(e){e=typeof e=="string"?is(e):e||{},e.connectionString&& -(e=Object.assign({},e,is(e.connectionString))),this.user=V("user",e),this.database= -V("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( -V("port",e),10),this.host=V("host",e),Object.defineProperty(this,"password",{configurable:!0, -enumerable:!1,writable:!0,value:V("password",e)}),this.binary=V("binary",e),this. -options=V("options",e),this.ssl=typeof e.ssl>"u"?Bu():e.ssl,typeof this.ssl=="st\ +teParamValue"),ne=a(function(r,e,t){var n=e[t];n!=null&&r.push(t+"="+Ue(n))},"ad\ +d"),Sr=class Sr{constructor(e){e=typeof e=="string"?as(e):e||{},e.connectionString&& +(e=Object.assign({},e,as(e.connectionString))),this.user=K("user",e),this.database= +K("database",e),this.database===void 0&&(this.database=this.user),this.port=parseInt( +K("port",e),10),this.host=K("host",e),Object.defineProperty(this,"password",{configurable:!0, +enumerable:!1,writable:!0,value:K("password",e)}),this.binary=K("binary",e),this. +options=K("options",e),this.ssl=typeof e.ssl>"u"?ku():e.ssl,typeof this.ssl=="st\ ring"&&this.ssl==="true"&&(this.ssl=!0),this.ssl==="no-verify"&&(this.ssl={rejectUnauthorized:!1}), this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}),this. -client_encoding=V("client_encoding",e),this.replication=V("replication",e),this. -isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=V("applicatio\ -n_name",e,"PGAPPNAME"),this.fallback_application_name=V("fallback_application_na\ -me",e,!1),this.statement_timeout=V("statement_timeout",e,!1),this.lock_timeout=V( -"lock_timeout",e,!1),this.idle_in_transaction_session_timeout=V("idle_in_transac\ -tion_session_timeout",e,!1),this.query_timeout=V("query_timeout",e,!1),e.connectionTimeoutMillis=== +client_encoding=K("client_encoding",e),this.replication=K("replication",e),this. +isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=K("applicatio\ +n_name",e,"PGAPPNAME"),this.fallback_application_name=K("fallback_application_na\ +me",e,!1),this.statement_timeout=K("statement_timeout",e,!1),this.lock_timeout=K( +"lock_timeout",e,!1),this.idle_in_transaction_session_timeout=K("idle_in_transac\ +tion_session_timeout",e,!1),this.query_timeout=K("query_timeout",e,!1),e.connectionTimeoutMillis=== void 0?this.connect_timeout=m.env.PGCONNECT_TIMEOUT||0:this.connect_timeout=Math. floor(e.connectionTimeoutMillis/1e3),e.keepAlive===!1?this.keepalives=0:e.keepAlive=== !0&&(this.keepalives=1),typeof e.keepAliveInitialDelayMillis=="number"&&(this.keepalives_idle= Math.floor(e.keepAliveInitialDelayMillis/1e3))}getLibpqConnectionString(e){var t=[]; -ie(t,this,"user"),ie(t,this,"password"),ie(t,this,"port"),ie(t,this,"application\ -_name"),ie(t,this,"fallback_application_name"),ie(t,this,"connect_timeout"),ie(t, +ne(t,this,"user"),ne(t,this,"password"),ne(t,this,"port"),ne(t,this,"application\ +_name"),ne(t,this,"fallback_application_name"),ne(t,this,"connect_timeout"),ne(t, this,"options");var n=typeof this.ssl=="object"?this.ssl:this.ssl?{sslmode:this. -ssl}:{};if(ie(t,n,"sslmode"),ie(t,n,"sslca"),ie(t,n,"sslkey"),ie(t,n,"sslcert"), -ie(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ue(this.database)),this.replication&& +ssl}:{};if(ne(t,n,"sslmode"),ne(t,n,"sslca"),ne(t,n,"sslkey"),ne(t,n,"sslcert"), +ne(t,n,"sslrootcert"),this.database&&t.push("dbname="+Ue(this.database)),this.replication&& t.push("replication="+Ue(this.replication)),this.host&&t.push("host="+Ue(this.host)), this.isDomainSocket)return e(null,t.join(" "));this.client_encoding&&t.push("cli\ -ent_encoding="+Ue(this.client_encoding)),Lu.lookup(this.host,function(i,s){return i? +ent_encoding="+Ue(this.client_encoding)),Mu.lookup(this.host,function(i,s){return i? e(i,null):(t.push("hostaddr="+Ue(s)),e(null,t.join(" ")))})}};a(Sr,"ConnectionPa\ -rameters");var br=Sr;os.exports=br});var cs=I((xl,us)=>{"use strict";p();var Ru=Xe(),as=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, +rameters");var br=Sr;cs.exports=br});var fs=I((Ml,ls)=>{"use strict";p();var Du=Xe(),hs=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/, vr=class vr{constructor(e,t){this.command=null,this.rowCount=null,this.oid=null, this.rows=[],this.fields=[],this._parsers=void 0,this._types=t,this.RowCtor=null, this.rowAsArray=e==="array",this.rowAsArray&&(this.parseRow=this._parseRowAsArray)}addCommandComplete(e){ -var t;e.text?t=as.exec(e.text):t=as.exec(e.command),t&&(this.command=t[1],t[3]?(this. +var t;e.text?t=hs.exec(e.text):t=hs.exec(e.command),t&&(this.command=t[1],t[3]?(this. oid=parseInt(t[2],10),this.rowCount=parseInt(t[3],10)):t[2]&&(this.rowCount=parseInt( t[2],10)))}_parseRowAsArray(e){for(var t=new Array(e.length),n=0,i=e.length;n{"use strict";p();var{EventEmitter:Fu}=ge(),hs=cs(),ls=tt(),_r=class _r extends Fu{constructor(e,t,n){ -super(),e=ls.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. +ext"):this._parsers[t]=Du.getTypeParser(n.dataTypeID,n.format||"text")}}};a(vr,"\ +Result");var xr=vr;ls.exports=xr});var ms=I((Ul,ys)=>{"use strict";p();var{EventEmitter:Uu}=we(),ps=fs(),ds=tt(),_r=class _r extends Uu{constructor(e,t,n){ +super(),e=ds.normalizeQueryConfig(e,t,n),this.text=e.text,this.values=e.values,this. rows=e.rows,this.types=e.types,this.name=e.name,this.binary=e.binary,this.portal= e.portal||"",this.callback=e.callback,this._rowMode=e.rowMode,m.domain&&e.callback&& -(this.callback=m.domain.bind(e.callback)),this._result=new hs(this._rowMode,this. +(this.callback=m.domain.bind(e.callback)),this._result=new ps(this._rowMode,this. types),this._results=this._result,this.isPreparedStatement=!1,this._canceledDueToError= !1,this._promise=null}requiresPreparation(){return this.name||this.rows?!0:!this. text||!this.values?!1:this.values.length>0}_checkForMultirow(){this._result.command&& -(Array.isArray(this._results)||(this._results=[this._result]),this._result=new hs( +(Array.isArray(this._results)||(this._results=[this._result]),this._result=new ps( this._rowMode,this.types),this._results.push(this._result))}handleRowDescription(e){ this._checkForMultirow(),this._result.addFields(e.fields),this._accumulateRows=this. callback||!this.listeners("row").length}handleDataRow(e){let t;if(!this._canceledDueToError){ @@ -935,47 +939,47 @@ name]}handlePortalSuspended(e){this._getRows(e,this.rows)}_getRows(e,t){e.execut {portal:this.portal,rows:t}),t?e.flush():e.sync()}prepare(e){this.isPreparedStatement= !0,this.hasBeenParsed(e)||e.parse({text:this.text,name:this.name,types:this.types}); try{e.bind({portal:this.portal,statement:this.name,values:this.values,binary:this. -binary,valueMapper:ls.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( +binary,valueMapper:ds.prepareValue})}catch(t){this.handleError(t,e);return}e.describe( {type:"P",name:this.portal||""}),this._getRows(e,this.rows)}handleCopyInResponse(e){ e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(_r,"Query"); -var Er=_r;fs.exports=Er});var ms={};se(ms,{Socket:()=>_e,isIP:()=>Mu});function Mu(r){return 0}var ys,ds,v, -_e,St=te(()=>{"use strict";p();ys=Te(ge(),1);a(Mu,"isIP");ds=/^[^.]+\./,v=class v extends ys.EventEmitter{constructor(){ -super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); -_(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ -troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, -"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return v.opts.poolQueryViaFetch?? -v.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){v.opts.poolQueryViaFetch= -t}static get fetchEndpoint(){return v.opts.fetchEndpoint??v.defaults.fetchEndpoint}static set fetchEndpoint(t){ -v.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ +var Er=_r;ys.exports=Er});var bs={};ie(bs,{Socket:()=>Ae,isIP:()=>Ou});function Ou(r){return 0}var ws,gs,E, +Ae,St=z(()=>{"use strict";p();ws=Te(we(),1);a(Ou,"isIP");gs=/^[^.]+\./,E=class E extends ws.EventEmitter{constructor(){ +super(...arguments);A(this,"opts",{});A(this,"connecting",!1);A(this,"pending",!0); +A(this,"writable",!0);A(this,"encrypted",!1);A(this,"authorized",!1);A(this,"des\ +troyed",!1);A(this,"ws",null);A(this,"writeBuffer");A(this,"tlsState",0);A(this, +"tlsRead");A(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= +t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ +E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ console.warn("The `fetchConnectionCache` option is deprecated (now always `true`\ -)")}static get fetchFunction(){return v.opts.fetchFunction??v.defaults.fetchFunction}static set fetchFunction(t){ -v.opts.fetchFunction=t}static get webSocketConstructor(){return v.opts.webSocketConstructor?? -v.defaults.webSocketConstructor}static set webSocketConstructor(t){v.opts.webSocketConstructor= -t}get webSocketConstructor(){return this.opts.webSocketConstructor??v.webSocketConstructor}set webSocketConstructor(t){ -this.opts.webSocketConstructor=t}static get wsProxy(){return v.opts.wsProxy??v.defaults. -wsProxy}static set wsProxy(t){v.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? -v.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return v. -opts.coalesceWrites??v.defaults.coalesceWrites}static set coalesceWrites(t){v.opts. -coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??v.coalesceWrites}set coalesceWrites(t){ -this.opts.coalesceWrites=t}static get useSecureWebSocket(){return v.opts.useSecureWebSocket?? -v.defaults.useSecureWebSocket}static set useSecureWebSocket(t){v.opts.useSecureWebSocket= -t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??v.useSecureWebSocket}set useSecureWebSocket(t){ -this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return v.opts.forceDisablePgSSL?? -v.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){v.opts.forceDisablePgSSL= -t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??v.forceDisablePgSSL}set forceDisablePgSSL(t){ -this.opts.forceDisablePgSSL=t}static get disableSNI(){return v.opts.disableSNI?? -v.defaults.disableSNI}static set disableSNI(t){v.opts.disableSNI=t}get disableSNI(){ -return this.opts.disableSNI??v.disableSNI}set disableSNI(t){this.opts.disableSNI= -t}static get pipelineConnect(){return v.opts.pipelineConnect??v.defaults.pipelineConnect}static set pipelineConnect(t){ -v.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? -v.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ -return v.opts.subtls??v.defaults.subtls}static set subtls(t){v.opts.subtls=t}get subtls(){ -return this.opts.subtls??v.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ -return v.opts.pipelineTLS??v.defaults.pipelineTLS}static set pipelineTLS(t){v.opts. -pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??v.pipelineTLS}set pipelineTLS(t){ -this.opts.pipelineTLS=t}static get rootCerts(){return v.opts.rootCerts??v.defaults. -rootCerts}static set rootCerts(t){v.opts.rootCerts=t}get rootCerts(){return this. -opts.rootCerts??v.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ +)")}static get fetchFunction(){return E.opts.fetchFunction??E.defaults.fetchFunction}static set fetchFunction(t){ +E.opts.fetchFunction=t}static get webSocketConstructor(){return E.opts.webSocketConstructor?? +E.defaults.webSocketConstructor}static set webSocketConstructor(t){E.opts.webSocketConstructor= +t}get webSocketConstructor(){return this.opts.webSocketConstructor??E.webSocketConstructor}set webSocketConstructor(t){ +this.opts.webSocketConstructor=t}static get wsProxy(){return E.opts.wsProxy??E.defaults. +wsProxy}static set wsProxy(t){E.opts.wsProxy=t}get wsProxy(){return this.opts.wsProxy?? +E.wsProxy}set wsProxy(t){this.opts.wsProxy=t}static get coalesceWrites(){return E. +opts.coalesceWrites??E.defaults.coalesceWrites}static set coalesceWrites(t){E.opts. +coalesceWrites=t}get coalesceWrites(){return this.opts.coalesceWrites??E.coalesceWrites}set coalesceWrites(t){ +this.opts.coalesceWrites=t}static get useSecureWebSocket(){return E.opts.useSecureWebSocket?? +E.defaults.useSecureWebSocket}static set useSecureWebSocket(t){E.opts.useSecureWebSocket= +t}get useSecureWebSocket(){return this.opts.useSecureWebSocket??E.useSecureWebSocket}set useSecureWebSocket(t){ +this.opts.useSecureWebSocket=t}static get forceDisablePgSSL(){return E.opts.forceDisablePgSSL?? +E.defaults.forceDisablePgSSL}static set forceDisablePgSSL(t){E.opts.forceDisablePgSSL= +t}get forceDisablePgSSL(){return this.opts.forceDisablePgSSL??E.forceDisablePgSSL}set forceDisablePgSSL(t){ +this.opts.forceDisablePgSSL=t}static get disableSNI(){return E.opts.disableSNI?? +E.defaults.disableSNI}static set disableSNI(t){E.opts.disableSNI=t}get disableSNI(){ +return this.opts.disableSNI??E.disableSNI}set disableSNI(t){this.opts.disableSNI= +t}static get pipelineConnect(){return E.opts.pipelineConnect??E.defaults.pipelineConnect}static set pipelineConnect(t){ +E.opts.pipelineConnect=t}get pipelineConnect(){return this.opts.pipelineConnect?? +E.pipelineConnect}set pipelineConnect(t){this.opts.pipelineConnect=t}static get subtls(){ +return E.opts.subtls??E.defaults.subtls}static set subtls(t){E.opts.subtls=t}get subtls(){ +return this.opts.subtls??E.subtls}set subtls(t){this.opts.subtls=t}static get pipelineTLS(){ +return E.opts.pipelineTLS??E.defaults.pipelineTLS}static set pipelineTLS(t){E.opts. +pipelineTLS=t}get pipelineTLS(){return this.opts.pipelineTLS??E.pipelineTLS}set pipelineTLS(t){ +this.opts.pipelineTLS=t}static get rootCerts(){return E.opts.rootCerts??E.defaults. +rootCerts}static set rootCerts(t){E.opts.rootCerts=t}get rootCerts(){return this. +opts.rootCerts??E.rootCerts}set rootCerts(t){this.opts.rootCerts=t}wsProxyAddrForHost(t,n){ let i=this.wsProxy;if(i===void 0)throw new Error("No WebSocket proxy is configur\ ed. Please see https://github.com/neondatabase/serverless/blob/main/CONFIG.md#ws\ proxy-string--host-string-port-number--string--string");return typeof i=="functi\ @@ -1014,12 +1018,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(v,"Socket"),_(v,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( -(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ds,"apiauth."):s=t.replace(ds,"api\ +!0,this.end()}};a(E,"Socket"),A(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +(t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(gs,"apiauth."):s=t.replace(gs,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(v,"opts",{});_e=v});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),A(E,"opts",{});Ae=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1045,11 +1049,11 @@ arameterDescriptionMessage");var Lr=Hr;T.ParameterDescriptionMessage=Lr;var Gr=c this.length=e,this.parameterName=t,this.parameterValue=n,this.name="parameterSta\ tus"}};a(Gr,"ParameterStatusMessage");var Br=Gr;T.ParameterStatusMessage=Br;var $r=class $r{constructor(e,t){ this.length=e,this.salt=t,this.name="authenticationMD5Password"}};a($r,"Authenti\ -cationMD5Password");var Rr=$r;T.AuthenticationMD5Password=Rr;var Vr=class Vr{constructor(e,t,n){ -this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Vr, -"BackendKeyDataMessage");var Fr=Vr;T.BackendKeyDataMessage=Fr;var Kr=class Kr{constructor(e,t,n,i){ +cationMD5Password");var Rr=$r;T.AuthenticationMD5Password=Rr;var Kr=class Kr{constructor(e,t,n){ +this.length=e,this.processID=t,this.secretKey=n,this.name="backendKeyData"}};a(Kr, +"BackendKeyDataMessage");var Fr=Kr;T.BackendKeyDataMessage=Fr;var Vr=class Vr{constructor(e,t,n,i){ this.length=e,this.processId=t,this.channel=n,this.payload=i,this.name="notifica\ -tion"}};a(Kr,"NotificationResponseMessage");var Mr=Kr;T.NotificationResponseMessage= +tion"}};a(Vr,"NotificationResponseMessage");var Mr=Vr;T.NotificationResponseMessage= Mr;var zr=class zr{constructor(e,t){this.length=e,this.status=t,this.name="ready\ ForQuery"}};a(zr,"ReadyForQueryMessage");var kr=zr;T.ReadyForQueryMessage=kr;var Yr=class Yr{constructor(e,t){ this.length=e,this.text=t,this.name="commandComplete"}};a(Yr,"CommandCompleteMes\ @@ -1057,7 +1061,7 @@ sage");var Dr=Yr;T.CommandCompleteMessage=Dr;var Zr=class Zr{constructor(e,t){th length=e,this.fields=t,this.name="dataRow",this.fieldCount=t.length}};a(Zr,"Data\ RowMessage");var Ur=Zr;T.DataRowMessage=Ur;var Jr=class Jr{constructor(e,t){this. length=e,this.message=t,this.name="notice"}};a(Jr,"NoticeMessage");var Or=Jr;T.NoticeMessage= -Or});var gs=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); +Or});var Ss=I(xt=>{"use strict";p();Object.defineProperty(xt,"__esModule",{value:!0}); xt.Writer=void 0;var tn=class tn{constructor(e=256){this.size=e,this.offset=5,this. headerPosition=0,this.buffer=y.allocUnsafe(e)}ensure(e){var t=this.buffer.length- this.offset;if(t>1)+e;this.buffer=y.allocUnsafe( @@ -1073,44 +1077,44 @@ this.offset+=e.length,this}join(e){if(e){this.buffer[this.headerPosition]=e;let offset-(this.headerPosition+1);this.buffer.writeInt32BE(t,this.headerPosition+1)} return this.buffer.slice(e?0:5,this.offset)}flush(e){var t=this.join(e);return this. offset=5,this.headerPosition=0,this.buffer=y.allocUnsafe(this.size),t}};a(tn,"Wr\ -iter");var en=tn;xt.Writer=en});var bs=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); -Et.serialize=void 0;var rn=gs(),M=new rn.Writer,ku=a(r=>{M.addInt16(3).addInt16( +iter");var en=tn;xt.Writer=en});var vs=I(Et=>{"use strict";p();Object.defineProperty(Et,"__esModule",{value:!0}); +Et.serialize=void 0;var rn=Ss(),M=new rn.Writer,Nu=a(r=>{M.addInt16(3).addInt16( 0);for(let n of Object.keys(r))M.addCString(n).addCString(r[n]);M.addCString("cl\ ient_encoding").addCString("UTF8");var e=M.addCString("").flush(),t=e.length+4;return new rn. -Writer().addInt32(t).add(e).flush()},"startup"),Du=a(()=>{let r=y.allocUnsafe(8); -return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Uu=a(r=>M. -addCString(r).flush(112),"password"),Ou=a(function(r,e){return M.addCString(r).addInt32( -y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),Nu=a( -function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),qu=a( -r=>M.addCString(r).flush(81),"query"),ws=[],Qu=a(r=>{let e=r.name||"";e.length>63&& +Writer().addInt32(t).add(e).flush()},"startup"),qu=a(()=>{let r=y.allocUnsafe(8); +return r.writeInt32BE(8,0),r.writeInt32BE(80877103,4),r},"requestSsl"),Qu=a(r=>M. +addCString(r).flush(112),"password"),Wu=a(function(r,e){return M.addCString(r).addInt32( +y.byteLength(e)).addString(e),M.flush(112)},"sendSASLInitialResponseMessage"),ju=a( +function(r){return M.addString(r).flush(112)},"sendSCRAMClientFinalMessage"),Hu=a( +r=>M.addCString(r).flush(81),"query"),xs=[],Gu=a(r=>{let e=r.name||"";e.length>63&& (console.error("Warning! Postgres only supports 63 characters for query names."), console.error("You supplied %s (%s)",e,e.length),console.error("This can cause c\ -onflicts and silent errors executing queries"));let t=r.types||ws;for(var n=t.length, +onflicts and silent errors executing queries"));let t=r.types||xs;for(var n=t.length, i=M.addCString(e).addCString(r.text).addInt16(n),s=0;s{let e=r.portal||"",t=r.statement|| -"",n=r.binary||!1,i=r.values||ws,s=i.length;return M.addCString(e).addCString(t), -M.addInt16(s),Wu(i,r.valueMapper),M.addInt16(s),M.add(Oe.flush()),M.addInt16(n?1: -0),M.flush(66)},"bind"),Hu=y.from([69,0,0,0,9,0,0,0,0,0]),Gu=a(r=>{if(!r||!r.portal&& -!r.rows)return Hu;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. +n)),Oe.addString(n))}},"writeValues"),Ku=a((r={})=>{let e=r.portal||"",t=r.statement|| +"",n=r.binary||!1,i=r.values||xs,s=i.length;return M.addCString(e).addCString(t), +M.addInt16(s),$u(i,r.valueMapper),M.addInt16(s),M.add(Oe.flush()),M.addInt16(n?1: +0),M.flush(66)},"bind"),Vu=y.from([69,0,0,0,9,0,0,0,0,0]),zu=a(r=>{if(!r||!r.portal&& +!r.rows)return Vu;let e=r.portal||"",t=r.rows||0,n=y.byteLength(e),i=4+n+1+4,s=y. allocUnsafe(1+i);return s[0]=69,s.writeInt32BE(i,1),s.write(e,5,"utf-8"),s[n+5]= -0,s.writeUInt32BE(t,s.length-4),s},"execute"),$u=a((r,e)=>{let t=y.allocUnsafe(16); +0,s.writeUInt32BE(t,s.length-4),s},"execute"),Yu=a((r,e)=>{let t=y.allocUnsafe(16); return t.writeInt32BE(16,0),t.writeInt16BE(1234,4),t.writeInt16BE(5678,6),t.writeInt32BE( r,8),t.writeInt32BE(e,12),t},"cancel"),nn=a((r,e)=>{let n=4+y.byteLength(e)+1,i=y. allocUnsafe(1+n);return i[0]=r,i.writeInt32BE(n,1),i.write(e,5,"utf-8"),i[n]=0,i}, -"cstringMessage"),Vu=M.addCString("P").flush(68),Ku=M.addCString("S").flush(68), -zu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?Vu:Ku,"describe"),Yu=a( -r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),Zu=a(r=>M.add(r).flush( -100),"copyData"),Ju=a(r=>nn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ -OnlyBuffer"),Xu=vt(72),ec=vt(83),tc=vt(88),rc=vt(99),nc={startup:ku,password:Uu, -requestSsl:Du,sendSASLInitialResponseMessage:Ou,sendSCRAMClientFinalMessage:Nu,query:qu, -parse:Qu,bind:ju,execute:Gu,describe:zu,close:Yu,flush:a(()=>Xu,"flush"),sync:a( -()=>ec,"sync"),end:a(()=>tc,"end"),copyData:Zu,copyDone:a(()=>rc,"copyDone"),copyFail:Ju, -cancel:$u};Et.serialize=nc});var Ss=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); -_t.BufferReader=void 0;var ic=y.allocUnsafe(0),on=class on{constructor(e=0){this. -offset=e,this.buffer=ic,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. +"cstringMessage"),Zu=M.addCString("P").flush(68),Ju=M.addCString("S").flush(68), +Xu=a(r=>r.name?nn(68,`${r.type}${r.name||""}`):r.type==="P"?Zu:Ju,"describe"),ec=a( +r=>{let e=`${r.type}${r.name||""}`;return nn(67,e)},"close"),tc=a(r=>M.add(r).flush( +100),"copyData"),rc=a(r=>nn(102,r),"copyFail"),vt=a(r=>y.from([r,0,0,0,4]),"code\ +OnlyBuffer"),nc=vt(72),ic=vt(83),sc=vt(88),oc=vt(99),ac={startup:Nu,password:Qu, +requestSsl:qu,sendSASLInitialResponseMessage:Wu,sendSCRAMClientFinalMessage:ju,query:Hu, +parse:Gu,bind:Ku,execute:zu,describe:Xu,close:ec,flush:a(()=>nc,"flush"),sync:a( +()=>ic,"sync"),end:a(()=>sc,"end"),copyData:tc,copyDone:a(()=>oc,"copyDone"),copyFail:rc, +cancel:Yu};Et.serialize=ac});var Es=I(_t=>{"use strict";p();Object.defineProperty(_t,"__esModule",{value:!0}); +_t.BufferReader=void 0;var uc=y.allocUnsafe(0),on=class on{constructor(e=0){this. +offset=e,this.buffer=uc,this.encoding="utf-8"}setBuffer(e,t){this.offset=e,this. buffer=t}int16(){let e=this.buffer.readInt16BE(this.offset);return this.offset+= 2,e}byte(){let e=this.buffer[this.offset];return this.offset++,e}int32(){let e=this. buffer.readInt32BE(this.offset);return this.offset+=4,e}string(e){let t=this.buffer. @@ -1118,14 +1122,14 @@ toString(this.encoding,this.offset,this.offset+e);return this.offset+=e,t}cstrin let e=this.offset,t=e;for(;this.buffer[t++]!==0;);return this.offset=t,this.buffer. toString(this.encoding,e,t-1)}bytes(e){let t=this.buffer.slice(this.offset,this. offset+e);return this.offset+=e,t}};a(on,"BufferReader");var sn=on;_t.BufferReader= -sn});var Es=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); -At.Parser=void 0;var k=Xr(),sc=Ss(),an=1,oc=4,xs=an+oc,vs=y.allocUnsafe(0),cn=class cn{constructor(e){ -if(this.buffer=vs,this.bufferLength=0,this.bufferOffset=0,this.reader=new sc.BufferReader, +sn});var Cs=I(At=>{"use strict";p();Object.defineProperty(At,"__esModule",{value:!0}); +At.Parser=void 0;var k=Xr(),cc=Es(),an=1,hc=4,_s=an+hc,As=y.allocUnsafe(0),cn=class cn{constructor(e){ +if(this.buffer=As,this.bufferLength=0,this.bufferOffset=0,this.reader=new cc.BufferReader, e?.mode==="binary")throw new Error("Binary mode not supported yet");this.mode=e?. mode||"text"}parse(e,t){this.mergeBuffer(e);let n=this.bufferOffset+this.bufferLength, -i=this.bufferOffset;for(;i+xs<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( -i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+xs,s,o,this.buffer);t(c),i+=u}else -break}i===n?(this.buffer=vs,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= +i=this.bufferOffset;for(;i+_s<=n;){let s=this.buffer[i],o=this.buffer.readUInt32BE( +i+an),u=an+o;if(u+i<=n){let c=this.handlePacket(i+_s,s,o,this.buffer);t(c),i+=u}else +break}i===n?(this.buffer=As,this.bufferLength=0,this.bufferOffset=0):(this.bufferLength= n-i,this.bufferOffset=i)}mergeBuffer(e){if(this.bufferLength>0){let t=this.bufferLength+ e.byteLength;if(t+this.bufferOffset>this.buffer.byteLength){let i;if(t<=this.buffer. byteLength&&this.bufferOffset>=this.bufferLength)i=this.buffer;else{let s=this.buffer. @@ -1182,16 +1186,16 @@ this.reader.cstring(),o=this.reader.string(1);let u=s.M,c=i==="notice"?new k.Not t,u):new k.DatabaseError(u,t,i);return c.severity=s.S,c.code=s.C,c.detail=s.D,c. hint=s.H,c.position=s.P,c.internalPosition=s.p,c.internalQuery=s.q,c.where=s.W,c. schema=s.s,c.table=s.t,c.column=s.c,c.dataType=s.d,c.constraint=s.n,c.file=s.F,c. -line=s.L,c.routine=s.R,c}};a(cn,"Parser");var un=cn;At.Parser=un});var hn=I(be=>{"use strict";p();Object.defineProperty(be,"__esModule",{value:!0}); -be.DatabaseError=be.serialize=be.parse=void 0;var ac=Xr();Object.defineProperty( -be,"DatabaseError",{enumerable:!0,get:a(function(){return ac.DatabaseError},"get")}); -var uc=bs();Object.defineProperty(be,"serialize",{enumerable:!0,get:a(function(){ -return uc.serialize},"get")});var cc=Es();function hc(r,e){let t=new cc.Parser;return r. -on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(hc,"parse");be. -parse=hc});var _s={};se(_s,{connect:()=>lc});function lc({socket:r,servername:e}){return r. -startTls(e),r}var As=te(()=>{"use strict";p();a(lc,"connect")});var pn=I((zl,Is)=>{"use strict";p();var Cs=(St(),O(ms)),fc=ge().EventEmitter,{parse:pc, -serialize:q}=hn(),Ts=q.flush(),dc=q.sync(),yc=q.end(),fn=class fn extends fc{constructor(e){ -super(),e=e||{},this.stream=e.stream||new Cs.Socket,this._keepAlive=e.keepAlive, +line=s.L,c.routine=s.R,c}};a(cn,"Parser");var un=cn;At.Parser=un});var hn=I(Se=>{"use strict";p();Object.defineProperty(Se,"__esModule",{value:!0}); +Se.DatabaseError=Se.serialize=Se.parse=void 0;var lc=Xr();Object.defineProperty( +Se,"DatabaseError",{enumerable:!0,get:a(function(){return lc.DatabaseError},"get")}); +var fc=vs();Object.defineProperty(Se,"serialize",{enumerable:!0,get:a(function(){ +return fc.serialize},"get")});var pc=Cs();function dc(r,e){let t=new pc.Parser;return r. +on("data",n=>t.parse(n,e)),new Promise(n=>r.on("end",()=>n()))}a(dc,"parse");Se. +parse=dc});var Ts={};ie(Ts,{connect:()=>yc});function yc({socket:r,servername:e}){return r. +startTls(e),r}var Is=z(()=>{"use strict";p();a(yc,"connect")});var pn=I((cf,Bs)=>{"use strict";p();var Ps=(St(),N(bs)),mc=we().EventEmitter,{parse:gc, +serialize:Q}=hn(),Ls=Q.flush(),wc=Q.sync(),bc=Q.end(),fn=class fn extends mc{constructor(e){ +super(),e=e||{},this.stream=e.stream||new Ps.Socket,this._keepAlive=e.keepAlive, this._keepAliveInitialDelayMillis=e.keepAliveInitialDelayMillis,this.lastBuffer= !1,this.parsedStatements={},this.ssl=e.ssl||!1,this._ending=!1,this._emitMessage= !1;var t=this;this.on("newListener",function(n){n==="message"&&(t._emitMessage=!0)})}connect(e,t){ @@ -1204,36 +1208,36 @@ ssl)return this.attachListeners(this.stream);this.stream.once("data",function(s) var o=s.toString("utf8");switch(o){case"S":break;case"N":return n.stream.end(),n. emit("error",new Error("The server does not support SSL connections"));default:return n. stream.end(),n.emit("error",new Error("There was an error establishing an SSL co\ -nnection"))}var u=(As(),O(_s));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( -c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Cs.isIP(t)===0&&(c.servername=t);try{ +nnection"))}var u=(Is(),N(Ts));let c={socket:n.stream};n.ssl!==!0&&(Object.assign( +c,n.ssl),"key"in n.ssl&&(c.key=n.ssl.key)),Ps.isIP(t)===0&&(c.servername=t);try{ n.stream=u.connect(c)}catch(h){return n.emit("error",h)}n.attachListeners(n.stream), n.stream.on("error",i),n.emit("sslconnect")})}attachListeners(e){e.on("end",()=>{ -this.emit("end")}),pc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& -this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(q.requestSsl())}startup(e){ -this.stream.write(q.startup(e))}cancel(e,t){this._send(q.cancel(e,t))}password(e){ -this._send(q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(q.sendSASLInitialResponseMessage( -e,t))}sendSCRAMClientFinalMessage(e){this._send(q.sendSCRAMClientFinalMessage(e))}_send(e){ -return this.stream.writable?this.stream.write(e):!1}query(e){this._send(q.query( -e))}parse(e){this._send(q.parse(e))}bind(e){this._send(q.bind(e))}execute(e){this. -_send(q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ts)}sync(){this. -_ending=!0,this._send(Ts),this._send(dc)}ref(){this.stream.ref()}unref(){this.stream. +this.emit("end")}),gc(e,t=>{var n=t.name==="error"?"errorMessage":t.name;this._emitMessage&& +this.emit("message",t),this.emit(n,t)})}requestSsl(){this.stream.write(Q.requestSsl())}startup(e){ +this.stream.write(Q.startup(e))}cancel(e,t){this._send(Q.cancel(e,t))}password(e){ +this._send(Q.password(e))}sendSASLInitialResponseMessage(e,t){this._send(Q.sendSASLInitialResponseMessage( +e,t))}sendSCRAMClientFinalMessage(e){this._send(Q.sendSCRAMClientFinalMessage(e))}_send(e){ +return this.stream.writable?this.stream.write(e):!1}query(e){this._send(Q.query( +e))}parse(e){this._send(Q.parse(e))}bind(e){this._send(Q.bind(e))}execute(e){this. +_send(Q.execute(e))}flush(){this.stream.writable&&this.stream.write(Ls)}sync(){this. +_ending=!0,this._send(Ls),this._send(wc)}ref(){this.stream.ref()}unref(){this.stream. unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this. -stream.end();return}return this.stream.write(yc,()=>{this.stream.end()})}close(e){ -this._send(q.close(e))}describe(e){this._send(q.describe(e))}sendCopyFromChunk(e){ -this._send(q.copyData(e))}endCopyFrom(){this._send(q.copyDone())}sendCopyFail(e){ -this._send(q.copyFail(e))}};a(fn,"Connection");var ln=fn;Is.exports=ln});var Bs=I((Xl,Ls)=>{"use strict";p();var mc=ge().EventEmitter,Jl=(Ge(),O(He)),gc=tt(), -dn=qi(),wc=Zi(),bc=wt(),Sc=bt(),Ps=ps(),xc=et(),vc=pn(),yn=class yn extends mc{constructor(e){ -super(),this.connectionParameters=new Sc(e),this.user=this.connectionParameters. +stream.end();return}return this.stream.write(bc,()=>{this.stream.end()})}close(e){ +this._send(Q.close(e))}describe(e){this._send(Q.describe(e))}sendCopyFromChunk(e){ +this._send(Q.copyData(e))}endCopyFrom(){this._send(Q.copyDone())}sendCopyFail(e){ +this._send(Q.copyFail(e))}};a(fn,"Connection");var ln=fn;Bs.exports=ln});var Ms=I((pf,Fs)=>{"use strict";p();var Sc=we().EventEmitter,ff=(Ge(),N(He)),xc=tt(), +dn=ji(),vc=es(),Ec=wt(),_c=bt(),Rs=ms(),Ac=et(),Cc=pn(),yn=class yn extends Sc{constructor(e){ +super(),this.connectionParameters=new _c(e),this.user=this.connectionParameters. user,this.database=this.connectionParameters.database,this.port=this.connectionParameters. port,this.host=this.connectionParameters.host,Object.defineProperty(this,"passwo\ rd",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}), this.replication=this.connectionParameters.replication;var t=e||{};this._Promise= -t.Promise||S.Promise,this._types=new bc(t.types),this._ending=!1,this._connecting= +t.Promise||b.Promise,this._types=new Ec(t.types),this._ending=!1,this._connecting= !1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this.connection= -t.connection||new vc({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. +t.connection||new Cc({stream:t.stream,ssl:this.connectionParameters.ssl,keepAlive:t. keepAlive||!1,keepAliveInitialDelayMillis:t.keepAliveInitialDelayMillis||0,encoding:this. connectionParameters.client_encoding||"utf8"}),this.queryQueue=[],this.binary=t. -binary||xc.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. +binary||Ac.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters. ssl||!1,this.ssl&&this.ssl.key&&Object.defineProperty(this.ssl,"key",{enumerable:!1}), this._connectionTimeoutMillis=t.connectionTimeoutMillis||0}_errorAllQueries(e){let t=a( n=>{m.nextTick(()=>{n.handleError(e,this.connection)})},"enqueueError");this.activeQuery&& @@ -1271,10 +1275,10 @@ let t=this.connection;typeof this.password=="function"?this._Promise.resolve().t ()=>this.password()).then(n=>{if(n!==void 0){if(typeof n!="string"){t.emit("erro\ r",new TypeError("Password must be a string"));return}this.connectionParameters. password=this.password=n}else this.connectionParameters.password=this.password=null; -e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():wc(this.connectionParameters, +e()}).catch(n=>{t.emit("error",n)}):this.password!==null?e():vc(this.connectionParameters, n=>{n!==void 0&&(this.connectionParameters.password=this.password=n),e()})}_handleAuthCleartextPassword(e){ this._checkPgPass(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(e){ -this._checkPgPass(()=>{let t=gc.postgresMd5PasswordHash(this.user,this.password, +this._checkPgPass(()=>{let t=xc.postgresMd5PasswordHash(this.user,this.password, e.salt);this.connection.password(t)})}_handleAuthSASL(e){this._checkPgPass(()=>{ this.saslSession=dn.startSession(e.mechanisms),this.connection.sendSASLInitialResponseMessage( this.saslSession.mechanism,this.saslSession.response)})}_handleAuthSASLContinue(e){ @@ -1320,8 +1324,8 @@ e&&m.nextTick(()=>{this.activeQuery.handleError(e,this.connection),this.readyFor emit("drain"))}query(e,t,n){var i,s,o,u,c;if(e==null)throw new TypeError("Client\ was passed a null or undefined query");return typeof e.submit=="function"?(o=e. query_timeout||this.connectionParameters.query_timeout,s=i=e,typeof t=="function"&& -(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Ps( -e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,b)=>d?l(d):h(b)}))), +(i.callback=i.callback||t)):(o=this.connectionParameters.query_timeout,i=new Rs( +e,t,n),i.callback||(s=new this._Promise((h,l)=>{i.callback=(d,S)=>d?l(d):h(S)}))), o&&(c=i.callback,u=setTimeout(()=>{var h=new Error("Query read timeout");m.nextTick( ()=>{i.handleError(h,this.connection)}),c(h),i.callback=()=>{};var l=this.queryQueue. indexOf(i);l>-1&&this.queryQueue.splice(l,1),this._pulseQueryQueue()},o),i.callback= @@ -1335,18 +1339,18 @@ unref()}end(e){if(this._ending=!0,!this.connection._connecting)if(e)e();else ret _Promise.resolve();if(this.activeQuery||!this._queryable?this.connection.stream. destroy():this.connection.end(),e)this.connection.once("end",e);else return new this. _Promise(t=>{this.connection.once("end",t)})}};a(yn,"Client");var Ct=yn;Ct.Query= -Ps;Ls.exports=Ct});var ks=I((rf,Ms)=>{"use strict";p();var Ec=ge().EventEmitter,Rs=a(function(){},"\ -NOOP"),Fs=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, +Rs;Fs.exports=Ct});var Os=I((mf,Us)=>{"use strict";p();var Tc=we().EventEmitter,ks=a(function(){},"\ +NOOP"),Ds=a((r,e)=>{let t=r.findIndex(e);return t===-1?void 0:r.splice(t,1)[0]}, "removeWhere"),wn=class wn{constructor(e,t,n){this.client=e,this.idleListener=t, this.timeoutId=n}};a(wn,"IdleItem");var mn=wn,bn=class bn{constructor(e){this.callback= -e}};a(bn,"PendingItem");var Ne=bn;function _c(){throw new Error("Release called \ -on client which has already been released to the pool.")}a(_c,"throwOnDoubleRele\ +e}};a(bn,"PendingItem");var Ne=bn;function Ic(){throw new Error("Release called \ +on client which has already been released to the pool.")}a(Ic,"throwOnDoubleRele\ ase");function Tt(r,e){if(e)return{callback:e,result:void 0};let t,n,i=a(function(o,u){ o?t(o):n(u)},"cb"),s=new r(function(o,u){n=o,t=u}).catch(o=>{throw Error.captureStackTrace( -o),o});return{callback:i,result:s}}a(Tt,"promisify");function Ac(r,e){return a(function t(n){ +o),o});return{callback:i,result:s}}a(Tt,"promisify");function Pc(r,e){return a(function t(n){ n.client=e,e.removeListener("error",t),e.on("error",()=>{r.log("additional clien\ t error after disconnection due to error",n)}),r._remove(e),r.emit("error",n,e)}, -"idleListener")}a(Ac,"makeIdleListener");var Sn=class Sn extends Ec{constructor(e,t){ +"idleListener")}a(Pc,"makeIdleListener");var Sn=class Sn extends Tc{constructor(e,t){ super(),this.options=Object.assign({},e),e!=null&&"password"in e&&Object.defineProperty( this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:e.password}), e!=null&&e.ssl&&e.ssl.key&&Object.defineProperty(this.options.ssl,"key",{enumerable:!1}), @@ -1354,7 +1358,7 @@ this.options.max=this.options.max||this.options.poolSize||10,this.options.maxUse this.options.maxUses||1/0,this.options.allowExitOnIdle=this.options.allowExitOnIdle|| !1,this.options.maxLifetimeSeconds=this.options.maxLifetimeSeconds||0,this.log=this. options.log||function(){},this.Client=this.options.Client||t||It().Client,this.Promise= -this.options.Promise||S.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this. +this.options.Promise||b.Promise,typeof this.options.idleTimeoutMillis>"u"&&(this. options.idleTimeoutMillis=1e4),this._clients=[],this._idle=[],this._expired=new WeakSet, this._pendingQueue=[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_isFull(){ return this._clients.length>=this.options.max}_pulseQueue(){if(this.log("pulse q\ @@ -1365,25 +1369,25 @@ _pendingQueue.length){this.log("no queued requests");return}if(!this._idle.lengt this._isFull())return;let e=this._pendingQueue.shift();if(this._idle.length){let t=this. _idle.pop();clearTimeout(t.timeoutId);let n=t.client;n.ref&&n.ref();let i=t.idleListener; return this._acquireClient(n,e,i,!1)}if(!this._isFull())return this.newClient(e); -throw new Error("unexpected condition")}_remove(e){let t=Fs(this._idle,n=>n.client=== +throw new Error("unexpected condition")}_remove(e){let t=Ds(this._idle,n=>n.client=== e);t!==void 0&&clearTimeout(t.timeoutId),this._clients=this._clients.filter(n=>n!== e),e.end(),this.emit("remove",e)}connect(e){if(this.ending){let i=new Error("Can\ not use a pool after calling end on the pool");return e?e(i):this.Promise.reject( i)}let t=Tt(this.Promise,e),n=t.result;if(this._isFull()||this._idle.length){if(this. _idle.length&&m.nextTick(()=>this._pulseQueue()),!this.options.connectionTimeoutMillis) return this._pendingQueue.push(new Ne(t.callback)),n;let i=a((u,c,h)=>{clearTimeout( -o),t.callback(u,c,h)},"queueCallback"),s=new Ne(i),o=setTimeout(()=>{Fs(this._pendingQueue, +o),t.callback(u,c,h)},"queueCallback"),s=new Ne(i),o=setTimeout(()=>{Ds(this._pendingQueue, u=>u.callback===i),s.timedOut=!0,t.callback(new Error("timeout exceeded when try\ ing to connect"))},this.options.connectionTimeoutMillis);return this._pendingQueue. push(s),n}return this.newClient(new Ne(t.callback)),n}newClient(e){let t=new this. -Client(this.options);this._clients.push(t);let n=Ac(this,t);this.log("checking c\ +Client(this.options);this._clients.push(t);let n=Pc(this,t);this.log("checking c\ lient timeout");let i,s=!1;this.options.connectionTimeoutMillis&&(i=setTimeout(()=>{ this.log("ending client due to timeout"),s=!0,t.connection?t.connection.stream.destroy(): t.end()},this.options.connectionTimeoutMillis)),this.log("connecting new client"), t.connect(o=>{if(i&&clearTimeout(i),t.on("error",n),o)this.log("client failed to\ connect",o),this._clients=this._clients.filter(u=>u!==t),s&&(o.message="Connect\ ion terminated due to connection timeout"),this._pulseQueue(),e.timedOut||e.callback( -o,void 0,Rs);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== +o,void 0,ks);else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!== 0){let u=setTimeout(()=>{this.log("ending client due to expired lifetime"),this. _expired.add(t),this._idle.findIndex(h=>h.client===t)!==-1&&this._acquireClient( t,new Ne((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.once( @@ -1391,8 +1395,8 @@ t,new Ne((h,l,d)=>d()),n,!1)},this.options.maxLifetimeSeconds*1e3);u.unref(),t.o i&&this.emit("connect",e),this.emit("acquire",e),e.release=this._releaseOnce(e,n), e.removeListener("error",n),t.timedOut?i&&this.options.verify?this.options.verify( e,e.release):e.release():i&&this.options.verify?this.options.verify(e,s=>{if(s)return e. -release(s),t.callback(s,void 0,Rs);t.callback(void 0,e,e.release)}):t.callback(void 0, -e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&_c(),n=!0,this._release(e, +release(s),t.callback(s,void 0,ks);t.callback(void 0,e,e.release)}):t.callback(void 0, +e,e.release)}_releaseOnce(e,t){let n=!1;return i=>{n&&Ic(),n=!0,this._release(e, t,i)}}_release(e,t,n){if(e.on("error",t),e._poolUseCount=(e._poolUseCount||0)+1, this.emit("release",n,e),n||this.ending||!e._queryable||e._ending||e._poolUseCount>= this.options.maxUses){e._poolUseCount>=this.options.maxUses&&this.log("remove ex\ @@ -1414,7 +1418,7 @@ this.Promise.reject(n)}this.ending=!0;let t=Tt(this.Promise,e);return this._endC t.callback,this._pulseQueue(),t.result}get waitingCount(){return this._pendingQueue. length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients. reduce((e,t)=>e+(this._expired.has(t)?1:0),0)}get totalCount(){return this._clients. -length}};a(Sn,"Pool");var gn=Sn;Ms.exports=gn});var Ds={};se(Ds,{default:()=>Cc});var Cc,Us=te(()=>{"use strict";p();Cc={}});var Os=I((af,Tc)=>{Tc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ +length}};a(Sn,"Pool");var gn=Sn;Us.exports=gn});var Ns={};ie(Ns,{default:()=>Lc});var Lc,qs=z(()=>{"use strict";p();Lc={}});var Qs=I((Sf,Bc)=>{Bc.exports={name:"pg",version:"8.8.0",description:"PostgreSQL\ client - pure javascript & libpq with the same API",keywords:["database","libpq", "pg","postgre","postgres","postgresql","rdbms"],homepage:"https://github.com/bri\ anc/node-postgres",repository:{type:"git",url:"git://github.com/brianc/node-post\ @@ -1425,16 +1429,16 @@ pes":"^2.1.0",pgpass:"1.x"},devDependencies:{async:"2.6.4",bluebird:"3.5.2",co:" 4.6.0","pg-copy-streams":"0.3.0"},peerDependencies:{"pg-native":">=3.0.1"},peerDependenciesMeta:{ "pg-native":{optional:!0}},scripts:{test:"make test-all"},files:["lib","SPONSORS\ .md"],license:"MIT",engines:{node:">= 8.0.0"},gitHead:"c99fb2c127ddf8d712500db2c\ -7b9a5491a178655"}});var Qs=I((uf,qs)=>{"use strict";p();var Ns=ge().EventEmitter,Ic=(Ge(),O(He)),xn=tt(), -qe=qs.exports=function(r,e,t){Ns.call(this),r=xn.normalizeQueryConfig(r,e,t),this. +7b9a5491a178655"}});var Hs=I((xf,js)=>{"use strict";p();var Ws=we().EventEmitter,Rc=(Ge(),N(He)),xn=tt(), +qe=js.exports=function(r,e,t){Ws.call(this),r=xn.normalizeQueryConfig(r,e,t),this. text=r.text,this.values=r.values,this.name=r.name,this.callback=r.callback,this. state="new",this._arrayMode=r.rowMode==="array",this._emitRowEvents=!1,this.on("\ -newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Ic.inherits( -qe,Ns);var Pc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ +newListener",function(n){n==="row"&&(this._emitRowEvents=!0)}.bind(this))};Rc.inherits( +qe,Ws);var Fc={sqlState:"code",statementPosition:"position",messagePrimary:"mess\ age",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"\ dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"\ routine"};qe.prototype.handleError=function(r){var e=this.native.pq.resultErrorFields(); -if(e)for(var t in e){var n=Pc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. +if(e)for(var t in e){var n=Fc[t]||t;r[n]=e[t]}this.callback?this.callback(r):this. emit("error",r),this.state="error"};qe.prototype.then=function(r,e){return this. _getPromise().then(r,e)};qe.prototype.catch=function(r){return this._getPromise(). catch(r)};qe.prototype._getPromise=function(){return this._promise?this._promise: @@ -1456,30 +1460,30 @@ this.name,this.text,n.length,function(s){return s?t(s):(r.namedQueries[e.name]=e text,e.native.execute(e.name,n,t))})}else if(this.values){if(!Array.isArray(this. values)){let s=new Error("Query values must be an array");return t(s)}var i=this. values.map(xn.prepareValue);r.native.query(this.text,i,t)}else r.native.query(this. -text,t)}});var Gs=I((ff,Hs)=>{"use strict";p();var Lc=(Us(),O(Ds)),Bc=wt(),lf=Os(),Ws=ge(). -EventEmitter,Rc=(Ge(),O(He)),Fc=bt(),js=Qs(),Z=Hs.exports=function(r){Ws.call(this), -r=r||{},this._Promise=r.Promise||S.Promise,this._types=new Bc(r.types),this.native= -new Lc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= -!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Fc( +text,t)}});var Vs=I((Af,Ks)=>{"use strict";p();var Mc=(qs(),N(Ns)),kc=wt(),_f=Qs(),Gs=we(). +EventEmitter,Dc=(Ge(),N(He)),Uc=bt(),$s=Hs(),J=Ks.exports=function(r){Gs.call(this), +r=r||{},this._Promise=r.Promise||b.Promise,this._types=new kc(r.types),this.native= +new Mc({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting= +!1,this._connected=!1,this._queryable=!0;var e=this.connectionParameters=new Uc( r);this.user=e.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1, writable:!0,value:e.password}),this.database=e.database,this.host=e.host,this.port= -e.port,this.namedQueries={}};Z.Query=js;Rc.inherits(Z,Ws);Z.prototype._errorAllQueries= +e.port,this.namedQueries={}};J.Query=$s;Dc.inherits(J,Gs);J.prototype._errorAllQueries= function(r){let e=a(t=>{m.nextTick(()=>{t.native=this.native,t.handleError(r)})}, "enqueueError");this._hasActiveQuery()&&(e(this._activeQuery),this._activeQuery= -null),this._queryQueue.forEach(e),this._queryQueue.length=0};Z.prototype._connect= +null),this._queryQueue.forEach(e),this._queryQueue.length=0};J.prototype._connect= function(r){var e=this;if(this._connecting){m.nextTick(()=>r(new Error("Client h\ as already been connected. You cannot reuse a client.")));return}this._connecting= !0,this.connectionParameters.getLibpqConnectionString(function(t,n){if(t)return r( t);e.native.connect(n,function(i){if(i)return e.native.end(),r(i);e._connected=!0, e.native.on("error",function(s){e._queryable=!1,e._errorAllQueries(s),e.emit("er\ ror",s)}),e.native.on("notification",function(s){e.emit("notification",{channel:s. -relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};Z. +relname,payload:s.extra})}),e.emit("connect"),e._pulseQueryQueue(!0),r()})})};J. prototype.connect=function(r){if(r){this._connect(r);return}return new this._Promise( -(e,t)=>{this._connect(n=>{n?t(n):e()})})};Z.prototype.query=function(r,e,t){var n, +(e,t)=>{this._connect(n=>{n?t(n):e()})})};J.prototype.query=function(r,e,t){var n, i,s,o,u;if(r==null)throw new TypeError("Client was passed a null or undefined qu\ ery");if(typeof r.submit=="function")s=r.query_timeout||this.connectionParameters. query_timeout,i=n=r,typeof e=="function"&&(r.callback=e);else if(s=this.connectionParameters. -query_timeout,n=new js(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= +query_timeout,n=new $s(r,e,t),!n.callback){let c,h;i=new this._Promise((l,d)=>{c= l,h=d}),n.callback=(l,d)=>l?h(l):c(d)}return s&&(u=n.callback,o=setTimeout(()=>{ var c=new Error("Query read timeout");m.nextTick(()=>{n.handleError(c,this.connection)}), u(c),n.callback=()=>{};var h=this._queryQueue.indexOf(n);h>-1&&this._queryQueue. @@ -1488,148 +1492,148 @@ this._queryable?this._ending?(n.native=this.native,m.nextTick(()=>{n.handleError new Error("Client was closed and is not queryable"))}),i):(this._queryQueue.push( n),this._pulseQueryQueue(),i):(n.native=this.native,m.nextTick(()=>{n.handleError( new Error("Client has encountered a connection error and is not queryable"))}),i)}; -Z.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( +J.prototype.end=function(r){var e=this;this._ending=!0,this._connected||this.once( "connect",this.end.bind(this,r));var t;return r||(t=new this._Promise(function(n,i){ r=a(s=>s?i(s):n(),"cb")})),this.native.end(function(){e._errorAllQueries(new Error( -"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};Z.prototype. +"Connection terminated")),m.nextTick(()=>{e.emit("end"),r&&r()})}),t};J.prototype. _hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="\ -error"&&this._activeQuery.state!=="end"};Z.prototype._pulseQueryQueue=function(r){ +error"&&this._activeQuery.state!=="end"};J.prototype._pulseQueryQueue=function(r){ if(this._connected&&!this._hasActiveQuery()){var e=this._queryQueue.shift();if(!e){ r||this.emit("drain");return}this._activeQuery=e,e.submit(this);var t=this;e.once( -"_done",function(){t._pulseQueryQueue()})}};Z.prototype.cancel=function(r){this. +"_done",function(){t._pulseQueryQueue()})}};J.prototype.cancel=function(r){this. _activeQuery===r?this.native.cancel(function(){}):this._queryQueue.indexOf(r)!== --1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};Z.prototype.ref=function(){}; -Z.prototype.unref=function(){};Z.prototype.setTypeParser=function(r,e,t){return this. -_types.setTypeParser(r,e,t)};Z.prototype.getTypeParser=function(r,e){return this. -_types.getTypeParser(r,e)}});var vn=I((yf,$s)=>{"use strict";p();$s.exports=Gs()});var It=I((gf,nt)=>{"use strict";p();var Mc=Bs(),kc=et(),Dc=pn(),Uc=ks(),{DatabaseError:Oc}=hn(), -Nc=a(r=>{var e;return e=class extends Uc{constructor(n){super(n,r)}},a(e,"BoundP\ -ool"),e},"poolFactory"),En=a(function(r){this.defaults=kc,this.Client=r,this.Query= -this.Client.Query,this.Pool=Nc(this.Client),this._pools=[],this.Connection=Dc,this. -types=Xe(),this.DatabaseError=Oc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. -exports=new En(vn()):(nt.exports=new En(Mc),Object.defineProperty(nt.exports,"na\ +-1&&this._queryQueue.splice(this._queryQueue.indexOf(r),1)};J.prototype.ref=function(){}; +J.prototype.unref=function(){};J.prototype.setTypeParser=function(r,e,t){return this. +_types.setTypeParser(r,e,t)};J.prototype.getTypeParser=function(r,e){return this. +_types.getTypeParser(r,e)}});var vn=I((If,zs)=>{"use strict";p();zs.exports=Vs()});var It=I((Lf,nt)=>{"use strict";p();var Oc=Ms(),Nc=et(),qc=pn(),Qc=Os(),{DatabaseError:Wc}=hn(), +jc=a(r=>{var e;return e=class extends Qc{constructor(n){super(n,r)}},a(e,"BoundP\ +ool"),e},"poolFactory"),En=a(function(r){this.defaults=Nc,this.Client=r,this.Query= +this.Client.Query,this.Pool=jc(this.Client),this._pools=[],this.Connection=qc,this. +types=Xe(),this.DatabaseError=Wc},"PG");typeof m.env.NODE_PG_FORCE_NATIVE<"u"?nt. +exports=new En(vn()):(nt.exports=new En(Oc),Object.defineProperty(nt.exports,"na\ tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new En(vn())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ -native",{value:r}),r}}))});p();var Lt=Te(It());St();p();St();mr();var zs=Te(tt()),Ys=Te(wt());function qc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(qc,"encodeBuffe\ -rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", -"NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); -_(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ -ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, -"constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ +native",{value:r}),r}}))});p();var Lt=Te(It());St();p();St();mr();var Js=Te(tt()),Xs=Te(wt());function Hc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(Hc,"encodeBuffe\ +rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);A(this,"name", +"NeonDbError");A(this,"severity");A(this,"code");A(this,"detail");A(this,"hint"); +A(this,"position");A(this,"internalPosition");A(this,"internalQuery");A(this,"wh\ +ere");A(this,"schema");A(this,"table");A(this,"column");A(this,"dataType");A(this, +"constraint");A(this,"file");A(this,"line");A(this,"routine");A(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. -captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,Vs="transaction() exp\ -ects an array of queries, or a function returning an array of queries",Qc=["seve\ +captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,Ys="transaction() exp\ +ects an array of queries, or a function returning an array of queries",Gc=["seve\ rity","code","detail","hint","position","internalPosition","internalQuery","wher\ -e","schema","table","column","dataType","constraint","file","line","routine"];function Zs(r,{ +e","schema","table","column","dataType","constraint","file","line","routine"];function eo(r,{ arrayMode:e,fullResults:t,fetchOptions:n,isolationLevel:i,readOnly:s,deferrable:o, queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data\ base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=yr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:b,hostname:C,port:L,pathname:Q}=l;if(d!=="postgres:"&&d!== -"postgresql:"||!b||!C||!Q)throw new Error("Database connection string format for\ - `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function J(A,...g){ -let P,K;if(typeof A=="string")P=A,K=g[1],g=g[0]??[];else{P="";for(let W=0;Wqc((0,zs.prepareValue)(W)));let D={ -query:P,params:g};return u&&u(D),Wc(de,D,K)}a(J,"resolve"),J.transaction=async(A,g)=>{ -if(typeof A=="function"&&(A=A(J)),!Array.isArray(A))throw new Error(Vs);A.forEach( -D=>{if(D[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Vs)});let P=A. -map(D=>D.parameterizedQuery),K=A.map(D=>D.opts??{});return de(P,K,g)};async function de(A,g,P){ -let{fetchEndpoint:K,fetchFunction:D}=_e,W=Array.isArray(A)?{queries:A}:A,X=n??{}, -oe=e??!1,R=t??!1,$=i,ce=s,ye=o;P!==void 0&&(P.fetchOptions!==void 0&&(X={...X,...P. -fetchOptions}),P.arrayMode!==void 0&&(oe=P.arrayMode),P.fullResults!==void 0&&(R= -P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& -(ce=P.readOnly),P.deferrable!==void 0&&(ye=P.deferrable)),g!==void 0&&!Array.isArray( -g)&&g.fetchOptions!==void 0&&(X={...X,...g.fetchOptions});let Se=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(Se=g.authToken);let We=typeof K=="function"?K(C,L,{jwtAuth:Se!== -void 0}):K,he={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ -ray-Mode":"true"},it=await jc(Se);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( -A)&&($!==void 0&&(he["Neon-Batch-Isolation-Level"]=$),ce!==void 0&&(he["Neon-Bat\ -ch-Read-Only"]=String(ce)),ye!==void 0&&(he["Neon-Batch-Deferrable"]=String(ye))); -let ee;try{ee=await(D??fetch)(We,{method:"POST",body:JSON.stringify(W),headers:he, -...X})}catch(j){let H=new pe(`Error connecting to database: ${j}`);throw H.sourceError= -j,H}if(ee.ok){let j=await ee.json();if(Array.isArray(A)){let H=j.results;if(!Array. -isArray(H))throw new pe("Neon internal error: unexpected result format");return H. -map((Ae,xe)=>{let Bt=g[xe]??{},eo=Bt.arrayMode??oe,to=Bt.fullResults??R;return Ks( -Ae,{arrayMode:eo,fullResults:to,parameterizedQuery:A[xe],resultCallback:c,types:Bt. -types})})}else{let H=g??{},Ae=H.arrayMode??oe,xe=H.fullResults??R;return Ks(j,{arrayMode:Ae, -fullResults:xe,parameterizedQuery:A,resultCallback:c,types:H.types})}}else{let{status:j}=ee; -if(j===400){let H=await ee.json(),Ae=new pe(H.message);for(let xe of Qc)Ae[xe]=H[xe]?? -void 0;throw Ae}else{let H=await ee.text();throw new pe(`Server error (HTTP stat\ -us ${j}): ${H}`)}}}return a(de,"execute"),J}a(Zs,"neon");function Wc(r,e,t){return{ +let{protocol:d,username:S,hostname:_,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== +"postgresql:"||!S||!_||!G)throw new Error("Database connection string format for\ + `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(C,...g){ +let P,W;if(typeof C=="string")P=C,W=g[1],g=g[0]??[];else{P="";for(let j=0;jHc((0,Js.prepareValue)(j)));let U={ +query:P,params:g};return u&&u(U),$c(se,U,W)}a(X,"resolve"),X.transaction=async(C,g)=>{ +if(typeof C=="function"&&(C=C(X)),!Array.isArray(C))throw new Error(Ys);C.forEach( +U=>{if(U[Symbol.toStringTag]!=="NeonQueryPromise")throw new Error(Ys)});let P=C. +map(U=>U.parameterizedQuery),W=C.map(U=>U.opts??{});return se(P,W,g)};async function se(C,g,P){ +let{fetchEndpoint:W,fetchFunction:U}=Ae,j=Array.isArray(C)?{queries:C}:C,ee=n??{}, +oe=e??!1,R=t??!1,$=i,ce=s,de=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, +...P.fetchOptions}),P.arrayMode!==void 0&&(oe=P.arrayMode),P.fullResults!==void 0&& +(R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& +(ce=P.readOnly),P.deferrable!==void 0&&(de=P.deferrable)),g!==void 0&&!Array.isArray( +g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let xe=h;!Array.isArray( +g)&&g?.authToken!==void 0&&(xe=g.authToken);let We=typeof W=="function"?W(_,L,{jwtAuth:xe!== +void 0}):W,he={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ +ray-Mode":"true"},it=await Kc(xe);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( +C)&&($!==void 0&&(he["Neon-Batch-Isolation-Level"]=$),ce!==void 0&&(he["Neon-Bat\ +ch-Read-Only"]=String(ce)),de!==void 0&&(he["Neon-Batch-Deferrable"]=String(de))); +let ye;try{ye=await(U??fetch)(We,{method:"POST",body:JSON.stringify(j),headers:he, +...ee})}catch(V){let D=new pe(`Error connecting to database: ${V}`);throw D.sourceError= +V,D}if(ye.ok){let V=await ye.json();if(Array.isArray(C)){let D=V.results;if(!Array. +isArray(D))throw new pe("Neon internal error: unexpected result format");return D. +map((me,ve)=>{let Bt=g[ve]??{},no=Bt.arrayMode??oe,io=Bt.fullResults??R;return Zs( +me,{arrayMode:no,fullResults:io,parameterizedQuery:C[ve],resultCallback:c,types:Bt. +types})})}else{let D=g??{},me=D.arrayMode??oe,ve=D.fullResults??R;return Zs(V,{arrayMode:me, +fullResults:ve,parameterizedQuery:C,resultCallback:c,types:D.types})}}else{let{status:V}=ye; +if(V===400){let D=await ye.json(),me=new pe(D.message);for(let ve of Gc)me[ve]=D[ve]?? +void 0;throw me}else{let D=await ye.text();throw new pe(`Server error (HTTP stat\ +us ${V}): ${D}`)}}}return a(se,"execute"),X}a(eo,"neon");function $c(r,e,t){return{ [Symbol.toStringTag]:"NeonQueryPromise",parameterizedQuery:e,opts:t,then:a((n,i)=>r( e,t).then(n,i),"then"),catch:a(n=>r(e,t).catch(n),"catch"),finally:a(n=>r(e,t).finally( -n),"finally")}}a(Wc,"createNeonQueryPromise");function Ks(r,{arrayMode:e,fullResults:t, -parameterizedQuery:n,resultCallback:i,types:s}){let o=new Ys.default(s),u=r.fields. +n),"finally")}}a($c,"createNeonQueryPromise");function Zs(r,{arrayMode:e,fullResults:t, +parameterizedQuery:n,resultCallback:i,types:s}){let o=new Xs.default(s),u=r.fields. map(l=>l.name),c=r.fields.map(l=>o.getTypeParser(l.dataTypeID)),h=e===!0?r.rows. -map(l=>l.map((d,b)=>d===null?null:c[b](d))):r.rows.map(l=>Object.fromEntries(l.map( -(d,b)=>[u[b],d===null?null:c[b](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), -t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Ks,"\ -processQueryResult");async function jc(r){if(typeof r=="string")return r;if(typeof r== +map(l=>l.map((d,S)=>d===null?null:c[S](d))):r.rows.map(l=>Object.fromEntries(l.map( +(d,S)=>[u[S],d===null?null:c[S](d)])));return i&&i(n,r,h,{arrayMode:e,fullResults:t}), +t?(r.viaNeonFetch=!0,r.rowAsArray=e,r.rows=h,r._parsers=c,r._types=o,r):h}a(Zs,"\ +processQueryResult");async function Kc(r){if(typeof r=="string")return r;if(typeof r== "function")try{return await Promise.resolve(r())}catch(e){let t=new pe("Error ge\ tting auth token.");throw e instanceof Error&&(t=new pe(`Error getting auth toke\ -n: ${e.message}`)),t}}a(jc,"getAuthToken");var Xs=Te(bt()),Qe=Te(It());var An=class An extends Lt.Client{constructor(t){super(t);this.config=t}get neonConfig(){ -return this.connection.stream}connect(t){let{neonConfig:n}=this;n.forceDisablePgSSL&& -(this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&&console.warn("\ -SSL is enabled for both Postgres (e.g. ?sslmode=require in the connection string\ - + forceDisablePgSSL = false) and the WebSocket tunnel (useSecureWebSocket = tru\ -e). Double encryption will increase latency and CPU usage. It may be appropriate\ - to disable SSL in the Postgres connection parameters or set forceDisablePgSSL =\ - true.");let i=this.config?.host!==void 0||this.config?.connectionString!==void 0|| -m.env.PGHOST!==void 0,s=m.env.USER??m.env.USERNAME;if(!i&&this.host==="localhost"&& -this.user===s&&this.database===s&&this.password===null)throw new Error(`No datab\ -ase host or connection string was set, and key parameters have default values (h\ -ost: localhost, user: ${s}, db: ${s}, password: null). Is an environment variabl\ -e missing? Alternatively, if you intended to connect with these parameters, plea\ -se set the host to 'localhost' explicitly.`);let o=super.connect(t),u=n.pipelineTLS&& -this.ssl,c=n.pipelineConnect==="password";if(!u&&!n.pipelineConnect)return o;let h=this. -connection;if(u&&h.on("connect",()=>h.stream.emit("data","S")),c){h.removeAllListeners( -"authenticationCleartextPassword"),h.removeAllListeners("readyForQuery"),h.once( -"readyForQuery",()=>h.on("readyForQuery",this._handleReadyForQuery.bind(this))); -let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassword(), -this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=this. -saslSession,i=this.password,s=t.data;if(n.message!=="SASLInitialResponse"||typeof i!= -"string"||typeof s!="string")throw new Error("SASL: protocol error");let o=Object. -fromEntries(s.split(",").map(ee=>{if(!/^.=/.test(ee))throw new Error("SASL: Inva\ -lid attribute pair entry");let j=ee[0],H=ee.substring(2);return[j,H]})),u=o.r,c=o. -s,h=o.i;if(!u||!/^[!-+--~]+$/.test(u))throw new Error("SASL: SCRAM-SERVER-FIRST-\ -MESSAGE: nonce missing/unprintable");if(!c||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. -test(c))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ -64");if(!h||!/^[1-9][0-9]*$/.test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-M\ -ESSAGE: missing/invalid iteration count");if(!u.startsWith(n.clientNonce))throw new Error( +n: ${e.message}`)),t}}a(Kc,"getAuthToken");var ro=Te(bt()),Qe=Te(It());var Vc="node:crypto",An=class An extends Lt.Client{constructor(t){super(t);this. +config=t}get neonConfig(){return this.connection.stream}connect(t){let{neonConfig:n}=this; +n.forceDisablePgSSL&&(this.ssl=this.connection.ssl=!1),this.ssl&&n.useSecureWebSocket&& +console.warn("SSL is enabled for both Postgres (e.g. ?sslmode=require in the con\ +nection string + forceDisablePgSSL = false) and the WebSocket tunnel (useSecureW\ +ebSocket = true). Double encryption will increase latency and CPU usage. It may \ +be appropriate to disable SSL in the Postgres connection parameters or set force\ +DisablePgSSL = true.");let i=this.config?.host!==void 0||this.config?.connectionString!== +void 0||m.env.PGHOST!==void 0,s=m.env.USER??m.env.USERNAME;if(!i&&this.host==="l\ +ocalhost"&&this.user===s&&this.database===s&&this.password===null)throw new Error( +`No database host or connection string was set, and key parameters have default \ +values (host: localhost, user: ${s}, db: ${s}, password: null). Is an environmen\ +t variable missing? Alternatively, if you intended to connect with these paramet\ +ers, please set the host to 'localhost' explicitly.`);let o=super.connect(t),u=n. +pipelineTLS&&this.ssl,c=n.pipelineConnect==="password";if(!u&&!n.pipelineConnect) +return o;let h=this.connection;if(u&&h.on("connect",()=>h.stream.emit("data","S")), +c){h.removeAllListeners("authenticationCleartextPassword"),h.removeAllListeners( +"readyForQuery"),h.once("readyForQuery",()=>h.on("readyForQuery",this._handleReadyForQuery. +bind(this)));let l=this.ssl?"sslconnect":"connect";h.on(l,()=>{this._handleAuthCleartextPassword(), +this._handleReadyForQuery()})}return o}async _handleAuthSASLContinue(t){let n=typeof w< +"u"&&w.subtle!==void 0&&w.subtle.importKey!==void 0?w.subtle:(await import(Vc)). +webcrypto.subtle,i=this.saslSession,s=this.password,o=t.data;if(i.message!=="SAS\ +LInitialResponse"||typeof s!="string"||typeof o!="string")throw new Error("SASL:\ + protocol error");let u=Object.fromEntries(o.split(",").map(V=>{if(!/^.=/.test(V)) +throw new Error("SASL: Invalid attribute pair entry");let D=V[0],me=V.substring( +2);return[D,me]})),c=u.r,h=u.s,l=u.i;if(!c||!/^[!-+--~]+$/.test(c))throw new Error( +"SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing/unprintable");if(!h||!/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/. +test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base\ +64");if(!l||!/^[1-9][0-9]*$/.test(l))throw new Error("SASL: SCRAM-SERVER-FIRST-M\ +ESSAGE: missing/invalid iteration count");if(!c.startsWith(i.clientNonce))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); -if(u.length===n.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ -SAGE: server nonce is too short");let l=parseInt(h,10),d=y.from(c,"base64"),b=new TextEncoder, -C=b.encode(i),L=await w.subtle.importKey("raw",C,{name:"HMAC",hash:{name:"SHA-25\ -6"}},!1,["sign"]),Q=new Uint8Array(await w.subtle.sign("HMAC",L,y.concat([d,y.from( -[0,0,0,1])]))),J=Q;for(var de=0;deJ[j]^Q[j]));let A=J,g=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),P=new Uint8Array(await w. -subtle.sign("HMAC",g,b.encode("Client Key"))),K=await w.subtle.digest("SHA-256", -P),D="n=*,r="+n.clientNonce,W="r="+u+",s="+c+",i="+l,X="c=biws,r="+u,oe=D+","+W+ -","+X,R=await w.subtle.importKey("raw",K,{name:"HMAC",hash:{name:"SHA-256"}},!1, -["sign"]);var $=new Uint8Array(await w.subtle.sign("HMAC",R,b.encode(oe))),ce=y. -from(P.map((ee,j)=>P[j]^$[j])),ye=ce.toString("base64");let Se=await w.subtle.importKey( -"raw",A,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),We=await w.subtle.sign( -"HMAC",Se,b.encode("Server Key")),he=await w.subtle.importKey("raw",We,{name:"HM\ -AC",hash:{name:"SHA-256"}},!1,["sign"]);var it=y.from(await w.subtle.sign("HMAC", -he,b.encode(oe)));n.message="SASLResponse",n.serverSignature=it.toString("base64"), -n.response=X+",p="+ye,this.connection.sendSCRAMClientFinalMessage(this.saslSession. -response)}};a(An,"NeonClient");var _n=An;function Hc(r,e){if(e)return{callback:e, +if(c.length===i.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ +SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),_=new TextEncoder, +L=_.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, +["sign"]),X=new Uint8Array(await n.sign("HMAC",G,y.concat([S,y.from([0,0,0,1])]))), +se=X;for(var C=0;Cse[D]^X[D]));let g=se,P=await n.importKey("raw",g,{name:"HMAC",hash:{ +name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,_.encode("C\ +lient Key"))),U=await n.digest("SHA-256",W),j="n=*,r="+i.clientNonce,ee="r="+c+"\ +,s="+h+",i="+d,oe="c=biws,r="+c,R=j+","+ee+","+oe,$=await n.importKey("raw",U,{name:"\ +HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var ce=new Uint8Array(await n.sign("HM\ +AC",$,_.encode(R))),de=y.from(W.map((V,D)=>W[D]^ce[D])),xe=de.toString("base64"); +let We=await n.importKey("raw",g,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]), +he=await n.sign("HMAC",We,_.encode("Server Key")),it=await n.importKey("raw",he, +{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var ye=y.from(await n.sign("HMA\ +C",it,_.encode(R)));i.message="SASLResponse",i.serverSignature=ye.toString("base\ +64"),i.response=oe+",p="+xe,this.connection.sendSCRAMClientFinalMessage(this.saslSession. +response)}};a(An,"NeonClient");var _n=An;function zc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ -n=o,t=u});return{callback:i,result:s}}a(Hc,"promisify");var Cn=class Cn extends Lt.Pool{constructor(){ -super(...arguments);_(this,"Client",_n);_(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ +n=o,t=u});return{callback:i,result:s}}a(zc,"promisify");var Cn=class Cn extends Lt.Pool{constructor(){ +super(...arguments);A(this,"Client",_n);A(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ -if(!_e.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Hc(this.Promise, -i);i=s.callback;try{let o=new Xs.default(this.options),u=encodeURIComponent,c=encodeURI, +if(!Ae.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") +return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=zc(this.Promise, +i);i=s.callback;try{let o=new ro.default(this.options),u=encodeURIComponent,c=encodeURI, h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== -"string"?t:t.text,d=n??t.values??[];Zs(h,{fullResults:!0,arrayMode:t.rowMode==="\ -array"})(l,d,{types:t.types??this.options?.types}).then(C=>i(void 0,C)).catch(C=>i( -C))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var Js=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; +"string"?t:t.text,d=n??t.values??[];eo(h,{fullResults:!0,arrayMode:t.rowMode==="\ +array"})(l,d,{types:t.types??this.options?.types}).then(_=>i(void 0,_)).catch(_=>i( +_))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var to=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; var export_Query=Qe.Query;var export_defaults=Qe.defaults;var export_types=Qe.types; export{_n as Client,export_ClientBase as ClientBase,export_Connection as Connection, -export_DatabaseError as DatabaseError,pe as NeonDbError,Js as Pool,export_Query as Query, -export_defaults as defaults,Zs as neon,_e as neonConfig,export_types as types}; +export_DatabaseError as DatabaseError,pe as NeonDbError,to as Pool,export_Query as Query, +export_defaults as defaults,eo as neon,Ae as neonConfig,export_types as types}; /*! Bundled license information: ieee754/index.js: diff --git a/export/index.ts b/export/index.ts index ea9ea98..175052e 100644 --- a/export/index.ts +++ b/export/index.ts @@ -6,6 +6,9 @@ import type { NeonConfigGlobalAndClient } from './neonConfig'; // @ts-ignore -- this isn't officially exported by pg import ConnectionParameters from '../node_modules/pg/lib/connection-parameters'; +// try to avoid the attentions of over-zealous bundlers +const cryptoLib = `node${String.fromCharCode(58)}crypto`; + interface ConnectionParameters { user: string; password: string; @@ -132,6 +135,12 @@ class NeonClient extends Client { } async _handleAuthSASLContinue(msg: any) { + const cs = + // note: we shim these with empty objects so we need further checks + typeof crypto !== 'undefined' && crypto.subtle !== undefined && crypto.subtle.importKey !== undefined + ? crypto.subtle + : (await import(cryptoLib)).webcrypto.subtle; + const session = this.saslSession; const password = this.password; const serverData = msg.data; @@ -187,7 +196,7 @@ class NeonClient extends Client { const saltBytes = Buffer.from(salt, 'base64'); const enc = new TextEncoder(); const passwordBytes = enc.encode(password); - const iterHmacKey = await crypto.subtle.importKey( + const iterHmacKey = await cs.importKey( 'raw', passwordBytes, { name: 'HMAC', hash: { name: 'SHA-256' } }, @@ -195,7 +204,7 @@ class NeonClient extends Client { ['sign'], ); let ui1 = new Uint8Array( - await crypto.subtle.sign( + await cs.sign( 'HMAC', iterHmacKey, Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])]), @@ -203,12 +212,12 @@ class NeonClient extends Client { ); let ui = ui1; for (var i = 0; i < iterations - 1; i++) { - ui1 = new Uint8Array(await crypto.subtle.sign('HMAC', iterHmacKey, ui1)); + ui1 = new Uint8Array(await cs.sign('HMAC', iterHmacKey, ui1)); ui = Buffer.from(ui.map((_, i) => ui[i] ^ ui1[i])); } const saltedPassword = ui; - const ckHmacKey = await crypto.subtle.importKey( + const ckHmacKey = await cs.importKey( 'raw', saltedPassword, { name: 'HMAC', hash: { name: 'SHA-256' } }, @@ -216,9 +225,9 @@ class NeonClient extends Client { ['sign'], ); const clientKey = new Uint8Array( - await crypto.subtle.sign('HMAC', ckHmacKey, enc.encode('Client Key')), + await cs.sign('HMAC', ckHmacKey, enc.encode('Client Key')), ); - const storedKey = await crypto.subtle.digest('SHA-256', clientKey); + const storedKey = await cs.digest('SHA-256', clientKey); const clientFirstMessageBare = 'n=*,r=' + session.clientNonce; const serverFirstMessage = 'r=' + nonce + ',s=' + salt + ',i=' + iterations; @@ -230,7 +239,7 @@ class NeonClient extends Client { ',' + clientFinalMessageWithoutProof; - const csHmacKey = await crypto.subtle.importKey( + const csHmacKey = await cs.importKey( 'raw', storedKey, { name: 'HMAC', hash: { name: 'SHA-256' } }, @@ -238,26 +247,26 @@ class NeonClient extends Client { ['sign'], ); var clientSignature = new Uint8Array( - await crypto.subtle.sign('HMAC', csHmacKey, enc.encode(authMessage)), + await cs.sign('HMAC', csHmacKey, enc.encode(authMessage)), ); var clientProofBytes = Buffer.from( clientKey.map((_, i) => clientKey[i] ^ clientSignature[i]), ); var clientProof = clientProofBytes.toString('base64'); - const skHmacKey = await crypto.subtle.importKey( + const skHmacKey = await cs.importKey( 'raw', saltedPassword, { name: 'HMAC', hash: { name: 'SHA-256' } }, false, ['sign'], ); - const serverKey = await crypto.subtle.sign( + const serverKey = await cs.sign( 'HMAC', skHmacKey, enc.encode('Server Key'), ); - const ssbHmacKey = await crypto.subtle.importKey( + const ssbHmacKey = await cs.importKey( 'raw', serverKey, { name: 'HMAC', hash: { name: 'SHA-256' } }, @@ -265,7 +274,7 @@ class NeonClient extends Client { ['sign'], ); var serverSignatureBytes = Buffer.from( - await crypto.subtle.sign('HMAC', ssbHmacKey, enc.encode(authMessage)), + await cs.sign('HMAC', ssbHmacKey, enc.encode(authMessage)), ); session.message = 'SASLResponse'; diff --git a/package-lock.json b/package-lock.json index f51d819..6f542e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,7 +39,7 @@ "dotenv": "^16.0.3", "esbuild": "^0.24.0", "fast-equals": "^5.0.1", - "subtls": "^0.4.0", + "subtls": "^0.4.4", "typescript": "^5.0.4", "vitest": "^2.1.6", "wrangler": "^3.0.1" @@ -143,20 +143,6 @@ "node": ">=16" } }, - "node_modules/@cloudflare/workers-shared": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.11.0.tgz", - "integrity": "sha512-A+lQ8xp7992qSeMmuQ0ssL6CPmm+ZmAv6Ddikan0n1jjpMAic+97l7xtVIsswSn9iLMFPYQ9uNN/8Fl0AgARIQ==", - "dev": true, - "license": "MIT OR Apache-2.0", - "dependencies": { - "mime": "^3.0.0", - "zod": "^3.22.3" - }, - "engines": { - "node": ">=16.7.0" - } - }, "node_modules/@cspotcode/source-map-support": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", @@ -175,6 +161,7 @@ "resolved": "https://registry.npmjs.org/@edge-runtime/primitives/-/primitives-6.0.0.tgz", "integrity": "sha512-FqoxaBT+prPBHBwE1WXS1ocnu/VLTQyZ6NMUBAdbP7N2hsFTTxMC/jMu2D/8GAlMQfxeuppcPuCUk/HO3fpIvA==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" } @@ -184,6 +171,7 @@ "resolved": "https://registry.npmjs.org/@edge-runtime/vm/-/vm-5.0.0.tgz", "integrity": "sha512-NKBGBSIKUG584qrS1tyxVpX/AKJKQw5HgjYEnPLC0QsTw79JrGn+qUr8CXFb955Iy7GUdiiUv1rJ6JBGvaKb6w==", "dev": true, + "license": "MIT", "dependencies": { "@edge-runtime/primitives": "6.0.0" }, @@ -711,35 +699,6 @@ "@rushstack/node-core-library": "5.10.1" } }, - "node_modules/@microsoft/api-extractor/node_modules/minimatch": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", - "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/@microsoft/api-extractor/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@microsoft/api-extractor/node_modules/typescript": { "version": "5.4.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", @@ -1082,22 +1041,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/@rushstack/node-core-library/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/@rushstack/rig-package": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/@rushstack/rig-package/-/rig-package-0.5.3.tgz", @@ -1109,19 +1052,6 @@ "strip-json-comments": "~3.1.1" } }, - "node_modules/@rushstack/rig-package/node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@rushstack/terminal": { "version": "0.14.4", "resolved": "https://registry.npmjs.org/@rushstack/terminal/-/terminal-0.14.4.tgz", @@ -1141,32 +1071,6 @@ } } }, - "node_modules/@rushstack/terminal/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@rushstack/terminal/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, "node_modules/@rushstack/ts-command-line": { "version": "4.23.2", "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.23.2.tgz", @@ -1692,9 +1596,9 @@ } }, "node_modules/boxen/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.0.tgz", + "integrity": "sha512-ZkD35Mx92acjB2yNJgziGqT9oKHEOxjTBTDRpOsRWtdecL/0jM3z5kM/CTzHWvHIen1GvkM85p6TuFfDGfc8/Q==", "license": "MIT", "engines": { "node": "^12.17.0 || ^14.13 || >=16.0.0" @@ -1955,15 +1859,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "license": "MIT" }, - "node_modules/chalk-template/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/chalk-template/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -1976,6 +1871,27 @@ "node": ">=8" } }, + "node_modules/chalk/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/check-error": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", @@ -1987,9 +1903,9 @@ } }, "node_modules/chokidar": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", - "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", "dev": true, "license": "MIT", "dependencies": { @@ -2117,6 +2033,15 @@ "node": ">=4.8" } }, + "node_modules/cross-spawn/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, "node_modules/crypto": { "resolved": "shims/crypto", "link": true @@ -2163,12 +2088,12 @@ } }, "node_modules/data-view-byte-offset": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", - "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.6", + "call-bound": "^1.0.2", "es-errors": "^1.3.0", "is-data-view": "^1.0.1" }, @@ -2277,12 +2202,12 @@ } }, "node_modules/dunder-proto": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.0.tgz", - "integrity": "sha512-9+Sj30DIu+4KvHqMfLUGLFYL2PkURSYMVXJyXe92nFRvlYq5hBjLEhblKB+vkd/WVlUYMWigiY07T91Fkk0+4A==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.0", + "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" }, @@ -2758,14 +2683,14 @@ } }, "node_modules/get-symbol-description": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", - "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.5", + "call-bound": "^1.0.3", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4" + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -2816,21 +2741,24 @@ "license": "ISC" }, "node_modules/has-bigints": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", - "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "license": "MIT", "engines": { - "node": ">=4" + "node": ">=8" } }, "node_modules/has-property-descriptors": { @@ -3109,12 +3037,12 @@ } }, "node_modules/is-finalizationregistry": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.0.tgz", - "integrity": "sha512-qfMdqbAQEwBw78ZyReKnlA8ezmPdb9BemzIIip/JkjaZUhitfXDkkr+3QTboW0JrSXT1QWyYShpvnNHGZ4c4yA==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7" + "call-bound": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -3230,12 +3158,12 @@ } }, "node_modules/is-shared-array-buffer": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", - "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7" + "call-bound": "^1.0.3" }, "engines": { "node": ">= 0.4" @@ -3290,12 +3218,12 @@ } }, "node_modules/is-typed-array": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", - "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", "license": "MIT", "dependencies": { - "which-typed-array": "^1.1.14" + "which-typed-array": "^1.1.16" }, "engines": { "node": ">= 0.4" @@ -3332,13 +3260,13 @@ } }, "node_modules/is-weakset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.3.tgz", - "integrity": "sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", - "get-intrinsic": "^1.2.4" + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -3460,9 +3388,9 @@ } }, "node_modules/math-intrinsics": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.0.0.tgz", - "integrity": "sha512-4MqMiKP90ybymYvsut0CH2g4XWbfLtmlCkXmtmdcDCxNB+mQcu1w/1+L/VD7vi/PSv7X2JYV7SCcR+jiPXnQtA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", "license": "MIT", "engines": { "node": ">= 0.4" @@ -3575,9 +3503,9 @@ } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -3671,6 +3599,15 @@ "validate-npm-package-license": "^3.0.1" } }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, "node_modules/npm-run-all": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", @@ -3739,14 +3676,16 @@ } }, "node_modules/object.assign": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", - "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.5", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", "define-properties": "^1.2.1", - "has-symbols": "^1.0.3", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", "object-keys": "^1.1.1" }, "engines": { @@ -4197,6 +4136,15 @@ "rc": "cli.js" } }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -4226,19 +4174,19 @@ } }, "node_modules/reflect.getprototypeof": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.8.tgz", - "integrity": "sha512-B5dj6usc5dkk8uFliwjwDHM8To5/QwdKz9JcBZ8Ic4G1f0YmeeJTtE/ZTdgRFPAfxZFiUaPhZ1Jcs4qeagItGQ==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.9.tgz", + "integrity": "sha512-r0Ay04Snci87djAsI4U+WNRcSw5S4pOH7qFjd/veA5gC7TbqESR3tcj28ia95L/fYUDw11JKP7uqUKUAfVvV5Q==", "license": "MIT", "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", - "dunder-proto": "^1.0.0", - "es-abstract": "^1.23.5", + "dunder-proto": "^1.0.1", + "es-abstract": "^1.23.6", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", + "get-intrinsic": "^1.2.6", "gopd": "^1.2.0", - "which-builtin-type": "^1.2.0" + "which-builtin-type": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -4466,12 +4414,19 @@ } }, "node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { - "semver": "bin/semver" + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/serve": { @@ -4535,6 +4490,18 @@ "node": ">= 0.6" } }, + "node_modules/serve-handler/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/serve/node_modules/chalk": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", @@ -4952,18 +4919,22 @@ } }, "node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/subtls": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.4.0.tgz", - "integrity": "sha512-MW9CxlL9+G/9M/X2vMt1N3N6oZKMTnbYVAEABnLqCU9uSmzJILOxCcmPPVwcsnkse6SIOvfSSxcZ7dryagk/Pg==", + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.4.5.tgz", + "integrity": "sha512-uOx+s5vjqPXe+/4eH478hAuQcO4AeF/0vtnaHs6nlyb5MU0mUk1IO9p45TWhD/eE2/crKiUcIOUrzJ2P7Opdyw==", "dev": true, "license": "MIT", "dependencies": { @@ -4971,15 +4942,19 @@ } }, "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, "license": "MIT", "dependencies": { - "has-flag": "^3.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, "node_modules/supports-preserve-symlinks-flag": { @@ -5062,30 +5037,30 @@ } }, "node_modules/typed-array-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", - "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bound": "^1.0.3", "es-errors": "^1.3.0", - "is-typed-array": "^1.1.13" + "is-typed-array": "^1.1.14" }, "engines": { "node": ">= 0.4" } }, "node_modules/typed-array-byte-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", - "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13" + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" }, "engines": { "node": ">= 0.4" @@ -5095,18 +5070,18 @@ } }, "node_modules/typed-array-byte-offset": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.3.tgz", - "integrity": "sha512-GsvTyUHTriq6o/bHcTd0vM7OQ9JEdlvluu9YISaA7+KzDzPaIzEeDFNkTfhdE3MYcNhNi0vq/LlegYgIs5yPAw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", "license": "MIT", "dependencies": { "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-proto": "^1.0.3", - "is-typed-array": "^1.1.13", - "reflect.getprototypeof": "^1.0.6" + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" }, "engines": { "node": ">= 0.4" @@ -5175,9 +5150,9 @@ } }, "node_modules/undici": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.1.0.tgz", - "integrity": "sha512-3+mdX2R31khuLCm2mKExSlMdJsfol7bJkIMH80tdXA74W34rT1jKemUTlYR7WY3TqsV4wfOgpatWmmB2Jl1+5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.2.0.tgz", + "integrity": "sha512-klt+0S55GBViA9nsq48/NSCo4YX5mjydjypxD7UmHh/brMu8h/Mhd/F7qAeoH2NOO8SDTk6kjnTFc4WpzmfYpQ==", "license": "MIT", "engines": { "node": ">=20.18.1" @@ -5966,15 +5941,16 @@ } }, "node_modules/which-typed-array": { - "version": "1.1.16", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.16.tgz", - "integrity": "sha512-g+N+GAWiRj66DngFwHvISJd+ITsyphZvD1vChfVg6cEdnzy53GzB3oy0fUNlvhz7H7+MiqhYr26qxQShCpKTTQ==", + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.18.tgz", + "integrity": "sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==", "license": "MIT", "dependencies": { "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", "for-each": "^0.3.3", - "gopd": "^1.0.1", + "gopd": "^1.2.0", "has-tostringtag": "^1.0.2" }, "engines": { @@ -6038,14 +6014,13 @@ } }, "node_modules/wrangler": { - "version": "3.95.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.95.0.tgz", - "integrity": "sha512-3w5852i3FNyDz421K2Qk4v5L8jjwegO5O8E1+VAQmjnm82HFNxpIRUBq0bmM7CTLvOPI/Jjcmj/eAWjQBL7QYg==", + "version": "3.98.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.98.0.tgz", + "integrity": "sha512-s3R2Jdai+sIAQ1Fd+WzEK5fVxYHxAN7qbjYPXGx75dxM9/O2p+CT666PYLROGIk4sfAeLU4eVp9iqfVDuiQESw==", "dev": true, "license": "MIT OR Apache-2.0", "dependencies": { "@cloudflare/kv-asset-handler": "0.3.4", - "@cloudflare/workers-shared": "0.11.0", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@esbuild-plugins/node-modules-polyfill": "^0.2.2", "blake3-wasm": "^2.1.5", diff --git a/package.json b/package.json index 4f7bb78..68a1518 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "dotenv": "^16.0.3", "esbuild": "^0.24.0", "fast-equals": "^5.0.1", - "subtls": "^0.4.0", + "subtls": "^0.4.4", "typescript": "^5.0.4", "vitest": "^2.1.6", "wrangler": "^3.0.1" diff --git a/shims/crypto/index.ts b/shims/crypto/index.ts index 86d4b8b..57e5747 100644 --- a/shims/crypto/index.ts +++ b/shims/crypto/index.ts @@ -1,7 +1,20 @@ -// note: sha256 and md5 are now bundled in this file since dts-generate-bundle had trouble importing them +import { sha256 } from './sha256'; +import { Md5 } from './md5'; + +// try to escape the attention of over-zealous bundlers +const cryptoLib = `node${String.fromCharCode(58)}crypto`; export function randomBytes(length: number) { - return crypto.getRandomValues(Buffer.alloc(length)); + // three possibilities: + // (1) old Node, no crypto object + // (2) newer Node, crypto object + // (3) browsers, crypto object of type WebCrypto + if (typeof crypto !== 'undefined' && (crypto as any).randomBytes !== undefined) { + const webcrypto = (crypto as any).webcrypto ?? crypto; + return webcrypto.getRandomValues(Buffer.alloc(length)); + } else { + return require(cryptoLib).randomBytes(length); + } } // hash/hmac notes: @@ -75,660 +88,3 @@ export function createHmac(type: 'sha256', key: string | Buffer | Uint8Array) { }, }; } - -/* -TypeScript Md5 -============== - -Based on work by -* Joseph Myers: http://www.myersdaily.org/joseph/javascript/md5-text.html -* André Cruz: https://github.com/satazor/SparkMD5 -* Raymond Hill: https://github.com/gorhill/yamd5.js - -Effectively a TypeScrypt re-write of Raymond Hill JS Library - -The MIT License (MIT) - -Copyright (C) 2014 Raymond Hill - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - - - DO WHAT YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2015 André Cruz - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT YOU WANT TO. - -*/ - -interface HasherState { - buffer: string; - buflen: number; - length: number; - state: number[]; -} - -export class Md5 { - /* GM added 2023-05-18 */ - /** - * Hash an array on the spot - * @param str String to hash - * @param raw Whether to return the value as an `Int32Array` - */ - public static hashByteArray(arr: Uint8Array, raw?: false): string; - public static hashByteArray(arr: Uint8Array, raw: true): Int32Array; - public static hashByteArray(arr: Uint8Array, raw: boolean = false) { - return this.onePassHasher.start().appendByteArray(arr).end(raw); - } - /* end GM added */ - - /** - * Hash a UTF-8 string on the spot - * @param str String to hash - * @param raw Whether to return the value as an `Int32Array` - */ - public static hashStr(str: string, raw?: false): string; - public static hashStr(str: string, raw: true): Int32Array; - public static hashStr(str: string, raw: boolean = false) { - return this.onePassHasher.start().appendStr(str).end(raw); - } - - /** - * Hash a ASCII string on the spot - * @param str String to hash - * @param raw Whether to return the value as an `Int32Array` - */ - public static hashAsciiStr(str: string, raw?: false): string; - public static hashAsciiStr(str: string, raw: true): Int32Array; - public static hashAsciiStr(str: string, raw: boolean = false) { - return this.onePassHasher.start().appendAsciiStr(str).end(raw); - } - // Private Static Variables - private static stateIdentity = new Int32Array([ - 1732584193, -271733879, -1732584194, 271733878, - ]); - private static buffer32Identity = new Int32Array([ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ]); - private static hexChars = '0123456789abcdef'; - private static hexOut: string[] = []; - - // Permanent instance is to use for one-call hashing - private static onePassHasher = new Md5(); - - private static _hex(x: Int32Array): string { - const hc = Md5.hexChars; - const ho = Md5.hexOut; - let n; - let offset; - let j; - let i; - - for (i = 0; i < 4; i += 1) { - offset = i * 8; - n = x[i]; - for (j = 0; j < 8; j += 2) { - ho[offset + 1 + j] = hc.charAt(n & 0x0f); - n >>>= 4; - ho[offset + 0 + j] = hc.charAt(n & 0x0f); - n >>>= 4; - } - } - return ho.join(''); - } - - private static _md5cycle( - x: Int32Array | Uint32Array, - k: Int32Array | Uint32Array, - ) { - let a = x[0]; - let b = x[1]; - let c = x[2]; - let d = x[3]; - // ff() - a += (((b & c) | (~b & d)) + k[0] - 680876936) | 0; - a = (((a << 7) | (a >>> 25)) + b) | 0; - d += (((a & b) | (~a & c)) + k[1] - 389564586) | 0; - d = (((d << 12) | (d >>> 20)) + a) | 0; - c += (((d & a) | (~d & b)) + k[2] + 606105819) | 0; - c = (((c << 17) | (c >>> 15)) + d) | 0; - b += (((c & d) | (~c & a)) + k[3] - 1044525330) | 0; - b = (((b << 22) | (b >>> 10)) + c) | 0; - a += (((b & c) | (~b & d)) + k[4] - 176418897) | 0; - a = (((a << 7) | (a >>> 25)) + b) | 0; - d += (((a & b) | (~a & c)) + k[5] + 1200080426) | 0; - d = (((d << 12) | (d >>> 20)) + a) | 0; - c += (((d & a) | (~d & b)) + k[6] - 1473231341) | 0; - c = (((c << 17) | (c >>> 15)) + d) | 0; - b += (((c & d) | (~c & a)) + k[7] - 45705983) | 0; - b = (((b << 22) | (b >>> 10)) + c) | 0; - a += (((b & c) | (~b & d)) + k[8] + 1770035416) | 0; - a = (((a << 7) | (a >>> 25)) + b) | 0; - d += (((a & b) | (~a & c)) + k[9] - 1958414417) | 0; - d = (((d << 12) | (d >>> 20)) + a) | 0; - c += (((d & a) | (~d & b)) + k[10] - 42063) | 0; - c = (((c << 17) | (c >>> 15)) + d) | 0; - b += (((c & d) | (~c & a)) + k[11] - 1990404162) | 0; - b = (((b << 22) | (b >>> 10)) + c) | 0; - a += (((b & c) | (~b & d)) + k[12] + 1804603682) | 0; - a = (((a << 7) | (a >>> 25)) + b) | 0; - d += (((a & b) | (~a & c)) + k[13] - 40341101) | 0; - d = (((d << 12) | (d >>> 20)) + a) | 0; - c += (((d & a) | (~d & b)) + k[14] - 1502002290) | 0; - c = (((c << 17) | (c >>> 15)) + d) | 0; - b += (((c & d) | (~c & a)) + k[15] + 1236535329) | 0; - b = (((b << 22) | (b >>> 10)) + c) | 0; - // gg() - a += (((b & d) | (c & ~d)) + k[1] - 165796510) | 0; - a = (((a << 5) | (a >>> 27)) + b) | 0; - d += (((a & c) | (b & ~c)) + k[6] - 1069501632) | 0; - d = (((d << 9) | (d >>> 23)) + a) | 0; - c += (((d & b) | (a & ~b)) + k[11] + 643717713) | 0; - c = (((c << 14) | (c >>> 18)) + d) | 0; - b += (((c & a) | (d & ~a)) + k[0] - 373897302) | 0; - b = (((b << 20) | (b >>> 12)) + c) | 0; - a += (((b & d) | (c & ~d)) + k[5] - 701558691) | 0; - a = (((a << 5) | (a >>> 27)) + b) | 0; - d += (((a & c) | (b & ~c)) + k[10] + 38016083) | 0; - d = (((d << 9) | (d >>> 23)) + a) | 0; - c += (((d & b) | (a & ~b)) + k[15] - 660478335) | 0; - c = (((c << 14) | (c >>> 18)) + d) | 0; - b += (((c & a) | (d & ~a)) + k[4] - 405537848) | 0; - b = (((b << 20) | (b >>> 12)) + c) | 0; - a += (((b & d) | (c & ~d)) + k[9] + 568446438) | 0; - a = (((a << 5) | (a >>> 27)) + b) | 0; - d += (((a & c) | (b & ~c)) + k[14] - 1019803690) | 0; - d = (((d << 9) | (d >>> 23)) + a) | 0; - c += (((d & b) | (a & ~b)) + k[3] - 187363961) | 0; - c = (((c << 14) | (c >>> 18)) + d) | 0; - b += (((c & a) | (d & ~a)) + k[8] + 1163531501) | 0; - b = (((b << 20) | (b >>> 12)) + c) | 0; - a += (((b & d) | (c & ~d)) + k[13] - 1444681467) | 0; - a = (((a << 5) | (a >>> 27)) + b) | 0; - d += (((a & c) | (b & ~c)) + k[2] - 51403784) | 0; - d = (((d << 9) | (d >>> 23)) + a) | 0; - c += (((d & b) | (a & ~b)) + k[7] + 1735328473) | 0; - c = (((c << 14) | (c >>> 18)) + d) | 0; - b += (((c & a) | (d & ~a)) + k[12] - 1926607734) | 0; - b = (((b << 20) | (b >>> 12)) + c) | 0; - // hh() - a += ((b ^ c ^ d) + k[5] - 378558) | 0; - a = (((a << 4) | (a >>> 28)) + b) | 0; - d += ((a ^ b ^ c) + k[8] - 2022574463) | 0; - d = (((d << 11) | (d >>> 21)) + a) | 0; - c += ((d ^ a ^ b) + k[11] + 1839030562) | 0; - c = (((c << 16) | (c >>> 16)) + d) | 0; - b += ((c ^ d ^ a) + k[14] - 35309556) | 0; - b = (((b << 23) | (b >>> 9)) + c) | 0; - a += ((b ^ c ^ d) + k[1] - 1530992060) | 0; - a = (((a << 4) | (a >>> 28)) + b) | 0; - d += ((a ^ b ^ c) + k[4] + 1272893353) | 0; - d = (((d << 11) | (d >>> 21)) + a) | 0; - c += ((d ^ a ^ b) + k[7] - 155497632) | 0; - c = (((c << 16) | (c >>> 16)) + d) | 0; - b += ((c ^ d ^ a) + k[10] - 1094730640) | 0; - b = (((b << 23) | (b >>> 9)) + c) | 0; - a += ((b ^ c ^ d) + k[13] + 681279174) | 0; - a = (((a << 4) | (a >>> 28)) + b) | 0; - d += ((a ^ b ^ c) + k[0] - 358537222) | 0; - d = (((d << 11) | (d >>> 21)) + a) | 0; - c += ((d ^ a ^ b) + k[3] - 722521979) | 0; - c = (((c << 16) | (c >>> 16)) + d) | 0; - b += ((c ^ d ^ a) + k[6] + 76029189) | 0; - b = (((b << 23) | (b >>> 9)) + c) | 0; - a += ((b ^ c ^ d) + k[9] - 640364487) | 0; - a = (((a << 4) | (a >>> 28)) + b) | 0; - d += ((a ^ b ^ c) + k[12] - 421815835) | 0; - d = (((d << 11) | (d >>> 21)) + a) | 0; - c += ((d ^ a ^ b) + k[15] + 530742520) | 0; - c = (((c << 16) | (c >>> 16)) + d) | 0; - b += ((c ^ d ^ a) + k[2] - 995338651) | 0; - b = (((b << 23) | (b >>> 9)) + c) | 0; - // ii() - a += ((c ^ (b | ~d)) + k[0] - 198630844) | 0; - a = (((a << 6) | (a >>> 26)) + b) | 0; - d += ((b ^ (a | ~c)) + k[7] + 1126891415) | 0; - d = (((d << 10) | (d >>> 22)) + a) | 0; - c += ((a ^ (d | ~b)) + k[14] - 1416354905) | 0; - c = (((c << 15) | (c >>> 17)) + d) | 0; - b += ((d ^ (c | ~a)) + k[5] - 57434055) | 0; - b = (((b << 21) | (b >>> 11)) + c) | 0; - a += ((c ^ (b | ~d)) + k[12] + 1700485571) | 0; - a = (((a << 6) | (a >>> 26)) + b) | 0; - d += ((b ^ (a | ~c)) + k[3] - 1894986606) | 0; - d = (((d << 10) | (d >>> 22)) + a) | 0; - c += ((a ^ (d | ~b)) + k[10] - 1051523) | 0; - c = (((c << 15) | (c >>> 17)) + d) | 0; - b += ((d ^ (c | ~a)) + k[1] - 2054922799) | 0; - b = (((b << 21) | (b >>> 11)) + c) | 0; - a += ((c ^ (b | ~d)) + k[8] + 1873313359) | 0; - a = (((a << 6) | (a >>> 26)) + b) | 0; - d += ((b ^ (a | ~c)) + k[15] - 30611744) | 0; - d = (((d << 10) | (d >>> 22)) + a) | 0; - c += ((a ^ (d | ~b)) + k[6] - 1560198380) | 0; - c = (((c << 15) | (c >>> 17)) + d) | 0; - b += ((d ^ (c | ~a)) + k[13] + 1309151649) | 0; - b = (((b << 21) | (b >>> 11)) + c) | 0; - a += ((c ^ (b | ~d)) + k[4] - 145523070) | 0; - a = (((a << 6) | (a >>> 26)) + b) | 0; - d += ((b ^ (a | ~c)) + k[11] - 1120210379) | 0; - d = (((d << 10) | (d >>> 22)) + a) | 0; - c += ((a ^ (d | ~b)) + k[2] + 718787259) | 0; - c = (((c << 15) | (c >>> 17)) + d) | 0; - b += ((d ^ (c | ~a)) + k[9] - 343485551) | 0; - b = (((b << 21) | (b >>> 11)) + c) | 0; - - x[0] = (a + x[0]) | 0; - x[1] = (b + x[1]) | 0; - x[2] = (c + x[2]) | 0; - x[3] = (d + x[3]) | 0; - } - - private _dataLength = 0; - private _bufferLength = 0; - - private _state: Int32Array = new Int32Array(4); - private _buffer: ArrayBuffer = new ArrayBuffer(68); - private _buffer8: Uint8Array; - private _buffer32: Uint32Array; - - constructor() { - this._buffer8 = new Uint8Array(this._buffer, 0, 68); - this._buffer32 = new Uint32Array(this._buffer, 0, 17); - this.start(); - } - - /** - * Initialise buffer to be hashed - */ - public start() { - this._dataLength = 0; - this._bufferLength = 0; - this._state.set(Md5.stateIdentity); - return this; - } - - // Char to code point to to array conversion: - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt - // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown - - /** - * Append a UTF-8 string to the hash buffer - * @param str String to append - */ - public appendStr(str: string) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let code; - let i; - - for (i = 0; i < str.length; i += 1) { - code = str.charCodeAt(i); - if (code < 128) { - buf8[bufLen++] = code; - } else if (code < 0x800) { - buf8[bufLen++] = (code >>> 6) + 0xc0; - buf8[bufLen++] = (code & 0x3f) | 0x80; - } else if (code < 0xd800 || code > 0xdbff) { - buf8[bufLen++] = (code >>> 12) + 0xe0; - buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; - buf8[bufLen++] = (code & 0x3f) | 0x80; - } else { - code = - (code - 0xd800) * 0x400 + (str.charCodeAt(++i) - 0xdc00) + 0x10000; - if (code > 0x10ffff) { - throw new Error( - 'Unicode standard supports code points up to U+10FFFF', - ); - } - buf8[bufLen++] = (code >>> 18) + 0xf0; - buf8[bufLen++] = ((code >>> 12) & 0x3f) | 0x80; - buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; - buf8[bufLen++] = (code & 0x3f) | 0x80; - } - if (bufLen >= 64) { - this._dataLength += 64; - Md5._md5cycle(this._state, buf32); - bufLen -= 64; - buf32[0] = buf32[16]; - } - } - this._bufferLength = bufLen; - return this; - } - - /** - * Append an ASCII string to the hash buffer - * @param str String to append - */ - public appendAsciiStr(str: string) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let i; - let j = 0; - - for (;;) { - i = Math.min(str.length - j, 64 - bufLen); - while (i--) { - buf8[bufLen++] = str.charCodeAt(j++); - } - if (bufLen < 64) { - break; - } - this._dataLength += 64; - Md5._md5cycle(this._state, buf32); - bufLen = 0; - } - this._bufferLength = bufLen; - return this; - } - - /** - * Append a byte array to the hash buffer - * @param input array to append - */ - public appendByteArray(input: Uint8Array) { - const buf8 = this._buffer8; - const buf32 = this._buffer32; - let bufLen = this._bufferLength; - let i; - let j = 0; - - for (;;) { - i = Math.min(input.length - j, 64 - bufLen); - while (i--) { - buf8[bufLen++] = input[j++]; - } - if (bufLen < 64) { - break; - } - this._dataLength += 64; - Md5._md5cycle(this._state, buf32); - bufLen = 0; - } - this._bufferLength = bufLen; - return this; - } - - /** - * Get the state of the hash buffer - */ - public getState(): HasherState { - const s = this._state; - - return { - buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)), - buflen: this._bufferLength, - length: this._dataLength, - state: [s[0], s[1], s[2], s[3]], - }; - } - - /** - * Override the current state of the hash buffer - * @param state New hash buffer state - */ - public setState(state: HasherState) { - const buf = state.buffer; - const x = state.state; - const s = this._state; - let i; - - this._dataLength = state.length; - this._bufferLength = state.buflen; - s[0] = x[0]; - s[1] = x[1]; - s[2] = x[2]; - s[3] = x[3]; - - for (i = 0; i < buf.length; i += 1) { - this._buffer8[i] = buf.charCodeAt(i); - } - } - - /** - * Hash the current state of the hash buffer and return the result - * @param raw Whether to return the value as an `Int32Array` - */ - public end(raw: boolean = false) { - const bufLen = this._bufferLength; - const buf8 = this._buffer8; - const buf32 = this._buffer32; - const i = (bufLen >> 2) + 1; - - this._dataLength += bufLen; - const dataBitsLen = this._dataLength * 8; - - buf8[bufLen] = 0x80; - buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0; - buf32.set(Md5.buffer32Identity.subarray(i), i); - - if (bufLen > 55) { - Md5._md5cycle(this._state, buf32); - buf32.set(Md5.buffer32Identity); - } - - // Do the final computation based on the tail and length - // Beware that the final length may not fit in 32 bits so we take care of that - if (dataBitsLen <= 0xffffffff) { - buf32[14] = dataBitsLen; - } else { - const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/); - if (matches === null) { - return; - } - - const lo = parseInt(matches[2], 16); - const hi = parseInt(matches[1], 16) || 0; - - buf32[14] = lo; - buf32[15] = hi; - } - - Md5._md5cycle(this._state, buf32); - - return raw ? this._state : Md5._hex(this._state); - } -} - -// if (Md5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592') { -// throw new Error('Md5 self test failed.'); -// } - -/* -Copyright 2022 Andrea Griffini - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -// sha256(data) returns the digest -// sha256() returns an object you can call .add(data) zero or more time and .digest() at the end -// digest is a 32-byte Uint8Array instance with an added .hex() function. -// Input should be either a string (that will be encoded as UTF-8) or an array-like object with values 0..255. - -export function sha256( - data?: T, -): T extends string | Uint8Array - ? Uint8Array - : { add: (data: string | Uint8Array) => void; digest: () => Uint8Array } { - let h0 = 0x6a09e667, - h1 = 0xbb67ae85, - h2 = 0x3c6ef372, - h3 = 0xa54ff53a, - h4 = 0x510e527f, - h5 = 0x9b05688c, - h6 = 0x1f83d9ab, - h7 = 0x5be0cd19, - tsz = 0, - bp = 0; - const k = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, - 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, - 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, - 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, - 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, - 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, - ], - rrot = (x: number, n: number) => (x >>> n) | (x << (32 - n)), - w = new Uint32Array(64), - buf = new Uint8Array(64), - process = () => { - for (let j = 0, r = 0; j < 16; j++, r += 4) { - w[j] = - (buf[r] << 24) | (buf[r + 1] << 16) | (buf[r + 2] << 8) | buf[r + 3]; - } - for (let j = 16; j < 64; j++) { - let s0 = rrot(w[j - 15], 7) ^ rrot(w[j - 15], 18) ^ (w[j - 15] >>> 3); - let s1 = rrot(w[j - 2], 17) ^ rrot(w[j - 2], 19) ^ (w[j - 2] >>> 10); - w[j] = (w[j - 16] + s0 + w[j - 7] + s1) | 0; - } - let a = h0, - b = h1, - c = h2, - d = h3, - e = h4, - f = h5, - g = h6, - h = h7; - for (let j = 0; j < 64; j++) { - let S1 = rrot(e, 6) ^ rrot(e, 11) ^ rrot(e, 25), - ch = (e & f) ^ (~e & g), - t1 = (h + S1 + ch + k[j] + w[j]) | 0, - S0 = rrot(a, 2) ^ rrot(a, 13) ^ rrot(a, 22), - maj = (a & b) ^ (a & c) ^ (b & c), - t2 = (S0 + maj) | 0; - h = g; - g = f; - f = e; - e = (d + t1) | 0; - d = c; - c = b; - b = a; - a = (t1 + t2) | 0; - } - h0 = (h0 + a) | 0; - h1 = (h1 + b) | 0; - h2 = (h2 + c) | 0; - h3 = (h3 + d) | 0; - h4 = (h4 + e) | 0; - h5 = (h5 + f) | 0; - h6 = (h6 + g) | 0; - h7 = (h7 + h) | 0; - bp = 0; - }, - add = (data: string | Uint8Array) => { - if (typeof data === 'string') { - data = new TextEncoder().encode(data); - } - for (let i = 0; i < data.length; i++) { - buf[bp++] = data[i]; - if (bp === 64) process(); - } - tsz += data.length; - }, - digest = () => { - buf[bp++] = 0x80; - if (bp == 64) process(); - if (bp + 8 > 64) { - while (bp < 64) buf[bp++] = 0x00; - process(); - } - while (bp < 58) buf[bp++] = 0x00; - // Max number of bytes is 35,184,372,088,831 - let L = tsz * 8; - buf[bp++] = (L / 1099511627776) & 255; - buf[bp++] = (L / 4294967296) & 255; - buf[bp++] = L >>> 24; - buf[bp++] = (L >>> 16) & 255; - buf[bp++] = (L >>> 8) & 255; - buf[bp++] = L & 255; - process(); - let reply = new Uint8Array(32); - reply[0] = h0 >>> 24; - reply[1] = (h0 >>> 16) & 255; - reply[2] = (h0 >>> 8) & 255; - reply[3] = h0 & 255; - reply[4] = h1 >>> 24; - reply[5] = (h1 >>> 16) & 255; - reply[6] = (h1 >>> 8) & 255; - reply[7] = h1 & 255; - reply[8] = h2 >>> 24; - reply[9] = (h2 >>> 16) & 255; - reply[10] = (h2 >>> 8) & 255; - reply[11] = h2 & 255; - reply[12] = h3 >>> 24; - reply[13] = (h3 >>> 16) & 255; - reply[14] = (h3 >>> 8) & 255; - reply[15] = h3 & 255; - reply[16] = h4 >>> 24; - reply[17] = (h4 >>> 16) & 255; - reply[18] = (h4 >>> 8) & 255; - reply[19] = h4 & 255; - reply[20] = h5 >>> 24; - reply[21] = (h5 >>> 16) & 255; - reply[22] = (h5 >>> 8) & 255; - reply[23] = h5 & 255; - reply[24] = h6 >>> 24; - reply[25] = (h6 >>> 16) & 255; - reply[26] = (h6 >>> 8) & 255; - reply[27] = h6 & 255; - reply[28] = h7 >>> 24; - reply[29] = (h7 >>> 16) & 255; - reply[30] = (h7 >>> 8) & 255; - reply[31] = h7 & 255; - return reply; - }; - if (data === undefined) return { add, digest } as any; - add(data); - return digest() as any; -} diff --git a/shims/crypto/md5.ts b/shims/crypto/md5.ts new file mode 100644 index 0000000..39dd54e --- /dev/null +++ b/shims/crypto/md5.ts @@ -0,0 +1,486 @@ +/* +TypeScript Md5 +============== + +Based on work by +* Joseph Myers: http://www.myersdaily.org/joseph/javascript/md5-text.html +* André Cruz: https://github.com/satazor/SparkMD5 +* Raymond Hill: https://github.com/gorhill/yamd5.js + +Effectively a TypeScrypt re-write of Raymond Hill JS Library + +The MIT License (MIT) + +Copyright (C) 2014 Raymond Hill + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + + DO WHAT YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2015 André Cruz + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT YOU WANT TO. + +*/ + +interface HasherState { + buffer: string; + buflen: number; + length: number; + state: number[]; +} + +export class Md5 { + /* GM added 2023-05-18 */ + /** + * Hash an array on the spot + * @param str String to hash + * @param raw Whether to return the value as an `Int32Array` + */ + public static hashByteArray(arr: Uint8Array, raw?: false): string; + public static hashByteArray(arr: Uint8Array, raw: true): Int32Array; + public static hashByteArray(arr: Uint8Array, raw: boolean = false) { + return this.onePassHasher.start().appendByteArray(arr).end(raw); + } + /* end GM added */ + + /** + * Hash a UTF-8 string on the spot + * @param str String to hash + * @param raw Whether to return the value as an `Int32Array` + */ + public static hashStr(str: string, raw?: false): string; + public static hashStr(str: string, raw: true): Int32Array; + public static hashStr(str: string, raw: boolean = false) { + return this.onePassHasher.start().appendStr(str).end(raw); + } + + /** + * Hash a ASCII string on the spot + * @param str String to hash + * @param raw Whether to return the value as an `Int32Array` + */ + public static hashAsciiStr(str: string, raw?: false): string; + public static hashAsciiStr(str: string, raw: true): Int32Array; + public static hashAsciiStr(str: string, raw: boolean = false) { + return this.onePassHasher.start().appendAsciiStr(str).end(raw); + } + // Private Static Variables + private static stateIdentity = new Int32Array([ + 1732584193, -271733879, -1732584194, 271733878, + ]); + private static buffer32Identity = new Int32Array([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + ]); + private static hexChars = '0123456789abcdef'; + private static hexOut: string[] = []; + + // Permanent instance is to use for one-call hashing + private static onePassHasher = new Md5(); + + private static _hex(x: Int32Array): string { + const hc = Md5.hexChars; + const ho = Md5.hexOut; + let n; + let offset; + let j; + let i; + + for (i = 0; i < 4; i += 1) { + offset = i * 8; + n = x[i]; + for (j = 0; j < 8; j += 2) { + ho[offset + 1 + j] = hc.charAt(n & 0x0f); + n >>>= 4; + ho[offset + 0 + j] = hc.charAt(n & 0x0f); + n >>>= 4; + } + } + return ho.join(''); + } + + private static _md5cycle( + x: Int32Array | Uint32Array, + k: Int32Array | Uint32Array, + ) { + let a = x[0]; + let b = x[1]; + let c = x[2]; + let d = x[3]; + // ff() + a += (((b & c) | (~b & d)) + k[0] - 680876936) | 0; + a = (((a << 7) | (a >>> 25)) + b) | 0; + d += (((a & b) | (~a & c)) + k[1] - 389564586) | 0; + d = (((d << 12) | (d >>> 20)) + a) | 0; + c += (((d & a) | (~d & b)) + k[2] + 606105819) | 0; + c = (((c << 17) | (c >>> 15)) + d) | 0; + b += (((c & d) | (~c & a)) + k[3] - 1044525330) | 0; + b = (((b << 22) | (b >>> 10)) + c) | 0; + a += (((b & c) | (~b & d)) + k[4] - 176418897) | 0; + a = (((a << 7) | (a >>> 25)) + b) | 0; + d += (((a & b) | (~a & c)) + k[5] + 1200080426) | 0; + d = (((d << 12) | (d >>> 20)) + a) | 0; + c += (((d & a) | (~d & b)) + k[6] - 1473231341) | 0; + c = (((c << 17) | (c >>> 15)) + d) | 0; + b += (((c & d) | (~c & a)) + k[7] - 45705983) | 0; + b = (((b << 22) | (b >>> 10)) + c) | 0; + a += (((b & c) | (~b & d)) + k[8] + 1770035416) | 0; + a = (((a << 7) | (a >>> 25)) + b) | 0; + d += (((a & b) | (~a & c)) + k[9] - 1958414417) | 0; + d = (((d << 12) | (d >>> 20)) + a) | 0; + c += (((d & a) | (~d & b)) + k[10] - 42063) | 0; + c = (((c << 17) | (c >>> 15)) + d) | 0; + b += (((c & d) | (~c & a)) + k[11] - 1990404162) | 0; + b = (((b << 22) | (b >>> 10)) + c) | 0; + a += (((b & c) | (~b & d)) + k[12] + 1804603682) | 0; + a = (((a << 7) | (a >>> 25)) + b) | 0; + d += (((a & b) | (~a & c)) + k[13] - 40341101) | 0; + d = (((d << 12) | (d >>> 20)) + a) | 0; + c += (((d & a) | (~d & b)) + k[14] - 1502002290) | 0; + c = (((c << 17) | (c >>> 15)) + d) | 0; + b += (((c & d) | (~c & a)) + k[15] + 1236535329) | 0; + b = (((b << 22) | (b >>> 10)) + c) | 0; + // gg() + a += (((b & d) | (c & ~d)) + k[1] - 165796510) | 0; + a = (((a << 5) | (a >>> 27)) + b) | 0; + d += (((a & c) | (b & ~c)) + k[6] - 1069501632) | 0; + d = (((d << 9) | (d >>> 23)) + a) | 0; + c += (((d & b) | (a & ~b)) + k[11] + 643717713) | 0; + c = (((c << 14) | (c >>> 18)) + d) | 0; + b += (((c & a) | (d & ~a)) + k[0] - 373897302) | 0; + b = (((b << 20) | (b >>> 12)) + c) | 0; + a += (((b & d) | (c & ~d)) + k[5] - 701558691) | 0; + a = (((a << 5) | (a >>> 27)) + b) | 0; + d += (((a & c) | (b & ~c)) + k[10] + 38016083) | 0; + d = (((d << 9) | (d >>> 23)) + a) | 0; + c += (((d & b) | (a & ~b)) + k[15] - 660478335) | 0; + c = (((c << 14) | (c >>> 18)) + d) | 0; + b += (((c & a) | (d & ~a)) + k[4] - 405537848) | 0; + b = (((b << 20) | (b >>> 12)) + c) | 0; + a += (((b & d) | (c & ~d)) + k[9] + 568446438) | 0; + a = (((a << 5) | (a >>> 27)) + b) | 0; + d += (((a & c) | (b & ~c)) + k[14] - 1019803690) | 0; + d = (((d << 9) | (d >>> 23)) + a) | 0; + c += (((d & b) | (a & ~b)) + k[3] - 187363961) | 0; + c = (((c << 14) | (c >>> 18)) + d) | 0; + b += (((c & a) | (d & ~a)) + k[8] + 1163531501) | 0; + b = (((b << 20) | (b >>> 12)) + c) | 0; + a += (((b & d) | (c & ~d)) + k[13] - 1444681467) | 0; + a = (((a << 5) | (a >>> 27)) + b) | 0; + d += (((a & c) | (b & ~c)) + k[2] - 51403784) | 0; + d = (((d << 9) | (d >>> 23)) + a) | 0; + c += (((d & b) | (a & ~b)) + k[7] + 1735328473) | 0; + c = (((c << 14) | (c >>> 18)) + d) | 0; + b += (((c & a) | (d & ~a)) + k[12] - 1926607734) | 0; + b = (((b << 20) | (b >>> 12)) + c) | 0; + // hh() + a += ((b ^ c ^ d) + k[5] - 378558) | 0; + a = (((a << 4) | (a >>> 28)) + b) | 0; + d += ((a ^ b ^ c) + k[8] - 2022574463) | 0; + d = (((d << 11) | (d >>> 21)) + a) | 0; + c += ((d ^ a ^ b) + k[11] + 1839030562) | 0; + c = (((c << 16) | (c >>> 16)) + d) | 0; + b += ((c ^ d ^ a) + k[14] - 35309556) | 0; + b = (((b << 23) | (b >>> 9)) + c) | 0; + a += ((b ^ c ^ d) + k[1] - 1530992060) | 0; + a = (((a << 4) | (a >>> 28)) + b) | 0; + d += ((a ^ b ^ c) + k[4] + 1272893353) | 0; + d = (((d << 11) | (d >>> 21)) + a) | 0; + c += ((d ^ a ^ b) + k[7] - 155497632) | 0; + c = (((c << 16) | (c >>> 16)) + d) | 0; + b += ((c ^ d ^ a) + k[10] - 1094730640) | 0; + b = (((b << 23) | (b >>> 9)) + c) | 0; + a += ((b ^ c ^ d) + k[13] + 681279174) | 0; + a = (((a << 4) | (a >>> 28)) + b) | 0; + d += ((a ^ b ^ c) + k[0] - 358537222) | 0; + d = (((d << 11) | (d >>> 21)) + a) | 0; + c += ((d ^ a ^ b) + k[3] - 722521979) | 0; + c = (((c << 16) | (c >>> 16)) + d) | 0; + b += ((c ^ d ^ a) + k[6] + 76029189) | 0; + b = (((b << 23) | (b >>> 9)) + c) | 0; + a += ((b ^ c ^ d) + k[9] - 640364487) | 0; + a = (((a << 4) | (a >>> 28)) + b) | 0; + d += ((a ^ b ^ c) + k[12] - 421815835) | 0; + d = (((d << 11) | (d >>> 21)) + a) | 0; + c += ((d ^ a ^ b) + k[15] + 530742520) | 0; + c = (((c << 16) | (c >>> 16)) + d) | 0; + b += ((c ^ d ^ a) + k[2] - 995338651) | 0; + b = (((b << 23) | (b >>> 9)) + c) | 0; + // ii() + a += ((c ^ (b | ~d)) + k[0] - 198630844) | 0; + a = (((a << 6) | (a >>> 26)) + b) | 0; + d += ((b ^ (a | ~c)) + k[7] + 1126891415) | 0; + d = (((d << 10) | (d >>> 22)) + a) | 0; + c += ((a ^ (d | ~b)) + k[14] - 1416354905) | 0; + c = (((c << 15) | (c >>> 17)) + d) | 0; + b += ((d ^ (c | ~a)) + k[5] - 57434055) | 0; + b = (((b << 21) | (b >>> 11)) + c) | 0; + a += ((c ^ (b | ~d)) + k[12] + 1700485571) | 0; + a = (((a << 6) | (a >>> 26)) + b) | 0; + d += ((b ^ (a | ~c)) + k[3] - 1894986606) | 0; + d = (((d << 10) | (d >>> 22)) + a) | 0; + c += ((a ^ (d | ~b)) + k[10] - 1051523) | 0; + c = (((c << 15) | (c >>> 17)) + d) | 0; + b += ((d ^ (c | ~a)) + k[1] - 2054922799) | 0; + b = (((b << 21) | (b >>> 11)) + c) | 0; + a += ((c ^ (b | ~d)) + k[8] + 1873313359) | 0; + a = (((a << 6) | (a >>> 26)) + b) | 0; + d += ((b ^ (a | ~c)) + k[15] - 30611744) | 0; + d = (((d << 10) | (d >>> 22)) + a) | 0; + c += ((a ^ (d | ~b)) + k[6] - 1560198380) | 0; + c = (((c << 15) | (c >>> 17)) + d) | 0; + b += ((d ^ (c | ~a)) + k[13] + 1309151649) | 0; + b = (((b << 21) | (b >>> 11)) + c) | 0; + a += ((c ^ (b | ~d)) + k[4] - 145523070) | 0; + a = (((a << 6) | (a >>> 26)) + b) | 0; + d += ((b ^ (a | ~c)) + k[11] - 1120210379) | 0; + d = (((d << 10) | (d >>> 22)) + a) | 0; + c += ((a ^ (d | ~b)) + k[2] + 718787259) | 0; + c = (((c << 15) | (c >>> 17)) + d) | 0; + b += ((d ^ (c | ~a)) + k[9] - 343485551) | 0; + b = (((b << 21) | (b >>> 11)) + c) | 0; + + x[0] = (a + x[0]) | 0; + x[1] = (b + x[1]) | 0; + x[2] = (c + x[2]) | 0; + x[3] = (d + x[3]) | 0; + } + + private _dataLength = 0; + private _bufferLength = 0; + + private _state: Int32Array = new Int32Array(4); + private _buffer: ArrayBuffer = new ArrayBuffer(68); + private _buffer8: Uint8Array; + private _buffer32: Uint32Array; + + constructor() { + this._buffer8 = new Uint8Array(this._buffer, 0, 68); + this._buffer32 = new Uint32Array(this._buffer, 0, 17); + this.start(); + } + + /** + * Initialise buffer to be hashed + */ + public start() { + this._dataLength = 0; + this._bufferLength = 0; + this._state.set(Md5.stateIdentity); + return this; + } + + // Char to code point to to array conversion: + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/charCodeAt + // #Example.3A_Fixing_charCodeAt_to_handle_non-Basic-Multilingual-Plane_characters_if_their_presence_earlier_in_the_string_is_unknown + + /** + * Append a UTF-8 string to the hash buffer + * @param str String to append + */ + public appendStr(str: string) { + const buf8 = this._buffer8; + const buf32 = this._buffer32; + let bufLen = this._bufferLength; + let code; + let i; + + for (i = 0; i < str.length; i += 1) { + code = str.charCodeAt(i); + if (code < 128) { + buf8[bufLen++] = code; + } else if (code < 0x800) { + buf8[bufLen++] = (code >>> 6) + 0xc0; + buf8[bufLen++] = (code & 0x3f) | 0x80; + } else if (code < 0xd800 || code > 0xdbff) { + buf8[bufLen++] = (code >>> 12) + 0xe0; + buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; + buf8[bufLen++] = (code & 0x3f) | 0x80; + } else { + code = + (code - 0xd800) * 0x400 + (str.charCodeAt(++i) - 0xdc00) + 0x10000; + if (code > 0x10ffff) { + throw new Error( + 'Unicode standard supports code points up to U+10FFFF', + ); + } + buf8[bufLen++] = (code >>> 18) + 0xf0; + buf8[bufLen++] = ((code >>> 12) & 0x3f) | 0x80; + buf8[bufLen++] = ((code >>> 6) & 0x3f) | 0x80; + buf8[bufLen++] = (code & 0x3f) | 0x80; + } + if (bufLen >= 64) { + this._dataLength += 64; + Md5._md5cycle(this._state, buf32); + bufLen -= 64; + buf32[0] = buf32[16]; + } + } + this._bufferLength = bufLen; + return this; + } + + /** + * Append an ASCII string to the hash buffer + * @param str String to append + */ + public appendAsciiStr(str: string) { + const buf8 = this._buffer8; + const buf32 = this._buffer32; + let bufLen = this._bufferLength; + let i; + let j = 0; + + for (;;) { + i = Math.min(str.length - j, 64 - bufLen); + while (i--) { + buf8[bufLen++] = str.charCodeAt(j++); + } + if (bufLen < 64) { + break; + } + this._dataLength += 64; + Md5._md5cycle(this._state, buf32); + bufLen = 0; + } + this._bufferLength = bufLen; + return this; + } + + /** + * Append a byte array to the hash buffer + * @param input array to append + */ + public appendByteArray(input: Uint8Array) { + const buf8 = this._buffer8; + const buf32 = this._buffer32; + let bufLen = this._bufferLength; + let i; + let j = 0; + + for (;;) { + i = Math.min(input.length - j, 64 - bufLen); + while (i--) { + buf8[bufLen++] = input[j++]; + } + if (bufLen < 64) { + break; + } + this._dataLength += 64; + Md5._md5cycle(this._state, buf32); + bufLen = 0; + } + this._bufferLength = bufLen; + return this; + } + + /** + * Get the state of the hash buffer + */ + public getState(): HasherState { + const s = this._state; + + return { + buffer: String.fromCharCode.apply(null, Array.from(this._buffer8)), + buflen: this._bufferLength, + length: this._dataLength, + state: [s[0], s[1], s[2], s[3]], + }; + } + + /** + * Override the current state of the hash buffer + * @param state New hash buffer state + */ + public setState(state: HasherState) { + const buf = state.buffer; + const x = state.state; + const s = this._state; + let i; + + this._dataLength = state.length; + this._bufferLength = state.buflen; + s[0] = x[0]; + s[1] = x[1]; + s[2] = x[2]; + s[3] = x[3]; + + for (i = 0; i < buf.length; i += 1) { + this._buffer8[i] = buf.charCodeAt(i); + } + } + + /** + * Hash the current state of the hash buffer and return the result + * @param raw Whether to return the value as an `Int32Array` + */ + public end(raw: boolean = false) { + const bufLen = this._bufferLength; + const buf8 = this._buffer8; + const buf32 = this._buffer32; + const i = (bufLen >> 2) + 1; + + this._dataLength += bufLen; + const dataBitsLen = this._dataLength * 8; + + buf8[bufLen] = 0x80; + buf8[bufLen + 1] = buf8[bufLen + 2] = buf8[bufLen + 3] = 0; + buf32.set(Md5.buffer32Identity.subarray(i), i); + + if (bufLen > 55) { + Md5._md5cycle(this._state, buf32); + buf32.set(Md5.buffer32Identity); + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + if (dataBitsLen <= 0xffffffff) { + buf32[14] = dataBitsLen; + } else { + const matches = dataBitsLen.toString(16).match(/(.*?)(.{0,8})$/); + if (matches === null) { + return; + } + + const lo = parseInt(matches[2], 16); + const hi = parseInt(matches[1], 16) || 0; + + buf32[14] = lo; + buf32[15] = hi; + } + + Md5._md5cycle(this._state, buf32); + + return raw ? this._state : Md5._hex(this._state); + } +} + +// if (Md5.hashStr('hello') !== '5d41402abc4b2a76b9719d911017c592') { +// throw new Error('Md5 self test failed.'); +// } diff --git a/shims/crypto/sha256.ts b/shims/crypto/sha256.ts new file mode 100644 index 0000000..40fdfd2 --- /dev/null +++ b/shims/crypto/sha256.ts @@ -0,0 +1,169 @@ +/* +Copyright 2022 Andrea Griffini + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +// sha256(data) returns the digest +// sha256() returns an object you can call .add(data) zero or more time and .digest() at the end +// digest is a 32-byte Uint8Array instance with an added .hex() function. +// Input should be either a string (that will be encoded as UTF-8) or an array-like object with values 0..255. + +export function sha256( + data?: T, +): T extends string | Uint8Array + ? Uint8Array + : { add: (data: string | Uint8Array) => void; digest: () => Uint8Array } { + let h0 = 0x6a09e667, + h1 = 0xbb67ae85, + h2 = 0x3c6ef372, + h3 = 0xa54ff53a, + h4 = 0x510e527f, + h5 = 0x9b05688c, + h6 = 0x1f83d9ab, + h7 = 0x5be0cd19, + tsz = 0, + bp = 0; + const k = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, + 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, + 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, + 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, + 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, + 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, + ], + rrot = (x: number, n: number) => (x >>> n) | (x << (32 - n)), + w = new Uint32Array(64), + buf = new Uint8Array(64), + process = () => { + for (let j = 0, r = 0; j < 16; j++, r += 4) { + w[j] = + (buf[r] << 24) | (buf[r + 1] << 16) | (buf[r + 2] << 8) | buf[r + 3]; + } + for (let j = 16; j < 64; j++) { + let s0 = rrot(w[j - 15], 7) ^ rrot(w[j - 15], 18) ^ (w[j - 15] >>> 3); + let s1 = rrot(w[j - 2], 17) ^ rrot(w[j - 2], 19) ^ (w[j - 2] >>> 10); + w[j] = (w[j - 16] + s0 + w[j - 7] + s1) | 0; + } + let a = h0, + b = h1, + c = h2, + d = h3, + e = h4, + f = h5, + g = h6, + h = h7; + for (let j = 0; j < 64; j++) { + let S1 = rrot(e, 6) ^ rrot(e, 11) ^ rrot(e, 25), + ch = (e & f) ^ (~e & g), + t1 = (h + S1 + ch + k[j] + w[j]) | 0, + S0 = rrot(a, 2) ^ rrot(a, 13) ^ rrot(a, 22), + maj = (a & b) ^ (a & c) ^ (b & c), + t2 = (S0 + maj) | 0; + h = g; + g = f; + f = e; + e = (d + t1) | 0; + d = c; + c = b; + b = a; + a = (t1 + t2) | 0; + } + h0 = (h0 + a) | 0; + h1 = (h1 + b) | 0; + h2 = (h2 + c) | 0; + h3 = (h3 + d) | 0; + h4 = (h4 + e) | 0; + h5 = (h5 + f) | 0; + h6 = (h6 + g) | 0; + h7 = (h7 + h) | 0; + bp = 0; + }, + add = (data: string | Uint8Array) => { + if (typeof data === 'string') { + data = new TextEncoder().encode(data); + } + for (let i = 0; i < data.length; i++) { + buf[bp++] = data[i]; + if (bp === 64) process(); + } + tsz += data.length; + }, + digest = () => { + buf[bp++] = 0x80; + if (bp == 64) process(); + if (bp + 8 > 64) { + while (bp < 64) buf[bp++] = 0x00; + process(); + } + while (bp < 58) buf[bp++] = 0x00; + // Max number of bytes is 35,184,372,088,831 + let L = tsz * 8; + buf[bp++] = (L / 1099511627776) & 255; + buf[bp++] = (L / 4294967296) & 255; + buf[bp++] = L >>> 24; + buf[bp++] = (L >>> 16) & 255; + buf[bp++] = (L >>> 8) & 255; + buf[bp++] = L & 255; + process(); + let reply = new Uint8Array(32); + reply[0] = h0 >>> 24; + reply[1] = (h0 >>> 16) & 255; + reply[2] = (h0 >>> 8) & 255; + reply[3] = h0 & 255; + reply[4] = h1 >>> 24; + reply[5] = (h1 >>> 16) & 255; + reply[6] = (h1 >>> 8) & 255; + reply[7] = h1 & 255; + reply[8] = h2 >>> 24; + reply[9] = (h2 >>> 16) & 255; + reply[10] = (h2 >>> 8) & 255; + reply[11] = h2 & 255; + reply[12] = h3 >>> 24; + reply[13] = (h3 >>> 16) & 255; + reply[14] = (h3 >>> 8) & 255; + reply[15] = h3 & 255; + reply[16] = h4 >>> 24; + reply[17] = (h4 >>> 16) & 255; + reply[18] = (h4 >>> 8) & 255; + reply[19] = h4 & 255; + reply[20] = h5 >>> 24; + reply[21] = (h5 >>> 16) & 255; + reply[22] = (h5 >>> 8) & 255; + reply[23] = h5 & 255; + reply[24] = h6 >>> 24; + reply[25] = (h6 >>> 16) & 255; + reply[26] = (h6 >>> 8) & 255; + reply[27] = h6 & 255; + reply[28] = h7 >>> 24; + reply[29] = (h7 >>> 16) & 255; + reply[30] = (h7 >>> 8) & 255; + reply[31] = h7 & 255; + return reply; + }; + if (data === undefined) return { add, digest } as any; + add(data); + return digest() as any; +} diff --git a/tests/http.test.ts b/tests/http.test.ts index 88a4b86..6d717f2 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -89,28 +89,31 @@ test('http queries with too few or too many parameters', async () => { }); test('timeout aborting an http query', { timeout: 5000 }, async () => { - const abortController = new AbortController(); - const { signal } = abortController; - setTimeout(() => abortController.abort('fetch timed out'), 250); + // note: in Node pre-17.3, you'd do this instead: + + // const abortController = new AbortController(); + // setTimeout(() => abortController.abort(new Error('fetch timed out')), 250); + // const { signal } = abortController; + + const signal = AbortSignal.timeout(250); await expect( sql('SELECT pg_sleep(2)', [], { fetchOptions: { signal } }), - ).rejects.toThrow('fetch timed out'); + ).rejects.toThrow('TimeoutError'); }); test('timeout not aborting an http query', { timeout: 5000 }, async () => { - const abortController = new AbortController(); - const { signal } = abortController; - const timeout = setTimeout( - () => abortController.abort('fetch timed out'), - 2000, - ); + // note: in Node pre-17.3, you'd do this instead: + + // const abortController = new AbortController(); + // const timeout = setTimeout(() => abortController.abort(new Error('fetch timed out')), 2500); + // const { signal } = abortController; + + const signal = AbortSignal.timeout(2500); await expect( - sql('SELECT pg_sleep(.5)', [], { fetchOptions: { signal } }), + sql('SELECT pg_sleep(.25)', [], { fetchOptions: { signal } }), ).resolves.toStrictEqual([{ pg_sleep: '' }]); - - clearTimeout(timeout); }); test('database URL with wrong user to `neon()`', async () => { From 0da9b27b00cb6e185c8c291b5ea6588ed81a3dba Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 19 Dec 2024 16:39:03 +0000 Subject: [PATCH 36/40] format:fix --- export/index.ts | 4 +++- shims/crypto/index.ts | 5 ++++- tests/http.test.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/export/index.ts b/export/index.ts index 175052e..5b6d397 100644 --- a/export/index.ts +++ b/export/index.ts @@ -137,7 +137,9 @@ class NeonClient extends Client { async _handleAuthSASLContinue(msg: any) { const cs = // note: we shim these with empty objects so we need further checks - typeof crypto !== 'undefined' && crypto.subtle !== undefined && crypto.subtle.importKey !== undefined + typeof crypto !== 'undefined' && + crypto.subtle !== undefined && + crypto.subtle.importKey !== undefined ? crypto.subtle : (await import(cryptoLib)).webcrypto.subtle; diff --git a/shims/crypto/index.ts b/shims/crypto/index.ts index 57e5747..1478aa5 100644 --- a/shims/crypto/index.ts +++ b/shims/crypto/index.ts @@ -9,7 +9,10 @@ export function randomBytes(length: number) { // (1) old Node, no crypto object // (2) newer Node, crypto object // (3) browsers, crypto object of type WebCrypto - if (typeof crypto !== 'undefined' && (crypto as any).randomBytes !== undefined) { + if ( + typeof crypto !== 'undefined' && + (crypto as any).randomBytes !== undefined + ) { const webcrypto = (crypto as any).webcrypto ?? crypto; return webcrypto.getRandomValues(Buffer.alloc(length)); } else { diff --git a/tests/http.test.ts b/tests/http.test.ts index 6d717f2..a8db5f3 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -108,7 +108,7 @@ test('timeout not aborting an http query', { timeout: 5000 }, async () => { // const abortController = new AbortController(); // const timeout = setTimeout(() => abortController.abort(new Error('fetch timed out')), 2500); // const { signal } = abortController; - + const signal = AbortSignal.timeout(2500); await expect( From 288e45d02828d09b965d5fd161583ae7a294e448 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 19 Dec 2024 17:02:52 +0000 Subject: [PATCH 37/40] Test that poolQueryViaFetch is inhibited by connect listener, and driver fix to ensure it is --- dist/dts/_extracted.d.ts | 1 + dist/dts/_extracted.d.ts.orig | 1 + dist/dts/export/index.d.ts | 1 + dist/jsr/index.d.ts | 1 + dist/jsr/index.js | 116 +++++++++++++++++----------------- dist/npm/index.d.mts | 1 + dist/npm/index.d.ts | 1 + dist/npm/index.js | 116 +++++++++++++++++----------------- dist/npm/index.mjs | 116 +++++++++++++++++----------------- export/index.ts | 2 + tests/ws.test.ts | 26 +++++++- 11 files changed, 206 insertions(+), 176 deletions(-) diff --git a/dist/dts/_extracted.d.ts b/dist/dts/_extracted.d.ts index 920375e..504734a 100644 --- a/dist/dts/_extracted.d.ts +++ b/dist/dts/_extracted.d.ts @@ -444,6 +444,7 @@ export declare class Pool extends Pool_2 { Client: typeof Client; hasFetchUnsupportedListeners: boolean; on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + addListener: (event: "error" | "connect" | "acquire" | "release" | "remove", listener: any) => this; query(config?: any, values?: any, cb?: any): any; } diff --git a/dist/dts/_extracted.d.ts.orig b/dist/dts/_extracted.d.ts.orig index d2f7eb9..878600a 100644 --- a/dist/dts/_extracted.d.ts.orig +++ b/dist/dts/_extracted.d.ts.orig @@ -444,6 +444,7 @@ export declare class Pool extends Pool_2 { Client: typeof Client; hasFetchUnsupportedListeners: boolean; on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + addListener: (event: "error" | "connect" | "acquire" | "release" | "remove", listener: any) => this; query(config?: any, values?: any, cb?: any): any; } diff --git a/dist/dts/export/index.d.ts b/dist/dts/export/index.d.ts index 761e01a..f0e1011 100644 --- a/dist/dts/export/index.d.ts +++ b/dist/dts/export/index.d.ts @@ -43,6 +43,7 @@ declare class NeonPool extends Pool { Client: typeof NeonClient; hasFetchUnsupportedListeners: boolean; on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + addListener: (event: "error" | "connect" | "acquire" | "release" | "remove", listener: any) => this; query(config?: any, values?: any, cb?: any): any; } export { Socket as neonConfig, NeonPool as Pool, NeonClient as Client, neon, NeonDbError, }; diff --git a/dist/jsr/index.d.ts b/dist/jsr/index.d.ts index c503ef4..0c60489 100644 --- a/dist/jsr/index.d.ts +++ b/dist/jsr/index.d.ts @@ -446,6 +446,7 @@ export declare class Pool extends Pool_2 { Client: typeof Client; hasFetchUnsupportedListeners: boolean; on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + addListener: (event: "error" | "connect" | "acquire" | "release" | "remove", listener: any) => this; query(config?: any, values?: any, cb?: any): any; } diff --git a/dist/jsr/index.js b/dist/jsr/index.js index 8966195..9af13b5 100644 --- a/dist/jsr/index.js +++ b/dist/jsr/index.js @@ -8,7 +8,7 @@ function(r){if(typeof require<"u")return require.apply(this,arguments);throw Err Ce(r,t,{get:e[t],enumerable:!0})},In=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== "function")for(let i of ao(e))!co.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= oo(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?so(uo(r)):{},In(e||!r||!r.__esModule?Ce(t,"default",{ -value:r,enumerable:!0}):t,r)),N=r=>In(Ce({},"__esModule",{value:!0}),r);var A=(r,e,t)=>ho(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=fo;st.toByteArray=yo;st.fromByteArray= +value:r,enumerable:!0}):t,r)),N=r=>In(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ho(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=fo;st.toByteArray=yo;st.fromByteArray= wo;var ae=[],te=[],lo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ee=0,Pn=Rt.length;Ee>18&63]+ae[r>>12&63]+ae[ u=t-n;ou?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ ae[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ae[e>>10]+ae[e>>4&63]+ae[e<< 2&63]+"=")),i.join("")}a(wo,"fromByteArray")});var Rn=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> -1,l=-7,d=t?i-1:0,S=t?-1:1,_=r[e+d];for(d+=S,s=_&(1<<-l)-1,_>>=-l,l+=u;l>0;s=s*256+ +1,l=-7,d=t?i-1:0,S=t?-1:1,A=r[e+d];for(d+=S,s=A&(1<<-l)-1,A>>=-l,l+=u;l>0;s=s*256+ r[e+d],d+=S,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=S,l-=8);if(s=== -0)s=1-h;else{if(s===c)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(_? +0)s=1-h;else{if(s===c)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(A? -1:1)*o*Math.pow(2,s-n)};Ft.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,L=n?1:-1,G=e<0|| +h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:s-1,L=n?1:-1,G=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=S/c:e+= S*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+_]=u&255,_+=L,u/=256, -i-=8);for(o=o<0;r[t+_]=o&255,_+=L,o/=256,h-=8);r[t+_-L]|=G*128}});var zn=I(Be=>{"use strict";p();var Mt=Bn(),Pe=Rn(),Fn=typeof Symbol=="function"&& +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+A]=u&255,A+=L,u/=256, +i-=8);for(o=o<0;r[t+A]=o&255,A+=L,o/=256,h-=8);r[t+A-L]|=G*128}});var zn=I(Be=>{"use strict";p();var Mt=Bn(),Pe=Rn(),Fn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Be.Buffer= f;Be.SlowBuffer=_o;Be.INSPECT_MAX_BYTES=50;var ot=2147483647;Be.kMaxLength=ot;f. TYPED_ARRAY_SUPPORT=bo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. @@ -463,11 +463,11 @@ o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,304932347 3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, 883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, 2361852424,2428436474,2756734187,3204031479,3329325298],S=a((C,g)=>C>>>g|C<<32-g, -"rrot"),_=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, -$+=4)_[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(_[R- -15],7)^S(_[R-15],18)^_[R-15]>>>3,ce=S(_[R-2],17)^S(_[R-2],19)^_[R-2]>>>10;_[R]=_[R- -16]+$+_[R-7]+ce|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,oe=c;for(let R=0;R<64;R++){let $=S( -U,6)^S(U,11)^S(U,25),ce=U&j^~U&ee,de=oe+$+ce+d[R]+_[R]|0,xe=S(C,2)^S(C,13)^S(C,22), +"rrot"),A=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, +$+=4)A[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(A[R- +15],7)^S(A[R-15],18)^A[R-15]>>>3,ce=S(A[R-2],17)^S(A[R-2],19)^A[R-2]>>>10;A[R]=A[R- +16]+$+A[R-7]+ce|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,oe=c;for(let R=0;R<64;R++){let $=S( +U,6)^S(U,11)^S(U,25),ce=U&j^~U&ee,de=oe+$+ce+d[R]+A[R]|0,xe=S(C,2)^S(C,13)^S(C,22), We=C&g^C&P^g&P,he=xe+We|0;oe=ee,ee=j,j=U,U=W+de|0,W=P,P=g,g=C,C=de+he|0}e=e+C|0, t=t+g|0,n=n+P|0,i=i+W|0,s=s+U|0,o=o+j|0,u=u+ee|0,c=c+oe|0,l=0},"process"),X=a(C=>{ typeof C=="string"&&(C=new TextEncoder().encode(C));for(let g=0;g>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> 16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:se}:(X(r),se())}var oi=z( -()=>{"use strict";p();a($e,"sha256")});var O,Ke,ai=z(()=>{"use strict";p();O=class O{constructor(){A(this,"_dataLength", -0);A(this,"_bufferLength",0);A(this,"_state",new Int32Array(4));A(this,"_buffer", -new ArrayBuffer(68));A(this,"_buffer8");A(this,"_buffer32");this._buffer8=new Uint8Array( +()=>{"use strict";p();a($e,"sha256")});var O,Ke,ai=z(()=>{"use strict";p();O=class O{constructor(){_(this,"_dataLength", +0);_(this,"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer", +new ArrayBuffer(68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array( this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ @@ -555,10 +555,10 @@ t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(O.buffer32Id subarray(s),s),t>55&&(O._md5cycle(this._state,i),i.set(O.buffer32Identity)),o<=4294967295) i[14]=o;else{let u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return;let c=parseInt( u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return O._md5cycle(this._state,i), -e?this._state:O._hex(this._state)}};a(O,"Md5"),A(O,"stateIdentity",new Int32Array( -[1732584193,-271733879,-1732584194,271733878])),A(O,"buffer32Identity",new Int32Array( -[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),A(O,"hexChars","0123456789abcdef"),A(O,"hexO\ -ut",[]),A(O,"onePassHasher",new O);Ke=O});var jt={};ie(jt,{createHash:()=>Xo,createHmac:()=>ea,randomBytes:()=>Jo});function Jo(r){ +e?this._state:O._hex(this._state)}};a(O,"Md5"),_(O,"stateIdentity",new Int32Array( +[1732584193,-271733879,-1732584194,271733878])),_(O,"buffer32Identity",new Int32Array( +[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(O,"hexChars","0123456789abcdef"),_(O,"hexO\ +ut",[]),_(O,"onePassHasher",new O);Ke=O});var jt={};ie(jt,{createHash:()=>Xo,createHmac:()=>ea,randomBytes:()=>Jo});function Jo(r){ return typeof w<"u"&&w.randomBytes!==void 0?(w.webcrypto??w).getRandomValues(y.alloc( r)):Tn(Zo).randomBytes(r)}function Xo(r){if(r==="sha256")return{update:a(function(e){ return{digest:a(function(){return y.from($e(e))},"digest")}},"update")};if(r==="\ @@ -663,8 +663,8 @@ u+i;for(c="",h=6-u.length,l=0;l>>0,o=42949 s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Fa=Ii(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(_,L,G){ -return _*Math.pow(2,G)+L};var s=t>>3,o=a(function(_){return n?~_&255:_},"inv"),u=255, +e%Z,o=4294967296*s+t,u=""+o%Z,n+u+i}a(Ra,"readInt8");Ti.exports=Ra});var Fi=I((Hh,Ri)=>{p();var Fa=Ii(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(A,L,G){ +return A*Math.pow(2,G)+L};var s=t>>3,o=a(function(A){return n?~A&255:A},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& (h=i(h,o(r[l])>>8-S,S)),h},"parseBits"),Bi=a(function(r,e,t){var n=Math.pow(2,t- @@ -686,8 +686,8 @@ n=F(r,32,64),i=96,s=[],o=0;o>3,(i+=l<<3)>>3), d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ -var d=[],S;if(h.length>1){var _=h.shift();for(S=0;S<_;S++)d[S]=c(h,l);h.unshift( -_)}else for(S=0;S1){var A=h.shift();for(S=0;S0},"parseBool"),qa=a(function(r){r(20,Fa),r(21,Ma),r(23,Pi),r(26, Pi),r(1700,Ua),r(700,ka),r(701,Da),r(16,Na),r(1114,Li.bind(null,!1)),r(1184,Li.bind( @@ -752,8 +752,8 @@ r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=hu(e, i,n.iteration),o=ke(s,"Client Key"),u=cu(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=ke(u,d),_=Qi( -o,S),L=_.toString("base64"),G=ke(s,"Server Key"),X=ke(G,d);r.message="SASLRespon\ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=ke(u,d),A=Qi( +o,S),L=A.toString("base64"),G=ke(s,"Server Key"),X=ke(G,d);r.message="SASLRespon\ se",r.serverSignature=X.toString("base64"),r.response=l+",p="+L}a(iu,"continueSe\ ssion");function su(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ @@ -789,7 +789,7 @@ r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;slu});function lu(...r){return r.join("/")}var sr=z(()=>{ "use strict";p();a(lu,"join")});var or={};ie(or,{stat:()=>fu});function fu(r,e){e(new Error("No filesystem"))}var ar=z( ()=>{"use strict";p();a(fu,"stat")});var ur={};ie(ur,{default:()=>pu});var pu,cr=z(()=>{"use strict";p();pu={}});var Hi={};ie(Hi,{StringDecoder:()=>hr});var lr,hr,Gi=z(()=>{"use strict";p();lr= -class lr{constructor(e){A(this,"td");this.td=new TextDecoder(e)}write(e){return this. +class lr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(lr,"StringDecoder"); hr=lr});var zi=I((pl,Vi)=>{"use strict";p();var{Transform:du}=(cr(),N(ur)),{StringDecoder:yu}=(Gi(),N(Hi)), be=Symbol("last"),dt=Symbol("decoder");function mu(r,e,t){let n;if(this.overflow){ @@ -828,8 +828,8 @@ a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.de pr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. on("data",s).on("end",o).on("error",u)};var Pu=fe.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, -u=!1,c=a(function(l,d,S){var _=r.substring(d,S);Object.hasOwnProperty.call(m.env, -"PGPASS_NO_DEESCAPE")||(_=_.replace(/\\([:\\])/g,"$1")),o[De[l]]=_},"addToObj"), +u=!1,c=a(function(l,d,S){var A=r.substring(d,S);Object.hasOwnProperty.call(m.env, +"PGPASS_NO_DEESCAPE")||(A=A.replace(/\\([:\\])/g,"$1")),o[De[l]]=A},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== fr?o:null,o},Lu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. @@ -847,8 +847,8 @@ this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| "text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};ts.exports=gt});var rs={};ie(rs,{default:()=>Ru});var Ru,ns=z(()=>{"use strict";p();Ru={}});var is={};ie(is,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:S}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let _=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ -href:r,protocol:t,auth:_,username:i,password:s,host:o,hostname:u,port:c,pathname:h, +i),h=decodeURIComponent(h);let A=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ +href:r,protocol:t,auth:A,username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,query:L,hash:S}}var mr=z(()=>{"use strict";p();a(yr,"parse")});var os=I((Il,ss)=>{"use strict";p();var Fu=(mr(),N(is)),gr=(ar(),N(or));function wr(r){ if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Fu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, @@ -946,10 +946,10 @@ binary,valueMapper:ds.prepareValue})}catch(t){this.handleError(t,e);return}e.des e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(_r,"Query"); var Er=_r;ys.exports=Er});var bs={};ie(bs,{Socket:()=>Ae,isIP:()=>Ou});function Ou(r){return 0}var ws,gs,E, Ae,St=z(()=>{"use strict";p();ws=Te(we(),1);a(Ou,"isIP");gs=/^[^.]+\./,E=class E extends ws.EventEmitter{constructor(){ -super(...arguments);A(this,"opts",{});A(this,"connecting",!1);A(this,"pending",!0); -A(this,"writable",!0);A(this,"encrypted",!1);A(this,"authorized",!1);A(this,"des\ -troyed",!1);A(this,"ws",null);A(this,"writeBuffer");A(this,"tlsState",0);A(this, -"tlsRead");A(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); +_(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ +troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ @@ -1020,12 +1020,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(E,"Socket"),A(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( (t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(gs,"apiauth."):s=t.replace(gs,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),A(E,"opts",{});Ae=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});Ae=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1516,11 +1516,11 @@ exports=new En(vn()):(nt.exports=new En(Oc),Object.defineProperty(nt.exports,"na tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new En(vn())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ native",{value:r}),r}}))});p();var Lt=Te(It());St();p();St();mr();var Js=Te(tt()),Xs=Te(wt());function Hc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(Hc,"encodeBuffe\ -rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);A(this,"name", -"NeonDbError");A(this,"severity");A(this,"code");A(this,"detail");A(this,"hint"); -A(this,"position");A(this,"internalPosition");A(this,"internalQuery");A(this,"wh\ -ere");A(this,"schema");A(this,"table");A(this,"column");A(this,"dataType");A(this, -"constraint");A(this,"file");A(this,"line");A(this,"routine");A(this,"sourceErro\ +rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", +"NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); +_(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ +ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, +"constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,Ys="transaction() exp\ ects an array of queries, or a function returning an array of queries",Gc=["seve\ @@ -1531,8 +1531,8 @@ queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=yr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:S,hostname:_,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== -"postgresql:"||!S||!_||!G)throw new Error("Database connection string format for\ +let{protocol:d,username:S,hostname:A,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== +"postgresql:"||!S||!A||!G)throw new Error("Database connection string format for\ `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(C,...g){ let P,W;if(typeof C=="string")P=C,W=g[1],g=g[0]??[];else{P="";for(let j=0;jHc((0,Js.prepareValue)(j)));let U={ @@ -1546,7 +1546,7 @@ oe=e??!1,R=t??!1,$=i,ce=s,de=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, (R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& (ce=P.readOnly),P.deferrable!==void 0&&(de=P.deferrable)),g!==void 0&&!Array.isArray( g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let xe=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(xe=g.authToken);let We=typeof W=="function"?W(_,L,{jwtAuth:xe!== +g)&&g?.authToken!==void 0&&(xe=g.authToken);let We=typeof W=="function"?W(A,L,{jwtAuth:xe!== void 0}):W,he={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ ray-Mode":"true"},it=await Kc(xe);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( C)&&($!==void 0&&(he["Neon-Batch-Isolation-Level"]=$),ce!==void 0&&(he["Neon-Bat\ @@ -1605,33 +1605,33 @@ test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base ESSAGE: missing/invalid iteration count");if(!c.startsWith(i.clientNonce))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); if(c.length===i.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ -SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),_=new TextEncoder, -L=_.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, +SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),A=new TextEncoder, +L=A.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, ["sign"]),X=new Uint8Array(await n.sign("HMAC",G,y.concat([S,y.from([0,0,0,1])]))), se=X;for(var C=0;Cse[D]^X[D]));let g=se,P=await n.importKey("raw",g,{name:"HMAC",hash:{ -name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,_.encode("C\ +name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,A.encode("C\ lient Key"))),U=await n.digest("SHA-256",W),j="n=*,r="+i.clientNonce,ee="r="+c+"\ ,s="+h+",i="+d,oe="c=biws,r="+c,R=j+","+ee+","+oe,$=await n.importKey("raw",U,{name:"\ HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var ce=new Uint8Array(await n.sign("HM\ -AC",$,_.encode(R))),de=y.from(W.map((V,D)=>W[D]^ce[D])),xe=de.toString("base64"); +AC",$,A.encode(R))),de=y.from(W.map((V,D)=>W[D]^ce[D])),xe=de.toString("base64"); let We=await n.importKey("raw",g,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]), -he=await n.sign("HMAC",We,_.encode("Server Key")),it=await n.importKey("raw",he, +he=await n.sign("HMAC",We,A.encode("Server Key")),it=await n.importKey("raw",he, {name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var ye=y.from(await n.sign("HMA\ -C",it,_.encode(R)));i.message="SASLResponse",i.serverSignature=ye.toString("base\ +C",it,A.encode(R)));i.message="SASLResponse",i.serverSignature=ye.toString("base\ 64"),i.response=oe+",p="+xe,this.connection.sendSCRAMClientFinalMessage(this.saslSession. response)}};a(An,"NeonClient");var _n=An;function zc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ n=o,t=u});return{callback:i,result:s}}a(zc,"promisify");var Cn=class Cn extends Lt.Pool{constructor(){ -super(...arguments);A(this,"Client",_n);A(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ -return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ -if(!Ae.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=zc(this.Promise, -i);i=s.callback;try{let o=new ro.default(this.options),u=encodeURIComponent,c=encodeURI, -h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== -"string"?t:t.text,d=n??t.values??[];eo(h,{fullResults:!0,arrayMode:t.rowMode==="\ -array"})(l,d,{types:t.types??this.options?.types}).then(_=>i(void 0,_)).catch(_=>i( -_))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var to=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; +super(...arguments);_(this,"Client",_n);_(this,"hasFetchUnsupportedListeners",!1); +_(this,"addListener",this.on)}on(t,n){return t!=="error"&&(this.hasFetchUnsupportedListeners= +!0),super.on(t,n)}query(t,n,i){if(!Ae.poolQueryViaFetch||this.hasFetchUnsupportedListeners|| +typeof t=="function")return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0); +let s=zc(this.Promise,i);i=s.callback;try{let o=new ro.default(this.options),u=encodeURIComponent, +c=encodeURI,h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`, +l=typeof t=="string"?t:t.text,d=n??t.values??[];eo(h,{fullResults:!0,arrayMode:t. +rowMode==="array"})(l,d,{types:t.types??this.options?.types}).then(A=>i(void 0,A)). +catch(A=>i(A))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var to=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; var export_Query=Qe.Query;var export_defaults=Qe.defaults;var export_types=Qe.types; export{_n as Client,export_ClientBase as ClientBase,export_Connection as Connection, export_DatabaseError as DatabaseError,pe as NeonDbError,to as Pool,export_Query as Query, diff --git a/dist/npm/index.d.mts b/dist/npm/index.d.mts index c503ef4..0c60489 100644 --- a/dist/npm/index.d.mts +++ b/dist/npm/index.d.mts @@ -446,6 +446,7 @@ export declare class Pool extends Pool_2 { Client: typeof Client; hasFetchUnsupportedListeners: boolean; on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + addListener: (event: "error" | "connect" | "acquire" | "release" | "remove", listener: any) => this; query(config?: any, values?: any, cb?: any): any; } diff --git a/dist/npm/index.d.ts b/dist/npm/index.d.ts index c503ef4..0c60489 100644 --- a/dist/npm/index.d.ts +++ b/dist/npm/index.d.ts @@ -446,6 +446,7 @@ export declare class Pool extends Pool_2 { Client: typeof Client; hasFetchUnsupportedListeners: boolean; on(event: 'error' | 'connect' | 'acquire' | 'release' | 'remove', listener: any): this; + addListener: (event: "error" | "connect" | "acquire" | "release" | "remove", listener: any) => this; query(config?: any, values?: any, cb?: any): any; } diff --git a/dist/npm/index.js b/dist/npm/index.js index 68bf68f..f661ce7 100644 --- a/dist/npm/index.js +++ b/dist/npm/index.js @@ -3,7 +3,7 @@ r[e]=t;var a=(r,e)=>Te(r,"name",{value:e,configurable:!0});var z=(r,e)=>()=>(r&& Te(r,t,{get:e[t],enumerable:!0})},Pn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== "function")for(let i of oo(e))!uo.call(r,i)&&i!==t&&Te(r,i,{get:()=>e[i],enumerable:!(n= so(e,i))||n.enumerable});return r};var Ie=(r,e,t)=>(t=r!=null?io(ao(r)):{},Pn(e||!r||!r.__esModule?Te(t,"default",{ -value:r,enumerable:!0}):t,r)),N=r=>Pn(Te({},"__esModule",{value:!0}),r);var A=(r,e,t)=>co(r,typeof e!="symbol"?e+"":e,t);var Rn=I(st=>{"use strict";p();st.byteLength=lo;st.toByteArray=po;st.fromByteArray= +value:r,enumerable:!0}):t,r)),N=r=>Pn(Te({},"__esModule",{value:!0}),r);var _=(r,e,t)=>co(r,typeof e!="symbol"?e+"":e,t);var Rn=I(st=>{"use strict";p();st.byteLength=lo;st.toByteArray=po;st.fromByteArray= go;var ue=[],re=[],ho=typeof Uint8Array<"u"?Uint8Array:Array,Ft="ABCDEFGHIJKLMNO\ PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ae=0,Ln=Ft.length;Ae>18&63]+ue[r>>12&63]+ue[ u=t-n;ou?u:o+s));return n===1?(e=r[t-1],i.push(ue[e>>2]+ ue[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ue[e>>10]+ue[e>>4&63]+ue[e<< 2&63]+"=")),i.join("")}a(go,"fromByteArray")});var Fn=I(Mt=>{p();Mt.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> -1,l=-7,d=t?i-1:0,S=t?-1:1,_=r[e+d];for(d+=S,s=_&(1<<-l)-1,_>>=-l,l+=u;l>0;s=s*256+ +1,l=-7,d=t?i-1:0,S=t?-1:1,A=r[e+d];for(d+=S,s=A&(1<<-l)-1,A>>=-l,l+=u;l>0;s=s*256+ r[e+d],d+=S,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=S,l-=8);if(s=== -0)s=1-h;else{if(s===c)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(_? +0)s=1-h;else{if(s===c)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(A? -1:1)*o*Math.pow(2,s-n)};Mt.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,L=n?1:-1,G=e<0|| +h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:s-1,L=n?1:-1,G=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=S/c:e+= S*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+_]=u&255,_+=L,u/=256, -i-=8);for(o=o<0;r[t+_]=o&255,_+=L,o/=256,h-=8);r[t+_-L]|=G*128}});var Yn=I(Re=>{"use strict";p();var kt=Rn(),Le=Fn(),Mn=typeof Symbol=="function"&& +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+A]=u&255,A+=L,u/=256, +i-=8);for(o=o<0;r[t+A]=o&255,A+=L,o/=256,h-=8);r[t+A-L]|=G*128}});var Yn=I(Re=>{"use strict";p();var kt=Rn(),Le=Fn(),Mn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Re.Buffer= f;Re.SlowBuffer=Eo;Re.INSPECT_MAX_BYTES=50;var ot=2147483647;Re.kMaxLength=ot;f. TYPED_ARRAY_SUPPORT=wo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. @@ -458,11 +458,11 @@ o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,304932347 3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, 883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, 2361852424,2428436474,2756734187,3204031479,3329325298],S=a((C,g)=>C>>>g|C<<32-g, -"rrot"),_=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, -$+=4)_[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(_[R- -15],7)^S(_[R-15],18)^_[R-15]>>>3,le=S(_[R-2],17)^S(_[R-2],19)^_[R-2]>>>10;_[R]=_[R- -16]+$+_[R-7]+le|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,ae=c;for(let R=0;R<64;R++){let $=S( -U,6)^S(U,11)^S(U,25),le=U&j^~U&ee,ye=ae+$+le+d[R]+_[R]|0,Ee=S(C,2)^S(C,13)^S(C,22), +"rrot"),A=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, +$+=4)A[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(A[R- +15],7)^S(A[R-15],18)^A[R-15]>>>3,le=S(A[R-2],17)^S(A[R-2],19)^A[R-2]>>>10;A[R]=A[R- +16]+$+A[R-7]+le|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,ae=c;for(let R=0;R<64;R++){let $=S( +U,6)^S(U,11)^S(U,25),le=U&j^~U&ee,ye=ae+$+le+d[R]+A[R]|0,Ee=S(C,2)^S(C,13)^S(C,22), We=C&g^C&P^g&P,fe=Ee+We|0;ae=ee,ee=j,j=U,U=W+ye|0,W=P,P=g,g=C,C=ye+fe|0}e=e+C|0, t=t+g|0,n=n+P|0,i=i+W|0,s=s+U|0,o=o+j|0,u=u+ee|0,c=c+ae|0,l=0},"process"),X=a(C=>{ typeof C=="string"&&(C=new TextEncoder().encode(C));for(let g=0;g>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> 16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:oe}:(X(r),oe())}var ai=z( -()=>{"use strict";p();a($e,"sha256")});var O,Ke,ui=z(()=>{"use strict";p();O=class O{constructor(){A(this,"_dataLength", -0);A(this,"_bufferLength",0);A(this,"_state",new Int32Array(4));A(this,"_buffer", -new ArrayBuffer(68));A(this,"_buffer8");A(this,"_buffer32");this._buffer8=new Uint8Array( +()=>{"use strict";p();a($e,"sha256")});var O,Ke,ui=z(()=>{"use strict";p();O=class O{constructor(){_(this,"_dataLength", +0);_(this,"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer", +new ArrayBuffer(68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array( this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ @@ -550,10 +550,10 @@ t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(O.buffer32Id subarray(s),s),t>55&&(O._md5cycle(this._state,i),i.set(O.buffer32Identity)),o<=4294967295) i[14]=o;else{let u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return;let c=parseInt( u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return O._md5cycle(this._state,i), -e?this._state:O._hex(this._state)}};a(O,"Md5"),A(O,"stateIdentity",new Int32Array( -[1732584193,-271733879,-1732584194,271733878])),A(O,"buffer32Identity",new Int32Array( -[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),A(O,"hexChars","0123456789abcdef"),A(O,"hexO\ -ut",[]),A(O,"onePassHasher",new O);Ke=O});var Ht={};te(Ht,{createHash:()=>Jo,createHmac:()=>Xo,randomBytes:()=>Zo});function Zo(r){ +e?this._state:O._hex(this._state)}};a(O,"Md5"),_(O,"stateIdentity",new Int32Array( +[1732584193,-271733879,-1732584194,271733878])),_(O,"buffer32Identity",new Int32Array( +[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(O,"hexChars","0123456789abcdef"),_(O,"hexO\ +ut",[]),_(O,"onePassHasher",new O);Ke=O});var Ht={};te(Ht,{createHash:()=>Jo,createHmac:()=>Xo,randomBytes:()=>Zo});function Zo(r){ return typeof w<"u"&&w.randomBytes!==void 0?(w.webcrypto??w).getRandomValues(y.alloc( r)):require(Yo).randomBytes(r)}function Jo(r){if(r==="sha256")return{update:a(function(e){ return{digest:a(function(){return y.from($e(e))},"digest")}},"update")};if(r==="\ @@ -658,8 +658,8 @@ u+i;for(c="",h=6-u.length,l=0;l>>0,o=42949 s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Ra=Pi(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(_,L,G){ -return _*Math.pow(2,G)+L};var s=t>>3,o=a(function(_){return n?~_&255:_},"inv"),u=255, +e%Z,o=4294967296*s+t,u=""+o%Z,n+u+i}a(Ba,"readInt8");Ii.exports=Ba});var Mi=I((Hh,Fi)=>{p();var Ra=Pi(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(A,L,G){ +return A*Math.pow(2,G)+L};var s=t>>3,o=a(function(A){return n?~A&255:A},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& (h=i(h,o(r[l])>>8-S,S)),h},"parseBits"),Ri=a(function(r,e,t){var n=Math.pow(2,t- @@ -681,8 +681,8 @@ n=F(r,32,64),i=96,s=[],o=0;o>3,(i+=l<<3)>>3), d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ -var d=[],S;if(h.length>1){var _=h.shift();for(S=0;S<_;S++)d[S]=c(h,l);h.unshift( -_)}else for(S=0;S1){var A=h.shift();for(S=0;S0},"parseBool"),Na=a(function(r){r(20,Ra),r(21,Fa),r(23,Li),r(26, Li),r(1700,Da),r(700,Ma),r(701,ka),r(16,Oa),r(1114,Bi.bind(null,!1)),r(1184,Bi.bind( @@ -747,8 +747,8 @@ r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=cu(e, i,n.iteration),o=De(s,"Client Key"),u=uu(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=De(u,d),_=Wi( -o,S),L=_.toString("base64"),G=De(s,"Server Key"),X=De(G,d);r.message="SASLRespon\ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=De(u,d),A=Wi( +o,S),L=A.toString("base64"),G=De(s,"Server Key"),X=De(G,d);r.message="SASLRespon\ se",r.serverSignature=X.toString("base64"),r.response=l+",p="+L}a(nu,"continueSe\ ssion");function iu(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ @@ -784,7 +784,7 @@ r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;shu});function hu(...r){return r.join("/")}var or=z(()=>{ "use strict";p();a(hu,"join")});var ar={};te(ar,{stat:()=>lu});function lu(r,e){e(new Error("No filesystem"))}var ur=z( ()=>{"use strict";p();a(lu,"stat")});var cr={};te(cr,{default:()=>fu});var fu,hr=z(()=>{"use strict";p();fu={}});var Gi={};te(Gi,{StringDecoder:()=>lr});var fr,lr,$i=z(()=>{"use strict";p();fr= -class fr{constructor(e){A(this,"td");this.td=new TextDecoder(e)}write(e){return this. +class fr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(fr,"StringDecoder"); lr=fr});var Yi=I((pl,zi)=>{"use strict";p();var{Transform:pu}=(hr(),N(cr)),{StringDecoder:du}=($i(),N(Gi)), Se=Symbol("last"),dt=Symbol("decoder");function yu(r,e,t){let n;if(this.overflow){ @@ -823,8 +823,8 @@ a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.de dr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. on("data",s).on("end",o).on("error",u)};var Iu=de.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, -u=!1,c=a(function(l,d,S){var _=r.substring(d,S);Object.hasOwnProperty.call(m.env, -"PGPASS_NO_DEESCAPE")||(_=_.replace(/\\([:\\])/g,"$1")),o[Ue[l]]=_},"addToObj"), +u=!1,c=a(function(l,d,S){var A=r.substring(d,S);Object.hasOwnProperty.call(m.env, +"PGPASS_NO_DEESCAPE")||(A=A.replace(/\\([:\\])/g,"$1")),o[Ue[l]]=A},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== pr?o:null,o},Pu=de.exports.isValidEntry=function(r){for(var e={0:function(o){return o. @@ -842,8 +842,8 @@ this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| "text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};rs.exports=gt});var ns={};te(ns,{default:()=>Bu});var Bu,is=z(()=>{"use strict";p();Bu={}});var ss={};te(ss,{parse:()=>mr});function mr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:S}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let _=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ -href:r,protocol:t,auth:_,username:i,password:s,host:o,hostname:u,port:c,pathname:h, +i),h=decodeURIComponent(h);let A=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ +href:r,protocol:t,auth:A,username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,query:L,hash:S}}var gr=z(()=>{"use strict";p();a(mr,"parse")});var as=I((Il,os)=>{"use strict";p();var Ru=(gr(),N(ss)),wr=(ur(),N(ar));function br(r){ if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Ru. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, @@ -941,10 +941,10 @@ binary,valueMapper:ys.prepareValue})}catch(t){this.handleError(t,e);return}e.des e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(Ar,"Query"); var _r=Ar;ms.exports=_r});var Ss={};te(Ss,{Socket:()=>xe,isIP:()=>Uu});function Uu(r){return 0}var bs,ws,E, xe,St=z(()=>{"use strict";p();bs=Ie(be(),1);a(Uu,"isIP");ws=/^[^.]+\./,E=class E extends bs.EventEmitter{constructor(){ -super(...arguments);A(this,"opts",{});A(this,"connecting",!1);A(this,"pending",!0); -A(this,"writable",!0);A(this,"encrypted",!1);A(this,"authorized",!1);A(this,"des\ -troyed",!1);A(this,"ws",null);A(this,"writeBuffer");A(this,"tlsState",0);A(this, -"tlsRead");A(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); +_(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ +troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ @@ -1015,12 +1015,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(E,"Socket"),A(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( (t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(ws,"apiauth."):s=t.replace(ws,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),A(E,"opts",{});xe=E});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});xe=E});var en=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1514,11 +1514,11 @@ native",{value:r}),r}}))});var zc={};te(zc,{Client:()=>Lt,ClientBase:()=>se.Clie DatabaseError:()=>se.DatabaseError,NeonDbError:()=>he,Pool:()=>Cn,Query:()=>se.Query, defaults:()=>se.defaults,neon:()=>An,neonConfig:()=>xe,types:()=>se.types});module. exports=N(zc);p();var Bt=Ie(It());St();p();St();gr();var Xs=Ie(tt()),eo=Ie(wt());function jc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(jc,"encodeBuffe\ -rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);A(this,"name", -"NeonDbError");A(this,"severity");A(this,"code");A(this,"detail");A(this,"hint"); -A(this,"position");A(this,"internalPosition");A(this,"internalQuery");A(this,"wh\ -ere");A(this,"schema");A(this,"table");A(this,"column");A(this,"dataType");A(this, -"constraint");A(this,"file");A(this,"line");A(this,"routine");A(this,"sourceErro\ +rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", +"NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); +_(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ +ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, +"constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var he=Pt,Zs="transaction() exp\ ects an array of queries, or a function returning an array of queries",Hc=["seve\ @@ -1529,8 +1529,8 @@ queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=mr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:S,hostname:_,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== -"postgresql:"||!S||!_||!G)throw new Error("Database connection string format for\ +let{protocol:d,username:S,hostname:A,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== +"postgresql:"||!S||!A||!G)throw new Error("Database connection string format for\ `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(C,...g){ let P,W;if(typeof C=="string")P=C,W=g[1],g=g[0]??[];else{P="";for(let j=0;jjc((0,Xs.prepareValue)(j)));let U={ @@ -1544,7 +1544,7 @@ ae=e??!1,R=t??!1,$=i,le=s,ye=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, (R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& (le=P.readOnly),P.deferrable!==void 0&&(ye=P.deferrable)),g!==void 0&&!Array.isArray( g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let Ee=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(Ee=g.authToken);let We=typeof W=="function"?W(_,L,{jwtAuth:Ee!== +g)&&g?.authToken!==void 0&&(Ee=g.authToken);let We=typeof W=="function"?W(A,L,{jwtAuth:Ee!== void 0}):W,fe={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ ray-Mode":"true"},it=await $c(Ee);it&&(fe.Authorization=`Bearer ${it}`),Array.isArray( C)&&($!==void 0&&(fe["Neon-Batch-Isolation-Level"]=$),le!==void 0&&(fe["Neon-Bat\ @@ -1603,33 +1603,33 @@ test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base ESSAGE: missing/invalid iteration count");if(!c.startsWith(i.clientNonce))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); if(c.length===i.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ -SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),_=new TextEncoder, -L=_.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, +SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),A=new TextEncoder, +L=A.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, ["sign"]),X=new Uint8Array(await n.sign("HMAC",G,y.concat([S,y.from([0,0,0,1])]))), oe=X;for(var C=0;Coe[D]^X[D]));let g=oe,P=await n.importKey("raw",g,{name:"HMAC",hash:{ -name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,_.encode("C\ +name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,A.encode("C\ lient Key"))),U=await n.digest("SHA-256",W),j="n=*,r="+i.clientNonce,ee="r="+c+"\ ,s="+h+",i="+d,ae="c=biws,r="+c,R=j+","+ee+","+ae,$=await n.importKey("raw",U,{name:"\ HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var le=new Uint8Array(await n.sign("HM\ -AC",$,_.encode(R))),ye=y.from(W.map((V,D)=>W[D]^le[D])),Ee=ye.toString("base64"); +AC",$,A.encode(R))),ye=y.from(W.map((V,D)=>W[D]^le[D])),Ee=ye.toString("base64"); let We=await n.importKey("raw",g,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]), -fe=await n.sign("HMAC",We,_.encode("Server Key")),it=await n.importKey("raw",fe, +fe=await n.sign("HMAC",We,A.encode("Server Key")),it=await n.importKey("raw",fe, {name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var me=y.from(await n.sign("HMA\ -C",it,_.encode(R)));i.message="SASLResponse",i.serverSignature=me.toString("base\ +C",it,A.encode(R)));i.message="SASLResponse",i.serverSignature=me.toString("base\ 64"),i.response=ae+",p="+Ee,this.connection.sendSCRAMClientFinalMessage(this.saslSession. response)}};a(Tn,"NeonClient");var Lt=Tn;function Vc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ n=o,t=u});return{callback:i,result:s}}a(Vc,"promisify");var In=class In extends Bt.Pool{constructor(){ -super(...arguments);A(this,"Client",Lt);A(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ -return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ -if(!xe.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=Vc(this.Promise, -i);i=s.callback;try{let o=new to.default(this.options),u=encodeURIComponent,c=encodeURI, -h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== -"string"?t:t.text,d=n??t.values??[];An(h,{fullResults:!0,arrayMode:t.rowMode==="\ -array"})(l,d,{types:t.types??this.options?.types}).then(_=>i(void 0,_)).catch(_=>i( -_))}catch(o){i(o)}return s.result}};a(In,"NeonPool");var Cn=In; +super(...arguments);_(this,"Client",Lt);_(this,"hasFetchUnsupportedListeners",!1); +_(this,"addListener",this.on)}on(t,n){return t!=="error"&&(this.hasFetchUnsupportedListeners= +!0),super.on(t,n)}query(t,n,i){if(!xe.poolQueryViaFetch||this.hasFetchUnsupportedListeners|| +typeof t=="function")return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0); +let s=Vc(this.Promise,i);i=s.callback;try{let o=new to.default(this.options),u=encodeURIComponent, +c=encodeURI,h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`, +l=typeof t=="string"?t:t.text,d=n??t.values??[];An(h,{fullResults:!0,arrayMode:t. +rowMode==="array"})(l,d,{types:t.types??this.options?.types}).then(A=>i(void 0,A)). +catch(A=>i(A))}catch(o){i(o)}return s.result}};a(In,"NeonPool");var Cn=In; /*! Bundled license information: ieee754/index.js: diff --git a/dist/npm/index.mjs b/dist/npm/index.mjs index 3b90a42..6fc2bb0 100644 --- a/dist/npm/index.mjs +++ b/dist/npm/index.mjs @@ -6,7 +6,7 @@ function(r){if(typeof require<"u")return require.apply(this,arguments);throw Err Ce(r,t,{get:e[t],enumerable:!0})},In=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e== "function")for(let i of ao(e))!co.call(r,i)&&i!==t&&Ce(r,i,{get:()=>e[i],enumerable:!(n= oo(e,i))||n.enumerable});return r};var Te=(r,e,t)=>(t=r!=null?so(uo(r)):{},In(e||!r||!r.__esModule?Ce(t,"default",{ -value:r,enumerable:!0}):t,r)),N=r=>In(Ce({},"__esModule",{value:!0}),r);var A=(r,e,t)=>ho(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=fo;st.toByteArray=yo;st.fromByteArray= +value:r,enumerable:!0}):t,r)),N=r=>In(Ce({},"__esModule",{value:!0}),r);var _=(r,e,t)=>ho(r,typeof e!="symbol"?e+"":e,t);var Bn=I(st=>{"use strict";p();st.byteLength=fo;st.toByteArray=yo;st.fromByteArray= wo;var ae=[],te=[],lo=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNO\ PQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ee=0,Pn=Rt.length;Ee>18&63]+ae[r>>12&63]+ae[ u=t-n;ou?u:o+s));return n===1?(e=r[t-1],i.push(ae[e>>2]+ ae[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(ae[e>>10]+ae[e>>4&63]+ae[e<< 2&63]+"=")),i.join("")}a(wo,"fromByteArray")});var Rn=I(Ft=>{p();Ft.read=function(r,e,t,n,i){var s,o,u=i*8-n-1,c=(1<> -1,l=-7,d=t?i-1:0,S=t?-1:1,_=r[e+d];for(d+=S,s=_&(1<<-l)-1,_>>=-l,l+=u;l>0;s=s*256+ +1,l=-7,d=t?i-1:0,S=t?-1:1,A=r[e+d];for(d+=S,s=A&(1<<-l)-1,A>>=-l,l+=u;l>0;s=s*256+ r[e+d],d+=S,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+r[e+d],d+=S,l-=8);if(s=== -0)s=1-h;else{if(s===c)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(_? +0)s=1-h;else{if(s===c)return o?NaN:(A?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(A? -1:1)*o*Math.pow(2,s-n)};Ft.write=function(r,e,t,n,i,s){var o,u,c,h=s*8-i-1,l=(1<< -h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,L=n?1:-1,G=e<0|| +h)-1,d=l>>1,S=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:s-1,L=n?1:-1,G=e<0|| e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,o=l):(o=Math. floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?e+=S/c:e+= S*Math.pow(2,1-d),e*c>=2&&(o++,c/=2),o+d>=l?(u=0,o=l):o+d>=1?(u=(e*c-1)*Math.pow( -2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+_]=u&255,_+=L,u/=256, -i-=8);for(o=o<0;r[t+_]=o&255,_+=L,o/=256,h-=8);r[t+_-L]|=G*128}});var zn=I(Be=>{"use strict";p();var Mt=Bn(),Pe=Rn(),Fn=typeof Symbol=="function"&& +2,i),o=o+d):(u=e*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;r[t+A]=u&255,A+=L,u/=256, +i-=8);for(o=o<0;r[t+A]=o&255,A+=L,o/=256,h-=8);r[t+A-L]|=G*128}});var zn=I(Be=>{"use strict";p();var Mt=Bn(),Pe=Rn(),Fn=typeof Symbol=="function"&& typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Be.Buffer= f;Be.SlowBuffer=_o;Be.INSPECT_MAX_BYTES=50;var ot=2147483647;Be.kMaxLength=ot;f. TYPED_ARRAY_SUPPORT=bo();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console. @@ -461,11 +461,11 @@ o=2600822924,u=528734635,c=1541459225,h=0,l=0,d=[1116352408,1899447441,304932347 3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556, 883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452, 2361852424,2428436474,2756734187,3204031479,3329325298],S=a((C,g)=>C>>>g|C<<32-g, -"rrot"),_=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, -$+=4)_[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(_[R- -15],7)^S(_[R-15],18)^_[R-15]>>>3,ce=S(_[R-2],17)^S(_[R-2],19)^_[R-2]>>>10;_[R]=_[R- -16]+$+_[R-7]+ce|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,oe=c;for(let R=0;R<64;R++){let $=S( -U,6)^S(U,11)^S(U,25),ce=U&j^~U&ee,de=oe+$+ce+d[R]+_[R]|0,xe=S(C,2)^S(C,13)^S(C,22), +"rrot"),A=new Uint32Array(64),L=new Uint8Array(64),G=a(()=>{for(let R=0,$=0;R<16;R++, +$+=4)A[R]=L[$]<<24|L[$+1]<<16|L[$+2]<<8|L[$+3];for(let R=16;R<64;R++){let $=S(A[R- +15],7)^S(A[R-15],18)^A[R-15]>>>3,ce=S(A[R-2],17)^S(A[R-2],19)^A[R-2]>>>10;A[R]=A[R- +16]+$+A[R-7]+ce|0}let C=e,g=t,P=n,W=i,U=s,j=o,ee=u,oe=c;for(let R=0;R<64;R++){let $=S( +U,6)^S(U,11)^S(U,25),ce=U&j^~U&ee,de=oe+$+ce+d[R]+A[R]|0,xe=S(C,2)^S(C,13)^S(C,22), We=C&g^C&P^g&P,he=xe+We|0;oe=ee,ee=j,j=U,U=W+de|0,W=P,P=g,g=C,C=de+he|0}e=e+C|0, t=t+g|0,n=n+P|0,i=i+W|0,s=s+U|0,o=o+j|0,u=u+ee|0,c=c+oe|0,l=0},"process"),X=a(C=>{ typeof C=="string"&&(C=new TextEncoder().encode(C));for(let g=0;g>>8&255,g[15]=i&255,g[16]=s>>>24,g[17]=s>>>16&255,g[18]=s>>>8&255,g[19]=s&255, g[20]=o>>>24,g[21]=o>>>16&255,g[22]=o>>>8&255,g[23]=o&255,g[24]=u>>>24,g[25]=u>>> 16&255,g[26]=u>>>8&255,g[27]=u&255,g[28]=c>>>24,g[29]=c>>>16&255,g[30]=c>>>8&255, g[31]=c&255,g},"digest");return r===void 0?{add:X,digest:se}:(X(r),se())}var oi=z( -()=>{"use strict";p();a($e,"sha256")});var O,Ke,ai=z(()=>{"use strict";p();O=class O{constructor(){A(this,"_dataLength", -0);A(this,"_bufferLength",0);A(this,"_state",new Int32Array(4));A(this,"_buffer", -new ArrayBuffer(68));A(this,"_buffer8");A(this,"_buffer32");this._buffer8=new Uint8Array( +()=>{"use strict";p();a($e,"sha256")});var O,Ke,ai=z(()=>{"use strict";p();O=class O{constructor(){_(this,"_dataLength", +0);_(this,"_bufferLength",0);_(this,"_state",new Int32Array(4));_(this,"_buffer", +new ArrayBuffer(68));_(this,"_buffer8");_(this,"_buffer32");this._buffer8=new Uint8Array( this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashByteArray(e,t=!1){ return this.onePassHasher.start().appendByteArray(e).end(t)}static hashStr(e,t=!1){ return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){ @@ -553,10 +553,10 @@ t;let o=this._dataLength*8;if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,i.set(O.buffer32Id subarray(s),s),t>55&&(O._md5cycle(this._state,i),i.set(O.buffer32Identity)),o<=4294967295) i[14]=o;else{let u=o.toString(16).match(/(.*?)(.{0,8})$/);if(u===null)return;let c=parseInt( u[2],16),h=parseInt(u[1],16)||0;i[14]=c,i[15]=h}return O._md5cycle(this._state,i), -e?this._state:O._hex(this._state)}};a(O,"Md5"),A(O,"stateIdentity",new Int32Array( -[1732584193,-271733879,-1732584194,271733878])),A(O,"buffer32Identity",new Int32Array( -[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),A(O,"hexChars","0123456789abcdef"),A(O,"hexO\ -ut",[]),A(O,"onePassHasher",new O);Ke=O});var jt={};ie(jt,{createHash:()=>Xo,createHmac:()=>ea,randomBytes:()=>Jo});function Jo(r){ +e?this._state:O._hex(this._state)}};a(O,"Md5"),_(O,"stateIdentity",new Int32Array( +[1732584193,-271733879,-1732584194,271733878])),_(O,"buffer32Identity",new Int32Array( +[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),_(O,"hexChars","0123456789abcdef"),_(O,"hexO\ +ut",[]),_(O,"onePassHasher",new O);Ke=O});var jt={};ie(jt,{createHash:()=>Xo,createHmac:()=>ea,randomBytes:()=>Jo});function Jo(r){ return typeof w<"u"&&w.randomBytes!==void 0?(w.webcrypto??w).getRandomValues(y.alloc( r)):Tn(Zo).randomBytes(r)}function Xo(r){if(r==="sha256")return{update:a(function(e){ return{digest:a(function(){return y.from($e(e))},"digest")}},"update")};if(r==="\ @@ -661,8 +661,8 @@ u+i;for(c="",h=6-u.length,l=0;l>>0,o=42949 s+t,t=o/Z>>>0,u=""+(o-Z*t),t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l< h;l++)c+="0";i=c+u+i}{if(s=e%Z,e=e/Z>>>0,o=4294967296*s+t,t=o/Z>>>0,u=""+(o-Z*t), t===0&&e===0)return n+u+i;for(c="",h=6-u.length,l=0;l{p();var Fa=Ii(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(_,L,G){ -return _*Math.pow(2,G)+L};var s=t>>3,o=a(function(_){return n?~_&255:_},"inv"),u=255, +e%Z,o=4294967296*s+t,u=""+o%Z,n+u+i}a(Ra,"readInt8");Ti.exports=Ra});var Fi=I((Hh,Ri)=>{p();var Fa=Ii(),F=a(function(r,e,t,n,i){t=t||0,n=n||!1,i=i||function(A,L,G){ +return A*Math.pow(2,G)+L};var s=t>>3,o=a(function(A){return n?~A&255:A},"inv"),u=255, c=8-t%8;e>t%8);var h=0;t%8+e>=8&&(h=i(0,o(r[s])& u,c));for(var l=e+t>>3,d=s+1;d0&& (h=i(h,o(r[l])>>8-S,S)),h},"parseBits"),Bi=a(function(r,e,t){var n=Math.pow(2,t- @@ -684,8 +684,8 @@ n=F(r,32,64),i=96,s=[],o=0;o>3,(i+=l<<3)>>3), d;console.log("ERROR: ElementType not implemented: "+h)},"parseElement"),c=a(function(h,l){ -var d=[],S;if(h.length>1){var _=h.shift();for(S=0;S<_;S++)d[S]=c(h,l);h.unshift( -_)}else for(S=0;S1){var A=h.shift();for(S=0;S0},"parseBool"),qa=a(function(r){r(20,Fa),r(21,Ma),r(23,Pi),r(26, Pi),r(1700,Ua),r(700,ka),r(701,Da),r(16,Na),r(1114,Li.bind(null,!1)),r(1184,Li.bind( @@ -750,8 +750,8 @@ r.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server n once is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serv\ er nonce does not start with client nonce");var i=y.from(n.salt,"base64"),s=hu(e, i,n.iteration),o=ke(s,"Client Key"),u=cu(o),c="n=*,r="+r.clientNonce,h="r="+n.nonce+ -",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=ke(u,d),_=Qi( -o,S),L=_.toString("base64"),G=ke(s,"Server Key"),X=ke(G,d);r.message="SASLRespon\ +",s="+n.salt+",i="+n.iteration,l="c=biws,r="+n.nonce,d=c+","+h+","+l,S=ke(u,d),A=Qi( +o,S),L=A.toString("base64"),G=ke(s,"Server Key"),X=ke(G,d);r.message="SASLRespon\ se",r.serverSignature=X.toString("base64"),r.response=l+",p="+L}a(iu,"continueSe\ ssion");function su(r,e){if(r.message!=="SASLResponse")throw new Error("SASL: La\ st message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: S\ @@ -787,7 +787,7 @@ r,y.concat([e,y.from([0,0,0,1])])),i=n,s=0;slu});function lu(...r){return r.join("/")}var sr=z(()=>{ "use strict";p();a(lu,"join")});var or={};ie(or,{stat:()=>fu});function fu(r,e){e(new Error("No filesystem"))}var ar=z( ()=>{"use strict";p();a(fu,"stat")});var ur={};ie(ur,{default:()=>pu});var pu,cr=z(()=>{"use strict";p();pu={}});var Hi={};ie(Hi,{StringDecoder:()=>hr});var lr,hr,Gi=z(()=>{"use strict";p();lr= -class lr{constructor(e){A(this,"td");this.td=new TextDecoder(e)}write(e){return this. +class lr{constructor(e){_(this,"td");this.td=new TextDecoder(e)}write(e){return this. td.decode(e,{stream:!0})}end(e){return this.td.decode(e)}};a(lr,"StringDecoder"); hr=lr});var zi=I((pl,Vi)=>{"use strict";p();var{Transform:du}=(cr(),N(ur)),{StringDecoder:yu}=(Gi(),N(Hi)), be=Symbol("last"),dt=Symbol("decoder");function mu(r,e,t){let n;if(this.overflow){ @@ -826,8 +826,8 @@ a(s,"onLine");var o=a(function(){e.destroy(),t(n)},"onEnd"),u=a(function(c){e.de pr("WARNING: error on reading file: %s",c),t(void 0)},"onErr");e.on("error",u),i. on("data",s).on("end",o).on("error",u)};var Pu=fe.exports.parseLine=function(r){ if(r.length<11||r.match(/^\s+#/))return null;for(var e="",t="",n=0,i=0,s=0,o={}, -u=!1,c=a(function(l,d,S){var _=r.substring(d,S);Object.hasOwnProperty.call(m.env, -"PGPASS_NO_DEESCAPE")||(_=_.replace(/\\([:\\])/g,"$1")),o[De[l]]=_},"addToObj"), +u=!1,c=a(function(l,d,S){var A=r.substring(d,S);Object.hasOwnProperty.call(m.env, +"PGPASS_NO_DEESCAPE")||(A=A.replace(/\\([:\\])/g,"$1")),o[De[l]]=A},"addToObj"), h=0;h=0&&e==":"&&t!=="\\"&&(c(n,i,h+1),i=h+2,n+=1)}return o=Object.keys(o).length=== fr?o:null,o},Lu=fe.exports.isValidEntry=function(r){for(var e={0:function(o){return o. @@ -845,8 +845,8 @@ this.getOverrides(e)[r]=t};gt.prototype.getTypeParser=function(r,e){return e=e|| "text",this.getOverrides(e)[r]||this._types.getTypeParser(r,e)};ts.exports=gt});var rs={};ie(rs,{default:()=>Ru});var Ru,ns=z(()=>{"use strict";p();Ru={}});var is={};ie(is,{parse:()=>yr});function yr(r,e=!1){let{protocol:t}=new URL(r),n="\ http:"+r.substring(t.length),{username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,searchParams:d,hash:S}=new URL(n);s=decodeURIComponent(s),i=decodeURIComponent( -i),h=decodeURIComponent(h);let _=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ -href:r,protocol:t,auth:_,username:i,password:s,host:o,hostname:u,port:c,pathname:h, +i),h=decodeURIComponent(h);let A=i+":"+s,L=e?Object.fromEntries(d.entries()):l;return{ +href:r,protocol:t,auth:A,username:i,password:s,host:o,hostname:u,port:c,pathname:h, search:l,query:L,hash:S}}var mr=z(()=>{"use strict";p();a(yr,"parse")});var os=I((Il,ss)=>{"use strict";p();var Fu=(mr(),N(is)),gr=(ar(),N(or));function wr(r){ if(r.charAt(0)==="/"){var t=r.split(" ");return{host:t[0],database:t[1]}}var e=Fu. parse(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(r)?encodeURI(r).replace(/\%25(\d\d)/g, @@ -944,10 +944,10 @@ binary,valueMapper:ds.prepareValue})}catch(t){this.handleError(t,e);return}e.des e.sendCopyFail("No source stream defined")}handleCopyData(e,t){}};a(_r,"Query"); var Er=_r;ys.exports=Er});var bs={};ie(bs,{Socket:()=>Ae,isIP:()=>Ou});function Ou(r){return 0}var ws,gs,E, Ae,St=z(()=>{"use strict";p();ws=Te(we(),1);a(Ou,"isIP");gs=/^[^.]+\./,E=class E extends ws.EventEmitter{constructor(){ -super(...arguments);A(this,"opts",{});A(this,"connecting",!1);A(this,"pending",!0); -A(this,"writable",!0);A(this,"encrypted",!1);A(this,"authorized",!1);A(this,"des\ -troyed",!1);A(this,"ws",null);A(this,"writeBuffer");A(this,"tlsState",0);A(this, -"tlsRead");A(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? +super(...arguments);_(this,"opts",{});_(this,"connecting",!1);_(this,"pending",!0); +_(this,"writable",!0);_(this,"encrypted",!1);_(this,"authorized",!1);_(this,"des\ +troyed",!1);_(this,"ws",null);_(this,"writeBuffer");_(this,"tlsState",0);_(this, +"tlsRead");_(this,"tlsWrite")}static get poolQueryViaFetch(){return E.opts.poolQueryViaFetch?? E.defaults.poolQueryViaFetch}static set poolQueryViaFetch(t){E.opts.poolQueryViaFetch= t}static get fetchEndpoint(){return E.opts.fetchEndpoint??E.defaults.fetchEndpoint}static set fetchEndpoint(t){ E.opts.fetchEndpoint=t}static get fetchConnectionCache(){return!0}static set fetchConnectionCache(t){ @@ -1018,12 +1018,12 @@ writeBuffer),n.set(t,this.writeBuffer.length),this.writeBuffer=n}}write(t,n="utf tlsState===0?(this.rawWrite(t),i()):this.tlsState===1?this.once("secureConnectio\ n",()=>{this.write(t,n,i)}):(this.tlsWrite(t),i()),!0)}end(t=y.alloc(0),n="utf8",i=()=>{}){ return this.write(t,n,()=>{this.ws.close(),i()}),this}destroy(){return this.destroyed= -!0,this.end()}};a(E,"Socket"),A(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( +!0,this.end()}};a(E,"Socket"),_(E,"defaults",{poolQueryViaFetch:!1,fetchEndpoint:a( (t,n,i)=>{let s;return i?.jwtAuth?s=t.replace(gs,"apiauth."):s=t.replace(gs,"api\ ."),"https://"+s+"/sql"},"fetchEndpoint"),fetchConnectionCache:!0,fetchFunction:void 0, webSocketConstructor:void 0,wsProxy:a(t=>t+"/v2","wsProxy"),useSecureWebSocket:!0, forceDisablePgSSL:!0,coalesceWrites:!0,pipelineConnect:"password",subtls:void 0, -rootCerts:"",pipelineTLS:!1,disableSNI:!1}),A(E,"opts",{});Ae=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. +rootCerts:"",pipelineTLS:!1,disableSNI:!1}),_(E,"opts",{});Ae=E});var Xr=I(T=>{"use strict";p();Object.defineProperty(T,"__esModule",{value:!0});T. NoticeMessage=T.DataRowMessage=T.CommandCompleteMessage=T.ReadyForQueryMessage=T. NotificationResponseMessage=T.BackendKeyDataMessage=T.AuthenticationMD5Password= T.ParameterStatusMessage=T.ParameterDescriptionMessage=T.RowDescriptionMessage=T. @@ -1514,11 +1514,11 @@ exports=new En(vn()):(nt.exports=new En(Oc),Object.defineProperty(nt.exports,"na tive",{configurable:!0,enumerable:!1,get(){var r=null;try{r=new En(vn())}catch(e){ if(e.code!=="MODULE_NOT_FOUND")throw e}return Object.defineProperty(nt.exports,"\ native",{value:r}),r}}))});p();var Lt=Te(It());St();p();St();mr();var Js=Te(tt()),Xs=Te(wt());function Hc(r){return r instanceof y?"\\x"+r.toString("hex"):r}a(Hc,"encodeBuffe\ -rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);A(this,"name", -"NeonDbError");A(this,"severity");A(this,"code");A(this,"detail");A(this,"hint"); -A(this,"position");A(this,"internalPosition");A(this,"internalQuery");A(this,"wh\ -ere");A(this,"schema");A(this,"table");A(this,"column");A(this,"dataType");A(this, -"constraint");A(this,"file");A(this,"line");A(this,"routine");A(this,"sourceErro\ +rsAsBytea");var Pt=class Pt extends Error{constructor(t){super(t);_(this,"name", +"NeonDbError");_(this,"severity");_(this,"code");_(this,"detail");_(this,"hint"); +_(this,"position");_(this,"internalPosition");_(this,"internalQuery");_(this,"wh\ +ere");_(this,"schema");_(this,"table");_(this,"column");_(this,"dataType");_(this, +"constraint");_(this,"file");_(this,"line");_(this,"routine");_(this,"sourceErro\ r");"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error. captureStackTrace(this,Pt)}};a(Pt,"NeonDbError");var pe=Pt,Ys="transaction() exp\ ects an array of queries, or a function returning an array of queries",Gc=["seve\ @@ -1529,8 +1529,8 @@ queryCallback:u,resultCallback:c,authToken:h}={}){if(!r)throw new Error("No data base connection string was provided to `neon()`. Perhaps an environment variable\ has not been set?");let l;try{l=yr(r)}catch{throw new Error("Database connectio\ n string provided to `neon()` is not a valid URL. Connection string: "+String(r))} -let{protocol:d,username:S,hostname:_,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== -"postgresql:"||!S||!_||!G)throw new Error("Database connection string format for\ +let{protocol:d,username:S,hostname:A,port:L,pathname:G}=l;if(d!=="postgres:"&&d!== +"postgresql:"||!S||!A||!G)throw new Error("Database connection string format for\ `neon()` should be: postgresql://user:password@host.tld/dbname?option=value");function X(C,...g){ let P,W;if(typeof C=="string")P=C,W=g[1],g=g[0]??[];else{P="";for(let j=0;jHc((0,Js.prepareValue)(j)));let U={ @@ -1544,7 +1544,7 @@ oe=e??!1,R=t??!1,$=i,ce=s,de=o;P!==void 0&&(P.fetchOptions!==void 0&&(ee={...ee, (R=P.fullResults),P.isolationLevel!==void 0&&($=P.isolationLevel),P.readOnly!==void 0&& (ce=P.readOnly),P.deferrable!==void 0&&(de=P.deferrable)),g!==void 0&&!Array.isArray( g)&&g.fetchOptions!==void 0&&(ee={...ee,...g.fetchOptions});let xe=h;!Array.isArray( -g)&&g?.authToken!==void 0&&(xe=g.authToken);let We=typeof W=="function"?W(_,L,{jwtAuth:xe!== +g)&&g?.authToken!==void 0&&(xe=g.authToken);let We=typeof W=="function"?W(A,L,{jwtAuth:xe!== void 0}):W,he={"Neon-Connection-String":r,"Neon-Raw-Text-Output":"true","Neon-Ar\ ray-Mode":"true"},it=await Kc(xe);it&&(he.Authorization=`Bearer ${it}`),Array.isArray( C)&&($!==void 0&&(he["Neon-Batch-Isolation-Level"]=$),ce!==void 0&&(he["Neon-Bat\ @@ -1603,33 +1603,33 @@ test(h))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing/not base ESSAGE: missing/invalid iteration count");if(!c.startsWith(i.clientNonce))throw new Error( "SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce"); if(c.length===i.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MES\ -SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),_=new TextEncoder, -L=_.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, +SAGE: server nonce is too short");let d=parseInt(l,10),S=y.from(h,"base64"),A=new TextEncoder, +L=A.encode(s),G=await n.importKey("raw",L,{name:"HMAC",hash:{name:"SHA-256"}},!1, ["sign"]),X=new Uint8Array(await n.sign("HMAC",G,y.concat([S,y.from([0,0,0,1])]))), se=X;for(var C=0;Cse[D]^X[D]));let g=se,P=await n.importKey("raw",g,{name:"HMAC",hash:{ -name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,_.encode("C\ +name:"SHA-256"}},!1,["sign"]),W=new Uint8Array(await n.sign("HMAC",P,A.encode("C\ lient Key"))),U=await n.digest("SHA-256",W),j="n=*,r="+i.clientNonce,ee="r="+c+"\ ,s="+h+",i="+d,oe="c=biws,r="+c,R=j+","+ee+","+oe,$=await n.importKey("raw",U,{name:"\ HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var ce=new Uint8Array(await n.sign("HM\ -AC",$,_.encode(R))),de=y.from(W.map((V,D)=>W[D]^ce[D])),xe=de.toString("base64"); +AC",$,A.encode(R))),de=y.from(W.map((V,D)=>W[D]^ce[D])),xe=de.toString("base64"); let We=await n.importKey("raw",g,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]), -he=await n.sign("HMAC",We,_.encode("Server Key")),it=await n.importKey("raw",he, +he=await n.sign("HMAC",We,A.encode("Server Key")),it=await n.importKey("raw",he, {name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);var ye=y.from(await n.sign("HMA\ -C",it,_.encode(R)));i.message="SASLResponse",i.serverSignature=ye.toString("base\ +C",it,A.encode(R)));i.message="SASLResponse",i.serverSignature=ye.toString("base\ 64"),i.response=oe+",p="+xe,this.connection.sendSCRAMClientFinalMessage(this.saslSession. response)}};a(An,"NeonClient");var _n=An;function zc(r,e){if(e)return{callback:e, result:void 0};let t,n,i=a(function(o,u){o?t(o):n(u)},"cb"),s=new r(function(o,u){ n=o,t=u});return{callback:i,result:s}}a(zc,"promisify");var Cn=class Cn extends Lt.Pool{constructor(){ -super(...arguments);A(this,"Client",_n);A(this,"hasFetchUnsupportedListeners",!1)}on(t,n){ -return t!=="error"&&(this.hasFetchUnsupportedListeners=!0),super.on(t,n)}query(t,n,i){ -if(!Ae.poolQueryViaFetch||this.hasFetchUnsupportedListeners||typeof t=="function") -return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0);let s=zc(this.Promise, -i);i=s.callback;try{let o=new ro.default(this.options),u=encodeURIComponent,c=encodeURI, -h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`,l=typeof t== -"string"?t:t.text,d=n??t.values??[];eo(h,{fullResults:!0,arrayMode:t.rowMode==="\ -array"})(l,d,{types:t.types??this.options?.types}).then(_=>i(void 0,_)).catch(_=>i( -_))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var to=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; +super(...arguments);_(this,"Client",_n);_(this,"hasFetchUnsupportedListeners",!1); +_(this,"addListener",this.on)}on(t,n){return t!=="error"&&(this.hasFetchUnsupportedListeners= +!0),super.on(t,n)}query(t,n,i){if(!Ae.poolQueryViaFetch||this.hasFetchUnsupportedListeners|| +typeof t=="function")return super.query(t,n,i);typeof n=="function"&&(i=n,n=void 0); +let s=zc(this.Promise,i);i=s.callback;try{let o=new ro.default(this.options),u=encodeURIComponent, +c=encodeURI,h=`postgresql://${u(o.user)}:${u(o.password)}@${u(o.host)}/${c(o.database)}`, +l=typeof t=="string"?t:t.text,d=n??t.values??[];eo(h,{fullResults:!0,arrayMode:t. +rowMode==="array"})(l,d,{types:t.types??this.options?.types}).then(A=>i(void 0,A)). +catch(A=>i(A))}catch(o){i(o)}return s.result}};a(Cn,"NeonPool");var to=Cn;var export_ClientBase=Qe.ClientBase;var export_Connection=Qe.Connection;var export_DatabaseError=Qe.DatabaseError; var export_Query=Qe.Query;var export_defaults=Qe.defaults;var export_types=Qe.types; export{_n as Client,export_ClientBase as ClientBase,export_Connection as Connection, export_DatabaseError as DatabaseError,pe as NeonDbError,to as Pool,export_Query as Query, diff --git a/export/index.ts b/export/index.ts index 5b6d397..4aa7a3b 100644 --- a/export/index.ts +++ b/export/index.ts @@ -313,6 +313,8 @@ class NeonPool extends Pool { return super.on(event as any, listener); } + addListener = this.on; + // @ts-ignore -- is it even possible to make TS happy with these overloaded function types? query(config?: any, values?: any, cb?: any) { if ( diff --git a/tests/ws.test.ts b/tests/ws.test.ts index cf2092f..362d63e 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -1,4 +1,4 @@ -import { expect, test, beforeAll } from 'vitest'; +import { expect, test, beforeAll, vi } from 'vitest'; import { Pool as PgPool } from 'pg'; import * as subtls from 'subtls'; import { sampleQueries } from './sampleQueries'; @@ -78,7 +78,29 @@ test('pool.query() with poolQueryViaFetch', async () => { } }); -// TODO: poolQueryViaFetch with contra-indications +test('pool.query() with poolQueryViaFetch but also a listener that prevents fetch', async () => { + neonConfig.poolQueryViaFetch = true; + + // use a new Pool because we know it will have to connect a new client + const customPool = new WsPool({ connectionString: DB_URL }); + + try { + const fn = vi.fn(); + const connectListener = () => { + customPool.removeListener('connect', connectListener); + fn(); + }; + customPool.addListener('connect', connectListener); + + const wsResult = await customPool.query('SELECT $1::int AS one', [1]); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult).not.toHaveProperty('viaNeonFetch'); + expect(fn).toHaveBeenCalledOnce(); + } finally { + neonConfig.poolQueryViaFetch = false; + customPool.end(); + } +}); test('client.query()', async () => { const client = new WsClient(DB_URL); From 06cd173f70175f14cfa3520b26a48bd6a31ee30f Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Thu, 19 Dec 2024 17:04:47 +0000 Subject: [PATCH 38/40] Deleted unused files --- tests/subtls-rootcerts.pem | 31 ------------------------------- tests/test.test.ts | 5 ----- 2 files changed, 36 deletions(-) delete mode 100644 tests/subtls-rootcerts.pem delete mode 100644 tests/test.test.ts diff --git a/tests/subtls-rootcerts.pem b/tests/subtls-rootcerts.pem deleted file mode 100644 index b85c803..0000000 --- a/tests/subtls-rootcerts.pem +++ /dev/null @@ -1,31 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw -TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh -cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 -WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu -ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY -MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc -h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ -0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U -A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW -T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH -B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC -B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv -KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn -OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn -jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw -qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI -rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq -hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL -ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ -3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK -NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 -ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur -TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC -jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc -oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq -4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA -mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d -emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= ------END CERTIFICATE----- diff --git a/tests/test.test.ts b/tests/test.test.ts deleted file mode 100644 index 44ed59e..0000000 --- a/tests/test.test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { expect, test } from 'vitest'; - -test('adds 1 + 2 to equal 3', () => { - expect(1 + 2).toBe(3); -}); From c022d389fe3c9fc3ec52bb5a27735dcb94f52636 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Sat, 21 Dec 2024 12:40:16 +0000 Subject: [PATCH 39/40] Do ws tests with both direct and -pooler URLs --- package-lock.json | 81 +++++++------- tests/http.test.ts | 4 +- tests/subtlsCert.ts | 31 ++++++ tests/ws.test.ts | 260 ++++++++++++++++++++------------------------ tests/ws.ts | 2 +- 5 files changed, 196 insertions(+), 182 deletions(-) create mode 100644 tests/subtlsCert.ts diff --git a/package-lock.json b/package-lock.json index 6f542e2..dc4ca0d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,9 +59,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20241205.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241205.0.tgz", - "integrity": "sha512-TArEZkSZkHJyEwnlWWkSpCI99cF6lJ14OVeEoI9Um/+cD9CKZLM9vCmsLeKglKheJ0KcdCnkA+DbeD15t3VaWg==", + "version": "1.20241218.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241218.0.tgz", + "integrity": "sha512-8rveQoxtUvlmORKqTWgjv2ycM8uqWox0u9evn3zd2iWKdou5sncFwH517ZRLI3rq9P31ZLmCQBZ0gloFsTeY6w==", "cpu": [ "x64" ], @@ -76,9 +76,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20241205.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241205.0.tgz", - "integrity": "sha512-u5eqKa9QRdA8MugfgCoD+ADDjY6EpKbv3hSYJETmmUh17l7WXjWBzv4pUvOKIX67C0UzMUy4jZYwC53MymhX3w==", + "version": "1.20241218.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241218.0.tgz", + "integrity": "sha512-be59Ad9nmM9lCkhHqmTs/uZ3JVZt8NJ9Z0PY+B0xnc5z6WwmV2lj0RVLtq7xJhQsQJA189zt5rXqDP6J+2mu7Q==", "cpu": [ "arm64" ], @@ -93,9 +93,9 @@ } }, "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20241205.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241205.0.tgz", - "integrity": "sha512-OYA7S5zpumMamWEW+IhhBU6YojIEocyE5X/YFPiTOCrDE3dsfr9t6oqNE7hxGm1VAAu+Irtl+a/5LwmBOU681w==", + "version": "1.20241218.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241218.0.tgz", + "integrity": "sha512-MzpSBcfZXRxrYWxQ4pVDYDrUbkQuM62ssl4ZtHH8J35OAeGsWFAYji6MkS2SpVwVcvacPwJXIF4JSzp4xKImKw==", "cpu": [ "x64" ], @@ -110,9 +110,9 @@ } }, "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20241205.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241205.0.tgz", - "integrity": "sha512-qAzecONjFJGIAVJZKExQ5dlbic0f3d4A+GdKa+H6SoUJtPaWiE3K6WuePo4JOT7W3/Zfh25McmX+MmpMUUcM5Q==", + "version": "1.20241218.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241218.0.tgz", + "integrity": "sha512-RIuJjPxpNqvwIs52vQsXeRMttvhIjgg9NLjjFa3jK8Ijnj8c3ZDru9Wqi48lJP07yDFIRr4uDMMqh/y29YQi2A==", "cpu": [ "arm64" ], @@ -127,9 +127,9 @@ } }, "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20241205.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241205.0.tgz", - "integrity": "sha512-BEab+HiUgCdl6GXAT7EI2yaRtDPiRJlB94XLvRvXi1ZcmQqsrq6awGo6apctFo4WUL29V7c09LxmN4HQ3X2Tvg==", + "version": "1.20241218.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241218.0.tgz", + "integrity": "sha512-tO1VjlvK3F6Yb2d1jgEy/QBYl//9Pyv3K0j+lq8Eu7qdfm0IgKwSRgDWLept84/qmNsQfausZ4JdNGxTf9xsxQ==", "cpu": [ "x64" ], @@ -3463,9 +3463,9 @@ } }, "node_modules/miniflare": { - "version": "3.20241205.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241205.0.tgz", - "integrity": "sha512-Z0cTtIf6ZrcAJ3SrOI9EUM3s4dkGhNeU6Ubl8sroYhsPVD+rtz3m5+p6McHFWCkcMff1o60X5XEKVTmkz0gbpA==", + "version": "3.20241218.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241218.0.tgz", + "integrity": "sha512-spYFDArH0wd+wJSTrzBrWrXJrbyJhRMJa35mat947y1jYhVV8I5V8vnD3LwjfpLr0SaEilojz1OIW7ekmnRe+w==", "dev": true, "license": "MIT", "dependencies": { @@ -3477,7 +3477,7 @@ "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", "undici": "^5.28.4", - "workerd": "1.20241205.0", + "workerd": "1.20241218.0", "ws": "^8.18.0", "youch": "^3.2.2", "zod": "^3.22.3" @@ -4245,9 +4245,9 @@ } }, "node_modules/resolve": { - "version": "1.22.9", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.9.tgz", - "integrity": "sha512-QxrmX1DzraFIi9PxdG5VkRfRwIgjwyud+z/iBwfRRrVmHc+P9Q7u2lSSpQ6bjr2gy5lrqIiU9vb6iAeGf2400A==", + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", "license": "MIT", "dependencies": { "is-core-module": "^2.16.0", @@ -4257,6 +4257,9 @@ "bin": { "resolve": "bin/resolve" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -4932,9 +4935,9 @@ } }, "node_modules/subtls": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.4.5.tgz", - "integrity": "sha512-uOx+s5vjqPXe+/4eH478hAuQcO4AeF/0vtnaHs6nlyb5MU0mUk1IO9p45TWhD/eE2/crKiUcIOUrzJ2P7Opdyw==", + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/subtls/-/subtls-0.4.6.tgz", + "integrity": "sha512-oRMIeTfQeoujHVKRPG14UedKakMPxiyOnWNEwMrEsd5tVOFNv1SuTYnGhJ/RmfGylq7ooxG24ceHMJ5VLYLydQ==", "dev": true, "license": "MIT", "dependencies": { @@ -5993,9 +5996,9 @@ } }, "node_modules/workerd": { - "version": "1.20241205.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241205.0.tgz", - "integrity": "sha512-vso/2n0c5SdBDWiD+Sx5gM7unA6SiZXRVUHDqH1euoP/9mFVHZF8icoYsNLB87b/TX8zNgpae+I5N/xFpd9v0g==", + "version": "1.20241218.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241218.0.tgz", + "integrity": "sha512-7Z3D4vOVChMz9mWDffE299oQxUWm/pbkeAWx1btVamPcAK/2IuoNBhwflWo3jyuKuxvYuFAdIucgYxc8ICqXiA==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", @@ -6006,17 +6009,17 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20241205.0", - "@cloudflare/workerd-darwin-arm64": "1.20241205.0", - "@cloudflare/workerd-linux-64": "1.20241205.0", - "@cloudflare/workerd-linux-arm64": "1.20241205.0", - "@cloudflare/workerd-windows-64": "1.20241205.0" + "@cloudflare/workerd-darwin-64": "1.20241218.0", + "@cloudflare/workerd-darwin-arm64": "1.20241218.0", + "@cloudflare/workerd-linux-64": "1.20241218.0", + "@cloudflare/workerd-linux-arm64": "1.20241218.0", + "@cloudflare/workerd-windows-64": "1.20241218.0" } }, "node_modules/wrangler": { - "version": "3.98.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.98.0.tgz", - "integrity": "sha512-s3R2Jdai+sIAQ1Fd+WzEK5fVxYHxAN7qbjYPXGx75dxM9/O2p+CT666PYLROGIk4sfAeLU4eVp9iqfVDuiQESw==", + "version": "3.99.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.99.0.tgz", + "integrity": "sha512-k0x4rT3G/QCbxcoZY7CHRVlAIS8WMmKdga6lf4d2c3gXFqssh44vwlTDuARA9QANBxKJTcA7JPTJRfUDhd9QBA==", "dev": true, "license": "MIT OR Apache-2.0", "dependencies": { @@ -6028,14 +6031,14 @@ "date-fns": "^4.1.0", "esbuild": "0.17.19", "itty-time": "^1.0.6", - "miniflare": "3.20241205.0", + "miniflare": "3.20241218.0", "nanoid": "^3.3.3", "path-to-regexp": "^6.3.0", "resolve": "^1.22.8", "selfsigned": "^2.0.1", "source-map": "^0.6.1", "unenv": "npm:unenv-nightly@2.0.0-20241204-140205-a5d5190", - "workerd": "1.20241205.0", + "workerd": "1.20241218.0", "xxhash-wasm": "^1.0.1" }, "bin": { @@ -6049,7 +6052,7 @@ "fsevents": "~2.3.2" }, "peerDependencies": { - "@cloudflare/workers-types": "^4.20241205.0" + "@cloudflare/workers-types": "^4.20241218.0" }, "peerDependenciesMeta": { "@cloudflare/workers-types": { diff --git a/tests/http.test.ts b/tests/http.test.ts index a8db5f3..25531a7 100644 --- a/tests/http.test.ts +++ b/tests/http.test.ts @@ -1,14 +1,14 @@ import { expect, test, vi, beforeAll } from 'vitest'; import { neon, neonConfig, Pool } from '../dist/npm'; import { sampleQueries } from './sampleQueries'; -import { shimWebSocket } from './ws'; +import { shimWebSocketIfRequired } from './ws'; const DB_URL = process.env.VITE_NEON_DB_URL!; const sql = neon(DB_URL); const sqlFull = neon(DB_URL, { fullResults: true }); const pool = new Pool({ connectionString: DB_URL }); -beforeAll(shimWebSocket); +beforeAll(shimWebSocketIfRequired); test( 'http query results match WebSocket query results', diff --git a/tests/subtlsCert.ts b/tests/subtlsCert.ts new file mode 100644 index 0000000..c272e81 --- /dev/null +++ b/tests/subtlsCert.ts @@ -0,0 +1,31 @@ +export const ISRGX1Cert = `-----BEGIN CERTIFICATE----- +MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw +TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh +cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 +WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu +ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY +MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc +h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ +0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U +A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW +T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH +B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC +B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv +KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn +OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn +jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw +qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI +rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV +HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq +hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL +ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ +3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK +NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 +ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur +TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC +jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc +oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq +4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA +mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d +emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= +-----END CERTIFICATE-----`; diff --git a/tests/ws.test.ts b/tests/ws.test.ts index 362d63e..ad3335b 100644 --- a/tests/ws.test.ts +++ b/tests/ws.test.ts @@ -1,8 +1,9 @@ -import { expect, test, beforeAll, vi } from 'vitest'; +import { expect, test, describe, beforeAll, vi } from 'vitest'; import { Pool as PgPool } from 'pg'; import * as subtls from 'subtls'; import { sampleQueries } from './sampleQueries'; -import { shimWebSocket } from './ws'; +import { shimWebSocketIfRequired } from './ws'; +import { ISRGX1Cert } from './subtlsCert'; import { neon, neonConfig, @@ -10,12 +11,6 @@ import { Client as WsClient, } from '../dist/npm'; -const DB_URL = process.env.VITE_NEON_DB_URL!; - -const sql = neon(DB_URL); -const wsPool = new WsPool({ connectionString: DB_URL }); -const pgPool = new PgPool({ connectionString: DB_URL }); - function recursiveTransform(x: any, transform: (x: any) => any) { if (Array.isArray(x)) { return x.map((item) => recursiveTransform(item, transform)); @@ -34,149 +29,134 @@ function functionsToPlaceholders(x: any) { ); } -beforeAll(shimWebSocket); - -test( - 'WebSockets query results match pg/TCP query results, using pool.connect()', - { timeout: 30000 }, - async () => { - const wsClient = await wsPool.connect(); - const pgClient = await pgPool.connect(); - - for (const queryPromise of sampleQueries(sql)) { - const { query, params } = queryPromise.parameterizedQuery; - const [wsResult, pgResult] = await Promise.all([ - wsClient.query(query, params), - pgClient.query(query, params), - ]); - - // unprocessed results don't strictly match because functions are minified by ws driver - expect(functionsToPlaceholders(wsResult)).toStrictEqual( - functionsToPlaceholders(pgResult), - ); - } +const DB_DIRECT_URL = process.env.VITE_NEON_DB_URL!; +const DB_POOLER_URL = process.env.VITE_NEON_DB_POOLER_URL!; + +const pgPool = new PgPool({ connectionString: DB_DIRECT_URL }); - wsClient.release(); - pgClient.release(); +beforeAll(shimWebSocketIfRequired); + +describe.each([ + { + DB_URL: DB_DIRECT_URL, + wsPool: new WsPool({ connectionString: DB_DIRECT_URL }), + }, + { + DB_URL: DB_POOLER_URL, + wsPool: new WsPool({ connectionString: DB_POOLER_URL }), }, -); +])('WebSocket connections and queries', ({ DB_URL, wsPool }) => { + test( + 'WebSockets query results match pg/TCP query results, using pool.connect()', + { timeout: 30000 }, + async () => { + const wsClient = await wsPool.connect(); + const pgClient = await pgPool.connect(); + const sql = neon('postgresql://dummy:dummy@dummy.dummy/dummy'); // the URL is not actually used + + for (const queryPromise of sampleQueries(sql)) { + const { query, params } = queryPromise.parameterizedQuery; + const [wsResult, pgResult] = await Promise.all([ + wsClient.query(query, params), + pgClient.query(query, params), + ]); + + // unprocessed results don't strictly match because functions are minified by ws driver + expect(functionsToPlaceholders(wsResult)).toStrictEqual( + functionsToPlaceholders(pgResult), + ); + } -test('pool.query() over WebSockets', async () => { - const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); - expect(wsResult.rows).toStrictEqual([{ one: 1 }]); - expect(wsResult.viaNeonFetch).toBeUndefined(); -}); + wsClient.release(); + pgClient.release(); + }, + ); -test('pool.query() with poolQueryViaFetch', async () => { - try { - neonConfig.poolQueryViaFetch = true; + test('pool.query() over WebSockets', async () => { const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); expect(wsResult.rows).toStrictEqual([{ one: 1 }]); - expect(wsResult.viaNeonFetch).toBe(true); - } finally { - neonConfig.poolQueryViaFetch = false; - } -}); - -test('pool.query() with poolQueryViaFetch but also a listener that prevents fetch', async () => { - neonConfig.poolQueryViaFetch = true; + expect(wsResult.viaNeonFetch).toBeUndefined(); + }); + + test('pool.query() with poolQueryViaFetch', async () => { + try { + neonConfig.poolQueryViaFetch = true; + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBe(true); + } finally { + neonConfig.poolQueryViaFetch = false; + } + }); - // use a new Pool because we know it will have to connect a new client - const customPool = new WsPool({ connectionString: DB_URL }); + test('pool.query() with poolQueryViaFetch but also a listener that prevents fetch', async () => { + neonConfig.poolQueryViaFetch = true; - try { - const fn = vi.fn(); - const connectListener = () => { - customPool.removeListener('connect', connectListener); - fn(); - }; - customPool.addListener('connect', connectListener); + // use a new Pool because we know it will have to connect a new client + const customPool = new WsPool({ connectionString: DB_URL }); + + try { + const fn = vi.fn(); + const connectListener = () => { + customPool.removeListener('connect', connectListener); + fn(); + }; + customPool.addListener('connect', connectListener); + + const wsResult = await customPool.query('SELECT $1::int AS one', [1]); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult).not.toHaveProperty('viaNeonFetch'); + expect(fn).toHaveBeenCalledOnce(); + } finally { + neonConfig.poolQueryViaFetch = false; + customPool.end(); + } + }); - const wsResult = await customPool.query('SELECT $1::int AS one', [1]); + test('client.query()', async () => { + const client = new WsClient(DB_URL); + await client.connect(); + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + await client.end(); expect(wsResult.rows).toStrictEqual([{ one: 1 }]); - expect(wsResult).not.toHaveProperty('viaNeonFetch'); - expect(fn).toHaveBeenCalledOnce(); - } finally { - neonConfig.poolQueryViaFetch = false; - customPool.end(); - } -}); - -test('client.query()', async () => { - const client = new WsClient(DB_URL); - await client.connect(); - const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); - await client.end(); - expect(wsResult.rows).toStrictEqual([{ one: 1 }]); - expect(wsResult.viaNeonFetch).toBeUndefined(); -}); - -test('client.query() with pipelined connect (yes, no) x coalesced writes (yes, no)', async () => { - const { pipelineConnect, coalesceWrites } = neonConfig; - try { - for (const pc of ['password', false] as const) { - for (const cw of [true, false]) { - neonConfig.pipelineConnect = pc; - neonConfig.coalesceWrites = cw; - - const client = new WsClient(DB_URL); - await client.connect(); - const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); - await client.end(); - - expect(wsResult.rows).toStrictEqual([{ one: 1 }]); - expect(wsResult.viaNeonFetch).toBeUndefined(); + expect(wsResult.viaNeonFetch).toBeUndefined(); + }); + + test('client.query() with pipelined connect (yes, no) x coalesced writes (yes, no)', async () => { + const { pipelineConnect, coalesceWrites } = neonConfig; + try { + for (const pc of ['password', false] as const) { + for (const cw of [true, false]) { + neonConfig.pipelineConnect = pc; + neonConfig.coalesceWrites = cw; + + const client = new WsClient(DB_URL); + await client.connect(); + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + await client.end(); + + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBeUndefined(); + } } + } finally { + neonConfig.pipelineConnect = pipelineConnect; + neonConfig.coalesceWrites = coalesceWrites; } - } finally { - neonConfig.pipelineConnect = pipelineConnect; - neonConfig.coalesceWrites = coalesceWrites; - } -}); + }); -const ISRGX1Cert = `-----BEGIN CERTIFICATE----- -MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw -TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh -cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4 -WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu -ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY -MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc -h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+ -0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U -A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW -T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH -B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC -B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv -KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn -OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn -jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw -qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI -rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq -hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL -ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ -3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK -NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5 -ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur -TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC -jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc -oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq -4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA -mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d -emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc= ------END CERTIFICATE-----`; - -test('client.query() with custom WebSocket proxy and subtls', async () => { - const client = new WsClient(DB_URL); - client.neonConfig.wsProxy = process.env.VITE_WSPROXY!; - client.neonConfig.forceDisablePgSSL = false; - client.neonConfig.pipelineConnect = false; - client.neonConfig.subtls = subtls; - client.neonConfig.rootCerts = ISRGX1Cert; - - await client.connect(); - const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); - await client.end(); - expect(wsResult.rows).toStrictEqual([{ one: 1 }]); - expect(wsResult.viaNeonFetch).toBeUndefined(); + test('client.query() with custom WebSocket proxy and subtls', async () => { + const client = new WsClient(DB_URL); + client.neonConfig.wsProxy = process.env.VITE_WSPROXY!; + client.neonConfig.forceDisablePgSSL = false; + client.neonConfig.pipelineConnect = false; + client.neonConfig.subtls = subtls; + client.neonConfig.rootCerts = ISRGX1Cert; + + await client.connect(); + const wsResult = await wsPool.query('SELECT $1::int AS one', [1]); + await client.end(); + expect(wsResult.rows).toStrictEqual([{ one: 1 }]); + expect(wsResult.viaNeonFetch).toBeUndefined(); + }); }); diff --git a/tests/ws.ts b/tests/ws.ts index aa9fabb..46b27a2 100644 --- a/tests/ws.ts +++ b/tests/ws.ts @@ -1,6 +1,6 @@ import { neonConfig } from '../dist/npm'; -export async function shimWebSocket() { +export async function shimWebSocketIfRequired() { if (typeof WebSocket !== 'function') { console.info( 'Native WebSocket not found: importing ws for neonConfig.webSocketConstructor', From 9693fefae5ecad9b7fa53b103426a4b833237232 Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Sat, 21 Dec 2024 12:52:54 +0000 Subject: [PATCH 40/40] Added -pooler URL env var to test.yml --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f301b2..78bcea4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,7 @@ jobs: - name: Run tests in Node 18 (no native WebSocket), node environment env: VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }} + VITE_NEON_DB_POOLER_URL: ${{ secrets.VITE_NEON_DB_POOLER_URL }} VITE_WSPROXY: ${{ vars.VITE_WSPROXY }} run: npm run testNode @@ -41,11 +42,13 @@ jobs: - name: Run tests in Node LTS, node environment env: VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }} + VITE_NEON_DB_POOLER_URL: ${{ secrets.VITE_NEON_DB_POOLER_URL }} VITE_WSPROXY: ${{ vars.VITE_WSPROXY }} run: npm run testNode - name: Run tests in Node LTS, edge-runtime environment env: VITE_NEON_DB_URL: ${{ secrets.VITE_NEON_DB_URL }} + VITE_NEON_DB_POOLER_URL: ${{ secrets.VITE_NEON_DB_POOLER_URL }} VITE_WSPROXY: ${{ vars.VITE_WSPROXY }} run: npm run testEdge