UNPKG

@botanalytics/core

Version:
1,563 lines (1,539 loc) 416 kB
var __create = Object.create; var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropNames = Object.getOwnPropertyNames; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); var __objRest = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols) for (var prop of __getOwnPropSymbols(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; 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 name2 in all) __defProp(target, name2, { get: all[name2], 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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/dotenv/lib/main.js var require_main = __commonJS({ "node_modules/dotenv/lib/main.js"(exports2, module2) { var fs = require("fs"); var path = require("path"); var os = require("os"); var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg; function parse(src) { const obj = {}; let lines = src.toString(); lines = lines.replace(/\r\n?/mg, "\n"); let match; while ((match = LINE.exec(lines)) != null) { const key = match[1]; let value = match[2] || ""; value = value.trim(); const maybeQuote = value[0]; value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"); if (maybeQuote === '"') { value = value.replace(/\\n/g, "\n"); value = value.replace(/\\r/g, "\r"); } obj[key] = value; } return obj; } function _log(message) { console.log(`[dotenv][DEBUG] ${message}`); } function _resolveHome(envPath) { return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath; } function config(options) { let dotenvPath = path.resolve(process.cwd(), ".env"); let encoding = "utf8"; const debug = Boolean(options && options.debug); const override = Boolean(options && options.override); if (options) { if (options.path != null) { dotenvPath = _resolveHome(options.path); } if (options.encoding != null) { encoding = options.encoding; } } try { const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding })); Object.keys(parsed).forEach(function(key) { if (!Object.prototype.hasOwnProperty.call(process.env, key)) { process.env[key] = parsed[key]; } else { if (override === true) { process.env[key] = parsed[key]; } if (debug) { if (override === true) { _log(`"${key}" is already defined in \`process.env\` and WAS overwritten`); } else { _log(`"${key}" is already defined in \`process.env\` and was NOT overwritten`); } } } }); return { parsed }; } catch (e) { if (debug) { _log(`Failed to load ${dotenvPath} ${e.message}`); } return { error: e }; } } var DotenvModule = { config, parse }; module2.exports.config = DotenvModule.config; module2.exports.parse = DotenvModule.parse; module2.exports = DotenvModule; } }); // node_modules/dotenv/lib/env-options.js var require_env_options = __commonJS({ "node_modules/dotenv/lib/env-options.js"(exports2, module2) { var options = {}; if (process.env.DOTENV_CONFIG_ENCODING != null) { options.encoding = process.env.DOTENV_CONFIG_ENCODING; } if (process.env.DOTENV_CONFIG_PATH != null) { options.path = process.env.DOTENV_CONFIG_PATH; } if (process.env.DOTENV_CONFIG_DEBUG != null) { options.debug = process.env.DOTENV_CONFIG_DEBUG; } if (process.env.DOTENV_CONFIG_OVERRIDE != null) { options.override = process.env.DOTENV_CONFIG_OVERRIDE; } module2.exports = options; } }); // node_modules/dotenv/lib/cli-options.js var require_cli_options = __commonJS({ "node_modules/dotenv/lib/cli-options.js"(exports2, module2) { var re = /^dotenv_config_(encoding|path|debug|override)=(.+)$/; module2.exports = function optionMatcher(args) { return args.reduce(function(acc, cur) { const matches = cur.match(re); if (matches) { acc[matches[1]] = matches[2]; } return acc; }, {}); }; } }); // node_modules/pino-std-serializers/lib/err-helpers.js var require_err_helpers = __commonJS({ "node_modules/pino-std-serializers/lib/err-helpers.js"(exports2, module2) { "use strict"; var getErrorCause = (err) => { if (!err) return; const cause = err.cause; if (typeof cause === "function") { const causeResult = err.cause(); return causeResult instanceof Error ? causeResult : void 0; } else { return cause instanceof Error ? cause : void 0; } }; var _stackWithCauses = (err, seen) => { if (!(err instanceof Error)) return ""; const stack = err.stack || ""; if (seen.has(err)) { return stack + "\ncauses have become circular..."; } const cause = getErrorCause(err); if (cause) { seen.add(err); return stack + "\ncaused by: " + _stackWithCauses(cause, seen); } else { return stack; } }; var stackWithCauses = (err) => _stackWithCauses(err, /* @__PURE__ */ new Set()); var _messageWithCauses = (err, seen, skip) => { if (!(err instanceof Error)) return ""; const message = skip ? "" : err.message || ""; if (seen.has(err)) { return message + ": ..."; } const cause = getErrorCause(err); if (cause) { seen.add(err); const skipIfVErrorStyleCause = typeof err.cause === "function"; return message + (skipIfVErrorStyleCause ? "" : ": ") + _messageWithCauses(cause, seen, skipIfVErrorStyleCause); } else { return message; } }; var messageWithCauses = (err) => _messageWithCauses(err, /* @__PURE__ */ new Set()); module2.exports = { getErrorCause, stackWithCauses, messageWithCauses }; } }); // node_modules/pino-std-serializers/lib/err.js var require_err = __commonJS({ "node_modules/pino-std-serializers/lib/err.js"(exports2, module2) { "use strict"; module2.exports = errSerializer; var { messageWithCauses, stackWithCauses } = require_err_helpers(); var { toString } = Object.prototype; var seen = Symbol("circular-ref-tag"); var rawSymbol = Symbol("pino-raw-err-ref"); var pinoErrProto = Object.create({}, { type: { enumerable: true, writable: true, value: void 0 }, message: { enumerable: true, writable: true, value: void 0 }, stack: { enumerable: true, writable: true, value: void 0 }, aggregateErrors: { enumerable: true, writable: true, value: void 0 }, raw: { enumerable: false, get: function() { return this[rawSymbol]; }, set: function(val) { this[rawSymbol] = val; } } }); Object.defineProperty(pinoErrProto, rawSymbol, { writable: true, value: {} }); function errSerializer(err) { if (!(err instanceof Error)) { return err; } err[seen] = void 0; const _err = Object.create(pinoErrProto); _err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name; _err.message = messageWithCauses(err); _err.stack = stackWithCauses(err); if (global.AggregateError !== void 0 && err instanceof global.AggregateError && Array.isArray(err.errors)) { _err.aggregateErrors = err.errors.map((err2) => errSerializer(err2)); } for (const key in err) { if (_err[key] === void 0) { const val = err[key]; if (val instanceof Error && key !== "cause") { if (!val.hasOwnProperty(seen)) { _err[key] = errSerializer(val); } } else { _err[key] = val; } } } delete err[seen]; _err.raw = err; return _err; } } }); // node_modules/pino-std-serializers/lib/req.js var require_req = __commonJS({ "node_modules/pino-std-serializers/lib/req.js"(exports2, module2) { "use strict"; module2.exports = { mapHttpRequest, reqSerializer }; var rawSymbol = Symbol("pino-raw-req-ref"); var pinoReqProto = Object.create({}, { id: { enumerable: true, writable: true, value: "" }, method: { enumerable: true, writable: true, value: "" }, url: { enumerable: true, writable: true, value: "" }, query: { enumerable: true, writable: true, value: "" }, params: { enumerable: true, writable: true, value: "" }, headers: { enumerable: true, writable: true, value: {} }, remoteAddress: { enumerable: true, writable: true, value: "" }, remotePort: { enumerable: true, writable: true, value: "" }, raw: { enumerable: false, get: function() { return this[rawSymbol]; }, set: function(val) { this[rawSymbol] = val; } } }); Object.defineProperty(pinoReqProto, rawSymbol, { writable: true, value: {} }); function reqSerializer(req) { const connection = req.info || req.socket; const _req = Object.create(pinoReqProto); _req.id = typeof req.id === "function" ? req.id() : req.id || (req.info ? req.info.id : void 0); _req.method = req.method; if (req.originalUrl) { _req.url = req.originalUrl; } else { const path = req.path; _req.url = typeof path === "string" ? path : req.url ? req.url.path || req.url : void 0; } if (req.query) { _req.query = req.query; } if (req.params) { _req.params = req.params; } _req.headers = req.headers; _req.remoteAddress = connection && connection.remoteAddress; _req.remotePort = connection && connection.remotePort; _req.raw = req.raw || req; return _req; } function mapHttpRequest(req) { return { req: reqSerializer(req) }; } } }); // node_modules/pino-std-serializers/lib/res.js var require_res = __commonJS({ "node_modules/pino-std-serializers/lib/res.js"(exports2, module2) { "use strict"; module2.exports = { mapHttpResponse, resSerializer }; var rawSymbol = Symbol("pino-raw-res-ref"); var pinoResProto = Object.create({}, { statusCode: { enumerable: true, writable: true, value: 0 }, headers: { enumerable: true, writable: true, value: "" }, raw: { enumerable: false, get: function() { return this[rawSymbol]; }, set: function(val) { this[rawSymbol] = val; } } }); Object.defineProperty(pinoResProto, rawSymbol, { writable: true, value: {} }); function resSerializer(res) { const _res = Object.create(pinoResProto); _res.statusCode = res.headersSent ? res.statusCode : null; _res.headers = res.getHeaders ? res.getHeaders() : res._headers; _res.raw = res; return _res; } function mapHttpResponse(res) { return { res: resSerializer(res) }; } } }); // node_modules/pino-std-serializers/index.js var require_pino_std_serializers = __commonJS({ "node_modules/pino-std-serializers/index.js"(exports2, module2) { "use strict"; var errSerializer = require_err(); var reqSerializers = require_req(); var resSerializers = require_res(); module2.exports = { err: errSerializer, mapHttpRequest: reqSerializers.mapHttpRequest, mapHttpResponse: resSerializers.mapHttpResponse, req: reqSerializers.reqSerializer, res: resSerializers.resSerializer, wrapErrorSerializer: function wrapErrorSerializer(customSerializer) { if (customSerializer === errSerializer) return customSerializer; return function wrapErrSerializer(err) { return customSerializer(errSerializer(err)); }; }, wrapRequestSerializer: function wrapRequestSerializer(customSerializer) { if (customSerializer === reqSerializers.reqSerializer) return customSerializer; return function wrappedReqSerializer(req) { return customSerializer(reqSerializers.reqSerializer(req)); }; }, wrapResponseSerializer: function wrapResponseSerializer(customSerializer) { if (customSerializer === resSerializers.resSerializer) return customSerializer; return function wrappedResSerializer(res) { return customSerializer(resSerializers.resSerializer(res)); }; } }; } }); // node_modules/pino/lib/caller.js var require_caller = __commonJS({ "node_modules/pino/lib/caller.js"(exports2, module2) { "use strict"; function noOpPrepareStackTrace(_, stack) { return stack; } module2.exports = function getCallers() { const originalPrepare = Error.prepareStackTrace; Error.prepareStackTrace = noOpPrepareStackTrace; const stack = new Error().stack; Error.prepareStackTrace = originalPrepare; if (!Array.isArray(stack)) { return void 0; } const entries = stack.slice(2); const fileNames = []; for (const entry of entries) { if (!entry) { continue; } fileNames.push(entry.getFileName()); } return fileNames; }; } }); // node_modules/fast-redact/lib/validator.js var require_validator = __commonJS({ "node_modules/fast-redact/lib/validator.js"(exports2, module2) { "use strict"; var { createContext, runInContext } = require("vm"); module2.exports = validator; function validator(opts = {}) { const { ERR_PATHS_MUST_BE_STRINGS = () => "fast-redact - Paths must be (non-empty) strings", ERR_INVALID_PATH = (s) => `fast-redact \u2013 Invalid path (${s})` } = opts; return function validate({ paths }) { paths.forEach((s) => { if (typeof s !== "string") { throw Error(ERR_PATHS_MUST_BE_STRINGS()); } try { if (/〇/.test(s)) throw Error(); const proxy = new Proxy({}, { get: () => proxy, set: () => { throw Error(); } }); const expr = (s[0] === "[" ? "" : ".") + s.replace(/^\*/, "\u3007").replace(/\.\*/g, ".\u3007").replace(/\[\*\]/g, "[\u3007]"); if (/\n|\r|;/.test(expr)) throw Error(); if (/\/\*/.test(expr)) throw Error(); runInContext(` (function () { 'use strict' o${expr} if ([o${expr}].length !== 1) throw Error() })() `, createContext({ o: proxy, "\u3007": null }), { codeGeneration: { strings: false, wasm: false } }); } catch (e) { throw Error(ERR_INVALID_PATH(s)); } }); }; } } }); // node_modules/fast-redact/lib/rx.js var require_rx = __commonJS({ "node_modules/fast-redact/lib/rx.js"(exports2, module2) { "use strict"; module2.exports = /[^.[\]]+|\[((?:.)*?)\]/g; } }); // node_modules/fast-redact/lib/parse.js var require_parse = __commonJS({ "node_modules/fast-redact/lib/parse.js"(exports2, module2) { "use strict"; var rx = require_rx(); module2.exports = parse; function parse({ paths }) { const wildcards = []; var wcLen = 0; const secret = paths.reduce(function(o, strPath, ix) { var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, "")); const leadingBracket = strPath[0] === "["; path = path.map((p) => { if (p[0] === "[") return p.substr(1, p.length - 2); else return p; }); const star = path.indexOf("*"); if (star > -1) { const before = path.slice(0, star); const beforeStr = before.join("."); const after = path.slice(star + 1, path.length); const nested = after.length > 0; wcLen++; wildcards.push({ before, beforeStr, after, nested }); } else { o[strPath] = { path, val: void 0, precensored: false, circle: "", escPath: JSON.stringify(strPath), leadingBracket }; } return o; }, {}); return { wildcards, wcLen, secret }; } } }); // node_modules/fast-redact/lib/redactor.js var require_redactor = __commonJS({ "node_modules/fast-redact/lib/redactor.js"(exports2, module2) { "use strict"; var rx = require_rx(); module2.exports = redactor; function redactor({ secret, serialize, wcLen, strict, isCensorFct, censorFctTakesPath }, state) { const redact = Function("o", ` if (typeof o !== 'object' || o == null) { ${strictImpl(strict, serialize)} } const { censor, secret } = this ${redactTmpl(secret, isCensorFct, censorFctTakesPath)} this.compileRestore() ${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)} ${resultTmpl(serialize)} `).bind(state); if (serialize === false) { redact.restore = (o) => state.restore(o); } return redact; } function redactTmpl(secret, isCensorFct, censorFctTakesPath) { return Object.keys(secret).map((path) => { const { escPath, leadingBracket, path: arrPath } = secret[path]; const skip = leadingBracket ? 1 : 0; const delim = leadingBracket ? "" : "."; const hops = []; var match; while ((match = rx.exec(path)) !== null) { const [, ix] = match; const { index, input } = match; if (index > skip) hops.push(input.substring(0, index - (ix ? 0 : 1))); } var existence = hops.map((p) => `o${delim}${p}`).join(" && "); if (existence.length === 0) existence += `o${delim}${path} != null`; else existence += ` && o${delim}${path} != null`; const circularDetection = ` switch (true) { ${hops.reverse().map((p) => ` case o${delim}${p} === censor: secret[${escPath}].circle = ${JSON.stringify(p)} break `).join("\n")} } `; const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`; return ` if (${existence}) { const val = o${delim}${path} if (val === censor) { secret[${escPath}].precensored = true } else { secret[${escPath}].val = val o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : "censor"} ${circularDetection} } } `; }).join("\n"); } function dynamicRedactTmpl(hasWildcards, isCensorFct, censorFctTakesPath) { return hasWildcards === true ? ` { const { wildcards, wcLen, groupRedact, nestedRedact } = this for (var i = 0; i < wcLen; i++) { const { before, beforeStr, after, nested } = wildcards[i] if (nested === true) { secret[beforeStr] = secret[beforeStr] || [] nestedRedact(secret[beforeStr], o, before, after, censor, ${isCensorFct}, ${censorFctTakesPath}) } else secret[beforeStr] = groupRedact(o, before, censor, ${isCensorFct}, ${censorFctTakesPath}) } } ` : ""; } function resultTmpl(serialize) { return serialize === false ? `return o` : ` var s = this.serialize(o) this.restore(o) return s `; } function strictImpl(strict, serialize) { return strict === true ? `throw Error('fast-redact: primitives cannot be redacted')` : serialize === false ? `return o` : `return this.serialize(o)`; } } }); // node_modules/fast-redact/lib/modifiers.js var require_modifiers = __commonJS({ "node_modules/fast-redact/lib/modifiers.js"(exports2, module2) { "use strict"; module2.exports = { groupRedact, groupRestore, nestedRedact, nestedRestore }; function groupRestore({ keys, values, target }) { if (target == null) return; const length = keys.length; for (var i = 0; i < length; i++) { const k = keys[i]; target[k] = values[i]; } } function groupRedact(o, path, censor, isCensorFct, censorFctTakesPath) { const target = get(o, path); if (target == null) return { keys: null, values: null, target: null, flat: true }; const keys = Object.keys(target); const keysLength = keys.length; const pathLength = path.length; const pathWithKey = censorFctTakesPath ? [...path] : void 0; const values = new Array(keysLength); for (var i = 0; i < keysLength; i++) { const key = keys[i]; values[i] = target[key]; if (censorFctTakesPath) { pathWithKey[pathLength] = key; target[key] = censor(target[key], pathWithKey); } else if (isCensorFct) { target[key] = censor(target[key]); } else { target[key] = censor; } } return { keys, values, target, flat: true }; } function nestedRestore(arr) { const length = arr.length; for (var i = 0; i < length; i++) { const { key, target, value } = arr[i]; if (has(target, key)) { target[key] = value; } if (typeof target === "object") { const targetKeys = Object.keys(target); for (var j = 0; j < targetKeys.length; j++) { const tKey = targetKeys[j]; const subTarget = target[tKey]; if (has(subTarget, key)) { subTarget[key] = value; } } } } } function nestedRedact(store, o, path, ns, censor, isCensorFct, censorFctTakesPath) { const target = get(o, path); if (target == null) return; const keys = Object.keys(target); const keysLength = keys.length; for (var i = 0; i < keysLength; i++) { const key = keys[i]; const { value, parent, exists } = specialSet(target, key, path, ns, censor, isCensorFct, censorFctTakesPath); if (exists === true && parent !== null) { store.push({ key: ns[ns.length - 1], target: parent, value }); } } return store; } function has(obj, prop) { return obj !== void 0 && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false; } function specialSet(o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) { const afterPathLen = afterPath.length; const lastPathIndex = afterPathLen - 1; const originalKey = k; var i = -1; var n; var nv; var ov; var oov = null; var exists = true; var wc = null; ov = n = o[k]; if (typeof n !== "object") return { value: null, parent: null, exists }; while (n != null && ++i < afterPathLen) { k = afterPath[i]; oov = ov; if (k !== "*" && !wc && !(typeof n === "object" && k in n)) { exists = false; break; } if (k === "*") { wc = k; if (i !== lastPathIndex) { continue; } } if (wc) { const wcKeys = Object.keys(n); for (var j = 0; j < wcKeys.length; j++) { const wck = wcKeys[j]; const wcov = n[wck]; const kIsWc = k === "*"; if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) { if (kIsWc) { ov = wcov; } else { ov = wcov[k]; } nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor; if (kIsWc) { n[wck] = nv; } else { wcov[k] = nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov ? wcov[k] : nv; } } } wc = null; } else { ov = n[k]; nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor; n[k] = has(n, k) && nv === ov || nv === void 0 && censor !== void 0 ? n[k] : nv; n = n[k]; } if (typeof n !== "object") break; } return { value: ov, parent: oov, exists }; } function get(o, p) { var i = -1; var l = p.length; var n = o; while (n != null && ++i < l) { n = n[p[i]]; } return n; } } }); // node_modules/fast-redact/lib/restorer.js var require_restorer = __commonJS({ "node_modules/fast-redact/lib/restorer.js"(exports2, module2) { "use strict"; var { groupRestore, nestedRestore } = require_modifiers(); module2.exports = restorer; function restorer({ secret, wcLen }) { return function compileRestore() { if (this.restore) return; const paths = Object.keys(secret); const resetters = resetTmpl(secret, paths); const hasWildcards = wcLen > 0; const state = hasWildcards ? { secret, groupRestore, nestedRestore } : { secret }; this.restore = Function("o", restoreTmpl(resetters, paths, hasWildcards)).bind(state); }; } function resetTmpl(secret, paths) { return paths.map((path) => { const { circle, escPath, leadingBracket } = secret[path]; const delim = leadingBracket ? "" : "."; const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`; const clear = `secret[${escPath}].val = undefined`; return ` if (secret[${escPath}].val !== undefined) { try { ${reset} } catch (e) {} ${clear} } `; }).join(""); } function restoreTmpl(resetters, paths, hasWildcards) { const dynamicReset = hasWildcards === true ? ` const keys = Object.keys(secret) const len = keys.length for (var i = len - 1; i >= ${paths.length}; i--) { const k = keys[i] const o = secret[k] if (o.flat === true) this.groupRestore(o) else this.nestedRestore(o) secret[k] = null } ` : ""; return ` const secret = this.secret ${dynamicReset} ${resetters} return o `; } } }); // node_modules/fast-redact/lib/state.js var require_state = __commonJS({ "node_modules/fast-redact/lib/state.js"(exports2, module2) { "use strict"; module2.exports = state; function state(o) { const { secret, censor, compileRestore, serialize, groupRedact, nestedRedact, wildcards, wcLen } = o; const builder = [{ secret, censor, compileRestore }]; if (serialize !== false) builder.push({ serialize }); if (wcLen > 0) builder.push({ groupRedact, nestedRedact, wildcards, wcLen }); return Object.assign(...builder); } } }); // node_modules/fast-redact/index.js var require_fast_redact = __commonJS({ "node_modules/fast-redact/index.js"(exports2, module2) { "use strict"; var validator = require_validator(); var parse = require_parse(); var redactor = require_redactor(); var restorer = require_restorer(); var { groupRedact, nestedRedact } = require_modifiers(); var state = require_state(); var rx = require_rx(); var validate = validator(); var noop3 = (o) => o; noop3.restore = noop3; var DEFAULT_CENSOR = "[REDACTED]"; fastRedact.rx = rx; fastRedact.validator = validator; module2.exports = fastRedact; function fastRedact(opts = {}) { const paths = Array.from(new Set(opts.paths || [])); const serialize = "serialize" in opts ? opts.serialize === false ? opts.serialize : typeof opts.serialize === "function" ? opts.serialize : JSON.stringify : JSON.stringify; const remove = opts.remove; if (remove === true && serialize !== JSON.stringify) { throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify"); } const censor = remove === true ? void 0 : "censor" in opts ? opts.censor : DEFAULT_CENSOR; const isCensorFct = typeof censor === "function"; const censorFctTakesPath = isCensorFct && censor.length > 1; if (paths.length === 0) return serialize || noop3; validate({ paths, serialize, censor }); const { wildcards, wcLen, secret } = parse({ paths, censor }); const compileRestore = restorer({ secret, wcLen }); const strict = "strict" in opts ? opts.strict : true; return redactor({ secret, wcLen, serialize, strict, isCensorFct, censorFctTakesPath }, state({ secret, censor, compileRestore, serialize, groupRedact, nestedRedact, wildcards, wcLen })); } } }); // node_modules/pino/lib/symbols.js var require_symbols = __commonJS({ "node_modules/pino/lib/symbols.js"(exports2, module2) { "use strict"; var setLevelSym = Symbol("pino.setLevel"); var getLevelSym = Symbol("pino.getLevel"); var levelValSym = Symbol("pino.levelVal"); var useLevelLabelsSym = Symbol("pino.useLevelLabels"); var useOnlyCustomLevelsSym = Symbol("pino.useOnlyCustomLevels"); var mixinSym = Symbol("pino.mixin"); var lsCacheSym = Symbol("pino.lsCache"); var chindingsSym = Symbol("pino.chindings"); var asJsonSym = Symbol("pino.asJson"); var writeSym = Symbol("pino.write"); var redactFmtSym = Symbol("pino.redactFmt"); var timeSym = Symbol("pino.time"); var timeSliceIndexSym = Symbol("pino.timeSliceIndex"); var streamSym = Symbol("pino.stream"); var stringifySym = Symbol("pino.stringify"); var stringifySafeSym = Symbol("pino.stringifySafe"); var stringifiersSym = Symbol("pino.stringifiers"); var endSym = Symbol("pino.end"); var formatOptsSym = Symbol("pino.formatOpts"); var messageKeySym = Symbol("pino.messageKey"); var nestedKeySym = Symbol("pino.nestedKey"); var nestedKeyStrSym = Symbol("pino.nestedKeyStr"); var mixinMergeStrategySym = Symbol("pino.mixinMergeStrategy"); var wildcardFirstSym = Symbol("pino.wildcardFirst"); var serializersSym = Symbol.for("pino.serializers"); var formattersSym = Symbol.for("pino.formatters"); var hooksSym = Symbol.for("pino.hooks"); var needsMetadataGsym = Symbol.for("pino.metadata"); module2.exports = { setLevelSym, getLevelSym, levelValSym, useLevelLabelsSym, mixinSym, lsCacheSym, chindingsSym, asJsonSym, writeSym, serializersSym, redactFmtSym, timeSym, timeSliceIndexSym, streamSym, stringifySym, stringifySafeSym, stringifiersSym, endSym, formatOptsSym, messageKeySym, nestedKeySym, wildcardFirstSym, needsMetadataGsym, useOnlyCustomLevelsSym, formattersSym, hooksSym, nestedKeyStrSym, mixinMergeStrategySym }; } }); // node_modules/pino/lib/redaction.js var require_redaction = __commonJS({ "node_modules/pino/lib/redaction.js"(exports2, module2) { "use strict"; var fastRedact = require_fast_redact(); var { redactFmtSym, wildcardFirstSym } = require_symbols(); var { rx, validator } = fastRedact; var validate = validator({ ERR_PATHS_MUST_BE_STRINGS: () => "pino \u2013 redacted paths must be strings", ERR_INVALID_PATH: (s) => `pino \u2013 redact paths array contains an invalid path (${s})` }); var CENSOR = "[Redacted]"; var strict = false; function redaction(opts, serialize) { const { paths, censor } = handle(opts); const shape = paths.reduce((o, str) => { rx.lastIndex = 0; const first = rx.exec(str); const next = rx.exec(str); let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0]; if (ns === "*") { ns = wildcardFirstSym; } if (next === null) { o[ns] = null; return o; } if (o[ns] === null) { return o; } const { index } = next; const nextPath = `${str.substr(index, str.length - 1)}`; o[ns] = o[ns] || []; if (ns !== wildcardFirstSym && o[ns].length === 0) { o[ns].push(...o[wildcardFirstSym] || []); } if (ns === wildcardFirstSym) { Object.keys(o).forEach(function(k) { if (o[k]) { o[k].push(nextPath); } }); } o[ns].push(nextPath); return o; }, {}); const result = { [redactFmtSym]: fastRedact({ paths, censor, serialize, strict }) }; const topCensor = (...args) => { return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor); }; return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => { if (shape[k] === null) { o[k] = (value) => topCensor(value, [k]); } else { const wrappedCensor = typeof censor === "function" ? (value, path) => { return censor(value, [k, ...path]); } : censor; o[k] = fastRedact({ paths: shape[k], censor: wrappedCensor, serialize, strict }); } return o; }, result); } function handle(opts) { if (Array.isArray(opts)) { opts = { paths: opts, censor: CENSOR }; validate(opts); return opts; } let { paths, censor = CENSOR, remove } = opts; if (Array.isArray(paths) === false) { throw Error("pino \u2013 redact must contain an array of strings"); } if (remove === true) censor = void 0; validate({ paths, censor }); return { paths, censor }; } module2.exports = redaction; } }); // node_modules/pino/lib/time.js var require_time = __commonJS({ "node_modules/pino/lib/time.js"(exports2, module2) { "use strict"; var nullTime = () => ""; var epochTime = () => `,"time":${Date.now()}`; var unixTime = () => `,"time":${Math.round(Date.now() / 1e3)}`; var isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"`; module2.exports = { nullTime, epochTime, unixTime, isoTime }; } }); // node_modules/quick-format-unescaped/index.js var require_quick_format_unescaped = __commonJS({ "node_modules/quick-format-unescaped/index.js"(exports2, module2) { "use strict"; function tryStringify(o) { try { return JSON.stringify(o); } catch (e) { return '"[Circular]"'; } } module2.exports = format; function format(f, args, opts) { var ss = opts && opts.stringify || tryStringify; var offset = 1; if (typeof f === "object" && f !== null) { var len = args.length + offset; if (len === 1) return f; var objects = new Array(len); objects[0] = ss(f); for (var index = 1; index < len; index++) { objects[index] = ss(args[index]); } return objects.join(" "); } if (typeof f !== "string") { return f; } var argLen = args.length; if (argLen === 0) return f; var str = ""; var a = 1 - offset; var lastPos = -1; var flen = f && f.length || 0; for (var i = 0; i < flen; ) { if (f.charCodeAt(i) === 37 && i + 1 < flen) { lastPos = lastPos > -1 ? lastPos : 0; switch (f.charCodeAt(i + 1)) { case 100: case 102: if (a >= argLen) break; if (args[a] == null) break; if (lastPos < i) str += f.slice(lastPos, i); str += Number(args[a]); lastPos = i + 2; i++; break; case 105: if (a >= argLen) break; if (args[a] == null) break; if (lastPos < i) str += f.slice(lastPos, i); str += Math.floor(Number(args[a])); lastPos = i + 2; i++; break; case 79: case 111: case 106: if (a >= argLen) break; if (args[a] === void 0) break; if (lastPos < i) str += f.slice(lastPos, i); var type2 = typeof args[a]; if (type2 === "string") { str += "'" + args[a] + "'"; lastPos = i + 2; i++; break; } if (type2 === "function") { str += args[a].name || "<anonymous>"; lastPos = i + 2; i++; break; } str += ss(args[a]); lastPos = i + 2; i++; break; case 115: if (a >= argLen) break; if (lastPos < i) str += f.slice(lastPos, i); str += String(args[a]); lastPos = i + 2; i++; break; case 37: if (lastPos < i) str += f.slice(lastPos, i); str += "%"; lastPos = i + 2; i++; a--; break; } ++a; } ++i; } if (lastPos === -1) return f; else if (lastPos < flen) { str += f.slice(lastPos); } return str; } } }); // node_modules/atomic-sleep/index.js var require_atomic_sleep = __commonJS({ "node_modules/atomic-sleep/index.js"(exports2, module2) { "use strict"; if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") { let sleep = function(ms) { const valid = ms > 0 && ms < Infinity; if (valid === false) { if (typeof ms !== "number" && typeof ms !== "bigint") { throw TypeError("sleep: ms must be a number"); } throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity"); } Atomics.wait(nil, 0, 0, Number(ms)); }; const nil = new Int32Array(new SharedArrayBuffer(4)); module2.exports = sleep; } else { let sleep = function(ms) { const valid = ms > 0 && ms < Infinity; if (valid === false) { if (typeof ms !== "number" && typeof ms !== "bigint") { throw TypeError("sleep: ms must be a number"); } throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity"); } const target = Date.now() + Number(ms); while (target > Date.now()) { } }; module2.exports = sleep; } } }); // node_modules/sonic-boom/index.js var require_sonic_boom = __commonJS({ "node_modules/sonic-boom/index.js"(exports2, module2) { "use strict"; var fs = require("fs"); var EventEmitter2 = require("events"); var inherits = require("util").inherits; var path = require("path"); var sleep = require_atomic_sleep(); var BUSY_WRITE_TIMEOUT = 100; var MAX_WRITE = 16 * 1024; function openFile(file, sonic) { sonic._opening = true; sonic._writing = true; sonic._asyncDrainScheduled = false; function fileOpened(err, fd) { if (err) { sonic._reopening = false; sonic._writing = false; sonic._opening = false; if (sonic.sync) { process.nextTick(() => { if (sonic.listenerCount("error") > 0) { sonic.emit("error", err); } }); } else { sonic.emit("error", err); } return; } sonic.fd = fd; sonic.file = file; sonic._reopening = false; sonic._opening = false; sonic._writing = false; if (sonic.sync) { process.nextTick(() => sonic.emit("ready")); } else { sonic.emit("ready"); } if (sonic._reopening) { return; } if (!sonic._writing && sonic._len > sonic.minLength && !sonic.destroyed) { actualWrite(sonic); } } const flags = sonic.append ? "a" : "w"; const mode = sonic.mode; if (sonic.sync) { try { if (sonic.mkdir) fs.mkdirSync(path.dirname(file), { recursive: true }); const fd = fs.openSync(file, flags, mode); fileOpened(null, fd); } catch (err) { fileOpened(err); throw err; } } else if (sonic.mkdir) { fs.mkdir(path.dirname(file), { recursive: true }, (err) => { if (err) return fileOpened(err); fs.open(file, flags, mode, fileOpened); }); } else { fs.open(file, flags, mode, fileOpened); } } function SonicBoom(opts) { if (!(this instanceof SonicBoom)) { return new SonicBoom(opts); } let { fd, dest, minLength, maxLength, maxWrite, sync, append = true, mode, mkdir, retryEAGAIN } = opts || {}; fd = fd || dest; this._bufs = []; this._len = 0; this.fd = -1; this._writing = false; this._writingBuf = ""; this._ending = false; this._reopening = false; this._asyncDrainScheduled = false; this._hwm = Math.max(minLength || 0, 16387); this.file = null; this.destroyed = false; this.minLength = minLength || 0; this.maxLength = maxLength || 0; this.maxWrite = maxWrite || MAX_WRITE; this.sync = sync || false; this.append = append || false; this.mode = mode; this.retryEAGAIN = retryEAGAIN || (() => true); this.mkdir = mkdir || false; if (typeof fd === "number") { this.fd = fd; process.nextTick(() => this.emit("ready")); } else if (typeof fd === "string") { openFile(fd, this); } else { throw new Error("SonicBoom supports only file descriptors and files"); } if (this.minLength >= this.maxWrite) { throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`); } this.release = (err, n) => { if (err) { if (err.code === "EAGAIN" && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) { if (this.sync) { try { sleep(BUSY_WRITE_TIMEOUT); this.release(void 0, 0); } catch (err2) { this.release(err2); } } else { setTimeout(() => { fs.write(this.fd, this._writingBuf, "utf8", this.release); }, BUSY_WRITE_TIMEOUT); } } else { this._writing = false; this.emit("error", err); } return; } this.emit("write", n); this._len -= n; this._writingBuf = this._writingBuf.slice(n); if (this._writingBuf.length) { if (!this.sync) { fs.write(this.fd, this._writingBuf, "utf8", this.release); return; } try { do { const n2 = fs.writeSync(this.fd, this._writingBuf, "utf8"); this._len -= n2; this._writingBuf = this._writingBuf.slice(n2); } while (this._writingBuf); } catch (err2) { this.release(err2); return; } } const len = this._len; if (this._reopening) { this._writing = false; this._reopening = false; this.reopen(); } else if (len > this.minLength) { actualWrite(this); } else if (this._ending) { if (len > 0) { actualWrite(this); } else { this._writing = false; actualClose(this); } } else { this._writing = false; if (this.sync) { if (!this._asyncDrainScheduled) { this._asyncDrainScheduled = true; process.nextTick(emitDrain, this); } } else { this.emit("drain"); } } }; this.on("newListener", function(name2) { if (name2 === "drain") { this._asyncDrainScheduled = false; } }); } function emitDrain(sonic) { const hasListeners = sonic.listenerCount("drain") > 0; if (!hasListeners) return; sonic._asyncDrainScheduled = false; sonic.emit("drain"); } inherits(SonicBoom, EventEmitter2); SonicBoom.prototype.write = function(data) { if (this.destroyed) { throw new Error("SonicBoom destroyed"); } const len = this._len + data.length; const bufs = this._bufs; if (this.maxLength && len > this.maxLength) { this.emit("drop", data); return this._len < this._hwm; } if (bufs.length === 0 || bufs[bufs.length - 1].length + data.length > this.maxWrite) { bufs.push("" + data); } else { bufs[bufs.length - 1] += data; } this._len = len; if (!this._writing && this._len >= this.minLength) { actualWrite(this); } return this._len < this._hwm; }; SonicBoom.prototype.flush = function() { if (this.destroyed) { throw new Error("SonicBoom destroyed"); } if (this._writing || this.minLength <= 0) { return; } if (this._bufs.length === 0) { this._bufs.push(""); } actualWrite(this); }; SonicBoom.prototype.reopen = function(file) { if (this.destroyed) { throw new Error("SonicBoom destroyed"); } if (this._opening) { this.once("ready", () => { this.reopen(file); }); return; } if (this._ending) { return; } if (!this.file) { throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom"); } this._reopening = true; if (this._writing) { return; } const fd = this.fd; this.once("ready", () => { if (fd !== this.fd) { fs.close(fd, (err) => { if (err) { return this.emit("error", err); } }); } }); openFile(file || this.file, this); }; SonicBoom.prototype.end = function() { if (this.destroyed) { throw new Error("SonicBoom destroyed"); } if (this._opening) { this.once("ready", () => { this.end();