@aws-sdk/middleware-ssec 3.485.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.
Files changed (2) hide show
  1. package/dist-cjs/index.js +74 -49
  2. package/package.json +4 -4
package/dist-cjs/index.js CHANGED
@@ -1,53 +1,78 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSsecPlugin = exports.ssecMiddlewareOptions = exports.ssecMiddleware = void 0;
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
+ getSsecPlugin: () => getSsecPlugin,
24
+ ssecMiddleware: () => ssecMiddleware,
25
+ ssecMiddlewareOptions: () => ssecMiddlewareOptions
26
+ });
27
+ module.exports = __toCommonJS(src_exports);
4
28
  function ssecMiddleware(options) {
5
- return (next) => async (args) => {
6
- let input = { ...args.input };
7
- const properties = [
8
- {
9
- target: "SSECustomerKey",
10
- hash: "SSECustomerKeyMD5",
11
- },
12
- {
13
- target: "CopySourceSSECustomerKey",
14
- hash: "CopySourceSSECustomerKeyMD5",
15
- },
16
- ];
17
- for (const prop of properties) {
18
- const value = input[prop.target];
19
- if (value) {
20
- const valueView = ArrayBuffer.isView(value)
21
- ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
22
- : typeof value === "string"
23
- ? options.utf8Decoder(value)
24
- : new Uint8Array(value);
25
- const encoded = options.base64Encoder(valueView);
26
- const hash = new options.md5();
27
- hash.update(valueView);
28
- input = {
29
- ...input,
30
- [prop.target]: encoded,
31
- [prop.hash]: options.base64Encoder(await hash.digest()),
32
- };
33
- }
34
- }
35
- return next({
36
- ...args,
37
- input,
38
- });
39
- };
29
+ return (next) => async (args) => {
30
+ let input = { ...args.input };
31
+ const properties = [
32
+ {
33
+ target: "SSECustomerKey",
34
+ hash: "SSECustomerKeyMD5"
35
+ },
36
+ {
37
+ target: "CopySourceSSECustomerKey",
38
+ hash: "CopySourceSSECustomerKeyMD5"
39
+ }
40
+ ];
41
+ for (const prop of properties) {
42
+ const value = input[prop.target];
43
+ if (value) {
44
+ const valueView = ArrayBuffer.isView(value) ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength) : typeof value === "string" ? options.utf8Decoder(value) : new Uint8Array(value);
45
+ const encoded = options.base64Encoder(valueView);
46
+ const hash = new options.md5();
47
+ hash.update(valueView);
48
+ input = {
49
+ ...input,
50
+ [prop.target]: encoded,
51
+ [prop.hash]: options.base64Encoder(await hash.digest())
52
+ };
53
+ }
54
+ }
55
+ return next({
56
+ ...args,
57
+ input
58
+ });
59
+ };
40
60
  }
41
- exports.ssecMiddleware = ssecMiddleware;
42
- exports.ssecMiddlewareOptions = {
43
- name: "ssecMiddleware",
44
- step: "initialize",
45
- tags: ["SSE"],
46
- override: true,
61
+ __name(ssecMiddleware, "ssecMiddleware");
62
+ var ssecMiddlewareOptions = {
63
+ name: "ssecMiddleware",
64
+ step: "initialize",
65
+ tags: ["SSE"],
66
+ override: true
47
67
  };
48
- const getSsecPlugin = (config) => ({
49
- applyToStack: (clientStack) => {
50
- clientStack.add(ssecMiddleware(config), exports.ssecMiddlewareOptions);
51
- },
68
+ var getSsecPlugin = /* @__PURE__ */ __name((config) => ({
69
+ applyToStack: (clientStack) => {
70
+ clientStack.add(ssecMiddleware(config), ssecMiddlewareOptions);
71
+ }
72
+ }), "getSsecPlugin");
73
+ // Annotate the CommonJS export names for ESM import in node:
74
+ 0 && (module.exports = {
75
+ getSsecPlugin,
76
+ ssecMiddleware,
77
+ ssecMiddlewareOptions
52
78
  });
53
- exports.getSsecPlugin = getSsecPlugin;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-ssec",
3
- "version": "3.485.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-ssec",
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",
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
- "@aws-sdk/types": "3.485.0",
25
- "@smithy/types": "^2.8.0",
24
+ "@aws-sdk/types": "3.495.0",
25
+ "@smithy/types": "^2.9.0",
26
26
  "tslib": "^2.5.0"
27
27
  },
28
28
  "engines": {