@webiny/api-sync-system 0.0.0-unstable.a4637c5ce6 → 0.0.0-unstable.a4f3e4ea8b
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/README.md +6 -108
- package/constants.js +2 -7
- package/constants.js.map +1 -1
- package/index.js +3 -40
- package/package.json +29 -26
- package/resolver/app/RecordHandler.d.ts +6 -6
- package/resolver/app/RecordHandler.js +84 -114
- package/resolver/app/RecordHandler.js.map +1 -1
- package/resolver/app/RecordsValidation.js +13 -24
- package/resolver/app/RecordsValidation.js.map +1 -1
- package/resolver/app/ResolverApplication.d.ts +1 -1
- package/resolver/app/ResolverApplication.js +27 -42
- package/resolver/app/ResolverApplication.js.map +1 -1
- package/resolver/app/abstractions/RecordHandler.d.ts +1 -1
- package/resolver/app/abstractions/RecordHandler.js +0 -7
- package/resolver/app/abstractions/RecordsValidation.d.ts +2 -2
- package/resolver/app/abstractions/RecordsValidation.js +0 -7
- package/resolver/app/abstractions/ResolverApplication.js +0 -7
- package/resolver/app/abstractions/ResolverRecord.d.ts +1 -1
- package/resolver/app/abstractions/ResolverRecord.js +0 -7
- package/resolver/app/bundler/BaseBundle.d.ts +6 -6
- package/resolver/app/bundler/BaseBundle.js +16 -22
- package/resolver/app/bundler/BaseBundle.js.map +1 -1
- package/resolver/app/bundler/Bundler.d.ts +1 -1
- package/resolver/app/bundler/Bundler.js +12 -25
- package/resolver/app/bundler/Bundler.js.map +1 -1
- package/resolver/app/bundler/Bundles.d.ts +2 -2
- package/resolver/app/bundler/Bundles.js +20 -33
- package/resolver/app/bundler/Bundles.js.map +1 -1
- package/resolver/app/bundler/CommandBundle.d.ts +1 -1
- package/resolver/app/bundler/CommandBundle.js +8 -25
- package/resolver/app/bundler/CommandBundle.js.map +1 -1
- package/resolver/app/bundler/TableBundle.d.ts +1 -1
- package/resolver/app/bundler/TableBundle.js +7 -22
- package/resolver/app/bundler/TableBundle.js.map +1 -1
- package/resolver/app/bundler/types.d.ts +2 -2
- package/resolver/app/bundler/types.js +0 -7
- package/resolver/app/commandHandler/DeleteCommandHandler.d.ts +3 -3
- package/resolver/app/commandHandler/DeleteCommandHandler.js +21 -35
- package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/PutCommandHandler.d.ts +4 -4
- package/resolver/app/commandHandler/PutCommandHandler.js +15 -28
- package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/delete.d.ts +1 -1
- package/resolver/app/commandHandler/delete.js +13 -21
- package/resolver/app/commandHandler/delete.js.map +1 -1
- package/resolver/app/commandHandler/put.d.ts +1 -1
- package/resolver/app/commandHandler/put.js +13 -21
- package/resolver/app/commandHandler/put.js.map +1 -1
- package/resolver/app/data/SourceDataContainer.d.ts +3 -3
- package/resolver/app/data/SourceDataContainer.js +27 -36
- package/resolver/app/data/SourceDataContainer.js.map +1 -1
- package/resolver/app/data/types.d.ts +2 -2
- package/resolver/app/data/types.js +0 -7
- package/resolver/app/fetcher/Fetcher.d.ts +3 -3
- package/resolver/app/fetcher/Fetcher.js +87 -121
- package/resolver/app/fetcher/Fetcher.js.map +1 -1
- package/resolver/app/fetcher/types.d.ts +2 -2
- package/resolver/app/fetcher/types.js +0 -7
- package/resolver/app/ingestor/Ingestor.d.ts +1 -1
- package/resolver/app/ingestor/Ingestor.js +26 -39
- package/resolver/app/ingestor/Ingestor.js.map +1 -1
- package/resolver/app/ingestor/IngestorResult.js +27 -39
- package/resolver/app/ingestor/IngestorResult.js.map +1 -1
- package/resolver/app/ingestor/types.d.ts +2 -2
- package/resolver/app/ingestor/types.js +0 -7
- package/resolver/app/storer/Storer.d.ts +3 -3
- package/resolver/app/storer/Storer.js +73 -95
- package/resolver/app/storer/Storer.js.map +1 -1
- package/resolver/app/storer/types.d.ts +2 -2
- package/resolver/app/storer/types.js +0 -7
- package/resolver/app/transform/TransformHandler.d.ts +4 -4
- package/resolver/app/transform/TransformHandler.js +46 -64
- package/resolver/app/transform/TransformHandler.js.map +1 -1
- package/resolver/app/transform/middleware.d.ts +1 -1
- package/resolver/app/transform/middleware.js +12 -25
- package/resolver/app/transform/middleware.js.map +1 -1
- package/resolver/app/utils/Retry.js +21 -32
- package/resolver/app/utils/Retry.js.map +1 -1
- package/resolver/app/utils/sleep.js +4 -12
- package/resolver/app/utils/sleep.js.map +1 -1
- package/resolver/app/validation/body.d.ts +25 -124
- package/resolver/app/validation/body.js +31 -44
- package/resolver/app/validation/body.js.map +1 -1
- package/resolver/app/validation/createJsonTransform.d.ts +1 -1
- package/resolver/app/validation/createJsonTransform.js +13 -22
- package/resolver/app/validation/createJsonTransform.js.map +1 -1
- package/resolver/app/validation/detail.d.ts +19 -72
- package/resolver/app/validation/detail.js +33 -46
- package/resolver/app/validation/detail.js.map +1 -1
- package/resolver/app/validation/event.d.ts +29 -188
- package/resolver/app/validation/event.js +21 -30
- package/resolver/app/validation/event.js.map +1 -1
- package/resolver/app/validation/numericString.d.ts +1 -1
- package/resolver/app/validation/numericString.js +9 -20
- package/resolver/app/validation/numericString.js.map +1 -1
- package/resolver/app/validation/system.d.ts +2 -14
- package/resolver/app/validation/system.js +9 -18
- package/resolver/app/validation/system.js.map +1 -1
- package/resolver/createEventHandlerPlugin.d.ts +2 -1
- package/resolver/createEventHandlerPlugin.js +85 -121
- package/resolver/createEventHandlerPlugin.js.map +1 -1
- package/resolver/createResolverHandler.d.ts +1 -1
- package/resolver/createResolverHandler.js +60 -75
- package/resolver/createResolverHandler.js.map +1 -1
- package/resolver/deployment/Deployment.d.ts +2 -3
- package/resolver/deployment/Deployment.js +27 -44
- package/resolver/deployment/Deployment.js.map +1 -1
- package/resolver/deployment/Deployments.js +19 -30
- package/resolver/deployment/Deployments.js.map +1 -1
- package/resolver/deployment/DeploymentsFetcher.js +82 -102
- package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
- package/resolver/deployment/types.d.ts +4 -6
- package/resolver/deployment/types.js +0 -7
- package/resolver/lambda/LambdaTrigger.js +25 -34
- package/resolver/lambda/LambdaTrigger.js.map +1 -1
- package/resolver/plugins/CommandHandlerPlugin.d.ts +3 -3
- package/resolver/plugins/CommandHandlerPlugin.js +17 -24
- package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
- package/resolver/plugins/StorerAfterEachPlugin.d.ts +2 -2
- package/resolver/plugins/StorerAfterEachPlugin.js +21 -29
- package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
- package/resolver/plugins/TransformRecordPlugin.d.ts +3 -3
- package/resolver/plugins/TransformRecordPlugin.js +20 -27
- package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
- package/resolver/recordTypes/fileManager/CopyFile.js +44 -74
- package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.d.ts +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.js +40 -65
- package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManager.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManager.js +7 -12
- package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +27 -45
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js +27 -45
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.d.ts +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.js +10 -34
- package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/fileManager/types.d.ts +2 -2
- package/resolver/recordTypes/fileManager/types.js +0 -7
- package/resolver/recordTypes/users/CopyUser.d.ts +2 -2
- package/resolver/recordTypes/users/CopyUser.js +44 -61
- package/resolver/recordTypes/users/CopyUser.js.map +1 -1
- package/resolver/recordTypes/users/DeleteUser.d.ts +2 -2
- package/resolver/recordTypes/users/DeleteUser.js +40 -58
- package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.d.ts +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.js +10 -33
- package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/users/types.d.ts +1 -1
- package/resolver/recordTypes/users/types.js +0 -7
- package/resolver/recordTypes/users/users.js +7 -12
- package/resolver/recordTypes/users/users.js.map +1 -1
- package/resolver/recordTypes/users/usersOnDelete.d.ts +2 -2
- package/resolver/recordTypes/users/usersOnDelete.js +26 -44
- package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
- package/resolver/recordTypes/users/usersOnPut.d.ts +2 -2
- package/resolver/recordTypes/users/usersOnPut.js +27 -45
- package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
- package/sync/FilterOutRecord.d.ts +2 -2
- package/sync/FilterOutRecord.js +8 -24
- package/sync/FilterOutRecord.js.map +1 -1
- package/sync/attachToDynamoDbDocument.d.ts +1 -1
- package/sync/attachToDynamoDbDocument.js +48 -75
- package/sync/attachToDynamoDbDocument.js.map +1 -1
- package/sync/createHandler.js +44 -60
- package/sync/createHandler.js.map +1 -1
- package/sync/createSendDataToEventBridgeOnRequestEnd.js +34 -46
- package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -1
- package/sync/createSyncSystem.d.ts +1 -1
- package/sync/createSyncSystem.js +27 -36
- package/sync/createSyncSystem.js.map +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.d.ts +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.js +37 -86
- package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
- package/sync/handler/Handler.d.ts +2 -2
- package/sync/handler/Handler.js +66 -86
- package/sync/handler/Handler.js.map +1 -1
- package/sync/handler/HandlerConverter.js +20 -36
- package/sync/handler/HandlerConverter.js.map +1 -1
- package/sync/handler/converter/BatchGetCommandConverter.js +13 -20
- package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
- package/sync/handler/converter/BatchWriteCommandConverter.js +13 -20
- package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
- package/sync/handler/converter/DeleteCommandConverter.js +13 -20
- package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
- package/sync/handler/converter/GetCommandConverter.js +13 -20
- package/sync/handler/converter/GetCommandConverter.js.map +1 -1
- package/sync/handler/converter/PutCommandConverter.js +13 -20
- package/sync/handler/converter/PutCommandConverter.js.map +1 -1
- package/sync/handler/converter/QueryCommandConverter.js +13 -20
- package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
- package/sync/handler/converter/ScanCommandConverter.js +13 -20
- package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
- package/sync/handler/converter/UpdateCommandConverter.js +13 -20
- package/sync/handler/converter/UpdateCommandConverter.js.map +1 -1
- package/sync/handler/converter/commands/BatchWriteCommandValue.d.ts +2 -2
- package/sync/handler/converter/commands/BatchWriteCommandValue.js +34 -44
- package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/DeleteCommandValue.d.ts +2 -2
- package/sync/handler/converter/commands/DeleteCommandValue.js +19 -23
- package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/NullCommandValue.d.ts +1 -1
- package/sync/handler/converter/commands/NullCommandValue.js +7 -14
- package/sync/handler/converter/commands/NullCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/PutCommandValue.d.ts +2 -2
- package/sync/handler/converter/commands/PutCommandValue.js +19 -23
- package/sync/handler/converter/commands/PutCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/UpdateCommandValue.d.ts +2 -2
- package/sync/handler/converter/commands/UpdateCommandValue.js +19 -23
- package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
- package/sync/handler/types.d.ts +3 -3
- package/sync/handler/types.js +0 -7
- package/sync/plugins/FilterOutRecordPlugin.d.ts +1 -1
- package/sync/plugins/FilterOutRecordPlugin.js +18 -28
- package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
- package/sync/requestPlugin.d.ts +1 -1
- package/sync/requestPlugin.js +39 -55
- package/sync/requestPlugin.js.map +1 -1
- package/sync/types.js +0 -7
- package/sync/utils/getTableType.js +11 -19
- package/sync/utils/getTableType.js.map +1 -1
- package/sync/utils/manifest.d.ts +3 -7
- package/sync/utils/manifest.js +30 -47
- package/sync/utils/manifest.js.map +1 -1
- package/sync/utils/validateSystemInput.d.ts +1 -1
- package/sync/utils/validateSystemInput.js +22 -37
- package/sync/utils/validateSystemInput.js.map +1 -1
- package/types.d.ts +3 -5
- package/types.js +6 -12
- package/types.js.map +1 -1
- package/utils/createSystemName.js +5 -10
- package/utils/createSystemName.js.map +1 -1
- package/worker/actions/copyFile/CopyFile.js +185 -268
- package/worker/actions/copyFile/CopyFile.js.map +1 -1
- package/worker/actions/copyFile/copyFileAction.d.ts +1 -1
- package/worker/actions/copyFile/copyFileAction.js +30 -45
- package/worker/actions/copyFile/copyFileAction.js.map +1 -1
- package/worker/actions/copyFile/copyFileSchema.d.ts +6 -38
- package/worker/actions/copyFile/copyFileSchema.js +14 -23
- package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
- package/worker/actions/copyFile/types.js +0 -7
- package/worker/actions/createUser/CreateUser.d.ts +1 -1
- package/worker/actions/createUser/CreateUser.js +53 -83
- package/worker/actions/createUser/CreateUser.js.map +1 -1
- package/worker/actions/createUser/createUserAction.d.ts +2 -2
- package/worker/actions/createUser/createUserAction.js +28 -39
- package/worker/actions/createUser/createUserAction.js.map +1 -1
- package/worker/actions/createUser/createUserSchema.d.ts +6 -38
- package/worker/actions/createUser/createUserSchema.js +14 -23
- package/worker/actions/createUser/createUserSchema.js.map +1 -1
- package/worker/actions/createUser/types.js +0 -7
- package/worker/actions/deleteFile/DeleteFile.js +52 -74
- package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileAction.d.ts +1 -1
- package/worker/actions/deleteFile/deleteFileAction.js +25 -40
- package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileSchema.d.ts +6 -38
- package/worker/actions/deleteFile/deleteFileSchema.js +14 -23
- package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
- package/worker/actions/deleteFile/types.js +0 -7
- package/worker/actions/deleteUser/DeleteUser.d.ts +2 -2
- package/worker/actions/deleteUser/DeleteUser.js +39 -60
- package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserAction.d.ts +1 -1
- package/worker/actions/deleteUser/deleteUserAction.js +26 -37
- package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserSchema.d.ts +5 -23
- package/worker/actions/deleteUser/deleteUserSchema.js +13 -22
- package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
- package/worker/actions/deleteUser/types.js +0 -7
- package/worker/actions/logValidationError.js +6 -14
- package/worker/actions/logValidationError.js.map +1 -1
- package/worker/actions/removeCognitoUserAttributes.js +9 -22
- package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
- package/worker/actions/updateUser/UpdateUser.d.ts +1 -1
- package/worker/actions/updateUser/UpdateUser.js +50 -74
- package/worker/actions/updateUser/UpdateUser.js.map +1 -1
- package/worker/actions/updateUser/types.js +0 -7
- package/worker/actions/updateUser/updateUserAction.d.ts +2 -2
- package/worker/actions/updateUser/updateUserAction.js +28 -39
- package/worker/actions/updateUser/updateUserAction.js.map +1 -1
- package/worker/actions/updateUser/updateUserSchema.d.ts +6 -38
- package/worker/actions/updateUser/updateUserSchema.js +14 -23
- package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
- package/worker/createWorkerHandler.js +32 -45
- package/worker/createWorkerHandler.js.map +1 -1
- package/worker/handler/WorkerActionHandler.d.ts +2 -2
- package/worker/handler/WorkerActionHandler.js +19 -28
- package/worker/handler/WorkerActionHandler.js.map +1 -1
- package/worker/handler/eventHandler.js +18 -27
- package/worker/handler/eventHandler.js.map +1 -1
- package/worker/plugins/WorkerActionPlugin.d.ts +1 -1
- package/worker/plugins/WorkerActionPlugin.js +18 -25
- package/worker/plugins/WorkerActionPlugin.js.map +1 -1
- package/worker/types.js +0 -7
- package/index.js.map +0 -1
- package/resolver/app/abstractions/RecordHandler.js.map +0 -1
- package/resolver/app/abstractions/RecordsValidation.js.map +0 -1
- package/resolver/app/abstractions/ResolverApplication.js.map +0 -1
- package/resolver/app/abstractions/ResolverRecord.js.map +0 -1
- package/resolver/app/bundler/types.js.map +0 -1
- package/resolver/app/data/types.js.map +0 -1
- package/resolver/app/fetcher/types.js.map +0 -1
- package/resolver/app/ingestor/types.js.map +0 -1
- package/resolver/app/storer/types.js.map +0 -1
- package/resolver/deployment/types.js.map +0 -1
- package/resolver/recordTypes/fileManager/types.js.map +0 -1
- package/resolver/recordTypes/users/types.js.map +0 -1
- package/sync/handler/types.js.map +0 -1
- package/sync/types.js.map +0 -1
- package/worker/actions/copyFile/types.js.map +0 -1
- package/worker/actions/createUser/types.js.map +0 -1
- package/worker/actions/deleteFile/types.js.map +0 -1
- package/worker/actions/deleteUser/types.js.map +0 -1
- package/worker/actions/updateUser/types.js.map +0 -1
- package/worker/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"sync/utils/validateSystemInput.js","sources":["../../../src/sync/utils/validateSystemInput.ts"],"sourcesContent":["import type { ISystem } from \"~/sync/types.js\";\nimport { createSystemName } from \"~/utils/createSystemName.js\";\n\nexport interface IValidResponse {\n system: ISystem;\n error?: never;\n}\n\nexport interface IErrorResponse {\n error: string;\n system?: never;\n}\n\nexport type ValidateSystemInputResponse = IValidResponse | IErrorResponse;\n\nexport const validateSystemInput = (input: Partial<ISystem>): ValidateSystemInputResponse => {\n const { env, region, variant, version } = input;\n if (!env) {\n return {\n error: \"Sync System: No environment variable provided. Sync System will not be attached.\"\n };\n } else if (!region) {\n return {\n error: \"Sync System: No region variable provided. Sync System will not be attached.\"\n };\n } else if (!version) {\n return {\n error: \"Sync System: No version variable provided. Sync System will not be attached.\"\n };\n }\n const name = createSystemName({\n env,\n variant\n });\n\n return {\n system: {\n env,\n name,\n region,\n variant,\n version\n }\n };\n};\n"],"names":["validateSystemInput","input","env","region","variant","version","name","createSystemName"],"mappings":";AAeO,MAAMA,sBAAsB,CAACC;IAChC,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGJ;IAC1C,IAAI,CAACC,KACD,OAAO;QACH,OAAO;IACX;IACG,IAAI,CAACC,QACR,OAAO;QACH,OAAO;IACX;IACG,IAAI,CAACE,SACR,OAAO;QACH,OAAO;IACX;IAEJ,MAAMC,OAAOC,iBAAiB;QAC1BL;QACAE;IACJ;IAEA,OAAO;QACH,QAAQ;YACJF;YACAI;YACAH;YACAC;YACAC;QACJ;IACJ;AACJ"}
|
package/types.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type { Context as BaseContext } from "@webiny/handler-aws/types";
|
|
1
|
+
import type { Context as BaseContext } from "@webiny/handler-aws/types.js";
|
|
2
2
|
export type CommandType = "put" | "delete";
|
|
3
3
|
export type ExtendedCommandType = "put" | "delete" | "update";
|
|
4
4
|
export type AllCommandType = ExtendedCommandType | "batchWrite" | "null";
|
|
5
5
|
export declare enum DynamoDBTableType {
|
|
6
6
|
REGULAR = "regular",
|
|
7
|
-
|
|
8
|
-
LOG = "log",
|
|
7
|
+
OPENSEARCH = "opensearch",
|
|
9
8
|
UNKNOWN = "unknown"
|
|
10
9
|
}
|
|
11
|
-
export
|
|
12
|
-
}
|
|
10
|
+
export type Context = BaseContext;
|
|
13
11
|
export interface IFileLambdaPayloadInfo {
|
|
14
12
|
bucket: string;
|
|
15
13
|
region: string;
|
package/types.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.DynamoDBTableType = void 0;
|
|
7
|
-
let DynamoDBTableType = exports.DynamoDBTableType = /*#__PURE__*/function (DynamoDBTableType) {
|
|
8
|
-
DynamoDBTableType["REGULAR"] = "regular";
|
|
9
|
-
DynamoDBTableType["ELASTICSEARCH"] = "elasticsearch";
|
|
10
|
-
DynamoDBTableType["LOG"] = "log";
|
|
11
|
-
DynamoDBTableType["UNKNOWN"] = "unknown";
|
|
12
|
-
return DynamoDBTableType;
|
|
1
|
+
var types_DynamoDBTableType = /*#__PURE__*/ function(DynamoDBTableType) {
|
|
2
|
+
DynamoDBTableType["REGULAR"] = "regular";
|
|
3
|
+
DynamoDBTableType["OPENSEARCH"] = "opensearch";
|
|
4
|
+
DynamoDBTableType["UNKNOWN"] = "unknown";
|
|
5
|
+
return DynamoDBTableType;
|
|
13
6
|
}({});
|
|
7
|
+
export { types_DynamoDBTableType as DynamoDBTableType };
|
|
14
8
|
|
|
15
9
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type { Context as BaseContext } from \"@webiny/handler-aws/types.js\";\n\nexport type CommandType = \"put\" | \"delete\";\nexport type ExtendedCommandType = \"put\" | \"delete\" | \"update\";\nexport type AllCommandType = ExtendedCommandType | \"batchWrite\" | \"null\";\n\nexport enum DynamoDBTableType {\n REGULAR = \"regular\",\n OPENSEARCH = \"opensearch\",\n UNKNOWN = \"unknown\"\n}\n\nexport type Context = BaseContext;\n\nexport interface IFileLambdaPayloadInfo {\n bucket: string;\n region: string;\n}\n\nexport interface ICopyFileLambdaPayload {\n action: \"copyFile\";\n key: string;\n source: IFileLambdaPayloadInfo;\n target: IFileLambdaPayloadInfo;\n}\n\nexport interface IDeleteFileLambdaPayload {\n action: \"deleteFile\";\n key: string;\n target: IFileLambdaPayloadInfo;\n}\n\nexport interface IUserLambdaPayloadInfo {\n region: string;\n userPoolId: string;\n}\n\nexport interface IDeleteUserLambdaPayload {\n action: \"deleteUser\";\n username: string;\n target: IUserLambdaPayloadInfo;\n}\n\nexport interface ICopyUserLambdaPayload {\n action: \"createUser\" | \"updateUser\";\n username: string;\n source: IUserLambdaPayloadInfo;\n target: IUserLambdaPayloadInfo;\n}\n"],"names":["DynamoDBTableType"],"mappings":"AAMO,IAAKA,0BAAiBA,WAAAA,GAAAA,SAAjBA,iBAAiB;;;;WAAjBA"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
exports.createSystemName = void 0;
|
|
7
|
-
const createSystemName = params => {
|
|
8
|
-
return [params.env, params.variant].filter(Boolean).join("#");
|
|
9
|
-
};
|
|
10
|
-
exports.createSystemName = createSystemName;
|
|
1
|
+
const createSystemName = (params)=>[
|
|
2
|
+
params.env,
|
|
3
|
+
params.variant
|
|
4
|
+
].filter(Boolean).join("#");
|
|
5
|
+
export { createSystemName };
|
|
11
6
|
|
|
12
7
|
//# sourceMappingURL=createSystemName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils/createSystemName.js","sources":["../../src/utils/createSystemName.ts"],"sourcesContent":["export interface ICreateSystemNameParams {\n env: string;\n variant: string | undefined;\n}\n\nexport const createSystemName = (params: ICreateSystemNameParams): string => {\n return [params.env, params.variant].filter(Boolean).join(\"#\");\n};\n"],"names":["createSystemName","params","Boolean"],"mappings":"AAKO,MAAMA,mBAAmB,CAACC,SACtB;QAACA,OAAO,GAAG;QAAEA,OAAO,OAAO;KAAC,CAAC,MAAM,CAACC,SAAS,IAAI,CAAC"}
|
|
@@ -1,283 +1,200 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.CopyFile = void 0;
|
|
8
|
-
var _index = require("@webiny/aws-sdk/client-s3/index.js");
|
|
9
|
-
var _bytes = _interopRequireDefault(require("bytes"));
|
|
10
|
-
var _utils = require("@webiny/utils");
|
|
1
|
+
import { AbortMultipartUploadCommand, CompleteMultipartUploadCommand, CopyObjectCommand, CreateMultipartUploadCommand, HeadObjectCommand, UploadPartCopyCommand } from "@webiny/aws-sdk/client-s3/index.js";
|
|
2
|
+
import bytes from "bytes";
|
|
3
|
+
import { convertException } from "@webiny/utils";
|
|
11
4
|
class CopyFile {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.targetClient = createS3Client({
|
|
25
|
-
region: targetRegion
|
|
26
|
-
});
|
|
27
|
-
this.maxConcurrency = maxConcurrency;
|
|
28
|
-
this.minPartSizeBytes = this.parseByteSize(minPartSize);
|
|
29
|
-
this.maxPartSizeBytes = this.parseByteSize(maxPartSize);
|
|
30
|
-
if (this.minPartSizeBytes < 5 * 1024 * 1024) {
|
|
31
|
-
throw new Error("minPartSize must be at least 5MB.");
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async copy(params) {
|
|
35
|
-
const {
|
|
36
|
-
key,
|
|
37
|
-
sourceBucket,
|
|
38
|
-
targetBucket
|
|
39
|
-
} = params;
|
|
40
|
-
const sourceHead = await this.headObject({
|
|
41
|
-
client: this.sourceClient,
|
|
42
|
-
bucket: sourceBucket,
|
|
43
|
-
key
|
|
44
|
-
});
|
|
45
|
-
if (!sourceHead?.ContentLength || !sourceHead.ETag) {
|
|
46
|
-
throw new Error("Source object metadata is invalid or missing.");
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* If the target object already exists, we can skip the copy operation.
|
|
50
|
-
*/
|
|
51
|
-
const targetHead = await this.headObject({
|
|
52
|
-
client: this.targetClient,
|
|
53
|
-
bucket: targetBucket,
|
|
54
|
-
key
|
|
55
|
-
});
|
|
56
|
-
if (targetHead) {
|
|
57
|
-
return;
|
|
5
|
+
constructor(params){
|
|
6
|
+
const { createS3Client, sourceRegion, targetRegion, maxConcurrency = 100, minPartSize = "5MB", maxPartSize = "1GB" } = params;
|
|
7
|
+
this.sourceClient = createS3Client({
|
|
8
|
+
region: sourceRegion
|
|
9
|
+
});
|
|
10
|
+
this.targetClient = createS3Client({
|
|
11
|
+
region: targetRegion
|
|
12
|
+
});
|
|
13
|
+
this.maxConcurrency = maxConcurrency;
|
|
14
|
+
this.minPartSizeBytes = this.parseByteSize(minPartSize);
|
|
15
|
+
this.maxPartSizeBytes = this.parseByteSize(maxPartSize);
|
|
16
|
+
if (this.minPartSizeBytes < 5242880) throw new Error("minPartSize must be at least 5MB.");
|
|
58
17
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
uploadId,
|
|
80
|
-
partNumber,
|
|
81
|
-
start,
|
|
82
|
-
end,
|
|
83
|
-
completedParts
|
|
18
|
+
async copy(params) {
|
|
19
|
+
const { key, sourceBucket, targetBucket } = params;
|
|
20
|
+
const sourceHead = await this.headObject({
|
|
21
|
+
client: this.sourceClient,
|
|
22
|
+
bucket: sourceBucket,
|
|
23
|
+
key
|
|
24
|
+
});
|
|
25
|
+
if (!sourceHead?.ContentLength || !sourceHead.ETag) throw new Error("Source object metadata is invalid or missing.");
|
|
26
|
+
const targetHead = await this.headObject({
|
|
27
|
+
client: this.targetClient,
|
|
28
|
+
bucket: targetBucket,
|
|
29
|
+
key
|
|
30
|
+
});
|
|
31
|
+
if (targetHead) return;
|
|
32
|
+
const totalSize = sourceHead.ContentLength;
|
|
33
|
+
let partSize = Math.max(this.minPartSizeBytes, Math.min(this.maxPartSizeBytes, Math.ceil(totalSize / this.maxConcurrency)));
|
|
34
|
+
partSize = Math.min(partSize, totalSize);
|
|
35
|
+
const uploadId = await this.createMultipartUpload({
|
|
36
|
+
targetBucket,
|
|
37
|
+
targetKey: key
|
|
84
38
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
39
|
+
const completedParts = [];
|
|
40
|
+
try {
|
|
41
|
+
let partNumber = 1;
|
|
42
|
+
let start = 0;
|
|
43
|
+
const promises = [];
|
|
44
|
+
let active = 0;
|
|
45
|
+
while(start < totalSize){
|
|
46
|
+
const end = Math.min(start + partSize - 1, totalSize - 1);
|
|
47
|
+
const copyPromise = this.uploadPartCopy({
|
|
48
|
+
sourceBucket,
|
|
49
|
+
sourceKey: key,
|
|
50
|
+
targetBucket,
|
|
51
|
+
targetKey: key,
|
|
52
|
+
uploadId,
|
|
53
|
+
partNumber,
|
|
54
|
+
start,
|
|
55
|
+
end,
|
|
56
|
+
completedParts
|
|
57
|
+
});
|
|
58
|
+
promises.push(copyPromise);
|
|
59
|
+
active++;
|
|
60
|
+
if (active >= this.maxConcurrency) {
|
|
61
|
+
await Promise.race(promises);
|
|
62
|
+
active--;
|
|
63
|
+
}
|
|
64
|
+
partNumber++;
|
|
65
|
+
start += partSize;
|
|
66
|
+
}
|
|
67
|
+
await Promise.all(promises);
|
|
68
|
+
await this.completeMultipartUpload({
|
|
69
|
+
targetBucket,
|
|
70
|
+
targetKey: key,
|
|
71
|
+
uploadId,
|
|
72
|
+
completedParts
|
|
73
|
+
});
|
|
74
|
+
} catch (ex) {
|
|
75
|
+
await this.abortMultipartUpload({
|
|
76
|
+
targetBucket,
|
|
77
|
+
targetKey: key,
|
|
78
|
+
uploadId
|
|
79
|
+
});
|
|
80
|
+
throw ex;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
await this.copyMetadata({
|
|
84
|
+
sourceBucket,
|
|
85
|
+
targetBucket,
|
|
86
|
+
key
|
|
87
|
+
});
|
|
88
|
+
} catch (ex) {
|
|
89
|
+
console.error(`Failed to copy metadata for ${key} from ${sourceBucket} to ${targetBucket}.`);
|
|
90
|
+
console.log(convertException(ex));
|
|
90
91
|
}
|
|
91
|
-
partNumber++;
|
|
92
|
-
start += partSize;
|
|
93
|
-
}
|
|
94
|
-
await Promise.all(promises);
|
|
95
|
-
/**
|
|
96
|
-
* Complete the multipart upload with all the completed parts.
|
|
97
|
-
*/
|
|
98
|
-
await this.completeMultipartUpload({
|
|
99
|
-
targetBucket,
|
|
100
|
-
targetKey: key,
|
|
101
|
-
uploadId,
|
|
102
|
-
completedParts
|
|
103
|
-
});
|
|
104
|
-
} catch (ex) {
|
|
105
|
-
await this.abortMultipartUpload({
|
|
106
|
-
targetBucket,
|
|
107
|
-
targetKey: key,
|
|
108
|
-
uploadId
|
|
109
|
-
});
|
|
110
|
-
throw ex;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* And then copy the metadata file.
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
try {
|
|
117
|
-
await this.copyMetadata({
|
|
118
|
-
sourceBucket,
|
|
119
|
-
targetBucket,
|
|
120
|
-
key
|
|
121
|
-
});
|
|
122
|
-
} catch (ex) {
|
|
123
|
-
console.error(`Failed to copy metadata for ${key} from ${sourceBucket} to ${targetBucket}.`);
|
|
124
|
-
console.log((0, _utils.convertException)(ex));
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
parseByteSize(value) {
|
|
128
|
-
if (typeof value === "number") {
|
|
129
|
-
return value;
|
|
130
92
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
93
|
+
parseByteSize(value) {
|
|
94
|
+
if ("number" == typeof value) return value;
|
|
95
|
+
const parsed = bytes.parse(value);
|
|
96
|
+
if ("number" == typeof parsed) return parsed;
|
|
97
|
+
const typeOfValue = typeof value;
|
|
98
|
+
throw new Error(`Invalid byte size value type "${typeOfValue}".`);
|
|
134
99
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const result = await client.send(command);
|
|
151
|
-
if (result.$metadata?.httpStatusCode === 200) {
|
|
152
|
-
return result;
|
|
153
|
-
}
|
|
154
|
-
} catch (ex) {
|
|
155
|
-
if (ex.name === "NotFound" || ex.$metadata?.httpStatusCode === 404) {
|
|
100
|
+
async headObject(params) {
|
|
101
|
+
const { client, bucket, key } = params;
|
|
102
|
+
const input = {
|
|
103
|
+
Bucket: bucket,
|
|
104
|
+
Key: key
|
|
105
|
+
};
|
|
106
|
+
const command = new HeadObjectCommand(input);
|
|
107
|
+
try {
|
|
108
|
+
const result = await client.send(command);
|
|
109
|
+
if (result.$metadata?.httpStatusCode === 200) return result;
|
|
110
|
+
} catch (ex) {
|
|
111
|
+
if ("NotFound" === ex.name || ex.$metadata?.httpStatusCode === 404) return null;
|
|
112
|
+
console.error(`Failed to head object ${key} in bucket ${bucket}.`);
|
|
113
|
+
console.log(convertException(ex));
|
|
114
|
+
}
|
|
156
115
|
return null;
|
|
157
|
-
}
|
|
158
|
-
console.error(`Failed to head object ${key} in bucket ${bucket}.`);
|
|
159
|
-
console.log((0, _utils.convertException)(ex));
|
|
160
116
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
117
|
+
async createMultipartUpload(params) {
|
|
118
|
+
const { targetBucket, targetKey } = params;
|
|
119
|
+
const input = {
|
|
120
|
+
Bucket: targetBucket,
|
|
121
|
+
Key: targetKey
|
|
122
|
+
};
|
|
123
|
+
const command = new CreateMultipartUploadCommand(input);
|
|
124
|
+
const response = await this.targetClient.send(command);
|
|
125
|
+
if (!response.UploadId) throw new Error("Failed to create multipart upload.");
|
|
126
|
+
return response.UploadId;
|
|
127
|
+
}
|
|
128
|
+
async uploadPartCopy(params) {
|
|
129
|
+
const { sourceBucket, sourceKey, targetBucket, targetKey, uploadId, partNumber, start, end, completedParts } = params;
|
|
130
|
+
const input = {
|
|
131
|
+
Bucket: targetBucket,
|
|
132
|
+
Key: targetKey,
|
|
133
|
+
UploadId: uploadId,
|
|
134
|
+
PartNumber: partNumber,
|
|
135
|
+
CopySource: encodeURIComponent(`${sourceBucket}/${sourceKey}`),
|
|
136
|
+
CopySourceRange: `bytes=${start}-${end}`
|
|
137
|
+
};
|
|
138
|
+
const command = new UploadPartCopyCommand(input);
|
|
139
|
+
const response = await this.targetClient.send(command);
|
|
140
|
+
if (!response.CopyPartResult?.ETag) throw new Error(`UploadPartCopy failed for part ${partNumber}`);
|
|
141
|
+
completedParts.push({
|
|
142
|
+
ETag: response.CopyPartResult.ETag,
|
|
143
|
+
PartNumber: partNumber
|
|
144
|
+
});
|
|
176
145
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
Bucket: targetBucket,
|
|
193
|
-
Key: targetKey,
|
|
194
|
-
UploadId: uploadId,
|
|
195
|
-
PartNumber: partNumber,
|
|
196
|
-
CopySource: encodeURIComponent(`${sourceBucket}/${sourceKey}`),
|
|
197
|
-
CopySourceRange: `bytes=${start}-${end}`
|
|
198
|
-
};
|
|
199
|
-
const command = new _index.UploadPartCopyCommand(input);
|
|
200
|
-
const response = await this.targetClient.send(command);
|
|
201
|
-
if (!response.CopyPartResult?.ETag) {
|
|
202
|
-
throw new Error(`UploadPartCopy failed for part ${partNumber}`);
|
|
146
|
+
async completeMultipartUpload(params) {
|
|
147
|
+
const { targetBucket, targetKey, uploadId, completedParts } = params;
|
|
148
|
+
const sortedParts = [
|
|
149
|
+
...completedParts
|
|
150
|
+
].sort((a, b)=>a.PartNumber - b.PartNumber);
|
|
151
|
+
const input = {
|
|
152
|
+
Bucket: targetBucket,
|
|
153
|
+
Key: targetKey,
|
|
154
|
+
UploadId: uploadId,
|
|
155
|
+
MultipartUpload: {
|
|
156
|
+
Parts: sortedParts
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
const command = new CompleteMultipartUploadCommand(input);
|
|
160
|
+
return await this.targetClient.send(command);
|
|
203
161
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
uploadId,
|
|
214
|
-
completedParts
|
|
215
|
-
} = params;
|
|
216
|
-
const sortedParts = [...completedParts].sort((a, b) => {
|
|
217
|
-
return a.PartNumber - b.PartNumber;
|
|
218
|
-
});
|
|
219
|
-
const input = {
|
|
220
|
-
Bucket: targetBucket,
|
|
221
|
-
Key: targetKey,
|
|
222
|
-
UploadId: uploadId,
|
|
223
|
-
MultipartUpload: {
|
|
224
|
-
Parts: sortedParts
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
const command = new _index.CompleteMultipartUploadCommand(input);
|
|
228
|
-
return await this.targetClient.send(command);
|
|
229
|
-
}
|
|
230
|
-
async abortMultipartUpload(params) {
|
|
231
|
-
const {
|
|
232
|
-
targetBucket,
|
|
233
|
-
targetKey,
|
|
234
|
-
uploadId
|
|
235
|
-
} = params;
|
|
236
|
-
const input = {
|
|
237
|
-
Bucket: targetBucket,
|
|
238
|
-
Key: targetKey,
|
|
239
|
-
UploadId: uploadId
|
|
240
|
-
};
|
|
241
|
-
const command = new _index.AbortMultipartUploadCommand(input);
|
|
242
|
-
await this.targetClient.send(command);
|
|
243
|
-
}
|
|
244
|
-
async copyMetadata(params) {
|
|
245
|
-
const {
|
|
246
|
-
sourceBucket,
|
|
247
|
-
targetBucket,
|
|
248
|
-
key
|
|
249
|
-
} = params;
|
|
250
|
-
const metadataKey = `${key}.metadata`;
|
|
251
|
-
const [sourceMetadata, targetMetadata] = await Promise.all([this.headObject({
|
|
252
|
-
client: this.sourceClient,
|
|
253
|
-
bucket: sourceBucket,
|
|
254
|
-
key: metadataKey
|
|
255
|
-
}).catch(() => null), this.headObject({
|
|
256
|
-
client: this.targetClient,
|
|
257
|
-
bucket: targetBucket,
|
|
258
|
-
key: metadataKey
|
|
259
|
-
}).catch(() => null)]);
|
|
260
|
-
/**
|
|
261
|
-
* If the source metadata does not exist, we cannot copy it.
|
|
262
|
-
*/
|
|
263
|
-
if (!sourceMetadata?.ETag) {
|
|
264
|
-
return null;
|
|
162
|
+
async abortMultipartUpload(params) {
|
|
163
|
+
const { targetBucket, targetKey, uploadId } = params;
|
|
164
|
+
const input = {
|
|
165
|
+
Bucket: targetBucket,
|
|
166
|
+
Key: targetKey,
|
|
167
|
+
UploadId: uploadId
|
|
168
|
+
};
|
|
169
|
+
const command = new AbortMultipartUploadCommand(input);
|
|
170
|
+
await this.targetClient.send(command);
|
|
265
171
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
172
|
+
async copyMetadata(params) {
|
|
173
|
+
const { sourceBucket, targetBucket, key } = params;
|
|
174
|
+
const metadataKey = `${key}.metadata`;
|
|
175
|
+
const [sourceMetadata, targetMetadata] = await Promise.all([
|
|
176
|
+
this.headObject({
|
|
177
|
+
client: this.sourceClient,
|
|
178
|
+
bucket: sourceBucket,
|
|
179
|
+
key: metadataKey
|
|
180
|
+
}).catch(()=>null),
|
|
181
|
+
this.headObject({
|
|
182
|
+
client: this.targetClient,
|
|
183
|
+
bucket: targetBucket,
|
|
184
|
+
key: metadataKey
|
|
185
|
+
}).catch(()=>null)
|
|
186
|
+
]);
|
|
187
|
+
if (!sourceMetadata?.ETag) return null;
|
|
188
|
+
if (targetMetadata) return null;
|
|
189
|
+
const input = {
|
|
190
|
+
Bucket: targetBucket,
|
|
191
|
+
Key: metadataKey,
|
|
192
|
+
CopySource: encodeURIComponent(`${sourceBucket}/${metadataKey}`)
|
|
193
|
+
};
|
|
194
|
+
const command = new CopyObjectCommand(input);
|
|
195
|
+
return await this.targetClient.send(command);
|
|
271
196
|
}
|
|
272
|
-
const input = {
|
|
273
|
-
Bucket: targetBucket,
|
|
274
|
-
Key: metadataKey,
|
|
275
|
-
CopySource: encodeURIComponent(`${sourceBucket}/${metadataKey}`)
|
|
276
|
-
};
|
|
277
|
-
const command = new _index.CopyObjectCommand(input);
|
|
278
|
-
return await this.targetClient.send(command);
|
|
279
|
-
}
|
|
280
197
|
}
|
|
281
|
-
|
|
198
|
+
export { CopyFile };
|
|
282
199
|
|
|
283
200
|
//# sourceMappingURL=CopyFile.js.map
|