@aws-sdk/middleware-ssec 3.186.0 → 3.188.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/CHANGELOG.md +8 -0
- package/dist-es/index.js +38 -68
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.188.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.187.0...v3.188.0) (2022-10-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/middleware-ssec
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [3.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @aws-sdk/middleware-ssec
|
package/dist-es/index.js
CHANGED
|
@@ -1,78 +1,48 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __values } from "tslib";
|
|
2
1
|
export function ssecMiddleware(options) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
encoded = options.base64Encoder(valueView);
|
|
38
|
-
hash = new options.md5();
|
|
39
|
-
hash.update(valueView);
|
|
40
|
-
_a = [__assign({}, input)];
|
|
41
|
-
_f = {}, _f[prop.target] = encoded;
|
|
42
|
-
_b = prop.hash;
|
|
43
|
-
_d = (_c = options).base64Encoder;
|
|
44
|
-
return [4, hash.digest()];
|
|
45
|
-
case 3:
|
|
46
|
-
input = __assign.apply(void 0, _a.concat([(_f[_b] = _d.apply(_c, [_g.sent()]), _f)]));
|
|
47
|
-
_g.label = 4;
|
|
48
|
-
case 4:
|
|
49
|
-
properties_1_1 = properties_1.next();
|
|
50
|
-
return [3, 2];
|
|
51
|
-
case 5: return [3, 8];
|
|
52
|
-
case 6:
|
|
53
|
-
e_1_1 = _g.sent();
|
|
54
|
-
e_1 = { error: e_1_1 };
|
|
55
|
-
return [3, 8];
|
|
56
|
-
case 7:
|
|
57
|
-
try {
|
|
58
|
-
if (properties_1_1 && !properties_1_1.done && (_e = properties_1.return)) _e.call(properties_1);
|
|
59
|
-
}
|
|
60
|
-
finally { if (e_1) throw e_1.error; }
|
|
61
|
-
return [7];
|
|
62
|
-
case 8: return [2, next(__assign(__assign({}, args), { input: input }))];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}); };
|
|
2
|
+
return (next) => async (args) => {
|
|
3
|
+
let input = { ...args.input };
|
|
4
|
+
const properties = [
|
|
5
|
+
{
|
|
6
|
+
target: "SSECustomerKey",
|
|
7
|
+
hash: "SSECustomerKeyMD5",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
target: "CopySourceSSECustomerKey",
|
|
11
|
+
hash: "CopySourceSSECustomerKeyMD5",
|
|
12
|
+
},
|
|
13
|
+
];
|
|
14
|
+
for (const prop of properties) {
|
|
15
|
+
const value = input[prop.target];
|
|
16
|
+
if (value) {
|
|
17
|
+
const valueView = ArrayBuffer.isView(value)
|
|
18
|
+
? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
|
|
19
|
+
: typeof value === "string"
|
|
20
|
+
? options.utf8Decoder(value)
|
|
21
|
+
: new Uint8Array(value);
|
|
22
|
+
const encoded = options.base64Encoder(valueView);
|
|
23
|
+
const hash = new options.md5();
|
|
24
|
+
hash.update(valueView);
|
|
25
|
+
input = {
|
|
26
|
+
...input,
|
|
27
|
+
[prop.target]: encoded,
|
|
28
|
+
[prop.hash]: options.base64Encoder(await hash.digest()),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return next({
|
|
33
|
+
...args,
|
|
34
|
+
input,
|
|
35
|
+
});
|
|
66
36
|
};
|
|
67
37
|
}
|
|
68
|
-
export
|
|
38
|
+
export const ssecMiddlewareOptions = {
|
|
69
39
|
name: "ssecMiddleware",
|
|
70
40
|
step: "initialize",
|
|
71
41
|
tags: ["SSE"],
|
|
72
42
|
override: true,
|
|
73
43
|
};
|
|
74
|
-
export
|
|
75
|
-
applyToStack:
|
|
44
|
+
export const getSsecPlugin = (config) => ({
|
|
45
|
+
applyToStack: (clientStack) => {
|
|
76
46
|
clientStack.add(ssecMiddleware(config), ssecMiddlewareOptions);
|
|
77
47
|
},
|
|
78
|
-
});
|
|
48
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-ssec",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.188.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/types": "3.
|
|
23
|
+
"@aws-sdk/types": "3.188.0",
|
|
24
24
|
"tslib": "^2.3.1"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|