@smithy/core 3.36.2 → 3.38.0

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 (90) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist-cjs/index.js +4 -2
  3. package/dist-cjs/submodules/cbor/index.js +45 -53
  4. package/dist-cjs/submodules/client/index.js +26 -13
  5. package/dist-cjs/submodules/config/index.browser.js +8 -4
  6. package/dist-cjs/submodules/config/index.js +16 -8
  7. package/dist-cjs/submodules/config/index.native.js +8 -4
  8. package/dist-cjs/submodules/endpoints/index.browser.js +2 -1
  9. package/dist-cjs/submodules/endpoints/index.js +10 -5
  10. package/dist-cjs/submodules/event-streams/index.browser.js +18 -9
  11. package/dist-cjs/submodules/event-streams/index.js +18 -9
  12. package/dist-cjs/submodules/protocols/index.js +86 -53
  13. package/dist-cjs/submodules/retry/index.browser.js +20 -10
  14. package/dist-cjs/submodules/retry/index.js +24 -12
  15. package/dist-cjs/submodules/serde/index.browser.js +13 -4
  16. package/dist-cjs/submodules/serde/index.js +7 -1
  17. package/dist-cjs/submodules/serde/index.native.js +13 -4
  18. package/dist-cjs/submodules/transport/index.js +6 -3
  19. package/dist-es/legacy-root-exports/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
  20. package/dist-es/normalizeProvider.js +2 -1
  21. package/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
  22. package/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +8 -4
  23. package/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +6 -3
  24. package/dist-es/submodules/cbor/codec-v2/CborShapeDeserializer2.js +12 -6
  25. package/dist-es/submodules/cbor/codec-v2/CborShapeSerializer2.js +4 -2
  26. package/dist-es/submodules/cbor/parseCborBody.js +2 -1
  27. package/dist-es/submodules/client/middleware-stack/MiddlewareStack.js +10 -5
  28. package/dist-es/submodules/client/smithy-client/create-aggregated-client.js +2 -1
  29. package/dist-es/submodules/client/smithy-client/exceptions.js +4 -2
  30. package/dist-es/submodules/client/smithy-client/extensions/checksum.js +2 -1
  31. package/dist-es/submodules/client/smithy-client/get-value-from-text-node.js +2 -1
  32. package/dist-es/submodules/client/smithy-client/object-mapping.js +4 -2
  33. package/dist-es/submodules/client/smithy-client/serde-json.js +2 -1
  34. package/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js +8 -4
  35. package/dist-es/submodules/config/util-config-provider/booleanSelector.js +6 -3
  36. package/dist-es/submodules/config/util-config-provider/numberSelector.js +2 -1
  37. package/dist-es/submodules/endpoints/middleware-endpoint/adaptors/getEndpointUrlConfig.js +8 -4
  38. package/dist-es/submodules/endpoints/util-endpoints/resolveEndpoint.js +2 -1
  39. package/dist-es/submodules/event-streams/EventStreamSerde.js +6 -3
  40. package/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +2 -1
  41. package/dist-es/submodules/event-streams/eventstream-codec/Int64.js +2 -1
  42. package/dist-es/submodules/event-streams/eventstream-codec/SmithyMessageDecoderStream.js +2 -1
  43. package/dist-es/submodules/event-streams/eventstream-serde/utils.js +2 -1
  44. package/dist-es/submodules/event-streams/eventstream-serde-universal/getUnmarshalledStream.js +4 -2
  45. package/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
  46. package/dist-es/submodules/protocols/HttpBindingProtocol.js +8 -4
  47. package/dist-es/submodules/protocols/HttpProtocol.js +4 -2
  48. package/dist-es/submodules/protocols/RpcProtocol.js +6 -2
  49. package/dist-es/submodules/protocols/index.js +1 -0
  50. package/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +8 -31
  51. package/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +7 -5
  52. package/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +7 -5
  53. package/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +7 -5
  54. package/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +6 -3
  55. package/dist-es/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.js +3 -0
  56. package/dist-es/submodules/retry/middleware-retry/configurations.js +4 -2
  57. package/dist-es/submodules/retry/middleware-retry/parseRetryAfterHeader.js +2 -1
  58. package/dist-es/submodules/retry/middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy.js +6 -3
  59. package/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +6 -3
  60. package/dist-es/submodules/retry/middleware-retry/util.js +6 -3
  61. package/dist-es/submodules/serde/index.browser.js +1 -0
  62. package/dist-es/submodules/serde/index.js +1 -0
  63. package/dist-es/submodules/serde/index.native.js +1 -0
  64. package/dist-es/submodules/serde/parse-utils.js +2 -1
  65. package/dist-es/submodules/serde/util-body-length/calculateBodyLength.browser.js +6 -3
  66. package/dist-es/submodules/transport/httpResponse.js +2 -1
  67. package/dist-es/submodules/transport/normalizeProvider.js +2 -1
  68. package/dist-es/submodules/transport/toEndpointV1.js +2 -1
  69. package/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
  70. package/dist-types/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
  71. package/dist-types/submodules/protocols/RpcProtocol.d.ts +12 -0
  72. package/dist-types/submodules/protocols/index.d.ts +1 -0
  73. package/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
  74. package/dist-types/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +1 -0
  75. package/dist-types/submodules/serde/index.browser.d.ts +1 -0
  76. package/dist-types/submodules/serde/index.d.ts +1 -0
  77. package/dist-types/submodules/serde/index.native.d.ts +1 -0
  78. package/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
  79. package/dist-types/ts3.4/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
  80. package/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +12 -0
  81. package/dist-types/ts3.4/submodules/protocols/index.d.ts +1 -0
  82. package/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
  83. package/dist-types/ts3.4/submodules/protocols/protocol-http/extensions/httpExtensionConfiguration.d.ts +1 -0
  84. package/dist-types/ts3.4/submodules/serde/index.browser.d.ts +1 -0
  85. package/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
  86. package/dist-types/ts3.4/submodules/serde/index.native.d.ts +1 -0
  87. package/package.json +1 -1
  88. /package/dist-es/submodules/{protocols → serde}/writeKey.js +0 -0
  89. /package/dist-types/submodules/{protocols → serde}/writeKey.d.ts +0 -0
  90. /package/dist-types/ts3.4/submodules/{protocols → serde}/writeKey.d.ts +0 -0
@@ -97,8 +97,9 @@ function parseRetryAfterHeader(response, logger) {
97
97
  return;
98
98
  }
99
99
  for (const header in response.headers) {
100
- if (!hasOwn(response.headers, header))
100
+ if (!hasOwn(response.headers, header)) {
101
101
  continue;
102
+ }
102
103
  const h = header.toLowerCase();
103
104
  if (h === "retry-after") {
104
105
  const retryAfter = response.headers[header];
@@ -143,12 +144,15 @@ function getRetryAfterHint(response, logger) {
143
144
  }
144
145
 
145
146
  const asSdkError = (error) => {
146
- if (error instanceof Error)
147
+ if (error instanceof Error) {
147
148
  return error;
148
- if (error instanceof Object)
149
+ }
150
+ if (error instanceof Object) {
149
151
  return Object.assign(new Error(), error);
150
- if (typeof error === "string")
152
+ }
153
+ if (typeof error === "string") {
151
154
  return new Error(error);
155
+ }
152
156
  return new Error(`AWS SDK error wrapper for ${error}`);
153
157
  };
154
158
 
@@ -230,12 +234,15 @@ const getRetryErrorInfo = (error, logger) => {
230
234
  return errorInfo;
231
235
  };
232
236
  const getRetryErrorType = (error) => {
233
- if (isThrottlingError(error))
237
+ if (isThrottlingError(error)) {
234
238
  return "THROTTLING";
235
- if (isTransientError(error))
239
+ }
240
+ if (isTransientError(error)) {
236
241
  return "TRANSIENT";
237
- if (isServerError(error))
242
+ }
243
+ if (isServerError(error)) {
238
244
  return "SERVER_ERROR";
245
+ }
239
246
  return "CLIENT_ERROR";
240
247
  };
241
248
  const retryMiddlewareOptions = {
@@ -687,15 +694,18 @@ class StandardRetryStrategy {
687
694
  }
688
695
  }
689
696
  const getDelayFromRetryAfterHeader = (response) => {
690
- if (!HttpResponse.isInstance(response))
697
+ if (!HttpResponse.isInstance(response)) {
691
698
  return;
699
+ }
692
700
  const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after");
693
- if (!retryAfterHeaderName)
701
+ if (!retryAfterHeaderName) {
694
702
  return;
703
+ }
695
704
  const retryAfter = response.headers[retryAfterHeaderName];
696
705
  const retryAfterSeconds = Number(retryAfter);
697
- if (!Number.isNaN(retryAfterSeconds))
706
+ if (!Number.isNaN(retryAfterSeconds)) {
698
707
  return Math.min(retryAfterSeconds * 1000, 20_000);
708
+ }
699
709
  const retryAfterDate = new Date(retryAfter);
700
710
  return Math.min(retryAfterDate.getTime() - Date.now(), 20_000);
701
711
  };
@@ -725,8 +735,9 @@ const CONFIG_MAX_ATTEMPTS = "max_attempts";
725
735
  const NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
726
736
  environmentVariableSelector: (env) => {
727
737
  const value = env[ENV_MAX_ATTEMPTS];
728
- if (!value)
738
+ if (!value) {
729
739
  return undefined;
740
+ }
730
741
  const maxAttempt = parseInt(value);
731
742
  if (Number.isNaN(maxAttempt)) {
732
743
  throw new Error(`Environment variable ${ENV_MAX_ATTEMPTS} mast be a number, got "${value}"`);
@@ -735,8 +746,9 @@ const NODE_MAX_ATTEMPT_CONFIG_OPTIONS = {
735
746
  },
736
747
  configFileSelector: (profile) => {
737
748
  const value = profile[CONFIG_MAX_ATTEMPTS];
738
- if (!value)
749
+ if (!value) {
739
750
  return undefined;
751
+ }
740
752
  const maxAttempt = parseInt(value);
741
753
  if (Number.isNaN(maxAttempt)) {
742
754
  throw new Error(`Shared config file entry ${CONFIG_MAX_ATTEMPTS} mast be a number, got "${value}"`);
@@ -292,8 +292,9 @@ const expectUnion = (value) => {
292
292
  const asObject = expectObject(value);
293
293
  const setKeys = [];
294
294
  for (const k in asObject) {
295
- if (!hasOwn(asObject, k))
295
+ if (!hasOwn(asObject, k)) {
296
296
  continue;
297
+ }
297
298
  if (asObject[k] != null) {
298
299
  setKeys.push(k);
299
300
  }
@@ -847,12 +848,15 @@ const calculateBodyLength = (body) => {
847
848
  let len = body.length;
848
849
  for (let i = len - 1; i >= 0; i--) {
849
850
  const code = body.charCodeAt(i);
850
- if (code > 0x7f && code <= 0x7ff)
851
+ if (code > 0x7f && code <= 0x7ff) {
851
852
  len++;
852
- else if (code > 0x7ff && code <= 0xffff)
853
+ }
854
+ else if (code > 0x7ff && code <= 0xffff) {
853
855
  len += 2;
854
- if (code >= 0xdc00 && code <= 0xdfff)
856
+ }
857
+ if (code >= 0xdc00 && code <= 0xdfff) {
855
858
  i--;
859
+ }
856
860
  }
857
861
  return len;
858
862
  }
@@ -1318,6 +1322,10 @@ async function splitStream(stream) {
1318
1322
  return readableStream.tee();
1319
1323
  }
1320
1324
 
1325
+ function writeKey(obj) {
1326
+ Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true });
1327
+ }
1328
+
1321
1329
  const no = Symbol.for("node-only");
1322
1330
  const fromArrayBuffer = no;
1323
1331
  const fromString = no;
@@ -1400,3 +1408,4 @@ exports.toHex = toHex;
1400
1408
  exports.toUint8Array = toUint8Array;
1401
1409
  exports.toUtf8 = toUtf8;
1402
1410
  exports.v4 = v4;
1411
+ exports.writeKey = writeKey;
@@ -260,8 +260,9 @@ const expectUnion = (value) => {
260
260
  const asObject = expectObject(value);
261
261
  const setKeys = [];
262
262
  for (const k in asObject) {
263
- if (!hasOwn(asObject, k))
263
+ if (!hasOwn(asObject, k)) {
264
264
  continue;
265
+ }
265
266
  if (asObject[k] != null) {
266
267
  setKeys.push(k);
267
268
  }
@@ -1685,6 +1686,10 @@ async function splitStream(stream) {
1685
1686
  return [stream1, stream2];
1686
1687
  }
1687
1688
 
1689
+ function writeKey(obj) {
1690
+ Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true });
1691
+ }
1692
+
1688
1693
  class Uint8ArrayBlobAdapter extends bindUint8ArrayBlobAdapter(toUtf8$1, fromUtf8$1, toBase64$1, fromBase64) {
1689
1694
  }
1690
1695
  const _getRandomValues = getRandomValues;
@@ -1763,3 +1768,4 @@ exports.toHex = toHex;
1763
1768
  exports.toUint8Array = toUint8Array;
1764
1769
  exports.toUtf8 = toUtf8$1;
1765
1770
  exports.v4 = v4;
1771
+ exports.writeKey = writeKey;
@@ -292,8 +292,9 @@ const expectUnion = (value) => {
292
292
  const asObject = expectObject(value);
293
293
  const setKeys = [];
294
294
  for (const k in asObject) {
295
- if (!hasOwn(asObject, k))
295
+ if (!hasOwn(asObject, k)) {
296
296
  continue;
297
+ }
297
298
  if (asObject[k] != null) {
298
299
  setKeys.push(k);
299
300
  }
@@ -847,12 +848,15 @@ const calculateBodyLength = (body) => {
847
848
  let len = body.length;
848
849
  for (let i = len - 1; i >= 0; i--) {
849
850
  const code = body.charCodeAt(i);
850
- if (code > 0x7f && code <= 0x7ff)
851
+ if (code > 0x7f && code <= 0x7ff) {
851
852
  len++;
852
- else if (code > 0x7ff && code <= 0xffff)
853
+ }
854
+ else if (code > 0x7ff && code <= 0xffff) {
853
855
  len += 2;
854
- if (code >= 0xdc00 && code <= 0xdfff)
856
+ }
857
+ if (code >= 0xdc00 && code <= 0xdfff) {
855
858
  i--;
859
+ }
856
860
  }
857
861
  return len;
858
862
  }
@@ -1318,6 +1322,10 @@ async function splitStream(stream) {
1318
1322
  return readableStream.tee();
1319
1323
  }
1320
1324
 
1325
+ function writeKey(obj) {
1326
+ Object.defineProperty(obj, "__proto__", { value: undefined, writable: true, enumerable: true, configurable: true });
1327
+ }
1328
+
1321
1329
  const no = Symbol.for("node-only");
1322
1330
  const fromArrayBuffer = no;
1323
1331
  const fromString = no;
@@ -1400,3 +1408,4 @@ exports.toHex = toHex;
1400
1408
  exports.toUint8Array = toUint8Array;
1401
1409
  exports.toUtf8 = toUtf8;
1402
1410
  exports.v4 = v4;
1411
+ exports.writeKey = writeKey;
@@ -83,8 +83,9 @@ class HttpResponse {
83
83
  this.body = options.body;
84
84
  }
85
85
  static isInstance(response) {
86
- if (!response)
86
+ if (!response) {
87
87
  return false;
88
+ }
88
89
  const resp = response;
89
90
  return typeof resp.statusCode === "number" && typeof resp.headers === "object";
90
91
  }
@@ -110,8 +111,9 @@ function isValidHostname(hostname) {
110
111
  }
111
112
 
112
113
  const normalizeProvider = (input) => {
113
- if (typeof input === "function")
114
+ if (typeof input === "function") {
114
115
  return input;
116
+ }
115
117
  const promisified = Promise.resolve(input);
116
118
  return () => promisified;
117
119
  };
@@ -165,8 +167,9 @@ const toEndpointV1 = (endpoint) => {
165
167
  if (endpoint.headers) {
166
168
  v1Endpoint.headers = {};
167
169
  for (const name in endpoint.headers) {
168
- if (!hasOwn(endpoint.headers, name))
170
+ if (!hasOwn(endpoint.headers, name)) {
169
171
  continue;
172
+ }
170
173
  v1Endpoint.headers[name.toLowerCase()] = endpoint.headers[name].join(", ");
171
174
  }
172
175
  }
@@ -3,8 +3,9 @@ export class DefaultIdentityProviderConfig {
3
3
  authSchemes = new Map();
4
4
  constructor(config) {
5
5
  for (const key in config) {
6
- if (!hasOwn(config, key))
6
+ if (!hasOwn(config, key)) {
7
7
  continue;
8
+ }
8
9
  const value = config[key];
9
10
  if (value !== undefined) {
10
11
  this.authSchemes.set(key, value);
@@ -1,6 +1,7 @@
1
1
  export const normalizeProvider = (input) => {
2
- if (typeof input === "function")
2
+ if (typeof input === "function") {
3
3
  return input;
4
+ }
4
5
  const promisified = Promise.resolve(input);
5
6
  return () => promisified;
6
7
  };
@@ -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";
@@ -60,8 +60,9 @@ export class CborShapeDeserializer extends SerdeContext {
60
60
  if (ns.isMapSchema()) {
61
61
  const targetSchema = ns.getValueSchema();
62
62
  for (const key in value) {
63
- if (!hasOwn(value, key))
63
+ if (!hasOwn(value, key)) {
64
64
  continue;
65
+ }
65
66
  const itemValue = this.readValue(targetSchema, value[key]);
66
67
  newObject[key] = itemValue;
67
68
  }
@@ -72,8 +73,9 @@ export class CborShapeDeserializer extends SerdeContext {
72
73
  if (isUnion) {
73
74
  keys = new Set();
74
75
  for (const k in value) {
75
- if (!hasOwn(value, k))
76
+ if (!hasOwn(value, k)) {
76
77
  continue;
78
+ }
77
79
  if (k !== "__type") {
78
80
  keys.add(k);
79
81
  }
@@ -90,8 +92,9 @@ export class CborShapeDeserializer extends SerdeContext {
90
92
  if (isUnion && keys?.size === 1) {
91
93
  let newObjectEmpty = true;
92
94
  for (const _ in newObject) {
93
- if (!hasOwn(newObject, _))
95
+ if (!hasOwn(newObject, _)) {
94
96
  continue;
97
+ }
95
98
  newObjectEmpty = false;
96
99
  break;
97
100
  }
@@ -102,8 +105,9 @@ export class CborShapeDeserializer extends SerdeContext {
102
105
  }
103
106
  else if (typeof value.__type === "string") {
104
107
  for (const k in value) {
105
- if (!hasOwn(value, k))
108
+ if (!hasOwn(value, k)) {
106
109
  continue;
110
+ }
107
111
  if (!(k in newObject)) {
108
112
  newObject[k] = value[k];
109
113
  }
@@ -50,8 +50,9 @@ export class CborShapeSerializer extends SerdeContext {
50
50
  if (ns.isMapSchema()) {
51
51
  const sparse = !!ns.getMergedTraits().sparse;
52
52
  for (const key in sourceObject) {
53
- if (!hasOwn(sourceObject, key))
53
+ if (!hasOwn(sourceObject, key)) {
54
54
  continue;
55
+ }
55
56
  const value = this.serialize(ns.getValueSchema(), sourceObject[key]);
56
57
  if (value != null || sparse) {
57
58
  newObject[key] = value;
@@ -72,8 +73,9 @@ export class CborShapeSerializer extends SerdeContext {
72
73
  }
73
74
  else if (typeof sourceObject.__type === "string") {
74
75
  for (const k in sourceObject) {
75
- if (!hasOwn(sourceObject, k))
76
+ if (!hasOwn(sourceObject, k)) {
76
77
  continue;
78
+ }
77
79
  if (!(k in newObject)) {
78
80
  newObject[k] = this.serialize(15, sourceObject[k]);
79
81
  }
@@ -90,8 +92,9 @@ export class CborShapeSerializer extends SerdeContext {
90
92
  return newArray;
91
93
  }
92
94
  for (const key in sourceObject) {
93
- if (!hasOwn(sourceObject, key))
95
+ if (!hasOwn(sourceObject, key)) {
94
96
  continue;
97
+ }
95
98
  newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
96
99
  }
97
100
  }
@@ -121,8 +121,9 @@ function readStruct(ns, count, startPos) {
121
121
  if (isUnion) {
122
122
  let resultEmpty = true;
123
123
  for (const _ in result) {
124
- if (!hasOwn(result, _))
124
+ if (!hasOwn(result, _)) {
125
125
  continue;
126
+ }
126
127
  resultEmpty = false;
127
128
  break;
128
129
  }
@@ -291,8 +292,9 @@ function readMapIndefinite(ns) {
291
292
  if (isUnion) {
292
293
  let resultEmpty = true;
293
294
  for (const _ in result) {
294
- if (!hasOwn(result, _))
295
+ if (!hasOwn(result, _)) {
295
296
  continue;
297
+ }
296
298
  resultEmpty = false;
297
299
  break;
298
300
  }
@@ -597,8 +599,9 @@ function transformObject(ns, value) {
597
599
  if (ns.isMapSchema()) {
598
600
  const targetSchema = ns.getValueSchema();
599
601
  for (const key in value) {
600
- if (!hasOwn(value, key))
602
+ if (!hasOwn(value, key)) {
601
603
  continue;
604
+ }
602
605
  newObject[key] = transformObject(targetSchema, value[key]);
603
606
  }
604
607
  }
@@ -608,8 +611,9 @@ function transformObject(ns, value) {
608
611
  if (isUnion) {
609
612
  keys = new Set();
610
613
  for (const k in value) {
611
- if (!hasOwn(value, k))
614
+ if (!hasOwn(value, k)) {
612
615
  continue;
616
+ }
613
617
  if (k !== "__type") {
614
618
  keys.add(k);
615
619
  }
@@ -626,8 +630,9 @@ function transformObject(ns, value) {
626
630
  if (isUnion && keys?.size === 1) {
627
631
  let newObjectEmpty = true;
628
632
  for (const _ in newObject) {
629
- if (!hasOwn(newObject, _))
633
+ if (!hasOwn(newObject, _)) {
630
634
  continue;
635
+ }
631
636
  newObjectEmpty = false;
632
637
  break;
633
638
  }
@@ -638,8 +643,9 @@ function transformObject(ns, value) {
638
643
  }
639
644
  else if (typeof value.__type === "string") {
640
645
  for (const k in value) {
641
- if (!hasOwn(value, k))
646
+ if (!hasOwn(value, k)) {
642
647
  continue;
648
+ }
643
649
  if (!(k in newObject)) {
644
650
  newObject[k] = value[k];
645
651
  }
@@ -254,8 +254,9 @@ function writeStruct(ns, value, serdeContext) {
254
254
  }
255
255
  if (typeof value.__type === "string") {
256
256
  for (const k in value) {
257
- if (!hasOwn(value, k))
257
+ if (!hasOwn(value, k)) {
258
258
  continue;
259
+ }
259
260
  if (!memberNames.includes(k)) {
260
261
  writeString(k);
261
262
  writeUntypedValue(value[k]);
@@ -321,8 +322,9 @@ function writeMap(ns, value, isDocument, serdeContext) {
321
322
  const valueSchema = ns.getValueSchema();
322
323
  const keys = [];
323
324
  for (const k in value) {
324
- if (!hasOwn(value, k))
325
+ if (!hasOwn(value, k)) {
325
326
  continue;
327
+ }
326
328
  const v = value[k];
327
329
  if (isDocument ? v !== undefined : v != null || sparse) {
328
330
  keys.push(k);
@@ -71,8 +71,9 @@ export const buildHttpRpcRequest = async (context, headers, path, resolvedHostna
71
71
  }
72
72
  if (endpoint.headers) {
73
73
  for (const name in endpoint.headers) {
74
- if (!hasOwn(endpoint.headers, name))
74
+ if (!hasOwn(endpoint.headers, name)) {
75
75
  continue;
76
+ }
76
77
  contents.headers[name] = endpoint.headers[name];
77
78
  }
78
79
  }
@@ -149,8 +149,9 @@ export const constructStack = () => {
149
149
  const aliases = getAllAliases(name, _aliases);
150
150
  if (aliases.length > 0) {
151
151
  if (aliases.some((alias) => entriesNameSet.has(alias))) {
152
- if (!override)
152
+ if (!override) {
153
153
  throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
154
+ }
154
155
  for (const alias of aliases) {
155
156
  const toOverrideIndex = absoluteEntries.findIndex((entry) => entry.name === alias || entry.aliases?.some((a) => a === alias));
156
157
  if (toOverrideIndex === -1) {
@@ -181,8 +182,9 @@ export const constructStack = () => {
181
182
  const aliases = getAllAliases(name, _aliases);
182
183
  if (aliases.length > 0) {
183
184
  if (aliases.some((alias) => entriesNameSet.has(alias))) {
184
- if (!override)
185
+ if (!override) {
185
186
  throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
187
+ }
186
188
  for (const alias of aliases) {
187
189
  const toOverrideIndex = relativeEntries.findIndex((entry) => entry.name === alias || entry.aliases?.some((a) => a === alias));
188
190
  if (toOverrideIndex === -1) {
@@ -209,10 +211,12 @@ export const constructStack = () => {
209
211
  plugin.applyToStack(stack);
210
212
  },
211
213
  remove: (toRemove) => {
212
- if (typeof toRemove === "string")
214
+ if (typeof toRemove === "string") {
213
215
  return removeByName(toRemove);
214
- else
216
+ }
217
+ else {
215
218
  return removeByReference(toRemove);
219
+ }
216
220
  },
217
221
  removeByTag: (toRemove) => {
218
222
  let isRemoved = false;
@@ -249,8 +253,9 @@ export const constructStack = () => {
249
253
  });
250
254
  },
251
255
  identifyOnResolve(toggle) {
252
- if (typeof toggle === "boolean")
256
+ if (typeof toggle === "boolean") {
253
257
  identifyOnResolve = toggle;
258
+ }
254
259
  return identifyOnResolve;
255
260
  },
256
261
  resolve: (handler, context) => {
@@ -6,8 +6,9 @@ export const createAggregatedClient = (commands, Client, options) => {
6
6
  this.send(command, optionsOrCb);
7
7
  }
8
8
  else if (typeof cb === "function") {
9
- if (typeof optionsOrCb !== "object")
9
+ if (typeof optionsOrCb !== "object") {
10
10
  throw new Error(`Expected http options but got ${typeof optionsOrCb}`);
11
+ }
11
12
  this.send(command, optionsOrCb || {}, cb);
12
13
  }
13
14
  else {
@@ -12,8 +12,9 @@ export class ServiceException extends Error {
12
12
  this.$metadata = options.$metadata;
13
13
  }
14
14
  static isInstance(value) {
15
- if (!value)
15
+ if (!value) {
16
16
  return false;
17
+ }
17
18
  const candidate = value;
18
19
  return (ServiceException.prototype.isPrototypeOf(candidate) ||
19
20
  (Boolean(candidate.$fault) &&
@@ -21,8 +22,9 @@ export class ServiceException extends Error {
21
22
  (candidate.$fault === "client" || candidate.$fault === "server")));
22
23
  }
23
24
  static [Symbol.hasInstance](instance) {
24
- if (!instance)
25
+ if (!instance) {
25
26
  return false;
27
+ }
26
28
  const candidate = instance;
27
29
  if (this === ServiceException) {
28
30
  return ServiceException.isInstance(instance);
@@ -5,8 +5,9 @@ const knownAlgorithms = Object.values(AlgorithmId);
5
5
  export const getChecksumConfiguration = (runtimeConfig) => {
6
6
  const checksumAlgorithms = [];
7
7
  for (const id in AlgorithmId) {
8
- if (!hasOwn(AlgorithmId, id))
8
+ if (!hasOwn(AlgorithmId, id)) {
9
9
  continue;
10
+ }
10
11
  const algorithmId = AlgorithmId[id];
11
12
  if (runtimeConfig[algorithmId] === undefined) {
12
13
  continue;
@@ -2,8 +2,9 @@ import { hasOwn } from "@smithy/core/transport";
2
2
  export const getValueFromTextNode = (obj) => {
3
3
  const textNodeName = "#text";
4
4
  for (const key in obj) {
5
- if (!hasOwn(obj, key))
5
+ if (!hasOwn(obj, key)) {
6
6
  continue;
7
+ }
7
8
  if (obj[key][textNodeName] !== undefined) {
8
9
  obj[key] = obj[key][textNodeName];
9
10
  }
@@ -19,8 +19,9 @@ export function map(arg0, arg1, arg2) {
19
19
  }
20
20
  }
21
21
  for (const key in instructions) {
22
- if (!hasOwn(instructions, key))
22
+ if (!hasOwn(instructions, key)) {
23
23
  continue;
24
+ }
24
25
  if (!Array.isArray(instructions[key])) {
25
26
  target[key] = instructions[key];
26
27
  continue;
@@ -39,8 +40,9 @@ export const convertMap = (target) => {
39
40
  export const take = (source, instructions) => {
40
41
  const out = {};
41
42
  for (const key in instructions) {
42
- if (!hasOwn(instructions, key))
43
+ if (!hasOwn(instructions, key)) {
43
44
  continue;
45
+ }
44
46
  applyInstruction(out, source, instructions, key);
45
47
  }
46
48
  return out;
@@ -9,8 +9,9 @@ export const _json = (obj) => {
9
9
  if (typeof obj === "object") {
10
10
  const target = {};
11
11
  for (const key in obj) {
12
- if (!hasOwn(obj, key))
12
+ if (!hasOwn(obj, key)) {
13
13
  continue;
14
+ }
14
15
  if (obj[key] == null) {
15
16
  continue;
16
17
  }