@aws-sdk/middleware-token 3.972.17 → 3.972.19

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
@@ -1,10 +1,8 @@
1
- 'use strict';
2
-
3
- var protocols = require('@smithy/core/protocols');
4
- var types = require('@smithy/types');
5
- var client = require('@smithy/core/client');
6
- var config = require('@smithy/core/config');
7
- var tokenDefaultProvider = require('./tokenDefaultProvider');
1
+ const { HttpRequest } = require("@smithy/core/protocols");
2
+ const { HttpAuthLocation } = require("@smithy/types");
3
+ const { normalizeProvider } = require("@smithy/core/client");
4
+ const { memoize } = require("@smithy/core/config");
5
+ const { tokenDefaultProvider } = require("./tokenDefaultProvider");
8
6
 
9
7
  const tokenMiddlewareOptions = {
10
8
  name: "tokenMiddleware",
@@ -14,12 +12,12 @@ const tokenMiddlewareOptions = {
14
12
  override: true,
15
13
  };
16
14
  const tokenMiddleware = (options) => (next, context) => async (args) => {
17
- if (!protocols.HttpRequest.isInstance(args.request) || context.currentAuthConfig)
15
+ if (!HttpRequest.isInstance(args.request) || context.currentAuthConfig)
18
16
  return next(args);
19
17
  const token = options.token && (await options.token());
20
18
  if (token?.token) {
21
19
  const authConfig = {
22
- in: types.HttpAuthLocation.HEADER,
20
+ in: HttpAuthLocation.HEADER,
23
21
  name: "authorization",
24
22
  scheme: "Bearer",
25
23
  };
@@ -42,15 +40,15 @@ const isTokenWithExpiry = (token) => token.expiration !== undefined;
42
40
  const isTokenExpiringWithinFiveMins = (token) => isTokenWithExpiry(token) && token.expiration.getTime() - Date.now() < 300000;
43
41
  const normalizeTokenProvider = (token) => {
44
42
  if (typeof token === "function") {
45
- return config.memoize(token, isTokenExpiringWithinFiveMins, isTokenWithExpiry);
43
+ return memoize(token, isTokenExpiringWithinFiveMins, isTokenWithExpiry);
46
44
  }
47
- return client.normalizeProvider(token);
45
+ return normalizeProvider(token);
48
46
  };
49
47
 
50
48
  const resolveTokenConfig = (input) => {
51
49
  const { token } = input;
52
50
  return Object.assign(input, {
53
- token: token ? normalizeTokenProvider(token) : tokenDefaultProvider.tokenDefaultProvider(input),
51
+ token: token ? normalizeTokenProvider(token) : tokenDefaultProvider(input),
54
52
  });
55
53
  };
56
54
 
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenDefaultProvider = void 0;
4
- const tokenDefaultProvider = (input) => async () => {
1
+ exports.tokenDefaultProvider = (input) => async () => {
5
2
  throw new Error("Token is missing");
6
3
  };
7
- exports.tokenDefaultProvider = tokenDefaultProvider;
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tokenDefaultProvider = void 0;
4
- const token_providers_1 = require("@aws-sdk/token-providers");
5
- exports.tokenDefaultProvider = token_providers_1.nodeProvider;
1
+ const { nodeProvider } = require("@aws-sdk/token-providers");
2
+ exports.tokenDefaultProvider = nodeProvider;
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-token",
3
- "version": "3.972.17",
3
+ "version": "3.972.19",
4
4
  "description": "Middleware and Plugin for setting token authentication",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
7
7
  "scripts": {
8
8
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
9
- "build:cjs": "node ../../scripts/compilation/inline middleware-token",
10
- "build:es": "tsc -p tsconfig.es.json",
9
+ "build:cjs": "node ../../scripts/compilation/inline",
10
+ "build:es": "premove dist-es && tsc -p tsconfig.es.json",
11
11
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
12
- "build:types": "tsc -p tsconfig.types.json",
12
+ "build:types": "premove dist-types && tsc -p tsconfig.types.json",
13
13
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
14
- "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
14
+ "clean": "premove dist-cjs dist-es dist-types",
15
15
  "test": "yarn g:vitest run && yarn test:browser",
16
16
  "test:watch": "yarn g:vitest watch",
17
- "test:browser": "yarn g:vitest run -c vitest.config.browser.mts",
18
- "test:browser:watch": "yarn g:vitest watch -c vitest.config.browser.mts",
19
17
  "test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
20
- "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
18
+ "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts",
19
+ "test:browser": "yarn g:vitest run -c vitest.config.browser.mts",
20
+ "test:browser:watch": "yarn g:vitest watch -c vitest.config.browser.mts"
21
21
  },
22
22
  "keywords": [
23
23
  "aws",
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "license": "Apache-2.0",
32
32
  "dependencies": {
33
- "@aws-sdk/token-providers": "3.1063.0",
34
- "@aws-sdk/types": "^3.973.11",
33
+ "@aws-sdk/token-providers": "3.1069.0",
34
+ "@aws-sdk/types": "^3.973.13",
35
35
  "@smithy/core": "^3.24.6",
36
36
  "@smithy/types": "^4.14.3",
37
37
  "tslib": "^2.6.2"