@mavogel/awscdk-rootmail 0.1.29 → 0.1.31

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 (74) hide show
  1. package/.jsii +9 -9
  2. package/lib/rootmail.js +1 -1
  3. package/lib/ses-receive.js +1 -1
  4. package/node_modules/@aws-sdk/checksums/package.json +3 -3
  5. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +1 -1
  6. package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +6 -6
  7. package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
  8. package/node_modules/@aws-sdk/client-route-53/package.json +6 -6
  9. package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
  10. package/node_modules/@aws-sdk/client-s3/package.json +9 -9
  11. package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
  12. package/node_modules/@aws-sdk/client-ses/package.json +6 -6
  13. package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
  14. package/node_modules/@aws-sdk/client-ssm/package.json +5 -5
  15. package/node_modules/@aws-sdk/core/package.json +2 -2
  16. package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  17. package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
  18. package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
  19. package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
  20. package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
  21. package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
  22. package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
  23. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
  24. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +3 -3
  25. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  26. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  27. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  28. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  29. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  30. package/node_modules/@aws-sdk/nested-clients/package.json +4 -4
  31. package/node_modules/@aws-sdk/token-providers/package.json +4 -4
  32. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
  33. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +44 -29
  34. package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
  35. package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
  36. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
  37. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +1 -0
  38. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +8 -31
  39. package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
  40. package/node_modules/@smithy/core/dist-types/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
  41. package/node_modules/@smithy/core/dist-types/submodules/protocols/RpcProtocol.d.ts +12 -0
  42. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +1 -0
  43. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
  44. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
  45. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
  46. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +12 -0
  47. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +1 -0
  48. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
  49. package/node_modules/@smithy/core/package.json +1 -1
  50. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
  51. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
  52. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
  53. package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
  54. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
  55. package/node_modules/@smithy/node-http-handler/dist-types/resolve-default-socket-timeout.d.ts +4 -0
  56. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
  57. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/resolve-default-socket-timeout.d.ts +4 -0
  58. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +6 -1
  59. package/node_modules/@smithy/node-http-handler/package.json +3 -3
  60. package/node_modules/bowser/README.md +26 -3
  61. package/node_modules/bowser/bowser.mjs +2225 -0
  62. package/node_modules/bowser/bundled.js +14 -1
  63. package/node_modules/bowser/es5.js +14 -1
  64. package/node_modules/bowser/index.d.mts +45 -0
  65. package/node_modules/bowser/package.json +90 -31
  66. package/node_modules/bowser/src/bowser.js +9 -1
  67. package/node_modules/bowser/src/constants.js +7 -0
  68. package/node_modules/bowser/src/parser-browsers.js +73 -7
  69. package/node_modules/bowser/src/parser-engines.js +12 -0
  70. package/node_modules/bowser/src/parser-os.js +3 -1
  71. package/node_modules/bowser/src/parser-platforms.js +3 -1
  72. package/node_modules/bowser/src/parser.js +22 -5
  73. package/node_modules/bowser/src/utils.js +16 -0
  74. package/package.json +9 -9
@@ -1,7 +1,7 @@
1
1
  const { nv, NumericValue, calculateBodyLength, generateIdempotencyToken, fromBase64, _parseEpochTimestamp } = require("@smithy/core/serde");
2
- const { hasOwn, getSmithyContext } = require("@smithy/core/transport");
3
- const { HttpRequest, collectBody, SerdeContext, RpcProtocol } = require("@smithy/core/protocols");
4
- const { NormalizedSchema, deref, TypeRegistry } = require("@smithy/core/schema");
2
+ const { hasOwn } = require("@smithy/core/transport");
3
+ const { HttpRequest, collectBody, SerdeContext, AbstractRpcV2Protocol } = require("@smithy/core/protocols");
4
+ const { NormalizedSchema, TypeRegistry } = require("@smithy/core/schema");
5
5
 
6
6
  const majorUint64 = 0;
7
7
  const majorNegativeInt64 = 1;
@@ -2216,51 +2216,27 @@ class CborCodec extends SerdeContext {
2216
2216
  }
2217
2217
  }
2218
2218
 
2219
- class SmithyRpcV2CborProtocol extends RpcProtocol {
2219
+ class SmithyRpcV2CborProtocol extends AbstractRpcV2Protocol {
2220
2220
  codec = new CborCodec();
2221
2221
  serializer = this.codec.createSerializer();
2222
2222
  deserializer = this.codec.createDeserializer();
2223
- constructor({ defaultNamespace, errorTypeRegistries, }) {
2224
- super({ defaultNamespace, errorTypeRegistries });
2225
- }
2226
2223
  getShapeId() {
2227
2224
  return "smithy.protocols#rpcv2Cbor";
2228
2225
  }
2229
2226
  getPayloadCodec() {
2230
2227
  return this.codec;
2231
2228
  }
2232
- async serializeRequest(operationSchema, input, context) {
2233
- const request = await super.serializeRequest(operationSchema, input, context);
2234
- Object.assign(request.headers, {
2235
- "content-type": this.getDefaultContentType(),
2236
- "smithy-protocol": "rpc-v2-cbor",
2237
- accept: this.getDefaultContentType(),
2238
- });
2239
- if (deref(operationSchema.input) === "unit") {
2240
- delete request.body;
2241
- delete request.headers["content-type"];
2242
- }
2243
- else {
2244
- if (!request.body) {
2245
- this.serializer.write(15, {});
2246
- request.body = this.serializer.flush();
2247
- }
2248
- if (request.body instanceof Uint8Array) {
2249
- request.headers["content-length"] = String(request.body.byteLength);
2250
- }
2251
- }
2252
- const { service, operation } = getSmithyContext(context);
2253
- const path = `/service/${service}/operation/${operation}`;
2254
- if (request.path.endsWith("/")) {
2255
- request.path += path.slice(1);
2229
+ getSmithyProtocolHeaderValue() {
2230
+ return "rpc-v2-cbor";
2231
+ }
2232
+ applyEmptyBody(request) {
2233
+ if (!request.body) {
2234
+ this.serializer.write(15, {});
2235
+ request.body = this.serializer.flush();
2256
2236
  }
2257
- else {
2258
- request.path += path;
2237
+ if (request.body instanceof Uint8Array) {
2238
+ request.headers["content-length"] = String(request.body.byteLength);
2259
2239
  }
2260
- return request;
2261
- }
2262
- async deserializeResponse(operationSchema, context, response) {
2263
- return super.deserializeResponse(operationSchema, context, response);
2264
2240
  }
2265
2241
  async handleError(operationSchema, context, response, dataObject, metadata) {
2266
2242
  const errorIdentifier = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
@@ -574,7 +574,7 @@ class RpcProtocol extends HttpProtocol {
574
574
  const deserializer = this.deserializer;
575
575
  const ns = NormalizedSchema.of(operationSchema.output);
576
576
  const dataObject = {};
577
- if (response.statusCode >= 300) {
577
+ if (this.isErrorResponse(response.statusCode)) {
578
578
  const bytes = await collectBody(response.body, context);
579
579
  if (bytes.byteLength > 0) {
580
580
  Object.assign(dataObject, await deserializer.read(15, bytes));
@@ -606,6 +606,42 @@ class RpcProtocol extends HttpProtocol {
606
606
  dataObject.$metadata = this.deserializeMetadata(response);
607
607
  return dataObject;
608
608
  }
609
+ isErrorResponse(statusCode) {
610
+ return statusCode >= 300;
611
+ }
612
+ }
613
+
614
+ class AbstractRpcV2Protocol extends RpcProtocol {
615
+ constructor({ defaultNamespace, errorTypeRegistries, }) {
616
+ super({ defaultNamespace, errorTypeRegistries });
617
+ }
618
+ async serializeRequest(operationSchema, input, context) {
619
+ const request = await super.serializeRequest(operationSchema, input, context);
620
+ Object.assign(request.headers, {
621
+ "content-type": this.getDefaultContentType(),
622
+ "smithy-protocol": this.getSmithyProtocolHeaderValue(),
623
+ accept: this.getDefaultContentType(),
624
+ });
625
+ if (deref(operationSchema.input) === "unit") {
626
+ delete request.body;
627
+ delete request.headers["content-type"];
628
+ }
629
+ else {
630
+ this.applyEmptyBody(request);
631
+ }
632
+ const { service, operation } = getSmithyContext(context);
633
+ const path = `/service/${service}/operation/${operation}`;
634
+ if (request.path.endsWith("/")) {
635
+ request.path += path.slice(1);
636
+ }
637
+ else {
638
+ request.path += path;
639
+ }
640
+ return request;
641
+ }
642
+ isErrorResponse(statusCode) {
643
+ return statusCode !== 200;
644
+ }
609
645
  }
610
646
 
611
647
  const resolvedPath = (resolvedPath, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
@@ -2240,7 +2276,7 @@ class JsonCodec2 extends SerdeContextConfig {
2240
2276
  }
2241
2277
  }
2242
2278
 
2243
- class SmithyRpcV2JsonProtocol extends RpcProtocol {
2279
+ class SmithyRpcV2JsonProtocol extends AbstractRpcV2Protocol {
2244
2280
  codec = new JsonCodec2({
2245
2281
  timestampFormat: {
2246
2282
  useTrait: false,
@@ -2251,41 +2287,19 @@ class SmithyRpcV2JsonProtocol extends RpcProtocol {
2251
2287
  });
2252
2288
  serializer = this.codec.createSerializer();
2253
2289
  deserializer = this.codec.createDeserializer();
2254
- constructor({ defaultNamespace, errorTypeRegistries, }) {
2255
- super({ defaultNamespace, errorTypeRegistries });
2256
- }
2257
2290
  getShapeId() {
2258
2291
  return "smithy.protocols#rpcv2Json";
2259
2292
  }
2260
2293
  getPayloadCodec() {
2261
2294
  return this.codec;
2262
2295
  }
2263
- async serializeRequest(operationSchema, input, context) {
2264
- const request = await super.serializeRequest(operationSchema, input, context);
2265
- Object.assign(request.headers, {
2266
- "content-type": this.getDefaultContentType(),
2267
- "smithy-protocol": "rpc-v2-json",
2268
- accept: this.getDefaultContentType(),
2269
- });
2270
- if (deref(operationSchema.input) === "unit") {
2271
- delete request.body;
2272
- delete request.headers["content-type"];
2273
- }
2274
- else if (!request.body) {
2296
+ getSmithyProtocolHeaderValue() {
2297
+ return "rpc-v2-json";
2298
+ }
2299
+ applyEmptyBody(request) {
2300
+ if (!request.body) {
2275
2301
  request.body = "{}";
2276
2302
  }
2277
- const { service, operation } = getSmithyContext(context);
2278
- const path = `/service/${service}/operation/${operation}`;
2279
- if (request.path.endsWith("/")) {
2280
- request.path += path.slice(1);
2281
- }
2282
- else {
2283
- request.path += path;
2284
- }
2285
- return request;
2286
- }
2287
- async deserializeResponse(operationSchema, context, response) {
2288
- return super.deserializeResponse(operationSchema, context, response);
2289
2303
  }
2290
2304
  async handleError(operationSchema, context, response, dataObject, metadata) {
2291
2305
  const errorName = loadSmithyRpcV2JsonErrorCode(response, dataObject) ?? "Unknown";
@@ -2753,6 +2767,7 @@ class JsonCodec extends SerdeContextConfig {
2753
2767
  }
2754
2768
  }
2755
2769
 
2770
+ exports.AbstractRpcV2Protocol = AbstractRpcV2Protocol;
2756
2771
  exports.Field = Field;
2757
2772
  exports.Fields = Fields;
2758
2773
  exports.FromStringShapeDeserializer = FromStringShapeDeserializer;
@@ -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";
@@ -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 >= 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
  }
@@ -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,9 +1,8 @@
1
- import { RpcProtocol } from "../RpcProtocol";
2
- import { NormalizedSchema, TypeRegistry, deref } from "@smithy/core/schema";
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 RpcProtocol {
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
- async serializeRequest(operationSchema, input, context) {
27
- const request = await super.serializeRequest(operationSchema, input, context);
28
- Object.assign(request.headers, {
29
- "content-type": this.getDefaultContentType(),
30
- "smithy-protocol": "rpc-v2-json",
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";
@@ -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
+ }
@@ -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 { RpcProtocol } from "../RpcProtocol";
2
- import { TypeRegistry } from "@smithy/core/schema";
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 RpcProtocol {
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
- 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
  }
@@ -1,28 +1,19 @@
1
- import { RpcProtocol } from "@smithy/core/protocols";
2
- import { TypeRegistry } from "@smithy/core/schema";
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 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 { 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";