@cdk8s/awscdk-resolver 0.0.375 → 0.0.376
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 +3 -3
- 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,808 +1,700 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
streamCollector: () => streamCollector
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(index_exports);
|
|
3
|
+
var protocolHttp = require('@smithy/protocol-http');
|
|
4
|
+
var querystringBuilder = require('@smithy/querystring-builder');
|
|
5
|
+
var http = require('http');
|
|
6
|
+
var https = require('https');
|
|
7
|
+
var stream = require('stream');
|
|
8
|
+
var http2 = require('http2');
|
|
39
9
|
|
|
40
|
-
|
|
41
|
-
var import_protocol_http = require("@smithy/protocol-http");
|
|
42
|
-
var import_querystring_builder = require("@smithy/querystring-builder");
|
|
43
|
-
var import_http = require("http");
|
|
44
|
-
var import_https = require("https");
|
|
10
|
+
const NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "EPIPE", "ETIMEDOUT"];
|
|
45
11
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
|
|
55
|
-
}
|
|
56
|
-
return transformedHeaders;
|
|
57
|
-
}, "getTransformedHeaders");
|
|
12
|
+
const getTransformedHeaders = (headers) => {
|
|
13
|
+
const transformedHeaders = {};
|
|
14
|
+
for (const name of Object.keys(headers)) {
|
|
15
|
+
const headerValues = headers[name];
|
|
16
|
+
transformedHeaders[name] = Array.isArray(headerValues) ? headerValues.join(",") : headerValues;
|
|
17
|
+
}
|
|
18
|
+
return transformedHeaders;
|
|
19
|
+
};
|
|
58
20
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
clearTimeout: /* @__PURE__ */ __name((timeoutId) => clearTimeout(timeoutId), "clearTimeout")
|
|
21
|
+
const timing = {
|
|
22
|
+
setTimeout: (cb, ms) => setTimeout(cb, ms),
|
|
23
|
+
clearTimeout: (timeoutId) => clearTimeout(timeoutId),
|
|
63
24
|
};
|
|
64
25
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}, "setConnectionTimeout");
|
|
26
|
+
const DEFER_EVENT_LISTENER_TIME$2 = 1000;
|
|
27
|
+
const setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
|
|
28
|
+
if (!timeoutInMs) {
|
|
29
|
+
return -1;
|
|
30
|
+
}
|
|
31
|
+
const registerTimeout = (offset) => {
|
|
32
|
+
const timeoutId = timing.setTimeout(() => {
|
|
33
|
+
request.destroy();
|
|
34
|
+
reject(Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), {
|
|
35
|
+
name: "TimeoutError",
|
|
36
|
+
}));
|
|
37
|
+
}, timeoutInMs - offset);
|
|
38
|
+
const doWithSocket = (socket) => {
|
|
39
|
+
if (socket?.connecting) {
|
|
40
|
+
socket.on("connect", () => {
|
|
41
|
+
timing.clearTimeout(timeoutId);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
timing.clearTimeout(timeoutId);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
if (request.socket) {
|
|
49
|
+
doWithSocket(request.socket);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
request.on("socket", doWithSocket);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
if (timeoutInMs < 2000) {
|
|
56
|
+
registerTimeout(0);
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME$2), DEFER_EVENT_LISTENER_TIME$2);
|
|
60
|
+
};
|
|
101
61
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
62
|
+
const DEFER_EVENT_LISTENER_TIME$1 = 3000;
|
|
63
|
+
const setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME$1) => {
|
|
64
|
+
if (keepAlive !== true) {
|
|
65
|
+
return -1;
|
|
66
|
+
}
|
|
67
|
+
const registerListener = () => {
|
|
68
|
+
if (request.socket) {
|
|
69
|
+
request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
request.on("socket", (socket) => {
|
|
73
|
+
socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (deferTimeMs === 0) {
|
|
78
|
+
registerListener();
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
return timing.setTimeout(registerListener, deferTimeMs);
|
|
82
|
+
};
|
|
123
83
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
DEFER_EVENT_LISTENER_TIME3
|
|
147
|
-
);
|
|
148
|
-
}, "setSocketTimeout");
|
|
84
|
+
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
85
|
+
const setSocketTimeout = (request, reject, timeoutInMs = DEFAULT_REQUEST_TIMEOUT) => {
|
|
86
|
+
const registerTimeout = (offset) => {
|
|
87
|
+
const timeout = timeoutInMs - offset;
|
|
88
|
+
const onTimeout = () => {
|
|
89
|
+
request.destroy();
|
|
90
|
+
reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
|
|
91
|
+
};
|
|
92
|
+
if (request.socket) {
|
|
93
|
+
request.socket.setTimeout(timeout, onTimeout);
|
|
94
|
+
request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
request.setTimeout(timeout, onTimeout);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
if (0 < timeoutInMs && timeoutInMs < 6000) {
|
|
101
|
+
registerTimeout(0);
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
105
|
+
};
|
|
149
106
|
|
|
150
|
-
|
|
151
|
-
var import_stream = require("stream");
|
|
152
|
-
var MIN_WAIT_TIME = 6e3;
|
|
107
|
+
const MIN_WAIT_TIME = 6_000;
|
|
153
108
|
async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME) {
|
|
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
|
-
|
|
109
|
+
const headers = request.headers ?? {};
|
|
110
|
+
const expect = headers["Expect"] || headers["expect"];
|
|
111
|
+
let timeoutId = -1;
|
|
112
|
+
let sendBody = true;
|
|
113
|
+
if (expect === "100-continue") {
|
|
114
|
+
sendBody = await Promise.race([
|
|
115
|
+
new Promise((resolve) => {
|
|
116
|
+
timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
|
|
117
|
+
}),
|
|
118
|
+
new Promise((resolve) => {
|
|
119
|
+
httpRequest.on("continue", () => {
|
|
120
|
+
timing.clearTimeout(timeoutId);
|
|
121
|
+
resolve(true);
|
|
122
|
+
});
|
|
123
|
+
httpRequest.on("response", () => {
|
|
124
|
+
timing.clearTimeout(timeoutId);
|
|
125
|
+
resolve(false);
|
|
126
|
+
});
|
|
127
|
+
httpRequest.on("error", () => {
|
|
128
|
+
timing.clearTimeout(timeoutId);
|
|
129
|
+
resolve(false);
|
|
130
|
+
});
|
|
131
|
+
}),
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
134
|
+
if (sendBody) {
|
|
135
|
+
writeBody(httpRequest, request.body);
|
|
136
|
+
}
|
|
182
137
|
}
|
|
183
|
-
__name(writeRequestBody, "writeRequestBody");
|
|
184
138
|
function writeBody(httpRequest, body) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
139
|
+
if (body instanceof stream.Readable) {
|
|
140
|
+
body.pipe(httpRequest);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (body) {
|
|
144
|
+
if (Buffer.isBuffer(body) || typeof body === "string") {
|
|
145
|
+
httpRequest.end(body);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const uint8 = body;
|
|
149
|
+
if (typeof uint8 === "object" &&
|
|
150
|
+
uint8.buffer &&
|
|
151
|
+
typeof uint8.byteOffset === "number" &&
|
|
152
|
+
typeof uint8.byteLength === "number") {
|
|
153
|
+
httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
httpRequest.end(Buffer.from(body));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
httpRequest.end();
|
|
203
160
|
}
|
|
204
|
-
__name(writeBody, "writeBody");
|
|
205
161
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
options().then((_options) => {
|
|
216
|
-
resolve(this.resolveDefaultConfig(_options));
|
|
217
|
-
}).catch(reject);
|
|
218
|
-
} else {
|
|
219
|
-
resolve(this.resolveDefaultConfig(options));
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
static {
|
|
224
|
-
__name(this, "NodeHttpHandler");
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* @returns the input if it is an HttpHandler of any class,
|
|
228
|
-
* or instantiates a new instance of this handler.
|
|
229
|
-
*/
|
|
230
|
-
static create(instanceOrOptions) {
|
|
231
|
-
if (typeof instanceOrOptions?.handle === "function") {
|
|
232
|
-
return instanceOrOptions;
|
|
233
|
-
}
|
|
234
|
-
return new _NodeHttpHandler(instanceOrOptions);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* @internal
|
|
238
|
-
*
|
|
239
|
-
* @param agent - http(s) agent in use by the NodeHttpHandler instance.
|
|
240
|
-
* @param socketWarningTimestamp - last socket usage check timestamp.
|
|
241
|
-
* @param logger - channel for the warning.
|
|
242
|
-
* @returns timestamp of last emitted warning.
|
|
243
|
-
*/
|
|
244
|
-
static checkSocketUsage(agent, socketWarningTimestamp, logger = console) {
|
|
245
|
-
const { sockets, requests, maxSockets } = agent;
|
|
246
|
-
if (typeof maxSockets !== "number" || maxSockets === Infinity) {
|
|
247
|
-
return socketWarningTimestamp;
|
|
248
|
-
}
|
|
249
|
-
const interval = 15e3;
|
|
250
|
-
if (Date.now() - interval < socketWarningTimestamp) {
|
|
251
|
-
return socketWarningTimestamp;
|
|
252
|
-
}
|
|
253
|
-
if (sockets && requests) {
|
|
254
|
-
for (const origin in sockets) {
|
|
255
|
-
const socketsInUse = sockets[origin]?.length ?? 0;
|
|
256
|
-
const requestsEnqueued = requests[origin]?.length ?? 0;
|
|
257
|
-
if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
|
|
258
|
-
logger?.warn?.(
|
|
259
|
-
`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
|
|
260
|
-
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
261
|
-
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`
|
|
262
|
-
);
|
|
263
|
-
return Date.now();
|
|
162
|
+
const DEFAULT_REQUEST_TIMEOUT = 0;
|
|
163
|
+
class NodeHttpHandler {
|
|
164
|
+
config;
|
|
165
|
+
configProvider;
|
|
166
|
+
socketWarningTimestamp = 0;
|
|
167
|
+
metadata = { handlerProtocol: "http/1.1" };
|
|
168
|
+
static create(instanceOrOptions) {
|
|
169
|
+
if (typeof instanceOrOptions?.handle === "function") {
|
|
170
|
+
return instanceOrOptions;
|
|
264
171
|
}
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const keepAlive = true;
|
|
272
|
-
const maxSockets = 50;
|
|
273
|
-
return {
|
|
274
|
-
connectionTimeout,
|
|
275
|
-
requestTimeout: requestTimeout ?? socketTimeout,
|
|
276
|
-
socketAcquisitionWarningTimeout,
|
|
277
|
-
httpAgent: (() => {
|
|
278
|
-
if (httpAgent instanceof import_http.Agent || typeof httpAgent?.destroy === "function") {
|
|
279
|
-
return httpAgent;
|
|
172
|
+
return new NodeHttpHandler(instanceOrOptions);
|
|
173
|
+
}
|
|
174
|
+
static checkSocketUsage(agent, socketWarningTimestamp, logger = console) {
|
|
175
|
+
const { sockets, requests, maxSockets } = agent;
|
|
176
|
+
if (typeof maxSockets !== "number" || maxSockets === Infinity) {
|
|
177
|
+
return socketWarningTimestamp;
|
|
280
178
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (httpsAgent instanceof import_https.Agent || typeof httpsAgent?.destroy === "function") {
|
|
285
|
-
return httpsAgent;
|
|
179
|
+
const interval = 15_000;
|
|
180
|
+
if (Date.now() - interval < socketWarningTimestamp) {
|
|
181
|
+
return socketWarningTimestamp;
|
|
286
182
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
this.config = await this.configProvider;
|
|
299
|
-
}
|
|
300
|
-
return new Promise((_resolve, _reject) => {
|
|
301
|
-
let writeRequestBodyPromise = void 0;
|
|
302
|
-
const timeouts = [];
|
|
303
|
-
const resolve = /* @__PURE__ */ __name(async (arg) => {
|
|
304
|
-
await writeRequestBodyPromise;
|
|
305
|
-
timeouts.forEach(timing.clearTimeout);
|
|
306
|
-
_resolve(arg);
|
|
307
|
-
}, "resolve");
|
|
308
|
-
const reject = /* @__PURE__ */ __name(async (arg) => {
|
|
309
|
-
await writeRequestBodyPromise;
|
|
310
|
-
timeouts.forEach(timing.clearTimeout);
|
|
311
|
-
_reject(arg);
|
|
312
|
-
}, "reject");
|
|
313
|
-
if (!this.config) {
|
|
314
|
-
throw new Error("Node HTTP request handler config is not resolved");
|
|
315
|
-
}
|
|
316
|
-
if (abortSignal?.aborted) {
|
|
317
|
-
const abortError = new Error("Request aborted");
|
|
318
|
-
abortError.name = "AbortError";
|
|
319
|
-
reject(abortError);
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
const isSSL = request.protocol === "https:";
|
|
323
|
-
const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
|
|
324
|
-
timeouts.push(
|
|
325
|
-
timing.setTimeout(
|
|
326
|
-
() => {
|
|
327
|
-
this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(
|
|
328
|
-
agent,
|
|
329
|
-
this.socketWarningTimestamp,
|
|
330
|
-
this.config.logger
|
|
331
|
-
);
|
|
332
|
-
},
|
|
333
|
-
this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3)
|
|
334
|
-
)
|
|
335
|
-
);
|
|
336
|
-
const queryString = (0, import_querystring_builder.buildQueryString)(request.query || {});
|
|
337
|
-
let auth = void 0;
|
|
338
|
-
if (request.username != null || request.password != null) {
|
|
339
|
-
const username = request.username ?? "";
|
|
340
|
-
const password = request.password ?? "";
|
|
341
|
-
auth = `${username}:${password}`;
|
|
342
|
-
}
|
|
343
|
-
let path = request.path;
|
|
344
|
-
if (queryString) {
|
|
345
|
-
path += `?${queryString}`;
|
|
346
|
-
}
|
|
347
|
-
if (request.fragment) {
|
|
348
|
-
path += `#${request.fragment}`;
|
|
349
|
-
}
|
|
350
|
-
let hostname = request.hostname ?? "";
|
|
351
|
-
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
352
|
-
hostname = request.hostname.slice(1, -1);
|
|
353
|
-
} else {
|
|
354
|
-
hostname = request.hostname;
|
|
355
|
-
}
|
|
356
|
-
const nodeHttpsOptions = {
|
|
357
|
-
headers: request.headers,
|
|
358
|
-
host: hostname,
|
|
359
|
-
method: request.method,
|
|
360
|
-
path,
|
|
361
|
-
port: request.port,
|
|
362
|
-
agent,
|
|
363
|
-
auth
|
|
364
|
-
};
|
|
365
|
-
const requestFunc = isSSL ? import_https.request : import_http.request;
|
|
366
|
-
const req = requestFunc(nodeHttpsOptions, (res) => {
|
|
367
|
-
const httpResponse = new import_protocol_http.HttpResponse({
|
|
368
|
-
statusCode: res.statusCode || -1,
|
|
369
|
-
reason: res.statusMessage,
|
|
370
|
-
headers: getTransformedHeaders(res.headers),
|
|
371
|
-
body: res
|
|
372
|
-
});
|
|
373
|
-
resolve({ response: httpResponse });
|
|
374
|
-
});
|
|
375
|
-
req.on("error", (err) => {
|
|
376
|
-
if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
|
|
377
|
-
reject(Object.assign(err, { name: "TimeoutError" }));
|
|
378
|
-
} else {
|
|
379
|
-
reject(err);
|
|
380
|
-
}
|
|
381
|
-
});
|
|
382
|
-
if (abortSignal) {
|
|
383
|
-
const onAbort = /* @__PURE__ */ __name(() => {
|
|
384
|
-
req.destroy();
|
|
385
|
-
const abortError = new Error("Request aborted");
|
|
386
|
-
abortError.name = "AbortError";
|
|
387
|
-
reject(abortError);
|
|
388
|
-
}, "onAbort");
|
|
389
|
-
if (typeof abortSignal.addEventListener === "function") {
|
|
390
|
-
const signal = abortSignal;
|
|
391
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
392
|
-
req.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
393
|
-
} else {
|
|
394
|
-
abortSignal.onabort = onAbort;
|
|
183
|
+
if (sockets && requests) {
|
|
184
|
+
for (const origin in sockets) {
|
|
185
|
+
const socketsInUse = sockets[origin]?.length ?? 0;
|
|
186
|
+
const requestsEnqueued = requests[origin]?.length ?? 0;
|
|
187
|
+
if (socketsInUse >= maxSockets && requestsEnqueued >= 2 * maxSockets) {
|
|
188
|
+
logger?.warn?.(`@smithy/node-http-handler:WARN - socket usage at capacity=${socketsInUse} and ${requestsEnqueued} additional requests are enqueued.
|
|
189
|
+
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
|
|
190
|
+
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.`);
|
|
191
|
+
return Date.now();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
395
194
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
this.sessions = [];
|
|
443
|
-
this.sessions = sessions ?? [];
|
|
444
|
-
}
|
|
445
|
-
static {
|
|
446
|
-
__name(this, "NodeHttp2ConnectionPool");
|
|
447
|
-
}
|
|
448
|
-
poll() {
|
|
449
|
-
if (this.sessions.length > 0) {
|
|
450
|
-
return this.sessions.shift();
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
offerLast(session) {
|
|
454
|
-
this.sessions.push(session);
|
|
455
|
-
}
|
|
456
|
-
contains(session) {
|
|
457
|
-
return this.sessions.includes(session);
|
|
458
|
-
}
|
|
459
|
-
remove(session) {
|
|
460
|
-
this.sessions = this.sessions.filter((s) => s !== session);
|
|
461
|
-
}
|
|
462
|
-
[Symbol.iterator]() {
|
|
463
|
-
return this.sessions[Symbol.iterator]();
|
|
464
|
-
}
|
|
465
|
-
destroy(connection) {
|
|
466
|
-
for (const session of this.sessions) {
|
|
467
|
-
if (session === connection) {
|
|
468
|
-
if (!session.destroyed) {
|
|
469
|
-
session.destroy();
|
|
195
|
+
return socketWarningTimestamp;
|
|
196
|
+
}
|
|
197
|
+
constructor(options) {
|
|
198
|
+
this.configProvider = new Promise((resolve, reject) => {
|
|
199
|
+
if (typeof options === "function") {
|
|
200
|
+
options()
|
|
201
|
+
.then((_options) => {
|
|
202
|
+
resolve(this.resolveDefaultConfig(_options));
|
|
203
|
+
})
|
|
204
|
+
.catch(reject);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
resolve(this.resolveDefaultConfig(options));
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
resolveDefaultConfig(options) {
|
|
212
|
+
const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent } = options || {};
|
|
213
|
+
const keepAlive = true;
|
|
214
|
+
const maxSockets = 50;
|
|
215
|
+
return {
|
|
216
|
+
connectionTimeout,
|
|
217
|
+
requestTimeout: requestTimeout ?? socketTimeout,
|
|
218
|
+
socketAcquisitionWarningTimeout,
|
|
219
|
+
httpAgent: (() => {
|
|
220
|
+
if (httpAgent instanceof http.Agent || typeof httpAgent?.destroy === "function") {
|
|
221
|
+
return httpAgent;
|
|
222
|
+
}
|
|
223
|
+
return new http.Agent({ keepAlive, maxSockets, ...httpAgent });
|
|
224
|
+
})(),
|
|
225
|
+
httpsAgent: (() => {
|
|
226
|
+
if (httpsAgent instanceof https.Agent || typeof httpsAgent?.destroy === "function") {
|
|
227
|
+
return httpsAgent;
|
|
228
|
+
}
|
|
229
|
+
return new https.Agent({ keepAlive, maxSockets, ...httpsAgent });
|
|
230
|
+
})(),
|
|
231
|
+
logger: console,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
destroy() {
|
|
235
|
+
this.config?.httpAgent?.destroy();
|
|
236
|
+
this.config?.httpsAgent?.destroy();
|
|
237
|
+
}
|
|
238
|
+
async handle(request, { abortSignal, requestTimeout } = {}) {
|
|
239
|
+
if (!this.config) {
|
|
240
|
+
this.config = await this.configProvider;
|
|
470
241
|
}
|
|
471
|
-
|
|
242
|
+
return new Promise((_resolve, _reject) => {
|
|
243
|
+
let writeRequestBodyPromise = undefined;
|
|
244
|
+
const timeouts = [];
|
|
245
|
+
const resolve = async (arg) => {
|
|
246
|
+
await writeRequestBodyPromise;
|
|
247
|
+
timeouts.forEach(timing.clearTimeout);
|
|
248
|
+
_resolve(arg);
|
|
249
|
+
};
|
|
250
|
+
const reject = async (arg) => {
|
|
251
|
+
await writeRequestBodyPromise;
|
|
252
|
+
timeouts.forEach(timing.clearTimeout);
|
|
253
|
+
_reject(arg);
|
|
254
|
+
};
|
|
255
|
+
if (!this.config) {
|
|
256
|
+
throw new Error("Node HTTP request handler config is not resolved");
|
|
257
|
+
}
|
|
258
|
+
if (abortSignal?.aborted) {
|
|
259
|
+
const abortError = new Error("Request aborted");
|
|
260
|
+
abortError.name = "AbortError";
|
|
261
|
+
reject(abortError);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const isSSL = request.protocol === "https:";
|
|
265
|
+
const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
|
|
266
|
+
timeouts.push(timing.setTimeout(() => {
|
|
267
|
+
this.socketWarningTimestamp = NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, this.config.logger);
|
|
268
|
+
}, this.config.socketAcquisitionWarningTimeout ??
|
|
269
|
+
(this.config.requestTimeout ?? 2000) + (this.config.connectionTimeout ?? 1000)));
|
|
270
|
+
const queryString = querystringBuilder.buildQueryString(request.query || {});
|
|
271
|
+
let auth = undefined;
|
|
272
|
+
if (request.username != null || request.password != null) {
|
|
273
|
+
const username = request.username ?? "";
|
|
274
|
+
const password = request.password ?? "";
|
|
275
|
+
auth = `${username}:${password}`;
|
|
276
|
+
}
|
|
277
|
+
let path = request.path;
|
|
278
|
+
if (queryString) {
|
|
279
|
+
path += `?${queryString}`;
|
|
280
|
+
}
|
|
281
|
+
if (request.fragment) {
|
|
282
|
+
path += `#${request.fragment}`;
|
|
283
|
+
}
|
|
284
|
+
let hostname = request.hostname ?? "";
|
|
285
|
+
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
286
|
+
hostname = request.hostname.slice(1, -1);
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
hostname = request.hostname;
|
|
290
|
+
}
|
|
291
|
+
const nodeHttpsOptions = {
|
|
292
|
+
headers: request.headers,
|
|
293
|
+
host: hostname,
|
|
294
|
+
method: request.method,
|
|
295
|
+
path,
|
|
296
|
+
port: request.port,
|
|
297
|
+
agent,
|
|
298
|
+
auth,
|
|
299
|
+
};
|
|
300
|
+
const requestFunc = isSSL ? https.request : http.request;
|
|
301
|
+
const req = requestFunc(nodeHttpsOptions, (res) => {
|
|
302
|
+
const httpResponse = new protocolHttp.HttpResponse({
|
|
303
|
+
statusCode: res.statusCode || -1,
|
|
304
|
+
reason: res.statusMessage,
|
|
305
|
+
headers: getTransformedHeaders(res.headers),
|
|
306
|
+
body: res,
|
|
307
|
+
});
|
|
308
|
+
resolve({ response: httpResponse });
|
|
309
|
+
});
|
|
310
|
+
req.on("error", (err) => {
|
|
311
|
+
if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
|
|
312
|
+
reject(Object.assign(err, { name: "TimeoutError" }));
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
reject(err);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
if (abortSignal) {
|
|
319
|
+
const onAbort = () => {
|
|
320
|
+
req.destroy();
|
|
321
|
+
const abortError = new Error("Request aborted");
|
|
322
|
+
abortError.name = "AbortError";
|
|
323
|
+
reject(abortError);
|
|
324
|
+
};
|
|
325
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
326
|
+
const signal = abortSignal;
|
|
327
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
328
|
+
req.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
abortSignal.onabort = onAbort;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
const effectiveRequestTimeout = requestTimeout ?? this.config.requestTimeout;
|
|
335
|
+
timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout));
|
|
336
|
+
timeouts.push(setSocketTimeout(req, reject, effectiveRequestTimeout));
|
|
337
|
+
const httpAgent = nodeHttpsOptions.agent;
|
|
338
|
+
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
339
|
+
timeouts.push(setSocketKeepAlive(req, {
|
|
340
|
+
keepAlive: httpAgent.keepAlive,
|
|
341
|
+
keepAliveMsecs: httpAgent.keepAliveMsecs,
|
|
342
|
+
}));
|
|
343
|
+
}
|
|
344
|
+
writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout).catch((e) => {
|
|
345
|
+
timeouts.forEach(timing.clearTimeout);
|
|
346
|
+
return _reject(e);
|
|
347
|
+
});
|
|
348
|
+
});
|
|
472
349
|
}
|
|
473
|
-
|
|
474
|
-
|
|
350
|
+
updateHttpClientConfig(key, value) {
|
|
351
|
+
this.config = undefined;
|
|
352
|
+
this.configProvider = this.configProvider.then((config) => {
|
|
353
|
+
return {
|
|
354
|
+
...config,
|
|
355
|
+
[key]: value,
|
|
356
|
+
};
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
httpHandlerConfigs() {
|
|
360
|
+
return this.config ?? {};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
475
363
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
static {
|
|
486
|
-
__name(this, "NodeHttp2ConnectionManager");
|
|
487
|
-
}
|
|
488
|
-
lease(requestContext, connectionConfiguration) {
|
|
489
|
-
const url = this.getUrlString(requestContext);
|
|
490
|
-
const existingPool = this.sessionCache.get(url);
|
|
491
|
-
if (existingPool) {
|
|
492
|
-
const existingSession = existingPool.poll();
|
|
493
|
-
if (existingSession && !this.config.disableConcurrency) {
|
|
494
|
-
return existingSession;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
const session = import_http2.default.connect(url);
|
|
498
|
-
if (this.config.maxConcurrency) {
|
|
499
|
-
session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
|
|
500
|
-
if (err) {
|
|
501
|
-
throw new Error(
|
|
502
|
-
"Fail to set maxConcurrentStreams to " + this.config.maxConcurrency + "when creating new session for " + requestContext.destination.toString()
|
|
503
|
-
);
|
|
364
|
+
class NodeHttp2ConnectionPool {
|
|
365
|
+
sessions = [];
|
|
366
|
+
constructor(sessions) {
|
|
367
|
+
this.sessions = sessions ?? [];
|
|
368
|
+
}
|
|
369
|
+
poll() {
|
|
370
|
+
if (this.sessions.length > 0) {
|
|
371
|
+
return this.sessions.shift();
|
|
504
372
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
session
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
* Delete a session from the connection pool.
|
|
526
|
-
* @param authority The authority of the session to delete.
|
|
527
|
-
* @param session The session to delete.
|
|
528
|
-
*/
|
|
529
|
-
deleteSession(authority, session) {
|
|
530
|
-
const existingConnectionPool = this.sessionCache.get(authority);
|
|
531
|
-
if (!existingConnectionPool) {
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
if (!existingConnectionPool.contains(session)) {
|
|
535
|
-
return;
|
|
536
|
-
}
|
|
537
|
-
existingConnectionPool.remove(session);
|
|
538
|
-
this.sessionCache.set(authority, existingConnectionPool);
|
|
539
|
-
}
|
|
540
|
-
release(requestContext, session) {
|
|
541
|
-
const cacheKey = this.getUrlString(requestContext);
|
|
542
|
-
this.sessionCache.get(cacheKey)?.offerLast(session);
|
|
543
|
-
}
|
|
544
|
-
destroy() {
|
|
545
|
-
for (const [key, connectionPool] of this.sessionCache) {
|
|
546
|
-
for (const session of connectionPool) {
|
|
547
|
-
if (!session.destroyed) {
|
|
548
|
-
session.destroy();
|
|
373
|
+
}
|
|
374
|
+
offerLast(session) {
|
|
375
|
+
this.sessions.push(session);
|
|
376
|
+
}
|
|
377
|
+
contains(session) {
|
|
378
|
+
return this.sessions.includes(session);
|
|
379
|
+
}
|
|
380
|
+
remove(session) {
|
|
381
|
+
this.sessions = this.sessions.filter((s) => s !== session);
|
|
382
|
+
}
|
|
383
|
+
[Symbol.iterator]() {
|
|
384
|
+
return this.sessions[Symbol.iterator]();
|
|
385
|
+
}
|
|
386
|
+
destroy(connection) {
|
|
387
|
+
for (const session of this.sessions) {
|
|
388
|
+
if (session === connection) {
|
|
389
|
+
if (!session.destroyed) {
|
|
390
|
+
session.destroy();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
549
393
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
this.sessionCache.delete(key);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
setMaxConcurrentStreams(maxConcurrentStreams) {
|
|
556
|
-
if (maxConcurrentStreams && maxConcurrentStreams <= 0) {
|
|
557
|
-
throw new RangeError("maxConcurrentStreams must be greater than zero.");
|
|
558
|
-
}
|
|
559
|
-
this.config.maxConcurrency = maxConcurrentStreams;
|
|
560
|
-
}
|
|
561
|
-
setDisableConcurrentStreams(disableConcurrentStreams) {
|
|
562
|
-
this.config.disableConcurrency = disableConcurrentStreams;
|
|
563
|
-
}
|
|
564
|
-
getUrlString(request) {
|
|
565
|
-
return request.destination.toString();
|
|
566
|
-
}
|
|
567
|
-
};
|
|
394
|
+
}
|
|
395
|
+
}
|
|
568
396
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
this.configProvider = new Promise((resolve, reject) => {
|
|
575
|
-
if (typeof options === "function") {
|
|
576
|
-
options().then((opts) => {
|
|
577
|
-
resolve(opts || {});
|
|
578
|
-
}).catch(reject);
|
|
579
|
-
} else {
|
|
580
|
-
resolve(options || {});
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
static {
|
|
585
|
-
__name(this, "NodeHttp2Handler");
|
|
586
|
-
}
|
|
587
|
-
/**
|
|
588
|
-
* @returns the input if it is an HttpHandler of any class,
|
|
589
|
-
* or instantiates a new instance of this handler.
|
|
590
|
-
*/
|
|
591
|
-
static create(instanceOrOptions) {
|
|
592
|
-
if (typeof instanceOrOptions?.handle === "function") {
|
|
593
|
-
return instanceOrOptions;
|
|
594
|
-
}
|
|
595
|
-
return new _NodeHttp2Handler(instanceOrOptions);
|
|
596
|
-
}
|
|
597
|
-
destroy() {
|
|
598
|
-
this.connectionManager.destroy();
|
|
599
|
-
}
|
|
600
|
-
async handle(request, { abortSignal, requestTimeout } = {}) {
|
|
601
|
-
if (!this.config) {
|
|
602
|
-
this.config = await this.configProvider;
|
|
603
|
-
this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false);
|
|
604
|
-
if (this.config.maxConcurrentStreams) {
|
|
605
|
-
this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams);
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
|
|
609
|
-
const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
|
|
610
|
-
return new Promise((_resolve, _reject) => {
|
|
611
|
-
let fulfilled = false;
|
|
612
|
-
let writeRequestBodyPromise = void 0;
|
|
613
|
-
const resolve = /* @__PURE__ */ __name(async (arg) => {
|
|
614
|
-
await writeRequestBodyPromise;
|
|
615
|
-
_resolve(arg);
|
|
616
|
-
}, "resolve");
|
|
617
|
-
const reject = /* @__PURE__ */ __name(async (arg) => {
|
|
618
|
-
await writeRequestBodyPromise;
|
|
619
|
-
_reject(arg);
|
|
620
|
-
}, "reject");
|
|
621
|
-
if (abortSignal?.aborted) {
|
|
622
|
-
fulfilled = true;
|
|
623
|
-
const abortError = new Error("Request aborted");
|
|
624
|
-
abortError.name = "AbortError";
|
|
625
|
-
reject(abortError);
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
const { hostname, method, port, protocol, query } = request;
|
|
629
|
-
let auth = "";
|
|
630
|
-
if (request.username != null || request.password != null) {
|
|
631
|
-
const username = request.username ?? "";
|
|
632
|
-
const password = request.password ?? "";
|
|
633
|
-
auth = `${username}:${password}@`;
|
|
634
|
-
}
|
|
635
|
-
const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
|
|
636
|
-
const requestContext = { destination: new URL(authority) };
|
|
637
|
-
const session = this.connectionManager.lease(requestContext, {
|
|
638
|
-
requestTimeout: this.config?.sessionTimeout,
|
|
639
|
-
disableConcurrentStreams: disableConcurrentStreams || false
|
|
640
|
-
});
|
|
641
|
-
const rejectWithDestroy = /* @__PURE__ */ __name((err) => {
|
|
642
|
-
if (disableConcurrentStreams) {
|
|
643
|
-
this.destroySession(session);
|
|
397
|
+
class NodeHttp2ConnectionManager {
|
|
398
|
+
constructor(config) {
|
|
399
|
+
this.config = config;
|
|
400
|
+
if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
|
|
401
|
+
throw new RangeError("maxConcurrency must be greater than zero.");
|
|
644
402
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
const req = session.request({
|
|
657
|
-
...request.headers,
|
|
658
|
-
[import_http22.constants.HTTP2_HEADER_PATH]: path,
|
|
659
|
-
[import_http22.constants.HTTP2_HEADER_METHOD]: method
|
|
660
|
-
});
|
|
661
|
-
session.ref();
|
|
662
|
-
req.on("response", (headers) => {
|
|
663
|
-
const httpResponse = new import_protocol_http.HttpResponse({
|
|
664
|
-
statusCode: headers[":status"] || -1,
|
|
665
|
-
headers: getTransformedHeaders(headers),
|
|
666
|
-
body: req
|
|
667
|
-
});
|
|
668
|
-
fulfilled = true;
|
|
669
|
-
resolve({ response: httpResponse });
|
|
670
|
-
if (disableConcurrentStreams) {
|
|
671
|
-
session.close();
|
|
672
|
-
this.connectionManager.deleteSession(authority, session);
|
|
403
|
+
}
|
|
404
|
+
config;
|
|
405
|
+
sessionCache = new Map();
|
|
406
|
+
lease(requestContext, connectionConfiguration) {
|
|
407
|
+
const url = this.getUrlString(requestContext);
|
|
408
|
+
const existingPool = this.sessionCache.get(url);
|
|
409
|
+
if (existingPool) {
|
|
410
|
+
const existingSession = existingPool.poll();
|
|
411
|
+
if (existingSession && !this.config.disableConcurrency) {
|
|
412
|
+
return existingSession;
|
|
413
|
+
}
|
|
673
414
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
const onAbort = /* @__PURE__ */ __name(() => {
|
|
685
|
-
req.close();
|
|
686
|
-
const abortError = new Error("Request aborted");
|
|
687
|
-
abortError.name = "AbortError";
|
|
688
|
-
rejectWithDestroy(abortError);
|
|
689
|
-
}, "onAbort");
|
|
690
|
-
if (typeof abortSignal.addEventListener === "function") {
|
|
691
|
-
const signal = abortSignal;
|
|
692
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
693
|
-
req.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
694
|
-
} else {
|
|
695
|
-
abortSignal.onabort = onAbort;
|
|
415
|
+
const session = http2.connect(url);
|
|
416
|
+
if (this.config.maxConcurrency) {
|
|
417
|
+
session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
|
|
418
|
+
if (err) {
|
|
419
|
+
throw new Error("Fail to set maxConcurrentStreams to " +
|
|
420
|
+
this.config.maxConcurrency +
|
|
421
|
+
"when creating new session for " +
|
|
422
|
+
requestContext.destination.toString());
|
|
423
|
+
}
|
|
424
|
+
});
|
|
696
425
|
}
|
|
697
|
-
}
|
|
698
|
-
req.on("frameError", (type, code, id) => {
|
|
699
|
-
rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
|
|
700
|
-
});
|
|
701
|
-
req.on("error", rejectWithDestroy);
|
|
702
|
-
req.on("aborted", () => {
|
|
703
|
-
rejectWithDestroy(
|
|
704
|
-
new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`)
|
|
705
|
-
);
|
|
706
|
-
});
|
|
707
|
-
req.on("close", () => {
|
|
708
426
|
session.unref();
|
|
709
|
-
|
|
710
|
-
|
|
427
|
+
const destroySessionCb = () => {
|
|
428
|
+
session.destroy();
|
|
429
|
+
this.deleteSession(url, session);
|
|
430
|
+
};
|
|
431
|
+
session.on("goaway", destroySessionCb);
|
|
432
|
+
session.on("error", destroySessionCb);
|
|
433
|
+
session.on("frameError", destroySessionCb);
|
|
434
|
+
session.on("close", () => this.deleteSession(url, session));
|
|
435
|
+
if (connectionConfiguration.requestTimeout) {
|
|
436
|
+
session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb);
|
|
437
|
+
}
|
|
438
|
+
const connectionPool = this.sessionCache.get(url) || new NodeHttp2ConnectionPool();
|
|
439
|
+
connectionPool.offerLast(session);
|
|
440
|
+
this.sessionCache.set(url, connectionPool);
|
|
441
|
+
return session;
|
|
442
|
+
}
|
|
443
|
+
deleteSession(authority, session) {
|
|
444
|
+
const existingConnectionPool = this.sessionCache.get(authority);
|
|
445
|
+
if (!existingConnectionPool) {
|
|
446
|
+
return;
|
|
711
447
|
}
|
|
712
|
-
if (!
|
|
713
|
-
|
|
448
|
+
if (!existingConnectionPool.contains(session)) {
|
|
449
|
+
return;
|
|
714
450
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
|
|
451
|
+
existingConnectionPool.remove(session);
|
|
452
|
+
this.sessionCache.set(authority, existingConnectionPool);
|
|
453
|
+
}
|
|
454
|
+
release(requestContext, session) {
|
|
455
|
+
const cacheKey = this.getUrlString(requestContext);
|
|
456
|
+
this.sessionCache.get(cacheKey)?.offerLast(session);
|
|
457
|
+
}
|
|
458
|
+
destroy() {
|
|
459
|
+
for (const [key, connectionPool] of this.sessionCache) {
|
|
460
|
+
for (const session of connectionPool) {
|
|
461
|
+
if (!session.destroyed) {
|
|
462
|
+
session.destroy();
|
|
463
|
+
}
|
|
464
|
+
connectionPool.remove(session);
|
|
465
|
+
}
|
|
466
|
+
this.sessionCache.delete(key);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
setMaxConcurrentStreams(maxConcurrentStreams) {
|
|
470
|
+
if (maxConcurrentStreams && maxConcurrentStreams <= 0) {
|
|
471
|
+
throw new RangeError("maxConcurrentStreams must be greater than zero.");
|
|
472
|
+
}
|
|
473
|
+
this.config.maxConcurrency = maxConcurrentStreams;
|
|
474
|
+
}
|
|
475
|
+
setDisableConcurrentStreams(disableConcurrentStreams) {
|
|
476
|
+
this.config.disableConcurrency = disableConcurrentStreams;
|
|
477
|
+
}
|
|
478
|
+
getUrlString(request) {
|
|
479
|
+
return request.destination.toString();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
741
482
|
|
|
742
|
-
|
|
483
|
+
class NodeHttp2Handler {
|
|
484
|
+
config;
|
|
485
|
+
configProvider;
|
|
486
|
+
metadata = { handlerProtocol: "h2" };
|
|
487
|
+
connectionManager = new NodeHttp2ConnectionManager({});
|
|
488
|
+
static create(instanceOrOptions) {
|
|
489
|
+
if (typeof instanceOrOptions?.handle === "function") {
|
|
490
|
+
return instanceOrOptions;
|
|
491
|
+
}
|
|
492
|
+
return new NodeHttp2Handler(instanceOrOptions);
|
|
493
|
+
}
|
|
494
|
+
constructor(options) {
|
|
495
|
+
this.configProvider = new Promise((resolve, reject) => {
|
|
496
|
+
if (typeof options === "function") {
|
|
497
|
+
options()
|
|
498
|
+
.then((opts) => {
|
|
499
|
+
resolve(opts || {});
|
|
500
|
+
})
|
|
501
|
+
.catch(reject);
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
resolve(options || {});
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
destroy() {
|
|
509
|
+
this.connectionManager.destroy();
|
|
510
|
+
}
|
|
511
|
+
async handle(request, { abortSignal, requestTimeout } = {}) {
|
|
512
|
+
if (!this.config) {
|
|
513
|
+
this.config = await this.configProvider;
|
|
514
|
+
this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false);
|
|
515
|
+
if (this.config.maxConcurrentStreams) {
|
|
516
|
+
this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
|
|
520
|
+
const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
|
|
521
|
+
return new Promise((_resolve, _reject) => {
|
|
522
|
+
let fulfilled = false;
|
|
523
|
+
let writeRequestBodyPromise = undefined;
|
|
524
|
+
const resolve = async (arg) => {
|
|
525
|
+
await writeRequestBodyPromise;
|
|
526
|
+
_resolve(arg);
|
|
527
|
+
};
|
|
528
|
+
const reject = async (arg) => {
|
|
529
|
+
await writeRequestBodyPromise;
|
|
530
|
+
_reject(arg);
|
|
531
|
+
};
|
|
532
|
+
if (abortSignal?.aborted) {
|
|
533
|
+
fulfilled = true;
|
|
534
|
+
const abortError = new Error("Request aborted");
|
|
535
|
+
abortError.name = "AbortError";
|
|
536
|
+
reject(abortError);
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
const { hostname, method, port, protocol, query } = request;
|
|
540
|
+
let auth = "";
|
|
541
|
+
if (request.username != null || request.password != null) {
|
|
542
|
+
const username = request.username ?? "";
|
|
543
|
+
const password = request.password ?? "";
|
|
544
|
+
auth = `${username}:${password}@`;
|
|
545
|
+
}
|
|
546
|
+
const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
|
|
547
|
+
const requestContext = { destination: new URL(authority) };
|
|
548
|
+
const session = this.connectionManager.lease(requestContext, {
|
|
549
|
+
requestTimeout: this.config?.sessionTimeout,
|
|
550
|
+
disableConcurrentStreams: disableConcurrentStreams || false,
|
|
551
|
+
});
|
|
552
|
+
const rejectWithDestroy = (err) => {
|
|
553
|
+
if (disableConcurrentStreams) {
|
|
554
|
+
this.destroySession(session);
|
|
555
|
+
}
|
|
556
|
+
fulfilled = true;
|
|
557
|
+
reject(err);
|
|
558
|
+
};
|
|
559
|
+
const queryString = querystringBuilder.buildQueryString(query || {});
|
|
560
|
+
let path = request.path;
|
|
561
|
+
if (queryString) {
|
|
562
|
+
path += `?${queryString}`;
|
|
563
|
+
}
|
|
564
|
+
if (request.fragment) {
|
|
565
|
+
path += `#${request.fragment}`;
|
|
566
|
+
}
|
|
567
|
+
const req = session.request({
|
|
568
|
+
...request.headers,
|
|
569
|
+
[http2.constants.HTTP2_HEADER_PATH]: path,
|
|
570
|
+
[http2.constants.HTTP2_HEADER_METHOD]: method,
|
|
571
|
+
});
|
|
572
|
+
session.ref();
|
|
573
|
+
req.on("response", (headers) => {
|
|
574
|
+
const httpResponse = new protocolHttp.HttpResponse({
|
|
575
|
+
statusCode: headers[":status"] || -1,
|
|
576
|
+
headers: getTransformedHeaders(headers),
|
|
577
|
+
body: req,
|
|
578
|
+
});
|
|
579
|
+
fulfilled = true;
|
|
580
|
+
resolve({ response: httpResponse });
|
|
581
|
+
if (disableConcurrentStreams) {
|
|
582
|
+
session.close();
|
|
583
|
+
this.connectionManager.deleteSession(authority, session);
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
if (effectiveRequestTimeout) {
|
|
587
|
+
req.setTimeout(effectiveRequestTimeout, () => {
|
|
588
|
+
req.close();
|
|
589
|
+
const timeoutError = new Error(`Stream timed out because of no activity for ${effectiveRequestTimeout} ms`);
|
|
590
|
+
timeoutError.name = "TimeoutError";
|
|
591
|
+
rejectWithDestroy(timeoutError);
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
if (abortSignal) {
|
|
595
|
+
const onAbort = () => {
|
|
596
|
+
req.close();
|
|
597
|
+
const abortError = new Error("Request aborted");
|
|
598
|
+
abortError.name = "AbortError";
|
|
599
|
+
rejectWithDestroy(abortError);
|
|
600
|
+
};
|
|
601
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
602
|
+
const signal = abortSignal;
|
|
603
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
604
|
+
req.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
abortSignal.onabort = onAbort;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
req.on("frameError", (type, code, id) => {
|
|
611
|
+
rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
|
|
612
|
+
});
|
|
613
|
+
req.on("error", rejectWithDestroy);
|
|
614
|
+
req.on("aborted", () => {
|
|
615
|
+
rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`));
|
|
616
|
+
});
|
|
617
|
+
req.on("close", () => {
|
|
618
|
+
session.unref();
|
|
619
|
+
if (disableConcurrentStreams) {
|
|
620
|
+
session.destroy();
|
|
621
|
+
}
|
|
622
|
+
if (!fulfilled) {
|
|
623
|
+
rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response"));
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout);
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
updateHttpClientConfig(key, value) {
|
|
630
|
+
this.config = undefined;
|
|
631
|
+
this.configProvider = this.configProvider.then((config) => {
|
|
632
|
+
return {
|
|
633
|
+
...config,
|
|
634
|
+
[key]: value,
|
|
635
|
+
};
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
httpHandlerConfigs() {
|
|
639
|
+
return this.config ?? {};
|
|
640
|
+
}
|
|
641
|
+
destroySession(session) {
|
|
642
|
+
if (!session.destroyed) {
|
|
643
|
+
session.destroy();
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
743
647
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}
|
|
752
|
-
_write(chunk, encoding, callback) {
|
|
753
|
-
this.bufferedBytes.push(chunk);
|
|
754
|
-
callback();
|
|
755
|
-
}
|
|
756
|
-
};
|
|
648
|
+
class Collector extends stream.Writable {
|
|
649
|
+
bufferedBytes = [];
|
|
650
|
+
_write(chunk, encoding, callback) {
|
|
651
|
+
this.bufferedBytes.push(chunk);
|
|
652
|
+
callback();
|
|
653
|
+
}
|
|
654
|
+
}
|
|
757
655
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
656
|
+
const streamCollector = (stream) => {
|
|
657
|
+
if (isReadableStreamInstance(stream)) {
|
|
658
|
+
return collectReadableStream(stream);
|
|
659
|
+
}
|
|
660
|
+
return new Promise((resolve, reject) => {
|
|
661
|
+
const collector = new Collector();
|
|
662
|
+
stream.pipe(collector);
|
|
663
|
+
stream.on("error", (err) => {
|
|
664
|
+
collector.end();
|
|
665
|
+
reject(err);
|
|
666
|
+
});
|
|
667
|
+
collector.on("error", reject);
|
|
668
|
+
collector.on("finish", function () {
|
|
669
|
+
const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
|
|
670
|
+
resolve(bytes);
|
|
671
|
+
});
|
|
774
672
|
});
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
var isReadableStreamInstance = /* @__PURE__ */ __name((stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream, "isReadableStreamInstance");
|
|
673
|
+
};
|
|
674
|
+
const isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
|
|
778
675
|
async function collectReadableStream(stream) {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
676
|
+
const chunks = [];
|
|
677
|
+
const reader = stream.getReader();
|
|
678
|
+
let isDone = false;
|
|
679
|
+
let length = 0;
|
|
680
|
+
while (!isDone) {
|
|
681
|
+
const { done, value } = await reader.read();
|
|
682
|
+
if (value) {
|
|
683
|
+
chunks.push(value);
|
|
684
|
+
length += value.length;
|
|
685
|
+
}
|
|
686
|
+
isDone = done;
|
|
687
|
+
}
|
|
688
|
+
const collected = new Uint8Array(length);
|
|
689
|
+
let offset = 0;
|
|
690
|
+
for (const chunk of chunks) {
|
|
691
|
+
collected.set(chunk, offset);
|
|
692
|
+
offset += chunk.length;
|
|
693
|
+
}
|
|
694
|
+
return collected;
|
|
798
695
|
}
|
|
799
|
-
__name(collectReadableStream, "collectReadableStream");
|
|
800
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
801
|
-
|
|
802
|
-
0 && (module.exports = {
|
|
803
|
-
DEFAULT_REQUEST_TIMEOUT,
|
|
804
|
-
NodeHttpHandler,
|
|
805
|
-
NodeHttp2Handler,
|
|
806
|
-
streamCollector
|
|
807
|
-
});
|
|
808
696
|
|
|
697
|
+
exports.DEFAULT_REQUEST_TIMEOUT = DEFAULT_REQUEST_TIMEOUT;
|
|
698
|
+
exports.NodeHttp2Handler = NodeHttp2Handler;
|
|
699
|
+
exports.NodeHttpHandler = NodeHttpHandler;
|
|
700
|
+
exports.streamCollector = streamCollector;
|