@aws-amplify/storage 6.10.2-unstable.f59a4f7.0 → 6.11.1-unstable.a9e970f.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.
Files changed (29) hide show
  1. package/dist/cjs/providers/s3/apis/internal/downloadData.js +1 -0
  2. package/dist/cjs/providers/s3/apis/internal/downloadData.js.map +1 -1
  3. package/dist/cjs/providers/s3/apis/internal/getUrl.js +1 -0
  4. package/dist/cjs/providers/s3/apis/internal/getUrl.js.map +1 -1
  5. package/dist/cjs/providers/s3/apis/internal/uploadData/putObjectJob.js +2 -1
  6. package/dist/cjs/providers/s3/apis/internal/uploadData/putObjectJob.js.map +1 -1
  7. package/dist/cjs/providers/s3/utils/client/s3data/getObject.js +4 -5
  8. package/dist/cjs/providers/s3/utils/client/s3data/getObject.js.map +1 -1
  9. package/dist/cjs/providers/s3/utils/client/s3data/headObject.js +3 -0
  10. package/dist/cjs/providers/s3/utils/client/s3data/headObject.js.map +1 -1
  11. package/dist/esm/providers/s3/apis/internal/downloadData.mjs +1 -0
  12. package/dist/esm/providers/s3/apis/internal/downloadData.mjs.map +1 -1
  13. package/dist/esm/providers/s3/apis/internal/getUrl.mjs +1 -0
  14. package/dist/esm/providers/s3/apis/internal/getUrl.mjs.map +1 -1
  15. package/dist/esm/providers/s3/apis/internal/uploadData/putObjectJob.mjs +2 -1
  16. package/dist/esm/providers/s3/apis/internal/uploadData/putObjectJob.mjs.map +1 -1
  17. package/dist/esm/providers/s3/types/options.d.ts +17 -1
  18. package/dist/esm/providers/s3/utils/client/s3data/getObject.d.ts +1 -1
  19. package/dist/esm/providers/s3/utils/client/s3data/getObject.mjs +5 -7
  20. package/dist/esm/providers/s3/utils/client/s3data/getObject.mjs.map +1 -1
  21. package/dist/esm/providers/s3/utils/client/s3data/headObject.mjs +4 -1
  22. package/dist/esm/providers/s3/utils/client/s3data/headObject.mjs.map +1 -1
  23. package/package.json +5 -5
  24. package/src/providers/s3/apis/internal/downloadData.ts +1 -0
  25. package/src/providers/s3/apis/internal/getUrl.ts +1 -0
  26. package/src/providers/s3/apis/internal/uploadData/putObjectJob.ts +2 -0
  27. package/src/providers/s3/types/options.ts +17 -1
  28. package/src/providers/s3/utils/client/s3data/getObject.ts +6 -7
  29. package/src/providers/s3/utils/client/s3data/headObject.ts +7 -1
@@ -41,6 +41,7 @@ const downloadDataJob = (downloadDataInput, abortSignal) => async () => {
41
41
  ...(downloadDataOptions?.bytesRange && {
42
42
  Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,
43
43
  }),
44
+ ResponseCacheControl: downloadDataOptions?.cacheControl,
44
45
  ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,
45
46
  });
46
47
  const result = {
@@ -1 +1 @@
1
- {"version":3,"file":"downloadData.js","sources":["../../../../../../src/providers/s3/apis/internal/downloadData.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.downloadData = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst resolveS3ConfigAndInput_1 = require(\"../../utils/resolveS3ConfigAndInput\");\nconst utils_2 = require(\"../../utils\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst downloadData = (input) => {\n const abortController = new AbortController();\n const downloadTask = (0, utils_2.createDownloadTask)({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n};\nexports.downloadData = downloadData;\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await (0, resolveS3ConfigAndInput_1.resolveS3ConfigAndInput)(core_1.Amplify, downloadDataInput);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(downloadDataInput, identityId);\n (0, utils_2.validateBucketOwnerID)(downloadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n utils_3.logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await (0, s3data_1.getObject)({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,YAAY,GAAG,MAAM;AAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,yBAAyB,GAAG,OAAO,CAAC,qCAAqC,CAAC;AAChF,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;AACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACrD,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC;AACpD,MAAM,OAAO,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E,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,GAAG,GAAG,MAAM,IAAI,QAAQ,CAAC,SAAS,EAAE;AAC3L,QAAQ,GAAG,QAAQ;AACnB,QAAQ,WAAW;AACnB,QAAQ,kBAAkB,EAAE,mBAAmB,EAAE,UAAU;AAC3D,QAAQ,cAAc,EAAE,IAAI,WAAW,CAAC,wBAAwB,EAAE,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC;AACrG,KAAK,EAAE;AACP,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,GAAG,EAAE,QAAQ;AACrB,QAAQ,IAAI,mBAAmB,EAAE,UAAU,IAAI;AAC/C,YAAY,KAAK,EAAE,CAAC,MAAM,EAAE,mBAAmB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACxG,SAAS,CAAC;AACV,QAAQ,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB;AACrE,KAAK,CAAC;AACN,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI;AACZ,QAAQ,YAAY;AACpB,QAAQ,IAAI;AACZ,QAAQ,WAAW;AACnB,QAAQ,IAAI;AACZ,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK;AACL,IAAI,OAAO,SAAS,KAAK,WAAW,CAAC;AACrC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM;AACrC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACxC,CAAC;;"}
1
+ {"version":3,"file":"downloadData.js","sources":["../../../../../../src/providers/s3/apis/internal/downloadData.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.downloadData = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst resolveS3ConfigAndInput_1 = require(\"../../utils/resolveS3ConfigAndInput\");\nconst utils_2 = require(\"../../utils\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst userAgent_1 = require(\"../../utils/userAgent\");\nconst utils_3 = require(\"../../../../utils\");\nconst constants_1 = require(\"../../utils/constants\");\nconst downloadData = (input) => {\n const abortController = new AbortController();\n const downloadTask = (0, utils_2.createDownloadTask)({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n};\nexports.downloadData = downloadData;\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await (0, resolveS3ConfigAndInput_1.resolveS3ConfigAndInput)(core_1.Amplify, downloadDataInput);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(downloadDataInput, identityId);\n (0, utils_2.validateBucketOwnerID)(downloadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n utils_3.logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await (0, s3data_1.getObject)({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n ResponseCacheControl: downloadDataOptions?.cacheControl,\n ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,YAAY,GAAG,MAAM;AAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,yBAAyB,GAAG,OAAO,CAAC,qCAAqC,CAAC;AAChF,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;AACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACrD,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC;AACpD,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC;AACpD,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAChC,IAAI,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE;AACjD,IAAI,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,kBAAkB,EAAE;AACzD,QAAQ,GAAG,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC;AAC3D,QAAQ,QAAQ,EAAE,CAAC,OAAO,KAAK;AAC/B,YAAY,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;AAC1C,QAAQ,CAAC;AACT,KAAK,CAAC;AACN,IAAI,OAAO,YAAY;AACvB,CAAC;AACD,OAAO,CAAC,YAAY,GAAG,YAAY;AACnC,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,WAAW,KAAK,YAAY;AACxE,IAAI,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AC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACxG,SAAS,CAAC;AACV,QAAQ,oBAAoB,EAAE,mBAAmB,EAAE,YAAY;AAC/D,QAAQ,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB;AACrE,KAAK,CAAC;AACN,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI;AACZ,QAAQ,YAAY;AACpB,QAAQ,IAAI;AACZ,QAAQ,WAAW;AACnB,QAAQ,IAAI;AACZ,QAAQ,QAAQ;AAChB,QAAQ,SAAS;AACjB,KAAK;AACL,IAAI,OAAO,SAAS,KAAK,WAAW,CAAC;AACrC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM;AACrC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACxC,CAAC;;"}
@@ -47,6 +47,7 @@ const getUrl = async (amplify, input) => {
47
47
  ...(getUrlOptions?.contentType && {
48
48
  ResponseContentType: getUrlOptions.contentType,
49
49
  }),
50
+ ResponseCacheControl: getUrlOptions?.cacheControl,
50
51
  ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,
51
52
  }),
52
53
  expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),
@@ -1 +1 @@
1
- {"version":3,"file":"getUrl.js","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.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.getUrl = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst utils_2 = require(\"../../utils\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst constants_1 = require(\"../../utils/constants\");\nconst constructContentDisposition_1 = require(\"../../utils/constructContentDisposition\");\nconst getProperties_1 = require(\"./getProperties\");\nconst getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n (0, utils_2.validateBucketOwnerID)(getUrlOptions?.expectedBucketOwner);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await (0, getProperties_1.getProperties)(amplify, input, utils_1.StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? constants_1.DEFAULT_PRESIGN_EXPIRATION;\n const resolvedCredential = typeof s3Config.credentials === 'function'\n ? await s3Config.credentials()\n : s3Config.credentials;\n const awsCredExpiration = resolvedCredential.expiration;\n if (awsCredExpiration) {\n const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);\n urlExpirationInSec = Math.min(awsCredExpirationInSec, urlExpirationInSec);\n }\n const maxUrlExpirationInSec = constants_1.MAX_URL_EXPIRATION / 1000;\n (0, assertValidationError_1.assertValidationError)(urlExpirationInSec <= maxUrlExpirationInSec, validation_1.StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await (0, s3data_1.getPresignedGetObjectUrl)({\n ...s3Config,\n credentials: resolvedCredential,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(getUrlOptions?.contentDisposition && {\n ResponseContentDisposition: (0, constructContentDisposition_1.constructContentDisposition)(getUrlOptions.contentDisposition),\n }),\n ...(getUrlOptions?.contentType && {\n ResponseContentType: getUrlOptions.contentType,\n }),\n ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\nexports.getUrl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BAAmB,EAAE,aAAa,CAAC,WAAW;AAC9D,aAAa,CAAC;AACd,YAAY,mBAAmB,EAAE,aAAa,EAAE,mBAAmB;AACnE,SAAS,CAAC;AACV,QAAQ,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,GAAG,IAAI,CAAC;AACnE,KAAK;AACL,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
1
+ {"version":3,"file":"getUrl.js","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.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.getUrl = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst validation_1 = require(\"../../../../errors/types/validation\");\nconst s3data_1 = require(\"../../utils/client/s3data\");\nconst utils_2 = require(\"../../utils\");\nconst assertValidationError_1 = require(\"../../../../errors/utils/assertValidationError\");\nconst constants_1 = require(\"../../utils/constants\");\nconst constructContentDisposition_1 = require(\"../../utils/constructContentDisposition\");\nconst getProperties_1 = require(\"./getProperties\");\nconst getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(amplify, input);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(input, identityId);\n (0, utils_2.validateBucketOwnerID)(getUrlOptions?.expectedBucketOwner);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await (0, getProperties_1.getProperties)(amplify, input, utils_1.StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? constants_1.DEFAULT_PRESIGN_EXPIRATION;\n const resolvedCredential = typeof s3Config.credentials === 'function'\n ? await s3Config.credentials()\n : s3Config.credentials;\n const awsCredExpiration = resolvedCredential.expiration;\n if (awsCredExpiration) {\n const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);\n urlExpirationInSec = Math.min(awsCredExpirationInSec, urlExpirationInSec);\n }\n const maxUrlExpirationInSec = constants_1.MAX_URL_EXPIRATION / 1000;\n (0, assertValidationError_1.assertValidationError)(urlExpirationInSec <= maxUrlExpirationInSec, validation_1.StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await (0, s3data_1.getPresignedGetObjectUrl)({\n ...s3Config,\n credentials: resolvedCredential,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(getUrlOptions?.contentDisposition && {\n ResponseContentDisposition: (0, constructContentDisposition_1.constructContentDisposition)(getUrlOptions.contentDisposition),\n }),\n ...(getUrlOptions?.contentType && {\n ResponseContentType: getUrlOptions.contentType,\n }),\n ResponseCacheControl: getUrlOptions?.cacheControl,\n ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\nexports.getUrl = getUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,MAAM,GAAG,MAAM;AACvB,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,qCAAqC,CAAC;AACnE,MAAM,QAAQ,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACrD,MAAM,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;AACtC,MAAM,uBAAuB,GAAG,OAAO,CAAC,gDAAgD,CAAC;AACzF,MAAM,WAAW,GAAG,OAAO,CAAC,uBAAuB,CAAC;AACpD,MAAM,6BAA6B,GAAG,OAAO,CAAC,yCAAyC,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AAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,kBAAkB,CAAC;AACjF,IAAI;AACJ,IAAI,MAAM,qBAAqB,GAAG,WAAW,CAAC,kBAAkB,GAAG,IAAI;AACvE,IAAI,IAAI,uBAAuB,CAAC,qBAAqB,EAAE,kBAAkB,IAAI,qBAAqB,EAAE,YAAY,CAAC,0BAA0B,CAAC,2BAA2B,CAAC;AACxK;AACA,IAAI,OAAO;AACX,QAAQ,GAAG,EAAE,MAAM,IAAI,QAAQ,CAAC,wBAAwB,EAAE;AAC1D,YAAY,GAAG,QAAQ;AACvB,YAAY,WAAW,EAAE,kBAAkB;AAC3C,YAAY,UAAU,EAAE,kBAAkB;AAC1C,SAAS,EAAE;AACX,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,GAAG,EAAE,QAAQ;AACzB,YAAY,IAAI,aAAa,EAAE,kBAAkB,IAAI;AACrD,gBAAgB,0BAA0B,EAAE,IAAI,6BAA6B,CAAC,2BAA2B,EAAE,aAAa,CAAC,kBAAkB,CAAC;AAC5I,aAAa,CAAC;AACd,YAAY,IAAI,aAAa,EAAE,WAAW,IAAI;AAC9C,gBAAgB,mBAAmB,EAAE,aAAa,CAAC,WAAW;AAC9D,aAAa,CAAC;AACd,YAAY,oBAAoB,EAAE,aAAa,EAAE,YAAY;AAC7D,YAAY,mBAAmB,EAAE,aAAa,EAAE,mBAAmB;AACnE,SAAS,CAAC;AACV,QAAQ,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,GAAG,IAAI,CAAC;AACnE,KAAK;AACL,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,MAAM;;"}
@@ -26,7 +26,7 @@ const putObjectJob = (uploadDataInput, abortSignal, totalLength) => async () =>
26
26
  const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
27
27
  const { contentDisposition, contentEncoding, contentType = uploadDataOptions?.contentType ??
28
28
  (0, contentType_1.getContentType)(data, objectKey) ??
29
- 'application/octet-stream', preventOverwrite, metadata, checksumAlgorithm, onProgress, expectedBucketOwner, } = uploadDataOptions ?? {};
29
+ 'application/octet-stream', preventOverwrite, metadata, checksumAlgorithm, onProgress, expectedBucketOwner, cacheControl, } = uploadDataOptions ?? {};
30
30
  const checksumCRC32 = checksumAlgorithm === constants_1.CHECKSUM_ALGORITHM_CRC32
31
31
  ? await (0, crc32_1.calculateContentCRC32)(data)
32
32
  : undefined;
@@ -47,6 +47,7 @@ const putObjectJob = (uploadDataInput, abortSignal, totalLength) => async () =>
47
47
  ContentType: contentType,
48
48
  ContentDisposition: (0, constructContentDisposition_1.constructContentDisposition)(contentDisposition),
49
49
  ContentEncoding: contentEncoding,
50
+ CacheControl: cacheControl,
50
51
  Metadata: metadata,
51
52
  ContentMD5: contentMD5,
52
53
  ChecksumCRC32: checksumCRC32,
@@ -1 +1 @@
1
- {"version":3,"file":"putObjectJob.js","sources":["../../../../../../../src/providers/s3/apis/internal/uploadData/putObjectJob.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.putObjectJob = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../../utils\");\nconst s3data_1 = require(\"../../../utils/client/s3data\");\nconst userAgent_1 = require(\"../../../utils/userAgent\");\nconst constants_1 = require(\"../../../utils/constants\");\nconst crc32_1 = require(\"../../../utils/crc32\");\nconst constructContentDisposition_1 = require(\"../../../utils/constructContentDisposition\");\nconst contentType_1 = require(\"../../../../../utils/contentType\");\n/**\n * Get a function the returns a promise to call putObject API to S3.\n *\n * @internal\n */\nconst putObjectJob = (uploadDataInput, abortSignal, totalLength) => async () => {\n const { options: uploadDataOptions, data } = uploadDataInput;\n const { bucket, keyPrefix, s3Config, isObjectLockEnabled, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(core_1.Amplify, uploadDataInput);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(uploadDataInput, identityId);\n (0, utils_2.validateBucketOwnerID)(uploadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n const { contentDisposition, contentEncoding, contentType = uploadDataOptions?.contentType ??\n (0, contentType_1.getContentType)(data, objectKey) ??\n 'application/octet-stream', preventOverwrite, metadata, checksumAlgorithm, onProgress, expectedBucketOwner, } = uploadDataOptions ?? {};\n const checksumCRC32 = checksumAlgorithm === constants_1.CHECKSUM_ALGORITHM_CRC32\n ? await (0, crc32_1.calculateContentCRC32)(data)\n : undefined;\n const contentMD5 = \n // check if checksum exists. ex: should not exist in react native\n !checksumCRC32 && isObjectLockEnabled\n ? await (0, utils_2.calculateContentMd5)(data)\n : undefined;\n const { ETag: eTag, VersionId: versionId } = await (0, s3data_1.putObject)({\n ...s3Config,\n abortSignal,\n onUploadProgress: onProgress,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.UploadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n Body: data,\n ContentType: contentType,\n ContentDisposition: (0, constructContentDisposition_1.constructContentDisposition)(contentDisposition),\n ContentEncoding: contentEncoding,\n Metadata: metadata,\n ContentMD5: contentMD5,\n ChecksumCRC32: checksumCRC32,\n ExpectedBucketOwner: expectedBucketOwner,\n IfNoneMatch: preventOverwrite ? '*' : undefined,\n });\n const result = {\n eTag,\n versionId,\n contentType,\n metadata,\n size: totalLength,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\nexports.putObjectJob = putObjectJob;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,C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QAAQ,SAAS;AACjB,QAAQ,WAAW;AACnB,QAAQ,QAAQ;AAChB,QAAQ,IAAI,EAAE,WAAW;AACzB,KAAK;AACL,IAAI,OAAO,SAAS,KAAK,WAAW,CAAC;AACrC,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM;AACrC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACxC,CAAC;AACD,OAAO,CAAC,YAAY,GAAG,YAAY;;"}
1
+ {"version":3,"file":"putObjectJob.js","sources":["../../../../../../../src/providers/s3/apis/internal/uploadData/putObjectJob.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.putObjectJob = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../../../utils\");\nconst s3data_1 = require(\"../../../utils/client/s3data\");\nconst userAgent_1 = require(\"../../../utils/userAgent\");\nconst constants_1 = require(\"../../../utils/constants\");\nconst crc32_1 = require(\"../../../utils/crc32\");\nconst constructContentDisposition_1 = require(\"../../../utils/constructContentDisposition\");\nconst contentType_1 = require(\"../../../../../utils/contentType\");\n/**\n * Get a function the returns a promise to call putObject API to S3.\n *\n * @internal\n */\nconst putObjectJob = (uploadDataInput, abortSignal, totalLength) => async () => {\n const { options: uploadDataOptions, data } = uploadDataInput;\n const { bucket, keyPrefix, s3Config, isObjectLockEnabled, identityId } = await (0, utils_2.resolveS3ConfigAndInput)(core_1.Amplify, uploadDataInput);\n const { inputType, objectKey } = (0, utils_2.validateStorageOperationInput)(uploadDataInput, identityId);\n (0, utils_2.validateBucketOwnerID)(uploadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === constants_1.STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n const { contentDisposition, contentEncoding, contentType = uploadDataOptions?.contentType ??\n (0, contentType_1.getContentType)(data, objectKey) ??\n 'application/octet-stream', preventOverwrite, metadata, checksumAlgorithm, onProgress, expectedBucketOwner, cacheControl, } = uploadDataOptions ?? {};\n const checksumCRC32 = checksumAlgorithm === constants_1.CHECKSUM_ALGORITHM_CRC32\n ? await (0, crc32_1.calculateContentCRC32)(data)\n : undefined;\n const contentMD5 = \n // check if checksum exists. ex: should not exist in react native\n !checksumCRC32 && isObjectLockEnabled\n ? await (0, utils_2.calculateContentMd5)(data)\n : undefined;\n const { ETag: eTag, VersionId: versionId } = await (0, s3data_1.putObject)({\n ...s3Config,\n abortSignal,\n onUploadProgress: onProgress,\n userAgentValue: (0, userAgent_1.getStorageUserAgentValue)(utils_1.StorageAction.UploadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n Body: data,\n ContentType: contentType,\n ContentDisposition: (0, constructContentDisposition_1.constructContentDisposition)(contentDisposition),\n ContentEncoding: contentEncoding,\n CacheControl: cacheControl,\n Metadata: metadata,\n ContentMD5: contentMD5,\n ChecksumCRC32: checksumCRC32,\n ExpectedBucketOwner: expectedBucketOwner,\n IfNoneMatch: preventOverwrite ? '*' : undefined,\n });\n const result = {\n eTag,\n versionId,\n contentType,\n metadata,\n size: totalLength,\n };\n return inputType === constants_1.STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\nexports.putObjectJob = putObjectJob;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,YAAY,GAAG,MAAM;AAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,8BAA8B,CAAC;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AAM;AACrC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACxC,CAAC;AACD,OAAO,CAAC,YAAY,GAAG,YAAY;;"}
@@ -17,6 +17,9 @@ const getObjectSerializer = async (input, endpoint) => {
17
17
  url.pathname = (0, utils_2.serializePathnameObjectKey)(url, input.Key);
18
18
  url.search = new utils_1.AmplifyUrlSearchParams({
19
19
  'x-id': 'GetObject',
20
+ ...(input.ResponseCacheControl && {
21
+ 'response-cache-control': input.ResponseCacheControl,
22
+ }),
20
23
  }).toString();
21
24
  (0, validateObjectUrl_1.validateObjectUrl)({
22
25
  bucketName: input.Bucket,
@@ -101,10 +104,6 @@ exports.getObject = (0, composers_1.composeServiceApi)(utils_2.s3TransferHandler
101
104
  const getPresignedGetObjectUrl = async (config, input) => {
102
105
  const endpoint = base_1.defaultConfig.endpointResolver(config, input);
103
106
  const { url, headers, method } = await getObjectSerializer(input, endpoint);
104
- // TODO: set content sha256 query parameter with value of UNSIGNED-PAYLOAD instead of empty hash.
105
- // It requires changes in presignUrl. Without this change, the generated url still works,
106
- // but not the same as other tools like AWS SDK and CLI.
107
- url.searchParams.append(utils_2.CONTENT_SHA256_HEADER, aws_client_utils_1.EMPTY_SHA256_HASH);
108
107
  if (config.userAgentValue) {
109
108
  url.searchParams.append(config.userAgentHeader ?? USER_AGENT_HEADER, config.userAgentValue);
110
109
  }
@@ -117,7 +116,7 @@ const getPresignedGetObjectUrl = async (config, input) => {
117
116
  for (const [headerName, value] of Object.entries(headers).sort(([key1], [key2]) => key1.localeCompare(key2))) {
118
117
  url.searchParams.append(headerName, value);
119
118
  }
120
- return (0, aws_client_utils_1.presignUrl)({ method, url, body: undefined }, {
119
+ return (0, aws_client_utils_1.presignUrl)({ method, url, body: aws_client_utils_1.UNSIGNED_PAYLOAD }, {
121
120
  signingService: base_1.defaultConfig.service,
122
121
  signingRegion: config.region,
123
122
  ...base_1.defaultConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"getObject.js","sources":["../../../../../../../src/providers/s3/utils/client/s3data/getObject.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.getPresignedGetObjectUrl = exports.getObject = void 0;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst composers_1 = require(\"@aws-amplify/core/internals/aws-client-utils/composers\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../utils\");\nconst validateObjectUrl_1 = require(\"../../validateObjectUrl\");\nconst base_1 = require(\"./base\");\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\nconst getObjectSerializer = async (input, endpoint) => {\n const url = new utils_1.AmplifyUrl(endpoint.url.toString());\n (0, utils_2.validateS3RequiredParameter)(!!input.Key, 'Key');\n url.pathname = (0, utils_2.serializePathnameObjectKey)(url, input.Key);\n url.search = new utils_1.AmplifyUrlSearchParams({\n 'x-id': 'GetObject',\n }).toString();\n (0, validateObjectUrl_1.validateObjectUrl)({\n bucketName: input.Bucket,\n key: input.Key,\n objectURL: url,\n });\n return {\n method: 'GET',\n headers: {\n ...(input.Range && { Range: input.Range }),\n ...(0, utils_2.assignStringVariables)({\n 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,\n }),\n },\n url,\n };\n};\nconst getObjectDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n // error is always set when statusCode >= 300\n throw (0, utils_2.buildStorageServiceError)((await (0, base_1.parseXmlError)(response)));\n }\n else {\n return {\n ...(0, utils_2.map)(response.headers, {\n DeleteMarker: ['x-amz-delete-marker', utils_2.deserializeBoolean],\n AcceptRanges: 'accept-ranges',\n Expiration: 'x-amz-expiration',\n Restore: 'x-amz-restore',\n LastModified: ['last-modified', utils_2.deserializeTimestamp],\n ContentLength: ['content-length', utils_2.deserializeNumber],\n ETag: 'etag',\n ChecksumCRC32: 'x-amz-checksum-crc32',\n ChecksumCRC32C: 'x-amz-checksum-crc32c',\n ChecksumSHA1: 'x-amz-checksum-sha1',\n ChecksumSHA256: 'x-amz-checksum-sha256',\n ChecksumType: 'x-amz-checksum-type',\n MissingMeta: ['x-amz-missing-meta', utils_2.deserializeNumber],\n VersionId: 'x-amz-version-id',\n CacheControl: 'cache-control',\n ContentDisposition: 'content-disposition',\n ContentEncoding: 'content-encoding',\n ContentLanguage: 'content-language',\n ContentRange: 'content-range',\n ContentType: 'content-type',\n Expires: ['expires', utils_2.deserializeTimestamp],\n WebsiteRedirectLocation: 'x-amz-website-redirect-location',\n ServerSideEncryption: 'x-amz-server-side-encryption',\n SSECustomerAlgorithm: 'x-amz-server-side-encryption-customer-algorithm',\n SSECustomerKeyMD5: 'x-amz-server-side-encryption-customer-key-md5',\n SSEKMSKeyId: 'x-amz-server-side-encryption-aws-kms-key-id',\n BucketKeyEnabled: [\n 'x-amz-server-side-encryption-bucket-key-enabled',\n utils_2.deserializeBoolean,\n ],\n StorageClass: 'x-amz-storage-class',\n RequestCharged: 'x-amz-request-charged',\n ReplicationStatus: 'x-amz-replication-status',\n PartsCount: ['x-amz-mp-parts-count', utils_2.deserializeNumber],\n TagCount: ['x-amz-tagging-count', utils_2.deserializeNumber],\n ObjectLockMode: 'x-amz-object-lock-mode',\n ObjectLockRetainUntilDate: [\n 'x-amz-object-lock-retain-until-date',\n utils_2.deserializeTimestamp,\n ],\n ObjectLockLegalHoldStatus: 'x-amz-object-lock-legal-hold',\n }),\n Metadata: (0, utils_2.deserializeMetadata)(response.headers),\n $metadata: (0, aws_client_utils_1.parseMetadata)(response),\n // @ts-expect-error The body is a CompatibleHttpResponse type because the lower-level handler is XHR instead of\n // fetch, which represents payload in Blob instread of ReadableStream.\n Body: response.body,\n };\n }\n};\nexports.getObject = (0, composers_1.composeServiceApi)(utils_2.s3TransferHandler, getObjectSerializer, getObjectDeserializer, { ...base_1.defaultConfig, responseType: 'blob' });\n/**\n * Get a presigned URL for the `getObject` API.\n *\n * @internal\n */\nconst getPresignedGetObjectUrl = async (config, input) => {\n const endpoint = base_1.defaultConfig.endpointResolver(config, input);\n const { url, headers, method } = await getObjectSerializer(input, endpoint);\n // TODO: set content sha256 query parameter with value of UNSIGNED-PAYLOAD instead of empty hash.\n // It requires changes in presignUrl. Without this change, the generated url still works,\n // but not the same as other tools like AWS SDK and CLI.\n url.searchParams.append(utils_2.CONTENT_SHA256_HEADER, aws_client_utils_1.EMPTY_SHA256_HASH);\n if (config.userAgentValue) {\n url.searchParams.append(config.userAgentHeader ?? USER_AGENT_HEADER, config.userAgentValue);\n }\n if (input.ResponseContentType) {\n url.searchParams.append('response-content-type', input.ResponseContentType);\n }\n if (input.ResponseContentDisposition) {\n url.searchParams.append('response-content-disposition', input.ResponseContentDisposition);\n }\n for (const [headerName, value] of Object.entries(headers).sort(([key1], [key2]) => key1.localeCompare(key2))) {\n url.searchParams.append(headerName, value);\n }\n return (0, aws_client_utils_1.presignUrl)({ method, url, body: undefined }, {\n signingService: base_1.defaultConfig.service,\n signingRegion: config.region,\n ...base_1.defaultConfig,\n ...config,\n });\n};\nexports.getPresignedGetObjectUrl = getPresignedGetObjectUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,SAAS,GAAG,MAAM;AAC7D,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,WAAW,GAAG,OAAO,CAAC,wDAAwD,CAAC;AACrF,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,mBAAmB,GAAG,OAAO,CAAC,yBAAyB,CAAC;AAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAChC,MAAM,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OAAO,CAAC,wBAAwB,GAAG,wBAAwB;;"}
1
+ {"version":3,"file":"getObject.js","sources":["../../../../../../../src/providers/s3/utils/client/s3data/getObject.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.getPresignedGetObjectUrl = exports.getObject = void 0;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst composers_1 = require(\"@aws-amplify/core/internals/aws-client-utils/composers\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst utils_2 = require(\"../utils\");\nconst validateObjectUrl_1 = require(\"../../validateObjectUrl\");\nconst base_1 = require(\"./base\");\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\nconst getObjectSerializer = async (input, endpoint) => {\n const url = new utils_1.AmplifyUrl(endpoint.url.toString());\n (0, utils_2.validateS3RequiredParameter)(!!input.Key, 'Key');\n url.pathname = (0, utils_2.serializePathnameObjectKey)(url, input.Key);\n url.search = new utils_1.AmplifyUrlSearchParams({\n 'x-id': 'GetObject',\n ...(input.ResponseCacheControl && {\n 'response-cache-control': input.ResponseCacheControl,\n }),\n }).toString();\n (0, validateObjectUrl_1.validateObjectUrl)({\n bucketName: input.Bucket,\n key: input.Key,\n objectURL: url,\n });\n return {\n method: 'GET',\n headers: {\n ...(input.Range && { Range: input.Range }),\n ...(0, utils_2.assignStringVariables)({\n 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,\n }),\n },\n url,\n };\n};\nconst getObjectDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n // error is always set when statusCode >= 300\n throw (0, utils_2.buildStorageServiceError)((await (0, base_1.parseXmlError)(response)));\n }\n else {\n return {\n ...(0, utils_2.map)(response.headers, {\n DeleteMarker: ['x-amz-delete-marker', utils_2.deserializeBoolean],\n AcceptRanges: 'accept-ranges',\n Expiration: 'x-amz-expiration',\n Restore: 'x-amz-restore',\n LastModified: ['last-modified', utils_2.deserializeTimestamp],\n ContentLength: ['content-length', utils_2.deserializeNumber],\n ETag: 'etag',\n ChecksumCRC32: 'x-amz-checksum-crc32',\n ChecksumCRC32C: 'x-amz-checksum-crc32c',\n ChecksumSHA1: 'x-amz-checksum-sha1',\n ChecksumSHA256: 'x-amz-checksum-sha256',\n ChecksumType: 'x-amz-checksum-type',\n MissingMeta: ['x-amz-missing-meta', utils_2.deserializeNumber],\n VersionId: 'x-amz-version-id',\n CacheControl: 'cache-control',\n ContentDisposition: 'content-disposition',\n ContentEncoding: 'content-encoding',\n ContentLanguage: 'content-language',\n ContentRange: 'content-range',\n ContentType: 'content-type',\n Expires: ['expires', utils_2.deserializeTimestamp],\n WebsiteRedirectLocation: 'x-amz-website-redirect-location',\n ServerSideEncryption: 'x-amz-server-side-encryption',\n SSECustomerAlgorithm: 'x-amz-server-side-encryption-customer-algorithm',\n SSECustomerKeyMD5: 'x-amz-server-side-encryption-customer-key-md5',\n SSEKMSKeyId: 'x-amz-server-side-encryption-aws-kms-key-id',\n BucketKeyEnabled: [\n 'x-amz-server-side-encryption-bucket-key-enabled',\n utils_2.deserializeBoolean,\n ],\n StorageClass: 'x-amz-storage-class',\n RequestCharged: 'x-amz-request-charged',\n ReplicationStatus: 'x-amz-replication-status',\n PartsCount: ['x-amz-mp-parts-count', utils_2.deserializeNumber],\n TagCount: ['x-amz-tagging-count', utils_2.deserializeNumber],\n ObjectLockMode: 'x-amz-object-lock-mode',\n ObjectLockRetainUntilDate: [\n 'x-amz-object-lock-retain-until-date',\n utils_2.deserializeTimestamp,\n ],\n ObjectLockLegalHoldStatus: 'x-amz-object-lock-legal-hold',\n }),\n Metadata: (0, utils_2.deserializeMetadata)(response.headers),\n $metadata: (0, aws_client_utils_1.parseMetadata)(response),\n // @ts-expect-error The body is a CompatibleHttpResponse type because the lower-level handler is XHR instead of\n // fetch, which represents payload in Blob instread of ReadableStream.\n Body: response.body,\n };\n }\n};\nexports.getObject = (0, composers_1.composeServiceApi)(utils_2.s3TransferHandler, getObjectSerializer, getObjectDeserializer, { ...base_1.defaultConfig, responseType: 'blob' });\n/**\n * Get a presigned URL for the `getObject` API.\n *\n * @internal\n */\nconst getPresignedGetObjectUrl = async (config, input) => {\n const endpoint = base_1.defaultConfig.endpointResolver(config, input);\n const { url, headers, method } = await getObjectSerializer(input, endpoint);\n if (config.userAgentValue) {\n url.searchParams.append(config.userAgentHeader ?? USER_AGENT_HEADER, config.userAgentValue);\n }\n if (input.ResponseContentType) {\n url.searchParams.append('response-content-type', input.ResponseContentType);\n }\n if (input.ResponseContentDisposition) {\n url.searchParams.append('response-content-disposition', input.ResponseContentDisposition);\n }\n for (const [headerName, value] of Object.entries(headers).sort(([key1], [key2]) => key1.localeCompare(key2))) {\n url.searchParams.append(headerName, value);\n }\n return (0, aws_client_utils_1.presignUrl)({ method, url, body: aws_client_utils_1.UNSIGNED_PAYLOAD }, {\n signingService: base_1.defaultConfig.service,\n signingRegion: config.region,\n ...base_1.defaultConfig,\n ...config,\n });\n};\nexports.getPresignedGetObjectUrl = getPresignedGetObjectUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,SAAS,GAAG,MAAM;AAC7D,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,WAAW,GAAG,OAAO,CAAC,wDAAwD,CAAC;AACrF,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,mBAAmB,GAAG,OAAO,CAAC,yBAAyB,CAAC;AAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAChC,MAAM,iBAAiB,GAAG,kBAAkB;AAC5C,MAAM,mBA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AAwB;;"}
@@ -14,6 +14,9 @@ const headObjectSerializer = async (input, endpoint) => {
14
14
  const url = new utils_1.AmplifyUrl(endpoint.url.toString());
15
15
  (0, utils_2.validateS3RequiredParameter)(!!input.Key, 'Key');
16
16
  url.pathname = (0, utils_2.serializePathnameObjectKey)(url, input.Key);
17
+ url.search = new utils_1.AmplifyUrlSearchParams({
18
+ 'response-cache-control': 'no-store',
19
+ }).toString();
17
20
  (0, validateObjectUrl_1.validateObjectUrl)({
18
21
  bucketName: input.Bucket,
19
22
  key: input.Key,
@@ -1 +1 @@
1
- {"version":3,"file":"headObject.js","sources":["../../../../../../../src/providers/s3/utils/client/s3data/headObject.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.headObject = void 0;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst composers_1 = require(\"@aws-amplify/core/internals/aws-client-utils/composers\");\nconst utils_2 = require(\"../utils\");\nconst validateObjectUrl_1 = require(\"../../validateObjectUrl\");\nconst base_1 = require(\"./base\");\nconst headObjectSerializer = async (input, endpoint) => {\n const url = new utils_1.AmplifyUrl(endpoint.url.toString());\n (0, utils_2.validateS3RequiredParameter)(!!input.Key, 'Key');\n url.pathname = (0, utils_2.serializePathnameObjectKey)(url, input.Key);\n (0, validateObjectUrl_1.validateObjectUrl)({\n bucketName: input.Bucket,\n key: input.Key,\n objectURL: url,\n });\n const headers = (0, utils_2.assignStringVariables)({\n 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,\n });\n return {\n method: 'HEAD',\n headers,\n url,\n };\n};\nconst headObjectDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n // error is always set when statusCode >= 300\n throw (0, utils_2.buildStorageServiceError)((await (0, base_1.parseXmlError)(response)));\n }\n else {\n const contents = {\n ...(0, utils_2.map)(response.headers, {\n ContentLength: ['content-length', utils_2.deserializeNumber],\n ContentType: 'content-type',\n ETag: 'etag',\n LastModified: ['last-modified', utils_2.deserializeTimestamp],\n VersionId: 'x-amz-version-id',\n }),\n Metadata: (0, utils_2.deserializeMetadata)(response.headers),\n };\n return {\n $metadata: (0, aws_client_utils_1.parseMetadata)(response),\n ...contents,\n };\n }\n};\nexports.headObject = (0, composers_1.composeServiceApi)(utils_2.s3TransferHandler, headObjectSerializer, headObjectDeserializer, { ...base_1.defaultConfig, responseType: 'text' });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,UAAU,GAAG,MAAM;AAC3B,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,wDAAwD,CAAC;AACrF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,mBAAmB,GAAG,OAAO,CAAC,yBAAyB,CAAC;AAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAChC,MAAM,oBAAoB,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACxD,IAAI,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/D,IAAI,IAAI,OAAO,CAAC,2BAA2B,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;AAChE,IAAI,GAAG,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,0BAA0B,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AAC1E,IAAI,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;AAC/C,QAAQ,U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,IAAI,WAAW,CAAC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,EAAE,GAAG,MAAM,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;;"}
1
+ {"version":3,"file":"headObject.js","sources":["../../../../../../../src/providers/s3/utils/client/s3data/headObject.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.headObject = void 0;\nconst aws_client_utils_1 = require(\"@aws-amplify/core/internals/aws-client-utils\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst composers_1 = require(\"@aws-amplify/core/internals/aws-client-utils/composers\");\nconst utils_2 = require(\"../utils\");\nconst validateObjectUrl_1 = require(\"../../validateObjectUrl\");\nconst base_1 = require(\"./base\");\nconst headObjectSerializer = async (input, endpoint) => {\n const url = new utils_1.AmplifyUrl(endpoint.url.toString());\n (0, utils_2.validateS3RequiredParameter)(!!input.Key, 'Key');\n url.pathname = (0, utils_2.serializePathnameObjectKey)(url, input.Key);\n url.search = new utils_1.AmplifyUrlSearchParams({\n 'response-cache-control': 'no-store',\n }).toString();\n (0, validateObjectUrl_1.validateObjectUrl)({\n bucketName: input.Bucket,\n key: input.Key,\n objectURL: url,\n });\n const headers = (0, utils_2.assignStringVariables)({\n 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,\n });\n return {\n method: 'HEAD',\n headers,\n url,\n };\n};\nconst headObjectDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n // error is always set when statusCode >= 300\n throw (0, utils_2.buildStorageServiceError)((await (0, base_1.parseXmlError)(response)));\n }\n else {\n const contents = {\n ...(0, utils_2.map)(response.headers, {\n ContentLength: ['content-length', utils_2.deserializeNumber],\n ContentType: 'content-type',\n ETag: 'etag',\n LastModified: ['last-modified', utils_2.deserializeTimestamp],\n VersionId: 'x-amz-version-id',\n }),\n Metadata: (0, utils_2.deserializeMetadata)(response.headers),\n };\n return {\n $metadata: (0, aws_client_utils_1.parseMetadata)(response),\n ...contents,\n };\n }\n};\nexports.headObject = (0, composers_1.composeServiceApi)(utils_2.s3TransferHandler, headObjectSerializer, headObjectDeserializer, { ...base_1.defaultConfig, responseType: 'text' });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,UAAU,GAAG,MAAM;AAC3B,MAAM,kBAAkB,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAClF,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,wDAAwD,CAAC;AACrF,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,mBAAmB,GAAG,OAAO,CAAC,yBAAyB,CAAC;AAC9D,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAChC,MAAM,oBAAoB,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACxD,IAAI,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC/D,IAAI,IAAI,OAAO,CAAC,2BAA2B,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;AAChE,IAAI,GAAG,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,0BAA0B,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AAC1E,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,sBAAsB,CAAC;AACpD,QAAQ,wBAAwB,EAAE,UAAU;AAC5C,KAAK,CAAC,CAAC,QAAQ,EAAE;AACjB,IAAI,IAAI,mBAAmB,CAAC,iBAAiB,EAAE;AAC/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UAAU,GAAG,IAAI,WAAW,CAAC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,EAAE,GAAG,MAAM,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;;"}
@@ -57,6 +57,7 @@ const downloadDataJob = (downloadDataInput, abortSignal) => async () => {
57
57
  ...(downloadDataOptions?.bytesRange && {
58
58
  Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,
59
59
  }),
60
+ ResponseCacheControl: downloadDataOptions?.cacheControl,
60
61
  ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,
61
62
  });
62
63
  const result = {
@@ -1 +1 @@
1
- {"version":3,"file":"downloadData.mjs","sources":["../../../../../../src/providers/s3/apis/internal/downloadData.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { resolveS3ConfigAndInput } from '../../utils/resolveS3ConfigAndInput';\nimport { createDownloadTask, validateBucketOwnerID, validateStorageOperationInput, } from '../../utils';\nimport { getObject } from '../../utils/client/s3data';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\nimport { logger } from '../../../../utils';\nimport { STORAGE_INPUT_KEY } from '../../utils/constants';\nexport const downloadData = (input) => {\n const abortController = new AbortController();\n const downloadTask = createDownloadTask({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n};\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await resolveS3ConfigAndInput(Amplify, downloadDataInput);\n const { inputType, objectKey } = validateStorageOperationInput(downloadDataInput, identityId);\n validateBucketOwnerID(downloadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await getObject({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: getStorageUserAgentValue(StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AASY,MAAC,YAAY,GAAG,CAAC,KAAK,KAAK;AACvC,IAAI,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE;AACjD,IAAI,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC5C,QAAQ,GAAG,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC;AAC3D,QAAQ,QAAQ,EAAE,CAAC,OAAO,KAAK;AAC/B,YAAY,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;AAC1C,QAAQ,CAAC;AACT,KAAK,CAAC;AACN,IAAI,OAAO,YAAY;AACvB;AACA,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,WAAW,KAAK,YAAY;AACxE,IAAI,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,iBAAiB;AAC9D,IAAI,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACjH,IAAI,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AACjB,KAAK;AACL,IAAI,OAAO,SAAS,KAAK;AACzB,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM;AACrC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACxC,CAAC;;;;"}
1
+ {"version":3,"file":"downloadData.mjs","sources":["../../../../../../src/providers/s3/apis/internal/downloadData.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { resolveS3ConfigAndInput } from '../../utils/resolveS3ConfigAndInput';\nimport { createDownloadTask, validateBucketOwnerID, validateStorageOperationInput, } from '../../utils';\nimport { getObject } from '../../utils/client/s3data';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\nimport { logger } from '../../../../utils';\nimport { STORAGE_INPUT_KEY } from '../../utils/constants';\nexport const downloadData = (input) => {\n const abortController = new AbortController();\n const downloadTask = createDownloadTask({\n job: downloadDataJob(input, abortController.signal),\n onCancel: (message) => {\n abortController.abort(message);\n },\n });\n return downloadTask;\n};\nconst downloadDataJob = (downloadDataInput, abortSignal) => async () => {\n const { options: downloadDataOptions } = downloadDataInput;\n const { bucket, keyPrefix, s3Config, identityId } = await resolveS3ConfigAndInput(Amplify, downloadDataInput);\n const { inputType, objectKey } = validateStorageOperationInput(downloadDataInput, identityId);\n validateBucketOwnerID(downloadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n logger.debug(`download ${objectKey} from ${finalKey}.`);\n const { Body: body, LastModified: lastModified, ContentLength: size, ETag: eTag, Metadata: metadata, VersionId: versionId, ContentType: contentType, } = await getObject({\n ...s3Config,\n abortSignal,\n onDownloadProgress: downloadDataOptions?.onProgress,\n userAgentValue: getStorageUserAgentValue(StorageAction.DownloadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(downloadDataOptions?.bytesRange && {\n Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,\n }),\n ResponseCacheControl: downloadDataOptions?.cacheControl,\n ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,\n });\n const result = {\n body,\n lastModified,\n size,\n contentType,\n eTag,\n metadata,\n versionId,\n };\n return inputType === STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AASY,MAAC,YAAY,GAAG,CAAC,KAAK,KAAK;AACvC,IAAI,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE;AACjD,IAAI,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC5C,QAAQ,GAAG,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC;AAC3D,QAAQ,QAAQ,EAAE,CAAC,OAAO,KAAK;AAC/B,YAAY,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;AAC1C,QAAQ,CAAC;AACT,KAAK,CAAC;AACN,IAAI,OAAO,YAAY;AACvB;AACA,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,WAAW,KAAK,YAAY;AACxE,IAAI,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,iBAAiB;AAC9D,IAAI,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,CAAC;AACjH,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,6BAA6B,CAAC,iBAAiB,EAAE,UAAU,CAAC;AACjG,IAAI,qBAAqB,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;AACnE,IAAI,MAAM,QAAQ,GAAG,SAAS,KAAK,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;AACxF,IAAI,M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@@ const getUrl = async (amplify, input) => {
64
64
  ...(getUrlOptions?.contentType && {
65
65
  ResponseContentType: getUrlOptions.contentType,
66
66
  }),
67
+ ResponseCacheControl: getUrlOptions?.cacheControl,
67
68
  ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,
68
69
  }),
69
70
  expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),
@@ -1 +1 @@
1
- {"version":3,"file":"getUrl.mjs","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { StorageValidationErrorCode } from '../../../../errors/types/validation';\nimport { getPresignedGetObjectUrl } from '../../utils/client/s3data';\nimport { resolveS3ConfigAndInput, validateBucketOwnerID, validateStorageOperationInput, } from '../../utils';\nimport { assertValidationError } from '../../../../errors/utils/assertValidationError';\nimport { DEFAULT_PRESIGN_EXPIRATION, MAX_URL_EXPIRATION, STORAGE_INPUT_KEY, } from '../../utils/constants';\nimport { constructContentDisposition } from '../../utils/constructContentDisposition';\nimport { getProperties } from './getProperties';\nexport const getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await resolveS3ConfigAndInput(amplify, input);\n const { inputType, objectKey } = validateStorageOperationInput(input, identityId);\n validateBucketOwnerID(getUrlOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await getProperties(amplify, input, StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? DEFAULT_PRESIGN_EXPIRATION;\n const resolvedCredential = typeof s3Config.credentials === 'function'\n ? await s3Config.credentials()\n : s3Config.credentials;\n const awsCredExpiration = resolvedCredential.expiration;\n if (awsCredExpiration) {\n const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);\n urlExpirationInSec = Math.min(awsCredExpirationInSec, urlExpirationInSec);\n }\n const maxUrlExpirationInSec = MAX_URL_EXPIRATION / 1000;\n assertValidationError(urlExpirationInSec <= maxUrlExpirationInSec, StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await getPresignedGetObjectUrl({\n ...s3Config,\n credentials: resolvedCredential,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(getUrlOptions?.contentDisposition && {\n ResponseContentDisposition: constructContentDisposition(getUrlOptions.contentDisposition),\n }),\n ...(getUrlOptions?.contentType && {\n ResponseContentType: getUrlOptions.contentType,\n }),\n ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AASY,MAAC,MAAM,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK;AAC5C,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC;AACrG,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,6BAA6B,CAAC,KAAK,EAAE,UAAU,CAAC;AACrF,IAAI,qBAAqB,CAAC,aAAa,EAAE,mBAAmB,CAAC;AAC7D,IAAI,MAAM,QAAQ,GAAG,SAAS,KAAK,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;AACxF,IAAI,IAAI,aAAa,EAAE,uBAAuB,EAAE;AAChD,QAAQ,MAAM,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC;AACjE,IAAI;AACJ,IAAI,IAAI,kBAA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C,GAAG,EAAE,GAAG,kBAAkB,GAAG,IAAI,CAAC;AACnE,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"getUrl.mjs","sources":["../../../../../../src/providers/s3/apis/internal/getUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { StorageValidationErrorCode } from '../../../../errors/types/validation';\nimport { getPresignedGetObjectUrl } from '../../utils/client/s3data';\nimport { resolveS3ConfigAndInput, validateBucketOwnerID, validateStorageOperationInput, } from '../../utils';\nimport { assertValidationError } from '../../../../errors/utils/assertValidationError';\nimport { DEFAULT_PRESIGN_EXPIRATION, MAX_URL_EXPIRATION, STORAGE_INPUT_KEY, } from '../../utils/constants';\nimport { constructContentDisposition } from '../../utils/constructContentDisposition';\nimport { getProperties } from './getProperties';\nexport const getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await resolveS3ConfigAndInput(amplify, input);\n const { inputType, objectKey } = validateStorageOperationInput(input, identityId);\n validateBucketOwnerID(getUrlOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n if (getUrlOptions?.validateObjectExistence) {\n await getProperties(amplify, input, StorageAction.GetUrl);\n }\n let urlExpirationInSec = getUrlOptions?.expiresIn ?? DEFAULT_PRESIGN_EXPIRATION;\n const resolvedCredential = typeof s3Config.credentials === 'function'\n ? await s3Config.credentials()\n : s3Config.credentials;\n const awsCredExpiration = resolvedCredential.expiration;\n if (awsCredExpiration) {\n const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);\n urlExpirationInSec = Math.min(awsCredExpirationInSec, urlExpirationInSec);\n }\n const maxUrlExpirationInSec = MAX_URL_EXPIRATION / 1000;\n assertValidationError(urlExpirationInSec <= maxUrlExpirationInSec, StorageValidationErrorCode.UrlExpirationMaxLimitExceed);\n // expiresAt is the minimum of credential expiration and url expiration\n return {\n url: await getPresignedGetObjectUrl({\n ...s3Config,\n credentials: resolvedCredential,\n expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n ...(getUrlOptions?.contentDisposition && {\n ResponseContentDisposition: constructContentDisposition(getUrlOptions.contentDisposition),\n }),\n ...(getUrlOptions?.contentType && {\n ResponseContentType: getUrlOptions.contentType,\n }),\n ResponseCacheControl: getUrlOptions?.cacheControl,\n ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AASY,MAAC,MAAM,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK;AAC5C,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,KAAK,CAAC;AACrG,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,6BAA6B,CAAC,KAAK,EAAE,UAAU,CAAC;AACrF,IAAI,qBAAqB,CAAC,aAAa,EAAE,mBAAmB,CAAC;AAC7D,IAAI,MAAM,QAAQ,GAAG,SAAS,KAAK,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS;AACxF,IAAI,IAAI,aAAa,EAAE,uBAAuB,EAAE;AAChD,QAAQ,MAAM,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC;AACjE,IAAI;AACJ,IAAI,IAAI,kBAAkB,GAAG,aAAa,EAAE,SAAS,IAAI,0BAA0B;AACnF,IAAI,MAAM,kBAAkB,GAAG,OAAO,QAAQ,CAAC,WAAW,KAAK;AAC/D,UAAU,MAAM,QAAQ,CAA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const putObjectJob = (uploadDataInput, abortSignal, totalLength) => async () =>
39
39
  const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
40
40
  const { contentDisposition, contentEncoding, contentType = uploadDataOptions?.contentType ??
41
41
  getContentType(data, objectKey) ??
42
- 'application/octet-stream', preventOverwrite, metadata, checksumAlgorithm, onProgress, expectedBucketOwner, } = uploadDataOptions ?? {};
42
+ 'application/octet-stream', preventOverwrite, metadata, checksumAlgorithm, onProgress, expectedBucketOwner, cacheControl, } = uploadDataOptions ?? {};
43
43
  const checksumCRC32 = checksumAlgorithm === CHECKSUM_ALGORITHM_CRC32
44
44
  ? await calculateContentCRC32(data)
45
45
  : undefined;
@@ -60,6 +60,7 @@ const putObjectJob = (uploadDataInput, abortSignal, totalLength) => async () =>
60
60
  ContentType: contentType,
61
61
  ContentDisposition: constructContentDisposition(contentDisposition),
62
62
  ContentEncoding: contentEncoding,
63
+ CacheControl: cacheControl,
63
64
  Metadata: metadata,
64
65
  ContentMD5: contentMD5,
65
66
  ChecksumCRC32: checksumCRC32,
@@ -1 +1 @@
1
- {"version":3,"file":"putObjectJob.mjs","sources":["../../../../../../../src/providers/s3/apis/internal/uploadData/putObjectJob.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { calculateContentMd5, resolveS3ConfigAndInput, validateBucketOwnerID, validateStorageOperationInput, } from '../../../utils';\nimport { putObject } from '../../../utils/client/s3data';\nimport { getStorageUserAgentValue } from '../../../utils/userAgent';\nimport { CHECKSUM_ALGORITHM_CRC32, STORAGE_INPUT_KEY, } from '../../../utils/constants';\nimport { calculateContentCRC32 } from '../../../utils/crc32';\nimport { constructContentDisposition } from '../../../utils/constructContentDisposition';\nimport { getContentType } from '../../../../../utils/contentType';\n/**\n * Get a function the returns a promise to call putObject API to S3.\n *\n * @internal\n */\nexport const putObjectJob = (uploadDataInput, abortSignal, totalLength) => async () => {\n const { options: uploadDataOptions, data } = uploadDataInput;\n const { bucket, keyPrefix, s3Config, isObjectLockEnabled, identityId } = await resolveS3ConfigAndInput(Amplify, uploadDataInput);\n const { inputType, objectKey } = validateStorageOperationInput(uploadDataInput, identityId);\n validateBucketOwnerID(uploadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n const { contentDisposition, contentEncoding, contentType = uploadDataOptions?.contentType ??\n getContentType(data, objectKey) ??\n 'application/octet-stream', preventOverwrite, metadata, checksumAlgorithm, onProgress, expectedBucketOwner, } = uploadDataOptions ?? {};\n const checksumCRC32 = checksumAlgorithm === CHECKSUM_ALGORITHM_CRC32\n ? await calculateContentCRC32(data)\n : undefined;\n const contentMD5 = \n // check if checksum exists. ex: should not exist in react native\n !checksumCRC32 && isObjectLockEnabled\n ? await calculateContentMd5(data)\n : undefined;\n const { ETag: eTag, VersionId: versionId } = await putObject({\n ...s3Config,\n abortSignal,\n onUploadProgress: onProgress,\n userAgentValue: getStorageUserAgentValue(StorageAction.UploadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n Body: data,\n ContentType: contentType,\n ContentDisposition: constructContentDisposition(contentDisposition),\n ContentEncoding: contentEncoding,\n Metadata: metadata,\n ContentMD5: contentMD5,\n ChecksumCRC32: checksumCRC32,\n ExpectedBucketOwner: expectedBucketOwner,\n IfNoneMatch: preventOverwrite ? '*' : undefined,\n });\n const result = {\n eTag,\n versionId,\n contentType,\n metadata,\n size: totalLength,\n };\n return inputType === STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAUA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,CAAC,eAAe,EAAE,WAAW,EAAE,WAAW,KAAK,YAAY;AACvF,IAAI,MA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AACrB,QAAQ,IAAI,EAAE,IAAI;AAClB,QAAQ,WAAW,EAAE,WAAW;AAChC,QAAQ,kBAAkB,EAAE,2BAA2B,CAAC,kBAAkB,CAAC;AAC3E,QAAQ,eAAe,EAAE,eAAe;AACxC,QAAQ,QAAQ,EAAE,QAAQ;AAC1B,QAAQ,UAAU,EAAE,UAAU;AAC9B,QAAQ,aAAa,EAAE,aAAa;AACpC,QAAQ,mBAAmB,EAAE,mBAAmB;AAChD,QAAQ,WAAW,EAAE,gBAAgB,GAAG,GAAG,GAAG,SAAS;AACvD,KAAK,CAAC;AACN,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI;AACZ,QAAQ,SAAS;AACjB,QAAQ,WAAW;AACnB,QAAQ,QAAQ;AAChB,QAAQ,IAAI,EAAE,WAAW;AACzB,KAAK;AACL,IAAI,OAAO,SAAS,KAAK;AACzB,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM;AACrC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACxC;;;;"}
1
+ {"version":3,"file":"putObjectJob.mjs","sources":["../../../../../../../src/providers/s3/apis/internal/uploadData/putObjectJob.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '@aws-amplify/core';\nimport { StorageAction } from '@aws-amplify/core/internals/utils';\nimport { calculateContentMd5, resolveS3ConfigAndInput, validateBucketOwnerID, validateStorageOperationInput, } from '../../../utils';\nimport { putObject } from '../../../utils/client/s3data';\nimport { getStorageUserAgentValue } from '../../../utils/userAgent';\nimport { CHECKSUM_ALGORITHM_CRC32, STORAGE_INPUT_KEY, } from '../../../utils/constants';\nimport { calculateContentCRC32 } from '../../../utils/crc32';\nimport { constructContentDisposition } from '../../../utils/constructContentDisposition';\nimport { getContentType } from '../../../../../utils/contentType';\n/**\n * Get a function the returns a promise to call putObject API to S3.\n *\n * @internal\n */\nexport const putObjectJob = (uploadDataInput, abortSignal, totalLength) => async () => {\n const { options: uploadDataOptions, data } = uploadDataInput;\n const { bucket, keyPrefix, s3Config, isObjectLockEnabled, identityId } = await resolveS3ConfigAndInput(Amplify, uploadDataInput);\n const { inputType, objectKey } = validateStorageOperationInput(uploadDataInput, identityId);\n validateBucketOwnerID(uploadDataOptions?.expectedBucketOwner);\n const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;\n const { contentDisposition, contentEncoding, contentType = uploadDataOptions?.contentType ??\n getContentType(data, objectKey) ??\n 'application/octet-stream', preventOverwrite, metadata, checksumAlgorithm, onProgress, expectedBucketOwner, cacheControl, } = uploadDataOptions ?? {};\n const checksumCRC32 = checksumAlgorithm === CHECKSUM_ALGORITHM_CRC32\n ? await calculateContentCRC32(data)\n : undefined;\n const contentMD5 = \n // check if checksum exists. ex: should not exist in react native\n !checksumCRC32 && isObjectLockEnabled\n ? await calculateContentMd5(data)\n : undefined;\n const { ETag: eTag, VersionId: versionId } = await putObject({\n ...s3Config,\n abortSignal,\n onUploadProgress: onProgress,\n userAgentValue: getStorageUserAgentValue(StorageAction.UploadData),\n }, {\n Bucket: bucket,\n Key: finalKey,\n Body: data,\n ContentType: contentType,\n ContentDisposition: constructContentDisposition(contentDisposition),\n ContentEncoding: contentEncoding,\n CacheControl: cacheControl,\n Metadata: metadata,\n ContentMD5: contentMD5,\n ChecksumCRC32: checksumCRC32,\n ExpectedBucketOwner: expectedBucketOwner,\n IfNoneMatch: preventOverwrite ? '*' : undefined,\n });\n const result = {\n eTag,\n versionId,\n contentType,\n metadata,\n size: totalLength,\n };\n return inputType === STORAGE_INPUT_KEY\n ? { key: objectKey, ...result }\n : { path: objectKey, ...result };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAUA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,CAAC,eAAe,EAAE,WAAW,EAAE,WAAW,KAAK,YAAY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,QAAQ,GAAG,EAAE,QAAQ;AACrB,QAAQ,IAAI,EAAE,IAAI;AAClB,QAAQ,WAAW,EAAE,WAAW;AAChC,QAAQ,kBAAkB,EAAE,2BAA2B,CAAC,kBAAkB,CAAC;AAC3E,QAAQ,eAAe,EAAE,eAAe;AACxC,QAAQ,YAAY,EAAE,YAAY;AAClC,QAAQ,QAAQ,EAAE,QAAQ;AAC1B,QAAQ,UAAU,EAAE,UAAU;AAC9B,QAAQ,aAAa,EAAE,aAAa;AACpC,QAAQ,mBAAmB,EAAE,mBAAmB;AAChD,QAAQ,WAAW,EAAE,gBAAgB,GAAG,GAAG,GAAG,SAAS;AACvD,KAAK,CAAC;AACN,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,IAAI;AACZ,QAAQ,SAAS;AACjB,QAAQ,WAAW;AACnB,QAAQ,QAAQ;AAChB,QAAQ,IAAI,EAAE,WAAW;AACzB,KAAK;AACL,IAAI,OAAO,SAAS,KAAK;AACzB,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,MAAM;AACrC,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE;AACxC;;;;"}
@@ -133,6 +133,11 @@ export type GetUrlOptions = CommonOptions & {
133
133
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
134
134
  */
135
135
  contentType?: string;
136
+ /**
137
+ * The cache-control header value of the file when downloading it.
138
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
139
+ */
140
+ cacheControl?: string;
136
141
  };
137
142
  /** @deprecated Use {@link GetUrlWithPathOptions} instead. */
138
143
  export type GetUrlWithKeyOptions = ReadOptions & GetUrlOptions;
@@ -140,7 +145,13 @@ export type GetUrlWithPathOptions = GetUrlOptions;
140
145
  /**
141
146
  * Input options type for S3 downloadData API.
142
147
  */
143
- export type DownloadDataOptions = CommonOptions & TransferOptions & BytesRangeOptions;
148
+ export type DownloadDataOptions = CommonOptions & TransferOptions & BytesRangeOptions & {
149
+ /**
150
+ * The cache-control header value of the file when downloading it.
151
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
152
+ */
153
+ cacheControl?: string;
154
+ };
144
155
  /** @deprecated Use {@link DownloadDataWithPathOptions} instead. */
145
156
  export type DownloadDataWithKeyOptions = ReadOptions & DownloadDataOptions;
146
157
  export type DownloadDataWithPathOptions = DownloadDataOptions;
@@ -180,6 +191,11 @@ export type UploadDataOptions = CommonOptions & TransferOptions & {
180
191
  * @default undefined
181
192
  */
182
193
  checksumAlgorithm?: UploadDataChecksumAlgorithm;
194
+ /**
195
+ * The cache-control header value of the file when downloading it.
196
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
197
+ */
198
+ cacheControl?: string;
183
199
  };
184
200
  /** @deprecated Use {@link UploadDataWithPathOptions} instead. */
185
201
  export type UploadDataWithKeyOptions = WriteOptions & UploadDataOptions;
@@ -1,7 +1,7 @@
1
1
  import { Endpoint, HttpResponse, PresignUrlOptions, UserAgentOptions } from '@aws-amplify/core/internals/aws-client-utils';
2
2
  import { S3EndpointResolverOptions } from './base';
3
3
  import type { GetObjectCommandInput, GetObjectCommandOutput } from './types';
4
- export type GetObjectInput = Pick<GetObjectCommandInput, 'Bucket' | 'Key' | 'Range' | 'ResponseContentDisposition' | 'ResponseContentType' | 'ExpectedBucketOwner'>;
4
+ export type GetObjectInput = Pick<GetObjectCommandInput, 'Bucket' | 'Key' | 'Range' | 'ResponseContentDisposition' | 'ResponseContentType' | 'ExpectedBucketOwner' | 'ResponseCacheControl'>;
5
5
  export type GetObjectOutput = GetObjectCommandOutput;
6
6
  export declare const getObject: (config: {
7
7
  responseType?: "blob" | "text" | undefined;
@@ -1,7 +1,6 @@
1
- import { parseMetadata, EMPTY_SHA256_HASH, presignUrl } from '@aws-amplify/core/internals/aws-client-utils';
1
+ import { parseMetadata, presignUrl, UNSIGNED_PAYLOAD } from '@aws-amplify/core/internals/aws-client-utils';
2
2
  import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';
3
3
  import { AmplifyUrl, AmplifyUrlSearchParams } from '@aws-amplify/core/internals/utils';
4
- import { CONTENT_SHA256_HEADER } from '../runtime/constants.mjs';
5
4
  import { s3TransferHandler } from '../runtime/s3TransferHandler/fetch.mjs';
6
5
  import 'fast-xml-parser';
7
6
  import '../runtime/s3TransferHandler/xhr.mjs';
@@ -20,6 +19,9 @@ const getObjectSerializer = async (input, endpoint) => {
20
19
  url.pathname = serializePathnameObjectKey(url, input.Key);
21
20
  url.search = new AmplifyUrlSearchParams({
22
21
  'x-id': 'GetObject',
22
+ ...(input.ResponseCacheControl && {
23
+ 'response-cache-control': input.ResponseCacheControl,
24
+ }),
23
25
  }).toString();
24
26
  validateObjectUrl({
25
27
  bucketName: input.Bucket,
@@ -104,10 +106,6 @@ const getObject = composeServiceApi(s3TransferHandler, getObjectSerializer, getO
104
106
  const getPresignedGetObjectUrl = async (config, input) => {
105
107
  const endpoint = defaultConfig.endpointResolver(config, input);
106
108
  const { url, headers, method } = await getObjectSerializer(input, endpoint);
107
- // TODO: set content sha256 query parameter with value of UNSIGNED-PAYLOAD instead of empty hash.
108
- // It requires changes in presignUrl. Without this change, the generated url still works,
109
- // but not the same as other tools like AWS SDK and CLI.
110
- url.searchParams.append(CONTENT_SHA256_HEADER, EMPTY_SHA256_HASH);
111
109
  if (config.userAgentValue) {
112
110
  url.searchParams.append(config.userAgentHeader ?? USER_AGENT_HEADER, config.userAgentValue);
113
111
  }
@@ -120,7 +118,7 @@ const getPresignedGetObjectUrl = async (config, input) => {
120
118
  for (const [headerName, value] of Object.entries(headers).sort(([key1], [key2]) => key1.localeCompare(key2))) {
121
119
  url.searchParams.append(headerName, value);
122
120
  }
123
- return presignUrl({ method, url, body: undefined }, {
121
+ return presignUrl({ method, url, body: UNSIGNED_PAYLOAD }, {
124
122
  signingService: defaultConfig.service,
125
123
  signingRegion: config.region,
126
124
  ...defaultConfig,
@@ -1 +1 @@
1
- {"version":3,"file":"getObject.mjs","sources":["../../../../../../../src/providers/s3/utils/client/s3data/getObject.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { EMPTY_SHA256_HASH, parseMetadata, presignUrl, } from '@aws-amplify/core/internals/aws-client-utils';\nimport { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';\nimport { AmplifyUrl, AmplifyUrlSearchParams, } from '@aws-amplify/core/internals/utils';\nimport { CONTENT_SHA256_HEADER, assignStringVariables, buildStorageServiceError, deserializeBoolean, deserializeMetadata, deserializeNumber, deserializeTimestamp, map, s3TransferHandler, serializePathnameObjectKey, validateS3RequiredParameter, } from '../utils';\nimport { validateObjectUrl } from '../../validateObjectUrl';\nimport { defaultConfig, parseXmlError, } from './base';\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\nconst getObjectSerializer = async (input, endpoint) => {\n const url = new AmplifyUrl(endpoint.url.toString());\n validateS3RequiredParameter(!!input.Key, 'Key');\n url.pathname = serializePathnameObjectKey(url, input.Key);\n url.search = new AmplifyUrlSearchParams({\n 'x-id': 'GetObject',\n }).toString();\n validateObjectUrl({\n bucketName: input.Bucket,\n key: input.Key,\n objectURL: url,\n });\n return {\n method: 'GET',\n headers: {\n ...(input.Range && { Range: input.Range }),\n ...assignStringVariables({\n 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,\n }),\n },\n url,\n };\n};\nconst getObjectDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n // error is always set when statusCode >= 300\n throw buildStorageServiceError((await parseXmlError(response)));\n }\n else {\n return {\n ...map(response.headers, {\n DeleteMarker: ['x-amz-delete-marker', deserializeBoolean],\n AcceptRanges: 'accept-ranges',\n Expiration: 'x-amz-expiration',\n Restore: 'x-amz-restore',\n LastModified: ['last-modified', deserializeTimestamp],\n ContentLength: ['content-length', deserializeNumber],\n ETag: 'etag',\n ChecksumCRC32: 'x-amz-checksum-crc32',\n ChecksumCRC32C: 'x-amz-checksum-crc32c',\n ChecksumSHA1: 'x-amz-checksum-sha1',\n ChecksumSHA256: 'x-amz-checksum-sha256',\n ChecksumType: 'x-amz-checksum-type',\n MissingMeta: ['x-amz-missing-meta', deserializeNumber],\n VersionId: 'x-amz-version-id',\n CacheControl: 'cache-control',\n ContentDisposition: 'content-disposition',\n ContentEncoding: 'content-encoding',\n ContentLanguage: 'content-language',\n ContentRange: 'content-range',\n ContentType: 'content-type',\n Expires: ['expires', deserializeTimestamp],\n WebsiteRedirectLocation: 'x-amz-website-redirect-location',\n ServerSideEncryption: 'x-amz-server-side-encryption',\n SSECustomerAlgorithm: 'x-amz-server-side-encryption-customer-algorithm',\n SSECustomerKeyMD5: 'x-amz-server-side-encryption-customer-key-md5',\n SSEKMSKeyId: 'x-amz-server-side-encryption-aws-kms-key-id',\n BucketKeyEnabled: [\n 'x-amz-server-side-encryption-bucket-key-enabled',\n deserializeBoolean,\n ],\n StorageClass: 'x-amz-storage-class',\n RequestCharged: 'x-amz-request-charged',\n ReplicationStatus: 'x-amz-replication-status',\n PartsCount: ['x-amz-mp-parts-count', deserializeNumber],\n TagCount: ['x-amz-tagging-count', deserializeNumber],\n ObjectLockMode: 'x-amz-object-lock-mode',\n ObjectLockRetainUntilDate: [\n 'x-amz-object-lock-retain-until-date',\n deserializeTimestamp,\n ],\n ObjectLockLegalHoldStatus: 'x-amz-object-lock-legal-hold',\n }),\n Metadata: deserializeMetadata(response.headers),\n $metadata: parseMetadata(response),\n // @ts-expect-error The body is a CompatibleHttpResponse type because the lower-level handler is XHR instead of\n // fetch, which represents payload in Blob instread of ReadableStream.\n Body: response.body,\n };\n }\n};\nexport const getObject = composeServiceApi(s3TransferHandler, getObjectSerializer, getObjectDeserializer, { ...defaultConfig, responseType: 'blob' });\n/**\n * Get a presigned URL for the `getObject` API.\n *\n * @internal\n */\nexport const getPresignedGetObjectUrl = async (config, input) => {\n const endpoint = defaultConfig.endpointResolver(config, input);\n const { url, headers, method } = await getObjectSerializer(input, endpoint);\n // TODO: set content sha256 query parameter with value of UNSIGNED-PAYLOAD instead of empty hash.\n // It requires changes in presignUrl. Without this change, the generated url still works,\n // but not the same as other tools like AWS SDK and CLI.\n url.searchParams.append(CONTENT_SHA256_HEADER, EMPTY_SHA256_HASH);\n if (config.userAgentValue) {\n url.searchParams.append(config.userAgentHeader ?? USER_AGENT_HEADER, config.userAgentValue);\n }\n if (input.ResponseContentType) {\n url.searchParams.append('response-content-type', input.ResponseContentType);\n }\n if (input.ResponseContentDisposition) {\n url.searchParams.append('response-content-disposition', input.ResponseContentDisposition);\n }\n for (const [headerName, value] of Object.entries(headers).sort(([key1], [key2]) => key1.localeCompare(key2))) {\n url.searchParams.append(headerName, value);\n }\n return presignUrl({ method, url, body: undefined }, {\n signingService: defaultConfig.service,\n signingRegion: config.region,\n ...defaultConfig,\n ...config,\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,iBAAiB,GAAG,kBAAkB;AAC5C,MAAM,mBAAmB,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACvD,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AACvD,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;AACnD,IAAI,GAAG,CAAC,QAAQ,GAAG,0BAA0B,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AAC7D,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,sBAAsB,CAAC;AAC5C,QAAQ,MAAM,EAAE,WAAW;AAC3B,KAAK,CAAC,CAAC,QAAQ,EAAE;AACjB,IAAI,iBAAiB,CAAC;AACtB,QAAQ,UAAU,EAAE,KAAK,CAAC,MAAM;AAChC,QAAQ,GAAG,EAAE,KAAK,CAAC,GAAG;AACtB,QAAQ,SAAS,EAAE,GAAG;AACtB,KA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AACxD,QAAQ,cAAc,EAAE,aAAa,CAAC,OAAO;AAC7C,QAAQ,aAAa,EAAE,MAAM,CAAC,MAAM;AACpC,QAAQ,GAAG,aAAa;AACxB,QAAQ,GAAG,MAAM;AACjB,KAAK,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"getObject.mjs","sources":["../../../../../../../src/providers/s3/utils/client/s3data/getObject.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { UNSIGNED_PAYLOAD, parseMetadata, presignUrl, } from '@aws-amplify/core/internals/aws-client-utils';\nimport { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';\nimport { AmplifyUrl, AmplifyUrlSearchParams, } from '@aws-amplify/core/internals/utils';\nimport { assignStringVariables, buildStorageServiceError, deserializeBoolean, deserializeMetadata, deserializeNumber, deserializeTimestamp, map, s3TransferHandler, serializePathnameObjectKey, validateS3RequiredParameter, } from '../utils';\nimport { validateObjectUrl } from '../../validateObjectUrl';\nimport { defaultConfig, parseXmlError, } from './base';\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\nconst getObjectSerializer = async (input, endpoint) => {\n const url = new AmplifyUrl(endpoint.url.toString());\n validateS3RequiredParameter(!!input.Key, 'Key');\n url.pathname = serializePathnameObjectKey(url, input.Key);\n url.search = new AmplifyUrlSearchParams({\n 'x-id': 'GetObject',\n ...(input.ResponseCacheControl && {\n 'response-cache-control': input.ResponseCacheControl,\n }),\n }).toString();\n validateObjectUrl({\n bucketName: input.Bucket,\n key: input.Key,\n objectURL: url,\n });\n return {\n method: 'GET',\n headers: {\n ...(input.Range && { Range: input.Range }),\n ...assignStringVariables({\n 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,\n }),\n },\n url,\n };\n};\nconst getObjectDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n // error is always set when statusCode >= 300\n throw buildStorageServiceError((await parseXmlError(response)));\n }\n else {\n return {\n ...map(response.headers, {\n DeleteMarker: ['x-amz-delete-marker', deserializeBoolean],\n AcceptRanges: 'accept-ranges',\n Expiration: 'x-amz-expiration',\n Restore: 'x-amz-restore',\n LastModified: ['last-modified', deserializeTimestamp],\n ContentLength: ['content-length', deserializeNumber],\n ETag: 'etag',\n ChecksumCRC32: 'x-amz-checksum-crc32',\n ChecksumCRC32C: 'x-amz-checksum-crc32c',\n ChecksumSHA1: 'x-amz-checksum-sha1',\n ChecksumSHA256: 'x-amz-checksum-sha256',\n ChecksumType: 'x-amz-checksum-type',\n MissingMeta: ['x-amz-missing-meta', deserializeNumber],\n VersionId: 'x-amz-version-id',\n CacheControl: 'cache-control',\n ContentDisposition: 'content-disposition',\n ContentEncoding: 'content-encoding',\n ContentLanguage: 'content-language',\n ContentRange: 'content-range',\n ContentType: 'content-type',\n Expires: ['expires', deserializeTimestamp],\n WebsiteRedirectLocation: 'x-amz-website-redirect-location',\n ServerSideEncryption: 'x-amz-server-side-encryption',\n SSECustomerAlgorithm: 'x-amz-server-side-encryption-customer-algorithm',\n SSECustomerKeyMD5: 'x-amz-server-side-encryption-customer-key-md5',\n SSEKMSKeyId: 'x-amz-server-side-encryption-aws-kms-key-id',\n BucketKeyEnabled: [\n 'x-amz-server-side-encryption-bucket-key-enabled',\n deserializeBoolean,\n ],\n StorageClass: 'x-amz-storage-class',\n RequestCharged: 'x-amz-request-charged',\n ReplicationStatus: 'x-amz-replication-status',\n PartsCount: ['x-amz-mp-parts-count', deserializeNumber],\n TagCount: ['x-amz-tagging-count', deserializeNumber],\n ObjectLockMode: 'x-amz-object-lock-mode',\n ObjectLockRetainUntilDate: [\n 'x-amz-object-lock-retain-until-date',\n deserializeTimestamp,\n ],\n ObjectLockLegalHoldStatus: 'x-amz-object-lock-legal-hold',\n }),\n Metadata: deserializeMetadata(response.headers),\n $metadata: parseMetadata(response),\n // @ts-expect-error The body is a CompatibleHttpResponse type because the lower-level handler is XHR instead of\n // fetch, which represents payload in Blob instread of ReadableStream.\n Body: response.body,\n };\n }\n};\nexport const getObject = composeServiceApi(s3TransferHandler, getObjectSerializer, getObjectDeserializer, { ...defaultConfig, responseType: 'blob' });\n/**\n * Get a presigned URL for the `getObject` API.\n *\n * @internal\n */\nexport const getPresignedGetObjectUrl = async (config, input) => {\n const endpoint = defaultConfig.endpointResolver(config, input);\n const { url, headers, method } = await getObjectSerializer(input, endpoint);\n if (config.userAgentValue) {\n url.searchParams.append(config.userAgentHeader ?? USER_AGENT_HEADER, config.userAgentValue);\n }\n if (input.ResponseContentType) {\n url.searchParams.append('response-content-type', input.ResponseContentType);\n }\n if (input.ResponseContentDisposition) {\n url.searchParams.append('response-content-disposition', input.ResponseContentDisposition);\n }\n for (const [headerName, value] of Object.entries(headers).sort(([key1], [key2]) => key1.localeCompare(key2))) {\n url.searchParams.append(headerName, value);\n }\n return presignUrl({ method, url, body: UNSIGNED_PAYLOAD }, {\n signingService: defaultConfig.service,\n signingRegion: config.region,\n ...defaultConfig,\n ...config,\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,iBAAiB,GAAG,kBAAkB;AAC5C,MAAM,mBAAmB,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACvD,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AACvD,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;AACnD,IAAI,GAAG,CAAC,QAAQ,GAAG,0BAA0B,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AAC7D,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,sBAAsB,CAAC;AAC5C,QAAQ,MAAM,EAAE,WAAW;AAC3B,QAAQ,IAAI,KAAK,CAAC,oBAAoB,IAAI;AAC1C,YAAY,wBAAwB,EAAE,KAAK,CAAC,oBAAoB;AAChE,SAAS,CAAC;AACV,KAAK,CAAC,CAAC,QAAQ,EAA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AC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE;AAC/D,QAAQ,cAAc,EAAE,aAAa,CAAC,OAAO;AAC7C,QAAQ,aAAa,EAAE,MAAM,CAAC,MAAM;AACpC,QAAQ,GAAG,aAAa;AACxB,QAAQ,GAAG,MAAM;AACjB,KAAK,CAAC;AACN;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { parseMetadata } from '@aws-amplify/core/internals/aws-client-utils';
2
- import { AmplifyUrl } from '@aws-amplify/core/internals/utils';
2
+ import { AmplifyUrl, AmplifyUrlSearchParams } from '@aws-amplify/core/internals/utils';
3
3
  import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';
4
4
  import { s3TransferHandler } from '../runtime/s3TransferHandler/fetch.mjs';
5
5
  import 'fast-xml-parser';
@@ -16,6 +16,9 @@ const headObjectSerializer = async (input, endpoint) => {
16
16
  const url = new AmplifyUrl(endpoint.url.toString());
17
17
  validateS3RequiredParameter(!!input.Key, 'Key');
18
18
  url.pathname = serializePathnameObjectKey(url, input.Key);
19
+ url.search = new AmplifyUrlSearchParams({
20
+ 'response-cache-control': 'no-store',
21
+ }).toString();
19
22
  validateObjectUrl({
20
23
  bucketName: input.Bucket,
21
24
  key: input.Key,
@@ -1 +1 @@
1
- {"version":3,"file":"headObject.mjs","sources":["../../../../../../../src/providers/s3/utils/client/s3data/headObject.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseMetadata, } from '@aws-amplify/core/internals/aws-client-utils';\nimport { AmplifyUrl } from '@aws-amplify/core/internals/utils';\nimport { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';\nimport { assignStringVariables, buildStorageServiceError, deserializeMetadata, deserializeNumber, deserializeTimestamp, map, s3TransferHandler, serializePathnameObjectKey, validateS3RequiredParameter, } from '../utils';\nimport { validateObjectUrl } from '../../validateObjectUrl';\nimport { defaultConfig, parseXmlError } from './base';\nconst headObjectSerializer = async (input, endpoint) => {\n const url = new AmplifyUrl(endpoint.url.toString());\n validateS3RequiredParameter(!!input.Key, 'Key');\n url.pathname = serializePathnameObjectKey(url, input.Key);\n validateObjectUrl({\n bucketName: input.Bucket,\n key: input.Key,\n objectURL: url,\n });\n const headers = assignStringVariables({\n 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,\n });\n return {\n method: 'HEAD',\n headers,\n url,\n };\n};\nconst headObjectDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n // error is always set when statusCode >= 300\n throw buildStorageServiceError((await parseXmlError(response)));\n }\n else {\n const contents = {\n ...map(response.headers, {\n ContentLength: ['content-length', deserializeNumber],\n ContentType: 'content-type',\n ETag: 'etag',\n LastModified: ['last-modified', deserializeTimestamp],\n VersionId: 'x-amz-version-id',\n }),\n Metadata: deserializeMetadata(response.headers),\n };\n return {\n $metadata: parseMetadata(response),\n ...contents,\n };\n }\n};\nexport const headObject = composeServiceApi(s3TransferHandler, headObjectSerializer, headObjectDeserializer, { ...defaultConfig, responseType: 'text' });\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,oBAAoB,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACxD,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AACvD,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;AACnD,IAAI,GAAG,CAAC,QAAQ,GAAG,0BAA0B,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;AAC7D,IAAI,iBAAiB,CAAC;AACtB,QAAQ,UAAU,EAAE,KAAK,CAAC,MAAM;AAChC,QAAQ,GAAG,EAAE,KAAK,CAAC,GAAG;AACtB,QAAQ,SAAS,EAAE,GAAG;AACtB,KAAK,CAAC;AACN,IAAI,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAC1C,QAAQ,6BAA6B,EAAE,KAAK,CAAC,mBAAmB;AAChE,KAAK,CAAC;AACN,IAAI,OAAO;AACX,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,OAAO;AACf,QAAQ,GAAG;AACX,KAAK;AACL,CAAC;AACD,MAAM,sBAAsB,GAAG,OAAO,QAAQ,KAAK;AACnD,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC;AACA,QAAQ,MAAM,wBAAwB,EAAE,MAAM,aAAa,CAAC,QAAQ,CAAC,EAAE;AACvE,IAAI;AACJ,SAAS;AACT,QAAQ,MAAM,QAAQ,GAAG;AACzB,YAAY,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE;AACrC,gBAAgB,aAAa,EAAE,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;AACpE,gBAAgB,WAAW,EAAE,cAAc;AAC3C,gBAAgB,IAAI,EAAE,MAAM;AAC5B,gBAAgB,YAAY,EAAE,CAAC,eAAe,EAAE,oBAAoB,CAAC;AACrE,gBAAgB,SAAS,EAAE,kBAAkB;AAC7C,aAAa,CAAC;AACd,YAAY,QAAQ,EAAE,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC;AAC3D,SAAS;AACT,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC9C,YAAY,GAAG,QAAQ;AACvB,SAAS;AACT,IAAI;AACJ,CAAC;AACW,MAAC,UAAU,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE;;;;"}
1
+ {"version":3,"file":"headObject.mjs","sources":["../../../../../../../src/providers/s3/utils/client/s3data/headObject.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseMetadata, } from '@aws-amplify/core/internals/aws-client-utils';\nimport { AmplifyUrl, AmplifyUrlSearchParams, } from '@aws-amplify/core/internals/utils';\nimport { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';\nimport { assignStringVariables, buildStorageServiceError, deserializeMetadata, deserializeNumber, deserializeTimestamp, map, s3TransferHandler, serializePathnameObjectKey, validateS3RequiredParameter, } from '../utils';\nimport { validateObjectUrl } from '../../validateObjectUrl';\nimport { defaultConfig, parseXmlError } from './base';\nconst headObjectSerializer = async (input, endpoint) => {\n const url = new AmplifyUrl(endpoint.url.toString());\n validateS3RequiredParameter(!!input.Key, 'Key');\n url.pathname = serializePathnameObjectKey(url, input.Key);\n url.search = new AmplifyUrlSearchParams({\n 'response-cache-control': 'no-store',\n }).toString();\n validateObjectUrl({\n bucketName: input.Bucket,\n key: input.Key,\n objectURL: url,\n });\n const headers = assignStringVariables({\n 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,\n });\n return {\n method: 'HEAD',\n headers,\n url,\n };\n};\nconst headObjectDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n // error is always set when statusCode >= 300\n throw buildStorageServiceError((await parseXmlError(response)));\n }\n else {\n const contents = {\n ...map(response.headers, {\n ContentLength: ['content-length', deserializeNumber],\n ContentType: 'content-type',\n ETag: 'etag',\n LastModified: ['last-modified', deserializeTimestamp],\n VersionId: 'x-amz-version-id',\n }),\n Metadata: deserializeMetadata(response.headers),\n };\n return {\n $metadata: parseMetadata(response),\n ...contents,\n };\n }\n};\nexport const headObject = composeServiceApi(s3TransferHandler, headObjectSerializer, headObjectDeserializer, { ...defaultConfig, responseType: 'text' });\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,oBAAoB,GAAG,OAAO,KAAK,EAAE,QAAQ,KAAK;AACxD,IAAI,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AACvD,IAAI,2BAA2B,CAAC,CAAC,CAAC,KAAK,C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AACT,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC9C,YAAY,GAAG,QAAQ;AACvB,SAAS;AACT,IAAI;AACJ,CAAC;AACW,MAAC,UAAU,GAAG,iBAAiB,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,EAAE,GAAG,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/storage",
3
- "version": "6.10.2-unstable.f59a4f7.0+f59a4f7",
3
+ "version": "6.11.1-unstable.a9e970f.0+a9e970f",
4
4
  "description": "Storage category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -108,12 +108,12 @@
108
108
  "./package.json": "./package.json"
109
109
  },
110
110
  "peerDependencies": {
111
- "@aws-amplify/core": "6.14.1-unstable.f59a4f7.0+f59a4f7"
111
+ "@aws-amplify/core": "6.15.1-unstable.a9e970f.0+a9e970f"
112
112
  },
113
113
  "devDependencies": {
114
- "@aws-amplify/core": "6.14.1-unstable.f59a4f7.0+f59a4f7",
115
- "@aws-amplify/react-native": "1.3.1-unstable.f59a4f7.0+f59a4f7",
114
+ "@aws-amplify/core": "6.15.1-unstable.a9e970f.0+a9e970f",
115
+ "@aws-amplify/react-native": "1.3.2-unstable.a9e970f.0+a9e970f",
116
116
  "@types/node": "20.14.12"
117
117
  },
118
- "gitHead": "f59a4f73a0ab824a71cc0e1ab51356ebb1cdd876"
118
+ "gitHead": "a9e970f3b1b4203c1f6b655b0dbc726a2027338c"
119
119
  }
@@ -77,6 +77,7 @@ const downloadDataJob =
77
77
  ...(downloadDataOptions?.bytesRange && {
78
78
  Range: `bytes=${downloadDataOptions.bytesRange.start}-${downloadDataOptions.bytesRange.end}`,
79
79
  }),
80
+ ResponseCacheControl: downloadDataOptions?.cacheControl,
80
81
  ExpectedBucketOwner: downloadDataOptions?.expectedBucketOwner,
81
82
  },
82
83
  );
@@ -82,6 +82,7 @@ export const getUrl = async (
82
82
  ...(getUrlOptions?.contentType && {
83
83
  ResponseContentType: getUrlOptions.contentType,
84
84
  }),
85
+ ResponseCacheControl: getUrlOptions?.cacheControl,
85
86
  ExpectedBucketOwner: getUrlOptions?.expectedBucketOwner,
86
87
  },
87
88
  ),
@@ -69,6 +69,7 @@ export const putObjectJob =
69
69
  checksumAlgorithm,
70
70
  onProgress,
71
71
  expectedBucketOwner,
72
+ cacheControl,
72
73
  } = uploadDataOptions ?? {};
73
74
 
74
75
  const checksumCRC32 =
@@ -96,6 +97,7 @@ export const putObjectJob =
96
97
  ContentType: contentType,
97
98
  ContentDisposition: constructContentDisposition(contentDisposition),
98
99
  ContentEncoding: contentEncoding,
100
+ CacheControl: cacheControl,
99
101
  Metadata: metadata,
100
102
  ContentMD5: contentMD5,
101
103
  ChecksumCRC32: checksumCRC32,
@@ -181,6 +181,11 @@ export type GetUrlOptions = CommonOptions & {
181
181
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
182
182
  */
183
183
  contentType?: string;
184
+ /**
185
+ * The cache-control header value of the file when downloading it.
186
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
187
+ */
188
+ cacheControl?: string;
184
189
  };
185
190
 
186
191
  /** @deprecated Use {@link GetUrlWithPathOptions} instead. */
@@ -192,7 +197,13 @@ export type GetUrlWithPathOptions = GetUrlOptions;
192
197
  */
193
198
  export type DownloadDataOptions = CommonOptions &
194
199
  TransferOptions &
195
- BytesRangeOptions;
200
+ BytesRangeOptions & {
201
+ /**
202
+ * The cache-control header value of the file when downloading it.
203
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
204
+ */
205
+ cacheControl?: string;
206
+ };
196
207
 
197
208
  /** @deprecated Use {@link DownloadDataWithPathOptions} instead. */
198
209
  export type DownloadDataWithKeyOptions = ReadOptions & DownloadDataOptions;
@@ -236,6 +247,11 @@ export type UploadDataOptions = CommonOptions &
236
247
  * @default undefined
237
248
  */
238
249
  checksumAlgorithm?: UploadDataChecksumAlgorithm;
250
+ /**
251
+ * The cache-control header value of the file when downloading it.
252
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
253
+ */
254
+ cacheControl?: string;
239
255
  };
240
256
 
241
257
  /** @deprecated Use {@link UploadDataWithPathOptions} instead. */
@@ -2,11 +2,11 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import {
5
- EMPTY_SHA256_HASH,
6
5
  Endpoint,
7
6
  HttpRequest,
8
7
  HttpResponse,
9
8
  PresignUrlOptions,
9
+ UNSIGNED_PAYLOAD,
10
10
  UserAgentOptions,
11
11
  parseMetadata,
12
12
  presignUrl,
@@ -18,7 +18,6 @@ import {
18
18
  } from '@aws-amplify/core/internals/utils';
19
19
 
20
20
  import {
21
- CONTENT_SHA256_HEADER,
22
21
  assignStringVariables,
23
22
  buildStorageServiceError,
24
23
  deserializeBoolean,
@@ -53,6 +52,7 @@ export type GetObjectInput = Pick<
53
52
  | 'ResponseContentDisposition'
54
53
  | 'ResponseContentType'
55
54
  | 'ExpectedBucketOwner'
55
+ | 'ResponseCacheControl'
56
56
  >;
57
57
 
58
58
  export type GetObjectOutput = GetObjectCommandOutput;
@@ -66,6 +66,9 @@ const getObjectSerializer = async (
66
66
  url.pathname = serializePathnameObjectKey(url, input.Key);
67
67
  url.search = new AmplifyUrlSearchParams({
68
68
  'x-id': 'GetObject',
69
+ ...(input.ResponseCacheControl && {
70
+ 'response-cache-control': input.ResponseCacheControl,
71
+ }),
69
72
  }).toString();
70
73
  validateObjectUrl({
71
74
  bucketName: input.Bucket,
@@ -172,10 +175,6 @@ export const getPresignedGetObjectUrl = async (
172
175
  const endpoint = defaultConfig.endpointResolver(config, input);
173
176
  const { url, headers, method } = await getObjectSerializer(input, endpoint);
174
177
 
175
- // TODO: set content sha256 query parameter with value of UNSIGNED-PAYLOAD instead of empty hash.
176
- // It requires changes in presignUrl. Without this change, the generated url still works,
177
- // but not the same as other tools like AWS SDK and CLI.
178
- url.searchParams.append(CONTENT_SHA256_HEADER, EMPTY_SHA256_HASH);
179
178
  if (config.userAgentValue) {
180
179
  url.searchParams.append(
181
180
  config.userAgentHeader ?? USER_AGENT_HEADER,
@@ -199,7 +198,7 @@ export const getPresignedGetObjectUrl = async (
199
198
  }
200
199
 
201
200
  return presignUrl(
202
- { method, url, body: undefined },
201
+ { method, url, body: UNSIGNED_PAYLOAD },
203
202
  {
204
203
  signingService: defaultConfig.service,
205
204
  signingRegion: config.region,
@@ -7,7 +7,10 @@ import {
7
7
  HttpResponse,
8
8
  parseMetadata,
9
9
  } from '@aws-amplify/core/internals/aws-client-utils';
10
- import { AmplifyUrl } from '@aws-amplify/core/internals/utils';
10
+ import {
11
+ AmplifyUrl,
12
+ AmplifyUrlSearchParams,
13
+ } from '@aws-amplify/core/internals/utils';
11
14
  import { composeServiceApi } from '@aws-amplify/core/internals/aws-client-utils/composers';
12
15
 
13
16
  import {
@@ -49,6 +52,9 @@ const headObjectSerializer = async (
49
52
  const url = new AmplifyUrl(endpoint.url.toString());
50
53
  validateS3RequiredParameter(!!input.Key, 'Key');
51
54
  url.pathname = serializePathnameObjectKey(url, input.Key);
55
+ url.search = new AmplifyUrlSearchParams({
56
+ 'response-cache-control': 'no-store',
57
+ }).toString();
52
58
  validateObjectUrl({
53
59
  bucketName: input.Bucket,
54
60
  key: input.Key,