@cdklabs/cdk-ecs-codedeploy 0.0.460 → 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.
Files changed (168) hide show
  1. package/.jsii +3 -3
  2. package/lib/api-canary/index.js +1 -1
  3. package/lib/ecs-appspec/index.js +1 -1
  4. package/lib/ecs-deployment/index.js +1 -1
  5. package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
  6. package/node_modules/@aws-sdk/client-codedeploy/dist-cjs/index.js +49 -11
  7. package/node_modules/@aws-sdk/client-codedeploy/dist-es/models/enums.js +6 -0
  8. package/node_modules/@aws-sdk/client-codedeploy/dist-es/models/errors.js +13 -0
  9. package/node_modules/@aws-sdk/client-codedeploy/dist-es/schemas/schemas_0.js +27 -11
  10. package/node_modules/@aws-sdk/client-codedeploy/dist-types/CodeDeployClient.d.ts +2 -1
  11. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/BatchGetDeploymentGroupsCommand.d.ts +5 -0
  12. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/BatchGetDeploymentsCommand.d.ts +5 -0
  13. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/CreateDeploymentCommand.d.ts +11 -0
  14. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/CreateDeploymentGroupCommand.d.ts +11 -0
  15. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/GetDeploymentCommand.d.ts +5 -0
  16. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/GetDeploymentGroupCommand.d.ts +5 -0
  17. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/UpdateDeploymentGroupCommand.d.ts +11 -0
  18. package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/enums.d.ts +14 -0
  19. package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/errors.d.ts +16 -0
  20. package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/models_0.d.ts +64 -1
  21. package/node_modules/@aws-sdk/client-codedeploy/dist-types/schemas/schemas_0.d.ts +2 -0
  22. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/enums.d.ts +8 -0
  23. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/errors.d.ts +8 -0
  24. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/models_0.d.ts +9 -0
  25. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/schemas/schemas_0.d.ts +2 -0
  26. package/node_modules/@aws-sdk/client-codedeploy/package.json +5 -5
  27. package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +12 -3
  28. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +94 -1589
  29. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +12 -3
  30. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -7
  31. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -3
  32. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -3
  33. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -8
  34. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  35. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  36. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  37. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  38. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -10
  39. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  40. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  41. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  42. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  43. package/node_modules/@aws-sdk/core/package.json +3 -3
  44. package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
  45. package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
  46. package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
  47. package/node_modules/@aws-sdk/credential-provider-login/package.json +5 -5
  48. package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
  49. package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
  50. package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
  51. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
  52. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  53. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  54. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  55. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  56. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  57. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentityClient.d.ts +2 -1
  58. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/SigninClient.d.ts +2 -1
  59. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSOClient.d.ts +2 -1
  60. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDCClient.d.ts +2 -1
  61. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +2 -1
  62. package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
  63. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
  64. package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +37 -19
  65. package/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +37 -19
  66. package/node_modules/@aws-sdk/token-providers/package.json +5 -5
  67. package/node_modules/@aws-sdk/types/dist-types/feature-ids.d.ts +3 -0
  68. package/node_modules/@aws-sdk/types/dist-types/ts3.4/feature-ids.d.ts +3 -0
  69. package/node_modules/@aws-sdk/types/package.json +1 -1
  70. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
  71. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +15 -2
  72. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +10 -0
  73. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +10 -0
  74. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +1711 -4
  75. package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
  76. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +16 -2
  77. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +10 -0
  78. package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
  79. package/node_modules/@smithy/core/dist-es/submodules/protocols/ConfigurableSerdeContext.js +6 -0
  80. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
  81. package/node_modules/@smithy/core/dist-es/submodules/protocols/UnionSerde.js +26 -0
  82. package/node_modules/@smithy/core/dist-es/submodules/protocols/common.js +3 -0
  83. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +9 -0
  84. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +79 -0
  85. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +8 -1
  86. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +8 -1
  87. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +13 -2
  88. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +16 -6
  89. package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/parseJsonBody.js +16 -1
  90. package/node_modules/@smithy/core/dist-es/submodules/protocols/writeKey.js +3 -0
  91. package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
  92. package/node_modules/@smithy/core/dist-types/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
  93. package/node_modules/@smithy/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  94. package/node_modules/@smithy/core/dist-types/submodules/protocols/RpcProtocol.d.ts +12 -0
  95. package/node_modules/@smithy/core/dist-types/submodules/protocols/UnionSerde.d.ts +24 -0
  96. package/node_modules/@smithy/core/dist-types/submodules/protocols/common.d.ts +2 -0
  97. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +10 -0
  98. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +13 -0
  99. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +19 -0
  100. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +16 -0
  101. package/node_modules/@smithy/core/dist-types/submodules/protocols/writeKey.d.ts +4 -0
  102. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
  103. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
  104. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -0
  105. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +12 -0
  106. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +24 -0
  107. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/common.d.ts +2 -0
  108. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -0
  109. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +13 -0
  110. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +19 -0
  111. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +15 -11
  112. package/node_modules/{@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json → @smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +7 -4
  113. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +14 -0
  114. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +29 -0
  115. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
  116. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +13 -9
  117. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +30 -0
  118. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +60 -0
  119. package/node_modules/{@aws-sdk → @smithy}/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -1
  120. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +21 -0
  121. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +15 -0
  122. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +11 -0
  123. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +38 -0
  124. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +4 -0
  125. package/node_modules/@smithy/core/package.json +2 -1
  126. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
  127. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
  128. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
  129. package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
  130. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
  131. package/node_modules/@smithy/node-http-handler/dist-types/resolve-default-socket-timeout.d.ts +4 -0
  132. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
  133. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/resolve-default-socket-timeout.d.ts +4 -0
  134. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +6 -1
  135. package/node_modules/@smithy/node-http-handler/package.json +3 -3
  136. package/package.json +2 -2
  137. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -7
  138. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -4
  139. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -13
  140. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -18
  141. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -27
  142. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -15
  143. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -39
  144. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +0 -7
  145. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +0 -7
  146. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +0 -2
  147. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +0 -14
  148. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -0
  149. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +0 -0
  150. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -0
  151. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -0
  152. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -0
  153. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/detectBufferParsing.js +0 -0
  154. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReplacer.js +0 -0
  155. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/jsonReviver.js +0 -0
  156. /package/node_modules/{@aws-sdk → @smithy}/core/dist-es/submodules/protocols/json/needsReviver.js +0 -0
  157. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -0
  158. /package/node_modules/{@aws-sdk/core/dist-types/submodules/protocols/json → @smithy/core/dist-types/submodules/protocols/json/codec-v1}/JsonSettings.d.ts +0 -0
  159. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -0
  160. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -0
  161. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -0
  162. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -0
  163. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -0
  164. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -0
  165. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +0 -0
  166. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReplacer.d.ts +0 -0
  167. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/jsonReviver.d.ts +0 -0
  168. /package/node_modules/{@aws-sdk → @smithy}/core/dist-types/submodules/protocols/json/needsReviver.d.ts +0 -0
@@ -1,53 +1,28 @@
1
- import { RpcProtocol } from "@smithy/core/protocols";
2
- import { NormalizedSchema, TypeRegistry, deref } from "@smithy/core/schema";
3
- import { getSmithyContext } from "@smithy/core/transport";
1
+ import { AbstractRpcV2Protocol } from "@smithy/core/protocols";
2
+ import { NormalizedSchema, TypeRegistry } from "@smithy/core/schema";
4
3
  import { CborCodec } from "./CborCodec";
5
4
  import { loadSmithyRpcV2CborErrorCode } from "./parseCborBody";
6
- export class SmithyRpcV2CborProtocol extends RpcProtocol {
5
+ export class SmithyRpcV2CborProtocol extends AbstractRpcV2Protocol {
7
6
  codec = new CborCodec();
8
7
  serializer = this.codec.createSerializer();
9
8
  deserializer = this.codec.createDeserializer();
10
- constructor({ defaultNamespace, errorTypeRegistries, }) {
11
- super({ defaultNamespace, errorTypeRegistries });
12
- }
13
9
  getShapeId() {
14
10
  return "smithy.protocols#rpcv2Cbor";
15
11
  }
16
12
  getPayloadCodec() {
17
13
  return this.codec;
18
14
  }
19
- async serializeRequest(operationSchema, input, context) {
20
- const request = await super.serializeRequest(operationSchema, input, context);
21
- Object.assign(request.headers, {
22
- "content-type": this.getDefaultContentType(),
23
- "smithy-protocol": "rpc-v2-cbor",
24
- accept: this.getDefaultContentType(),
25
- });
26
- if (deref(operationSchema.input) === "unit") {
27
- delete request.body;
28
- delete request.headers["content-type"];
29
- }
30
- else {
31
- if (!request.body) {
32
- this.serializer.write(15, {});
33
- request.body = this.serializer.flush();
34
- }
35
- if (request.body instanceof Uint8Array) {
36
- request.headers["content-length"] = String(request.body.byteLength);
37
- }
38
- }
39
- const { service, operation } = getSmithyContext(context);
40
- const path = `/service/${service}/operation/${operation}`;
41
- if (request.path.endsWith("/")) {
42
- request.path += path.slice(1);
15
+ getSmithyProtocolHeaderValue() {
16
+ return "rpc-v2-cbor";
17
+ }
18
+ applyEmptyBody(request) {
19
+ if (!request.body) {
20
+ this.serializer.write(15, {});
21
+ request.body = this.serializer.flush();
43
22
  }
44
- else {
45
- request.path += path;
23
+ if (request.body instanceof Uint8Array) {
24
+ request.headers["content-length"] = String(request.body.byteLength);
46
25
  }
47
- return request;
48
- }
49
- async deserializeResponse(operationSchema, context, response) {
50
- return super.deserializeResponse(operationSchema, context, response);
51
26
  }
52
27
  async handleError(operationSchema, context, response, dataObject, metadata) {
53
28
  const errorIdentifier = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
@@ -1,6 +1,8 @@
1
1
  import { SMITHY_CONTEXT_KEY, } from "@smithy/types";
2
2
  import { constructStack } from "../middleware-stack/MiddlewareStack";
3
3
  import { schemaLogFilter } from "./schemaLogFilter";
4
+ import { NormalizedSchema } from "@smithy/core/schema";
5
+ const operationEventStreamMarker = Symbol.for("@smithy/op-event-stream");
4
6
  export class Command {
5
7
  middlewareStack = constructStack();
6
8
  schema;
@@ -34,9 +36,21 @@ export class Command {
34
36
  requestOptions = { ...requestOptions };
35
37
  delete requestOptions.metricsRecorder;
36
38
  }
37
- if (smithyContext.eventStream) {
39
+ let isEventStream;
40
+ const schema = this.schema;
41
+ const marker = schema?.[operationEventStreamMarker];
42
+ if (marker !== undefined) {
43
+ isEventStream = marker;
44
+ }
45
+ else if (schema) {
46
+ if (Array.isArray(schema) && schema[0] === 9) {
47
+ const [, , , , input$, output$] = schema;
48
+ isEventStream = schema[operationEventStreamMarker] = Boolean(NormalizedSchema.of(input$).getEventStreamMember() || NormalizedSchema.of(output$).getEventStreamMember());
49
+ }
50
+ }
51
+ if (isEventStream) {
38
52
  requestOptions = {
39
- isEventStream: true,
53
+ isEventStream,
40
54
  ...requestOptions,
41
55
  };
42
56
  }
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ export class SerdeContextConfig {
2
+ serdeContext;
3
+ setSerdeContext(serdeContext) {
4
+ this.serdeContext = serdeContext;
5
+ }
6
+ }
@@ -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 >= 300) {
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
  }
@@ -0,0 +1,26 @@
1
+ export class UnionSerde {
2
+ from;
3
+ to;
4
+ keys;
5
+ constructor(from, to) {
6
+ this.from = from;
7
+ this.to = to;
8
+ const keys = Object.keys(this.from);
9
+ const set = new Set(keys);
10
+ set.delete("__type");
11
+ this.keys = set;
12
+ }
13
+ mark(key) {
14
+ this.keys.delete(key);
15
+ }
16
+ hasUnknown() {
17
+ return this.keys.size === 1 && Object.keys(this.to).length === 0;
18
+ }
19
+ writeUnknown() {
20
+ if (this.hasUnknown()) {
21
+ const k = this.keys.values().next().value;
22
+ const v = this.from[k];
23
+ this.to.$unknown = [k, v];
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,3 @@
1
+ import { collectBody } from "./collect-stream-body";
2
+ import { toUtf8 } from "@smithy/core/serde";
3
+ export const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => (context?.utf8Encoder ?? toUtf8)(body));
@@ -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";
@@ -23,3 +24,11 @@ export { escapeUriPath } from "./util-uri-escape/escape-uri-path";
23
24
  export { buildQueryString } from "./querystring-builder/buildQueryString";
24
25
  export { parseQueryString } from "@smithy/core/transport";
25
26
  export { parseUrl } from "@smithy/core/transport";
27
+ export { SmithyRpcV2JsonProtocol } from "./json/SmithyRpcV2JsonProtocol";
28
+ export { parseJsonBody, parseJsonErrorBody, loadJsonRpcErrorCode, loadRestJsonErrorCode, loadSmithyRpcV2JsonErrorCode, } from "./json/parseJsonBody";
29
+ export { JsonCodec } from "./json/codec-v1/JsonCodec";
30
+ export { JsonShapeSerializer } from "./json/codec-v1/JsonShapeSerializer";
31
+ export { JsonShapeDeserializer } from "./json/codec-v1/JsonShapeDeserializer";
32
+ export { JsonCodec2 } from "./json/codec-v2/JsonCodec2";
33
+ export { JsonShapeSerializer2 } from "./json/codec-v2/JsonShapeSerializer2";
34
+ export { JsonShapeDeserializer2 } from "./json/codec-v2/JsonShapeDeserializer2";
@@ -0,0 +1,79 @@
1
+ import { AbstractRpcV2Protocol } from "../AbstractRpcV2Protocol";
2
+ import { NormalizedSchema, TypeRegistry } from "@smithy/core/schema";
3
+ import { JsonCodec2 } from "./codec-v2/JsonCodec2";
4
+ import { loadSmithyRpcV2JsonErrorCode } from "./parseJsonBody";
5
+ export class SmithyRpcV2JsonProtocol extends AbstractRpcV2Protocol {
6
+ codec = new JsonCodec2({
7
+ timestampFormat: {
8
+ useTrait: false,
9
+ default: 7,
10
+ },
11
+ jsonName: false,
12
+ bigNumberAsString: true,
13
+ });
14
+ serializer = this.codec.createSerializer();
15
+ deserializer = this.codec.createDeserializer();
16
+ getShapeId() {
17
+ return "smithy.protocols#rpcv2Json";
18
+ }
19
+ getPayloadCodec() {
20
+ return this.codec;
21
+ }
22
+ getSmithyProtocolHeaderValue() {
23
+ return "rpc-v2-json";
24
+ }
25
+ applyEmptyBody(request) {
26
+ if (!request.body) {
27
+ request.body = "{}";
28
+ }
29
+ }
30
+ async handleError(operationSchema, context, response, dataObject, metadata) {
31
+ const errorName = loadSmithyRpcV2JsonErrorCode(response, dataObject) ?? "Unknown";
32
+ const errorMetadata = {
33
+ $metadata: metadata,
34
+ $fault: response.statusCode <= 500 ? "client" : "server",
35
+ };
36
+ let namespace = this.options.defaultNamespace;
37
+ if (errorName.includes("#")) {
38
+ [namespace] = errorName.split("#");
39
+ }
40
+ const registry = this.compositeErrorRegistry;
41
+ const nsRegistry = TypeRegistry.for(namespace);
42
+ registry.copyFrom(nsRegistry);
43
+ let errorSchema;
44
+ try {
45
+ errorSchema = registry.getSchema(errorName);
46
+ }
47
+ catch (ignored) {
48
+ if (dataObject.Message) {
49
+ dataObject.message = dataObject.Message;
50
+ }
51
+ const syntheticRegistry = TypeRegistry.for("smithy.ts.sdk.synthetic." + namespace);
52
+ registry.copyFrom(syntheticRegistry);
53
+ const baseExceptionSchema = registry.getBaseException();
54
+ if (baseExceptionSchema) {
55
+ const ErrorCtor = registry.getErrorCtor(baseExceptionSchema);
56
+ throw Object.assign(new ErrorCtor({ name: errorName }), errorMetadata, dataObject);
57
+ }
58
+ throw Object.assign(new Error(errorName), errorMetadata, dataObject);
59
+ }
60
+ const ns = NormalizedSchema.of(errorSchema);
61
+ const ErrorCtor = registry.getErrorCtor(errorSchema);
62
+ const message = dataObject.message ?? dataObject.Message ?? "Unknown";
63
+ const exception = new ErrorCtor({});
64
+ const output = {};
65
+ const errorDeserializer = this.codec.createDeserializer();
66
+ for (const [name, member] of ns.structIterator()) {
67
+ if (dataObject[name] != null) {
68
+ output[name] = errorDeserializer.readObject(member, dataObject[name]);
69
+ }
70
+ }
71
+ throw Object.assign(exception, errorMetadata, {
72
+ $fault: ns.getMergedTraits().error,
73
+ message,
74
+ }, output);
75
+ }
76
+ getDefaultContentType() {
77
+ return "application/json";
78
+ }
79
+ }
@@ -1,7 +1,8 @@
1
- import { determineTimestampFormat } from "@smithy/core/protocols";
1
+ import { determineTimestampFormat } from "../../serde/determineTimestampFormat";
2
2
  import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import { LazyJsonString, NumericValue, parseEpochTimestamp, parseRfc3339DateTimeWithOffset, parseRfc7231DateTime, } from "@smithy/core/serde";
4
4
  import { fromBase64 } from "@smithy/core/serde";
5
+ import { hasOwn } from "@smithy/core/transport";
5
6
  import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
6
7
  import { UnionSerde } from "../../UnionSerde";
7
8
  import { jsonReviver } from "../jsonReviver";
@@ -56,6 +57,8 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
56
57
  }
57
58
  else if (typeof record.__type === "string") {
58
59
  for (const k in record) {
60
+ if (!hasOwn(record, k))
61
+ continue;
59
62
  const v = record[k];
60
63
  const t = jsonName ? (nameMap[k] ?? k) : k;
61
64
  if (!(t in out)) {
@@ -77,6 +80,8 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
77
80
  const mapMember = ns.getValueSchema();
78
81
  const out = {};
79
82
  for (const _k in value) {
83
+ if (!hasOwn(value, _k))
84
+ continue;
80
85
  if (_k === "__proto__") {
81
86
  writeKey(out);
82
87
  }
@@ -138,6 +143,8 @@ export class JsonShapeDeserializer extends SerdeContextConfig {
138
143
  if (isObject) {
139
144
  const out = Array.isArray(value) ? [] : {};
140
145
  for (const k in value) {
146
+ if (!hasOwn(value, k))
147
+ continue;
141
148
  if (k === "__proto__") {
142
149
  writeKey(out);
143
150
  }
@@ -1,9 +1,10 @@
1
- import { determineTimestampFormat } from "@smithy/core/protocols";
1
+ import { determineTimestampFormat } from "../../serde/determineTimestampFormat";
2
2
  import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import { dateToUtcString, generateIdempotencyToken, LazyJsonString, NumericValue, toBase64 } from "@smithy/core/serde";
4
4
  import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
5
5
  import { JsonReplacer } from "../jsonReplacer";
6
6
  import { writeKey } from "../../writeKey";
7
+ import { hasOwn } from "@smithy/core/transport";
7
8
  export class JsonShapeSerializer extends SerdeContextConfig {
8
9
  settings;
9
10
  buffer;
@@ -73,6 +74,8 @@ export class JsonShapeSerializer extends SerdeContextConfig {
73
74
  }
74
75
  else if (typeof record.__type === "string") {
75
76
  for (const k in record) {
77
+ if (!hasOwn(record, k))
78
+ continue;
76
79
  const v = record[k];
77
80
  const targetKey = jsonName ? (nameMap[k] ?? k) : k;
78
81
  if (!(targetKey in out)) {
@@ -98,6 +101,8 @@ export class JsonShapeSerializer extends SerdeContextConfig {
98
101
  const out = {};
99
102
  const sparse = !!ns.getMergedTraits().sparse;
100
103
  for (const _k in value) {
104
+ if (!hasOwn(value, _k))
105
+ continue;
101
106
  const _v = value[_k];
102
107
  if (sparse || _v != null) {
103
108
  if (_k === "__proto__") {
@@ -170,6 +175,8 @@ export class JsonShapeSerializer extends SerdeContextConfig {
170
175
  }
171
176
  const out = Array.isArray(value) ? [] : {};
172
177
  for (const k in value) {
178
+ if (!hasOwn(value, k))
179
+ continue;
173
180
  const v = value[k];
174
181
  if (k === "__proto__") {
175
182
  writeKey(out);
@@ -1,4 +1,4 @@
1
- import { determineTimestampFormat } from "@smithy/core/protocols";
1
+ import { determineTimestampFormat } from "../../serde/determineTimestampFormat";
2
2
  import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import { fromBase64, LazyJsonString, NumericValue, parseEpochTimestamp, parseRfc3339DateTimeWithOffset, parseRfc7231DateTime, } from "@smithy/core/serde";
4
4
  import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
@@ -8,6 +8,7 @@ import { jsonReviver } from "../jsonReviver";
8
8
  import { needsReviver } from "../needsReviver";
9
9
  import { parseJsonBody } from "../parseJsonBody";
10
10
  import { writeKey } from "../../writeKey";
11
+ import { hasOwn } from "@smithy/core/transport";
11
12
  export class JsonShapeDeserializer2 extends SerdeContextConfig {
12
13
  settings;
13
14
  constructor(settings) {
@@ -59,6 +60,8 @@ export class JsonShapeDeserializer2 extends SerdeContextConfig {
59
60
  const map = value;
60
61
  if (this.needsTransform(mapMember)) {
61
62
  for (const k in map) {
63
+ if (!hasOwn(map, k))
64
+ continue;
62
65
  if (k === "__proto__") {
63
66
  writeKey(map);
64
67
  }
@@ -130,6 +133,8 @@ export class JsonShapeDeserializer2 extends SerdeContextConfig {
130
133
  else {
131
134
  const doc = value;
132
135
  for (const k in doc) {
136
+ if (!hasOwn(doc, k))
137
+ continue;
133
138
  if (k === "__proto__") {
134
139
  writeKey(doc);
135
140
  }
@@ -176,6 +181,8 @@ export class JsonShapeDeserializer2 extends SerdeContextConfig {
176
181
  }
177
182
  else if (hasType) {
178
183
  for (const k in record) {
184
+ if (!hasOwn(record, k))
185
+ continue;
179
186
  const v = record[k];
180
187
  const t = jsonName ? (nameMap[k] ?? k) : k;
181
188
  if (!(t in out)) {
@@ -186,7 +193,11 @@ export class JsonShapeDeserializer2 extends SerdeContextConfig {
186
193
  return out;
187
194
  }
188
195
  needsTransform(ns) {
189
- if (ns.isBlobSchema() || ns.isTimestampSchema() || ns.isBigIntegerSchema() || ns.isBigDecimalSchema()) {
196
+ if (ns.isBlobSchema() ||
197
+ ns.isTimestampSchema() ||
198
+ ns.isBigIntegerSchema() ||
199
+ ns.isBigDecimalSchema() ||
200
+ ns.isNumericSchema()) {
190
201
  return true;
191
202
  }
192
203
  if (ns.isDocumentSchema() || ns.isStructSchema() || ns.isListSchema() || ns.isMapSchema()) {
@@ -1,7 +1,8 @@
1
- import { determineTimestampFormat } from "@smithy/core/protocols";
1
+ import { determineTimestampFormat } from "../../serde/determineTimestampFormat";
2
2
  import { NormalizedSchema } from "@smithy/core/schema";
3
3
  import { dateToUtcString, generateIdempotencyToken, LazyJsonString, NumericValue, toBase64 } from "@smithy/core/serde";
4
4
  import { SerdeContextConfig } from "../../ConfigurableSerdeContext";
5
+ import { hasOwn } from "@smithy/core/transport";
5
6
  import { JsonBytesStringAdapter } from "./JsonBytesStringAdapter";
6
7
  const encoder = new TextEncoder();
7
8
  const OPEN_BRACE = 0x7b;
@@ -117,9 +118,9 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
117
118
  this.i = i;
118
119
  }
119
120
  writeJsonString(s) {
120
- this.ensure(s.length * 3 + 2);
121
- this.json[this.i++] = QUOTE;
122
121
  const z = s.length;
122
+ this.ensure(z * 3 + 2);
123
+ this.json[this.i++] = QUOTE;
123
124
  for (let j = 0; j < z; ++j) {
124
125
  const c = s.charCodeAt(j);
125
126
  if (c > 0x22 && c < 0x5c) {
@@ -128,7 +129,7 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
128
129
  else if (c < 0x80) {
129
130
  const esc = ESCAPE_TABLE[c];
130
131
  if (esc !== null) {
131
- this.ensure(esc.length + 1);
132
+ this.ensure(esc.length + 1 + (z - j - 1) * 3 + 1);
132
133
  this.json[this.i++] = BACKSLASH;
133
134
  for (let k = 0; k < esc.length; k++) {
134
135
  this.json[this.i++] = esc.charCodeAt(k);
@@ -147,12 +148,12 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
147
148
  ++j;
148
149
  }
149
150
  else {
150
- this.ensure(6);
151
+ this.ensure(6 + (z - j - 1) * 3 + 1);
151
152
  this.writeUnicodeEscape(c);
152
153
  }
153
154
  }
154
155
  else if (c >= 0xdc00 && c <= 0xdfff) {
155
- this.ensure(6);
156
+ this.ensure(6 + (z - j - 1) * 3 + 1);
156
157
  this.writeUnicodeEscape(c);
157
158
  }
158
159
  else {
@@ -255,6 +256,11 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
255
256
  }
256
257
  }
257
258
  }
259
+ if (this.settings.bigNumberAsString && value != null && (ns.isBigIntegerSchema() || ns.isBigDecimalSchema())) {
260
+ const asString = value instanceof NumericValue ? value.string : String(value);
261
+ this.writeAsciiQuoted(asString);
262
+ return;
263
+ }
258
264
  if (isObject) {
259
265
  if (ns.isStructSchema()) {
260
266
  this.writeStruct(ns, value);
@@ -452,6 +458,8 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
452
458
  if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
453
459
  let modifications;
454
460
  for (const k in value) {
461
+ if (!hasOwn(value, k))
462
+ continue;
455
463
  const v = value[k];
456
464
  if (Number.isNaN(v) || v === Infinity || v === -Infinity) {
457
465
  (modifications ??= {})[k] = v;
@@ -475,6 +483,8 @@ export class JsonShapeSerializer2 extends SerdeContextConfig {
475
483
  this.json[this.i++] = OPEN_BRACE;
476
484
  let first = true;
477
485
  for (const k in value) {
486
+ if (!hasOwn(value, k))
487
+ continue;
478
488
  const v = value[k];
479
489
  if (isDocument ? v === undefined : v == null && !sparse) {
480
490
  continue;
@@ -1,4 +1,4 @@
1
- import { collectBody } from "@smithy/core/protocols";
1
+ import { collectBody } from "../collect-stream-body";
2
2
  import { collectBodyString } from "../common";
3
3
  import { detectBufferParsing } from "./detectBufferParsing";
4
4
  import { jsonReviver } from "./jsonReviver";
@@ -63,6 +63,21 @@ export const loadRestJsonErrorCode = (output, data) => {
63
63
  export const loadJsonRpcErrorCode = (output, data, queryCompat = false) => {
64
64
  return loadErrorCode(output, data, queryCompat ? ["code", "header", "type"] : ["type", "code", "header"]);
65
65
  };
66
+ export const loadSmithyRpcV2JsonErrorCode = (output, data) => {
67
+ if (data?.__type !== undefined) {
68
+ let cleanValue = data.__type;
69
+ if (typeof cleanValue === "number") {
70
+ cleanValue = cleanValue.toString();
71
+ }
72
+ if (cleanValue.indexOf(",") >= 0) {
73
+ cleanValue = cleanValue.split(",")[0];
74
+ }
75
+ if (cleanValue.indexOf(":") >= 0) {
76
+ cleanValue = cleanValue.split(":")[0];
77
+ }
78
+ return cleanValue;
79
+ }
80
+ };
66
81
  const loadErrorCode = ({ headers }, data, order) => {
67
82
  while (order.length > 0) {
68
83
  const location = order.shift();
@@ -0,0 +1,3 @@
1
+ export function writeKey(obj) {
2
+ Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true });
3
+ }
@@ -1,28 +1,19 @@
1
- import { RpcProtocol } from "@smithy/core/protocols";
2
- import { TypeRegistry } from "@smithy/core/schema";
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 RpcProtocol {
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
- serializeRequest<Input extends object>(operationSchema: OperationSchema, input: Input, context: HandlerExecutionContext & SerdeFunctions & EndpointBearer): Promise<IHttpRequest>;
25
- deserializeResponse<Output extends MetadataBearer>(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse): Promise<Output>;
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
+ }
@@ -0,0 +1,8 @@
1
+ import type { ConfigurableSerdeContext, SerdeFunctions } from "@smithy/types";
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare class SerdeContextConfig implements ConfigurableSerdeContext {
6
+ protected serdeContext?: SerdeFunctions;
7
+ setSerdeContext(serdeContext: SerdeFunctions): void;
8
+ }