@aws-sdk/body-checksum-node 3.183.0 → 3.186.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 +39 -21
- package/package.json +8 -8
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.186.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.185.0...v3.186.0) (2022-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @aws-sdk/body-checksum-node
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @aws-sdk/body-checksum-node
|
package/dist-es/index.js
CHANGED
|
@@ -1,28 +1,46 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
1
2
|
import { streamReader } from "@aws-sdk/chunked-stream-reader-node";
|
|
2
3
|
import { isArrayBuffer } from "@aws-sdk/is-array-buffer";
|
|
3
4
|
import { TreeHash } from "@aws-sdk/sha256-tree-hash";
|
|
4
5
|
import { toHex } from "@aws-sdk/util-hex-encoding";
|
|
5
6
|
import { createReadStream } from "fs";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
export function bodyChecksumGenerator(request, options) {
|
|
8
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
9
|
+
var contentHash, treeHash, body, bodyTee, _a, _b, _c;
|
|
10
|
+
return __generator(this, function (_d) {
|
|
11
|
+
switch (_d.label) {
|
|
12
|
+
case 0:
|
|
13
|
+
contentHash = new options.sha256();
|
|
14
|
+
treeHash = new TreeHash(options.sha256, options.utf8Decoder);
|
|
15
|
+
body = request.body;
|
|
16
|
+
if (!(typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body))) return [3, 1];
|
|
17
|
+
contentHash === null || contentHash === void 0 ? void 0 : contentHash.update(body);
|
|
18
|
+
treeHash === null || treeHash === void 0 ? void 0 : treeHash.update(body);
|
|
19
|
+
return [3, 3];
|
|
20
|
+
case 1:
|
|
21
|
+
if (typeof body.path !== "string") {
|
|
22
|
+
throw new Error("Unable to calculate checksums for non-file streams.");
|
|
23
|
+
}
|
|
24
|
+
bodyTee = createReadStream(body.path, {
|
|
25
|
+
start: body.start,
|
|
26
|
+
end: body.end,
|
|
27
|
+
});
|
|
28
|
+
return [4, streamReader(bodyTee, function (chunk) {
|
|
29
|
+
contentHash === null || contentHash === void 0 ? void 0 : contentHash.update(chunk);
|
|
30
|
+
treeHash === null || treeHash === void 0 ? void 0 : treeHash.update(chunk);
|
|
31
|
+
})];
|
|
32
|
+
case 2:
|
|
33
|
+
_d.sent();
|
|
34
|
+
_d.label = 3;
|
|
35
|
+
case 3:
|
|
36
|
+
_a = toHex;
|
|
37
|
+
return [4, contentHash.digest()];
|
|
38
|
+
case 4:
|
|
39
|
+
_b = [_a.apply(void 0, [_d.sent()])];
|
|
40
|
+
_c = toHex;
|
|
41
|
+
return [4, treeHash.digest()];
|
|
42
|
+
case 5: return [2, _b.concat([_c.apply(void 0, [_d.sent()])])];
|
|
43
|
+
}
|
|
21
44
|
});
|
|
22
|
-
|
|
23
|
-
contentHash?.update(chunk);
|
|
24
|
-
treeHash?.update(chunk);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return [toHex(await contentHash.digest()), toHex(await treeHash.digest())];
|
|
45
|
+
});
|
|
28
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/body-checksum-node",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.186.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,17 +20,17 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aws-sdk/chunked-stream-reader-node": "3.
|
|
24
|
-
"@aws-sdk/is-array-buffer": "3.
|
|
25
|
-
"@aws-sdk/protocol-http": "3.
|
|
26
|
-
"@aws-sdk/sha256-tree-hash": "3.
|
|
27
|
-
"@aws-sdk/types": "3.
|
|
28
|
-
"@aws-sdk/util-hex-encoding": "3.
|
|
23
|
+
"@aws-sdk/chunked-stream-reader-node": "3.186.0",
|
|
24
|
+
"@aws-sdk/is-array-buffer": "3.186.0",
|
|
25
|
+
"@aws-sdk/protocol-http": "3.186.0",
|
|
26
|
+
"@aws-sdk/sha256-tree-hash": "3.186.0",
|
|
27
|
+
"@aws-sdk/types": "3.186.0",
|
|
28
|
+
"@aws-sdk/util-hex-encoding": "3.186.0",
|
|
29
29
|
"tslib": "^2.3.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@aws-crypto/sha256-js": "2.0.0",
|
|
33
|
-
"@aws-sdk/util-utf8-node": "3.
|
|
33
|
+
"@aws-sdk/util-utf8-node": "3.186.0",
|
|
34
34
|
"@tsconfig/recommended": "1.0.1",
|
|
35
35
|
"concurrently": "7.0.0",
|
|
36
36
|
"downlevel-dts": "0.10.1",
|