@webiny/api-sync-system 0.0.0-unstable.e6f0dc8ca7 → 0.0.0-unstable.e9333b3f0b
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/constants.js +2 -1
- package/constants.js.map +1 -1
- package/index.d.ts +11 -3
- package/index.js +8 -5
- package/package.json +23 -18
- package/resolver/SyncResolverConfig.d.ts +17 -0
- package/resolver/SyncResolverConfig.js +5 -0
- package/resolver/SyncResolverConfig.js.map +1 -0
- package/resolver/SyncResolverLambdaHandler.d.ts +14 -0
- package/resolver/SyncResolverLambdaHandler.js +159 -0
- package/resolver/SyncResolverLambdaHandler.js.map +1 -0
- package/resolver/app/RecordHandler.js +83 -105
- package/resolver/app/RecordHandler.js.map +1 -1
- package/resolver/app/RecordsValidation.js +11 -14
- package/resolver/app/RecordsValidation.js.map +1 -1
- package/resolver/app/ResolverApplication.js +24 -31
- package/resolver/app/ResolverApplication.js.map +1 -1
- package/resolver/app/abstractions/RecordHandler.js +0 -3
- package/resolver/app/abstractions/RecordsValidation.js +0 -3
- package/resolver/app/abstractions/ResolverApplication.js +0 -3
- package/resolver/app/abstractions/ResolverRecord.js +0 -3
- package/resolver/app/bundler/BaseBundle.js +17 -16
- package/resolver/app/bundler/BaseBundle.js.map +1 -1
- package/resolver/app/bundler/Bundler.js +13 -18
- package/resolver/app/bundler/Bundler.js.map +1 -1
- package/resolver/app/bundler/Bundles.js +21 -26
- package/resolver/app/bundler/Bundles.js.map +1 -1
- package/resolver/app/bundler/CommandBundle.js +7 -16
- package/resolver/app/bundler/CommandBundle.js.map +1 -1
- package/resolver/app/bundler/TableBundle.js +6 -13
- package/resolver/app/bundler/TableBundle.js.map +1 -1
- package/resolver/app/bundler/types.js +0 -3
- package/resolver/app/commandHandler/DeleteCommandHandler.js +22 -29
- package/resolver/app/commandHandler/DeleteCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/PutCommandHandler.js +16 -22
- package/resolver/app/commandHandler/PutCommandHandler.js.map +1 -1
- package/resolver/app/commandHandler/delete.js +11 -12
- package/resolver/app/commandHandler/delete.js.map +1 -1
- package/resolver/app/commandHandler/put.js +11 -12
- package/resolver/app/commandHandler/put.js.map +1 -1
- package/resolver/app/data/SourceDataContainer.js +28 -30
- package/resolver/app/data/SourceDataContainer.js.map +1 -1
- package/resolver/app/data/types.js +0 -3
- package/resolver/app/fetcher/Fetcher.js +84 -109
- package/resolver/app/fetcher/Fetcher.js.map +1 -1
- package/resolver/app/fetcher/types.js +0 -3
- package/resolver/app/ingestor/Ingestor.js +27 -32
- package/resolver/app/ingestor/Ingestor.js.map +1 -1
- package/resolver/app/ingestor/IngestorResult.js +28 -32
- package/resolver/app/ingestor/IngestorResult.js.map +1 -1
- package/resolver/app/ingestor/types.js +0 -3
- package/resolver/app/storer/Storer.js +71 -85
- package/resolver/app/storer/Storer.js.map +1 -1
- package/resolver/app/storer/types.js +0 -3
- package/resolver/app/transform/TransformHandler.js +45 -56
- package/resolver/app/transform/TransformHandler.js.map +1 -1
- package/resolver/app/transform/middleware.js +13 -20
- package/resolver/app/transform/middleware.js.map +1 -1
- package/resolver/app/utils/Retry.js +21 -24
- package/resolver/app/utils/Retry.js.map +1 -1
- package/resolver/app/utils/sleep.js +4 -5
- package/resolver/app/utils/sleep.js.map +1 -1
- package/resolver/app/validation/body.d.ts +5 -5
- package/resolver/app/validation/body.js +26 -31
- package/resolver/app/validation/body.js.map +1 -1
- package/resolver/app/validation/createJsonTransform.js +12 -13
- package/resolver/app/validation/createJsonTransform.js.map +1 -1
- package/resolver/app/validation/detail.d.ts +5 -5
- package/resolver/app/validation/detail.js +30 -35
- package/resolver/app/validation/detail.js.map +1 -1
- package/resolver/app/validation/event.d.ts +5 -5
- package/resolver/app/validation/event.js +17 -18
- package/resolver/app/validation/event.js.map +1 -1
- package/resolver/app/validation/numericString.js +8 -11
- package/resolver/app/validation/numericString.js.map +1 -1
- package/resolver/app/validation/system.js +8 -9
- package/resolver/app/validation/system.js.map +1 -1
- package/resolver/deployment/Deployment.js +28 -31
- package/resolver/deployment/Deployment.js.map +1 -1
- package/resolver/deployment/Deployments.js +20 -23
- package/resolver/deployment/Deployments.js.map +1 -1
- package/resolver/deployment/DeploymentsFetcher.js +75 -84
- package/resolver/deployment/DeploymentsFetcher.js.map +1 -1
- package/resolver/deployment/types.js +0 -3
- package/resolver/lambda/LambdaTrigger.js +24 -26
- package/resolver/lambda/LambdaTrigger.js.map +1 -1
- package/resolver/plugins/CommandHandlerPlugin.js +16 -15
- package/resolver/plugins/CommandHandlerPlugin.js.map +1 -1
- package/resolver/plugins/StorerAfterEachPlugin.js +20 -19
- package/resolver/plugins/StorerAfterEachPlugin.js.map +1 -1
- package/resolver/plugins/TransformRecordPlugin.js +19 -18
- package/resolver/plugins/TransformRecordPlugin.js.map +1 -1
- package/resolver/recordTypes/fileManager/CopyFile.js +44 -67
- package/resolver/recordTypes/fileManager/CopyFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/DeleteFile.js +40 -58
- package/resolver/recordTypes/fileManager/DeleteFile.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManager.js +5 -3
- package/resolver/recordTypes/fileManager/fileManager.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js +24 -35
- package/resolver/recordTypes/fileManager/fileManagerOnDelete.js.map +1 -1
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js +24 -35
- package/resolver/recordTypes/fileManager/fileManagerOnPut.js.map +1 -1
- package/resolver/recordTypes/fileManager/shouldBeHandled.js +10 -27
- package/resolver/recordTypes/fileManager/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/fileManager/types.js +0 -3
- package/resolver/recordTypes/users/CopyUser.js +44 -54
- package/resolver/recordTypes/users/CopyUser.js.map +1 -1
- package/resolver/recordTypes/users/DeleteUser.js +40 -51
- package/resolver/recordTypes/users/DeleteUser.js.map +1 -1
- package/resolver/recordTypes/users/shouldBeHandled.js +10 -26
- package/resolver/recordTypes/users/shouldBeHandled.js.map +1 -1
- package/resolver/recordTypes/users/types.js +0 -3
- package/resolver/recordTypes/users/users.js +5 -3
- package/resolver/recordTypes/users/users.js.map +1 -1
- package/resolver/recordTypes/users/usersOnDelete.js +23 -34
- package/resolver/recordTypes/users/usersOnDelete.js.map +1 -1
- package/resolver/recordTypes/users/usersOnPut.js +24 -35
- package/resolver/recordTypes/users/usersOnPut.js.map +1 -1
- package/sync/ApiGatewaySyncDecorator.d.ts +14 -0
- package/sync/ApiGatewaySyncDecorator.js +49 -0
- package/sync/ApiGatewaySyncDecorator.js.map +1 -0
- package/sync/FilterOutRecord.js +9 -17
- package/sync/FilterOutRecord.js.map +1 -1
- package/sync/SyncSystemConfig.d.ts +11 -0
- package/sync/SyncSystemConfig.js +5 -0
- package/sync/SyncSystemConfig.js.map +1 -0
- package/sync/attachToDynamoDbDocument.js +46 -65
- package/sync/attachToDynamoDbDocument.js.map +1 -1
- package/sync/createHandler.js +31 -40
- package/sync/createHandler.js.map +1 -1
- package/sync/filter/createDefaultFilterOutRecordPlugins.js +37 -76
- package/sync/filter/createDefaultFilterOutRecordPlugins.js.map +1 -1
- package/sync/handler/Handler.js +64 -76
- package/sync/handler/Handler.js.map +1 -1
- package/sync/handler/HandlerConverter.js +21 -29
- package/sync/handler/HandlerConverter.js.map +1 -1
- package/sync/handler/converter/BatchGetCommandConverter.js +12 -11
- package/sync/handler/converter/BatchGetCommandConverter.js.map +1 -1
- package/sync/handler/converter/BatchWriteCommandConverter.js +12 -11
- package/sync/handler/converter/BatchWriteCommandConverter.js.map +1 -1
- package/sync/handler/converter/DeleteCommandConverter.js +12 -11
- package/sync/handler/converter/DeleteCommandConverter.js.map +1 -1
- package/sync/handler/converter/GetCommandConverter.js +12 -11
- package/sync/handler/converter/GetCommandConverter.js.map +1 -1
- package/sync/handler/converter/PutCommandConverter.js +12 -11
- package/sync/handler/converter/PutCommandConverter.js.map +1 -1
- package/sync/handler/converter/QueryCommandConverter.js +12 -11
- package/sync/handler/converter/QueryCommandConverter.js.map +1 -1
- package/sync/handler/converter/ScanCommandConverter.js +12 -11
- package/sync/handler/converter/ScanCommandConverter.js.map +1 -1
- package/sync/handler/converter/UpdateCommandConverter.js +12 -11
- package/sync/handler/converter/UpdateCommandConverter.js.map +1 -1
- package/sync/handler/converter/commands/BatchWriteCommandValue.js +34 -37
- package/sync/handler/converter/commands/BatchWriteCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/DeleteCommandValue.js +19 -16
- package/sync/handler/converter/commands/DeleteCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/NullCommandValue.js +8 -8
- package/sync/handler/converter/commands/NullCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/PutCommandValue.js +19 -16
- package/sync/handler/converter/commands/PutCommandValue.js.map +1 -1
- package/sync/handler/converter/commands/UpdateCommandValue.js +19 -16
- package/sync/handler/converter/commands/UpdateCommandValue.js.map +1 -1
- package/sync/handler/types.js +0 -3
- package/sync/plugins/FilterOutRecordPlugin.js +17 -19
- package/sync/plugins/FilterOutRecordPlugin.js.map +1 -1
- package/sync/types.js +0 -3
- package/sync/utils/getTableType.js +10 -9
- package/sync/utils/getTableType.js.map +1 -1
- package/sync/utils/manifest.d.ts +2 -6
- package/sync/utils/manifest.js +27 -36
- package/sync/utils/manifest.js.map +1 -1
- package/sync/utils/validateSystemInput.js +21 -29
- package/sync/utils/validateSystemInput.js.map +1 -1
- package/types.d.ts +0 -2
- package/types.js +6 -5
- package/types.js.map +1 -1
- package/utils/createSystemName.js +5 -3
- package/utils/createSystemName.js.map +1 -1
- package/worker/SyncWorkerConfig.d.ts +9 -0
- package/worker/SyncWorkerConfig.js +5 -0
- package/worker/SyncWorkerConfig.js.map +1 -0
- package/worker/SyncWorkerEventHandler.d.ts +14 -0
- package/worker/SyncWorkerEventHandler.js +5 -0
- package/worker/SyncWorkerEventHandler.js.map +1 -0
- package/worker/SyncWorkerEventType.d.ts +10 -0
- package/worker/SyncWorkerEventType.js +24 -0
- package/worker/SyncWorkerEventType.js.map +1 -0
- package/worker/SyncWorkerLambdaHandler.d.ts +13 -0
- package/worker/SyncWorkerLambdaHandler.js +61 -0
- package/worker/SyncWorkerLambdaHandler.js.map +1 -0
- package/worker/actions/copyFile/CopyFile.js +183 -258
- package/worker/actions/copyFile/CopyFile.js.map +1 -1
- package/worker/actions/copyFile/copyFileAction.js +26 -34
- package/worker/actions/copyFile/copyFileAction.js.map +1 -1
- package/worker/actions/copyFile/copyFileSchema.js +13 -14
- package/worker/actions/copyFile/copyFileSchema.js.map +1 -1
- package/worker/actions/copyFile/types.js +0 -3
- package/worker/actions/createUser/CreateUser.js +51 -74
- package/worker/actions/createUser/CreateUser.js.map +1 -1
- package/worker/actions/createUser/createUserAction.js +24 -28
- package/worker/actions/createUser/createUserAction.js.map +1 -1
- package/worker/actions/createUser/createUserSchema.js +13 -14
- package/worker/actions/createUser/createUserSchema.js.map +1 -1
- package/worker/actions/createUser/types.js +0 -3
- package/worker/actions/deleteFile/DeleteFile.js +52 -67
- package/worker/actions/deleteFile/DeleteFile.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileAction.js +21 -29
- package/worker/actions/deleteFile/deleteFileAction.js.map +1 -1
- package/worker/actions/deleteFile/deleteFileSchema.js +13 -14
- package/worker/actions/deleteFile/deleteFileSchema.js.map +1 -1
- package/worker/actions/deleteFile/types.js +0 -3
- package/worker/actions/deleteUser/DeleteUser.js +38 -52
- package/worker/actions/deleteUser/DeleteUser.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserAction.js +22 -26
- package/worker/actions/deleteUser/deleteUserAction.js.map +1 -1
- package/worker/actions/deleteUser/deleteUserSchema.js +12 -13
- package/worker/actions/deleteUser/deleteUserSchema.js.map +1 -1
- package/worker/actions/deleteUser/types.js +0 -3
- package/worker/actions/logValidationError.js +5 -6
- package/worker/actions/logValidationError.js.map +1 -1
- package/worker/actions/removeCognitoUserAttributes.js +9 -15
- package/worker/actions/removeCognitoUserAttributes.js.map +1 -1
- package/worker/actions/updateUser/UpdateUser.js +48 -65
- package/worker/actions/updateUser/UpdateUser.js.map +1 -1
- package/worker/actions/updateUser/types.js +0 -3
- package/worker/actions/updateUser/updateUserAction.js +24 -28
- package/worker/actions/updateUser/updateUserAction.js.map +1 -1
- package/worker/actions/updateUser/updateUserSchema.js +13 -14
- package/worker/actions/updateUser/updateUserSchema.js.map +1 -1
- package/worker/handler/WorkerActionHandler.js +19 -21
- package/worker/handler/WorkerActionHandler.js.map +1 -1
- package/worker/plugins/WorkerActionPlugin.js +17 -16
- package/worker/plugins/WorkerActionPlugin.js.map +1 -1
- package/worker/types.js +0 -3
- 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/createEventHandlerPlugin.d.ts +0 -11
- package/resolver/createEventHandlerPlugin.js +0 -120
- package/resolver/createEventHandlerPlugin.js.map +0 -1
- package/resolver/createResolverHandler.d.ts +0 -21
- package/resolver/createResolverHandler.js +0 -72
- package/resolver/createResolverHandler.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/createSendDataToEventBridgeOnRequestEnd.d.ts +0 -2
- package/sync/createSendDataToEventBridgeOnRequestEnd.js +0 -44
- package/sync/createSendDataToEventBridgeOnRequestEnd.js.map +0 -1
- package/sync/createSyncSystem.d.ts +0 -16
- package/sync/createSyncSystem.js +0 -35
- package/sync/createSyncSystem.js.map +0 -1
- package/sync/handler/types.js.map +0 -1
- package/sync/requestPlugin.d.ts +0 -9
- package/sync/requestPlugin.js +0 -58
- package/sync/requestPlugin.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/createWorkerHandler.d.ts +0 -11
- package/worker/createWorkerHandler.js +0 -41
- package/worker/createWorkerHandler.js.map +0 -1
- package/worker/handler/eventHandler.d.ts +0 -1
- package/worker/handler/eventHandler.js +0 -24
- package/worker/handler/eventHandler.js.map +0 -1
- package/worker/types.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/RecordsValidation.js","sources":["../../../src/resolver/app/RecordsValidation.ts"],"sourcesContent":["import type { SQSRecord } from \"@webiny/aws-sdk/types/index.js\";\nimport type {\n IRecordsValidation,\n IRecordsValidationResult\n} from \"./abstractions/RecordsValidation.js\";\nimport { createZodError } from \"@webiny/utils\";\nimport { createEventValidation } from \"~/resolver/app/validation/event.js\";\n\nconst validation = createEventValidation();\n\nexport class RecordsValidation implements IRecordsValidation {\n public async validate(records: SQSRecord[]): Promise<IRecordsValidationResult> {\n const result = await validation.safeParseAsync(records);\n if (result.error) {\n return {\n error: createZodError(result.error)\n };\n }\n return {\n records: result.data\n };\n }\n}\n\nexport const createRecordsValidation = (): IRecordsValidation => {\n return new RecordsValidation();\n};\n"],"names":["validation","createEventValidation","RecordsValidation","records","result","createZodError","createRecordsValidation"],"mappings":";;AAQA,MAAMA,aAAaC;AAEZ,MAAMC;IACT,MAAa,SAASC,OAAoB,EAAqC;QAC3E,MAAMC,SAAS,MAAMJ,WAAW,cAAc,CAACG;QAC/C,IAAIC,OAAO,KAAK,EACZ,OAAO;YACH,OAAOC,eAAeD,OAAO,KAAK;QACtC;QAEJ,OAAO;YACH,SAASA,OAAO,IAAI;QACxB;IACJ;AACJ;AAEO,MAAME,0BAA0B,IAC5B,IAAIJ"}
|
|
@@ -2,39 +2,32 @@ import { createRecordsValidation } from "./RecordsValidation.js";
|
|
|
2
2
|
import { convertException } from "@webiny/utils";
|
|
3
3
|
import { createIngestor } from "./ingestor/Ingestor.js";
|
|
4
4
|
import { createIngestorResult } from "./ingestor/IngestorResult.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
async resolve(params) {
|
|
11
|
-
const validation = createRecordsValidation();
|
|
12
|
-
const result = await validation.validate(params.records);
|
|
13
|
-
if (result.error) {
|
|
14
|
-
throw result.error;
|
|
5
|
+
class ResolverApplication {
|
|
6
|
+
constructor(params){
|
|
7
|
+
this.recordHandler = params.recordHandler;
|
|
8
|
+
this.deployments = params.deployments;
|
|
15
9
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
async resolve(params) {
|
|
11
|
+
const validation = createRecordsValidation();
|
|
12
|
+
const result = await validation.validate(params.records);
|
|
13
|
+
if (result.error) throw result.error;
|
|
14
|
+
const ingestor = createIngestor({
|
|
15
|
+
createIngestorResult: ()=>createIngestorResult(),
|
|
16
|
+
getSource: (name)=>this.deployments.get(name)
|
|
17
|
+
});
|
|
18
|
+
const data = await ingestor.ingest({
|
|
19
|
+
records: result.records
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
await this.recordHandler.handle({
|
|
23
|
+
data
|
|
24
|
+
});
|
|
25
|
+
} catch (ex) {
|
|
26
|
+
console.error(convertException(ex));
|
|
27
|
+
}
|
|
33
28
|
}
|
|
34
|
-
}
|
|
35
29
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
30
|
+
const createResolverApp = (params)=>new ResolverApplication(params);
|
|
31
|
+
export { ResolverApplication, createResolverApp };
|
|
39
32
|
|
|
40
33
|
//# sourceMappingURL=ResolverApplication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/ResolverApplication.js","sources":["../../../src/resolver/app/ResolverApplication.ts"],"sourcesContent":["import type {\n IResolverApplication,\n IResolverApplicationResolveParams\n} from \"./abstractions/ResolverApplication.js\";\nimport { createRecordsValidation } from \"./RecordsValidation.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { IRecordHandler } from \"./abstractions/RecordHandler.js\";\nimport type { IDeployments } from \"~/resolver/deployment/types.js\";\nimport { createIngestor } from \"./ingestor/Ingestor.js\";\nimport { createIngestorResult } from \"~/resolver/app/ingestor/IngestorResult.js\";\n\nexport interface IResolverApplicationParams {\n recordHandler: IRecordHandler;\n deployments: IDeployments;\n}\n\nexport class ResolverApplication implements IResolverApplication {\n private readonly recordHandler: IRecordHandler;\n private readonly deployments: IDeployments;\n\n public constructor(params: IResolverApplicationParams) {\n this.recordHandler = params.recordHandler;\n this.deployments = params.deployments;\n }\n\n public async resolve(params: IResolverApplicationResolveParams): Promise<void> {\n const validation = createRecordsValidation();\n\n const result = await validation.validate(params.records);\n if (result.error) {\n throw result.error;\n }\n\n const ingestor = createIngestor({\n createIngestorResult: () => {\n return createIngestorResult();\n },\n getSource: name => {\n return this.deployments.get(name);\n }\n });\n\n const data = await ingestor.ingest({\n records: result.records\n });\n\n try {\n await this.recordHandler.handle({\n data\n });\n } catch (ex) {\n console.error(convertException(ex));\n }\n }\n}\n\nexport const createResolverApp = (params: IResolverApplicationParams): IResolverApplication => {\n return new ResolverApplication(params);\n};\n"],"names":["ResolverApplication","params","validation","createRecordsValidation","result","ingestor","createIngestor","createIngestorResult","name","data","ex","console","convertException","createResolverApp"],"mappings":";;;;AAgBO,MAAMA;IAIT,YAAmBC,MAAkC,CAAE;QACnD,IAAI,CAAC,aAAa,GAAGA,OAAO,aAAa;QACzC,IAAI,CAAC,WAAW,GAAGA,OAAO,WAAW;IACzC;IAEA,MAAa,QAAQA,MAAyC,EAAiB;QAC3E,MAAMC,aAAaC;QAEnB,MAAMC,SAAS,MAAMF,WAAW,QAAQ,CAACD,OAAO,OAAO;QACvD,IAAIG,OAAO,KAAK,EACZ,MAAMA,OAAO,KAAK;QAGtB,MAAMC,WAAWC,eAAe;YAC5B,sBAAsB,IACXC;YAEX,WAAWC,CAAAA,OACA,IAAI,CAAC,WAAW,CAAC,GAAG,CAACA;QAEpC;QAEA,MAAMC,OAAO,MAAMJ,SAAS,MAAM,CAAC;YAC/B,SAASD,OAAO,OAAO;QAC3B;QAEA,IAAI;YACA,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;gBAC5BK;YACJ;QACJ,EAAE,OAAOC,IAAI;YACTC,QAAQ,KAAK,CAACC,iBAAiBF;QACnC;IACJ;AACJ;AAEO,MAAMG,oBAAoB,CAACZ,SACvB,IAAID,oBAAoBC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
class BaseBundle {
|
|
2
|
+
constructor(params){
|
|
3
|
+
this.items = [];
|
|
4
|
+
this.command = this.getCommand(params.command);
|
|
5
|
+
this.table = params.table;
|
|
6
|
+
this.source = params.source;
|
|
7
|
+
}
|
|
8
|
+
getCommand(command) {
|
|
9
|
+
return "delete" === command ? "delete" : "put";
|
|
10
|
+
}
|
|
11
|
+
add(item) {
|
|
12
|
+
this.items.push({
|
|
13
|
+
PK: item.PK,
|
|
14
|
+
SK: item.SK
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
17
|
}
|
|
18
|
+
export { BaseBundle };
|
|
18
19
|
|
|
19
20
|
//# sourceMappingURL=BaseBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/bundler/BaseBundle.js","sources":["../../../../src/resolver/app/bundler/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"],"names":["BaseBundle","params","command","item"],"mappings":"AAaO,MAAeA;IAQlB,YAAmBC,MAAyB,CAAE;aAPrC,KAAK,GAAkB,EAAE;QAQ9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,UAAU,CAACA,OAAO,OAAO;QAC7C,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;QACzB,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IAEU,WAAWC,OAA4B,EAAe;QAC5D,OAAOA,AAAY,aAAZA,UAAuB,WAAW;IAC7C;IAEO,IAAIC,IAAyB,EAAQ;QACxC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACZ,IAAIA,KAAK,EAAE;YACX,IAAIA,KAAK,EAAE;QACf;IACJ;AACJ"}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
item
|
|
13
|
-
});
|
|
1
|
+
class Bundler {
|
|
2
|
+
constructor(params){
|
|
3
|
+
this.createBundles = params.createBundles;
|
|
4
|
+
}
|
|
5
|
+
bundle(params) {
|
|
6
|
+
const { items } = params;
|
|
7
|
+
const bundles = this.createBundles();
|
|
8
|
+
for (const item of items)bundles.add({
|
|
9
|
+
item
|
|
10
|
+
});
|
|
11
|
+
return bundles;
|
|
14
12
|
}
|
|
15
|
-
return bundles;
|
|
16
|
-
}
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
14
|
+
const createBundler = (params)=>new Bundler(params);
|
|
15
|
+
export { Bundler, createBundler };
|
|
21
16
|
|
|
22
17
|
//# sourceMappingURL=Bundler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/bundler/Bundler.js","sources":["../../../../src/resolver/app/bundler/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"],"names":["Bundler","params","items","bundles","item","createBundler"],"mappings":"AAMO,MAAMA;IAGT,YAAmBC,MAAsB,CAAE;QACvC,IAAI,CAAC,aAAa,GAAGA,OAAO,aAAa;IAC7C;IAEO,OAAOA,MAA4B,EAAY;QAClD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAElB,MAAME,UAAU,IAAI,CAAC,aAAa;QAElC,KAAK,MAAMC,QAAQF,MACfC,QAAQ,GAAG,CAAC;YACRC;QACJ;QAGJ,OAAOD;IACX;AACJ;AAEO,MAAME,gBAAgB,CAACJ,SACnB,IAAID,QAAQC"}
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
class Bundles {
|
|
2
|
+
constructor(params){
|
|
3
|
+
this.bundles = [];
|
|
4
|
+
this.createBundle = params.createBundle;
|
|
5
|
+
}
|
|
6
|
+
add(params) {
|
|
7
|
+
const { item } = params;
|
|
8
|
+
const bundle = this.getBundle(item);
|
|
9
|
+
bundle.add(item);
|
|
10
|
+
}
|
|
11
|
+
getBundles() {
|
|
12
|
+
return this.bundles;
|
|
13
|
+
}
|
|
14
|
+
getBundle(item) {
|
|
15
|
+
const last = this.bundles[this.bundles.length - 1];
|
|
16
|
+
if (last?.canAdd(item)) return last;
|
|
17
|
+
const bundle = this.createBundle(item);
|
|
18
|
+
this.bundles.push(bundle);
|
|
19
|
+
return bundle;
|
|
20
20
|
}
|
|
21
|
-
const bundle = this.createBundle(item);
|
|
22
|
-
this.bundles.push(bundle);
|
|
23
|
-
return bundle;
|
|
24
|
-
}
|
|
25
21
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
22
|
+
const createBundles = (params)=>new Bundles(params);
|
|
23
|
+
export { Bundles, createBundles };
|
|
29
24
|
|
|
30
25
|
//# sourceMappingURL=Bundles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/bundler/Bundles.js","sources":["../../../../src/resolver/app/bundler/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"],"names":["Bundles","params","item","bundle","last","createBundles"],"mappings":"AAOO,MAAMA;IAIT,YAAmBC,MAAsB,CAAE;aAH1B,OAAO,GAAc,EAAE;QAIpC,IAAI,CAAC,YAAY,GAAGA,OAAO,YAAY;IAC3C;IAEO,IAAIA,MAAyB,EAAQ;QACxC,MAAM,EAAEC,IAAI,EAAE,GAAGD;QAEjB,MAAME,SAAS,IAAI,CAAC,SAAS,CAACD;QAE9BC,OAAO,GAAG,CAACD;IACf;IAEO,aAAwB;QAC3B,OAAO,IAAI,CAAC,OAAO;IACvB;IAEQ,UAAUA,IAAyB,EAAW;QAClD,MAAME,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE;QAClD,IAAIA,MAAM,OAAOF,OACb,OAAOE;QAEX,MAAMD,SAAS,IAAI,CAAC,YAAY,CAACD;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAACC;QAClB,OAAOA;IACX;AACJ;AAEO,MAAME,gBAAgB,CAACJ,SACnB,IAAID,QAAQC"}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Used to bundle by source system, table and command.
|
|
3
|
-
* If we receive >1 commands in a single batch, for example, put -> delete -> put -> delete, we need to make sure
|
|
4
|
-
* that commands are executed in that order.
|
|
5
|
-
*
|
|
6
|
-
* This will be used for executing the commands in the target systems.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
1
|
import { BaseBundle } from "./BaseBundle.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
class CommandBundle extends BaseBundle {
|
|
3
|
+
canAdd(item) {
|
|
4
|
+
const command = this.getCommand(item.command);
|
|
5
|
+
return this.command === command && this.table.name === item.table.name && this.source.name === item.source.name;
|
|
6
|
+
}
|
|
15
7
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
8
|
+
const createCommandBundle = (params)=>new CommandBundle(params);
|
|
9
|
+
export { CommandBundle, createCommandBundle };
|
|
19
10
|
|
|
20
11
|
//# sourceMappingURL=CommandBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/bundler/CommandBundle.js","sources":["../../../../src/resolver/app/bundler/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"],"names":["CommandBundle","BaseBundle","item","command","createCommandBundle","params"],"mappings":";AAYO,MAAMA,sBAAsBC;IACxB,OAAOC,IAAyB,EAAW;QAC9C,MAAMC,UAAU,IAAI,CAAC,UAAU,CAACD,KAAK,OAAO;QAC5C,OACI,IAAI,CAAC,OAAO,KAAKC,WACjB,IAAI,CAAC,KAAK,CAAC,IAAI,KAAKD,KAAK,KAAK,CAAC,IAAI,IACnC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAKA,KAAK,MAAM,CAAC,IAAI;IAE7C;AACJ;AAEO,MAAME,sBAAsB,CAACC,SACzB,IAAIL,cAAcK"}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This will bundle records by system and table.
|
|
3
|
-
*
|
|
4
|
-
* It will be used to fetch the data from the source system tables.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import { BaseBundle } from "./BaseBundle.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
class TableBundle extends BaseBundle {
|
|
3
|
+
canAdd(item) {
|
|
4
|
+
return this.source.name === item.source.name && this.table.name === item.table.name;
|
|
5
|
+
}
|
|
12
6
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
7
|
+
const createTableBundle = (params)=>new TableBundle(params);
|
|
8
|
+
export { TableBundle, createTableBundle };
|
|
16
9
|
|
|
17
10
|
//# sourceMappingURL=TableBundle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/bundler/TableBundle.js","sources":["../../../../src/resolver/app/bundler/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"],"names":["TableBundle","BaseBundle","item","createTableBundle","params"],"mappings":";AAUO,MAAMA,oBAAoBC;IACtB,OAAOC,IAAyB,EAAW;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAKA,KAAK,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAKA,KAAK,KAAK,CAAC,IAAI;IACvF;AACJ;AAEO,MAAMC,oBAAoB,CAACC,SACvB,IAAIJ,YAAYI"}
|
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
await this.storer.store({
|
|
23
|
-
command: "delete",
|
|
24
|
-
deployment: targetDeployment,
|
|
25
|
-
table: targetTable,
|
|
26
|
-
items: result,
|
|
27
|
-
bundle
|
|
28
|
-
});
|
|
29
|
-
}
|
|
1
|
+
class DeleteCommandHandler {
|
|
2
|
+
constructor(params){
|
|
3
|
+
this.storer = params.storer;
|
|
4
|
+
}
|
|
5
|
+
async handle(params) {
|
|
6
|
+
const { targetDeployment, targetTable, bundle } = params;
|
|
7
|
+
const result = bundle.items.map((item)=>{
|
|
8
|
+
if (!item.PK || !item.SK) return null;
|
|
9
|
+
return {
|
|
10
|
+
PK: item.PK,
|
|
11
|
+
SK: item.SK
|
|
12
|
+
};
|
|
13
|
+
}).filter((item)=>!!item);
|
|
14
|
+
await this.storer.store({
|
|
15
|
+
command: "delete",
|
|
16
|
+
deployment: targetDeployment,
|
|
17
|
+
table: targetTable,
|
|
18
|
+
items: result,
|
|
19
|
+
bundle
|
|
20
|
+
});
|
|
21
|
+
}
|
|
30
22
|
}
|
|
23
|
+
export { DeleteCommandHandler };
|
|
31
24
|
|
|
32
25
|
//# sourceMappingURL=DeleteCommandHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/commandHandler/DeleteCommandHandler.js","sources":["../../../../src/resolver/app/commandHandler/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"],"names":["DeleteCommandHandler","params","targetDeployment","targetTable","bundle","result","item"],"mappings":"AAgBO,MAAMA;IAGT,YAAmBC,MAAmC,CAAE;QACpD,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IACA,MAAa,OAAOA,MAAyC,EAAiB;QAC1E,MAAM,EAAEC,gBAAgB,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGH;QAClD,MAAMI,SAASD,OAAO,KAAK,CACtB,GAAG,CAACE,CAAAA;YACD,IAAI,CAACA,KAAK,EAAE,IAAI,CAACA,KAAK,EAAE,EACpB,OAAO;YAEX,OAAO;gBACH,IAAIA,KAAK,EAAE;gBACX,IAAIA,KAAK,EAAE;YACf;QACJ,GACC,MAAM,CAAC,CAACA,OACE,CAAC,CAACA;QAGjB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACpB,SAAS;YACT,YAAYJ;YACZ,OAAOC;YACP,OAAOE;YACPD;QACJ;IACJ;AACJ"}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
command: "put",
|
|
17
|
-
deployment: targetDeployment,
|
|
18
|
-
table: targetTable,
|
|
19
|
-
items: result,
|
|
20
|
-
bundle
|
|
21
|
-
});
|
|
22
|
-
}
|
|
1
|
+
class PutCommandHandler {
|
|
2
|
+
constructor(params){
|
|
3
|
+
this.storer = params.storer;
|
|
4
|
+
}
|
|
5
|
+
async handle(params) {
|
|
6
|
+
const { items, targetDeployment, targetTable, bundle } = params;
|
|
7
|
+
const result = items.filter((item)=>!!item.PK && !!item.SK);
|
|
8
|
+
await this.storer.store({
|
|
9
|
+
command: "put",
|
|
10
|
+
deployment: targetDeployment,
|
|
11
|
+
table: targetTable,
|
|
12
|
+
items: result,
|
|
13
|
+
bundle
|
|
14
|
+
});
|
|
15
|
+
}
|
|
23
16
|
}
|
|
17
|
+
export { PutCommandHandler };
|
|
24
18
|
|
|
25
19
|
//# sourceMappingURL=PutCommandHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/commandHandler/PutCommandHandler.js","sources":["../../../../src/resolver/app/commandHandler/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"],"names":["PutCommandHandler","params","items","targetDeployment","targetTable","bundle","result","item"],"mappings":"AAgBO,MAAMA;IAGT,YAAmBC,MAAgC,CAAE;QACjD,IAAI,CAAC,MAAM,GAAGA,OAAO,MAAM;IAC/B;IAEA,MAAa,OAAOA,MAAsC,EAAiB;QACvE,MAAM,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGJ;QAEzD,MAAMK,SAASJ,MAAM,MAAM,CAACK,CAAAA,OACjB,CAAC,CAACA,KAAK,EAAE,IAAI,CAAC,CAACA,KAAK,EAAE;QAGjC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACpB,SAAS;YACT,YAAYJ;YACZ,OAAOC;YACP,OAAOE;YACPD;QACJ;IACJ;AACJ"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { CommandHandlerPlugin, createCommandHandlerPlugin } from "../../plugins/CommandHandlerPlugin.js";
|
|
2
2
|
import { DeleteCommandHandler } from "./DeleteCommandHandler.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
plugin.name = `${CommandHandlerPlugin.type}.delete`;
|
|
14
|
-
return plugin;
|
|
3
|
+
const createDeleteCommandHandlerPlugin = ()=>{
|
|
4
|
+
const plugin = createCommandHandlerPlugin({
|
|
5
|
+
canHandle: (command)=>"delete" === command,
|
|
6
|
+
handle: async (params)=>{
|
|
7
|
+
const handler = new DeleteCommandHandler(params);
|
|
8
|
+
return handler.handle(params);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
plugin.name = `${CommandHandlerPlugin.type}.delete`;
|
|
12
|
+
return plugin;
|
|
15
13
|
};
|
|
14
|
+
export { createDeleteCommandHandlerPlugin };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/commandHandler/delete.js","sources":["../../../../src/resolver/app/commandHandler/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"],"names":["createDeleteCommandHandlerPlugin","plugin","createCommandHandlerPlugin","command","params","handler","DeleteCommandHandler","CommandHandlerPlugin"],"mappings":";;AAMO,MAAMA,mCAAmC;IAC5C,MAAMC,SAASC,2BAA2B;QACtC,WAAWC,CAAAA,UACAA,AAAY,aAAZA;QAEX,QAAQ,OAAMC;YACV,MAAMC,UAAU,IAAIC,qBAAqBF;YAEzC,OAAOC,QAAQ,MAAM,CAACD;QAC1B;IACJ;IAEAH,OAAO,IAAI,GAAG,GAAGM,qBAAqB,IAAI,CAAC,OAAO,CAAC;IAEnD,OAAON;AACX"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { CommandHandlerPlugin, createCommandHandlerPlugin } from "../../plugins/CommandHandlerPlugin.js";
|
|
2
2
|
import { PutCommandHandler } from "./PutCommandHandler.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
plugin.name = `${CommandHandlerPlugin.type}.put`;
|
|
14
|
-
return plugin;
|
|
3
|
+
const createPutCommandHandlerPlugin = ()=>{
|
|
4
|
+
const plugin = createCommandHandlerPlugin({
|
|
5
|
+
canHandle: (command)=>"put" === command,
|
|
6
|
+
handle: async (params)=>{
|
|
7
|
+
const handler = new PutCommandHandler(params);
|
|
8
|
+
return handler.handle(params);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
plugin.name = `${CommandHandlerPlugin.type}.put`;
|
|
12
|
+
return plugin;
|
|
15
13
|
};
|
|
14
|
+
export { createPutCommandHandlerPlugin };
|
|
16
15
|
|
|
17
16
|
//# sourceMappingURL=put.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"resolver/app/commandHandler/put.js","sources":["../../../../src/resolver/app/commandHandler/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"],"names":["createPutCommandHandlerPlugin","plugin","createCommandHandlerPlugin","command","params","handler","PutCommandHandler","CommandHandlerPlugin"],"mappings":";;AAMO,MAAMA,gCAAgC;IACzC,MAAMC,SAASC,2BAA2B;QACtC,WAAWC,CAAAA,UACAA,AAAY,UAAZA;QAEX,QAAQ,OAAMC;YACV,MAAMC,UAAU,IAAIC,kBAAkBF;YAEtC,OAAOC,QAAQ,MAAM,CAACD;QAC1B;IACJ;IAEAH,OAAO,IAAI,GAAG,GAAGM,qBAAqB,IAAI,CAAC,IAAI,CAAC;IAEhD,OAAON;AACX"}
|