@smithy/core 3.29.3 → 3.29.5

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 (45) hide show
  1. package/dist-cjs/submodules/cbor/index.js +3 -3
  2. package/dist-cjs/submodules/config/index.browser.js +2 -2
  3. package/dist-cjs/submodules/config/index.js +3 -3
  4. package/dist-cjs/submodules/config/index.native.js +1 -1
  5. package/dist-cjs/submodules/endpoints/index.browser.js +2 -2
  6. package/dist-cjs/submodules/endpoints/index.js +2 -2
  7. package/dist-cjs/submodules/event-streams/index.browser.js +20 -20
  8. package/dist-cjs/submodules/event-streams/index.js +20 -20
  9. package/dist-cjs/submodules/protocols/index.js +1 -1
  10. package/dist-cjs/submodules/retry/index.browser.js +3 -3
  11. package/dist-cjs/submodules/retry/index.js +3 -3
  12. package/dist-cjs/submodules/schema/index.js +4 -4
  13. package/dist-cjs/submodules/serde/index.browser.js +4 -4
  14. package/dist-cjs/submodules/serde/index.js +16 -6
  15. package/dist-cjs/submodules/serde/index.native.js +4 -4
  16. package/dist-cjs/submodules/transport/index.js +1 -1
  17. package/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +2 -2
  18. package/dist-es/submodules/cbor/parseCborBody.js +1 -1
  19. package/dist-es/submodules/config/config-resolver/regionInfo/getRegionInfo.js +1 -1
  20. package/dist-es/submodules/config/defaults-mode/resolveDefaultsModeConfig.browser.js +1 -1
  21. package/dist-es/submodules/config/node-config-provider/getSelectorName.js +1 -1
  22. package/dist-es/submodules/config/shared-ini-file-loader/parseIni.js +1 -1
  23. package/dist-es/submodules/endpoints/middleware-endpoint/service-customizations/s3.js +1 -1
  24. package/dist-es/submodules/endpoints/util-endpoints/lib/parseURL.js +1 -1
  25. package/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +20 -20
  26. package/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js +1 -1
  27. package/dist-es/submodules/retry/middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy.js +1 -1
  28. package/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +1 -1
  29. package/dist-es/submodules/retry/util-retry/StandardRetryStrategy.js +1 -1
  30. package/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +2 -2
  31. package/dist-es/submodules/schema/schemas/ErrorSchema.js +1 -1
  32. package/dist-es/submodules/schema/schemas/NormalizedSchema.js +1 -1
  33. package/dist-es/submodules/serde/copyDocumentWithTransform.js +1 -1
  34. package/dist-es/submodules/serde/date-utils.js +1 -1
  35. package/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js +2 -2
  36. package/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js +11 -1
  37. package/dist-es/submodules/serde/util-stream/sdk-stream-mixin.js +1 -1
  38. package/dist-es/submodules/transport/isValidHostname.js +1 -1
  39. package/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +2 -2
  40. package/dist-types/submodules/serde/copyDocumentWithTransform.d.ts +1 -1
  41. package/dist-types/submodules/serde/util-stream/checksum/ChecksumStream.d.ts +9 -4
  42. package/dist-types/ts3.4/submodules/schema/schemas/ErrorSchema.d.ts +2 -2
  43. package/dist-types/ts3.4/submodules/serde/copyDocumentWithTransform.d.ts +1 -1
  44. package/dist-types/ts3.4/submodules/serde/util-stream/checksum/ChecksumStream.d.ts +9 -4
  45. package/package.json +5 -3
@@ -928,7 +928,7 @@ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, bod
928
928
  try {
929
929
  contents.headers["content-length"] = String(calculateBodyLength(body));
930
930
  }
931
- catch (e) { }
931
+ catch (ignored) { }
932
932
  }
933
933
  return new HttpRequest(contents);
934
934
  };
@@ -1177,7 +1177,7 @@ class SmithyRpcV2CborProtocol extends RpcProtocol {
1177
1177
  try {
1178
1178
  request.headers["content-length"] = String(request.body.byteLength);
1179
1179
  }
1180
- catch (e) { }
1180
+ catch (ignored) { }
1181
1181
  }
1182
1182
  const { service, operation } = getSmithyContext(context);
1183
1183
  const path = `/service/${service}/operation/${operation}`;
@@ -1209,7 +1209,7 @@ class SmithyRpcV2CborProtocol extends RpcProtocol {
1209
1209
  try {
1210
1210
  errorSchema = registry.getSchema(errorName);
1211
1211
  }
1212
- catch (e) {
1212
+ catch (ignored) {
1213
1213
  if (dataObject.Message) {
1214
1214
  dataObject.message = dataObject.Message;
1215
1215
  }
@@ -245,7 +245,7 @@ const getResolvedSigningRegion = (hostname, { signingRegion, regionRegex, useFip
245
245
 
246
246
  const getRegionInfo = (region, { useFipsEndpoint = false, useDualstackEndpoint = false, signingService, regionHash, partitionHash, }) => {
247
247
  const partition = getResolvedPartition(region, { partitionHash });
248
- const resolvedRegion = region in regionHash ? region : partitionHash[partition]?.endpoint ?? region;
248
+ const resolvedRegion = region in regionHash ? region : (partitionHash[partition]?.endpoint ?? region);
249
249
  const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint };
250
250
  const regionHostname = getHostnameFromVariants(regionHash[resolvedRegion]?.variants, hostnameOptions);
251
251
  const partitionHostname = getHostnameFromVariants(partitionHash[partition]?.variants, hostnameOptions);
@@ -291,7 +291,7 @@ const resolveDefaultsModeConfig = ({ defaultsMode, } = {}) => memoize(async () =
291
291
  const useMobileConfiguration = () => {
292
292
  const navigator = window?.navigator;
293
293
  if (navigator?.connection) {
294
- const { effectiveType, rtt, downlink } = navigator?.connection;
294
+ const { effectiveType, rtt, downlink } = navigator.connection;
295
295
  const slow = (typeof effectiveType === "string" && effectiveType !== "4g") || Number(rtt) > 100 || Number(downlink) < 10;
296
296
  if (slow) {
297
297
  return true;
@@ -207,7 +207,7 @@ const getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join(getHomeDir(
207
207
  const ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
208
208
  const getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join(getHomeDir(), ".aws", "credentials");
209
209
 
210
- const prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
210
+ const prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/;
211
211
  const profileNameBlockList = ["__proto__", "profile __proto__"];
212
212
  const parseIni = (iniData) => {
213
213
  const map = {};
@@ -355,7 +355,7 @@ function getSelectorName(functionString) {
355
355
  constants.delete("ENV");
356
356
  return [...constants].join(", ");
357
357
  }
358
- catch (e) {
358
+ catch (ignored) {
359
359
  return functionString;
360
360
  }
361
361
  }
@@ -659,7 +659,7 @@ const getResolvedSigningRegion = (hostname, { signingRegion, regionRegex, useFip
659
659
 
660
660
  const getRegionInfo = (region, { useFipsEndpoint = false, useDualstackEndpoint = false, signingService, regionHash, partitionHash, }) => {
661
661
  const partition = getResolvedPartition(region, { partitionHash });
662
- const resolvedRegion = region in regionHash ? region : partitionHash[partition]?.endpoint ?? region;
662
+ const resolvedRegion = region in regionHash ? region : (partitionHash[partition]?.endpoint ?? region);
663
663
  const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint };
664
664
  const regionHostname = getHostnameFromVariants(regionHash[resolvedRegion]?.variants, hostnameOptions);
665
665
  const partitionHostname = getHostnameFromVariants(partitionHash[partition]?.variants, hostnameOptions);
@@ -245,7 +245,7 @@ const getResolvedSigningRegion = (hostname, { signingRegion, regionRegex, useFip
245
245
 
246
246
  const getRegionInfo = (region, { useFipsEndpoint = false, useDualstackEndpoint = false, signingService, regionHash, partitionHash, }) => {
247
247
  const partition = getResolvedPartition(region, { partitionHash });
248
- const resolvedRegion = region in regionHash ? region : partitionHash[partition]?.endpoint ?? region;
248
+ const resolvedRegion = region in regionHash ? region : (partitionHash[partition]?.endpoint ?? region);
249
249
  const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint };
250
250
  const regionHostname = getHostnameFromVariants(regionHash[resolvedRegion]?.variants, hostnameOptions);
251
251
  const partitionHostname = getHostnameFromVariants(partitionHash[partition]?.variants, hostnameOptions);
@@ -28,7 +28,7 @@ const resolveParamsForS3 = async (endpointParams) => {
28
28
  }
29
29
  return endpointParams;
30
30
  };
31
- const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
31
+ const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
32
32
  const IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
33
33
  const DOTS_PATTERN = /\.\./;
34
34
  const isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
@@ -417,7 +417,7 @@ const parseURL = (value) => {
417
417
  }
418
418
  return new URL(value);
419
419
  }
420
- catch (error) {
420
+ catch (ignored) {
421
421
  return null;
422
422
  }
423
423
  })();
@@ -60,7 +60,7 @@ const resolveParamsForS3 = async (endpointParams) => {
60
60
  }
61
61
  return endpointParams;
62
62
  };
63
- const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
63
+ const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
64
64
  const IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
65
65
  const DOTS_PATTERN = /\.\./;
66
66
  const isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
@@ -449,7 +449,7 @@ const parseURL = (value) => {
449
449
  }
450
450
  return new URL(value);
451
451
  }
452
- catch (error) {
452
+ catch (ignored) {
453
453
  return null;
454
454
  }
455
455
  })();
@@ -69,27 +69,27 @@ class HeaderMarshaller {
69
69
  formatHeaderValue(header) {
70
70
  switch (header.type) {
71
71
  case "boolean":
72
- return Uint8Array.from([header.value ? 0 : 1]);
72
+ return Uint8Array.from([header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse]);
73
73
  case "byte":
74
- return Uint8Array.from([2, header.value]);
74
+ return Uint8Array.from([HEADER_VALUE_TYPE.byte, header.value]);
75
75
  case "short":
76
76
  const shortView = new DataView(new ArrayBuffer(3));
77
- shortView.setUint8(0, 3);
77
+ shortView.setUint8(0, HEADER_VALUE_TYPE.short);
78
78
  shortView.setInt16(1, header.value, false);
79
79
  return new Uint8Array(shortView.buffer);
80
80
  case "integer":
81
81
  const intView = new DataView(new ArrayBuffer(5));
82
- intView.setUint8(0, 4);
82
+ intView.setUint8(0, HEADER_VALUE_TYPE.integer);
83
83
  intView.setInt32(1, header.value, false);
84
84
  return new Uint8Array(intView.buffer);
85
85
  case "long":
86
86
  const longBytes = new Uint8Array(9);
87
- longBytes[0] = 5;
87
+ longBytes[0] = HEADER_VALUE_TYPE.long;
88
88
  longBytes.set(header.value.bytes, 1);
89
89
  return longBytes;
90
90
  case "binary":
91
91
  const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
92
- binView.setUint8(0, 6);
92
+ binView.setUint8(0, HEADER_VALUE_TYPE.byteArray);
93
93
  binView.setUint16(1, header.value.byteLength, false);
94
94
  const binBytes = new Uint8Array(binView.buffer);
95
95
  binBytes.set(header.value, 3);
@@ -97,14 +97,14 @@ class HeaderMarshaller {
97
97
  case "string":
98
98
  const utf8Bytes = this.fromUtf8(header.value);
99
99
  const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
100
- strView.setUint8(0, 7);
100
+ strView.setUint8(0, HEADER_VALUE_TYPE.string);
101
101
  strView.setUint16(1, utf8Bytes.byteLength, false);
102
102
  const strBytes = new Uint8Array(strView.buffer);
103
103
  strBytes.set(utf8Bytes, 3);
104
104
  return strBytes;
105
105
  case "timestamp":
106
106
  const tsBytes = new Uint8Array(9);
107
- tsBytes[0] = 8;
107
+ tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
108
108
  tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
109
109
  return tsBytes;
110
110
  case "uuid":
@@ -112,8 +112,8 @@ class HeaderMarshaller {
112
112
  throw new Error(`Invalid UUID received: ${header.value}`);
113
113
  }
114
114
  const uuidBytes = new Uint8Array(17);
115
- uuidBytes[0] = 9;
116
- uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
115
+ uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
116
+ uuidBytes.set(fromHex(header.value.replace(/-/g, "")), 1);
117
117
  return uuidBytes;
118
118
  }
119
119
  }
@@ -125,46 +125,46 @@ class HeaderMarshaller {
125
125
  const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
126
126
  position += nameLength;
127
127
  switch (headers.getUint8(position++)) {
128
- case 0:
128
+ case HEADER_VALUE_TYPE.boolTrue:
129
129
  out[name] = {
130
130
  type: BOOLEAN_TAG,
131
131
  value: true,
132
132
  };
133
133
  break;
134
- case 1:
134
+ case HEADER_VALUE_TYPE.boolFalse:
135
135
  out[name] = {
136
136
  type: BOOLEAN_TAG,
137
137
  value: false,
138
138
  };
139
139
  break;
140
- case 2:
140
+ case HEADER_VALUE_TYPE.byte:
141
141
  out[name] = {
142
142
  type: BYTE_TAG,
143
143
  value: headers.getInt8(position++),
144
144
  };
145
145
  break;
146
- case 3:
146
+ case HEADER_VALUE_TYPE.short:
147
147
  out[name] = {
148
148
  type: SHORT_TAG,
149
149
  value: headers.getInt16(position, false),
150
150
  };
151
151
  position += 2;
152
152
  break;
153
- case 4:
153
+ case HEADER_VALUE_TYPE.integer:
154
154
  out[name] = {
155
155
  type: INT_TAG,
156
156
  value: headers.getInt32(position, false),
157
157
  };
158
158
  position += 4;
159
159
  break;
160
- case 5:
160
+ case HEADER_VALUE_TYPE.long:
161
161
  out[name] = {
162
162
  type: LONG_TAG,
163
163
  value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)),
164
164
  };
165
165
  position += 8;
166
166
  break;
167
- case 6:
167
+ case HEADER_VALUE_TYPE.byteArray:
168
168
  const binaryLength = headers.getUint16(position, false);
169
169
  position += 2;
170
170
  out[name] = {
@@ -173,7 +173,7 @@ class HeaderMarshaller {
173
173
  };
174
174
  position += binaryLength;
175
175
  break;
176
- case 7:
176
+ case HEADER_VALUE_TYPE.string:
177
177
  const stringLength = headers.getUint16(position, false);
178
178
  position += 2;
179
179
  out[name] = {
@@ -182,14 +182,14 @@ class HeaderMarshaller {
182
182
  };
183
183
  position += stringLength;
184
184
  break;
185
- case 8:
185
+ case HEADER_VALUE_TYPE.timestamp:
186
186
  out[name] = {
187
187
  type: TIMESTAMP_TAG,
188
188
  value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf()),
189
189
  };
190
190
  position += 8;
191
191
  break;
192
- case 9:
192
+ case HEADER_VALUE_TYPE.uuid:
193
193
  const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
194
194
  position += 16;
195
195
  out[name] = {
@@ -70,27 +70,27 @@ class HeaderMarshaller {
70
70
  formatHeaderValue(header) {
71
71
  switch (header.type) {
72
72
  case "boolean":
73
- return Uint8Array.from([header.value ? 0 : 1]);
73
+ return Uint8Array.from([header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse]);
74
74
  case "byte":
75
- return Uint8Array.from([2, header.value]);
75
+ return Uint8Array.from([HEADER_VALUE_TYPE.byte, header.value]);
76
76
  case "short":
77
77
  const shortView = new DataView(new ArrayBuffer(3));
78
- shortView.setUint8(0, 3);
78
+ shortView.setUint8(0, HEADER_VALUE_TYPE.short);
79
79
  shortView.setInt16(1, header.value, false);
80
80
  return new Uint8Array(shortView.buffer);
81
81
  case "integer":
82
82
  const intView = new DataView(new ArrayBuffer(5));
83
- intView.setUint8(0, 4);
83
+ intView.setUint8(0, HEADER_VALUE_TYPE.integer);
84
84
  intView.setInt32(1, header.value, false);
85
85
  return new Uint8Array(intView.buffer);
86
86
  case "long":
87
87
  const longBytes = new Uint8Array(9);
88
- longBytes[0] = 5;
88
+ longBytes[0] = HEADER_VALUE_TYPE.long;
89
89
  longBytes.set(header.value.bytes, 1);
90
90
  return longBytes;
91
91
  case "binary":
92
92
  const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
93
- binView.setUint8(0, 6);
93
+ binView.setUint8(0, HEADER_VALUE_TYPE.byteArray);
94
94
  binView.setUint16(1, header.value.byteLength, false);
95
95
  const binBytes = new Uint8Array(binView.buffer);
96
96
  binBytes.set(header.value, 3);
@@ -98,14 +98,14 @@ class HeaderMarshaller {
98
98
  case "string":
99
99
  const utf8Bytes = this.fromUtf8(header.value);
100
100
  const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
101
- strView.setUint8(0, 7);
101
+ strView.setUint8(0, HEADER_VALUE_TYPE.string);
102
102
  strView.setUint16(1, utf8Bytes.byteLength, false);
103
103
  const strBytes = new Uint8Array(strView.buffer);
104
104
  strBytes.set(utf8Bytes, 3);
105
105
  return strBytes;
106
106
  case "timestamp":
107
107
  const tsBytes = new Uint8Array(9);
108
- tsBytes[0] = 8;
108
+ tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
109
109
  tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
110
110
  return tsBytes;
111
111
  case "uuid":
@@ -113,8 +113,8 @@ class HeaderMarshaller {
113
113
  throw new Error(`Invalid UUID received: ${header.value}`);
114
114
  }
115
115
  const uuidBytes = new Uint8Array(17);
116
- uuidBytes[0] = 9;
117
- uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
116
+ uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
117
+ uuidBytes.set(fromHex(header.value.replace(/-/g, "")), 1);
118
118
  return uuidBytes;
119
119
  }
120
120
  }
@@ -126,46 +126,46 @@ class HeaderMarshaller {
126
126
  const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
127
127
  position += nameLength;
128
128
  switch (headers.getUint8(position++)) {
129
- case 0:
129
+ case HEADER_VALUE_TYPE.boolTrue:
130
130
  out[name] = {
131
131
  type: BOOLEAN_TAG,
132
132
  value: true,
133
133
  };
134
134
  break;
135
- case 1:
135
+ case HEADER_VALUE_TYPE.boolFalse:
136
136
  out[name] = {
137
137
  type: BOOLEAN_TAG,
138
138
  value: false,
139
139
  };
140
140
  break;
141
- case 2:
141
+ case HEADER_VALUE_TYPE.byte:
142
142
  out[name] = {
143
143
  type: BYTE_TAG,
144
144
  value: headers.getInt8(position++),
145
145
  };
146
146
  break;
147
- case 3:
147
+ case HEADER_VALUE_TYPE.short:
148
148
  out[name] = {
149
149
  type: SHORT_TAG,
150
150
  value: headers.getInt16(position, false),
151
151
  };
152
152
  position += 2;
153
153
  break;
154
- case 4:
154
+ case HEADER_VALUE_TYPE.integer:
155
155
  out[name] = {
156
156
  type: INT_TAG,
157
157
  value: headers.getInt32(position, false),
158
158
  };
159
159
  position += 4;
160
160
  break;
161
- case 5:
161
+ case HEADER_VALUE_TYPE.long:
162
162
  out[name] = {
163
163
  type: LONG_TAG,
164
164
  value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)),
165
165
  };
166
166
  position += 8;
167
167
  break;
168
- case 6:
168
+ case HEADER_VALUE_TYPE.byteArray:
169
169
  const binaryLength = headers.getUint16(position, false);
170
170
  position += 2;
171
171
  out[name] = {
@@ -174,7 +174,7 @@ class HeaderMarshaller {
174
174
  };
175
175
  position += binaryLength;
176
176
  break;
177
- case 7:
177
+ case HEADER_VALUE_TYPE.string:
178
178
  const stringLength = headers.getUint16(position, false);
179
179
  position += 2;
180
180
  out[name] = {
@@ -183,14 +183,14 @@ class HeaderMarshaller {
183
183
  };
184
184
  position += stringLength;
185
185
  break;
186
- case 8:
186
+ case HEADER_VALUE_TYPE.timestamp:
187
187
  out[name] = {
188
188
  type: TIMESTAMP_TAG,
189
189
  value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf()),
190
190
  };
191
191
  position += 8;
192
192
  break;
193
- case 9:
193
+ case HEADER_VALUE_TYPE.uuid:
194
194
  const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
195
195
  position += 16;
196
196
  out[name] = {
@@ -965,7 +965,7 @@ function contentLengthMiddleware(bodyLengthChecker) {
965
965
  [CONTENT_LENGTH_HEADER]: String(length),
966
966
  };
967
967
  }
968
- catch (error) {
968
+ catch (ignored) {
969
969
  }
970
970
  }
971
971
  }
@@ -181,7 +181,7 @@ function bindRetryMiddleware(isStreamingPayload) {
181
181
  try {
182
182
  retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
183
183
  }
184
- catch (refreshError) {
184
+ catch (ignoredRefreshError) {
185
185
  if (!lastError.$metadata) {
186
186
  lastError.$metadata = {};
187
187
  }
@@ -499,7 +499,7 @@ let StandardRetryStrategy$1 = class StandardRetryStrategy {
499
499
  try {
500
500
  return await this.maxAttemptsProvider();
501
501
  }
502
- catch (error) {
502
+ catch (ignored) {
503
503
  console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
504
504
  return DEFAULT_MAX_ATTEMPTS;
505
505
  }
@@ -626,7 +626,7 @@ class StandardRetryStrategy {
626
626
  try {
627
627
  maxAttempts = await this.maxAttemptsProvider();
628
628
  }
629
- catch (error) {
629
+ catch (ignored) {
630
630
  maxAttempts = DEFAULT_MAX_ATTEMPTS;
631
631
  }
632
632
  return maxAttempts;
@@ -183,7 +183,7 @@ function bindRetryMiddleware(isStreamingPayload) {
183
183
  try {
184
184
  retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
185
185
  }
186
- catch (refreshError) {
186
+ catch (ignoredRefreshError) {
187
187
  if (!lastError.$metadata) {
188
188
  lastError.$metadata = {};
189
189
  }
@@ -501,7 +501,7 @@ let StandardRetryStrategy$1 = class StandardRetryStrategy {
501
501
  try {
502
502
  return await this.maxAttemptsProvider();
503
503
  }
504
- catch (error) {
504
+ catch (ignored) {
505
505
  console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
506
506
  return DEFAULT_MAX_ATTEMPTS;
507
507
  }
@@ -628,7 +628,7 @@ class StandardRetryStrategy {
628
628
  try {
629
629
  maxAttempts = await this.maxAttemptsProvider();
630
630
  }
631
- catch (error) {
631
+ catch (ignored) {
632
632
  maxAttempts = DEFAULT_MAX_ATTEMPTS;
633
633
  }
634
634
  return maxAttempts;
@@ -41,7 +41,7 @@ const schemaDeserializationMiddleware = (config) => (next, context) => async (ar
41
41
  try {
42
42
  error.message += "\n " + hint;
43
43
  }
44
- catch (e) {
44
+ catch (ignored) {
45
45
  if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
46
46
  console.warn(hint);
47
47
  }
@@ -66,7 +66,7 @@ const schemaDeserializationMiddleware = (config) => (next, context) => async (ar
66
66
  };
67
67
  }
68
68
  }
69
- catch (e) {
69
+ catch (ignored) {
70
70
  }
71
71
  }
72
72
  throw error;
@@ -205,7 +205,7 @@ class ErrorSchema extends StructureSchema {
205
205
  ctor;
206
206
  symbol = ErrorSchema.symbol;
207
207
  }
208
- const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
208
+ const error = (namespace, name, traits, memberNames, memberList, _ctor) => Schema.assign(new ErrorSchema(), {
209
209
  name,
210
210
  namespace,
211
211
  traits,
@@ -457,7 +457,7 @@ class NormalizedSchema {
457
457
  const schema = this.getSchema();
458
458
  const memberSchema = isDoc
459
459
  ? 15
460
- : schema[4] ?? 0;
460
+ : (schema[4] ?? 0);
461
461
  return member([memberSchema, 0], "key");
462
462
  }
463
463
  getValueSchema() {
@@ -150,7 +150,7 @@ function bindV4(getRandomValues) {
150
150
  };
151
151
  }
152
152
 
153
- const copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => source;
153
+ const copyDocumentWithTransform = (source, _schemaRef, _transform = (_) => _) => source;
154
154
 
155
155
  const parseBoolean = (value) => {
156
156
  switch (value) {
@@ -420,7 +420,7 @@ const parseRfc3339DateTime = (value) => {
420
420
  const day = parseDateValue(dayStr, "day", 1, 31);
421
421
  return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
422
422
  };
423
- const RFC3339_WITH_OFFSET$1 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
423
+ const RFC3339_WITH_OFFSET$1 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/);
424
424
  const parseRfc3339DateTimeWithOffset = (value) => {
425
425
  if (value === null || value === undefined) {
426
426
  return undefined;
@@ -915,7 +915,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
915
915
  try {
916
916
  error.message += "\n " + hint;
917
917
  }
918
- catch (e) {
918
+ catch (ignored) {
919
919
  if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
920
920
  console.warn(hint);
921
921
  }
@@ -940,7 +940,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
940
940
  };
941
941
  }
942
942
  }
943
- catch (e) {
943
+ catch (ignored) {
944
944
  }
945
945
  }
946
946
  throw error;
@@ -118,7 +118,7 @@ function bindV4(getRandomValues) {
118
118
  };
119
119
  }
120
120
 
121
- const copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => source;
121
+ const copyDocumentWithTransform = (source, _schemaRef, _transform = (_) => _) => source;
122
122
 
123
123
  const parseBoolean = (value) => {
124
124
  switch (value) {
@@ -388,7 +388,7 @@ const parseRfc3339DateTime = (value) => {
388
388
  const day = parseDateValue(dayStr, "day", 1, 31);
389
389
  return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
390
390
  };
391
- const RFC3339_WITH_OFFSET$1 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
391
+ const RFC3339_WITH_OFFSET$1 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/);
392
392
  const parseRfc3339DateTimeWithOffset = (value) => {
393
393
  if (value === null || value === undefined) {
394
394
  return undefined;
@@ -880,7 +880,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
880
880
  try {
881
881
  error.message += "\n " + hint;
882
882
  }
883
- catch (e) {
883
+ catch (ignored) {
884
884
  if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
885
885
  console.warn(hint);
886
886
  }
@@ -905,7 +905,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
905
905
  };
906
906
  }
907
907
  }
908
- catch (e) {
908
+ catch (ignored) {
909
909
  }
910
910
  }
911
911
  throw error;
@@ -1006,6 +1006,7 @@ let ChecksumStream$1 = class ChecksumStream extends Readable {
1006
1006
  this.source.on("data", this.onSourceData);
1007
1007
  this.source.on("end", this.onSourceEnd);
1008
1008
  this.source.on("error", this.onSourceError);
1009
+ this.source.on("close", this.onSourceClose);
1009
1010
  this.source.pause();
1010
1011
  }
1011
1012
  onSourceData = (chunk) => {
@@ -1045,10 +1046,19 @@ let ChecksumStream$1 = class ChecksumStream extends Readable {
1045
1046
  onSourceError = (error) => {
1046
1047
  this.destroy(error);
1047
1048
  };
1048
- _read(size) {
1049
+ onSourceClose = () => {
1050
+ if (!this.destroyed && !this.source.readableEnded) {
1051
+ this.destroy(new Error("Connection lost or stream closed before all data was received."));
1052
+ }
1053
+ };
1054
+ _read(_size) {
1049
1055
  this.source.resume();
1050
1056
  }
1051
1057
  _destroy(error, callback) {
1058
+ this.source?.removeListener("data", this.onSourceData);
1059
+ this.source?.removeListener("end", this.onSourceEnd);
1060
+ this.source?.removeListener("error", this.onSourceError);
1061
+ this.source?.removeListener("close", this.onSourceClose);
1052
1062
  this.source?.destroy();
1053
1063
  callback(error);
1054
1064
  }
@@ -1595,7 +1605,7 @@ const sdkStreamMixin = (stream) => {
1595
1605
  try {
1596
1606
  return sdkStreamMixin$1(stream);
1597
1607
  }
1598
- catch (e) {
1608
+ catch (ignored) {
1599
1609
  const name = stream?.__proto__?.constructor?.name || stream;
1600
1610
  throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`);
1601
1611
  }
@@ -150,7 +150,7 @@ function bindV4(getRandomValues) {
150
150
  };
151
151
  }
152
152
 
153
- const copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => source;
153
+ const copyDocumentWithTransform = (source, _schemaRef, _transform = (_) => _) => source;
154
154
 
155
155
  const parseBoolean = (value) => {
156
156
  switch (value) {
@@ -420,7 +420,7 @@ const parseRfc3339DateTime = (value) => {
420
420
  const day = parseDateValue(dayStr, "day", 1, 31);
421
421
  return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
422
422
  };
423
- const RFC3339_WITH_OFFSET$1 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
423
+ const RFC3339_WITH_OFFSET$1 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/);
424
424
  const parseRfc3339DateTimeWithOffset = (value) => {
425
425
  if (value === null || value === undefined) {
426
426
  return undefined;
@@ -915,7 +915,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
915
915
  try {
916
916
  error.message += "\n " + hint;
917
917
  }
918
- catch (e) {
918
+ catch (ignored) {
919
919
  if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
920
920
  console.warn(hint);
921
921
  }
@@ -940,7 +940,7 @@ const deserializerMiddleware = (options, deserializer) => (next, context) => asy
940
940
  };
941
941
  }
942
942
  }
943
- catch (e) {
943
+ catch (ignored) {
944
944
  }
945
945
  }
946
946
  throw error;
@@ -101,7 +101,7 @@ const isValidHostLabel = (value, allowSubDomains = false) => {
101
101
  };
102
102
 
103
103
  function isValidHostname(hostname) {
104
- const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/;
104
+ const hostPattern = /^[a-z0-9][a-z0-9.-]*[a-z0-9]$/;
105
105
  return hostPattern.test(hostname);
106
106
  }
107
107
 
@@ -35,7 +35,7 @@ export class SmithyRpcV2CborProtocol extends RpcProtocol {
35
35
  try {
36
36
  request.headers["content-length"] = String(request.body.byteLength);
37
37
  }
38
- catch (e) { }
38
+ catch (ignored) { }
39
39
  }
40
40
  const { service, operation } = getSmithyContext(context);
41
41
  const path = `/service/${service}/operation/${operation}`;
@@ -67,7 +67,7 @@ export class SmithyRpcV2CborProtocol extends RpcProtocol {
67
67
  try {
68
68
  errorSchema = registry.getSchema(errorName);
69
69
  }
70
- catch (e) {
70
+ catch (ignored) {
71
71
  if (dataObject.Message) {
72
72
  dataObject.message = dataObject.Message;
73
73
  }
@@ -91,7 +91,7 @@ export const buildHttpRpcRequest = async (context, headers, path, resolvedHostna
91
91
  try {
92
92
  contents.headers["content-length"] = String(calculateBodyLength(body));
93
93
  }
94
- catch (e) { }
94
+ catch (ignored) { }
95
95
  }
96
96
  return new __HttpRequest(contents);
97
97
  };
@@ -4,7 +4,7 @@ import { getResolvedPartition } from "./getResolvedPartition";
4
4
  import { getResolvedSigningRegion } from "./getResolvedSigningRegion";
5
5
  export const getRegionInfo = (region, { useFipsEndpoint = false, useDualstackEndpoint = false, signingService, regionHash, partitionHash, }) => {
6
6
  const partition = getResolvedPartition(region, { partitionHash });
7
- const resolvedRegion = region in regionHash ? region : partitionHash[partition]?.endpoint ?? region;
7
+ const resolvedRegion = region in regionHash ? region : (partitionHash[partition]?.endpoint ?? region);
8
8
  const hostnameOptions = { useFipsEndpoint, useDualstackEndpoint };
9
9
  const regionHostname = getHostnameFromVariants(regionHash[resolvedRegion]?.variants, hostnameOptions);
10
10
  const partitionHostname = getHostnameFromVariants(partitionHash[partition]?.variants, hostnameOptions);
@@ -20,7 +20,7 @@ export const resolveDefaultsModeConfig = ({ defaultsMode, } = {}) => memoize(asy
20
20
  const useMobileConfiguration = () => {
21
21
  const navigator = window?.navigator;
22
22
  if (navigator?.connection) {
23
- const { effectiveType, rtt, downlink } = navigator?.connection;
23
+ const { effectiveType, rtt, downlink } = navigator.connection;
24
24
  const slow = (typeof effectiveType === "string" && effectiveType !== "4g") || Number(rtt) > 100 || Number(downlink) < 10;
25
25
  if (slow) {
26
26
  return true;
@@ -6,7 +6,7 @@ export function getSelectorName(functionString) {
6
6
  constants.delete("ENV");
7
7
  return [...constants].join(", ");
8
8
  }
9
- catch (e) {
9
+ catch (ignored) {
10
10
  return functionString;
11
11
  }
12
12
  }
@@ -1,6 +1,6 @@
1
1
  import { IniSectionType } from "@smithy/types";
2
2
  import { CONFIG_PREFIX_SEPARATOR } from "./constants";
3
- const prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
3
+ const prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/;
4
4
  const profileNameBlockList = ["__proto__", "profile __proto__"];
5
5
  export const parseIni = (iniData) => {
6
6
  const map = {};
@@ -20,7 +20,7 @@ export const resolveParamsForS3 = async (endpointParams) => {
20
20
  }
21
21
  return endpointParams;
22
22
  };
23
- const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
23
+ const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/;
24
24
  const IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
25
25
  const DOTS_PATTERN = /\.\./;
26
26
  export const DOT_PATTERN = /\./;
@@ -20,7 +20,7 @@ export const parseURL = (value) => {
20
20
  }
21
21
  return new URL(value);
22
22
  }
23
- catch (error) {
23
+ catch (ignored) {
24
24
  return null;
25
25
  }
26
26
  })();
@@ -24,27 +24,27 @@ export class HeaderMarshaller {
24
24
  formatHeaderValue(header) {
25
25
  switch (header.type) {
26
26
  case "boolean":
27
- return Uint8Array.from([header.value ? 0 : 1]);
27
+ return Uint8Array.from([header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse]);
28
28
  case "byte":
29
- return Uint8Array.from([2, header.value]);
29
+ return Uint8Array.from([HEADER_VALUE_TYPE.byte, header.value]);
30
30
  case "short":
31
31
  const shortView = new DataView(new ArrayBuffer(3));
32
- shortView.setUint8(0, 3);
32
+ shortView.setUint8(0, HEADER_VALUE_TYPE.short);
33
33
  shortView.setInt16(1, header.value, false);
34
34
  return new Uint8Array(shortView.buffer);
35
35
  case "integer":
36
36
  const intView = new DataView(new ArrayBuffer(5));
37
- intView.setUint8(0, 4);
37
+ intView.setUint8(0, HEADER_VALUE_TYPE.integer);
38
38
  intView.setInt32(1, header.value, false);
39
39
  return new Uint8Array(intView.buffer);
40
40
  case "long":
41
41
  const longBytes = new Uint8Array(9);
42
- longBytes[0] = 5;
42
+ longBytes[0] = HEADER_VALUE_TYPE.long;
43
43
  longBytes.set(header.value.bytes, 1);
44
44
  return longBytes;
45
45
  case "binary":
46
46
  const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
47
- binView.setUint8(0, 6);
47
+ binView.setUint8(0, HEADER_VALUE_TYPE.byteArray);
48
48
  binView.setUint16(1, header.value.byteLength, false);
49
49
  const binBytes = new Uint8Array(binView.buffer);
50
50
  binBytes.set(header.value, 3);
@@ -52,14 +52,14 @@ export class HeaderMarshaller {
52
52
  case "string":
53
53
  const utf8Bytes = this.fromUtf8(header.value);
54
54
  const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
55
- strView.setUint8(0, 7);
55
+ strView.setUint8(0, HEADER_VALUE_TYPE.string);
56
56
  strView.setUint16(1, utf8Bytes.byteLength, false);
57
57
  const strBytes = new Uint8Array(strView.buffer);
58
58
  strBytes.set(utf8Bytes, 3);
59
59
  return strBytes;
60
60
  case "timestamp":
61
61
  const tsBytes = new Uint8Array(9);
62
- tsBytes[0] = 8;
62
+ tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
63
63
  tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1);
64
64
  return tsBytes;
65
65
  case "uuid":
@@ -67,8 +67,8 @@ export class HeaderMarshaller {
67
67
  throw new Error(`Invalid UUID received: ${header.value}`);
68
68
  }
69
69
  const uuidBytes = new Uint8Array(17);
70
- uuidBytes[0] = 9;
71
- uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
70
+ uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
71
+ uuidBytes.set(fromHex(header.value.replace(/-/g, "")), 1);
72
72
  return uuidBytes;
73
73
  }
74
74
  }
@@ -80,46 +80,46 @@ export class HeaderMarshaller {
80
80
  const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
81
81
  position += nameLength;
82
82
  switch (headers.getUint8(position++)) {
83
- case 0:
83
+ case HEADER_VALUE_TYPE.boolTrue:
84
84
  out[name] = {
85
85
  type: BOOLEAN_TAG,
86
86
  value: true,
87
87
  };
88
88
  break;
89
- case 1:
89
+ case HEADER_VALUE_TYPE.boolFalse:
90
90
  out[name] = {
91
91
  type: BOOLEAN_TAG,
92
92
  value: false,
93
93
  };
94
94
  break;
95
- case 2:
95
+ case HEADER_VALUE_TYPE.byte:
96
96
  out[name] = {
97
97
  type: BYTE_TAG,
98
98
  value: headers.getInt8(position++),
99
99
  };
100
100
  break;
101
- case 3:
101
+ case HEADER_VALUE_TYPE.short:
102
102
  out[name] = {
103
103
  type: SHORT_TAG,
104
104
  value: headers.getInt16(position, false),
105
105
  };
106
106
  position += 2;
107
107
  break;
108
- case 4:
108
+ case HEADER_VALUE_TYPE.integer:
109
109
  out[name] = {
110
110
  type: INT_TAG,
111
111
  value: headers.getInt32(position, false),
112
112
  };
113
113
  position += 4;
114
114
  break;
115
- case 5:
115
+ case HEADER_VALUE_TYPE.long:
116
116
  out[name] = {
117
117
  type: LONG_TAG,
118
118
  value: new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)),
119
119
  };
120
120
  position += 8;
121
121
  break;
122
- case 6:
122
+ case HEADER_VALUE_TYPE.byteArray:
123
123
  const binaryLength = headers.getUint16(position, false);
124
124
  position += 2;
125
125
  out[name] = {
@@ -128,7 +128,7 @@ export class HeaderMarshaller {
128
128
  };
129
129
  position += binaryLength;
130
130
  break;
131
- case 7:
131
+ case HEADER_VALUE_TYPE.string:
132
132
  const stringLength = headers.getUint16(position, false);
133
133
  position += 2;
134
134
  out[name] = {
@@ -137,14 +137,14 @@ export class HeaderMarshaller {
137
137
  };
138
138
  position += stringLength;
139
139
  break;
140
- case 8:
140
+ case HEADER_VALUE_TYPE.timestamp:
141
141
  out[name] = {
142
142
  type: TIMESTAMP_TAG,
143
143
  value: new Date(new Int64(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf()),
144
144
  };
145
145
  position += 8;
146
146
  break;
147
- case 9:
147
+ case HEADER_VALUE_TYPE.uuid:
148
148
  const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
149
149
  position += 16;
150
150
  out[name] = {
@@ -16,7 +16,7 @@ export function contentLengthMiddleware(bodyLengthChecker) {
16
16
  [CONTENT_LENGTH_HEADER]: String(length),
17
17
  };
18
18
  }
19
- catch (error) {
19
+ catch (ignored) {
20
20
  }
21
21
  }
22
22
  }
@@ -27,7 +27,7 @@ export class StandardRetryStrategy {
27
27
  try {
28
28
  maxAttempts = await this.maxAttemptsProvider();
29
29
  }
30
- catch (error) {
30
+ catch (ignored) {
31
31
  maxAttempts = DEFAULT_MAX_ATTEMPTS;
32
32
  }
33
33
  return maxAttempts;
@@ -41,7 +41,7 @@ export function bindRetryMiddleware(isStreamingPayload) {
41
41
  try {
42
42
  retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
43
43
  }
44
- catch (refreshError) {
44
+ catch (ignoredRefreshError) {
45
45
  if (!lastError.$metadata) {
46
46
  lastError.$metadata = {};
47
47
  }
@@ -76,7 +76,7 @@ export class StandardRetryStrategy {
76
76
  try {
77
77
  return await this.maxAttemptsProvider();
78
78
  }
79
- catch (error) {
79
+ catch (ignored) {
80
80
  console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
81
81
  return DEFAULT_MAX_ATTEMPTS;
82
82
  }
@@ -26,7 +26,7 @@ export const schemaDeserializationMiddleware = (config) => (next, context) => as
26
26
  try {
27
27
  error.message += "\n " + hint;
28
28
  }
29
- catch (e) {
29
+ catch (ignored) {
30
30
  if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
31
31
  console.warn(hint);
32
32
  }
@@ -51,7 +51,7 @@ export const schemaDeserializationMiddleware = (config) => (next, context) => as
51
51
  };
52
52
  }
53
53
  }
54
- catch (e) {
54
+ catch (ignored) {
55
55
  }
56
56
  }
57
57
  throw error;
@@ -5,7 +5,7 @@ export class ErrorSchema extends StructureSchema {
5
5
  ctor;
6
6
  symbol = ErrorSchema.symbol;
7
7
  }
8
- export const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
8
+ export const error = (namespace, name, traits, memberNames, memberList, _ctor) => Schema.assign(new ErrorSchema(), {
9
9
  name,
10
10
  namespace,
11
11
  traits,
@@ -216,7 +216,7 @@ export class NormalizedSchema {
216
216
  const schema = this.getSchema();
217
217
  const memberSchema = isDoc
218
218
  ? 15
219
- : schema[4] ?? 0;
219
+ : (schema[4] ?? 0);
220
220
  return member([memberSchema, 0], "key");
221
221
  }
222
222
  getValueSchema() {
@@ -1 +1 @@
1
- export const copyDocumentWithTransform = (source, schemaRef, transform = (_) => _) => source;
1
+ export const copyDocumentWithTransform = (source, _schemaRef, _transform = (_) => _) => source;
@@ -33,7 +33,7 @@ export const parseRfc3339DateTime = (value) => {
33
33
  const day = parseDateValue(dayStr, "day", 1, 31);
34
34
  return buildDate(year, month, day, { hours, minutes, seconds, fractionalMilliseconds });
35
35
  };
36
- const RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
36
+ const RFC3339_WITH_OFFSET = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}:\d{2})|[zZ])$/);
37
37
  export const parseRfc3339DateTimeWithOffset = (value) => {
38
38
  if (value === null || value === undefined) {
39
39
  return undefined;
@@ -20,7 +20,7 @@ export const deserializerMiddleware = (options, deserializer) => (next, context)
20
20
  try {
21
21
  error.message += "\n " + hint;
22
22
  }
23
- catch (e) {
23
+ catch (ignored) {
24
24
  if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
25
25
  console.warn(hint);
26
26
  }
@@ -45,7 +45,7 @@ export const deserializerMiddleware = (options, deserializer) => (next, context)
45
45
  };
46
46
  }
47
47
  }
48
- catch (e) {
48
+ catch (ignored) {
49
49
  }
50
50
  }
51
51
  throw error;
@@ -19,6 +19,7 @@ export class ChecksumStream extends Readable {
19
19
  this.source.on("data", this.onSourceData);
20
20
  this.source.on("end", this.onSourceEnd);
21
21
  this.source.on("error", this.onSourceError);
22
+ this.source.on("close", this.onSourceClose);
22
23
  this.source.pause();
23
24
  }
24
25
  onSourceData = (chunk) => {
@@ -58,10 +59,19 @@ export class ChecksumStream extends Readable {
58
59
  onSourceError = (error) => {
59
60
  this.destroy(error);
60
61
  };
61
- _read(size) {
62
+ onSourceClose = () => {
63
+ if (!this.destroyed && !this.source.readableEnded) {
64
+ this.destroy(new Error("Connection lost or stream closed before all data was received."));
65
+ }
66
+ };
67
+ _read(_size) {
62
68
  this.source.resume();
63
69
  }
64
70
  _destroy(error, callback) {
71
+ this.source?.removeListener("data", this.onSourceData);
72
+ this.source?.removeListener("end", this.onSourceEnd);
73
+ this.source?.removeListener("error", this.onSourceError);
74
+ this.source?.removeListener("close", this.onSourceClose);
65
75
  this.source?.destroy();
66
76
  callback(error);
67
77
  }
@@ -8,7 +8,7 @@ export const sdkStreamMixin = (stream) => {
8
8
  try {
9
9
  return sdkStreamMixinReadableStream(stream);
10
10
  }
11
- catch (e) {
11
+ catch (ignored) {
12
12
  const name = stream?.__proto__?.constructor?.name || stream;
13
13
  throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`);
14
14
  }
@@ -1,4 +1,4 @@
1
1
  export function isValidHostname(hostname) {
2
- const hostPattern = /^[a-z0-9][a-z0-9\.\-]*[a-z0-9]$/;
2
+ const hostPattern = /^[a-z0-9][a-z0-9.-]*[a-z0-9]$/;
3
3
  return hostPattern.test(hostname);
4
4
  }
@@ -28,10 +28,10 @@ export declare class ErrorSchema extends StructureSchema {
28
28
  * @param traits - shape level serde traits.
29
29
  * @param memberNames - list of member names.
30
30
  * @param memberList - list of schemaRef corresponding to each
31
- * @param ctor - class reference for the existing Error extending class.
31
+ * @param _ctor - class reference for the existing Error extending class.
32
32
  */
33
33
  export declare const error: (namespace: string, name: string, traits: SchemaTraits, memberNames: string[], memberList: SchemaRef[],
34
34
  /**
35
35
  * @deprecated - field unused.
36
36
  */
37
- ctor?: any) => ErrorSchema;
37
+ _ctor?: any) => ErrorSchema;
@@ -3,4 +3,4 @@ import type { SchemaRef } from "@smithy/types";
3
3
  * @internal
4
4
  * @deprecated the former functionality has been internalized to the CborCodec.
5
5
  */
6
- export declare const copyDocumentWithTransform: (source: any, schemaRef: SchemaRef, transform?: (_: any, schemaRef: SchemaRef) => any) => any;
6
+ export declare const copyDocumentWithTransform: (source: any, _schemaRef: SchemaRef, _transform?: (_: any, schemaRef: SchemaRef) => any) => any;
@@ -40,11 +40,11 @@ export interface ChecksumStreamInit<T extends Readable | ReadableStream> {
40
40
  * @internal
41
41
  */
42
42
  export declare class ChecksumStream extends Readable {
43
- private expectedChecksum;
44
- private checksumSourceLocation;
43
+ private readonly expectedChecksum;
44
+ private readonly checksumSourceLocation;
45
45
  private checksum;
46
46
  private source;
47
- private base64Encoder;
47
+ private readonly base64Encoder;
48
48
  constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }: ChecksumStreamInit<Readable>);
49
49
  /**
50
50
  * Update the checksum and forward each source chunk to the readable side,
@@ -59,12 +59,17 @@ export declare class ChecksumStream extends Readable {
59
59
  * Surface source errors on this stream.
60
60
  */
61
61
  private onSourceError;
62
+ /**
63
+ * If the source stream closes without having ended,
64
+ * this is considered an error.
65
+ */
66
+ private onSourceClose;
62
67
  /**
63
68
  * Resume the source so it flows at the rate this stream is consumed.
64
69
  * Do not call this directly.
65
70
  * @internal
66
71
  */
67
- _read(size: number): void;
72
+ _read(_size: number): void;
68
73
  /**
69
74
  * Destroy the upstream source for cleanup so it is not left dangling, then
70
75
  * complete this stream's destruction. The error is intentionally not forwarded
@@ -28,10 +28,10 @@ export declare class ErrorSchema extends StructureSchema {
28
28
  * @param traits - shape level serde traits.
29
29
  * @param memberNames - list of member names.
30
30
  * @param memberList - list of schemaRef corresponding to each
31
- * @param ctor - class reference for the existing Error extending class.
31
+ * @param _ctor - class reference for the existing Error extending class.
32
32
  */
33
33
  export declare const error: (namespace: string, name: string, traits: SchemaTraits, memberNames: string[], memberList: SchemaRef[],
34
34
  /**
35
35
  * @deprecated - field unused.
36
36
  */
37
- ctor?: any) => ErrorSchema;
37
+ _ctor?: any) => ErrorSchema;
@@ -3,4 +3,4 @@ import { SchemaRef } from "@smithy/types";
3
3
  * @internal
4
4
  * @deprecated the former functionality has been internalized to the CborCodec.
5
5
  */
6
- export declare const copyDocumentWithTransform: (source: any, schemaRef: SchemaRef, transform?: (_: any, schemaRef: SchemaRef) => any) => any;
6
+ export declare const copyDocumentWithTransform: (source: any, _schemaRef: SchemaRef, _transform?: (_: any, schemaRef: SchemaRef) => any) => any;
@@ -40,11 +40,11 @@ export interface ChecksumStreamInit<T extends Readable | ReadableStream> {
40
40
  * @internal
41
41
  */
42
42
  export declare class ChecksumStream extends Readable {
43
- private expectedChecksum;
44
- private checksumSourceLocation;
43
+ private readonly expectedChecksum;
44
+ private readonly checksumSourceLocation;
45
45
  private checksum;
46
46
  private source;
47
- private base64Encoder;
47
+ private readonly base64Encoder;
48
48
  constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }: ChecksumStreamInit<Readable>);
49
49
  /**
50
50
  * Update the checksum and forward each source chunk to the readable side,
@@ -59,12 +59,17 @@ export declare class ChecksumStream extends Readable {
59
59
  * Surface source errors on this stream.
60
60
  */
61
61
  private onSourceError;
62
+ /**
63
+ * If the source stream closes without having ended,
64
+ * this is considered an error.
65
+ */
66
+ private onSourceClose;
62
67
  /**
63
68
  * Resume the source so it flows at the rate this stream is consumed.
64
69
  * Do not call this directly.
65
70
  * @internal
66
71
  */
67
- _read(size: number): void;
72
+ _read(_size: number): void;
68
73
  /**
69
74
  * Destroy the upstream source for cleanup so it is not left dangling, then
70
75
  * complete this stream's destruction. The error is intentionally not forwarded
package/package.json CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.29.3",
3
+ "version": "3.29.5",
4
4
  "scripts": {
5
5
  "benchmark:cbor": "node ./scripts/cbor-perf.mjs",
6
6
  "benchmark:checksum": "node ./scripts/checksum-perf.mjs",
7
7
  "build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
8
- "build:es:cjs": "premove dist-es && yarn g:tsc -p tsconfig.es.json && node ../../scripts/inline",
8
+ "build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
9
9
  "build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
10
10
  "build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
11
11
  "clean": "premove dist-cjs dist-es dist-types",
12
12
  "extract:docs": "api-extractor run --local",
13
- "format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"",
14
13
  "lint": "node ../../scripts/validation/submodules-linter.js",
15
14
  "prebuild": "yarn lint",
16
15
  "stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
@@ -189,6 +188,9 @@
189
188
  "<4.5": {
190
189
  "dist-types/*": [
191
190
  "dist-types/ts3.4/*"
191
+ ],
192
+ "*": [
193
+ "dist-types/ts3.4/submodules/*/index.d.ts"
192
194
  ]
193
195
  }
194
196
  },