@aws-sdk/middleware-flexible-checksums
Advanced tools
Comparing version 3.460.0 to 3.461.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ChecksumLocation = exports.ChecksumAlgorithm = void 0; | ||
exports.S3_EXPRESS_DEFAULT_CHECKSUM_ALGORITHM = exports.DEFAULT_CHECKSUM_ALGORITHM = exports.ChecksumLocation = exports.ChecksumAlgorithm = void 0; | ||
var ChecksumAlgorithm; | ||
@@ -17,1 +17,3 @@ (function (ChecksumAlgorithm) { | ||
})(ChecksumLocation = exports.ChecksumLocation || (exports.ChecksumLocation = {})); | ||
exports.DEFAULT_CHECKSUM_ALGORITHM = ChecksumAlgorithm.MD5; | ||
exports.S3_EXPRESS_DEFAULT_CHECKSUM_ALGORITHM = ChecksumAlgorithm.CRC32; |
@@ -17,3 +17,3 @@ "use strict"; | ||
}; | ||
const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next) => async (args) => { | ||
const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next, context) => async (args) => { | ||
if (!protocol_http_1.HttpRequest.isInstance(args.request)) { | ||
@@ -29,3 +29,3 @@ return next(args); | ||
requestAlgorithmMember, | ||
}); | ||
}, !!context.isS3ExpressBucket); | ||
let updatedBody = requestBody; | ||
@@ -32,0 +32,0 @@ let updatedHeaders = headers; |
@@ -6,5 +6,6 @@ "use strict"; | ||
const types_1 = require("./types"); | ||
const getChecksumAlgorithmForRequest = (input, { requestChecksumRequired, requestAlgorithmMember }) => { | ||
const getChecksumAlgorithmForRequest = (input, { requestChecksumRequired, requestAlgorithmMember }, isS3Express) => { | ||
const defaultAlgorithm = isS3Express ? constants_1.S3_EXPRESS_DEFAULT_CHECKSUM_ALGORITHM : constants_1.DEFAULT_CHECKSUM_ALGORITHM; | ||
if (!requestAlgorithmMember || !input[requestAlgorithmMember]) { | ||
return requestChecksumRequired ? constants_1.ChecksumAlgorithm.MD5 : undefined; | ||
return requestChecksumRequired ? defaultAlgorithm : undefined; | ||
} | ||
@@ -11,0 +12,0 @@ const checksumAlgorithm = input[requestAlgorithmMember]; |
@@ -14,1 +14,3 @@ export var ChecksumAlgorithm; | ||
})(ChecksumLocation || (ChecksumLocation = {})); | ||
export const DEFAULT_CHECKSUM_ALGORITHM = ChecksumAlgorithm.MD5; | ||
export const S3_EXPRESS_DEFAULT_CHECKSUM_ALGORITHM = ChecksumAlgorithm.CRC32; |
@@ -14,3 +14,3 @@ import { HttpRequest } from "@smithy/protocol-http"; | ||
}; | ||
export const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next) => async (args) => { | ||
export const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next, context) => async (args) => { | ||
if (!HttpRequest.isInstance(args.request)) { | ||
@@ -26,3 +26,3 @@ return next(args); | ||
requestAlgorithmMember, | ||
}); | ||
}, !!context.isS3ExpressBucket); | ||
let updatedBody = requestBody; | ||
@@ -29,0 +29,0 @@ let updatedHeaders = headers; |
@@ -1,6 +0,7 @@ | ||
import { ChecksumAlgorithm } from "./constants"; | ||
import { DEFAULT_CHECKSUM_ALGORITHM, S3_EXPRESS_DEFAULT_CHECKSUM_ALGORITHM } from "./constants"; | ||
import { CLIENT_SUPPORTED_ALGORITHMS } from "./types"; | ||
export const getChecksumAlgorithmForRequest = (input, { requestChecksumRequired, requestAlgorithmMember }) => { | ||
export const getChecksumAlgorithmForRequest = (input, { requestChecksumRequired, requestAlgorithmMember }, isS3Express) => { | ||
const defaultAlgorithm = isS3Express ? S3_EXPRESS_DEFAULT_CHECKSUM_ALGORITHM : DEFAULT_CHECKSUM_ALGORITHM; | ||
if (!requestAlgorithmMember || !input[requestAlgorithmMember]) { | ||
return requestChecksumRequired ? ChecksumAlgorithm.MD5 : undefined; | ||
return requestChecksumRequired ? defaultAlgorithm : undefined; | ||
} | ||
@@ -7,0 +8,0 @@ const checksumAlgorithm = input[requestAlgorithmMember]; |
@@ -18,1 +18,9 @@ /** | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
export declare const DEFAULT_CHECKSUM_ALGORITHM = ChecksumAlgorithm.MD5; | ||
/** | ||
* @internal | ||
*/ | ||
export declare const S3_EXPRESS_DEFAULT_CHECKSUM_ALGORITHM = ChecksumAlgorithm.CRC32; |
@@ -17,2 +17,2 @@ import { ChecksumAlgorithm } from "./constants"; | ||
*/ | ||
export declare const getChecksumAlgorithmForRequest: (input: any, { requestChecksumRequired, requestAlgorithmMember }: GetChecksumAlgorithmForRequestOptions) => ChecksumAlgorithm | undefined; | ||
export declare const getChecksumAlgorithmForRequest: (input: any, { requestChecksumRequired, requestAlgorithmMember }: GetChecksumAlgorithmForRequestOptions, isS3Express?: boolean) => ChecksumAlgorithm | undefined; |
@@ -12,1 +12,4 @@ export declare enum ChecksumAlgorithm { | ||
} | ||
export declare const DEFAULT_CHECKSUM_ALGORITHM = ChecksumAlgorithm.MD5; | ||
export declare const S3_EXPRESS_DEFAULT_CHECKSUM_ALGORITHM = | ||
ChecksumAlgorithm.CRC32; |
@@ -11,3 +11,4 @@ import { ChecksumAlgorithm } from "./constants"; | ||
requestAlgorithmMember, | ||
}: GetChecksumAlgorithmForRequestOptions | ||
}: GetChecksumAlgorithmForRequestOptions, | ||
isS3Express?: boolean | ||
) => ChecksumAlgorithm | undefined; |
{ | ||
"name": "@aws-sdk/middleware-flexible-checksums", | ||
"version": "3.460.0", | ||
"version": "3.461.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57060
950