@smithy/core 2.5.7 → 3.0.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.
package/dist-cjs/index.js CHANGED
@@ -60,7 +60,6 @@ function convertHttpAuthSchemesToMap(httpAuthSchemes) {
60
60
  }
61
61
  __name(convertHttpAuthSchemesToMap, "convertHttpAuthSchemesToMap");
62
62
  var httpAuthSchemeMiddleware = /* @__PURE__ */ __name((config, mwOptions) => (next, context) => async (args) => {
63
- var _a;
64
63
  const options = config.httpAuthSchemeProvider(
65
64
  await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input)
66
65
  );
@@ -78,7 +77,7 @@ var httpAuthSchemeMiddleware = /* @__PURE__ */ __name((config, mwOptions) => (ne
78
77
  failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
79
78
  continue;
80
79
  }
81
- const { identityProperties = {}, signingProperties = {} } = ((_a = option.propertiesExtractor) == null ? void 0 : _a.call(option, config, context)) || {};
80
+ const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
82
81
  option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
83
82
  option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
84
83
  smithyContext.selectedHttpAuthScheme = {
@@ -254,7 +253,7 @@ function setFeature(context, feature, value) {
254
253
  __name(setFeature, "setFeature");
255
254
 
256
255
  // src/util-identity-and-auth/DefaultIdentityProviderConfig.ts
257
- var _DefaultIdentityProviderConfig = class _DefaultIdentityProviderConfig {
256
+ var DefaultIdentityProviderConfig = class {
258
257
  /**
259
258
  * Creates an IdentityProviderConfig with a record of scheme IDs to identity providers.
260
259
  *
@@ -268,17 +267,21 @@ var _DefaultIdentityProviderConfig = class _DefaultIdentityProviderConfig {
268
267
  }
269
268
  }
270
269
  }
270
+ static {
271
+ __name(this, "DefaultIdentityProviderConfig");
272
+ }
271
273
  getIdentityProvider(schemeId) {
272
274
  return this.authSchemes.get(schemeId);
273
275
  }
274
276
  };
275
- __name(_DefaultIdentityProviderConfig, "DefaultIdentityProviderConfig");
276
- var DefaultIdentityProviderConfig = _DefaultIdentityProviderConfig;
277
277
 
278
278
  // src/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.ts
279
279
 
280
280
 
281
- var _HttpApiKeyAuthSigner = class _HttpApiKeyAuthSigner {
281
+ var HttpApiKeyAuthSigner = class {
282
+ static {
283
+ __name(this, "HttpApiKeyAuthSigner");
284
+ }
282
285
  async sign(httpRequest, identity, signingProperties) {
283
286
  if (!signingProperties) {
284
287
  throw new Error(
@@ -307,12 +310,13 @@ var _HttpApiKeyAuthSigner = class _HttpApiKeyAuthSigner {
307
310
  return clonedRequest;
308
311
  }
309
312
  };
310
- __name(_HttpApiKeyAuthSigner, "HttpApiKeyAuthSigner");
311
- var HttpApiKeyAuthSigner = _HttpApiKeyAuthSigner;
312
313
 
313
314
  // src/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.ts
314
315
 
315
- var _HttpBearerAuthSigner = class _HttpBearerAuthSigner {
316
+ var HttpBearerAuthSigner = class {
317
+ static {
318
+ __name(this, "HttpBearerAuthSigner");
319
+ }
316
320
  async sign(httpRequest, identity, signingProperties) {
317
321
  const clonedRequest = import_protocol_http.HttpRequest.clone(httpRequest);
318
322
  if (!identity.token) {
@@ -322,17 +326,16 @@ var _HttpBearerAuthSigner = class _HttpBearerAuthSigner {
322
326
  return clonedRequest;
323
327
  }
324
328
  };
325
- __name(_HttpBearerAuthSigner, "HttpBearerAuthSigner");
326
- var HttpBearerAuthSigner = _HttpBearerAuthSigner;
327
329
 
328
330
  // src/util-identity-and-auth/httpAuthSchemes/noAuth.ts
329
- var _NoAuthSigner = class _NoAuthSigner {
331
+ var NoAuthSigner = class {
332
+ static {
333
+ __name(this, "NoAuthSigner");
334
+ }
330
335
  async sign(httpRequest, identity, signingProperties) {
331
336
  return httpRequest;
332
337
  }
333
338
  };
334
- __name(_NoAuthSigner, "NoAuthSigner");
335
- var NoAuthSigner = _NoAuthSigner;
336
339
 
337
340
  // src/util-identity-and-auth/memoizeIdentityProvider.ts
338
341
  var createIsIdentityExpiredFunction = /* @__PURE__ */ __name((expirationMs) => (identity) => doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs, "createIsIdentityExpiredFunction");
@@ -363,14 +366,14 @@ var memoizeIdentityProvider = /* @__PURE__ */ __name((provider, isExpired, requi
363
366
  }, "coalesceProvider");
364
367
  if (isExpired === void 0) {
365
368
  return async (options) => {
366
- if (!hasResult || (options == null ? void 0 : options.forceRefresh)) {
369
+ if (!hasResult || options?.forceRefresh) {
367
370
  resolved = await coalesceProvider(options);
368
371
  }
369
372
  return resolved;
370
373
  };
371
374
  }
372
375
  return async (options) => {
373
- if (!hasResult || (options == null ? void 0 : options.forceRefresh)) {
376
+ if (!hasResult || options?.forceRefresh) {
374
377
  resolved = await coalesceProvider(options);
375
378
  }
376
379
  if (isConstant) {
@@ -164,8 +164,7 @@ function decode(at, to) {
164
164
  }
165
165
  }
166
166
  function bytesToUtf8(bytes, at, to) {
167
- var _a;
168
- if (USE_BUFFER && ((_a = bytes.constructor) == null ? void 0 : _a.name) === "Buffer") {
167
+ if (USE_BUFFER && bytes.constructor?.name === "Buffer") {
169
168
  return bytes.toString("utf-8", at, to);
170
169
  }
171
170
  if (textDecoder) {
@@ -492,7 +491,6 @@ function encodeHeader(major, value) {
492
491
  }
493
492
  }
494
493
  function encode(_input) {
495
- var _a;
496
494
  const encodeStack = [_input];
497
495
  while (encodeStack.length) {
498
496
  const input = encodeStack.pop();
@@ -602,7 +600,7 @@ function encode(_input) {
602
600
  encodeHeader(majorMap, keys.length);
603
601
  continue;
604
602
  }
605
- throw new Error(`data type ${((_a = input == null ? void 0 : input.constructor) == null ? void 0 : _a.name) ?? typeof input} not compatible for encoding.`);
603
+ throw new Error(`data type ${input?.constructor?.name ?? typeof input} not compatible for encoding.`);
606
604
  }
607
605
  }
608
606
 
@@ -112,7 +112,7 @@ var RequestBuilder = class {
112
112
  */
113
113
  bp(uriLabel) {
114
114
  this.resolvePathStack.push((basePath) => {
115
- this.path = `${(basePath == null ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + uriLabel;
115
+ this.path = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + uriLabel;
116
116
  });
117
117
  return this;
118
118
  }
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  export type CborItemType = undefined | boolean | number | bigint | [CborUnstructuredByteStringType, Uint64] | string | CborTagType;
3
4
  export type CborTagType = {
4
5
  tag: Uint64 | number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "2.5.7",
3
+ "version": "3.0.0",
4
4
  "scripts": {
5
5
  "build": "yarn lint && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline core",
@@ -54,17 +54,17 @@
54
54
  },
55
55
  "license": "Apache-2.0",
56
56
  "dependencies": {
57
- "@smithy/middleware-serde": "^3.0.11",
58
- "@smithy/protocol-http": "^4.1.8",
59
- "@smithy/types": "^3.7.2",
60
- "@smithy/util-body-length-browser": "^3.0.0",
61
- "@smithy/util-middleware": "^3.0.11",
62
- "@smithy/util-stream": "^3.3.4",
63
- "@smithy/util-utf8": "^3.0.0",
57
+ "@smithy/middleware-serde": "^4.0.0",
58
+ "@smithy/protocol-http": "^5.0.0",
59
+ "@smithy/types": "^4.0.0",
60
+ "@smithy/util-body-length-browser": "^4.0.0",
61
+ "@smithy/util-middleware": "^4.0.0",
62
+ "@smithy/util-stream": "^4.0.0",
63
+ "@smithy/util-utf8": "^4.0.0",
64
64
  "tslib": "^2.6.2"
65
65
  },
66
66
  "engines": {
67
- "node": ">=16.0.0"
67
+ "node": ">=18.0.0"
68
68
  },
69
69
  "typesVersions": {
70
70
  "<4.0": {
@@ -87,7 +87,7 @@
87
87
  "directory": "packages/core"
88
88
  },
89
89
  "devDependencies": {
90
- "@types/node": "^16.18.96",
90
+ "@types/node": "^18.11.9",
91
91
  "concurrently": "7.0.0",
92
92
  "downlevel-dts": "0.10.1",
93
93
  "json-bigint": "^1.0.0",