@aws-amplify/storage 6.0.20 → 6.0.21-gen2-storage.7da2b89.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 +18 -2
- package/dist/cjs/errors/types/validation.js.map +1 -1
- package/dist/cjs/providers/s3/apis/copy.js +1 -13
- package/dist/cjs/providers/s3/apis/copy.js.map +1 -1
- package/dist/cjs/providers/s3/apis/downloadData.js +11 -36
- package/dist/cjs/providers/s3/apis/downloadData.js.map +1 -1
- package/dist/cjs/providers/s3/apis/getProperties.js +1 -12
- package/dist/cjs/providers/s3/apis/getProperties.js.map +1 -1
- package/dist/cjs/providers/s3/apis/getUrl.js +1 -19
- 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 +13 -6
- package/dist/cjs/providers/s3/apis/internal/getUrl.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/remove.js +1 -10
- package/dist/cjs/providers/s3/apis/remove.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/copy.js +3 -5
- package/dist/cjs/providers/s3/apis/server/copy.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/getProperties.js +1 -3
- package/dist/cjs/providers/s3/apis/server/getProperties.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/getUrl.js +1 -3
- package/dist/cjs/providers/s3/apis/server/getUrl.js.map +1 -1
- package/dist/cjs/providers/s3/apis/server/remove.js +1 -3
- package/dist/cjs/providers/s3/apis/server/remove.js.map +1 -1
- package/dist/cjs/providers/s3/utils/constants.js +3 -1
- package/dist/cjs/providers/s3/utils/constants.js.map +1 -1
- package/dist/cjs/providers/s3/utils/index.js +5 -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/esm/errors/types/validation.d.ts +6 -2
- package/dist/esm/errors/types/validation.mjs +18 -2
- package/dist/esm/errors/types/validation.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/copy.d.ts +29 -12
- package/dist/esm/providers/s3/apis/copy.mjs +1 -13
- package/dist/esm/providers/s3/apis/copy.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/downloadData.d.ts +70 -32
- package/dist/esm/providers/s3/apis/downloadData.mjs +12 -36
- package/dist/esm/providers/s3/apis/downloadData.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/getProperties.d.ts +28 -11
- package/dist/esm/providers/s3/apis/getProperties.mjs +1 -12
- package/dist/esm/providers/s3/apis/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/getUrl.d.ts +42 -18
- package/dist/esm/providers/s3/apis/getUrl.mjs +1 -19
- package/dist/esm/providers/s3/apis/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/copy.d.ts +3 -1
- 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.mjs +11 -6
- package/dist/esm/providers/s3/apis/internal/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/internal/getUrl.mjs +15 -7
- package/dist/esm/providers/s3/apis/internal/getUrl.mjs.map +1 -1
- 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/remove.d.ts +26 -9
- package/dist/esm/providers/s3/apis/remove.mjs +1 -10
- package/dist/esm/providers/s3/apis/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/copy.d.ts +31 -2
- package/dist/esm/providers/s3/apis/server/copy.mjs +1 -3
- package/dist/esm/providers/s3/apis/server/copy.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/getProperties.d.ts +30 -2
- package/dist/esm/providers/s3/apis/server/getProperties.mjs +1 -3
- package/dist/esm/providers/s3/apis/server/getProperties.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/getUrl.d.ts +44 -2
- package/dist/esm/providers/s3/apis/server/getUrl.mjs +1 -3
- package/dist/esm/providers/s3/apis/server/getUrl.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/server/remove.d.ts +28 -2
- package/dist/esm/providers/s3/apis/server/remove.mjs +1 -3
- package/dist/esm/providers/s3/apis/server/remove.mjs.map +1 -1
- package/dist/esm/providers/s3/apis/uploadData/multipart/uploadHandlers.d.ts +1 -1
- package/dist/esm/providers/s3/apis/uploadData/putObjectJob.d.ts +1 -1
- package/dist/esm/providers/s3/types/index.d.ts +3 -3
- package/dist/esm/providers/s3/types/inputs.d.ts +29 -7
- package/dist/esm/providers/s3/types/options.d.ts +23 -5
- package/dist/esm/providers/s3/types/outputs.d.ts +33 -10
- package/dist/esm/providers/s3/utils/constants.d.ts +2 -0
- package/dist/esm/providers/s3/utils/constants.mjs +3 -1
- package/dist/esm/providers/s3/utils/constants.mjs.map +1 -1
- package/dist/esm/providers/s3/utils/index.d.ts +2 -0
- package/dist/esm/providers/s3/utils/index.mjs +2 -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/types/index.d.ts +2 -2
- package/dist/esm/types/inputs.d.ts +42 -8
- package/dist/esm/types/options.d.ts +1 -0
- package/dist/esm/types/outputs.d.ts +22 -6
- package/package.json +107 -107
- package/src/errors/types/validation.ts +19 -2
- package/src/providers/s3/apis/copy.ts +38 -15
- package/src/providers/s3/apis/downloadData.ts +105 -47
- package/src/providers/s3/apis/getProperties.ts +38 -15
- package/src/providers/s3/apis/getUrl.ts +48 -22
- package/src/providers/s3/apis/internal/copy.ts +90 -8
- package/src/providers/s3/apis/internal/getProperties.ts +19 -9
- package/src/providers/s3/apis/internal/getUrl.ts +29 -11
- package/src/providers/s3/apis/internal/remove.ts +28 -10
- package/src/providers/s3/apis/remove.ts +35 -12
- package/src/providers/s3/apis/server/copy.ts +49 -6
- package/src/providers/s3/apis/server/getProperties.ts +48 -6
- package/src/providers/s3/apis/server/getUrl.ts +56 -5
- package/src/providers/s3/apis/server/remove.ts +46 -5
- package/src/providers/s3/apis/uploadData/multipart/uploadHandlers.ts +1 -1
- package/src/providers/s3/apis/uploadData/putObjectJob.ts +1 -1
- package/src/providers/s3/types/index.ts +26 -5
- package/src/providers/s3/types/inputs.ts +64 -18
- package/src/providers/s3/types/options.ts +44 -21
- package/src/providers/s3/types/outputs.ts +47 -10
- package/src/providers/s3/utils/constants.ts +3 -0
- package/src/providers/s3/utils/index.ts +2 -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/types/index.ts +12 -5
- package/src/types/inputs.ts +61 -11
- package/src/types/options.ts +1 -0
- package/src/types/outputs.ts +25 -6
|
@@ -3,9 +3,7 @@ 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
|
-
const copy =
|
|
7
|
-
return copy$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
8
|
-
};
|
|
6
|
+
const copy = (contextSpec, input) => copy$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
9
7
|
|
|
10
8
|
export { copy };
|
|
11
9
|
//# 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 const copy =
|
|
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 const copy = (contextSpec, input) => copyInternal(getAmplifyServerContext(contextSpec).amplify, input);\n"],"names":["copyInternal"],"mappings":";;;AAAA;AACA;AAGY,MAAC,IAAI,GAAG,CAAC,WAAW,EAAE,KAAK,KAAKA,MAAY,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK;;;;"}
|
|
@@ -1,3 +1,31 @@
|
|
|
1
1
|
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { GetPropertiesInputKey, GetPropertiesInputPath, GetPropertiesOutputKey, GetPropertiesOutputPath } from '../../types';
|
|
3
|
+
interface GetProperties {
|
|
4
|
+
/**
|
|
5
|
+
* Gets the properties of a file. The properties include S3 system metadata and
|
|
6
|
+
* the user metadata that was provided when uploading the file.
|
|
7
|
+
*
|
|
8
|
+
* @param contextSpec - The isolated server context.
|
|
9
|
+
* @param input - The `GetPropertiesInputPath` object.
|
|
10
|
+
* @returns Requested object properties.
|
|
11
|
+
* @throws An `S3Exception` when the underlying S3 service returned error.
|
|
12
|
+
* @throws A `StorageValidationErrorCode` when API call parameters are invalid.
|
|
13
|
+
*/
|
|
14
|
+
(contextSpec: AmplifyServer.ContextSpec, input: GetPropertiesInputPath): Promise<GetPropertiesOutputPath>;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
|
|
17
|
+
* Please use {@link https://docs.amplify.aws/javascript/build-a-backend/storage/get-properties/ | path} instead.
|
|
18
|
+
*
|
|
19
|
+
* Gets the properties of a file. The properties include S3 system metadata and
|
|
20
|
+
* the user metadata that was provided when uploading the file.
|
|
21
|
+
*
|
|
22
|
+
* @param contextSpec - The isolated server context.
|
|
23
|
+
* @param input - The `GetPropertiesInputKey` object.
|
|
24
|
+
* @returns Requested object properties.
|
|
25
|
+
* @throws An `S3Exception` when the underlying S3 service returned error.
|
|
26
|
+
* @throws A `StorageValidationErrorCode` when API call parameters are invalid.
|
|
27
|
+
*/
|
|
28
|
+
(contextSpec: AmplifyServer.ContextSpec, input: GetPropertiesInputKey): Promise<GetPropertiesOutputKey>;
|
|
29
|
+
}
|
|
30
|
+
export declare const getProperties: GetProperties;
|
|
31
|
+
export {};
|
|
@@ -3,9 +3,7 @@ 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
|
-
const getProperties = (contextSpec, input) =>
|
|
7
|
-
return getProperties$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
8
|
-
};
|
|
6
|
+
const getProperties = (contextSpec, input) => getProperties$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
9
7
|
|
|
10
8
|
export { getProperties };
|
|
11
9
|
//# 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 const getProperties = (contextSpec, input) =>
|
|
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 const getProperties = (contextSpec, input) => getPropertiesInternal(getAmplifyServerContext(contextSpec).amplify, input);\n"],"names":["getPropertiesInternal"],"mappings":";;;AAAA;AACA;AAGY,MAAC,aAAa,GAAG,CAAC,WAAW,EAAE,KAAK,KAAKA,eAAqB,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK;;;;"}
|
|
@@ -1,3 +1,45 @@
|
|
|
1
1
|
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { GetUrlInputKey, GetUrlInputPath, GetUrlOutput } from '../../types';
|
|
3
|
+
interface GetUrl {
|
|
4
|
+
/**
|
|
5
|
+
* Get a temporary presigned URL to download the specified S3 object.
|
|
6
|
+
* The presigned URL expires when the associated role used to sign the request expires or
|
|
7
|
+
* the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
|
|
8
|
+
*
|
|
9
|
+
* By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
|
|
10
|
+
* to true, this method will verify the given object already exists in S3 before returning a presigned
|
|
11
|
+
* URL, and will throw `StorageError` if the object does not exist.
|
|
12
|
+
*
|
|
13
|
+
* @param contextSpec - The isolated server context.
|
|
14
|
+
* @param input - The `GetUrlInputPath` object.
|
|
15
|
+
* @returns Presigned URL and timestamp when the URL MAY expire.
|
|
16
|
+
* @throws service: `S3Exception` - thrown when checking for existence of the object
|
|
17
|
+
* @throws validation: `StorageValidationErrorCode` - Validation errors
|
|
18
|
+
* thrown either username or key are not defined.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
(contextSpec: AmplifyServer.ContextSpec, input: GetUrlInputPath): Promise<GetUrlOutput>;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated The `key` and `accessLevel` parameters are deprecated and may be removed in the next major version.
|
|
24
|
+
* Please use {@link https://docs.amplify.aws/javascript/build-a-backend/storage/download/#generate-a-download-url | path} instead.
|
|
25
|
+
*
|
|
26
|
+
* Get a temporary presigned URL to download the specified S3 object.
|
|
27
|
+
* The presigned URL expires when the associated role used to sign the request expires or
|
|
28
|
+
* the option `expiresIn` is reached. The `expiresAt` property in the output object indicates when the URL MAY expire.
|
|
29
|
+
*
|
|
30
|
+
* By default, it will not validate the object that exists in S3. If you set the `options.validateObjectExistence`
|
|
31
|
+
* to true, this method will verify the given object already exists in S3 before returning a presigned
|
|
32
|
+
* URL, and will throw `StorageError` if the object does not exist.
|
|
33
|
+
*
|
|
34
|
+
* @param contextSpec - The isolated server context.
|
|
35
|
+
* @param input - The `GetUrlInputKey` object.
|
|
36
|
+
* @returns Presigned URL and timestamp when the URL MAY expire.
|
|
37
|
+
* @throws service: `S3Exception` - thrown when checking for existence of the object
|
|
38
|
+
* @throws validation: `StorageValidationErrorCode` - Validation errors
|
|
39
|
+
* thrown either username or key are not defined.
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
(contextSpec: AmplifyServer.ContextSpec, input: GetUrlInputKey): Promise<GetUrlOutput>;
|
|
43
|
+
}
|
|
44
|
+
export declare const getUrl: GetUrl;
|
|
45
|
+
export {};
|
|
@@ -3,9 +3,7 @@ import { getUrl as getUrl$1 } from '../internal/getUrl.mjs';
|
|
|
3
3
|
|
|
4
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
-
const getUrl = async (contextSpec, input) =>
|
|
7
|
-
return getUrl$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
8
|
-
};
|
|
6
|
+
const getUrl = async (contextSpec, input) => getUrl$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
9
7
|
|
|
10
8
|
export { getUrl };
|
|
11
9
|
//# sourceMappingURL=getUrl.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUrl.mjs","sources":["../../../../../../src/providers/s3/apis/server/getUrl.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 { getUrl as getUrlInternal } from '../internal/getUrl';\nexport const getUrl = async (contextSpec, input) =>
|
|
1
|
+
{"version":3,"file":"getUrl.mjs","sources":["../../../../../../src/providers/s3/apis/server/getUrl.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 { getUrl as getUrlInternal } from '../internal/getUrl';\nexport const getUrl = async (contextSpec, input) => getUrlInternal(getAmplifyServerContext(contextSpec).amplify, input);\n"],"names":["getUrlInternal"],"mappings":";;;AAAA;AACA;AAGY,MAAC,MAAM,GAAG,OAAO,WAAW,EAAE,KAAK,KAAKA,QAAc,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK;;;;"}
|
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
import { AmplifyServer } from '@aws-amplify/core/internals/adapter-core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { RemoveInputKey, RemoveInputPath, RemoveOutputKey, RemoveOutputPath } from '../../types';
|
|
3
|
+
interface RemoveApi {
|
|
4
|
+
/**
|
|
5
|
+
* Remove a file from your S3 bucket.
|
|
6
|
+
* @param input - The `RemoveInputPath` object.
|
|
7
|
+
* @param contextSpec - The context spec used to get the Amplify server context.
|
|
8
|
+
* @return Output containing the removed object path.
|
|
9
|
+
* @throws service: `S3Exception` - S3 service errors thrown while while removing the object.
|
|
10
|
+
* @throws validation: `StorageValidationErrorCode` - Validation errors thrown
|
|
11
|
+
* when there is no path or path is empty or path has a leading slash.
|
|
12
|
+
*/
|
|
13
|
+
(contextSpec: AmplifyServer.ContextSpec, input: RemoveInputPath): Promise<RemoveOutputPath>;
|
|
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/remove | path} instead.
|
|
17
|
+
*
|
|
18
|
+
* Remove a file from your S3 bucket.
|
|
19
|
+
* @param input - The `RemoveInputKey` object.
|
|
20
|
+
* @param contextSpec - The context spec used to get the Amplify server context.
|
|
21
|
+
* @return Output containing the removed object key
|
|
22
|
+
* @throws service: `S3Exception` - S3 service errors thrown while while removing the object
|
|
23
|
+
* @throws validation: `StorageValidationErrorCode` - Validation errors thrown
|
|
24
|
+
* when there is no key or its empty.
|
|
25
|
+
*/
|
|
26
|
+
(contextSpec: AmplifyServer.ContextSpec, input: RemoveInputKey): Promise<RemoveOutputKey>;
|
|
27
|
+
}
|
|
28
|
+
export declare const remove: RemoveApi;
|
|
29
|
+
export {};
|
|
@@ -3,9 +3,7 @@ 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
|
-
const remove = (contextSpec, input) =>
|
|
7
|
-
return remove$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
8
|
-
};
|
|
6
|
+
const remove = (contextSpec, input) => remove$1(getAmplifyServerContext(contextSpec).amplify, input);
|
|
9
7
|
|
|
10
8
|
export { remove };
|
|
11
9
|
//# sourceMappingURL=remove.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.mjs","sources":["../../../../../../src/providers/s3/apis/server/remove.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 { remove as removeInternal } from '../internal/remove';\nexport const remove = (contextSpec, input) =>
|
|
1
|
+
{"version":3,"file":"remove.mjs","sources":["../../../../../../src/providers/s3/apis/server/remove.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 { remove as removeInternal } from '../internal/remove';\nexport const remove = (contextSpec, input) => removeInternal(getAmplifyServerContext(contextSpec).amplify, input);\n"],"names":["removeInternal"],"mappings":";;;AAAA;AACA;AAGY,MAAC,MAAM,GAAG,CAAC,WAAW,EAAE,KAAK,KAAKA,QAAc,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,KAAK;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UploadDataInput } from '../../../types';
|
|
2
|
-
import {
|
|
2
|
+
import { ItemKey as S3Item } from '../../../types/outputs';
|
|
3
3
|
/**
|
|
4
4
|
* Create closure hiding the multipart upload implementation details and expose the upload job and control functions(
|
|
5
5
|
* onPause, onResume, onCancel).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { DownloadDataOutput, GetUrlOutput, UploadDataOutput, ListOutputItem, ListAllOutput, ListPaginateOutput, GetPropertiesOutput, CopyOutput, RemoveOutput, } from './outputs';
|
|
3
|
-
export { CopyInput, GetPropertiesInput, GetUrlInput, ListAllInput, ListPaginateInput, RemoveInput, DownloadDataInput, UploadDataInput, } from './inputs';
|
|
1
|
+
export { GetUrlOptionsKey, GetUrlOptionsPath, UploadDataOptions, GetPropertiesOptionsKey, GetPropertiesOptionsPath, ListAllOptions, ListPaginateOptions, RemoveOptions, DownloadDataOptionsPath, DownloadDataOptionsKey, CopyDestinationOptionsKey, CopySourceOptionsKey, } from './options';
|
|
2
|
+
export { DownloadDataOutput, DownloadDataOutputKey, DownloadDataOutputPath, GetUrlOutput, UploadDataOutput, ListOutputItem, ListAllOutput, ListPaginateOutput, GetPropertiesOutput, GetPropertiesOutputKey, GetPropertiesOutputPath, CopyOutput, CopyOutputKey, CopyOutputPath, RemoveOutput, RemoveOutputKey, RemoveOutputPath, } from './outputs';
|
|
3
|
+
export { CopyInput, CopyInputKey, CopyInputPath, GetPropertiesInput, GetPropertiesInputKey, GetPropertiesInputPath, GetUrlInput, GetUrlInputKey, GetUrlInputPath, ListAllInput, ListPaginateInput, RemoveInputKey, RemoveInputPath, RemoveInput, DownloadDataInput, DownloadDataInputKey, DownloadDataInputPath, UploadDataInput, } from './inputs';
|
|
4
4
|
export { S3Exception } from './errors';
|
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { StrictUnion } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
import { StorageCopyInputKey, StorageCopyInputPath, StorageDownloadDataInputKey, StorageDownloadDataInputPath, StorageGetPropertiesInputKey, StorageGetPropertiesInputPath, StorageGetUrlInputKey, StorageGetUrlInputPath, StorageListInput, StorageRemoveInputKey, StorageRemoveInputPath, StorageUploadDataInput } from '../../../types';
|
|
3
|
+
import { CopyDestinationOptionsKey, CopySourceOptionsKey, DownloadDataOptionsKey, DownloadDataOptionsPath, GetPropertiesOptionsKey, GetPropertiesOptionsPath, GetUrlOptionsKey, GetUrlOptionsPath, ListAllOptions, ListPaginateOptions, RemoveOptions, UploadDataOptions } from '../types';
|
|
3
4
|
/**
|
|
4
5
|
* Input type for S3 copy API.
|
|
5
6
|
*/
|
|
6
|
-
export type CopyInput =
|
|
7
|
+
export type CopyInput = CopyInputKey | CopyInputPath;
|
|
8
|
+
/** @deprecated Use {@link CopyInputPath} instead. */
|
|
9
|
+
export type CopyInputKey = StorageCopyInputKey<CopySourceOptionsKey, CopyDestinationOptionsKey>;
|
|
10
|
+
export type CopyInputPath = StorageCopyInputPath;
|
|
7
11
|
/**
|
|
8
12
|
* Input type for S3 getProperties API.
|
|
9
13
|
*/
|
|
10
|
-
export type GetPropertiesInput =
|
|
14
|
+
export type GetPropertiesInput = StrictUnion<GetPropertiesInputKey | GetPropertiesInputPath>;
|
|
15
|
+
/** @deprecated Use {@link GetPropertiesInputPath} instead. */
|
|
16
|
+
export type GetPropertiesInputKey = StorageGetPropertiesInputKey<GetPropertiesOptionsKey>;
|
|
17
|
+
export type GetPropertiesInputPath = StorageGetPropertiesInputPath<GetPropertiesOptionsPath>;
|
|
11
18
|
/**
|
|
12
19
|
* Input type for S3 getUrl API.
|
|
13
20
|
*/
|
|
14
|
-
export type GetUrlInput =
|
|
21
|
+
export type GetUrlInput = StrictUnion<GetUrlInputKey | GetUrlInputPath>;
|
|
22
|
+
/** @deprecated Use {@link GetUrlInputPath} instead. */
|
|
23
|
+
export type GetUrlInputKey = StorageGetUrlInputKey<GetUrlOptionsKey>;
|
|
24
|
+
export type GetUrlInputPath = StorageGetUrlInputPath<GetUrlOptionsPath>;
|
|
15
25
|
/**
|
|
16
26
|
* Input type for S3 list API. Lists all bucket objects.
|
|
17
27
|
*/
|
|
@@ -20,14 +30,26 @@ export type ListAllInput = StorageListInput<ListAllOptions>;
|
|
|
20
30
|
* Input type for S3 list API. Lists bucket objects with pagination.
|
|
21
31
|
*/
|
|
22
32
|
export type ListPaginateInput = StorageListInput<ListPaginateOptions>;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use {@link RemoveInputPath} instead.
|
|
35
|
+
* Input type with key for S3 remove API.
|
|
36
|
+
*/
|
|
37
|
+
export type RemoveInputKey = StorageRemoveInputKey<RemoveOptions>;
|
|
38
|
+
/**
|
|
39
|
+
* Input type with path for S3 remove API.
|
|
40
|
+
*/
|
|
41
|
+
export type RemoveInputPath = StorageRemoveInputPath<Omit<RemoveOptions, 'accessLevel'>>;
|
|
23
42
|
/**
|
|
24
43
|
* Input type for S3 remove API.
|
|
25
44
|
*/
|
|
26
|
-
export type RemoveInput =
|
|
45
|
+
export type RemoveInput = StrictUnion<RemoveInputKey | RemoveInputPath>;
|
|
27
46
|
/**
|
|
28
47
|
* Input type for S3 downloadData API.
|
|
29
48
|
*/
|
|
30
|
-
export type DownloadDataInput =
|
|
49
|
+
export type DownloadDataInput = StrictUnion<DownloadDataInputKey | DownloadDataInputPath>;
|
|
50
|
+
/** @deprecated Use {@link DownloadDataInputPath} instead. */
|
|
51
|
+
export type DownloadDataInputKey = StorageDownloadDataInputKey<DownloadDataOptionsKey>;
|
|
52
|
+
export type DownloadDataInputPath = StorageDownloadDataInputPath<DownloadDataOptionsPath>;
|
|
31
53
|
/**
|
|
32
54
|
* Input type for S3 uploadData API.
|
|
33
55
|
*/
|
|
@@ -9,13 +9,19 @@ interface CommonOptions {
|
|
|
9
9
|
*/
|
|
10
10
|
useAccelerateEndpoint?: boolean;
|
|
11
11
|
}
|
|
12
|
+
/** @deprecated This may be removed in the next major version. */
|
|
12
13
|
type ReadOptions = {
|
|
14
|
+
/** @deprecated This may be removed in the next major version. */
|
|
13
15
|
accessLevel?: 'guest' | 'private';
|
|
14
16
|
} | {
|
|
17
|
+
/** @deprecated This may be removed in the next major version. */
|
|
15
18
|
accessLevel: 'protected';
|
|
19
|
+
/** @deprecated This may be removed in the next major version. */
|
|
16
20
|
targetIdentityId?: string;
|
|
17
21
|
};
|
|
22
|
+
/** @deprecated This may be removed in the next major version. */
|
|
18
23
|
interface WriteOptions {
|
|
24
|
+
/** @deprecated This may be removed in the next major version. */
|
|
19
25
|
accessLevel?: StorageAccessLevel;
|
|
20
26
|
}
|
|
21
27
|
interface BytesRangeOptions {
|
|
@@ -36,7 +42,9 @@ interface TransferOptions {
|
|
|
36
42
|
/**
|
|
37
43
|
* Input options type for S3 getProperties API.
|
|
38
44
|
*/
|
|
39
|
-
|
|
45
|
+
/** @deprecated Use {@link GetPropertiesOptionsPath} instead. */
|
|
46
|
+
export type GetPropertiesOptionsKey = ReadOptions & CommonOptions;
|
|
47
|
+
export type GetPropertiesOptionsPath = CommonOptions;
|
|
40
48
|
/**
|
|
41
49
|
* Input options type for S3 getProperties API.
|
|
42
50
|
*/
|
|
@@ -52,7 +60,7 @@ export type ListPaginateOptions = StorageListPaginateOptions & ReadOptions & Com
|
|
|
52
60
|
/**
|
|
53
61
|
* Input options type for S3 getUrl API.
|
|
54
62
|
*/
|
|
55
|
-
export type GetUrlOptions =
|
|
63
|
+
export type GetUrlOptions = CommonOptions & {
|
|
56
64
|
/**
|
|
57
65
|
* Whether to head object to make sure the object existence before downloading.
|
|
58
66
|
* @default false
|
|
@@ -64,10 +72,16 @@ export type GetUrlOptions = ReadOptions & CommonOptions & {
|
|
|
64
72
|
*/
|
|
65
73
|
expiresIn?: number;
|
|
66
74
|
};
|
|
75
|
+
/** @deprecated Use {@link GetUrlOptionsPath} instead. */
|
|
76
|
+
export type GetUrlOptionsKey = ReadOptions & GetUrlOptions;
|
|
77
|
+
export type GetUrlOptionsPath = GetUrlOptions;
|
|
67
78
|
/**
|
|
68
79
|
* Input options type for S3 downloadData API.
|
|
69
80
|
*/
|
|
70
|
-
export type DownloadDataOptions =
|
|
81
|
+
export type DownloadDataOptions = CommonOptions & TransferOptions & BytesRangeOptions;
|
|
82
|
+
/** @deprecated Use {@link DownloadDataOptionsPath} instead. */
|
|
83
|
+
export type DownloadDataOptionsKey = ReadOptions & DownloadDataOptions;
|
|
84
|
+
export type DownloadDataOptionsPath = DownloadDataOptions;
|
|
71
85
|
export type UploadDataOptions = WriteOptions & CommonOptions & TransferOptions & {
|
|
72
86
|
/**
|
|
73
87
|
* The default content-disposition header value of the file when downloading it.
|
|
@@ -90,10 +104,14 @@ export type UploadDataOptions = WriteOptions & CommonOptions & TransferOptions &
|
|
|
90
104
|
*/
|
|
91
105
|
metadata?: Record<string, string>;
|
|
92
106
|
};
|
|
93
|
-
|
|
107
|
+
/** @deprecated This may be removed in the next major version. */
|
|
108
|
+
export type CopySourceOptionsKey = ReadOptions & {
|
|
109
|
+
/** @deprecated This may be removed in the next major version. */
|
|
94
110
|
key: string;
|
|
95
111
|
};
|
|
96
|
-
|
|
112
|
+
/** @deprecated This may be removed in the next major version. */
|
|
113
|
+
export type CopyDestinationOptionsKey = WriteOptions & {
|
|
114
|
+
/** @deprecated This may be removed in the next major version. */
|
|
97
115
|
key: string;
|
|
98
116
|
};
|
|
99
117
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StrictUnion } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
import { DownloadTask, StorageDownloadDataOutput, StorageGetUrlOutput, StorageItemKey, StorageItemPath, StorageListOutput, UploadTask } from '../../../types';
|
|
2
3
|
/**
|
|
3
|
-
* type for S3 item.
|
|
4
|
+
* Base type for an S3 item.
|
|
4
5
|
*/
|
|
5
|
-
export interface
|
|
6
|
+
export interface ItemBase {
|
|
6
7
|
/**
|
|
7
8
|
* VersionId used to reference a specific version of the object.
|
|
8
9
|
*/
|
|
@@ -12,14 +13,22 @@ export interface Item extends StorageItem {
|
|
|
12
13
|
*/
|
|
13
14
|
contentType?: string;
|
|
14
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use {@link ItemPath} instead.
|
|
18
|
+
*/
|
|
19
|
+
export type ItemKey = ItemBase & StorageItemKey;
|
|
20
|
+
export type ItemPath = ItemBase & StorageItemPath;
|
|
15
21
|
/**
|
|
16
22
|
* type for S3 list item.
|
|
17
23
|
*/
|
|
18
|
-
export type ListOutputItem = Omit<
|
|
24
|
+
export type ListOutputItem = Omit<ItemKey, 'metadata'>;
|
|
25
|
+
/** @deprecated Use {@link DownloadDataOutputPath} instead. */
|
|
26
|
+
export type DownloadDataOutputKey = DownloadTask<StorageDownloadDataOutput<ItemKey>>;
|
|
27
|
+
export type DownloadDataOutputPath = DownloadTask<StorageDownloadDataOutput<ItemPath>>;
|
|
19
28
|
/**
|
|
20
29
|
* Output type for S3 downloadData API.
|
|
21
30
|
*/
|
|
22
|
-
export type DownloadDataOutput =
|
|
31
|
+
export type DownloadDataOutput = DownloadDataOutputKey | DownloadDataOutputPath;
|
|
23
32
|
/**
|
|
24
33
|
* Output type for S3 getUrl API.
|
|
25
34
|
*/
|
|
@@ -27,11 +36,14 @@ export type GetUrlOutput = StorageGetUrlOutput;
|
|
|
27
36
|
/**
|
|
28
37
|
* Output type for S3 uploadData API.
|
|
29
38
|
*/
|
|
30
|
-
export type UploadDataOutput = UploadTask<
|
|
39
|
+
export type UploadDataOutput = UploadTask<ItemKey>;
|
|
40
|
+
/** @deprecated Use {@link GetPropertiesOutputPath} instead. */
|
|
41
|
+
export type GetPropertiesOutputKey = ItemKey;
|
|
42
|
+
export type GetPropertiesOutputPath = ItemPath;
|
|
31
43
|
/**
|
|
32
44
|
* Output type for S3 getProperties API.
|
|
33
45
|
*/
|
|
34
|
-
export type GetPropertiesOutput =
|
|
46
|
+
export type GetPropertiesOutput = GetPropertiesOutputKey | GetPropertiesOutputPath;
|
|
35
47
|
/**
|
|
36
48
|
* Output type for S3 list API. Lists all bucket objects.
|
|
37
49
|
*/
|
|
@@ -43,10 +55,21 @@ export type ListPaginateOutput = StorageListOutput<ListOutputItem> & {
|
|
|
43
55
|
nextToken?: string;
|
|
44
56
|
};
|
|
45
57
|
/**
|
|
46
|
-
*
|
|
58
|
+
* @deprecated Use {@link CopyOutputPath} instead.
|
|
47
59
|
*/
|
|
48
|
-
export type
|
|
60
|
+
export type CopyOutputKey = Pick<ItemKey, 'key'>;
|
|
61
|
+
export type CopyOutputPath = Pick<ItemPath, 'path'>;
|
|
62
|
+
export type CopyOutput = StrictUnion<CopyOutputKey | CopyOutputPath>;
|
|
49
63
|
/**
|
|
50
64
|
* Output type for S3 remove API.
|
|
51
65
|
*/
|
|
52
|
-
export type RemoveOutput =
|
|
66
|
+
export type RemoveOutput = StrictUnion<RemoveOutputKey | RemoveOutputPath>;
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated Use {@link RemoveOutputPath} instead.
|
|
69
|
+
* Output helper type with key for S3 remove API.
|
|
70
|
+
*/
|
|
71
|
+
export type RemoveOutputKey = Pick<ItemKey, 'key'>;
|
|
72
|
+
/**
|
|
73
|
+
* Output helper type with path for S3 remove API.
|
|
74
|
+
*/
|
|
75
|
+
export type RemoveOutputPath = Pick<ItemPath, 'path'>;
|
|
@@ -7,3 +7,5 @@ export declare const MAX_OBJECT_SIZE: number;
|
|
|
7
7
|
export declare const MAX_PARTS_COUNT = 10000;
|
|
8
8
|
export declare const DEFAULT_QUEUE_SIZE = 4;
|
|
9
9
|
export declare const UPLOADS_STORAGE_KEY = "__uploadInProgress";
|
|
10
|
+
export declare const STORAGE_INPUT_KEY = "key";
|
|
11
|
+
export declare const STORAGE_INPUT_PATH = "path";
|
|
@@ -12,6 +12,8 @@ const MAX_OBJECT_SIZE = 5 * TiB;
|
|
|
12
12
|
const MAX_PARTS_COUNT = 10000;
|
|
13
13
|
const DEFAULT_QUEUE_SIZE = 4;
|
|
14
14
|
const UPLOADS_STORAGE_KEY = '__uploadInProgress';
|
|
15
|
+
const STORAGE_INPUT_KEY = 'key';
|
|
16
|
+
const STORAGE_INPUT_PATH = 'path';
|
|
15
17
|
|
|
16
|
-
export { DEFAULT_ACCESS_LEVEL, DEFAULT_PART_SIZE, DEFAULT_PRESIGN_EXPIRATION, DEFAULT_QUEUE_SIZE, LOCAL_TESTING_S3_ENDPOINT, MAX_OBJECT_SIZE, MAX_PARTS_COUNT, MAX_URL_EXPIRATION, UPLOADS_STORAGE_KEY };
|
|
18
|
+
export { DEFAULT_ACCESS_LEVEL, DEFAULT_PART_SIZE, DEFAULT_PRESIGN_EXPIRATION, DEFAULT_QUEUE_SIZE, LOCAL_TESTING_S3_ENDPOINT, MAX_OBJECT_SIZE, MAX_PARTS_COUNT, MAX_URL_EXPIRATION, STORAGE_INPUT_KEY, STORAGE_INPUT_PATH, UPLOADS_STORAGE_KEY };
|
|
17
19
|
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sources":["../../../../../src/providers/s3/utils/constants.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const LOCAL_TESTING_S3_ENDPOINT = 'http://localhost:20005';\nexport const DEFAULT_ACCESS_LEVEL = 'guest';\nexport const DEFAULT_PRESIGN_EXPIRATION = 900;\nexport const MAX_URL_EXPIRATION = 7 * 24 * 60 * 60 * 1000;\nconst MiB = 1024 * 1024;\nconst GiB = 1024 * MiB;\nconst TiB = 1024 * GiB;\nexport const DEFAULT_PART_SIZE = 5 * MiB;\nexport const MAX_OBJECT_SIZE = 5 * TiB;\nexport const MAX_PARTS_COUNT = 10000;\nexport const DEFAULT_QUEUE_SIZE = 4;\nexport const UPLOADS_STORAGE_KEY = '__uploadInProgress';\n"],"names":[],"mappings":"AAAA;AACA;AACY,MAAC,yBAAyB,GAAG,yBAAyB;AACtD,MAAC,oBAAoB,GAAG,QAAQ;AAChC,MAAC,0BAA0B,GAAG,IAAI;AAClC,MAAC,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK;AAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AACxB,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AACvB,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AACX,MAAC,iBAAiB,GAAG,CAAC,GAAG,IAAI;AAC7B,MAAC,eAAe,GAAG,CAAC,GAAG,IAAI;AAC3B,MAAC,eAAe,GAAG,MAAM;AACzB,MAAC,kBAAkB,GAAG,EAAE;AACxB,MAAC,mBAAmB,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"constants.mjs","sources":["../../../../../src/providers/s3/utils/constants.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const LOCAL_TESTING_S3_ENDPOINT = 'http://localhost:20005';\nexport const DEFAULT_ACCESS_LEVEL = 'guest';\nexport const DEFAULT_PRESIGN_EXPIRATION = 900;\nexport const MAX_URL_EXPIRATION = 7 * 24 * 60 * 60 * 1000;\nconst MiB = 1024 * 1024;\nconst GiB = 1024 * MiB;\nconst TiB = 1024 * GiB;\nexport const DEFAULT_PART_SIZE = 5 * MiB;\nexport const MAX_OBJECT_SIZE = 5 * TiB;\nexport const MAX_PARTS_COUNT = 10000;\nexport const DEFAULT_QUEUE_SIZE = 4;\nexport const UPLOADS_STORAGE_KEY = '__uploadInProgress';\nexport const STORAGE_INPUT_KEY = 'key';\nexport const STORAGE_INPUT_PATH = 'path';\n"],"names":[],"mappings":"AAAA;AACA;AACY,MAAC,yBAAyB,GAAG,yBAAyB;AACtD,MAAC,oBAAoB,GAAG,QAAQ;AAChC,MAAC,0BAA0B,GAAG,IAAI;AAClC,MAAC,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK;AAC1D,MAAM,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AACxB,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AACvB,MAAM,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AACX,MAAC,iBAAiB,GAAG,CAAC,GAAG,IAAI;AAC7B,MAAC,eAAe,GAAG,CAAC,GAAG,IAAI;AAC3B,MAAC,eAAe,GAAG,MAAM;AACzB,MAAC,kBAAkB,GAAG,EAAE;AACxB,MAAC,mBAAmB,GAAG,qBAAqB;AAC5C,MAAC,iBAAiB,GAAG,MAAM;AAC3B,MAAC,kBAAkB,GAAG;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { calculateContentMd5 } from './md5';
|
|
2
2
|
export { resolveS3ConfigAndInput } from './resolveS3ConfigAndInput';
|
|
3
3
|
export { createDownloadTask, createUploadTask } from './transferTask';
|
|
4
|
+
export { validateStorageOperationInput } from './validateStorageOperationInput';
|
|
5
|
+
export { isInputWithPath } from './isInputWithPath';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { calculateContentMd5 } from './md5.mjs';
|
|
2
2
|
export { resolveS3ConfigAndInput } from './resolveS3ConfigAndInput.mjs';
|
|
3
3
|
export { createDownloadTask, createUploadTask } from './transferTask.mjs';
|
|
4
|
+
export { validateStorageOperationInput } from './validateStorageOperationInput.mjs';
|
|
5
|
+
export { isInputWithPath } from './isInputWithPath.mjs';
|
|
4
6
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
const isInputWithPath = (input) => {
|
|
4
|
+
return input.path !== undefined;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export { isInputWithPath };
|
|
8
|
+
//# sourceMappingURL=isInputWithPath.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isInputWithPath.mjs","sources":["../../../../../src/providers/s3/utils/isInputWithPath.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const isInputWithPath = (input) => {\n return input.path !== undefined;\n};\n"],"names":[],"mappings":"AAAA;AACA;AACY,MAAC,eAAe,GAAG,CAAC,KAAK,KAAK;AAC1C,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC;AACpC;;;;"}
|
|
@@ -10,6 +10,7 @@ interface ResolvedS3ConfigAndInput {
|
|
|
10
10
|
bucket: string;
|
|
11
11
|
keyPrefix: string;
|
|
12
12
|
isObjectLockEnabled?: boolean;
|
|
13
|
+
identityId?: string;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* resolve the common input options for S3 API handlers from Amplify configuration and library options.
|
|
@@ -17,7 +18,7 @@ interface ResolvedS3ConfigAndInput {
|
|
|
17
18
|
* @param {AmplifyClassV6} amplify The Amplify instance.
|
|
18
19
|
* @param {S3ApiOptions} apiOptions The input options for S3 provider.
|
|
19
20
|
* @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.
|
|
20
|
-
* @throws A
|
|
21
|
+
* @throws A `StorageError` with `error.name` from `StorageValidationErrorCode` indicating invalid
|
|
21
22
|
* configurations or Amplify library options.
|
|
22
23
|
*
|
|
23
24
|
* @internal
|
|
@@ -11,7 +11,7 @@ import { DEFAULT_ACCESS_LEVEL, LOCAL_TESTING_S3_ENDPOINT } from './constants.mjs
|
|
|
11
11
|
* @param {AmplifyClassV6} amplify The Amplify instance.
|
|
12
12
|
* @param {S3ApiOptions} apiOptions The input options for S3 provider.
|
|
13
13
|
* @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.
|
|
14
|
-
* @throws A
|
|
14
|
+
* @throws A `StorageError` with `error.name` from `StorageValidationErrorCode` indicating invalid
|
|
15
15
|
* configurations or Amplify library options.
|
|
16
16
|
*
|
|
17
17
|
* @internal
|
|
@@ -48,6 +48,7 @@ const resolveS3ConfigAndInput = async (amplify, apiOptions) => {
|
|
|
48
48
|
},
|
|
49
49
|
bucket,
|
|
50
50
|
keyPrefix,
|
|
51
|
+
identityId,
|
|
51
52
|
isObjectLockEnabled,
|
|
52
53
|
};
|
|
53
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveS3ConfigAndInput.mjs","sources":["../../../../../src/providers/s3/utils/resolveS3ConfigAndInput.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { resolvePrefix as defaultPrefixResolver } from '../../../utils/resolvePrefix';\nimport { DEFAULT_ACCESS_LEVEL, LOCAL_TESTING_S3_ENDPOINT } from './constants';\n/**\n * resolve the common input options for S3 API handlers from Amplify configuration and library options.\n *\n * @param {AmplifyClassV6} amplify The Amplify instance.\n * @param {S3ApiOptions} apiOptions The input options for S3 provider.\n * @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.\n * @throws A
|
|
1
|
+
{"version":3,"file":"resolveS3ConfigAndInput.mjs","sources":["../../../../../src/providers/s3/utils/resolveS3ConfigAndInput.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { resolvePrefix as defaultPrefixResolver } from '../../../utils/resolvePrefix';\nimport { DEFAULT_ACCESS_LEVEL, LOCAL_TESTING_S3_ENDPOINT } from './constants';\n/**\n * resolve the common input options for S3 API handlers from Amplify configuration and library options.\n *\n * @param {AmplifyClassV6} amplify The Amplify instance.\n * @param {S3ApiOptions} apiOptions The input options for S3 provider.\n * @returns {Promise<ResolvedS3ConfigAndInput>} The resolved common input options for S3 API handlers.\n * @throws A `StorageError` with `error.name` from `StorageValidationErrorCode` indicating invalid\n * configurations or Amplify library options.\n *\n * @internal\n */\nexport const resolveS3ConfigAndInput = async (amplify, apiOptions) => {\n // identityId is always cached in memory if forceRefresh is not set. So we can safely make calls here.\n const { credentials, identityId } = await amplify.Auth.fetchAuthSession({\n forceRefresh: false,\n });\n assertValidationError(!!credentials, StorageValidationErrorCode.NoCredentials);\n assertValidationError(!!identityId, StorageValidationErrorCode.NoIdentityId);\n const { bucket, region, dangerouslyConnectToHttpEndpointForTesting } = amplify.getConfig()?.Storage?.S3 ?? {};\n assertValidationError(!!bucket, StorageValidationErrorCode.NoBucket);\n assertValidationError(!!region, StorageValidationErrorCode.NoRegion);\n const { defaultAccessLevel, prefixResolver = defaultPrefixResolver, isObjectLockEnabled, } = amplify.libraryOptions?.Storage?.S3 ?? {};\n const keyPrefix = await prefixResolver({\n accessLevel: apiOptions?.accessLevel ?? defaultAccessLevel ?? DEFAULT_ACCESS_LEVEL,\n // use conditional assign to make tsc happy because StorageOptions is a union type that may not have targetIdentityId\n targetIdentityId: apiOptions?.accessLevel === 'protected'\n ? apiOptions?.targetIdentityId ?? identityId\n : identityId,\n });\n return {\n s3Config: {\n credentials,\n region,\n useAccelerateEndpoint: apiOptions?.useAccelerateEndpoint,\n ...(dangerouslyConnectToHttpEndpointForTesting\n ? {\n customEndpoint: LOCAL_TESTING_S3_ENDPOINT,\n forcePathStyle: true,\n }\n : {}),\n },\n bucket,\n keyPrefix,\n identityId,\n isObjectLockEnabled,\n };\n};\n"],"names":["defaultPrefixResolver"],"mappings":";;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG,OAAO,OAAO,EAAE,UAAU,KAAK;AACtE;AACA,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC;AAC5E,QAAQ,YAAY,EAAE,KAAK;AAC3B,KAAK,CAAC,CAAC;AACP,IAAI,qBAAqB,CAAC,CAAC,CAAC,WAAW,EAAE,0BAA0B,CAAC,aAAa,CAAC,CAAC;AACnF,IAAI,qBAAqB,CAAC,CAAC,CAAC,UAAU,EAAE,0BAA0B,CAAC,YAAY,CAAC,CAAC;AACjF,IAAI,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,0CAA0C,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC;AAClH,IAAI,qBAAqB,CAAC,CAAC,CAAC,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,CAAC;AACzE,IAAI,qBAAqB,CAAC,CAAC,CAAC,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,CAAC;AACzE,IAAI,MAAM,EAAE,kBAAkB,EAAE,cAAc,GAAGA,aAAqB,EAAE,mBAAmB,GAAG,GAAG,OAAO,CAAC,cAAc,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC;AAC3I,IAAI,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC;AAC3C,QAAQ,WAAW,EAAE,UAAU,EAAE,WAAW,IAAI,kBAAkB,IAAI,oBAAoB;AAC1F;AACA,QAAQ,gBAAgB,EAAE,UAAU,EAAE,WAAW,KAAK,WAAW;AACjE,cAAc,UAAU,EAAE,gBAAgB,IAAI,UAAU;AACxD,cAAc,UAAU;AACxB,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,QAAQ,EAAE;AAClB,YAAY,WAAW;AACvB,YAAY,MAAM;AAClB,YAAY,qBAAqB,EAAE,UAAU,EAAE,qBAAqB;AACpE,YAAY,IAAI,0CAA0C;AAC1D,kBAAkB;AAClB,oBAAoB,cAAc,EAAE,yBAAyB;AAC7D,oBAAoB,cAAc,EAAE,IAAI;AACxC,iBAAiB;AACjB,kBAAkB,EAAE;AACpB,SAAS;AACT,QAAQ,MAAM;AACd,QAAQ,SAAS;AACjB,QAAQ,UAAU;AAClB,QAAQ,mBAAmB;AAC3B,KAAK,CAAC;AACN;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { assertValidationError } from '../../../errors/utils/assertValidationError.mjs';
|
|
2
|
+
import { StorageValidationErrorCode } from '../../../errors/types/validation.mjs';
|
|
3
|
+
import { isInputWithPath } from './isInputWithPath.mjs';
|
|
4
|
+
import { STORAGE_INPUT_PATH, STORAGE_INPUT_KEY } from './constants.mjs';
|
|
5
|
+
|
|
6
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
7
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
8
|
+
const validateStorageOperationInput = (input, identityId) => {
|
|
9
|
+
assertValidationError(
|
|
10
|
+
// Key present without a path
|
|
11
|
+
(!!input.key && !input.path) ||
|
|
12
|
+
// Path present without a key
|
|
13
|
+
(!input.key && !!input.path), StorageValidationErrorCode.InvalidStorageOperationInput);
|
|
14
|
+
if (isInputWithPath(input)) {
|
|
15
|
+
const { path } = input;
|
|
16
|
+
const objectKey = typeof path === 'string' ? path : path({ identityId });
|
|
17
|
+
assertValidationError(!objectKey.startsWith('/'), StorageValidationErrorCode.InvalidStoragePathInput);
|
|
18
|
+
return {
|
|
19
|
+
inputType: STORAGE_INPUT_PATH,
|
|
20
|
+
objectKey,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return { inputType: STORAGE_INPUT_KEY, objectKey: input.key };
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { validateStorageOperationInput };
|
|
29
|
+
//# sourceMappingURL=validateStorageOperationInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateStorageOperationInput.mjs","sources":["../../../../../src/providers/s3/utils/validateStorageOperationInput.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { assertValidationError } from '../../../errors/utils/assertValidationError';\nimport { StorageValidationErrorCode } from '../../../errors/types/validation';\nimport { isInputWithPath } from './isInputWithPath';\nimport { STORAGE_INPUT_KEY, STORAGE_INPUT_PATH } from './constants';\nexport const validateStorageOperationInput = (input, identityId) => {\n assertValidationError(\n // Key present without a path\n (!!input.key && !input.path) ||\n // Path present without a key\n (!input.key && !!input.path), StorageValidationErrorCode.InvalidStorageOperationInput);\n if (isInputWithPath(input)) {\n const { path } = input;\n const objectKey = typeof path === 'string' ? path : path({ identityId });\n assertValidationError(!objectKey.startsWith('/'), StorageValidationErrorCode.InvalidStoragePathInput);\n return {\n inputType: STORAGE_INPUT_PATH,\n objectKey,\n };\n }\n else {\n return { inputType: STORAGE_INPUT_KEY, objectKey: input.key };\n }\n};\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAKY,MAAC,6BAA6B,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK;AACpE,IAAI,qBAAqB;AACzB;AACA,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI;AAC/B;AACA,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC,4BAA4B,CAAC,CAAC;AAC/F,IAAI,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE;AAChC,QAAQ,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;AAC/B,QAAQ,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;AACjF,QAAQ,qBAAqB,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,0BAA0B,CAAC,uBAAuB,CAAC,CAAC;AAC9G,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,kBAAkB;AACzC,YAAY,SAAS;AACrB,SAAS,CAAC;AACV,KAAK;AACL,SAAS;AACT,QAAQ,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AACtE,KAAK;AACL;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { DownloadTask, TransferProgressEvent, TransferTaskState, UploadTask, } from './common';
|
|
2
|
-
export { StorageOperationInput, StorageListInput,
|
|
2
|
+
export { StorageOperationInput, StorageListInput, StorageGetPropertiesInputKey, StorageGetPropertiesInputPath, StorageRemoveInputPath, StorageRemoveInputKey, StorageDownloadDataInputKey, StorageDownloadDataInputPath, StorageUploadDataInput, StorageCopyInputKey, StorageCopyInputPath, StorageGetUrlInputKey, StorageGetUrlInputPath, StorageUploadDataPayload, } from './inputs';
|
|
3
3
|
export { StorageOptions, StorageRemoveOptions, StorageListAllOptions, StorageListPaginateOptions, } from './options';
|
|
4
|
-
export { StorageItem, StorageListOutput, StorageDownloadDataOutput, StorageGetUrlOutput, StorageUploadOutput, } from './outputs';
|
|
4
|
+
export { StorageItem, StorageItemKey, StorageItemPath, StorageListOutput, StorageDownloadDataOutput, StorageGetUrlOutput, StorageUploadOutput, } from './outputs';
|