@cdklabs/cdk-ecs-codedeploy 0.0.461 → 0.0.462
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 +3 -3
- package/lib/api-canary/index.js +1 -1
- package/lib/ecs-appspec/index.js +1 -1
- package/lib/ecs-deployment/index.js +1 -1
- package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
- package/node_modules/@aws-sdk/client-codedeploy/dist-cjs/index.js +49 -11
- package/node_modules/@aws-sdk/client-codedeploy/dist-es/models/enums.js +6 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-es/models/errors.js +13 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-es/schemas/schemas_0.js +27 -11
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/CodeDeployClient.d.ts +2 -1
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/BatchGetDeploymentGroupsCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/BatchGetDeploymentsCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/CreateDeploymentCommand.d.ts +11 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/CreateDeploymentGroupCommand.d.ts +11 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/GetDeploymentCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/GetDeploymentGroupCommand.d.ts +5 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/UpdateDeploymentGroupCommand.d.ts +11 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/enums.d.ts +14 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/errors.d.ts +16 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/models_0.d.ts +64 -1
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/schemas/schemas_0.d.ts +2 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/enums.d.ts +8 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/errors.d.ts +8 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/models_0.d.ts +9 -0
- package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/schemas/schemas_0.d.ts +2 -0
- package/node_modules/@aws-sdk/client-codedeploy/package.json +5 -5
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +94 -1589
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -7
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -8
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -10
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
- package/node_modules/@aws-sdk/core/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-login/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentityClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/SigninClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSOClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDCClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +2 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +37 -19
- package/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +37 -19
- package/node_modules/@aws-sdk/token-providers/package.json +5 -5
- package/node_modules/@aws-sdk/types/dist-types/feature-ids.d.ts +3 -0
- package/node_modules/@aws-sdk/types/dist-types/ts3.4/feature-ids.d.ts +3 -0
- package/node_modules/@aws-sdk/types/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +15 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +10 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +10 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +49 -34
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +16 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +10 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +8 -31
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +5 -5
- package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/dist-types/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/RpcProtocol.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
- package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
- package/node_modules/@smithy/node-http-handler/dist-types/resolve-default-socket-timeout.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/resolve-default-socket-timeout.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/package.json +3 -3
- package/package.json +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +0 -20
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +0 -160
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +0 -193
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -103
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -20
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +0 -200
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +0 -519
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/detectBufferParsing.js +0 -18
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js +0 -46
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js +0 -121
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/needsReviver.js +0 -41
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js +0 -89
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -15
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -14
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -29
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -51
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -13
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -30
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -60
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +0 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/jsonReplacer.d.ts +0 -21
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/jsonReviver.d.ts +0 -15
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/needsReviver.d.ts +0 -11
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +0 -22
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +0 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -11
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -27
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -9
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -15
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -39
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +0 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +0 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +0 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +0 -14
|
@@ -14,6 +14,9 @@ export class HeaderMarshaller {
|
|
|
14
14
|
if (!hasOwn(headers, headerName))
|
|
15
15
|
continue;
|
|
16
16
|
const bytes = this.fromUtf8(headerName);
|
|
17
|
+
if (bytes.byteLength > 255) {
|
|
18
|
+
throw new Error(`@smithy/core/event-streams - header name exceeds 255 bytes: ${bytes.byteLength}`);
|
|
19
|
+
}
|
|
17
20
|
chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
|
|
18
21
|
}
|
|
19
22
|
const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
|
|
@@ -46,6 +49,9 @@ export class HeaderMarshaller {
|
|
|
46
49
|
longBytes.set(header.value.bytes, 1);
|
|
47
50
|
return longBytes;
|
|
48
51
|
case "binary":
|
|
52
|
+
if (header.value.byteLength > MAX_HEADER_VALUE_BYTES) {
|
|
53
|
+
throw new Error(`@smithy/core/event-streams - header value (binary) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${header.value.byteLength}`);
|
|
54
|
+
}
|
|
49
55
|
const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
|
|
50
56
|
binView.setUint8(0, 6);
|
|
51
57
|
binView.setUint16(1, header.value.byteLength, false);
|
|
@@ -54,6 +60,9 @@ export class HeaderMarshaller {
|
|
|
54
60
|
return binBytes;
|
|
55
61
|
case "string":
|
|
56
62
|
const utf8Bytes = this.fromUtf8(header.value);
|
|
63
|
+
if (utf8Bytes.byteLength > MAX_HEADER_VALUE_BYTES) {
|
|
64
|
+
throw new Error(`@smithy/core/event-streams - header value (string) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${utf8Bytes.byteLength}`);
|
|
65
|
+
}
|
|
57
66
|
const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
|
|
58
67
|
strView.setUint8(0, 7);
|
|
59
68
|
strView.setUint16(1, utf8Bytes.byteLength, false);
|
|
@@ -185,3 +194,4 @@ const STRING_TAG = "string";
|
|
|
185
194
|
const TIMESTAMP_TAG = "timestamp";
|
|
186
195
|
const UUID_TAG = "uuid";
|
|
187
196
|
const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
197
|
+
const MAX_HEADER_VALUE_BYTES = 32767;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { deref } from "@smithy/core/schema";
|
|
2
|
+
import { getSmithyContext } from "@smithy/core/transport";
|
|
3
|
+
import { RpcProtocol } from "./RpcProtocol";
|
|
4
|
+
export class AbstractRpcV2Protocol extends RpcProtocol {
|
|
5
|
+
constructor({ defaultNamespace, errorTypeRegistries, }) {
|
|
6
|
+
super({ defaultNamespace, errorTypeRegistries });
|
|
7
|
+
}
|
|
8
|
+
async serializeRequest(operationSchema, input, context) {
|
|
9
|
+
const request = await super.serializeRequest(operationSchema, input, context);
|
|
10
|
+
Object.assign(request.headers, {
|
|
11
|
+
"content-type": this.getDefaultContentType(),
|
|
12
|
+
"smithy-protocol": this.getSmithyProtocolHeaderValue(),
|
|
13
|
+
accept: this.getDefaultContentType(),
|
|
14
|
+
});
|
|
15
|
+
if (deref(operationSchema.input) === "unit") {
|
|
16
|
+
delete request.body;
|
|
17
|
+
delete request.headers["content-type"];
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this.applyEmptyBody(request);
|
|
21
|
+
}
|
|
22
|
+
const { service, operation } = getSmithyContext(context);
|
|
23
|
+
const path = `/service/${service}/operation/${operation}`;
|
|
24
|
+
if (request.path.endsWith("/")) {
|
|
25
|
+
request.path += path.slice(1);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
request.path += path;
|
|
29
|
+
}
|
|
30
|
+
return request;
|
|
31
|
+
}
|
|
32
|
+
isErrorResponse(statusCode) {
|
|
33
|
+
return statusCode !== 200;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -59,7 +59,7 @@ export class RpcProtocol extends HttpProtocol {
|
|
|
59
59
|
const deserializer = this.deserializer;
|
|
60
60
|
const ns = NormalizedSchema.of(operationSchema.output);
|
|
61
61
|
const dataObject = {};
|
|
62
|
-
if (response.statusCode
|
|
62
|
+
if (this.isErrorResponse(response.statusCode)) {
|
|
63
63
|
const bytes = await collectBody(response.body, context);
|
|
64
64
|
if (bytes.byteLength > 0) {
|
|
65
65
|
Object.assign(dataObject, await deserializer.read(15, bytes));
|
|
@@ -91,4 +91,7 @@ export class RpcProtocol extends HttpProtocol {
|
|
|
91
91
|
dataObject.$metadata = this.deserializeMetadata(response);
|
|
92
92
|
return dataObject;
|
|
93
93
|
}
|
|
94
|
+
isErrorResponse(statusCode) {
|
|
95
|
+
return statusCode >= 300;
|
|
96
|
+
}
|
|
94
97
|
}
|
|
@@ -3,6 +3,7 @@ export { extendedEncodeURIComponent } from "./extended-encode-uri-component";
|
|
|
3
3
|
export { HttpBindingProtocol } from "./HttpBindingProtocol";
|
|
4
4
|
export { HttpProtocol } from "./HttpProtocol";
|
|
5
5
|
export { RpcProtocol } from "./RpcProtocol";
|
|
6
|
+
export { AbstractRpcV2Protocol } from "./AbstractRpcV2Protocol";
|
|
6
7
|
export { RequestBuilder, requestBuilder } from "./requestBuilder";
|
|
7
8
|
export { resolvedPath } from "./resolve-path";
|
|
8
9
|
export { FromStringShapeDeserializer } from "./serde/FromStringShapeDeserializer";
|
package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NormalizedSchema, TypeRegistry
|
|
3
|
-
import { getSmithyContext } from "@smithy/core/transport";
|
|
1
|
+
import { AbstractRpcV2Protocol } from "../AbstractRpcV2Protocol";
|
|
2
|
+
import { NormalizedSchema, TypeRegistry } from "@smithy/core/schema";
|
|
4
3
|
import { JsonCodec2 } from "./codec-v2/JsonCodec2";
|
|
5
4
|
import { loadSmithyRpcV2JsonErrorCode } from "./parseJsonBody";
|
|
6
|
-
export class SmithyRpcV2JsonProtocol extends
|
|
5
|
+
export class SmithyRpcV2JsonProtocol extends AbstractRpcV2Protocol {
|
|
7
6
|
codec = new JsonCodec2({
|
|
8
7
|
timestampFormat: {
|
|
9
8
|
useTrait: false,
|
|
@@ -14,41 +13,19 @@ export class SmithyRpcV2JsonProtocol extends RpcProtocol {
|
|
|
14
13
|
});
|
|
15
14
|
serializer = this.codec.createSerializer();
|
|
16
15
|
deserializer = this.codec.createDeserializer();
|
|
17
|
-
constructor({ defaultNamespace, errorTypeRegistries, }) {
|
|
18
|
-
super({ defaultNamespace, errorTypeRegistries });
|
|
19
|
-
}
|
|
20
16
|
getShapeId() {
|
|
21
17
|
return "smithy.protocols#rpcv2Json";
|
|
22
18
|
}
|
|
23
19
|
getPayloadCodec() {
|
|
24
20
|
return this.codec;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
accept: this.getDefaultContentType(),
|
|
32
|
-
});
|
|
33
|
-
if (deref(operationSchema.input) === "unit") {
|
|
34
|
-
delete request.body;
|
|
35
|
-
delete request.headers["content-type"];
|
|
36
|
-
}
|
|
37
|
-
else if (!request.body) {
|
|
22
|
+
getSmithyProtocolHeaderValue() {
|
|
23
|
+
return "rpc-v2-json";
|
|
24
|
+
}
|
|
25
|
+
applyEmptyBody(request) {
|
|
26
|
+
if (!request.body) {
|
|
38
27
|
request.body = "{}";
|
|
39
28
|
}
|
|
40
|
-
const { service, operation } = getSmithyContext(context);
|
|
41
|
-
const path = `/service/${service}/operation/${operation}`;
|
|
42
|
-
if (request.path.endsWith("/")) {
|
|
43
|
-
request.path += path.slice(1);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
request.path += path;
|
|
47
|
-
}
|
|
48
|
-
return request;
|
|
49
|
-
}
|
|
50
|
-
async deserializeResponse(operationSchema, context, response) {
|
|
51
|
-
return super.deserializeResponse(operationSchema, context, response);
|
|
52
29
|
}
|
|
53
30
|
async handleError(operationSchema, context, response, dataObject, metadata) {
|
|
54
31
|
const errorName = loadSmithyRpcV2JsonErrorCode(response, dataObject) ?? "Unknown";
|
package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js
CHANGED
|
@@ -118,9 +118,9 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
118
118
|
this.i = i;
|
|
119
119
|
}
|
|
120
120
|
writeJsonString(s) {
|
|
121
|
-
this.ensure(s.length * 3 + 2);
|
|
122
|
-
this.json[this.i++] = QUOTE;
|
|
123
121
|
const z = s.length;
|
|
122
|
+
this.ensure(z * 3 + 2);
|
|
123
|
+
this.json[this.i++] = QUOTE;
|
|
124
124
|
for (let j = 0; j < z; ++j) {
|
|
125
125
|
const c = s.charCodeAt(j);
|
|
126
126
|
if (c > 0x22 && c < 0x5c) {
|
|
@@ -129,7 +129,7 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
129
129
|
else if (c < 0x80) {
|
|
130
130
|
const esc = ESCAPE_TABLE[c];
|
|
131
131
|
if (esc !== null) {
|
|
132
|
-
this.ensure(esc.length + 1);
|
|
132
|
+
this.ensure(esc.length + 1 + (z - j - 1) * 3 + 1);
|
|
133
133
|
this.json[this.i++] = BACKSLASH;
|
|
134
134
|
for (let k = 0; k < esc.length; k++) {
|
|
135
135
|
this.json[this.i++] = esc.charCodeAt(k);
|
|
@@ -148,12 +148,12 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
148
148
|
++j;
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
|
-
this.ensure(6);
|
|
151
|
+
this.ensure(6 + (z - j - 1) * 3 + 1);
|
|
152
152
|
this.writeUnicodeEscape(c);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
else if (c >= 0xdc00 && c <= 0xdfff) {
|
|
156
|
-
this.ensure(6);
|
|
156
|
+
this.ensure(6 + (z - j - 1) * 3 + 1);
|
|
157
157
|
this.writeUnicodeEscape(c);
|
|
158
158
|
}
|
|
159
159
|
else {
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, SerdeFunctions } from "@smithy/types";
|
|
1
|
+
import { AbstractRpcV2Protocol } from "@smithy/core/protocols";
|
|
2
|
+
import type { HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, OperationSchema, ResponseMetadata, SerdeFunctions } from "@smithy/types";
|
|
4
3
|
import { CborCodec } from "./CborCodec";
|
|
5
4
|
/**
|
|
6
5
|
* Client protocol for Smithy RPCv2 CBOR.
|
|
7
6
|
*
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
|
-
export declare class SmithyRpcV2CborProtocol extends
|
|
11
|
-
/**
|
|
12
|
-
* @override
|
|
13
|
-
*/
|
|
14
|
-
protected compositeErrorRegistry: TypeRegistry;
|
|
9
|
+
export declare class SmithyRpcV2CborProtocol extends AbstractRpcV2Protocol {
|
|
15
10
|
private codec;
|
|
16
11
|
protected serializer: import(".").CborShapeSerializer2;
|
|
17
12
|
protected deserializer: import(".").CborShapeDeserializer2;
|
|
18
|
-
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
19
|
-
defaultNamespace: string;
|
|
20
|
-
errorTypeRegistries?: TypeRegistry[];
|
|
21
|
-
});
|
|
22
13
|
getShapeId(): string;
|
|
23
14
|
getPayloadCodec(): CborCodec;
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
protected getSmithyProtocolHeaderValue(): string;
|
|
16
|
+
protected applyEmptyBody(request: IHttpRequest): void;
|
|
26
17
|
protected handleError(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any, metadata: ResponseMetadata): Promise<never>;
|
|
27
18
|
protected getDefaultContentType(): string;
|
|
28
19
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, OperationSchema, SerdeFunctions } from "@smithy/types";
|
|
2
|
+
import type { TypeRegistry } from "@smithy/core/schema";
|
|
3
|
+
import { RpcProtocol } from "./RpcProtocol";
|
|
4
|
+
/**
|
|
5
|
+
* Shared abstract base for the Smithy RPC v2 client protocols (JSON and CBOR).
|
|
6
|
+
*
|
|
7
|
+
* Factors out the request-framing flow and response status handling that are
|
|
8
|
+
* identical across both RPC v2 protocols. Concrete protocols supply their
|
|
9
|
+
* codec, error handling, content type, shape id, and the two per-protocol
|
|
10
|
+
* request details via {@link getSmithyProtocolHeaderValue} and
|
|
11
|
+
* {@link applyEmptyBody}.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class AbstractRpcV2Protocol extends RpcProtocol {
|
|
16
|
+
/**
|
|
17
|
+
* @override
|
|
18
|
+
*/
|
|
19
|
+
protected compositeErrorRegistry: TypeRegistry;
|
|
20
|
+
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
21
|
+
defaultNamespace: string;
|
|
22
|
+
errorTypeRegistries?: TypeRegistry[];
|
|
23
|
+
});
|
|
24
|
+
serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
|
|
25
|
+
/**
|
|
26
|
+
* @override
|
|
27
|
+
*
|
|
28
|
+
* Per the Smithy RPC v2 specification, the only successful response status
|
|
29
|
+
* code is 200; any other status code MUST be handled as an error.
|
|
30
|
+
*/
|
|
31
|
+
protected isErrorResponse(statusCode: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @returns the value of the `smithy-protocol` header for this protocol,
|
|
34
|
+
* e.g. `rpc-v2-json` or `rpc-v2-cbor`.
|
|
35
|
+
*/
|
|
36
|
+
protected abstract getSmithyProtocolHeaderValue(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Applies this protocol's representation of an empty request body when the
|
|
39
|
+
* operation has a non-unit input but produced no serialized body. Called
|
|
40
|
+
* only for non-unit inputs.
|
|
41
|
+
*
|
|
42
|
+
* @param request - the request being serialized, mutated in place.
|
|
43
|
+
*/
|
|
44
|
+
protected abstract applyEmptyBody(request: IHttpRequest): void;
|
|
45
|
+
}
|
|
@@ -13,4 +13,16 @@ export declare abstract class RpcProtocol extends HttpProtocol {
|
|
|
13
13
|
protected compositeErrorRegistry: TypeRegistry;
|
|
14
14
|
serializeRequest<Input extends object>(operationSchema: OperationSchema, _input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
|
|
15
15
|
deserializeResponse<Output extends MetadataBearer>(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse): Promise<Output>;
|
|
16
|
+
/**
|
|
17
|
+
* Determines whether a response status code indicates an error response that
|
|
18
|
+
* should be routed to {@link handleError} rather than deserialized as output.
|
|
19
|
+
*
|
|
20
|
+
* The default treats any status code of 300 or greater as an error,
|
|
21
|
+
* preserving the historical behavior for RPC-over-HTTP protocols. Subclasses
|
|
22
|
+
* whose specification is stricter SHOULD override this.
|
|
23
|
+
*
|
|
24
|
+
* @param statusCode - the HTTP response status code.
|
|
25
|
+
* @returns true if the response should be handled as an error.
|
|
26
|
+
*/
|
|
27
|
+
protected isErrorResponse(statusCode: number): boolean;
|
|
16
28
|
}
|
|
@@ -3,6 +3,7 @@ export { extendedEncodeURIComponent } from "./extended-encode-uri-component";
|
|
|
3
3
|
export { HttpBindingProtocol } from "./HttpBindingProtocol";
|
|
4
4
|
export { HttpProtocol } from "./HttpProtocol";
|
|
5
5
|
export { RpcProtocol } from "./RpcProtocol";
|
|
6
|
+
export { AbstractRpcV2Protocol } from "./AbstractRpcV2Protocol";
|
|
6
7
|
export { RequestBuilder, requestBuilder } from "./requestBuilder";
|
|
7
8
|
export { resolvedPath } from "./resolve-path";
|
|
8
9
|
export { FromStringShapeDeserializer } from "./serde/FromStringShapeDeserializer";
|
package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
|
|
1
|
+
import { AbstractRpcV2Protocol } from "../AbstractRpcV2Protocol";
|
|
2
|
+
import type { HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, OperationSchema, ResponseMetadata, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
|
|
4
3
|
import { JsonCodec2 } from "./codec-v2/JsonCodec2";
|
|
5
4
|
/**
|
|
6
5
|
* Client protocol for Smithy RPCv2 JSON.
|
|
7
6
|
*
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
|
-
export declare class SmithyRpcV2JsonProtocol extends
|
|
11
|
-
/**
|
|
12
|
-
* @override
|
|
13
|
-
*/
|
|
14
|
-
protected compositeErrorRegistry: TypeRegistry;
|
|
9
|
+
export declare class SmithyRpcV2JsonProtocol extends AbstractRpcV2Protocol {
|
|
15
10
|
private codec;
|
|
16
11
|
protected serializer: ShapeSerializer<string | Uint8Array>;
|
|
17
12
|
protected deserializer: ShapeDeserializer<string | Uint8Array>;
|
|
18
|
-
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
19
|
-
defaultNamespace: string;
|
|
20
|
-
errorTypeRegistries?: TypeRegistry[];
|
|
21
|
-
});
|
|
22
13
|
getShapeId(): string;
|
|
23
14
|
getPayloadCodec(): JsonCodec2;
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
protected getSmithyProtocolHeaderValue(): string;
|
|
16
|
+
protected applyEmptyBody(request: IHttpRequest): void;
|
|
26
17
|
protected handleError(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any, metadata: ResponseMetadata): Promise<never>;
|
|
27
18
|
protected getDefaultContentType(): string;
|
|
28
19
|
}
|
package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, SerdeFunctions } from "@smithy/types";
|
|
1
|
+
import { AbstractRpcV2Protocol } from "@smithy/core/protocols";
|
|
2
|
+
import { HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, OperationSchema, ResponseMetadata, SerdeFunctions } from "@smithy/types";
|
|
4
3
|
import { CborCodec } from "./CborCodec";
|
|
5
4
|
/**
|
|
6
5
|
* Client protocol for Smithy RPCv2 CBOR.
|
|
7
6
|
*
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
|
-
export declare class SmithyRpcV2CborProtocol extends
|
|
11
|
-
/**
|
|
12
|
-
* @override
|
|
13
|
-
*/
|
|
14
|
-
protected compositeErrorRegistry: TypeRegistry;
|
|
9
|
+
export declare class SmithyRpcV2CborProtocol extends AbstractRpcV2Protocol {
|
|
15
10
|
private codec;
|
|
16
11
|
protected serializer: import(".").CborShapeSerializer2;
|
|
17
12
|
protected deserializer: import(".").CborShapeDeserializer2;
|
|
18
|
-
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
19
|
-
defaultNamespace: string;
|
|
20
|
-
errorTypeRegistries?: TypeRegistry[];
|
|
21
|
-
});
|
|
22
13
|
getShapeId(): string;
|
|
23
14
|
getPayloadCodec(): CborCodec;
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
protected getSmithyProtocolHeaderValue(): string;
|
|
16
|
+
protected applyEmptyBody(request: IHttpRequest): void;
|
|
26
17
|
protected handleError(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any, metadata: ResponseMetadata): Promise<never>;
|
|
27
18
|
protected getDefaultContentType(): string;
|
|
28
19
|
}
|
package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/AbstractRpcV2Protocol.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, OperationSchema, SerdeFunctions } from "@smithy/types";
|
|
2
|
+
import { TypeRegistry } from "@smithy/core/schema";
|
|
3
|
+
import { RpcProtocol } from "./RpcProtocol";
|
|
4
|
+
/**
|
|
5
|
+
* Shared abstract base for the Smithy RPC v2 client protocols (JSON and CBOR).
|
|
6
|
+
*
|
|
7
|
+
* Factors out the request-framing flow and response status handling that are
|
|
8
|
+
* identical across both RPC v2 protocols. Concrete protocols supply their
|
|
9
|
+
* codec, error handling, content type, shape id, and the two per-protocol
|
|
10
|
+
* request details via {@link getSmithyProtocolHeaderValue} and
|
|
11
|
+
* {@link applyEmptyBody}.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class AbstractRpcV2Protocol extends RpcProtocol {
|
|
16
|
+
/**
|
|
17
|
+
* @override
|
|
18
|
+
*/
|
|
19
|
+
protected compositeErrorRegistry: TypeRegistry;
|
|
20
|
+
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
21
|
+
defaultNamespace: string;
|
|
22
|
+
errorTypeRegistries?: TypeRegistry[];
|
|
23
|
+
});
|
|
24
|
+
serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
|
|
25
|
+
/**
|
|
26
|
+
* @override
|
|
27
|
+
*
|
|
28
|
+
* Per the Smithy RPC v2 specification, the only successful response status
|
|
29
|
+
* code is 200; any other status code MUST be handled as an error.
|
|
30
|
+
*/
|
|
31
|
+
protected isErrorResponse(statusCode: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @returns the value of the `smithy-protocol` header for this protocol,
|
|
34
|
+
* e.g. `rpc-v2-json` or `rpc-v2-cbor`.
|
|
35
|
+
*/
|
|
36
|
+
protected abstract getSmithyProtocolHeaderValue(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Applies this protocol's representation of an empty request body when the
|
|
39
|
+
* operation has a non-unit input but produced no serialized body. Called
|
|
40
|
+
* only for non-unit inputs.
|
|
41
|
+
*
|
|
42
|
+
* @param request - the request being serialized, mutated in place.
|
|
43
|
+
*/
|
|
44
|
+
protected abstract applyEmptyBody(request: IHttpRequest): void;
|
|
45
|
+
}
|
|
@@ -13,4 +13,16 @@ export declare abstract class RpcProtocol extends HttpProtocol {
|
|
|
13
13
|
protected compositeErrorRegistry: TypeRegistry;
|
|
14
14
|
serializeRequest<Input extends object>(operationSchema: OperationSchema, _input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
|
|
15
15
|
deserializeResponse<Output extends MetadataBearer>(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse): Promise<Output>;
|
|
16
|
+
/**
|
|
17
|
+
* Determines whether a response status code indicates an error response that
|
|
18
|
+
* should be routed to {@link handleError} rather than deserialized as output.
|
|
19
|
+
*
|
|
20
|
+
* The default treats any status code of 300 or greater as an error,
|
|
21
|
+
* preserving the historical behavior for RPC-over-HTTP protocols. Subclasses
|
|
22
|
+
* whose specification is stricter SHOULD override this.
|
|
23
|
+
*
|
|
24
|
+
* @param statusCode - the HTTP response status code.
|
|
25
|
+
* @returns true if the response should be handled as an error.
|
|
26
|
+
*/
|
|
27
|
+
protected isErrorResponse(statusCode: number): boolean;
|
|
16
28
|
}
|
|
@@ -3,6 +3,7 @@ export { extendedEncodeURIComponent } from "./extended-encode-uri-component";
|
|
|
3
3
|
export { HttpBindingProtocol } from "./HttpBindingProtocol";
|
|
4
4
|
export { HttpProtocol } from "./HttpProtocol";
|
|
5
5
|
export { RpcProtocol } from "./RpcProtocol";
|
|
6
|
+
export { AbstractRpcV2Protocol } from "./AbstractRpcV2Protocol";
|
|
6
7
|
export { RequestBuilder, requestBuilder } from "./requestBuilder";
|
|
7
8
|
export { resolvedPath } from "./resolve-path";
|
|
8
9
|
export { FromStringShapeDeserializer } from "./serde/FromStringShapeDeserializer";
|
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
|
|
1
|
+
import { AbstractRpcV2Protocol } from "../AbstractRpcV2Protocol";
|
|
2
|
+
import { HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, OperationSchema, ResponseMetadata, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
|
|
4
3
|
import { JsonCodec2 } from "./codec-v2/JsonCodec2";
|
|
5
4
|
/**
|
|
6
5
|
* Client protocol for Smithy RPCv2 JSON.
|
|
7
6
|
*
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
|
-
export declare class SmithyRpcV2JsonProtocol extends
|
|
11
|
-
/**
|
|
12
|
-
* @override
|
|
13
|
-
*/
|
|
14
|
-
protected compositeErrorRegistry: TypeRegistry;
|
|
9
|
+
export declare class SmithyRpcV2JsonProtocol extends AbstractRpcV2Protocol {
|
|
15
10
|
private codec;
|
|
16
11
|
protected serializer: ShapeSerializer<string | Uint8Array>;
|
|
17
12
|
protected deserializer: ShapeDeserializer<string | Uint8Array>;
|
|
18
|
-
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
19
|
-
defaultNamespace: string;
|
|
20
|
-
errorTypeRegistries?: TypeRegistry[];
|
|
21
|
-
});
|
|
22
13
|
getShapeId(): string;
|
|
23
14
|
getPayloadCodec(): JsonCodec2;
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
protected getSmithyProtocolHeaderValue(): string;
|
|
16
|
+
protected applyEmptyBody(request: IHttpRequest): void;
|
|
26
17
|
protected handleError(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any, metadata: ResponseMetadata): Promise<never>;
|
|
27
18
|
protected getDefaultContentType(): string;
|
|
28
19
|
}
|
|
@@ -123,13 +123,26 @@ const setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs
|
|
|
123
123
|
return timing.setTimeout(registerListener, deferTimeMs);
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
+
const resolveDefaultSocketTimeout = (config) => {
|
|
127
|
+
const value = config?.defaultSocketTimeout;
|
|
128
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
|
|
129
|
+
};
|
|
130
|
+
|
|
126
131
|
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
127
|
-
const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
132
|
+
const setSocketTimeout = (request, reject, timeoutInMs = 0, destroyResponseBodyOnTimeout = false) => {
|
|
133
|
+
let response;
|
|
134
|
+
if (destroyResponseBodyOnTimeout) {
|
|
135
|
+
request.once("response", (res) => (response = res));
|
|
136
|
+
}
|
|
128
137
|
const registerTimeout = (offset) => {
|
|
129
138
|
const timeout = timeoutInMs - offset;
|
|
130
139
|
const onTimeout = () => {
|
|
140
|
+
const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${destroyResponseBodyOnTimeout ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
|
|
141
|
+
if (destroyResponseBodyOnTimeout) {
|
|
142
|
+
response?.destroy(error);
|
|
143
|
+
}
|
|
131
144
|
request.destroy();
|
|
132
|
-
reject(
|
|
145
|
+
reject(error);
|
|
133
146
|
};
|
|
134
147
|
if (request.socket) {
|
|
135
148
|
request.socket.setTimeout(timeout, onTimeout);
|
|
@@ -143,7 +156,12 @@ const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
|
143
156
|
registerTimeout(0);
|
|
144
157
|
return 0;
|
|
145
158
|
}
|
|
146
|
-
|
|
159
|
+
const deferralId = timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
160
|
+
if (destroyResponseBodyOnTimeout) {
|
|
161
|
+
request.once("close", () => timing.clearTimeout(deferralId));
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
return deferralId;
|
|
147
165
|
};
|
|
148
166
|
|
|
149
167
|
const MIN_WAIT_TIME = 6_000;
|
|
@@ -383,7 +401,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
383
401
|
const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
|
|
384
402
|
connectionTimeoutId = setConnectionTimeout(req, reject, config.connectionTimeout);
|
|
385
403
|
requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
|
|
386
|
-
|
|
404
|
+
const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
|
|
405
|
+
if (defaultSocketTimeout) {
|
|
406
|
+
socketTimeoutId = setSocketTimeout(req, reject, defaultSocketTimeout, true);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
|
|
410
|
+
}
|
|
387
411
|
const httpAgent = nodeHttpsOptions.agent;
|
|
388
412
|
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
389
413
|
keepAliveTimeoutId = setSocketKeepAlive(req, {
|
|
@@ -423,6 +447,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
423
447
|
connectionTimeout,
|
|
424
448
|
requestTimeout,
|
|
425
449
|
socketTimeout,
|
|
450
|
+
defaultSocketTimeout: resolveDefaultSocketTimeout(options),
|
|
426
451
|
socketAcquisitionWarningTimeout,
|
|
427
452
|
throwOnRequestTimeout,
|
|
428
453
|
httpAgentProvider: async () => {
|
|
@@ -710,7 +735,8 @@ class NodeHttp2Handler {
|
|
|
710
735
|
}
|
|
711
736
|
async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
|
|
712
737
|
if (!this.config) {
|
|
713
|
-
|
|
738
|
+
const config = await this.configProvider;
|
|
739
|
+
this.config = { ...config, defaultSocketTimeout: resolveDefaultSocketTimeout(config) };
|
|
714
740
|
const { disableConcurrentStreams, maxConcurrentStreams, nodeHttp2ConnectOptions } = this.config;
|
|
715
741
|
this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams ?? false);
|
|
716
742
|
if (maxConcurrentStreams) {
|
|
@@ -720,9 +746,12 @@ class NodeHttp2Handler {
|
|
|
720
746
|
this.connectionManager.setNodeHttp2ConnectOptions(nodeHttp2ConnectOptions);
|
|
721
747
|
}
|
|
722
748
|
}
|
|
723
|
-
const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
|
|
749
|
+
const { requestTimeout: configRequestTimeout, disableConcurrentStreams, sessionTimeout } = this.config;
|
|
724
750
|
const useIsolatedSession = disableConcurrentStreams || isEventStream;
|
|
725
751
|
const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
|
|
752
|
+
const defaultSocketTimeout = effectiveRequestTimeout === undefined && sessionTimeout === undefined
|
|
753
|
+
? this.config.defaultSocketTimeout
|
|
754
|
+
: undefined;
|
|
726
755
|
return new Promise((_resolve, _reject) => {
|
|
727
756
|
let fulfilled = false;
|
|
728
757
|
let writeRequestBodyPromise = undefined;
|
|
@@ -785,6 +814,19 @@ class NodeHttp2Handler {
|
|
|
785
814
|
rejectWithDestroy(timeoutError);
|
|
786
815
|
});
|
|
787
816
|
}
|
|
817
|
+
else if (defaultSocketTimeout) {
|
|
818
|
+
clientHttp2Stream.setTimeout(defaultSocketTimeout, () => {
|
|
819
|
+
const timeoutError = new Error(`Stream timed out because of no activity for ${defaultSocketTimeout} ms`);
|
|
820
|
+
timeoutError.name = "TimeoutError";
|
|
821
|
+
fulfilled = true;
|
|
822
|
+
reject(timeoutError);
|
|
823
|
+
clientHttp2Stream.destroy(timeoutError);
|
|
824
|
+
if (useIsolatedSession) {
|
|
825
|
+
ref.destroy();
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
clientHttp2Stream.once("response", () => clientHttp2Stream.setTimeout(defaultSocketTimeout));
|
|
829
|
+
}
|
|
788
830
|
if (abortSignal) {
|
|
789
831
|
const onAbort = () => {
|
|
790
832
|
clientHttp2Stream.close();
|
|
@@ -7,6 +7,7 @@ import { node_https } from "./node-https";
|
|
|
7
7
|
import { setConnectionTimeout } from "./set-connection-timeout";
|
|
8
8
|
import { setRequestTimeout } from "./set-request-timeout";
|
|
9
9
|
import { setSocketKeepAlive } from "./set-socket-keep-alive";
|
|
10
|
+
import { resolveDefaultSocketTimeout } from "./resolve-default-socket-timeout";
|
|
10
11
|
import { setSocketTimeout } from "./set-socket-timeout";
|
|
11
12
|
import { timing } from "./timing";
|
|
12
13
|
import { writeRequestBody } from "./write-request-body";
|
|
@@ -185,7 +186,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
185
186
|
const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
|
|
186
187
|
connectionTimeoutId = setConnectionTimeout(req, reject, config.connectionTimeout);
|
|
187
188
|
requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
|
|
188
|
-
|
|
189
|
+
const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
|
|
190
|
+
if (defaultSocketTimeout) {
|
|
191
|
+
socketTimeoutId = setSocketTimeout(req, reject, defaultSocketTimeout, true);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
|
|
195
|
+
}
|
|
189
196
|
const httpAgent = nodeHttpsOptions.agent;
|
|
190
197
|
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
191
198
|
keepAliveTimeoutId = setSocketKeepAlive(req, {
|
|
@@ -225,6 +232,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
225
232
|
connectionTimeout,
|
|
226
233
|
requestTimeout,
|
|
227
234
|
socketTimeout,
|
|
235
|
+
defaultSocketTimeout: resolveDefaultSocketTimeout(options),
|
|
228
236
|
socketAcquisitionWarningTimeout,
|
|
229
237
|
throwOnRequestTimeout,
|
|
230
238
|
httpAgentProvider: async () => {
|