@code-yeongyu/senpi 2026.8.20-2 → 2026.8.20
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/CHANGELOG.md +0 -16
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js +13 -38
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/index.js +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/schemas/schemas_0.js +12 -34
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/commands/ConverseCommand.d.ts +0 -29
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/commands/ConverseStreamCommand.d.ts +0 -15
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/commands/CountTokensCommand.d.ts +0 -14
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/index.d.ts +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/models/models_0.d.ts +1 -119
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/runtimeConfig.browser.d.ts +46 -46
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/runtimeConfig.d.ts +36 -36
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/runtimeConfig.native.d.ts +48 -48
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/runtimeConfig.shared.d.ts +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/schemas/schemas_0.d.ts +0 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/index.d.ts +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/models/models_0.d.ts +0 -76
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/runtimeConfig.browser.d.ts +72 -70
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/runtimeConfig.d.ts +68 -68
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/runtimeConfig.native.d.ts +88 -86
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/runtimeConfig.shared.d.ts +3 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/schemas/schemas_0.d.ts +0 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +14 -14
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +426 -1343
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +5 -8
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +3 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{codec-v1/JsonCodec.js → JsonCodec.js} +1 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{codec-v1/JsonShapeDeserializer.js → JsonShapeDeserializer.js} +6 -6
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{codec-v1/JsonShapeSerializer.js → JsonShapeSerializer.js} +5 -8
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{codec-v2/JsonShapeDeserializer2.js → experimental/BufferJsonShapeDeserializer.js} +18 -38
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/{codec-v2/JsonShapeSerializer2.js → experimental/ByteJsonShapeSerializer.js} +71 -107
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js +9 -93
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/util-endpoints/lib/aws/partitions.d.ts +54 -54
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/util-user-agent-browser/defaultUserAgent.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/util-user-agent-browser/defaultUserAgent.native.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/util-user-agent-node/defaultUserAgent.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +6 -9
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +3 -4
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +3 -5
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{codec-v1/JsonCodec.d.ts → JsonCodec.d.ts} +8 -4
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{codec-v1/JsonShapeDeserializer.d.ts → JsonShapeDeserializer.d.ts} +2 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{codec-v1/JsonShapeSerializer.d.ts → JsonShapeSerializer.d.ts} +2 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{codec-v2/JsonShapeDeserializer2.d.ts → experimental/BufferJsonShapeDeserializer.d.ts} +3 -4
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/{codec-v2/JsonShapeSerializer2.d.ts → experimental/ByteJsonShapeSerializer.d.ts} +16 -19
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/api-extractor-type-index.d.ts +7 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/index.d.ts +21 -61
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.d.ts +27 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/AccountIdEndpointModeConstants.d.ts +16 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/NodeAccountIdEndpointModeConfigOptions.d.ts +14 -5
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/index.d.ts +5 -16
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/emitWarningIfUnsupportedVersion.d.ts +11 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.browser.d.ts +47 -107
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.d.ts +39 -112
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.native.d.ts +48 -107
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/longPollMiddleware.d.ts +14 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-host-header/hostHeaderMiddleware.d.ts +35 -25
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-logger/loggerMiddleware.d.ts +4 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/configuration.d.ts +6 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.browser.d.ts +6 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.d.ts +10 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.native.d.ts +6 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/check-features.d.ts +20 -16
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/configurations.d.ts +44 -21
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/constants.d.ts +7 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/encode-features.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/user-agent-middleware.d.ts +18 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/awsRegionConfig.d.ts +11 -8
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/extensions.d.ts +16 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.browser.d.ts +4 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.d.ts +14 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.native.d.ts +4 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setCredentialFeature.d.ts +7 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setFeature.d.ts +12 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setTokenFeature.d.ts +7 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/aws.d.ts +2 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/isVirtualHostableS3Bucket.d.ts +5 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/parseArn.d.ts +7 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partition.d.ts +38 -28
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partitions.d.ts +638 -647
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/isIpAddress.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/resolveDefaultAwsRegionalEndpointsConfig.d.ts +56 -29
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/resolveEndpoint.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/EndpointError.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/EndpointRuleObject.d.ts +1 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/ErrorRuleObject.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/RuleSetObject.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/TreeRuleObject.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/shared.d.ts +1 -12
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/configurations.d.ts +7 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/createUserAgentStringParsingProvider.d.ts +14 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.browser.d.ts +2 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.d.ts +27 -15
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.native.d.ts +18 -10
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/crt-availability.d.ts +8 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/defaultUserAgent.d.ts +28 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.d.ts +6 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/is-crt-available.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/nodeAppIdConfigOptions.d.ts +13 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.d.ts +10 -9
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +44 -39
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.browser.d.ts +6 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.d.ts +7 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-node-config.d.ts +13 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/index.d.ts +7 -23
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +38 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +133 -57
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/index.browser.d.ts +11 -32
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/index.d.ts +9 -32
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.d.ts +8 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getBearerTokenEnvKey.d.ts +6 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getDateHeader.d.ts +8 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.d.ts +8 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +26 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/index.d.ts +4 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/isClockSkewed.d.ts +9 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -5
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/ProtocolLib.d.ts +74 -40
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +24 -9
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/cbor/AwsSmithyRpcV2CborProtocol.d.ts +25 -36
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/coercing-serializers.d.ts +18 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/common.d.ts +2 -5
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +22 -30
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +22 -22
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +22 -22
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +29 -50
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +36 -52
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonCodec.d.ts +19 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonShapeDeserializer.d.ts +13 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonShapeSerializer.d.ts +28 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/awsExpectUnion.d.ts +7 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.d.ts +29 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/ByteJsonShapeSerializer.d.ts +57 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +21 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +15 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +11 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +22 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsEc2QueryProtocol.d.ts +27 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsQueryProtocol.d.ts +49 -57
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/QuerySerializerSettings.d.ts +13 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/QueryShapeSerializer.d.ts +16 -21
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +4 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/AwsRestXmlProtocol.d.ts +31 -47
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlCodec.d.ts +14 -17
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlShapeDeserializer.d.ts +20 -15
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlShapeSerializer.d.ts +21 -21
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/parseXmlBody.d.ts +13 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/simpleFormatXml.d.ts +6 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +3 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/util-arn-parser/arn.d.ts +32 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/util-format-url/format-url.d.ts +2 -4
- package/node_modules/@aws-sdk/core/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-env/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/LICENSE +201 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/README.md +9 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-cjs/index.js +840 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +50 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +241 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +136 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +173 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +10 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/http2/ClientHttp2SessionRef.d.ts +46 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +47 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +46 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +36 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +76 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/node-http2.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/node-https.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +9 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +10 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/http2/ClientHttp2SessionRef.d.ts +46 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +47 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +46 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +36 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +76 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-https.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +9 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +12 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +12 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +64 -0
- package/node_modules/@aws-sdk/credential-provider-http/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +13 -13
- package/node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js +28 -35
- package/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js +28 -35
- package/node_modules/@aws-sdk/credential-provider-login/dist-types/LoginCredentialsFetcher.d.ts +0 -1
- package/node_modules/@aws-sdk/credential-provider-login/dist-types/ts3.4/LoginCredentialsFetcher.d.ts +0 -1
- package/node_modules/@aws-sdk/credential-provider-login/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-node/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-process/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +6 -6
- package/node_modules/@aws-sdk/eventstream-handler-node/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +4 -4
- package/node_modules/@aws-sdk/middleware-websocket/package.json +7 -7
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.browser.d.ts +42 -42
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.d.ts +42 -42
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.native.d.ts +41 -41
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.shared.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.browser.d.ts +43 -43
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.d.ts +43 -43
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.native.d.ts +42 -42
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.shared.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.browser.d.ts +42 -42
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.d.ts +42 -42
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.native.d.ts +41 -41
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.shared.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.browser.d.ts +42 -42
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.d.ts +42 -42
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.native.d.ts +41 -41
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.shared.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.browser.d.ts +44 -44
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.d.ts +35 -35
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.native.d.ts +43 -43
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.shared.d.ts +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.browser.d.ts +66 -64
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.d.ts +65 -65
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.native.d.ts +70 -68
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.shared.d.ts +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.browser.d.ts +69 -67
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.d.ts +66 -66
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.native.d.ts +73 -71
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.shared.d.ts +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.browser.d.ts +66 -64
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.d.ts +65 -65
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.native.d.ts +70 -68
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.shared.d.ts +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.browser.d.ts +66 -64
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.d.ts +65 -65
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.native.d.ts +70 -68
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.shared.d.ts +3 -3
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.browser.d.ts +70 -68
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.d.ts +68 -68
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.native.d.ts +74 -72
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.shared.d.ts +3 -3
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/LICENSE +201 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/README.md +9 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-cjs/index.js +840 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +9 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +50 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +241 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +136 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +173 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +10 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +5 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +4 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/http2/ClientHttp2SessionRef.d.ts +46 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +3 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +47 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +46 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +36 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +76 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/node-http2.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/node-https.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +6 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +9 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +10 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +5 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +4 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/http2/ClientHttp2SessionRef.d.ts +46 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +3 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +47 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +46 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +36 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +76 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-https.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +6 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +6 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +9 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +12 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +12 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +64 -0
- package/node_modules/@aws-sdk/nested-clients/package.json +8 -8
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +4 -4
- package/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@bufbuild/protobuf/README.md +15 -12
- package/node_modules/@bufbuild/protobuf/dist/commonjs/create.js +162 -199
- package/node_modules/@bufbuild/protobuf/dist/commonjs/from-binary.js +153 -321
- package/node_modules/@bufbuild/protobuf/dist/commonjs/from-json.js +303 -601
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.d.ts +1 -27
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.js +56 -80
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect.js +80 -3
- package/node_modules/@bufbuild/protobuf/dist/commonjs/registry.js +3 -12
- package/node_modules/@bufbuild/protobuf/dist/commonjs/to-binary.d.ts +0 -4
- package/node_modules/@bufbuild/protobuf/dist/commonjs/to-binary.js +127 -365
- package/node_modules/@bufbuild/protobuf/dist/commonjs/to-json.js +159 -393
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/base64-encoding.d.ts +1 -3
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/base64-encoding.js +8 -40
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.d.ts +19 -37
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.js +85 -281
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/index.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/index.js +1 -4
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-encoding.d.ts +2 -19
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-encoding.js +13 -47
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/varint.d.ts +4 -4
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/varint.js +23 -35
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/wrappers.js +12 -12
- package/node_modules/@bufbuild/protobuf/dist/esm/create.js +162 -199
- package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +153 -321
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +304 -602
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.d.ts +1 -27
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js +57 -79
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +78 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +3 -12
- package/node_modules/@bufbuild/protobuf/dist/esm/to-binary.d.ts +0 -4
- package/node_modules/@bufbuild/protobuf/dist/esm/to-binary.js +127 -365
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +159 -393
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.d.ts +1 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js +8 -40
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.d.ts +19 -37
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +87 -283
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/index.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/index.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.d.ts +2 -19
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +13 -46
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.d.ts +4 -4
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js +23 -35
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +12 -12
- package/node_modules/@bufbuild/protobuf/package.json +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +0 -12
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@earendil-works/pi-agent-core/package.json +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +8 -8
- package/node_modules/@earendil-works/pi-pty/package.json +2 -2
- package/node_modules/@earendil-works/pi-telemetry/package.json +2 -2
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +337 -1560
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +23 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +23 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +13 -17
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +205 -4
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +2 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-encode.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/index.js +1 -5
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +19 -19
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js +4 -6
- package/node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.js +5 -8
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/MapSchema.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/OperationSchema.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/cbor/CborCodec.d.ts +27 -5
- package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/cbor/index.d.ts +1 -5
- package/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/extensions/defaultExtensionConfiguration.d.ts +7 -1
- package/node_modules/@smithy/core/dist-types/submodules/config/config-resolver/regionConfig/checkRegion.d.ts +1 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/util-endpoints/utils/evaluateCondition.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/util-endpoints/utils/evaluateConditions.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/util-endpoints/utils/evaluateExpression.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/util-endpoints/utils/evaluateRules.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/util-endpoints/utils/getEndpointProperties.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/endpoints/util-endpoints/utils/getReferenceValue.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/event-streams/EventStreamSerde.d.ts +2 -14
- package/node_modules/@smithy/core/dist-types/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +2 -7
- package/node_modules/@smithy/core/dist-types/submodules/retry/util-retry/retries-2026-config.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/submodules/serde/parse-utils.d.ts +5 -5
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/CborCodec.d.ts +27 -5
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/index.d.ts +1 -5
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/extensions/defaultExtensionConfiguration.d.ts +7 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/config/config-resolver/regionConfig/checkRegion.d.ts +1 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/util-endpoints/utils/evaluateCondition.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/util-endpoints/utils/evaluateConditions.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/util-endpoints/utils/evaluateExpression.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/util-endpoints/utils/evaluateRules.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/util-endpoints/utils/getEndpointProperties.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/util-endpoints/utils/getReferenceValue.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/event-streams/EventStreamSerde.d.ts +2 -14
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +2 -7
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/retry/util-retry/retries-2026-config.d.ts +2 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/TypeRegistry.d.ts +1 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/parse-utils.d.ts +5 -5
- package/node_modules/@smithy/core/package.json +11 -4
- package/node_modules/@smithy/credential-provider-imds/package.json +12 -4
- package/node_modules/@smithy/fetch-http-handler/package.json +13 -5
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +2 -9
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +2 -9
- package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/package.json +13 -5
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +9 -9
- package/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js +9 -9
- package/node_modules/@smithy/signature-v4/package.json +12 -4
- package/node_modules/@smithy/types/dist-types/schema/sentinels.d.ts +14 -14
- package/node_modules/@smithy/types/package.json +39 -29
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/child_process.d.ts +1 -0
- package/node_modules/@types/node/crypto.d.ts +7 -7
- package/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@types/node/fs.d.ts +0 -7
- package/node_modules/@types/node/http.d.ts +0 -30
- package/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/perf_hooks.d.ts +1 -2
- package/node_modules/@types/node/process.d.ts +43 -42
- package/node_modules/@types/node/quic.d.ts +84 -1049
- package/node_modules/@types/node/sqlite.d.ts +1 -14
- package/node_modules/@types/node/stream/iter.d.ts +2 -3
- package/node_modules/@types/node/test.d.ts +0 -61
- package/node_modules/@types/node/v8.d.ts +23 -20
- package/package.json +36 -36
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -103
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -20
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -51
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +0 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -11
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -27
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -9
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -15
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -39
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/message.d.ts +0 -49
- package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/message.js +0 -157
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/json.d.ts +0 -28
- package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/json.js +0 -44
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/message.d.ts +0 -49
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/message.js +0 -152
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/json.d.ts +0 -28
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/json.js +0 -41
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +0 -113
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +0 -103
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeDeserializer2.js +0 -621
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeSerializer2.js +0 -602
- package/node_modules/@smithy/core/dist-types/submodules/cbor/codec-v1/CborShapeDeserializer.d.ts +0 -13
- package/node_modules/@smithy/core/dist-types/submodules/cbor/codec-v1/CborShapeSerializer.d.ts +0 -15
- package/node_modules/@smithy/core/dist-types/submodules/cbor/codec-v2/CborShapeDeserializer2.d.ts +0 -18
- package/node_modules/@smithy/core/dist-types/submodules/cbor/codec-v2/CborShapeSerializer2.d.ts +0 -35
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/codec-v1/CborShapeDeserializer.d.ts +0 -13
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/codec-v1/CborShapeSerializer.d.ts +0 -15
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/codec-v2/CborShapeDeserializer2.d.ts +0 -18
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/codec-v2/CborShapeSerializer2.d.ts +0 -35
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { nv, NumericValue, calculateBodyLength,
|
|
1
|
+
const { nv, NumericValue, calculateBodyLength, _parseEpochTimestamp, fromBase64, generateIdempotencyToken } = require("@smithy/core/serde");
|
|
2
2
|
const { HttpRequest, collectBody, SerdeContext, RpcProtocol } = require("@smithy/core/protocols");
|
|
3
3
|
const { NormalizedSchema, deref, TypeRegistry } = require("@smithy/core/schema");
|
|
4
4
|
const { getSmithyContext } = require("@smithy/core/transport");
|
|
@@ -29,23 +29,23 @@ function tag(data) {
|
|
|
29
29
|
return data;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const USE_BUFFER$
|
|
33
|
-
const textDecoder
|
|
34
|
-
let payload
|
|
35
|
-
let isBuffer
|
|
36
|
-
let dataView$
|
|
32
|
+
const USE_BUFFER$1 = typeof Buffer !== "undefined";
|
|
33
|
+
const textDecoder = new TextDecoder();
|
|
34
|
+
let payload = alloc(0);
|
|
35
|
+
let isBuffer = false;
|
|
36
|
+
let dataView$1 = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
37
37
|
let _offset = 0;
|
|
38
38
|
function setPayload(bytes) {
|
|
39
|
-
payload
|
|
40
|
-
isBuffer
|
|
41
|
-
dataView$
|
|
39
|
+
payload = bytes;
|
|
40
|
+
isBuffer = USE_BUFFER$1 && payload instanceof Buffer;
|
|
41
|
+
dataView$1 = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
42
42
|
}
|
|
43
43
|
function decode(at, to) {
|
|
44
44
|
if (at >= to) {
|
|
45
45
|
throw new Error("unexpected end of (decode) payload.");
|
|
46
46
|
}
|
|
47
|
-
const major = (payload
|
|
48
|
-
const minor = payload
|
|
47
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
48
|
+
const minor = payload[at] & 0b0001_1111;
|
|
49
49
|
if (minor === minorIndefinite && 2 <= major && major <= 5) {
|
|
50
50
|
return decodeIndefinite(at, to);
|
|
51
51
|
}
|
|
@@ -63,36 +63,36 @@ function decode(at, to) {
|
|
|
63
63
|
switch (minor) {
|
|
64
64
|
case extendedOneByte:
|
|
65
65
|
if (to - at < 2) {
|
|
66
|
-
overflow
|
|
66
|
+
overflow(1);
|
|
67
67
|
}
|
|
68
|
-
unsignedInt = payload
|
|
68
|
+
unsignedInt = payload[at + 1];
|
|
69
69
|
offset = 2;
|
|
70
70
|
break;
|
|
71
71
|
case extendedFloat16:
|
|
72
72
|
if (to - at < 3) {
|
|
73
|
-
overflow
|
|
73
|
+
overflow(2);
|
|
74
74
|
}
|
|
75
|
-
unsignedInt = dataView$
|
|
75
|
+
unsignedInt = dataView$1.getUint16(at + 1);
|
|
76
76
|
offset = 3;
|
|
77
77
|
break;
|
|
78
78
|
case extendedFloat32:
|
|
79
79
|
if (to - at < 5) {
|
|
80
|
-
overflow
|
|
80
|
+
overflow(4);
|
|
81
81
|
}
|
|
82
|
-
unsignedInt = dataView$
|
|
82
|
+
unsignedInt = dataView$1.getUint32(at + 1);
|
|
83
83
|
offset = 5;
|
|
84
84
|
break;
|
|
85
85
|
case extendedFloat64:
|
|
86
86
|
if (to - at < 9) {
|
|
87
|
-
overflow
|
|
87
|
+
overflow(8);
|
|
88
88
|
}
|
|
89
89
|
{
|
|
90
|
-
const hi = dataView$
|
|
90
|
+
const hi = dataView$1.getUint32(at + 1);
|
|
91
91
|
if (hi < 0x00200000) {
|
|
92
|
-
unsignedInt = hi * 4294967296 + dataView$
|
|
92
|
+
unsignedInt = hi * 4294967296 + dataView$1.getUint32(at + 5);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
unsignedInt = dataView$
|
|
95
|
+
unsignedInt = dataView$1.getBigUint64(at + 1);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
offset = 9;
|
|
@@ -103,7 +103,7 @@ function decode(at, to) {
|
|
|
103
103
|
}
|
|
104
104
|
if (major === majorUint64) {
|
|
105
105
|
_offset = offset;
|
|
106
|
-
return castBigInt
|
|
106
|
+
return castBigInt(unsignedInt);
|
|
107
107
|
}
|
|
108
108
|
else if (major === majorNegativeInt64) {
|
|
109
109
|
let negativeInt;
|
|
@@ -114,7 +114,7 @@ function decode(at, to) {
|
|
|
114
114
|
negativeInt = -1 - unsignedInt;
|
|
115
115
|
}
|
|
116
116
|
_offset = offset;
|
|
117
|
-
return castBigInt
|
|
117
|
+
return castBigInt(negativeInt);
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
120
|
return decodeTagValue(at, to, minor, unsignedInt, offset);
|
|
@@ -133,8 +133,8 @@ function decode(at, to) {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
function decodeIndefinite(at, to) {
|
|
136
|
-
const major = (payload
|
|
137
|
-
const minor = payload
|
|
136
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
137
|
+
const minor = payload[at] & 0b0001_1111;
|
|
138
138
|
if (minor === minorIndefinite) {
|
|
139
139
|
switch (major) {
|
|
140
140
|
case majorUtf8String:
|
|
@@ -148,7 +148,7 @@ function decodeIndefinite(at, to) {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
function bytesToFloat16
|
|
151
|
+
function bytesToFloat16(a, b) {
|
|
152
152
|
const sign = a >> 7;
|
|
153
153
|
const exponent = (a & 0b0111_1100) >> 2;
|
|
154
154
|
const fraction = ((a & 0b0000_0011) << 8) | b;
|
|
@@ -168,7 +168,7 @@ function bytesToFloat16$1(a, b) {
|
|
|
168
168
|
return scalar * (Math.pow(2, exponent - 15) * (1 + fraction / 1024));
|
|
169
169
|
}
|
|
170
170
|
function decodeMap(at, to) {
|
|
171
|
-
const mapDataLength = decodeCount
|
|
171
|
+
const mapDataLength = decodeCount(at, to);
|
|
172
172
|
if (mapDataLength < 25) {
|
|
173
173
|
return decodeMapSmall(at, to, mapDataLength);
|
|
174
174
|
}
|
|
@@ -182,7 +182,7 @@ function decodeMapLarge(at, to, mapDataLength) {
|
|
|
182
182
|
for (let i = 0; i < mapDataLength; ++i) {
|
|
183
183
|
const key = decodeUtf8String(at, to);
|
|
184
184
|
at += _offset;
|
|
185
|
-
const valMajor = (payload
|
|
185
|
+
const valMajor = (payload[at] & 0b1110_0000) >> 5;
|
|
186
186
|
if (valMajor === majorUtf8String) {
|
|
187
187
|
map[key] = decodeUtf8String(at, to);
|
|
188
188
|
}
|
|
@@ -210,7 +210,7 @@ function decodeMapSmall(at, to, mapDataLength) {
|
|
|
210
210
|
return map;
|
|
211
211
|
}
|
|
212
212
|
function decodeList(at, to) {
|
|
213
|
-
const listDataLength = decodeCount
|
|
213
|
+
const listDataLength = decodeCount(at, to);
|
|
214
214
|
const offset = _offset;
|
|
215
215
|
at += offset;
|
|
216
216
|
const base = at;
|
|
@@ -223,76 +223,76 @@ function decodeList(at, to) {
|
|
|
223
223
|
return list;
|
|
224
224
|
}
|
|
225
225
|
function decodeUtf8String(at, to) {
|
|
226
|
-
const length = decodeCount
|
|
226
|
+
const length = decodeCount(at, to);
|
|
227
227
|
const offset = _offset;
|
|
228
228
|
at += offset;
|
|
229
229
|
if (to - at < length) {
|
|
230
|
-
overflow
|
|
230
|
+
overflow(length);
|
|
231
231
|
}
|
|
232
232
|
_offset = offset + length;
|
|
233
233
|
if (length < 24) {
|
|
234
234
|
return decodeUtf8StringCached(at, length);
|
|
235
235
|
}
|
|
236
|
-
if (isBuffer
|
|
237
|
-
return payload
|
|
236
|
+
if (isBuffer) {
|
|
237
|
+
return payload.toString("utf-8", at, at + length);
|
|
238
238
|
}
|
|
239
|
-
return textDecoder
|
|
239
|
+
return textDecoder.decode(payload.subarray(at, at + length));
|
|
240
240
|
}
|
|
241
|
-
const stringCache
|
|
242
|
-
const stringCacheEpochs
|
|
243
|
-
let cacheEpoch
|
|
241
|
+
const stringCache = new Array(2048);
|
|
242
|
+
const stringCacheEpochs = new Uint16Array(2048);
|
|
243
|
+
let cacheEpoch = 0;
|
|
244
244
|
function advanceDecodingEpoch() {
|
|
245
|
-
cacheEpoch
|
|
245
|
+
cacheEpoch = (cacheEpoch + 1) & 0b1111_1111_1111_1111;
|
|
246
246
|
}
|
|
247
247
|
function decodeUtf8StringCached(at, length) {
|
|
248
248
|
let h = length;
|
|
249
249
|
for (let i = 0; i < length; ++i) {
|
|
250
|
-
h = (h * 31 + payload
|
|
250
|
+
h = (h * 31 + payload[at + i]) | 0;
|
|
251
251
|
}
|
|
252
252
|
const slot = (h >>> 0) & 2047;
|
|
253
|
-
const cached = stringCache
|
|
253
|
+
const cached = stringCache[slot];
|
|
254
254
|
if (cached !== undefined) {
|
|
255
255
|
if (cached.length === length) {
|
|
256
256
|
let match = true;
|
|
257
257
|
for (let i = 0; i < length; ++i) {
|
|
258
|
-
if (cached.charCodeAt(i) !== payload
|
|
258
|
+
if (cached.charCodeAt(i) !== payload[at + i]) {
|
|
259
259
|
match = false;
|
|
260
260
|
break;
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
if (match) {
|
|
264
|
-
stringCacheEpochs
|
|
264
|
+
stringCacheEpochs[slot] = cacheEpoch;
|
|
265
265
|
return cached;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
const result = isBuffer
|
|
270
|
-
? payload
|
|
271
|
-
: textDecoder
|
|
272
|
-
if (stringCacheEpochs
|
|
273
|
-
stringCache
|
|
274
|
-
stringCacheEpochs
|
|
269
|
+
const result = isBuffer
|
|
270
|
+
? payload.toString("utf-8", at, at + length)
|
|
271
|
+
: textDecoder.decode(payload.subarray(at, at + length));
|
|
272
|
+
if (stringCacheEpochs[slot] !== cacheEpoch) {
|
|
273
|
+
stringCache[slot] = result;
|
|
274
|
+
stringCacheEpochs[slot] = cacheEpoch;
|
|
275
275
|
}
|
|
276
276
|
return result;
|
|
277
277
|
}
|
|
278
278
|
function decodeUnstructuredByteString(at, to) {
|
|
279
|
-
const length = decodeCount
|
|
279
|
+
const length = decodeCount(at, to);
|
|
280
280
|
const offset = _offset;
|
|
281
281
|
at += offset;
|
|
282
282
|
if (to - at < length) {
|
|
283
|
-
overflow
|
|
283
|
+
overflow(length);
|
|
284
284
|
}
|
|
285
|
-
const value = payload
|
|
285
|
+
const value = payload.subarray(at, at + length);
|
|
286
286
|
_offset = offset + length;
|
|
287
287
|
return value;
|
|
288
288
|
}
|
|
289
289
|
function decodeTagValue(at, to, minor, unsignedInt, offset) {
|
|
290
290
|
if (minor === 2 || minor === 3) {
|
|
291
|
-
const length = decodeCount
|
|
291
|
+
const length = decodeCount(at + offset, to);
|
|
292
292
|
let b = BigInt(0);
|
|
293
293
|
const start = at + offset + _offset;
|
|
294
294
|
for (let i = start; i < start + length; ++i) {
|
|
295
|
-
b = (b << BigInt(8)) | BigInt(payload
|
|
295
|
+
b = (b << BigInt(8)) | BigInt(payload[i]);
|
|
296
296
|
}
|
|
297
297
|
_offset = offset + _offset + length;
|
|
298
298
|
return minor === 3 ? -b - BigInt(1) : b;
|
|
@@ -323,11 +323,11 @@ function decodeTagValue(at, to, minor, unsignedInt, offset) {
|
|
|
323
323
|
const value = decode(at + offset, to);
|
|
324
324
|
const valueOffset = _offset;
|
|
325
325
|
_offset = offset + valueOffset;
|
|
326
|
-
return tag({ tag: castBigInt
|
|
326
|
+
return tag({ tag: castBigInt(unsignedInt), value });
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
function decodeSpecial(at, to) {
|
|
330
|
-
const minor = payload
|
|
330
|
+
const minor = payload[at] & 0b0001_1111;
|
|
331
331
|
switch (minor) {
|
|
332
332
|
case specialTrue:
|
|
333
333
|
case specialFalse:
|
|
@@ -344,25 +344,25 @@ function decodeSpecial(at, to) {
|
|
|
344
344
|
throw new Error("incomplete float16 at end of buf.");
|
|
345
345
|
}
|
|
346
346
|
_offset = 3;
|
|
347
|
-
return bytesToFloat16
|
|
347
|
+
return bytesToFloat16(payload[at + 1], payload[at + 2]);
|
|
348
348
|
case extendedFloat32:
|
|
349
349
|
if (to - at < 5) {
|
|
350
350
|
throw new Error("incomplete float32 at end of buf.");
|
|
351
351
|
}
|
|
352
352
|
_offset = 5;
|
|
353
|
-
return dataView$
|
|
353
|
+
return dataView$1.getFloat32(at + 1);
|
|
354
354
|
case extendedFloat64:
|
|
355
355
|
if (to - at < 9) {
|
|
356
356
|
throw new Error("incomplete float64 at end of buf.");
|
|
357
357
|
}
|
|
358
358
|
_offset = 9;
|
|
359
|
-
return dataView$
|
|
359
|
+
return dataView$1.getFloat64(at + 1);
|
|
360
360
|
default:
|
|
361
361
|
unexpectedMinor(minor);
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
function decodeCount
|
|
365
|
-
const minor = payload
|
|
364
|
+
function decodeCount(at, to) {
|
|
365
|
+
const minor = payload[at] & 0b0001_1111;
|
|
366
366
|
if (minor < 24) {
|
|
367
367
|
_offset = 1;
|
|
368
368
|
return minor;
|
|
@@ -370,28 +370,28 @@ function decodeCount$1(at, to) {
|
|
|
370
370
|
switch (minor) {
|
|
371
371
|
case extendedOneByte:
|
|
372
372
|
if (to - at < 2) {
|
|
373
|
-
overflow
|
|
373
|
+
overflow(1);
|
|
374
374
|
}
|
|
375
375
|
_offset = 2;
|
|
376
|
-
return payload
|
|
376
|
+
return payload[at + 1];
|
|
377
377
|
case extendedFloat16:
|
|
378
378
|
if (to - at < 3) {
|
|
379
|
-
overflow
|
|
379
|
+
overflow(2);
|
|
380
380
|
}
|
|
381
381
|
_offset = 3;
|
|
382
|
-
return dataView$
|
|
382
|
+
return dataView$1.getUint16(at + 1);
|
|
383
383
|
case extendedFloat32:
|
|
384
384
|
if (to - at < 5) {
|
|
385
|
-
overflow
|
|
385
|
+
overflow(4);
|
|
386
386
|
}
|
|
387
387
|
_offset = 5;
|
|
388
|
-
return dataView$
|
|
388
|
+
return dataView$1.getUint32(at + 1);
|
|
389
389
|
case extendedFloat64:
|
|
390
390
|
if (to - at < 9) {
|
|
391
|
-
overflow
|
|
391
|
+
overflow(8);
|
|
392
392
|
}
|
|
393
393
|
_offset = 9;
|
|
394
|
-
return demote(dataView$
|
|
394
|
+
return demote(dataView$1.getBigUint64(at + 1));
|
|
395
395
|
default:
|
|
396
396
|
unexpectedMinor(minor);
|
|
397
397
|
}
|
|
@@ -401,7 +401,7 @@ function decodeMapIndefinite(at, to) {
|
|
|
401
401
|
const base = at;
|
|
402
402
|
const map = {};
|
|
403
403
|
for (; at < to;) {
|
|
404
|
-
if (payload
|
|
404
|
+
if (payload[at] === 0b1111_1111) {
|
|
405
405
|
_offset = at - base + 2;
|
|
406
406
|
return map;
|
|
407
407
|
}
|
|
@@ -416,7 +416,7 @@ function decodeListIndefinite(at, to) {
|
|
|
416
416
|
at += 1;
|
|
417
417
|
const list = [];
|
|
418
418
|
for (const base = at; at < to;) {
|
|
419
|
-
if (payload
|
|
419
|
+
if (payload[at] === 0b1111_1111) {
|
|
420
420
|
_offset = at - base + 2;
|
|
421
421
|
return list;
|
|
422
422
|
}
|
|
@@ -429,17 +429,17 @@ function decodeUtf8StringIndefinite(at, to) {
|
|
|
429
429
|
at += 1;
|
|
430
430
|
const vector = [];
|
|
431
431
|
for (const base = at; at < to;) {
|
|
432
|
-
if (payload
|
|
432
|
+
if (payload[at] === 0b1111_1111) {
|
|
433
433
|
const data = alloc(vector.length);
|
|
434
434
|
data.set(vector, 0);
|
|
435
435
|
_offset = at - base + 2;
|
|
436
|
-
if (USE_BUFFER$
|
|
436
|
+
if (USE_BUFFER$1) {
|
|
437
437
|
return data.toString("utf-8", 0, data.length);
|
|
438
438
|
}
|
|
439
|
-
return textDecoder
|
|
439
|
+
return textDecoder.decode(data);
|
|
440
440
|
}
|
|
441
|
-
const major = (payload
|
|
442
|
-
const minor = payload
|
|
441
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
442
|
+
const minor = payload[at] & 0b0001_1111;
|
|
443
443
|
if (major !== majorUtf8String) {
|
|
444
444
|
unexpectedMajorInIndefiniteString(major);
|
|
445
445
|
}
|
|
@@ -459,14 +459,14 @@ function decodeUnstructuredByteStringIndefinite(at, to) {
|
|
|
459
459
|
at += 1;
|
|
460
460
|
const vector = [];
|
|
461
461
|
for (const base = at; at < to;) {
|
|
462
|
-
if (payload
|
|
462
|
+
if (payload[at] === 0b1111_1111) {
|
|
463
463
|
const data = alloc(vector.length);
|
|
464
464
|
data.set(vector, 0);
|
|
465
465
|
_offset = at - base + 2;
|
|
466
466
|
return data;
|
|
467
467
|
}
|
|
468
|
-
const major = (payload
|
|
469
|
-
const minor = payload
|
|
468
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
469
|
+
const minor = payload[at] & 0b0001_1111;
|
|
470
470
|
if (major !== majorUnstructuredByteString) {
|
|
471
471
|
unexpectedMajorInIndefiniteString(major);
|
|
472
472
|
}
|
|
@@ -482,7 +482,7 @@ function decodeUnstructuredByteStringIndefinite(at, to) {
|
|
|
482
482
|
}
|
|
483
483
|
throw new Error("expected break marker.");
|
|
484
484
|
}
|
|
485
|
-
function castBigInt
|
|
485
|
+
function castBigInt(bigInt) {
|
|
486
486
|
if (typeof bigInt === "number") {
|
|
487
487
|
return bigInt;
|
|
488
488
|
}
|
|
@@ -499,7 +499,7 @@ function demote(bigInteger) {
|
|
|
499
499
|
}
|
|
500
500
|
return num;
|
|
501
501
|
}
|
|
502
|
-
function overflow
|
|
502
|
+
function overflow(n) {
|
|
503
503
|
throw new Error(`length ${n} greater than remaining buf len.`);
|
|
504
504
|
}
|
|
505
505
|
function unexpectedMinor(minor) {
|
|
@@ -509,25 +509,25 @@ function unexpectedMajorInIndefiniteString(major) {
|
|
|
509
509
|
throw new Error(`unexpected major type ${major} in indefinite string.`);
|
|
510
510
|
}
|
|
511
511
|
|
|
512
|
-
const USE_BUFFER
|
|
512
|
+
const USE_BUFFER = typeof Buffer !== "undefined";
|
|
513
513
|
const encodeStringCache = new Map();
|
|
514
|
-
let encodeCacheEpoch
|
|
515
|
-
let encodeCacheSaturated
|
|
514
|
+
let encodeCacheEpoch = 0;
|
|
515
|
+
let encodeCacheSaturated = false;
|
|
516
516
|
const initialSize = 2048;
|
|
517
517
|
let data = alloc(initialSize);
|
|
518
|
-
let dataView
|
|
519
|
-
let cursor
|
|
518
|
+
let dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
519
|
+
let cursor = 0;
|
|
520
520
|
function encode(_input) {
|
|
521
521
|
const encodeStack = [_input];
|
|
522
522
|
while (encodeStack.length) {
|
|
523
523
|
const input = encodeStack.pop();
|
|
524
524
|
if (typeof input === "string") {
|
|
525
525
|
const len = input.length;
|
|
526
|
-
if (USE_BUFFER
|
|
526
|
+
if (USE_BUFFER) {
|
|
527
527
|
ensureSpace(len * 3 + 9);
|
|
528
528
|
if (len > 23) {
|
|
529
|
-
encodeHeader
|
|
530
|
-
cursor
|
|
529
|
+
encodeHeader(majorUtf8String, Buffer.byteLength(input));
|
|
530
|
+
cursor += data.write(input, cursor);
|
|
531
531
|
}
|
|
532
532
|
else {
|
|
533
533
|
encodeStringCached(input);
|
|
@@ -536,8 +536,8 @@ function encode(_input) {
|
|
|
536
536
|
else {
|
|
537
537
|
const maxBytes = len * 3;
|
|
538
538
|
ensureSpace(maxBytes + 9);
|
|
539
|
-
const headerPos = cursor
|
|
540
|
-
const result = new TextEncoder().encodeInto(input, data.subarray(cursor
|
|
539
|
+
const headerPos = cursor;
|
|
540
|
+
const result = new TextEncoder().encodeInto(input, data.subarray(cursor + 9));
|
|
541
541
|
const byteLen = result.written;
|
|
542
542
|
let headerSize;
|
|
543
543
|
if (byteLen < 24) {
|
|
@@ -558,50 +558,50 @@ function encode(_input) {
|
|
|
558
558
|
if (headerSize < 9) {
|
|
559
559
|
data.copyWithin(headerPos + headerSize, headerPos + 9, headerPos + 9 + byteLen);
|
|
560
560
|
}
|
|
561
|
-
cursor
|
|
561
|
+
cursor = headerPos;
|
|
562
562
|
encodeInteger(majorUtf8String, byteLen);
|
|
563
|
-
cursor
|
|
563
|
+
cursor += byteLen;
|
|
564
564
|
}
|
|
565
565
|
continue;
|
|
566
566
|
}
|
|
567
|
-
if (data.byteLength - cursor
|
|
567
|
+
if (data.byteLength - cursor < 9) {
|
|
568
568
|
ensureSpace(64);
|
|
569
569
|
}
|
|
570
570
|
if (typeof input === "number") {
|
|
571
|
-
if (Number.isInteger(input)
|
|
571
|
+
if (Number.isInteger(input)) {
|
|
572
572
|
const nonNegative = input >= 0;
|
|
573
573
|
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
574
574
|
const value = nonNegative ? input : -input - 1;
|
|
575
575
|
if (value < 24) {
|
|
576
|
-
data[cursor
|
|
576
|
+
data[cursor++] = (major << 5) | value;
|
|
577
577
|
}
|
|
578
578
|
else if (value < 256) {
|
|
579
|
-
data[cursor
|
|
580
|
-
data[cursor
|
|
579
|
+
data[cursor++] = (major << 5) | 24;
|
|
580
|
+
data[cursor++] = value;
|
|
581
581
|
}
|
|
582
582
|
else if (value < 65536) {
|
|
583
|
-
data[cursor
|
|
584
|
-
data[cursor
|
|
585
|
-
data[cursor
|
|
583
|
+
data[cursor++] = (major << 5) | extendedFloat16;
|
|
584
|
+
data[cursor++] = value >> 8;
|
|
585
|
+
data[cursor++] = value & 0xff;
|
|
586
586
|
}
|
|
587
587
|
else if (value < 4294967296) {
|
|
588
|
-
data[cursor
|
|
589
|
-
dataView
|
|
590
|
-
cursor
|
|
588
|
+
data[cursor++] = (major << 5) | extendedFloat32;
|
|
589
|
+
dataView.setUint32(cursor, value);
|
|
590
|
+
cursor += 4;
|
|
591
591
|
}
|
|
592
592
|
else {
|
|
593
|
-
data[cursor
|
|
593
|
+
data[cursor++] = (major << 5) | extendedFloat64;
|
|
594
594
|
const hi = (value / 4294967296) | 0;
|
|
595
595
|
const lo = (value - hi * 4294967296) | 0;
|
|
596
|
-
dataView
|
|
597
|
-
dataView
|
|
598
|
-
cursor
|
|
596
|
+
dataView.setUint32(cursor, hi);
|
|
597
|
+
dataView.setUint32(cursor + 4, lo);
|
|
598
|
+
cursor += 8;
|
|
599
599
|
}
|
|
600
600
|
continue;
|
|
601
601
|
}
|
|
602
|
-
data[cursor
|
|
603
|
-
dataView
|
|
604
|
-
cursor
|
|
602
|
+
data[cursor++] = (majorSpecial << 5) | extendedFloat64;
|
|
603
|
+
dataView.setFloat64(cursor, input);
|
|
604
|
+
cursor += 8;
|
|
605
605
|
continue;
|
|
606
606
|
}
|
|
607
607
|
else if (typeof input === "bigint") {
|
|
@@ -614,9 +614,9 @@ function encode(_input) {
|
|
|
614
614
|
encodeInteger(major, n);
|
|
615
615
|
}
|
|
616
616
|
else {
|
|
617
|
-
data[cursor
|
|
618
|
-
dataView
|
|
619
|
-
cursor
|
|
617
|
+
data[cursor++] = (major << 5) | extendedFloat64;
|
|
618
|
+
dataView.setBigUint64(cursor, value);
|
|
619
|
+
cursor += 8;
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
else {
|
|
@@ -629,19 +629,19 @@ function encode(_input) {
|
|
|
629
629
|
b >>= BigInt(8);
|
|
630
630
|
}
|
|
631
631
|
ensureSpace(bigIntBytes.byteLength * 2 + 16);
|
|
632
|
-
data[cursor
|
|
633
|
-
encodeHeader
|
|
634
|
-
data.set(bigIntBytes, cursor
|
|
635
|
-
cursor
|
|
632
|
+
data[cursor++] = nonNegative ? 0b110_00010 : 0b110_00011;
|
|
633
|
+
encodeHeader(majorUnstructuredByteString, bigIntBytes.byteLength);
|
|
634
|
+
data.set(bigIntBytes, cursor);
|
|
635
|
+
cursor += bigIntBytes.byteLength;
|
|
636
636
|
}
|
|
637
637
|
continue;
|
|
638
638
|
}
|
|
639
639
|
else if (input === null) {
|
|
640
|
-
data[cursor
|
|
640
|
+
data[cursor++] = (majorSpecial << 5) | specialNull;
|
|
641
641
|
continue;
|
|
642
642
|
}
|
|
643
643
|
else if (typeof input === "boolean") {
|
|
644
|
-
data[cursor
|
|
644
|
+
data[cursor++] = (majorSpecial << 5) | (input ? specialTrue : specialFalse);
|
|
645
645
|
continue;
|
|
646
646
|
}
|
|
647
647
|
else if (typeof input === "undefined") {
|
|
@@ -658,8 +658,8 @@ function encode(_input) {
|
|
|
658
658
|
else if (typeof input.byteLength === "number") {
|
|
659
659
|
ensureSpace(input.length * 2 + 9);
|
|
660
660
|
encodeInteger(majorUnstructuredByteString, input.length);
|
|
661
|
-
data.set(input, cursor
|
|
662
|
-
cursor
|
|
661
|
+
data.set(input, cursor);
|
|
662
|
+
cursor += input.byteLength;
|
|
663
663
|
continue;
|
|
664
664
|
}
|
|
665
665
|
else if (typeof input === "object") {
|
|
@@ -667,7 +667,7 @@ function encode(_input) {
|
|
|
667
667
|
const decimalIndex = input.string.indexOf(".");
|
|
668
668
|
const exponent = decimalIndex === -1 ? 0 : decimalIndex - input.string.length + 1;
|
|
669
669
|
const mantissa = BigInt(input.string.replace(".", ""));
|
|
670
|
-
data[cursor
|
|
670
|
+
data[cursor++] = 0b110_00100;
|
|
671
671
|
encodeInteger(majorList, 2);
|
|
672
672
|
encodeStack.push(mantissa);
|
|
673
673
|
encodeStack.push(exponent);
|
|
@@ -676,7 +676,7 @@ function encode(_input) {
|
|
|
676
676
|
if (input[tagSymbol]) {
|
|
677
677
|
if ("tag" in input && "value" in input) {
|
|
678
678
|
encodeStack.push(input.value);
|
|
679
|
-
encodeHeader
|
|
679
|
+
encodeHeader(majorTag, input.tag);
|
|
680
680
|
continue;
|
|
681
681
|
}
|
|
682
682
|
else {
|
|
@@ -696,13 +696,13 @@ function encode(_input) {
|
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
function advanceEncodingEpoch() {
|
|
699
|
-
encodeCacheEpoch
|
|
700
|
-
encodeCacheSaturated
|
|
699
|
+
encodeCacheEpoch = (encodeCacheEpoch + 1) & 0b1111_1111_1111_1111;
|
|
700
|
+
encodeCacheSaturated = false;
|
|
701
701
|
}
|
|
702
702
|
function toUint8Array() {
|
|
703
|
-
const out = alloc(cursor
|
|
704
|
-
out.set(data.subarray(0, cursor
|
|
705
|
-
cursor
|
|
703
|
+
const out = alloc(cursor);
|
|
704
|
+
out.set(data.subarray(0, cursor), 0);
|
|
705
|
+
cursor = 0;
|
|
706
706
|
return out;
|
|
707
707
|
}
|
|
708
708
|
function resize(size) {
|
|
@@ -716,23 +716,23 @@ function resize(size) {
|
|
|
716
716
|
data.set(old, 0);
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
|
-
dataView
|
|
719
|
+
dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
720
720
|
}
|
|
721
721
|
function encodeStringCached(input) {
|
|
722
722
|
const cached = encodeStringCache.get(input);
|
|
723
723
|
if (cached !== undefined) {
|
|
724
|
-
data.set(cached.bytes, cursor
|
|
725
|
-
cursor
|
|
726
|
-
cached.epoch = encodeCacheEpoch
|
|
724
|
+
data.set(cached.bytes, cursor);
|
|
725
|
+
cursor += cached.bytes.length;
|
|
726
|
+
cached.epoch = encodeCacheEpoch;
|
|
727
727
|
return;
|
|
728
728
|
}
|
|
729
|
-
const start = cursor
|
|
729
|
+
const start = cursor;
|
|
730
730
|
const byteLen = Buffer.byteLength(input);
|
|
731
731
|
encodeInteger(majorUtf8String, byteLen);
|
|
732
|
-
cursor
|
|
733
|
-
const bytes = Uint8Array.prototype.slice.call(data, start, cursor
|
|
732
|
+
cursor += data.write(input, cursor);
|
|
733
|
+
const bytes = Uint8Array.prototype.slice.call(data, start, cursor);
|
|
734
734
|
if (encodeStringCache.size >= 2048) {
|
|
735
|
-
if (encodeCacheSaturated
|
|
735
|
+
if (encodeCacheSaturated) {
|
|
736
736
|
return;
|
|
737
737
|
}
|
|
738
738
|
let evicted = 0;
|
|
@@ -740,24 +740,24 @@ function encodeStringCached(input) {
|
|
|
740
740
|
if (evicted >= 1024) {
|
|
741
741
|
break;
|
|
742
742
|
}
|
|
743
|
-
if (entry.epoch !== encodeCacheEpoch
|
|
743
|
+
if (entry.epoch !== encodeCacheEpoch) {
|
|
744
744
|
encodeStringCache.delete(key);
|
|
745
745
|
evicted++;
|
|
746
746
|
}
|
|
747
747
|
}
|
|
748
748
|
if (evicted === 0) {
|
|
749
|
-
encodeCacheSaturated
|
|
749
|
+
encodeCacheSaturated = true;
|
|
750
750
|
return;
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
753
|
if (encodeStringCache.size < 2048) {
|
|
754
|
-
encodeStringCache.set(input, { epoch: encodeCacheEpoch
|
|
754
|
+
encodeStringCache.set(input, { epoch: encodeCacheEpoch, bytes });
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
757
|
function ensureSpace(bytes) {
|
|
758
|
-
const remaining = data.byteLength - cursor
|
|
758
|
+
const remaining = data.byteLength - cursor;
|
|
759
759
|
if (remaining < bytes) {
|
|
760
|
-
if (cursor
|
|
760
|
+
if (cursor < 16_000_000) {
|
|
761
761
|
resize(Math.max(data.byteLength * 4, data.byteLength + bytes));
|
|
762
762
|
}
|
|
763
763
|
else {
|
|
@@ -765,55 +765,55 @@ function ensureSpace(bytes) {
|
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
|
-
function encodeHeader
|
|
768
|
+
function encodeHeader(major, value) {
|
|
769
769
|
if (value < 24) {
|
|
770
|
-
data[cursor
|
|
770
|
+
data[cursor++] = (major << 5) | value;
|
|
771
771
|
}
|
|
772
772
|
else if (value < 256) {
|
|
773
|
-
data[cursor
|
|
774
|
-
data[cursor
|
|
773
|
+
data[cursor++] = (major << 5) | 24;
|
|
774
|
+
data[cursor++] = value;
|
|
775
775
|
}
|
|
776
776
|
else if (value < 65536) {
|
|
777
|
-
data[cursor
|
|
778
|
-
dataView
|
|
779
|
-
cursor
|
|
777
|
+
data[cursor++] = (major << 5) | extendedFloat16;
|
|
778
|
+
dataView.setUint16(cursor, value);
|
|
779
|
+
cursor += 2;
|
|
780
780
|
}
|
|
781
781
|
else if (value < 4294967296) {
|
|
782
|
-
data[cursor
|
|
783
|
-
dataView
|
|
784
|
-
cursor
|
|
782
|
+
data[cursor++] = (major << 5) | extendedFloat32;
|
|
783
|
+
dataView.setUint32(cursor, value);
|
|
784
|
+
cursor += 4;
|
|
785
785
|
}
|
|
786
786
|
else {
|
|
787
|
-
data[cursor
|
|
788
|
-
dataView
|
|
789
|
-
cursor
|
|
787
|
+
data[cursor++] = (major << 5) | extendedFloat64;
|
|
788
|
+
dataView.setBigUint64(cursor, typeof value === "bigint" ? value : BigInt(value));
|
|
789
|
+
cursor += 8;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
792
|
function encodeInteger(major, value) {
|
|
793
793
|
if (value < 24) {
|
|
794
|
-
data[cursor
|
|
794
|
+
data[cursor++] = (major << 5) | value;
|
|
795
795
|
}
|
|
796
796
|
else if (value < 256) {
|
|
797
|
-
data[cursor
|
|
798
|
-
data[cursor
|
|
797
|
+
data[cursor++] = (major << 5) | 24;
|
|
798
|
+
data[cursor++] = value;
|
|
799
799
|
}
|
|
800
800
|
else if (value < 65536) {
|
|
801
|
-
data[cursor
|
|
802
|
-
data[cursor
|
|
803
|
-
data[cursor
|
|
801
|
+
data[cursor++] = (major << 5) | extendedFloat16;
|
|
802
|
+
data[cursor++] = value >> 8;
|
|
803
|
+
data[cursor++] = value & 0xff;
|
|
804
804
|
}
|
|
805
805
|
else if (value < 4294967296) {
|
|
806
|
-
data[cursor
|
|
807
|
-
dataView
|
|
808
|
-
cursor
|
|
806
|
+
data[cursor++] = (major << 5) | extendedFloat32;
|
|
807
|
+
dataView.setUint32(cursor, value);
|
|
808
|
+
cursor += 4;
|
|
809
809
|
}
|
|
810
810
|
else {
|
|
811
|
-
data[cursor
|
|
811
|
+
data[cursor++] = (major << 5) | extendedFloat64;
|
|
812
812
|
const hi = (value / 4294967296) | 0;
|
|
813
813
|
const lo = (value - hi * 4294967296) | 0;
|
|
814
|
-
dataView
|
|
815
|
-
dataView
|
|
816
|
-
cursor
|
|
814
|
+
dataView.setUint32(cursor, hi);
|
|
815
|
+
dataView.setUint32(cursor + 4, lo);
|
|
816
|
+
cursor += 8;
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
|
|
@@ -933,1229 +933,216 @@ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, bod
|
|
|
933
933
|
return new HttpRequest(contents);
|
|
934
934
|
};
|
|
935
935
|
|
|
936
|
-
class
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
936
|
+
class CborCodec extends SerdeContext {
|
|
937
|
+
createSerializer() {
|
|
938
|
+
const serializer = new CborShapeSerializer();
|
|
939
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
940
|
+
return serializer;
|
|
941
941
|
}
|
|
942
|
-
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
947
|
-
return result;
|
|
942
|
+
createDeserializer() {
|
|
943
|
+
const deserializer = new CborShapeDeserializer();
|
|
944
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
945
|
+
return deserializer;
|
|
948
946
|
}
|
|
949
947
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
if (existing) {
|
|
955
|
-
return existing;
|
|
956
|
-
}
|
|
957
|
-
const memberNames = [];
|
|
958
|
-
const memberSchemas = [];
|
|
959
|
-
for (const [name, memberSchema] of ns.structIterator()) {
|
|
960
|
-
memberNames.push(name);
|
|
961
|
-
memberSchemas.push(memberSchema);
|
|
962
|
-
}
|
|
963
|
-
const encodedKeys = new Array(memberNames.length);
|
|
964
|
-
for (let i = 0; i < memberNames.length; ++i) {
|
|
965
|
-
encodedKeys[i] = encodeCborStringKey(memberNames[i]);
|
|
966
|
-
}
|
|
967
|
-
const cache = { memberNames, memberSchemas, encodedKeys };
|
|
968
|
-
schema[CBOR_STRUCT_CACHE] = cache;
|
|
969
|
-
return cache;
|
|
970
|
-
}
|
|
971
|
-
function encodeCborStringKey(s) {
|
|
972
|
-
let utf8Bytes;
|
|
973
|
-
if (USE_BUFFER$1) {
|
|
974
|
-
utf8Bytes = Buffer.from(s, "utf-8");
|
|
975
|
-
}
|
|
976
|
-
else {
|
|
977
|
-
utf8Bytes = new TextEncoder().encode(s);
|
|
978
|
-
}
|
|
979
|
-
const byteLen = utf8Bytes.length;
|
|
980
|
-
let headerSize;
|
|
981
|
-
if (byteLen < 24) {
|
|
982
|
-
headerSize = 1;
|
|
983
|
-
}
|
|
984
|
-
else if (byteLen < 256) {
|
|
985
|
-
headerSize = 2;
|
|
986
|
-
}
|
|
987
|
-
else {
|
|
988
|
-
headerSize = 3;
|
|
989
|
-
}
|
|
990
|
-
const result = new Uint8Array(headerSize + byteLen);
|
|
991
|
-
if (headerSize === 1) {
|
|
992
|
-
result[0] = (majorUtf8String << 5) | byteLen;
|
|
993
|
-
}
|
|
994
|
-
else if (headerSize === 2) {
|
|
995
|
-
result[0] = (majorUtf8String << 5) | 24;
|
|
996
|
-
result[1] = byteLen;
|
|
997
|
-
}
|
|
998
|
-
else {
|
|
999
|
-
result[0] = (majorUtf8String << 5) | extendedFloat16;
|
|
1000
|
-
result[1] = byteLen >> 8;
|
|
1001
|
-
result[2] = byteLen & 0xff;
|
|
948
|
+
class CborShapeSerializer extends SerdeContext {
|
|
949
|
+
value;
|
|
950
|
+
write(schema, value) {
|
|
951
|
+
this.value = this.serialize(schema, value);
|
|
1002
952
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
let view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
1011
|
-
let cursor = 0;
|
|
1012
|
-
const STRING_CACHE_MAX = 2048;
|
|
1013
|
-
const stringEncodeCache = new Map();
|
|
1014
|
-
let encodeCacheEpoch = 0;
|
|
1015
|
-
let encodeCacheSaturated = false;
|
|
1016
|
-
function allocUnsafe(size) {
|
|
1017
|
-
return USE_BUFFER$1 ? Buffer.allocUnsafe(size) : new Uint8Array(size);
|
|
1018
|
-
}
|
|
1019
|
-
function writeValue(ns, value, container, serdeContext) {
|
|
1020
|
-
if (value == null) {
|
|
1021
|
-
if (value === undefined && ns.isIdempotencyToken()) {
|
|
1022
|
-
writeString(generateIdempotencyToken());
|
|
1023
|
-
return;
|
|
953
|
+
serialize(schema, source) {
|
|
954
|
+
const ns = NormalizedSchema.of(schema);
|
|
955
|
+
if (source == null) {
|
|
956
|
+
if (ns.isIdempotencyToken()) {
|
|
957
|
+
return generateIdempotencyToken();
|
|
958
|
+
}
|
|
959
|
+
return source;
|
|
1024
960
|
}
|
|
1025
|
-
ensure(1);
|
|
1026
|
-
buf[cursor++] = (majorSpecial << 5) | specialNull;
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
if (ns.isUnitSchema()) {
|
|
1030
|
-
ensure(1);
|
|
1031
|
-
encodeHeader(majorMap, 0);
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
const isObject = typeof value === "object";
|
|
1035
|
-
if (isObject) {
|
|
1036
961
|
if (ns.isBlobSchema()) {
|
|
1037
|
-
if (
|
|
1038
|
-
|
|
1039
|
-
return;
|
|
962
|
+
if (typeof source === "string") {
|
|
963
|
+
return (this.serdeContext?.base64Decoder ?? fromBase64)(source);
|
|
1040
964
|
}
|
|
965
|
+
return source;
|
|
1041
966
|
}
|
|
1042
967
|
if (ns.isTimestampSchema()) {
|
|
1043
|
-
if (
|
|
1044
|
-
|
|
1045
|
-
return;
|
|
968
|
+
if (typeof source === "number" || typeof source === "bigint") {
|
|
969
|
+
return dateToTag(new Date((Number(source) / 1000) | 0));
|
|
1046
970
|
}
|
|
971
|
+
return dateToTag(source);
|
|
1047
972
|
}
|
|
1048
|
-
if (
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
writeTimestamp(value);
|
|
1062
|
-
return;
|
|
1063
|
-
}
|
|
1064
|
-
if (value instanceof Uint8Array) {
|
|
1065
|
-
writeBytes(value);
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
if (value instanceof NumericValue) {
|
|
1069
|
-
writeNumericValue(value);
|
|
1070
|
-
return;
|
|
1071
|
-
}
|
|
1072
|
-
if (value[tagSymbol]) {
|
|
1073
|
-
const tagged = value;
|
|
1074
|
-
writeTag(tagged.tag, tagged.value);
|
|
1075
|
-
return;
|
|
1076
|
-
}
|
|
1077
|
-
if (ns.isDocumentSchema()) {
|
|
1078
|
-
if (Array.isArray(value)) {
|
|
1079
|
-
writeList(ns, value, true, serdeContext);
|
|
973
|
+
if (typeof source === "function" || typeof source === "object") {
|
|
974
|
+
const sourceObject = source;
|
|
975
|
+
if (ns.isListSchema() && Array.isArray(sourceObject)) {
|
|
976
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
977
|
+
const newArray = [];
|
|
978
|
+
let i = 0;
|
|
979
|
+
for (const item of sourceObject) {
|
|
980
|
+
const value = this.serialize(ns.getValueSchema(), item);
|
|
981
|
+
if (value != null || sparse) {
|
|
982
|
+
newArray[i++] = value;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
return newArray;
|
|
1080
986
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
987
|
+
if (sourceObject instanceof Date) {
|
|
988
|
+
return dateToTag(sourceObject);
|
|
1083
989
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
if (typeof value === "string") {
|
|
1094
|
-
if (ns.isBlobSchema()) {
|
|
1095
|
-
const bytes = (serdeContext?.base64Decoder ?? fromBase64)(value);
|
|
1096
|
-
writeBytes(bytes);
|
|
1097
|
-
return;
|
|
1098
|
-
}
|
|
1099
|
-
writeString(value);
|
|
1100
|
-
return;
|
|
1101
|
-
}
|
|
1102
|
-
if (typeof value === "number") {
|
|
1103
|
-
ensure(9);
|
|
1104
|
-
if (Number.isInteger(value) && value >= -9007199254740992 && value <= 0x1fffffffffffff) {
|
|
1105
|
-
writeInteger(value);
|
|
1106
|
-
}
|
|
1107
|
-
else {
|
|
1108
|
-
writeFloat64(value);
|
|
1109
|
-
}
|
|
1110
|
-
return;
|
|
1111
|
-
}
|
|
1112
|
-
if (typeof value === "boolean") {
|
|
1113
|
-
ensure(1);
|
|
1114
|
-
buf[cursor++] = (majorSpecial << 5) | (value ? specialTrue : specialFalse);
|
|
1115
|
-
return;
|
|
1116
|
-
}
|
|
1117
|
-
if (typeof value === "bigint") {
|
|
1118
|
-
writeBigInt(value);
|
|
1119
|
-
return;
|
|
1120
|
-
}
|
|
1121
|
-
writeString(String(value));
|
|
1122
|
-
}
|
|
1123
|
-
function writeStruct(ns, value, serdeContext) {
|
|
1124
|
-
if (ns.isUnionSchema()) {
|
|
1125
|
-
let wrote = false;
|
|
1126
|
-
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
1127
|
-
const item = value[memberName];
|
|
1128
|
-
if (item != null) {
|
|
1129
|
-
ensure(9);
|
|
1130
|
-
encodeHeader(majorMap, 1);
|
|
1131
|
-
writeString(memberName);
|
|
1132
|
-
writeValue(memberSchema, item, ns, serdeContext);
|
|
1133
|
-
wrote = true;
|
|
1134
|
-
break;
|
|
990
|
+
const newObject = {};
|
|
991
|
+
if (ns.isMapSchema()) {
|
|
992
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
993
|
+
for (const key in sourceObject) {
|
|
994
|
+
const value = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
995
|
+
if (value != null || sparse) {
|
|
996
|
+
newObject[key] = value;
|
|
997
|
+
}
|
|
998
|
+
}
|
|
1135
999
|
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1000
|
+
else if (ns.isStructSchema()) {
|
|
1001
|
+
for (const [key, memberSchema] of ns.structIterator()) {
|
|
1002
|
+
const value = this.serialize(memberSchema, sourceObject[key]);
|
|
1003
|
+
if (value != null) {
|
|
1004
|
+
newObject[key] = value;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
const isUnion = ns.isUnionSchema();
|
|
1008
|
+
if (isUnion && Array.isArray(sourceObject.$unknown)) {
|
|
1009
|
+
const [k, v] = sourceObject.$unknown;
|
|
1010
|
+
newObject[k] = v;
|
|
1011
|
+
}
|
|
1012
|
+
else if (typeof sourceObject.__type === "string") {
|
|
1013
|
+
for (const k in sourceObject) {
|
|
1014
|
+
if (!(k in newObject)) {
|
|
1015
|
+
newObject[k] = this.serialize(15, sourceObject[k]);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1144
1019
|
}
|
|
1145
|
-
else {
|
|
1146
|
-
|
|
1147
|
-
|
|
1020
|
+
else if (ns.isDocumentSchema()) {
|
|
1021
|
+
for (const key in sourceObject) {
|
|
1022
|
+
newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
1023
|
+
}
|
|
1148
1024
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
}
|
|
1152
|
-
const cache = loadCborStructIterator(ns);
|
|
1153
|
-
const { memberNames, memberSchemas, encodedKeys } = cache;
|
|
1154
|
-
const z = memberNames.length;
|
|
1155
|
-
let headerSize;
|
|
1156
|
-
if (z < 24) {
|
|
1157
|
-
headerSize = 1;
|
|
1158
|
-
}
|
|
1159
|
-
else if (z < 256) {
|
|
1160
|
-
headerSize = 2;
|
|
1161
|
-
}
|
|
1162
|
-
else {
|
|
1163
|
-
headerSize = 3;
|
|
1164
|
-
}
|
|
1165
|
-
ensure(headerSize);
|
|
1166
|
-
const headerPos = cursor;
|
|
1167
|
-
cursor += headerSize;
|
|
1168
|
-
let count = 0;
|
|
1169
|
-
for (let i = 0; i < z; ++i) {
|
|
1170
|
-
const item = value[memberNames[i]];
|
|
1171
|
-
if (item == null && !memberSchemas[i].isIdempotencyToken()) {
|
|
1172
|
-
continue;
|
|
1173
|
-
}
|
|
1174
|
-
const key = encodedKeys[i];
|
|
1175
|
-
ensure(key.length);
|
|
1176
|
-
buf.set(key, cursor);
|
|
1177
|
-
cursor += key.length;
|
|
1178
|
-
writeValue(memberSchemas[i], item, ns, serdeContext);
|
|
1179
|
-
++count;
|
|
1180
|
-
}
|
|
1181
|
-
if (typeof value.__type === "string") {
|
|
1182
|
-
for (const k in value) {
|
|
1183
|
-
if (!memberNames.includes(k)) {
|
|
1184
|
-
writeString(k);
|
|
1185
|
-
writeUntypedValue(value[k]);
|
|
1186
|
-
++count;
|
|
1025
|
+
else if (ns.isBigDecimalSchema()) {
|
|
1026
|
+
return sourceObject;
|
|
1187
1027
|
}
|
|
1028
|
+
return newObject;
|
|
1188
1029
|
}
|
|
1030
|
+
return source;
|
|
1189
1031
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
buf[headerPos] = (majorMap << 5) | 24;
|
|
1195
|
-
buf[headerPos + 1] = count;
|
|
1196
|
-
}
|
|
1197
|
-
else {
|
|
1198
|
-
buf[headerPos] = (majorMap << 5) | extendedFloat16;
|
|
1199
|
-
buf[headerPos + 1] = count >> 8;
|
|
1200
|
-
buf[headerPos + 2] = count & 0xff;
|
|
1032
|
+
flush() {
|
|
1033
|
+
const buffer = cbor.serialize(this.value);
|
|
1034
|
+
this.value = undefined;
|
|
1035
|
+
return buffer;
|
|
1201
1036
|
}
|
|
1202
1037
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
}
|
|
1038
|
+
class CborShapeDeserializer extends SerdeContext {
|
|
1039
|
+
read(schema, bytes) {
|
|
1040
|
+
const data = cbor.deserialize(bytes);
|
|
1041
|
+
return this.readValue(schema, data);
|
|
1042
|
+
}
|
|
1043
|
+
readValue(_schema, value) {
|
|
1044
|
+
const ns = NormalizedSchema.of(_schema);
|
|
1045
|
+
if (ns.isTimestampSchema()) {
|
|
1046
|
+
if (typeof value === "number") {
|
|
1047
|
+
return _parseEpochTimestamp(value);
|
|
1214
1048
|
}
|
|
1215
|
-
|
|
1216
|
-
if (
|
|
1217
|
-
|
|
1049
|
+
if (typeof value === "object") {
|
|
1050
|
+
if (value.tag === 1 && "value" in value) {
|
|
1051
|
+
return _parseEpochTimestamp(value.value);
|
|
1218
1052
|
}
|
|
1219
1053
|
}
|
|
1220
1054
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
writeValue(valueSchema, items[i], undefined, serdeContext);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
else {
|
|
1228
|
-
let count = 0;
|
|
1229
|
-
for (let i = 0; i < value.length; ++i) {
|
|
1230
|
-
if (value[i] != null) {
|
|
1231
|
-
++count;
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
ensure(9);
|
|
1235
|
-
encodeHeader(majorList, count);
|
|
1236
|
-
for (let i = 0; i < value.length; ++i) {
|
|
1237
|
-
if (value[i] != null) {
|
|
1238
|
-
writeValue(valueSchema, value[i], undefined, serdeContext);
|
|
1055
|
+
if (ns.isBlobSchema()) {
|
|
1056
|
+
if (typeof value === "string") {
|
|
1057
|
+
return (this.serdeContext?.base64Decoder ?? fromBase64)(value);
|
|
1239
1058
|
}
|
|
1059
|
+
return value;
|
|
1240
1060
|
}
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
const v = value[k];
|
|
1249
|
-
if (isDocument ? v !== undefined : v != null || sparse) {
|
|
1250
|
-
keys.push(k);
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
ensure(9);
|
|
1254
|
-
encodeHeader(majorMap, keys.length);
|
|
1255
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
1256
|
-
const k = keys[i];
|
|
1257
|
-
writeString(k);
|
|
1258
|
-
writeValue(valueSchema, value[k], undefined, serdeContext);
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
function writeUntypedValue(value) {
|
|
1262
|
-
if (value == null) {
|
|
1263
|
-
ensure(1);
|
|
1264
|
-
buf[cursor++] = (majorSpecial << 5) | specialNull;
|
|
1265
|
-
return;
|
|
1266
|
-
}
|
|
1267
|
-
if (typeof value === "string") {
|
|
1268
|
-
writeString(value);
|
|
1269
|
-
return;
|
|
1270
|
-
}
|
|
1271
|
-
if (typeof value === "number") {
|
|
1272
|
-
ensure(9);
|
|
1273
|
-
if (Number.isInteger(value) && value >= -9007199254740992 && value <= 0x1fffffffffffff) {
|
|
1274
|
-
writeInteger(value);
|
|
1275
|
-
}
|
|
1276
|
-
else {
|
|
1277
|
-
writeFloat64(value);
|
|
1278
|
-
}
|
|
1279
|
-
return;
|
|
1280
|
-
}
|
|
1281
|
-
if (typeof value === "boolean") {
|
|
1282
|
-
ensure(1);
|
|
1283
|
-
buf[cursor++] = (majorSpecial << 5) | (value ? specialTrue : specialFalse);
|
|
1284
|
-
return;
|
|
1285
|
-
}
|
|
1286
|
-
if (typeof value === "bigint") {
|
|
1287
|
-
writeBigInt(value);
|
|
1288
|
-
return;
|
|
1289
|
-
}
|
|
1290
|
-
if (value instanceof Uint8Array) {
|
|
1291
|
-
writeBytes(value);
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
|
-
if (value instanceof Date) {
|
|
1295
|
-
writeTimestamp(value);
|
|
1296
|
-
return;
|
|
1297
|
-
}
|
|
1298
|
-
if (value instanceof NumericValue) {
|
|
1299
|
-
writeNumericValue(value);
|
|
1300
|
-
return;
|
|
1301
|
-
}
|
|
1302
|
-
if (value[tagSymbol]) {
|
|
1303
|
-
const tagged = value;
|
|
1304
|
-
writeTag(tagged.tag, tagged.value);
|
|
1305
|
-
return;
|
|
1306
|
-
}
|
|
1307
|
-
if (Array.isArray(value)) {
|
|
1308
|
-
ensure(9);
|
|
1309
|
-
encodeHeader(majorList, value.length);
|
|
1310
|
-
for (let i = 0; i < value.length; ++i) {
|
|
1311
|
-
writeUntypedValue(value[i]);
|
|
1312
|
-
}
|
|
1313
|
-
return;
|
|
1314
|
-
}
|
|
1315
|
-
if (typeof value === "object") {
|
|
1316
|
-
const keys = Object.keys(value);
|
|
1317
|
-
ensure(9);
|
|
1318
|
-
encodeHeader(majorMap, keys.length);
|
|
1319
|
-
for (let i = 0; i < keys.length; ++i) {
|
|
1320
|
-
writeString(keys[i]);
|
|
1321
|
-
writeUntypedValue(value[keys[i]]);
|
|
1322
|
-
}
|
|
1323
|
-
return;
|
|
1324
|
-
}
|
|
1325
|
-
writeString(String(value));
|
|
1326
|
-
}
|
|
1327
|
-
function ensure(n) {
|
|
1328
|
-
if (cursor + n > buf.length) {
|
|
1329
|
-
let newSize = buf.length * 2;
|
|
1330
|
-
while (newSize < cursor + n) {
|
|
1331
|
-
newSize *= 2;
|
|
1061
|
+
if (typeof value === "undefined" ||
|
|
1062
|
+
typeof value === "boolean" ||
|
|
1063
|
+
typeof value === "number" ||
|
|
1064
|
+
typeof value === "string" ||
|
|
1065
|
+
typeof value === "bigint" ||
|
|
1066
|
+
typeof value === "symbol") {
|
|
1067
|
+
return value;
|
|
1332
1068
|
}
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
view = new DataView(next.buffer, next.byteOffset, next.byteLength);
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
function encodeHeader(major, value) {
|
|
1340
|
-
if (value < 24) {
|
|
1341
|
-
buf[cursor++] = (major << 5) | value;
|
|
1342
|
-
}
|
|
1343
|
-
else if (value < 256) {
|
|
1344
|
-
buf[cursor++] = (major << 5) | 24;
|
|
1345
|
-
buf[cursor++] = value;
|
|
1346
|
-
}
|
|
1347
|
-
else if (value < 65536) {
|
|
1348
|
-
buf[cursor++] = (major << 5) | extendedFloat16;
|
|
1349
|
-
buf[cursor++] = value >> 8;
|
|
1350
|
-
buf[cursor++] = value & 0xff;
|
|
1351
|
-
}
|
|
1352
|
-
else if (value < 4294967296) {
|
|
1353
|
-
buf[cursor++] = (major << 5) | extendedFloat32;
|
|
1354
|
-
view.setUint32(cursor, value);
|
|
1355
|
-
cursor += 4;
|
|
1356
|
-
}
|
|
1357
|
-
else {
|
|
1358
|
-
buf[cursor++] = (major << 5) | extendedFloat64;
|
|
1359
|
-
const hi = (value / 4294967296) | 0;
|
|
1360
|
-
const lo = (value - hi * 4294967296) | 0;
|
|
1361
|
-
view.setUint32(cursor, hi);
|
|
1362
|
-
view.setUint32(cursor + 4, lo);
|
|
1363
|
-
cursor += 8;
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
function encodeBigHeader(major, value) {
|
|
1367
|
-
const n = Number(value);
|
|
1368
|
-
if (n < 4294967296) {
|
|
1369
|
-
encodeHeader(major, n);
|
|
1370
|
-
return;
|
|
1371
|
-
}
|
|
1372
|
-
buf[cursor++] = (major << 5) | extendedFloat64;
|
|
1373
|
-
view.setBigUint64(cursor, value);
|
|
1374
|
-
cursor += 8;
|
|
1375
|
-
}
|
|
1376
|
-
function writeString(s) {
|
|
1377
|
-
const len = s.length;
|
|
1378
|
-
if (len <= 23) {
|
|
1379
|
-
const cached = stringEncodeCache.get(s);
|
|
1380
|
-
if (cached) {
|
|
1381
|
-
ensure(cached.bytes.length);
|
|
1382
|
-
buf.set(cached.bytes, cursor);
|
|
1383
|
-
cursor += cached.bytes.length;
|
|
1384
|
-
cached.epoch = encodeCacheEpoch;
|
|
1385
|
-
return;
|
|
1386
|
-
}
|
|
1387
|
-
const start = cursor;
|
|
1388
|
-
writeStringUncached(s, len);
|
|
1389
|
-
const end = cursor;
|
|
1390
|
-
const bytes = Uint8Array.prototype.slice.call(buf, start, end);
|
|
1391
|
-
if (stringEncodeCache.size >= STRING_CACHE_MAX) {
|
|
1392
|
-
if (encodeCacheSaturated) {
|
|
1393
|
-
return;
|
|
1394
|
-
}
|
|
1395
|
-
let evicted = 0;
|
|
1396
|
-
for (const [key, entry] of stringEncodeCache) {
|
|
1397
|
-
if (evicted >= 1024) {
|
|
1398
|
-
break;
|
|
1399
|
-
}
|
|
1400
|
-
if (entry.epoch !== encodeCacheEpoch) {
|
|
1401
|
-
stringEncodeCache.delete(key);
|
|
1402
|
-
++evicted;
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
if (evicted === 0) {
|
|
1406
|
-
encodeCacheSaturated = true;
|
|
1407
|
-
return;
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
if (stringEncodeCache.size < STRING_CACHE_MAX) {
|
|
1411
|
-
stringEncodeCache.set(s, { epoch: encodeCacheEpoch, bytes });
|
|
1412
|
-
}
|
|
1413
|
-
return;
|
|
1414
|
-
}
|
|
1415
|
-
writeStringUncached(s, len);
|
|
1416
|
-
}
|
|
1417
|
-
function writeStringUncached(s, len) {
|
|
1418
|
-
if (USE_BUFFER$1) {
|
|
1419
|
-
const maxBytes = len * 3;
|
|
1420
|
-
ensure(maxBytes + 9);
|
|
1421
|
-
const byteLen = Buffer.byteLength(s);
|
|
1422
|
-
encodeHeader(majorUtf8String, byteLen);
|
|
1423
|
-
cursor += buf.write(s, cursor);
|
|
1424
|
-
}
|
|
1425
|
-
else {
|
|
1426
|
-
const maxBytes = len * 3;
|
|
1427
|
-
ensure(maxBytes + 9);
|
|
1428
|
-
const headerPos = cursor;
|
|
1429
|
-
const result = textEncoder.encodeInto(s, buf.subarray(headerPos + 9));
|
|
1430
|
-
const byteLen = result.written;
|
|
1431
|
-
let headerSize;
|
|
1432
|
-
if (byteLen < 24) {
|
|
1433
|
-
headerSize = 1;
|
|
1434
|
-
}
|
|
1435
|
-
else if (byteLen < 256) {
|
|
1436
|
-
headerSize = 2;
|
|
1437
|
-
}
|
|
1438
|
-
else if (byteLen < 65536) {
|
|
1439
|
-
headerSize = 3;
|
|
1440
|
-
}
|
|
1441
|
-
else if (byteLen < 4294967296) {
|
|
1442
|
-
headerSize = 5;
|
|
1443
|
-
}
|
|
1444
|
-
else {
|
|
1445
|
-
headerSize = 9;
|
|
1446
|
-
}
|
|
1447
|
-
if (headerSize < 9) {
|
|
1448
|
-
buf.copyWithin(headerPos + headerSize, headerPos + 9, headerPos + 9 + byteLen);
|
|
1449
|
-
}
|
|
1450
|
-
cursor = headerPos;
|
|
1451
|
-
encodeHeader(majorUtf8String, byteLen);
|
|
1452
|
-
cursor += byteLen;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
function writeFloat64(value) {
|
|
1456
|
-
ensure(9);
|
|
1457
|
-
buf[cursor++] = (majorSpecial << 5) | extendedFloat64;
|
|
1458
|
-
view.setFloat64(cursor, value);
|
|
1459
|
-
cursor += 8;
|
|
1460
|
-
}
|
|
1461
|
-
function writeInteger(value) {
|
|
1462
|
-
ensure(9);
|
|
1463
|
-
const nonNegative = value >= 0;
|
|
1464
|
-
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
1465
|
-
const abs = nonNegative ? value : -value - 1;
|
|
1466
|
-
encodeHeader(major, abs);
|
|
1467
|
-
}
|
|
1468
|
-
function writeBigInt(value) {
|
|
1469
|
-
const nonNegative = value >= 0;
|
|
1470
|
-
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
1471
|
-
const abs = nonNegative ? value : -value - BigInt(1);
|
|
1472
|
-
if (abs < BigInt("18446744073709551616")) {
|
|
1473
|
-
ensure(9);
|
|
1474
|
-
encodeBigHeader(major, abs);
|
|
1475
|
-
}
|
|
1476
|
-
else {
|
|
1477
|
-
const binaryStr = abs.toString(2);
|
|
1478
|
-
const byteLen = Math.ceil(binaryStr.length / 8);
|
|
1479
|
-
const bigIntBytes = new Uint8Array(byteLen);
|
|
1480
|
-
let b = abs;
|
|
1481
|
-
for (let i = byteLen - 1; i >= 0; --i) {
|
|
1482
|
-
bigIntBytes[i] = Number(b & BigInt(255));
|
|
1483
|
-
b >>= BigInt(8);
|
|
1484
|
-
}
|
|
1485
|
-
ensure(byteLen + 16);
|
|
1486
|
-
buf[cursor++] = nonNegative ? 0b110_00010 : 0b110_00011;
|
|
1487
|
-
encodeHeader(majorUnstructuredByteString, byteLen);
|
|
1488
|
-
buf.set(bigIntBytes, cursor);
|
|
1489
|
-
cursor += byteLen;
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
function writeBytes(data) {
|
|
1493
|
-
ensure(data.length + 9);
|
|
1494
|
-
encodeHeader(majorUnstructuredByteString, data.length);
|
|
1495
|
-
buf.set(data, cursor);
|
|
1496
|
-
cursor += data.length;
|
|
1497
|
-
}
|
|
1498
|
-
function writeTag(tagValue, innerValue) {
|
|
1499
|
-
ensure(9);
|
|
1500
|
-
if (typeof tagValue === "bigint") {
|
|
1501
|
-
encodeBigHeader(majorTag, tagValue);
|
|
1502
|
-
}
|
|
1503
|
-
else {
|
|
1504
|
-
encodeHeader(majorTag, tagValue);
|
|
1505
|
-
}
|
|
1506
|
-
writeUntypedValue(innerValue);
|
|
1507
|
-
}
|
|
1508
|
-
function writeNumericValue(nv) {
|
|
1509
|
-
const decimalIndex = nv.string.indexOf(".");
|
|
1510
|
-
const exponent = decimalIndex === -1 ? 0 : decimalIndex - nv.string.length + 1;
|
|
1511
|
-
const mantissa = BigInt(nv.string.replace(".", ""));
|
|
1512
|
-
ensure(9);
|
|
1513
|
-
buf[cursor++] = 0b110_00100;
|
|
1514
|
-
encodeHeader(majorList, 2);
|
|
1515
|
-
ensure(9);
|
|
1516
|
-
writeInteger(exponent);
|
|
1517
|
-
writeBigInt(mantissa);
|
|
1518
|
-
}
|
|
1519
|
-
function writeTimestamp(date) {
|
|
1520
|
-
ensure(18);
|
|
1521
|
-
encodeHeader(majorTag, 1);
|
|
1522
|
-
const epochSecs = date.getTime() / 1000;
|
|
1523
|
-
if (Number.isInteger(epochSecs)) {
|
|
1524
|
-
writeInteger(epochSecs);
|
|
1525
|
-
}
|
|
1526
|
-
else {
|
|
1527
|
-
writeFloat64(epochSecs);
|
|
1528
|
-
}
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
class CborShapeDeserializer2 extends SerdeContext {
|
|
1532
|
-
read(schema, bytes) {
|
|
1533
|
-
payload = bytes;
|
|
1534
|
-
isBuffer = USE_BUFFER && bytes instanceof Buffer;
|
|
1535
|
-
dataView = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
1536
|
-
pos = 0;
|
|
1537
|
-
end = bytes.length;
|
|
1538
|
-
cacheEpoch = (cacheEpoch + 1) & 0xffff;
|
|
1539
|
-
return readValue(NormalizedSchema.of(schema));
|
|
1540
|
-
}
|
|
1541
|
-
readValue(_schema, value) {
|
|
1542
|
-
return transformObject(NormalizedSchema.of(_schema), value);
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
|
-
const USE_BUFFER = typeof Buffer !== "undefined";
|
|
1546
|
-
const textDecoder = new TextDecoder();
|
|
1547
|
-
let payload = new Uint8Array(0);
|
|
1548
|
-
let isBuffer = false;
|
|
1549
|
-
let dataView = new DataView(new ArrayBuffer(0));
|
|
1550
|
-
let pos = 0;
|
|
1551
|
-
let end = 0;
|
|
1552
|
-
const STRING_CACHE_SIZE = 2048;
|
|
1553
|
-
const stringCache = new Array(STRING_CACHE_SIZE);
|
|
1554
|
-
const stringCacheEpochs = new Uint16Array(STRING_CACHE_SIZE);
|
|
1555
|
-
let cacheEpoch = 0;
|
|
1556
|
-
function readValue(ns) {
|
|
1557
|
-
if (pos >= end) {
|
|
1558
|
-
throw new Error("unexpected end of CBOR payload.");
|
|
1559
|
-
}
|
|
1560
|
-
const major = (payload[pos] & 0b1110_0000) >> 5;
|
|
1561
|
-
const minor = payload[pos] & 0b0001_1111;
|
|
1562
|
-
if (minor === minorIndefinite && major >= 2 && major <= 5) {
|
|
1563
|
-
return readIndefinite(ns, major);
|
|
1564
|
-
}
|
|
1565
|
-
switch (major) {
|
|
1566
|
-
case majorUint64:
|
|
1567
|
-
return readUnsignedInt();
|
|
1568
|
-
case majorNegativeInt64:
|
|
1569
|
-
return readNegativeInt();
|
|
1570
|
-
case majorUnstructuredByteString:
|
|
1571
|
-
return readByteString();
|
|
1572
|
-
case majorUtf8String:
|
|
1573
|
-
return readUtf8String();
|
|
1574
|
-
case majorList:
|
|
1575
|
-
return readList(ns);
|
|
1576
|
-
case majorMap:
|
|
1577
|
-
return readMap(ns);
|
|
1578
|
-
case majorTag:
|
|
1579
|
-
return readTag();
|
|
1580
|
-
case majorSpecial:
|
|
1581
|
-
return readSpecial();
|
|
1582
|
-
default:
|
|
1583
|
-
throw new Error(`unexpected CBOR major type ${major}.`);
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
function readList(ns) {
|
|
1587
|
-
const count = decodeCount();
|
|
1588
|
-
const memberSchema = ns.isListSchema() ? ns.getValueSchema() : ns;
|
|
1589
|
-
const list = Array(count);
|
|
1590
|
-
for (let i = 0; i < count; ++i) {
|
|
1591
|
-
list[i] = readValue(memberSchema);
|
|
1592
|
-
}
|
|
1593
|
-
return list;
|
|
1594
|
-
}
|
|
1595
|
-
function readMap(ns) {
|
|
1596
|
-
const count = decodeCount();
|
|
1597
|
-
if (ns.isStructSchema()) {
|
|
1598
|
-
const startPos = pos;
|
|
1599
|
-
return readStruct(ns, count, startPos);
|
|
1600
|
-
}
|
|
1601
|
-
const valueSchema = ns.isMapSchema() ? ns.getValueSchema() : ns;
|
|
1602
|
-
const map = {};
|
|
1603
|
-
for (let i = 0; i < count; ++i) {
|
|
1604
|
-
const key = readUtf8String();
|
|
1605
|
-
map[key] = readValue(valueSchema);
|
|
1606
|
-
}
|
|
1607
|
-
return map;
|
|
1608
|
-
}
|
|
1609
|
-
function readStruct(ns, count, startPos) {
|
|
1610
|
-
const isUnion = ns.isUnionSchema();
|
|
1611
|
-
const cache = loadCborStructIterator(ns);
|
|
1612
|
-
const { memberSchemas, encodedKeys, memberNames } = cache;
|
|
1613
|
-
const z = encodedKeys.length;
|
|
1614
|
-
const result = {};
|
|
1615
|
-
let unknownKey;
|
|
1616
|
-
let unknownValue;
|
|
1617
|
-
let unknownCount = 0;
|
|
1618
|
-
let hasType = false;
|
|
1619
|
-
let hint = 0;
|
|
1620
|
-
for (let i = 0; i < count; ++i) {
|
|
1621
|
-
const matchIdx = matchStructKey(encodedKeys, z, hint);
|
|
1622
|
-
if (matchIdx >= 0) {
|
|
1623
|
-
hint = matchIdx + 1;
|
|
1624
|
-
if (hint >= z) {
|
|
1625
|
-
hint = 0;
|
|
1626
|
-
}
|
|
1627
|
-
const val = readValue(memberSchemas[matchIdx]);
|
|
1628
|
-
if (val != null) {
|
|
1629
|
-
result[memberNames[matchIdx]] = val;
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
else {
|
|
1633
|
-
const key = readUtf8String();
|
|
1634
|
-
const val = readValue(NormalizedSchema.of(15));
|
|
1635
|
-
if (key === "__type" && typeof val === "string") {
|
|
1636
|
-
hasType = true;
|
|
1637
|
-
}
|
|
1638
|
-
else {
|
|
1639
|
-
unknownKey = key;
|
|
1640
|
-
unknownValue = val;
|
|
1641
|
-
++unknownCount;
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
if (isUnion) {
|
|
1646
|
-
let resultEmpty = true;
|
|
1647
|
-
for (const _ in result) {
|
|
1648
|
-
resultEmpty = false;
|
|
1649
|
-
break;
|
|
1650
|
-
}
|
|
1651
|
-
if (resultEmpty && unknownCount === 1) {
|
|
1652
|
-
result.$unknown = [unknownKey, unknownValue];
|
|
1653
|
-
}
|
|
1654
|
-
}
|
|
1655
|
-
else if (hasType) {
|
|
1656
|
-
pos = startPos;
|
|
1657
|
-
const docSchema = NormalizedSchema.of(15);
|
|
1658
|
-
for (let i = 0; i < count; ++i) {
|
|
1659
|
-
const key = readUtf8String();
|
|
1660
|
-
const val = readValue(docSchema);
|
|
1661
|
-
if (!(key in result)) {
|
|
1662
|
-
result[key] = val;
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
return result;
|
|
1667
|
-
}
|
|
1668
|
-
function readTag(ns) {
|
|
1669
|
-
const tagNum = decodeArgument();
|
|
1670
|
-
const tagNumber = typeof tagNum === "bigint" ? Number(tagNum) : tagNum;
|
|
1671
|
-
if (tagNumber === 1) {
|
|
1672
|
-
const docSchema = NormalizedSchema.of(15);
|
|
1673
|
-
const epochValue = readValue(docSchema);
|
|
1674
|
-
return _parseEpochTimestamp(epochValue);
|
|
1675
|
-
}
|
|
1676
|
-
if (tagNumber === 2 || tagNumber === 3) {
|
|
1677
|
-
const byteStr = readByteString();
|
|
1678
|
-
let b = BigInt(0);
|
|
1679
|
-
for (let i = 0; i < byteStr.length; ++i) {
|
|
1680
|
-
b = (b << BigInt(8)) | BigInt(byteStr[i]);
|
|
1681
|
-
}
|
|
1682
|
-
return tagNumber === 3 ? -b - BigInt(1) : b;
|
|
1683
|
-
}
|
|
1684
|
-
if (tagNumber === 4) {
|
|
1685
|
-
const docSchema = NormalizedSchema.of(15);
|
|
1686
|
-
const pair = readValue(docSchema);
|
|
1687
|
-
const [exponent, mantissa] = pair;
|
|
1688
|
-
const normalizer = mantissa < 0 ? -1 : 1;
|
|
1689
|
-
const mantissaStr = "0".repeat(Math.abs(exponent) + 1) + String(BigInt(normalizer) * BigInt(mantissa));
|
|
1690
|
-
let numericString;
|
|
1691
|
-
const sign = mantissa < 0 ? "-" : "";
|
|
1692
|
-
numericString =
|
|
1693
|
-
exponent === 0
|
|
1694
|
-
? mantissaStr
|
|
1695
|
-
: mantissaStr.slice(0, mantissaStr.length + exponent) + "." + mantissaStr.slice(exponent);
|
|
1696
|
-
numericString = numericString.replace(/^0+/g, "");
|
|
1697
|
-
if (numericString === "") {
|
|
1698
|
-
numericString = "0";
|
|
1699
|
-
}
|
|
1700
|
-
if (numericString[0] === ".") {
|
|
1701
|
-
numericString = "0" + numericString;
|
|
1702
|
-
}
|
|
1703
|
-
numericString = sign + numericString;
|
|
1704
|
-
return nv(numericString);
|
|
1705
|
-
}
|
|
1706
|
-
const docSchema = NormalizedSchema.of(15);
|
|
1707
|
-
const innerValue = readValue(docSchema);
|
|
1708
|
-
return { tag: castBigInt(tagNum), value: innerValue };
|
|
1709
|
-
}
|
|
1710
|
-
function readIndefinite(ns, major) {
|
|
1711
|
-
switch (major) {
|
|
1712
|
-
case majorUtf8String:
|
|
1713
|
-
return readUtf8StringIndefinite();
|
|
1714
|
-
case majorUnstructuredByteString:
|
|
1715
|
-
return readByteStringIndefinite();
|
|
1716
|
-
case majorList:
|
|
1717
|
-
return readListIndefinite(ns);
|
|
1718
|
-
case majorMap:
|
|
1719
|
-
return readMapIndefinite(ns);
|
|
1720
|
-
default:
|
|
1721
|
-
throw new Error(`unexpected indefinite length for major ${major}.`);
|
|
1722
|
-
}
|
|
1723
|
-
}
|
|
1724
|
-
function readUtf8StringIndefinite() {
|
|
1725
|
-
pos += 1;
|
|
1726
|
-
const chunks = [];
|
|
1727
|
-
let totalLen = 0;
|
|
1728
|
-
while (pos < end) {
|
|
1729
|
-
if (payload[pos] === 0xff) {
|
|
1730
|
-
pos += 1;
|
|
1731
|
-
const combined = new Uint8Array(totalLen);
|
|
1732
|
-
let offset = 0;
|
|
1733
|
-
for (let i = 0; i < chunks.length; ++i) {
|
|
1734
|
-
combined.set(chunks[i], offset);
|
|
1735
|
-
offset += chunks[i].length;
|
|
1069
|
+
else if (typeof value === "object") {
|
|
1070
|
+
if (value === null) {
|
|
1071
|
+
return null;
|
|
1736
1072
|
}
|
|
1737
|
-
if (
|
|
1738
|
-
return
|
|
1073
|
+
if ("byteLength" in value) {
|
|
1074
|
+
return value;
|
|
1739
1075
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
const bytes = readByteString();
|
|
1743
|
-
chunks.push(bytes);
|
|
1744
|
-
totalLen += bytes.length;
|
|
1745
|
-
}
|
|
1746
|
-
throw new Error("expected break marker.");
|
|
1747
|
-
}
|
|
1748
|
-
function readByteStringIndefinite() {
|
|
1749
|
-
pos += 1;
|
|
1750
|
-
const chunks = [];
|
|
1751
|
-
let totalLen = 0;
|
|
1752
|
-
while (pos < end) {
|
|
1753
|
-
if (payload[pos] === 0xff) {
|
|
1754
|
-
pos += 1;
|
|
1755
|
-
const combined = new Uint8Array(totalLen);
|
|
1756
|
-
let offset = 0;
|
|
1757
|
-
for (let i = 0; i < chunks.length; ++i) {
|
|
1758
|
-
combined.set(chunks[i], offset);
|
|
1759
|
-
offset += chunks[i].length;
|
|
1076
|
+
if (value instanceof Date) {
|
|
1077
|
+
return value;
|
|
1760
1078
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
const bytes = readByteString();
|
|
1764
|
-
chunks.push(bytes);
|
|
1765
|
-
totalLen += bytes.length;
|
|
1766
|
-
}
|
|
1767
|
-
throw new Error("expected break marker.");
|
|
1768
|
-
}
|
|
1769
|
-
function readListIndefinite(ns) {
|
|
1770
|
-
pos += 1;
|
|
1771
|
-
const memberSchema = ns.isListSchema() ? ns.getValueSchema() : ns;
|
|
1772
|
-
const list = [];
|
|
1773
|
-
while (pos < end) {
|
|
1774
|
-
if (payload[pos] === 0xff) {
|
|
1775
|
-
pos += 1;
|
|
1776
|
-
return list;
|
|
1777
|
-
}
|
|
1778
|
-
list.push(readValue(memberSchema));
|
|
1779
|
-
}
|
|
1780
|
-
throw new Error("expected break marker.");
|
|
1781
|
-
}
|
|
1782
|
-
function readMapIndefinite(ns) {
|
|
1783
|
-
pos += 1;
|
|
1784
|
-
if (ns.isStructSchema()) {
|
|
1785
|
-
const cache = loadCborStructIterator(ns);
|
|
1786
|
-
const { memberSchemas, encodedKeys, memberNames } = cache;
|
|
1787
|
-
const z = encodedKeys.length;
|
|
1788
|
-
const isUnion = ns.isUnionSchema();
|
|
1789
|
-
const result = {};
|
|
1790
|
-
let unknownKey;
|
|
1791
|
-
let unknownValue;
|
|
1792
|
-
let unknownCount = 0;
|
|
1793
|
-
let hint = 0;
|
|
1794
|
-
while (pos < end) {
|
|
1795
|
-
if (payload[pos] === 0xff) {
|
|
1796
|
-
pos += 1;
|
|
1797
|
-
if (isUnion) {
|
|
1798
|
-
let resultEmpty = true;
|
|
1799
|
-
for (const _ in result) {
|
|
1800
|
-
resultEmpty = false;
|
|
1801
|
-
break;
|
|
1802
|
-
}
|
|
1803
|
-
if (resultEmpty && unknownCount === 1) {
|
|
1804
|
-
result.$unknown = [unknownKey, unknownValue];
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
return result;
|
|
1079
|
+
if (ns.isDocumentSchema()) {
|
|
1080
|
+
return value;
|
|
1808
1081
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
const val = readValue(memberSchemas[matchIdx]);
|
|
1816
|
-
if (val != null) {
|
|
1817
|
-
result[memberNames[matchIdx]] = val;
|
|
1082
|
+
if (ns.isListSchema()) {
|
|
1083
|
+
const newArray = [];
|
|
1084
|
+
const memberSchema = ns.getValueSchema();
|
|
1085
|
+
for (const item of value) {
|
|
1086
|
+
const itemValue = this.readValue(memberSchema, item);
|
|
1087
|
+
newArray.push(itemValue);
|
|
1818
1088
|
}
|
|
1089
|
+
return newArray;
|
|
1819
1090
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
++unknownCount;
|
|
1091
|
+
const newObject = {};
|
|
1092
|
+
if (ns.isMapSchema()) {
|
|
1093
|
+
const targetSchema = ns.getValueSchema();
|
|
1094
|
+
for (const key in value) {
|
|
1095
|
+
const itemValue = this.readValue(targetSchema, value[key]);
|
|
1096
|
+
newObject[key] = itemValue;
|
|
1827
1097
|
}
|
|
1828
1098
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
return false;
|
|
1866
|
-
}
|
|
1867
|
-
for (let i = 1; i < len; ++i) {
|
|
1868
|
-
if (payload[at + i] !== expected[i]) {
|
|
1869
|
-
return false;
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
return true;
|
|
1873
|
-
}
|
|
1874
|
-
function decodeArgument() {
|
|
1875
|
-
const minor = payload[pos] & 0b0001_1111;
|
|
1876
|
-
if (minor < 24) {
|
|
1877
|
-
pos += 1;
|
|
1878
|
-
return minor;
|
|
1879
|
-
}
|
|
1880
|
-
switch (minor) {
|
|
1881
|
-
case extendedOneByte:
|
|
1882
|
-
if (end - pos < 2) {
|
|
1883
|
-
overflow(1);
|
|
1884
|
-
}
|
|
1885
|
-
pos += 2;
|
|
1886
|
-
return payload[pos - 1];
|
|
1887
|
-
case extendedFloat16:
|
|
1888
|
-
if (end - pos < 3) {
|
|
1889
|
-
overflow(2);
|
|
1890
|
-
}
|
|
1891
|
-
pos += 3;
|
|
1892
|
-
return dataView.getUint16(pos - 2);
|
|
1893
|
-
case extendedFloat32:
|
|
1894
|
-
if (end - pos < 5) {
|
|
1895
|
-
overflow(4);
|
|
1896
|
-
}
|
|
1897
|
-
pos += 5;
|
|
1898
|
-
return dataView.getUint32(pos - 4);
|
|
1899
|
-
case extendedFloat64: {
|
|
1900
|
-
if (end - pos < 9) {
|
|
1901
|
-
overflow(8);
|
|
1902
|
-
}
|
|
1903
|
-
pos += 9;
|
|
1904
|
-
const hi = dataView.getUint32(pos - 8);
|
|
1905
|
-
if (hi < 0x00200000) {
|
|
1906
|
-
return hi * 4294967296 + dataView.getUint32(pos - 4);
|
|
1907
|
-
}
|
|
1908
|
-
return dataView.getBigUint64(pos - 8);
|
|
1909
|
-
}
|
|
1910
|
-
default:
|
|
1911
|
-
throw new Error(`unexpected minor value ${minor}.`);
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
function decodeCount() {
|
|
1915
|
-
const val = decodeArgument();
|
|
1916
|
-
return typeof val === "bigint" ? Number(val) : val;
|
|
1917
|
-
}
|
|
1918
|
-
function readUnsignedInt() {
|
|
1919
|
-
const val = decodeArgument();
|
|
1920
|
-
return castBigInt(val);
|
|
1921
|
-
}
|
|
1922
|
-
function readNegativeInt() {
|
|
1923
|
-
const val = decodeArgument();
|
|
1924
|
-
if (typeof val === "bigint") {
|
|
1925
|
-
return BigInt(-1) - val;
|
|
1926
|
-
}
|
|
1927
|
-
return -1 - val;
|
|
1928
|
-
}
|
|
1929
|
-
function readByteString() {
|
|
1930
|
-
const length = decodeCount();
|
|
1931
|
-
if (end - pos < length) {
|
|
1932
|
-
overflow(length);
|
|
1933
|
-
}
|
|
1934
|
-
const start = pos;
|
|
1935
|
-
pos += length;
|
|
1936
|
-
return payload.subarray(start, start + length);
|
|
1937
|
-
}
|
|
1938
|
-
function readUtf8String() {
|
|
1939
|
-
const length = decodeCount();
|
|
1940
|
-
if (end - pos < length) {
|
|
1941
|
-
overflow(length);
|
|
1942
|
-
}
|
|
1943
|
-
const start = pos;
|
|
1944
|
-
pos += length;
|
|
1945
|
-
if (length < 24) {
|
|
1946
|
-
return decodeUtf8Cached(start, length);
|
|
1947
|
-
}
|
|
1948
|
-
if (isBuffer) {
|
|
1949
|
-
return payload.toString("utf-8", start, start + length);
|
|
1950
|
-
}
|
|
1951
|
-
return textDecoder.decode(payload.subarray(start, start + length));
|
|
1952
|
-
}
|
|
1953
|
-
function decodeUtf8Cached(at, length) {
|
|
1954
|
-
let h = length;
|
|
1955
|
-
for (let i = 0; i < length; ++i) {
|
|
1956
|
-
h = (h * 31 + payload[at + i]) | 0;
|
|
1957
|
-
}
|
|
1958
|
-
const slot = (h >>> 0) & (STRING_CACHE_SIZE - 1);
|
|
1959
|
-
const cached = stringCache[slot];
|
|
1960
|
-
if (cached !== undefined && cached.length === length) {
|
|
1961
|
-
let match = true;
|
|
1962
|
-
for (let i = 0; i < length; ++i) {
|
|
1963
|
-
if (cached.charCodeAt(i) !== payload[at + i]) {
|
|
1964
|
-
match = false;
|
|
1965
|
-
break;
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
if (match) {
|
|
1969
|
-
stringCacheEpochs[slot] = cacheEpoch;
|
|
1970
|
-
return cached;
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
const result = isBuffer
|
|
1974
|
-
? payload.toString("utf-8", at, at + length)
|
|
1975
|
-
: textDecoder.decode(payload.subarray(at, at + length));
|
|
1976
|
-
if (stringCacheEpochs[slot] !== cacheEpoch) {
|
|
1977
|
-
stringCache[slot] = result;
|
|
1978
|
-
stringCacheEpochs[slot] = cacheEpoch;
|
|
1979
|
-
}
|
|
1980
|
-
return result;
|
|
1981
|
-
}
|
|
1982
|
-
function readSpecial() {
|
|
1983
|
-
const p = pos;
|
|
1984
|
-
const minor = payload[p] & 0b0001_1111;
|
|
1985
|
-
switch (minor) {
|
|
1986
|
-
case specialTrue:
|
|
1987
|
-
pos = p + 1;
|
|
1988
|
-
return true;
|
|
1989
|
-
case specialFalse:
|
|
1990
|
-
pos = p + 1;
|
|
1991
|
-
return false;
|
|
1992
|
-
case specialNull:
|
|
1993
|
-
pos = p + 1;
|
|
1994
|
-
return null;
|
|
1995
|
-
case specialUndefined:
|
|
1996
|
-
pos = p + 1;
|
|
1997
|
-
return null;
|
|
1998
|
-
case extendedFloat16: {
|
|
1999
|
-
if (end - p < 3) {
|
|
2000
|
-
overflow(2);
|
|
2001
|
-
}
|
|
2002
|
-
pos = p + 3;
|
|
2003
|
-
return bytesToFloat16(payload[p + 1], payload[p + 2]);
|
|
2004
|
-
}
|
|
2005
|
-
case extendedFloat32: {
|
|
2006
|
-
if (end - p < 5) {
|
|
2007
|
-
overflow(4);
|
|
2008
|
-
}
|
|
2009
|
-
pos = p + 5;
|
|
2010
|
-
return dataView.getFloat32(p + 1);
|
|
2011
|
-
}
|
|
2012
|
-
case extendedFloat64: {
|
|
2013
|
-
if (end - p < 9) {
|
|
2014
|
-
overflow(8);
|
|
2015
|
-
}
|
|
2016
|
-
pos = p + 9;
|
|
2017
|
-
return dataView.getFloat64(p + 1);
|
|
2018
|
-
}
|
|
2019
|
-
default:
|
|
2020
|
-
throw new Error(`unexpected minor value ${minor} for major 7.`);
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
function bytesToFloat16(a, b) {
|
|
2024
|
-
const sign = a >> 7;
|
|
2025
|
-
const exponent = (a & 0b0111_1100) >> 2;
|
|
2026
|
-
const fraction = ((a & 0b0000_0011) << 8) | b;
|
|
2027
|
-
const scalar = sign === 0 ? 1 : -1;
|
|
2028
|
-
if (exponent === 0b00000) {
|
|
2029
|
-
if (fraction === 0) {
|
|
2030
|
-
return 0;
|
|
2031
|
-
}
|
|
2032
|
-
return scalar * (Math.pow(2, 1 - 15) * (fraction / 1024));
|
|
2033
|
-
}
|
|
2034
|
-
else if (exponent === 0b11111) {
|
|
2035
|
-
if (fraction === 0) {
|
|
2036
|
-
return scalar * Infinity;
|
|
2037
|
-
}
|
|
2038
|
-
return NaN;
|
|
2039
|
-
}
|
|
2040
|
-
return scalar * (Math.pow(2, exponent - 15) * (1 + fraction / 1024));
|
|
2041
|
-
}
|
|
2042
|
-
function castBigInt(value) {
|
|
2043
|
-
if (typeof value === "number") {
|
|
2044
|
-
return value;
|
|
2045
|
-
}
|
|
2046
|
-
const num = Number(value);
|
|
2047
|
-
if (Number.MIN_SAFE_INTEGER <= num && num <= Number.MAX_SAFE_INTEGER) {
|
|
2048
|
-
return num;
|
|
2049
|
-
}
|
|
2050
|
-
return value;
|
|
2051
|
-
}
|
|
2052
|
-
function overflow(n) {
|
|
2053
|
-
throw new Error(`CBOR: length ${n} greater than remaining buffer length.`);
|
|
2054
|
-
}
|
|
2055
|
-
function transformObject(ns, value) {
|
|
2056
|
-
if (ns.isTimestampSchema()) {
|
|
2057
|
-
if (typeof value === "number") {
|
|
2058
|
-
return _parseEpochTimestamp(value);
|
|
2059
|
-
}
|
|
2060
|
-
if (typeof value === "object" && value !== null) {
|
|
2061
|
-
if (value.tag === 1 && "value" in value) {
|
|
2062
|
-
return _parseEpochTimestamp(value.value);
|
|
2063
|
-
}
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
if (ns.isBlobSchema()) {
|
|
2067
|
-
return value;
|
|
2068
|
-
}
|
|
2069
|
-
if (typeof value === "undefined" ||
|
|
2070
|
-
typeof value === "boolean" ||
|
|
2071
|
-
typeof value === "number" ||
|
|
2072
|
-
typeof value === "string" ||
|
|
2073
|
-
typeof value === "bigint" ||
|
|
2074
|
-
typeof value === "symbol") {
|
|
2075
|
-
return value;
|
|
2076
|
-
}
|
|
2077
|
-
if (typeof value !== "object" || value === null) {
|
|
2078
|
-
return value;
|
|
2079
|
-
}
|
|
2080
|
-
if ("byteLength" in value) {
|
|
2081
|
-
return value;
|
|
2082
|
-
}
|
|
2083
|
-
if (value instanceof Date) {
|
|
2084
|
-
return value;
|
|
2085
|
-
}
|
|
2086
|
-
if (value instanceof NumericValue) {
|
|
2087
|
-
return value;
|
|
2088
|
-
}
|
|
2089
|
-
if (ns.isDocumentSchema()) {
|
|
2090
|
-
return value;
|
|
2091
|
-
}
|
|
2092
|
-
if (ns.isListSchema()) {
|
|
2093
|
-
const memberSchema = ns.getValueSchema();
|
|
2094
|
-
const out = [];
|
|
2095
|
-
for (const item of value) {
|
|
2096
|
-
out.push(transformObject(memberSchema, item));
|
|
2097
|
-
}
|
|
2098
|
-
return out;
|
|
2099
|
-
}
|
|
2100
|
-
const newObject = {};
|
|
2101
|
-
if (ns.isMapSchema()) {
|
|
2102
|
-
const targetSchema = ns.getValueSchema();
|
|
2103
|
-
for (const key in value) {
|
|
2104
|
-
newObject[key] = transformObject(targetSchema, value[key]);
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
else if (ns.isStructSchema()) {
|
|
2108
|
-
const isUnion = ns.isUnionSchema();
|
|
2109
|
-
let keys;
|
|
2110
|
-
if (isUnion) {
|
|
2111
|
-
keys = new Set();
|
|
2112
|
-
for (const k in value) {
|
|
2113
|
-
if (k !== "__type") {
|
|
2114
|
-
keys.add(k);
|
|
1099
|
+
else if (ns.isStructSchema()) {
|
|
1100
|
+
const isUnion = ns.isUnionSchema();
|
|
1101
|
+
let keys;
|
|
1102
|
+
if (isUnion) {
|
|
1103
|
+
keys = new Set();
|
|
1104
|
+
for (const k in value) {
|
|
1105
|
+
if (k !== "__type") {
|
|
1106
|
+
keys.add(k);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
for (const [key, memberSchema] of ns.structIterator()) {
|
|
1111
|
+
if (isUnion) {
|
|
1112
|
+
keys.delete(key);
|
|
1113
|
+
}
|
|
1114
|
+
if (value[key] != null) {
|
|
1115
|
+
newObject[key] = this.readValue(memberSchema, value[key]);
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
if (isUnion && keys?.size === 1) {
|
|
1119
|
+
let newObjectEmpty = true;
|
|
1120
|
+
for (const _ in newObject) {
|
|
1121
|
+
newObjectEmpty = false;
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
if (newObjectEmpty) {
|
|
1125
|
+
const k = keys.values().next().value;
|
|
1126
|
+
newObject.$unknown = [k, value[k]];
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
else if (typeof value.__type === "string") {
|
|
1130
|
+
for (const k in value) {
|
|
1131
|
+
if (!(k in newObject)) {
|
|
1132
|
+
newObject[k] = value[k];
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
2115
1135
|
}
|
|
2116
1136
|
}
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
if (isUnion) {
|
|
2120
|
-
keys.delete(key);
|
|
2121
|
-
}
|
|
2122
|
-
if (value[key] != null) {
|
|
2123
|
-
newObject[key] = transformObject(memberSchema, value[key]);
|
|
2124
|
-
}
|
|
2125
|
-
}
|
|
2126
|
-
if (isUnion && keys?.size === 1) {
|
|
2127
|
-
let newObjectEmpty = true;
|
|
2128
|
-
for (const _ in newObject) {
|
|
2129
|
-
newObjectEmpty = false;
|
|
2130
|
-
break;
|
|
2131
|
-
}
|
|
2132
|
-
if (newObjectEmpty) {
|
|
2133
|
-
const k = keys.values().next().value;
|
|
2134
|
-
newObject.$unknown = [k, value[k]];
|
|
1137
|
+
else if (value instanceof NumericValue) {
|
|
1138
|
+
return value;
|
|
2135
1139
|
}
|
|
1140
|
+
return newObject;
|
|
2136
1141
|
}
|
|
2137
|
-
else
|
|
2138
|
-
|
|
2139
|
-
if (!(k in newObject)) {
|
|
2140
|
-
newObject[k] = value[k];
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
1142
|
+
else {
|
|
1143
|
+
return value;
|
|
2143
1144
|
}
|
|
2144
1145
|
}
|
|
2145
|
-
return newObject;
|
|
2146
|
-
}
|
|
2147
|
-
|
|
2148
|
-
class CborCodec extends SerdeContext {
|
|
2149
|
-
createSerializer() {
|
|
2150
|
-
const serializer = new CborShapeSerializer2();
|
|
2151
|
-
serializer.setSerdeContext(this.serdeContext);
|
|
2152
|
-
return serializer;
|
|
2153
|
-
}
|
|
2154
|
-
createDeserializer() {
|
|
2155
|
-
const deserializer = new CborShapeDeserializer2();
|
|
2156
|
-
deserializer.setSerdeContext(this.serdeContext);
|
|
2157
|
-
return deserializer;
|
|
2158
|
-
}
|
|
2159
1146
|
}
|
|
2160
1147
|
|
|
2161
1148
|
class SmithyRpcV2CborProtocol extends RpcProtocol {
|
|
@@ -2187,9 +1174,10 @@ class SmithyRpcV2CborProtocol extends RpcProtocol {
|
|
|
2187
1174
|
this.serializer.write(15, {});
|
|
2188
1175
|
request.body = this.serializer.flush();
|
|
2189
1176
|
}
|
|
2190
|
-
|
|
1177
|
+
try {
|
|
2191
1178
|
request.headers["content-length"] = String(request.body.byteLength);
|
|
2192
1179
|
}
|
|
1180
|
+
catch (ignored) { }
|
|
2193
1181
|
}
|
|
2194
1182
|
const { service, operation } = getSmithyContext(context);
|
|
2195
1183
|
const path = `/service/${service}/operation/${operation}`;
|
|
@@ -2252,220 +1240,9 @@ class SmithyRpcV2CborProtocol extends RpcProtocol {
|
|
|
2252
1240
|
}
|
|
2253
1241
|
}
|
|
2254
1242
|
|
|
2255
|
-
class CborShapeSerializer extends SerdeContext {
|
|
2256
|
-
value;
|
|
2257
|
-
write(schema, value) {
|
|
2258
|
-
this.value = this.serialize(schema, value);
|
|
2259
|
-
}
|
|
2260
|
-
serialize(schema, source) {
|
|
2261
|
-
const ns = NormalizedSchema.of(schema);
|
|
2262
|
-
if (source == null) {
|
|
2263
|
-
if (ns.isIdempotencyToken()) {
|
|
2264
|
-
return generateIdempotencyToken();
|
|
2265
|
-
}
|
|
2266
|
-
return source;
|
|
2267
|
-
}
|
|
2268
|
-
if (ns.isBlobSchema()) {
|
|
2269
|
-
if (typeof source === "string") {
|
|
2270
|
-
return (this.serdeContext?.base64Decoder ?? fromBase64)(source);
|
|
2271
|
-
}
|
|
2272
|
-
return source;
|
|
2273
|
-
}
|
|
2274
|
-
if (ns.isTimestampSchema()) {
|
|
2275
|
-
if (typeof source === "number" || typeof source === "bigint") {
|
|
2276
|
-
return dateToTag(new Date((Number(source) / 1000) | 0));
|
|
2277
|
-
}
|
|
2278
|
-
return dateToTag(source);
|
|
2279
|
-
}
|
|
2280
|
-
if (typeof source === "function" || typeof source === "object") {
|
|
2281
|
-
const sourceObject = source;
|
|
2282
|
-
if (ns.isListSchema() && Array.isArray(sourceObject)) {
|
|
2283
|
-
const sparse = !!ns.getMergedTraits().sparse;
|
|
2284
|
-
const newArray = [];
|
|
2285
|
-
let i = 0;
|
|
2286
|
-
for (const item of sourceObject) {
|
|
2287
|
-
const value = this.serialize(ns.getValueSchema(), item);
|
|
2288
|
-
if (value != null || sparse) {
|
|
2289
|
-
newArray[i++] = value;
|
|
2290
|
-
}
|
|
2291
|
-
}
|
|
2292
|
-
return newArray;
|
|
2293
|
-
}
|
|
2294
|
-
if (sourceObject instanceof Date) {
|
|
2295
|
-
return dateToTag(sourceObject);
|
|
2296
|
-
}
|
|
2297
|
-
const newObject = {};
|
|
2298
|
-
if (ns.isMapSchema()) {
|
|
2299
|
-
const sparse = !!ns.getMergedTraits().sparse;
|
|
2300
|
-
for (const key in sourceObject) {
|
|
2301
|
-
const value = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
2302
|
-
if (value != null || sparse) {
|
|
2303
|
-
newObject[key] = value;
|
|
2304
|
-
}
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
else if (ns.isStructSchema()) {
|
|
2308
|
-
for (const [key, memberSchema] of ns.structIterator()) {
|
|
2309
|
-
const value = this.serialize(memberSchema, sourceObject[key]);
|
|
2310
|
-
if (value != null) {
|
|
2311
|
-
newObject[key] = value;
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
const isUnion = ns.isUnionSchema();
|
|
2315
|
-
if (isUnion && Array.isArray(sourceObject.$unknown)) {
|
|
2316
|
-
const [k, v] = sourceObject.$unknown;
|
|
2317
|
-
newObject[k] = v;
|
|
2318
|
-
}
|
|
2319
|
-
else if (typeof sourceObject.__type === "string") {
|
|
2320
|
-
for (const k in sourceObject) {
|
|
2321
|
-
if (!(k in newObject)) {
|
|
2322
|
-
newObject[k] = this.serialize(15, sourceObject[k]);
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
else if (ns.isDocumentSchema()) {
|
|
2328
|
-
if (Array.isArray(sourceObject)) {
|
|
2329
|
-
const newArray = [];
|
|
2330
|
-
let i = 0;
|
|
2331
|
-
for (const item of sourceObject) {
|
|
2332
|
-
newArray[i++] = this.serialize(ns.getValueSchema(), item);
|
|
2333
|
-
}
|
|
2334
|
-
return newArray;
|
|
2335
|
-
}
|
|
2336
|
-
for (const key in sourceObject) {
|
|
2337
|
-
newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
else if (ns.isBigDecimalSchema()) {
|
|
2341
|
-
return sourceObject;
|
|
2342
|
-
}
|
|
2343
|
-
return newObject;
|
|
2344
|
-
}
|
|
2345
|
-
return source;
|
|
2346
|
-
}
|
|
2347
|
-
flush() {
|
|
2348
|
-
const buffer = cbor.serialize(this.value);
|
|
2349
|
-
this.value = undefined;
|
|
2350
|
-
return buffer;
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
class CborShapeDeserializer extends SerdeContext {
|
|
2355
|
-
read(schema, bytes) {
|
|
2356
|
-
const data = cbor.deserialize(bytes);
|
|
2357
|
-
return this.readValue(schema, data);
|
|
2358
|
-
}
|
|
2359
|
-
readValue(_schema, value) {
|
|
2360
|
-
const ns = NormalizedSchema.of(_schema);
|
|
2361
|
-
if (ns.isTimestampSchema()) {
|
|
2362
|
-
if (typeof value === "number") {
|
|
2363
|
-
return _parseEpochTimestamp(value);
|
|
2364
|
-
}
|
|
2365
|
-
if (typeof value === "object") {
|
|
2366
|
-
if (value.tag === 1 && "value" in value) {
|
|
2367
|
-
return _parseEpochTimestamp(value.value);
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
if (ns.isBlobSchema()) {
|
|
2372
|
-
if (typeof value === "string") {
|
|
2373
|
-
return (this.serdeContext?.base64Decoder ?? fromBase64)(value);
|
|
2374
|
-
}
|
|
2375
|
-
return value;
|
|
2376
|
-
}
|
|
2377
|
-
if (typeof value === "undefined" ||
|
|
2378
|
-
typeof value === "boolean" ||
|
|
2379
|
-
typeof value === "number" ||
|
|
2380
|
-
typeof value === "string" ||
|
|
2381
|
-
typeof value === "bigint" ||
|
|
2382
|
-
typeof value === "symbol") {
|
|
2383
|
-
return value;
|
|
2384
|
-
}
|
|
2385
|
-
else if (typeof value === "object") {
|
|
2386
|
-
if (value === null) {
|
|
2387
|
-
return null;
|
|
2388
|
-
}
|
|
2389
|
-
if ("byteLength" in value) {
|
|
2390
|
-
return value;
|
|
2391
|
-
}
|
|
2392
|
-
if (value instanceof Date) {
|
|
2393
|
-
return value;
|
|
2394
|
-
}
|
|
2395
|
-
if (ns.isDocumentSchema()) {
|
|
2396
|
-
return value;
|
|
2397
|
-
}
|
|
2398
|
-
if (ns.isListSchema()) {
|
|
2399
|
-
const newArray = [];
|
|
2400
|
-
const memberSchema = ns.getValueSchema();
|
|
2401
|
-
for (const item of value) {
|
|
2402
|
-
const itemValue = this.readValue(memberSchema, item);
|
|
2403
|
-
newArray.push(itemValue);
|
|
2404
|
-
}
|
|
2405
|
-
return newArray;
|
|
2406
|
-
}
|
|
2407
|
-
const newObject = {};
|
|
2408
|
-
if (ns.isMapSchema()) {
|
|
2409
|
-
const targetSchema = ns.getValueSchema();
|
|
2410
|
-
for (const key in value) {
|
|
2411
|
-
const itemValue = this.readValue(targetSchema, value[key]);
|
|
2412
|
-
newObject[key] = itemValue;
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
else if (ns.isStructSchema()) {
|
|
2416
|
-
const isUnion = ns.isUnionSchema();
|
|
2417
|
-
let keys;
|
|
2418
|
-
if (isUnion) {
|
|
2419
|
-
keys = new Set();
|
|
2420
|
-
for (const k in value) {
|
|
2421
|
-
if (k !== "__type") {
|
|
2422
|
-
keys.add(k);
|
|
2423
|
-
}
|
|
2424
|
-
}
|
|
2425
|
-
}
|
|
2426
|
-
for (const [key, memberSchema] of ns.structIterator()) {
|
|
2427
|
-
if (isUnion) {
|
|
2428
|
-
keys.delete(key);
|
|
2429
|
-
}
|
|
2430
|
-
if (value[key] != null) {
|
|
2431
|
-
newObject[key] = this.readValue(memberSchema, value[key]);
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
if (isUnion && keys?.size === 1) {
|
|
2435
|
-
let newObjectEmpty = true;
|
|
2436
|
-
for (const _ in newObject) {
|
|
2437
|
-
newObjectEmpty = false;
|
|
2438
|
-
break;
|
|
2439
|
-
}
|
|
2440
|
-
if (newObjectEmpty) {
|
|
2441
|
-
const k = keys.values().next().value;
|
|
2442
|
-
newObject.$unknown = [k, value[k]];
|
|
2443
|
-
}
|
|
2444
|
-
}
|
|
2445
|
-
else if (typeof value.__type === "string") {
|
|
2446
|
-
for (const k in value) {
|
|
2447
|
-
if (!(k in newObject)) {
|
|
2448
|
-
newObject[k] = value[k];
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
}
|
|
2453
|
-
else if (value instanceof NumericValue) {
|
|
2454
|
-
return value;
|
|
2455
|
-
}
|
|
2456
|
-
return newObject;
|
|
2457
|
-
}
|
|
2458
|
-
else {
|
|
2459
|
-
return value;
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
}
|
|
2463
|
-
|
|
2464
1243
|
exports.CborCodec = CborCodec;
|
|
2465
1244
|
exports.CborShapeDeserializer = CborShapeDeserializer;
|
|
2466
|
-
exports.CborShapeDeserializer2 = CborShapeDeserializer2;
|
|
2467
1245
|
exports.CborShapeSerializer = CborShapeSerializer;
|
|
2468
|
-
exports.CborShapeSerializer2 = CborShapeSerializer2;
|
|
2469
1246
|
exports.SmithyRpcV2CborProtocol = SmithyRpcV2CborProtocol;
|
|
2470
1247
|
exports.buildHttpRpcRequest = buildHttpRpcRequest;
|
|
2471
1248
|
exports.cbor = cbor;
|