@aws-amplify/storage 6.6.7 → 6.6.8-unstable.555defc.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.
@@ -8,18 +8,8 @@ const md5_js_1 = require("@smithy/md5-js");
8
8
  const utils_1 = require("./client/utils");
9
9
  const calculateContentMd5 = async (content) => {
10
10
  const hasher = new md5_js_1.Md5();
11
- if (typeof content === 'string') {
12
- hasher.update(content);
13
- }
14
- else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {
15
- const blob = new Blob([content]);
16
- const buffer = await readFile(blob);
17
- hasher.update(buffer);
18
- }
19
- else {
20
- const buffer = await readFile(content);
21
- hasher.update(buffer);
22
- }
11
+ const buffer = content instanceof Blob ? await readFile(content) : content;
12
+ hasher.update(buffer);
23
13
  const digest = await hasher.digest();
24
14
  return (0, utils_1.toBase64)(digest);
25
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"md5.js","sources":["../../../../../src/providers/s3/utils/md5.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.calculateContentMd5 = void 0;\nconst md5_js_1 = require(\"@smithy/md5-js\");\nconst utils_1 = require(\"./client/utils\");\nconst calculateContentMd5 = async (content) => {\n const hasher = new md5_js_1.Md5();\n if (typeof content === 'string') {\n hasher.update(content);\n }\n else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {\n const blob = new Blob([content]);\n const buffer = await readFile(blob);\n hasher.update(buffer);\n }\n else {\n const buffer = await readFile(content);\n hasher.update(buffer);\n }\n const digest = await hasher.digest();\n return (0, utils_1.toBase64)(digest);\n};\nexports.calculateContentMd5 = calculateContentMd5;\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n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M,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC5D,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;AACpC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAC1C,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;;"}
1
+ {"version":3,"file":"md5.js","sources":["../../../../../src/providers/s3/utils/md5.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.calculateContentMd5 = void 0;\nconst md5_js_1 = require(\"@smithy/md5-js\");\nconst utils_1 = require(\"./client/utils\");\nconst calculateContentMd5 = async (content) => {\n const hasher = new md5_js_1.Md5();\n const buffer = content instanceof Blob ? await readFile(content) : content;\n hasher.update(buffer);\n const digest = await hasher.digest();\n return (0, utils_1.toBase64)(digest);\n};\nexports.calculateContentMd5 = calculateContentMd5;\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n reader.readAsArrayBuffer(file);\n});\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO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,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;;"}
@@ -12,18 +12,8 @@ const utils_1 = require("./client/utils");
12
12
  // TODO: This file should be removable when we drop support for React Native 0.71
13
13
  const calculateContentMd5 = async (content) => {
14
14
  const hasher = new md5_js_1.Md5();
15
- if (typeof content === 'string') {
16
- hasher.update(content);
17
- }
18
- else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {
19
- const blob = new Blob([content]);
20
- const buffer = await readFile(blob);
21
- hasher.update(buffer);
22
- }
23
- else {
24
- const buffer = await readFile(content);
25
- hasher.update(buffer);
26
- }
15
+ const buffer = content instanceof Blob ? await readFile(content) : content;
16
+ hasher.update(buffer);
27
17
  const digest = await hasher.digest();
28
18
  return (0, utils_1.toBase64)(digest);
29
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"md5.native.js","sources":["../../../../../src/providers/s3/utils/md5.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.calculateContentMd5 = void 0;\nconst buffer_1 = require(\"buffer\");\nconst md5_js_1 = require(\"@smithy/md5-js\");\nconst utils_1 = require(\"./client/utils\");\n// The FileReader in React Native 0.71 did not support `readAsArrayBuffer`. This native implementation accomodates this\n// by attempting to use `readAsArrayBuffer` and changing the file reading strategy if it throws an error.\n// TODO: This file should be removable when we drop support for React Native 0.71\nconst calculateContentMd5 = async (content) => {\n const hasher = new md5_js_1.Md5();\n if (typeof content === 'string') {\n hasher.update(content);\n }\n else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {\n const blob = new Blob([content]);\n const buffer = await readFile(blob);\n hasher.update(buffer);\n }\n else {\n const buffer = await readFile(content);\n hasher.update(buffer);\n }\n const digest = await hasher.digest();\n return (0, utils_1.toBase64)(digest);\n};\nexports.calculateContentMd5 = calculateContentMd5;\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n try {\n reader.readAsArrayBuffer(file);\n }\n catch (e) {\n reader.onload = () => {\n // reference: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL\n // response from readAsDataURL is always prepended with \"data:*/*;base64,\"\n const [, base64Data] = reader.result.split(',');\n const arrayBuffer = buffer_1.Buffer.from(base64Data, 'base64');\n resolve(arrayBuffer);\n };\n reader.readAsDataURL(file);\n }\n});\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,mBAAmB,GAAG,KAAK,CAAC,CAAC;AACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1C;AACA;AACA;AACA,MAAM,mBAAmB,GAAG,OAAO,OAAO,KAAK;AAC/C,IAAI,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC;AACtC,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AACrC,QAAQ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC/B,KAAK;AACL,SAAS,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,OAAO,YAAY,WAAW,EAAE;AAC5E,QAAQ,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACzC,QAAQ,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5C,QAAQ,MAAM,CAAC,MAAM,C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E,QAAQ,CAAC,CAAC;AAC3E,YAAY,OAAO,CAAC,WAAW,CAAC,CAAC;AACjC,SAAS,CAAC;AACV,QAAQ,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACnC,KAAK;AACL,CAAC,CAAC;;"}
1
+ {"version":3,"file":"md5.native.js","sources":["../../../../../src/providers/s3/utils/md5.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.calculateContentMd5 = void 0;\nconst buffer_1 = require(\"buffer\");\nconst md5_js_1 = require(\"@smithy/md5-js\");\nconst utils_1 = require(\"./client/utils\");\n// The FileReader in React Native 0.71 did not support `readAsArrayBuffer`. This native implementation accomodates this\n// by attempting to use `readAsArrayBuffer` and changing the file reading strategy if it throws an error.\n// TODO: This file should be removable when we drop support for React Native 0.71\nconst calculateContentMd5 = async (content) => {\n const hasher = new md5_js_1.Md5();\n const buffer = content instanceof Blob ? await readFile(content) : content;\n hasher.update(buffer);\n const digest = await hasher.digest();\n return (0, utils_1.toBase64)(digest);\n};\nexports.calculateContentMd5 = calculateContentMd5;\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n try {\n reader.readAsArrayBuffer(file);\n }\n catch (e) {\n reader.onload = () => {\n // reference: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL\n // response from readAsDataURL is always prepended with \"data:*/*;base64,\"\n const [, base64Data] = reader.result.split(',');\n const arrayBuffer = buffer_1.Buffer.from(base64Data, 'base64');\n resolve(arrayBuffer);\n };\n reader.readAsDataURL(file);\n }\n});\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE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CAAC;AAC7B,KAAK,CAAC;AACN,IAAI,IAAI;AACR,QAAQ,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACvC,KAAK;AACL,IAAI,OAAO,CAAC,EAAE;AACd,QAAQ,MAAM,CAAC,MAAM,GAAG,MAAM;AAC9B;AACA;AACA,YAAY,MAAM,GAAG,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5D,YAAY,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC3E,YAAY,OAAO,CAAC,WAAW,CAAC,CAAC;AACjC,SAAS,CAAC;AACV,QAAQ,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACnC,KAAK;AACL,CAAC,CAAC;;"}
@@ -10,18 +10,8 @@ import '@aws-amplify/core/internals/utils';
10
10
  // SPDX-License-Identifier: Apache-2.0
11
11
  const calculateContentMd5 = async (content) => {
12
12
  const hasher = new Md5();
13
- if (typeof content === 'string') {
14
- hasher.update(content);
15
- }
16
- else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {
17
- const blob = new Blob([content]);
18
- const buffer = await readFile(blob);
19
- hasher.update(buffer);
20
- }
21
- else {
22
- const buffer = await readFile(content);
23
- hasher.update(buffer);
24
- }
13
+ const buffer = content instanceof Blob ? await readFile(content) : content;
14
+ hasher.update(buffer);
25
15
  const digest = await hasher.digest();
26
16
  return toBase64(digest);
27
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"md5.mjs","sources":["../../../../../src/providers/s3/utils/md5.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Md5 } from '@smithy/md5-js';\nimport { toBase64 } from './client/utils';\nexport const calculateContentMd5 = async (content) => {\n const hasher = new Md5();\n if (typeof content === 'string') {\n hasher.update(content);\n }\n else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {\n const blob = new Blob([content]);\n const buffer = await readFile(blob);\n hasher.update(buffer);\n }\n else {\n const buffer = await readFile(content);\n hasher.update(buffer);\n }\n const digest = await hasher.digest();\n return toBase64(digest);\n};\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n reader.readAsArrayBuffer(file);\n});\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAGY,MAAC,mBAAmB,GAAG,OAAO,OAAO,KAAK;AACtD,IAAI,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;AAC7B,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AACrC,QAAQ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC/B,KAAK;AACL,SAAS,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,OAAO,YAAY,WAAW,EAAE;AAC5E,QAAQ,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACzC,QAAQ,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5C,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC9B,KAAK;AACL,SAAS;AACT,QAAQ,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC/C,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;AACzC,IAAI,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC5B,EAAE;AACF,MAAM,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC5D,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;AACpC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAC1C,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"md5.mjs","sources":["../../../../../src/providers/s3/utils/md5.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Md5 } from '@smithy/md5-js';\nimport { toBase64 } from './client/utils';\nexport const calculateContentMd5 = async (content) => {\n const hasher = new Md5();\n const buffer = content instanceof Blob ? await readFile(content) : content;\n hasher.update(buffer);\n const digest = await hasher.digest();\n return toBase64(digest);\n};\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n reader.readAsArrayBuffer(file);\n});\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAGY,MAAC,mBAAmB,GAAG,OAAO,OAAO,KAAK;AACtD,IAAI,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;AAC7B,IAAI,MAAM,MAAM,GAAG,OAAO,YAAY,IAAI,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAC/E,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC1B,IAAI,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;AACzC,IAAI,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC5B,EAAE;AACF,MAAM,QAAQ,GAAG,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK;AAC5D,IAAI,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;AACpC,IAAI,MAAM,CAAC,MAAM,GAAG,MAAM;AAC1B,QAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC/B,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAC1C,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,OAAO,GAAG,MAAM;AAC3B,QAAQ,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC7B,KAAK,CAAC;AACN,IAAI,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;;;;"}
@@ -14,18 +14,8 @@ import '@aws-amplify/core/internals/utils';
14
14
  // TODO: This file should be removable when we drop support for React Native 0.71
15
15
  const calculateContentMd5 = async (content) => {
16
16
  const hasher = new Md5();
17
- if (typeof content === 'string') {
18
- hasher.update(content);
19
- }
20
- else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {
21
- const blob = new Blob([content]);
22
- const buffer = await readFile(blob);
23
- hasher.update(buffer);
24
- }
25
- else {
26
- const buffer = await readFile(content);
27
- hasher.update(buffer);
28
- }
17
+ const buffer = content instanceof Blob ? await readFile(content) : content;
18
+ hasher.update(buffer);
29
19
  const digest = await hasher.digest();
30
20
  return toBase64(digest);
31
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"md5.native.mjs","sources":["../../../../../src/providers/s3/utils/md5.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Buffer } from 'buffer';\nimport { Md5 } from '@smithy/md5-js';\nimport { toBase64 } from './client/utils';\n// The FileReader in React Native 0.71 did not support `readAsArrayBuffer`. This native implementation accomodates this\n// by attempting to use `readAsArrayBuffer` and changing the file reading strategy if it throws an error.\n// TODO: This file should be removable when we drop support for React Native 0.71\nexport const calculateContentMd5 = async (content) => {\n const hasher = new Md5();\n if (typeof content === 'string') {\n hasher.update(content);\n }\n else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {\n const blob = new Blob([content]);\n const buffer = await readFile(blob);\n hasher.update(buffer);\n }\n else {\n const buffer = await readFile(content);\n hasher.update(buffer);\n }\n const digest = await hasher.digest();\n return toBase64(digest);\n};\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n try {\n reader.readAsArrayBuffer(file);\n }\n catch (e) {\n reader.onload = () => {\n // reference: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL\n // response from readAsDataURL is always prepended with \"data:*/*;base64,\"\n const [, base64Data] = reader.result.split(',');\n const arrayBuffer = Buffer.from(base64Data, 'base64');\n resolve(arrayBuffer);\n };\n reader.readAsDataURL(file);\n }\n});\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAIA;AACA;AACA;AACY,MAAC,mBAAmB,GAAG,OAAO,OAAO,KAAK;AACtD,IAAI,MAAM,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;AAC7B,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;AACrC,QAAQ,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC/B,KAAK;AACL,SAAS,IAAI,WAA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A;AACA,YAAY,MAAM,GAAG,UAAU,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5D,YAAY,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAClE,YAAY,OAAO,CAAC,WAAW,CAAC,CAAC;AACjC,SAAS,CAAC;AACV,QAAQ,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACnC,KAAK;AACL,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"md5.native.mjs","sources":["../../../../../src/providers/s3/utils/md5.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Buffer } from 'buffer';\nimport { Md5 } from '@smithy/md5-js';\nimport { toBase64 } from './client/utils';\n// The FileReader in React Native 0.71 did not support `readAsArrayBuffer`. This native implementation accomodates this\n// by attempting to use `readAsArrayBuffer` and changing the file reading strategy if it throws an error.\n// TODO: This file should be removable when we drop support for React Native 0.71\nexport const calculateContentMd5 = async (content) => {\n const hasher = new Md5();\n const buffer = content instanceof Blob ? await readFile(content) : content;\n hasher.update(buffer);\n const digest = await hasher.digest();\n return toBase64(digest);\n};\nconst readFile = (file) => new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result);\n };\n reader.onabort = () => {\n reject(new Error('Read aborted'));\n };\n reader.onerror = () => {\n reject(reader.error);\n };\n try {\n reader.readAsArrayBuffer(file);\n }\n catch (e) {\n reader.onload = () => {\n // reference: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL\n // response from readAsDataURL is always prepended with \"data:*/*;base64,\"\n const [, base64Data] = reader.result.split(',');\n const arrayBuffer = Buffer.from(base64Data, 'base64');\n resolve(arrayBuffer);\n };\n reader.readAsDataURL(file);\n }\n});\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAIA;AACA;AACA;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,CAAC,CAAC;AAClE,YAAY,OAAO,CAAC,WAAW,CAAC,CAAC;AACjC,SAAS,CAAC;AACV,QAAQ,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACnC,KAAK;AACL,CAAC,CAAC;;;;"}
package/package.json CHANGED
@@ -1,109 +1,109 @@
1
1
  {
2
- "name": "@aws-amplify/storage",
3
- "version": "6.6.7",
4
- "description": "Storage category of aws-amplify",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.mjs",
7
- "react-native": {
8
- "./dist/cjs/index": "./src/index.ts",
9
- "fast-xml-parser": "fast-xml-parser",
10
- "buffer": "buffer"
11
- },
12
- "typings": "./dist/esm/index.d.ts",
13
- "browser": {
14
- "./dist/esm/providers/s3/utils/client/runtime/base64/index.native.mjs": "./dist/esm/providers/s3/utils/client/runtime/base64/index.browser.mjs",
15
- "./dist/esm/providers/s3/utils/client/runtime/s3TransferHandler/fetch.mjs": "./dist/esm/providers/s3/utils/client/runtime/s3TransferHandler/xhr.mjs",
16
- "./dist/esm/providers/s3/utils/client/runtime/xmlParser/pureJs.mjs": "./dist/esm/providers/s3/utils/client/runtime/xmlParser/dom.mjs",
17
- "fast-xml-parser": false,
18
- "buffer": false
19
- },
20
- "sideEffects": false,
21
- "publishConfig": {
22
- "access": "public"
23
- },
24
- "scripts": {
25
- "test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
26
- "build-with-test": "npm test && npm run build",
27
- "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
28
- "build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
29
- "build:watch": "npm run build:esm-cjs -- --watch",
30
- "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
31
- "clean": "npm run clean:size && rimraf lib-esm lib dist",
32
- "clean:size": "rimraf dual-publish-tmp tmp*",
33
- "format": "echo \"Not implemented\"",
34
- "lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
35
- "lint:fix": "eslint '**/*.{ts,tsx}' --fix",
36
- "ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 90.31"
37
- },
38
- "typesVersions": {
39
- ">=4.2": {
40
- "s3": [
41
- "./dist/esm/providers/s3/index.d.ts"
42
- ],
43
- "server": [
44
- "./dist/esm/server.d.ts"
45
- ],
46
- "s3/server": [
47
- "./dist/esm/providers/s3/server.d.ts"
48
- ]
49
- }
50
- },
51
- "repository": {
52
- "type": "git",
53
- "url": "https://github.com/aws-amplify/amplify-js.git"
54
- },
55
- "author": "Amazon Web Services",
56
- "license": "Apache-2.0",
57
- "bugs": {
58
- "url": "https://github.com/aws/aws-amplify/issues"
59
- },
60
- "homepage": "https://aws-amplify.github.io/",
61
- "files": [
62
- "dist/cjs",
63
- "dist/esm",
64
- "src",
65
- "server",
66
- "s3"
67
- ],
68
- "dependencies": {
69
- "@aws-sdk/types": "3.398.0",
70
- "@smithy/md5-js": "2.0.7",
71
- "buffer": "4.9.2",
72
- "fast-xml-parser": "^4.4.1",
73
- "tslib": "^2.5.0"
74
- },
75
- "exports": {
76
- ".": {
77
- "types": "./dist/esm/index.d.ts",
78
- "import": "./dist/esm/index.mjs",
79
- "require": "./dist/cjs/index.js",
80
- "react-native": "./src/index.ts"
81
- },
82
- "./server": {
83
- "types": "./dist/esm/server.d.ts",
84
- "import": "./dist/esm/server.mjs",
85
- "require": "./dist/cjs/server.js"
86
- },
87
- "./s3": {
88
- "types": "./dist/esm/providers/s3/index.d.ts",
89
- "import": "./dist/esm/providers/s3/index.mjs",
90
- "require": "./dist/cjs/providers/s3/index.js",
91
- "react-native": "./src/providers/s3/index.ts"
92
- },
93
- "./s3/server": {
94
- "types": "./dist/esm/providers/s3/server.d.ts",
95
- "import": "./dist/esm/providers/s3/server.mjs",
96
- "require": "./dist/cjs/providers/s3/server.js"
97
- },
98
- "./package.json": "./package.json"
99
- },
100
- "peerDependencies": {
101
- "@aws-amplify/core": "^6.1.0"
102
- },
103
- "devDependencies": {
104
- "@aws-amplify/core": "6.4.2",
105
- "@aws-amplify/react-native": "1.1.5",
106
- "typescript": "5.0.2"
107
- },
108
- "gitHead": "716cc95cb08bc1e700b3f57752457be28d18e4fd"
2
+ "name": "@aws-amplify/storage",
3
+ "version": "6.6.8-unstable.555defc.0+555defc",
4
+ "description": "Storage category of aws-amplify",
5
+ "main": "./dist/cjs/index.js",
6
+ "module": "./dist/esm/index.mjs",
7
+ "react-native": {
8
+ "./dist/cjs/index": "./src/index.ts",
9
+ "fast-xml-parser": "fast-xml-parser",
10
+ "buffer": "buffer"
11
+ },
12
+ "typings": "./dist/esm/index.d.ts",
13
+ "browser": {
14
+ "./dist/esm/providers/s3/utils/client/runtime/base64/index.native.mjs": "./dist/esm/providers/s3/utils/client/runtime/base64/index.browser.mjs",
15
+ "./dist/esm/providers/s3/utils/client/runtime/s3TransferHandler/fetch.mjs": "./dist/esm/providers/s3/utils/client/runtime/s3TransferHandler/xhr.mjs",
16
+ "./dist/esm/providers/s3/utils/client/runtime/xmlParser/pureJs.mjs": "./dist/esm/providers/s3/utils/client/runtime/xmlParser/dom.mjs",
17
+ "fast-xml-parser": false,
18
+ "buffer": false
19
+ },
20
+ "sideEffects": false,
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
26
+ "build-with-test": "npm test && npm run build",
27
+ "build:umd": "webpack && webpack --config ./webpack.config.dev.js",
28
+ "build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
29
+ "build:watch": "npm run build:esm-cjs -- --watch",
30
+ "build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
31
+ "clean": "npm run clean:size && rimraf lib-esm lib dist",
32
+ "clean:size": "rimraf dual-publish-tmp tmp*",
33
+ "format": "echo \"Not implemented\"",
34
+ "lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
35
+ "lint:fix": "eslint '**/*.{ts,tsx}' --fix",
36
+ "ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 90.31"
37
+ },
38
+ "typesVersions": {
39
+ ">=4.2": {
40
+ "s3": [
41
+ "./dist/esm/providers/s3/index.d.ts"
42
+ ],
43
+ "server": [
44
+ "./dist/esm/server.d.ts"
45
+ ],
46
+ "s3/server": [
47
+ "./dist/esm/providers/s3/server.d.ts"
48
+ ]
49
+ }
50
+ },
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "https://github.com/aws-amplify/amplify-js.git"
54
+ },
55
+ "author": "Amazon Web Services",
56
+ "license": "Apache-2.0",
57
+ "bugs": {
58
+ "url": "https://github.com/aws/aws-amplify/issues"
59
+ },
60
+ "homepage": "https://aws-amplify.github.io/",
61
+ "files": [
62
+ "dist/cjs",
63
+ "dist/esm",
64
+ "src",
65
+ "server",
66
+ "s3"
67
+ ],
68
+ "dependencies": {
69
+ "@aws-sdk/types": "3.398.0",
70
+ "@smithy/md5-js": "2.0.7",
71
+ "buffer": "4.9.2",
72
+ "fast-xml-parser": "^4.4.1",
73
+ "tslib": "^2.5.0"
74
+ },
75
+ "exports": {
76
+ ".": {
77
+ "types": "./dist/esm/index.d.ts",
78
+ "import": "./dist/esm/index.mjs",
79
+ "require": "./dist/cjs/index.js",
80
+ "react-native": "./src/index.ts"
81
+ },
82
+ "./server": {
83
+ "types": "./dist/esm/server.d.ts",
84
+ "import": "./dist/esm/server.mjs",
85
+ "require": "./dist/cjs/server.js"
86
+ },
87
+ "./s3": {
88
+ "types": "./dist/esm/providers/s3/index.d.ts",
89
+ "import": "./dist/esm/providers/s3/index.mjs",
90
+ "require": "./dist/cjs/providers/s3/index.js",
91
+ "react-native": "./src/providers/s3/index.ts"
92
+ },
93
+ "./s3/server": {
94
+ "types": "./dist/esm/providers/s3/server.d.ts",
95
+ "import": "./dist/esm/providers/s3/server.mjs",
96
+ "require": "./dist/cjs/providers/s3/server.js"
97
+ },
98
+ "./package.json": "./package.json"
99
+ },
100
+ "peerDependencies": {
101
+ "@aws-amplify/core": "6.4.3-unstable.555defc.0+555defc"
102
+ },
103
+ "devDependencies": {
104
+ "@aws-amplify/core": "6.4.3-unstable.555defc.0+555defc",
105
+ "@aws-amplify/react-native": "1.1.6-unstable.555defc.0+555defc",
106
+ "typescript": "5.0.2"
107
+ },
108
+ "gitHead": "555defc9b9915db513a58ffe642ebbd1d6adb9e0"
109
109
  }
@@ -14,16 +14,8 @@ export const calculateContentMd5 = async (
14
14
  content: Blob | string | ArrayBuffer | ArrayBufferView,
15
15
  ): Promise<string> => {
16
16
  const hasher = new Md5();
17
- if (typeof content === 'string') {
18
- hasher.update(content);
19
- } else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {
20
- const blob = new Blob([content]);
21
- const buffer = await readFile(blob);
22
- hasher.update(buffer);
23
- } else {
24
- const buffer = await readFile(content);
25
- hasher.update(buffer);
26
- }
17
+ const buffer = content instanceof Blob ? await readFile(content) : content;
18
+ hasher.update(buffer);
27
19
  const digest = await hasher.digest();
28
20
 
29
21
  return toBase64(digest);
@@ -9,16 +9,8 @@ export const calculateContentMd5 = async (
9
9
  content: Blob | string | ArrayBuffer | ArrayBufferView,
10
10
  ): Promise<string> => {
11
11
  const hasher = new Md5();
12
- if (typeof content === 'string') {
13
- hasher.update(content);
14
- } else if (ArrayBuffer.isView(content) || content instanceof ArrayBuffer) {
15
- const blob = new Blob([content]);
16
- const buffer = await readFile(blob);
17
- hasher.update(buffer);
18
- } else {
19
- const buffer = await readFile(content);
20
- hasher.update(buffer);
21
- }
12
+ const buffer = content instanceof Blob ? await readFile(content) : content;
13
+ hasher.update(buffer);
22
14
  const digest = await hasher.digest();
23
15
 
24
16
  return toBase64(digest);