@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.38.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6f250ec: Let clients offer a service default idle timeout to the request handler through updateHttpClientConfig, taken only when the handler has none of its own.
8
+ - 0f58fed: Export the shared `writeKey` helper and include headers named after Object prototype properties in canonical request signatures.
9
+
10
+ ## 3.37.0
11
+
12
+ ### Minor Changes
13
+
14
+ - a90c7be: Add AbstractRpcV2Protocol, a shared abstract base for the Smithy RPC v2 JSON and CBOR client protocols, deduplicating their request framing and response status handling.
15
+ - a90c7be: Add Smithy RPC v2 JSON protocol support: client protocol and JSON codec in @smithy/core, server protocol in @smithy/server-common, and the snapshot response serializer in @smithy/snapshot-testing.
16
+
17
+ ### Patch Changes
18
+
19
+ - a90c7be: Treat any non-200 response as an error in the Smithy RPC v2 JSON and CBOR client protocols, per the specification. RpcProtocol gains a protected isErrorResponse predicate (default unchanged: status >= 300) that both RPC v2 protocols override to status !== 200.
20
+
3
21
  ## 3.36.2
4
22
 
5
23
  ### Patch Changes
package/dist-cjs/index.js CHANGED
@@ -139,8 +139,9 @@ const getHttpSigningPlugin = (config) => ({
139
139
  });
140
140
 
141
141
  const normalizeProvider = (input) => {
142
- if (typeof input === "function")
142
+ if (typeof input === "function") {
143
143
  return input;
144
+ }
144
145
  const promisified = Promise.resolve(input);
145
146
  return () => promisified;
146
147
  };
@@ -203,8 +204,9 @@ class DefaultIdentityProviderConfig {
203
204
  authSchemes = new Map();
204
205
  constructor(config) {
205
206
  for (const key in config) {
206
- if (!hasOwn(config, key))
207
+ if (!hasOwn(config, key)) {
207
208
  continue;
209
+ }
208
210
  const value = config[key];
209
211
  if (value !== undefined) {
210
212
  this.authSchemes.set(key, value);
@@ -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;
@@ -931,8 +931,9 @@ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, bod
931
931
  }
932
932
  if (endpoint.headers) {
933
933
  for (const name in endpoint.headers) {
934
- if (!hasOwn(endpoint.headers, name))
934
+ if (!hasOwn(endpoint.headers, name)) {
935
935
  continue;
936
+ }
936
937
  contents.headers[name] = endpoint.headers[name];
937
938
  }
938
939
  }
@@ -1193,8 +1194,9 @@ function writeStruct(ns, value, serdeContext) {
1193
1194
  }
1194
1195
  if (typeof value.__type === "string") {
1195
1196
  for (const k in value) {
1196
- if (!hasOwn(value, k))
1197
+ if (!hasOwn(value, k)) {
1197
1198
  continue;
1199
+ }
1198
1200
  if (!memberNames.includes(k)) {
1199
1201
  writeString(k);
1200
1202
  writeUntypedValue(value[k]);
@@ -1260,8 +1262,9 @@ function writeMap(ns, value, isDocument, serdeContext) {
1260
1262
  const valueSchema = ns.getValueSchema();
1261
1263
  const keys = [];
1262
1264
  for (const k in value) {
1263
- if (!hasOwn(value, k))
1265
+ if (!hasOwn(value, k)) {
1264
1266
  continue;
1267
+ }
1265
1268
  const v = value[k];
1266
1269
  if (isDocument ? v !== undefined : v != null || sparse) {
1267
1270
  keys.push(k);
@@ -1675,8 +1678,9 @@ function readStruct(ns, count, startPos) {
1675
1678
  if (isUnion) {
1676
1679
  let resultEmpty = true;
1677
1680
  for (const _ in result) {
1678
- if (!hasOwn(result, _))
1681
+ if (!hasOwn(result, _)) {
1679
1682
  continue;
1683
+ }
1680
1684
  resultEmpty = false;
1681
1685
  break;
1682
1686
  }
@@ -1845,8 +1849,9 @@ function readMapIndefinite(ns) {
1845
1849
  if (isUnion) {
1846
1850
  let resultEmpty = true;
1847
1851
  for (const _ in result) {
1848
- if (!hasOwn(result, _))
1852
+ if (!hasOwn(result, _)) {
1849
1853
  continue;
1854
+ }
1850
1855
  resultEmpty = false;
1851
1856
  break;
1852
1857
  }
@@ -2151,8 +2156,9 @@ function transformObject(ns, value) {
2151
2156
  if (ns.isMapSchema()) {
2152
2157
  const targetSchema = ns.getValueSchema();
2153
2158
  for (const key in value) {
2154
- if (!hasOwn(value, key))
2159
+ if (!hasOwn(value, key)) {
2155
2160
  continue;
2161
+ }
2156
2162
  newObject[key] = transformObject(targetSchema, value[key]);
2157
2163
  }
2158
2164
  }
@@ -2162,8 +2168,9 @@ function transformObject(ns, value) {
2162
2168
  if (isUnion) {
2163
2169
  keys = new Set();
2164
2170
  for (const k in value) {
2165
- if (!hasOwn(value, k))
2171
+ if (!hasOwn(value, k)) {
2166
2172
  continue;
2173
+ }
2167
2174
  if (k !== "__type") {
2168
2175
  keys.add(k);
2169
2176
  }
@@ -2180,8 +2187,9 @@ function transformObject(ns, value) {
2180
2187
  if (isUnion && keys?.size === 1) {
2181
2188
  let newObjectEmpty = true;
2182
2189
  for (const _ in newObject) {
2183
- if (!hasOwn(newObject, _))
2190
+ if (!hasOwn(newObject, _)) {
2184
2191
  continue;
2192
+ }
2185
2193
  newObjectEmpty = false;
2186
2194
  break;
2187
2195
  }
@@ -2192,8 +2200,9 @@ function transformObject(ns, value) {
2192
2200
  }
2193
2201
  else if (typeof value.__type === "string") {
2194
2202
  for (const k in value) {
2195
- if (!hasOwn(value, k))
2203
+ if (!hasOwn(value, k)) {
2196
2204
  continue;
2205
+ }
2197
2206
  if (!(k in newObject)) {
2198
2207
  newObject[k] = value[k];
2199
2208
  }
@@ -2216,51 +2225,27 @@ class CborCodec extends SerdeContext {
2216
2225
  }
2217
2226
  }
2218
2227
 
2219
- class SmithyRpcV2CborProtocol extends RpcProtocol {
2228
+ class SmithyRpcV2CborProtocol extends AbstractRpcV2Protocol {
2220
2229
  codec = new CborCodec();
2221
2230
  serializer = this.codec.createSerializer();
2222
2231
  deserializer = this.codec.createDeserializer();
2223
- constructor({ defaultNamespace, errorTypeRegistries, }) {
2224
- super({ defaultNamespace, errorTypeRegistries });
2225
- }
2226
2232
  getShapeId() {
2227
2233
  return "smithy.protocols#rpcv2Cbor";
2228
2234
  }
2229
2235
  getPayloadCodec() {
2230
2236
  return this.codec;
2231
2237
  }
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);
2238
+ getSmithyProtocolHeaderValue() {
2239
+ return "rpc-v2-cbor";
2240
+ }
2241
+ applyEmptyBody(request) {
2242
+ if (!request.body) {
2243
+ this.serializer.write(15, {});
2244
+ request.body = this.serializer.flush();
2256
2245
  }
2257
- else {
2258
- request.path += path;
2246
+ if (request.body instanceof Uint8Array) {
2247
+ request.headers["content-length"] = String(request.body.byteLength);
2259
2248
  }
2260
- return request;
2261
- }
2262
- async deserializeResponse(operationSchema, context, response) {
2263
- return super.deserializeResponse(operationSchema, context, response);
2264
2249
  }
2265
2250
  async handleError(operationSchema, context, response, dataObject, metadata) {
2266
2251
  const errorIdentifier = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
@@ -2356,8 +2341,9 @@ class CborShapeSerializer extends SerdeContext {
2356
2341
  if (ns.isMapSchema()) {
2357
2342
  const sparse = !!ns.getMergedTraits().sparse;
2358
2343
  for (const key in sourceObject) {
2359
- if (!hasOwn(sourceObject, key))
2344
+ if (!hasOwn(sourceObject, key)) {
2360
2345
  continue;
2346
+ }
2361
2347
  const value = this.serialize(ns.getValueSchema(), sourceObject[key]);
2362
2348
  if (value != null || sparse) {
2363
2349
  newObject[key] = value;
@@ -2378,8 +2364,9 @@ class CborShapeSerializer extends SerdeContext {
2378
2364
  }
2379
2365
  else if (typeof sourceObject.__type === "string") {
2380
2366
  for (const k in sourceObject) {
2381
- if (!hasOwn(sourceObject, k))
2367
+ if (!hasOwn(sourceObject, k)) {
2382
2368
  continue;
2369
+ }
2383
2370
  if (!(k in newObject)) {
2384
2371
  newObject[k] = this.serialize(15, sourceObject[k]);
2385
2372
  }
@@ -2396,8 +2383,9 @@ class CborShapeSerializer extends SerdeContext {
2396
2383
  return newArray;
2397
2384
  }
2398
2385
  for (const key in sourceObject) {
2399
- if (!hasOwn(sourceObject, key))
2386
+ if (!hasOwn(sourceObject, key)) {
2400
2387
  continue;
2388
+ }
2401
2389
  newObject[key] = this.serialize(ns.getValueSchema(), sourceObject[key]);
2402
2390
  }
2403
2391
  }
@@ -2472,8 +2460,9 @@ class CborShapeDeserializer extends SerdeContext {
2472
2460
  if (ns.isMapSchema()) {
2473
2461
  const targetSchema = ns.getValueSchema();
2474
2462
  for (const key in value) {
2475
- if (!hasOwn(value, key))
2463
+ if (!hasOwn(value, key)) {
2476
2464
  continue;
2465
+ }
2477
2466
  const itemValue = this.readValue(targetSchema, value[key]);
2478
2467
  newObject[key] = itemValue;
2479
2468
  }
@@ -2484,8 +2473,9 @@ class CborShapeDeserializer extends SerdeContext {
2484
2473
  if (isUnion) {
2485
2474
  keys = new Set();
2486
2475
  for (const k in value) {
2487
- if (!hasOwn(value, k))
2476
+ if (!hasOwn(value, k)) {
2488
2477
  continue;
2478
+ }
2489
2479
  if (k !== "__type") {
2490
2480
  keys.add(k);
2491
2481
  }
@@ -2502,8 +2492,9 @@ class CborShapeDeserializer extends SerdeContext {
2502
2492
  if (isUnion && keys?.size === 1) {
2503
2493
  let newObjectEmpty = true;
2504
2494
  for (const _ in newObject) {
2505
- if (!hasOwn(newObject, _))
2495
+ if (!hasOwn(newObject, _)) {
2506
2496
  continue;
2497
+ }
2507
2498
  newObjectEmpty = false;
2508
2499
  break;
2509
2500
  }
@@ -2514,8 +2505,9 @@ class CborShapeDeserializer extends SerdeContext {
2514
2505
  }
2515
2506
  else if (typeof value.__type === "string") {
2516
2507
  for (const k in value) {
2517
- if (!hasOwn(value, k))
2508
+ if (!hasOwn(value, k)) {
2518
2509
  continue;
2510
+ }
2519
2511
  if (!(k in newObject)) {
2520
2512
  newObject[k] = value[k];
2521
2513
  }
@@ -157,8 +157,9 @@ const constructStack = () => {
157
157
  const aliases = getAllAliases(name, _aliases);
158
158
  if (aliases.length > 0) {
159
159
  if (aliases.some((alias) => entriesNameSet.has(alias))) {
160
- if (!override)
160
+ if (!override) {
161
161
  throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
162
+ }
162
163
  for (const alias of aliases) {
163
164
  const toOverrideIndex = absoluteEntries.findIndex((entry) => entry.name === alias || entry.aliases?.some((a) => a === alias));
164
165
  if (toOverrideIndex === -1) {
@@ -189,8 +190,9 @@ const constructStack = () => {
189
190
  const aliases = getAllAliases(name, _aliases);
190
191
  if (aliases.length > 0) {
191
192
  if (aliases.some((alias) => entriesNameSet.has(alias))) {
192
- if (!override)
193
+ if (!override) {
193
194
  throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name, _aliases)}'`);
195
+ }
194
196
  for (const alias of aliases) {
195
197
  const toOverrideIndex = relativeEntries.findIndex((entry) => entry.name === alias || entry.aliases?.some((a) => a === alias));
196
198
  if (toOverrideIndex === -1) {
@@ -217,10 +219,12 @@ const constructStack = () => {
217
219
  plugin.applyToStack(stack);
218
220
  },
219
221
  remove: (toRemove) => {
220
- if (typeof toRemove === "string")
222
+ if (typeof toRemove === "string") {
221
223
  return removeByName(toRemove);
222
- else
224
+ }
225
+ else {
223
226
  return removeByReference(toRemove);
227
+ }
224
228
  },
225
229
  removeByTag: (toRemove) => {
226
230
  let isRemoved = false;
@@ -257,8 +261,9 @@ const constructStack = () => {
257
261
  });
258
262
  },
259
263
  identifyOnResolve(toggle) {
260
- if (typeof toggle === "boolean")
264
+ if (typeof toggle === "boolean") {
261
265
  identifyOnResolve = toggle;
266
+ }
262
267
  return identifyOnResolve;
263
268
  },
264
269
  resolve: (handler, context) => {
@@ -737,8 +742,9 @@ const createAggregatedClient = (commands, Client, options) => {
737
742
  this.send(command, optionsOrCb);
738
743
  }
739
744
  else if (typeof cb === "function") {
740
- if (typeof optionsOrCb !== "object")
745
+ if (typeof optionsOrCb !== "object") {
741
746
  throw new Error(`Expected http options but got ${typeof optionsOrCb}`);
747
+ }
742
748
  this.send(command, optionsOrCb || {}, cb);
743
749
  }
744
750
  else {
@@ -791,8 +797,9 @@ class ServiceException extends Error {
791
797
  this.$metadata = options.$metadata;
792
798
  }
793
799
  static isInstance(value) {
794
- if (!value)
800
+ if (!value) {
795
801
  return false;
802
+ }
796
803
  const candidate = value;
797
804
  return (ServiceException.prototype.isPrototypeOf(candidate) ||
798
805
  (Boolean(candidate.$fault) &&
@@ -800,8 +807,9 @@ class ServiceException extends Error {
800
807
  (candidate.$fault === "client" || candidate.$fault === "server")));
801
808
  }
802
809
  static [Symbol.hasInstance](instance) {
803
- if (!instance)
810
+ if (!instance) {
804
811
  return false;
812
+ }
805
813
  const candidate = instance;
806
814
  if (this === ServiceException) {
807
815
  return ServiceException.isInstance(instance);
@@ -925,8 +933,9 @@ const knownAlgorithms = Object.values(AlgorithmId);
925
933
  const getChecksumConfiguration = (runtimeConfig) => {
926
934
  const checksumAlgorithms = [];
927
935
  for (const id in AlgorithmId) {
928
- if (!hasOwn(AlgorithmId, id))
936
+ if (!hasOwn(AlgorithmId, id)) {
929
937
  continue;
938
+ }
930
939
  const algorithmId = AlgorithmId[id];
931
940
  if (runtimeConfig[algorithmId] === undefined) {
932
941
  continue;
@@ -1000,8 +1009,9 @@ const getArrayIfSingleItem = (mayBeArray) => Array.isArray(mayBeArray) ? mayBeAr
1000
1009
  const getValueFromTextNode = (obj) => {
1001
1010
  const textNodeName = "#text";
1002
1011
  for (const key in obj) {
1003
- if (!hasOwn(obj, key))
1012
+ if (!hasOwn(obj, key)) {
1004
1013
  continue;
1014
+ }
1005
1015
  if (obj[key][textNodeName] !== undefined) {
1006
1016
  obj[key] = obj[key][textNodeName];
1007
1017
  }
@@ -1044,8 +1054,9 @@ function map(arg0, arg1, arg2) {
1044
1054
  }
1045
1055
  }
1046
1056
  for (const key in instructions) {
1047
- if (!hasOwn(instructions, key))
1057
+ if (!hasOwn(instructions, key)) {
1048
1058
  continue;
1059
+ }
1049
1060
  if (!Array.isArray(instructions[key])) {
1050
1061
  target[key] = instructions[key];
1051
1062
  continue;
@@ -1064,8 +1075,9 @@ const convertMap = (target) => {
1064
1075
  const take = (source, instructions) => {
1065
1076
  const out = {};
1066
1077
  for (const key in instructions) {
1067
- if (!hasOwn(instructions, key))
1078
+ if (!hasOwn(instructions, key)) {
1068
1079
  continue;
1080
+ }
1069
1081
  applyInstruction(out, source, instructions, key);
1070
1082
  }
1071
1083
  return out;
@@ -1146,8 +1158,9 @@ const _json = (obj) => {
1146
1158
  if (typeof obj === "object") {
1147
1159
  const target = {};
1148
1160
  for (const key in obj) {
1149
- if (!hasOwn(obj, key))
1161
+ if (!hasOwn(obj, key)) {
1150
1162
  continue;
1163
+ }
1151
1164
  if (obj[key] == null) {
1152
1165
  continue;
1153
1166
  }
@@ -111,18 +111,22 @@ const memoize = (provider, isExpired, requiresRefresh) => {
111
111
  };
112
112
 
113
113
  const booleanSelector = (obj, key, type) => {
114
- if (!(key in obj))
114
+ if (!(key in obj)) {
115
115
  return undefined;
116
- if (obj[key] === "true")
116
+ }
117
+ if (obj[key] === "true") {
117
118
  return true;
118
- if (obj[key] === "false")
119
+ }
120
+ if (obj[key] === "false") {
119
121
  return false;
122
+ }
120
123
  throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
121
124
  };
122
125
 
123
126
  const numberSelector = (obj, key, type) => {
124
- if (!(key in obj))
127
+ if (!(key in obj)) {
125
128
  return undefined;
129
+ }
126
130
  const numberValue = parseInt(obj[key], 10);
127
131
  if (Number.isNaN(numberValue)) {
128
132
  throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`);
@@ -116,18 +116,22 @@ const memoize = (provider, isExpired, requiresRefresh) => {
116
116
  };
117
117
 
118
118
  const booleanSelector = (obj, key, type) => {
119
- if (!(key in obj))
119
+ if (!(key in obj)) {
120
120
  return undefined;
121
- if (obj[key] === "true")
121
+ }
122
+ if (obj[key] === "true") {
122
123
  return true;
123
- if (obj[key] === "false")
124
+ }
125
+ if (obj[key] === "false") {
124
126
  return false;
127
+ }
125
128
  throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
126
129
  };
127
130
 
128
131
  const numberSelector = (obj, key, type) => {
129
- if (!(key in obj))
132
+ if (!(key in obj)) {
130
133
  return undefined;
134
+ }
131
135
  const numberValue = parseInt(obj[key], 10);
132
136
  if (Number.isNaN(numberValue)) {
133
137
  throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`);
@@ -150,15 +154,19 @@ const getHomeDirCacheKey = () => {
150
154
  };
151
155
  const getHomeDir = () => {
152
156
  const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep}` } = process.env;
153
- if (HOME)
157
+ if (HOME) {
154
158
  return HOME;
155
- if (USERPROFILE)
159
+ }
160
+ if (USERPROFILE) {
156
161
  return USERPROFILE;
157
- if (HOMEPATH)
162
+ }
163
+ if (HOMEPATH) {
158
164
  return `${HOMEDRIVE}${HOMEPATH}`;
165
+ }
159
166
  const homeDirCacheKey = getHomeDirCacheKey();
160
- if (!homeDirCache[homeDirCacheKey])
167
+ if (!homeDirCache[homeDirCacheKey]) {
161
168
  homeDirCache[homeDirCacheKey] = homedir();
169
+ }
162
170
  return homeDirCache[homeDirCacheKey];
163
171
  };
164
172
 
@@ -111,18 +111,22 @@ const memoize = (provider, isExpired, requiresRefresh) => {
111
111
  };
112
112
 
113
113
  const booleanSelector = (obj, key, type) => {
114
- if (!(key in obj))
114
+ if (!(key in obj)) {
115
115
  return undefined;
116
- if (obj[key] === "true")
116
+ }
117
+ if (obj[key] === "true") {
117
118
  return true;
118
- if (obj[key] === "false")
119
+ }
120
+ if (obj[key] === "false") {
119
121
  return false;
122
+ }
120
123
  throw new Error(`Cannot load ${type} "${key}". Expected "true" or "false", got ${obj[key]}.`);
121
124
  };
122
125
 
123
126
  const numberSelector = (obj, key, type) => {
124
- if (!(key in obj))
127
+ if (!(key in obj)) {
125
128
  return undefined;
129
+ }
126
130
  const numberValue = parseInt(obj[key], 10);
127
131
  if (Number.isNaN(numberValue)) {
128
132
  throw new TypeError(`Cannot load ${type} '${key}'. Expected number, got '${obj[key]}'.`);
@@ -783,8 +783,9 @@ const resolveEndpoint = (ruleSetObject, options) => {
783
783
  const { parameters, rules } = ruleSetObject;
784
784
  options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
785
785
  for (const paramKey in parameters) {
786
- if (!hasOwn(parameters, paramKey))
786
+ if (!hasOwn(parameters, paramKey)) {
787
787
  continue;
788
+ }
788
789
  const parameter = parameters[paramKey];
789
790
  const endpointParam = endpointParams[paramKey];
790
791
  if (endpointParam == null && parameter.default != null) {
@@ -11,11 +11,13 @@ const getEndpointUrlConfig = (serviceId) => ({
11
11
  environmentVariableSelector: (env) => {
12
12
  const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
13
13
  const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
14
- if (serviceEndpointUrl)
14
+ if (serviceEndpointUrl) {
15
15
  return serviceEndpointUrl;
16
+ }
16
17
  const endpointUrl = env[ENV_ENDPOINT_URL];
17
- if (endpointUrl)
18
+ if (endpointUrl) {
18
19
  return endpointUrl;
20
+ }
19
21
  return undefined;
20
22
  },
21
23
  configFileSelector: (profile, config) => {
@@ -27,12 +29,14 @@ const getEndpointUrlConfig = (serviceId) => ({
27
29
  const servicesSection = config[servicesSectionKey];
28
30
  const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
29
31
  const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(CONFIG_PREFIX_SEPARATOR)];
30
- if (endpointUrl)
32
+ if (endpointUrl) {
31
33
  return endpointUrl;
34
+ }
32
35
  }
33
36
  const endpointUrl = profile[CONFIG_ENDPOINT_URL];
34
- if (endpointUrl)
37
+ if (endpointUrl) {
35
38
  return endpointUrl;
39
+ }
36
40
  return undefined;
37
41
  },
38
42
  default: undefined,
@@ -831,8 +835,9 @@ const resolveEndpoint = (ruleSetObject, options) => {
831
835
  const { parameters, rules } = ruleSetObject;
832
836
  options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`);
833
837
  for (const paramKey in parameters) {
834
- if (!hasOwn(parameters, paramKey))
838
+ if (!hasOwn(parameters, paramKey)) {
835
839
  continue;
840
+ }
836
841
  const parameter = parameters[paramKey];
837
842
  const endpointParam = endpointParams[paramKey];
838
843
  if (endpointParam == null && parameter.default != null) {