@aws-sdk/middleware-flexible-checksums 3.53.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/CHANGELOG.md +12 -0
- package/LICENSE +201 -0
- package/README.md +7 -0
- package/dist-cjs/configuration.js +2 -0
- package/dist-cjs/constants.js +16 -0
- package/dist-cjs/flexibleChecksumsMiddleware.js +73 -0
- package/dist-cjs/getChecksum.js +10 -0
- package/dist-cjs/getChecksumAlgorithmForRequest.js +17 -0
- package/dist-cjs/getChecksumAlgorithmListForResponse.js +15 -0
- package/dist-cjs/getChecksumLocationName.js +6 -0
- package/dist-cjs/getFlexibleChecksumsPlugin.js +16 -0
- package/dist-cjs/hasHeader.js +13 -0
- package/dist-cjs/index.js +6 -0
- package/dist-cjs/isStreaming.js +6 -0
- package/dist-cjs/selectChecksumAlgorithmFunction.js +14 -0
- package/dist-cjs/stringHasher.js +9 -0
- package/dist-cjs/types.js +16 -0
- package/dist-cjs/validateChecksumFromResponse.js +26 -0
- package/dist-es/configuration.js +1 -0
- package/dist-es/constants.js +13 -0
- package/dist-es/flexibleChecksumsMiddleware.js +68 -0
- package/dist-es/getChecksum.js +18 -0
- package/dist-es/getChecksumAlgorithmForRequest.js +14 -0
- package/dist-es/getChecksumAlgorithmListForResponse.js +24 -0
- package/dist-es/getChecksumLocationName.js +4 -0
- package/dist-es/getFlexibleChecksumsPlugin.js +12 -0
- package/dist-es/hasHeader.js +21 -0
- package/dist-es/index.js +3 -0
- package/dist-es/isStreaming.js +4 -0
- package/dist-es/selectChecksumAlgorithmFunction.js +13 -0
- package/dist-es/stringHasher.js +5 -0
- package/dist-es/types.js +13 -0
- package/dist-es/validateChecksumFromResponse.js +55 -0
- package/dist-types/configuration.d.ts +36 -0
- package/dist-types/constants.d.ts +17 -0
- package/dist-types/flexibleChecksumsMiddleware.d.ts +4 -0
- package/dist-types/getChecksum.d.ts +7 -0
- package/dist-types/getChecksumAlgorithmForRequest.d.ts +17 -0
- package/dist-types/getChecksumAlgorithmListForResponse.d.ts +6 -0
- package/dist-types/getChecksumLocationName.d.ts +5 -0
- package/dist-types/getFlexibleChecksumsPlugin.d.ts +28 -0
- package/dist-types/hasHeader.d.ts +6 -0
- package/dist-types/index.d.ts +3 -0
- package/dist-types/isStreaming.d.ts +4 -0
- package/dist-types/selectChecksumAlgorithmFunction.d.ts +7 -0
- package/dist-types/stringHasher.d.ts +5 -0
- package/dist-types/ts3.4/configuration.d.ts +17 -0
- package/dist-types/ts3.4/constants.d.ts +13 -0
- package/dist-types/ts3.4/flexibleChecksumsMiddleware.d.ts +4 -0
- package/dist-types/ts3.4/getChecksum.d.ts +7 -0
- package/dist-types/ts3.4/getChecksumAlgorithmForRequest.d.ts +9 -0
- package/dist-types/ts3.4/getChecksumAlgorithmListForResponse.d.ts +3 -0
- package/dist-types/ts3.4/getChecksumLocationName.d.ts +3 -0
- package/dist-types/ts3.4/getFlexibleChecksumsPlugin.d.ts +16 -0
- package/dist-types/ts3.4/hasHeader.d.ts +3 -0
- package/dist-types/ts3.4/index.d.ts +3 -0
- package/dist-types/ts3.4/isStreaming.d.ts +2 -0
- package/dist-types/ts3.4/selectChecksumAlgorithmFunction.d.ts +5 -0
- package/dist-types/ts3.4/stringHasher.d.ts +3 -0
- package/dist-types/ts3.4/types.d.ts +5 -0
- package/dist-types/ts3.4/validateChecksumFromResponse.d.ts +8 -0
- package/dist-types/types.d.ts +10 -0
- package/dist-types/validateChecksumFromResponse.d.ts +11 -0
- package/package.json +54 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# [3.53.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.52.0...v3.53.0) (2022-02-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **middleware-flexible-checksums:** add flexibleChecksumMiddleware ([#3340](https://github.com/aws/aws-sdk-js-v3/issues/3340)) ([15e0512](https://github.com/aws/aws-sdk-js-v3/commit/15e05124f9eb4a9fbf9437f14179188d7d4b11e1))
|
|
12
|
+
* **middleware-flexible-checksums:** support trailing checksums with aws-chunked encoding ([#3347](https://github.com/aws/aws-sdk-js-v3/issues/3347)) ([50b48fe](https://github.com/aws/aws-sdk-js-v3/commit/50b48fec155cb87f85799f001beac6ca6434372b))
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @aws-sdk/middleware-flexible-checksums
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@aws-sdk/middleware-flexible-checksums)
|
|
4
|
+
[](https://www.npmjs.com/package/@aws-sdk/middleware-flexible-checksums)
|
|
5
|
+
|
|
6
|
+
This package provides AWS SDK for JavaScript middleware that applies a checksum
|
|
7
|
+
of the request body as a header.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChecksumLocation = exports.ChecksumAlgorithm = void 0;
|
|
4
|
+
var ChecksumAlgorithm;
|
|
5
|
+
(function (ChecksumAlgorithm) {
|
|
6
|
+
ChecksumAlgorithm["MD5"] = "MD5";
|
|
7
|
+
ChecksumAlgorithm["CRC32"] = "CRC32";
|
|
8
|
+
ChecksumAlgorithm["CRC32C"] = "CRC32C";
|
|
9
|
+
ChecksumAlgorithm["SHA1"] = "SHA1";
|
|
10
|
+
ChecksumAlgorithm["SHA256"] = "SHA256";
|
|
11
|
+
})(ChecksumAlgorithm = exports.ChecksumAlgorithm || (exports.ChecksumAlgorithm = {}));
|
|
12
|
+
var ChecksumLocation;
|
|
13
|
+
(function (ChecksumLocation) {
|
|
14
|
+
ChecksumLocation["HEADER"] = "header";
|
|
15
|
+
ChecksumLocation["TRAILER"] = "trailer";
|
|
16
|
+
})(ChecksumLocation = exports.ChecksumLocation || (exports.ChecksumLocation = {}));
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flexibleChecksumsMiddleware = void 0;
|
|
4
|
+
const protocol_http_1 = require("@aws-sdk/protocol-http");
|
|
5
|
+
const getChecksum_1 = require("./getChecksum");
|
|
6
|
+
const getChecksumAlgorithmForRequest_1 = require("./getChecksumAlgorithmForRequest");
|
|
7
|
+
const getChecksumLocationName_1 = require("./getChecksumLocationName");
|
|
8
|
+
const hasHeader_1 = require("./hasHeader");
|
|
9
|
+
const isStreaming_1 = require("./isStreaming");
|
|
10
|
+
const selectChecksumAlgorithmFunction_1 = require("./selectChecksumAlgorithmFunction");
|
|
11
|
+
const validateChecksumFromResponse_1 = require("./validateChecksumFromResponse");
|
|
12
|
+
const flexibleChecksumsMiddleware = (config, middlewareConfig) => (next) => async (args) => {
|
|
13
|
+
if (!protocol_http_1.HttpRequest.isInstance(args.request)) {
|
|
14
|
+
return next(args);
|
|
15
|
+
}
|
|
16
|
+
const { request } = args;
|
|
17
|
+
const { body: requestBody, headers } = request;
|
|
18
|
+
const { base64Encoder, streamHasher } = config;
|
|
19
|
+
const { input, requestChecksumRequired, requestAlgorithmMember } = middlewareConfig;
|
|
20
|
+
const checksumAlgorithm = getChecksumAlgorithmForRequest_1.getChecksumAlgorithmForRequest(input, {
|
|
21
|
+
requestChecksumRequired,
|
|
22
|
+
requestAlgorithmMember,
|
|
23
|
+
});
|
|
24
|
+
let updatedBody = requestBody;
|
|
25
|
+
let updatedHeaders = headers;
|
|
26
|
+
if (checksumAlgorithm) {
|
|
27
|
+
const checksumLocationName = getChecksumLocationName_1.getChecksumLocationName(checksumAlgorithm);
|
|
28
|
+
const checksumAlgorithmFn = selectChecksumAlgorithmFunction_1.selectChecksumAlgorithmFunction(checksumAlgorithm, config);
|
|
29
|
+
if (isStreaming_1.isStreaming(requestBody)) {
|
|
30
|
+
const { getAwsChunkedEncodingStream, bodyLengthChecker } = config;
|
|
31
|
+
updatedBody = getAwsChunkedEncodingStream(requestBody, {
|
|
32
|
+
base64Encoder,
|
|
33
|
+
bodyLengthChecker,
|
|
34
|
+
checksumLocationName,
|
|
35
|
+
checksumAlgorithmFn,
|
|
36
|
+
streamHasher,
|
|
37
|
+
});
|
|
38
|
+
updatedHeaders = {
|
|
39
|
+
...headers,
|
|
40
|
+
"content-encoding": "aws-chunked",
|
|
41
|
+
"transfer-encoding": "chunked",
|
|
42
|
+
"x-amz-decoded-content-length": headers["content-length"],
|
|
43
|
+
"x-amz-content-sha256": "STREAMING-UNSIGNED-PAYLOAD-TRAILER",
|
|
44
|
+
"x-amz-trailer": checksumLocationName,
|
|
45
|
+
};
|
|
46
|
+
delete updatedHeaders["content-length"];
|
|
47
|
+
}
|
|
48
|
+
else if (!hasHeader_1.hasHeader(checksumLocationName, headers)) {
|
|
49
|
+
const checksum = await getChecksum_1.getChecksum(requestBody, { streamHasher, checksumAlgorithmFn, base64Encoder });
|
|
50
|
+
updatedHeaders = {
|
|
51
|
+
...headers,
|
|
52
|
+
[checksumLocationName]: checksum,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const result = await next({
|
|
57
|
+
...args,
|
|
58
|
+
request: {
|
|
59
|
+
...request,
|
|
60
|
+
headers: updatedHeaders,
|
|
61
|
+
body: updatedBody,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
const { requestValidationModeMember, responseAlgorithms } = middlewareConfig;
|
|
65
|
+
if (requestValidationModeMember && input[requestValidationModeMember] === "ENABLED") {
|
|
66
|
+
validateChecksumFromResponse_1.validateChecksumFromResponse(result.response, {
|
|
67
|
+
config,
|
|
68
|
+
responseAlgorithms,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
};
|
|
73
|
+
exports.flexibleChecksumsMiddleware = flexibleChecksumsMiddleware;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChecksum = void 0;
|
|
4
|
+
const isStreaming_1 = require("./isStreaming");
|
|
5
|
+
const stringHasher_1 = require("./stringHasher");
|
|
6
|
+
const getChecksum = async (body, { streamHasher, checksumAlgorithmFn, base64Encoder }) => {
|
|
7
|
+
const digest = isStreaming_1.isStreaming(body) ? streamHasher(checksumAlgorithmFn, body) : stringHasher_1.stringHasher(checksumAlgorithmFn, body);
|
|
8
|
+
return base64Encoder(await digest);
|
|
9
|
+
};
|
|
10
|
+
exports.getChecksum = getChecksum;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChecksumAlgorithmForRequest = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const getChecksumAlgorithmForRequest = (input, { requestChecksumRequired, requestAlgorithmMember }) => {
|
|
7
|
+
if (!requestAlgorithmMember || !input[requestAlgorithmMember]) {
|
|
8
|
+
return requestChecksumRequired ? constants_1.ChecksumAlgorithm.MD5 : undefined;
|
|
9
|
+
}
|
|
10
|
+
const checksumAlgorithm = input[requestAlgorithmMember];
|
|
11
|
+
if (!types_1.CLIENT_SUPPORTED_ALGORITHMS.includes(checksumAlgorithm)) {
|
|
12
|
+
throw new Error(`The checksum algorithm "${checksumAlgorithm}" is not supported by the client.` +
|
|
13
|
+
` Select one of ${types_1.CLIENT_SUPPORTED_ALGORITHMS}.`);
|
|
14
|
+
}
|
|
15
|
+
return checksumAlgorithm;
|
|
16
|
+
};
|
|
17
|
+
exports.getChecksumAlgorithmForRequest = getChecksumAlgorithmForRequest;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChecksumAlgorithmListForResponse = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
5
|
+
const getChecksumAlgorithmListForResponse = (responseAlgorithms = []) => {
|
|
6
|
+
const validChecksumAlgorithms = [];
|
|
7
|
+
for (const algorithm of types_1.PRIORITY_ORDER_ALGORITHMS) {
|
|
8
|
+
if (!responseAlgorithms.includes(algorithm) || !types_1.CLIENT_SUPPORTED_ALGORITHMS.includes(algorithm)) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
validChecksumAlgorithms.push(algorithm);
|
|
12
|
+
}
|
|
13
|
+
return validChecksumAlgorithms;
|
|
14
|
+
};
|
|
15
|
+
exports.getChecksumAlgorithmListForResponse = getChecksumAlgorithmListForResponse;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getChecksumLocationName = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const getChecksumLocationName = (algorithm) => algorithm === constants_1.ChecksumAlgorithm.MD5 ? "content-md5" : `x-amz-checksum-${algorithm.toLowerCase()}`;
|
|
6
|
+
exports.getChecksumLocationName = getChecksumLocationName;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFlexibleChecksumsPlugin = exports.flexibleChecksumsMiddlewareOptions = void 0;
|
|
4
|
+
const flexibleChecksumsMiddleware_1 = require("./flexibleChecksumsMiddleware");
|
|
5
|
+
exports.flexibleChecksumsMiddlewareOptions = {
|
|
6
|
+
name: "flexibleChecksumsMiddleware",
|
|
7
|
+
step: "build",
|
|
8
|
+
tags: ["BODY_CHECKSUM"],
|
|
9
|
+
override: true,
|
|
10
|
+
};
|
|
11
|
+
const getFlexibleChecksumsPlugin = (config, middlewareConfig) => ({
|
|
12
|
+
applyToStack: (clientStack) => {
|
|
13
|
+
clientStack.add(flexibleChecksumsMiddleware_1.flexibleChecksumsMiddleware(config, middlewareConfig), exports.flexibleChecksumsMiddlewareOptions);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
exports.getFlexibleChecksumsPlugin = getFlexibleChecksumsPlugin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasHeader = void 0;
|
|
4
|
+
const hasHeader = (header, headers) => {
|
|
5
|
+
const soughtHeader = header.toLowerCase();
|
|
6
|
+
for (const headerName of Object.keys(headers)) {
|
|
7
|
+
if (soughtHeader === headerName.toLowerCase()) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
};
|
|
13
|
+
exports.hasHeader = hasHeader;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./constants"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./flexibleChecksumsMiddleware"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./getFlexibleChecksumsPlugin"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isStreaming = void 0;
|
|
4
|
+
const is_array_buffer_1 = require("@aws-sdk/is-array-buffer");
|
|
5
|
+
const isStreaming = (body) => body !== undefined && typeof body !== "string" && !ArrayBuffer.isView(body) && !is_array_buffer_1.isArrayBuffer(body);
|
|
6
|
+
exports.isStreaming = isStreaming;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectChecksumAlgorithmFunction = void 0;
|
|
4
|
+
const crc32_1 = require("@aws-crypto/crc32");
|
|
5
|
+
const crc32c_1 = require("@aws-crypto/crc32c");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
const selectChecksumAlgorithmFunction = (checksumAlgorithm, config) => ({
|
|
8
|
+
[constants_1.ChecksumAlgorithm.MD5]: config.md5,
|
|
9
|
+
[constants_1.ChecksumAlgorithm.CRC32]: crc32_1.AwsCrc32,
|
|
10
|
+
[constants_1.ChecksumAlgorithm.CRC32C]: crc32c_1.AwsCrc32c,
|
|
11
|
+
[constants_1.ChecksumAlgorithm.SHA1]: config.sha1,
|
|
12
|
+
[constants_1.ChecksumAlgorithm.SHA256]: config.sha256,
|
|
13
|
+
}[checksumAlgorithm]);
|
|
14
|
+
exports.selectChecksumAlgorithmFunction = selectChecksumAlgorithmFunction;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringHasher = void 0;
|
|
4
|
+
const stringHasher = (checksumAlgorithmFn, body) => {
|
|
5
|
+
const hash = new checksumAlgorithmFn();
|
|
6
|
+
hash.update(body || "");
|
|
7
|
+
return hash.digest();
|
|
8
|
+
};
|
|
9
|
+
exports.stringHasher = stringHasher;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PRIORITY_ORDER_ALGORITHMS = exports.CLIENT_SUPPORTED_ALGORITHMS = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
exports.CLIENT_SUPPORTED_ALGORITHMS = [
|
|
6
|
+
constants_1.ChecksumAlgorithm.CRC32,
|
|
7
|
+
constants_1.ChecksumAlgorithm.CRC32C,
|
|
8
|
+
constants_1.ChecksumAlgorithm.SHA1,
|
|
9
|
+
constants_1.ChecksumAlgorithm.SHA256,
|
|
10
|
+
];
|
|
11
|
+
exports.PRIORITY_ORDER_ALGORITHMS = [
|
|
12
|
+
constants_1.ChecksumAlgorithm.CRC32,
|
|
13
|
+
constants_1.ChecksumAlgorithm.CRC32C,
|
|
14
|
+
constants_1.ChecksumAlgorithm.SHA1,
|
|
15
|
+
constants_1.ChecksumAlgorithm.SHA256,
|
|
16
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateChecksumFromResponse = void 0;
|
|
4
|
+
const getChecksum_1 = require("./getChecksum");
|
|
5
|
+
const getChecksumAlgorithmListForResponse_1 = require("./getChecksumAlgorithmListForResponse");
|
|
6
|
+
const getChecksumLocationName_1 = require("./getChecksumLocationName");
|
|
7
|
+
const selectChecksumAlgorithmFunction_1 = require("./selectChecksumAlgorithmFunction");
|
|
8
|
+
const validateChecksumFromResponse = async (response, { config, responseAlgorithms }) => {
|
|
9
|
+
const checksumAlgorithms = getChecksumAlgorithmListForResponse_1.getChecksumAlgorithmListForResponse(responseAlgorithms);
|
|
10
|
+
const { body: responseBody, headers: responseHeaders } = response;
|
|
11
|
+
for (const algorithm of checksumAlgorithms) {
|
|
12
|
+
const responseHeader = getChecksumLocationName_1.getChecksumLocationName(algorithm);
|
|
13
|
+
const checksumFromResponse = responseHeaders[responseHeader];
|
|
14
|
+
if (checksumFromResponse) {
|
|
15
|
+
const checksumAlgorithmFn = selectChecksumAlgorithmFunction_1.selectChecksumAlgorithmFunction(algorithm, config);
|
|
16
|
+
const { streamHasher, base64Encoder } = config;
|
|
17
|
+
const checksum = await getChecksum_1.getChecksum(responseBody, { streamHasher, checksumAlgorithmFn, base64Encoder });
|
|
18
|
+
if (checksum === checksumFromResponse) {
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
throw new Error(`Checksum mismatch: expected "${checksum}" but received "${checksumFromResponse}"` +
|
|
22
|
+
` in response header "${responseHeader}".`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.validateChecksumFromResponse = validateChecksumFromResponse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export var ChecksumAlgorithm;
|
|
2
|
+
(function (ChecksumAlgorithm) {
|
|
3
|
+
ChecksumAlgorithm["MD5"] = "MD5";
|
|
4
|
+
ChecksumAlgorithm["CRC32"] = "CRC32";
|
|
5
|
+
ChecksumAlgorithm["CRC32C"] = "CRC32C";
|
|
6
|
+
ChecksumAlgorithm["SHA1"] = "SHA1";
|
|
7
|
+
ChecksumAlgorithm["SHA256"] = "SHA256";
|
|
8
|
+
})(ChecksumAlgorithm || (ChecksumAlgorithm = {}));
|
|
9
|
+
export var ChecksumLocation;
|
|
10
|
+
(function (ChecksumLocation) {
|
|
11
|
+
ChecksumLocation["HEADER"] = "header";
|
|
12
|
+
ChecksumLocation["TRAILER"] = "trailer";
|
|
13
|
+
})(ChecksumLocation || (ChecksumLocation = {}));
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
|
+
import { HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
|
+
import { getChecksum } from "./getChecksum";
|
|
4
|
+
import { getChecksumAlgorithmForRequest } from "./getChecksumAlgorithmForRequest";
|
|
5
|
+
import { getChecksumLocationName } from "./getChecksumLocationName";
|
|
6
|
+
import { hasHeader } from "./hasHeader";
|
|
7
|
+
import { isStreaming } from "./isStreaming";
|
|
8
|
+
import { selectChecksumAlgorithmFunction } from "./selectChecksumAlgorithmFunction";
|
|
9
|
+
import { validateChecksumFromResponse } from "./validateChecksumFromResponse";
|
|
10
|
+
export var flexibleChecksumsMiddleware = function (config, middlewareConfig) {
|
|
11
|
+
return function (next) {
|
|
12
|
+
return function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13
|
+
var request, requestBody, headers, base64Encoder, streamHasher, input, requestChecksumRequired, requestAlgorithmMember, checksumAlgorithm, updatedBody, updatedHeaders, checksumLocationName, checksumAlgorithmFn, getAwsChunkedEncodingStream, bodyLengthChecker, checksum, result, requestValidationModeMember, responseAlgorithms;
|
|
14
|
+
var _a;
|
|
15
|
+
return __generator(this, function (_b) {
|
|
16
|
+
switch (_b.label) {
|
|
17
|
+
case 0:
|
|
18
|
+
if (!HttpRequest.isInstance(args.request)) {
|
|
19
|
+
return [2, next(args)];
|
|
20
|
+
}
|
|
21
|
+
request = args.request;
|
|
22
|
+
requestBody = request.body, headers = request.headers;
|
|
23
|
+
base64Encoder = config.base64Encoder, streamHasher = config.streamHasher;
|
|
24
|
+
input = middlewareConfig.input, requestChecksumRequired = middlewareConfig.requestChecksumRequired, requestAlgorithmMember = middlewareConfig.requestAlgorithmMember;
|
|
25
|
+
checksumAlgorithm = getChecksumAlgorithmForRequest(input, {
|
|
26
|
+
requestChecksumRequired: requestChecksumRequired,
|
|
27
|
+
requestAlgorithmMember: requestAlgorithmMember,
|
|
28
|
+
});
|
|
29
|
+
updatedBody = requestBody;
|
|
30
|
+
updatedHeaders = headers;
|
|
31
|
+
if (!checksumAlgorithm) return [3, 3];
|
|
32
|
+
checksumLocationName = getChecksumLocationName(checksumAlgorithm);
|
|
33
|
+
checksumAlgorithmFn = selectChecksumAlgorithmFunction(checksumAlgorithm, config);
|
|
34
|
+
if (!isStreaming(requestBody)) return [3, 1];
|
|
35
|
+
getAwsChunkedEncodingStream = config.getAwsChunkedEncodingStream, bodyLengthChecker = config.bodyLengthChecker;
|
|
36
|
+
updatedBody = getAwsChunkedEncodingStream(requestBody, {
|
|
37
|
+
base64Encoder: base64Encoder,
|
|
38
|
+
bodyLengthChecker: bodyLengthChecker,
|
|
39
|
+
checksumLocationName: checksumLocationName,
|
|
40
|
+
checksumAlgorithmFn: checksumAlgorithmFn,
|
|
41
|
+
streamHasher: streamHasher,
|
|
42
|
+
});
|
|
43
|
+
updatedHeaders = __assign(__assign({}, headers), { "content-encoding": "aws-chunked", "transfer-encoding": "chunked", "x-amz-decoded-content-length": headers["content-length"], "x-amz-content-sha256": "STREAMING-UNSIGNED-PAYLOAD-TRAILER", "x-amz-trailer": checksumLocationName });
|
|
44
|
+
delete updatedHeaders["content-length"];
|
|
45
|
+
return [3, 3];
|
|
46
|
+
case 1:
|
|
47
|
+
if (!!hasHeader(checksumLocationName, headers)) return [3, 3];
|
|
48
|
+
return [4, getChecksum(requestBody, { streamHasher: streamHasher, checksumAlgorithmFn: checksumAlgorithmFn, base64Encoder: base64Encoder })];
|
|
49
|
+
case 2:
|
|
50
|
+
checksum = _b.sent();
|
|
51
|
+
updatedHeaders = __assign(__assign({}, headers), (_a = {}, _a[checksumLocationName] = checksum, _a));
|
|
52
|
+
_b.label = 3;
|
|
53
|
+
case 3: return [4, next(__assign(__assign({}, args), { request: __assign(__assign({}, request), { headers: updatedHeaders, body: updatedBody }) }))];
|
|
54
|
+
case 4:
|
|
55
|
+
result = _b.sent();
|
|
56
|
+
requestValidationModeMember = middlewareConfig.requestValidationModeMember, responseAlgorithms = middlewareConfig.responseAlgorithms;
|
|
57
|
+
if (requestValidationModeMember && input[requestValidationModeMember] === "ENABLED") {
|
|
58
|
+
validateChecksumFromResponse(result.response, {
|
|
59
|
+
config: config,
|
|
60
|
+
responseAlgorithms: responseAlgorithms,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return [2, result];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); };
|
|
67
|
+
};
|
|
68
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __awaiter, __generator } from "tslib";
|
|
2
|
+
import { isStreaming } from "./isStreaming";
|
|
3
|
+
import { stringHasher } from "./stringHasher";
|
|
4
|
+
export var getChecksum = function (body, _a) {
|
|
5
|
+
var streamHasher = _a.streamHasher, checksumAlgorithmFn = _a.checksumAlgorithmFn, base64Encoder = _a.base64Encoder;
|
|
6
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
7
|
+
var digest, _b;
|
|
8
|
+
return __generator(this, function (_c) {
|
|
9
|
+
switch (_c.label) {
|
|
10
|
+
case 0:
|
|
11
|
+
digest = isStreaming(body) ? streamHasher(checksumAlgorithmFn, body) : stringHasher(checksumAlgorithmFn, body);
|
|
12
|
+
_b = base64Encoder;
|
|
13
|
+
return [4, digest];
|
|
14
|
+
case 1: return [2, _b.apply(void 0, [_c.sent()])];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
import { CLIENT_SUPPORTED_ALGORITHMS } from "./types";
|
|
3
|
+
export var getChecksumAlgorithmForRequest = function (input, _a) {
|
|
4
|
+
var requestChecksumRequired = _a.requestChecksumRequired, requestAlgorithmMember = _a.requestAlgorithmMember;
|
|
5
|
+
if (!requestAlgorithmMember || !input[requestAlgorithmMember]) {
|
|
6
|
+
return requestChecksumRequired ? ChecksumAlgorithm.MD5 : undefined;
|
|
7
|
+
}
|
|
8
|
+
var checksumAlgorithm = input[requestAlgorithmMember];
|
|
9
|
+
if (!CLIENT_SUPPORTED_ALGORITHMS.includes(checksumAlgorithm)) {
|
|
10
|
+
throw new Error("The checksum algorithm \"" + checksumAlgorithm + "\" is not supported by the client." +
|
|
11
|
+
(" Select one of " + CLIENT_SUPPORTED_ALGORITHMS + "."));
|
|
12
|
+
}
|
|
13
|
+
return checksumAlgorithm;
|
|
14
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { __values } from "tslib";
|
|
2
|
+
import { CLIENT_SUPPORTED_ALGORITHMS, PRIORITY_ORDER_ALGORITHMS } from "./types";
|
|
3
|
+
export var getChecksumAlgorithmListForResponse = function (responseAlgorithms) {
|
|
4
|
+
var e_1, _a;
|
|
5
|
+
if (responseAlgorithms === void 0) { responseAlgorithms = []; }
|
|
6
|
+
var validChecksumAlgorithms = [];
|
|
7
|
+
try {
|
|
8
|
+
for (var PRIORITY_ORDER_ALGORITHMS_1 = __values(PRIORITY_ORDER_ALGORITHMS), PRIORITY_ORDER_ALGORITHMS_1_1 = PRIORITY_ORDER_ALGORITHMS_1.next(); !PRIORITY_ORDER_ALGORITHMS_1_1.done; PRIORITY_ORDER_ALGORITHMS_1_1 = PRIORITY_ORDER_ALGORITHMS_1.next()) {
|
|
9
|
+
var algorithm = PRIORITY_ORDER_ALGORITHMS_1_1.value;
|
|
10
|
+
if (!responseAlgorithms.includes(algorithm) || !CLIENT_SUPPORTED_ALGORITHMS.includes(algorithm)) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
validChecksumAlgorithms.push(algorithm);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
17
|
+
finally {
|
|
18
|
+
try {
|
|
19
|
+
if (PRIORITY_ORDER_ALGORITHMS_1_1 && !PRIORITY_ORDER_ALGORITHMS_1_1.done && (_a = PRIORITY_ORDER_ALGORITHMS_1.return)) _a.call(PRIORITY_ORDER_ALGORITHMS_1);
|
|
20
|
+
}
|
|
21
|
+
finally { if (e_1) throw e_1.error; }
|
|
22
|
+
}
|
|
23
|
+
return validChecksumAlgorithms;
|
|
24
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { flexibleChecksumsMiddleware } from "./flexibleChecksumsMiddleware";
|
|
2
|
+
export var flexibleChecksumsMiddlewareOptions = {
|
|
3
|
+
name: "flexibleChecksumsMiddleware",
|
|
4
|
+
step: "build",
|
|
5
|
+
tags: ["BODY_CHECKSUM"],
|
|
6
|
+
override: true,
|
|
7
|
+
};
|
|
8
|
+
export var getFlexibleChecksumsPlugin = function (config, middlewareConfig) { return ({
|
|
9
|
+
applyToStack: function (clientStack) {
|
|
10
|
+
clientStack.add(flexibleChecksumsMiddleware(config, middlewareConfig), flexibleChecksumsMiddlewareOptions);
|
|
11
|
+
},
|
|
12
|
+
}); };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __values } from "tslib";
|
|
2
|
+
export var hasHeader = function (header, headers) {
|
|
3
|
+
var e_1, _a;
|
|
4
|
+
var soughtHeader = header.toLowerCase();
|
|
5
|
+
try {
|
|
6
|
+
for (var _b = __values(Object.keys(headers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
7
|
+
var headerName = _c.value;
|
|
8
|
+
if (soughtHeader === headerName.toLowerCase()) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
14
|
+
finally {
|
|
15
|
+
try {
|
|
16
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
17
|
+
}
|
|
18
|
+
finally { if (e_1) throw e_1.error; }
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
};
|
package/dist-es/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AwsCrc32 } from "@aws-crypto/crc32";
|
|
2
|
+
import { AwsCrc32c } from "@aws-crypto/crc32c";
|
|
3
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
4
|
+
export var selectChecksumAlgorithmFunction = function (checksumAlgorithm, config) {
|
|
5
|
+
var _a;
|
|
6
|
+
return ((_a = {},
|
|
7
|
+
_a[ChecksumAlgorithm.MD5] = config.md5,
|
|
8
|
+
_a[ChecksumAlgorithm.CRC32] = AwsCrc32,
|
|
9
|
+
_a[ChecksumAlgorithm.CRC32C] = AwsCrc32c,
|
|
10
|
+
_a[ChecksumAlgorithm.SHA1] = config.sha1,
|
|
11
|
+
_a[ChecksumAlgorithm.SHA256] = config.sha256,
|
|
12
|
+
_a)[checksumAlgorithm]);
|
|
13
|
+
};
|
package/dist-es/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
export var CLIENT_SUPPORTED_ALGORITHMS = [
|
|
3
|
+
ChecksumAlgorithm.CRC32,
|
|
4
|
+
ChecksumAlgorithm.CRC32C,
|
|
5
|
+
ChecksumAlgorithm.SHA1,
|
|
6
|
+
ChecksumAlgorithm.SHA256,
|
|
7
|
+
];
|
|
8
|
+
export var PRIORITY_ORDER_ALGORITHMS = [
|
|
9
|
+
ChecksumAlgorithm.CRC32,
|
|
10
|
+
ChecksumAlgorithm.CRC32C,
|
|
11
|
+
ChecksumAlgorithm.SHA1,
|
|
12
|
+
ChecksumAlgorithm.SHA256,
|
|
13
|
+
];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { __awaiter, __generator, __values } from "tslib";
|
|
2
|
+
import { getChecksum } from "./getChecksum";
|
|
3
|
+
import { getChecksumAlgorithmListForResponse } from "./getChecksumAlgorithmListForResponse";
|
|
4
|
+
import { getChecksumLocationName } from "./getChecksumLocationName";
|
|
5
|
+
import { selectChecksumAlgorithmFunction } from "./selectChecksumAlgorithmFunction";
|
|
6
|
+
export var validateChecksumFromResponse = function (response, _a) {
|
|
7
|
+
var config = _a.config, responseAlgorithms = _a.responseAlgorithms;
|
|
8
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
9
|
+
var checksumAlgorithms, responseBody, responseHeaders, checksumAlgorithms_1, checksumAlgorithms_1_1, algorithm, responseHeader, checksumFromResponse, checksumAlgorithmFn, streamHasher, base64Encoder, checksum, e_1_1;
|
|
10
|
+
var e_1, _b;
|
|
11
|
+
return __generator(this, function (_c) {
|
|
12
|
+
switch (_c.label) {
|
|
13
|
+
case 0:
|
|
14
|
+
checksumAlgorithms = getChecksumAlgorithmListForResponse(responseAlgorithms);
|
|
15
|
+
responseBody = response.body, responseHeaders = response.headers;
|
|
16
|
+
_c.label = 1;
|
|
17
|
+
case 1:
|
|
18
|
+
_c.trys.push([1, 6, 7, 8]);
|
|
19
|
+
checksumAlgorithms_1 = __values(checksumAlgorithms), checksumAlgorithms_1_1 = checksumAlgorithms_1.next();
|
|
20
|
+
_c.label = 2;
|
|
21
|
+
case 2:
|
|
22
|
+
if (!!checksumAlgorithms_1_1.done) return [3, 5];
|
|
23
|
+
algorithm = checksumAlgorithms_1_1.value;
|
|
24
|
+
responseHeader = getChecksumLocationName(algorithm);
|
|
25
|
+
checksumFromResponse = responseHeaders[responseHeader];
|
|
26
|
+
if (!checksumFromResponse) return [3, 4];
|
|
27
|
+
checksumAlgorithmFn = selectChecksumAlgorithmFunction(algorithm, config);
|
|
28
|
+
streamHasher = config.streamHasher, base64Encoder = config.base64Encoder;
|
|
29
|
+
return [4, getChecksum(responseBody, { streamHasher: streamHasher, checksumAlgorithmFn: checksumAlgorithmFn, base64Encoder: base64Encoder })];
|
|
30
|
+
case 3:
|
|
31
|
+
checksum = _c.sent();
|
|
32
|
+
if (checksum === checksumFromResponse) {
|
|
33
|
+
return [3, 5];
|
|
34
|
+
}
|
|
35
|
+
throw new Error("Checksum mismatch: expected \"" + checksum + "\" but received \"" + checksumFromResponse + "\"" +
|
|
36
|
+
(" in response header \"" + responseHeader + "\"."));
|
|
37
|
+
case 4:
|
|
38
|
+
checksumAlgorithms_1_1 = checksumAlgorithms_1.next();
|
|
39
|
+
return [3, 2];
|
|
40
|
+
case 5: return [3, 8];
|
|
41
|
+
case 6:
|
|
42
|
+
e_1_1 = _c.sent();
|
|
43
|
+
e_1 = { error: e_1_1 };
|
|
44
|
+
return [3, 8];
|
|
45
|
+
case 7:
|
|
46
|
+
try {
|
|
47
|
+
if (checksumAlgorithms_1_1 && !checksumAlgorithms_1_1.done && (_b = checksumAlgorithms_1.return)) _b.call(checksumAlgorithms_1);
|
|
48
|
+
}
|
|
49
|
+
finally { if (e_1) throw e_1.error; }
|
|
50
|
+
return [7];
|
|
51
|
+
case 8: return [2];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Encoder, GetAwsChunkedEncodingStream, HashConstructor, StreamHasher } from "@aws-sdk/types";
|
|
2
|
+
export interface PreviouslyResolved {
|
|
3
|
+
/**
|
|
4
|
+
* The function that will be used to convert binary data to a base64-encoded string.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
base64Encoder: Encoder;
|
|
8
|
+
/**
|
|
9
|
+
* A function that can calculate the length of a body.
|
|
10
|
+
*/
|
|
11
|
+
bodyLengthChecker: (body: any) => number | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* A function that returns Readable Stream which follows aws-chunked encoding stream.
|
|
14
|
+
*/
|
|
15
|
+
getAwsChunkedEncodingStream: GetAwsChunkedEncodingStream;
|
|
16
|
+
/**
|
|
17
|
+
* A constructor for a class implementing the {@link Hash} interface that computes MD5 hashes.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
md5: HashConstructor;
|
|
21
|
+
/**
|
|
22
|
+
* A constructor for a class implementing the {@link Hash} interface that computes SHA1 hashes.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
sha1: HashConstructor;
|
|
26
|
+
/**
|
|
27
|
+
* A constructor for a class implementing the {@link Hash} interface that computes SHA256 hashes.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
sha256: HashConstructor;
|
|
31
|
+
/**
|
|
32
|
+
* A function that, given a hash constructor and a stream, calculates the hash of the streamed value.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
streamHasher: StreamHasher<any>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checksum Algorithms supported by the SDK.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum ChecksumAlgorithm {
|
|
5
|
+
MD5 = "MD5",
|
|
6
|
+
CRC32 = "CRC32",
|
|
7
|
+
CRC32C = "CRC32C",
|
|
8
|
+
SHA1 = "SHA1",
|
|
9
|
+
SHA256 = "SHA256"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Location when the checksum is stored in the request body.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum ChecksumLocation {
|
|
15
|
+
HEADER = "header",
|
|
16
|
+
TRAILER = "trailer"
|
|
17
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BuildMiddleware } from "@aws-sdk/types";
|
|
2
|
+
import { PreviouslyResolved } from "./configuration";
|
|
3
|
+
import { FlexibleChecksumsMiddlewareConfig } from "./getFlexibleChecksumsPlugin";
|
|
4
|
+
export declare const flexibleChecksumsMiddleware: (config: PreviouslyResolved, middlewareConfig: FlexibleChecksumsMiddlewareConfig) => BuildMiddleware<any, any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Encoder, HashConstructor, StreamHasher } from "@aws-sdk/types";
|
|
2
|
+
export interface GetChecksumDigestOptions {
|
|
3
|
+
streamHasher: StreamHasher<any>;
|
|
4
|
+
checksumAlgorithmFn: HashConstructor;
|
|
5
|
+
base64Encoder: Encoder;
|
|
6
|
+
}
|
|
7
|
+
export declare const getChecksum: (body: unknown, { streamHasher, checksumAlgorithmFn, base64Encoder }: GetChecksumDigestOptions) => Promise<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
export interface GetChecksumAlgorithmForRequestOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Indicates an operation requires a checksum in its HTTP request.
|
|
5
|
+
*/
|
|
6
|
+
requestChecksumRequired: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Defines a top-level operation input member that is used to configure request checksum behavior.
|
|
9
|
+
*/
|
|
10
|
+
requestAlgorithmMember?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Returns the checksum algorithm to use for the request, along with
|
|
14
|
+
* the priority array of location to use to populate checksum and names
|
|
15
|
+
* to be used as a key at the location.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getChecksumAlgorithmForRequest: (input: any, { requestChecksumRequired, requestAlgorithmMember }: GetChecksumAlgorithmForRequestOptions) => ChecksumAlgorithm | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the priority array of algorithm to use to verify checksum and names
|
|
4
|
+
* to be used as a key in the response header.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getChecksumAlgorithmListForResponse: (responseAlgorithms?: string[]) => ChecksumAlgorithm[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BuildHandlerOptions, Pluggable } from "@aws-sdk/types";
|
|
2
|
+
import { PreviouslyResolved } from "./configuration";
|
|
3
|
+
export declare const flexibleChecksumsMiddlewareOptions: BuildHandlerOptions;
|
|
4
|
+
export interface FlexibleChecksumsMiddlewareConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The input object for the operation.
|
|
7
|
+
*/
|
|
8
|
+
input: Object;
|
|
9
|
+
/**
|
|
10
|
+
* Indicates an operation requires a checksum in its HTTP request.
|
|
11
|
+
*/
|
|
12
|
+
requestChecksumRequired: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Defines a top-level operation input member that is used to configure request checksum behavior.
|
|
15
|
+
*/
|
|
16
|
+
requestAlgorithmMember?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Defines a top-level operation input member used to opt-in to best-effort validation
|
|
19
|
+
* of a checksum returned in the HTTP response of the operation.
|
|
20
|
+
*/
|
|
21
|
+
requestValidationModeMember?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Defines the checksum algorithms clients SHOULD look for when validating checksums
|
|
24
|
+
* returned in the HTTP response.
|
|
25
|
+
*/
|
|
26
|
+
responseAlgorithms?: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare const getFlexibleChecksumsPlugin: (config: PreviouslyResolved, middlewareConfig: FlexibleChecksumsMiddlewareConfig) => Pluggable<any, any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HashConstructor } from "@aws-sdk/types";
|
|
2
|
+
import { PreviouslyResolved } from "./configuration";
|
|
3
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the function that will compute the checksum for the given {@link ChecksumAlgorithm}.
|
|
6
|
+
*/
|
|
7
|
+
export declare const selectChecksumAlgorithmFunction: (checksumAlgorithm: ChecksumAlgorithm, config: PreviouslyResolved) => HashConstructor;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Encoder, GetAwsChunkedEncodingStream, HashConstructor, StreamHasher } from "@aws-sdk/types";
|
|
2
|
+
export interface PreviouslyResolved {
|
|
3
|
+
|
|
4
|
+
base64Encoder: Encoder;
|
|
5
|
+
|
|
6
|
+
bodyLengthChecker: (body: any) => number | undefined;
|
|
7
|
+
|
|
8
|
+
getAwsChunkedEncodingStream: GetAwsChunkedEncodingStream;
|
|
9
|
+
|
|
10
|
+
md5: HashConstructor;
|
|
11
|
+
|
|
12
|
+
sha1: HashConstructor;
|
|
13
|
+
|
|
14
|
+
sha256: HashConstructor;
|
|
15
|
+
|
|
16
|
+
streamHasher: StreamHasher<any>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BuildMiddleware } from "@aws-sdk/types";
|
|
2
|
+
import { PreviouslyResolved } from "./configuration";
|
|
3
|
+
import { FlexibleChecksumsMiddlewareConfig } from "./getFlexibleChecksumsPlugin";
|
|
4
|
+
export declare const flexibleChecksumsMiddleware: (config: PreviouslyResolved, middlewareConfig: FlexibleChecksumsMiddlewareConfig) => BuildMiddleware<any, any>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Encoder, HashConstructor, StreamHasher } from "@aws-sdk/types";
|
|
2
|
+
export interface GetChecksumDigestOptions {
|
|
3
|
+
streamHasher: StreamHasher<any>;
|
|
4
|
+
checksumAlgorithmFn: HashConstructor;
|
|
5
|
+
base64Encoder: Encoder;
|
|
6
|
+
}
|
|
7
|
+
export declare const getChecksum: (body: unknown, { streamHasher, checksumAlgorithmFn, base64Encoder }: GetChecksumDigestOptions) => Promise<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
export interface GetChecksumAlgorithmForRequestOptions {
|
|
3
|
+
|
|
4
|
+
requestChecksumRequired: boolean;
|
|
5
|
+
|
|
6
|
+
requestAlgorithmMember?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export declare const getChecksumAlgorithmForRequest: (input: any, { requestChecksumRequired, requestAlgorithmMember }: GetChecksumAlgorithmForRequestOptions) => ChecksumAlgorithm | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BuildHandlerOptions, Pluggable } from "@aws-sdk/types";
|
|
2
|
+
import { PreviouslyResolved } from "./configuration";
|
|
3
|
+
export declare const flexibleChecksumsMiddlewareOptions: BuildHandlerOptions;
|
|
4
|
+
export interface FlexibleChecksumsMiddlewareConfig {
|
|
5
|
+
|
|
6
|
+
input: Object;
|
|
7
|
+
|
|
8
|
+
requestChecksumRequired: boolean;
|
|
9
|
+
|
|
10
|
+
requestAlgorithmMember?: string;
|
|
11
|
+
|
|
12
|
+
requestValidationModeMember?: string;
|
|
13
|
+
|
|
14
|
+
responseAlgorithms?: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare const getFlexibleChecksumsPlugin: (config: PreviouslyResolved, middlewareConfig: FlexibleChecksumsMiddlewareConfig) => Pluggable<any, any>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HashConstructor } from "@aws-sdk/types";
|
|
2
|
+
import { PreviouslyResolved } from "./configuration";
|
|
3
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
4
|
+
|
|
5
|
+
export declare const selectChecksumAlgorithmFunction: (checksumAlgorithm: ChecksumAlgorithm, config: PreviouslyResolved) => HashConstructor;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HttpResponse } from "@aws-sdk/protocol-http";
|
|
2
|
+
import { PreviouslyResolved } from "./configuration";
|
|
3
|
+
export interface ValidateChecksumFromResponseOptions {
|
|
4
|
+
config: PreviouslyResolved;
|
|
5
|
+
|
|
6
|
+
responseAlgorithms?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const validateChecksumFromResponse: (response: HttpResponse, { config, responseAlgorithms }: ValidateChecksumFromResponseOptions) => Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChecksumAlgorithm } from "./constants";
|
|
2
|
+
/**
|
|
3
|
+
* List of algorithms supported by client.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CLIENT_SUPPORTED_ALGORITHMS: ChecksumAlgorithm[];
|
|
6
|
+
/**
|
|
7
|
+
* Priority order for validating checksum algorithm. A faster algorithm has higher priority.
|
|
8
|
+
* ToDo: update the priority order based on profiling of JavaScript implementations.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PRIORITY_ORDER_ALGORITHMS: ChecksumAlgorithm[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpResponse } from "@aws-sdk/protocol-http";
|
|
2
|
+
import { PreviouslyResolved } from "./configuration";
|
|
3
|
+
export interface ValidateChecksumFromResponseOptions {
|
|
4
|
+
config: PreviouslyResolved;
|
|
5
|
+
/**
|
|
6
|
+
* Defines the checksum algorithms clients SHOULD look for when validating checksums
|
|
7
|
+
* returned in the HTTP response.
|
|
8
|
+
*/
|
|
9
|
+
responseAlgorithms?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare const validateChecksumFromResponse: (response: HttpResponse, { config, responseAlgorithms }: ValidateChecksumFromResponseOptions) => Promise<void>;
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aws-sdk/middleware-flexible-checksums",
|
|
3
|
+
"version": "3.53.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
7
|
+
"build:es": "tsc -p tsconfig.es.json",
|
|
8
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
9
|
+
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
10
|
+
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
|
11
|
+
"test": "jest --coverage"
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist-cjs/index.js",
|
|
14
|
+
"module": "./dist-es/index.js",
|
|
15
|
+
"types": "./dist-types/index.d.ts",
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "AWS SDK for JavaScript Team",
|
|
18
|
+
"url": "https://aws.amazon.com/javascript/"
|
|
19
|
+
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@aws-crypto/crc32": "2.0.0",
|
|
23
|
+
"@aws-crypto/crc32c": "2.0.0",
|
|
24
|
+
"@aws-sdk/is-array-buffer": "3.52.0",
|
|
25
|
+
"@aws-sdk/protocol-http": "3.53.0",
|
|
26
|
+
"@aws-sdk/types": "3.53.0",
|
|
27
|
+
"tslib": "^2.3.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"concurrently": "7.0.0",
|
|
31
|
+
"downlevel-dts": "0.7.0",
|
|
32
|
+
"rimraf": "3.0.2",
|
|
33
|
+
"typescript": "~4.3.5"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">= 12.0.0"
|
|
37
|
+
},
|
|
38
|
+
"typesVersions": {
|
|
39
|
+
"<4.0": {
|
|
40
|
+
"dist-types/*": [
|
|
41
|
+
"dist-types/ts3.4/*"
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist-*"
|
|
47
|
+
],
|
|
48
|
+
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages/middleware-flexible-checksums",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "https://github.com/aws/aws-sdk-js-v3.git",
|
|
52
|
+
"directory": "packages/middleware-flexible-checksums"
|
|
53
|
+
}
|
|
54
|
+
}
|