diff --git "a/artifacts/api-server/dist/pino-worker.mjs" "b/artifacts/api-server/dist/pino-worker.mjs" new file mode 100644--- /dev/null +++ "b/artifacts/api-server/dist/pino-worker.mjs" @@ -0,0 +1,4706 @@ +import { createRequire as __bannerCrReq } from 'node:module'; +import __bannerPath from 'node:path'; +import __bannerUrl from 'node:url'; + +globalThis.require = __bannerCrReq(import.meta.url); +globalThis.__filename = __bannerUrl.fileURLToPath(import.meta.url); +globalThis.__dirname = __bannerPath.dirname(globalThis.__filename); + +var __getOwnPropNames = Object.getOwnPropertyNames; +var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { + get: (a, b) => (typeof require !== "undefined" ? require : a)[b] +}) : x)(function(x) { + if (typeof require !== "undefined") return require.apply(this, arguments); + throw Error('Dynamic require of "' + x + '" is not supported'); +}); +var __commonJS = (cb, mod) => function __require2() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; + +// ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-helpers.js +var require_err_helpers = __commonJS({ + "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-helpers.js"(exports, module) { + "use strict"; + var isErrorLike = (err) => { + return err && typeof err.message === "string"; + }; + var getErrorCause = (err) => { + if (!err) return; + const cause = err.cause; + if (typeof cause === "function") { + const causeResult = err.cause(); + return isErrorLike(causeResult) ? causeResult : void 0; + } else { + return isErrorLike(cause) ? cause : void 0; + } + }; + var _stackWithCauses = (err, seen) => { + if (!isErrorLike(err)) 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 (!isErrorLike(err)) 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()); + module.exports = { + isErrorLike, + getErrorCause, + stackWithCauses, + messageWithCauses + }; + } +}); + +// ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-proto.js +var require_err_proto = __commonJS({ + "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-proto.js"(exports, module) { + "use strict"; + var seen = /* @__PURE__ */ Symbol("circular-ref-tag"); + var rawSymbol = /* @__PURE__ */ 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: {} + }); + module.exports = { + pinoErrProto, + pinoErrorSymbols: { + seen, + rawSymbol + } + }; + } +}); + +// ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err.js +var require_err = __commonJS({ + "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err.js"(exports, module) { + "use strict"; + module.exports = errSerializer; + var { messageWithCauses, stackWithCauses, isErrorLike } = require_err_helpers(); + var { pinoErrProto, pinoErrorSymbols } = require_err_proto(); + var { seen } = pinoErrorSymbols; + var { toString } = Object.prototype; + function errSerializer(err) { + if (!isErrorLike(err)) { + 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 (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 (isErrorLike(val)) { + if (key !== "cause" && !Object.prototype.hasOwnProperty.call(val, seen)) { + _err[key] = errSerializer(val); + } + } else { + _err[key] = val; + } + } + } + delete err[seen]; + _err.raw = err; + return _err; + } + } +}); + +// ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-with-cause.js +var require_err_with_cause = __commonJS({ + "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-with-cause.js"(exports, module) { + "use strict"; + module.exports = errWithCauseSerializer; + var { isErrorLike } = require_err_helpers(); + var { pinoErrProto, pinoErrorSymbols } = require_err_proto(); + var { seen } = pinoErrorSymbols; + var { toString } = Object.prototype; + function errWithCauseSerializer(err) { + if (!isErrorLike(err)) { + 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 = err.message; + _err.stack = err.stack; + if (Array.isArray(err.errors)) { + _err.aggregateErrors = err.errors.map((err2) => errWithCauseSerializer(err2)); + } + if (isErrorLike(err.cause) && !Object.prototype.hasOwnProperty.call(err.cause, seen)) { + _err.cause = errWithCauseSerializer(err.cause); + } + for (const key in err) { + if (_err[key] === void 0) { + const val = err[key]; + if (isErrorLike(val)) { + if (!Object.prototype.hasOwnProperty.call(val, seen)) { + _err[key] = errWithCauseSerializer(val); + } + } else { + _err[key] = val; + } + } + } + delete err[seen]; + _err.raw = err; + return _err; + } + } +}); + +// ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/req.js +var require_req = __commonJS({ + "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/req.js"(exports, module) { + "use strict"; + module.exports = { + mapHttpRequest, + reqSerializer + }; + var rawSymbol = /* @__PURE__ */ 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/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/res.js +var require_res = __commonJS({ + "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/res.js"(exports, module) { + "use strict"; + module.exports = { + mapHttpResponse, + resSerializer + }; + var rawSymbol = /* @__PURE__ */ 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/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/index.js +var require_pino_std_serializers = __commonJS({ + "../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/index.js"(exports, module) { + "use strict"; + var errSerializer = require_err(); + var errWithCauseSerializer = require_err_with_cause(); + var reqSerializers = require_req(); + var resSerializers = require_res(); + module.exports = { + err: errSerializer, + errWithCause: errWithCauseSerializer, + 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/.pnpm/pino@9.14.0/node_modules/pino/lib/caller.js +var require_caller = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/caller.js"(exports, module) { + "use strict"; + function noOpPrepareStackTrace(_, stack) { + return stack; + } + module.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/.pnpm/@pinojs+redact@0.4.0/node_modules/@pinojs/redact/index.js +var require_redact = __commonJS({ + "../../node_modules/.pnpm/@pinojs+redact@0.4.0/node_modules/@pinojs/redact/index.js"(exports, module) { + "use strict"; + function deepClone(obj) { + if (obj === null || typeof obj !== "object") { + return obj; + } + if (obj instanceof Date) { + return new Date(obj.getTime()); + } + if (obj instanceof Array) { + const cloned = []; + for (let i = 0; i < obj.length; i++) { + cloned[i] = deepClone(obj[i]); + } + return cloned; + } + if (typeof obj === "object") { + const cloned = Object.create(Object.getPrototypeOf(obj)); + for (const key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + cloned[key] = deepClone(obj[key]); + } + } + return cloned; + } + return obj; + } + function parsePath(path) { + const parts = []; + let current = ""; + let inBrackets = false; + let inQuotes = false; + let quoteChar = ""; + for (let i = 0; i < path.length; i++) { + const char = path[i]; + if (!inBrackets && char === ".") { + if (current) { + parts.push(current); + current = ""; + } + } else if (char === "[") { + if (current) { + parts.push(current); + current = ""; + } + inBrackets = true; + } else if (char === "]" && inBrackets) { + parts.push(current); + current = ""; + inBrackets = false; + inQuotes = false; + } else if ((char === '"' || char === "'") && inBrackets) { + if (!inQuotes) { + inQuotes = true; + quoteChar = char; + } else if (char === quoteChar) { + inQuotes = false; + quoteChar = ""; + } else { + current += char; + } + } else { + current += char; + } + } + if (current) { + parts.push(current); + } + return parts; + } + function setValue(obj, parts, value) { + let current = obj; + for (let i = 0; i < parts.length - 1; i++) { + const key = parts[i]; + if (typeof current !== "object" || current === null || !(key in current)) { + return false; + } + if (typeof current[key] !== "object" || current[key] === null) { + return false; + } + current = current[key]; + } + const lastKey = parts[parts.length - 1]; + if (lastKey === "*") { + if (Array.isArray(current)) { + for (let i = 0; i < current.length; i++) { + current[i] = value; + } + } else if (typeof current === "object" && current !== null) { + for (const key in current) { + if (Object.prototype.hasOwnProperty.call(current, key)) { + current[key] = value; + } + } + } + } else { + if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) { + current[lastKey] = value; + } + } + return true; + } + function removeKey(obj, parts) { + let current = obj; + for (let i = 0; i < parts.length - 1; i++) { + const key = parts[i]; + if (typeof current !== "object" || current === null || !(key in current)) { + return false; + } + if (typeof current[key] !== "object" || current[key] === null) { + return false; + } + current = current[key]; + } + const lastKey = parts[parts.length - 1]; + if (lastKey === "*") { + if (Array.isArray(current)) { + for (let i = 0; i < current.length; i++) { + current[i] = void 0; + } + } else if (typeof current === "object" && current !== null) { + for (const key in current) { + if (Object.prototype.hasOwnProperty.call(current, key)) { + delete current[key]; + } + } + } + } else { + if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) { + delete current[lastKey]; + } + } + return true; + } + var PATH_NOT_FOUND = /* @__PURE__ */ Symbol("PATH_NOT_FOUND"); + function getValueIfExists(obj, parts) { + let current = obj; + for (const part of parts) { + if (current === null || current === void 0) { + return PATH_NOT_FOUND; + } + if (typeof current !== "object" || current === null) { + return PATH_NOT_FOUND; + } + if (!(part in current)) { + return PATH_NOT_FOUND; + } + current = current[part]; + } + return current; + } + function getValue(obj, parts) { + let current = obj; + for (const part of parts) { + if (current === null || current === void 0) { + return void 0; + } + if (typeof current !== "object" || current === null) { + return void 0; + } + current = current[part]; + } + return current; + } + function redactPaths(obj, paths, censor, remove = false) { + for (const path of paths) { + const parts = parsePath(path); + if (parts.includes("*")) { + redactWildcardPath(obj, parts, censor, path, remove); + } else { + if (remove) { + removeKey(obj, parts); + } else { + const value = getValueIfExists(obj, parts); + if (value === PATH_NOT_FOUND) { + continue; + } + const actualCensor = typeof censor === "function" ? censor(value, parts) : censor; + setValue(obj, parts, actualCensor); + } + } + } + } + function redactWildcardPath(obj, parts, censor, originalPath, remove = false) { + const wildcardIndex = parts.indexOf("*"); + if (wildcardIndex === parts.length - 1) { + const parentParts = parts.slice(0, -1); + let current = obj; + for (const part of parentParts) { + if (current === null || current === void 0) return; + if (typeof current !== "object" || current === null) return; + current = current[part]; + } + if (Array.isArray(current)) { + if (remove) { + for (let i = 0; i < current.length; i++) { + current[i] = void 0; + } + } else { + for (let i = 0; i < current.length; i++) { + const indexPath = [...parentParts, i.toString()]; + const actualCensor = typeof censor === "function" ? censor(current[i], indexPath) : censor; + current[i] = actualCensor; + } + } + } else if (typeof current === "object" && current !== null) { + if (remove) { + const keysToDelete = []; + for (const key in current) { + if (Object.prototype.hasOwnProperty.call(current, key)) { + keysToDelete.push(key); + } + } + for (const key of keysToDelete) { + delete current[key]; + } + } else { + for (const key in current) { + const keyPath = [...parentParts, key]; + const actualCensor = typeof censor === "function" ? censor(current[key], keyPath) : censor; + current[key] = actualCensor; + } + } + } + } else { + redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove); + } + } + function redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove = false) { + const beforeWildcard = parts.slice(0, wildcardIndex); + const afterWildcard = parts.slice(wildcardIndex + 1); + const pathArray = []; + function traverse(current, pathLength) { + if (pathLength === beforeWildcard.length) { + if (Array.isArray(current)) { + for (let i = 0; i < current.length; i++) { + pathArray[pathLength] = i.toString(); + traverse(current[i], pathLength + 1); + } + } else if (typeof current === "object" && current !== null) { + for (const key in current) { + pathArray[pathLength] = key; + traverse(current[key], pathLength + 1); + } + } + } else if (pathLength < beforeWildcard.length) { + const nextKey = beforeWildcard[pathLength]; + if (current && typeof current === "object" && current !== null && nextKey in current) { + pathArray[pathLength] = nextKey; + traverse(current[nextKey], pathLength + 1); + } + } else { + if (afterWildcard.includes("*")) { + const wrappedCensor = typeof censor === "function" ? (value, path) => { + const fullPath = [...pathArray.slice(0, pathLength), ...path]; + return censor(value, fullPath); + } : censor; + redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove); + } else { + if (remove) { + removeKey(current, afterWildcard); + } else { + const actualCensor = typeof censor === "function" ? censor(getValue(current, afterWildcard), [...pathArray.slice(0, pathLength), ...afterWildcard]) : censor; + setValue(current, afterWildcard, actualCensor); + } + } + } + } + if (beforeWildcard.length === 0) { + traverse(obj, 0); + } else { + let current = obj; + for (let i = 0; i < beforeWildcard.length; i++) { + const part = beforeWildcard[i]; + if (current === null || current === void 0) return; + if (typeof current !== "object" || current === null) return; + current = current[part]; + pathArray[i] = part; + } + if (current !== null && current !== void 0) { + traverse(current, beforeWildcard.length); + } + } + } + function buildPathStructure(pathsToClone) { + if (pathsToClone.length === 0) { + return null; + } + const pathStructure = /* @__PURE__ */ new Map(); + for (const path of pathsToClone) { + const parts = parsePath(path); + let current = pathStructure; + for (let i = 0; i < parts.length; i++) { + const part = parts[i]; + if (!current.has(part)) { + current.set(part, /* @__PURE__ */ new Map()); + } + current = current.get(part); + } + } + return pathStructure; + } + function selectiveClone(obj, pathStructure) { + if (!pathStructure) { + return obj; + } + function cloneSelectively(source, pathMap, depth = 0) { + if (!pathMap || pathMap.size === 0) { + return source; + } + if (source === null || typeof source !== "object") { + return source; + } + if (source instanceof Date) { + return new Date(source.getTime()); + } + if (Array.isArray(source)) { + const cloned2 = []; + for (let i = 0; i < source.length; i++) { + const indexStr = i.toString(); + if (pathMap.has(indexStr) || pathMap.has("*")) { + cloned2[i] = cloneSelectively(source[i], pathMap.get(indexStr) || pathMap.get("*")); + } else { + cloned2[i] = source[i]; + } + } + return cloned2; + } + const cloned = Object.create(Object.getPrototypeOf(source)); + for (const key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + if (pathMap.has(key) || pathMap.has("*")) { + cloned[key] = cloneSelectively(source[key], pathMap.get(key) || pathMap.get("*")); + } else { + cloned[key] = source[key]; + } + } + } + return cloned; + } + return cloneSelectively(obj, pathStructure); + } + function validatePath(path) { + if (typeof path !== "string") { + throw new Error("Paths must be (non-empty) strings"); + } + if (path === "") { + throw new Error("Invalid redaction path ()"); + } + if (path.includes("..")) { + throw new Error(`Invalid redaction path (${path})`); + } + if (path.includes(",")) { + throw new Error(`Invalid redaction path (${path})`); + } + let bracketCount = 0; + let inQuotes = false; + let quoteChar = ""; + for (let i = 0; i < path.length; i++) { + const char = path[i]; + if ((char === '"' || char === "'") && bracketCount > 0) { + if (!inQuotes) { + inQuotes = true; + quoteChar = char; + } else if (char === quoteChar) { + inQuotes = false; + quoteChar = ""; + } + } else if (char === "[" && !inQuotes) { + bracketCount++; + } else if (char === "]" && !inQuotes) { + bracketCount--; + if (bracketCount < 0) { + throw new Error(`Invalid redaction path (${path})`); + } + } + } + if (bracketCount !== 0) { + throw new Error(`Invalid redaction path (${path})`); + } + } + function validatePaths(paths) { + if (!Array.isArray(paths)) { + throw new TypeError("paths must be an array"); + } + for (const path of paths) { + validatePath(path); + } + } + function slowRedact(options = {}) { + const { + paths = [], + censor = "[REDACTED]", + serialize = JSON.stringify, + strict = true, + remove = false + } = options; + validatePaths(paths); + const pathStructure = buildPathStructure(paths); + return function redact(obj) { + if (strict && (obj === null || typeof obj !== "object")) { + if (obj === null || obj === void 0) { + return serialize ? serialize(obj) : obj; + } + if (typeof obj !== "object") { + return serialize ? serialize(obj) : obj; + } + } + const cloned = selectiveClone(obj, pathStructure); + const original = obj; + let actualCensor = censor; + if (typeof censor === "function") { + actualCensor = censor; + } + redactPaths(cloned, paths, actualCensor, remove); + if (serialize === false) { + cloned.restore = function() { + return deepClone(original); + }; + return cloned; + } + if (typeof serialize === "function") { + return serialize(cloned); + } + return JSON.stringify(cloned); + }; + } + module.exports = slowRedact; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/symbols.js +var require_symbols = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/symbols.js"(exports, module) { + "use strict"; + var setLevelSym = /* @__PURE__ */ Symbol("pino.setLevel"); + var getLevelSym = /* @__PURE__ */ Symbol("pino.getLevel"); + var levelValSym = /* @__PURE__ */ Symbol("pino.levelVal"); + var levelCompSym = /* @__PURE__ */ Symbol("pino.levelComp"); + var useLevelLabelsSym = /* @__PURE__ */ Symbol("pino.useLevelLabels"); + var useOnlyCustomLevelsSym = /* @__PURE__ */ Symbol("pino.useOnlyCustomLevels"); + var mixinSym = /* @__PURE__ */ Symbol("pino.mixin"); + var lsCacheSym = /* @__PURE__ */ Symbol("pino.lsCache"); + var chindingsSym = /* @__PURE__ */ Symbol("pino.chindings"); + var asJsonSym = /* @__PURE__ */ Symbol("pino.asJson"); + var writeSym = /* @__PURE__ */ Symbol("pino.write"); + var redactFmtSym = /* @__PURE__ */ Symbol("pino.redactFmt"); + var timeSym = /* @__PURE__ */ Symbol("pino.time"); + var timeSliceIndexSym = /* @__PURE__ */ Symbol("pino.timeSliceIndex"); + var streamSym = /* @__PURE__ */ Symbol("pino.stream"); + var stringifySym = /* @__PURE__ */ Symbol("pino.stringify"); + var stringifySafeSym = /* @__PURE__ */ Symbol("pino.stringifySafe"); + var stringifiersSym = /* @__PURE__ */ Symbol("pino.stringifiers"); + var endSym = /* @__PURE__ */ Symbol("pino.end"); + var formatOptsSym = /* @__PURE__ */ Symbol("pino.formatOpts"); + var messageKeySym = /* @__PURE__ */ Symbol("pino.messageKey"); + var errorKeySym = /* @__PURE__ */ Symbol("pino.errorKey"); + var nestedKeySym = /* @__PURE__ */ Symbol("pino.nestedKey"); + var nestedKeyStrSym = /* @__PURE__ */ Symbol("pino.nestedKeyStr"); + var mixinMergeStrategySym = /* @__PURE__ */ Symbol("pino.mixinMergeStrategy"); + var msgPrefixSym = /* @__PURE__ */ Symbol("pino.msgPrefix"); + var wildcardFirstSym = /* @__PURE__ */ Symbol("pino.wildcardFirst"); + var serializersSym = /* @__PURE__ */ Symbol.for("pino.serializers"); + var formattersSym = /* @__PURE__ */ Symbol.for("pino.formatters"); + var hooksSym = /* @__PURE__ */ Symbol.for("pino.hooks"); + var needsMetadataGsym = /* @__PURE__ */ Symbol.for("pino.metadata"); + module.exports = { + setLevelSym, + getLevelSym, + levelValSym, + levelCompSym, + useLevelLabelsSym, + mixinSym, + lsCacheSym, + chindingsSym, + asJsonSym, + writeSym, + serializersSym, + redactFmtSym, + timeSym, + timeSliceIndexSym, + streamSym, + stringifySym, + stringifySafeSym, + stringifiersSym, + endSym, + formatOptsSym, + messageKeySym, + errorKeySym, + nestedKeySym, + wildcardFirstSym, + needsMetadataGsym, + useOnlyCustomLevelsSym, + formattersSym, + hooksSym, + nestedKeyStrSym, + mixinMergeStrategySym, + msgPrefixSym + }; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/redaction.js +var require_redaction = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/redaction.js"(exports, module) { + "use strict"; + var Redact = require_redact(); + var { redactFmtSym, wildcardFirstSym } = require_symbols(); + var rx = /[^.[\]]+|\[([^[\]]*?)\]/g; + var CENSOR = "[Redacted]"; + var strict = false; + function redaction(opts, serialize) { + const { paths, censor, remove } = 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]: Redact({ paths, censor, serialize, strict, remove }) + }; + 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] = Redact({ + paths: shape[k], + censor: wrappedCensor, + serialize, + strict, + remove + }); + } + return o; + }, result); + } + function handle(opts) { + if (Array.isArray(opts)) { + opts = { paths: opts, censor: CENSOR }; + 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; + return { paths, censor, remove }; + } + module.exports = redaction; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/time.js +var require_time = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/time.js"(exports, module) { + "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()}"`; + var NS_PER_MS = 1000000n; + var NS_PER_SEC = 1000000000n; + var startWallTimeNs = BigInt(Date.now()) * NS_PER_MS; + var startHrTime = process.hrtime.bigint(); + var isoTimeNano = () => { + const elapsedNs = process.hrtime.bigint() - startHrTime; + const currentTimeNs = startWallTimeNs + elapsedNs; + const secondsSinceEpoch = currentTimeNs / NS_PER_SEC; + const nanosWithinSecond = currentTimeNs % NS_PER_SEC; + const msSinceEpoch = Number(secondsSinceEpoch * 1000n + nanosWithinSecond / 1000000n); + const date = new Date(msSinceEpoch); + const year = date.getUTCFullYear(); + const month = (date.getUTCMonth() + 1).toString().padStart(2, "0"); + const day = date.getUTCDate().toString().padStart(2, "0"); + const hours = date.getUTCHours().toString().padStart(2, "0"); + const minutes = date.getUTCMinutes().toString().padStart(2, "0"); + const seconds = date.getUTCSeconds().toString().padStart(2, "0"); + return `,"time":"${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${nanosWithinSecond.toString().padStart(9, "0")}Z"`; + }; + module.exports = { nullTime, epochTime, unixTime, isoTime, isoTimeNano }; + } +}); + +// ../../node_modules/.pnpm/quick-format-unescaped@4.0.4/node_modules/quick-format-unescaped/index.js +var require_quick_format_unescaped = __commonJS({ + "../../node_modules/.pnpm/quick-format-unescaped@4.0.4/node_modules/quick-format-unescaped/index.js"(exports, module) { + "use strict"; + function tryStringify(o) { + try { + return JSON.stringify(o); + } catch (e) { + return '"[Circular]"'; + } + } + module.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: + // 'd' + 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: + // 'O' + case 111: + // 'o' + case 106: + if (a >= argLen) + break; + if (args[a] === void 0) break; + if (lastPos < i) + str += f.slice(lastPos, i); + var type = typeof args[a]; + if (type === "string") { + str += "'" + args[a] + "'"; + lastPos = i + 2; + i++; + break; + } + if (type === "function") { + str += args[a].name || ""; + 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/.pnpm/atomic-sleep@1.0.0/node_modules/atomic-sleep/index.js +var require_atomic_sleep = __commonJS({ + "../../node_modules/.pnpm/atomic-sleep@1.0.0/node_modules/atomic-sleep/index.js"(exports, module) { + "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)); + module.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()) { + } + }; + module.exports = sleep; + } + } +}); + +// ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js +var require_sonic_boom = __commonJS({ + "../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js"(exports, module) { + "use strict"; + var fs = __require("fs"); + var EventEmitter = __require("events"); + var inherits = __require("util").inherits; + var path = __require("path"); + var sleep = require_atomic_sleep(); + var assert = __require("assert"); + var BUSY_WRITE_TIMEOUT = 100; + var kEmptyBuffer = Buffer.allocUnsafe(0); + var MAX_WRITE = 16 * 1024; + var kContentModeBuffer = "buffer"; + var kContentModeUtf8 = "utf8"; + var [major, minor] = (process.versions.node || "0.0").split(".").map(Number); + var kCopyBuffer = major >= 22 && minor >= 7; + 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; + } + const reopening = sonic._reopening; + 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.destroyed) { + return; + } + if (!sonic._writing && sonic._len > sonic.minLength || sonic._flushPending) { + sonic._actualWrite(); + } else if (reopening) { + process.nextTick(() => sonic.emit("drain")); + } + } + 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, periodicFlush, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {}; + fd = fd || dest; + this._len = 0; + this.fd = -1; + this._bufs = []; + this._lens = []; + this._writing = false; + this._ending = false; + this._reopening = false; + this._asyncDrainScheduled = false; + this._flushPending = 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._periodicFlush = periodicFlush || 0; + this._periodicFlushTimer = void 0; + this.sync = sync || false; + this.writable = true; + this._fsync = fsync || false; + this.append = append || false; + this.mode = mode; + this.retryEAGAIN = retryEAGAIN || (() => true); + this.mkdir = mkdir || false; + let fsWriteSync; + let fsWrite; + if (contentMode === kContentModeBuffer) { + this._writingBuf = kEmptyBuffer; + this.write = writeBuffer; + this.flush = flushBuffer; + this.flushSync = flushBufferSync; + this._actualWrite = actualWriteBuffer; + fsWriteSync = () => fs.writeSync(this.fd, this._writingBuf); + fsWrite = () => fs.write(this.fd, this._writingBuf, this.release); + } else if (contentMode === void 0 || contentMode === kContentModeUtf8) { + this._writingBuf = ""; + this.write = write; + this.flush = flush; + this.flushSync = flushSync; + this._actualWrite = actualWrite; + fsWriteSync = () => { + if (Buffer.isBuffer(this._writingBuf)) { + return fs.writeSync(this.fd, this._writingBuf); + } + return fs.writeSync(this.fd, this._writingBuf, "utf8"); + }; + fsWrite = () => { + if (Buffer.isBuffer(this._writingBuf)) { + return fs.write(this.fd, this._writingBuf, this.release); + } + return fs.write(this.fd, this._writingBuf, "utf8", this.release); + }; + } else { + throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`); + } + 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" || err.code === "EBUSY") && 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(fsWrite, BUSY_WRITE_TIMEOUT); + } + } else { + this._writing = false; + this.emit("error", err); + } + return; + } + this.emit("write", n); + const releasedBufObj = releaseWritingBuf(this._writingBuf, this._len, n); + this._len = releasedBufObj.len; + this._writingBuf = releasedBufObj.writingBuf; + if (this._writingBuf.length) { + if (!this.sync) { + fsWrite(); + return; + } + try { + do { + const n2 = fsWriteSync(); + const releasedBufObj2 = releaseWritingBuf(this._writingBuf, this._len, n2); + this._len = releasedBufObj2.len; + this._writingBuf = releasedBufObj2.writingBuf; + } while (this._writingBuf.length); + } catch (err2) { + this.release(err2); + return; + } + } + if (this._fsync) { + fs.fsyncSync(this.fd); + } + const len = this._len; + if (this._reopening) { + this._writing = false; + this._reopening = false; + this.reopen(); + } else if (len > this.minLength) { + this._actualWrite(); + } else if (this._ending) { + if (len > 0) { + this._actualWrite(); + } 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(name) { + if (name === "drain") { + this._asyncDrainScheduled = false; + } + }); + if (this._periodicFlush !== 0) { + this._periodicFlushTimer = setInterval(() => this.flush(null), this._periodicFlush); + this._periodicFlushTimer.unref(); + } + } + function releaseWritingBuf(writingBuf, len, n) { + if (typeof writingBuf === "string") { + writingBuf = Buffer.from(writingBuf); + } + len = Math.max(len - n, 0); + writingBuf = writingBuf.subarray(n); + return { writingBuf, len }; + } + function emitDrain(sonic) { + const hasListeners = sonic.listenerCount("drain") > 0; + if (!hasListeners) return; + sonic._asyncDrainScheduled = false; + sonic.emit("drain"); + } + inherits(SonicBoom, EventEmitter); + function mergeBuf(bufs, len) { + if (bufs.length === 0) { + return kEmptyBuffer; + } + if (bufs.length === 1) { + return bufs[0]; + } + return Buffer.concat(bufs, len); + } + function write(data) { + if (this.destroyed) { + throw new Error("SonicBoom destroyed"); + } + data = "" + data; + const dataLen = Buffer.byteLength(data); + const len = this._len + dataLen; + const bufs = this._bufs; + if (this.maxLength && len > this.maxLength) { + this.emit("drop", data); + return this._len < this._hwm; + } + if (bufs.length === 0 || Buffer.byteLength(bufs[bufs.length - 1]) + dataLen > this.maxWrite) { + bufs.push(data); + } else { + bufs[bufs.length - 1] += data; + } + this._len = len; + if (!this._writing && this._len >= this.minLength) { + this._actualWrite(); + } + return this._len < this._hwm; + } + function writeBuffer(data) { + if (this.destroyed) { + throw new Error("SonicBoom destroyed"); + } + const len = this._len + data.length; + const bufs = this._bufs; + const lens = this._lens; + if (this.maxLength && len > this.maxLength) { + this.emit("drop", data); + return this._len < this._hwm; + } + if (bufs.length === 0 || lens[lens.length - 1] + data.length > this.maxWrite) { + bufs.push([data]); + lens.push(data.length); + } else { + bufs[bufs.length - 1].push(data); + lens[lens.length - 1] += data.length; + } + this._len = len; + if (!this._writing && this._len >= this.minLength) { + this._actualWrite(); + } + return this._len < this._hwm; + } + function callFlushCallbackOnDrain(cb) { + this._flushPending = true; + const onDrain = () => { + if (!this._fsync) { + try { + fs.fsync(this.fd, (err) => { + this._flushPending = false; + cb(err); + }); + } catch (err) { + cb(err); + } + } else { + this._flushPending = false; + cb(); + } + this.off("error", onError); + }; + const onError = (err) => { + this._flushPending = false; + cb(err); + this.off("drain", onDrain); + }; + this.once("drain", onDrain); + this.once("error", onError); + } + function flush(cb) { + if (cb != null && typeof cb !== "function") { + throw new Error("flush cb must be a function"); + } + if (this.destroyed) { + const error = new Error("SonicBoom destroyed"); + if (cb) { + cb(error); + return; + } + throw error; + } + if (this.minLength <= 0) { + cb?.(); + return; + } + if (cb) { + callFlushCallbackOnDrain.call(this, cb); + } + if (this._writing) { + return; + } + if (this._bufs.length === 0) { + this._bufs.push(""); + } + this._actualWrite(); + } + function flushBuffer(cb) { + if (cb != null && typeof cb !== "function") { + throw new Error("flush cb must be a function"); + } + if (this.destroyed) { + const error = new Error("SonicBoom destroyed"); + if (cb) { + cb(error); + return; + } + throw error; + } + if (this.minLength <= 0) { + cb?.(); + return; + } + if (cb) { + callFlushCallbackOnDrain.call(this, cb); + } + if (this._writing) { + return; + } + if (this._bufs.length === 0) { + this._bufs.push([]); + this._lens.push(0); + } + this._actualWrite(); + } + 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"); + } + if (file) { + this.file = file; + } + 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(this.file, this); + }; + SonicBoom.prototype.end = function() { + if (this.destroyed) { + throw new Error("SonicBoom destroyed"); + } + if (this._opening) { + this.once("ready", () => { + this.end(); + }); + return; + } + if (this._ending) { + return; + } + this._ending = true; + if (this._writing) { + return; + } + if (this._len > 0 && this.fd >= 0) { + this._actualWrite(); + } else { + actualClose(this); + } + }; + function flushSync() { + if (this.destroyed) { + throw new Error("SonicBoom destroyed"); + } + if (this.fd < 0) { + throw new Error("sonic boom is not ready yet"); + } + if (!this._writing && this._writingBuf.length > 0) { + this._bufs.unshift(this._writingBuf); + this._writingBuf = ""; + } + let buf = ""; + while (this._bufs.length || buf.length) { + if (buf.length <= 0) { + buf = this._bufs[0]; + } + try { + const n = Buffer.isBuffer(buf) ? fs.writeSync(this.fd, buf) : fs.writeSync(this.fd, buf, "utf8"); + const releasedBufObj = releaseWritingBuf(buf, this._len, n); + buf = releasedBufObj.writingBuf; + this._len = releasedBufObj.len; + if (buf.length <= 0) { + this._bufs.shift(); + } + } catch (err) { + const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY"; + if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) { + throw err; + } + sleep(BUSY_WRITE_TIMEOUT); + } + } + try { + fs.fsyncSync(this.fd); + } catch { + } + } + function flushBufferSync() { + if (this.destroyed) { + throw new Error("SonicBoom destroyed"); + } + if (this.fd < 0) { + throw new Error("sonic boom is not ready yet"); + } + if (!this._writing && this._writingBuf.length > 0) { + this._bufs.unshift([this._writingBuf]); + this._writingBuf = kEmptyBuffer; + } + let buf = kEmptyBuffer; + while (this._bufs.length || buf.length) { + if (buf.length <= 0) { + buf = mergeBuf(this._bufs[0], this._lens[0]); + } + try { + const n = fs.writeSync(this.fd, buf); + buf = buf.subarray(n); + this._len = Math.max(this._len - n, 0); + if (buf.length <= 0) { + this._bufs.shift(); + this._lens.shift(); + } + } catch (err) { + const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY"; + if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) { + throw err; + } + sleep(BUSY_WRITE_TIMEOUT); + } + } + } + SonicBoom.prototype.destroy = function() { + if (this.destroyed) { + return; + } + actualClose(this); + }; + function actualWrite() { + const release = this.release; + this._writing = true; + this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || ""; + if (this.sync) { + try { + const written = Buffer.isBuffer(this._writingBuf) ? fs.writeSync(this.fd, this._writingBuf) : fs.writeSync(this.fd, this._writingBuf, "utf8"); + release(null, written); + } catch (err) { + release(err); + } + } else { + fs.write(this.fd, this._writingBuf, release); + } + } + function actualWriteBuffer() { + const release = this.release; + this._writing = true; + this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift()); + if (this.sync) { + try { + const written = fs.writeSync(this.fd, this._writingBuf); + release(null, written); + } catch (err) { + release(err); + } + } else { + if (kCopyBuffer) { + this._writingBuf = Buffer.from(this._writingBuf); + } + fs.write(this.fd, this._writingBuf, release); + } + } + function actualClose(sonic) { + if (sonic.fd === -1) { + sonic.once("ready", actualClose.bind(null, sonic)); + return; + } + if (sonic._periodicFlushTimer !== void 0) { + clearInterval(sonic._periodicFlushTimer); + } + sonic.destroyed = true; + sonic._bufs = []; + sonic._lens = []; + assert(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`); + try { + fs.fsync(sonic.fd, closeWrapped); + } catch { + } + function closeWrapped() { + if (sonic.fd !== 1 && sonic.fd !== 2) { + fs.close(sonic.fd, done); + } else { + done(); + } + } + function done(err) { + if (err) { + sonic.emit("error", err); + return; + } + if (sonic._ending && !sonic._writing) { + sonic.emit("finish"); + } + sonic.emit("close"); + } + } + SonicBoom.SonicBoom = SonicBoom; + SonicBoom.default = SonicBoom; + module.exports = SonicBoom; + } +}); + +// ../../node_modules/.pnpm/on-exit-leak-free@2.1.2/node_modules/on-exit-leak-free/index.js +var require_on_exit_leak_free = __commonJS({ + "../../node_modules/.pnpm/on-exit-leak-free@2.1.2/node_modules/on-exit-leak-free/index.js"(exports, module) { + "use strict"; + var refs = { + exit: [], + beforeExit: [] + }; + var functions = { + exit: onExit, + beforeExit: onBeforeExit + }; + var registry; + function ensureRegistry() { + if (registry === void 0) { + registry = new FinalizationRegistry(clear); + } + } + function install(event) { + if (refs[event].length > 0) { + return; + } + process.on(event, functions[event]); + } + function uninstall(event) { + if (refs[event].length > 0) { + return; + } + process.removeListener(event, functions[event]); + if (refs.exit.length === 0 && refs.beforeExit.length === 0) { + registry = void 0; + } + } + function onExit() { + callRefs("exit"); + } + function onBeforeExit() { + callRefs("beforeExit"); + } + function callRefs(event) { + for (const ref of refs[event]) { + const obj = ref.deref(); + const fn = ref.fn; + if (obj !== void 0) { + fn(obj, event); + } + } + refs[event] = []; + } + function clear(ref) { + for (const event of ["exit", "beforeExit"]) { + const index = refs[event].indexOf(ref); + refs[event].splice(index, index + 1); + uninstall(event); + } + } + function _register(event, obj, fn) { + if (obj === void 0) { + throw new Error("the object can't be undefined"); + } + install(event); + const ref = new WeakRef(obj); + ref.fn = fn; + ensureRegistry(); + registry.register(obj, ref); + refs[event].push(ref); + } + function register(obj, fn) { + _register("exit", obj, fn); + } + function registerBeforeExit(obj, fn) { + _register("beforeExit", obj, fn); + } + function unregister(obj) { + if (registry === void 0) { + return; + } + registry.unregister(obj); + for (const event of ["exit", "beforeExit"]) { + refs[event] = refs[event].filter((ref) => { + const _obj = ref.deref(); + return _obj && _obj !== obj; + }); + uninstall(event); + } + } + module.exports = { + register, + registerBeforeExit, + unregister + }; + } +}); + +// ../../node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/package.json +var require_package = __commonJS({ + "../../node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/package.json"(exports, module) { + module.exports = { + name: "thread-stream", + version: "3.1.0", + description: "A streaming way to send data to a Node.js Worker Thread", + main: "index.js", + types: "index.d.ts", + dependencies: { + "real-require": "^0.2.0" + }, + devDependencies: { + "@types/node": "^20.1.0", + "@types/tap": "^15.0.0", + "@yao-pkg/pkg": "^5.11.5", + desm: "^1.3.0", + fastbench: "^1.0.1", + husky: "^9.0.6", + "pino-elasticsearch": "^8.0.0", + "sonic-boom": "^4.0.1", + standard: "^17.0.0", + tap: "^16.2.0", + "ts-node": "^10.8.0", + typescript: "^5.3.2", + "why-is-node-running": "^2.2.2" + }, + scripts: { + build: "tsc --noEmit", + test: 'standard && npm run build && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts', + "test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts", + "test:ci:js": 'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"', + "test:ci:ts": 'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"', + "test:yarn": 'npm run transpile && tap "test/**/*.test.js" --no-check-coverage', + transpile: "sh ./test/ts/transpile.sh", + prepare: "husky install" + }, + standard: { + ignore: [ + "test/ts/**/*", + "test/syntax-error.mjs" + ] + }, + repository: { + type: "git", + url: "git+https://github.com/mcollina/thread-stream.git" + }, + keywords: [ + "worker", + "thread", + "threads", + "stream" + ], + author: "Matteo Collina ", + license: "MIT", + bugs: { + url: "https://github.com/mcollina/thread-stream/issues" + }, + homepage: "https://github.com/mcollina/thread-stream#readme" + }; + } +}); + +// ../../node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/lib/wait.js +var require_wait = __commonJS({ + "../../node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/lib/wait.js"(exports, module) { + "use strict"; + var MAX_TIMEOUT = 1e3; + function wait(state, index, expected, timeout, done) { + const max = Date.now() + timeout; + let current = Atomics.load(state, index); + if (current === expected) { + done(null, "ok"); + return; + } + let prior = current; + const check = (backoff) => { + if (Date.now() > max) { + done(null, "timed-out"); + } else { + setTimeout(() => { + prior = current; + current = Atomics.load(state, index); + if (current === prior) { + check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2); + } else { + if (current === expected) done(null, "ok"); + else done(null, "not-equal"); + } + }, backoff); + } + }; + check(1); + } + function waitDiff(state, index, expected, timeout, done) { + const max = Date.now() + timeout; + let current = Atomics.load(state, index); + if (current !== expected) { + done(null, "ok"); + return; + } + const check = (backoff) => { + if (Date.now() > max) { + done(null, "timed-out"); + } else { + setTimeout(() => { + current = Atomics.load(state, index); + if (current !== expected) { + done(null, "ok"); + } else { + check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2); + } + }, backoff); + } + }; + check(1); + } + module.exports = { wait, waitDiff }; + } +}); + +// ../../node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/lib/indexes.js +var require_indexes = __commonJS({ + "../../node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/lib/indexes.js"(exports, module) { + "use strict"; + var WRITE_INDEX = 4; + var READ_INDEX = 8; + module.exports = { + WRITE_INDEX, + READ_INDEX + }; + } +}); + +// ../../node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/index.js +var require_thread_stream = __commonJS({ + "../../node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/index.js"(exports, module) { + "use strict"; + var { version } = require_package(); + var { EventEmitter } = __require("events"); + var { Worker } = __require("worker_threads"); + var { join } = __require("path"); + var { pathToFileURL } = __require("url"); + var { wait } = require_wait(); + var { + WRITE_INDEX, + READ_INDEX + } = require_indexes(); + var buffer = __require("buffer"); + var assert = __require("assert"); + var kImpl = /* @__PURE__ */ Symbol("kImpl"); + var MAX_STRING = buffer.constants.MAX_STRING_LENGTH; + var FakeWeakRef = class { + constructor(value) { + this._value = value; + } + deref() { + return this._value; + } + }; + var FakeFinalizationRegistry = class { + register() { + } + unregister() { + } + }; + var FinalizationRegistry2 = process.env.NODE_V8_COVERAGE ? FakeFinalizationRegistry : global.FinalizationRegistry || FakeFinalizationRegistry; + var WeakRef2 = process.env.NODE_V8_COVERAGE ? FakeWeakRef : global.WeakRef || FakeWeakRef; + var registry = new FinalizationRegistry2((worker) => { + if (worker.exited) { + return; + } + worker.terminate(); + }); + function createWorker(stream, opts) { + const { filename, workerData } = opts; + const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {}; + const toExecute = bundlerOverrides["thread-stream-worker"] || join(__dirname, "lib", "worker.js"); + const worker = new Worker(toExecute, { + ...opts.workerOpts, + trackUnmanagedFds: false, + workerData: { + filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href, + dataBuf: stream[kImpl].dataBuf, + stateBuf: stream[kImpl].stateBuf, + workerData: { + $context: { + threadStreamVersion: version + }, + ...workerData + } + } + }); + worker.stream = new FakeWeakRef(stream); + worker.on("message", onWorkerMessage); + worker.on("exit", onWorkerExit); + registry.register(stream, worker); + return worker; + } + function drain(stream) { + assert(!stream[kImpl].sync); + if (stream[kImpl].needDrain) { + stream[kImpl].needDrain = false; + stream.emit("drain"); + } + } + function nextFlush(stream) { + const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX); + let leftover = stream[kImpl].data.length - writeIndex; + if (leftover > 0) { + if (stream[kImpl].buf.length === 0) { + stream[kImpl].flushing = false; + if (stream[kImpl].ending) { + end(stream); + } else if (stream[kImpl].needDrain) { + process.nextTick(drain, stream); + } + return; + } + let toWrite = stream[kImpl].buf.slice(0, leftover); + let toWriteBytes = Buffer.byteLength(toWrite); + if (toWriteBytes <= leftover) { + stream[kImpl].buf = stream[kImpl].buf.slice(leftover); + write(stream, toWrite, nextFlush.bind(null, stream)); + } else { + stream.flush(() => { + if (stream.destroyed) { + return; + } + Atomics.store(stream[kImpl].state, READ_INDEX, 0); + Atomics.store(stream[kImpl].state, WRITE_INDEX, 0); + while (toWriteBytes > stream[kImpl].data.length) { + leftover = leftover / 2; + toWrite = stream[kImpl].buf.slice(0, leftover); + toWriteBytes = Buffer.byteLength(toWrite); + } + stream[kImpl].buf = stream[kImpl].buf.slice(leftover); + write(stream, toWrite, nextFlush.bind(null, stream)); + }); + } + } else if (leftover === 0) { + if (writeIndex === 0 && stream[kImpl].buf.length === 0) { + return; + } + stream.flush(() => { + Atomics.store(stream[kImpl].state, READ_INDEX, 0); + Atomics.store(stream[kImpl].state, WRITE_INDEX, 0); + nextFlush(stream); + }); + } else { + destroy(stream, new Error("overwritten")); + } + } + function onWorkerMessage(msg) { + const stream = this.stream.deref(); + if (stream === void 0) { + this.exited = true; + this.terminate(); + return; + } + switch (msg.code) { + case "READY": + this.stream = new WeakRef2(stream); + stream.flush(() => { + stream[kImpl].ready = true; + stream.emit("ready"); + }); + break; + case "ERROR": + destroy(stream, msg.err); + break; + case "EVENT": + if (Array.isArray(msg.args)) { + stream.emit(msg.name, ...msg.args); + } else { + stream.emit(msg.name, msg.args); + } + break; + case "WARNING": + process.emitWarning(msg.err); + break; + default: + destroy(stream, new Error("this should not happen: " + msg.code)); + } + } + function onWorkerExit(code) { + const stream = this.stream.deref(); + if (stream === void 0) { + return; + } + registry.unregister(stream); + stream.worker.exited = true; + stream.worker.off("exit", onWorkerExit); + destroy(stream, code !== 0 ? new Error("the worker thread exited") : null); + } + var ThreadStream = class extends EventEmitter { + constructor(opts = {}) { + super(); + if (opts.bufferSize < 4) { + throw new Error("bufferSize must at least fit a 4-byte utf-8 char"); + } + this[kImpl] = {}; + this[kImpl].stateBuf = new SharedArrayBuffer(128); + this[kImpl].state = new Int32Array(this[kImpl].stateBuf); + this[kImpl].dataBuf = new SharedArrayBuffer(opts.bufferSize || 4 * 1024 * 1024); + this[kImpl].data = Buffer.from(this[kImpl].dataBuf); + this[kImpl].sync = opts.sync || false; + this[kImpl].ending = false; + this[kImpl].ended = false; + this[kImpl].needDrain = false; + this[kImpl].destroyed = false; + this[kImpl].flushing = false; + this[kImpl].ready = false; + this[kImpl].finished = false; + this[kImpl].errored = null; + this[kImpl].closed = false; + this[kImpl].buf = ""; + this.worker = createWorker(this, opts); + this.on("message", (message, transferList) => { + this.worker.postMessage(message, transferList); + }); + } + write(data) { + if (this[kImpl].destroyed) { + error(this, new Error("the worker has exited")); + return false; + } + if (this[kImpl].ending) { + error(this, new Error("the worker is ending")); + return false; + } + if (this[kImpl].flushing && this[kImpl].buf.length + data.length >= MAX_STRING) { + try { + writeSync(this); + this[kImpl].flushing = true; + } catch (err) { + destroy(this, err); + return false; + } + } + this[kImpl].buf += data; + if (this[kImpl].sync) { + try { + writeSync(this); + return true; + } catch (err) { + destroy(this, err); + return false; + } + } + if (!this[kImpl].flushing) { + this[kImpl].flushing = true; + setImmediate(nextFlush, this); + } + this[kImpl].needDrain = this[kImpl].data.length - this[kImpl].buf.length - Atomics.load(this[kImpl].state, WRITE_INDEX) <= 0; + return !this[kImpl].needDrain; + } + end() { + if (this[kImpl].destroyed) { + return; + } + this[kImpl].ending = true; + end(this); + } + flush(cb) { + if (this[kImpl].destroyed) { + if (typeof cb === "function") { + process.nextTick(cb, new Error("the worker has exited")); + } + return; + } + const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX); + wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => { + if (err) { + destroy(this, err); + process.nextTick(cb, err); + return; + } + if (res === "not-equal") { + this.flush(cb); + return; + } + process.nextTick(cb); + }); + } + flushSync() { + if (this[kImpl].destroyed) { + return; + } + writeSync(this); + flushSync(this); + } + unref() { + this.worker.unref(); + } + ref() { + this.worker.ref(); + } + get ready() { + return this[kImpl].ready; + } + get destroyed() { + return this[kImpl].destroyed; + } + get closed() { + return this[kImpl].closed; + } + get writable() { + return !this[kImpl].destroyed && !this[kImpl].ending; + } + get writableEnded() { + return this[kImpl].ending; + } + get writableFinished() { + return this[kImpl].finished; + } + get writableNeedDrain() { + return this[kImpl].needDrain; + } + get writableObjectMode() { + return false; + } + get writableErrored() { + return this[kImpl].errored; + } + }; + function error(stream, err) { + setImmediate(() => { + stream.emit("error", err); + }); + } + function destroy(stream, err) { + if (stream[kImpl].destroyed) { + return; + } + stream[kImpl].destroyed = true; + if (err) { + stream[kImpl].errored = err; + error(stream, err); + } + if (!stream.worker.exited) { + stream.worker.terminate().catch(() => { + }).then(() => { + stream[kImpl].closed = true; + stream.emit("close"); + }); + } else { + setImmediate(() => { + stream[kImpl].closed = true; + stream.emit("close"); + }); + } + } + function write(stream, data, cb) { + const current = Atomics.load(stream[kImpl].state, WRITE_INDEX); + const length = Buffer.byteLength(data); + stream[kImpl].data.write(data, current); + Atomics.store(stream[kImpl].state, WRITE_INDEX, current + length); + Atomics.notify(stream[kImpl].state, WRITE_INDEX); + cb(); + return true; + } + function end(stream) { + if (stream[kImpl].ended || !stream[kImpl].ending || stream[kImpl].flushing) { + return; + } + stream[kImpl].ended = true; + try { + stream.flushSync(); + let readIndex = Atomics.load(stream[kImpl].state, READ_INDEX); + Atomics.store(stream[kImpl].state, WRITE_INDEX, -1); + Atomics.notify(stream[kImpl].state, WRITE_INDEX); + let spins = 0; + while (readIndex !== -1) { + Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3); + readIndex = Atomics.load(stream[kImpl].state, READ_INDEX); + if (readIndex === -2) { + destroy(stream, new Error("end() failed")); + return; + } + if (++spins === 10) { + destroy(stream, new Error("end() took too long (10s)")); + return; + } + } + process.nextTick(() => { + stream[kImpl].finished = true; + stream.emit("finish"); + }); + } catch (err) { + destroy(stream, err); + } + } + function writeSync(stream) { + const cb = () => { + if (stream[kImpl].ending) { + end(stream); + } else if (stream[kImpl].needDrain) { + process.nextTick(drain, stream); + } + }; + stream[kImpl].flushing = false; + while (stream[kImpl].buf.length !== 0) { + const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX); + let leftover = stream[kImpl].data.length - writeIndex; + if (leftover === 0) { + flushSync(stream); + Atomics.store(stream[kImpl].state, READ_INDEX, 0); + Atomics.store(stream[kImpl].state, WRITE_INDEX, 0); + continue; + } else if (leftover < 0) { + throw new Error("overwritten"); + } + let toWrite = stream[kImpl].buf.slice(0, leftover); + let toWriteBytes = Buffer.byteLength(toWrite); + if (toWriteBytes <= leftover) { + stream[kImpl].buf = stream[kImpl].buf.slice(leftover); + write(stream, toWrite, cb); + } else { + flushSync(stream); + Atomics.store(stream[kImpl].state, READ_INDEX, 0); + Atomics.store(stream[kImpl].state, WRITE_INDEX, 0); + while (toWriteBytes > stream[kImpl].buf.length) { + leftover = leftover / 2; + toWrite = stream[kImpl].buf.slice(0, leftover); + toWriteBytes = Buffer.byteLength(toWrite); + } + stream[kImpl].buf = stream[kImpl].buf.slice(leftover); + write(stream, toWrite, cb); + } + } + } + function flushSync(stream) { + if (stream[kImpl].flushing) { + throw new Error("unable to flush while flushing"); + } + const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX); + let spins = 0; + while (true) { + const readIndex = Atomics.load(stream[kImpl].state, READ_INDEX); + if (readIndex === -2) { + throw Error("_flushSync failed"); + } + if (readIndex !== writeIndex) { + Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3); + } else { + break; + } + if (++spins === 10) { + throw new Error("_flushSync took too long (10s)"); + } + } + } + module.exports = ThreadStream; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/transport.js +var require_transport = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/transport.js"(exports, module) { + "use strict"; + var { createRequire } = __require("module"); + var getCallers = require_caller(); + var { join, isAbsolute, sep } = __require("node:path"); + var sleep = require_atomic_sleep(); + var onExit = require_on_exit_leak_free(); + var ThreadStream = require_thread_stream(); + function setupOnExit(stream) { + onExit.register(stream, autoEnd); + onExit.registerBeforeExit(stream, flush); + stream.on("close", function() { + onExit.unregister(stream); + }); + } + function buildStream(filename, workerData, workerOpts, sync) { + const stream = new ThreadStream({ + filename, + workerData, + workerOpts, + sync + }); + stream.on("ready", onReady); + stream.on("close", function() { + process.removeListener("exit", onExit2); + }); + process.on("exit", onExit2); + function onReady() { + process.removeListener("exit", onExit2); + stream.unref(); + if (workerOpts.autoEnd !== false) { + setupOnExit(stream); + } + } + function onExit2() { + if (stream.closed) { + return; + } + stream.flushSync(); + sleep(100); + stream.end(); + } + return stream; + } + function autoEnd(stream) { + stream.ref(); + stream.flushSync(); + stream.end(); + stream.once("close", function() { + stream.unref(); + }); + } + function flush(stream) { + stream.flushSync(); + } + function transport(fullOptions) { + const { pipeline, targets, levels, dedupe, worker = {}, caller = getCallers(), sync = false } = fullOptions; + const options = { + ...fullOptions.options + }; + const callers = typeof caller === "string" ? [caller] : caller; + const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {}; + let target = fullOptions.target; + if (target && targets) { + throw new Error("only one of target or targets can be specified"); + } + if (targets) { + target = bundlerOverrides["pino-worker"] || join(__dirname, "worker.js"); + options.targets = targets.filter((dest) => dest.target).map((dest) => { + return { + ...dest, + target: fixTarget(dest.target) + }; + }); + options.pipelines = targets.filter((dest) => dest.pipeline).map((dest) => { + return dest.pipeline.map((t) => { + return { + ...t, + level: dest.level, + // duplicate the pipeline `level` property defined in the upper level + target: fixTarget(t.target) + }; + }); + }); + } else if (pipeline) { + target = bundlerOverrides["pino-worker"] || join(__dirname, "worker.js"); + options.pipelines = [pipeline.map((dest) => { + return { + ...dest, + target: fixTarget(dest.target) + }; + })]; + } + if (levels) { + options.levels = levels; + } + if (dedupe) { + options.dedupe = dedupe; + } + options.pinoWillSendConfig = true; + return buildStream(fixTarget(target), options, worker, sync); + function fixTarget(origin) { + origin = bundlerOverrides[origin] || origin; + if (isAbsolute(origin) || origin.indexOf("file://") === 0) { + return origin; + } + if (origin === "pino/file") { + return join(__dirname, "..", "file.js"); + } + let fixTarget2; + for (const filePath of callers) { + try { + const context = filePath === "node:repl" ? process.cwd() + sep : filePath; + fixTarget2 = createRequire(context).resolve(origin); + break; + } catch (err) { + continue; + } + } + if (!fixTarget2) { + throw new Error(`unable to determine transport target for "${origin}"`); + } + return fixTarget2; + } + } + module.exports = transport; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/tools.js +var require_tools = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/tools.js"(exports, module) { + "use strict"; + var diagChan = __require("node:diagnostics_channel"); + var format = require_quick_format_unescaped(); + var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers(); + var SonicBoom = require_sonic_boom(); + var onExit = require_on_exit_leak_free(); + var { + lsCacheSym, + chindingsSym, + writeSym, + serializersSym, + formatOptsSym, + endSym, + stringifiersSym, + stringifySym, + stringifySafeSym, + wildcardFirstSym, + nestedKeySym, + formattersSym, + messageKeySym, + errorKeySym, + nestedKeyStrSym, + msgPrefixSym + } = require_symbols(); + var { isMainThread } = __require("worker_threads"); + var transport = require_transport(); + var asJsonChan; + if (typeof diagChan.tracingChannel === "function") { + asJsonChan = diagChan.tracingChannel("pino_asJson"); + } else { + asJsonChan = { + hasSubscribers: false, + traceSync(fn, store, thisArg, ...args) { + return fn.call(thisArg, ...args); + } + }; + } + function noop() { + } + function genLog(level, hook) { + if (!hook) return LOG; + return function hookWrappedLog(...args) { + hook.call(this, args, LOG, level); + }; + function LOG(o, ...n) { + if (typeof o === "object") { + let msg = o; + if (o !== null) { + if (o.method && o.headers && o.socket) { + o = mapHttpRequest(o); + } else if (typeof o.setHeader === "function") { + o = mapHttpResponse(o); + } + } + let formatParams; + if (msg === null && n.length === 0) { + formatParams = [null]; + } else { + msg = n.shift(); + formatParams = n; + } + if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) { + msg = this[msgPrefixSym] + msg; + } + this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level); + } else { + let msg = o === void 0 ? n.shift() : o; + if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) { + msg = this[msgPrefixSym] + msg; + } + this[writeSym](null, format(msg, n, this[formatOptsSym]), level); + } + } + } + function asString(str) { + let result = ""; + let last = 0; + let found = false; + let point = 255; + const l = str.length; + if (l > 100) { + return JSON.stringify(str); + } + for (var i = 0; i < l && point >= 32; i++) { + point = str.charCodeAt(i); + if (point === 34 || point === 92) { + result += str.slice(last, i) + "\\"; + last = i; + found = true; + } + } + if (!found) { + result = str; + } else { + result += str.slice(last); + } + return point < 32 ? JSON.stringify(str) : '"' + result + '"'; + } + function asJson(obj, msg, num, time) { + if (asJsonChan.hasSubscribers === false) { + return _asJson.call(this, obj, msg, num, time); + } + const store = { instance: this, arguments }; + return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time); + } + function _asJson(obj, msg, num, time) { + const stringify2 = this[stringifySym]; + const stringifySafe = this[stringifySafeSym]; + const stringifiers = this[stringifiersSym]; + const end = this[endSym]; + const chindings = this[chindingsSym]; + const serializers = this[serializersSym]; + const formatters = this[formattersSym]; + const messageKey = this[messageKeySym]; + const errorKey = this[errorKeySym]; + let data = this[lsCacheSym][num] + time; + data = data + chindings; + let value; + if (formatters.log) { + obj = formatters.log(obj); + } + const wildcardStringifier = stringifiers[wildcardFirstSym]; + let propStr = ""; + for (const key in obj) { + value = obj[key]; + if (Object.prototype.hasOwnProperty.call(obj, key) && value !== void 0) { + if (serializers[key]) { + value = serializers[key](value); + } else if (key === errorKey && serializers.err) { + value = serializers.err(value); + } + const stringifier = stringifiers[key] || wildcardStringifier; + switch (typeof value) { + case "undefined": + case "function": + continue; + case "number": + if (Number.isFinite(value) === false) { + value = null; + } + // this case explicitly falls through to the next one + case "boolean": + if (stringifier) value = stringifier(value); + break; + case "string": + value = (stringifier || asString)(value); + break; + default: + value = (stringifier || stringify2)(value, stringifySafe); + } + if (value === void 0) continue; + const strKey = asString(key); + propStr += "," + strKey + ":" + value; + } + } + let msgStr = ""; + if (msg !== void 0) { + value = serializers[messageKey] ? serializers[messageKey](msg) : msg; + const stringifier = stringifiers[messageKey] || wildcardStringifier; + switch (typeof value) { + case "function": + break; + case "number": + if (Number.isFinite(value) === false) { + value = null; + } + // this case explicitly falls through to the next one + case "boolean": + if (stringifier) value = stringifier(value); + msgStr = ',"' + messageKey + '":' + value; + break; + case "string": + value = (stringifier || asString)(value); + msgStr = ',"' + messageKey + '":' + value; + break; + default: + value = (stringifier || stringify2)(value, stringifySafe); + msgStr = ',"' + messageKey + '":' + value; + } + } + if (this[nestedKeySym] && propStr) { + return data + this[nestedKeyStrSym] + propStr.slice(1) + "}" + msgStr + end; + } else { + return data + propStr + msgStr + end; + } + } + function asChindings(instance, bindings) { + let value; + let data = instance[chindingsSym]; + const stringify2 = instance[stringifySym]; + const stringifySafe = instance[stringifySafeSym]; + const stringifiers = instance[stringifiersSym]; + const wildcardStringifier = stringifiers[wildcardFirstSym]; + const serializers = instance[serializersSym]; + const formatter = instance[formattersSym].bindings; + bindings = formatter(bindings); + for (const key in bindings) { + value = bindings[key]; + const valid = (key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== void 0; + if (valid === true) { + value = serializers[key] ? serializers[key](value) : value; + value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe); + if (value === void 0) continue; + data += ',"' + key + '":' + value; + } + } + return data; + } + function hasBeenTampered(stream) { + return stream.write !== stream.constructor.prototype.write; + } + function buildSafeSonicBoom(opts) { + const stream = new SonicBoom(opts); + stream.on("error", filterBrokenPipe); + if (!opts.sync && isMainThread) { + onExit.register(stream, autoEnd); + stream.on("close", function() { + onExit.unregister(stream); + }); + } + return stream; + function filterBrokenPipe(err) { + if (err.code === "EPIPE") { + stream.write = noop; + stream.end = noop; + stream.flushSync = noop; + stream.destroy = noop; + return; + } + stream.removeListener("error", filterBrokenPipe); + stream.emit("error", err); + } + } + function autoEnd(stream, eventName) { + if (stream.destroyed) { + return; + } + if (eventName === "beforeExit") { + stream.flush(); + stream.on("drain", function() { + stream.end(); + }); + } else { + stream.flushSync(); + } + } + function createArgsNormalizer(defaultOptions) { + return function normalizeArgs(instance, caller, opts = {}, stream) { + if (typeof opts === "string") { + stream = buildSafeSonicBoom({ dest: opts }); + opts = {}; + } else if (typeof stream === "string") { + if (opts && opts.transport) { + throw Error("only one of option.transport or stream can be specified"); + } + stream = buildSafeSonicBoom({ dest: stream }); + } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) { + stream = opts; + opts = {}; + } else if (opts.transport) { + if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) { + throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)"); + } + if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === "function") { + throw Error("option.transport.targets do not allow custom level formatters"); + } + let customLevels; + if (opts.customLevels) { + customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels); + } + stream = transport({ caller, ...opts.transport, levels: customLevels }); + } + opts = Object.assign({}, defaultOptions, opts); + opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers); + opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters); + if (opts.prettyPrint) { + throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)"); + } + const { enabled, onChild } = opts; + if (enabled === false) opts.level = "silent"; + if (!onChild) opts.onChild = noop; + if (!stream) { + if (!hasBeenTampered(process.stdout)) { + stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 }); + } else { + stream = process.stdout; + } + } + return { opts, stream }; + }; + } + function stringify(obj, stringifySafeFn) { + try { + return JSON.stringify(obj); + } catch (_) { + try { + const stringify2 = stringifySafeFn || this[stringifySafeSym]; + return stringify2(obj); + } catch (_2) { + return '"[unable to serialize, circular reference is too complex to analyze]"'; + } + } + } + function buildFormatters(level, bindings, log) { + return { + level, + bindings, + log + }; + } + function normalizeDestFileDescriptor(destination) { + const fd = Number(destination); + if (typeof destination === "string" && Number.isFinite(fd)) { + return fd; + } + if (destination === void 0) { + return 1; + } + return destination; + } + module.exports = { + noop, + buildSafeSonicBoom, + asChindings, + asJson, + genLog, + createArgsNormalizer, + stringify, + buildFormatters, + normalizeDestFileDescriptor + }; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/constants.js +var require_constants = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/constants.js"(exports, module) { + var DEFAULT_LEVELS = { + trace: 10, + debug: 20, + info: 30, + warn: 40, + error: 50, + fatal: 60 + }; + var SORTING_ORDER = { + ASC: "ASC", + DESC: "DESC" + }; + module.exports = { + DEFAULT_LEVELS, + SORTING_ORDER + }; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/levels.js +var require_levels = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/levels.js"(exports, module) { + "use strict"; + var { + lsCacheSym, + levelValSym, + useOnlyCustomLevelsSym, + streamSym, + formattersSym, + hooksSym, + levelCompSym + } = require_symbols(); + var { noop, genLog } = require_tools(); + var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants(); + var levelMethods = { + fatal: (hook) => { + const logFatal = genLog(DEFAULT_LEVELS.fatal, hook); + return function(...args) { + const stream = this[streamSym]; + logFatal.call(this, ...args); + if (typeof stream.flushSync === "function") { + try { + stream.flushSync(); + } catch (e) { + } + } + }; + }, + error: (hook) => genLog(DEFAULT_LEVELS.error, hook), + warn: (hook) => genLog(DEFAULT_LEVELS.warn, hook), + info: (hook) => genLog(DEFAULT_LEVELS.info, hook), + debug: (hook) => genLog(DEFAULT_LEVELS.debug, hook), + trace: (hook) => genLog(DEFAULT_LEVELS.trace, hook) + }; + var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => { + o[DEFAULT_LEVELS[k]] = k; + return o; + }, {}); + var initialLsCache = Object.keys(nums).reduce((o, k) => { + o[k] = '{"level":' + Number(k); + return o; + }, {}); + function genLsCache(instance) { + const formatter = instance[formattersSym].level; + const { labels } = instance.levels; + const cache = {}; + for (const label in labels) { + const level = formatter(labels[label], Number(label)); + cache[label] = JSON.stringify(level).slice(0, -1); + } + instance[lsCacheSym] = cache; + return instance; + } + function isStandardLevel(level, useOnlyCustomLevels) { + if (useOnlyCustomLevels) { + return false; + } + switch (level) { + case "fatal": + case "error": + case "warn": + case "info": + case "debug": + case "trace": + return true; + default: + return false; + } + } + function setLevel(level) { + const { labels, values } = this.levels; + if (typeof level === "number") { + if (labels[level] === void 0) throw Error("unknown level value" + level); + level = labels[level]; + } + if (values[level] === void 0) throw Error("unknown level " + level); + const preLevelVal = this[levelValSym]; + const levelVal = this[levelValSym] = values[level]; + const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym]; + const levelComparison = this[levelCompSym]; + const hook = this[hooksSym].logMethod; + for (const key in values) { + if (levelComparison(values[key], levelVal) === false) { + this[key] = noop; + continue; + } + this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key](hook) : genLog(values[key], hook); + } + this.emit( + "level-change", + level, + levelVal, + labels[preLevelVal], + preLevelVal, + this + ); + } + function getLevel(level) { + const { levels, levelVal } = this; + return levels && levels.labels ? levels.labels[levelVal] : ""; + } + function isLevelEnabled(logLevel) { + const { values } = this.levels; + const logLevelVal = values[logLevel]; + return logLevelVal !== void 0 && this[levelCompSym](logLevelVal, this[levelValSym]); + } + function compareLevel(direction, current, expected) { + if (direction === SORTING_ORDER.DESC) { + return current <= expected; + } + return current >= expected; + } + function genLevelComparison(levelComparison) { + if (typeof levelComparison === "string") { + return compareLevel.bind(null, levelComparison); + } + return levelComparison; + } + function mappings(customLevels = null, useOnlyCustomLevels = false) { + const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => { + o[customLevels[k]] = k; + return o; + }, {}) : null; + const labels = Object.assign( + Object.create(Object.prototype, { Infinity: { value: "silent" } }), + useOnlyCustomLevels ? null : nums, + customNums + ); + const values = Object.assign( + Object.create(Object.prototype, { silent: { value: Infinity } }), + useOnlyCustomLevels ? null : DEFAULT_LEVELS, + customLevels + ); + return { labels, values }; + } + function assertDefaultLevelFound(defaultLevel, customLevels, useOnlyCustomLevels) { + if (typeof defaultLevel === "number") { + const values = [].concat( + Object.keys(customLevels || {}).map((key) => customLevels[key]), + useOnlyCustomLevels ? [] : Object.keys(nums).map((level) => +level), + Infinity + ); + if (!values.includes(defaultLevel)) { + throw Error(`default level:${defaultLevel} must be included in custom levels`); + } + return; + } + const labels = Object.assign( + Object.create(Object.prototype, { silent: { value: Infinity } }), + useOnlyCustomLevels ? null : DEFAULT_LEVELS, + customLevels + ); + if (!(defaultLevel in labels)) { + throw Error(`default level:${defaultLevel} must be included in custom levels`); + } + } + function assertNoLevelCollisions(levels, customLevels) { + const { labels, values } = levels; + for (const k in customLevels) { + if (k in values) { + throw Error("levels cannot be overridden"); + } + if (customLevels[k] in labels) { + throw Error("pre-existing level values cannot be used for new levels"); + } + } + } + function assertLevelComparison(levelComparison) { + if (typeof levelComparison === "function") { + return; + } + if (typeof levelComparison === "string" && Object.values(SORTING_ORDER).includes(levelComparison)) { + return; + } + throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type'); + } + module.exports = { + initialLsCache, + genLsCache, + levelMethods, + getLevel, + setLevel, + isLevelEnabled, + mappings, + assertNoLevelCollisions, + assertDefaultLevelFound, + genLevelComparison, + assertLevelComparison + }; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/meta.js +var require_meta = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/meta.js"(exports, module) { + "use strict"; + module.exports = { version: "9.14.0" }; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/proto.js +var require_proto = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/proto.js"(exports, module) { + "use strict"; + var { EventEmitter } = __require("node:events"); + var { + lsCacheSym, + levelValSym, + setLevelSym, + getLevelSym, + chindingsSym, + parsedChindingsSym, + mixinSym, + asJsonSym, + writeSym, + mixinMergeStrategySym, + timeSym, + timeSliceIndexSym, + streamSym, + serializersSym, + formattersSym, + errorKeySym, + messageKeySym, + useOnlyCustomLevelsSym, + needsMetadataGsym, + redactFmtSym, + stringifySym, + formatOptsSym, + stringifiersSym, + msgPrefixSym, + hooksSym + } = require_symbols(); + var { + getLevel, + setLevel, + isLevelEnabled, + mappings, + initialLsCache, + genLsCache, + assertNoLevelCollisions + } = require_levels(); + var { + asChindings, + asJson, + buildFormatters, + stringify, + noop + } = require_tools(); + var { + version + } = require_meta(); + var redaction = require_redaction(); + var constructor = class Pino { + }; + var prototype = { + constructor, + child, + bindings, + setBindings, + flush, + isLevelEnabled, + version, + get level() { + return this[getLevelSym](); + }, + set level(lvl) { + this[setLevelSym](lvl); + }, + get levelVal() { + return this[levelValSym]; + }, + set levelVal(n) { + throw Error("levelVal is read-only"); + }, + get msgPrefix() { + return this[msgPrefixSym]; + }, + get [Symbol.toStringTag]() { + return "Pino"; + }, + [lsCacheSym]: initialLsCache, + [writeSym]: write, + [asJsonSym]: asJson, + [getLevelSym]: getLevel, + [setLevelSym]: setLevel + }; + Object.setPrototypeOf(prototype, EventEmitter.prototype); + module.exports = function() { + return Object.create(prototype); + }; + var resetChildingsFormatter = (bindings2) => bindings2; + function child(bindings2, options) { + if (!bindings2) { + throw Error("missing bindings for child Pino"); + } + const serializers = this[serializersSym]; + const formatters = this[formattersSym]; + const instance = Object.create(this); + if (options == null) { + if (instance[formattersSym].bindings !== resetChildingsFormatter) { + instance[formattersSym] = buildFormatters( + formatters.level, + resetChildingsFormatter, + formatters.log + ); + } + instance[chindingsSym] = asChindings(instance, bindings2); + instance[setLevelSym](this.level); + if (this.onChild !== noop) { + this.onChild(instance); + } + return instance; + } + if (options.hasOwnProperty("serializers") === true) { + instance[serializersSym] = /* @__PURE__ */ Object.create(null); + for (const k in serializers) { + instance[serializersSym][k] = serializers[k]; + } + const parentSymbols = Object.getOwnPropertySymbols(serializers); + for (var i = 0; i < parentSymbols.length; i++) { + const ks = parentSymbols[i]; + instance[serializersSym][ks] = serializers[ks]; + } + for (const bk in options.serializers) { + instance[serializersSym][bk] = options.serializers[bk]; + } + const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers); + for (var bi = 0; bi < bindingsSymbols.length; bi++) { + const bks = bindingsSymbols[bi]; + instance[serializersSym][bks] = options.serializers[bks]; + } + } else instance[serializersSym] = serializers; + if (options.hasOwnProperty("formatters")) { + const { level, bindings: chindings, log } = options.formatters; + instance[formattersSym] = buildFormatters( + level || formatters.level, + chindings || resetChildingsFormatter, + log || formatters.log + ); + } else { + instance[formattersSym] = buildFormatters( + formatters.level, + resetChildingsFormatter, + formatters.log + ); + } + if (options.hasOwnProperty("customLevels") === true) { + assertNoLevelCollisions(this.levels, options.customLevels); + instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]); + genLsCache(instance); + } + if (typeof options.redact === "object" && options.redact !== null || Array.isArray(options.redact)) { + instance.redact = options.redact; + const stringifiers = redaction(instance.redact, stringify); + const formatOpts = { stringify: stringifiers[redactFmtSym] }; + instance[stringifySym] = stringify; + instance[stringifiersSym] = stringifiers; + instance[formatOptsSym] = formatOpts; + } + if (typeof options.msgPrefix === "string") { + instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix; + } + instance[chindingsSym] = asChindings(instance, bindings2); + const childLevel = options.level || this.level; + instance[setLevelSym](childLevel); + this.onChild(instance); + return instance; + } + function bindings() { + const chindings = this[chindingsSym]; + const chindingsJson = `{${chindings.substr(1)}}`; + const bindingsFromJson = JSON.parse(chindingsJson); + delete bindingsFromJson.pid; + delete bindingsFromJson.hostname; + return bindingsFromJson; + } + function setBindings(newBindings) { + const chindings = asChindings(this, newBindings); + this[chindingsSym] = chindings; + delete this[parsedChindingsSym]; + } + function defaultMixinMergeStrategy(mergeObject, mixinObject) { + return Object.assign(mixinObject, mergeObject); + } + function write(_obj, msg, num) { + const t = this[timeSym](); + const mixin = this[mixinSym]; + const errorKey = this[errorKeySym]; + const messageKey = this[messageKeySym]; + const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy; + let obj; + const streamWriteHook = this[hooksSym].streamWrite; + if (_obj === void 0 || _obj === null) { + obj = {}; + } else if (_obj instanceof Error) { + obj = { [errorKey]: _obj }; + if (msg === void 0) { + msg = _obj.message; + } + } else { + obj = _obj; + if (msg === void 0 && _obj[messageKey] === void 0 && _obj[errorKey]) { + msg = _obj[errorKey].message; + } + } + if (mixin) { + obj = mixinMergeStrategy(obj, mixin(obj, num, this)); + } + const s = this[asJsonSym](obj, msg, num, t); + const stream = this[streamSym]; + if (stream[needsMetadataGsym] === true) { + stream.lastLevel = num; + stream.lastObj = obj; + stream.lastMsg = msg; + stream.lastTime = t.slice(this[timeSliceIndexSym]); + stream.lastLogger = this; + } + stream.write(streamWriteHook ? streamWriteHook(s) : s); + } + function flush(cb) { + if (cb != null && typeof cb !== "function") { + throw Error("callback must be a function"); + } + const stream = this[streamSym]; + if (typeof stream.flush === "function") { + stream.flush(cb || noop); + } else if (cb) cb(); + } + } +}); + +// ../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js +var require_safe_stable_stringify = __commonJS({ + "../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(exports, module) { + "use strict"; + var { hasOwnProperty } = Object.prototype; + var stringify = configure(); + stringify.configure = configure; + stringify.stringify = stringify; + stringify.default = stringify; + exports.stringify = stringify; + exports.configure = configure; + module.exports = stringify; + var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/; + function strEscape(str) { + if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) { + return `"${str}"`; + } + return JSON.stringify(str); + } + function sort(array, comparator) { + if (array.length > 200 || comparator) { + return array.sort(comparator); + } + for (let i = 1; i < array.length; i++) { + const currentValue = array[i]; + let position = i; + while (position !== 0 && array[position - 1] > currentValue) { + array[position] = array[position - 1]; + position--; + } + array[position] = currentValue; + } + return array; + } + var typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor( + Object.getPrototypeOf( + Object.getPrototypeOf( + new Int8Array() + ) + ), + Symbol.toStringTag + ).get; + function isTypedArrayWithEntries(value) { + return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0; + } + function stringifyTypedArray(array, separator, maximumBreadth) { + if (array.length < maximumBreadth) { + maximumBreadth = array.length; + } + const whitespace = separator === "," ? "" : " "; + let res = `"0":${whitespace}${array[0]}`; + for (let i = 1; i < maximumBreadth; i++) { + res += `${separator}"${i}":${whitespace}${array[i]}`; + } + return res; + } + function getCircularValueOption(options) { + if (hasOwnProperty.call(options, "circularValue")) { + const circularValue = options.circularValue; + if (typeof circularValue === "string") { + return `"${circularValue}"`; + } + if (circularValue == null) { + return circularValue; + } + if (circularValue === Error || circularValue === TypeError) { + return { + toString() { + throw new TypeError("Converting circular structure to JSON"); + } + }; + } + throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined'); + } + return '"[Circular]"'; + } + function getDeterministicOption(options) { + let value; + if (hasOwnProperty.call(options, "deterministic")) { + value = options.deterministic; + if (typeof value !== "boolean" && typeof value !== "function") { + throw new TypeError('The "deterministic" argument must be of type boolean or comparator function'); + } + } + return value === void 0 ? true : value; + } + function getBooleanOption(options, key) { + let value; + if (hasOwnProperty.call(options, key)) { + value = options[key]; + if (typeof value !== "boolean") { + throw new TypeError(`The "${key}" argument must be of type boolean`); + } + } + return value === void 0 ? true : value; + } + function getPositiveIntegerOption(options, key) { + let value; + if (hasOwnProperty.call(options, key)) { + value = options[key]; + if (typeof value !== "number") { + throw new TypeError(`The "${key}" argument must be of type number`); + } + if (!Number.isInteger(value)) { + throw new TypeError(`The "${key}" argument must be an integer`); + } + if (value < 1) { + throw new RangeError(`The "${key}" argument must be >= 1`); + } + } + return value === void 0 ? Infinity : value; + } + function getItemCount(number) { + if (number === 1) { + return "1 item"; + } + return `${number} items`; + } + function getUniqueReplacerSet(replacerArray) { + const replacerSet = /* @__PURE__ */ new Set(); + for (const value of replacerArray) { + if (typeof value === "string" || typeof value === "number") { + replacerSet.add(String(value)); + } + } + return replacerSet; + } + function getStrictOption(options) { + if (hasOwnProperty.call(options, "strict")) { + const value = options.strict; + if (typeof value !== "boolean") { + throw new TypeError('The "strict" argument must be of type boolean'); + } + if (value) { + return (value2) => { + let message = `Object can not safely be stringified. Received type ${typeof value2}`; + if (typeof value2 !== "function") message += ` (${value2.toString()})`; + throw new Error(message); + }; + } + } + } + function configure(options) { + options = { ...options }; + const fail = getStrictOption(options); + if (fail) { + if (options.bigint === void 0) { + options.bigint = false; + } + if (!("circularValue" in options)) { + options.circularValue = Error; + } + } + const circularValue = getCircularValueOption(options); + const bigint = getBooleanOption(options, "bigint"); + const deterministic = getDeterministicOption(options); + const comparator = typeof deterministic === "function" ? deterministic : void 0; + const maximumDepth = getPositiveIntegerOption(options, "maximumDepth"); + const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth"); + function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) { + let value = parent[key]; + if (typeof value === "object" && value !== null && typeof value.toJSON === "function") { + value = value.toJSON(key); + } + value = replacer.call(parent, key, value); + switch (typeof value) { + case "string": + return strEscape(value); + case "object": { + if (value === null) { + return "null"; + } + if (stack.indexOf(value) !== -1) { + return circularValue; + } + let res = ""; + let join = ","; + const originalIndentation = indentation; + if (Array.isArray(value)) { + if (value.length === 0) { + return "[]"; + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"'; + } + stack.push(value); + if (spacer !== "") { + indentation += spacer; + res += ` +${indentation}`; + join = `, +${indentation}`; + } + const maximumValuesToStringify = Math.min(value.length, maximumBreadth); + let i = 0; + for (; i < maximumValuesToStringify - 1; i++) { + const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation); + res += tmp2 !== void 0 ? tmp2 : "null"; + res += join; + } + const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation); + res += tmp !== void 0 ? tmp : "null"; + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1; + res += `${join}"... ${getItemCount(removedKeys)} not stringified"`; + } + if (spacer !== "") { + res += ` +${originalIndentation}`; + } + stack.pop(); + return `[${res}]`; + } + let keys = Object.keys(value); + const keyLength = keys.length; + if (keyLength === 0) { + return "{}"; + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"'; + } + let whitespace = ""; + let separator = ""; + if (spacer !== "") { + indentation += spacer; + join = `, +${indentation}`; + whitespace = " "; + } + const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth); + if (deterministic && !isTypedArrayWithEntries(value)) { + keys = sort(keys, comparator); + } + stack.push(value); + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key2 = keys[i]; + const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation); + if (tmp !== void 0) { + res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`; + separator = join; + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth; + res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`; + separator = join; + } + if (spacer !== "" && separator.length > 1) { + res = ` +${indentation}${res} +${originalIndentation}`; + } + stack.pop(); + return `{${res}}`; + } + case "number": + return isFinite(value) ? String(value) : fail ? fail(value) : "null"; + case "boolean": + return value === true ? "true" : "false"; + case "undefined": + return void 0; + case "bigint": + if (bigint) { + return String(value); + } + // fallthrough + default: + return fail ? fail(value) : void 0; + } + } + function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) { + if (typeof value === "object" && value !== null && typeof value.toJSON === "function") { + value = value.toJSON(key); + } + switch (typeof value) { + case "string": + return strEscape(value); + case "object": { + if (value === null) { + return "null"; + } + if (stack.indexOf(value) !== -1) { + return circularValue; + } + const originalIndentation = indentation; + let res = ""; + let join = ","; + if (Array.isArray(value)) { + if (value.length === 0) { + return "[]"; + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"'; + } + stack.push(value); + if (spacer !== "") { + indentation += spacer; + res += ` +${indentation}`; + join = `, +${indentation}`; + } + const maximumValuesToStringify = Math.min(value.length, maximumBreadth); + let i = 0; + for (; i < maximumValuesToStringify - 1; i++) { + const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation); + res += tmp2 !== void 0 ? tmp2 : "null"; + res += join; + } + const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation); + res += tmp !== void 0 ? tmp : "null"; + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1; + res += `${join}"... ${getItemCount(removedKeys)} not stringified"`; + } + if (spacer !== "") { + res += ` +${originalIndentation}`; + } + stack.pop(); + return `[${res}]`; + } + stack.push(value); + let whitespace = ""; + if (spacer !== "") { + indentation += spacer; + join = `, +${indentation}`; + whitespace = " "; + } + let separator = ""; + for (const key2 of replacer) { + const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation); + if (tmp !== void 0) { + res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`; + separator = join; + } + } + if (spacer !== "" && separator.length > 1) { + res = ` +${indentation}${res} +${originalIndentation}`; + } + stack.pop(); + return `{${res}}`; + } + case "number": + return isFinite(value) ? String(value) : fail ? fail(value) : "null"; + case "boolean": + return value === true ? "true" : "false"; + case "undefined": + return void 0; + case "bigint": + if (bigint) { + return String(value); + } + // fallthrough + default: + return fail ? fail(value) : void 0; + } + } + function stringifyIndent(key, value, stack, spacer, indentation) { + switch (typeof value) { + case "string": + return strEscape(value); + case "object": { + if (value === null) { + return "null"; + } + if (typeof value.toJSON === "function") { + value = value.toJSON(key); + if (typeof value !== "object") { + return stringifyIndent(key, value, stack, spacer, indentation); + } + if (value === null) { + return "null"; + } + } + if (stack.indexOf(value) !== -1) { + return circularValue; + } + const originalIndentation = indentation; + if (Array.isArray(value)) { + if (value.length === 0) { + return "[]"; + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"'; + } + stack.push(value); + indentation += spacer; + let res2 = ` +${indentation}`; + const join2 = `, +${indentation}`; + const maximumValuesToStringify = Math.min(value.length, maximumBreadth); + let i = 0; + for (; i < maximumValuesToStringify - 1; i++) { + const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation); + res2 += tmp2 !== void 0 ? tmp2 : "null"; + res2 += join2; + } + const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation); + res2 += tmp !== void 0 ? tmp : "null"; + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1; + res2 += `${join2}"... ${getItemCount(removedKeys)} not stringified"`; + } + res2 += ` +${originalIndentation}`; + stack.pop(); + return `[${res2}]`; + } + let keys = Object.keys(value); + const keyLength = keys.length; + if (keyLength === 0) { + return "{}"; + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"'; + } + indentation += spacer; + const join = `, +${indentation}`; + let res = ""; + let separator = ""; + let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth); + if (isTypedArrayWithEntries(value)) { + res += stringifyTypedArray(value, join, maximumBreadth); + keys = keys.slice(value.length); + maximumPropertiesToStringify -= value.length; + separator = join; + } + if (deterministic) { + keys = sort(keys, comparator); + } + stack.push(value); + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key2 = keys[i]; + const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation); + if (tmp !== void 0) { + res += `${separator}${strEscape(key2)}: ${tmp}`; + separator = join; + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth; + res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`; + separator = join; + } + if (separator !== "") { + res = ` +${indentation}${res} +${originalIndentation}`; + } + stack.pop(); + return `{${res}}`; + } + case "number": + return isFinite(value) ? String(value) : fail ? fail(value) : "null"; + case "boolean": + return value === true ? "true" : "false"; + case "undefined": + return void 0; + case "bigint": + if (bigint) { + return String(value); + } + // fallthrough + default: + return fail ? fail(value) : void 0; + } + } + function stringifySimple(key, value, stack) { + switch (typeof value) { + case "string": + return strEscape(value); + case "object": { + if (value === null) { + return "null"; + } + if (typeof value.toJSON === "function") { + value = value.toJSON(key); + if (typeof value !== "object") { + return stringifySimple(key, value, stack); + } + if (value === null) { + return "null"; + } + } + if (stack.indexOf(value) !== -1) { + return circularValue; + } + let res = ""; + const hasLength = value.length !== void 0; + if (hasLength && Array.isArray(value)) { + if (value.length === 0) { + return "[]"; + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"'; + } + stack.push(value); + const maximumValuesToStringify = Math.min(value.length, maximumBreadth); + let i = 0; + for (; i < maximumValuesToStringify - 1; i++) { + const tmp2 = stringifySimple(String(i), value[i], stack); + res += tmp2 !== void 0 ? tmp2 : "null"; + res += ","; + } + const tmp = stringifySimple(String(i), value[i], stack); + res += tmp !== void 0 ? tmp : "null"; + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1; + res += `,"... ${getItemCount(removedKeys)} not stringified"`; + } + stack.pop(); + return `[${res}]`; + } + let keys = Object.keys(value); + const keyLength = keys.length; + if (keyLength === 0) { + return "{}"; + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"'; + } + let separator = ""; + let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth); + if (hasLength && isTypedArrayWithEntries(value)) { + res += stringifyTypedArray(value, ",", maximumBreadth); + keys = keys.slice(value.length); + maximumPropertiesToStringify -= value.length; + separator = ","; + } + if (deterministic) { + keys = sort(keys, comparator); + } + stack.push(value); + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key2 = keys[i]; + const tmp = stringifySimple(key2, value[key2], stack); + if (tmp !== void 0) { + res += `${separator}${strEscape(key2)}:${tmp}`; + separator = ","; + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth; + res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`; + } + stack.pop(); + return `{${res}}`; + } + case "number": + return isFinite(value) ? String(value) : fail ? fail(value) : "null"; + case "boolean": + return value === true ? "true" : "false"; + case "undefined": + return void 0; + case "bigint": + if (bigint) { + return String(value); + } + // fallthrough + default: + return fail ? fail(value) : void 0; + } + } + function stringify2(value, replacer, space) { + if (arguments.length > 1) { + let spacer = ""; + if (typeof space === "number") { + spacer = " ".repeat(Math.min(space, 10)); + } else if (typeof space === "string") { + spacer = space.slice(0, 10); + } + if (replacer != null) { + if (typeof replacer === "function") { + return stringifyFnReplacer("", { "": value }, [], replacer, spacer, ""); + } + if (Array.isArray(replacer)) { + return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, ""); + } + } + if (spacer.length !== 0) { + return stringifyIndent("", value, [], spacer, ""); + } + } + return stringifySimple("", value, []); + } + return stringify2; + } + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/multistream.js +var require_multistream = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/multistream.js"(exports, module) { + "use strict"; + var metadata = /* @__PURE__ */ Symbol.for("pino.metadata"); + var { DEFAULT_LEVELS } = require_constants(); + var DEFAULT_INFO_LEVEL = DEFAULT_LEVELS.info; + function multistream(streamsArray, opts) { + streamsArray = streamsArray || []; + opts = opts || { dedupe: false }; + const streamLevels = Object.create(DEFAULT_LEVELS); + streamLevels.silent = Infinity; + if (opts.levels && typeof opts.levels === "object") { + Object.keys(opts.levels).forEach((i) => { + streamLevels[i] = opts.levels[i]; + }); + } + const res = { + write, + add, + remove, + emit, + flushSync, + end, + minLevel: 0, + lastId: 0, + streams: [], + clone, + [metadata]: true, + streamLevels + }; + if (Array.isArray(streamsArray)) { + streamsArray.forEach(add, res); + } else { + add.call(res, streamsArray); + } + streamsArray = null; + return res; + function write(data) { + let dest; + const level = this.lastLevel; + const { streams } = this; + let recordedLevel = 0; + let stream; + for (let i = initLoopVar(streams.length, opts.dedupe); checkLoopVar(i, streams.length, opts.dedupe); i = adjustLoopVar(i, opts.dedupe)) { + dest = streams[i]; + if (dest.level <= level) { + if (recordedLevel !== 0 && recordedLevel !== dest.level) { + break; + } + stream = dest.stream; + if (stream[metadata]) { + const { lastTime, lastMsg, lastObj, lastLogger } = this; + stream.lastLevel = level; + stream.lastTime = lastTime; + stream.lastMsg = lastMsg; + stream.lastObj = lastObj; + stream.lastLogger = lastLogger; + } + stream.write(data); + if (opts.dedupe) { + recordedLevel = dest.level; + } + } else if (!opts.dedupe) { + break; + } + } + } + function emit(...args) { + for (const { stream } of this.streams) { + if (typeof stream.emit === "function") { + stream.emit(...args); + } + } + } + function flushSync() { + for (const { stream } of this.streams) { + if (typeof stream.flushSync === "function") { + stream.flushSync(); + } + } + } + function add(dest) { + if (!dest) { + return res; + } + const isStream = typeof dest.write === "function" || dest.stream; + const stream_ = dest.write ? dest : dest.stream; + if (!isStream) { + throw Error("stream object needs to implement either StreamEntry or DestinationStream interface"); + } + const { streams, streamLevels: streamLevels2 } = this; + let level; + if (typeof dest.levelVal === "number") { + level = dest.levelVal; + } else if (typeof dest.level === "string") { + level = streamLevels2[dest.level]; + } else if (typeof dest.level === "number") { + level = dest.level; + } else { + level = DEFAULT_INFO_LEVEL; + } + const dest_ = { + stream: stream_, + level, + levelVal: void 0, + id: ++res.lastId + }; + streams.unshift(dest_); + streams.sort(compareByLevel); + this.minLevel = streams[0].level; + return res; + } + function remove(id) { + const { streams } = this; + const index = streams.findIndex((s) => s.id === id); + if (index >= 0) { + streams.splice(index, 1); + streams.sort(compareByLevel); + this.minLevel = streams.length > 0 ? streams[0].level : -1; + } + return res; + } + function end() { + for (const { stream } of this.streams) { + if (typeof stream.flushSync === "function") { + stream.flushSync(); + } + stream.end(); + } + } + function clone(level) { + const streams = new Array(this.streams.length); + for (let i = 0; i < streams.length; i++) { + streams[i] = { + level, + stream: this.streams[i].stream + }; + } + return { + write, + add, + remove, + minLevel: level, + streams, + clone, + emit, + flushSync, + [metadata]: true + }; + } + } + function compareByLevel(a, b) { + return a.level - b.level; + } + function initLoopVar(length, dedupe) { + return dedupe ? length - 1 : 0; + } + function adjustLoopVar(i, dedupe) { + return dedupe ? i - 1 : i + 1; + } + function checkLoopVar(i, length, dedupe) { + return dedupe ? i >= 0 : i < length; + } + module.exports = multistream; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/pino.js +var require_pino = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/pino.js"(exports, module) { + function pinoBundlerAbsolutePath(p) { + try { + const path = __require("path"); + const outputDir = "/home/runner/workspace/artifacts/api-server/dist"; + return path.resolve(outputDir, p.replace(/^\.\//, "")); + } catch (e) { + const f = new Function("p", "return new URL(p, import.meta.url).pathname"); + return f(p); + } + } + globalThis.__bundlerPathsOverrides = { ...globalThis.__bundlerPathsOverrides || {}, "thread-stream-worker": pinoBundlerAbsolutePath("./thread-stream-worker.mjs"), "pino-worker": pinoBundlerAbsolutePath("./pino-worker.mjs"), "pino/file": pinoBundlerAbsolutePath("./pino-file.mjs"), "pino-pretty": pinoBundlerAbsolutePath("./pino-pretty.mjs") }; + var os = __require("node:os"); + var stdSerializers = require_pino_std_serializers(); + var caller = require_caller(); + var redaction = require_redaction(); + var time = require_time(); + var proto = require_proto(); + var symbols = require_symbols(); + var { configure } = require_safe_stable_stringify(); + var { assertDefaultLevelFound, mappings, genLsCache, genLevelComparison, assertLevelComparison } = require_levels(); + var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants(); + var { + createArgsNormalizer, + asChindings, + buildSafeSonicBoom, + buildFormatters, + stringify, + normalizeDestFileDescriptor, + noop + } = require_tools(); + var { version } = require_meta(); + var { + chindingsSym, + redactFmtSym, + serializersSym, + timeSym, + timeSliceIndexSym, + streamSym, + stringifySym, + stringifySafeSym, + stringifiersSym, + setLevelSym, + endSym, + formatOptsSym, + messageKeySym, + errorKeySym, + nestedKeySym, + mixinSym, + levelCompSym, + useOnlyCustomLevelsSym, + formattersSym, + hooksSym, + nestedKeyStrSym, + mixinMergeStrategySym, + msgPrefixSym + } = symbols; + var { epochTime, nullTime } = time; + var { pid } = process; + var hostname = os.hostname(); + var defaultErrorSerializer = stdSerializers.err; + var defaultOptions = { + level: "info", + levelComparison: SORTING_ORDER.ASC, + levels: DEFAULT_LEVELS, + messageKey: "msg", + errorKey: "err", + nestedKey: null, + enabled: true, + base: { pid, hostname }, + serializers: Object.assign(/* @__PURE__ */ Object.create(null), { + err: defaultErrorSerializer + }), + formatters: Object.assign(/* @__PURE__ */ Object.create(null), { + bindings(bindings) { + return bindings; + }, + level(label, number) { + return { level: number }; + } + }), + hooks: { + logMethod: void 0, + streamWrite: void 0 + }, + timestamp: epochTime, + name: void 0, + redact: null, + customLevels: null, + useOnlyCustomLevels: false, + depthLimit: 5, + edgeLimit: 100 + }; + var normalize = createArgsNormalizer(defaultOptions); + var serializers = Object.assign(/* @__PURE__ */ Object.create(null), stdSerializers); + function pino(...args) { + const instance = {}; + const { opts, stream } = normalize(instance, caller(), ...args); + if (opts.level && typeof opts.level === "string" && DEFAULT_LEVELS[opts.level.toLowerCase()] !== void 0) opts.level = opts.level.toLowerCase(); + const { + redact, + crlf, + serializers: serializers2, + timestamp, + messageKey, + errorKey, + nestedKey, + base, + name, + level, + customLevels, + levelComparison, + mixin, + mixinMergeStrategy, + useOnlyCustomLevels, + formatters, + hooks, + depthLimit, + edgeLimit, + onChild, + msgPrefix + } = opts; + const stringifySafe = configure({ + maximumDepth: depthLimit, + maximumBreadth: edgeLimit + }); + const allFormatters = buildFormatters( + formatters.level, + formatters.bindings, + formatters.log + ); + const stringifyFn = stringify.bind({ + [stringifySafeSym]: stringifySafe + }); + const stringifiers = redact ? redaction(redact, stringifyFn) : {}; + const formatOpts = redact ? { stringify: stringifiers[redactFmtSym] } : { stringify: stringifyFn }; + const end = "}" + (crlf ? "\r\n" : "\n"); + const coreChindings = asChindings.bind(null, { + [chindingsSym]: "", + [serializersSym]: serializers2, + [stringifiersSym]: stringifiers, + [stringifySym]: stringify, + [stringifySafeSym]: stringifySafe, + [formattersSym]: allFormatters + }); + let chindings = ""; + if (base !== null) { + if (name === void 0) { + chindings = coreChindings(base); + } else { + chindings = coreChindings(Object.assign({}, base, { name })); + } + } + const time2 = timestamp instanceof Function ? timestamp : timestamp ? epochTime : nullTime; + const timeSliceIndex = time2().indexOf(":") + 1; + if (useOnlyCustomLevels && !customLevels) throw Error("customLevels is required if useOnlyCustomLevels is set true"); + if (mixin && typeof mixin !== "function") throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`); + if (msgPrefix && typeof msgPrefix !== "string") throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`); + assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels); + const levels = mappings(customLevels, useOnlyCustomLevels); + if (typeof stream.emit === "function") { + stream.emit("message", { code: "PINO_CONFIG", config: { levels, messageKey, errorKey } }); + } + assertLevelComparison(levelComparison); + const levelCompFunc = genLevelComparison(levelComparison); + Object.assign(instance, { + levels, + [levelCompSym]: levelCompFunc, + [useOnlyCustomLevelsSym]: useOnlyCustomLevels, + [streamSym]: stream, + [timeSym]: time2, + [timeSliceIndexSym]: timeSliceIndex, + [stringifySym]: stringify, + [stringifySafeSym]: stringifySafe, + [stringifiersSym]: stringifiers, + [endSym]: end, + [formatOptsSym]: formatOpts, + [messageKeySym]: messageKey, + [errorKeySym]: errorKey, + [nestedKeySym]: nestedKey, + // protect against injection + [nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : "", + [serializersSym]: serializers2, + [mixinSym]: mixin, + [mixinMergeStrategySym]: mixinMergeStrategy, + [chindingsSym]: chindings, + [formattersSym]: allFormatters, + [hooksSym]: hooks, + silent: noop, + onChild, + [msgPrefixSym]: msgPrefix + }); + Object.setPrototypeOf(instance, proto()); + genLsCache(instance); + instance[setLevelSym](level); + return instance; + } + module.exports = pino; + module.exports.destination = (dest = process.stdout.fd) => { + if (typeof dest === "object") { + dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd); + return buildSafeSonicBoom(dest); + } else { + return buildSafeSonicBoom({ dest: normalizeDestFileDescriptor(dest), minLength: 0 }); + } + }; + module.exports.transport = require_transport(); + module.exports.multistream = require_multistream(); + module.exports.levels = mappings(); + module.exports.stdSerializers = serializers; + module.exports.stdTimeFunctions = Object.assign({}, time); + module.exports.symbols = symbols; + module.exports.version = version; + module.exports.default = pino; + module.exports.pino = pino; + } +}); + +// ../../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js +var require_split2 = __commonJS({ + "../../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports, module) { + "use strict"; + var { Transform } = __require("stream"); + var { StringDecoder } = __require("string_decoder"); + var kLast = /* @__PURE__ */ Symbol("last"); + var kDecoder = /* @__PURE__ */ 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(); + } + function flush(cb) { + this[kLast] += this[kDecoder].end(); + if (this[kLast]) { + try { + push(this, this.mapper(this[kLast])); + } catch (error) { + return cb(error); + } + } + cb(); + } + function push(self, val) { + if (val !== void 0) { + self.push(val); + } + } + function noop(incoming) { + return incoming; + } + 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 StringDecoder("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; + } + module.exports = split; + } +}); + +// ../../node_modules/.pnpm/pino-abstract-transport@2.0.0/node_modules/pino-abstract-transport/index.js +var require_pino_abstract_transport = __commonJS({ + "../../node_modules/.pnpm/pino-abstract-transport@2.0.0/node_modules/pino-abstract-transport/index.js"(exports, module) { + "use strict"; + var metadata = /* @__PURE__ */ Symbol.for("pino.metadata"); + var split = require_split2(); + var { Duplex } = __require("stream"); + var { parentPort, workerData } = __require("worker_threads"); + function createDeferred() { + let resolve; + let reject; + const promise = new Promise((_resolve, _reject) => { + resolve = _resolve; + reject = _reject; + }); + promise.resolve = resolve; + promise.reject = reject; + return promise; + } + module.exports = function build(fn, opts = {}) { + const waitForConfig = opts.expectPinoConfig === true && workerData?.workerData?.pinoWillSendConfig === true; + const parseLines = opts.parse === "lines"; + const parseLine = typeof opts.parseLine === "function" ? opts.parseLine : JSON.parse; + const close = opts.close || defaultClose; + const stream = split(function(line) { + let value; + try { + value = parseLine(line); + } catch (error) { + this.emit("unknown", line, error); + return; + } + if (value === null) { + this.emit("unknown", line, "Null value ignored"); + return; + } + if (typeof value !== "object") { + value = { + data: value, + time: Date.now() + }; + } + if (stream[metadata]) { + stream.lastTime = value.time; + stream.lastLevel = value.level; + stream.lastObj = value; + } + if (parseLines) { + return line; + } + return value; + }, { autoDestroy: true }); + stream._destroy = function(err, cb) { + const promise = close(err, cb); + if (promise && typeof promise.then === "function") { + promise.then(cb, cb); + } + }; + if (opts.expectPinoConfig === true && workerData?.workerData?.pinoWillSendConfig !== true) { + setImmediate(() => { + stream.emit("error", new Error("This transport is not compatible with the current version of pino. Please upgrade pino to the latest version.")); + }); + } + if (opts.metadata !== false) { + stream[metadata] = true; + stream.lastTime = 0; + stream.lastLevel = 0; + stream.lastObj = null; + } + if (waitForConfig) { + let pinoConfig = {}; + const configReceived = createDeferred(); + parentPort.on("message", function handleMessage(message) { + if (message.code === "PINO_CONFIG") { + pinoConfig = message.config; + configReceived.resolve(); + parentPort.off("message", handleMessage); + } + }); + Object.defineProperties(stream, { + levels: { + get() { + return pinoConfig.levels; + } + }, + messageKey: { + get() { + return pinoConfig.messageKey; + } + }, + errorKey: { + get() { + return pinoConfig.errorKey; + } + } + }); + return configReceived.then(finish); + } + return finish(); + function finish() { + let res = fn(stream); + if (res && typeof res.catch === "function") { + res.catch((err) => { + stream.destroy(err); + }); + res = null; + } else if (opts.enablePipelining && res) { + return Duplex.from({ writable: stream, readable: res }); + } + return stream; + } + }; + function defaultClose(err, cb) { + process.nextTick(cb, err); + } + } +}); + +// ../../node_modules/.pnpm/real-require@0.2.0/node_modules/real-require/src/index.js +var require_src = __commonJS({ + "../../node_modules/.pnpm/real-require@0.2.0/node_modules/real-require/src/index.js"(exports, module) { + var realImport = new Function("modulePath", "return import(modulePath)"); + function realRequire(modulePath) { + if (typeof __non_webpack__require__ === "function") { + return __non_webpack__require__(modulePath); + } + return __require(modulePath); + } + module.exports = { realImport, realRequire }; + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/transport-stream.js +var require_transport_stream = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/transport-stream.js"(exports, module) { + "use strict"; + var { realImport, realRequire } = require_src(); + module.exports = loadTransportStreamBuilder; + async function loadTransportStreamBuilder(target) { + let fn; + try { + const toLoad = target.startsWith("file://") ? target : "file://" + target; + if (toLoad.endsWith(".ts") || toLoad.endsWith(".cts")) { + if (process[/* @__PURE__ */ Symbol.for("ts-node.register.instance")]) { + realRequire("ts-node/register"); + } else if (process.env && process.env.TS_NODE_DEV) { + realRequire("ts-node-dev"); + } + fn = realRequire(decodeURIComponent(target)); + } else { + fn = await realImport(toLoad); + } + } catch (error) { + if (error.code === "ENOTDIR" || error.code === "ERR_MODULE_NOT_FOUND") { + fn = realRequire(target); + } else if (error.code === void 0 || error.code === "ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING") { + try { + fn = realRequire(decodeURIComponent(target)); + } catch { + throw error; + } + } else { + throw error; + } + } + if (typeof fn === "object") fn = fn.default; + if (typeof fn === "object") fn = fn.default; + if (typeof fn !== "function") throw Error("exported worker is not a function"); + return fn; + } + } +}); + +// ../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/worker.js +var require_worker = __commonJS({ + "../../node_modules/.pnpm/pino@9.14.0/node_modules/pino/lib/worker.js"(exports, module) { + var EE = __require("node:events"); + var { pipeline, PassThrough } = __require("node:stream"); + var pino = require_pino(); + var build = require_pino_abstract_transport(); + var loadTransportStreamBuilder = require_transport_stream(); + module.exports = async function({ targets, pipelines, levels, dedupe }) { + const targetStreams = []; + if (targets && targets.length) { + targets = await Promise.all(targets.map(async (t) => { + const fn = await loadTransportStreamBuilder(t.target); + const stream = await fn(t.options); + return { + level: t.level, + stream + }; + })); + targetStreams.push(...targets); + } + if (pipelines && pipelines.length) { + pipelines = await Promise.all( + pipelines.map(async (p) => { + let level; + const pipeDests = await Promise.all( + p.map( + async (t) => { + level = t.level; + const fn = await loadTransportStreamBuilder(t.target); + const stream = await fn(t.options); + return stream; + } + ) + ); + return { + level, + stream: createPipeline(pipeDests) + }; + }) + ); + targetStreams.push(...pipelines); + } + if (targetStreams.length === 1) { + return targetStreams[0].stream; + } else { + return build(process2, { + parse: "lines", + metadata: true, + close(err, cb) { + let expected = 0; + for (const transport of targetStreams) { + expected++; + transport.stream.on("close", closeCb); + transport.stream.end(); + } + function closeCb() { + if (--expected === 0) { + cb(err); + } + } + } + }); + } + function process2(stream) { + const multi = pino.multistream(targetStreams, { levels, dedupe }); + stream.on("data", function(chunk) { + const { lastTime, lastMsg, lastObj, lastLevel } = this; + multi.lastLevel = lastLevel; + multi.lastTime = lastTime; + multi.lastMsg = lastMsg; + multi.lastObj = lastObj; + multi.write(chunk + "\n"); + }); + } + function createPipeline(streams) { + const ee = new EE(); + const stream = new PassThrough({ + autoDestroy: true, + destroy(_, cb) { + ee.on("error", cb); + ee.on("closed", cb); + } + }); + pipeline(stream, ...streams, function(err) { + if (err && err.code !== "ERR_STREAM_PREMATURE_CLOSE") { + ee.emit("error", err); + return; + } + ee.emit("closed"); + }); + return stream; + } + }; + } +}); +export default require_worker(); +//# sourceMappingURL=pino-worker.mjs.map