@aws-sdk/body-checksum-node 3.972.10 → 3.972.12
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 +7 -9
- package/dist-es/index.js +1 -3
- package/package.json +5 -8
package/dist-cjs/index.js
CHANGED
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkedStreamReaderNode = require('@aws-sdk/chunked-stream-reader-node');
|
|
4
4
|
var sha256TreeHash = require('@aws-sdk/sha256-tree-hash');
|
|
5
|
-
var
|
|
6
|
-
var utilHexEncoding = require('@smithy/util-hex-encoding');
|
|
7
|
-
var utilUtf8 = require('@smithy/util-utf8');
|
|
5
|
+
var serde = require('@smithy/core/serde');
|
|
8
6
|
var node_fs = require('node:fs');
|
|
9
7
|
|
|
10
8
|
async function bodyChecksumGenerator(request, options) {
|
|
11
9
|
const contentHash = new options.sha256();
|
|
12
10
|
const treeHash = new sha256TreeHash.TreeHash(options.sha256, options.utf8Decoder);
|
|
13
11
|
const { body } = request;
|
|
14
|
-
if (typeof body === "string" || ArrayBuffer.isView(body) ||
|
|
15
|
-
contentHash?.update(
|
|
16
|
-
treeHash?.update(
|
|
12
|
+
if (typeof body === "string" || ArrayBuffer.isView(body) || serde.isArrayBuffer(body)) {
|
|
13
|
+
contentHash?.update(serde.toUint8Array(body));
|
|
14
|
+
treeHash?.update(serde.toUint8Array(body));
|
|
17
15
|
}
|
|
18
16
|
else {
|
|
19
17
|
if (typeof body.path !== "string") {
|
|
@@ -24,11 +22,11 @@ async function bodyChecksumGenerator(request, options) {
|
|
|
24
22
|
end: body.end,
|
|
25
23
|
});
|
|
26
24
|
await chunkedStreamReaderNode.streamReader(bodyTee, (chunk) => {
|
|
27
|
-
contentHash?.update(
|
|
28
|
-
treeHash?.update(
|
|
25
|
+
contentHash?.update(serde.toUint8Array(chunk));
|
|
26
|
+
treeHash?.update(serde.toUint8Array(chunk));
|
|
29
27
|
});
|
|
30
28
|
}
|
|
31
|
-
return [
|
|
29
|
+
return [serde.toHex(await contentHash.digest()), serde.toHex(await treeHash.digest())];
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
exports.bodyChecksumGenerator = bodyChecksumGenerator;
|
package/dist-es/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { streamReader } from "@aws-sdk/chunked-stream-reader-node";
|
|
2
2
|
import { TreeHash } from "@aws-sdk/sha256-tree-hash";
|
|
3
|
-
import { isArrayBuffer } from "@smithy/
|
|
4
|
-
import { toHex } from "@smithy/util-hex-encoding";
|
|
5
|
-
import { toUint8Array } from "@smithy/util-utf8";
|
|
3
|
+
import { isArrayBuffer, toHex, toUint8Array } from "@smithy/core/serde";
|
|
6
4
|
import { createReadStream } from "node:fs";
|
|
7
5
|
export async function bodyChecksumGenerator(request, options) {
|
|
8
6
|
const contentHash = new options.sha256();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/body-checksum-node",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.12",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline body-checksum-node",
|
|
@@ -23,13 +23,10 @@
|
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@aws-sdk/chunked-stream-reader-node": "^3.972.5",
|
|
26
|
-
"@aws-sdk/sha256-tree-hash": "^3.972.
|
|
27
|
-
"@aws-sdk/types": "^3.973.
|
|
28
|
-
"@smithy/
|
|
29
|
-
"@smithy/
|
|
30
|
-
"@smithy/types": "^4.14.0",
|
|
31
|
-
"@smithy/util-hex-encoding": "^4.2.2",
|
|
32
|
-
"@smithy/util-utf8": "^4.2.2",
|
|
26
|
+
"@aws-sdk/sha256-tree-hash": "^3.972.12",
|
|
27
|
+
"@aws-sdk/types": "^3.973.8",
|
|
28
|
+
"@smithy/core": "^3.24.1",
|
|
29
|
+
"@smithy/types": "^4.14.1",
|
|
33
30
|
"tslib": "^2.6.2"
|
|
34
31
|
},
|
|
35
32
|
"devDependencies": {
|