@aws-sdk/body-checksum-node 3.489.0 → 3.496.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 +57 -30
  2. package/package.json +10 -10
package/dist-cjs/index.js CHANGED
@@ -1,33 +1,60 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bodyChecksumGenerator = void 0;
4
- const chunked_stream_reader_node_1 = require("@aws-sdk/chunked-stream-reader-node");
5
- const sha256_tree_hash_1 = require("@aws-sdk/sha256-tree-hash");
6
- const is_array_buffer_1 = require("@smithy/is-array-buffer");
7
- const util_hex_encoding_1 = require("@smithy/util-hex-encoding");
8
- const util_utf8_1 = require("@smithy/util-utf8");
9
- const fs_1 = require("fs");
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
+ bodyChecksumGenerator: () => bodyChecksumGenerator
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+ var import_chunked_stream_reader_node = require("@aws-sdk/chunked-stream-reader-node");
27
+ var import_sha256_tree_hash = require("@aws-sdk/sha256-tree-hash");
28
+ var import_is_array_buffer = require("@smithy/is-array-buffer");
29
+ var import_util_hex_encoding = require("@smithy/util-hex-encoding");
30
+ var import_util_utf8 = require("@smithy/util-utf8");
31
+ var import_fs = require("fs");
10
32
  async function bodyChecksumGenerator(request, options) {
11
- const contentHash = new options.sha256();
12
- const treeHash = new sha256_tree_hash_1.TreeHash(options.sha256, options.utf8Decoder);
13
- const { body } = request;
14
- if (typeof body === "string" || ArrayBuffer.isView(body) || (0, is_array_buffer_1.isArrayBuffer)(body)) {
15
- contentHash === null || contentHash === void 0 ? void 0 : contentHash.update((0, util_utf8_1.toUint8Array)(body));
16
- treeHash === null || treeHash === void 0 ? void 0 : treeHash.update((0, util_utf8_1.toUint8Array)(body));
33
+ const contentHash = new options.sha256();
34
+ const treeHash = new import_sha256_tree_hash.TreeHash(options.sha256, options.utf8Decoder);
35
+ const { body } = request;
36
+ if (typeof body === "string" || ArrayBuffer.isView(body) || (0, import_is_array_buffer.isArrayBuffer)(body)) {
37
+ contentHash == null ? void 0 : contentHash.update((0, import_util_utf8.toUint8Array)(body));
38
+ treeHash == null ? void 0 : treeHash.update((0, import_util_utf8.toUint8Array)(body));
39
+ } else {
40
+ if (typeof body.path !== "string") {
41
+ throw new Error("Unable to calculate checksums for non-file streams.");
17
42
  }
18
- else {
19
- if (typeof body.path !== "string") {
20
- throw new Error("Unable to calculate checksums for non-file streams.");
21
- }
22
- const bodyTee = (0, fs_1.createReadStream)(body.path, {
23
- start: body.start,
24
- end: body.end,
25
- });
26
- await (0, chunked_stream_reader_node_1.streamReader)(bodyTee, (chunk) => {
27
- contentHash === null || contentHash === void 0 ? void 0 : contentHash.update((0, util_utf8_1.toUint8Array)(chunk));
28
- treeHash === null || treeHash === void 0 ? void 0 : treeHash.update((0, util_utf8_1.toUint8Array)(chunk));
29
- });
30
- }
31
- return [(0, util_hex_encoding_1.toHex)(await contentHash.digest()), (0, util_hex_encoding_1.toHex)(await treeHash.digest())];
43
+ const bodyTee = (0, import_fs.createReadStream)(body.path, {
44
+ start: body.start,
45
+ end: body.end
46
+ });
47
+ await (0, import_chunked_stream_reader_node.streamReader)(bodyTee, (chunk) => {
48
+ contentHash == null ? void 0 : contentHash.update((0, import_util_utf8.toUint8Array)(chunk));
49
+ treeHash == null ? void 0 : treeHash.update((0, import_util_utf8.toUint8Array)(chunk));
50
+ });
51
+ }
52
+ return [(0, import_util_hex_encoding.toHex)(await contentHash.digest()), (0, import_util_hex_encoding.toHex)(await treeHash.digest())];
32
53
  }
33
- exports.bodyChecksumGenerator = bodyChecksumGenerator;
54
+ __name(bodyChecksumGenerator, "bodyChecksumGenerator");
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+
57
+ 0 && (module.exports = {
58
+ bodyChecksumGenerator
59
+ });
60
+
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aws-sdk/body-checksum-node",
3
- "version": "3.489.0",
3
+ "version": "3.496.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 body-checksum-node",
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,14 +20,14 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/chunked-stream-reader-node": "3.465.0",
24
- "@aws-sdk/sha256-tree-hash": "3.489.0",
25
- "@aws-sdk/types": "3.489.0",
26
- "@smithy/is-array-buffer": "^2.0.0",
27
- "@smithy/protocol-http": "^3.0.12",
28
- "@smithy/types": "^2.8.0",
29
- "@smithy/util-hex-encoding": "^2.0.0",
30
- "@smithy/util-utf8": "^2.0.2",
23
+ "@aws-sdk/chunked-stream-reader-node": "3.495.0",
24
+ "@aws-sdk/sha256-tree-hash": "3.496.0",
25
+ "@aws-sdk/types": "3.496.0",
26
+ "@smithy/is-array-buffer": "^2.1.1",
27
+ "@smithy/protocol-http": "^3.1.1",
28
+ "@smithy/types": "^2.9.1",
29
+ "@smithy/util-hex-encoding": "^2.1.1",
30
+ "@smithy/util-utf8": "^2.1.1",
31
31
  "tslib": "^2.5.0"
32
32
  },
33
33
  "devDependencies": {