@aws-sdk/middleware-api-key 3.489.0 → 3.495.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.
@@ -1,11 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveApiKeyConfig = void 0;
4
- const util_middleware_1 = require("@smithy/util-middleware");
5
- const resolveApiKeyConfig = (input) => {
6
- return {
7
- ...input,
8
- apiKey: input.apiKey ? (0, util_middleware_1.normalizeProvider)(input.apiKey) : undefined,
9
- };
10
- };
11
- exports.resolveApiKeyConfig = resolveApiKeyConfig;
1
+ module.exports = require("./index.js");
@@ -1,37 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getApiKeyPlugin = exports.apiKeyMiddlewareOptions = exports.apiKeyMiddleware = void 0;
4
- const protocol_http_1 = require("@smithy/protocol-http");
5
- const apiKeyMiddleware = (pluginConfig, middlewareConfig) => (next, context) => async function (args) {
6
- if (!protocol_http_1.HttpRequest.isInstance(args.request) || context.currentAuthConfig)
7
- return next(args);
8
- const apiKey = pluginConfig.apiKey && (await pluginConfig.apiKey());
9
- if (!apiKey) {
10
- context.currentAuthConfig = undefined;
11
- return next(args);
12
- }
13
- context.currentAuthConfig = middlewareConfig;
14
- if (middlewareConfig.in === "header") {
15
- args.request.headers[middlewareConfig.name.toLowerCase()] = middlewareConfig.scheme
16
- ? `${middlewareConfig.scheme} ${apiKey}`
17
- : apiKey;
18
- }
19
- else if (middlewareConfig.in === "query") {
20
- args.request.query[middlewareConfig.name] = apiKey;
21
- }
22
- return next(args);
23
- };
24
- exports.apiKeyMiddleware = apiKeyMiddleware;
25
- exports.apiKeyMiddlewareOptions = {
26
- name: "apiKeyMiddleware",
27
- tags: ["APIKEY", "AUTH"],
28
- relation: "after",
29
- toMiddleware: "retryMiddleware",
30
- override: true,
31
- };
32
- const getApiKeyPlugin = (pluginConfig, middlewareConfig) => ({
33
- applyToStack: (clientStack) => {
34
- clientStack.addRelativeTo((0, exports.apiKeyMiddleware)(pluginConfig, middlewareConfig), exports.apiKeyMiddlewareOptions);
35
- },
36
- });
37
- exports.getApiKeyPlugin = getApiKeyPlugin;
1
+ module.exports = require("./index.js");
package/dist-cjs/index.js CHANGED
@@ -1,5 +1,75 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./apiKeyConfiguration"), exports);
5
- tslib_1.__exportStar(require("./apiKeyMiddleware"), exports);
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ apiKeyMiddleware: () => apiKeyMiddleware,
24
+ apiKeyMiddlewareOptions: () => apiKeyMiddlewareOptions,
25
+ getApiKeyPlugin: () => getApiKeyPlugin,
26
+ resolveApiKeyConfig: () => resolveApiKeyConfig
27
+ });
28
+ module.exports = __toCommonJS(src_exports);
29
+
30
+ // src/apiKeyConfiguration.ts
31
+ var import_util_middleware = require("@smithy/util-middleware");
32
+ var resolveApiKeyConfig = /* @__PURE__ */ __name((input) => {
33
+ return {
34
+ ...input,
35
+ apiKey: input.apiKey ? (0, import_util_middleware.normalizeProvider)(input.apiKey) : void 0
36
+ };
37
+ }, "resolveApiKeyConfig");
38
+
39
+ // src/apiKeyMiddleware.ts
40
+ var import_protocol_http = require("@smithy/protocol-http");
41
+ var apiKeyMiddleware = /* @__PURE__ */ __name((pluginConfig, middlewareConfig) => (next, context) => async function(args) {
42
+ if (!import_protocol_http.HttpRequest.isInstance(args.request) || context.currentAuthConfig)
43
+ return next(args);
44
+ const apiKey = pluginConfig.apiKey && await pluginConfig.apiKey();
45
+ if (!apiKey) {
46
+ context.currentAuthConfig = void 0;
47
+ return next(args);
48
+ }
49
+ context.currentAuthConfig = middlewareConfig;
50
+ if (middlewareConfig.in === "header") {
51
+ args.request.headers[middlewareConfig.name.toLowerCase()] = middlewareConfig.scheme ? `${middlewareConfig.scheme} ${apiKey}` : apiKey;
52
+ } else if (middlewareConfig.in === "query") {
53
+ args.request.query[middlewareConfig.name] = apiKey;
54
+ }
55
+ return next(args);
56
+ }, "apiKeyMiddleware");
57
+ var apiKeyMiddlewareOptions = {
58
+ name: "apiKeyMiddleware",
59
+ tags: ["APIKEY", "AUTH"],
60
+ relation: "after",
61
+ toMiddleware: "retryMiddleware",
62
+ override: true
63
+ };
64
+ var getApiKeyPlugin = /* @__PURE__ */ __name((pluginConfig, middlewareConfig) => ({
65
+ applyToStack: (clientStack) => {
66
+ clientStack.addRelativeTo(apiKeyMiddleware(pluginConfig, middlewareConfig), apiKeyMiddlewareOptions);
67
+ }
68
+ }), "getApiKeyPlugin");
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ apiKeyMiddleware,
72
+ apiKeyMiddlewareOptions,
73
+ getApiKeyPlugin,
74
+ resolveApiKeyConfig
75
+ });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-api-key",
3
- "version": "3.489.0",
3
+ "version": "3.495.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
- "build:cjs": "tsc -p tsconfig.cjs.json",
6
+ "build:cjs": "node ../../scripts/compilation/inline middleware-api-key",
7
7
  "build:es": "tsc -p tsconfig.es.json",
8
8
  "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
9
9
  "build:types": "tsc -p tsconfig.types.json",
@@ -20,10 +20,10 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/types": "3.489.0",
24
- "@smithy/protocol-http": "^3.0.12",
25
- "@smithy/types": "^2.8.0",
26
- "@smithy/util-middleware": "^2.0.9",
23
+ "@aws-sdk/types": "3.495.0",
24
+ "@smithy/protocol-http": "^3.1.0",
25
+ "@smithy/types": "^2.9.0",
26
+ "@smithy/util-middleware": "^2.1.0",
27
27
  "tslib": "^2.5.0"
28
28
  },
29
29
  "engines": {