@aws-amplify/storage 6.8.5-unstable.fd56414.0 → 6.9.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/providers/s3/apis/internal/uploadData/multipart/initialUpload.js +13 -3
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/initialUpload.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadCache.js +21 -10
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadCache.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.js +5 -2
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.js +2 -2
- package/dist/cjs/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/putObjectJob.js +1 -1
- package/dist/cjs/providers/s3/apis/internal/uploadData/putObjectJob.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/completeMultipartUpload.js +1 -0
- package/dist/cjs/providers/s3/utils/client/s3data/completeMultipartUpload.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/createMultipartUpload.js +1 -0
- package/dist/cjs/providers/s3/utils/client/s3data/createMultipartUpload.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/getObject.js +1 -0
- package/dist/cjs/providers/s3/utils/client/s3data/getObject.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js +1 -0
- package/dist/cjs/providers/s3/utils/client/s3data/listObjectsV2.js.map +1 -1
- package/dist/cjs/providers/s3/utils/crc32.js +4 -5
- package/dist/cjs/providers/s3/utils/crc32.js.map +1 -1
- package/dist/cjs/providers/s3/utils/hexUtils.js +1 -3
- package/dist/cjs/providers/s3/utils/hexUtils.js.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/initialUpload.mjs +14 -4
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/initialUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadCache.d.ts +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadCache.mjs +20 -9
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadCache.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.mjs +5 -2
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.mjs +2 -2
- package/dist/esm/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/putObjectJob.mjs +1 -1
- package/dist/esm/providers/s3/apis/internal/uploadData/putObjectJob.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.d.ts +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.mjs +1 -0
- package/dist/esm/providers/s3/utils/client/s3data/completeMultipartUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.d.ts +2 -2
- package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.mjs +1 -0
- package/dist/esm/providers/s3/utils/client/s3data/createMultipartUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/getObject.mjs +1 -0
- package/dist/esm/providers/s3/utils/client/s3data/getObject.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs +1 -0
- package/dist/esm/providers/s3/utils/client/s3data/listObjectsV2.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/crc32.d.ts +4 -6
- package/dist/esm/providers/s3/utils/crc32.mjs +5 -6
- package/dist/esm/providers/s3/utils/crc32.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/hexUtils.d.ts +0 -1
- package/dist/esm/providers/s3/utils/hexUtils.mjs +1 -2
- package/dist/esm/providers/s3/utils/hexUtils.mjs.map +1 -1
- package/package.json +117 -117
- package/src/providers/s3/apis/internal/uploadData/multipart/initialUpload.ts +14 -4
- package/src/providers/s3/apis/internal/uploadData/multipart/uploadCache.ts +30 -10
- package/src/providers/s3/apis/internal/uploadData/multipart/uploadHandlers.ts +5 -2
- package/src/providers/s3/apis/internal/uploadData/multipart/uploadPartExecutor.ts +4 -4
- package/src/providers/s3/apis/internal/uploadData/putObjectJob.ts +1 -1
- package/src/providers/s3/utils/client/s3data/completeMultipartUpload.ts +2 -0
- package/src/providers/s3/utils/client/s3data/createMultipartUpload.ts +3 -1
- package/src/providers/s3/utils/client/s3data/getObject.ts +1 -0
- package/src/providers/s3/utils/client/s3data/listObjectsV2.ts +2 -0
- package/src/providers/s3/utils/crc32.ts +6 -13
- package/src/providers/s3/utils/hexUtils.ts +0 -3
- package/dist/cjs/providers/s3/utils/getCombinedCrc32.js +0 -31
- package/dist/cjs/providers/s3/utils/getCombinedCrc32.js.map +0 -1
- package/dist/cjs/providers/s3/utils/getCombinedCrc32.native.js +0 -40
- package/dist/cjs/providers/s3/utils/getCombinedCrc32.native.js.map +0 -1
- package/dist/esm/providers/s3/utils/getCombinedCrc32.d.ts +0 -14
- package/dist/esm/providers/s3/utils/getCombinedCrc32.mjs +0 -29
- package/dist/esm/providers/s3/utils/getCombinedCrc32.mjs.map +0 -1
- package/dist/esm/providers/s3/utils/getCombinedCrc32.native.d.ts +0 -14
- package/dist/esm/providers/s3/utils/getCombinedCrc32.native.mjs +0 -38
- package/dist/esm/providers/s3/utils/getCombinedCrc32.native.mjs.map +0 -1
- package/src/providers/s3/utils/getCombinedCrc32.native.ts +0 -46
- package/src/providers/s3/utils/getCombinedCrc32.ts +0 -34
|
@@ -5,7 +5,7 @@ import { TransferProgressEvent } from '../../../../../../types';
|
|
|
5
5
|
import { ResolvedS3Config } from '../../../../types/options';
|
|
6
6
|
import { uploadPart } from '../../../../utils/client/s3data';
|
|
7
7
|
import { logger } from '../../../../../../utils';
|
|
8
|
-
import {
|
|
8
|
+
import { calculateContentCRC32 } from '../../../../utils/crc32';
|
|
9
9
|
import { calculateContentMd5 } from '../../../../utils';
|
|
10
10
|
|
|
11
11
|
import { PartToUpload } from './getDataChunker';
|
|
@@ -58,7 +58,7 @@ export const uploadPartExecutor = async ({
|
|
|
58
58
|
});
|
|
59
59
|
} else {
|
|
60
60
|
// handle cancel error
|
|
61
|
-
let checksumCRC32:
|
|
61
|
+
let checksumCRC32: string | undefined;
|
|
62
62
|
if (useCRC32Checksum) {
|
|
63
63
|
checksumCRC32 = await calculateContentCRC32(data);
|
|
64
64
|
}
|
|
@@ -85,14 +85,14 @@ export const uploadPartExecutor = async ({
|
|
|
85
85
|
UploadId: uploadId,
|
|
86
86
|
Body: data,
|
|
87
87
|
PartNumber: partNumber,
|
|
88
|
-
ChecksumCRC32: checksumCRC32
|
|
88
|
+
ChecksumCRC32: checksumCRC32,
|
|
89
89
|
ContentMD5: contentMD5,
|
|
90
90
|
ExpectedBucketOwner: expectedBucketOwner,
|
|
91
91
|
},
|
|
92
92
|
);
|
|
93
93
|
transferredBytes += size;
|
|
94
94
|
// eTag will always be set even the S3 model interface marks it as optional.
|
|
95
|
-
onPartUploadCompletion(partNumber, eTag!, checksumCRC32
|
|
95
|
+
onPartUploadCompletion(partNumber, eTag!, checksumCRC32);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
@@ -95,7 +95,7 @@ export const putObjectJob =
|
|
|
95
95
|
ContentEncoding: contentEncoding,
|
|
96
96
|
Metadata: metadata,
|
|
97
97
|
ContentMD5: contentMD5,
|
|
98
|
-
ChecksumCRC32: checksumCRC32
|
|
98
|
+
ChecksumCRC32: checksumCRC32,
|
|
99
99
|
ExpectedBucketOwner: expectedBucketOwner,
|
|
100
100
|
IfNoneMatch: preventOverwrite ? '*' : undefined,
|
|
101
101
|
},
|
|
@@ -49,6 +49,7 @@ export type CompleteMultipartUploadInput = Pick<
|
|
|
49
49
|
| 'UploadId'
|
|
50
50
|
| 'MultipartUpload'
|
|
51
51
|
| 'ChecksumCRC32'
|
|
52
|
+
| 'ChecksumType'
|
|
52
53
|
| 'ExpectedBucketOwner'
|
|
53
54
|
| 'IfNoneMatch'
|
|
54
55
|
>;
|
|
@@ -66,6 +67,7 @@ const completeMultipartUploadSerializer = async (
|
|
|
66
67
|
'content-type': 'application/xml',
|
|
67
68
|
...assignStringVariables({
|
|
68
69
|
'x-amz-checksum-crc32': input.ChecksumCRC32,
|
|
70
|
+
'x-amz-checksum-type': input.ChecksumType,
|
|
69
71
|
'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,
|
|
70
72
|
'If-None-Match': input.IfNoneMatch,
|
|
71
73
|
}),
|
|
@@ -32,7 +32,8 @@ import { defaultConfig, parseXmlError } from './base';
|
|
|
32
32
|
export type CreateMultipartUploadInput = Extract<
|
|
33
33
|
CreateMultipartUploadCommandInput,
|
|
34
34
|
PutObjectInput
|
|
35
|
-
|
|
35
|
+
> &
|
|
36
|
+
Pick<CreateMultipartUploadCommandInput, 'ChecksumType'>;
|
|
36
37
|
|
|
37
38
|
export type CreateMultipartUploadOutput = Pick<
|
|
38
39
|
CreateMultipartUploadCommandOutput,
|
|
@@ -47,6 +48,7 @@ const createMultipartUploadSerializer = async (
|
|
|
47
48
|
...(await serializeObjectConfigsToHeaders(input)),
|
|
48
49
|
...assignStringVariables({
|
|
49
50
|
'x-amz-checksum-algorithm': input.ChecksumAlgorithm,
|
|
51
|
+
'x-amz-checksum-type': input.ChecksumType,
|
|
50
52
|
'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,
|
|
51
53
|
}),
|
|
52
54
|
};
|
|
@@ -105,6 +105,7 @@ const getObjectDeserializer = async (
|
|
|
105
105
|
ChecksumCRC32C: 'x-amz-checksum-crc32c',
|
|
106
106
|
ChecksumSHA1: 'x-amz-checksum-sha1',
|
|
107
107
|
ChecksumSHA256: 'x-amz-checksum-sha256',
|
|
108
|
+
ChecksumType: 'x-amz-checksum-type',
|
|
108
109
|
MissingMeta: ['x-amz-missing-meta', deserializeNumber],
|
|
109
110
|
VersionId: 'x-amz-version-id',
|
|
110
111
|
CacheControl: 'cache-control',
|
|
@@ -29,6 +29,7 @@ import { deserializeStringTag } from '../utils/deserializeHelpers';
|
|
|
29
29
|
|
|
30
30
|
import type {
|
|
31
31
|
ChecksumAlgorithm,
|
|
32
|
+
ChecksumType,
|
|
32
33
|
ListObjectsV2CommandInput,
|
|
33
34
|
ListObjectsV2CommandOutput,
|
|
34
35
|
StorageClass,
|
|
@@ -126,6 +127,7 @@ const deserializeObject = (output: any) =>
|
|
|
126
127
|
'ChecksumAlgorithm',
|
|
127
128
|
value => emptyArrayGuard(value, deserializeChecksumAlgorithmList),
|
|
128
129
|
],
|
|
130
|
+
ChecksumType: ['ChecksumType', deserializeStringTag<ChecksumType>],
|
|
129
131
|
Size: ['Size', deserializeNumber],
|
|
130
132
|
StorageClass: ['StorageClass', deserializeStringTag<StorageClass>],
|
|
131
133
|
Owner: ['Owner', deserializeOwner],
|
|
@@ -3,21 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
import crc32 from 'crc-32';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { hexToBase64 } from './hexUtils';
|
|
7
7
|
import { readFile } from './readFile';
|
|
8
8
|
|
|
9
9
|
const CHUNK_SIZE = 1024 * 1024; // 1MB chunks
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
seed: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Calculate the CRC32 checksum for given content and return base64 encoded checksum.
|
|
13
|
+
*/
|
|
17
14
|
export const calculateContentCRC32 = async (
|
|
18
15
|
content: Blob | string | ArrayBuffer | ArrayBufferView,
|
|
19
16
|
seed = 0,
|
|
20
|
-
): Promise<
|
|
17
|
+
): Promise<string> => {
|
|
21
18
|
let internalSeed = seed;
|
|
22
19
|
|
|
23
20
|
if (content instanceof ArrayBuffer || ArrayBuffer.isView(content)) {
|
|
@@ -64,9 +61,5 @@ export const calculateContentCRC32 = async (
|
|
|
64
61
|
|
|
65
62
|
const hex = internalSeed.toString(16).padStart(8, '0');
|
|
66
63
|
|
|
67
|
-
return
|
|
68
|
-
checksumArrayBuffer: hexToArrayBuffer(hex),
|
|
69
|
-
checksum: hexToBase64(hex),
|
|
70
|
-
seed: internalSeed,
|
|
71
|
-
};
|
|
64
|
+
return hexToBase64(hex);
|
|
72
65
|
};
|
|
@@ -6,8 +6,5 @@ import { toBase64 } from './client/runtime';
|
|
|
6
6
|
export const hexToUint8Array = (hexString: string) =>
|
|
7
7
|
new Uint8Array((hexString.match(/\w{2}/g)! ?? []).map(h => parseInt(h, 16)));
|
|
8
8
|
|
|
9
|
-
export const hexToArrayBuffer = (hexString: string) =>
|
|
10
|
-
hexToUint8Array(hexString).buffer;
|
|
11
|
-
|
|
12
9
|
export const hexToBase64 = (hexString: string) =>
|
|
13
10
|
toBase64(hexToUint8Array(hexString));
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getCombinedCrc32 = void 0;
|
|
7
|
-
const getDataChunker_1 = require("../apis/internal/uploadData/multipart/getDataChunker");
|
|
8
|
-
const crc32_1 = require("./crc32");
|
|
9
|
-
/**
|
|
10
|
-
* Calculates a combined CRC32 checksum for the given data.
|
|
11
|
-
*
|
|
12
|
-
* This function chunks the input data, calculates CRC32 for each chunk,
|
|
13
|
-
* and then combines these checksums into a single value.
|
|
14
|
-
*
|
|
15
|
-
* @async
|
|
16
|
-
* @param {StorageUploadDataPayload} data - The data to calculate the checksum for.
|
|
17
|
-
* @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.
|
|
18
|
-
* @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum
|
|
19
|
-
* and the number of chunks, separated by a hyphen.
|
|
20
|
-
*/
|
|
21
|
-
const getCombinedCrc32 = async (data, size) => {
|
|
22
|
-
const crc32List = [];
|
|
23
|
-
const dataChunker = (0, getDataChunker_1.getDataChunker)(data, size);
|
|
24
|
-
for (const { data: checkData } of dataChunker) {
|
|
25
|
-
const { checksumArrayBuffer } = await (0, crc32_1.calculateContentCRC32)(checkData);
|
|
26
|
-
crc32List.push(checksumArrayBuffer);
|
|
27
|
-
}
|
|
28
|
-
return `${(await (0, crc32_1.calculateContentCRC32)(new Blob(crc32List))).checksum}-${crc32List.length}`;
|
|
29
|
-
};
|
|
30
|
-
exports.getCombinedCrc32 = getCombinedCrc32;
|
|
31
|
-
//# sourceMappingURL=getCombinedCrc32.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCombinedCrc32.js","sources":["../../../../../src/providers/s3/utils/getCombinedCrc32.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCombinedCrc32 = void 0;\nconst getDataChunker_1 = require(\"../apis/internal/uploadData/multipart/getDataChunker\");\nconst crc32_1 = require(\"./crc32\");\n/**\n * Calculates a combined CRC32 checksum for the given data.\n *\n * This function chunks the input data, calculates CRC32 for each chunk,\n * and then combines these checksums into a single value.\n *\n * @async\n * @param {StorageUploadDataPayload} data - The data to calculate the checksum for.\n * @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.\n * @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum\n * and the number of chunks, separated by a hyphen.\n */\nconst getCombinedCrc32 = async (data, size) => {\n const crc32List = [];\n const dataChunker = (0, getDataChunker_1.getDataChunker)(data, size);\n for (const { data: checkData } of dataChunker) {\n const { checksumArrayBuffer } = await (0, crc32_1.calculateContentCRC32)(checkData);\n crc32List.push(checksumArrayBuffer);\n }\n return `${(await (0, crc32_1.calculateContentCRC32)(new Blob(crc32List))).checksum}-${crc32List.length}`;\n};\nexports.getCombinedCrc32 = getCombinedCrc32;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gBAAgB,GAAG,MAAM;AACjC,MAAM,gBAAgB,GAAG,OAAO,CAAC,sDAAsD,CAAC;AACxF,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,OAAO,IAAI,EAAE,IAAI,KAAK;AAC/C,IAAI,MAAM,SAAS,GAAG,EAAE;AACxB,IAAI,MAAM,WAAW,GAAG,IAAI,gBAAgB,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC;AACxE,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,WAAW,EAAE;AACnD,QAAQ,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,IAAI,OAAO,CAAC,qBAAqB,EAAE,SAAS,CAAC;AAC3F,QAAQ,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC;AAC3C;AACA,IAAI,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,OAAO,CAAC,qBAAqB,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;AAC5G,CAAC;AACD,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getCombinedCrc32 = void 0;
|
|
7
|
-
const getDataChunker_1 = require("../apis/internal/uploadData/multipart/getDataChunker");
|
|
8
|
-
const crc32_1 = require("./crc32");
|
|
9
|
-
/**
|
|
10
|
-
* Calculates a combined CRC32 checksum for the given data.
|
|
11
|
-
*
|
|
12
|
-
* This function chunks the input data, calculates CRC32 for each chunk,
|
|
13
|
-
* and then combines these checksums into a single value.
|
|
14
|
-
*
|
|
15
|
-
* @async
|
|
16
|
-
* @param {StorageUploadDataPayload} data - The data to calculate the checksum for.
|
|
17
|
-
* @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.
|
|
18
|
-
* @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum
|
|
19
|
-
* and the number of chunks, separated by a hyphen.
|
|
20
|
-
*/
|
|
21
|
-
const getCombinedCrc32 = async (data, size) => {
|
|
22
|
-
const crc32List = [];
|
|
23
|
-
const dataChunker = (0, getDataChunker_1.getDataChunker)(data, size);
|
|
24
|
-
let totalLength = 0;
|
|
25
|
-
for (const { data: checkData } of dataChunker) {
|
|
26
|
-
const checksum = new Uint8Array((await (0, crc32_1.calculateContentCRC32)(checkData)).checksumArrayBuffer);
|
|
27
|
-
totalLength += checksum.length;
|
|
28
|
-
crc32List.push(checksum);
|
|
29
|
-
}
|
|
30
|
-
// Combine all Uint8Arrays into a single Uint8Array
|
|
31
|
-
const combinedArray = new Uint8Array(totalLength);
|
|
32
|
-
let offset = 0;
|
|
33
|
-
for (const crc32Hash of crc32List) {
|
|
34
|
-
combinedArray.set(crc32Hash, offset);
|
|
35
|
-
offset += crc32Hash.length;
|
|
36
|
-
}
|
|
37
|
-
return `${(await (0, crc32_1.calculateContentCRC32)(combinedArray.buffer)).checksum}-${crc32List.length}`;
|
|
38
|
-
};
|
|
39
|
-
exports.getCombinedCrc32 = getCombinedCrc32;
|
|
40
|
-
//# sourceMappingURL=getCombinedCrc32.native.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCombinedCrc32.native.js","sources":["../../../../../src/providers/s3/utils/getCombinedCrc32.native.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCombinedCrc32 = void 0;\nconst getDataChunker_1 = require(\"../apis/internal/uploadData/multipart/getDataChunker\");\nconst crc32_1 = require(\"./crc32\");\n/**\n * Calculates a combined CRC32 checksum for the given data.\n *\n * This function chunks the input data, calculates CRC32 for each chunk,\n * and then combines these checksums into a single value.\n *\n * @async\n * @param {StorageUploadDataPayload} data - The data to calculate the checksum for.\n * @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.\n * @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum\n * and the number of chunks, separated by a hyphen.\n */\nconst getCombinedCrc32 = async (data, size) => {\n const crc32List = [];\n const dataChunker = (0, getDataChunker_1.getDataChunker)(data, size);\n let totalLength = 0;\n for (const { data: checkData } of dataChunker) {\n const checksum = new Uint8Array((await (0, crc32_1.calculateContentCRC32)(checkData)).checksumArrayBuffer);\n totalLength += checksum.length;\n crc32List.push(checksum);\n }\n // Combine all Uint8Arrays into a single Uint8Array\n const combinedArray = new Uint8Array(totalLength);\n let offset = 0;\n for (const crc32Hash of crc32List) {\n combinedArray.set(crc32Hash, offset);\n offset += crc32Hash.length;\n }\n return `${(await (0, crc32_1.calculateContentCRC32)(combinedArray.buffer)).checksum}-${crc32List.length}`;\n};\nexports.getCombinedCrc32 = getCombinedCrc32;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gBAAgB,GAAG,MAAM;AACjC,MAAM,gBAAgB,GAAG,OAAO,CAAC,sDAAsD,CAAC;AACxF,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,OAAO,IAAI,EAAE,IAAI,KAAK;AAC/C,IAAI,MAAM,SAAS,GAAG,EAAE;AACxB,IAAI,MAAM,WAAW,GAAG,IAAI,gBAAgB,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC;AACxE,IAAI,IAAI,WAAW,GAAG,CAAC;AACvB,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,WAAW,EAAE;AACnD,QAAQ,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAE,mBAAmB,CAAC;AAClH,QAAQ,WAAW,IAAI,QAAQ,CAAC,MAAM;AACtC,QAAQ,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;AAChC;AACA;AACA,IAAI,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC;AACrD,IAAI,IAAI,MAAM,GAAG,CAAC;AAClB,IAAI,KAAK,MAAM,SAAS,IAAI,SAAS,EAAE;AACvC,QAAQ,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC;AAC5C,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAClC;AACA,IAAI,OAAO,CAAC,EAAE,CAAC,MAAM,IAAI,OAAO,CAAC,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;AAC7G,CAAC;AACD,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StorageUploadDataPayload } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Calculates a combined CRC32 checksum for the given data.
|
|
4
|
-
*
|
|
5
|
-
* This function chunks the input data, calculates CRC32 for each chunk,
|
|
6
|
-
* and then combines these checksums into a single value.
|
|
7
|
-
*
|
|
8
|
-
* @async
|
|
9
|
-
* @param {StorageUploadDataPayload} data - The data to calculate the checksum for.
|
|
10
|
-
* @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.
|
|
11
|
-
* @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum
|
|
12
|
-
* and the number of chunks, separated by a hyphen.
|
|
13
|
-
*/
|
|
14
|
-
export declare const getCombinedCrc32: (data: StorageUploadDataPayload, size: number | undefined) => Promise<string>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { getDataChunker } from '../apis/internal/uploadData/multipart/getDataChunker.mjs';
|
|
2
|
-
import { calculateContentCRC32 } from './crc32.mjs';
|
|
3
|
-
|
|
4
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
/**
|
|
7
|
-
* Calculates a combined CRC32 checksum for the given data.
|
|
8
|
-
*
|
|
9
|
-
* This function chunks the input data, calculates CRC32 for each chunk,
|
|
10
|
-
* and then combines these checksums into a single value.
|
|
11
|
-
*
|
|
12
|
-
* @async
|
|
13
|
-
* @param {StorageUploadDataPayload} data - The data to calculate the checksum for.
|
|
14
|
-
* @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.
|
|
15
|
-
* @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum
|
|
16
|
-
* and the number of chunks, separated by a hyphen.
|
|
17
|
-
*/
|
|
18
|
-
const getCombinedCrc32 = async (data, size) => {
|
|
19
|
-
const crc32List = [];
|
|
20
|
-
const dataChunker = getDataChunker(data, size);
|
|
21
|
-
for (const { data: checkData } of dataChunker) {
|
|
22
|
-
const { checksumArrayBuffer } = await calculateContentCRC32(checkData);
|
|
23
|
-
crc32List.push(checksumArrayBuffer);
|
|
24
|
-
}
|
|
25
|
-
return `${(await calculateContentCRC32(new Blob(crc32List))).checksum}-${crc32List.length}`;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { getCombinedCrc32 };
|
|
29
|
-
//# sourceMappingURL=getCombinedCrc32.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCombinedCrc32.mjs","sources":["../../../../../src/providers/s3/utils/getCombinedCrc32.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getDataChunker } from '../apis/internal/uploadData/multipart/getDataChunker';\nimport { calculateContentCRC32 } from './crc32';\n/**\n * Calculates a combined CRC32 checksum for the given data.\n *\n * This function chunks the input data, calculates CRC32 for each chunk,\n * and then combines these checksums into a single value.\n *\n * @async\n * @param {StorageUploadDataPayload} data - The data to calculate the checksum for.\n * @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.\n * @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum\n * and the number of chunks, separated by a hyphen.\n */\nexport const getCombinedCrc32 = async (data, size) => {\n const crc32List = [];\n const dataChunker = getDataChunker(data, size);\n for (const { data: checkData } of dataChunker) {\n const { checksumArrayBuffer } = await calculateContentCRC32(checkData);\n crc32List.push(checksumArrayBuffer);\n }\n return `${(await calculateContentCRC32(new Blob(crc32List))).checksum}-${crc32List.length}`;\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,OAAO,IAAI,EAAE,IAAI,KAAK;AACtD,IAAI,MAAM,SAAS,GAAG,EAAE;AACxB,IAAI,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC;AAClD,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,WAAW,EAAE;AACnD,QAAQ,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,qBAAqB,CAAC,SAAS,CAAC;AAC9E,QAAQ,SAAS,CAAC,IAAI,CAAC,mBAAmB,CAAC;AAC3C;AACA,IAAI,OAAO,CAAC,EAAE,CAAC,MAAM,qBAAqB,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;AAC/F;;;;"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { StorageUploadDataPayload } from '../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Calculates a combined CRC32 checksum for the given data.
|
|
4
|
-
*
|
|
5
|
-
* This function chunks the input data, calculates CRC32 for each chunk,
|
|
6
|
-
* and then combines these checksums into a single value.
|
|
7
|
-
*
|
|
8
|
-
* @async
|
|
9
|
-
* @param {StorageUploadDataPayload} data - The data to calculate the checksum for.
|
|
10
|
-
* @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.
|
|
11
|
-
* @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum
|
|
12
|
-
* and the number of chunks, separated by a hyphen.
|
|
13
|
-
*/
|
|
14
|
-
export declare const getCombinedCrc32: (data: StorageUploadDataPayload, size: number | undefined) => Promise<string>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { getDataChunker } from '../apis/internal/uploadData/multipart/getDataChunker.mjs';
|
|
2
|
-
import { calculateContentCRC32 } from './crc32.mjs';
|
|
3
|
-
|
|
4
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
/**
|
|
7
|
-
* Calculates a combined CRC32 checksum for the given data.
|
|
8
|
-
*
|
|
9
|
-
* This function chunks the input data, calculates CRC32 for each chunk,
|
|
10
|
-
* and then combines these checksums into a single value.
|
|
11
|
-
*
|
|
12
|
-
* @async
|
|
13
|
-
* @param {StorageUploadDataPayload} data - The data to calculate the checksum for.
|
|
14
|
-
* @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.
|
|
15
|
-
* @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum
|
|
16
|
-
* and the number of chunks, separated by a hyphen.
|
|
17
|
-
*/
|
|
18
|
-
const getCombinedCrc32 = async (data, size) => {
|
|
19
|
-
const crc32List = [];
|
|
20
|
-
const dataChunker = getDataChunker(data, size);
|
|
21
|
-
let totalLength = 0;
|
|
22
|
-
for (const { data: checkData } of dataChunker) {
|
|
23
|
-
const checksum = new Uint8Array((await calculateContentCRC32(checkData)).checksumArrayBuffer);
|
|
24
|
-
totalLength += checksum.length;
|
|
25
|
-
crc32List.push(checksum);
|
|
26
|
-
}
|
|
27
|
-
// Combine all Uint8Arrays into a single Uint8Array
|
|
28
|
-
const combinedArray = new Uint8Array(totalLength);
|
|
29
|
-
let offset = 0;
|
|
30
|
-
for (const crc32Hash of crc32List) {
|
|
31
|
-
combinedArray.set(crc32Hash, offset);
|
|
32
|
-
offset += crc32Hash.length;
|
|
33
|
-
}
|
|
34
|
-
return `${(await calculateContentCRC32(combinedArray.buffer)).checksum}-${crc32List.length}`;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export { getCombinedCrc32 };
|
|
38
|
-
//# sourceMappingURL=getCombinedCrc32.native.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCombinedCrc32.native.mjs","sources":["../../../../../src/providers/s3/utils/getCombinedCrc32.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getDataChunker } from '../apis/internal/uploadData/multipart/getDataChunker';\nimport { calculateContentCRC32 } from './crc32';\n/**\n * Calculates a combined CRC32 checksum for the given data.\n *\n * This function chunks the input data, calculates CRC32 for each chunk,\n * and then combines these checksums into a single value.\n *\n * @async\n * @param {StorageUploadDataPayload} data - The data to calculate the checksum for.\n * @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.\n * @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum\n * and the number of chunks, separated by a hyphen.\n */\nexport const getCombinedCrc32 = async (data, size) => {\n const crc32List = [];\n const dataChunker = getDataChunker(data, size);\n let totalLength = 0;\n for (const { data: checkData } of dataChunker) {\n const checksum = new Uint8Array((await calculateContentCRC32(checkData)).checksumArrayBuffer);\n totalLength += checksum.length;\n crc32List.push(checksum);\n }\n // Combine all Uint8Arrays into a single Uint8Array\n const combinedArray = new Uint8Array(totalLength);\n let offset = 0;\n for (const crc32Hash of crc32List) {\n combinedArray.set(crc32Hash, offset);\n offset += crc32Hash.length;\n }\n return `${(await calculateContentCRC32(combinedArray.buffer)).checksum}-${crc32List.length}`;\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,OAAO,IAAI,EAAE,IAAI,KAAK;AACtD,IAAI,MAAM,SAAS,GAAG,EAAE;AACxB,IAAI,MAAM,WAAW,GAAG,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC;AAClD,IAAI,IAAI,WAAW,GAAG,CAAC;AACvB,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,WAAW,EAAE;AACnD,QAAQ,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,CAAC,MAAM,qBAAqB,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC;AACrG,QAAQ,WAAW,IAAI,QAAQ,CAAC,MAAM;AACtC,QAAQ,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;AAChC;AACA;AACA,IAAI,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC;AACrD,IAAI,IAAI,MAAM,GAAG,CAAC;AAClB,IAAI,KAAK,MAAM,SAAS,IAAI,SAAS,EAAE;AACvC,QAAQ,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC;AAC5C,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AAClC;AACA,IAAI,OAAO,CAAC,EAAE,CAAC,MAAM,qBAAqB,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;AAChG;;;;"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { StorageUploadDataPayload } from '../../../types';
|
|
5
|
-
import { getDataChunker } from '../apis/internal/uploadData/multipart/getDataChunker';
|
|
6
|
-
|
|
7
|
-
import { calculateContentCRC32 } from './crc32';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Calculates a combined CRC32 checksum for the given data.
|
|
11
|
-
*
|
|
12
|
-
* This function chunks the input data, calculates CRC32 for each chunk,
|
|
13
|
-
* and then combines these checksums into a single value.
|
|
14
|
-
*
|
|
15
|
-
* @async
|
|
16
|
-
* @param {StorageUploadDataPayload} data - The data to calculate the checksum for.
|
|
17
|
-
* @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.
|
|
18
|
-
* @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum
|
|
19
|
-
* and the number of chunks, separated by a hyphen.
|
|
20
|
-
*/
|
|
21
|
-
export const getCombinedCrc32 = async (
|
|
22
|
-
data: StorageUploadDataPayload,
|
|
23
|
-
size: number | undefined,
|
|
24
|
-
) => {
|
|
25
|
-
const crc32List: Uint8Array[] = [];
|
|
26
|
-
const dataChunker = getDataChunker(data, size);
|
|
27
|
-
|
|
28
|
-
let totalLength = 0;
|
|
29
|
-
for (const { data: checkData } of dataChunker) {
|
|
30
|
-
const checksum = new Uint8Array(
|
|
31
|
-
(await calculateContentCRC32(checkData)).checksumArrayBuffer,
|
|
32
|
-
);
|
|
33
|
-
totalLength += checksum.length;
|
|
34
|
-
crc32List.push(checksum);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Combine all Uint8Arrays into a single Uint8Array
|
|
38
|
-
const combinedArray = new Uint8Array(totalLength);
|
|
39
|
-
let offset = 0;
|
|
40
|
-
for (const crc32Hash of crc32List) {
|
|
41
|
-
combinedArray.set(crc32Hash, offset);
|
|
42
|
-
offset += crc32Hash.length;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return `${(await calculateContentCRC32(combinedArray.buffer)).checksum}-${crc32List.length}`;
|
|
46
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { StorageUploadDataPayload } from '../../../types';
|
|
5
|
-
import { getDataChunker } from '../apis/internal/uploadData/multipart/getDataChunker';
|
|
6
|
-
|
|
7
|
-
import { calculateContentCRC32 } from './crc32';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Calculates a combined CRC32 checksum for the given data.
|
|
11
|
-
*
|
|
12
|
-
* This function chunks the input data, calculates CRC32 for each chunk,
|
|
13
|
-
* and then combines these checksums into a single value.
|
|
14
|
-
*
|
|
15
|
-
* @async
|
|
16
|
-
* @param {StorageUploadDataPayload} data - The data to calculate the checksum for.
|
|
17
|
-
* @param {number | undefined} size - The size of each chunk. If undefined, a default chunk size will be used.
|
|
18
|
-
* @returns {Promise<string>} A promise that resolves to a string containing the combined CRC32 checksum
|
|
19
|
-
* and the number of chunks, separated by a hyphen.
|
|
20
|
-
*/
|
|
21
|
-
export const getCombinedCrc32 = async (
|
|
22
|
-
data: StorageUploadDataPayload,
|
|
23
|
-
size: number | undefined,
|
|
24
|
-
) => {
|
|
25
|
-
const crc32List: ArrayBuffer[] = [];
|
|
26
|
-
const dataChunker = getDataChunker(data, size);
|
|
27
|
-
for (const { data: checkData } of dataChunker) {
|
|
28
|
-
const { checksumArrayBuffer } = await calculateContentCRC32(checkData);
|
|
29
|
-
|
|
30
|
-
crc32List.push(checksumArrayBuffer);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return `${(await calculateContentCRC32(new Blob(crc32List))).checksum}-${crc32List.length}`;
|
|
34
|
-
};
|