@aws-sdk/body-checksum-browser 3.489.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 +55 -27
  2. package/package.json +9 -9
package/dist-cjs/index.js CHANGED
@@ -1,30 +1,58 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bodyChecksumGenerator = void 0;
4
- const sha256_tree_hash_1 = require("@aws-sdk/sha256-tree-hash");
5
- const chunked_blob_reader_1 = require("@smithy/chunked-blob-reader");
6
- const util_hex_encoding_1 = require("@smithy/util-hex-encoding");
7
- const util_utf8_1 = require("@smithy/util-utf8");
8
- const MiB = 1024 * 1024;
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_sha256_tree_hash = require("@aws-sdk/sha256-tree-hash");
27
+ var import_chunked_blob_reader = require("@smithy/chunked-blob-reader");
28
+ var import_util_hex_encoding = require("@smithy/util-hex-encoding");
29
+ var import_util_utf8 = require("@smithy/util-utf8");
30
+ var MiB = 1024 * 1024;
9
31
  async function bodyChecksumGenerator(request, options) {
10
- const contentHash = new options.sha256();
11
- const treeHash = new sha256_tree_hash_1.TreeHash(options.sha256, options.utf8Decoder);
12
- const { body } = request;
13
- if (typeof body === "string") {
14
- contentHash.update((0, util_utf8_1.toUint8Array)(body));
15
- treeHash.update(body);
32
+ const contentHash = new options.sha256();
33
+ const treeHash = new import_sha256_tree_hash.TreeHash(options.sha256, options.utf8Decoder);
34
+ const { body } = request;
35
+ if (typeof body === "string") {
36
+ contentHash.update((0, import_util_utf8.toUint8Array)(body));
37
+ treeHash.update(body);
38
+ } else {
39
+ if (Boolean(body) && Object.prototype.toString.call(body) === "[object Blob]") {
40
+ await (0, import_chunked_blob_reader.blobReader)(
41
+ body,
42
+ (chunk) => {
43
+ treeHash == null ? void 0 : treeHash.update(chunk);
44
+ contentHash == null ? void 0 : contentHash.update(chunk);
45
+ },
46
+ MiB
47
+ );
48
+ } else {
49
+ throw new Error("Unable to calculate checksums for non-blob streams.");
16
50
  }
17
- else {
18
- if (Boolean(body) && Object.prototype.toString.call(body) === "[object Blob]") {
19
- await (0, chunked_blob_reader_1.blobReader)(body, (chunk) => {
20
- treeHash === null || treeHash === void 0 ? void 0 : treeHash.update(chunk);
21
- contentHash === null || contentHash === void 0 ? void 0 : contentHash.update(chunk);
22
- }, MiB);
23
- }
24
- else {
25
- throw new Error("Unable to calculate checksums for non-blob streams.");
26
- }
27
- }
28
- return [(0, util_hex_encoding_1.toHex)(await contentHash.digest()), (0, util_hex_encoding_1.toHex)(await treeHash.digest())];
51
+ }
52
+ return [(0, import_util_hex_encoding.toHex)(await contentHash.digest()), (0, import_util_hex_encoding.toHex)(await treeHash.digest())];
29
53
  }
30
- exports.bodyChecksumGenerator = bodyChecksumGenerator;
54
+ __name(bodyChecksumGenerator, "bodyChecksumGenerator");
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ bodyChecksumGenerator
58
+ });
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@aws-sdk/body-checksum-browser",
3
- "version": "3.489.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 body-checksum-browser",
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,13 +20,13 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/sha256-tree-hash": "3.489.0",
24
- "@aws-sdk/types": "3.489.0",
25
- "@smithy/chunked-blob-reader": "^2.0.0",
26
- "@smithy/protocol-http": "^3.0.12",
27
- "@smithy/types": "^2.8.0",
28
- "@smithy/util-hex-encoding": "^2.0.0",
29
- "@smithy/util-utf8": "^2.0.2",
23
+ "@aws-sdk/sha256-tree-hash": "3.495.0",
24
+ "@aws-sdk/types": "3.495.0",
25
+ "@smithy/chunked-blob-reader": "^2.1.0",
26
+ "@smithy/protocol-http": "^3.1.0",
27
+ "@smithy/types": "^2.9.0",
28
+ "@smithy/util-hex-encoding": "^2.1.0",
29
+ "@smithy/util-utf8": "^2.1.0",
30
30
  "tslib": "^2.5.0"
31
31
  },
32
32
  "devDependencies": {