From 4c029bab3dc6510bd9492d72b938cc1df54e1471 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 12 Aug 2026 21:44:38 +0000 Subject: [PATCH] chore: Update dist --- THIRD-PARTY | 8 ++--- dist/index.js | 96 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 91 insertions(+), 13 deletions(-) diff --git a/THIRD-PARTY b/THIRD-PARTY index 7d34672..804b8f7 100644 --- a/THIRD-PARTY +++ b/THIRD-PARTY @@ -832,7 +832,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. The following npm package may be included in this product: - - @aws-sdk/core@3.977.5 + - @aws-sdk/core@3.977.7 This package contains the following license: @@ -1042,12 +1042,12 @@ Apache License The following npm packages may be included in this product: - - @aws-sdk/credential-provider-env@3.972.66 + - @aws-sdk/credential-provider-env@3.972.67 - @aws-sdk/credential-provider-ini@3.973.11 - @aws-sdk/credential-provider-node@3.972.77 - @aws-sdk/token-providers@3.1102.0 - - @aws-sdk/types@3.974.2 - - @aws-sdk/xml-builder@3.972.37 + - @aws-sdk/types@3.974.3 + - @aws-sdk/xml-builder@3.972.38 - @smithy/credential-provider-imds@4.4.16 - @smithy/fetch-http-handler@5.6.13 - @smithy/node-http-handler@4.9.13 diff --git a/dist/index.js b/dist/index.js index e38e74b..85012d1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -36618,24 +36618,25 @@ function jsonReviver(key, value, context) { const numericString = context.source; if (typeof value === "number") { const inSafeRange = value <= Number.MAX_SAFE_INTEGER && value >= Number.MIN_SAFE_INTEGER; - if (!inSafeRange || numericString !== String(value)) { - if (inSafeRange && /[eE]/.test(numericString) && String(Number(numericString)) === String(value)) { + if (inSafeRange) { + if (isRepresentable(numericString, value)) { return value; } - if (isFractionalNumeric(numericString)) { + return new NumericValue(numericString, "bigDecimal"); + } else { + if (isFractionalBigNumeric(numericString)) { return new NumericValue(numericString, "bigDecimal"); - } else { - if (/[eE]/.test(numericString)) { - return BigInt(Number(numericString)); - } - return BigInt(numericString); } + if (/[eE]/.test(numericString)) { + return expandExponentToBigInt(numericString); + } + return BigInt(numericString); } } } return value; } -function isFractionalNumeric(s2) { +function isFractionalBigNumeric(s2) { const dotIndex = s2.indexOf("."); if (dotIndex === -1) { return false; @@ -36648,6 +36649,83 @@ function isFractionalNumeric(s2) { const exp = parseInt(s2.slice(eIndex + 1), 10); return exp < fracDigits; } +function isRepresentable(numericString, value) { + if (numericString === String(value)) { + return true; + } + if (Object.is(value, -0)) { + return true; + } + if (/[eE]/.test(numericString)) { + return expandToDecimal(numericString) === expandToDecimal(String(value)); + } + const normalized = numericString.replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, ""); + const canonical = String(value); + if (normalized === canonical) { + return true; + } + if (/[eE]/.test(canonical)) { + return normalized === expandToDecimal(canonical); + } + return false; +} +function expandToDecimal(s2) { + const negative = s2.startsWith("-"); + const abs = negative ? s2.slice(1) : s2; + const eIndex = abs.search(/[eE]/); + let result; + if (eIndex === -1) { + result = abs; + } else { + const exp = parseInt(abs.slice(eIndex + 1), 10); + const mantissa = abs.slice(0, eIndex); + const dotIndex = mantissa.indexOf("."); + let digits; + let intLen; + if (dotIndex === -1) { + digits = mantissa; + intLen = mantissa.length; + } else { + digits = mantissa.slice(0, dotIndex) + mantissa.slice(dotIndex + 1); + intLen = dotIndex; + } + digits = digits.replace(/0+$/, "") || "0"; + const newDotPos = intLen + exp; + if (digits === "0") { + result = "0"; + } else if (newDotPos <= 0) { + result = "0." + "0".repeat(-newDotPos) + digits; + } else if (newDotPos >= digits.length) { + result = digits + "0".repeat(newDotPos - digits.length); + } else { + result = digits.slice(0, newDotPos) + "." + digits.slice(newDotPos); + } + } + if (result.includes(".")) { + result = result.replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, ""); + } + return (negative ? "-" : "") + result; +} +function expandExponentToBigInt(s2) { + const eIndex = s2.search(/[eE]/); + const exp = parseInt(s2.slice(eIndex + 1), 10); + const negative = s2.startsWith("-"); + const mantissa = s2.slice(negative ? 1 : 0, eIndex); + const dotIndex = mantissa.indexOf("."); + let digits; + let shift; + if (dotIndex === -1) { + digits = mantissa; + shift = exp; + } else { + digits = mantissa.slice(0, dotIndex) + mantissa.slice(dotIndex + 1); + const fracDigits = mantissa.length - dotIndex - 1; + shift = exp - fracDigits; + } + digits = digits.replace(/0+$/, "") || "0"; + const result = BigInt(digits) * 10n ** BigInt(shift + (mantissa.replace(".", "").length - digits.length)); + return negative ? -result : result; +} var init_jsonReviver = __esm({ "node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js"() { init_serde();