@aws-sdk/middleware-flexible-checksums 3.974.16 → 3.974.17
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 +11 -13
- package/dist-es/flexibleChecksumsMiddleware.js +2 -2
- package/dist-es/flexibleChecksumsResponseMiddleware.js +1 -1
- package/dist-es/isStreaming.js +1 -1
- package/dist-es/resolveFlexibleChecksumsConfig.js +1 -1
- package/dist-es/stringHasher.js +1 -1
- package/dist-es/validateChecksumFromResponse.js +1 -1
- package/dist-types/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS.d.ts +1 -1
- package/dist-types/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS.d.ts +1 -1
- package/dist-types/ts3.4/NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS.d.ts +1 -1
- package/dist-types/ts3.4/NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS.d.ts +1 -1
- package/dist-types/ts3.4/validateChecksumFromResponse.d.ts +1 -1
- package/dist-types/validateChecksumFromResponse.d.ts +1 -1
- package/package.json +5 -10
package/dist-cjs/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var client = require('@aws-sdk/core/client');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var isArrayBuffer = require('@smithy/is-array-buffer');
|
|
4
|
+
var protocols = require('@smithy/core/protocols');
|
|
5
|
+
var serde = require('@smithy/core/serde');
|
|
7
6
|
var crc32c = require('@aws-crypto/crc32c');
|
|
8
7
|
var crc64Nvme = require('@aws-sdk/crc64-nvme');
|
|
9
8
|
var getCrc32ChecksumAlgorithmFunction = require('./getCrc32ChecksumAlgorithmFunction');
|
|
10
|
-
var
|
|
11
|
-
var utilMiddleware = require('@smithy/util-middleware');
|
|
9
|
+
var client$1 = require('@smithy/core/client');
|
|
12
10
|
|
|
13
11
|
const RequestChecksumCalculation = {
|
|
14
12
|
WHEN_SUPPORTED: "WHEN_SUPPORTED",
|
|
@@ -102,7 +100,7 @@ const hasHeaderWithPrefix = (headerPrefix, headers) => {
|
|
|
102
100
|
return false;
|
|
103
101
|
};
|
|
104
102
|
|
|
105
|
-
const isStreaming = (body) => body !== undefined && typeof body !== "string" && !ArrayBuffer.isView(body) && !
|
|
103
|
+
const isStreaming = (body) => body !== undefined && typeof body !== "string" && !ArrayBuffer.isView(body) && !serde.isArrayBuffer(body);
|
|
106
104
|
|
|
107
105
|
const CLIENT_SUPPORTED_ALGORITHMS = [
|
|
108
106
|
exports.ChecksumAlgorithm.CRC32,
|
|
@@ -149,7 +147,7 @@ const selectChecksumAlgorithmFunction = (checksumAlgorithm, config) => {
|
|
|
149
147
|
|
|
150
148
|
const stringHasher = (checksumAlgorithmFn, body) => {
|
|
151
149
|
const hash = new checksumAlgorithmFn();
|
|
152
|
-
hash.update(
|
|
150
|
+
hash.update(serde.toUint8Array(body || ""));
|
|
153
151
|
return hash.digest();
|
|
154
152
|
};
|
|
155
153
|
|
|
@@ -160,7 +158,7 @@ const flexibleChecksumsMiddlewareOptions = {
|
|
|
160
158
|
override: true,
|
|
161
159
|
};
|
|
162
160
|
const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next, context) => async (args) => {
|
|
163
|
-
if (!
|
|
161
|
+
if (!protocols.HttpRequest.isInstance(args.request)) {
|
|
164
162
|
return next(args);
|
|
165
163
|
}
|
|
166
164
|
if (hasHeaderWithPrefix("x-amz-checksum-", args.request.headers)) {
|
|
@@ -211,7 +209,7 @@ const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next, context
|
|
|
211
209
|
if (isStreaming(requestBody)) {
|
|
212
210
|
const { getAwsChunkedEncodingStream, bodyLengthChecker } = config;
|
|
213
211
|
updatedBody = getAwsChunkedEncodingStream(typeof config.requestStreamBufferSize === "number" && config.requestStreamBufferSize >= 8 * 1024
|
|
214
|
-
?
|
|
212
|
+
? serde.createBufferedReadable(requestBody, config.requestStreamBufferSize, context.logger)
|
|
215
213
|
: requestBody, {
|
|
216
214
|
base64Encoder,
|
|
217
215
|
bodyLengthChecker,
|
|
@@ -353,7 +351,7 @@ const validateChecksumFromResponse = async (response, { config, responseAlgorith
|
|
|
353
351
|
}
|
|
354
352
|
const { base64Encoder } = config;
|
|
355
353
|
if (isStreaming(responseBody)) {
|
|
356
|
-
response.body =
|
|
354
|
+
response.body = serde.createChecksumStream({
|
|
357
355
|
expectedChecksum: checksumFromResponse,
|
|
358
356
|
checksumSourceLocation: responseHeader,
|
|
359
357
|
checksum: new checksumAlgorithmFn(),
|
|
@@ -380,7 +378,7 @@ const flexibleChecksumsResponseMiddlewareOptions = {
|
|
|
380
378
|
override: true,
|
|
381
379
|
};
|
|
382
380
|
const flexibleChecksumsResponseMiddleware = (config, middlewareConfig) => (next, context) => async (args) => {
|
|
383
|
-
if (!
|
|
381
|
+
if (!protocols.HttpRequest.isInstance(args.request)) {
|
|
384
382
|
return next(args);
|
|
385
383
|
}
|
|
386
384
|
const input = args.input;
|
|
@@ -427,8 +425,8 @@ const getFlexibleChecksumsPlugin = (config, middlewareConfig) => ({
|
|
|
427
425
|
const resolveFlexibleChecksumsConfig = (input) => {
|
|
428
426
|
const { requestChecksumCalculation, responseChecksumValidation, requestStreamBufferSize } = input;
|
|
429
427
|
return Object.assign(input, {
|
|
430
|
-
requestChecksumCalculation:
|
|
431
|
-
responseChecksumValidation:
|
|
428
|
+
requestChecksumCalculation: client$1.normalizeProvider(requestChecksumCalculation ?? DEFAULT_REQUEST_CHECKSUM_CALCULATION),
|
|
429
|
+
responseChecksumValidation: client$1.normalizeProvider(responseChecksumValidation ?? DEFAULT_RESPONSE_CHECKSUM_VALIDATION),
|
|
432
430
|
requestStreamBufferSize: Number(requestStreamBufferSize ?? 0),
|
|
433
431
|
checksumAlgorithms: input.checksumAlgorithms ?? {},
|
|
434
432
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setFeature } from "@aws-sdk/core/client";
|
|
2
|
-
import { HttpRequest } from "@smithy/
|
|
3
|
-
import { createBufferedReadable } from "@smithy/
|
|
2
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
3
|
+
import { createBufferedReadable } from "@smithy/core/serde";
|
|
4
4
|
import { ChecksumAlgorithm, DEFAULT_CHECKSUM_ALGORITHM, RequestChecksumCalculation } from "./constants";
|
|
5
5
|
import { getChecksumAlgorithmForRequest } from "./getChecksumAlgorithmForRequest";
|
|
6
6
|
import { getChecksumLocationName } from "./getChecksumLocationName";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpRequest } from "@smithy/
|
|
1
|
+
import { HttpRequest } from "@smithy/core/protocols";
|
|
2
2
|
import { getChecksumAlgorithmListForResponse } from "./getChecksumAlgorithmListForResponse";
|
|
3
3
|
import { getChecksumLocationName } from "./getChecksumLocationName";
|
|
4
4
|
import { isChecksumWithPartNumber } from "./isChecksumWithPartNumber";
|
package/dist-es/isStreaming.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { isArrayBuffer } from "@smithy/
|
|
1
|
+
import { isArrayBuffer } from "@smithy/core/serde";
|
|
2
2
|
export const isStreaming = (body) => body !== undefined && typeof body !== "string" && !ArrayBuffer.isView(body) && !isArrayBuffer(body);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeProvider } from "@smithy/
|
|
1
|
+
import { normalizeProvider } from "@smithy/core/client";
|
|
2
2
|
import { DEFAULT_REQUEST_CHECKSUM_CALCULATION, DEFAULT_RESPONSE_CHECKSUM_VALIDATION } from "./constants";
|
|
3
3
|
export const resolveFlexibleChecksumsConfig = (input) => {
|
|
4
4
|
const { requestChecksumCalculation, responseChecksumValidation, requestStreamBufferSize } = input;
|
package/dist-es/stringHasher.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createChecksumStream } from "@smithy/
|
|
1
|
+
import { createChecksumStream } from "@smithy/core/serde";
|
|
2
2
|
import { ChecksumAlgorithm } from "./constants";
|
|
3
3
|
import { getChecksum } from "./getChecksum";
|
|
4
4
|
import { getChecksumAlgorithmListForResponse } from "./getChecksumAlgorithmListForResponse";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoadedConfigSelectors } from "@smithy/
|
|
1
|
+
import { LoadedConfigSelectors } from "@smithy/core/config";
|
|
2
2
|
import { RequestChecksumCalculation } from "./constants";
|
|
3
3
|
export declare const ENV_REQUEST_CHECKSUM_CALCULATION =
|
|
4
4
|
"AWS_REQUEST_CHECKSUM_CALCULATION";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoadedConfigSelectors } from "@smithy/
|
|
1
|
+
import { LoadedConfigSelectors } from "@smithy/core/config";
|
|
2
2
|
import { ResponseChecksumValidation } from "./constants";
|
|
3
3
|
export declare const ENV_RESPONSE_CHECKSUM_VALIDATION =
|
|
4
4
|
"AWS_RESPONSE_CHECKSUM_VALIDATION";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { HttpResponse } from "@smithy/
|
|
1
|
+
import type { HttpResponse } from "@smithy/core/protocols";
|
|
2
2
|
import type { Logger } from "@smithy/types";
|
|
3
3
|
import type { PreviouslyResolved } from "./configuration";
|
|
4
4
|
export interface ValidateChecksumFromResponseOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-flexible-checksums",
|
|
3
|
-
"version": "3.974.
|
|
3
|
+
"version": "3.974.17",
|
|
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",
|
|
@@ -37,20 +37,15 @@
|
|
|
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.974.
|
|
41
|
-
"@aws-sdk/crc64-nvme": "^3.972.
|
|
40
|
+
"@aws-sdk/core": "^3.974.9",
|
|
41
|
+
"@aws-sdk/crc64-nvme": "^3.972.8",
|
|
42
42
|
"@aws-sdk/types": "^3.973.8",
|
|
43
|
-
"@smithy/
|
|
44
|
-
"@smithy/node-config-provider": "^4.3.14",
|
|
45
|
-
"@smithy/protocol-http": "^5.3.14",
|
|
43
|
+
"@smithy/core": "^3.24.1",
|
|
46
44
|
"@smithy/types": "^4.14.1",
|
|
47
|
-
"@smithy/util-middleware": "^4.2.14",
|
|
48
|
-
"@smithy/util-stream": "^4.5.25",
|
|
49
|
-
"@smithy/util-utf8": "^4.2.2",
|
|
50
45
|
"tslib": "^2.6.2"
|
|
51
46
|
},
|
|
52
47
|
"devDependencies": {
|
|
53
|
-
"@smithy/node-http-handler": "^4.
|
|
48
|
+
"@smithy/node-http-handler": "^4.7.1",
|
|
54
49
|
"concurrently": "7.0.0",
|
|
55
50
|
"downlevel-dts": "0.10.1",
|
|
56
51
|
"premove": "4.0.0",
|