@aws-sdk/middleware-flexible-checksums 3.956.0 → 3.964.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/dist-cjs/index.js CHANGED
@@ -5,6 +5,7 @@ var protocolHttp = require('@smithy/protocol-http');
5
5
  var utilStream = require('@smithy/util-stream');
6
6
  var isArrayBuffer = require('@smithy/is-array-buffer');
7
7
  var crc32c = require('@aws-crypto/crc32c');
8
+ var crc64Nvme = require('@aws-sdk/crc64-nvme');
8
9
  var getCrc32ChecksumAlgorithmFunction = require('./getCrc32ChecksumAlgorithmFunction');
9
10
  var utilUtf8 = require('@smithy/util-utf8');
10
11
  var utilMiddleware = require('@smithy/util-middleware');
@@ -66,10 +67,6 @@ const NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS = {
66
67
  default: DEFAULT_RESPONSE_CHECKSUM_VALIDATION,
67
68
  };
68
69
 
69
- const crc64NvmeCrtContainer = {
70
- CrtCrc64Nvme: null,
71
- };
72
-
73
70
  const CLIENT_SUPPORTED_ALGORITHMS = [
74
71
  exports.ChecksumAlgorithm.CRC32,
75
72
  exports.ChecksumAlgorithm.CRC32C,
@@ -135,14 +132,10 @@ const selectChecksumAlgorithmFunction = (checksumAlgorithm, config) => {
135
132
  case exports.ChecksumAlgorithm.CRC32C:
136
133
  return crc32c.AwsCrc32c;
137
134
  case exports.ChecksumAlgorithm.CRC64NVME:
138
- if (typeof crc64NvmeCrtContainer.CrtCrc64Nvme !== "function") {
139
- throw new Error(`Please check whether you have installed the "@aws-sdk/crc64-nvme-crt" package explicitly. \n` +
140
- `You must also register the package by calling [require("@aws-sdk/crc64-nvme-crt");] ` +
141
- `or an ESM equivalent such as [import "@aws-sdk/crc64-nvme-crt";]. \n` +
142
- "For more information please go to " +
143
- "https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");
135
+ if (typeof crc64Nvme.crc64NvmeCrtContainer.CrtCrc64Nvme !== "function") {
136
+ return crc64Nvme.Crc64Nvme;
144
137
  }
145
- return crc64NvmeCrtContainer.CrtCrc64Nvme;
138
+ return crc64Nvme.crc64NvmeCrtContainer.CrtCrc64Nvme;
146
139
  case exports.ChecksumAlgorithm.SHA1:
147
140
  return config.sha1;
148
141
  case exports.ChecksumAlgorithm.SHA256:
@@ -244,15 +237,31 @@ const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next, context
244
237
  };
245
238
  }
246
239
  }
247
- const result = await next({
248
- ...args,
249
- request: {
250
- ...request,
251
- headers: updatedHeaders,
252
- body: updatedBody,
253
- },
254
- });
255
- return result;
240
+ try {
241
+ const result = await next({
242
+ ...args,
243
+ request: {
244
+ ...request,
245
+ headers: updatedHeaders,
246
+ body: updatedBody,
247
+ },
248
+ });
249
+ return result;
250
+ }
251
+ catch (e) {
252
+ if (e instanceof Error && e.name === "InvalidChunkSizeError") {
253
+ try {
254
+ if (!e.message.endsWith(".")) {
255
+ e.message += ".";
256
+ }
257
+ e.message +=
258
+ " Set [requestStreamBufferSize=number e.g. 65_536] in client constructor to instruct AWS SDK to buffer your input stream.";
259
+ }
260
+ catch (ignored) {
261
+ }
262
+ }
263
+ throw e;
264
+ }
256
265
  };
257
266
 
258
267
  const flexibleChecksumsInputMiddlewareOptions = {
@@ -421,7 +430,6 @@ exports.NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS = NODE_REQUEST_CHECKSUM
421
430
  exports.NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS = NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS;
422
431
  exports.RequestChecksumCalculation = RequestChecksumCalculation;
423
432
  exports.ResponseChecksumValidation = ResponseChecksumValidation;
424
- exports.crc64NvmeCrtContainer = crc64NvmeCrtContainer;
425
433
  exports.flexibleChecksumsMiddleware = flexibleChecksumsMiddleware;
426
434
  exports.flexibleChecksumsMiddlewareOptions = flexibleChecksumsMiddlewareOptions;
427
435
  exports.getFlexibleChecksumsPlugin = getFlexibleChecksumsPlugin;
@@ -95,13 +95,29 @@ export const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next,
95
95
  };
96
96
  }
97
97
  }
98
- const result = await next({
99
- ...args,
100
- request: {
101
- ...request,
102
- headers: updatedHeaders,
103
- body: updatedBody,
104
- },
105
- });
106
- return result;
98
+ try {
99
+ const result = await next({
100
+ ...args,
101
+ request: {
102
+ ...request,
103
+ headers: updatedHeaders,
104
+ body: updatedBody,
105
+ },
106
+ });
107
+ return result;
108
+ }
109
+ catch (e) {
110
+ if (e instanceof Error && e.name === "InvalidChunkSizeError") {
111
+ try {
112
+ if (!e.message.endsWith(".")) {
113
+ e.message += ".";
114
+ }
115
+ e.message +=
116
+ " Set [requestStreamBufferSize=number e.g. 65_536] in client constructor to instruct AWS SDK to buffer your input stream.";
117
+ }
118
+ catch (ignored) {
119
+ }
120
+ }
121
+ throw e;
122
+ }
107
123
  };
package/dist-es/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  export * from "./NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS";
2
2
  export * from "./NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS";
3
3
  export * from "./constants";
4
- export * from "./crc64-nvme-crt-container";
5
4
  export * from "./flexibleChecksumsMiddleware";
6
5
  export * from "./getFlexibleChecksumsPlugin";
7
6
  export * from "./resolveFlexibleChecksumsConfig";
@@ -1,6 +1,6 @@
1
1
  import { AwsCrc32c } from "@aws-crypto/crc32c";
2
+ import { Crc64Nvme, crc64NvmeCrtContainer } from "@aws-sdk/crc64-nvme";
2
3
  import { ChecksumAlgorithm } from "./constants";
3
- import { crc64NvmeCrtContainer } from "./crc64-nvme-crt-container";
4
4
  import { getCrc32ChecksumAlgorithmFunction } from "./getCrc32ChecksumAlgorithmFunction";
5
5
  export const selectChecksumAlgorithmFunction = (checksumAlgorithm, config) => {
6
6
  switch (checksumAlgorithm) {
@@ -12,11 +12,7 @@ export const selectChecksumAlgorithmFunction = (checksumAlgorithm, config) => {
12
12
  return AwsCrc32c;
13
13
  case ChecksumAlgorithm.CRC64NVME:
14
14
  if (typeof crc64NvmeCrtContainer.CrtCrc64Nvme !== "function") {
15
- throw new Error(`Please check whether you have installed the "@aws-sdk/crc64-nvme-crt" package explicitly. \n` +
16
- `You must also register the package by calling [require("@aws-sdk/crc64-nvme-crt");] ` +
17
- `or an ESM equivalent such as [import "@aws-sdk/crc64-nvme-crt";]. \n` +
18
- "For more information please go to " +
19
- "https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt");
15
+ return Crc64Nvme;
20
16
  }
21
17
  return crc64NvmeCrtContainer.CrtCrc64Nvme;
22
18
  case ChecksumAlgorithm.SHA1:
@@ -1,7 +1,6 @@
1
1
  export * from "./NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS";
2
2
  export * from "./NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS";
3
3
  export * from "./constants";
4
- export * from "./crc64-nvme-crt-container";
5
4
  export * from "./flexibleChecksumsMiddleware";
6
5
  export * from "./getFlexibleChecksumsPlugin";
7
6
  export * from "./resolveFlexibleChecksumsConfig";
@@ -1,7 +1,6 @@
1
1
  export * from "./NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS";
2
2
  export * from "./NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS";
3
3
  export * from "./constants";
4
- export * from "./crc64-nvme-crt-container";
5
4
  export * from "./flexibleChecksumsMiddleware";
6
5
  export * from "./getFlexibleChecksumsPlugin";
7
6
  export * from "./resolveFlexibleChecksumsConfig";
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-flexible-checksums",
3
- "version": "3.956.0",
3
+ "version": "3.964.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-flexible-checksums",
7
7
  "build:es": "tsc -p tsconfig.es.json",
8
- "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
8
+ "build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
9
9
  "build:types": "tsc -p tsconfig.types.json",
10
10
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11
11
  "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
@@ -37,8 +37,9 @@
37
37
  "@aws-crypto/crc32": "5.2.0",
38
38
  "@aws-crypto/crc32c": "5.2.0",
39
39
  "@aws-crypto/util": "5.2.0",
40
- "@aws-sdk/core": "3.956.0",
41
- "@aws-sdk/types": "3.956.0",
40
+ "@aws-sdk/core": "3.964.0",
41
+ "@aws-sdk/crc64-nvme": "3.957.0",
42
+ "@aws-sdk/types": "3.957.0",
42
43
  "@smithy/is-array-buffer": "^4.2.0",
43
44
  "@smithy/node-config-provider": "^4.3.7",
44
45
  "@smithy/protocol-http": "^5.3.7",
@@ -1,3 +0,0 @@
1
- export const crc64NvmeCrtContainer = {
2
- CrtCrc64Nvme: null,
3
- };
@@ -1,13 +0,0 @@
1
- import { ChecksumConstructor } from "@smithy/types";
2
- /**
3
- * @internal
4
- *
5
- * \@aws-sdk/crc64-nvme-crt will install the constructor in this
6
- * container if it is installed.
7
- *
8
- * This avoids a runtime-require being interpreted statically by bundlers.
9
- *
10
- */
11
- export declare const crc64NvmeCrtContainer: {
12
- CrtCrc64Nvme: null | ChecksumConstructor;
13
- };
@@ -1,4 +0,0 @@
1
- import { ChecksumConstructor } from "@smithy/types";
2
- export declare const crc64NvmeCrtContainer: {
3
- CrtCrc64Nvme: null | ChecksumConstructor;
4
- };