@cdk8s/awscdk-resolver 0.0.375 → 0.0.377
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/.jsii +2 -2
- package/lib/resolve.js +1 -1
- package/node_modules/@smithy/abort-controller/dist-cjs/index.js +28 -80
- package/node_modules/@smithy/abort-controller/dist-es/AbortController.js +1 -3
- package/node_modules/@smithy/abort-controller/dist-es/AbortSignal.js +2 -2
- package/node_modules/@smithy/abort-controller/package.json +2 -2
- package/node_modules/@smithy/config-resolver/dist-cjs/index.js +158 -215
- package/node_modules/@smithy/config-resolver/package.json +5 -5
- package/node_modules/@smithy/core/dist-cjs/index.js +308 -412
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +957 -969
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +198 -249
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +793 -895
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +617 -811
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +584 -680
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +4 -0
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +3 -3
- package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-decode.js +18 -18
- package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-encode.js +5 -5
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +5 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js +9 -7
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +2 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeSerializer.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +3 -2
- package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js +3 -5
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js +5 -5
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/MapSchema.js +6 -5
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +16 -8
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/OperationSchema.js +6 -5
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/Schema.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js +5 -5
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js +6 -5
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/sentinels.js +14 -14
- package/node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js +2 -0
- package/node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js +1 -1
- package/node_modules/@smithy/core/dist-es/util-identity-and-auth/memoizeIdentityProvider.js +4 -2
- package/node_modules/@smithy/core/package.json +11 -11
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +340 -412
- package/node_modules/@smithy/credential-provider-imds/dist-es/error/InstanceMetadataV1FallbackError.js +2 -1
- package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +190 -238
- package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +2 -0
- package/node_modules/@smithy/fetch-http-handler/package.json +6 -6
- package/node_modules/@smithy/hash-node/dist-cjs/index.js +38 -63
- package/node_modules/@smithy/hash-node/dist-es/index.js +3 -0
- package/node_modules/@smithy/hash-node/package.json +4 -4
- package/node_modules/@smithy/invalid-dependency/dist-cjs/index.js +7 -38
- package/node_modules/@smithy/invalid-dependency/package.json +2 -2
- package/node_modules/@smithy/is-array-buffer/dist-cjs/index.js +4 -30
- package/node_modules/@smithy/is-array-buffer/package.json +1 -1
- package/node_modules/@smithy/middleware-content-length/dist-cjs/index.js +39 -64
- package/node_modules/@smithy/middleware-content-length/package.json +3 -3
- package/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +1 -1
- package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +219 -277
- package/node_modules/@smithy/middleware-endpoint/package.json +8 -8
- package/node_modules/@smithy/middleware-retry/dist-cjs/index.js +327 -380
- package/node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.browser.js +1 -1
- package/node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js +2 -2
- package/node_modules/@smithy/middleware-retry/dist-es/AdaptiveRetryStrategy.js +1 -0
- package/node_modules/@smithy/middleware-retry/dist-es/StandardRetryStrategy.js +5 -1
- package/node_modules/@smithy/middleware-retry/package.json +9 -9
- package/node_modules/@smithy/middleware-serde/dist-cjs/index.js +89 -118
- package/node_modules/@smithy/middleware-serde/package.json +3 -3
- package/node_modules/@smithy/middleware-stack/dist-cjs/index.js +274 -297
- package/node_modules/@smithy/middleware-stack/package.json +2 -2
- package/node_modules/@smithy/node-config-provider/dist-cjs/index.js +51 -98
- package/node_modules/@smithy/node-config-provider/package.json +4 -4
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +663 -771
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +5 -3
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +2 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +1 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +4 -2
- package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +3 -1
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +1 -4
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +3 -1
- package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +1 -1
- package/node_modules/@smithy/node-http-handler/package.json +5 -5
- package/node_modules/@smithy/property-provider/dist-cjs/index.js +105 -158
- package/node_modules/@smithy/property-provider/dist-es/CredentialsProviderError.js +1 -1
- package/node_modules/@smithy/property-provider/dist-es/ProviderError.js +2 -1
- package/node_modules/@smithy/property-provider/dist-es/TokenProviderError.js +1 -1
- package/node_modules/@smithy/property-provider/package.json +2 -2
- package/node_modules/@smithy/protocol-http/dist-cjs/index.js +154 -246
- package/node_modules/@smithy/protocol-http/dist-es/Field.js +3 -0
- package/node_modules/@smithy/protocol-http/dist-es/Fields.js +2 -1
- package/node_modules/@smithy/protocol-http/dist-es/httpRequest.js +11 -0
- package/node_modules/@smithy/protocol-http/dist-es/httpResponse.js +4 -0
- package/node_modules/@smithy/protocol-http/package.json +2 -2
- package/node_modules/@smithy/querystring-builder/dist-cjs/index.js +21 -47
- package/node_modules/@smithy/querystring-builder/package.json +3 -3
- package/node_modules/@smithy/querystring-parser/dist-cjs/index.js +22 -48
- package/node_modules/@smithy/querystring-parser/package.json +2 -2
- package/node_modules/@smithy/service-error-classification/dist-cjs/index.js +70 -103
- package/node_modules/@smithy/service-error-classification/package.json +2 -2
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js +171 -210
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/slurpFile.js +1 -1
- package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +525 -648
- package/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js +2 -1
- package/node_modules/@smithy/signature-v4/dist-es/SignatureV4.js +1 -1
- package/node_modules/@smithy/signature-v4/dist-es/SignatureV4Base.js +6 -0
- package/node_modules/@smithy/signature-v4/package.json +8 -8
- package/node_modules/@smithy/smithy-client/dist-cjs/index.js +554 -747
- package/node_modules/@smithy/smithy-client/dist-es/client.js +4 -1
- package/node_modules/@smithy/smithy-client/dist-es/command.js +17 -18
- package/node_modules/@smithy/smithy-client/dist-es/exceptions.js +4 -0
- package/node_modules/@smithy/smithy-client/package.json +7 -7
- package/node_modules/@smithy/types/dist-cjs/index.js +80 -133
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/@smithy/url-parser/dist-cjs/index.js +20 -46
- package/node_modules/@smithy/url-parser/package.json +3 -3
- package/node_modules/@smithy/util-base64/dist-cjs/index.js +16 -24
- package/node_modules/@smithy/util-base64/package.json +3 -3
- package/node_modules/@smithy/util-body-length-browser/dist-cjs/index.js +26 -50
- package/node_modules/@smithy/util-body-length-browser/package.json +1 -1
- package/node_modules/@smithy/util-body-length-node/dist-cjs/index.js +27 -50
- package/node_modules/@smithy/util-body-length-node/package.json +1 -1
- package/node_modules/@smithy/util-buffer-from/dist-cjs/index.js +17 -44
- package/node_modules/@smithy/util-buffer-from/package.json +2 -2
- package/node_modules/@smithy/util-config-provider/dist-cjs/index.js +26 -56
- package/node_modules/@smithy/util-config-provider/package.json +1 -1
- package/node_modules/@smithy/util-defaults-mode-browser/dist-cjs/index.js +9 -22
- package/node_modules/@smithy/util-defaults-mode-browser/dist-cjs/resolveDefaultsModeConfig.js +4 -5
- package/node_modules/@smithy/util-defaults-mode-browser/dist-cjs/resolveDefaultsModeConfig.native.js +2 -2
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js +65 -110
- package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
- package/node_modules/@smithy/util-endpoints/dist-cjs/index.js +445 -526
- package/node_modules/@smithy/util-endpoints/dist-es/cache/EndpointCache.js +3 -2
- package/node_modules/@smithy/util-endpoints/package.json +3 -3
- package/node_modules/@smithy/util-hex-encoding/dist-cjs/index.js +29 -58
- package/node_modules/@smithy/util-hex-encoding/package.json +1 -1
- package/node_modules/@smithy/util-middleware/dist-cjs/index.js +11 -40
- package/node_modules/@smithy/util-middleware/package.json +2 -2
- package/node_modules/@smithy/util-retry/dist-cjs/index.js +260 -340
- package/node_modules/@smithy/util-retry/dist-es/AdaptiveRetryStrategy.js +4 -1
- package/node_modules/@smithy/util-retry/dist-es/ConfiguredRetryStrategy.js +1 -0
- package/node_modules/@smithy/util-retry/dist-es/DefaultRateLimiter.js +17 -8
- package/node_modules/@smithy/util-retry/dist-es/StandardRetryStrategy.js +5 -3
- package/node_modules/@smithy/util-retry/package.json +3 -3
- package/node_modules/@smithy/util-stream/dist-cjs/ByteArrayCollector.js +3 -2
- package/node_modules/@smithy/util-stream/dist-cjs/checksum/ChecksumStream.js +7 -3
- package/node_modules/@smithy/util-stream/dist-cjs/checksum/createChecksumStream.browser.js +2 -3
- package/node_modules/@smithy/util-stream/dist-cjs/createBufferedReadable.js +1 -1
- package/node_modules/@smithy/util-stream/dist-cjs/createBufferedReadableStream.js +2 -3
- package/node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js +1 -2
- package/node_modules/@smithy/util-stream/dist-cjs/headStream.js +4 -8
- package/node_modules/@smithy/util-stream/dist-cjs/index.js +83 -93
- package/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js +1 -2
- package/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js +1 -2
- package/node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js +3 -7
- package/node_modules/@smithy/util-stream/dist-es/ByteArrayCollector.js +3 -2
- package/node_modules/@smithy/util-stream/dist-es/checksum/ChecksumStream.js +5 -0
- package/node_modules/@smithy/util-stream/dist-es/headStream.js +3 -6
- package/node_modules/@smithy/util-stream/package.json +8 -8
- package/node_modules/@smithy/util-uri-escape/dist-cjs/index.js +6 -40
- package/node_modules/@smithy/util-uri-escape/package.json +1 -1
- package/node_modules/@smithy/util-utf8/dist-cjs/index.js +27 -60
- package/node_modules/@smithy/util-utf8/package.json +2 -2
- package/node_modules/@smithy/util-waiter/dist-cjs/index.js +152 -189
- package/node_modules/@smithy/util-waiter/package.json +3 -3
- package/node_modules/@smithy/uuid/dist-cjs/index.js +33 -42
- package/node_modules/@smithy/uuid/package.json +1 -1
- package/package.json +5 -5
- package/node_modules/@smithy/abort-controller/dist-cjs/AbortController.js +0 -1
- package/node_modules/@smithy/abort-controller/dist-cjs/AbortSignal.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/endpointsConfig/NodeUseFipsEndpointConfigOptions.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/endpointsConfig/index.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/endpointsConfig/resolveCustomEndpointsConfig.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/endpointsConfig/resolveEndpointsConfig.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/endpointsConfig/utils/getEndpointFromRegion.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionConfig/config.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionConfig/getRealRegion.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionConfig/index.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionConfig/isFipsRegion.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionConfig/resolveRegionConfig.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/EndpointVariant.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/EndpointVariantTag.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/PartitionHash.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/RegionHash.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/getHostnameFromVariants.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/getRegionInfo.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/getResolvedHostname.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/getResolvedPartition.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/getResolvedSigningRegion.js +0 -1
- package/node_modules/@smithy/config-resolver/dist-cjs/regionInfo/index.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/config/Endpoint.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/config/EndpointConfigOptions.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/config/EndpointMode.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/config/EndpointModeConfigOptions.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/error/InstanceMetadataV1FallbackError.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/fromContainerMetadata.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/fromInstanceMetadata.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/remoteProvider/ImdsCredentials.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/remoteProvider/RemoteProviderInit.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/remoteProvider/httpRequest.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/remoteProvider/index.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/remoteProvider/retry.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/types.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/utils/getExtendedInstanceMetadataCredentials.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/utils/getInstanceMetadataEndpoint.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/utils/staticStabilityProvider.js +0 -1
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/create-request.js +0 -1
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/fetch-http-handler.js +0 -1
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/request-timeout.js +0 -1
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/stream-collector.js +0 -1
- package/node_modules/@smithy/invalid-dependency/dist-cjs/invalidFunction.js +0 -1
- package/node_modules/@smithy/invalid-dependency/dist-cjs/invalidProvider.js +0 -1
- package/node_modules/@smithy/middleware-serde/dist-cjs/deserializerMiddleware.js +0 -1
- package/node_modules/@smithy/middleware-serde/dist-cjs/serdePlugin.js +0 -1
- package/node_modules/@smithy/middleware-serde/dist-cjs/serializerMiddleware.js +0 -1
- package/node_modules/@smithy/middleware-stack/dist-cjs/MiddlewareStack.js +0 -1
- package/node_modules/@smithy/middleware-stack/dist-cjs/types.js +0 -1
- package/node_modules/@smithy/node-config-provider/dist-cjs/configLoader.js +0 -1
- package/node_modules/@smithy/node-config-provider/dist-cjs/fromEnv.js +0 -1
- package/node_modules/@smithy/node-config-provider/dist-cjs/fromSharedConfigFiles.js +0 -1
- package/node_modules/@smithy/node-config-provider/dist-cjs/fromStatic.js +0 -1
- package/node_modules/@smithy/node-config-provider/dist-cjs/getSelectorName.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/constants.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/get-transformed-headers.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/node-http-handler.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/node-http2-connection-manager.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/node-http2-connection-pool.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/node-http2-handler.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/readable.mock.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/server.mock.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/set-connection-timeout.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/set-socket-keep-alive.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/set-socket-timeout.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/stream-collector/collector.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/stream-collector/index.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/stream-collector/readable.mock.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/timing.js +0 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/write-request-body.js +0 -1
- package/node_modules/@smithy/property-provider/dist-cjs/CredentialsProviderError.js +0 -1
- package/node_modules/@smithy/property-provider/dist-cjs/ProviderError.js +0 -1
- package/node_modules/@smithy/property-provider/dist-cjs/TokenProviderError.js +0 -1
- package/node_modules/@smithy/property-provider/dist-cjs/chain.js +0 -1
- package/node_modules/@smithy/property-provider/dist-cjs/fromStatic.js +0 -1
- package/node_modules/@smithy/property-provider/dist-cjs/memoize.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/Field.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/Fields.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/extensions/httpExtensionConfiguration.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/extensions/index.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/httpHandler.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/httpRequest.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/httpResponse.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/isValidHostname.js +0 -1
- package/node_modules/@smithy/protocol-http/dist-cjs/types.js +0 -1
- package/node_modules/@smithy/service-error-classification/dist-cjs/constants.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/externalDataInterceptor.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getConfigData.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getConfigFilepath.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getCredentialsFilepath.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getProfileName.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSsoSessionData.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/loadSharedConfigFiles.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/loadSsoSessionData.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/mergeConfigFiles.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/parseIni.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/parseKnownFiles.js +0 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-cjs/types.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/HeaderFormatter.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/SignatureV4.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/SignatureV4Base.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/constants.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/credentialDerivation.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/getCanonicalHeaders.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/getCanonicalQuery.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/getPayloadHash.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/headerUtil.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/moveHeadersToQuery.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/prepareRequest.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/signature-v4a-container.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/suite.fixture.js +0 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/utilDate.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/abort-handler.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/abort.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/auth/HttpApiKeyAuth.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/auth/HttpAuthScheme.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/auth/HttpAuthSchemeProvider.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/auth/HttpSigner.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/auth/IdentityProviderConfig.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/auth/auth.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/auth/index.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/blob/blob-payload-input-types.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/checksum.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/client.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/command.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/connection/config.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/connection/index.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/connection/manager.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/connection/pool.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/crypto.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/downlevel-ts3.4/transform/type-transform.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/encode.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/endpoint.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/endpoints/EndpointRuleObject.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/endpoints/ErrorRuleObject.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/endpoints/RuleSetObject.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/endpoints/TreeRuleObject.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/endpoints/index.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/endpoints/shared.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/eventStream.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/extensions/checksum.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/extensions/defaultClientConfiguration.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/extensions/defaultExtensionConfiguration.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/extensions/index.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/extensions/retry.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/externals-check/browser-externals-check.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/feature-ids.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/http/httpHandlerInitialization.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/http.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/identity/apiKeyIdentity.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/identity/awsCredentialIdentity.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/identity/identity.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/identity/index.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/identity/tokenIdentity.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/logger.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/middleware.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/pagination.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/profile.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/response.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/retry.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/schema/schema.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/schema/sentinels.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/schema/traits.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/serde.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/shapes.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/signature.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/stream.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/streaming-payload/streaming-blob-common-types.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/streaming-payload/streaming-blob-payload-input-types.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/streaming-payload/streaming-blob-payload-output-types.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/transfer.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/transform/client-method-transforms.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/transform/client-payload-blob-type-narrow.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/transform/exact.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/transform/mutable.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/transform/no-undefined.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/transform/type-transform.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/uri.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/util.js +0 -1
- package/node_modules/@smithy/types/dist-cjs/waiter.js +0 -1
- package/node_modules/@smithy/util-body-length-browser/dist-cjs/calculateBodyLength.js +0 -1
- package/node_modules/@smithy/util-body-length-node/dist-cjs/calculateBodyLength.js +0 -1
- package/node_modules/@smithy/util-config-provider/dist-cjs/booleanSelector.js +0 -1
- package/node_modules/@smithy/util-config-provider/dist-cjs/numberSelector.js +0 -1
- package/node_modules/@smithy/util-config-provider/dist-cjs/types.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/cache/EndpointCache.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/debug/debugId.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/debug/index.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/debug/toDebugString.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/getEndpointUrlConfig.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/booleanEquals.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/getAttr.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/getAttrPathList.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/index.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/isIpAddress.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/isSet.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/isValidHostLabel.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/not.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/parseURL.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/stringEquals.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/substring.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/lib/uriEncode.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/resolveEndpoint.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointError.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointFunctions.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/types/EndpointRuleObject.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/types/ErrorRuleObject.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/types/RuleSetObject.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/types/TreeRuleObject.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/types/index.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/types/shared.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/callFunction.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/customEndpointFunctions.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/endpointFunctions.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateCondition.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateConditions.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateEndpointRule.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateErrorRule.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateExpression.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateRules.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateTemplate.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/evaluateTreeRule.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointHeaders.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointProperties.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointProperty.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/getEndpointUrl.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/getReferenceValue.js +0 -1
- package/node_modules/@smithy/util-endpoints/dist-cjs/utils/index.js +0 -1
- package/node_modules/@smithy/util-middleware/dist-cjs/getSmithyContext.js +0 -1
- package/node_modules/@smithy/util-middleware/dist-cjs/normalizeProvider.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/AdaptiveRetryStrategy.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/ConfiguredRetryStrategy.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/DefaultRateLimiter.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/StandardRetryStrategy.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/config.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/constants.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/defaultRetryBackoffStrategy.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/defaultRetryToken.js +0 -1
- package/node_modules/@smithy/util-retry/dist-cjs/types.js +0 -1
- package/node_modules/@smithy/util-stream/dist-cjs/blob/Uint8ArrayBlobAdapter.js +0 -1
- package/node_modules/@smithy/util-stream/dist-cjs/blob/transforms.js +0 -1
- package/node_modules/@smithy/util-uri-escape/dist-cjs/escape-uri-path.js +0 -1
- package/node_modules/@smithy/util-uri-escape/dist-cjs/escape-uri.js +0 -1
- package/node_modules/@smithy/util-utf8/dist-cjs/fromUtf8.browser.js +0 -1
- package/node_modules/@smithy/util-utf8/dist-cjs/fromUtf8.js +0 -1
- package/node_modules/@smithy/util-utf8/dist-cjs/toUint8Array.js +0 -1
- package/node_modules/@smithy/util-utf8/dist-cjs/toUtf8.browser.js +0 -1
- package/node_modules/@smithy/util-utf8/dist-cjs/toUtf8.js +0 -1
- package/node_modules/@smithy/util-waiter/dist-cjs/createWaiter.js +0 -1
- package/node_modules/@smithy/util-waiter/dist-cjs/poller.js +0 -1
- package/node_modules/@smithy/util-waiter/dist-cjs/utils/index.js +0 -1
- package/node_modules/@smithy/util-waiter/dist-cjs/utils/sleep.js +0 -1
- package/node_modules/@smithy/util-waiter/dist-cjs/utils/validate.js +0 -1
- package/node_modules/@smithy/util-waiter/dist-cjs/waiter.js +0 -1
- package/node_modules/@smithy/uuid/dist-cjs/randomUUID.browser.js +0 -1
- package/node_modules/@smithy/uuid/dist-cjs/v4.js +0 -1
|
@@ -1,1072 +1,1060 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/submodules/cbor/index.ts
|
|
20
|
-
var index_exports = {};
|
|
21
|
-
__export(index_exports, {
|
|
22
|
-
CborCodec: () => CborCodec,
|
|
23
|
-
CborShapeDeserializer: () => CborShapeDeserializer,
|
|
24
|
-
CborShapeSerializer: () => CborShapeSerializer,
|
|
25
|
-
SmithyRpcV2CborProtocol: () => SmithyRpcV2CborProtocol,
|
|
26
|
-
buildHttpRpcRequest: () => buildHttpRpcRequest,
|
|
27
|
-
cbor: () => cbor,
|
|
28
|
-
checkCborResponse: () => checkCborResponse,
|
|
29
|
-
dateToTag: () => dateToTag,
|
|
30
|
-
loadSmithyRpcV2CborErrorCode: () => loadSmithyRpcV2CborErrorCode,
|
|
31
|
-
parseCborBody: () => parseCborBody,
|
|
32
|
-
parseCborErrorBody: () => parseCborErrorBody,
|
|
33
|
-
tag: () => tag,
|
|
34
|
-
tagSymbol: () => tagSymbol
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(index_exports);
|
|
1
|
+
'use strict';
|
|
37
2
|
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
var
|
|
3
|
+
var serde = require('@smithy/core/serde');
|
|
4
|
+
var utilUtf8 = require('@smithy/util-utf8');
|
|
5
|
+
var protocols = require('@smithy/core/protocols');
|
|
6
|
+
var protocolHttp = require('@smithy/protocol-http');
|
|
7
|
+
var utilBodyLengthBrowser = require('@smithy/util-body-length-browser');
|
|
8
|
+
var schema = require('@smithy/core/schema');
|
|
9
|
+
var utilMiddleware = require('@smithy/util-middleware');
|
|
10
|
+
var utilBase64 = require('@smithy/util-base64');
|
|
41
11
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var minorIndefinite = 31;
|
|
12
|
+
const majorUint64 = 0;
|
|
13
|
+
const majorNegativeInt64 = 1;
|
|
14
|
+
const majorUnstructuredByteString = 2;
|
|
15
|
+
const majorUtf8String = 3;
|
|
16
|
+
const majorList = 4;
|
|
17
|
+
const majorMap = 5;
|
|
18
|
+
const majorTag = 6;
|
|
19
|
+
const majorSpecial = 7;
|
|
20
|
+
const specialFalse = 20;
|
|
21
|
+
const specialTrue = 21;
|
|
22
|
+
const specialNull = 22;
|
|
23
|
+
const specialUndefined = 23;
|
|
24
|
+
const extendedOneByte = 24;
|
|
25
|
+
const extendedFloat16 = 25;
|
|
26
|
+
const extendedFloat32 = 26;
|
|
27
|
+
const extendedFloat64 = 27;
|
|
28
|
+
const minorIndefinite = 31;
|
|
60
29
|
function alloc(size) {
|
|
61
|
-
|
|
30
|
+
return typeof Buffer !== "undefined" ? Buffer.alloc(size) : new Uint8Array(size);
|
|
62
31
|
}
|
|
63
|
-
|
|
64
|
-
function tag(
|
|
65
|
-
|
|
66
|
-
|
|
32
|
+
const tagSymbol = Symbol("@smithy/core/cbor::tagSymbol");
|
|
33
|
+
function tag(data) {
|
|
34
|
+
data[tagSymbol] = true;
|
|
35
|
+
return data;
|
|
67
36
|
}
|
|
68
37
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var _offset = 0;
|
|
38
|
+
const USE_TEXT_DECODER = typeof TextDecoder !== "undefined";
|
|
39
|
+
const USE_BUFFER$1 = typeof Buffer !== "undefined";
|
|
40
|
+
let payload = alloc(0);
|
|
41
|
+
let dataView$1 = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
42
|
+
const textDecoder = USE_TEXT_DECODER ? new TextDecoder() : null;
|
|
43
|
+
let _offset = 0;
|
|
76
44
|
function setPayload(bytes) {
|
|
77
|
-
|
|
78
|
-
|
|
45
|
+
payload = bytes;
|
|
46
|
+
dataView$1 = new DataView(payload.buffer, payload.byteOffset, payload.byteLength);
|
|
79
47
|
}
|
|
80
48
|
function decode(at, to) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} else {
|
|
96
|
-
switch (minor) {
|
|
97
|
-
case extendedOneByte:
|
|
98
|
-
case extendedFloat16:
|
|
99
|
-
case extendedFloat32:
|
|
100
|
-
case extendedFloat64:
|
|
101
|
-
const countLength = minorValueToArgumentLength[minor];
|
|
102
|
-
const countOffset = countLength + 1;
|
|
103
|
-
offset = countOffset;
|
|
104
|
-
if (to - at < countOffset) {
|
|
105
|
-
throw new Error(`countLength ${countLength} greater than remaining buf len.`);
|
|
49
|
+
if (at >= to) {
|
|
50
|
+
throw new Error("unexpected end of (decode) payload.");
|
|
51
|
+
}
|
|
52
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
53
|
+
const minor = payload[at] & 0b0001_1111;
|
|
54
|
+
switch (major) {
|
|
55
|
+
case majorUint64:
|
|
56
|
+
case majorNegativeInt64:
|
|
57
|
+
case majorTag:
|
|
58
|
+
let unsignedInt;
|
|
59
|
+
let offset;
|
|
60
|
+
if (minor < 24) {
|
|
61
|
+
unsignedInt = minor;
|
|
62
|
+
offset = 1;
|
|
106
63
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
64
|
+
else {
|
|
65
|
+
switch (minor) {
|
|
66
|
+
case extendedOneByte:
|
|
67
|
+
case extendedFloat16:
|
|
68
|
+
case extendedFloat32:
|
|
69
|
+
case extendedFloat64:
|
|
70
|
+
const countLength = minorValueToArgumentLength[minor];
|
|
71
|
+
const countOffset = (countLength + 1);
|
|
72
|
+
offset = countOffset;
|
|
73
|
+
if (to - at < countOffset) {
|
|
74
|
+
throw new Error(`countLength ${countLength} greater than remaining buf len.`);
|
|
75
|
+
}
|
|
76
|
+
const countIndex = at + 1;
|
|
77
|
+
if (countLength === 1) {
|
|
78
|
+
unsignedInt = payload[countIndex];
|
|
79
|
+
}
|
|
80
|
+
else if (countLength === 2) {
|
|
81
|
+
unsignedInt = dataView$1.getUint16(countIndex);
|
|
82
|
+
}
|
|
83
|
+
else if (countLength === 4) {
|
|
84
|
+
unsignedInt = dataView$1.getUint32(countIndex);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
unsignedInt = dataView$1.getBigUint64(countIndex);
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
default:
|
|
91
|
+
throw new Error(`unexpected minor value ${minor}.`);
|
|
92
|
+
}
|
|
116
93
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
94
|
+
if (major === majorUint64) {
|
|
95
|
+
_offset = offset;
|
|
96
|
+
return castBigInt(unsignedInt);
|
|
97
|
+
}
|
|
98
|
+
else if (major === majorNegativeInt64) {
|
|
99
|
+
let negativeInt;
|
|
100
|
+
if (typeof unsignedInt === "bigint") {
|
|
101
|
+
negativeInt = BigInt(-1) - unsignedInt;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
negativeInt = -1 - unsignedInt;
|
|
105
|
+
}
|
|
106
|
+
_offset = offset;
|
|
107
|
+
return castBigInt(negativeInt);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
if (minor === 2 || minor === 3) {
|
|
111
|
+
const length = decodeCount(at + offset, to);
|
|
112
|
+
let b = BigInt(0);
|
|
113
|
+
const start = at + offset + _offset;
|
|
114
|
+
for (let i = start; i < start + length; ++i) {
|
|
115
|
+
b = (b << BigInt(8)) | BigInt(payload[i]);
|
|
116
|
+
}
|
|
117
|
+
_offset = offset + _offset + length;
|
|
118
|
+
return minor === 3 ? -b - BigInt(1) : b;
|
|
119
|
+
}
|
|
120
|
+
else if (minor === 4) {
|
|
121
|
+
const decimalFraction = decode(at + offset, to);
|
|
122
|
+
const [exponent, mantissa] = decimalFraction;
|
|
123
|
+
const normalizer = mantissa < 0 ? -1 : 1;
|
|
124
|
+
const mantissaStr = "0".repeat(Math.abs(exponent) + 1) + String(BigInt(normalizer) * BigInt(mantissa));
|
|
125
|
+
let numericString;
|
|
126
|
+
const sign = mantissa < 0 ? "-" : "";
|
|
127
|
+
numericString =
|
|
128
|
+
exponent === 0
|
|
129
|
+
? mantissaStr
|
|
130
|
+
: mantissaStr.slice(0, mantissaStr.length + exponent) + "." + mantissaStr.slice(exponent);
|
|
131
|
+
numericString = numericString.replace(/^0+/g, "");
|
|
132
|
+
if (numericString === "") {
|
|
133
|
+
numericString = "0";
|
|
134
|
+
}
|
|
135
|
+
if (numericString[0] === ".") {
|
|
136
|
+
numericString = "0" + numericString;
|
|
137
|
+
}
|
|
138
|
+
numericString = sign + numericString;
|
|
139
|
+
_offset = offset + _offset;
|
|
140
|
+
return serde.nv(numericString);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
const value = decode(at + offset, to);
|
|
144
|
+
const valueOffset = _offset;
|
|
145
|
+
_offset = offset + valueOffset;
|
|
146
|
+
return tag({ tag: castBigInt(unsignedInt), value });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
case majorUtf8String:
|
|
150
|
+
case majorMap:
|
|
151
|
+
case majorList:
|
|
152
|
+
case majorUnstructuredByteString:
|
|
153
|
+
if (minor === minorIndefinite) {
|
|
154
|
+
switch (major) {
|
|
155
|
+
case majorUtf8String:
|
|
156
|
+
return decodeUtf8StringIndefinite(at, to);
|
|
157
|
+
case majorMap:
|
|
158
|
+
return decodeMapIndefinite(at, to);
|
|
159
|
+
case majorList:
|
|
160
|
+
return decodeListIndefinite(at, to);
|
|
161
|
+
case majorUnstructuredByteString:
|
|
162
|
+
return decodeUnstructuredByteStringIndefinite(at, to);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
switch (major) {
|
|
167
|
+
case majorUtf8String:
|
|
168
|
+
return decodeUtf8String(at, to);
|
|
169
|
+
case majorMap:
|
|
170
|
+
return decodeMap(at, to);
|
|
171
|
+
case majorList:
|
|
172
|
+
return decodeList(at, to);
|
|
173
|
+
case majorUnstructuredByteString:
|
|
174
|
+
return decodeUnstructuredByteString(at, to);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
default:
|
|
178
|
+
return decodeSpecial(at, to);
|
|
179
|
+
}
|
|
199
180
|
}
|
|
200
181
|
function bytesToUtf8(bytes, at, to) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
182
|
+
if (USE_BUFFER$1 && bytes.constructor?.name === "Buffer") {
|
|
183
|
+
return bytes.toString("utf-8", at, to);
|
|
184
|
+
}
|
|
185
|
+
if (textDecoder) {
|
|
186
|
+
return textDecoder.decode(bytes.subarray(at, to));
|
|
187
|
+
}
|
|
188
|
+
return utilUtf8.toUtf8(bytes.subarray(at, to));
|
|
208
189
|
}
|
|
209
190
|
function demote(bigInteger) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
191
|
+
const num = Number(bigInteger);
|
|
192
|
+
if (num < Number.MIN_SAFE_INTEGER || Number.MAX_SAFE_INTEGER < num) {
|
|
193
|
+
console.warn(new Error(`@smithy/core/cbor - truncating BigInt(${bigInteger}) to ${num} with loss of precision.`));
|
|
194
|
+
}
|
|
195
|
+
return num;
|
|
215
196
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
197
|
+
const minorValueToArgumentLength = {
|
|
198
|
+
[extendedOneByte]: 1,
|
|
199
|
+
[extendedFloat16]: 2,
|
|
200
|
+
[extendedFloat32]: 4,
|
|
201
|
+
[extendedFloat64]: 8,
|
|
221
202
|
};
|
|
222
203
|
function bytesToFloat16(a, b) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
204
|
+
const sign = a >> 7;
|
|
205
|
+
const exponent = (a & 0b0111_1100) >> 2;
|
|
206
|
+
const fraction = ((a & 0b0000_0011) << 8) | b;
|
|
207
|
+
const scalar = sign === 0 ? 1 : -1;
|
|
208
|
+
let exponentComponent;
|
|
209
|
+
let summation;
|
|
210
|
+
if (exponent === 0b00000) {
|
|
211
|
+
if (fraction === 0b00000_00000) {
|
|
212
|
+
return 0;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
exponentComponent = Math.pow(2, 1 - 15);
|
|
216
|
+
summation = 0;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else if (exponent === 0b11111) {
|
|
220
|
+
if (fraction === 0b00000_00000) {
|
|
221
|
+
return scalar * Infinity;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
return NaN;
|
|
225
|
+
}
|
|
235
226
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
} else {
|
|
240
|
-
return NaN;
|
|
227
|
+
else {
|
|
228
|
+
exponentComponent = Math.pow(2, exponent - 15);
|
|
229
|
+
summation = 1;
|
|
241
230
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
summation = 1;
|
|
245
|
-
}
|
|
246
|
-
summation += fraction / 1024;
|
|
247
|
-
return scalar * (exponentComponent * summation);
|
|
231
|
+
summation += fraction / 1024;
|
|
232
|
+
return scalar * (exponentComponent * summation);
|
|
248
233
|
}
|
|
249
234
|
function decodeCount(at, to) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
if (minor === extendedOneByte || minor === extendedFloat16 || minor === extendedFloat32 || minor === extendedFloat64) {
|
|
256
|
-
const countLength = minorValueToArgumentLength[minor];
|
|
257
|
-
_offset = countLength + 1;
|
|
258
|
-
if (to - at < _offset) {
|
|
259
|
-
throw new Error(`countLength ${countLength} greater than remaining buf len.`);
|
|
235
|
+
const minor = payload[at] & 0b0001_1111;
|
|
236
|
+
if (minor < 24) {
|
|
237
|
+
_offset = 1;
|
|
238
|
+
return minor;
|
|
260
239
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
240
|
+
if (minor === extendedOneByte ||
|
|
241
|
+
minor === extendedFloat16 ||
|
|
242
|
+
minor === extendedFloat32 ||
|
|
243
|
+
minor === extendedFloat64) {
|
|
244
|
+
const countLength = minorValueToArgumentLength[minor];
|
|
245
|
+
_offset = (countLength + 1);
|
|
246
|
+
if (to - at < _offset) {
|
|
247
|
+
throw new Error(`countLength ${countLength} greater than remaining buf len.`);
|
|
248
|
+
}
|
|
249
|
+
const countIndex = at + 1;
|
|
250
|
+
if (countLength === 1) {
|
|
251
|
+
return payload[countIndex];
|
|
252
|
+
}
|
|
253
|
+
else if (countLength === 2) {
|
|
254
|
+
return dataView$1.getUint16(countIndex);
|
|
255
|
+
}
|
|
256
|
+
else if (countLength === 4) {
|
|
257
|
+
return dataView$1.getUint32(countIndex);
|
|
258
|
+
}
|
|
259
|
+
return demote(dataView$1.getBigUint64(countIndex));
|
|
268
260
|
}
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
throw new Error(`unexpected minor value ${minor}.`);
|
|
261
|
+
throw new Error(`unexpected minor value ${minor}.`);
|
|
272
262
|
}
|
|
273
263
|
function decodeUtf8String(at, to) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
264
|
+
const length = decodeCount(at, to);
|
|
265
|
+
const offset = _offset;
|
|
266
|
+
at += offset;
|
|
267
|
+
if (to - at < length) {
|
|
268
|
+
throw new Error(`string len ${length} greater than remaining buf len.`);
|
|
269
|
+
}
|
|
270
|
+
const value = bytesToUtf8(payload, at, at + length);
|
|
271
|
+
_offset = offset + length;
|
|
272
|
+
return value;
|
|
283
273
|
}
|
|
284
274
|
function decodeUtf8StringIndefinite(at, to) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
275
|
+
at += 1;
|
|
276
|
+
const vector = [];
|
|
277
|
+
for (const base = at; at < to;) {
|
|
278
|
+
if (payload[at] === 0b1111_1111) {
|
|
279
|
+
const data = alloc(vector.length);
|
|
280
|
+
data.set(vector, 0);
|
|
281
|
+
_offset = at - base + 2;
|
|
282
|
+
return bytesToUtf8(data, 0, data.length);
|
|
283
|
+
}
|
|
284
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
285
|
+
const minor = payload[at] & 0b0001_1111;
|
|
286
|
+
if (major !== majorUtf8String) {
|
|
287
|
+
throw new Error(`unexpected major type ${major} in indefinite string.`);
|
|
288
|
+
}
|
|
289
|
+
if (minor === minorIndefinite) {
|
|
290
|
+
throw new Error("nested indefinite string.");
|
|
291
|
+
}
|
|
292
|
+
const bytes = decodeUnstructuredByteString(at, to);
|
|
293
|
+
const length = _offset;
|
|
294
|
+
at += length;
|
|
295
|
+
for (let i = 0; i < bytes.length; ++i) {
|
|
296
|
+
vector.push(bytes[i]);
|
|
297
|
+
}
|
|
307
298
|
}
|
|
308
|
-
|
|
309
|
-
throw new Error("expected break marker.");
|
|
299
|
+
throw new Error("expected break marker.");
|
|
310
300
|
}
|
|
311
301
|
function decodeUnstructuredByteString(at, to) {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
302
|
+
const length = decodeCount(at, to);
|
|
303
|
+
const offset = _offset;
|
|
304
|
+
at += offset;
|
|
305
|
+
if (to - at < length) {
|
|
306
|
+
throw new Error(`unstructured byte string len ${length} greater than remaining buf len.`);
|
|
307
|
+
}
|
|
308
|
+
const value = payload.subarray(at, at + length);
|
|
309
|
+
_offset = offset + length;
|
|
310
|
+
return value;
|
|
321
311
|
}
|
|
322
312
|
function decodeUnstructuredByteStringIndefinite(at, to) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
313
|
+
at += 1;
|
|
314
|
+
const vector = [];
|
|
315
|
+
for (const base = at; at < to;) {
|
|
316
|
+
if (payload[at] === 0b1111_1111) {
|
|
317
|
+
const data = alloc(vector.length);
|
|
318
|
+
data.set(vector, 0);
|
|
319
|
+
_offset = at - base + 2;
|
|
320
|
+
return data;
|
|
321
|
+
}
|
|
322
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
323
|
+
const minor = payload[at] & 0b0001_1111;
|
|
324
|
+
if (major !== majorUnstructuredByteString) {
|
|
325
|
+
throw new Error(`unexpected major type ${major} in indefinite string.`);
|
|
326
|
+
}
|
|
327
|
+
if (minor === minorIndefinite) {
|
|
328
|
+
throw new Error("nested indefinite string.");
|
|
329
|
+
}
|
|
330
|
+
const bytes = decodeUnstructuredByteString(at, to);
|
|
331
|
+
const length = _offset;
|
|
332
|
+
at += length;
|
|
333
|
+
for (let i = 0; i < bytes.length; ++i) {
|
|
334
|
+
vector.push(bytes[i]);
|
|
335
|
+
}
|
|
345
336
|
}
|
|
346
|
-
|
|
347
|
-
throw new Error("expected break marker.");
|
|
337
|
+
throw new Error("expected break marker.");
|
|
348
338
|
}
|
|
349
339
|
function decodeList(at, to) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
340
|
+
const listDataLength = decodeCount(at, to);
|
|
341
|
+
const offset = _offset;
|
|
342
|
+
at += offset;
|
|
343
|
+
const base = at;
|
|
344
|
+
const list = Array(listDataLength);
|
|
345
|
+
for (let i = 0; i < listDataLength; ++i) {
|
|
346
|
+
const item = decode(at, to);
|
|
347
|
+
const itemOffset = _offset;
|
|
348
|
+
list[i] = item;
|
|
349
|
+
at += itemOffset;
|
|
350
|
+
}
|
|
351
|
+
_offset = offset + (at - base);
|
|
352
|
+
return list;
|
|
363
353
|
}
|
|
364
354
|
function decodeListIndefinite(at, to) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
355
|
+
at += 1;
|
|
356
|
+
const list = [];
|
|
357
|
+
for (const base = at; at < to;) {
|
|
358
|
+
if (payload[at] === 0b1111_1111) {
|
|
359
|
+
_offset = at - base + 2;
|
|
360
|
+
return list;
|
|
361
|
+
}
|
|
362
|
+
const item = decode(at, to);
|
|
363
|
+
const n = _offset;
|
|
364
|
+
at += n;
|
|
365
|
+
list.push(item);
|
|
371
366
|
}
|
|
372
|
-
|
|
373
|
-
const n = _offset;
|
|
374
|
-
at += n;
|
|
375
|
-
list.push(item);
|
|
376
|
-
}
|
|
377
|
-
throw new Error("expected break marker.");
|
|
367
|
+
throw new Error("expected break marker.");
|
|
378
368
|
}
|
|
379
369
|
function decodeMap(at, to) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
370
|
+
const mapDataLength = decodeCount(at, to);
|
|
371
|
+
const offset = _offset;
|
|
372
|
+
at += offset;
|
|
373
|
+
const base = at;
|
|
374
|
+
const map = {};
|
|
375
|
+
for (let i = 0; i < mapDataLength; ++i) {
|
|
376
|
+
if (at >= to) {
|
|
377
|
+
throw new Error("unexpected end of map payload.");
|
|
378
|
+
}
|
|
379
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
380
|
+
if (major !== majorUtf8String) {
|
|
381
|
+
throw new Error(`unexpected major type ${major} for map key at index ${at}.`);
|
|
382
|
+
}
|
|
383
|
+
const key = decode(at, to);
|
|
384
|
+
at += _offset;
|
|
385
|
+
const value = decode(at, to);
|
|
386
|
+
at += _offset;
|
|
387
|
+
map[key] = value;
|
|
392
388
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
const value = decode(at, to);
|
|
396
|
-
at += _offset;
|
|
397
|
-
map[key] = value;
|
|
398
|
-
}
|
|
399
|
-
_offset = offset + (at - base);
|
|
400
|
-
return map;
|
|
389
|
+
_offset = offset + (at - base);
|
|
390
|
+
return map;
|
|
401
391
|
}
|
|
402
392
|
function decodeMapIndefinite(at, to) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
393
|
+
at += 1;
|
|
394
|
+
const base = at;
|
|
395
|
+
const map = {};
|
|
396
|
+
for (; at < to;) {
|
|
397
|
+
if (at >= to) {
|
|
398
|
+
throw new Error("unexpected end of map payload.");
|
|
399
|
+
}
|
|
400
|
+
if (payload[at] === 0b1111_1111) {
|
|
401
|
+
_offset = at - base + 2;
|
|
402
|
+
return map;
|
|
403
|
+
}
|
|
404
|
+
const major = (payload[at] & 0b1110_0000) >> 5;
|
|
405
|
+
if (major !== majorUtf8String) {
|
|
406
|
+
throw new Error(`unexpected major type ${major} for map key.`);
|
|
407
|
+
}
|
|
408
|
+
const key = decode(at, to);
|
|
409
|
+
at += _offset;
|
|
410
|
+
const value = decode(at, to);
|
|
411
|
+
at += _offset;
|
|
412
|
+
map[key] = value;
|
|
417
413
|
}
|
|
418
|
-
|
|
419
|
-
at += _offset;
|
|
420
|
-
const value = decode(at, to);
|
|
421
|
-
at += _offset;
|
|
422
|
-
map[key] = value;
|
|
423
|
-
}
|
|
424
|
-
throw new Error("expected break marker.");
|
|
414
|
+
throw new Error("expected break marker.");
|
|
425
415
|
}
|
|
426
416
|
function decodeSpecial(at, to) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
417
|
+
const minor = payload[at] & 0b0001_1111;
|
|
418
|
+
switch (minor) {
|
|
419
|
+
case specialTrue:
|
|
420
|
+
case specialFalse:
|
|
421
|
+
_offset = 1;
|
|
422
|
+
return minor === specialTrue;
|
|
423
|
+
case specialNull:
|
|
424
|
+
_offset = 1;
|
|
425
|
+
return null;
|
|
426
|
+
case specialUndefined:
|
|
427
|
+
_offset = 1;
|
|
428
|
+
return null;
|
|
429
|
+
case extendedFloat16:
|
|
430
|
+
if (to - at < 3) {
|
|
431
|
+
throw new Error("incomplete float16 at end of buf.");
|
|
432
|
+
}
|
|
433
|
+
_offset = 3;
|
|
434
|
+
return bytesToFloat16(payload[at + 1], payload[at + 2]);
|
|
435
|
+
case extendedFloat32:
|
|
436
|
+
if (to - at < 5) {
|
|
437
|
+
throw new Error("incomplete float32 at end of buf.");
|
|
438
|
+
}
|
|
439
|
+
_offset = 5;
|
|
440
|
+
return dataView$1.getFloat32(at + 1);
|
|
441
|
+
case extendedFloat64:
|
|
442
|
+
if (to - at < 9) {
|
|
443
|
+
throw new Error("incomplete float64 at end of buf.");
|
|
444
|
+
}
|
|
445
|
+
_offset = 9;
|
|
446
|
+
return dataView$1.getFloat64(at + 1);
|
|
447
|
+
default:
|
|
448
|
+
throw new Error(`unexpected minor value ${minor}.`);
|
|
449
|
+
}
|
|
460
450
|
}
|
|
461
451
|
function castBigInt(bigInt) {
|
|
462
|
-
|
|
452
|
+
if (typeof bigInt === "number") {
|
|
453
|
+
return bigInt;
|
|
454
|
+
}
|
|
455
|
+
const num = Number(bigInt);
|
|
456
|
+
if (Number.MIN_SAFE_INTEGER <= num && num <= Number.MAX_SAFE_INTEGER) {
|
|
457
|
+
return num;
|
|
458
|
+
}
|
|
463
459
|
return bigInt;
|
|
464
|
-
}
|
|
465
|
-
const num = Number(bigInt);
|
|
466
|
-
if (Number.MIN_SAFE_INTEGER <= num && num <= Number.MAX_SAFE_INTEGER) {
|
|
467
|
-
return num;
|
|
468
|
-
}
|
|
469
|
-
return bigInt;
|
|
470
460
|
}
|
|
471
461
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
var data = alloc(initialSize);
|
|
478
|
-
var dataView2 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
479
|
-
var cursor = 0;
|
|
462
|
+
const USE_BUFFER = typeof Buffer !== "undefined";
|
|
463
|
+
const initialSize = 2048;
|
|
464
|
+
let data = alloc(initialSize);
|
|
465
|
+
let dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
466
|
+
let cursor = 0;
|
|
480
467
|
function ensureSpace(bytes) {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
468
|
+
const remaining = data.byteLength - cursor;
|
|
469
|
+
if (remaining < bytes) {
|
|
470
|
+
if (cursor < 16_000_000) {
|
|
471
|
+
resize(Math.max(data.byteLength * 4, data.byteLength + bytes));
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
resize(data.byteLength + bytes + 16_000_000);
|
|
475
|
+
}
|
|
487
476
|
}
|
|
488
|
-
}
|
|
489
477
|
}
|
|
490
478
|
function toUint8Array() {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
479
|
+
const out = alloc(cursor);
|
|
480
|
+
out.set(data.subarray(0, cursor), 0);
|
|
481
|
+
cursor = 0;
|
|
482
|
+
return out;
|
|
495
483
|
}
|
|
496
484
|
function resize(size) {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
485
|
+
const old = data;
|
|
486
|
+
data = alloc(size);
|
|
487
|
+
if (old) {
|
|
488
|
+
if (old.copy) {
|
|
489
|
+
old.copy(data, 0, 0, old.byteLength);
|
|
490
|
+
}
|
|
491
|
+
else {
|
|
492
|
+
data.set(old, 0);
|
|
493
|
+
}
|
|
504
494
|
}
|
|
505
|
-
|
|
506
|
-
dataView2 = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
495
|
+
dataView = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
507
496
|
}
|
|
508
497
|
function encodeHeader(major, value) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
498
|
+
if (value < 24) {
|
|
499
|
+
data[cursor++] = (major << 5) | value;
|
|
500
|
+
}
|
|
501
|
+
else if (value < 1 << 8) {
|
|
502
|
+
data[cursor++] = (major << 5) | 24;
|
|
503
|
+
data[cursor++] = value;
|
|
504
|
+
}
|
|
505
|
+
else if (value < 1 << 16) {
|
|
506
|
+
data[cursor++] = (major << 5) | extendedFloat16;
|
|
507
|
+
dataView.setUint16(cursor, value);
|
|
508
|
+
cursor += 2;
|
|
509
|
+
}
|
|
510
|
+
else if (value < 2 ** 32) {
|
|
511
|
+
data[cursor++] = (major << 5) | extendedFloat32;
|
|
512
|
+
dataView.setUint32(cursor, value);
|
|
513
|
+
cursor += 4;
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
data[cursor++] = (major << 5) | extendedFloat64;
|
|
517
|
+
dataView.setBigUint64(cursor, typeof value === "bigint" ? value : BigInt(value));
|
|
518
|
+
cursor += 8;
|
|
519
|
+
}
|
|
527
520
|
}
|
|
528
521
|
function encode(_input) {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
if (Number.isInteger(input)) {
|
|
546
|
-
const nonNegative = input >= 0;
|
|
547
|
-
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
548
|
-
const value = nonNegative ? input : -input - 1;
|
|
549
|
-
if (value < 24) {
|
|
550
|
-
data[cursor++] = major << 5 | value;
|
|
551
|
-
} else if (value < 256) {
|
|
552
|
-
data[cursor++] = major << 5 | 24;
|
|
553
|
-
data[cursor++] = value;
|
|
554
|
-
} else if (value < 65536) {
|
|
555
|
-
data[cursor++] = major << 5 | extendedFloat16;
|
|
556
|
-
data[cursor++] = value >> 8;
|
|
557
|
-
data[cursor++] = value;
|
|
558
|
-
} else if (value < 4294967296) {
|
|
559
|
-
data[cursor++] = major << 5 | extendedFloat32;
|
|
560
|
-
dataView2.setUint32(cursor, value);
|
|
561
|
-
cursor += 4;
|
|
562
|
-
} else {
|
|
563
|
-
data[cursor++] = major << 5 | extendedFloat64;
|
|
564
|
-
dataView2.setBigUint64(cursor, BigInt(value));
|
|
565
|
-
cursor += 8;
|
|
522
|
+
const encodeStack = [_input];
|
|
523
|
+
while (encodeStack.length) {
|
|
524
|
+
const input = encodeStack.pop();
|
|
525
|
+
ensureSpace(typeof input === "string" ? input.length * 4 : 64);
|
|
526
|
+
if (typeof input === "string") {
|
|
527
|
+
if (USE_BUFFER) {
|
|
528
|
+
encodeHeader(majorUtf8String, Buffer.byteLength(input));
|
|
529
|
+
cursor += data.write(input, cursor);
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
const bytes = utilUtf8.fromUtf8(input);
|
|
533
|
+
encodeHeader(majorUtf8String, bytes.byteLength);
|
|
534
|
+
data.set(bytes, cursor);
|
|
535
|
+
cursor += bytes.byteLength;
|
|
536
|
+
}
|
|
537
|
+
continue;
|
|
566
538
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
while (bigIntBytes.byteLength - ++i >= 0) {
|
|
601
|
-
bigIntBytes[bigIntBytes.byteLength - i] = Number(b & BigInt(255));
|
|
602
|
-
b >>= BigInt(8);
|
|
539
|
+
else if (typeof input === "number") {
|
|
540
|
+
if (Number.isInteger(input)) {
|
|
541
|
+
const nonNegative = input >= 0;
|
|
542
|
+
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
543
|
+
const value = nonNegative ? input : -input - 1;
|
|
544
|
+
if (value < 24) {
|
|
545
|
+
data[cursor++] = (major << 5) | value;
|
|
546
|
+
}
|
|
547
|
+
else if (value < 256) {
|
|
548
|
+
data[cursor++] = (major << 5) | 24;
|
|
549
|
+
data[cursor++] = value;
|
|
550
|
+
}
|
|
551
|
+
else if (value < 65536) {
|
|
552
|
+
data[cursor++] = (major << 5) | extendedFloat16;
|
|
553
|
+
data[cursor++] = value >> 8;
|
|
554
|
+
data[cursor++] = value;
|
|
555
|
+
}
|
|
556
|
+
else if (value < 4294967296) {
|
|
557
|
+
data[cursor++] = (major << 5) | extendedFloat32;
|
|
558
|
+
dataView.setUint32(cursor, value);
|
|
559
|
+
cursor += 4;
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
data[cursor++] = (major << 5) | extendedFloat64;
|
|
563
|
+
dataView.setBigUint64(cursor, BigInt(value));
|
|
564
|
+
cursor += 8;
|
|
565
|
+
}
|
|
566
|
+
continue;
|
|
567
|
+
}
|
|
568
|
+
data[cursor++] = (majorSpecial << 5) | extendedFloat64;
|
|
569
|
+
dataView.setFloat64(cursor, input);
|
|
570
|
+
cursor += 8;
|
|
571
|
+
continue;
|
|
603
572
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
573
|
+
else if (typeof input === "bigint") {
|
|
574
|
+
const nonNegative = input >= 0;
|
|
575
|
+
const major = nonNegative ? majorUint64 : majorNegativeInt64;
|
|
576
|
+
const value = nonNegative ? input : -input - BigInt(1);
|
|
577
|
+
const n = Number(value);
|
|
578
|
+
if (n < 24) {
|
|
579
|
+
data[cursor++] = (major << 5) | n;
|
|
580
|
+
}
|
|
581
|
+
else if (n < 256) {
|
|
582
|
+
data[cursor++] = (major << 5) | 24;
|
|
583
|
+
data[cursor++] = n;
|
|
584
|
+
}
|
|
585
|
+
else if (n < 65536) {
|
|
586
|
+
data[cursor++] = (major << 5) | extendedFloat16;
|
|
587
|
+
data[cursor++] = n >> 8;
|
|
588
|
+
data[cursor++] = n & 0b1111_1111;
|
|
589
|
+
}
|
|
590
|
+
else if (n < 4294967296) {
|
|
591
|
+
data[cursor++] = (major << 5) | extendedFloat32;
|
|
592
|
+
dataView.setUint32(cursor, n);
|
|
593
|
+
cursor += 4;
|
|
594
|
+
}
|
|
595
|
+
else if (value < BigInt("18446744073709551616")) {
|
|
596
|
+
data[cursor++] = (major << 5) | extendedFloat64;
|
|
597
|
+
dataView.setBigUint64(cursor, value);
|
|
598
|
+
cursor += 8;
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
const binaryBigInt = value.toString(2);
|
|
602
|
+
const bigIntBytes = new Uint8Array(Math.ceil(binaryBigInt.length / 8));
|
|
603
|
+
let b = value;
|
|
604
|
+
let i = 0;
|
|
605
|
+
while (bigIntBytes.byteLength - ++i >= 0) {
|
|
606
|
+
bigIntBytes[bigIntBytes.byteLength - i] = Number(b & BigInt(255));
|
|
607
|
+
b >>= BigInt(8);
|
|
608
|
+
}
|
|
609
|
+
ensureSpace(bigIntBytes.byteLength * 2);
|
|
610
|
+
data[cursor++] = nonNegative ? 0b110_00010 : 0b110_00011;
|
|
611
|
+
if (USE_BUFFER) {
|
|
612
|
+
encodeHeader(majorUnstructuredByteString, Buffer.byteLength(bigIntBytes));
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
encodeHeader(majorUnstructuredByteString, bigIntBytes.byteLength);
|
|
616
|
+
}
|
|
617
|
+
data.set(bigIntBytes, cursor);
|
|
618
|
+
cursor += bigIntBytes.byteLength;
|
|
619
|
+
}
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
else if (input === null) {
|
|
623
|
+
data[cursor++] = (majorSpecial << 5) | specialNull;
|
|
624
|
+
continue;
|
|
610
625
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
continue;
|
|
615
|
-
} else if (input === null) {
|
|
616
|
-
data[cursor++] = majorSpecial << 5 | specialNull;
|
|
617
|
-
continue;
|
|
618
|
-
} else if (typeof input === "boolean") {
|
|
619
|
-
data[cursor++] = majorSpecial << 5 | (input ? specialTrue : specialFalse);
|
|
620
|
-
continue;
|
|
621
|
-
} else if (typeof input === "undefined") {
|
|
622
|
-
throw new Error("@smithy/core/cbor: client may not serialize undefined value.");
|
|
623
|
-
} else if (Array.isArray(input)) {
|
|
624
|
-
for (let i = input.length - 1; i >= 0; --i) {
|
|
625
|
-
encodeStack.push(input[i]);
|
|
626
|
-
}
|
|
627
|
-
encodeHeader(majorList, input.length);
|
|
628
|
-
continue;
|
|
629
|
-
} else if (typeof input.byteLength === "number") {
|
|
630
|
-
ensureSpace(input.length * 2);
|
|
631
|
-
encodeHeader(majorUnstructuredByteString, input.length);
|
|
632
|
-
data.set(input, cursor);
|
|
633
|
-
cursor += input.byteLength;
|
|
634
|
-
continue;
|
|
635
|
-
} else if (typeof input === "object") {
|
|
636
|
-
if (input instanceof import_serde2.NumericValue) {
|
|
637
|
-
const decimalIndex = input.string.indexOf(".");
|
|
638
|
-
const exponent = decimalIndex === -1 ? 0 : decimalIndex - input.string.length + 1;
|
|
639
|
-
const mantissa = BigInt(input.string.replace(".", ""));
|
|
640
|
-
data[cursor++] = 196;
|
|
641
|
-
encodeStack.push(mantissa);
|
|
642
|
-
encodeStack.push(exponent);
|
|
643
|
-
encodeHeader(majorList, 2);
|
|
644
|
-
continue;
|
|
645
|
-
}
|
|
646
|
-
if (input[tagSymbol]) {
|
|
647
|
-
if ("tag" in input && "value" in input) {
|
|
648
|
-
encodeStack.push(input.value);
|
|
649
|
-
encodeHeader(majorTag, input.tag);
|
|
650
|
-
continue;
|
|
651
|
-
} else {
|
|
652
|
-
throw new Error(
|
|
653
|
-
"tag encountered with missing fields, need 'tag' and 'value', found: " + JSON.stringify(input)
|
|
654
|
-
);
|
|
626
|
+
else if (typeof input === "boolean") {
|
|
627
|
+
data[cursor++] = (majorSpecial << 5) | (input ? specialTrue : specialFalse);
|
|
628
|
+
continue;
|
|
655
629
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
630
|
+
else if (typeof input === "undefined") {
|
|
631
|
+
throw new Error("@smithy/core/cbor: client may not serialize undefined value.");
|
|
632
|
+
}
|
|
633
|
+
else if (Array.isArray(input)) {
|
|
634
|
+
for (let i = input.length - 1; i >= 0; --i) {
|
|
635
|
+
encodeStack.push(input[i]);
|
|
636
|
+
}
|
|
637
|
+
encodeHeader(majorList, input.length);
|
|
638
|
+
continue;
|
|
639
|
+
}
|
|
640
|
+
else if (typeof input.byteLength === "number") {
|
|
641
|
+
ensureSpace(input.length * 2);
|
|
642
|
+
encodeHeader(majorUnstructuredByteString, input.length);
|
|
643
|
+
data.set(input, cursor);
|
|
644
|
+
cursor += input.byteLength;
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
else if (typeof input === "object") {
|
|
648
|
+
if (input instanceof serde.NumericValue) {
|
|
649
|
+
const decimalIndex = input.string.indexOf(".");
|
|
650
|
+
const exponent = decimalIndex === -1 ? 0 : decimalIndex - input.string.length + 1;
|
|
651
|
+
const mantissa = BigInt(input.string.replace(".", ""));
|
|
652
|
+
data[cursor++] = 0b110_00100;
|
|
653
|
+
encodeStack.push(mantissa);
|
|
654
|
+
encodeStack.push(exponent);
|
|
655
|
+
encodeHeader(majorList, 2);
|
|
656
|
+
continue;
|
|
657
|
+
}
|
|
658
|
+
if (input[tagSymbol]) {
|
|
659
|
+
if ("tag" in input && "value" in input) {
|
|
660
|
+
encodeStack.push(input.value);
|
|
661
|
+
encodeHeader(majorTag, input.tag);
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
throw new Error("tag encountered with missing fields, need 'tag' and 'value', found: " + JSON.stringify(input));
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
const keys = Object.keys(input);
|
|
669
|
+
for (let i = keys.length - 1; i >= 0; --i) {
|
|
670
|
+
const key = keys[i];
|
|
671
|
+
encodeStack.push(input[key]);
|
|
672
|
+
encodeStack.push(key);
|
|
673
|
+
}
|
|
674
|
+
encodeHeader(majorMap, keys.length);
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
throw new Error(`data type ${input?.constructor?.name ?? typeof input} not compatible for encoding.`);
|
|
665
678
|
}
|
|
666
|
-
throw new Error(`data type ${input?.constructor?.name ?? typeof input} not compatible for encoding.`);
|
|
667
|
-
}
|
|
668
679
|
}
|
|
669
680
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
*
|
|
689
|
-
* This may be used to garbage collect the CBOR
|
|
690
|
-
* shared encoding buffer space,
|
|
691
|
-
* e.g. resizeEncodingBuffer(0);
|
|
692
|
-
*
|
|
693
|
-
* This may also be used to pre-allocate more space for
|
|
694
|
-
* CBOR encoding, e.g. resizeEncodingBuffer(100_000_000);
|
|
695
|
-
*/
|
|
696
|
-
resizeEncodingBuffer(size) {
|
|
697
|
-
resize(size);
|
|
698
|
-
}
|
|
681
|
+
const cbor = {
|
|
682
|
+
deserialize(payload) {
|
|
683
|
+
setPayload(payload);
|
|
684
|
+
return decode(0, payload.length);
|
|
685
|
+
},
|
|
686
|
+
serialize(input) {
|
|
687
|
+
try {
|
|
688
|
+
encode(input);
|
|
689
|
+
return toUint8Array();
|
|
690
|
+
}
|
|
691
|
+
catch (e) {
|
|
692
|
+
toUint8Array();
|
|
693
|
+
throw e;
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
resizeEncodingBuffer(size) {
|
|
697
|
+
resize(size);
|
|
698
|
+
},
|
|
699
699
|
};
|
|
700
700
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
}
|
|
717
|
-
return {};
|
|
718
|
-
});
|
|
701
|
+
const parseCborBody = (streamBody, context) => {
|
|
702
|
+
return protocols.collectBody(streamBody, context).then(async (bytes) => {
|
|
703
|
+
if (bytes.length) {
|
|
704
|
+
try {
|
|
705
|
+
return cbor.deserialize(bytes);
|
|
706
|
+
}
|
|
707
|
+
catch (e) {
|
|
708
|
+
Object.defineProperty(e, "$responseBodyText", {
|
|
709
|
+
value: context.utf8Encoder(bytes),
|
|
710
|
+
});
|
|
711
|
+
throw e;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return {};
|
|
715
|
+
});
|
|
719
716
|
};
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
717
|
+
const dateToTag = (date) => {
|
|
718
|
+
return tag({
|
|
719
|
+
tag: 1,
|
|
720
|
+
value: date.getTime() / 1000,
|
|
721
|
+
});
|
|
725
722
|
};
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
723
|
+
const parseCborErrorBody = async (errorBody, context) => {
|
|
724
|
+
const value = await parseCborBody(errorBody, context);
|
|
725
|
+
value.message = value.message ?? value.Message;
|
|
726
|
+
return value;
|
|
730
727
|
};
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
728
|
+
const loadSmithyRpcV2CborErrorCode = (output, data) => {
|
|
729
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
730
|
+
let cleanValue = rawValue;
|
|
731
|
+
if (typeof cleanValue === "number") {
|
|
732
|
+
cleanValue = cleanValue.toString();
|
|
733
|
+
}
|
|
734
|
+
if (cleanValue.indexOf(",") >= 0) {
|
|
735
|
+
cleanValue = cleanValue.split(",")[0];
|
|
736
|
+
}
|
|
737
|
+
if (cleanValue.indexOf(":") >= 0) {
|
|
738
|
+
cleanValue = cleanValue.split(":")[0];
|
|
739
|
+
}
|
|
740
|
+
if (cleanValue.indexOf("#") >= 0) {
|
|
741
|
+
cleanValue = cleanValue.split("#")[1];
|
|
742
|
+
}
|
|
743
|
+
return cleanValue;
|
|
744
|
+
};
|
|
745
|
+
if (data["__type"] !== undefined) {
|
|
746
|
+
return sanitizeErrorCode(data["__type"]);
|
|
742
747
|
}
|
|
743
|
-
|
|
744
|
-
|
|
748
|
+
const codeKey = Object.keys(data).find((key) => key.toLowerCase() === "code");
|
|
749
|
+
if (codeKey && data[codeKey] !== undefined) {
|
|
750
|
+
return sanitizeErrorCode(data[codeKey]);
|
|
745
751
|
}
|
|
746
|
-
return cleanValue;
|
|
747
|
-
};
|
|
748
|
-
if (data2["__type"] !== void 0) {
|
|
749
|
-
return sanitizeErrorCode(data2["__type"]);
|
|
750
|
-
}
|
|
751
|
-
const codeKey = Object.keys(data2).find((key) => key.toLowerCase() === "code");
|
|
752
|
-
if (codeKey && data2[codeKey] !== void 0) {
|
|
753
|
-
return sanitizeErrorCode(data2[codeKey]);
|
|
754
|
-
}
|
|
755
752
|
};
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
753
|
+
const checkCborResponse = (response) => {
|
|
754
|
+
if (String(response.headers["smithy-protocol"]).toLowerCase() !== "rpc-v2-cbor") {
|
|
755
|
+
throw new Error("Malformed RPCv2 CBOR response, status: " + response.statusCode);
|
|
756
|
+
}
|
|
760
757
|
};
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
758
|
+
const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
|
|
759
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
760
|
+
const contents = {
|
|
761
|
+
protocol,
|
|
762
|
+
hostname,
|
|
763
|
+
port,
|
|
764
|
+
method: "POST",
|
|
765
|
+
path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
|
|
766
|
+
headers: {
|
|
767
|
+
...headers,
|
|
768
|
+
},
|
|
769
|
+
};
|
|
770
|
+
if (resolvedHostname !== undefined) {
|
|
771
|
+
contents.hostname = resolvedHostname;
|
|
772
772
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
try {
|
|
780
|
-
contents.headers["content-length"] = String((0, import_util_body_length_browser.calculateBodyLength)(body));
|
|
781
|
-
} catch (e) {
|
|
773
|
+
if (body !== undefined) {
|
|
774
|
+
contents.body = body;
|
|
775
|
+
try {
|
|
776
|
+
contents.headers["content-length"] = String(utilBodyLengthBrowser.calculateBodyLength(body));
|
|
777
|
+
}
|
|
778
|
+
catch (e) { }
|
|
782
779
|
}
|
|
783
|
-
|
|
784
|
-
return new import_protocol_http.HttpRequest(contents);
|
|
780
|
+
return new protocolHttp.HttpRequest(contents);
|
|
785
781
|
};
|
|
786
782
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
var import_schema = require("@smithy/core/schema");
|
|
794
|
-
var import_serde3 = require("@smithy/core/serde");
|
|
795
|
-
var import_util_base64 = require("@smithy/util-base64");
|
|
796
|
-
var CborCodec = class {
|
|
797
|
-
createSerializer() {
|
|
798
|
-
const serializer = new CborShapeSerializer();
|
|
799
|
-
serializer.setSerdeContext(this.serdeContext);
|
|
800
|
-
return serializer;
|
|
801
|
-
}
|
|
802
|
-
createDeserializer() {
|
|
803
|
-
const deserializer = new CborShapeDeserializer();
|
|
804
|
-
deserializer.setSerdeContext(this.serdeContext);
|
|
805
|
-
return deserializer;
|
|
806
|
-
}
|
|
807
|
-
setSerdeContext(serdeContext) {
|
|
808
|
-
this.serdeContext = serdeContext;
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
var CborShapeSerializer = class {
|
|
812
|
-
setSerdeContext(serdeContext) {
|
|
813
|
-
this.serdeContext = serdeContext;
|
|
814
|
-
}
|
|
815
|
-
write(schema, value) {
|
|
816
|
-
this.value = this.serialize(schema, value);
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Recursive serializer transform that copies and prepares the user input object
|
|
820
|
-
* for CBOR serialization.
|
|
821
|
-
*/
|
|
822
|
-
serialize(schema, source) {
|
|
823
|
-
const ns = import_schema.NormalizedSchema.of(schema);
|
|
824
|
-
if (source == null) {
|
|
825
|
-
if (ns.isIdempotencyToken()) {
|
|
826
|
-
return (0, import_serde3.generateIdempotencyToken)();
|
|
827
|
-
}
|
|
828
|
-
return source;
|
|
783
|
+
class CborCodec {
|
|
784
|
+
serdeContext;
|
|
785
|
+
createSerializer() {
|
|
786
|
+
const serializer = new CborShapeSerializer();
|
|
787
|
+
serializer.setSerdeContext(this.serdeContext);
|
|
788
|
+
return serializer;
|
|
829
789
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
return source;
|
|
790
|
+
createDeserializer() {
|
|
791
|
+
const deserializer = new CborShapeDeserializer();
|
|
792
|
+
deserializer.setSerdeContext(this.serdeContext);
|
|
793
|
+
return deserializer;
|
|
835
794
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
return dateToTag(new Date(Number(source) / 1e3 | 0));
|
|
839
|
-
}
|
|
840
|
-
return dateToTag(source);
|
|
795
|
+
setSerdeContext(serdeContext) {
|
|
796
|
+
this.serdeContext = serdeContext;
|
|
841
797
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
798
|
+
}
|
|
799
|
+
class CborShapeSerializer {
|
|
800
|
+
serdeContext;
|
|
801
|
+
value;
|
|
802
|
+
setSerdeContext(serdeContext) {
|
|
803
|
+
this.serdeContext = serdeContext;
|
|
804
|
+
}
|
|
805
|
+
write(schema, value) {
|
|
806
|
+
this.value = this.serialize(schema, value);
|
|
807
|
+
}
|
|
808
|
+
serialize(schema$1, source) {
|
|
809
|
+
const ns = schema.NormalizedSchema.of(schema$1);
|
|
810
|
+
if (source == null) {
|
|
811
|
+
if (ns.isIdempotencyToken()) {
|
|
812
|
+
return serde.generateIdempotencyToken();
|
|
813
|
+
}
|
|
814
|
+
return source;
|
|
853
815
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
const newObject = {};
|
|
860
|
-
if (ns.isMapSchema()) {
|
|
861
|
-
const sparse = !!ns.getMergedTraits().sparse;
|
|
862
|
-
for (const key of Object.keys(sourceObject)) {
|
|
863
|
-
const value = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
864
|
-
if (value != null || sparse) {
|
|
865
|
-
newObject[key] = value;
|
|
866
|
-
}
|
|
816
|
+
if (ns.isBlobSchema()) {
|
|
817
|
+
if (typeof source === "string") {
|
|
818
|
+
return (this.serdeContext?.base64Decoder ?? utilBase64.fromBase64)(source);
|
|
819
|
+
}
|
|
820
|
+
return source;
|
|
867
821
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
}
|
|
822
|
+
if (ns.isTimestampSchema()) {
|
|
823
|
+
if (typeof source === "number" || typeof source === "bigint") {
|
|
824
|
+
return dateToTag(new Date((Number(source) / 1000) | 0));
|
|
825
|
+
}
|
|
826
|
+
return dateToTag(source);
|
|
874
827
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
828
|
+
if (typeof source === "function" || typeof source === "object") {
|
|
829
|
+
const sourceObject = source;
|
|
830
|
+
if (ns.isListSchema() && Array.isArray(sourceObject)) {
|
|
831
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
832
|
+
const newArray = [];
|
|
833
|
+
let i = 0;
|
|
834
|
+
for (const item of sourceObject) {
|
|
835
|
+
const value = this.serialize(ns.getValueSchema(), item);
|
|
836
|
+
if (value != null || sparse) {
|
|
837
|
+
newArray[i++] = value;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return newArray;
|
|
841
|
+
}
|
|
842
|
+
if (sourceObject instanceof Date) {
|
|
843
|
+
return dateToTag(sourceObject);
|
|
844
|
+
}
|
|
845
|
+
const newObject = {};
|
|
846
|
+
if (ns.isMapSchema()) {
|
|
847
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
848
|
+
for (const key of Object.keys(sourceObject)) {
|
|
849
|
+
const value = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
850
|
+
if (value != null || sparse) {
|
|
851
|
+
newObject[key] = value;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
else if (ns.isStructSchema()) {
|
|
856
|
+
for (const [key, memberSchema] of ns.structIterator()) {
|
|
857
|
+
const value = this.serialize(memberSchema, sourceObject[key]);
|
|
858
|
+
if (value != null) {
|
|
859
|
+
newObject[key] = value;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
else if (ns.isDocumentSchema()) {
|
|
864
|
+
for (const key of Object.keys(sourceObject)) {
|
|
865
|
+
newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
return newObject;
|
|
878
869
|
}
|
|
879
|
-
|
|
880
|
-
return newObject;
|
|
870
|
+
return source;
|
|
881
871
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
this.serdeContext = serdeContext;
|
|
893
|
-
}
|
|
894
|
-
read(schema, bytes) {
|
|
895
|
-
const data2 = cbor.deserialize(bytes);
|
|
896
|
-
return this.readValue(schema, data2);
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* Public because it's called by the protocol implementation to deserialize errors.
|
|
900
|
-
* @internal
|
|
901
|
-
*/
|
|
902
|
-
readValue(_schema, value) {
|
|
903
|
-
const ns = import_schema.NormalizedSchema.of(_schema);
|
|
904
|
-
if (ns.isTimestampSchema() && typeof value === "number") {
|
|
905
|
-
return (0, import_serde3.parseEpochTimestamp)(value);
|
|
872
|
+
flush() {
|
|
873
|
+
const buffer = cbor.serialize(this.value);
|
|
874
|
+
this.value = undefined;
|
|
875
|
+
return buffer;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
class CborShapeDeserializer {
|
|
879
|
+
serdeContext;
|
|
880
|
+
setSerdeContext(serdeContext) {
|
|
881
|
+
this.serdeContext = serdeContext;
|
|
906
882
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
return
|
|
910
|
-
}
|
|
911
|
-
return value;
|
|
883
|
+
read(schema, bytes) {
|
|
884
|
+
const data = cbor.deserialize(bytes);
|
|
885
|
+
return this.readValue(schema, data);
|
|
912
886
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
return null;
|
|
918
|
-
}
|
|
919
|
-
if ("byteLength" in value) {
|
|
920
|
-
return value;
|
|
921
|
-
}
|
|
922
|
-
if (value instanceof Date) {
|
|
923
|
-
return value;
|
|
924
|
-
}
|
|
925
|
-
if (ns.isDocumentSchema()) {
|
|
926
|
-
return value;
|
|
927
|
-
}
|
|
928
|
-
if (ns.isListSchema()) {
|
|
929
|
-
const newArray = [];
|
|
930
|
-
const memberSchema = ns.getValueSchema();
|
|
931
|
-
const sparse = !!ns.getMergedTraits().sparse;
|
|
932
|
-
for (const item of value) {
|
|
933
|
-
const itemValue = this.readValue(memberSchema, item);
|
|
934
|
-
if (itemValue != null || sparse) {
|
|
935
|
-
newArray.push(itemValue);
|
|
936
|
-
}
|
|
887
|
+
readValue(_schema, value) {
|
|
888
|
+
const ns = schema.NormalizedSchema.of(_schema);
|
|
889
|
+
if (ns.isTimestampSchema() && typeof value === "number") {
|
|
890
|
+
return serde.parseEpochTimestamp(value);
|
|
937
891
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
const targetSchema = ns.getValueSchema();
|
|
944
|
-
for (const key of Object.keys(value)) {
|
|
945
|
-
const itemValue = this.readValue(targetSchema, value[key]);
|
|
946
|
-
if (itemValue != null || sparse) {
|
|
947
|
-
newObject[key] = itemValue;
|
|
948
|
-
}
|
|
892
|
+
if (ns.isBlobSchema()) {
|
|
893
|
+
if (typeof value === "string") {
|
|
894
|
+
return (this.serdeContext?.base64Decoder ?? utilBase64.fromBase64)(value);
|
|
895
|
+
}
|
|
896
|
+
return value;
|
|
949
897
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
898
|
+
if (typeof value === "undefined" ||
|
|
899
|
+
typeof value === "boolean" ||
|
|
900
|
+
typeof value === "number" ||
|
|
901
|
+
typeof value === "string" ||
|
|
902
|
+
typeof value === "bigint" ||
|
|
903
|
+
typeof value === "symbol") {
|
|
904
|
+
return value;
|
|
905
|
+
}
|
|
906
|
+
else if (typeof value === "function" || typeof value === "object") {
|
|
907
|
+
if (value === null) {
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
910
|
+
if ("byteLength" in value) {
|
|
911
|
+
return value;
|
|
912
|
+
}
|
|
913
|
+
if (value instanceof Date) {
|
|
914
|
+
return value;
|
|
915
|
+
}
|
|
916
|
+
if (ns.isDocumentSchema()) {
|
|
917
|
+
return value;
|
|
918
|
+
}
|
|
919
|
+
if (ns.isListSchema()) {
|
|
920
|
+
const newArray = [];
|
|
921
|
+
const memberSchema = ns.getValueSchema();
|
|
922
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
923
|
+
for (const item of value) {
|
|
924
|
+
const itemValue = this.readValue(memberSchema, item);
|
|
925
|
+
if (itemValue != null || sparse) {
|
|
926
|
+
newArray.push(itemValue);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
return newArray;
|
|
930
|
+
}
|
|
931
|
+
const newObject = {};
|
|
932
|
+
if (ns.isMapSchema()) {
|
|
933
|
+
const sparse = !!ns.getMergedTraits().sparse;
|
|
934
|
+
const targetSchema = ns.getValueSchema();
|
|
935
|
+
for (const key of Object.keys(value)) {
|
|
936
|
+
const itemValue = this.readValue(targetSchema, value[key]);
|
|
937
|
+
if (itemValue != null || sparse) {
|
|
938
|
+
newObject[key] = itemValue;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
else if (ns.isStructSchema()) {
|
|
943
|
+
for (const [key, memberSchema] of ns.structIterator()) {
|
|
944
|
+
newObject[key] = this.readValue(memberSchema, value[key]);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
return newObject;
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
return value;
|
|
953
951
|
}
|
|
954
|
-
}
|
|
955
|
-
return newObject;
|
|
956
|
-
} else {
|
|
957
|
-
return value;
|
|
958
952
|
}
|
|
959
|
-
|
|
960
|
-
};
|
|
953
|
+
}
|
|
961
954
|
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
this.deserializer = this.codec.createDeserializer();
|
|
969
|
-
}
|
|
970
|
-
getShapeId() {
|
|
971
|
-
return "smithy.protocols#rpcv2Cbor";
|
|
972
|
-
}
|
|
973
|
-
getPayloadCodec() {
|
|
974
|
-
return this.codec;
|
|
975
|
-
}
|
|
976
|
-
async serializeRequest(operationSchema, input, context) {
|
|
977
|
-
const request = await super.serializeRequest(operationSchema, input, context);
|
|
978
|
-
Object.assign(request.headers, {
|
|
979
|
-
"content-type": this.getDefaultContentType(),
|
|
980
|
-
"smithy-protocol": "rpc-v2-cbor",
|
|
981
|
-
accept: this.getDefaultContentType()
|
|
982
|
-
});
|
|
983
|
-
if ((0, import_schema2.deref)(operationSchema.input) === "unit") {
|
|
984
|
-
delete request.body;
|
|
985
|
-
delete request.headers["content-type"];
|
|
986
|
-
} else {
|
|
987
|
-
if (!request.body) {
|
|
988
|
-
this.serializer.write(15, {});
|
|
989
|
-
request.body = this.serializer.flush();
|
|
990
|
-
}
|
|
991
|
-
try {
|
|
992
|
-
request.headers["content-length"] = String(request.body.byteLength);
|
|
993
|
-
} catch (e) {
|
|
994
|
-
}
|
|
955
|
+
class SmithyRpcV2CborProtocol extends protocols.RpcProtocol {
|
|
956
|
+
codec = new CborCodec();
|
|
957
|
+
serializer = this.codec.createSerializer();
|
|
958
|
+
deserializer = this.codec.createDeserializer();
|
|
959
|
+
constructor({ defaultNamespace }) {
|
|
960
|
+
super({ defaultNamespace });
|
|
995
961
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
if (request.path.endsWith("/")) {
|
|
999
|
-
request.path += path.slice(1);
|
|
1000
|
-
} else {
|
|
1001
|
-
request.path += path;
|
|
962
|
+
getShapeId() {
|
|
963
|
+
return "smithy.protocols#rpcv2Cbor";
|
|
1002
964
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
async deserializeResponse(operationSchema, context, response) {
|
|
1006
|
-
return super.deserializeResponse(operationSchema, context, response);
|
|
1007
|
-
}
|
|
1008
|
-
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
1009
|
-
const errorName = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
|
|
1010
|
-
let namespace = this.options.defaultNamespace;
|
|
1011
|
-
if (errorName.includes("#")) {
|
|
1012
|
-
[namespace] = errorName.split("#");
|
|
965
|
+
getPayloadCodec() {
|
|
966
|
+
return this.codec;
|
|
1013
967
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
968
|
+
async serializeRequest(operationSchema, input, context) {
|
|
969
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
970
|
+
Object.assign(request.headers, {
|
|
971
|
+
"content-type": this.getDefaultContentType(),
|
|
972
|
+
"smithy-protocol": "rpc-v2-cbor",
|
|
973
|
+
accept: this.getDefaultContentType(),
|
|
974
|
+
});
|
|
975
|
+
if (schema.deref(operationSchema.input) === "unit") {
|
|
976
|
+
delete request.body;
|
|
977
|
+
delete request.headers["content-type"];
|
|
978
|
+
}
|
|
979
|
+
else {
|
|
980
|
+
if (!request.body) {
|
|
981
|
+
this.serializer.write(15, {});
|
|
982
|
+
request.body = this.serializer.flush();
|
|
983
|
+
}
|
|
984
|
+
try {
|
|
985
|
+
request.headers["content-length"] = String(request.body.byteLength);
|
|
986
|
+
}
|
|
987
|
+
catch (e) { }
|
|
988
|
+
}
|
|
989
|
+
const { service, operation } = utilMiddleware.getSmithyContext(context);
|
|
990
|
+
const path = `/service/${service}/operation/${operation}`;
|
|
991
|
+
if (request.path.endsWith("/")) {
|
|
992
|
+
request.path += path.slice(1);
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
request.path += path;
|
|
996
|
+
}
|
|
997
|
+
return request;
|
|
1034
998
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const message = dataObject.message ?? dataObject.Message ?? "Unknown";
|
|
1038
|
-
const exception = new ErrorCtor(message);
|
|
1039
|
-
const output = {};
|
|
1040
|
-
for (const [name, member] of ns.structIterator()) {
|
|
1041
|
-
output[name] = this.deserializer.readValue(member, dataObject[name]);
|
|
999
|
+
async deserializeResponse(operationSchema, context, response) {
|
|
1000
|
+
return super.deserializeResponse(operationSchema, context, response);
|
|
1042
1001
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1002
|
+
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
1003
|
+
const errorName = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
|
|
1004
|
+
let namespace = this.options.defaultNamespace;
|
|
1005
|
+
if (errorName.includes("#")) {
|
|
1006
|
+
[namespace] = errorName.split("#");
|
|
1007
|
+
}
|
|
1008
|
+
const errorMetadata = {
|
|
1009
|
+
$metadata: metadata,
|
|
1010
|
+
$response: response,
|
|
1011
|
+
$fault: response.statusCode <= 500 ? "client" : "server",
|
|
1012
|
+
};
|
|
1013
|
+
const registry = schema.TypeRegistry.for(namespace);
|
|
1014
|
+
let errorSchema;
|
|
1015
|
+
try {
|
|
1016
|
+
errorSchema = registry.getSchema(errorName);
|
|
1017
|
+
}
|
|
1018
|
+
catch (e) {
|
|
1019
|
+
if (dataObject.Message) {
|
|
1020
|
+
dataObject.message = dataObject.Message;
|
|
1021
|
+
}
|
|
1022
|
+
const synthetic = schema.TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace);
|
|
1023
|
+
const baseExceptionSchema = synthetic.getBaseException();
|
|
1024
|
+
if (baseExceptionSchema) {
|
|
1025
|
+
const ErrorCtor = synthetic.getErrorCtor(baseExceptionSchema);
|
|
1026
|
+
throw Object.assign(new ErrorCtor({ name: errorName }), errorMetadata, dataObject);
|
|
1027
|
+
}
|
|
1028
|
+
throw Object.assign(new Error(errorName), errorMetadata, dataObject);
|
|
1029
|
+
}
|
|
1030
|
+
const ns = schema.NormalizedSchema.of(errorSchema);
|
|
1031
|
+
const ErrorCtor = registry.getErrorCtor(errorSchema);
|
|
1032
|
+
const message = dataObject.message ?? dataObject.Message ?? "Unknown";
|
|
1033
|
+
const exception = new ErrorCtor(message);
|
|
1034
|
+
const output = {};
|
|
1035
|
+
for (const [name, member] of ns.structIterator()) {
|
|
1036
|
+
output[name] = this.deserializer.readValue(member, dataObject[name]);
|
|
1037
|
+
}
|
|
1038
|
+
throw Object.assign(exception, errorMetadata, {
|
|
1039
|
+
$fault: ns.getMergedTraits().error,
|
|
1040
|
+
message,
|
|
1041
|
+
}, output);
|
|
1042
|
+
}
|
|
1043
|
+
getDefaultContentType() {
|
|
1044
|
+
return "application/cbor";
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
exports.CborCodec = CborCodec;
|
|
1049
|
+
exports.CborShapeDeserializer = CborShapeDeserializer;
|
|
1050
|
+
exports.CborShapeSerializer = CborShapeSerializer;
|
|
1051
|
+
exports.SmithyRpcV2CborProtocol = SmithyRpcV2CborProtocol;
|
|
1052
|
+
exports.buildHttpRpcRequest = buildHttpRpcRequest;
|
|
1053
|
+
exports.cbor = cbor;
|
|
1054
|
+
exports.checkCborResponse = checkCborResponse;
|
|
1055
|
+
exports.dateToTag = dateToTag;
|
|
1056
|
+
exports.loadSmithyRpcV2CborErrorCode = loadSmithyRpcV2CborErrorCode;
|
|
1057
|
+
exports.parseCborBody = parseCborBody;
|
|
1058
|
+
exports.parseCborErrorBody = parseCborErrorBody;
|
|
1059
|
+
exports.tag = tag;
|
|
1060
|
+
exports.tagSymbol = tagSymbol;
|