@relative-ci/core 5.3.4-alpha.0 → 6.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/__/@actions/http-client/lib/index.js +1 -1
- package/lib/cjs/__/@octokit/core/dist-src/version.js +1 -1
- package/lib/cjs/__/@octokit/core/dist-src/version.js.map +1 -1
- package/lib/cjs/__/@octokit/graphql/dist-bundle/index.js +4 -0
- package/lib/cjs/__/@octokit/graphql/dist-bundle/index.js.map +1 -1
- package/lib/cjs/__/@octokit/request/dist-bundle/index.js +10 -6
- package/lib/cjs/__/@octokit/request/dist-bundle/index.js.map +1 -1
- package/lib/cjs/__/content-type/dist/index.js +183 -0
- package/lib/cjs/__/content-type/dist/index.js.map +1 -0
- package/lib/cjs/__/cross-spawn/index.js +1 -1
- package/lib/cjs/__/{execa → env-ci/__/execa}/index.js +1 -1
- package/lib/cjs/__/env-ci/__/execa/index.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/command.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/error.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/promise.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/stdio.js.map +1 -0
- package/lib/cjs/__/{execa → env-ci/__/execa}/lib/stream.js +1 -1
- package/lib/cjs/__/env-ci/__/execa/lib/stream.js.map +1 -0
- package/lib/cjs/__/env-ci/__/execa/lib/verbose.js.map +1 -0
- package/lib/cjs/__/env-ci/__/get-stream/source/array-buffer.js.map +1 -0
- package/lib/cjs/__/env-ci/__/human-signals/build/src/core.js.map +1 -0
- package/lib/cjs/__/env-ci/__/human-signals/build/src/main.js.map +1 -0
- package/lib/cjs/__/env-ci/__/human-signals/build/src/realtime.js.map +1 -0
- package/lib/cjs/__/env-ci/__/human-signals/build/src/signals.js.map +1 -0
- package/lib/cjs/__/env-ci/__/is-stream/index.js.map +1 -0
- package/lib/cjs/__/{npm-run-path → env-ci/__/npm-run-path}/index.js +1 -1
- package/lib/cjs/__/env-ci/__/npm-run-path/index.js.map +1 -0
- package/lib/cjs/__/env-ci/__/path-key/index.js.map +1 -0
- package/lib/cjs/__/env-ci/__/signal-exit/dist/mjs/index.js.map +1 -0
- package/lib/cjs/__/env-ci/__/signal-exit/dist/mjs/signals.js.map +1 -0
- package/lib/cjs/__/env-ci/__/strip-final-newline/index.js.map +1 -0
- package/lib/cjs/__/env-ci/lib/git.js +1 -1
- package/lib/cjs/__/json-with-bigint/json-with-bigint.js +419 -60
- package/lib/cjs/__/json-with-bigint/json-with-bigint.js.map +1 -1
- package/lib/cjs/__/undici/lib/core/request.js +12 -1
- package/lib/cjs/__/undici/lib/core/request.js.map +1 -1
- package/lib/cjs/__/undici/lib/dispatcher/agent.js +0 -1
- package/lib/cjs/__/undici/lib/dispatcher/agent.js.map +1 -1
- package/lib/cjs/__/undici/lib/dispatcher/client-h1.js +151 -25
- package/lib/cjs/__/undici/lib/dispatcher/client-h1.js.map +1 -1
- package/lib/cjs/__/undici/lib/dispatcher/dispatcher-base.js +1 -0
- package/lib/cjs/__/undici/lib/dispatcher/dispatcher-base.js.map +1 -1
- package/lib/cjs/__/undici/lib/handler/retry-handler.js +34 -0
- package/lib/cjs/__/undici/lib/handler/retry-handler.js.map +1 -1
- package/lib/cjs/__/undici/lib/web/cookies/parse.js +16 -23
- package/lib/cjs/__/undici/lib/web/cookies/parse.js.map +1 -1
- package/lib/cjs/__/undici/lib/web/cookies/util.js +79 -9
- package/lib/cjs/__/undici/lib/web/cookies/util.js.map +1 -1
- package/lib/cjs/__/undici/lib/web/websocket/receiver.js +31 -8
- package/lib/cjs/__/undici/lib/web/websocket/receiver.js.map +1 -1
- package/lib/cjs/__/undici/lib/web/websocket/websocket.js +4 -1
- package/lib/cjs/__/undici/lib/web/websocket/websocket.js.map +1 -1
- package/lib/cjs/_virtual/_commonjsHelpers.js +1 -1
- package/lib/cjs/_virtual/index10.js +2 -2
- package/lib/cjs/_virtual/index11.js +2 -2
- package/lib/cjs/_virtual/index13.js +2 -2
- package/lib/cjs/_virtual/index9.js +3 -3
- package/lib/cjs/env/load.js +1 -1
- package/lib/cjs/env/load.js.map +1 -1
- package/lib/esm/__/@actions/http-client/lib/index.js +1 -1
- package/lib/esm/__/@octokit/core/dist-src/version.js +1 -1
- package/lib/esm/__/@octokit/core/dist-src/version.js.map +1 -1
- package/lib/esm/__/@octokit/graphql/dist-bundle/index.js +4 -0
- package/lib/esm/__/@octokit/graphql/dist-bundle/index.js.map +1 -1
- package/lib/esm/__/@octokit/request/dist-bundle/index.js +11 -7
- package/lib/esm/__/@octokit/request/dist-bundle/index.js.map +1 -1
- package/lib/esm/__/content-type/dist/index.js +181 -0
- package/lib/esm/__/content-type/dist/index.js.map +1 -0
- package/lib/esm/__/cross-spawn/index.js +1 -1
- package/lib/esm/__/{execa → env-ci/__/execa}/index.js +1 -1
- package/lib/esm/__/env-ci/__/execa/index.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/command.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/error.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/promise.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/stdio.js.map +1 -0
- package/lib/esm/__/{execa → env-ci/__/execa}/lib/stream.js +1 -1
- package/lib/esm/__/env-ci/__/execa/lib/stream.js.map +1 -0
- package/lib/esm/__/env-ci/__/execa/lib/verbose.js.map +1 -0
- package/lib/esm/__/env-ci/__/get-stream/source/array-buffer.js.map +1 -0
- package/lib/esm/__/env-ci/__/human-signals/build/src/core.js.map +1 -0
- package/lib/esm/__/env-ci/__/human-signals/build/src/main.js.map +1 -0
- package/lib/esm/__/env-ci/__/human-signals/build/src/realtime.js.map +1 -0
- package/lib/esm/__/env-ci/__/human-signals/build/src/signals.js.map +1 -0
- package/lib/esm/__/env-ci/__/is-stream/index.js.map +1 -0
- package/lib/esm/__/{npm-run-path → env-ci/__/npm-run-path}/index.js +1 -1
- package/lib/esm/__/env-ci/__/npm-run-path/index.js.map +1 -0
- package/lib/esm/__/env-ci/__/path-key/index.js.map +1 -0
- package/lib/esm/__/env-ci/__/signal-exit/dist/mjs/index.js.map +1 -0
- package/lib/esm/__/env-ci/__/signal-exit/dist/mjs/signals.js.map +1 -0
- package/lib/esm/__/env-ci/__/strip-final-newline/index.js.map +1 -0
- package/lib/esm/__/env-ci/lib/git.js +1 -1
- package/lib/esm/__/json-with-bigint/json-with-bigint.js +419 -60
- package/lib/esm/__/json-with-bigint/json-with-bigint.js.map +1 -1
- package/lib/esm/__/undici/lib/core/request.js +12 -1
- package/lib/esm/__/undici/lib/core/request.js.map +1 -1
- package/lib/esm/__/undici/lib/dispatcher/agent.js +0 -1
- package/lib/esm/__/undici/lib/dispatcher/agent.js.map +1 -1
- package/lib/esm/__/undici/lib/dispatcher/client-h1.js +151 -25
- package/lib/esm/__/undici/lib/dispatcher/client-h1.js.map +1 -1
- package/lib/esm/__/undici/lib/dispatcher/dispatcher-base.js +1 -0
- package/lib/esm/__/undici/lib/dispatcher/dispatcher-base.js.map +1 -1
- package/lib/esm/__/undici/lib/handler/retry-handler.js +34 -0
- package/lib/esm/__/undici/lib/handler/retry-handler.js.map +1 -1
- package/lib/esm/__/undici/lib/web/cookies/parse.js +16 -23
- package/lib/esm/__/undici/lib/web/cookies/parse.js.map +1 -1
- package/lib/esm/__/undici/lib/web/cookies/util.js +79 -9
- package/lib/esm/__/undici/lib/web/cookies/util.js.map +1 -1
- package/lib/esm/__/undici/lib/web/websocket/receiver.js +31 -8
- package/lib/esm/__/undici/lib/web/websocket/receiver.js.map +1 -1
- package/lib/esm/__/undici/lib/web/websocket/websocket.js +4 -1
- package/lib/esm/__/undici/lib/web/websocket/websocket.js.map +1 -1
- package/lib/esm/_virtual/_commonjsHelpers.js +1 -1
- package/lib/esm/_virtual/index10.js +2 -2
- package/lib/esm/_virtual/index11.js +2 -2
- package/lib/esm/_virtual/index13.js +2 -2
- package/lib/esm/_virtual/index9.js +3 -3
- package/lib/esm/env/load.js +1 -1
- package/lib/esm/env/load.js.map +1 -1
- package/package.json +12 -12
- package/lib/cjs/__/execa/index.js.map +0 -1
- package/lib/cjs/__/execa/lib/command.js.map +0 -1
- package/lib/cjs/__/execa/lib/error.js.map +0 -1
- package/lib/cjs/__/execa/lib/promise.js.map +0 -1
- package/lib/cjs/__/execa/lib/stdio.js.map +0 -1
- package/lib/cjs/__/execa/lib/stream.js.map +0 -1
- package/lib/cjs/__/execa/lib/verbose.js.map +0 -1
- package/lib/cjs/__/fast-content-type-parse/index.js +0 -182
- package/lib/cjs/__/fast-content-type-parse/index.js.map +0 -1
- package/lib/cjs/__/get-stream/source/array-buffer.js.map +0 -1
- package/lib/cjs/__/human-signals/build/src/core.js.map +0 -1
- package/lib/cjs/__/human-signals/build/src/main.js.map +0 -1
- package/lib/cjs/__/human-signals/build/src/realtime.js.map +0 -1
- package/lib/cjs/__/human-signals/build/src/signals.js.map +0 -1
- package/lib/cjs/__/is-stream/index.js.map +0 -1
- package/lib/cjs/__/npm-run-path/__/path-key/index.js.map +0 -1
- package/lib/cjs/__/npm-run-path/index.js.map +0 -1
- package/lib/cjs/__/signal-exit/dist/mjs/index.js.map +0 -1
- package/lib/cjs/__/signal-exit/dist/mjs/signals.js.map +0 -1
- package/lib/cjs/__/strip-final-newline/index.js.map +0 -1
- package/lib/esm/__/execa/index.js.map +0 -1
- package/lib/esm/__/execa/lib/command.js.map +0 -1
- package/lib/esm/__/execa/lib/error.js.map +0 -1
- package/lib/esm/__/execa/lib/promise.js.map +0 -1
- package/lib/esm/__/execa/lib/stdio.js.map +0 -1
- package/lib/esm/__/execa/lib/stream.js.map +0 -1
- package/lib/esm/__/execa/lib/verbose.js.map +0 -1
- package/lib/esm/__/fast-content-type-parse/index.js +0 -180
- package/lib/esm/__/fast-content-type-parse/index.js.map +0 -1
- package/lib/esm/__/get-stream/source/array-buffer.js.map +0 -1
- package/lib/esm/__/human-signals/build/src/core.js.map +0 -1
- package/lib/esm/__/human-signals/build/src/main.js.map +0 -1
- package/lib/esm/__/human-signals/build/src/realtime.js.map +0 -1
- package/lib/esm/__/human-signals/build/src/signals.js.map +0 -1
- package/lib/esm/__/is-stream/index.js.map +0 -1
- package/lib/esm/__/npm-run-path/__/path-key/index.js.map +0 -1
- package/lib/esm/__/npm-run-path/index.js.map +0 -1
- package/lib/esm/__/signal-exit/dist/mjs/index.js.map +0 -1
- package/lib/esm/__/signal-exit/dist/mjs/signals.js.map +0 -1
- package/lib/esm/__/strip-final-newline/index.js.map +0 -1
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/command.js +0 -0
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/error.js +0 -0
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/promise.js +0 -0
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/stdio.js +0 -0
- /package/lib/cjs/__/{execa → env-ci/__/execa}/lib/verbose.js +0 -0
- /package/lib/cjs/__/{get-stream → env-ci/__/get-stream}/source/array-buffer.js +0 -0
- /package/lib/cjs/__/{human-signals → env-ci/__/human-signals}/build/src/core.js +0 -0
- /package/lib/cjs/__/{human-signals → env-ci/__/human-signals}/build/src/main.js +0 -0
- /package/lib/cjs/__/{human-signals → env-ci/__/human-signals}/build/src/realtime.js +0 -0
- /package/lib/cjs/__/{human-signals → env-ci/__/human-signals}/build/src/signals.js +0 -0
- /package/lib/cjs/__/{is-stream → env-ci/__/is-stream}/index.js +0 -0
- /package/lib/cjs/__/{npm-run-path → env-ci}/__/path-key/index.js +0 -0
- /package/lib/cjs/__/{signal-exit → env-ci/__/signal-exit}/dist/mjs/index.js +0 -0
- /package/lib/cjs/__/{signal-exit → env-ci/__/signal-exit}/dist/mjs/signals.js +0 -0
- /package/lib/cjs/__/{strip-final-newline → env-ci/__/strip-final-newline}/index.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/command.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/error.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/promise.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/stdio.js +0 -0
- /package/lib/esm/__/{execa → env-ci/__/execa}/lib/verbose.js +0 -0
- /package/lib/esm/__/{get-stream → env-ci/__/get-stream}/source/array-buffer.js +0 -0
- /package/lib/esm/__/{human-signals → env-ci/__/human-signals}/build/src/core.js +0 -0
- /package/lib/esm/__/{human-signals → env-ci/__/human-signals}/build/src/main.js +0 -0
- /package/lib/esm/__/{human-signals → env-ci/__/human-signals}/build/src/realtime.js +0 -0
- /package/lib/esm/__/{human-signals → env-ci/__/human-signals}/build/src/signals.js +0 -0
- /package/lib/esm/__/{is-stream → env-ci/__/is-stream}/index.js +0 -0
- /package/lib/esm/__/{npm-run-path → env-ci}/__/path-key/index.js +0 -0
- /package/lib/esm/__/{signal-exit → env-ci/__/signal-exit}/dist/mjs/index.js +0 -0
- /package/lib/esm/__/{signal-exit → env-ci/__/signal-exit}/dist/mjs/signals.js +0 -0
- /package/lib/esm/__/{strip-final-newline → env-ci/__/strip-final-newline}/index.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-with-bigint.js","sources":["../../../../../../node_modules/json-with-bigint/json-with-bigint.js"],"sourcesContent":["const intRegex = /^-?\\d+$/;\nconst noiseValue = /^-?\\d+n+$/; // Noise - strings that match the custom format before being converted to it\nconst originalStringify = JSON.stringify;\nconst originalParse = JSON.parse;\nconst customFormat = /^-?\\d+n$/;\n\nconst bigIntsStringify = /([\\[:])?\"(-?\\d+)n\"($|([\\\\n]|\\s)*(\\s|[\\\\n])*[,\\}\\]])/g;\nconst noiseStringify =\n /([\\[:])?(\"-?\\d+n+)n(\"$|\"([\\\\n]|\\s)*(\\s|[\\\\n])*[,\\}\\]])/g;\n\n/**\n * @typedef {(this: any, key: string | number | undefined, value: any) => any} Replacer\n * @typedef {(key: string | number | undefined, value: any, context?: { source: string }) => any} Reviver\n */\n\n/**\n * Converts a JavaScript value to a JSON string.\n *\n * Supports serialization of BigInt values using two strategies:\n * 1. Custom format \"123n\" → \"123\" (universal fallback)\n * 2. Native JSON.rawJSON() (Node.js 22+, fastest) when available\n *\n * All other values are serialized exactly like native JSON.stringify().\n *\n * @param {*} value The value to convert to a JSON string.\n * @param {Replacer | Array<string | number> | null} [replacer]\n * A function that alters the behavior of the stringification process,\n * or an array of strings/numbers to indicate properties to exclude.\n * @param {string | number} [space]\n * A string or number to specify indentation or pretty-printing.\n * @returns {string} The JSON string representation.\n */\nconst JSONStringify = (value, replacer, space) => {\n if (\"rawJSON\" in JSON) {\n return originalStringify(\n value,\n (key, value) => {\n if (typeof value === \"bigint\") return JSON.rawJSON(value.toString());\n\n if (typeof replacer === \"function\") return replacer(key, value);\n\n if (Array.isArray(replacer) && replacer.includes(key)) return value;\n\n return value;\n },\n space,\n );\n }\n\n if (!value) return originalStringify(value, replacer, space);\n\n const convertedToCustomJSON = originalStringify(\n value,\n (key, value) => {\n const isNoise = typeof value === \"string\" && noiseValue.test(value);\n\n if (isNoise) return value.toString() + \"n\"; // Mark noise values with additional \"n\" to offset the deletion of one \"n\" during the processing\n\n if (typeof value === \"bigint\") return value.toString() + \"n\";\n\n if (typeof replacer === \"function\") return replacer(key, value);\n\n if (Array.isArray(replacer) && replacer.includes(key)) return value;\n\n return value;\n },\n space,\n );\n const processedJSON = convertedToCustomJSON.replace(\n bigIntsStringify,\n \"$1$2$3\",\n ); // Delete one \"n\" off the end of every BigInt value\n const denoisedJSON = processedJSON.replace(noiseStringify, \"$1$2$3\"); // Remove one \"n\" off the end of every noisy string\n\n return denoisedJSON;\n};\n\nconst featureCache = new Map();\n\n/**\n * Detects if the current JSON.parse implementation supports the context.source feature.\n *\n * Uses toString() fingerprinting to cache results and automatically detect runtime\n * replacements of JSON.parse (polyfills, mocks, etc.).\n *\n * @returns {boolean} true if context.source is supported, false otherwise.\n */\nconst isContextSourceSupported = () => {\n const parseFingerprint = JSON.parse.toString();\n\n if (featureCache.has(parseFingerprint)) {\n return featureCache.get(parseFingerprint);\n }\n\n try {\n const result = JSON.parse(\n \"1\",\n (_, __, context) => !!context?.source && context.source === \"1\",\n );\n featureCache.set(parseFingerprint, result);\n\n return result;\n } catch {\n featureCache.set(parseFingerprint, false);\n\n return false;\n }\n};\n\n/**\n * Reviver function that converts custom-format BigInt strings back to BigInt values.\n * Also handles \"noise\" strings that accidentally match the BigInt format.\n *\n * @param {string | number | undefined} key The object key.\n * @param {*} value The value being parsed.\n * @param {object} [context] Parse context (if supported by JSON.parse).\n * @param {Reviver} [userReviver] User's custom reviver function.\n * @returns {any} The transformed value.\n */\nconst convertMarkedBigIntsReviver = (key, value, context, userReviver) => {\n const isCustomFormatBigInt =\n typeof value === \"string\" && customFormat.test(value);\n if (isCustomFormatBigInt) return BigInt(value.slice(0, -1));\n\n const isNoiseValue = typeof value === \"string\" && noiseValue.test(value);\n if (isNoiseValue) return value.slice(0, -1);\n\n if (typeof userReviver !== \"function\") return value;\n\n return userReviver(key, value, context);\n};\n\n/**\n * Fast JSON.parse implementation (~2x faster than classic fallback).\n * Uses JSON.parse's context.source feature to detect integers and convert\n * large numbers directly to BigInt without string manipulation.\n *\n * Does not support legacy custom format from v1 of this library.\n *\n * @param {string} text JSON string to parse.\n * @param {Reviver} [reviver] Transform function to apply to each value.\n * @returns {any} Parsed JavaScript value.\n */\nconst JSONParseV2 = (text, reviver) => {\n return JSON.parse(text, (key, value, context) => {\n const isBigNumber =\n typeof value === \"number\" &&\n (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER);\n const isInt = context && intRegex.test(context.source);\n const isBigInt = isBigNumber && isInt;\n\n if (isBigInt) return BigInt(context.source);\n\n if (typeof reviver !== \"function\") return value;\n\n return reviver(key, value, context);\n });\n};\n\nconst MAX_INT = Number.MAX_SAFE_INTEGER.toString();\nconst MAX_DIGITS = MAX_INT.length;\nconst stringsOrLargeNumbers =\n /\"(?:\\\\.|[^\"])*\"|-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?/g;\nconst noiseValueWithQuotes = /^\"-?\\d+n+\"$/; // Noise - strings that match the custom format before being converted to it\n\n/**\n * Converts a JSON string into a JavaScript value.\n *\n * Supports parsing of large integers using two strategies:\n * 1. Classic fallback: Marks large numbers with \"123n\" format, then converts to BigInt\n * 2. Fast path (JSONParseV2): Uses context.source feature (~2x faster) when available\n *\n * All other JSON values are parsed exactly like native JSON.parse().\n *\n * @param {string} text A valid JSON string.\n * @param {Reviver} [reviver]\n * A function that transforms the results. This function is called for each member\n * of the object. If a member contains nested objects, the nested objects are\n * transformed before the parent object is.\n * @returns {any} The parsed JavaScript value.\n * @throws {SyntaxError} If text is not valid JSON.\n */\nconst JSONParse = (text, reviver) => {\n if (!text) return originalParse(text, reviver);\n\n if (isContextSourceSupported()) return JSONParseV2(text, reviver); // Shortcut to a faster (2x) and simpler version\n\n // Find and mark big numbers with \"n\"\n const serializedData = text.replace(\n stringsOrLargeNumbers,\n (text, digits, fractional, exponential) => {\n const isString = text[0] === '\"';\n const isNoise = isString && noiseValueWithQuotes.test(text);\n\n if (isNoise) return text.substring(0, text.length - 1) + 'n\"'; // Mark noise values with additional \"n\" to offset the deletion of one \"n\" during the processing\n\n const isFractionalOrExponential = fractional || exponential;\n const isLessThanMaxSafeInt =\n digits &&\n (digits.length < MAX_DIGITS ||\n (digits.length === MAX_DIGITS && digits <= MAX_INT)); // With a fixed number of digits, we can correctly use lexicographical comparison to do a numeric comparison\n\n if (isString || isFractionalOrExponential || isLessThanMaxSafeInt)\n return text;\n\n return '\"' + text + 'n\"';\n },\n );\n\n return originalParse(serializedData, (key, value, context) =>\n convertMarkedBigIntsReviver(key, value, context, reviver),\n );\n};\n\nexport { JSONStringify, JSONParse };\n"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG,SAAS;AAC1B,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,iBAAiB,GAAG,IAAI,CAAC,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AEH,EAAE,OAAO,aAAa,CAAC,cAAc,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO;AAC3D,IAAI,2BAA2B,CAAC,GAAG,EAAE,KAAuB,CAAC;AAC7D,GAAG;AACH;;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"json-with-bigint.js","sources":["../../../../../../node_modules/json-with-bigint/json-with-bigint.js"],"sourcesContent":["const intRegex = /^-?\\d+$/;\nconst noiseValue = /^-?\\d+n+$/; // Noise - strings that match the custom format before being converted to it\nconst originalStringify = JSON.stringify;\nconst originalParse = JSON.parse;\nconst customFormat = /^-?\\d+n$/;\n\nconst bigIntsStringify = /([\\[:])?\"(-?\\d+)n\"($|\\s*[,\\}\\]])/g;\nconst noiseStringify = /([\\[:])?(\"-?\\d+n+)n(\"$|\"\\s*[,\\}\\]])/g;\n\n/**\n * @typedef {(this: any, key: string | number | undefined, value: any) => any} Replacer\n * @typedef {(key: string | number | undefined, value: any, context?: { source: string }) => any} Reviver\n */\n\n/**\n * Checks if a value is unstringifiable according to native JSON.stringify rules.\n *\n * @param {any} val The value to check.\n * @returns {boolean} True if the value is undefined, a function, or a symbol.\n */\nconst isUnstringifiable = (val) =>\n val === undefined || typeof val === \"function\" || typeof val === \"symbol\";\n\n/**\n * Checks if a value is a native JSON.rawJSON object (Node.js 22+).\n *\n * @param {any} val The value to check.\n * @returns {boolean} True if the value is a RawJSON instance.\n */\nconst isRawJSON = (val) =>\n val !== null &&\n typeof val === \"object\" &&\n val.constructor &&\n val.constructor.name === \"RawJSON\";\n\n/**\n * Iteratively converts a JS value to a JSON string.\n * Used as a fallback when the native JSON.stringify hits the Maximum Call Stack size.\n * Fully compliant with JSON formatting (space), replacers, and toJSON behaviors.\n *\n * @param {any} rootValue The value to stringify.\n * @param {Replacer | Array<string | number> | null} [replacer] User's custom replacer function.\n * @param {string | number} [spaceParam] Indentation for pretty-printing.\n * @returns {string | undefined} The generated JSON string.\n */\nconst stringifyIteratively = (rootValue, replacer, spaceParam) => {\n let space = \"\";\n\n if (typeof spaceParam === \"number\") {\n space = \" \".repeat(Math.min(10, Math.max(0, Math.floor(spaceParam))));\n } else if (typeof spaceParam === \"string\") {\n space = spaceParam.slice(0, 10);\n }\n\n const isFunctionReplacer = typeof replacer === \"function\";\n const propertyList = Array.isArray(replacer)\n ? new Set(replacer.map(String))\n : null;\n\n /**\n * Prepares a value for stringification by resolving toJSON, handling BigInts,\n * applying custom replacers, and unwrapping primitive objects.\n *\n * @param {object|Array} parent The parent object or array holding the value.\n * @param {string} key The key associated with the value.\n * @param {any} val The raw value to process.\n * @returns {any} The processed value ready for stringification.\n */\n const prepareVal = (parent, key, val) => {\n const isObject = val !== null && typeof val === \"object\";\n const hasToJSON = isObject && typeof val.toJSON === \"function\";\n\n if (hasToJSON) {\n val = val.toJSON(key);\n }\n\n const isNoise = typeof val === \"string\" && noiseValue.test(val);\n\n if (isNoise) return val + \"n\";\n\n const isBigInt = typeof val === \"bigint\";\n\n if (isBigInt) {\n const supportsRawJSON = \"rawJSON\" in JSON;\n\n if (supportsRawJSON) return JSON.rawJSON(val.toString());\n\n return val.toString() + \"n\";\n }\n\n if (isFunctionReplacer) {\n val = replacer.call(parent, key, val);\n }\n\n const isPostReplacerObject = val !== null && typeof val === \"object\";\n\n if (isPostReplacerObject) {\n const isPrimitiveWrapper =\n val instanceof Number ||\n val instanceof String ||\n val instanceof Boolean;\n\n if (isPrimitiveWrapper) {\n val = val.valueOf();\n }\n }\n\n return val;\n };\n\n const rootProcessed = prepareVal({ \"\": rootValue }, \"\", rootValue);\n\n if (isUnstringifiable(rootProcessed)) {\n return undefined;\n }\n\n const isRootPrimitive =\n rootProcessed === null || typeof rootProcessed !== \"object\";\n const isRootNativeRawJSON = isRawJSON(rootProcessed);\n\n if (isRootPrimitive || isRootNativeRawJSON) {\n return originalStringify(rootProcessed);\n }\n\n const chunks = [];\n let level = 0;\n\n const stack = [\n {\n parent: { \"\": rootProcessed },\n key: \"\",\n val: rootProcessed,\n isArray: Array.isArray(rootProcessed),\n keys: Array.isArray(rootProcessed) ? null : Object.keys(rootProcessed),\n index: 0,\n first: true,\n },\n ];\n\n const visited = new WeakSet([rootProcessed]);\n\n while (stack.length > 0) {\n const node = stack[stack.length - 1];\n\n if (node.index === 0) {\n chunks.push(node.isArray ? \"[\" : \"{\");\n level++;\n }\n\n let isDone = false;\n\n if (node.isArray) {\n if (node.index < node.val.length) {\n if (!node.first) chunks.push(\",\");\n\n if (space) chunks.push(\"\\n\" + space.repeat(level));\n\n const childRaw = node.val[node.index];\n const childVal = prepareVal(node.val, String(node.index), childRaw);\n\n if (isUnstringifiable(childVal)) {\n chunks.push(\"null\");\n node.first = false;\n node.index++;\n } else {\n const isComplexObject =\n childVal !== null && typeof childVal === \"object\";\n const isNativeRaw = isRawJSON(childVal);\n\n if (isComplexObject && !isNativeRaw) {\n if (visited.has(childVal)) {\n throw new TypeError(\"Converting circular structure to JSON\");\n }\n\n visited.add(childVal);\n\n stack.push({\n parent: node.val,\n key: String(node.index),\n val: childVal,\n isArray: Array.isArray(childVal),\n keys: Array.isArray(childVal) ? null : Object.keys(childVal),\n index: 0,\n first: true,\n });\n\n node.first = false;\n node.index++;\n } else {\n chunks.push(originalStringify(childVal));\n node.first = false;\n node.index++;\n }\n }\n } else {\n isDone = true;\n }\n } else {\n while (node.index < node.keys.length) {\n const k = node.keys[node.index++];\n\n const isFilteredOutByArray = propertyList && !propertyList.has(k);\n\n if (isFilteredOutByArray) continue;\n\n const childRaw = node.val[k];\n const childVal = prepareVal(node.val, k, childRaw);\n\n if (isUnstringifiable(childVal)) continue;\n\n if (!node.first) chunks.push(\",\");\n\n if (space) {\n chunks.push(\"\\n\" + space.repeat(level) + originalStringify(k) + \": \");\n } else {\n chunks.push(originalStringify(k) + \":\");\n }\n\n const isComplexObject =\n childVal !== null && typeof childVal === \"object\";\n const isNativeRaw = isRawJSON(childVal);\n\n if (isComplexObject && !isNativeRaw) {\n if (visited.has(childVal)) {\n throw new TypeError(\"Converting circular structure to JSON\");\n }\n\n visited.add(childVal);\n\n stack.push({\n parent: node.val,\n key: k,\n val: childVal,\n isArray: Array.isArray(childVal),\n keys: Array.isArray(childVal) ? null : Object.keys(childVal),\n index: 0,\n first: true,\n });\n\n node.first = false;\n\n break; // Stop current loop level to process the newly pushed stack node\n } else {\n chunks.push(originalStringify(childVal));\n node.first = false;\n }\n }\n\n const isNodeFullyProcessed =\n node.index >= node.keys.length && stack[stack.length - 1] === node;\n\n if (isNodeFullyProcessed) {\n isDone = true;\n }\n }\n\n if (isDone) {\n level--;\n\n if (!node.first && space) chunks.push(\"\\n\" + space.repeat(level));\n\n chunks.push(node.isArray ? \"]\" : \"}\");\n visited.delete(node.val);\n stack.pop();\n }\n }\n\n return chunks.join(\"\");\n};\n\n/**\n * Converts a JavaScript value to a JSON string.\n *\n * Supports serialization of BigInt values using two strategies:\n * 1. Custom format \"123n\" → \"123\" (universal fallback)\n * 2. Native JSON.rawJSON() (Node.js 22+, fastest) when available\n *\n * All other values are serialized exactly like native JSON.stringify().\n *\n * @param {*} value The value to convert to a JSON string.\n * @param {Replacer | Array<string | number> | null} [replacer]\n * A function that alters the behavior of the stringification process,\n * or an array of strings/numbers to indicate properties to exclude.\n * @param {string | number} [space]\n * A string or number to specify indentation or pretty-printing.\n * @returns {string} The JSON string representation.\n */\nconst JSONStringify = (value, replacer, space) => {\n try {\n const supportsRawJSON = \"rawJSON\" in JSON;\n\n if (supportsRawJSON) {\n return originalStringify(\n value,\n (key, val) => {\n if (typeof val === \"bigint\") return JSON.rawJSON(val.toString());\n\n const hasFunctionReplacer = typeof replacer === \"function\";\n\n if (hasFunctionReplacer) return replacer(key, val);\n\n const isKeyInArrayReplacer =\n Array.isArray(replacer) && replacer.includes(key);\n\n if (isKeyInArrayReplacer) return val;\n\n return val;\n },\n space,\n );\n }\n\n if (!value) return originalStringify(value, replacer, space);\n\n const convertedToCustomJSON = originalStringify(\n value,\n (key, val) => {\n const isNoise = typeof val === \"string\" && noiseValue.test(val);\n\n if (isNoise) return val.toString() + \"n\"; // Mark noise values with additional \"n\" to offset the deletion of one \"n\" during the processing\n\n if (typeof val === \"bigint\") return val.toString() + \"n\";\n\n const hasFunctionReplacer = typeof replacer === \"function\";\n\n if (hasFunctionReplacer) return replacer(key, val);\n\n const isKeyInArrayReplacer =\n Array.isArray(replacer) && replacer.includes(key);\n\n if (isKeyInArrayReplacer) return val;\n\n return val;\n },\n space,\n );\n\n const processedJSON = convertedToCustomJSON.replace(\n bigIntsStringify,\n \"$1$2$3\",\n ); // Delete one \"n\" off the end of every BigInt value\n\n const denoisedJSON = processedJSON.replace(noiseStringify, \"$1$2$3\"); // Remove one \"n\" off the end of every noisy string\n\n return denoisedJSON;\n } catch (error) {\n if (error instanceof RangeError) {\n const convertedJSON = stringifyIteratively(value, replacer, space);\n\n if (convertedJSON === undefined) return undefined;\n\n const supportsRawJSON = \"rawJSON\" in JSON;\n\n if (supportsRawJSON) return convertedJSON;\n\n const processedJSON = convertedJSON.replace(bigIntsStringify, \"$1$2$3\");\n\n return processedJSON.replace(noiseStringify, \"$1$2$3\");\n }\n\n throw error;\n }\n};\n\nconst featureCache = new Map();\n\n/**\n * Detects if the current JSON.parse implementation supports the context.source feature.\n *\n * Uses toString() fingerprinting to cache results and automatically detect runtime\n * replacements of JSON.parse (polyfills, mocks, etc.).\n *\n * @returns {boolean} true if context.source is supported, false otherwise.\n */\nconst isContextSourceSupported = () => {\n const parseFingerprint = JSON.parse.toString();\n\n if (featureCache.has(parseFingerprint)) {\n return featureCache.get(parseFingerprint);\n }\n\n try {\n const result = JSON.parse(\n \"1\",\n (_, __, context) => !!context?.source && context.source === \"1\",\n );\n featureCache.set(parseFingerprint, result);\n\n return result;\n } catch {\n featureCache.set(parseFingerprint, false);\n\n return false;\n }\n};\n\n/**\n * Reviver function that converts custom-format BigInt strings back to BigInt values.\n * Also handles \"noise\" strings that accidentally match the BigInt format.\n *\n * @param {string | number | undefined} key The object key.\n * @param {*} value The value being parsed.\n * @param {object} [context] Parse context (if supported by JSON.parse).\n * @param {Reviver} [userReviver] User's custom reviver function.\n * @returns {any} The transformed value.\n */\nconst convertMarkedBigIntsReviver = (key, value, context, userReviver) => {\n const isCustomFormatBigInt =\n typeof value === \"string\" && customFormat.test(value);\n\n if (isCustomFormatBigInt) return BigInt(value.slice(0, -1));\n\n const isNoiseValue = typeof value === \"string\" && noiseValue.test(value);\n if (isNoiseValue) return value.slice(0, -1);\n\n const hasUserReviver = typeof userReviver === \"function\";\n\n if (!hasUserReviver) return value;\n\n return userReviver(key, value, context);\n};\n\n/**\n * Fast JSON.parse implementation (~2x faster than classic fallback).\n * Uses JSON.parse's context.source feature to detect integers and convert\n * large numbers directly to BigInt without string manipulation.\n *\n * Does not support legacy custom format from v1 of this library.\n *\n * @param {string} text JSON string to parse.\n * @param {Reviver} [reviver] Transform function to apply to each value.\n * @returns {any} Parsed JavaScript value.\n */\nconst JSONParseV2 = (text, reviver) => {\n return JSON.parse(text, (key, value, context) => {\n const isNumber = typeof value === \"number\";\n const isOutOfBounds =\n value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER;\n const isBigNumber = isNumber && isOutOfBounds;\n const isInt = context && intRegex.test(context.source);\n const isBigInt = isBigNumber && isInt;\n\n if (isBigInt) return BigInt(context.source);\n\n const hasCustomReviver = typeof reviver === \"function\";\n\n if (!hasCustomReviver) return value;\n\n return reviver(key, value, context);\n });\n};\n\nconst MAX_INT = Number.MAX_SAFE_INTEGER.toString();\nconst MAX_DIGITS = MAX_INT.length;\nconst stringsOrLargeNumbers =\n /\"(?:\\\\.|[^\"])*\"|-?(0|[1-9][0-9]*)(\\.[0-9]+)?([eE][+-]?[0-9]+)?/g;\nconst noiseValueWithQuotes = /^\"-?\\d+n+\"$/; // Noise - strings that match the custom format before being converted to it\n\n/**\n * Iteratively traverses the parsed object bottom-up (post-order),\n * emulating the native JSON.parse reviver behavior.\n * This avoids Call Stack overflows (RangeError) on deeply nested structures.\n *\n * @param {any} parsed The natively parsed JSON object.\n * @param {Reviver} [userReviver] User's custom reviver function.\n * @returns {any} The fully processed object.\n */\nconst applyReviverIteratively = (parsed, userReviver) => {\n const rootHolder = { \"\": parsed };\n const stack = [{ parent: rootHolder, key: \"\", visited: false }];\n\n while (stack.length > 0) {\n const node = stack[stack.length - 1];\n\n if (!node.visited) {\n node.visited = true;\n\n const value = node.parent[node.key];\n const isComplexObject = value !== null && typeof value === \"object\";\n\n if (isComplexObject) {\n const keys = Object.keys(value);\n\n for (let i = keys.length - 1; i >= 0; i--) {\n stack.push({ parent: value, key: keys[i], visited: false });\n }\n }\n } else {\n const { parent, key } = node;\n let value = parent[key];\n\n if (typeof value === \"string\") {\n const isCustomFormatBigInt = customFormat.test(value);\n\n if (isCustomFormatBigInt) {\n value = BigInt(value.slice(0, -1));\n } else {\n const isNoise = noiseValue.test(value);\n\n if (isNoise) value = value.slice(0, -1);\n }\n }\n\n const hasUserReviver = typeof userReviver === \"function\";\n\n if (hasUserReviver) {\n value = userReviver.call(parent, key, value);\n }\n\n const isDeleted = value === undefined;\n\n if (isDeleted) {\n delete parent[key];\n } else {\n parent[key] = value;\n }\n\n stack.pop();\n }\n }\n\n return rootHolder[\"\"];\n};\n\n/**\n * Pre-processes the JSON string to mark large numbers with an 'n' suffix.\n *\n * @param {string} text The raw JSON string.\n * @returns {string} The serialized string with marked BigInts.\n */\nconst serializeBigInts = (text) => {\n return text.replace(\n stringsOrLargeNumbers,\n (match, digits, fractional, exponential) => {\n const isString = match[0] === '\"';\n const isNoise = isString && noiseValueWithQuotes.test(match);\n\n if (isNoise) return match.substring(0, match.length - 1) + 'n\"'; // Mark noise values with additional \"n\" to offset the deletion of one \"n\" during the processing\n\n const hasFractionalOrExponential = fractional || exponential;\n\n // With a fixed number of digits, we can correctly use lexicographical comparison to do a numeric comparison\n const isLessThanMaxSafeInt =\n digits &&\n (digits.length < MAX_DIGITS ||\n (digits.length === MAX_DIGITS && digits <= MAX_INT));\n\n const isStandardValue =\n isString || hasFractionalOrExponential || isLessThanMaxSafeInt;\n\n if (isStandardValue) return match;\n\n return '\"' + match + 'n\"';\n },\n );\n};\n\n/**\n * Converts a JSON string into a JavaScript value.\n *\n * Supports parsing of large integers using two strategies:\n * 1. Classic fallback: Marks large numbers with \"123n\" format, then converts to BigInt\n * 2. Fast path (JSONParseV2): Uses context.source feature (~2x faster) when available\n *\n * All other JSON values are parsed exactly like native JSON.parse().\n *\n * @param {string} text A valid JSON string.\n * @param {Reviver} [reviver]\n * A function that transforms the results. This function is called for each member\n * of the object. If a member contains nested objects, the nested objects are\n * transformed before the parent object is.\n * @returns {any} The parsed JavaScript value.\n * @throws {SyntaxError} If text is not valid JSON.\n */\nconst JSONParse = (text, reviver) => {\n if (!text) return originalParse(text, reviver);\n\n try {\n if (isContextSourceSupported()) return JSONParseV2(text, reviver); // Shortcut to a faster (2x) and simpler version\n\n // Find and mark big numbers with \"n\"\n const serializedData = serializeBigInts(text);\n\n return originalParse(serializedData, (key, value, context) =>\n convertMarkedBigIntsReviver(key, value, context, reviver),\n );\n } catch (error) {\n if (error instanceof RangeError) {\n const serializedData = serializeBigInts(text);\n const parsed = originalParse(serializedData);\n\n return applyReviverIteratively(parsed, reviver);\n }\n\n throw error;\n }\n};\n\nexport { JSONStringify, JSONParse };\n"],"names":[],"mappings":";;AAAA,MAAM,QAAQ,GAAG,SAAS;AAC1B,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS;AACxC,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK;AAChC,MAAM,YAAY,GAAG,UAAU;;AAE/B,MAAM,gBAAgB,GAAG,mCAAmC;AAC5D,MAAM,cAAc,GAAG,sCAAsC;;AAE7D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,CAAC,GAAG;AAC9B,EAAE,GAAG,KAAK,SAAS,IAAI,OAAO,GAAG,KAAK,UAAU,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,KAAK;AACrC,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC;;AAEhD,EAAE,IAAI;AACN,IAAI,IAAI,wBAAwB,EAAE,EAAE,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;;AAEtE;AACA,IAAI,MAAM,cAAc,GAAG,gBAAgB,CAAC,IAAI,CAAC;;AAEjD,IAAI,OAAO,aAAa,CAAC,cAAc,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO;AAC7D,MAAM,2BAA2B,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC;AAC/D,KAAK;AACL,EAAE,CAAC,CAAC,OAAO,KAAK,EAAE;AAClB,IAAI,IAAI,KAAK,YAAY,UAAU,EAAE;AACrC,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,IAAI,CAAC;AACnD,MAAM,MAAM,MAAM,GAAG,aAAa,CAAC,cAAc,CAAC;;AAElD,MAAM,OAAO,uBAAuB,CAAC,MAAe,CAAC;AACrD,IAAI;;AAEJ,IAAI,MAAM,KAAK;AACf,EAAE;AACF;;;;;","x_google_ignoreList":[0]}
|
|
@@ -367,7 +367,13 @@ function requireRequest () {
|
|
|
367
367
|
} else if (typeof val[i] === 'object') {
|
|
368
368
|
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
369
369
|
} else {
|
|
370
|
-
|
|
370
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
371
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
372
|
+
const str = `${val[i]}`;
|
|
373
|
+
if (!isValidHeaderValue(str)) {
|
|
374
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
375
|
+
}
|
|
376
|
+
arr.push(str);
|
|
371
377
|
}
|
|
372
378
|
}
|
|
373
379
|
val = arr;
|
|
@@ -378,7 +384,12 @@ function requireRequest () {
|
|
|
378
384
|
} else if (val === null) {
|
|
379
385
|
val = '';
|
|
380
386
|
} else {
|
|
387
|
+
// Coerce primitives (and reject unsafe coercions such as functions
|
|
388
|
+
// with a crafted toString/Symbol.toPrimitive).
|
|
381
389
|
val = `${val}`;
|
|
390
|
+
if (!isValidHeaderValue(val)) {
|
|
391
|
+
throw new InvalidArgumentError(`invalid ${key} header`)
|
|
392
|
+
}
|
|
382
393
|
}
|
|
383
394
|
|
|
384
395
|
if (headerName === 'host') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sources":["../../../../../../../../node_modules/undici/lib/core/request.js"],"sourcesContent":["'use strict'\n\nconst {\n InvalidArgumentError,\n NotSupportedError\n} = require('./errors')\nconst assert = require('node:assert')\nconst {\n isValidHTTPToken,\n isValidHeaderValue,\n isStream,\n destroy,\n isBuffer,\n isFormDataLike,\n isIterable,\n isBlobLike,\n buildURL,\n validateHandler,\n getServerName,\n normalizedMethodRecords\n} = require('./util')\nconst { channels } = require('./diagnostics.js')\nconst { headerNameLowerCasedRecord } = require('./constants')\n\n// Verifies that a given path is valid does not contain control chars \\x00 to \\x20\nconst invalidPathRegex = /[^\\u0021-\\u00ff]/\n\nconst kHandler = Symbol('handler')\n\nclass Request {\n constructor (origin, {\n path,\n method,\n body,\n headers,\n query,\n idempotent,\n blocking,\n upgrade,\n headersTimeout,\n bodyTimeout,\n reset,\n throwOnError,\n expectContinue,\n servername\n }, handler) {\n if (typeof path !== 'string') {\n throw new InvalidArgumentError('path must be a string')\n } else if (\n path[0] !== '/' &&\n !(path.startsWith('http://') || path.startsWith('https://')) &&\n method !== 'CONNECT'\n ) {\n throw new InvalidArgumentError('path must be an absolute URL or start with a slash')\n } else if (invalidPathRegex.test(path)) {\n throw new InvalidArgumentError('invalid request path')\n }\n\n if (typeof method !== 'string') {\n throw new InvalidArgumentError('method must be a string')\n } else if (normalizedMethodRecords[method] === undefined && !isValidHTTPToken(method)) {\n throw new InvalidArgumentError('invalid request method')\n }\n\n if (upgrade && typeof upgrade !== 'string') {\n throw new InvalidArgumentError('upgrade must be a string')\n }\n\n if (upgrade && !isValidHeaderValue(upgrade)) {\n throw new InvalidArgumentError('invalid upgrade header')\n }\n\n if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) {\n throw new InvalidArgumentError('invalid headersTimeout')\n }\n\n if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) {\n throw new InvalidArgumentError('invalid bodyTimeout')\n }\n\n if (reset != null && typeof reset !== 'boolean') {\n throw new InvalidArgumentError('invalid reset')\n }\n\n if (expectContinue != null && typeof expectContinue !== 'boolean') {\n throw new InvalidArgumentError('invalid expectContinue')\n }\n\n this.headersTimeout = headersTimeout\n\n this.bodyTimeout = bodyTimeout\n\n this.throwOnError = throwOnError === true\n\n this.method = method\n\n this.abort = null\n\n if (body == null) {\n this.body = null\n } else if (isStream(body)) {\n this.body = body\n\n const rState = this.body._readableState\n if (!rState || !rState.autoDestroy) {\n this.endHandler = function autoDestroy () {\n destroy(this)\n }\n this.body.on('end', this.endHandler)\n }\n\n this.errorHandler = err => {\n if (this.abort) {\n this.abort(err)\n } else {\n this.error = err\n }\n }\n this.body.on('error', this.errorHandler)\n } else if (isBuffer(body)) {\n this.body = body.byteLength ? body : null\n } else if (ArrayBuffer.isView(body)) {\n this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null\n } else if (body instanceof ArrayBuffer) {\n this.body = body.byteLength ? Buffer.from(body) : null\n } else if (typeof body === 'string') {\n this.body = body.length ? Buffer.from(body) : null\n } else if (isFormDataLike(body) || isIterable(body) || isBlobLike(body)) {\n this.body = body\n } else {\n throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable')\n }\n\n this.completed = false\n\n this.aborted = false\n\n this.upgrade = upgrade || null\n\n this.path = query ? buildURL(path, query) : path\n\n this.origin = origin\n\n this.idempotent = idempotent == null\n ? method === 'HEAD' || method === 'GET'\n : idempotent\n\n this.blocking = blocking == null ? false : blocking\n\n this.reset = reset == null ? null : reset\n\n this.host = null\n\n this.contentLength = null\n\n this.contentType = null\n\n this.headers = []\n\n // Only for H2\n this.expectContinue = expectContinue != null ? expectContinue : false\n\n if (Array.isArray(headers)) {\n if (headers.length % 2 !== 0) {\n throw new InvalidArgumentError('headers array must be even')\n }\n for (let i = 0; i < headers.length; i += 2) {\n processHeader(this, headers[i], headers[i + 1])\n }\n } else if (headers && typeof headers === 'object') {\n if (headers[Symbol.iterator]) {\n for (const header of headers) {\n if (!Array.isArray(header) || header.length !== 2) {\n throw new InvalidArgumentError('headers must be in key-value pair format')\n }\n processHeader(this, header[0], header[1])\n }\n } else {\n const keys = Object.keys(headers)\n for (let i = 0; i < keys.length; ++i) {\n processHeader(this, keys[i], headers[keys[i]])\n }\n }\n } else if (headers != null) {\n throw new InvalidArgumentError('headers must be an object or an array')\n }\n\n validateHandler(handler, method, upgrade)\n\n this.servername = servername || getServerName(this.host)\n\n this[kHandler] = handler\n\n if (channels.create.hasSubscribers) {\n channels.create.publish({ request: this })\n }\n }\n\n onBodySent (chunk) {\n if (this[kHandler].onBodySent) {\n try {\n return this[kHandler].onBodySent(chunk)\n } catch (err) {\n this.abort(err)\n }\n }\n }\n\n onRequestSent () {\n if (channels.bodySent.hasSubscribers) {\n channels.bodySent.publish({ request: this })\n }\n\n if (this[kHandler].onRequestSent) {\n try {\n return this[kHandler].onRequestSent()\n } catch (err) {\n this.abort(err)\n }\n }\n }\n\n onConnect (abort) {\n assert(!this.aborted)\n assert(!this.completed)\n\n if (this.error) {\n abort(this.error)\n } else {\n this.abort = abort\n return this[kHandler].onConnect(abort)\n }\n }\n\n onResponseStarted () {\n return this[kHandler].onResponseStarted?.()\n }\n\n onHeaders (statusCode, headers, resume, statusText) {\n assert(!this.aborted)\n assert(!this.completed)\n\n if (channels.headers.hasSubscribers) {\n channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })\n }\n\n try {\n return this[kHandler].onHeaders(statusCode, headers, resume, statusText)\n } catch (err) {\n this.abort(err)\n }\n }\n\n onData (chunk) {\n assert(!this.aborted)\n assert(!this.completed)\n\n try {\n return this[kHandler].onData(chunk)\n } catch (err) {\n this.abort(err)\n return false\n }\n }\n\n onUpgrade (statusCode, headers, socket) {\n assert(!this.aborted)\n assert(!this.completed)\n\n return this[kHandler].onUpgrade(statusCode, headers, socket)\n }\n\n onComplete (trailers) {\n this.onFinally()\n\n assert(!this.aborted)\n\n this.completed = true\n if (channels.trailers.hasSubscribers) {\n channels.trailers.publish({ request: this, trailers })\n }\n\n try {\n return this[kHandler].onComplete(trailers)\n } catch (err) {\n // TODO (fix): This might be a bad idea?\n this.onError(err)\n }\n }\n\n onError (error) {\n this.onFinally()\n\n if (channels.error.hasSubscribers) {\n channels.error.publish({ request: this, error })\n }\n\n if (this.aborted) {\n return\n }\n this.aborted = true\n\n return this[kHandler].onError(error)\n }\n\n onFinally () {\n if (this.errorHandler) {\n this.body.off('error', this.errorHandler)\n this.errorHandler = null\n }\n\n if (this.endHandler) {\n this.body.off('end', this.endHandler)\n this.endHandler = null\n }\n }\n\n addHeader (key, value) {\n processHeader(this, key, value)\n return this\n }\n}\n\nfunction processHeader (request, key, val) {\n if (val && (typeof val === 'object' && !Array.isArray(val))) {\n throw new InvalidArgumentError(`invalid ${key} header`)\n } else if (val === undefined) {\n return\n }\n\n let headerName = headerNameLowerCasedRecord[key]\n\n if (headerName === undefined) {\n headerName = key.toLowerCase()\n if (headerNameLowerCasedRecord[headerName] === undefined && !isValidHTTPToken(headerName)) {\n throw new InvalidArgumentError('invalid header key')\n }\n }\n\n if (Array.isArray(val)) {\n const arr = []\n for (let i = 0; i < val.length; i++) {\n if (typeof val[i] === 'string') {\n if (!isValidHeaderValue(val[i])) {\n throw new InvalidArgumentError(`invalid ${key} header`)\n }\n arr.push(val[i])\n } else if (val[i] === null) {\n arr.push('')\n } else if (typeof val[i] === 'object') {\n throw new InvalidArgumentError(`invalid ${key} header`)\n } else {\n arr.push(`${val[i]}`)\n }\n }\n val = arr\n } else if (typeof val === 'string') {\n if (!isValidHeaderValue(val)) {\n throw new InvalidArgumentError(`invalid ${key} header`)\n }\n } else if (val === null) {\n val = ''\n } else {\n val = `${val}`\n }\n\n if (headerName === 'host') {\n if (request.host !== null) {\n throw new InvalidArgumentError('duplicate host header')\n }\n if (typeof val !== 'string') {\n throw new InvalidArgumentError('invalid host header')\n }\n // Consumed by Client\n request.host = val\n } else if (headerName === 'content-length') {\n if (request.contentLength !== null) {\n throw new InvalidArgumentError('duplicate content-length header')\n }\n request.contentLength = parseInt(val, 10)\n if (!Number.isFinite(request.contentLength)) {\n throw new InvalidArgumentError('invalid content-length header')\n }\n } else if (request.contentType === null && headerName === 'content-type') {\n request.contentType = val\n request.headers.push(key, val)\n } else if (headerName === 'transfer-encoding' || headerName === 'keep-alive' || headerName === 'upgrade') {\n throw new InvalidArgumentError(`invalid ${headerName} header`)\n } else if (headerName === 'connection') {\n const value = typeof val === 'string' ? val.toLowerCase() : null\n if (value !== 'close' && value !== 'keep-alive') {\n throw new InvalidArgumentError('invalid connection header')\n }\n\n if (value === 'close') {\n request.reset = true\n }\n } else if (headerName === 'expect') {\n throw new NotSupportedError('expect header not supported')\n } else {\n request.headers.push(key, val)\n }\n}\n\nmodule.exports = Request\n"],"names":["require$$0","require$$1","require$$2","require$$3","require$$4"],"mappings":";;;;;;;;;;;;;;;;;;;CAEA,MAAM;AACN,GAAE,oBAAoB;GACpB;AACF,EAAC,GAAGA,gBAAA;AACJ,CAAA,MAAM,MAAM,GAAGC;CACf,MAAM;AACN,GAAE,gBAAgB;AAClB,GAAE,kBAAkB;AACpB,GAAE,QAAQ;AACV,GAAE,OAAO;AACT,GAAE,QAAQ;AACV,GAAE,cAAc;AAChB,GAAE,UAAU;AACZ,GAAE,UAAU;AACZ,GAAE,QAAQ;AACV,GAAE,eAAe;AACjB,GAAE,aAAa;GACb;AACF,EAAC,GAAGC,cAAA;CACJ,MAAM,EAAE,QAAQ,EAAE,GAAGC,qBAAA;CACrB,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],"sourcesContent":["'use strict'\n\nconst {\n InvalidArgumentError,\n NotSupportedError\n} = require('./errors')\nconst assert = require('node:assert')\nconst {\n isValidHTTPToken,\n isValidHeaderValue,\n isStream,\n destroy,\n isBuffer,\n isFormDataLike,\n isIterable,\n isBlobLike,\n buildURL,\n validateHandler,\n getServerName,\n normalizedMethodRecords\n} = require('./util')\nconst { channels } = require('./diagnostics.js')\nconst { headerNameLowerCasedRecord } = require('./constants')\n\n// Verifies that a given path is valid does not contain control chars \\x00 to \\x20\nconst invalidPathRegex = /[^\\u0021-\\u00ff]/\n\nconst kHandler = Symbol('handler')\n\nclass Request {\n constructor (origin, {\n path,\n method,\n body,\n headers,\n query,\n idempotent,\n blocking,\n upgrade,\n headersTimeout,\n bodyTimeout,\n reset,\n throwOnError,\n expectContinue,\n servername\n }, handler) {\n if (typeof path !== 'string') {\n throw new InvalidArgumentError('path must be a string')\n } else if (\n path[0] !== '/' &&\n !(path.startsWith('http://') || path.startsWith('https://')) &&\n method !== 'CONNECT'\n ) {\n throw new InvalidArgumentError('path must be an absolute URL or start with a slash')\n } else if (invalidPathRegex.test(path)) {\n throw new InvalidArgumentError('invalid request path')\n }\n\n if (typeof method !== 'string') {\n throw new InvalidArgumentError('method must be a string')\n } else if (normalizedMethodRecords[method] === undefined && !isValidHTTPToken(method)) {\n throw new InvalidArgumentError('invalid request method')\n }\n\n if (upgrade && typeof upgrade !== 'string') {\n throw new InvalidArgumentError('upgrade must be a string')\n }\n\n if (upgrade && !isValidHeaderValue(upgrade)) {\n throw new InvalidArgumentError('invalid upgrade header')\n }\n\n if (headersTimeout != null && (!Number.isFinite(headersTimeout) || headersTimeout < 0)) {\n throw new InvalidArgumentError('invalid headersTimeout')\n }\n\n if (bodyTimeout != null && (!Number.isFinite(bodyTimeout) || bodyTimeout < 0)) {\n throw new InvalidArgumentError('invalid bodyTimeout')\n }\n\n if (reset != null && typeof reset !== 'boolean') {\n throw new InvalidArgumentError('invalid reset')\n }\n\n if (expectContinue != null && typeof expectContinue !== 'boolean') {\n throw new InvalidArgumentError('invalid expectContinue')\n }\n\n this.headersTimeout = headersTimeout\n\n this.bodyTimeout = bodyTimeout\n\n this.throwOnError = throwOnError === true\n\n this.method = method\n\n this.abort = null\n\n if (body == null) {\n this.body = null\n } else if (isStream(body)) {\n this.body = body\n\n const rState = this.body._readableState\n if (!rState || !rState.autoDestroy) {\n this.endHandler = function autoDestroy () {\n destroy(this)\n }\n this.body.on('end', this.endHandler)\n }\n\n this.errorHandler = err => {\n if (this.abort) {\n this.abort(err)\n } else {\n this.error = err\n }\n }\n this.body.on('error', this.errorHandler)\n } else if (isBuffer(body)) {\n this.body = body.byteLength ? body : null\n } else if (ArrayBuffer.isView(body)) {\n this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null\n } else if (body instanceof ArrayBuffer) {\n this.body = body.byteLength ? Buffer.from(body) : null\n } else if (typeof body === 'string') {\n this.body = body.length ? Buffer.from(body) : null\n } else if (isFormDataLike(body) || isIterable(body) || isBlobLike(body)) {\n this.body = body\n } else {\n throw new InvalidArgumentError('body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable')\n }\n\n this.completed = false\n\n this.aborted = false\n\n this.upgrade = upgrade || null\n\n this.path = query ? buildURL(path, query) : path\n\n this.origin = origin\n\n this.idempotent = idempotent == null\n ? method === 'HEAD' || method === 'GET'\n : idempotent\n\n this.blocking = blocking == null ? false : blocking\n\n this.reset = reset == null ? null : reset\n\n this.host = null\n\n this.contentLength = null\n\n this.contentType = null\n\n this.headers = []\n\n // Only for H2\n this.expectContinue = expectContinue != null ? expectContinue : false\n\n if (Array.isArray(headers)) {\n if (headers.length % 2 !== 0) {\n throw new InvalidArgumentError('headers array must be even')\n }\n for (let i = 0; i < headers.length; i += 2) {\n processHeader(this, headers[i], headers[i + 1])\n }\n } else if (headers && typeof headers === 'object') {\n if (headers[Symbol.iterator]) {\n for (const header of headers) {\n if (!Array.isArray(header) || header.length !== 2) {\n throw new InvalidArgumentError('headers must be in key-value pair format')\n }\n processHeader(this, header[0], header[1])\n }\n } else {\n const keys = Object.keys(headers)\n for (let i = 0; i < keys.length; ++i) {\n processHeader(this, keys[i], headers[keys[i]])\n }\n }\n } else if (headers != null) {\n throw new InvalidArgumentError('headers must be an object or an array')\n }\n\n validateHandler(handler, method, upgrade)\n\n this.servername = servername || getServerName(this.host)\n\n this[kHandler] = handler\n\n if (channels.create.hasSubscribers) {\n channels.create.publish({ request: this })\n }\n }\n\n onBodySent (chunk) {\n if (this[kHandler].onBodySent) {\n try {\n return this[kHandler].onBodySent(chunk)\n } catch (err) {\n this.abort(err)\n }\n }\n }\n\n onRequestSent () {\n if (channels.bodySent.hasSubscribers) {\n channels.bodySent.publish({ request: this })\n }\n\n if (this[kHandler].onRequestSent) {\n try {\n return this[kHandler].onRequestSent()\n } catch (err) {\n this.abort(err)\n }\n }\n }\n\n onConnect (abort) {\n assert(!this.aborted)\n assert(!this.completed)\n\n if (this.error) {\n abort(this.error)\n } else {\n this.abort = abort\n return this[kHandler].onConnect(abort)\n }\n }\n\n onResponseStarted () {\n return this[kHandler].onResponseStarted?.()\n }\n\n onHeaders (statusCode, headers, resume, statusText) {\n assert(!this.aborted)\n assert(!this.completed)\n\n if (channels.headers.hasSubscribers) {\n channels.headers.publish({ request: this, response: { statusCode, headers, statusText } })\n }\n\n try {\n return this[kHandler].onHeaders(statusCode, headers, resume, statusText)\n } catch (err) {\n this.abort(err)\n }\n }\n\n onData (chunk) {\n assert(!this.aborted)\n assert(!this.completed)\n\n try {\n return this[kHandler].onData(chunk)\n } catch (err) {\n this.abort(err)\n return false\n }\n }\n\n onUpgrade (statusCode, headers, socket) {\n assert(!this.aborted)\n assert(!this.completed)\n\n return this[kHandler].onUpgrade(statusCode, headers, socket)\n }\n\n onComplete (trailers) {\n this.onFinally()\n\n assert(!this.aborted)\n\n this.completed = true\n if (channels.trailers.hasSubscribers) {\n channels.trailers.publish({ request: this, trailers })\n }\n\n try {\n return this[kHandler].onComplete(trailers)\n } catch (err) {\n // TODO (fix): This might be a bad idea?\n this.onError(err)\n }\n }\n\n onError (error) {\n this.onFinally()\n\n if (channels.error.hasSubscribers) {\n channels.error.publish({ request: this, error })\n }\n\n if (this.aborted) {\n return\n }\n this.aborted = true\n\n return this[kHandler].onError(error)\n }\n\n onFinally () {\n if (this.errorHandler) {\n this.body.off('error', this.errorHandler)\n this.errorHandler = null\n }\n\n if (this.endHandler) {\n this.body.off('end', this.endHandler)\n this.endHandler = null\n }\n }\n\n addHeader (key, value) {\n processHeader(this, key, value)\n return this\n }\n}\n\nfunction processHeader (request, key, val) {\n if (val && (typeof val === 'object' && !Array.isArray(val))) {\n throw new InvalidArgumentError(`invalid ${key} header`)\n } else if (val === undefined) {\n return\n }\n\n let headerName = headerNameLowerCasedRecord[key]\n\n if (headerName === undefined) {\n headerName = key.toLowerCase()\n if (headerNameLowerCasedRecord[headerName] === undefined && !isValidHTTPToken(headerName)) {\n throw new InvalidArgumentError('invalid header key')\n }\n }\n\n if (Array.isArray(val)) {\n const arr = []\n for (let i = 0; i < val.length; i++) {\n if (typeof val[i] === 'string') {\n if (!isValidHeaderValue(val[i])) {\n throw new InvalidArgumentError(`invalid ${key} header`)\n }\n arr.push(val[i])\n } else if (val[i] === null) {\n arr.push('')\n } else if (typeof val[i] === 'object') {\n throw new InvalidArgumentError(`invalid ${key} header`)\n } else {\n // Coerce primitives (and reject unsafe coercions such as functions\n // with a crafted toString/Symbol.toPrimitive).\n const str = `${val[i]}`\n if (!isValidHeaderValue(str)) {\n throw new InvalidArgumentError(`invalid ${key} header`)\n }\n arr.push(str)\n }\n }\n val = arr\n } else if (typeof val === 'string') {\n if (!isValidHeaderValue(val)) {\n throw new InvalidArgumentError(`invalid ${key} header`)\n }\n } else if (val === null) {\n val = ''\n } else {\n // Coerce primitives (and reject unsafe coercions such as functions\n // with a crafted toString/Symbol.toPrimitive).\n val = `${val}`\n if (!isValidHeaderValue(val)) {\n throw new InvalidArgumentError(`invalid ${key} header`)\n }\n }\n\n if (headerName === 'host') {\n if (request.host !== null) {\n throw new InvalidArgumentError('duplicate host header')\n }\n if (typeof val !== 'string') {\n throw new InvalidArgumentError('invalid host header')\n }\n // Consumed by Client\n request.host = val\n } else if (headerName === 'content-length') {\n if (request.contentLength !== null) {\n throw new InvalidArgumentError('duplicate content-length header')\n }\n request.contentLength = parseInt(val, 10)\n if (!Number.isFinite(request.contentLength)) {\n throw new InvalidArgumentError('invalid content-length header')\n }\n } else if (request.contentType === null && headerName === 'content-type') {\n request.contentType = val\n request.headers.push(key, val)\n } else if (headerName === 'transfer-encoding' || headerName === 'keep-alive' || headerName === 'upgrade') {\n throw new InvalidArgumentError(`invalid ${headerName} header`)\n } else if (headerName === 'connection') {\n const value = typeof val === 'string' ? val.toLowerCase() : null\n if (value !== 'close' && value !== 'keep-alive') {\n throw new InvalidArgumentError('invalid connection header')\n }\n\n if (value === 'close') {\n request.reset = true\n }\n } else if (headerName === 'expect') {\n throw new NotSupportedError('expect header not supported')\n } else {\n request.headers.push(key, val)\n }\n}\n\nmodule.exports = Request\n"],"names":["require$$0","require$$1","require$$2","require$$3","require$$4"],"mappings":";;;;;;;;;;;;;;;;;;;CAEA,MAAM;AACN,GAAE,oBAAoB;GACpB;AACF,EAAC,GAAGA,gBAAA;AACJ,CAAA,MAAM,MAAM,GAAGC;CACf,MAAM;AACN,GAAE,gBAAgB;AAClB,GAAE,kBAAkB;AACpB,GAAE,QAAQ;AACV,GAAE,OAAO;AACT,GAAE,QAAQ;AACV,GAAE,cAAc;AAChB,GAAE,UAAU;AACZ,GAAE,UAAU;AACZ,GAAE,QAAQ;AACV,GAAE,eAAe;AACjB,GAAE,aAAa;GACb;AACF,EAAC,GAAGC,cAAA;CACJ,MAAM,EAAE,QAAQ,EAAE,GAAGC,qBAAA;CACrB,MAAM,EAAE,0BAA0B,EAAE,GAAGC,mBAAA;;AAEvC;AACA,CAAA,MAAM,gBAAgB,GAAG;;AAEzB,CAAA,MAAM,QAAQ,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AAC,6BAA6B;AAC7D,GAAA,CAAG,MAAM;KACL,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;AACjC,GAAA;AACA,CAAA;;AAEA,CAAA,OAAc,GAAG;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -39,7 +39,6 @@ function requireAgent () {
|
|
|
39
39
|
|
|
40
40
|
class Agent extends DispatcherBase {
|
|
41
41
|
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
|
42
|
-
|
|
43
42
|
if (typeof factory !== 'function') {
|
|
44
43
|
throw new InvalidArgumentError('factory must be a function.')
|
|
45
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sources":["../../../../../../../../node_modules/undici/lib/dispatcher/agent.js"],"sourcesContent":["'use strict'\n\nconst { InvalidArgumentError } = require('../core/errors')\nconst { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = require('../core/symbols')\nconst DispatcherBase = require('./dispatcher-base')\nconst Pool = require('./pool')\nconst Client = require('./client')\nconst util = require('../core/util')\nconst createRedirectInterceptor = require('../interceptor/redirect-interceptor')\n\nconst kOnConnect = Symbol('onConnect')\nconst kOnDisconnect = Symbol('onDisconnect')\nconst kOnConnectionError = Symbol('onConnectionError')\nconst kMaxRedirections = Symbol('maxRedirections')\nconst kOnDrain = Symbol('onDrain')\nconst kFactory = Symbol('factory')\nconst kOptions = Symbol('options')\n\nfunction defaultFactory (origin, opts) {\n return opts && opts.connections === 1\n ? new Client(origin, opts)\n : new Pool(origin, opts)\n}\n\nclass Agent extends DispatcherBase {\n constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {\n
|
|
1
|
+
{"version":3,"file":"agent.js","sources":["../../../../../../../../node_modules/undici/lib/dispatcher/agent.js"],"sourcesContent":["'use strict'\n\nconst { InvalidArgumentError } = require('../core/errors')\nconst { kClients, kRunning, kClose, kDestroy, kDispatch, kInterceptors } = require('../core/symbols')\nconst DispatcherBase = require('./dispatcher-base')\nconst Pool = require('./pool')\nconst Client = require('./client')\nconst util = require('../core/util')\nconst createRedirectInterceptor = require('../interceptor/redirect-interceptor')\n\nconst kOnConnect = Symbol('onConnect')\nconst kOnDisconnect = Symbol('onDisconnect')\nconst kOnConnectionError = Symbol('onConnectionError')\nconst kMaxRedirections = Symbol('maxRedirections')\nconst kOnDrain = Symbol('onDrain')\nconst kFactory = Symbol('factory')\nconst kOptions = Symbol('options')\n\nfunction defaultFactory (origin, opts) {\n return opts && opts.connections === 1\n ? new Client(origin, opts)\n : new Pool(origin, opts)\n}\n\nclass Agent extends DispatcherBase {\n constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {\n if (typeof factory !== 'function') {\n throw new InvalidArgumentError('factory must be a function.')\n }\n\n if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {\n throw new InvalidArgumentError('connect must be a function or an object')\n }\n\n if (!Number.isInteger(maxRedirections) || maxRedirections < 0) {\n throw new InvalidArgumentError('maxRedirections must be a positive number')\n }\n\n super(options)\n\n if (connect && typeof connect !== 'function') {\n connect = { ...connect }\n }\n\n this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent)\n ? options.interceptors.Agent\n : [createRedirectInterceptor({ maxRedirections })]\n\n this[kOptions] = { ...util.deepClone(options), connect }\n this[kOptions].interceptors = options.interceptors\n ? { ...options.interceptors }\n : undefined\n this[kMaxRedirections] = maxRedirections\n this[kFactory] = factory\n this[kClients] = new Map()\n\n this[kOnDrain] = (origin, targets) => {\n this.emit('drain', origin, [this, ...targets])\n }\n\n this[kOnConnect] = (origin, targets) => {\n this.emit('connect', origin, [this, ...targets])\n }\n\n this[kOnDisconnect] = (origin, targets, err) => {\n this.emit('disconnect', origin, [this, ...targets], err)\n }\n\n this[kOnConnectionError] = (origin, targets, err) => {\n this.emit('connectionError', origin, [this, ...targets], err)\n }\n }\n\n get [kRunning] () {\n let ret = 0\n for (const client of this[kClients].values()) {\n ret += client[kRunning]\n }\n return ret\n }\n\n [kDispatch] (opts, handler) {\n let key\n if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) {\n key = String(opts.origin)\n } else {\n throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.')\n }\n\n let dispatcher = this[kClients].get(key)\n\n if (!dispatcher) {\n dispatcher = this[kFactory](opts.origin, this[kOptions])\n .on('drain', this[kOnDrain])\n .on('connect', this[kOnConnect])\n .on('disconnect', this[kOnDisconnect])\n .on('connectionError', this[kOnConnectionError])\n\n // This introduces a tiny memory leak, as dispatchers are never removed from the map.\n // TODO(mcollina): remove te timer when the client/pool do not have any more\n // active connections.\n this[kClients].set(key, dispatcher)\n }\n\n return dispatcher.dispatch(opts, handler)\n }\n\n async [kClose] () {\n const closePromises = []\n for (const client of this[kClients].values()) {\n closePromises.push(client.close())\n }\n this[kClients].clear()\n\n await Promise.all(closePromises)\n }\n\n async [kDestroy] (err) {\n const destroyPromises = []\n for (const client of this[kClients].values()) {\n destroyPromises.push(client.destroy(err))\n }\n this[kClients].clear()\n\n await Promise.all(destroyPromises)\n }\n}\n\nmodule.exports = Agent\n"],"names":["require$$0","require$$1","require$$2","require$$3","require$$4","util","require$$5","require$$6"],"mappings":";;;;;;;;;;;;;;;;;CAEA,MAAM,EAAE,oBAAoB,EAAE,GAAGA,gBAAA;AACjC,CAAA,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,GAAGC,iBAAA;AAC3E,CAAA,MAAM,cAAc,GAAGC,wBAAA;AACvB,CAAA,MAAM,IAAI,GAAGC,cAAA;AACb,CAAA,MAAM,MAAM,GAAGC,gBAAA;AACf,CAAA,MAAMC,MAAI,GAAGC,cAAA;AACb,CAAA,MAAM,yBAAyB,GAAGC,6BAAA;;AAElC,CAAA,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW;AACrC,CAAA,MAAM,aAAa,GAAG,MAAM,CAAC,c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AEA,KAAI,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO;AAC5C,GAAA;;GAEE,OAAO,MAAM,EAAE,GAAG;KAChB,MAAM,aAAa,GAAG;KACtB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE;AAClD,OAAM,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;AACvC,KAAA;AACA,KAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK;;AAExB,KAAI,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa;AACnC,GAAA;;AAEA,GAAE,OAAO,QAAQ,EAAE,CAAC,GAAG,EAAE;KACrB,MAAM,eAAe,GAAG;KACxB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE;OAC5C,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;AAC9C,KAAA;AACA,KAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK;;AAExB,KAAI,MAAM,OAAO,CAAC,GAAG,CAAC,eAAe;AACrC,GAAA;AACA;;AAEA,CAAA,KAAc,GAAG;;;;;;","x_google_ignoreList":[0]}
|
|
@@ -32,6 +32,7 @@ function requireClientH1 () {
|
|
|
32
32
|
RequestContentLengthMismatchError,
|
|
33
33
|
ResponseContentLengthMismatchError,
|
|
34
34
|
RequestAbortedError,
|
|
35
|
+
InvalidArgumentError,
|
|
35
36
|
HeadersTimeoutError,
|
|
36
37
|
HeadersOverflowError,
|
|
37
38
|
SocketError,
|
|
@@ -79,6 +80,9 @@ function requireClientH1 () {
|
|
|
79
80
|
const FastBuffer = Buffer[Symbol.species];
|
|
80
81
|
const addListener = util$1.addListener;
|
|
81
82
|
const removeAllListeners = util$1.removeAllListeners;
|
|
83
|
+
const kIdleSocketValidation = Symbol('kIdleSocketValidation');
|
|
84
|
+
const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout');
|
|
85
|
+
const kSocketUsed = Symbol('kSocketUsed');
|
|
82
86
|
|
|
83
87
|
let extractBody;
|
|
84
88
|
|
|
@@ -301,29 +305,71 @@ function requireClientH1 () {
|
|
|
301
305
|
|
|
302
306
|
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr;
|
|
303
307
|
|
|
304
|
-
if (ret
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
315
|
-
message =
|
|
316
|
-
'Response does not match the HTTP/1.1 protocol (' +
|
|
317
|
-
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
|
318
|
-
')';
|
|
308
|
+
if (ret !== constants$1.ERROR.OK) {
|
|
309
|
+
const body = data.subarray(offset);
|
|
310
|
+
|
|
311
|
+
if (ret === constants$1.ERROR.PAUSED_UPGRADE) {
|
|
312
|
+
this.onUpgrade(body);
|
|
313
|
+
} else if (ret === constants$1.ERROR.PAUSED) {
|
|
314
|
+
this.paused = true;
|
|
315
|
+
socket.unshift(body);
|
|
316
|
+
} else {
|
|
317
|
+
throw this.createError(ret, body)
|
|
319
318
|
}
|
|
320
|
-
throw new HTTPParserError(message, constants$1.ERROR[ret], data.slice(offset))
|
|
321
319
|
}
|
|
322
320
|
} catch (err) {
|
|
323
321
|
util$1.destroy(socket, err);
|
|
324
322
|
}
|
|
325
323
|
}
|
|
326
324
|
|
|
325
|
+
finish () {
|
|
326
|
+
assert(currentParser === null);
|
|
327
|
+
assert(this.ptr != null);
|
|
328
|
+
assert(!this.paused);
|
|
329
|
+
|
|
330
|
+
const { llhttp } = this;
|
|
331
|
+
|
|
332
|
+
let ret;
|
|
333
|
+
|
|
334
|
+
try {
|
|
335
|
+
currentParser = this;
|
|
336
|
+
ret = llhttp.llhttp_finish(this.ptr);
|
|
337
|
+
} finally {
|
|
338
|
+
currentParser = null;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (ret === constants$1.ERROR.OK) {
|
|
342
|
+
return null
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (ret === constants$1.ERROR.PAUSED || ret === constants$1.ERROR.PAUSED_UPGRADE) {
|
|
346
|
+
this.paused = true;
|
|
347
|
+
return null
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return this.createError(ret, EMPTY_BUF)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
createError (ret, data) {
|
|
354
|
+
const { llhttp, contentLength, bytesRead } = this;
|
|
355
|
+
|
|
356
|
+
if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
|
|
357
|
+
return new ResponseContentLengthMismatchError()
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const ptr = llhttp.llhttp_get_error_reason(this.ptr);
|
|
361
|
+
let message = '';
|
|
362
|
+
if (ptr) {
|
|
363
|
+
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
364
|
+
message =
|
|
365
|
+
'Response does not match the HTTP/1.1 protocol (' +
|
|
366
|
+
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
|
367
|
+
')';
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
return new HTTPParserError(message, constants$1.ERROR[ret], data)
|
|
371
|
+
}
|
|
372
|
+
|
|
327
373
|
destroy () {
|
|
328
374
|
assert(this.ptr != null);
|
|
329
375
|
assert(currentParser == null);
|
|
@@ -351,6 +397,11 @@ function requireClientH1 () {
|
|
|
351
397
|
return -1
|
|
352
398
|
}
|
|
353
399
|
|
|
400
|
+
if (client[kRunning] === 0) {
|
|
401
|
+
util$1.destroy(socket, new SocketError('bad response', util$1.getSocketInfo(socket)));
|
|
402
|
+
return -1
|
|
403
|
+
}
|
|
404
|
+
|
|
354
405
|
const request = client[kQueue][client[kRunningIdx]];
|
|
355
406
|
if (!request) {
|
|
356
407
|
return -1
|
|
@@ -454,6 +505,11 @@ function requireClientH1 () {
|
|
|
454
505
|
return -1
|
|
455
506
|
}
|
|
456
507
|
|
|
508
|
+
if (client[kRunning] === 0) {
|
|
509
|
+
util$1.destroy(socket, new SocketError('bad response', util$1.getSocketInfo(socket)));
|
|
510
|
+
return -1
|
|
511
|
+
}
|
|
512
|
+
|
|
457
513
|
const request = client[kQueue][client[kRunningIdx]];
|
|
458
514
|
|
|
459
515
|
/* istanbul ignore next: difficult to make a test case for */
|
|
@@ -627,6 +683,7 @@ function requireClientH1 () {
|
|
|
627
683
|
request.onComplete(headers);
|
|
628
684
|
|
|
629
685
|
client[kQueue][client[kRunningIdx]++] = null;
|
|
686
|
+
socket[kSocketUsed] = true;
|
|
630
687
|
|
|
631
688
|
if (socket[kWriting]) {
|
|
632
689
|
assert(client[kRunning] === 0);
|
|
@@ -685,6 +742,9 @@ function requireClientH1 () {
|
|
|
685
742
|
socket[kWriting] = false;
|
|
686
743
|
socket[kReset] = false;
|
|
687
744
|
socket[kBlocking] = false;
|
|
745
|
+
socket[kIdleSocketValidation] = 0;
|
|
746
|
+
socket[kIdleSocketValidationTimeout] = null;
|
|
747
|
+
socket[kSocketUsed] = false;
|
|
688
748
|
socket[kParser] = new Parser(client, socket, llhttpInstance);
|
|
689
749
|
|
|
690
750
|
addListener(socket, 'error', function (err) {
|
|
@@ -695,8 +755,11 @@ function requireClientH1 () {
|
|
|
695
755
|
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
|
696
756
|
// to the user.
|
|
697
757
|
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
|
|
698
|
-
|
|
699
|
-
|
|
758
|
+
const parserErr = parser.finish();
|
|
759
|
+
if (parserErr) {
|
|
760
|
+
this[kError] = parserErr;
|
|
761
|
+
this[kClient][kOnError](parserErr);
|
|
762
|
+
}
|
|
700
763
|
return
|
|
701
764
|
}
|
|
702
765
|
|
|
@@ -715,8 +778,10 @@ function requireClientH1 () {
|
|
|
715
778
|
const parser = this[kParser];
|
|
716
779
|
|
|
717
780
|
if (parser.statusCode && !parser.shouldKeepAlive) {
|
|
718
|
-
|
|
719
|
-
|
|
781
|
+
const parserErr = parser.finish();
|
|
782
|
+
if (parserErr) {
|
|
783
|
+
util$1.destroy(this, parserErr);
|
|
784
|
+
}
|
|
720
785
|
return
|
|
721
786
|
}
|
|
722
787
|
|
|
@@ -726,10 +791,11 @@ function requireClientH1 () {
|
|
|
726
791
|
const client = this[kClient];
|
|
727
792
|
const parser = this[kParser];
|
|
728
793
|
|
|
794
|
+
clearIdleSocketValidation(this);
|
|
795
|
+
|
|
729
796
|
if (parser) {
|
|
730
797
|
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
|
|
731
|
-
|
|
732
|
-
parser.onMessageComplete();
|
|
798
|
+
this[kError] = parser.finish() || this[kError];
|
|
733
799
|
}
|
|
734
800
|
|
|
735
801
|
this[kParser].destroy();
|
|
@@ -792,7 +858,7 @@ function requireClientH1 () {
|
|
|
792
858
|
return socket.destroyed
|
|
793
859
|
},
|
|
794
860
|
busy (request) {
|
|
795
|
-
if (socket[kWriting] || socket[kReset] || socket[kBlocking]) {
|
|
861
|
+
if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) {
|
|
796
862
|
return true
|
|
797
863
|
}
|
|
798
864
|
|
|
@@ -830,6 +896,31 @@ function requireClientH1 () {
|
|
|
830
896
|
}
|
|
831
897
|
}
|
|
832
898
|
|
|
899
|
+
function clearIdleSocketValidation (socket) {
|
|
900
|
+
if (socket[kIdleSocketValidationTimeout]) {
|
|
901
|
+
clearTimeout(socket[kIdleSocketValidationTimeout]);
|
|
902
|
+
socket[kIdleSocketValidationTimeout] = null;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
socket[kIdleSocketValidation] = 0;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
function scheduleIdleSocketValidation (client, socket) {
|
|
909
|
+
socket[kIdleSocketValidation] = 1;
|
|
910
|
+
socket[kIdleSocketValidationTimeout] = setTimeout(() => {
|
|
911
|
+
socket[kIdleSocketValidationTimeout] = null;
|
|
912
|
+
socket[kIdleSocketValidation] = 2;
|
|
913
|
+
|
|
914
|
+
if (client[kSocket] === socket && !socket.destroyed) {
|
|
915
|
+
client[kResume]();
|
|
916
|
+
}
|
|
917
|
+
}, 0);
|
|
918
|
+
socket[kIdleSocketValidationTimeout].unref?.();
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* @param {import('./client.js')} client
|
|
923
|
+
*/
|
|
833
924
|
function resumeH1 (client) {
|
|
834
925
|
const socket = client[kSocket];
|
|
835
926
|
|
|
@@ -844,6 +935,32 @@ function requireClientH1 () {
|
|
|
844
935
|
socket[kNoRef] = false;
|
|
845
936
|
}
|
|
846
937
|
|
|
938
|
+
if (client[kRunning] === 0 && client[kPending] > 0 && socket[kSocketUsed]) {
|
|
939
|
+
if (socket[kIdleSocketValidation] === 0) {
|
|
940
|
+
scheduleIdleSocketValidation(client, socket);
|
|
941
|
+
socket[kParser].readMore();
|
|
942
|
+
if (socket.destroyed) {
|
|
943
|
+
return
|
|
944
|
+
}
|
|
945
|
+
return
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
if (socket[kIdleSocketValidation] === 1) {
|
|
949
|
+
socket[kParser].readMore();
|
|
950
|
+
if (socket.destroyed) {
|
|
951
|
+
return
|
|
952
|
+
}
|
|
953
|
+
return
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
if (client[kRunning] === 0) {
|
|
958
|
+
socket[kParser].readMore();
|
|
959
|
+
if (socket.destroyed) {
|
|
960
|
+
return
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
|
|
847
964
|
if (client[kSize] === 0) {
|
|
848
965
|
if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) {
|
|
849
966
|
socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE);
|
|
@@ -899,8 +1016,16 @@ function requireClientH1 () {
|
|
|
899
1016
|
}
|
|
900
1017
|
body$1 = bodyStream.stream;
|
|
901
1018
|
contentLength = bodyStream.length;
|
|
902
|
-
} else if (util$1.isBlobLike(body$1) && request.contentType == null
|
|
903
|
-
|
|
1019
|
+
} else if (util$1.isBlobLike(body$1) && request.contentType == null) {
|
|
1020
|
+
const contentType = body$1.type;
|
|
1021
|
+
if (contentType) {
|
|
1022
|
+
const contentTypeValue = `${contentType}`;
|
|
1023
|
+
if (!util$1.isValidHeaderValue(contentTypeValue)) {
|
|
1024
|
+
util$1.errorRequest(client, request, new InvalidArgumentError('invalid content-type header'));
|
|
1025
|
+
return false
|
|
1026
|
+
}
|
|
1027
|
+
headers.push('content-type', contentTypeValue);
|
|
1028
|
+
}
|
|
904
1029
|
}
|
|
905
1030
|
|
|
906
1031
|
if (body$1 && typeof body$1.read === 'function') {
|
|
@@ -937,6 +1062,7 @@ function requireClientH1 () {
|
|
|
937
1062
|
}
|
|
938
1063
|
|
|
939
1064
|
const socket = client[kSocket];
|
|
1065
|
+
clearIdleSocketValidation(socket);
|
|
940
1066
|
|
|
941
1067
|
const abort = (err) => {
|
|
942
1068
|
if (request.aborted || request.completed) {
|