@aws-sdk/body-checksum-browser 3.972.17 → 3.972.19

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 CHANGED
@@ -1,22 +1,20 @@
1
- 'use strict';
2
-
3
- var sha256TreeHash = require('@aws-sdk/sha256-tree-hash');
4
- var checksum = require('@smithy/core/checksum');
5
- var serde = require('@smithy/core/serde');
1
+ const { TreeHash } = require("@aws-sdk/sha256-tree-hash");
2
+ const { blobReader } = require("@smithy/core/checksum");
3
+ const { toUint8Array, toHex } = require("@smithy/core/serde");
6
4
 
7
5
  const MiB = 1024 * 1024;
8
6
  async function bodyChecksumGenerator(request, options) {
9
7
  const contentHash = new options.sha256();
10
- const treeHash = new sha256TreeHash.TreeHash(options.sha256, options.utf8Decoder);
8
+ const treeHash = new TreeHash(options.sha256, options.utf8Decoder);
11
9
  const { body } = request;
12
10
  if (typeof body === "string") {
13
- contentHash.update(serde.toUint8Array(body));
11
+ contentHash.update(toUint8Array(body));
14
12
  treeHash.update(body);
15
13
  }
16
14
  else {
17
15
  if (Boolean(body) &&
18
16
  (Object.prototype.toString.call(body) === "[object Blob]" || body.constructor?.name === "Blob")) {
19
- await checksum.blobReader(body, (chunk) => {
17
+ await blobReader(body, (chunk) => {
20
18
  treeHash?.update(chunk);
21
19
  contentHash?.update(chunk);
22
20
  }, MiB);
@@ -25,7 +23,7 @@ async function bodyChecksumGenerator(request, options) {
25
23
  throw new Error(`Unable to calculate checksums for non-blob streams, received: ${body.constructor.name + ":" + Object.prototype.toString.call(body)}.`);
26
24
  }
27
25
  }
28
- return [serde.toHex(await contentHash.digest()), serde.toHex(await treeHash.digest())];
26
+ return [toHex(await contentHash.digest()), toHex(await treeHash.digest())];
29
27
  }
30
28
 
31
29
  exports.bodyChecksumGenerator = bodyChecksumGenerator;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@aws-sdk/body-checksum-browser",
3
- "version": "3.972.17",
3
+ "version": "3.972.19",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
- "build:cjs": "node ../../scripts/compilation/inline body-checksum-browser",
7
- "build:es": "tsc -p tsconfig.es.json",
6
+ "build:cjs": "node ../../scripts/compilation/inline",
7
+ "build:es": "premove dist-es && tsc -p tsconfig.es.json",
8
8
  "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
9
- "build:types": "tsc -p tsconfig.types.json",
9
+ "build:types": "premove dist-types && tsc -p tsconfig.types.json",
10
10
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11
- "clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
11
+ "clean": "premove dist-cjs dist-es dist-types",
12
12
  "test": "yarn g:vitest run",
13
13
  "test:watch": "yarn g:vitest watch"
14
14
  },
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@aws-sdk/sha256-tree-hash": "^3.972.15",
26
- "@aws-sdk/types": "^3.973.11",
25
+ "@aws-sdk/sha256-tree-hash": "^3.972.17",
26
+ "@aws-sdk/types": "^3.973.13",
27
27
  "@smithy/core": "^3.24.6",
28
28
  "@smithy/types": "^4.14.3",
29
29
  "tslib": "^2.6.2"