@webiny/api-sync-system 6.0.0-alpha.5 → 6.0.0-rc.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/README.md +6 -108
- package/constants.js +1 -7
- package/constants.js.map +1 -1
- package/index.js +3 -38
- package/index.js.map +1 -1
- package/package.json +20 -23
- package/resolver/app/RecordHandler.d.ts +6 -6
- package/resolver/app/RecordHandler.js +7 -15
- package/resolver/app/RecordHandler.js.map +1 -1
- package/resolver/app/RecordsValidation.js +6 -14
- package/resolver/app/RecordsValidation.js.map +1 -1
- package/resolver/app/ResolverApplication.d.ts +1 -1
- package/resolver/app/ResolverApplication.js +10 -18
- package/resolver/app/ResolverApplication.js.map +1 -1
- package/resolver/app/abstractions/RecordHandler.d.ts +1 -1
- package/resolver/app/abstractions/RecordHandler.js +1 -5
- package/resolver/app/abstractions/RecordsValidation.d.ts +2 -2
- package/resolver/app/abstractions/RecordsValidation.js +1 -5
- package/resolver/app/abstractions/RecordsValidation.js.map +1 -1
- package/resolver/app/abstractions/ResolverApplication.js +1 -5
- package/resolver/app/abstractions/ResolverRecord.d.ts +1 -1
- package/resolver/app/abstractions/ResolverRecord.js +1 -5
- package/resolver/app/abstractions/ResolverRecord.js.map +1 -1
- package/resolver/app/bundler/BaseBundle.d.ts +6 -6
- package/resolver/app/bundler/BaseBundle.js +1 -8
- package/resolver/app/bundler/BaseBundle.js.map +1 -1
- package/resolver/app/bundler/Bundler.d.ts +1 -1
- package/resolver/app/bundler/Bundler.js +2 -10
- package/resolver/app/bundler/Bundler.js.map +1 -1
- package/resolver/app/bundler/Bundles.d.ts +2 -2
- package/resolver/app/bundler/Bundles.js +2 -10
- package/resolver/app/bundler/Bundles.js.map +1 -1
- package/resolver/app/bundler/CommandBundle.d.ts +1 -1
- package/resolver/app/bundler/CommandBundle.js +3 -11
- package/resolver/app/bundler/CommandBundle.js.map +1 -1
- package/resolver/app/bundler/TableBundle.d.ts +1 -1
- package/resolver/app/bundler/TableBundle.js +3 -11
- package/resolver/app/bundler/TableBundle.js.map +1 -1
- package/resolver/app/bundler/types.d.ts +2 -2
- package/resolver/app/bundler/types.js +1 -5
- package/resolver/app/commandHandler/DeleteCommandHandler.d.ts +3 -3
- package/resolver/app/commandHandler/DeleteCommandHandler.js +1 -8
- package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/PutCommandHandler.d.ts +4 -4
- package/resolver/app/commandHandler/PutCommandHandler.js +1 -8
- package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/delete.d.ts +1 -1
- package/resolver/app/commandHandler/delete.js +6 -13
- package/resolver/app/commandHandler/delete.js.map +1 -1
- package/resolver/app/commandHandler/put.d.ts +1 -1
- package/resolver/app/commandHandler/put.js +6 -13
- package/resolver/app/commandHandler/put.js.map +1 -1
- package/resolver/app/data/SourceDataContainer.d.ts +3 -3
- package/resolver/app/data/SourceDataContainer.js +1 -8
- package/resolver/app/data/SourceDataContainer.js.map +1 -1
- package/resolver/app/data/types.d.ts +2 -2
- package/resolver/app/data/types.js +1 -5
- package/resolver/app/fetcher/Fetcher.d.ts +3 -3
- package/resolver/app/fetcher/Fetcher.js +13 -22
- package/resolver/app/fetcher/Fetcher.js.map +1 -1
- package/resolver/app/fetcher/types.d.ts +2 -2
- package/resolver/app/fetcher/types.js +1 -5
- package/resolver/app/ingestor/Ingestor.d.ts +1 -1
- package/resolver/app/ingestor/Ingestor.js +2 -10
- package/resolver/app/ingestor/Ingestor.js.map +1 -1
- package/resolver/app/ingestor/IngestorResult.js +3 -11
- package/resolver/app/ingestor/IngestorResult.js.map +1 -1
- package/resolver/app/ingestor/types.d.ts +2 -2
- package/resolver/app/ingestor/types.js +1 -5
- package/resolver/app/storer/Storer.d.ts +3 -3
- package/resolver/app/storer/Storer.js +12 -20
- package/resolver/app/storer/Storer.js.map +1 -1
- package/resolver/app/storer/types.d.ts +2 -2
- package/resolver/app/storer/types.js +1 -5
- package/resolver/app/storer/types.js.map +1 -1
- package/resolver/app/transform/TransformHandler.d.ts +4 -4
- package/resolver/app/transform/TransformHandler.js +5 -12
- package/resolver/app/transform/TransformHandler.js.map +1 -1
- package/resolver/app/transform/middleware.d.ts +1 -1
- package/resolver/app/transform/middleware.js +1 -7
- package/resolver/app/transform/middleware.js.map +1 -1
- package/resolver/app/utils/Retry.js +4 -12
- package/resolver/app/utils/Retry.js.map +1 -1
- package/resolver/app/utils/sleep.js +1 -8
- package/resolver/app/utils/sleep.js.map +1 -1
- package/resolver/app/validation/body.d.ts +6 -6
- package/resolver/app/validation/body.js +22 -30
- package/resolver/app/validation/body.js.map +1 -1
- package/resolver/app/validation/createJsonTransform.js +6 -14
- package/resolver/app/validation/createJsonTransform.js.map +1 -1
- package/resolver/app/validation/detail.d.ts +6 -6
- package/resolver/app/validation/detail.js +16 -24
- package/resolver/app/validation/detail.js.map +1 -1
- package/resolver/app/validation/event.d.ts +6 -6
- package/resolver/app/validation/event.js +19 -27
- package/resolver/app/validation/event.js.map +1 -1
- package/resolver/app/validation/numericString.js +5 -13
- package/resolver/app/validation/numericString.js.map +1 -1
- package/resolver/app/validation/system.js +8 -16
- package/resolver/app/validation/system.js.map +1 -1
- package/resolver/createEventHandlerPlugin.d.ts +2 -1
- package/resolver/createEventHandlerPlugin.js +35 -42
- package/resolver/createEventHandlerPlugin.js.map +1 -1
- package/resolver/createResolverHandler.d.ts +1 -1
- package/resolver/createResolverHandler.js +24 -31
- package/resolver/createResolverHandler.js.map +1 -1
- package/resolver/deployment/Deployment.d.ts +2 -3
- package/resolver/deployment/Deployment.js +6 -14
- package/resolver/deployment/Deployment.js.map +1 -1
- package/resolver/deployment/Deployments.js +2 -10
- package/resolver/deployment/Deployments.js.map +1 -1
- package/resolver/deployment/DeploymentsFetcher.js +33 -42
- package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
- package/resolver/deployment/types.d.ts +4 -4
- package/resolver/deployment/types.js +1 -5
- package/resolver/deployment/types.js.map +1 -1
- package/resolver/lambda/LambdaTrigger.js +5 -12
- package/resolver/lambda/LambdaTrigger.js.map +1 -1
- package/resolver/plugins/CommandHandlerPlugin.d.ts +3 -3
- package/resolver/plugins/CommandHandlerPlugin.js +3 -11
- package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
- package/resolver/plugins/StorerAfterEachPlugin.d.ts +2 -2
- package/resolver/plugins/StorerAfterEachPlugin.js +4 -13
- package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
- package/resolver/plugins/TransformRecordPlugin.d.ts +3 -3
- package/resolver/plugins/TransformRecordPlugin.js +3 -11
- package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
- package/resolver/recordTypes/fileManager/CopyFile.js +4 -11
- package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.d.ts +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.js +3 -10
- package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManager.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManager.js +4 -11
- package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +7 -14
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.d.ts +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js +7 -14
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.d.ts +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.js +1 -8
- package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/fileManager/types.d.ts +2 -2
- package/resolver/recordTypes/fileManager/types.js +1 -5
- package/resolver/recordTypes/users/CopyUser.d.ts +2 -2
- package/resolver/recordTypes/users/CopyUser.js +3 -10
- package/resolver/recordTypes/users/CopyUser.js.map +1 -1
- package/resolver/recordTypes/users/DeleteUser.d.ts +2 -2
- package/resolver/recordTypes/users/DeleteUser.js +3 -10
- package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.d.ts +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.js +1 -8
- package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/users/types.d.ts +1 -1
- package/resolver/recordTypes/users/types.js +1 -5
- package/resolver/recordTypes/users/types.js.map +1 -1
- package/resolver/recordTypes/users/users.js +4 -11
- package/resolver/recordTypes/users/users.js.map +1 -1
- package/resolver/recordTypes/users/usersOnDelete.d.ts +2 -2
- package/resolver/recordTypes/users/usersOnDelete.js +7 -14
- package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
- package/resolver/recordTypes/users/usersOnPut.d.ts +2 -2
- package/resolver/recordTypes/users/usersOnPut.js +7 -14
- package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
- package/sync/FilterOutRecord.d.ts +2 -2
- package/sync/FilterOutRecord.js +2 -10
- package/sync/FilterOutRecord.js.map +1 -1
- package/sync/attachToDynamoDbDocument.d.ts +1 -1
- package/sync/attachToDynamoDbDocument.js +9 -17
- package/sync/attachToDynamoDbDocument.js.map +1 -1
- package/sync/createHandler.js +27 -34
- package/sync/createHandler.js.map +1 -1
- package/sync/createSendDataToEventBridgeOnRequestEnd.js +6 -13
- package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +1 -1
- package/sync/createSyncSystem.d.ts +1 -1
- package/sync/createSyncSystem.js +6 -13
- package/sync/createSyncSystem.js.map +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.d.ts +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.js +9 -19
- package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
- package/sync/handler/Handler.d.ts +2 -2
- package/sync/handler/Handler.js +9 -17
- package/sync/handler/Handler.js.map +1 -1
- package/sync/handler/HandlerConverter.js +2 -10
- package/sync/handler/HandlerConverter.js.map +1 -1
- package/sync/handler/converter/BatchGetCommandConverter.js +6 -14
- package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
- package/sync/handler/converter/BatchWriteCommandConverter.js +6 -14
- package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
- package/sync/handler/converter/DeleteCommandConverter.js +6 -14
- package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
- package/sync/handler/converter/GetCommandConverter.js +6 -14
- package/sync/handler/converter/GetCommandConverter.js.map +1 -1
- package/sync/handler/converter/PutCommandConverter.js +6 -14
- package/sync/handler/converter/PutCommandConverter.js.map +1 -1
- package/sync/handler/converter/QueryCommandConverter.js +6 -14
- package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
- package/sync/handler/converter/ScanCommandConverter.js +6 -14
- package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
- package/sync/handler/converter/UpdateCommandConverter.js +6 -14
- 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 +4 -11
- 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 +3 -10
- 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 +1 -8
- 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 +3 -10
- 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 +3 -10
- package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
- package/sync/handler/types.d.ts +3 -3
- package/sync/handler/types.js +1 -5
- package/sync/handler/types.js.map +1 -1
- package/sync/plugins/FilterOutRecordPlugin.d.ts +1 -1
- package/sync/plugins/FilterOutRecordPlugin.js +3 -11
- package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
- package/sync/requestPlugin.d.ts +1 -1
- package/sync/requestPlugin.js +19 -20
- package/sync/requestPlugin.js.map +1 -1
- package/sync/types.js +1 -5
- package/sync/utils/getTableType.js +7 -14
- package/sync/utils/getTableType.js.map +1 -1
- package/sync/utils/manifest.d.ts +1 -1
- package/sync/utils/manifest.js +12 -20
- package/sync/utils/manifest.js.map +1 -1
- package/sync/utils/validateSystemInput.d.ts +1 -1
- package/sync/utils/validateSystemInput.js +3 -10
- package/sync/utils/validateSystemInput.js.map +1 -1
- package/types.d.ts +3 -4
- package/types.js +2 -8
- package/types.js.map +1 -1
- package/utils/createSystemName.js +1 -8
- package/utils/createSystemName.js.map +1 -1
- package/worker/actions/copyFile/CopyFile.js +13 -21
- package/worker/actions/copyFile/CopyFile.js.map +1 -1
- package/worker/actions/copyFile/copyFileAction.d.ts +1 -1
- package/worker/actions/copyFile/copyFileAction.js +9 -16
- package/worker/actions/copyFile/copyFileAction.js.map +1 -1
- package/worker/actions/copyFile/copyFileSchema.js +8 -16
- package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
- package/worker/actions/copyFile/types.js +1 -5
- package/worker/actions/createUser/CreateUser.d.ts +1 -1
- package/worker/actions/createUser/CreateUser.js +9 -16
- package/worker/actions/createUser/CreateUser.js.map +1 -1
- package/worker/actions/createUser/createUserAction.d.ts +2 -2
- package/worker/actions/createUser/createUserAction.js +9 -16
- package/worker/actions/createUser/createUserAction.js.map +1 -1
- package/worker/actions/createUser/createUserSchema.js +8 -16
- package/worker/actions/createUser/createUserSchema.js.map +1 -1
- package/worker/actions/createUser/types.js +1 -5
- package/worker/actions/deleteFile/DeleteFile.js +4 -11
- package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileAction.d.ts +1 -1
- package/worker/actions/deleteFile/deleteFileAction.js +9 -16
- package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileSchema.js +8 -16
- package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
- package/worker/actions/deleteFile/types.js +1 -5
- package/worker/actions/deleteUser/DeleteUser.d.ts +2 -2
- package/worker/actions/deleteUser/DeleteUser.js +7 -14
- package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserAction.d.ts +1 -1
- package/worker/actions/deleteUser/deleteUserAction.js +9 -16
- package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserSchema.js +8 -16
- package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
- package/worker/actions/deleteUser/types.js +1 -5
- package/worker/actions/logValidationError.js +4 -11
- package/worker/actions/logValidationError.js.map +1 -1
- package/worker/actions/removeCognitoUserAttributes.js +1 -8
- package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
- package/worker/actions/updateUser/UpdateUser.d.ts +1 -1
- package/worker/actions/updateUser/UpdateUser.js +9 -16
- package/worker/actions/updateUser/UpdateUser.js.map +1 -1
- package/worker/actions/updateUser/types.js +1 -5
- package/worker/actions/updateUser/updateUserAction.d.ts +2 -2
- package/worker/actions/updateUser/updateUserAction.js +9 -16
- package/worker/actions/updateUser/updateUserAction.js.map +1 -1
- package/worker/actions/updateUser/updateUserSchema.js +8 -16
- package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
- package/worker/createWorkerHandler.js +17 -24
- package/worker/createWorkerHandler.js.map +1 -1
- package/worker/handler/WorkerActionHandler.d.ts +2 -2
- package/worker/handler/WorkerActionHandler.js +3 -10
- package/worker/handler/WorkerActionHandler.js.map +1 -1
- package/worker/handler/eventHandler.js +9 -16
- package/worker/handler/eventHandler.js.map +1 -1
- package/worker/plugins/WorkerActionPlugin.d.ts +1 -1
- package/worker/plugins/WorkerActionPlugin.js +3 -11
- package/worker/plugins/WorkerActionPlugin.js.map +1 -1
- package/worker/types.js +1 -5
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.BaseBundle = void 0;
|
|
7
|
-
class BaseBundle {
|
|
1
|
+
export class BaseBundle {
|
|
8
2
|
items = [];
|
|
9
3
|
constructor(params) {
|
|
10
4
|
this.command = this.getCommand(params.command);
|
|
@@ -21,6 +15,5 @@ class BaseBundle {
|
|
|
21
15
|
});
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
|
-
exports.BaseBundle = BaseBundle;
|
|
25
18
|
|
|
26
19
|
//# sourceMappingURL=BaseBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BaseBundle","items","constructor","params","command","getCommand","table","source","add","item","push","PK","SK"
|
|
1
|
+
{"version":3,"names":["BaseBundle","items","constructor","params","command","getCommand","table","source","add","item","push","PK","SK"],"sources":["BaseBundle.ts"],"sourcesContent":["import type { IBundle, IBundleItem } from \"~/resolver/app/bundler/types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { CommandType } from \"~/types.js\";\nimport { type ExtendedCommandType } from \"~/types.js\";\nimport type { IIngestorResultItem } from \"../ingestor/types.js\";\n\nexport interface IBaseBundleParams {\n command: ExtendedCommandType;\n table: ITable;\n source: IDeployment;\n}\n\nexport abstract class BaseBundle implements IBundle {\n readonly items: IBundleItem[] = [];\n readonly command: CommandType;\n readonly table: ITable;\n readonly source: IDeployment;\n\n public abstract canAdd(item: IIngestorResultItem): boolean;\n\n public constructor(params: IBaseBundleParams) {\n this.command = this.getCommand(params.command);\n this.table = params.table;\n this.source = params.source;\n }\n\n protected getCommand(command: ExtendedCommandType): CommandType {\n return command === \"delete\" ? \"delete\" : \"put\";\n }\n\n public add(item: IIngestorResultItem): void {\n this.items.push({\n PK: item.PK,\n SK: item.SK\n });\n }\n}\n"],"mappings":"AAaA,OAAO,MAAeA,UAAU,CAAoB;EACvCC,KAAK,GAAkB,EAAE;EAO3BC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACF,MAAM,CAACC,OAAO,CAAC;IAC9C,IAAI,CAACE,KAAK,GAAGH,MAAM,CAACG,KAAK;IACzB,IAAI,CAACC,MAAM,GAAGJ,MAAM,CAACI,MAAM;EAC/B;EAEUF,UAAUA,CAACD,OAA4B,EAAe;IAC5D,OAAOA,OAAO,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK;EAClD;EAEOI,GAAGA,CAACC,IAAyB,EAAQ;IACxC,IAAI,CAACR,KAAK,CAACS,IAAI,CAAC;MACZC,EAAE,EAAEF,IAAI,CAACE,EAAE;MACXC,EAAE,EAAEH,IAAI,CAACG;IACb,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createBundler = exports.Bundler = void 0;
|
|
7
|
-
class Bundler {
|
|
1
|
+
export class Bundler {
|
|
8
2
|
constructor(params) {
|
|
9
3
|
this.createBundles = params.createBundles;
|
|
10
4
|
}
|
|
@@ -21,10 +15,8 @@ class Bundler {
|
|
|
21
15
|
return bundles;
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
const createBundler = params => {
|
|
18
|
+
export const createBundler = params => {
|
|
26
19
|
return new Bundler(params);
|
|
27
20
|
};
|
|
28
|
-
exports.createBundler = createBundler;
|
|
29
21
|
|
|
30
22
|
//# sourceMappingURL=Bundler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Bundler","constructor","params","createBundles","bundle","items","bundles","item","add","
|
|
1
|
+
{"version":3,"names":["Bundler","constructor","params","createBundles","bundle","items","bundles","item","add","createBundler"],"sources":["Bundler.ts"],"sourcesContent":["import type { IBundler, IBundlerBundleParams, IBundles } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IBundlerParams {\n createBundles: () => IBundles;\n}\n\nexport class Bundler implements IBundler {\n private readonly createBundles: () => IBundles;\n\n public constructor(params: IBundlerParams) {\n this.createBundles = params.createBundles;\n }\n\n public bundle(params: IBundlerBundleParams): IBundles {\n const { items } = params;\n\n const bundles = this.createBundles();\n\n for (const item of items) {\n bundles.add({\n item\n });\n }\n\n return bundles;\n }\n}\n\nexport const createBundler = (params: IBundlerParams) => {\n return new Bundler(params);\n};\n"],"mappings":"AAMA,OAAO,MAAMA,OAAO,CAAqB;EAG9BC,WAAWA,CAACC,MAAsB,EAAE;IACvC,IAAI,CAACC,aAAa,GAAGD,MAAM,CAACC,aAAa;EAC7C;EAEOC,MAAMA,CAACF,MAA4B,EAAY;IAClD,MAAM;MAAEG;IAAM,CAAC,GAAGH,MAAM;IAExB,MAAMI,OAAO,GAAG,IAAI,CAACH,aAAa,CAAC,CAAC;IAEpC,KAAK,MAAMI,IAAI,IAAIF,KAAK,EAAE;MACtBC,OAAO,CAACE,GAAG,CAAC;QACRD;MACJ,CAAC,CAAC;IACN;IAEA,OAAOD,OAAO;EAClB;AACJ;AAEA,OAAO,MAAMG,aAAa,GAAIP,MAAsB,IAAK;EACrD,OAAO,IAAIF,OAAO,CAACE,MAAM,CAAC;AAC9B,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { IBundle, IBundles, IBundlesAddParams } from "
|
|
2
|
-
import type { IIngestorResultItem } from "
|
|
1
|
+
import type { IBundle, IBundles, IBundlesAddParams } from "../../../resolver/app/bundler/types.js";
|
|
2
|
+
import type { IIngestorResultItem } from "../../../resolver/app/ingestor/types.js";
|
|
3
3
|
export interface IBundlesParams {
|
|
4
4
|
createBundle: (item: IIngestorResultItem) => IBundle;
|
|
5
5
|
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createBundles = exports.Bundles = void 0;
|
|
7
|
-
class Bundles {
|
|
1
|
+
export class Bundles {
|
|
8
2
|
bundles = [];
|
|
9
3
|
constructor(params) {
|
|
10
4
|
this.createBundle = params.createBundle;
|
|
@@ -29,10 +23,8 @@ class Bundles {
|
|
|
29
23
|
return bundle;
|
|
30
24
|
}
|
|
31
25
|
}
|
|
32
|
-
|
|
33
|
-
const createBundles = params => {
|
|
26
|
+
export const createBundles = params => {
|
|
34
27
|
return new Bundles(params);
|
|
35
28
|
};
|
|
36
|
-
exports.createBundles = createBundles;
|
|
37
29
|
|
|
38
30
|
//# sourceMappingURL=Bundles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Bundles","bundles","constructor","params","createBundle","add","item","bundle","getBundle","getBundles","last","length","canAdd","push","
|
|
1
|
+
{"version":3,"names":["Bundles","bundles","constructor","params","createBundle","add","item","bundle","getBundle","getBundles","last","length","canAdd","push","createBundles"],"sources":["Bundles.ts"],"sourcesContent":["import type { IBundle, IBundles, IBundlesAddParams } from \"~/resolver/app/bundler/types.js\";\nimport type { IIngestorResultItem } from \"~/resolver/app/ingestor/types.js\";\n\nexport interface IBundlesParams {\n createBundle: (item: IIngestorResultItem) => IBundle;\n}\n\nexport class Bundles implements IBundles {\n private readonly bundles: IBundle[] = [];\n private readonly createBundle: (item: IIngestorResultItem) => IBundle;\n\n public constructor(params: IBundlesParams) {\n this.createBundle = params.createBundle;\n }\n\n public add(params: IBundlesAddParams): void {\n const { item } = params;\n\n const bundle = this.getBundle(item);\n\n bundle.add(item);\n }\n\n public getBundles(): IBundle[] {\n return this.bundles;\n }\n\n private getBundle(item: IIngestorResultItem): IBundle {\n const last = this.bundles[this.bundles.length - 1];\n if (last?.canAdd(item)) {\n return last;\n }\n const bundle = this.createBundle(item);\n this.bundles.push(bundle);\n return bundle;\n }\n}\n\nexport const createBundles = (params: IBundlesParams) => {\n return new Bundles(params);\n};\n"],"mappings":"AAOA,OAAO,MAAMA,OAAO,CAAqB;EACpBC,OAAO,GAAc,EAAE;EAGjCC,WAAWA,CAACC,MAAsB,EAAE;IACvC,IAAI,CAACC,YAAY,GAAGD,MAAM,CAACC,YAAY;EAC3C;EAEOC,GAAGA,CAACF,MAAyB,EAAQ;IACxC,MAAM;MAAEG;IAAK,CAAC,GAAGH,MAAM;IAEvB,MAAMI,MAAM,GAAG,IAAI,CAACC,SAAS,CAACF,IAAI,CAAC;IAEnCC,MAAM,CAACF,GAAG,CAACC,IAAI,CAAC;EACpB;EAEOG,UAAUA,CAAA,EAAc;IAC3B,OAAO,IAAI,CAACR,OAAO;EACvB;EAEQO,SAASA,CAACF,IAAyB,EAAW;IAClD,MAAMI,IAAI,GAAG,IAAI,CAACT,OAAO,CAAC,IAAI,CAACA,OAAO,CAACU,MAAM,GAAG,CAAC,CAAC;IAClD,IAAID,IAAI,EAAEE,MAAM,CAACN,IAAI,CAAC,EAAE;MACpB,OAAOI,IAAI;IACf;IACA,MAAMH,MAAM,GAAG,IAAI,CAACH,YAAY,CAACE,IAAI,CAAC;IACtC,IAAI,CAACL,OAAO,CAACY,IAAI,CAACN,MAAM,CAAC;IACzB,OAAOA,MAAM;EACjB;AACJ;AAEA,OAAO,MAAMO,aAAa,GAAIX,MAAsB,IAAK;EACrD,OAAO,IAAIH,OAAO,CAACG,MAAM,CAAC;AAC9B,CAAC","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This will be used for executing the commands in the target systems.
|
|
7
7
|
*/
|
|
8
8
|
import type { IBundle } from "./types.js";
|
|
9
|
-
import type { IIngestorResultItem } from "../ingestor/types";
|
|
9
|
+
import type { IIngestorResultItem } from "../ingestor/types.js";
|
|
10
10
|
import type { IBaseBundleParams } from "./BaseBundle.js";
|
|
11
11
|
import { BaseBundle } from "./BaseBundle.js";
|
|
12
12
|
export declare class CommandBundle extends BaseBundle {
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createCommandBundle = exports.CommandBundle = void 0;
|
|
7
|
-
var _BaseBundle = require("./BaseBundle.js");
|
|
8
1
|
/**
|
|
9
2
|
* Used to bundle by source system, table and command.
|
|
10
3
|
* If we receive >1 commands in a single batch, for example, put -> delete -> put -> delete, we need to make sure
|
|
@@ -13,16 +6,15 @@ var _BaseBundle = require("./BaseBundle.js");
|
|
|
13
6
|
* This will be used for executing the commands in the target systems.
|
|
14
7
|
*/
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
import { BaseBundle } from "./BaseBundle.js";
|
|
10
|
+
export class CommandBundle extends BaseBundle {
|
|
17
11
|
canAdd(item) {
|
|
18
12
|
const command = this.getCommand(item.command);
|
|
19
13
|
return this.command === command && this.table.name === item.table.name && this.source.name === item.source.name;
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
|
-
|
|
23
|
-
const createCommandBundle = params => {
|
|
16
|
+
export const createCommandBundle = params => {
|
|
24
17
|
return new CommandBundle(params);
|
|
25
18
|
};
|
|
26
|
-
exports.createCommandBundle = createCommandBundle;
|
|
27
19
|
|
|
28
20
|
//# sourceMappingURL=CommandBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["BaseBundle","CommandBundle","canAdd","item","command","getCommand","table","name","source","createCommandBundle","params"],"sources":["CommandBundle.ts"],"sourcesContent":["/**\n * Used to bundle by source system, table and command.\n * If we receive >1 commands in a single batch, for example, put -> delete -> put -> delete, we need to make sure\n * that commands are executed in that order.\n *\n * This will be used for executing the commands in the target systems.\n */\nimport type { IBundle } from \"./types.js\";\nimport type { IIngestorResultItem } from \"../ingestor/types.js\";\nimport type { IBaseBundleParams } from \"./BaseBundle.js\";\nimport { BaseBundle } from \"./BaseBundle.js\";\n\nexport class CommandBundle extends BaseBundle {\n public canAdd(item: IIngestorResultItem): boolean {\n const command = this.getCommand(item.command);\n return (\n this.command === command &&\n this.table.name === item.table.name &&\n this.source.name === item.source.name\n );\n }\n}\n\nexport const createCommandBundle = (params: IBaseBundleParams): IBundle => {\n return new CommandBundle(params);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,UAAU;AAEnB,OAAO,MAAMC,aAAa,SAASD,UAAU,CAAC;EACnCE,MAAMA,CAACC,IAAyB,EAAW;IAC9C,MAAMC,OAAO,GAAG,IAAI,CAACC,UAAU,CAACF,IAAI,CAACC,OAAO,CAAC;IAC7C,OACI,IAAI,CAACA,OAAO,KAAKA,OAAO,IACxB,IAAI,CAACE,KAAK,CAACC,IAAI,KAAKJ,IAAI,CAACG,KAAK,CAACC,IAAI,IACnC,IAAI,CAACC,MAAM,CAACD,IAAI,KAAKJ,IAAI,CAACK,MAAM,CAACD,IAAI;EAE7C;AACJ;AAEA,OAAO,MAAME,mBAAmB,GAAIC,MAAyB,IAAc;EACvE,OAAO,IAAIT,aAAa,CAACS,MAAM,CAAC;AACpC,CAAC","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* It will be used to fetch the data from the source system tables.
|
|
5
5
|
*/
|
|
6
6
|
import type { IBundle } from "./types.js";
|
|
7
|
-
import type { IIngestorResultItem } from "../ingestor/types";
|
|
7
|
+
import type { IIngestorResultItem } from "../ingestor/types.js";
|
|
8
8
|
import type { IBaseBundleParams } from "./BaseBundle.js";
|
|
9
9
|
import { BaseBundle } from "./BaseBundle.js";
|
|
10
10
|
export declare class TableBundle extends BaseBundle {
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createTableBundle = exports.TableBundle = void 0;
|
|
7
|
-
var _BaseBundle = require("./BaseBundle.js");
|
|
8
1
|
/**
|
|
9
2
|
* This will bundle records by system and table.
|
|
10
3
|
*
|
|
11
4
|
* It will be used to fetch the data from the source system tables.
|
|
12
5
|
*/
|
|
13
6
|
|
|
14
|
-
|
|
7
|
+
import { BaseBundle } from "./BaseBundle.js";
|
|
8
|
+
export class TableBundle extends BaseBundle {
|
|
15
9
|
canAdd(item) {
|
|
16
10
|
return this.source.name === item.source.name && this.table.name === item.table.name;
|
|
17
11
|
}
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
const createTableBundle = params => {
|
|
13
|
+
export const createTableBundle = params => {
|
|
21
14
|
return new TableBundle(params);
|
|
22
15
|
};
|
|
23
|
-
exports.createTableBundle = createTableBundle;
|
|
24
16
|
|
|
25
17
|
//# sourceMappingURL=TableBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["BaseBundle","TableBundle","canAdd","item","source","name","table","createTableBundle","params"],"sources":["TableBundle.ts"],"sourcesContent":["/**\n * This will bundle records by system and table.\n *\n * It will be used to fetch the data from the source system tables.\n */\nimport type { IBundle } from \"./types.js\";\nimport type { IIngestorResultItem } from \"../ingestor/types.js\";\nimport type { IBaseBundleParams } from \"./BaseBundle.js\";\nimport { BaseBundle } from \"./BaseBundle.js\";\n\nexport class TableBundle extends BaseBundle {\n public canAdd(item: IIngestorResultItem): boolean {\n return this.source.name === item.source.name && this.table.name === item.table.name;\n }\n}\n\nexport const createTableBundle = (params: IBaseBundleParams): IBundle => {\n return new TableBundle(params);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAIA,SAASA,UAAU;AAEnB,OAAO,MAAMC,WAAW,SAASD,UAAU,CAAC;EACjCE,MAAMA,CAACC,IAAyB,EAAW;IAC9C,OAAO,IAAI,CAACC,MAAM,CAACC,IAAI,KAAKF,IAAI,CAACC,MAAM,CAACC,IAAI,IAAI,IAAI,CAACC,KAAK,CAACD,IAAI,KAAKF,IAAI,CAACG,KAAK,CAACD,IAAI;EACvF;AACJ;AAEA,OAAO,MAAME,iBAAiB,GAAIC,MAAyB,IAAc;EACrE,OAAO,IAAIP,WAAW,CAACO,MAAM,CAAC;AAClC,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IIngestorResultItem } from "
|
|
1
|
+
import type { IIngestorResultItem } from "../../../resolver/app/ingestor/types.js";
|
|
2
2
|
import type { CommandType } from "../../../types.js";
|
|
3
3
|
import type { ITable } from "../../../sync/types.js";
|
|
4
|
-
import type { IDeployment } from "
|
|
4
|
+
import type { IDeployment } from "../../../resolver/deployment/types.js";
|
|
5
5
|
export interface IBundleItem {
|
|
6
6
|
PK: string;
|
|
7
7
|
SK: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IStoreItem, IStorer } from "../storer/types";
|
|
2
|
-
import type { IDeployment } from "
|
|
1
|
+
import type { IStoreItem, IStorer } from "../storer/types.js";
|
|
2
|
+
import type { IDeployment } from "../../../resolver/deployment/types.js";
|
|
3
3
|
import type { ITable } from "../../../sync/types.js";
|
|
4
|
-
import type { IBundle } from "
|
|
4
|
+
import type { IBundle } from "../../../resolver/app/bundler/types.js";
|
|
5
5
|
export interface IDeleteCommandHandlerHandleParams {
|
|
6
6
|
targetDeployment: IDeployment;
|
|
7
7
|
targetTable: ITable;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DeleteCommandHandler = void 0;
|
|
7
|
-
class DeleteCommandHandler {
|
|
1
|
+
export class DeleteCommandHandler {
|
|
8
2
|
constructor(params) {
|
|
9
3
|
this.storer = params.storer;
|
|
10
4
|
}
|
|
@@ -34,6 +28,5 @@ class DeleteCommandHandler {
|
|
|
34
28
|
});
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
|
-
exports.DeleteCommandHandler = DeleteCommandHandler;
|
|
38
31
|
|
|
39
32
|
//# sourceMappingURL=DeleteCommandHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeleteCommandHandler","constructor","params","storer","handle","targetDeployment","targetTable","bundle","result","items","map","item","PK","SK","filter","store","command","deployment","table"
|
|
1
|
+
{"version":3,"names":["DeleteCommandHandler","constructor","params","storer","handle","targetDeployment","targetTable","bundle","result","items","map","item","PK","SK","filter","store","command","deployment","table"],"sources":["DeleteCommandHandler.ts"],"sourcesContent":["import type { IStoreItem, IStorer } from \"../storer/types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { IBundle } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IDeleteCommandHandlerHandleParams {\n targetDeployment: IDeployment;\n targetTable: ITable;\n items: IStoreItem[];\n bundle: IBundle;\n}\n\nexport interface IDeleteCommandHandlerParams {\n storer: IStorer;\n}\n\nexport class DeleteCommandHandler {\n private readonly storer: IStorer;\n\n public constructor(params: IDeleteCommandHandlerParams) {\n this.storer = params.storer;\n }\n public async handle(params: IDeleteCommandHandlerHandleParams): Promise<void> {\n const { targetDeployment, targetTable, bundle } = params;\n const result = bundle.items\n .map(item => {\n if (!item.PK || !item.SK) {\n return null;\n }\n return {\n PK: item.PK,\n SK: item.SK\n };\n })\n .filter((item): item is IStoreItem => {\n return !!item;\n });\n\n await this.storer.store({\n command: \"delete\",\n deployment: targetDeployment,\n table: targetTable,\n items: result,\n bundle\n });\n }\n}\n"],"mappings":"AAgBA,OAAO,MAAMA,oBAAoB,CAAC;EAGvBC,WAAWA,CAACC,MAAmC,EAAE;IACpD,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EACA,MAAaC,MAAMA,CAACF,MAAyC,EAAiB;IAC1E,MAAM;MAAEG,gBAAgB;MAAEC,WAAW;MAAEC;IAAO,CAAC,GAAGL,MAAM;IACxD,MAAMM,MAAM,GAAGD,MAAM,CAACE,KAAK,CACtBC,GAAG,CAACC,IAAI,IAAI;MACT,IAAI,CAACA,IAAI,CAACC,EAAE,IAAI,CAACD,IAAI,CAACE,EAAE,EAAE;QACtB,OAAO,IAAI;MACf;MACA,OAAO;QACHD,EAAE,EAAED,IAAI,CAACC,EAAE;QACXC,EAAE,EAAEF,IAAI,CAACE;MACb,CAAC;IACL,CAAC,CAAC,CACDC,MAAM,CAAEH,IAAI,IAAyB;MAClC,OAAO,CAAC,CAACA,IAAI;IACjB,CAAC,CAAC;IAEN,MAAM,IAAI,CAACR,MAAM,CAACY,KAAK,CAAC;MACpBC,OAAO,EAAE,QAAQ;MACjBC,UAAU,EAAEZ,gBAAgB;MAC5Ba,KAAK,EAAEZ,WAAW;MAClBG,KAAK,EAAED,MAAM;MACbD;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IStoreItem, IStorer } from "../storer/types";
|
|
2
|
-
import type { ITable } from "../../../sync/types";
|
|
3
|
-
import type { IDeployment } from "
|
|
4
|
-
import type { IBundle } from "
|
|
1
|
+
import type { IStoreItem, IStorer } from "../storer/types.js";
|
|
2
|
+
import type { ITable } from "../../../sync/types.js";
|
|
3
|
+
import type { IDeployment } from "../../../resolver/deployment/types.js";
|
|
4
|
+
import type { IBundle } from "../../../resolver/app/bundler/types.js";
|
|
5
5
|
export interface IPutCommandHandlerHandleParams {
|
|
6
6
|
items: IStoreItem[];
|
|
7
7
|
bundle: IBundle;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PutCommandHandler = void 0;
|
|
7
|
-
class PutCommandHandler {
|
|
1
|
+
export class PutCommandHandler {
|
|
8
2
|
constructor(params) {
|
|
9
3
|
this.storer = params.storer;
|
|
10
4
|
}
|
|
@@ -27,6 +21,5 @@ class PutCommandHandler {
|
|
|
27
21
|
});
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
|
-
exports.PutCommandHandler = PutCommandHandler;
|
|
31
24
|
|
|
32
25
|
//# sourceMappingURL=PutCommandHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PutCommandHandler","constructor","params","storer","handle","items","targetDeployment","targetTable","bundle","result","filter","item","PK","SK","store","command","deployment","table"
|
|
1
|
+
{"version":3,"names":["PutCommandHandler","constructor","params","storer","handle","items","targetDeployment","targetTable","bundle","result","filter","item","PK","SK","store","command","deployment","table"],"sources":["PutCommandHandler.ts"],"sourcesContent":["import type { IStoreItem, IStorer } from \"../storer/types.js\";\nimport type { ITable } from \"~/sync/types.js\";\nimport type { IDeployment } from \"~/resolver/deployment/types.js\";\nimport type { IBundle } from \"~/resolver/app/bundler/types.js\";\n\nexport interface IPutCommandHandlerHandleParams {\n items: IStoreItem[];\n bundle: IBundle;\n targetDeployment: IDeployment;\n targetTable: ITable;\n}\n\nexport interface IPutCommandHandlerParams {\n storer: IStorer;\n}\n\nexport class PutCommandHandler {\n private readonly storer: IStorer;\n\n public constructor(params: IPutCommandHandlerParams) {\n this.storer = params.storer;\n }\n\n public async handle(params: IPutCommandHandlerHandleParams): Promise<void> {\n const { items, targetDeployment, targetTable, bundle } = params;\n\n const result = items.filter(item => {\n return !!item.PK && !!item.SK;\n });\n\n await this.storer.store({\n command: \"put\",\n deployment: targetDeployment,\n table: targetTable,\n items: result,\n bundle\n });\n }\n}\n"],"mappings":"AAgBA,OAAO,MAAMA,iBAAiB,CAAC;EAGpBC,WAAWA,CAACC,MAAgC,EAAE;IACjD,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;EAC/B;EAEA,MAAaC,MAAMA,CAACF,MAAsC,EAAiB;IACvE,MAAM;MAAEG,KAAK;MAAEC,gBAAgB;MAAEC,WAAW;MAAEC;IAAO,CAAC,GAAGN,MAAM;IAE/D,MAAMO,MAAM,GAAGJ,KAAK,CAACK,MAAM,CAACC,IAAI,IAAI;MAChC,OAAO,CAAC,CAACA,IAAI,CAACC,EAAE,IAAI,CAAC,CAACD,IAAI,CAACE,EAAE;IACjC,CAAC,CAAC;IAEF,MAAM,IAAI,CAACV,MAAM,CAACW,KAAK,CAAC;MACpBC,OAAO,EAAE,KAAK;MACdC,UAAU,EAAEV,gBAAgB;MAC5BW,KAAK,EAAEV,WAAW;MAClBF,KAAK,EAAEI,MAAM;MACbD;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CommandHandlerPlugin } from "
|
|
1
|
+
import { CommandHandlerPlugin } from "../../../resolver/plugins/CommandHandlerPlugin.js";
|
|
2
2
|
export declare const createDeleteCommandHandlerPlugin: () => CommandHandlerPlugin;
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.createDeleteCommandHandlerPlugin = void 0;
|
|
7
|
-
var _CommandHandlerPlugin = require("../../plugins/CommandHandlerPlugin.js");
|
|
8
|
-
var _DeleteCommandHandler = require("./DeleteCommandHandler");
|
|
9
|
-
const createDeleteCommandHandlerPlugin = () => {
|
|
10
|
-
const plugin = (0, _CommandHandlerPlugin.createCommandHandlerPlugin)({
|
|
1
|
+
import { CommandHandlerPlugin, createCommandHandlerPlugin } from "../../plugins/CommandHandlerPlugin.js";
|
|
2
|
+
import { DeleteCommandHandler } from "./DeleteCommandHandler.js";
|
|
3
|
+
export const createDeleteCommandHandlerPlugin = () => {
|
|
4
|
+
const plugin = createCommandHandlerPlugin({
|
|
11
5
|
canHandle: command => {
|
|
12
6
|
return command === "delete";
|
|
13
7
|
},
|
|
14
8
|
handle: async params => {
|
|
15
|
-
const handler = new
|
|
9
|
+
const handler = new DeleteCommandHandler(params);
|
|
16
10
|
return handler.handle(params);
|
|
17
11
|
}
|
|
18
12
|
});
|
|
19
|
-
plugin.name = `${
|
|
13
|
+
plugin.name = `${CommandHandlerPlugin.type}.delete`;
|
|
20
14
|
return plugin;
|
|
21
15
|
};
|
|
22
|
-
exports.createDeleteCommandHandlerPlugin = createDeleteCommandHandlerPlugin;
|
|
23
16
|
|
|
24
17
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["CommandHandlerPlugin","createCommandHandlerPlugin","DeleteCommandHandler","createDeleteCommandHandlerPlugin","plugin","canHandle","command","handle","params","handler","name","type"],"sources":["delete.ts"],"sourcesContent":["import {\n CommandHandlerPlugin,\n createCommandHandlerPlugin\n} from \"~/resolver/plugins/CommandHandlerPlugin.js\";\nimport { DeleteCommandHandler } from \"./DeleteCommandHandler.js\";\n\nexport const createDeleteCommandHandlerPlugin = () => {\n const plugin = createCommandHandlerPlugin({\n canHandle: command => {\n return command === \"delete\";\n },\n handle: async params => {\n const handler = new DeleteCommandHandler(params);\n\n return handler.handle(params);\n }\n });\n\n plugin.name = `${CommandHandlerPlugin.type}.delete`;\n\n return plugin;\n};\n"],"mappings":"AAAA,SACIA,oBAAoB,EACpBC,0BAA0B;AAE9B,SAASC,oBAAoB;AAE7B,OAAO,MAAMC,gCAAgC,GAAGA,CAAA,KAAM;EAClD,MAAMC,MAAM,GAAGH,0BAA0B,CAAC;IACtCI,SAAS,EAAEC,OAAO,IAAI;MAClB,OAAOA,OAAO,KAAK,QAAQ;IAC/B,CAAC;IACDC,MAAM,EAAE,MAAMC,MAAM,IAAI;MACpB,MAAMC,OAAO,GAAG,IAAIP,oBAAoB,CAACM,MAAM,CAAC;MAEhD,OAAOC,OAAO,CAACF,MAAM,CAACC,MAAM,CAAC;IACjC;EACJ,CAAC,CAAC;EAEFJ,MAAM,CAACM,IAAI,GAAG,GAAGV,oBAAoB,CAACW,IAAI,SAAS;EAEnD,OAAOP,MAAM;AACjB,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CommandHandlerPlugin } from "
|
|
1
|
+
import { CommandHandlerPlugin } from "../../../resolver/plugins/CommandHandlerPlugin.js";
|
|
2
2
|
export declare const createPutCommandHandlerPlugin: () => CommandHandlerPlugin;
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.createPutCommandHandlerPlugin = void 0;
|
|
7
|
-
var _CommandHandlerPlugin = require("../../plugins/CommandHandlerPlugin.js");
|
|
8
|
-
var _PutCommandHandler = require("./PutCommandHandler");
|
|
9
|
-
const createPutCommandHandlerPlugin = () => {
|
|
10
|
-
const plugin = (0, _CommandHandlerPlugin.createCommandHandlerPlugin)({
|
|
1
|
+
import { CommandHandlerPlugin, createCommandHandlerPlugin } from "../../plugins/CommandHandlerPlugin.js";
|
|
2
|
+
import { PutCommandHandler } from "./PutCommandHandler.js";
|
|
3
|
+
export const createPutCommandHandlerPlugin = () => {
|
|
4
|
+
const plugin = createCommandHandlerPlugin({
|
|
11
5
|
canHandle: command => {
|
|
12
6
|
return command === "put";
|
|
13
7
|
},
|
|
14
8
|
handle: async params => {
|
|
15
|
-
const handler = new
|
|
9
|
+
const handler = new PutCommandHandler(params);
|
|
16
10
|
return handler.handle(params);
|
|
17
11
|
}
|
|
18
12
|
});
|
|
19
|
-
plugin.name = `${
|
|
13
|
+
plugin.name = `${CommandHandlerPlugin.type}.put`;
|
|
20
14
|
return plugin;
|
|
21
15
|
};
|
|
22
|
-
exports.createPutCommandHandlerPlugin = createPutCommandHandlerPlugin;
|
|
23
16
|
|
|
24
17
|
//# sourceMappingURL=put.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["CommandHandlerPlugin","createCommandHandlerPlugin","PutCommandHandler","createPutCommandHandlerPlugin","plugin","canHandle","command","handle","params","handler","name","type"],"sources":["put.ts"],"sourcesContent":["import {\n CommandHandlerPlugin,\n createCommandHandlerPlugin\n} from \"~/resolver/plugins/CommandHandlerPlugin.js\";\nimport { PutCommandHandler } from \"./PutCommandHandler.js\";\n\nexport const createPutCommandHandlerPlugin = () => {\n const plugin = createCommandHandlerPlugin({\n canHandle: command => {\n return command === \"put\";\n },\n handle: async params => {\n const handler = new PutCommandHandler(params);\n\n return handler.handle(params);\n }\n });\n\n plugin.name = `${CommandHandlerPlugin.type}.put`;\n\n return plugin;\n};\n"],"mappings":"AAAA,SACIA,oBAAoB,EACpBC,0BAA0B;AAE9B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,6BAA6B,GAAGA,CAAA,KAAM;EAC/C,MAAMC,MAAM,GAAGH,0BAA0B,CAAC;IACtCI,SAAS,EAAEC,OAAO,IAAI;MAClB,OAAOA,OAAO,KAAK,KAAK;IAC5B,CAAC;IACDC,MAAM,EAAE,MAAMC,MAAM,IAAI;MACpB,MAAMC,OAAO,GAAG,IAAIP,iBAAiB,CAACM,MAAM,CAAC;MAE7C,OAAOC,OAAO,CAACF,MAAM,CAACC,MAAM,CAAC;IACjC;EACJ,CAAC,CAAC;EAEFJ,MAAM,CAACM,IAAI,GAAG,GAAGV,oBAAoB,CAACW,IAAI,MAAM;EAEhD,OAAOP,MAAM;AACjB,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { GenericRecord } from "@webiny/api/types";
|
|
2
|
-
import type { IInputItem, IItem, ISourceDataContainer } from "
|
|
3
|
-
import type { IStoreItem } from "
|
|
1
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
2
|
+
import type { IInputItem, IItem, ISourceDataContainer } from "../../../resolver/app/data/types.js";
|
|
3
|
+
import type { IStoreItem } from "../../../resolver/app/storer/types.js";
|
|
4
4
|
export declare class SourceDataContainer implements ISourceDataContainer {
|
|
5
5
|
readonly items: GenericRecord<string, IItem>;
|
|
6
6
|
private constructor();
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SourceDataContainer = void 0;
|
|
7
|
-
class SourceDataContainer {
|
|
1
|
+
export class SourceDataContainer {
|
|
8
2
|
items = {};
|
|
9
3
|
constructor() {
|
|
10
4
|
// block
|
|
@@ -37,6 +31,5 @@ class SourceDataContainer {
|
|
|
37
31
|
return `${item.source.name}#${item.table.name}#${item.PK}#${item.SK}`;
|
|
38
32
|
}
|
|
39
33
|
}
|
|
40
|
-
exports.SourceDataContainer = SourceDataContainer;
|
|
41
34
|
|
|
42
35
|
//# sourceMappingURL=SourceDataContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SourceDataContainer","items","constructor","create","get","input","key","createKey","item","data","add","merge","container","source","name","table","PK","SK"
|
|
1
|
+
{"version":3,"names":["SourceDataContainer","items","constructor","create","get","input","key","createKey","item","data","add","merge","container","source","name","table","PK","SK"],"sources":["SourceDataContainer.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { IInputItem, IItem, ISourceDataContainer } from \"~/resolver/app/data/types.js\";\nimport type { IStoreItem } from \"~/resolver/app/storer/types.js\";\n\nexport class SourceDataContainer implements ISourceDataContainer {\n public readonly items: GenericRecord<string, IItem> = {};\n\n private constructor() {\n // block\n }\n\n public static create(): ISourceDataContainer {\n return new SourceDataContainer();\n }\n\n public get(input: IInputItem): IStoreItem | null {\n const key = this.createKey(input);\n const item = this.items[key];\n return item?.data || null;\n }\n\n public add(item: IInputItem, data: IStoreItem | null): void {\n const key = this.createKey(item);\n if (this.items[key]) {\n return;\n }\n\n this.items[key] = {\n ...item,\n data\n };\n }\n\n public merge(container: ISourceDataContainer): void {\n for (const key in container.items) {\n const item = container.items[key];\n this.add(item, item.data);\n }\n }\n\n private createKey(item: IInputItem): string {\n return `${item.source.name}#${item.table.name}#${item.PK}#${item.SK}`;\n }\n}\n"],"mappings":"AAIA,OAAO,MAAMA,mBAAmB,CAAiC;EAC7CC,KAAK,GAAiC,CAAC,CAAC;EAEhDC,WAAWA,CAAA,EAAG;IAClB;EAAA;EAGJ,OAAcC,MAAMA,CAAA,EAAyB;IACzC,OAAO,IAAIH,mBAAmB,CAAC,CAAC;EACpC;EAEOI,GAAGA,CAACC,KAAiB,EAAqB;IAC7C,MAAMC,GAAG,GAAG,IAAI,CAACC,SAAS,CAACF,KAAK,CAAC;IACjC,MAAMG,IAAI,GAAG,IAAI,CAACP,KAAK,CAACK,GAAG,CAAC;IAC5B,OAAOE,IAAI,EAAEC,IAAI,IAAI,IAAI;EAC7B;EAEOC,GAAGA,CAACF,IAAgB,EAAEC,IAAuB,EAAQ;IACxD,MAAMH,GAAG,GAAG,IAAI,CAACC,SAAS,CAACC,IAAI,CAAC;IAChC,IAAI,IAAI,CAACP,KAAK,CAACK,GAAG,CAAC,EAAE;MACjB;IACJ;IAEA,IAAI,CAACL,KAAK,CAACK,GAAG,CAAC,GAAG;MACd,GAAGE,IAAI;MACPC;IACJ,CAAC;EACL;EAEOE,KAAKA,CAACC,SAA+B,EAAQ;IAChD,KAAK,MAAMN,GAAG,IAAIM,SAAS,CAACX,KAAK,EAAE;MAC/B,MAAMO,IAAI,GAAGI,SAAS,CAACX,KAAK,CAACK,GAAG,CAAC;MACjC,IAAI,CAACI,GAAG,CAACF,IAAI,EAAEA,IAAI,CAACC,IAAI,CAAC;IAC7B;EACJ;EAEQF,SAASA,CAACC,IAAgB,EAAU;IACxC,OAAO,GAAGA,IAAI,CAACK,MAAM,CAACC,IAAI,IAAIN,IAAI,CAACO,KAAK,CAACD,IAAI,IAAIN,IAAI,CAACQ,EAAE,IAAIR,IAAI,CAACS,EAAE,EAAE;EACzE;AACJ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ITable } from "../../../sync/types.js";
|
|
2
|
-
import type { IDeployment } from "
|
|
2
|
+
import type { IDeployment } from "../../../resolver/deployment/types.js";
|
|
3
3
|
import type { GenericRecord } from "@webiny/api/types.js";
|
|
4
|
-
import type { IStoreItem } from "
|
|
4
|
+
import type { IStoreItem } from "../../../resolver/app/storer/types.js";
|
|
5
5
|
export interface IInputItem {
|
|
6
6
|
PK: string;
|
|
7
7
|
SK: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IFetcher, IFetcherExecParams, IFetcherExecResult } from "./types";
|
|
2
|
-
import {
|
|
3
|
-
import type { IDeployment } from "
|
|
1
|
+
import type { IFetcher, IFetcherExecParams, IFetcherExecResult } from "./types.js";
|
|
2
|
+
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
3
|
+
import type { IDeployment } from "../../../resolver/deployment/types.js";
|
|
4
4
|
export interface IFetcherParamsCreateDocumentClientCallable {
|
|
5
5
|
(deployment: Pick<IDeployment, "region">): Pick<DynamoDBDocument, "send">;
|
|
6
6
|
}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.createFetcher = exports.Fetcher = void 0;
|
|
8
|
-
var _clientDynamodb = require("@webiny/aws-sdk/client-dynamodb");
|
|
9
|
-
var _chunk = _interopRequireDefault(require("lodash/chunk"));
|
|
10
|
-
var _SourceDataContainer = require("../data/SourceDataContainer.js");
|
|
11
|
-
var _utils = require("@webiny/utils");
|
|
12
|
-
var _Retry = require("../utils/Retry.js");
|
|
13
|
-
class Fetcher {
|
|
1
|
+
import { BatchGetCommand } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
|
+
import lodashChunk from "lodash/chunk.js";
|
|
3
|
+
import { SourceDataContainer } from "../data/SourceDataContainer.js";
|
|
4
|
+
import { convertException } from "@webiny/utils";
|
|
5
|
+
import { createRetry } from "../utils/Retry.js";
|
|
6
|
+
export class Fetcher {
|
|
14
7
|
constructor(params) {
|
|
15
8
|
this.createDocumentClient = params.createDocumentClient;
|
|
16
9
|
this.maxRetries = params.maxRetries || 10;
|
|
@@ -25,7 +18,7 @@ class Fetcher {
|
|
|
25
18
|
} = params;
|
|
26
19
|
if (input.length === 0) {
|
|
27
20
|
return {
|
|
28
|
-
items:
|
|
21
|
+
items: SourceDataContainer.create()
|
|
29
22
|
};
|
|
30
23
|
}
|
|
31
24
|
const client = this.createDocumentClient(deployment);
|
|
@@ -35,7 +28,7 @@ class Fetcher {
|
|
|
35
28
|
maxBatchSize,
|
|
36
29
|
records: input
|
|
37
30
|
});
|
|
38
|
-
const items =
|
|
31
|
+
const items = SourceDataContainer.create();
|
|
39
32
|
for (const item of input) {
|
|
40
33
|
const data = results.find(result => {
|
|
41
34
|
return item.PK === result.PK && item.SK === result.SK;
|
|
@@ -58,12 +51,12 @@ class Fetcher {
|
|
|
58
51
|
records: items,
|
|
59
52
|
maxBatchSize
|
|
60
53
|
} = params;
|
|
61
|
-
const batches = (
|
|
54
|
+
const batches = lodashChunk(items, maxBatchSize);
|
|
62
55
|
const results = [];
|
|
63
56
|
for (const batch of batches) {
|
|
64
57
|
let keys = this.getKeys(batch);
|
|
65
58
|
while (keys.length > 0) {
|
|
66
|
-
const command = new
|
|
59
|
+
const command = new BatchGetCommand({
|
|
67
60
|
RequestItems: {
|
|
68
61
|
[table.name]: {
|
|
69
62
|
Keys: keys
|
|
@@ -90,7 +83,7 @@ class Fetcher {
|
|
|
90
83
|
table,
|
|
91
84
|
client
|
|
92
85
|
} = params;
|
|
93
|
-
const retry =
|
|
86
|
+
const retry = createRetry({
|
|
94
87
|
maxRetries: this.maxRetries,
|
|
95
88
|
retryDelay: this.retryDelay
|
|
96
89
|
});
|
|
@@ -103,7 +96,7 @@ class Fetcher {
|
|
|
103
96
|
}, {
|
|
104
97
|
onFail: ex => {
|
|
105
98
|
console.error(`Max retries reached. Could not fetch items from table: ${table}`);
|
|
106
|
-
console.log(
|
|
99
|
+
console.log(convertException(ex));
|
|
107
100
|
console.log(JSON.stringify(command));
|
|
108
101
|
}
|
|
109
102
|
});
|
|
@@ -123,10 +116,8 @@ class Fetcher {
|
|
|
123
116
|
return Array.from(keys.values());
|
|
124
117
|
}
|
|
125
118
|
}
|
|
126
|
-
|
|
127
|
-
const createFetcher = params => {
|
|
119
|
+
export const createFetcher = params => {
|
|
128
120
|
return new Fetcher(params);
|
|
129
121
|
};
|
|
130
|
-
exports.createFetcher = createFetcher;
|
|
131
122
|
|
|
132
123
|
//# sourceMappingURL=Fetcher.js.map
|