From be2588dd0fab9bb62feecf71e54faefb3c7d1424 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Mar 2021 05:06:17 +0000 Subject: [PATCH 1/2] Bump probot from 11.0.6 to 11.1.0 Bumps [probot](https://github.com/probot/probot) from 11.0.6 to 11.1.0. - [Release notes](https://github.com/probot/probot/releases) - [Commits](https://github.com/probot/probot/compare/v11.0.6...v11.1.0) Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 24 ++++++------------------ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 7b6e938dd..934587d58 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "escape-string-regexp": "4.0.0", "ignore": "5.1.8", "lodash": "4.17.20", - "probot": "11.0.6", + "probot": "11.1.0", "regex-parser": "2.2.11", "request": "2.88.2", "semver": "7.3.4" diff --git a/yarn.lock b/yarn.lock index d06f222c9..1900b7306 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4880,7 +4880,7 @@ pino-pretty@^4.2.1: split2 "^3.1.1" strip-json-comments "^3.1.1" -pino-std-serializers@^2.4.0, pino-std-serializers@^2.4.2: +pino-std-serializers@^2.4.0: version "2.5.0" resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-2.5.0.tgz#40ead781c65a0ce7ecd9c1c33f409d31fe712315" integrity sha512-wXqbqSrIhE58TdrxxlfLwU9eDhrzppQDvGhBEr1gYbzzM4KKo3Y63gSjiDXRKLVS2UOXdPNR2v+KnQgNrs+xUg== @@ -4890,19 +4890,7 @@ pino-std-serializers@^3.1.0: resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz#b56487c402d882eb96cd67c257868016b61ad671" integrity sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg== -pino@^6.0.0, pino@^6.7.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/pino/-/pino-6.8.0.tgz#d242f9936f2e65217fde75c0af5d5d8b4d3d3fde" - integrity sha512-nxq+6Jr7m0cMjYFBoTRw3bco14omZ/SQCheAHz9GVwdkbUrzKhgT+gSI/ql2Mnsca0QQKgpB/ACWhjxE4JsX3Q== - dependencies: - fast-redact "^3.0.0" - fast-safe-stringify "^2.0.7" - flatstr "^1.0.12" - pino-std-serializers "^2.4.2" - quick-format-unescaped "^4.0.1" - sonic-boom "^1.0.2" - -pino@^6.11.0: +pino@^6.0.0, pino@^6.11.0, pino@^6.7.0: version "6.11.1" resolved "https://registry.yarnpkg.com/pino/-/pino-6.11.1.tgz#5af2d5395cfe625ead9fe64a3b51a4802cd2598e" integrity sha512-PoDR/4jCyaP1k2zhuQ4N0NuhaMtei+C9mUHBRRJQujexl/bq3JkeL2OC23ada6Np3zeUMHbO4TGzY2D/rwZX3w== @@ -4992,10 +4980,10 @@ pretty-format@^26.6.2: ansi-styles "^4.0.0" react-is "^17.0.1" -probot@11.0.6, probot@^11.0.6: - version "11.0.6" - resolved "https://registry.yarnpkg.com/probot/-/probot-11.0.6.tgz#9ed421a8d4b89f8ee8873374668aeb9eca5760c4" - integrity sha512-KvX931ZXno/jveNbMk+1QeWa63XOJWfnGHDGiE1R+r54VHEg7dQAeLpaOjTX34DiZpTlFUvyulXZoFMDFnQsYQ== +probot@11.1.0, probot@^11.0.6: + version "11.1.0" + resolved "https://registry.yarnpkg.com/probot/-/probot-11.1.0.tgz#8cf63bf2b8c57759ac66bcc155d3769dca64f128" + integrity sha512-h+Bty4+mxrF+lstLlzfwBZSRO5OnTUGbYWjMWadFoYoal3dGqIf7VQFloCZZM2qNTpHqRawnqW20ZLHoErcF9Q== dependencies: "@octokit/core" "^3.2.4" "@octokit/plugin-enterprise-compatibility" "^1.2.8" From 63d8bc0bcfa9ba2c719f6dd7bf8d570c95ac7e9a Mon Sep 17 00:00:00 2001 From: Joseph Petersen Date: Fri, 12 Mar 2021 08:51:50 +0100 Subject: [PATCH 2/2] build --- dist/index.js | 2411 ++++++++++++------------------------------------- 1 file changed, 556 insertions(+), 1855 deletions(-) diff --git a/dist/index.js b/dist/index.js index 024aaf4e3..6b3eb38dc 100644 --- a/dist/index.js +++ b/dist/index.js @@ -10,14 +10,6 @@ module.exports = JSON.parse("{\"name\":\"@hapi/joi\",\"description\":\"Object sc /***/ }), -/***/ 63550: -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse("{\"name\":\"pino\",\"version\":\"6.11.1\",\"description\":\"super fast, all natural json logger\",\"main\":\"pino.js\",\"browser\":\"./browser.js\",\"files\":[\"pino.js\",\"bin.js\",\"browser.js\",\"pretty.js\",\"usage.txt\",\"test\",\"docs\",\"example.js\",\"lib\"],\"scripts\":{\"docs\":\"docsify serve\",\"browser-test\":\"airtap --local 8080 test/browser*test.js\",\"lint\":\"eslint .\",\"test\":\"npm run lint && tap --100 test/*test.js test/*/*test.js\",\"cov-ui\":\"tap --coverage-report=html test/*test.js test/*/*test.js\",\"bench\":\"node benchmarks/utils/runbench all\",\"bench-basic\":\"node benchmarks/utils/runbench basic\",\"bench-object\":\"node benchmarks/utils/runbench object\",\"bench-deep-object\":\"node benchmarks/utils/runbench deep-object\",\"bench-multi-arg\":\"node benchmarks/utils/runbench multi-arg\",\"bench-longs-tring\":\"node benchmarks/utils/runbench long-string\",\"bench-child\":\"node benchmarks/utils/runbench child\",\"bench-child-child\":\"node benchmarks/utils/runbench child-child\",\"bench-child-creation\":\"node benchmarks/utils/runbench child-creation\",\"bench-formatters\":\"node benchmarks/utils/runbench formatters\",\"update-bench-doc\":\"node benchmarks/utils/generate-benchmark-doc > docs/benchmarks.md\"},\"bin\":{\"pino\":\"./bin.js\"},\"precommit\":\"test\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/pinojs/pino.git\"},\"keywords\":[\"fast\",\"logger\",\"stream\",\"json\"],\"author\":\"Matteo Collina \",\"contributors\":[\"David Mark Clements \",\"James Sumners \",\"Thomas Watson Steen (https://twitter.com/wa7son)\"],\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/pinojs/pino/issues\"},\"homepage\":\"http://getpino.io\",\"devDependencies\":{\"airtap\":\"3.0.0\",\"benchmark\":\"^2.1.4\",\"bole\":\"^4.0.0\",\"bunyan\":\"^1.8.14\",\"docsify-cli\":\"^4.4.1\",\"eslint\":\"^7.17.0\",\"eslint-config-standard\":\"^16.0.2\",\"eslint-plugin-import\":\"^2.22.1\",\"eslint-plugin-node\":\"^11.1.0\",\"eslint-plugin-promise\":\"^4.2.1\",\"execa\":\"^4.0.0\",\"fastbench\":\"^1.0.1\",\"flush-write-stream\":\"^2.0.0\",\"import-fresh\":\"^3.2.1\",\"log\":\"^6.0.0\",\"loglevel\":\"^1.6.7\",\"pino-pretty\":\"^4.1.0\",\"pre-commit\":\"^1.2.2\",\"proxyquire\":\"^2.1.3\",\"pump\":\"^3.0.0\",\"semver\":\"^7.0.0\",\"split2\":\"^3.1.1\",\"steed\":\"^1.1.3\",\"strip-ansi\":\"^6.0.0\",\"tap\":\"^14.10.8\",\"tape\":\"^5.0.0\",\"through2\":\"^4.0.0\",\"winston\":\"^3.3.3\"},\"dependencies\":{\"fast-redact\":\"^3.0.0\",\"fast-safe-stringify\":\"^2.0.7\",\"flatstr\":\"^1.0.12\",\"pino-std-serializers\":\"^3.1.0\",\"quick-format-unescaped\":\"^4.0.1\",\"sonic-boom\":\"^1.0.2\"}}"); - -/***/ }), - /***/ 54582: /***/ ((__unused_webpack_module, __unused_webpack_exports, __nccwpck_require__) => { @@ -15658,1852 +15650,274 @@ function getPayload(request) { request.setEncoding("utf8"); request.on("error", error => reject(new AggregateError([error]))); request.on("data", chunk => data += chunk); - request.on("end", () => { - try { - resolve(JSON.parse(data)); - } catch (error) { - error.message = "Invalid JSON"; - error.status = 400; - reject(new AggregateError([error])); - } - }); - }); -} - -var Algorithm; - -(function (Algorithm) { - Algorithm["SHA1"] = "sha1"; - Algorithm["SHA256"] = "sha256"; -})(Algorithm || (Algorithm = {})); - -function sign(options, payload) { - const { - secret, - algorithm - } = typeof options === "string" ? { - secret: options, - algorithm: Algorithm.SHA1 - } : { - secret: options.secret, - algorithm: options.algorithm || Algorithm.SHA1 - }; - - if (!secret || !payload) { - throw new TypeError("[@octokit/webhooks] secret & payload required"); - } - - if (!Object.values(Algorithm).includes(algorithm)) { - throw new TypeError(`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha1' or 'sha256'`); - } - - payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload); - return `${algorithm}=${crypto.createHmac(algorithm, secret).update(payload).digest("hex")}`; -} - -function toNormalizedJsonString(payload) { - return JSON.stringify(payload).replace(/[^\\]\\u[\da-f]{4}/g, s => { - return s.substr(0, 3) + s.substr(3).toUpperCase(); - }); -} - -const getAlgorithm = signature => { - return signature.startsWith("sha256=") ? "sha256" : "sha1"; -}; - -function verify(secret, eventPayload, signature) { - if (!secret || !eventPayload || !signature) { - throw new TypeError("[@octokit/webhooks] secret, eventPayload & signature required"); - } - - const signatureBuffer = buffer.Buffer.from(signature); - const algorithm = getAlgorithm(signature); - const verificationBuffer = buffer.Buffer.from(sign({ - secret, - algorithm - }, eventPayload)); - - if (signatureBuffer.length !== verificationBuffer.length) { - return false; - } - - return crypto.timingSafeEqual(signatureBuffer, verificationBuffer); -} - -function verifyAndReceive(state, event) { - // verify will validate that the secret is not undefined - const matchesSignature = verify(state.secret, event.payload, event.signature); - - if (!matchesSignature) { - const error = new Error("[@octokit/webhooks] signature does not match event payload and secret"); - return state.eventHandler.receive(Object.assign(error, { - event, - status: 400 - })); - } - - return state.eventHandler.receive({ - id: event.id, - name: event.name, - payload: event.payload - }); -} - -const debugWebhooks = debug.debug("webhooks:receiver"); -function middleware(state, request, response, next) { - if (isntWebhook(request, { - path: state.path - })) { - // the next callback is set when used as an express middleware. That allows - // it to define custom routes like /my/custom/page while the webhooks are - // expected to be sent to the / root path. Otherwise the root path would - // match all requests and would make it impossible to define custom rooutes - if (next) { - next(); - return; - } - - debugWebhooks(`ignored: ${request.method} ${request.url}`); - response.statusCode = 404; - response.end("Not found"); - return; - } - - const missingHeaders = getMissingHeaders(request).join(", "); - - if (missingHeaders) { - const error = new Error(`[@octokit/webhooks] Required headers missing: ${missingHeaders}`); - return state.eventHandler.receive(error).catch(() => { - response.statusCode = 400; - response.end(error.message); - }); - } - - const eventName = request.headers["x-github-event"]; - const signatureSHA1 = request.headers["x-hub-signature"]; - const signatureSHA256 = request.headers["x-hub-signature-256"]; - const id = request.headers["x-github-delivery"]; - debugWebhooks(`${eventName} event received (id: ${id})`); // GitHub will abort the request if it does not receive a response within 10s - // See https://github.com/octokit/webhooks.js/issues/185 - - let didTimeout = false; - const timeout = setTimeout(() => { - didTimeout = true; - response.statusCode = 202; - response.end("still processing\n"); - }, 9000).unref(); - return getPayload(request).then(payload => { - return verifyAndReceive(state, { - id: id, - name: eventName, - payload, - signature: signatureSHA256 || signatureSHA1 - }); - }).then(() => { - clearTimeout(timeout); - if (didTimeout) return; - response.end("ok\n"); - }).catch(error => { - clearTimeout(timeout); - if (didTimeout) return; - const statusCode = Array.from(error)[0].status; - response.statusCode = statusCode || 500; - response.end(error.toString()); - }); -} - -function createMiddleware(options) { - if (!options || !options.secret) { - throw new Error("[@octokit/webhooks] options.secret required"); - } - - const state = { - eventHandler: createEventHandler(options), - path: options.path || "/", - secret: options.secret, - hooks: {} - }; - const api = middleware.bind(null, state); - api.on = state.eventHandler.on; - api.removeListener = state.eventHandler.removeListener; - return api; -} - -class Webhooks { - constructor(options) { - if (!options || !options.secret) { - throw new Error("[@octokit/webhooks] options.secret required"); - } - - const state = { - eventHandler: createEventHandler(options), - path: options.path || "/", - secret: options.secret, - hooks: {} - }; - this.sign = sign.bind(null, options.secret); - this.verify = verify.bind(null, options.secret); - this.on = state.eventHandler.on; - this.onAny = state.eventHandler.onAny; - this.onError = state.eventHandler.onError; - this.removeListener = state.eventHandler.removeListener; - this.receive = state.eventHandler.receive; - this.middleware = middleware.bind(null, state); - this.verifyAndReceive = verifyAndReceive.bind(null, state); - } - -} - -const createWebhooksApi = Webhooks.prototype.constructor; - -exports.Webhooks = Webhooks; -exports.createEventHandler = createEventHandler; -exports.createMiddleware = createMiddleware; -exports.createWebhooksApi = createWebhooksApi; -exports.sign = sign; -exports.verify = verify; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ 93159: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -const ProbotExports = __nccwpck_require__(58930); -const pino = __nccwpck_require__(9021); - -const { transport } = __nccwpck_require__(96645); - -module.exports = { ...ProbotExports, run }; - -async function run(app) { - const log = pino({}, transport); - - const githubToken = - process.env.GITHUB_TOKEN || - process.env.INPUT_GITHUB_TOKEN || - process.env.INPUT_TOKEN; - - if (!githubToken) { - log.error( - "[probot/adapter-github-actions] a token must be passed as `env.GITHUB_TOKEN` or `with.GITHUB_TOKEN` or `with.token`, see https://github.com/probot/adapter-github-actions#usage" - ); - return; - } - - const envVariablesMissing = [ - "GITHUB_RUN_ID", - "GITHUB_EVENT_NAME", - "GITHUB_EVENT_PATH", - ].filter((name) => !process.env[name]); - - if (envVariablesMissing.length) { - log.error( - `[probot/adapter-github-actions] GitHub Action default environment variables missing: ${envVariablesMissing.join( - ", " - )}. See https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables` - ); - return; - } - - const probot = ProbotExports.createProbot({ - overrides: { - githubToken, - log, - }, - }); - - await probot.load(app); - - return probot - .receive({ - id: process.env.GITHUB_RUN_ID, - name: process.env.GITHUB_EVENT_NAME, - payload: require(process.env.GITHUB_EVENT_PATH), - }) - .catch((error) => { - probot.log.error(error); - }); -} - - -/***/ }), - -/***/ 42726: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const errSerializer = __nccwpck_require__(20957) -const reqSerializers = __nccwpck_require__(95831) -const resSerializers = __nccwpck_require__(19283) - -module.exports = { - err: errSerializer, - mapHttpRequest: reqSerializers.mapHttpRequest, - mapHttpResponse: resSerializers.mapHttpResponse, - req: reqSerializers.reqSerializer, - res: resSerializers.resSerializer, - - wrapErrorSerializer: function wrapErrorSerializer (customSerializer) { - if (customSerializer === errSerializer) return customSerializer - return function wrapErrSerializer (err) { - return customSerializer(errSerializer(err)) - } - }, - - wrapRequestSerializer: function wrapRequestSerializer (customSerializer) { - if (customSerializer === reqSerializers.reqSerializer) return customSerializer - return function wrappedReqSerializer (req) { - return customSerializer(reqSerializers.reqSerializer(req)) - } - }, - - wrapResponseSerializer: function wrapResponseSerializer (customSerializer) { - if (customSerializer === resSerializers.resSerializer) return customSerializer - return function wrappedResSerializer (res) { - return customSerializer(resSerializers.resSerializer(res)) - } - } -} - - -/***/ }), - -/***/ 20957: -/***/ ((module) => { - -"use strict"; - - -module.exports = errSerializer - -const { toString } = Object.prototype -const seen = Symbol('circular-ref-tag') -const rawSymbol = Symbol('pino-raw-err-ref') -const pinoErrProto = Object.create({}, { - type: { - enumerable: true, - writable: true, - value: undefined - }, - message: { - enumerable: true, - writable: true, - value: undefined - }, - stack: { - enumerable: true, - writable: true, - value: undefined - }, - raw: { - enumerable: false, - get: function () { - return this[rawSymbol] - }, - set: function (val) { - this[rawSymbol] = val - } - } -}) -Object.defineProperty(pinoErrProto, rawSymbol, { - writable: true, - value: {} -}) - -function errSerializer (err) { - if (!(err instanceof Error)) { - return err - } - - err[seen] = undefined // tag to prevent re-looking at this - 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 - for (const key in err) { - if (_err[key] === undefined) { - const val = err[key] - if (val instanceof Error) { - /* eslint-disable no-prototype-builtins */ - if (!val.hasOwnProperty(seen)) { - _err[key] = errSerializer(val) - } - } else { - _err[key] = val - } - } - } - - delete err[seen] // clean up tag in case err is serialized again later - _err.raw = err - return _err -} - - -/***/ }), - -/***/ 95831: -/***/ ((module) => { - -"use strict"; - - -module.exports = { - mapHttpRequest, - reqSerializer -} - -const rawSymbol = Symbol('pino-raw-req-ref') -const 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) { - // req.info is for hapi compat. - 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 : undefined))) - _req.method = req.method - // req.originalUrl is for expressjs compat. - if (req.originalUrl) { - _req.url = req.originalUrl - _req.query = req.query - _req.params = req.params - } else { - // req.url.path is for hapi compat. - _req.url = req.path || (req.url ? (req.url.path || req.url) : undefined) - } - _req.headers = req.headers - _req.remoteAddress = connection && connection.remoteAddress - _req.remotePort = connection && connection.remotePort - // req.raw is for hapi compat/equivalence - _req.raw = req.raw || req - return _req -} - -function mapHttpRequest (req) { - return { - req: reqSerializer(req) - } -} - - -/***/ }), - -/***/ 19283: -/***/ ((module) => { - -"use strict"; - - -module.exports = { - mapHttpResponse, - resSerializer -} - -const rawSymbol = Symbol('pino-raw-res-ref') -const 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.statusCode - _res.headers = res.getHeaders ? res.getHeaders() : res._headers - _res.raw = res - return _res -} - -function mapHttpResponse (res) { - return { - res: resSerializer(res) - } -} - - -/***/ }), - -/***/ 51106: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - -/* eslint no-prototype-builtins: 0 */ -const flatstr = __nccwpck_require__(35298) -const { - lsCacheSym, - levelValSym, - useOnlyCustomLevelsSym, - streamSym, - formattersSym, - hooksSym -} = __nccwpck_require__(78511) -const { noop, genLog } = __nccwpck_require__(28751) - -const levels = { - trace: 10, - debug: 20, - info: 30, - warn: 40, - error: 50, - fatal: 60 -} -const levelMethods = { - fatal: (hook) => { - const logFatal = genLog(levels.fatal, hook) - return function (...args) { - const stream = this[streamSym] - logFatal.call(this, ...args) - if (typeof stream.flushSync === 'function') { - try { - stream.flushSync() - } catch (e) { - // https://github.com/pinojs/pino/pull/740#discussion_r346788313 - } - } - } - }, - error: (hook) => genLog(levels.error, hook), - warn: (hook) => genLog(levels.warn, hook), - info: (hook) => genLog(levels.info, hook), - debug: (hook) => genLog(levels.debug, hook), - trace: (hook) => genLog(levels.trace, hook) -} - -const nums = Object.keys(levels).reduce((o, k) => { - o[levels[k]] = k - return o -}, {}) - -const initialLsCache = Object.keys(nums).reduce((o, k) => { - o[k] = flatstr('{"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] === undefined) throw Error('unknown level value' + level) - level = labels[level] - } - if (values[level] === undefined) throw Error('unknown level ' + level) - const preLevelVal = this[levelValSym] - const levelVal = this[levelValSym] = values[level] - const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym] - const hook = this[hooksSym].logMethod - - for (const key in values) { - if (levelVal > values[key]) { - 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 - ) -} - -function getLevel (level) { - const { levels, levelVal } = this - // protection against potential loss of Pino scope from serializers (edge case with circular refs - https://github.com/pinojs/pino/issues/833) - return (levels && levels.labels) ? levels.labels[levelVal] : '' -} - -function isLevelEnabled (logLevel) { - const { values } = this.levels - const logLevelVal = values[logLevel] - return logLevelVal !== undefined && (logLevelVal >= this[levelValSym]) -} - -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 : 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 : 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') - } - } -} - -module.exports = { - initialLsCache, - genLsCache, - levelMethods, - getLevel, - setLevel, - isLevelEnabled, - mappings, - assertNoLevelCollisions, - assertDefaultLevelFound -} - - -/***/ }), - -/***/ 34961: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const { version } = __nccwpck_require__(63550) - -module.exports = { version } - - -/***/ }), - -/***/ 88925: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -/* eslint no-prototype-builtins: 0 */ - -const { EventEmitter } = __nccwpck_require__(28614) -const SonicBoom = __nccwpck_require__(73460) -const flatstr = __nccwpck_require__(35298) -const { - lsCacheSym, - levelValSym, - setLevelSym, - getLevelSym, - chindingsSym, - parsedChindingsSym, - mixinSym, - asJsonSym, - writeSym, - timeSym, - timeSliceIndexSym, - streamSym, - serializersSym, - formattersSym, - useOnlyCustomLevelsSym, - needsMetadataGsym -} = __nccwpck_require__(78511) -const { - getLevel, - setLevel, - isLevelEnabled, - mappings, - initialLsCache, - genLsCache, - assertNoLevelCollisions -} = __nccwpck_require__(51106) -const { - asChindings, - asJson, - buildFormatters -} = __nccwpck_require__(28751) -const { - version -} = __nccwpck_require__(34961) - -// note: use of class is satirical -// https://github.com/pinojs/pino/pull/433#pullrequestreview-127703127 -const constructor = class Pino {} -const 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') }, - [lsCacheSym]: initialLsCache, - [writeSym]: write, - [asJsonSym]: asJson, - [getLevelSym]: getLevel, - [setLevelSym]: setLevel -} - -Object.setPrototypeOf(prototype, EventEmitter.prototype) - -// exporting and consuming the prototype object using factory pattern fixes scoping issues with getters when serializing -module.exports = function () { - return Object.create(prototype) -} - -const resetChildingsFormatter = bindings => bindings -function child (bindings) { - if (!bindings) { - throw Error('missing bindings for child Pino') - } - const serializers = this[serializersSym] - const formatters = this[formattersSym] - const instance = Object.create(this) - if (bindings.hasOwnProperty('serializers') === true) { - instance[serializersSym] = Object.create(null) - - for (const k in serializers) { - instance[serializersSym][k] = serializers[k] - } - const parentSymbols = Object.getOwnPropertySymbols(serializers) - /* eslint no-var: off */ - for (var i = 0; i < parentSymbols.length; i++) { - const ks = parentSymbols[i] - instance[serializersSym][ks] = serializers[ks] - } - - for (const bk in bindings.serializers) { - instance[serializersSym][bk] = bindings.serializers[bk] - } - const bindingsSymbols = Object.getOwnPropertySymbols(bindings.serializers) - for (var bi = 0; bi < bindingsSymbols.length; bi++) { - const bks = bindingsSymbols[bi] - instance[serializersSym][bks] = bindings.serializers[bks] - } - } else instance[serializersSym] = serializers - if (bindings.hasOwnProperty('formatters')) { - const { level, bindings: chindings, log } = bindings.formatters - instance[formattersSym] = buildFormatters( - level || formatters.level, - chindings || resetChildingsFormatter, - log || formatters.log - ) - } else { - instance[formattersSym] = buildFormatters( - formatters.level, - resetChildingsFormatter, - formatters.log - ) - } - if (bindings.hasOwnProperty('customLevels') === true) { - assertNoLevelCollisions(this.levels, bindings.customLevels) - instance.levels = mappings(bindings.customLevels, instance[useOnlyCustomLevelsSym]) - genLsCache(instance) - } - instance[chindingsSym] = asChindings(instance, bindings) - const childLevel = bindings.level || this.level - instance[setLevelSym](childLevel) - - return instance -} - -function bindings () { - const chindings = this[chindingsSym] - const chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac" - 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 write (_obj, msg, num) { - const t = this[timeSym]() - const mixin = this[mixinSym] - const objError = _obj instanceof Error - let obj - - if (_obj === undefined || _obj === null) { - obj = mixin ? mixin({}) : {} - } else { - obj = Object.assign(mixin ? mixin(_obj) : {}, _obj) - if (!msg && objError) { - msg = _obj.message - } - - if (objError) { - obj.stack = _obj.stack - if (!obj.type) { - obj.type = 'Error' - } - } - } - - 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 // for child loggers - } - if (stream instanceof SonicBoom) stream.write(s) - else stream.write(flatstr(s)) -} - -function flush () { - const stream = this[streamSym] - if ('flush' in stream) stream.flush() -} - - -/***/ }), - -/***/ 87418: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -const fastRedact = __nccwpck_require__(24826) -const { redactFmtSym, wildcardFirstSym } = __nccwpck_require__(78511) -const { rx, validator } = fastRedact - -const validate = validator({ - ERR_PATHS_MUST_BE_STRINGS: () => 'pino – redacted paths must be strings', - ERR_INVALID_PATH: (s) => `pino – redact paths array contains an invalid path (${s})` -}) - -const CENSOR = '[Redacted]' -const strict = false // TODO should this be configurable? - -function redaction (opts, serialize) { - const { paths, censor } = handle(opts) - - const shape = paths.reduce((o, str) => { - rx.lastIndex = 0 - const first = rx.exec(str) - const next = rx.exec(str) - - // ns is the top-level path segment, brackets + quoting removed. - let ns = first[1] !== undefined - ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, '$1') - : first[0] - - if (ns === '*') { - ns = wildcardFirstSym - } - - // top level key: - if (next === null) { - o[ns] = null - return o - } - - // path with at least two segments: - // if ns is already redacted at the top level, ignore lower level redactions - if (o[ns] === null) { - return o - } - - const { index } = next - const nextPath = `${str.substr(index, str.length - 1)}` - - o[ns] = o[ns] || [] - - // shape is a mix of paths beginning with literal values and wildcard - // paths [ "a.b.c", "*.b.z" ] should reduce to a shape of - // { "a": [ "b.c", "b.z" ], *: [ "b.z" ] } - // note: "b.z" is in both "a" and * arrays because "a" matches the wildcard. - // (* entry has wildcardFirstSym as key) - if (ns !== wildcardFirstSym && o[ns].length === 0) { - // first time ns's get all '*' redactions so far - o[ns].push(...(o[wildcardFirstSym] || [])) - } - - if (ns === wildcardFirstSym) { - // new * path gets added to all previously registered literal ns's. - Object.keys(o).forEach(function (k) { - if (o[k]) { - o[k].push(nextPath) - } - }) - } - - o[ns].push(nextPath) - return o - }, {}) - - // the redactor assigned to the format symbol key - // provides top level redaction for instances where - // an object is interpolated into the msg string - const result = { - [redactFmtSym]: fastRedact({ paths, censor, serialize, strict }) - } - - const topCensor = (...args) => { - return typeof censor === 'function' ? serialize(censor(...args)) : serialize(censor) - } - - return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => { - // top level key: - if (shape[k] === null) { - o[k] = (value) => topCensor(value, [k]) - } else { - const wrappedCensor = typeof censor === 'function' - ? (value, path) => { - return censor(value, [k, ...path]) - } - : censor - o[k] = fastRedact({ - paths: shape[k], - censor: wrappedCensor, - serialize, - strict - }) - } - return o - }, result) -} - -function handle (opts) { - if (Array.isArray(opts)) { - opts = { paths: opts, censor: CENSOR } - validate(opts) - return opts - } - let { paths, censor = CENSOR, remove } = opts - if (Array.isArray(paths) === false) { throw Error('pino – redact must contain an array of strings') } - if (remove === true) censor = undefined - validate({ paths, censor }) - - return { paths, censor } -} - -module.exports = redaction - - -/***/ }), - -/***/ 78511: -/***/ ((module) => { - -"use strict"; - - -const setLevelSym = Symbol('pino.setLevel') -const getLevelSym = Symbol('pino.getLevel') -const levelValSym = Symbol('pino.levelVal') -const useLevelLabelsSym = Symbol('pino.useLevelLabels') -const useOnlyCustomLevelsSym = Symbol('pino.useOnlyCustomLevels') -const mixinSym = Symbol('pino.mixin') - -const lsCacheSym = Symbol('pino.lsCache') -const chindingsSym = Symbol('pino.chindings') -const parsedChindingsSym = Symbol('pino.parsedChindings') - -const asJsonSym = Symbol('pino.asJson') -const writeSym = Symbol('pino.write') -const redactFmtSym = Symbol('pino.redactFmt') - -const timeSym = Symbol('pino.time') -const timeSliceIndexSym = Symbol('pino.timeSliceIndex') -const streamSym = Symbol('pino.stream') -const stringifySym = Symbol('pino.stringify') -const stringifiersSym = Symbol('pino.stringifiers') -const endSym = Symbol('pino.end') -const formatOptsSym = Symbol('pino.formatOpts') -const messageKeySym = Symbol('pino.messageKey') -const nestedKeySym = Symbol('pino.nestedKey') - -const wildcardFirstSym = Symbol('pino.wildcardFirst') - -// public symbols, no need to use the same pino -// version for these -const serializersSym = Symbol.for('pino.serializers') -const formattersSym = Symbol.for('pino.formatters') -const hooksSym = Symbol.for('pino.hooks') -const needsMetadataGsym = Symbol.for('pino.metadata') - -module.exports = { - setLevelSym, - getLevelSym, - levelValSym, - useLevelLabelsSym, - mixinSym, - lsCacheSym, - chindingsSym, - parsedChindingsSym, - asJsonSym, - writeSym, - serializersSym, - redactFmtSym, - timeSym, - timeSliceIndexSym, - streamSym, - stringifySym, - stringifiersSym, - endSym, - formatOptsSym, - messageKeySym, - nestedKeySym, - wildcardFirstSym, - needsMetadataGsym, - useOnlyCustomLevelsSym, - formattersSym, - hooksSym -} - - -/***/ }), - -/***/ 57148: -/***/ ((module) => { - -"use strict"; - - -const nullTime = () => '' - -const epochTime = () => `,"time":${Date.now()}` - -const unixTime = () => `,"time":${Math.round(Date.now() / 1000.0)}` - -const isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"` // using Date.now() for testability - -module.exports = { nullTime, epochTime, unixTime, isoTime } - - -/***/ }), - -/***/ 28751: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - -"use strict"; - - -/* eslint no-prototype-builtins: 0 */ - -const format = __nccwpck_require__(5933) -const { mapHttpRequest, mapHttpResponse } = __nccwpck_require__(42726) -const SonicBoom = __nccwpck_require__(73460) -const stringifySafe = __nccwpck_require__(17676) -const { - lsCacheSym, - chindingsSym, - parsedChindingsSym, - writeSym, - serializersSym, - formatOptsSym, - endSym, - stringifiersSym, - stringifySym, - wildcardFirstSym, - needsMetadataGsym, - redactFmtSym, - streamSym, - nestedKeySym, - formattersSym, - messageKeySym -} = __nccwpck_require__(78511) - -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) - } - } - if (this[nestedKeySym]) o = { [this[nestedKeySym]]: o } - let formatParams - if (msg === null && n.length === 0) { - formatParams = [null] - } else { - msg = n.shift() - formatParams = n - } - this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level) - } else { - this[writeSym](null, format(o, n, this[formatOptsSym]), level) - } - } -} - -// magically escape strings for json -// relying on their charCodeAt -// everything below 32 needs JSON.stringify() -// 34 and 92 happens all the time, so we -// have a fast case for them -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) { - const stringify = this[stringifySym] - const stringifiers = this[stringifiersSym] - const end = this[endSym] - const chindings = this[chindingsSym] - const serializers = this[serializersSym] - const formatters = this[formattersSym] - const messageKey = this[messageKeySym] - let data = this[lsCacheSym][num] + time - - // we need the child bindings added to the output first so instance logged - // objects can take precedence when JSON.parse-ing the resulting log line - data = data + chindings - - let value - const notHasOwnProperty = obj.hasOwnProperty === undefined - if (formatters.log) { - obj = formatters.log(obj) - } - if (msg !== undefined) { - obj[messageKey] = msg - } - const wildcardStringifier = stringifiers[wildcardFirstSym] - for (const key in obj) { - value = obj[key] - if ((notHasOwnProperty || obj.hasOwnProperty(key)) && value !== undefined) { - value = serializers[key] ? serializers[key](value) : value - - const stringifier = stringifiers[key] || wildcardStringifier - - switch (typeof value) { - case 'undefined': - case 'function': - continue - case 'number': - /* eslint no-fallthrough: "off" */ - 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 || stringify)(value) - } - if (value === undefined) continue - data += ',"' + key + '":' + value - } - } - - return data + end -} - -function asChindings (instance, bindings) { - let value - let data = instance[chindingsSym] - const stringify = instance[stringifySym] - 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 !== 'level' && - key !== 'serializers' && - key !== 'formatters' && - key !== 'customLevels' && - bindings.hasOwnProperty(key) && - value !== undefined - if (valid === true) { - value = serializers[key] ? serializers[key](value) : value - value = (stringifiers[key] || wildcardStringifier || stringify)(value) - if (value === undefined) continue - data += ',"' + key + '":' + value - } - } - return data -} - -function getPrettyStream (opts, prettifier, dest, instance) { - if (prettifier && typeof prettifier === 'function') { - prettifier = prettifier.bind(instance) - return prettifierMetaWrapper(prettifier(opts), dest, opts) - } - try { - const prettyFactory = __nccwpck_require__(31691) - prettyFactory.asMetaWrapper = prettifierMetaWrapper - return prettifierMetaWrapper(prettyFactory(opts), dest, opts) - } catch (e) { - throw Error('Missing `pino-pretty` module: `pino-pretty` must be installed separately') - } -} - -function prettifierMetaWrapper (pretty, dest, opts) { - opts = Object.assign({ suppressFlushSyncWarning: false }, opts) - let warned = false - return { - [needsMetadataGsym]: true, - lastLevel: 0, - lastMsg: null, - lastObj: null, - lastLogger: null, - flushSync () { - if (opts.suppressFlushSyncWarning || warned) { - return - } - warned = true - setMetadataProps(dest, this) - dest.write(pretty(Object.assign({ - level: 40, // warn - msg: 'pino.final with prettyPrint does not support flushing', - time: Date.now() - }, this.chindings()))) - }, - chindings () { - const lastLogger = this.lastLogger - let chindings = null - - // protection against flushSync being called before logging - // anything - if (!lastLogger) { - return null - } - - if (lastLogger.hasOwnProperty(parsedChindingsSym)) { - chindings = lastLogger[parsedChindingsSym] - } else { - chindings = JSON.parse('{' + lastLogger[chindingsSym].substr(1) + '}') - lastLogger[parsedChindingsSym] = chindings - } - - return chindings - }, - write (chunk) { - const lastLogger = this.lastLogger - const chindings = this.chindings() - - let time = this.lastTime - - if (time.match(/^\d+/)) { - time = parseInt(time) - } else { - time = time.slice(1, -1) - } - - const lastObj = this.lastObj - const lastMsg = this.lastMsg - const errorProps = null - - const formatters = lastLogger[formattersSym] - const formattedObj = formatters.log ? formatters.log(lastObj) : lastObj - - const messageKey = lastLogger[messageKeySym] - if (lastMsg && formattedObj && !formattedObj.hasOwnProperty(messageKey)) { - formattedObj[messageKey] = lastMsg - } - - const obj = Object.assign({ - level: this.lastLevel, - time - }, formattedObj, errorProps) - - const serializers = lastLogger[serializersSym] - const keys = Object.keys(serializers) - - for (var i = 0; i < keys.length; i++) { - const key = keys[i] - if (obj[key] !== undefined) { - obj[key] = serializers[key](obj[key]) - } - } - - for (const key in chindings) { - if (!obj.hasOwnProperty(key)) { - obj[key] = chindings[key] - } - } - - const stringifiers = lastLogger[stringifiersSym] - const redact = stringifiers[redactFmtSym] - - const formatted = pretty(typeof redact === 'function' ? redact(obj) : obj) - if (formatted === undefined) return - - setMetadataProps(dest, this) - dest.write(formatted) - } - } -} - -function hasBeenTampered (stream) { - return stream.write !== stream.constructor.prototype.write -} - -function buildSafeSonicBoom (opts) { - const stream = new SonicBoom(opts) - stream.on('error', filterBrokenPipe) - return stream - - function filterBrokenPipe (err) { - // TODO verify on Windows - if (err.code === 'EPIPE') { - // If we get EPIPE, we should stop logging here - // however we have no control to the consumer of - // SonicBoom, so we just overwrite the write method - stream.write = noop - stream.end = noop - stream.flushSync = noop - stream.destroy = noop - return - } - stream.removeListener('error', filterBrokenPipe) - stream.emit('error', err) - } -} - -function createArgsNormalizer (defaultOptions) { - return function normalizeArgs (instance, opts = {}, stream) { - // support stream as a string - if (typeof opts === 'string') { - stream = buildSafeSonicBoom({ dest: opts, sync: true }) - opts = {} - } else if (typeof stream === 'string') { - stream = buildSafeSonicBoom({ dest: stream, sync: true }) - } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) { - stream = opts - opts = null - } - opts = Object.assign({}, defaultOptions, opts) - if ('extreme' in opts) { - throw Error('The extreme option has been removed, use pino.destination({ sync: false }) instead') - } - if ('onTerminated' in opts) { - throw Error('The onTerminated option has been removed, use pino.final instead') - } - if ('changeLevelName' in opts) { - process.emitWarning( - 'The changeLevelName option is deprecated and will be removed in v7. Use levelKey instead.', - { code: 'changeLevelName_deprecation' } - ) - opts.levelKey = opts.changeLevelName - delete opts.changeLevelName - } - const { enabled, prettyPrint, prettifier, messageKey } = opts - if (enabled === false) opts.level = 'silent' - stream = stream || process.stdout - if (stream === process.stdout && stream.fd >= 0 && !hasBeenTampered(stream)) { - stream = buildSafeSonicBoom({ fd: stream.fd, sync: true }) - } - if (prettyPrint) { - const prettyOpts = Object.assign({ messageKey }, prettyPrint) - stream = getPrettyStream(prettyOpts, prettifier, stream, instance) - } - return { opts, stream } - } -} - -function final (logger, handler) { - if (typeof logger === 'undefined' || typeof logger.child !== 'function') { - throw Error('expected a pino logger instance') - } - const hasHandler = (typeof handler !== 'undefined') - if (hasHandler && typeof handler !== 'function') { - throw Error('if supplied, the handler parameter should be a function') - } - const stream = logger[streamSym] - if (typeof stream.flushSync !== 'function') { - throw Error('final requires a stream that has a flushSync method, such as pino.destination') - } - - const finalLogger = new Proxy(logger, { - get: (logger, key) => { - if (key in logger.levels.values) { - return (...args) => { - logger[key](...args) - stream.flushSync() - } + request.on("end", () => { + try { + resolve(JSON.parse(data)); + } catch (error) { + error.message = "Invalid JSON"; + error.status = 400; + reject(new AggregateError([error])); } - return logger[key] - } - }) + }); + }); +} - if (!hasHandler) { - return finalLogger - } +var Algorithm; - return (err = null, ...args) => { - try { - stream.flushSync() - } catch (e) { - // it's too late to wait for the stream to be ready - // because this is a final tick scenario. - // in practice there shouldn't be a situation where it isn't - // however, swallow the error just in case (and for easier testing) - } - return handler(err, finalLogger, ...args) - } -} +(function (Algorithm) { + Algorithm["SHA1"] = "sha1"; + Algorithm["SHA256"] = "sha256"; +})(Algorithm || (Algorithm = {})); -function stringify (obj) { - try { - return JSON.stringify(obj) - } catch (_) { - return stringifySafe(obj) - } -} +function sign(options, payload) { + const { + secret, + algorithm + } = typeof options === "string" ? { + secret: options, + algorithm: Algorithm.SHA1 + } : { + secret: options.secret, + algorithm: options.algorithm || Algorithm.SHA1 + }; -function buildFormatters (level, bindings, log) { - return { - level, - bindings, - log + if (!secret || !payload) { + throw new TypeError("[@octokit/webhooks] secret & payload required"); } -} -function setMetadataProps (dest, that) { - if (dest[needsMetadataGsym] === true) { - dest.lastLevel = that.lastLevel - dest.lastMsg = that.lastMsg - dest.lastObj = that.lastObj - dest.lastTime = that.lastTime - dest.lastLogger = that.lastLogger + if (!Object.values(Algorithm).includes(algorithm)) { + throw new TypeError(`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha1' or 'sha256'`); } + + payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload); + return `${algorithm}=${crypto.createHmac(algorithm, secret).update(payload).digest("hex")}`; } -module.exports = { - noop, - buildSafeSonicBoom, - getPrettyStream, - asChindings, - asJson, - genLog, - createArgsNormalizer, - final, - stringify, - buildFormatters +function toNormalizedJsonString(payload) { + return JSON.stringify(payload).replace(/[^\\]\\u[\da-f]{4}/g, s => { + return s.substr(0, 3) + s.substr(3).toUpperCase(); + }); } +const getAlgorithm = signature => { + return signature.startsWith("sha256=") ? "sha256" : "sha1"; +}; -/***/ }), +function verify(secret, eventPayload, signature) { + if (!secret || !eventPayload || !signature) { + throw new TypeError("[@octokit/webhooks] secret, eventPayload & signature required"); + } -/***/ 9021: -/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + const signatureBuffer = buffer.Buffer.from(signature); + const algorithm = getAlgorithm(signature); + const verificationBuffer = buffer.Buffer.from(sign({ + secret, + algorithm + }, eventPayload)); -"use strict"; + if (signatureBuffer.length !== verificationBuffer.length) { + return false; + } -/* eslint no-prototype-builtins: 0 */ -const os = __nccwpck_require__(12087) -const stdSerializers = __nccwpck_require__(42726) -const redaction = __nccwpck_require__(87418) -const time = __nccwpck_require__(57148) -const proto = __nccwpck_require__(88925) -const symbols = __nccwpck_require__(78511) -const { assertDefaultLevelFound, mappings, genLsCache } = __nccwpck_require__(51106) -const { - createArgsNormalizer, - asChindings, - final, - stringify, - buildSafeSonicBoom, - buildFormatters, - noop -} = __nccwpck_require__(28751) -const { version } = __nccwpck_require__(34961) -const { - chindingsSym, - redactFmtSym, - serializersSym, - timeSym, - timeSliceIndexSym, - streamSym, - stringifySym, - stringifiersSym, - setLevelSym, - endSym, - formatOptsSym, - messageKeySym, - nestedKeySym, - mixinSym, - useOnlyCustomLevelsSym, - formattersSym, - hooksSym -} = symbols -const { epochTime, nullTime } = time -const { pid } = process -const hostname = os.hostname() -const defaultErrorSerializer = stdSerializers.err -const defaultOptions = { - level: 'info', - messageKey: 'msg', - nestedKey: null, - enabled: true, - prettyPrint: false, - base: { pid, hostname }, - serializers: Object.assign(Object.create(null), { - err: defaultErrorSerializer - }), - formatters: Object.assign(Object.create(null), { - bindings (bindings) { - return bindings - }, - level (label, number) { - return { level: number } - } - }), - hooks: { - logMethod: undefined - }, - timestamp: epochTime, - name: undefined, - redact: null, - customLevels: null, - levelKey: undefined, - useOnlyCustomLevels: false + return crypto.timingSafeEqual(signatureBuffer, verificationBuffer); } -const normalize = createArgsNormalizer(defaultOptions) +function verifyAndReceive(state, event) { + // verify will validate that the secret is not undefined + const matchesSignature = verify(state.secret, event.payload, event.signature); -const serializers = Object.assign(Object.create(null), stdSerializers) + if (!matchesSignature) { + const error = new Error("[@octokit/webhooks] signature does not match event payload and secret"); + return state.eventHandler.receive(Object.assign(error, { + event, + status: 400 + })); + } -function pino (...args) { - const instance = {} - const { opts, stream } = normalize(instance, ...args) - const { - redact, - crlf, - serializers, - timestamp, - messageKey, - nestedKey, - base, - name, - level, - customLevels, - useLevelLabels, - changeLevelName, - levelKey, - mixin, - useOnlyCustomLevels, - formatters, - hooks - } = opts + return state.eventHandler.receive({ + id: event.id, + name: event.name, + payload: event.payload + }); +} - const allFormatters = buildFormatters( - formatters.level, - formatters.bindings, - formatters.log - ) +const debugWebhooks = debug.debug("webhooks:receiver"); +function middleware(state, request, response, next) { + if (isntWebhook(request, { + path: state.path + })) { + // the next callback is set when used as an express middleware. That allows + // it to define custom routes like /my/custom/page while the webhooks are + // expected to be sent to the / root path. Otherwise the root path would + // match all requests and would make it impossible to define custom rooutes + if (next) { + next(); + return; + } - if (useLevelLabels && !(changeLevelName || levelKey)) { - process.emitWarning('useLevelLabels is deprecated, use the formatters.level option instead', 'Warning', 'PINODEP001') - allFormatters.level = labelsFormatter - } else if ((changeLevelName || levelKey) && !useLevelLabels) { - process.emitWarning('changeLevelName and levelKey are deprecated, use the formatters.level option instead', 'Warning', 'PINODEP002') - allFormatters.level = levelNameFormatter(changeLevelName || levelKey) - } else if ((changeLevelName || levelKey) && useLevelLabels) { - process.emitWarning('useLevelLabels is deprecated, use the formatters.level option instead', 'Warning', 'PINODEP001') - process.emitWarning('changeLevelName and levelKey are deprecated, use the formatters.level option instead', 'Warning', 'PINODEP002') - allFormatters.level = levelNameLabelFormatter(changeLevelName || levelKey) + debugWebhooks(`ignored: ${request.method} ${request.url}`); + response.statusCode = 404; + response.end("Not found"); + return; } - if (serializers[Symbol.for('pino.*')]) { - process.emitWarning('The pino.* serializer is deprecated, use the formatters.log options instead', 'Warning', 'PINODEP003') - allFormatters.log = serializers[Symbol.for('pino.*')] - } + const missingHeaders = getMissingHeaders(request).join(", "); - if (!allFormatters.bindings) { - allFormatters.bindings = defaultOptions.formatters.bindings + if (missingHeaders) { + const error = new Error(`[@octokit/webhooks] Required headers missing: ${missingHeaders}`); + return state.eventHandler.receive(error).catch(() => { + response.statusCode = 400; + response.end(error.message); + }); } - if (!allFormatters.level) { - allFormatters.level = defaultOptions.formatters.level + + const eventName = request.headers["x-github-event"]; + const signatureSHA1 = request.headers["x-hub-signature"]; + const signatureSHA256 = request.headers["x-hub-signature-256"]; + const id = request.headers["x-github-delivery"]; + debugWebhooks(`${eventName} event received (id: ${id})`); // GitHub will abort the request if it does not receive a response within 10s + // See https://github.com/octokit/webhooks.js/issues/185 + + let didTimeout = false; + const timeout = setTimeout(() => { + didTimeout = true; + response.statusCode = 202; + response.end("still processing\n"); + }, 9000).unref(); + return getPayload(request).then(payload => { + return verifyAndReceive(state, { + id: id, + name: eventName, + payload, + signature: signatureSHA256 || signatureSHA1 + }); + }).then(() => { + clearTimeout(timeout); + if (didTimeout) return; + response.end("ok\n"); + }).catch(error => { + clearTimeout(timeout); + if (didTimeout) return; + const statusCode = Array.from(error)[0].status; + response.statusCode = statusCode || 500; + response.end(error.toString()); + }); +} + +function createMiddleware(options) { + if (!options || !options.secret) { + throw new Error("[@octokit/webhooks] options.secret required"); } - const stringifiers = redact ? redaction(redact, stringify) : {} - const formatOpts = redact - ? { stringify: stringifiers[redactFmtSym] } - : { stringify } - const end = '}' + (crlf ? '\r\n' : '\n') - const coreChindings = asChindings.bind(null, { - [chindingsSym]: '', - [serializersSym]: serializers, - [stringifiersSym]: stringifiers, - [stringifySym]: stringify, - [formattersSym]: allFormatters - }) + const state = { + eventHandler: createEventHandler(options), + path: options.path || "/", + secret: options.secret, + hooks: {} + }; + const api = middleware.bind(null, state); + api.on = state.eventHandler.on; + api.removeListener = state.eventHandler.removeListener; + return api; +} - let chindings = '' - if (base !== null) { - if (name === undefined) { - chindings = coreChindings(base) - } else { - chindings = coreChindings(Object.assign({}, base, { name })) +class Webhooks { + constructor(options) { + if (!options || !options.secret) { + throw new Error("[@octokit/webhooks] options.secret required"); } + + const state = { + eventHandler: createEventHandler(options), + path: options.path || "/", + secret: options.secret, + hooks: {} + }; + this.sign = sign.bind(null, options.secret); + this.verify = verify.bind(null, options.secret); + this.on = state.eventHandler.on; + this.onAny = state.eventHandler.onAny; + this.onError = state.eventHandler.onError; + this.removeListener = state.eventHandler.removeListener; + this.receive = state.eventHandler.receive; + this.middleware = middleware.bind(null, state); + this.verifyAndReceive = verifyAndReceive.bind(null, state); } - const time = (timestamp instanceof Function) - ? timestamp - : (timestamp ? epochTime : nullTime) - const timeSliceIndex = time().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"`) +const createWebhooksApi = Webhooks.prototype.constructor; - assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels) - const levels = mappings(customLevels, useOnlyCustomLevels) +exports.Webhooks = Webhooks; +exports.createEventHandler = createEventHandler; +exports.createMiddleware = createMiddleware; +exports.createWebhooksApi = createWebhooksApi; +exports.sign = sign; +exports.verify = verify; +//# sourceMappingURL=index.js.map - Object.assign(instance, { - levels, - [useOnlyCustomLevelsSym]: useOnlyCustomLevels, - [streamSym]: stream, - [timeSym]: time, - [timeSliceIndexSym]: timeSliceIndex, - [stringifySym]: stringify, - [stringifiersSym]: stringifiers, - [endSym]: end, - [formatOptsSym]: formatOpts, - [messageKeySym]: messageKey, - [nestedKeySym]: nestedKey, - [serializersSym]: serializers, - [mixinSym]: mixin, - [chindingsSym]: chindings, - [formattersSym]: allFormatters, - [hooksSym]: hooks, - silent: noop - }) - Object.setPrototypeOf(instance, proto()) +/***/ }), - genLsCache(instance) +/***/ 93159: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { - instance[setLevelSym](level) +const ProbotExports = __nccwpck_require__(58930); +const pino = __nccwpck_require__(79608); - return instance -} +const { transport } = __nccwpck_require__(96645); -function labelsFormatter (label, number) { - return { level: label } -} +module.exports = { ...ProbotExports, run }; -function levelNameFormatter (name) { - return function (label, number) { - return { [name]: number } - } -} +async function run(app) { + const log = pino({}, transport); -function levelNameLabelFormatter (name) { - return function (label, number) { - return { [name]: label } - } -} + const githubToken = + process.env.GITHUB_TOKEN || + process.env.INPUT_GITHUB_TOKEN || + process.env.INPUT_TOKEN; -module.exports = pino + if (!githubToken) { + log.error( + "[probot/adapter-github-actions] a token must be passed as `env.GITHUB_TOKEN` or `with.GITHUB_TOKEN` or `with.token`, see https://github.com/probot/adapter-github-actions#usage" + ); + return; + } -module.exports.extreme = (dest = process.stdout.fd) => { - process.emitWarning( - 'The pino.extreme() option is deprecated and will be removed in v7. Use pino.destination({ sync: false }) instead.', - { code: 'extreme_deprecation' } - ) - return buildSafeSonicBoom({ dest, minLength: 4096, sync: false }) -} + const envVariablesMissing = [ + "GITHUB_RUN_ID", + "GITHUB_EVENT_NAME", + "GITHUB_EVENT_PATH", + ].filter((name) => !process.env[name]); -module.exports.destination = (dest = process.stdout.fd) => { - if (typeof dest === 'object') { - dest.dest = dest.dest || process.stdout.fd - return buildSafeSonicBoom(dest) - } else { - return buildSafeSonicBoom({ dest, minLength: 0, sync: true }) + if (envVariablesMissing.length) { + log.error( + `[probot/adapter-github-actions] GitHub Action default environment variables missing: ${envVariablesMissing.join( + ", " + )}. See https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables` + ); + return; } -} -module.exports.final = final -module.exports.levels = mappings() -module.exports.stdSerializers = serializers -module.exports.stdTimeFunctions = Object.assign({}, time) -module.exports.symbols = symbols -module.exports.version = version + const probot = ProbotExports.createProbot({ + overrides: { + githubToken, + log, + }, + }); -// Enables default and name export with TypeScript and Babel -module.exports.default = pino -module.exports.pino = pino + await probot.load(app); + + return probot + .receive({ + id: process.env.GITHUB_RUN_ID, + name: process.env.GITHUB_EVENT_NAME, + payload: require(process.env.GITHUB_EVENT_PATH), + }) + .catch((error) => { + probot.log.error(error); + }); +} /***/ }), @@ -17515,7 +15929,7 @@ const { inspect } = __nccwpck_require__(31669); const through = __nccwpck_require__(18180); const core = __nccwpck_require__(42186); -const pino = __nccwpck_require__(9021); +const pino = __nccwpck_require__(79608); const LEVEL_TO_ACTIONS_CORE_LOG_METHOD = { trace: "debug", @@ -100489,7 +98903,7 @@ function setLevel (level) { const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym] const hook = this[hooksSym].logMethod - for (var key in values) { + for (const key in values) { if (levelVal > values[key]) { this[key] = noop continue @@ -100519,10 +98933,12 @@ function isLevelEnabled (logLevel) { } function mappings (customLevels = null, useOnlyCustomLevels = false) { - const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => { - o[customLevels[k]] = k - return o - }, {}) : null + 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' } }), @@ -100687,16 +99103,17 @@ function child (bindings) { if (bindings.hasOwnProperty('serializers') === true) { instance[serializersSym] = Object.create(null) - for (var k in serializers) { + for (const k in serializers) { instance[serializersSym][k] = serializers[k] } const parentSymbols = Object.getOwnPropertySymbols(serializers) + /* eslint no-var: off */ for (var i = 0; i < parentSymbols.length; i++) { const ks = parentSymbols[i] instance[serializersSym][ks] = serializers[ks] } - for (var bk in bindings.serializers) { + for (const bk in bindings.serializers) { instance[serializersSym][bk] = bindings.serializers[bk] } const bindingsSymbols = Object.getOwnPropertySymbols(bindings.serializers) @@ -100733,8 +99150,8 @@ function child (bindings) { function bindings () { const chindings = this[chindingsSym] - var chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac" - var bindingsFromJson = JSON.parse(chindingsJson) + const chindingsJson = `{${chindings.substr(1)}}` // at least contains ,"pid":7068,"hostname":"myMac" + const bindingsFromJson = JSON.parse(chindingsJson) delete bindingsFromJson.pid delete bindingsFromJson.hostname return bindingsFromJson @@ -100750,7 +99167,7 @@ function write (_obj, msg, num) { const t = this[timeSym]() const mixin = this[mixinSym] const objError = _obj instanceof Error - var obj + let obj if (_obj === undefined || _obj === null) { obj = mixin ? mixin({}) : {} @@ -100881,9 +99298,11 @@ function redaction (opts, serialize) { if (shape[k] === null) { o[k] = (value) => topCensor(value, [k]) } else { - const wrappedCensor = typeof censor === 'function' ? (value, path) => { - return censor(value, [k, ...path]) - } : censor + const wrappedCensor = typeof censor === 'function' + ? (value, path) => { + return censor(value, [k, ...path]) + } + : censor o[k] = fastRedact({ paths: shape[k], censor: wrappedCensor, @@ -100901,7 +99320,7 @@ function handle (opts) { validate(opts) return opts } - var { paths, censor = CENSOR, remove } = opts + let { paths, censor = CENSOR, remove } = opts if (Array.isArray(paths) === false) { throw Error('pino – redact must contain an array of strings') } if (remove === true) censor = undefined validate({ paths, censor }) @@ -101014,7 +99433,7 @@ module.exports = { nullTime, epochTime, unixTime, isoTime } /* eslint no-prototype-builtins: 0 */ const format = __nccwpck_require__(5933) -const { mapHttpRequest, mapHttpResponse } = __nccwpck_require__(72571) +const { mapHttpRequest, mapHttpResponse } = __nccwpck_require__(73757) const SonicBoom = __nccwpck_require__(73460) const stringifySafe = __nccwpck_require__(17676) const { @@ -101042,12 +99461,12 @@ function genLog (level, hook) { if (!hook) return LOG return function hookWrappedLog (...args) { - hook.call(this, args, LOG) + hook.call(this, args, LOG, level) } function LOG (o, ...n) { if (typeof o === 'object') { - var msg = o + let msg = o if (o !== null) { if (o.method && o.headers && o.socket) { o = mapHttpRequest(o) @@ -101056,7 +99475,7 @@ function genLog (level, hook) { } } if (this[nestedKeySym]) o = { [this[nestedKeySym]]: o } - var formatParams + let formatParams if (msg === null && n.length === 0) { formatParams = [null] } else { @@ -101076,10 +99495,10 @@ function genLog (level, hook) { // 34 and 92 happens all the time, so we // have a fast case for them function asString (str) { - var result = '' - var last = 0 - var found = false - var point = 255 + let result = '' + let last = 0 + let found = false + let point = 255 const l = str.length if (l > 100) { return JSON.stringify(str) @@ -101108,14 +99527,14 @@ function asJson (obj, msg, num, time) { const serializers = this[serializersSym] const formatters = this[formattersSym] const messageKey = this[messageKeySym] - var data = this[lsCacheSym][num] + time + let data = this[lsCacheSym][num] + time // we need the child bindings added to the output first so instance logged // objects can take precedence when JSON.parse-ing the resulting log line data = data + chindings - var value - var notHasOwnProperty = obj.hasOwnProperty === undefined + let value + const notHasOwnProperty = obj.hasOwnProperty === undefined if (formatters.log) { obj = formatters.log(obj) } @@ -101123,7 +99542,7 @@ function asJson (obj, msg, num, time) { obj[messageKey] = msg } const wildcardStringifier = stringifiers[wildcardFirstSym] - for (var key in obj) { + for (const key in obj) { value = obj[key] if ((notHasOwnProperty || obj.hasOwnProperty(key)) && value !== undefined) { value = serializers[key] ? serializers[key](value) : value @@ -101158,9 +99577,8 @@ function asJson (obj, msg, num, time) { } function asChindings (instance, bindings) { - var key - var value - var data = instance[chindingsSym] + let value + let data = instance[chindingsSym] const stringify = instance[stringifySym] const stringifiers = instance[stringifiersSym] const wildcardStringifier = stringifiers[wildcardFirstSym] @@ -101168,7 +99586,7 @@ function asChindings (instance, bindings) { const formatter = instance[formattersSym].bindings bindings = formatter(bindings) - for (key in bindings) { + for (const key in bindings) { value = bindings[key] const valid = key !== 'level' && key !== 'serializers' && @@ -101192,7 +99610,7 @@ function getPrettyStream (opts, prettifier, dest, instance) { return prettifierMetaWrapper(prettifier(opts), dest, opts) } try { - var prettyFactory = __nccwpck_require__(31691) + const prettyFactory = __nccwpck_require__(31691) prettyFactory.asMetaWrapper = prettifierMetaWrapper return prettifierMetaWrapper(prettyFactory(opts), dest, opts) } catch (e) { @@ -101202,7 +99620,7 @@ function getPrettyStream (opts, prettifier, dest, instance) { function prettifierMetaWrapper (pretty, dest, opts) { opts = Object.assign({ suppressFlushSyncWarning: false }, opts) - var warned = false + let warned = false return { [needsMetadataGsym]: true, lastLevel: 0, @@ -101223,7 +99641,7 @@ function prettifierMetaWrapper (pretty, dest, opts) { }, chindings () { const lastLogger = this.lastLogger - var chindings = null + let chindings = null // protection against flushSync being called before logging // anything @@ -101244,7 +99662,7 @@ function prettifierMetaWrapper (pretty, dest, opts) { const lastLogger = this.lastLogger const chindings = this.chindings() - var time = this.lastTime + let time = this.lastTime if (time.match(/^\d+/)) { time = parseInt(time) @@ -101252,9 +99670,9 @@ function prettifierMetaWrapper (pretty, dest, opts) { time = time.slice(1, -1) } - var lastObj = this.lastObj - var lastMsg = this.lastMsg - var errorProps = null + const lastObj = this.lastObj + const lastMsg = this.lastMsg + const errorProps = null const formatters = lastLogger[formattersSym] const formattedObj = formatters.log ? formatters.log(lastObj) : lastObj @@ -101271,16 +99689,15 @@ function prettifierMetaWrapper (pretty, dest, opts) { const serializers = lastLogger[serializersSym] const keys = Object.keys(serializers) - var key for (var i = 0; i < keys.length; i++) { - key = keys[i] + const key = keys[i] if (obj[key] !== undefined) { obj[key] = serializers[key](obj[key]) } } - for (key in chindings) { + for (const key in chindings) { if (!obj.hasOwnProperty(key)) { obj[key] = chindings[key] } @@ -101447,6 +99864,279 @@ module.exports = { } +/***/ }), + +/***/ 73757: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const errSerializer = __nccwpck_require__(79276) +const reqSerializers = __nccwpck_require__(76343) +const resSerializers = __nccwpck_require__(71550) + +module.exports = { + err: errSerializer, + mapHttpRequest: reqSerializers.mapHttpRequest, + mapHttpResponse: resSerializers.mapHttpResponse, + req: reqSerializers.reqSerializer, + res: resSerializers.resSerializer, + + wrapErrorSerializer: function wrapErrorSerializer (customSerializer) { + if (customSerializer === errSerializer) return customSerializer + return function wrapErrSerializer (err) { + return customSerializer(errSerializer(err)) + } + }, + + wrapRequestSerializer: function wrapRequestSerializer (customSerializer) { + if (customSerializer === reqSerializers.reqSerializer) return customSerializer + return function wrappedReqSerializer (req) { + return customSerializer(reqSerializers.reqSerializer(req)) + } + }, + + wrapResponseSerializer: function wrapResponseSerializer (customSerializer) { + if (customSerializer === resSerializers.resSerializer) return customSerializer + return function wrappedResSerializer (res) { + return customSerializer(resSerializers.resSerializer(res)) + } + } +} + + +/***/ }), + +/***/ 79276: +/***/ ((module) => { + +"use strict"; + + +module.exports = errSerializer + +const { toString } = Object.prototype +const seen = Symbol('circular-ref-tag') +const rawSymbol = Symbol('pino-raw-err-ref') +const pinoErrProto = Object.create({}, { + type: { + enumerable: true, + writable: true, + value: undefined + }, + message: { + enumerable: true, + writable: true, + value: undefined + }, + stack: { + enumerable: true, + writable: true, + value: undefined + }, + raw: { + enumerable: false, + get: function () { + return this[rawSymbol] + }, + set: function (val) { + this[rawSymbol] = val + } + } +}) +Object.defineProperty(pinoErrProto, rawSymbol, { + writable: true, + value: {} +}) + +function errSerializer (err) { + if (!(err instanceof Error)) { + return err + } + + err[seen] = undefined // tag to prevent re-looking at this + 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 + for (const key in err) { + if (_err[key] === undefined) { + const val = err[key] + if (val instanceof Error) { + /* eslint-disable no-prototype-builtins */ + if (!val.hasOwnProperty(seen)) { + _err[key] = errSerializer(val) + } + } else { + _err[key] = val + } + } + } + + delete err[seen] // clean up tag in case err is serialized again later + _err.raw = err + return _err +} + + +/***/ }), + +/***/ 76343: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + mapHttpRequest, + reqSerializer +} + +const rawSymbol = Symbol('pino-raw-req-ref') +const 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) { + // req.info is for hapi compat. + 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 : undefined))) + _req.method = req.method + // req.originalUrl is for expressjs compat. + if (req.originalUrl) { + _req.url = req.originalUrl + _req.query = req.query + _req.params = req.params + } else { + // req.url.path is for hapi compat. + _req.url = req.path || (req.url ? (req.url.path || req.url) : undefined) + } + _req.headers = req.headers + _req.remoteAddress = connection && connection.remoteAddress + _req.remotePort = connection && connection.remotePort + // req.raw is for hapi compat/equivalence + _req.raw = req.raw || req + return _req +} + +function mapHttpRequest (req) { + return { + req: reqSerializer(req) + } +} + + +/***/ }), + +/***/ 71550: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + mapHttpResponse, + resSerializer +} + +const rawSymbol = Symbol('pino-raw-res-ref') +const 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.statusCode + _res.headers = res.getHeaders ? res.getHeaders() : res._headers + _res.raw = res + return _res +} + +function mapHttpResponse (res) { + return { + res: resSerializer(res) + } +} + + /***/ }), /***/ 79608: @@ -101456,7 +100146,7 @@ module.exports = { /* eslint no-prototype-builtins: 0 */ const os = __nccwpck_require__(12087) -const stdSerializers = __nccwpck_require__(72571) +const stdSerializers = __nccwpck_require__(73757) const redaction = __nccwpck_require__(34219) const time = __nccwpck_require__(61866) const proto = __nccwpck_require__(26899) @@ -101593,10 +100283,19 @@ function pino (...args) { [stringifySym]: stringify, [formattersSym]: allFormatters }) - const chindings = base === null ? '' : (name === undefined) - ? coreChindings(base) : coreChindings(Object.assign({}, base, { name })) + + let chindings = '' + if (base !== null) { + if (name === undefined) { + chindings = coreChindings(base) + } else { + chindings = coreChindings(Object.assign({}, base, { name })) + } + } + const time = (timestamp instanceof Function) - ? timestamp : (timestamp ? epochTime : nullTime) + ? timestamp + : (timestamp ? epochTime : nullTime) const timeSliceIndex = time().indexOf(':') + 1 if (useOnlyCustomLevels && !customLevels) throw Error('customLevels is required if useOnlyCustomLevels is set true') @@ -102077,9 +100776,9 @@ const get_authenticated_octokit_1 = __nccwpck_require__(88916); * * @param id - ID of the installation, which can be extracted from * `context.payload.installation.id`. If called without this parameter, the - * client wil authenticate [as the app](https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/about-authentication-options-for-github-apps/#authenticating-as-a-github-app) + * client wil authenticate [as the app](https://docs.github.com/en/developers/apps/authenticating-with-github-apps#authenticating-as-a-github-app) * instead of as a specific installation, which means it can only be used for - * [app APIs](https://developer.github.com/v3/apps/). + * [app APIs](https://docs.github.com/apps/). * * @returns An authenticated GitHub API client */ @@ -103052,6 +101751,8 @@ class Probot { } return this.webhooks.on(eventNameOrNames, callback); }; + this.onAny = this.webhooks.onAny; + this.onError = this.webhooks.onError; this.version = version_1.VERSION; } static defaults(defaults) { @@ -103339,7 +102040,7 @@ Server.version = version_1.VERSION; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.VERSION = void 0; // The version is set automatically before publish to npm -exports.VERSION = "11.0.6"; +exports.VERSION = "11.1.0"; //# sourceMappingURL=version.js.map /***/ }), @@ -129332,7 +128033,7 @@ module.exports = JSON.parse("{\"application/1d-interleaved-parityfec\":{\"source /***/ ((module) => { "use strict"; -module.exports = JSON.parse("{\"name\":\"pino\",\"version\":\"6.8.0\",\"description\":\"super fast, all natural json logger\",\"main\":\"pino.js\",\"browser\":\"./browser.js\",\"files\":[\"pino.js\",\"bin.js\",\"browser.js\",\"pretty.js\",\"usage.txt\",\"test\",\"docs\",\"example.js\",\"lib\"],\"scripts\":{\"docs\":\"docsify serve\",\"browser-test\":\"airtap --local 8080 test/browser*test.js\",\"test\":\"standard | snazzy && tap --100 test/*test.js test/*/*test.js\",\"cov-ui\":\"tap --coverage-report=html test/*test.js test/*/*test.js\",\"bench\":\"node benchmarks/utils/runbench all\",\"bench-basic\":\"node benchmarks/utils/runbench basic\",\"bench-object\":\"node benchmarks/utils/runbench object\",\"bench-deep-object\":\"node benchmarks/utils/runbench deep-object\",\"bench-multi-arg\":\"node benchmarks/utils/runbench multi-arg\",\"bench-longs-tring\":\"node benchmarks/utils/runbench long-string\",\"bench-child\":\"node benchmarks/utils/runbench child\",\"bench-child-child\":\"node benchmarks/utils/runbench child-child\",\"bench-child-creation\":\"node benchmarks/utils/runbench child-creation\",\"bench-formatters\":\"node benchmarks/utils/runbench formatters\",\"update-bench-doc\":\"node benchmarks/utils/generate-benchmark-doc > docs/benchmarks.md\"},\"bin\":{\"pino\":\"./bin.js\"},\"precommit\":\"test\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/pinojs/pino.git\"},\"keywords\":[\"fast\",\"logger\",\"stream\",\"json\"],\"author\":\"Matteo Collina \",\"contributors\":[\"David Mark Clements \",\"James Sumners \",\"Thomas Watson Steen (https://twitter.com/wa7son)\"],\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/pinojs/pino/issues\"},\"homepage\":\"http://getpino.io\",\"devDependencies\":{\"airtap\":\"3.0.0\",\"benchmark\":\"^2.1.4\",\"bole\":\"^4.0.0\",\"bunyan\":\"^1.8.14\",\"docsify-cli\":\"^4.4.1\",\"execa\":\"^4.0.0\",\"fastbench\":\"^1.0.1\",\"flush-write-stream\":\"^2.0.0\",\"import-fresh\":\"^3.2.1\",\"log\":\"^6.0.0\",\"loglevel\":\"^1.6.7\",\"pino-pretty\":\"^4.1.0\",\"pre-commit\":\"^1.2.2\",\"proxyquire\":\"^2.1.3\",\"pump\":\"^3.0.0\",\"semver\":\"^7.0.0\",\"snazzy\":\"^8.0.0\",\"split2\":\"^3.1.1\",\"standard\":\"^14.3.3\",\"steed\":\"^1.1.3\",\"strip-ansi\":\"^6.0.0\",\"tap\":\"^14.10.8\",\"tape\":\"^5.0.0\",\"through2\":\"^4.0.0\",\"winston\":\"^3.3.3\"},\"dependencies\":{\"fast-redact\":\"^3.0.0\",\"fast-safe-stringify\":\"^2.0.7\",\"flatstr\":\"^1.0.12\",\"pino-std-serializers\":\"^2.4.2\",\"quick-format-unescaped\":\"^4.0.1\",\"sonic-boom\":\"^1.0.2\"}}"); +module.exports = JSON.parse("{\"name\":\"pino\",\"version\":\"6.11.1\",\"description\":\"super fast, all natural json logger\",\"main\":\"pino.js\",\"browser\":\"./browser.js\",\"files\":[\"pino.js\",\"bin.js\",\"browser.js\",\"pretty.js\",\"usage.txt\",\"test\",\"docs\",\"example.js\",\"lib\"],\"scripts\":{\"docs\":\"docsify serve\",\"browser-test\":\"airtap --local 8080 test/browser*test.js\",\"lint\":\"eslint .\",\"test\":\"npm run lint && tap --100 test/*test.js test/*/*test.js\",\"cov-ui\":\"tap --coverage-report=html test/*test.js test/*/*test.js\",\"bench\":\"node benchmarks/utils/runbench all\",\"bench-basic\":\"node benchmarks/utils/runbench basic\",\"bench-object\":\"node benchmarks/utils/runbench object\",\"bench-deep-object\":\"node benchmarks/utils/runbench deep-object\",\"bench-multi-arg\":\"node benchmarks/utils/runbench multi-arg\",\"bench-longs-tring\":\"node benchmarks/utils/runbench long-string\",\"bench-child\":\"node benchmarks/utils/runbench child\",\"bench-child-child\":\"node benchmarks/utils/runbench child-child\",\"bench-child-creation\":\"node benchmarks/utils/runbench child-creation\",\"bench-formatters\":\"node benchmarks/utils/runbench formatters\",\"update-bench-doc\":\"node benchmarks/utils/generate-benchmark-doc > docs/benchmarks.md\"},\"bin\":{\"pino\":\"./bin.js\"},\"precommit\":\"test\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/pinojs/pino.git\"},\"keywords\":[\"fast\",\"logger\",\"stream\",\"json\"],\"author\":\"Matteo Collina \",\"contributors\":[\"David Mark Clements \",\"James Sumners \",\"Thomas Watson Steen (https://twitter.com/wa7son)\"],\"license\":\"MIT\",\"bugs\":{\"url\":\"https://github.com/pinojs/pino/issues\"},\"homepage\":\"http://getpino.io\",\"devDependencies\":{\"airtap\":\"3.0.0\",\"benchmark\":\"^2.1.4\",\"bole\":\"^4.0.0\",\"bunyan\":\"^1.8.14\",\"docsify-cli\":\"^4.4.1\",\"eslint\":\"^7.17.0\",\"eslint-config-standard\":\"^16.0.2\",\"eslint-plugin-import\":\"^2.22.1\",\"eslint-plugin-node\":\"^11.1.0\",\"eslint-plugin-promise\":\"^4.2.1\",\"execa\":\"^4.0.0\",\"fastbench\":\"^1.0.1\",\"flush-write-stream\":\"^2.0.0\",\"import-fresh\":\"^3.2.1\",\"log\":\"^6.0.0\",\"loglevel\":\"^1.6.7\",\"pino-pretty\":\"^4.1.0\",\"pre-commit\":\"^1.2.2\",\"proxyquire\":\"^2.1.3\",\"pump\":\"^3.0.0\",\"semver\":\"^7.0.0\",\"split2\":\"^3.1.1\",\"steed\":\"^1.1.3\",\"strip-ansi\":\"^6.0.0\",\"tap\":\"^14.10.8\",\"tape\":\"^5.0.0\",\"through2\":\"^4.0.0\",\"winston\":\"^3.3.3\"},\"dependencies\":{\"fast-redact\":\"^3.0.0\",\"fast-safe-stringify\":\"^2.0.7\",\"flatstr\":\"^1.0.12\",\"pino-std-serializers\":\"^3.1.0\",\"quick-format-unescaped\":\"^4.0.1\",\"sonic-boom\":\"^1.0.2\"}}"); /***/ }),