@aws-amplify/storage 6.0.28 → 6.0.29-gen2-storage.e54bfa9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/errors/types/validation.js +22 -2
- package/dist/cjs/errors/types/validation.js.map +1 -1
- package/dist/cjs/providers/s3/apis/copy.js +2 -12
- package/dist/cjs/providers/s3/apis/copy.js.map +1 -1
- package/dist/cjs/providers/s3/apis/downloadData.js +13 -38
- package/dist/cjs/providers/s3/apis/downloadData.js.map +1 -1
- package/dist/cjs/providers/s3/apis/getProperties.js +2 -11
- package/dist/cjs/providers/s3/apis/getProperties.js.map +1 -1
- package/dist/cjs/providers/s3/apis/getUrl.js +2 -18
- package/dist/cjs/providers/s3/apis/getUrl.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/copy.js +41 -7
- package/dist/cjs/providers/s3/apis/internal/copy.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/getProperties.js +10 -6
- package/dist/cjs/providers/s3/apis/internal/getProperties.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/getUrl.js +8 -6
- package/dist/cjs/providers/s3/apis/internal/getUrl.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/list.js +86 -16
- package/dist/cjs/providers/s3/apis/internal/list.js.map +1 -1
- package/dist/cjs/providers/s3/apis/internal/remove.js +20 -7
- package/dist/cjs/providers/s3/apis/internal/remove.js.map +1 -1
- package/dist/cjs/providers/s3/apis/list.js +4 -4
- package/dist/cjs/providers/s3/apis/list.js.map +1 -1
- package/dist/cjs/providers/s3/apis/remove.js +2 -9
- package/dist/cjs/providers/s3/apis/remove.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/copy.js +4 -4
- package/dist/cjs/providers/s3/apis/server/copy.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/getProperties.js +2 -2
- package/dist/cjs/providers/s3/apis/server/getProperties.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/getUrl.js +2 -2
- package/dist/cjs/providers/s3/apis/server/getUrl.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/list.js +4 -4
- package/dist/cjs/providers/s3/apis/server/list.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/remove.js +2 -2
- package/dist/cjs/providers/s3/apis/server/remove.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/index.js +4 -50
- package/dist/cjs/providers/s3/apis/uploadData/index.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/initialUpload.js +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/initialUpload.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadCache.js +8 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadCache.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadHandlers.js +28 -13
- package/dist/cjs/providers/s3/apis/uploadData/multipart/uploadHandlers.js.map +1 -1
- package/dist/cjs/providers/s3/apis/uploadData/putObjectJob.js +10 -5
- package/dist/cjs/providers/s3/apis/uploadData/putObjectJob.js.map +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/parsePayload.js +1 -1
- package/dist/cjs/providers/s3/utils/client/utils/parsePayload.js.map +1 -1
- package/dist/cjs/providers/s3/utils/constants.js +4 -1
- package/dist/cjs/providers/s3/utils/constants.js.map +1 -1
- package/dist/cjs/providers/s3/utils/index.js +7 -1
- package/dist/cjs/providers/s3/utils/index.js.map +1 -1
- package/dist/cjs/providers/s3/utils/isInputWithPath.js +11 -0
- package/dist/cjs/providers/s3/utils/isInputWithPath.js.map +1 -0
- package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js +2 -1
- package/dist/cjs/providers/s3/utils/resolveS3ConfigAndInput.js.map +1 -1
- package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js +31 -0
- package/dist/cjs/providers/s3/utils/validateStorageOperationInput.js.map +1 -0
- package/dist/cjs/providers/s3/utils/validateStorageOperationInputWithPrefix.js +32 -0
- package/dist/cjs/providers/s3/utils/validateStorageOperationInputWithPrefix.js.map +1 -0
- package/dist/esm/errors/types/validation.d.ts +7 -2
- package/dist/esm/errors/types/validation.mjs +22 -2
- package/dist/esm/errors/types/validation.mjs.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/providers/s3/apis/copy.d.ts +22 -9
- package/dist/esm/providers/s3/apis/copy.mjs +2 -12
- package/dist/esm/providers/s3/apis/copy.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/downloadData.d.ts +41 -7
- package/dist/esm/providers/s3/apis/downloadData.mjs +15 -39
- package/dist/esm/providers/s3/apis/downloadData.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/getProperties.d.ts +18 -5
- package/dist/esm/providers/s3/apis/getProperties.mjs +2 -11
- package/dist/esm/providers/s3/apis/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/getUrl.d.ts +27 -7
- package/dist/esm/providers/s3/apis/getUrl.mjs +2 -18
- package/dist/esm/providers/s3/apis/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/copy.d.ts +4 -2
- package/dist/esm/providers/s3/apis/internal/copy.mjs +41 -6
- package/dist/esm/providers/s3/apis/internal/copy.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/getProperties.d.ts +2 -2
- package/dist/esm/providers/s3/apis/internal/getProperties.mjs +11 -6
- package/dist/esm/providers/s3/apis/internal/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/getUrl.d.ts +2 -2
- package/dist/esm/providers/s3/apis/internal/getUrl.mjs +10 -7
- package/dist/esm/providers/s3/apis/internal/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/list.d.ts +2 -2
- package/dist/esm/providers/s3/apis/internal/list.mjs +87 -16
- package/dist/esm/providers/s3/apis/internal/list.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/remove.d.ts +2 -2
- package/dist/esm/providers/s3/apis/internal/remove.mjs +21 -7
- package/dist/esm/providers/s3/apis/internal/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/list.d.ts +39 -22
- package/dist/esm/providers/s3/apis/list.mjs +2 -2
- package/dist/esm/providers/s3/apis/list.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/remove.d.ts +18 -5
- package/dist/esm/providers/s3/apis/remove.mjs +2 -9
- package/dist/esm/providers/s3/apis/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/copy.d.ts +27 -2
- package/dist/esm/providers/s3/apis/server/copy.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/copy.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/getProperties.d.ts +26 -2
- package/dist/esm/providers/s3/apis/server/getProperties.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/getUrl.d.ts +40 -2
- package/dist/esm/providers/s3/apis/server/getUrl.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/list.d.ts +41 -22
- package/dist/esm/providers/s3/apis/server/list.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/list.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/remove.d.ts +24 -2
- package/dist/esm/providers/s3/apis/server/remove.mjs +2 -2
- package/dist/esm/providers/s3/apis/server/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/index.d.ts +64 -7
- package/dist/esm/providers/s3/apis/uploadData/index.mjs +4 -50
- package/dist/esm/providers/s3/apis/uploadData/index.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.d.ts +2 -2
- package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.mjs +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/initialUpload.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.d.ts +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.mjs +8 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadCache.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.d.ts +4 -4
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.mjs +30 -14
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/putObjectJob.d.ts +3 -3
- package/dist/esm/providers/s3/apis/uploadData/putObjectJob.mjs +11 -5
- package/dist/esm/providers/s3/apis/uploadData/putObjectJob.mjs.map +1 -1
- package/dist/esm/providers/s3/index.d.ts +2 -2
- package/dist/esm/providers/s3/types/index.d.ts +3 -3
- package/dist/esm/providers/s3/types/inputs.d.ts +51 -11
- package/dist/esm/providers/s3/types/options.d.ts +41 -10
- package/dist/esm/providers/s3/types/outputs.d.ts +68 -13
- package/dist/esm/providers/s3/utils/client/utils/parsePayload.mjs +1 -1
- package/dist/esm/providers/s3/utils/client/utils/parsePayload.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/constants.d.ts +3 -0
- package/dist/esm/providers/s3/utils/constants.mjs +4 -1
- package/dist/esm/providers/s3/utils/constants.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/index.d.ts +3 -0
- package/dist/esm/providers/s3/utils/index.mjs +3 -0
- package/dist/esm/providers/s3/utils/index.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/isInputWithPath.d.ts +2 -0
- package/dist/esm/providers/s3/utils/isInputWithPath.mjs +8 -0
- package/dist/esm/providers/s3/utils/isInputWithPath.mjs.map +1 -0
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.d.ts +2 -1
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs +2 -1
- package/dist/esm/providers/s3/utils/resolveS3ConfigAndInput.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/validateStorageOperationInput.d.ts +5 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs +29 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInput.mjs.map +1 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.d.ts +5 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.mjs +30 -0
- package/dist/esm/providers/s3/utils/validateStorageOperationInputWithPrefix.mjs.map +1 -0
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/types/inputs.d.ts +41 -13
- package/dist/esm/types/options.d.ts +1 -0
- package/dist/esm/types/outputs.d.ts +26 -6
- package/package.json +107 -107
- package/src/errors/types/validation.ts +23 -2
- package/src/index.ts +16 -0
- package/src/providers/s3/apis/copy.ts +30 -11
- package/src/providers/s3/apis/downloadData.ts +78 -19
- package/src/providers/s3/apis/getProperties.ts +31 -8
- package/src/providers/s3/apis/getUrl.ts +37 -10
- package/src/providers/s3/apis/internal/copy.ts +89 -8
- package/src/providers/s3/apis/internal/getProperties.ts +27 -12
- package/src/providers/s3/apis/internal/getUrl.ts +28 -14
- package/src/providers/s3/apis/internal/list.ts +135 -29
- package/src/providers/s3/apis/internal/remove.ts +36 -13
- package/src/providers/s3/apis/list.ts +54 -26
- package/src/providers/s3/apis/remove.ts +28 -7
- package/src/providers/s3/apis/server/copy.ts +42 -5
- package/src/providers/s3/apis/server/getProperties.ts +41 -4
- package/src/providers/s3/apis/server/getUrl.ts +55 -4
- package/src/providers/s3/apis/server/list.ts +64 -32
- package/src/providers/s3/apis/server/remove.ts +39 -4
- package/src/providers/s3/apis/uploadData/index.ts +77 -8
- package/src/providers/s3/apis/uploadData/multipart/initialUpload.ts +4 -3
- package/src/providers/s3/apis/uploadData/multipart/uploadCache.ts +11 -2
- package/src/providers/s3/apis/uploadData/multipart/uploadHandlers.ts +50 -20
- package/src/providers/s3/apis/uploadData/putObjectJob.ts +23 -9
- package/src/providers/s3/index.ts +16 -0
- package/src/providers/s3/types/index.ts +37 -14
- package/src/providers/s3/types/inputs.ts +95 -26
- package/src/providers/s3/types/options.ts +73 -27
- package/src/providers/s3/types/outputs.ts +80 -13
- package/src/providers/s3/utils/client/utils/parsePayload.ts +1 -1
- package/src/providers/s3/utils/constants.ts +4 -0
- package/src/providers/s3/utils/index.ts +3 -0
- package/src/providers/s3/utils/isInputWithPath.ts +13 -0
- package/src/providers/s3/utils/resolveS3ConfigAndInput.ts +3 -2
- package/src/providers/s3/utils/validateStorageOperationInput.ts +39 -0
- package/src/providers/s3/utils/validateStorageOperationInputWithPrefix.ts +46 -0
- package/src/types/index.ts +16 -8
- package/src/types/inputs.ts +73 -20
- package/src/types/options.ts +1 -0
- package/src/types/outputs.ts +29 -6
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
2
|
-
import { GetUrlInput, GetUrlOutput } from '../../types';
|
|
3
|
-
export declare const getUrl: (amplify: AmplifyClassV6, input: GetUrlInput) => Promise<GetUrlOutput>;
|
|
2
|
+
import { GetUrlInput, GetUrlOutput, GetUrlWithPathInput, GetUrlWithPathOutput } from '../../types';
|
|
3
|
+
export declare const getUrl: (amplify: AmplifyClassV6, input: GetUrlInput | GetUrlWithPathInput) => Promise<GetUrlOutput | GetUrlWithPathOutput>;
|
|
@@ -21,18 +21,21 @@ import 'buffer';
|
|
|
21
21
|
import { resolveS3ConfigAndInput } from '../../utils/resolveS3ConfigAndInput.mjs';
|
|
22
22
|
import { assertValidationError } from '../../../../errors/utils/assertValidationError.mjs';
|
|
23
23
|
import '../../../../utils/logger.mjs';
|
|
24
|
-
import {
|
|
24
|
+
import { validateStorageOperationInput } from '../../utils/validateStorageOperationInput.mjs';
|
|
25
|
+
import { DEFAULT_PRESIGN_EXPIRATION, STORAGE_INPUT_KEY, MAX_URL_EXPIRATION } from '../../utils/constants.mjs';
|
|
25
26
|
import { getProperties } from './getProperties.mjs';
|
|
26
27
|
|
|
27
28
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
28
29
|
// SPDX-License-Identifier: Apache-2.0
|
|
29
30
|
const getUrl = async (amplify, input) => {
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const { options: getUrlOptions } = input;
|
|
32
|
+
const { s3Config, keyPrefix, bucket, identityId } = await resolveS3ConfigAndInput(amplify, getUrlOptions);
|
|
33
|
+
const { inputType, objectKey } = validateStorageOperationInput(input, identityId);
|
|
34
|
+
const finalKey = inputType === STORAGE_INPUT_KEY ? keyPrefix + objectKey : objectKey;
|
|
35
|
+
if (getUrlOptions?.validateObjectExistence) {
|
|
36
|
+
await getProperties(amplify, input, StorageAction.GetUrl);
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
let urlExpirationInSec = options?.expiresIn ?? DEFAULT_PRESIGN_EXPIRATION;
|
|
38
|
+
let urlExpirationInSec = getUrlOptions?.expiresIn ?? DEFAULT_PRESIGN_EXPIRATION;
|
|
36
39
|
const awsCredExpiration = s3Config.credentials?.expiration;
|
|
37
40
|
if (awsCredExpiration) {
|
|
38
41
|
const awsCredExpirationInSec = Math.floor((awsCredExpiration.getTime() - Date.now()) / 1000);
|
|
@@ -47,7 +50,7 @@ const getUrl = async (amplify, input) => {
|
|
|
47
50
|
expiration: urlExpirationInSec,
|
|
48
51
|
}, {
|
|
49
52
|
Bucket: bucket,
|
|
50
|
-
Key:
|
|
53
|
+
Key: finalKey,
|
|
51
54
|
}),
|
|
52
55
|
expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),
|
|
53
56
|
};
|
|
@@ -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';\nimport { resolveS3ConfigAndInput } from '../../utils';\nimport { assertValidationError } from '../../../../errors/utils/assertValidationError';\nimport { DEFAULT_PRESIGN_EXPIRATION, MAX_URL_EXPIRATION, } from '../../utils/constants';\nimport { getProperties } from './getProperties';\nexport const getUrl = async (amplify, input) => {\n const {
|
|
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';\nimport { resolveS3ConfigAndInput, validateStorageOperationInput, } from '../../utils';\nimport { assertValidationError } from '../../../../errors/utils/assertValidationError';\nimport { DEFAULT_PRESIGN_EXPIRATION, MAX_URL_EXPIRATION, STORAGE_INPUT_KEY, } from '../../utils/constants';\nimport { getProperties } from './getProperties';\nexport const getUrl = async (amplify, input) => {\n const { options: getUrlOptions } = input;\n const { s3Config, keyPrefix, bucket, identityId } = await resolveS3ConfigAndInput(amplify, getUrlOptions);\n const { inputType, objectKey } = validateStorageOperationInput(input, identityId);\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 awsCredExpiration = s3Config.credentials?.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 expiration: urlExpirationInSec,\n }, {\n Bucket: bucket,\n Key: finalKey,\n }),\n expiresAt: new Date(Date.now() + urlExpirationInSec * 1000),\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAQY,MAAC,MAAM,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;AAC7C,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAC9G,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,6BAA6B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AACtF,IAAI,MAAM,QAAQ,GAAG,SAAS,KAAK,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AACzF,IAAI,IAAI,aAAa,EAAE,uBAAuB,EAAE;AAChD,QAAQ,MAAM,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;AAClE,KAAK;AACL,IAAI,IAAI,kBAAkB,GAAG,aAAa,EAAE,SAAS,IAAI,0BAA0B,CAAC;AACpF,IAAI,MAAM,iBAAiB,GAAG,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;AAC/D,IAAI,IAAI,iBAAiB,EAAE;AAC3B,QAAQ,MAAM,sBAAsB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,iBAAiB,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,CAAC;AACrG,QAAQ,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,sBAAsB,EAAE,kBAAkB,CAAC,CAAC;AAClF,KAAK;AACL,IAAI,MAAM,qBAAqB,GAAG,kBAAkB,GAAG,IAAI,CAAC;AAC5D,IAAI,qBAAqB,CAAC,kBAAkB,IAAI,qBAAqB,EAAE,0BAA0B,CAAC,2BAA2B,CAAC,CAAC;AAC/H;AACA,IAAI,OAAO;AACX,QAAQ,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC5C,YAAY,GAAG,QAAQ;AACvB,YAAY,UAAU,EAAE,kBAAkB;AAC1C,SAAS,EAAE;AACX,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,GAAG,EAAE,QAAQ;AACzB,SAAS,CAAC;AACV,QAAQ,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,GAAG,IAAI,CAAC;AACnE,KAAK,CAAC;AACN;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
2
|
-
import { ListAllInput, ListAllOutput, ListPaginateInput, ListPaginateOutput } from '../../types';
|
|
3
|
-
export declare const list: (amplify: AmplifyClassV6, input
|
|
2
|
+
import { ListAllInput, ListAllOutput, ListAllWithPathInput, ListAllWithPathOutput, ListPaginateInput, ListPaginateOutput, ListPaginateWithPathInput, ListPaginateWithPathOutput } from '../../types';
|
|
3
|
+
export declare const list: (amplify: AmplifyClassV6, input: ListAllInput | ListPaginateInput | ListAllWithPathInput | ListPaginateWithPathInput) => Promise<ListAllOutput | ListPaginateOutput | ListAllWithPathOutput | ListPaginateWithPathOutput>;
|
|
@@ -8,6 +8,8 @@ import 'buffer';
|
|
|
8
8
|
import { resolveS3ConfigAndInput } from '../../utils/resolveS3ConfigAndInput.mjs';
|
|
9
9
|
import '../../../../errors/types/validation.mjs';
|
|
10
10
|
import { logger } from '../../../../utils/logger.mjs';
|
|
11
|
+
import { STORAGE_INPUT_PREFIX } from '../../utils/constants.mjs';
|
|
12
|
+
import { validateStorageOperationInputWithPrefix } from '../../utils/validateStorageOperationInputWithPrefix.mjs';
|
|
11
13
|
import '../../utils/client/base.mjs';
|
|
12
14
|
import '../../utils/client/getObject.mjs';
|
|
13
15
|
import { listObjectsV2 } from '../../utils/client/listObjectsV2.mjs';
|
|
@@ -26,8 +28,10 @@ import { getStorageUserAgentValue } from '../../utils/userAgent.mjs';
|
|
|
26
28
|
// SPDX-License-Identifier: Apache-2.0
|
|
27
29
|
const MAX_PAGE_SIZE = 1000;
|
|
28
30
|
const list = async (amplify, input) => {
|
|
29
|
-
const { options = {}
|
|
30
|
-
const { s3Config, bucket, keyPrefix:
|
|
31
|
+
const { options = {} } = input;
|
|
32
|
+
const { s3Config, bucket, keyPrefix: generatedPrefix, identityId, } = await resolveS3ConfigAndInput(amplify, options);
|
|
33
|
+
const { inputType, objectKey } = validateStorageOperationInputWithPrefix(input, identityId);
|
|
34
|
+
const isInputWithPrefix = inputType === STORAGE_INPUT_PREFIX;
|
|
31
35
|
// @ts-expect-error pageSize and nextToken should not coexist with listAll
|
|
32
36
|
if (options?.listAll && (options?.pageSize || options?.nextToken)) {
|
|
33
37
|
const anyOptions = options;
|
|
@@ -35,21 +39,42 @@ const list = async (amplify, input) => {
|
|
|
35
39
|
}
|
|
36
40
|
const listParams = {
|
|
37
41
|
Bucket: bucket,
|
|
38
|
-
Prefix: `${
|
|
42
|
+
Prefix: isInputWithPrefix ? `${generatedPrefix}${objectKey}` : objectKey,
|
|
39
43
|
MaxKeys: options?.listAll ? undefined : options?.pageSize,
|
|
40
44
|
ContinuationToken: options?.listAll ? undefined : options?.nextToken,
|
|
41
45
|
};
|
|
42
46
|
logger.debug(`listing items from "${listParams.Prefix}"`);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
const listInputArgs = {
|
|
48
|
+
s3Config,
|
|
49
|
+
listParams,
|
|
50
|
+
};
|
|
51
|
+
if (options.listAll) {
|
|
52
|
+
if (isInputWithPrefix) {
|
|
53
|
+
return _listAllWithPrefix({
|
|
54
|
+
...listInputArgs,
|
|
55
|
+
generatedPrefix,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return _listAllWithPath(listInputArgs);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
if (isInputWithPrefix) {
|
|
64
|
+
return _listWithPrefix({ ...listInputArgs, generatedPrefix });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return _listWithPath(listInputArgs);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
46
70
|
};
|
|
47
|
-
|
|
71
|
+
/** @deprecated Use {@link _listAllWithPath} instead. */
|
|
72
|
+
const _listAllWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {
|
|
48
73
|
const listResult = [];
|
|
49
74
|
let continuationToken = listParams.ContinuationToken;
|
|
50
75
|
do {
|
|
51
|
-
const { items: pageResults, nextToken: pageNextToken } = await
|
|
52
|
-
|
|
76
|
+
const { items: pageResults, nextToken: pageNextToken } = await _listWithPrefix({
|
|
77
|
+
generatedPrefix,
|
|
53
78
|
s3Config,
|
|
54
79
|
listParams: {
|
|
55
80
|
...listParams,
|
|
@@ -64,7 +89,8 @@ const _listAll = async ({ s3Config, listParams, prefix, }) => {
|
|
|
64
89
|
items: listResult,
|
|
65
90
|
};
|
|
66
91
|
};
|
|
67
|
-
|
|
92
|
+
/** @deprecated Use {@link _listWithPath} instead. */
|
|
93
|
+
const _listWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {
|
|
68
94
|
const listParamsClone = { ...listParams };
|
|
69
95
|
if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {
|
|
70
96
|
logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);
|
|
@@ -79,14 +105,59 @@ const _list = async ({ s3Config, listParams, prefix, }) => {
|
|
|
79
105
|
items: [],
|
|
80
106
|
};
|
|
81
107
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
108
|
+
return {
|
|
109
|
+
items: response.Contents.map(item => ({
|
|
110
|
+
key: generatedPrefix
|
|
111
|
+
? item.Key.substring(generatedPrefix.length)
|
|
112
|
+
: item.Key,
|
|
113
|
+
eTag: item.ETag,
|
|
114
|
+
lastModified: item.LastModified,
|
|
115
|
+
size: item.Size,
|
|
116
|
+
})),
|
|
117
|
+
nextToken: response.NextContinuationToken,
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
const _listAllWithPath = async ({ s3Config, listParams, }) => {
|
|
121
|
+
const listResult = [];
|
|
122
|
+
let continuationToken = listParams.ContinuationToken;
|
|
123
|
+
do {
|
|
124
|
+
const { items: pageResults, nextToken: pageNextToken } = await _listWithPath({
|
|
125
|
+
s3Config,
|
|
126
|
+
listParams: {
|
|
127
|
+
...listParams,
|
|
128
|
+
ContinuationToken: continuationToken,
|
|
129
|
+
MaxKeys: MAX_PAGE_SIZE,
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
listResult.push(...pageResults);
|
|
133
|
+
continuationToken = pageNextToken;
|
|
134
|
+
} while (continuationToken);
|
|
88
135
|
return {
|
|
89
136
|
items: listResult,
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
const _listWithPath = async ({ s3Config, listParams, }) => {
|
|
140
|
+
const listParamsClone = { ...listParams };
|
|
141
|
+
if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {
|
|
142
|
+
logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);
|
|
143
|
+
listParamsClone.MaxKeys = MAX_PAGE_SIZE;
|
|
144
|
+
}
|
|
145
|
+
const response = await listObjectsV2({
|
|
146
|
+
...s3Config,
|
|
147
|
+
userAgentValue: getStorageUserAgentValue(StorageAction.List),
|
|
148
|
+
}, listParamsClone);
|
|
149
|
+
if (!response?.Contents) {
|
|
150
|
+
return {
|
|
151
|
+
items: [],
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
items: response.Contents.map(item => ({
|
|
156
|
+
path: item.Key,
|
|
157
|
+
eTag: item.ETag,
|
|
158
|
+
lastModified: item.LastModified,
|
|
159
|
+
size: item.Size,
|
|
160
|
+
})),
|
|
90
161
|
nextToken: response.NextContinuationToken,
|
|
91
162
|
};
|
|
92
163
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.mjs","sources":["../../../../../../src/providers/s3/apis/internal/list.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 { resolveS3ConfigAndInput } from '../../utils';\nimport { listObjectsV2, } from '../../utils/client';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\nimport { logger } from '../../../../utils';\nconst MAX_PAGE_SIZE = 1000;\nexport const list = async (amplify, input) => {\n const { options = {}, prefix: path = '' } = input ?? {};\n const { s3Config, bucket, keyPrefix: prefix, } = await resolveS3ConfigAndInput(amplify, options);\n // @ts-expect-error pageSize and nextToken should not coexist with listAll\n if (options?.listAll && (options?.pageSize || options?.nextToken)) {\n const anyOptions = options;\n logger.debug(`listAll is set to true, ignoring ${anyOptions?.pageSize ? `pageSize: ${anyOptions?.pageSize}` : ''} ${anyOptions?.nextToken ? `nextToken: ${anyOptions?.nextToken}` : ''}.`);\n }\n const listParams = {\n Bucket: bucket,\n Prefix: `${prefix}${path}`,\n MaxKeys: options?.listAll ? undefined : options?.pageSize,\n ContinuationToken: options?.listAll ? undefined : options?.nextToken,\n };\n logger.debug(`listing items from \"${listParams.Prefix}\"`);\n return options.listAll\n ? _listAll({ s3Config, listParams, prefix })\n : _list({ s3Config, listParams, prefix });\n};\nconst _listAll = async ({ s3Config, listParams, prefix, }) => {\n const listResult = [];\n let continuationToken = listParams.ContinuationToken;\n do {\n const { items: pageResults, nextToken: pageNextToken } = await _list({\n prefix,\n s3Config,\n listParams: {\n ...listParams,\n ContinuationToken: continuationToken,\n MaxKeys: MAX_PAGE_SIZE,\n },\n });\n listResult.push(...pageResults);\n continuationToken = pageNextToken;\n } while (continuationToken);\n return {\n items: listResult,\n };\n};\nconst _list = async ({ s3Config, listParams, prefix, }) => {\n const listParamsClone = { ...listParams };\n if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {\n logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n listParamsClone.MaxKeys = MAX_PAGE_SIZE;\n }\n const response = await listObjectsV2({\n ...s3Config,\n userAgentValue: getStorageUserAgentValue(StorageAction.List),\n }, listParamsClone);\n if (!response?.Contents) {\n return {\n items: [],\n };\n }\n const listResult = response.Contents.map(item => ({\n key: item.Key.substring(prefix.length),\n eTag: item.ETag,\n lastModified: item.LastModified,\n size: item.Size,\n }));\n return {\n items: listResult,\n nextToken: response.NextContinuationToken,\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAMA,MAAM,aAAa,GAAG,IAAI,CAAC;AACf,MAAC,IAAI,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AAC9C,IAAI,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;AAC5D,IAAI,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACrG;AACA,IAAI,IAAI,OAAO,EAAE,OAAO,KAAK,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,SAAS,CAAC,EAAE;AACvE,QAAQ,MAAM,UAAU,GAAG,OAAO,CAAC;AACnC,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC,iCAAiC,EAAE,UAAU,EAAE,QAAQ,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UA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AC;AACR,IAAI,OAAO;AACX,QAAQ,KAAK,EAAE,UAAU;AACzB,QAAQ,SAAS,EAAE,QAAQ,CAAC,qBAAqB;AACjD,KAAK,CAAC;AACN,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../../../src/providers/s3/apis/internal/list.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 { resolveS3ConfigAndInput, validateStorageOperationInputWithPrefix, } from '../../utils';\nimport { listObjectsV2, } from '../../utils/client';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\nimport { logger } from '../../../../utils';\nimport { STORAGE_INPUT_PREFIX } from '../../utils/constants';\nconst MAX_PAGE_SIZE = 1000;\nexport const list = async (amplify, input) => {\n const { options = {} } = input;\n const { s3Config, bucket, keyPrefix: generatedPrefix, identityId, } = await resolveS3ConfigAndInput(amplify, options);\n const { inputType, objectKey } = validateStorageOperationInputWithPrefix(input, identityId);\n const isInputWithPrefix = inputType === STORAGE_INPUT_PREFIX;\n // @ts-expect-error pageSize and nextToken should not coexist with listAll\n if (options?.listAll && (options?.pageSize || options?.nextToken)) {\n const anyOptions = options;\n logger.debug(`listAll is set to true, ignoring ${anyOptions?.pageSize ? `pageSize: ${anyOptions?.pageSize}` : ''} ${anyOptions?.nextToken ? `nextToken: ${anyOptions?.nextToken}` : ''}.`);\n }\n const listParams = {\n Bucket: bucket,\n Prefix: isInputWithPrefix ? `${generatedPrefix}${objectKey}` : objectKey,\n MaxKeys: options?.listAll ? undefined : options?.pageSize,\n ContinuationToken: options?.listAll ? undefined : options?.nextToken,\n };\n logger.debug(`listing items from \"${listParams.Prefix}\"`);\n const listInputArgs = {\n s3Config,\n listParams,\n };\n if (options.listAll) {\n if (isInputWithPrefix) {\n return _listAllWithPrefix({\n ...listInputArgs,\n generatedPrefix,\n });\n }\n else {\n return _listAllWithPath(listInputArgs);\n }\n }\n else {\n if (isInputWithPrefix) {\n return _listWithPrefix({ ...listInputArgs, generatedPrefix });\n }\n else {\n return _listWithPath(listInputArgs);\n }\n }\n};\n/** @deprecated Use {@link _listAllWithPath} instead. */\nconst _listAllWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {\n const listResult = [];\n let continuationToken = listParams.ContinuationToken;\n do {\n const { items: pageResults, nextToken: pageNextToken } = await _listWithPrefix({\n generatedPrefix,\n s3Config,\n listParams: {\n ...listParams,\n ContinuationToken: continuationToken,\n MaxKeys: MAX_PAGE_SIZE,\n },\n });\n listResult.push(...pageResults);\n continuationToken = pageNextToken;\n } while (continuationToken);\n return {\n items: listResult,\n };\n};\n/** @deprecated Use {@link _listWithPath} instead. */\nconst _listWithPrefix = async ({ s3Config, listParams, generatedPrefix, }) => {\n const listParamsClone = { ...listParams };\n if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {\n logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n listParamsClone.MaxKeys = MAX_PAGE_SIZE;\n }\n const response = await listObjectsV2({\n ...s3Config,\n userAgentValue: getStorageUserAgentValue(StorageAction.List),\n }, listParamsClone);\n if (!response?.Contents) {\n return {\n items: [],\n };\n }\n return {\n items: response.Contents.map(item => ({\n key: generatedPrefix\n ? item.Key.substring(generatedPrefix.length)\n : item.Key,\n eTag: item.ETag,\n lastModified: item.LastModified,\n size: item.Size,\n })),\n nextToken: response.NextContinuationToken,\n };\n};\nconst _listAllWithPath = async ({ s3Config, listParams, }) => {\n const listResult = [];\n let continuationToken = listParams.ContinuationToken;\n do {\n const { items: pageResults, nextToken: pageNextToken } = await _listWithPath({\n s3Config,\n listParams: {\n ...listParams,\n ContinuationToken: continuationToken,\n MaxKeys: MAX_PAGE_SIZE,\n },\n });\n listResult.push(...pageResults);\n continuationToken = pageNextToken;\n } while (continuationToken);\n return {\n items: listResult,\n };\n};\nconst _listWithPath = async ({ s3Config, listParams, }) => {\n const listParamsClone = { ...listParams };\n if (!listParamsClone.MaxKeys || listParamsClone.MaxKeys > MAX_PAGE_SIZE) {\n logger.debug(`defaulting pageSize to ${MAX_PAGE_SIZE}.`);\n listParamsClone.MaxKeys = MAX_PAGE_SIZE;\n }\n const response = await listObjectsV2({\n ...s3Config,\n userAgentValue: getStorageUserAgentValue(StorageAction.List),\n }, listParamsClone);\n if (!response?.Contents) {\n return {\n items: [],\n };\n }\n return {\n items: response.Contents.map(item => ({\n path: item.Key,\n eTag: item.ETag,\n lastModified: item.LastModified,\n size: item.Size,\n })),\n nextToken: response.NextContinuationToken,\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOA,MAAM,aAAa,GAAG,IAAI,CAAC;AACf,MAAC,IAAI,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AAC9C,IAAI,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC;AACnC,IAAI,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,GAAG,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1H,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,uCAAuC,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAChG,IAAI,MAAM,iBAAiB,GAAG,SAAS,KAAK,oBAAoB,CAAC;AACjE;AACA,IAAI,IAAI,OAAO,EAAE,OAAO,KAAK,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,SAAS,CAAC,EAAE;AACvE,QAAQ,MAAM,UAAU,GAAG,OAAO,CAAC;AACnC,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC,iCAAiC,EAAE,UAAU,EAAE,QAAQ,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,GAAG,C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AM,aAAa,GAAG,OAAO,EAAE,QAAQ,EAAE,UAAU,GAAG,KAAK;AAC3D,IAAI,MAAM,eAAe,GAAG,EAAE,GAAG,UAAU,EAAE,CAAC;AAC9C,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,IAAI,eAAe,CAAC,OAAO,GAAG,aAAa,EAAE;AAC7E,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACjE,QAAQ,eAAe,CAAC,OAAO,GAAG,aAAa,CAAC;AAChD,KAAK;AACL,IAAI,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC;AACzC,QAAQ,GAAG,QAAQ;AACnB,QAAQ,cAAc,EAAE,wBAAwB,CAAC,aAAa,CAAC,IAAI,CAAC;AACpE,KAAK,EAAE,eAAe,CAAC,CAAC;AACxB,IAAI,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE;AAC7B,QAAQ,OAAO;AACf,YAAY,KAAK,EAAE,EAAE;AACrB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO;AACX,QAAQ,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK;AAC9C,YAAY,IAAI,EAAE,IAAI,CAAC,GAAG;AAC1B,YAAY,IAAI,EAAE,IAAI,CAAC,IAAI;AAC3B,YAAY,YAAY,EAAE,IAAI,CAAC,YAAY;AAC3C,YAAY,IAAI,EAAE,IAAI,CAAC,IAAI;AAC3B,SAAS,CAAC,CAAC;AACX,QAAQ,SAAS,EAAE,QAAQ,CAAC,qBAAqB;AACjD,KAAK,CAAC;AACN,CAAC;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AmplifyClassV6 } from '@aws-amplify/core';
|
|
2
|
-
import { RemoveInput, RemoveOutput } from '../../types';
|
|
3
|
-
export declare const remove: (amplify: AmplifyClassV6, input: RemoveInput) => Promise<RemoveOutput>;
|
|
2
|
+
import { RemoveInput, RemoveOutput, RemoveWithPathInput, RemoveWithPathOutput } from '../../types';
|
|
3
|
+
export declare const remove: (amplify: AmplifyClassV6, input: RemoveInput | RemoveWithPathInput) => Promise<RemoveOutput | RemoveWithPathOutput>;
|
|
@@ -8,6 +8,8 @@ import 'buffer';
|
|
|
8
8
|
import { resolveS3ConfigAndInput } from '../../utils/resolveS3ConfigAndInput.mjs';
|
|
9
9
|
import '../../../../errors/types/validation.mjs';
|
|
10
10
|
import { logger } from '../../../../utils/logger.mjs';
|
|
11
|
+
import { validateStorageOperationInput } from '../../utils/validateStorageOperationInput.mjs';
|
|
12
|
+
import { STORAGE_INPUT_KEY } from '../../utils/constants.mjs';
|
|
11
13
|
import '../../utils/client/base.mjs';
|
|
12
14
|
import '../../utils/client/getObject.mjs';
|
|
13
15
|
import '../../utils/client/listObjectsV2.mjs';
|
|
@@ -25,10 +27,18 @@ import { getStorageUserAgentValue } from '../../utils/userAgent.mjs';
|
|
|
25
27
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
26
28
|
// SPDX-License-Identifier: Apache-2.0
|
|
27
29
|
const remove = async (amplify, input) => {
|
|
28
|
-
const {
|
|
29
|
-
const { s3Config, keyPrefix, bucket } = await resolveS3ConfigAndInput(amplify, options);
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const { options = {} } = input ?? {};
|
|
31
|
+
const { s3Config, keyPrefix, bucket, identityId } = await resolveS3ConfigAndInput(amplify, options);
|
|
32
|
+
const { inputType, objectKey } = validateStorageOperationInput(input, identityId);
|
|
33
|
+
let finalKey;
|
|
34
|
+
if (inputType === STORAGE_INPUT_KEY) {
|
|
35
|
+
finalKey = `${keyPrefix}${objectKey}`;
|
|
36
|
+
logger.debug(`remove "${objectKey}" from "${finalKey}".`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
finalKey = objectKey;
|
|
40
|
+
logger.debug(`removing object in path "${finalKey}"`);
|
|
41
|
+
}
|
|
32
42
|
await deleteObject({
|
|
33
43
|
...s3Config,
|
|
34
44
|
userAgentValue: getStorageUserAgentValue(StorageAction.Remove),
|
|
@@ -36,9 +46,13 @@ const remove = async (amplify, input) => {
|
|
|
36
46
|
Bucket: bucket,
|
|
37
47
|
Key: finalKey,
|
|
38
48
|
});
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
return inputType === STORAGE_INPUT_KEY
|
|
50
|
+
? {
|
|
51
|
+
key: objectKey,
|
|
52
|
+
}
|
|
53
|
+
: {
|
|
54
|
+
path: objectKey,
|
|
55
|
+
};
|
|
42
56
|
};
|
|
43
57
|
|
|
44
58
|
export { remove };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.mjs","sources":["../../../../../../src/providers/s3/apis/internal/remove.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 { resolveS3ConfigAndInput } from '../../utils';\nimport { deleteObject } from '../../utils/client';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\nimport { logger } from '../../../../utils';\nexport const remove = async (amplify, input) => {\n const {
|
|
1
|
+
{"version":3,"file":"remove.mjs","sources":["../../../../../../src/providers/s3/apis/internal/remove.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 { resolveS3ConfigAndInput, validateStorageOperationInput, } from '../../utils';\nimport { deleteObject } from '../../utils/client';\nimport { getStorageUserAgentValue } from '../../utils/userAgent';\nimport { logger } from '../../../../utils';\nimport { STORAGE_INPUT_KEY } from '../../utils/constants';\nexport const remove = async (amplify, input) => {\n const { options = {} } = input ?? {};\n const { s3Config, keyPrefix, bucket, identityId } = await resolveS3ConfigAndInput(amplify, options);\n const { inputType, objectKey } = validateStorageOperationInput(input, identityId);\n let finalKey;\n if (inputType === STORAGE_INPUT_KEY) {\n finalKey = `${keyPrefix}${objectKey}`;\n logger.debug(`remove \"${objectKey}\" from \"${finalKey}\".`);\n }\n else {\n finalKey = objectKey;\n logger.debug(`removing object in path \"${finalKey}\"`);\n }\n await deleteObject({\n ...s3Config,\n userAgentValue: getStorageUserAgentValue(StorageAction.Remove),\n }, {\n Bucket: bucket,\n Key: finalKey,\n });\n return inputType === STORAGE_INPUT_KEY\n ? {\n key: objectKey,\n }\n : {\n path: objectKey,\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAOY,MAAC,MAAM,GAAG,OAAO,OAAO,EAAE,KAAK,KAAK;AAChD,IAAI,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC;AACzC,IAAI,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACxG,IAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,6BAA6B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AACtF,IAAI,IAAI,QAAQ,CAAC;AACjB,IAAI,IAAI,SAAS,KAAK,iBAAiB,EAAE;AACzC,QAAQ,QAAQ,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAC9C,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAClE,KAAK;AACL,SAAS;AACT,QAAQ,QAAQ,GAAG,SAAS,CAAC;AAC7B,QAAQ,MAAM,CAAC,KAAK,CAAC,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,KAAK;AACL,IAAI,MAAM,YAAY,CAAC;AACvB,QAAQ,GAAG,QAAQ;AACnB,QAAQ,cAAc,EAAE,wBAAwB,CAAC,aAAa,CAAC,MAAM,CAAC;AACtE,KAAK,EAAE;AACP,QAAQ,MAAM,EAAE,MAAM;AACtB,QAAQ,GAAG,EAAE,QAAQ;AACrB,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,SAAS,KAAK,iBAAiB;AAC1C,UAAU;AACV,YAAY,GAAG,EAAE,SAAS;AAC1B,SAAS;AACT,UAAU;AACV,YAAY,IAAI,EAAE,SAAS;AAC3B,SAAS,CAAC;AACV;;;;"}
|
|
@@ -1,22 +1,39 @@
|
|
|
1
|
-
import { ListAllInput, ListAllOutput, ListPaginateInput, ListPaginateOutput } from '../types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { ListAllInput, ListAllOutput, ListAllWithPathInput, ListAllWithPathOutput, ListPaginateInput, ListPaginateOutput, ListPaginateWithPathInput, ListPaginateWithPathOutput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* List files in pages with the given `path`.
|
|
4
|
+
* `pageSize` is defaulted to 1000. Additionally, the result will include a `nextToken` if there are more items to retrieve.
|
|
5
|
+
* @param input - The `ListPaginateWithPathInput` object.
|
|
6
|
+
* @returns A list of objects with path and metadata
|
|
7
|
+
* @throws service: `S3Exception` - S3 service errors thrown when checking for existence of bucket
|
|
8
|
+
* @throws validation: `StorageValidationErrorCode` - thrown when there are issues with credentials
|
|
9
|
+
*/
|
|
10
|
+
export declare function list(input: ListPaginateWithPathInput): Promise<ListPaginateWithPathOutput>;
|
|
11
|
+
/**
|
|
12
|
+
* List all files from S3 for a given `path`. You can set `listAll` to true in `options` to get all the files from S3.
|
|
13
|
+
* @param input - The `ListAllWithPathInput` object.
|
|
14
|
+
* @returns A list of all objects with path and metadata
|
|
15
|
+
* @throws service: `S3Exception` - S3 service errors thrown when checking for existence of bucket
|
|
16
|
+
* @throws validation: `StorageValidationErrorCode` - thrown when there are issues with credentials
|
|
17
|
+
*/
|
|
18
|
+
export declare function list(input: ListAllWithPathInput): Promise<ListAllWithPathOutput>;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated The `prefix` and `accessLevel` parameters are deprecated and may be removed in the next major version.
|
|
21
|
+
* Please use {@link https://docs.amplify.aws/react/build-a-backend/storage/list | path} instead.
|
|
22
|
+
* List files in pages with the given `prefix`.
|
|
23
|
+
* `pageSize` is defaulted to 1000. Additionally, the result will include a `nextToken` if there are more items to retrieve.
|
|
24
|
+
* @param input - The `ListPaginateInput` object.
|
|
25
|
+
* @returns A list of objects with key and metadata
|
|
26
|
+
* @throws service: `S3Exception` - S3 service errors thrown when checking for existence of bucket
|
|
27
|
+
* @throws validation: `StorageValidationErrorCode` - thrown when there are issues with credentials
|
|
28
|
+
*/
|
|
29
|
+
export declare function list(input?: ListPaginateInput): Promise<ListPaginateOutput>;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated The `prefix` and `accessLevel` parameters are deprecated and may be removed in the next major version.
|
|
32
|
+
* Please use {@link https://docs.amplify.aws/react/build-a-backend/storage/list | path} instead.
|
|
33
|
+
* List all files from S3 for a given `prefix`. You can set `listAll` to true in `options` to get all the files from S3.
|
|
34
|
+
* @param input - The `ListAllInput` object.
|
|
35
|
+
* @returns A list of all objects with key and metadata
|
|
36
|
+
* @throws service: `S3Exception` - S3 service errors thrown when checking for existence of bucket
|
|
37
|
+
* @throws validation: `StorageValidationErrorCode` - thrown when there are issues with credentials
|
|
38
|
+
*/
|
|
39
|
+
export declare function list(input?: ListAllInput): Promise<ListAllOutput>;
|
|
@@ -3,9 +3,9 @@ import { list as list$1 } from './internal/list.mjs';
|
|
|
3
3
|
|
|
4
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
|
|
6
|
+
function list(input) {
|
|
7
7
|
return list$1(Amplify, input ?? {});
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
export { list };
|
|
11
11
|
//# sourceMappingURL=list.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.mjs","sources":["../../../../../src/providers/s3/apis/list.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 { list as listInternal } from './internal/list';\nexport
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../../src/providers/s3/apis/list.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 { list as listInternal } from './internal/list';\nexport function list(input) {\n return listInternal(Amplify, input ?? {});\n}\n"],"names":["listInternal"],"mappings":";;;AAAA;AACA;AAGO,SAAS,IAAI,CAAC,KAAK,EAAE;AAC5B,IAAI,OAAOA,MAAY,CAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;AAC9C;;;;"}
|
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
import { RemoveInput, RemoveOutput } from '../types';
|
|
1
|
+
import { RemoveInput, RemoveOutput, RemoveWithPathInput, RemoveWithPathOutput } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Remove a file from your S3 bucket.
|
|
4
|
-
* @param input - The
|
|
4
|
+
* @param input - The `RemoveWithPathInput` object.
|
|
5
|
+
* @return Output containing the removed object path.
|
|
6
|
+
* @throws service: `S3Exception` - S3 service errors thrown while while removing the object.
|
|
7
|
+
* @throws validation: `StorageValidationErrorCode` - Validation errors thrown
|
|
8
|
+
* when there is no path or path is empty or path has a leading slash.
|
|
9
|
+
*/
|
|
10
|
+
export declare function remove(input: RemoveWithPathInput): Promise<RemoveWithPathOutput>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
|
|
13
|
+
* Please use {@link https://docs.amplify.aws/react/build-a-backend/storage/remove | path} instead.
|
|
14
|
+
*
|
|
15
|
+
* Remove a file from your S3 bucket.
|
|
16
|
+
* @param input - The `RemoveInput` object.
|
|
5
17
|
* @return Output containing the removed object key
|
|
6
|
-
* @throws service:
|
|
7
|
-
* @throws validation:
|
|
18
|
+
* @throws service: `S3Exception` - S3 service errors thrown while while removing the object
|
|
19
|
+
* @throws validation: `StorageValidationErrorCode` - Validation errors thrown
|
|
20
|
+
* when there is no key or its empty.
|
|
8
21
|
*/
|
|
9
|
-
export declare
|
|
22
|
+
export declare function remove(input: RemoveInput): Promise<RemoveOutput>;
|
|
@@ -3,16 +3,9 @@ import { remove as remove$1 } from './internal/remove.mjs';
|
|
|
3
3
|
|
|
4
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
|
|
7
|
-
* Remove a file from your S3 bucket.
|
|
8
|
-
* @param input - The RemoveInput object.
|
|
9
|
-
* @return Output containing the removed object key
|
|
10
|
-
* @throws service: {@link S3Exception} - S3 service errors thrown while getting properties
|
|
11
|
-
* @throws validation: {@link StorageValidationErrorCode } - Validation errors thrown
|
|
12
|
-
*/
|
|
13
|
-
const remove = (input) => {
|
|
6
|
+
function remove(input) {
|
|
14
7
|
return remove$1(Amplify, input);
|
|
15
|
-
}
|
|
8
|
+
}
|
|
16
9
|
|
|
17
10
|
export { remove };
|
|
18
11
|
//# sourceMappingURL=remove.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.mjs","sources":["../../../../../src/providers/s3/apis/remove.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 { remove as removeInternal } from './internal/remove';\
|
|
1
|
+
{"version":3,"file":"remove.mjs","sources":["../../../../../src/providers/s3/apis/remove.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 { remove as removeInternal } from './internal/remove';\nexport function remove(input) {\n return removeInternal(Amplify, input);\n}\n"],"names":["removeInternal"],"mappings":";;;AAAA;AACA;AAGO,SAAS,MAAM,CAAC,KAAK,EAAE;AAC9B,IAAI,OAAOA,QAAc,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC1C;;;;"}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
1
|
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
2
|
-
import { CopyInput, CopyOutput } from '../../types';
|
|
3
|
-
|
|
2
|
+
import { CopyInput, CopyOutput, CopyWithPathInput, CopyWithPathOutput } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Copy an object from a source to a destination object within the same bucket.
|
|
5
|
+
*
|
|
6
|
+
* @param contextSpec - The isolated server context.
|
|
7
|
+
* @param input - The `CopyWithPathInput` object.
|
|
8
|
+
* @returns Output containing the destination object path.
|
|
9
|
+
* @throws service: `S3Exception` - Thrown when checking for existence of the object
|
|
10
|
+
* @throws validation: `StorageValidationErrorCode` - Thrown when
|
|
11
|
+
* source or destination path is not defined.
|
|
12
|
+
*/
|
|
13
|
+
export declare function copy(contextSpec: AmplifyServer.ContextSpec, input: CopyWithPathInput): Promise<CopyWithPathOutput>;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
|
|
16
|
+
* Please use {@link https://docs.amplify.aws/react/build-a-backend/storage/copy | path} instead.
|
|
17
|
+
*
|
|
18
|
+
* Copy an object from a source to a destination object within the same bucket. Can optionally copy files across
|
|
19
|
+
* different accessLevel or identityId (if source object's accessLevel is 'protected').
|
|
20
|
+
*
|
|
21
|
+
* @param contextSpec - The isolated server context.
|
|
22
|
+
* @param input - The `CopyInput` object.
|
|
23
|
+
* @returns Output containing the destination object key.
|
|
24
|
+
* @throws service: `S3Exception` - Thrown when checking for existence of the object
|
|
25
|
+
* @throws validation: `StorageValidationErrorCode` - Thrown when
|
|
26
|
+
* source or destination key is not defined.
|
|
27
|
+
*/
|
|
28
|
+
export declare function copy(contextSpec: AmplifyServer.ContextSpec, input: CopyInput): Promise<CopyOutput>;
|
|
@@ -3,9 +3,9 @@ import { copy as copy$1 } from '../internal/copy.mjs';
|
|
|
3
3
|
|
|
4
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
|
|
6
|
+
function copy(contextSpec, input) {
|
|
7
7
|
return copy$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
export { copy };
|
|
11
11
|
//# sourceMappingURL=copy.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.mjs","sources":["../../../../../../src/providers/s3/apis/server/copy.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getAmplifyServerContext, } from '@aws-amplify/core/internals/adapter-core';\nimport { copy as copyInternal } from '../internal/copy';\nexport
|
|
1
|
+
{"version":3,"file":"copy.mjs","sources":["../../../../../../src/providers/s3/apis/server/copy.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getAmplifyServerContext, } from '@aws-amplify/core/internals/adapter-core';\nimport { copy as copyInternal } from '../internal/copy';\nexport function copy(contextSpec, input) {\n return copyInternal(getAmplifyServerContext(contextSpec).amplify, input);\n}\n"],"names":["copyInternal"],"mappings":";;;AAAA;AACA;AAGO,SAAS,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE;AACzC,IAAI,OAAOA,MAAY,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC7E;;;;"}
|
|
@@ -1,3 +1,27 @@
|
|
|
1
1
|
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
2
|
-
import { GetPropertiesInput, GetPropertiesOutput } from '../../types';
|
|
3
|
-
|
|
2
|
+
import { GetPropertiesInput, GetPropertiesOutput, GetPropertiesWithPathInput, GetPropertiesWithPathOutput } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the properties of a file. The properties include S3 system metadata and
|
|
5
|
+
* the user metadata that was provided when uploading the file.
|
|
6
|
+
*
|
|
7
|
+
* @param contextSpec - The isolated server context.
|
|
8
|
+
* @param input - The `GetPropertiesWithPathInput` object.
|
|
9
|
+
* @returns Requested object properties.
|
|
10
|
+
* @throws An `S3Exception` when the underlying S3 service returned error.
|
|
11
|
+
* @throws A `StorageValidationErrorCode` when API call parameters are invalid.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getProperties(contextSpec: AmplifyServer.ContextSpec, input: GetPropertiesWithPathInput): Promise<GetPropertiesWithPathOutput>;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
|
|
16
|
+
* Please use {@link https://docs.amplify.aws/javascript/build-a-backend/storage/get-properties/ | path} instead.
|
|
17
|
+
*
|
|
18
|
+
* Gets the properties of a file. The properties include S3 system metadata and
|
|
19
|
+
* the user metadata that was provided when uploading the file.
|
|
20
|
+
*
|
|
21
|
+
* @param contextSpec - The isolated server context.
|
|
22
|
+
* @param input - The `GetPropertiesInput` object.
|
|
23
|
+
* @returns Requested object properties.
|
|
24
|
+
* @throws An `S3Exception` when the underlying S3 service returned error.
|
|
25
|
+
* @throws A `StorageValidationErrorCode` when API call parameters are invalid.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getProperties(contextSpec: AmplifyServer.ContextSpec, input: GetPropertiesInput): Promise<GetPropertiesOutput>;
|
|
@@ -3,9 +3,9 @@ import { getProperties as getProperties$1 } from '../internal/getProperties.mjs'
|
|
|
3
3
|
|
|
4
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
|
|
6
|
+
function getProperties(contextSpec, input) {
|
|
7
7
|
return getProperties$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
export { getProperties };
|
|
11
11
|
//# sourceMappingURL=getProperties.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProperties.mjs","sources":["../../../../../../src/providers/s3/apis/server/getProperties.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getAmplifyServerContext, } from '@aws-amplify/core/internals/adapter-core';\nimport { getProperties as getPropertiesInternal } from '../internal/getProperties';\nexport
|
|
1
|
+
{"version":3,"file":"getProperties.mjs","sources":["../../../../../../src/providers/s3/apis/server/getProperties.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { getAmplifyServerContext, } from '@aws-amplify/core/internals/adapter-core';\nimport { getProperties as getPropertiesInternal } from '../internal/getProperties';\nexport function getProperties(contextSpec, input) {\n return getPropertiesInternal(getAmplifyServerContext(contextSpec).amplify, input);\n}\n"],"names":["getPropertiesInternal"],"mappings":";;;AAAA;AACA;AAGO,SAAS,aAAa,CAAC,WAAW,EAAE,KAAK,EAAE;AAClD,IAAI,OAAOA,eAAqB,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACtF;;;;"}
|