@mbc-cqrs-serverless/import 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constant/import-publish.d.ts +23 -0
- package/dist/constant/import-publish.js +28 -0
- package/dist/constant/import-publish.js.map +1 -0
- package/dist/constant/index.d.ts +1 -0
- package/dist/constant/index.js +1 -0
- package/dist/constant/index.js.map +1 -1
- package/dist/event/command-finished.queue.event.handler.js +0 -8
- package/dist/event/command-finished.queue.event.handler.js.map +1 -1
- package/dist/event/csv-import.queue.event.handler.js +2 -2
- package/dist/event/csv-import.queue.event.handler.js.map +1 -1
- package/dist/event/csv-import.sfn.event.d.ts +21 -1
- package/dist/event/csv-import.sfn.event.handler.d.ts +11 -2
- package/dist/event/csv-import.sfn.event.handler.js +109 -51
- package/dist/event/csv-import.sfn.event.handler.js.map +1 -1
- package/dist/event/csv-import.sfn.event.js.map +1 -1
- package/dist/event/import-status.queue.event.handler.js +5 -5
- package/dist/event/import-status.queue.event.handler.js.map +1 -1
- package/dist/event/import.queue.event.handler.d.ts +3 -1
- package/dist/event/import.queue.event.handler.js +17 -5
- package/dist/event/import.queue.event.handler.js.map +1 -1
- package/dist/event/zip-import.sfn.event.handler.js +9 -9
- package/dist/event/zip-import.sfn.event.handler.js.map +1 -1
- package/dist/import.module-definition.d.ts +2 -0
- package/dist/import.module-definition.js +3 -1
- package/dist/import.module-definition.js.map +1 -1
- package/dist/import.module.js +9 -0
- package/dist/import.module.js.map +1 -1
- package/dist/interface/import-entity-profile.interface.d.ts +8 -0
- package/package.json +3 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How import publishes commands to CommandService for CSV / queue import paths.
|
|
3
|
+
*
|
|
4
|
+
* **ASYNC (default)** — Uses `publishAsync` / `publishPartialUpdateAsync`. Commands are
|
|
5
|
+
* written for the normal orchestrated pipeline (e.g. Step Functions) where completion is
|
|
6
|
+
* asynchronous relative to the importer Lambda.
|
|
7
|
+
*
|
|
8
|
+
* **SYNC** — Uses `publishSync` / `publishPartialUpdateSync`. Runs the full command
|
|
9
|
+
* pipeline **inline in the same Lambda invocation** (command → TTL → history → data →
|
|
10
|
+
* sync handlers → status). It does **not** wait on a separate Step Functions execution;
|
|
11
|
+
* it **bypasses** that async orchestration by executing handlers synchronously.
|
|
12
|
+
*
|
|
13
|
+
* **CSV Distributed Map batches** — In `csv_rows_handler`, rows in a batch are processed
|
|
14
|
+
* **sequentially**. Each SYNC row awaits `publishSync`, so total duration grows with batch
|
|
15
|
+
* size × per-row latency. Large `ItemBatcher` settings (e.g. 100 rows) combined with
|
|
16
|
+
* SYNC can exceed the Lambda timeout. Prefer ASYNC for large imports; use SYNC only when
|
|
17
|
+
* batches are small, per-row work is cheap, and you have sized Step Functions batching /
|
|
18
|
+
* Lambda timeout accordingly.
|
|
19
|
+
*/
|
|
20
|
+
export declare enum ImportPublishMode {
|
|
21
|
+
SYNC = "SYNC",
|
|
22
|
+
ASYNC = "ASYNC"
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImportPublishMode = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* How import publishes commands to CommandService for CSV / queue import paths.
|
|
6
|
+
*
|
|
7
|
+
* **ASYNC (default)** — Uses `publishAsync` / `publishPartialUpdateAsync`. Commands are
|
|
8
|
+
* written for the normal orchestrated pipeline (e.g. Step Functions) where completion is
|
|
9
|
+
* asynchronous relative to the importer Lambda.
|
|
10
|
+
*
|
|
11
|
+
* **SYNC** — Uses `publishSync` / `publishPartialUpdateSync`. Runs the full command
|
|
12
|
+
* pipeline **inline in the same Lambda invocation** (command → TTL → history → data →
|
|
13
|
+
* sync handlers → status). It does **not** wait on a separate Step Functions execution;
|
|
14
|
+
* it **bypasses** that async orchestration by executing handlers synchronously.
|
|
15
|
+
*
|
|
16
|
+
* **CSV Distributed Map batches** — In `csv_rows_handler`, rows in a batch are processed
|
|
17
|
+
* **sequentially**. Each SYNC row awaits `publishSync`, so total duration grows with batch
|
|
18
|
+
* size × per-row latency. Large `ItemBatcher` settings (e.g. 100 rows) combined with
|
|
19
|
+
* SYNC can exceed the Lambda timeout. Prefer ASYNC for large imports; use SYNC only when
|
|
20
|
+
* batches are small, per-row work is cheap, and you have sized Step Functions batching /
|
|
21
|
+
* Lambda timeout accordingly.
|
|
22
|
+
*/
|
|
23
|
+
var ImportPublishMode;
|
|
24
|
+
(function (ImportPublishMode) {
|
|
25
|
+
ImportPublishMode["SYNC"] = "SYNC";
|
|
26
|
+
ImportPublishMode["ASYNC"] = "ASYNC";
|
|
27
|
+
})(ImportPublishMode || (exports.ImportPublishMode = ImportPublishMode = {}));
|
|
28
|
+
//# sourceMappingURL=import-publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-publish.js","sourceRoot":"","sources":["../../src/constant/import-publish.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,oCAAe,CAAA;AACjB,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B"}
|
package/dist/constant/index.d.ts
CHANGED
package/dist/constant/index.js
CHANGED
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./id"), exports);
|
|
18
|
+
__exportStar(require("./import-publish"), exports);
|
|
18
19
|
__exportStar(require("./queue"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constant/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAoB;AACpB,0CAAuB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constant/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAoB;AACpB,mDAAgC;AAChC,0CAAuB"}
|
|
@@ -60,14 +60,6 @@ let CommandFinishedHandler = CommandFinishedHandler_1 = class CommandFinishedHan
|
|
|
60
60
|
result,
|
|
61
61
|
error,
|
|
62
62
|
});
|
|
63
|
-
const skParts = importKey.sk.split(core_1.KEY_SEPARATOR);
|
|
64
|
-
const parentId = skParts.slice(0, -1).join(core_1.KEY_SEPARATOR); // Everything except the last part (the child's own ULID)
|
|
65
|
-
if (parentId.startsWith(constant_1.CSV_IMPORT_PK_PREFIX)) {
|
|
66
|
-
const parentKey = (0, helpers_1.parseId)(parentId);
|
|
67
|
-
const childSucceeded = newStatus === enum_1.ImportStatusEnum.COMPLETED;
|
|
68
|
-
// This call will handle incrementing and finalizing the parent job.
|
|
69
|
-
await this.importService.incrementParentJobCounters(parentKey, childSucceeded);
|
|
70
|
-
}
|
|
71
63
|
}
|
|
72
64
|
catch (error) {
|
|
73
65
|
this.logger.error('Failed to process command notification event', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-finished.queue.event.handler.js","sourceRoot":"","sources":["../../src/event/command-finished.queue.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oDAOkC;AAClC,2CAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"command-finished.queue.event.handler.js","sourceRoot":"","sources":["../../src/event/command-finished.queue.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oDAOkC;AAClC,2CAAuC;AAEvC,0CAA8C;AAC9C,kCAA0C;AAC1C,wCAAoC;AACpC,sDAAiD;AAajD,0DAA0D;AAC1D,MAAM,qBAAqB,GAAG,gBAAgB,CAAA;AAGvC,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAKjC,YAA6B,aAA4B;QAA5B,kBAAa,G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mBAAY,EAAC,wBAAiB,CAAC;qCAMc,8BAAa;GAL9C,sBAAsB,CAiHlC"}
|
|
@@ -40,7 +40,7 @@ let CsvImportQueueEventHandler = CsvImportQueueEventHandler_1 = class CsvImportQ
|
|
|
40
40
|
}
|
|
41
41
|
const importKey = event.importEvent.importKey;
|
|
42
42
|
const { key, tableName, tenantCode } = importEntity.attributes;
|
|
43
|
-
this.logger.
|
|
43
|
+
this.logger.debug(`Received master CSV job from queue: ${importEntity.id} for file ${key}`);
|
|
44
44
|
try {
|
|
45
45
|
await this.importService.updateStatus(importKey, import_status_enum_1.ImportStatusEnum.PROCESSING);
|
|
46
46
|
// 1. Find the custom CSV mapper for the target table.
|
|
@@ -52,7 +52,7 @@ let CsvImportQueueEventHandler = CsvImportQueueEventHandler_1 = class CsvImportQ
|
|
|
52
52
|
...importEntity.attributes,
|
|
53
53
|
sourceId: importEntity.id,
|
|
54
54
|
}, `${tenantCode}-${tableName}-${Date.now()}`);
|
|
55
|
-
this.logger.
|
|
55
|
+
this.logger.debug(`Started Step Function execution for master job ${importEntity.id}`);
|
|
56
56
|
// The master job's status will now be updated by the Step Function itself upon completion/failure.
|
|
57
57
|
}
|
|
58
58
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv-import.queue.event.handler.js","sourceRoot":"","sources":["../../src/event/csv-import.queue.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA8C;AAC9C,oDAKkC;AAClC,2CAA+C;AAC/C,2CAA8C;AAE9C,0CAAkD;AAElD,mEAA6D;AAC7D,0EAAiE;AACjE,sDAAiD;AAEjD,6DAAuD;AAGhD,IAAM,0BAA0B,kCAAhC,MAAM,0BAA0B;IAMrC,YACmB,aAA4B,EAC5B,UAA+B,EAC/B,aAA4B,EAE7C,iBAA0E;QAJzD,kBAAa,GAAb,aAAa,CAAe;QAC5B,eAAU,GAAV,UAAU,CAAqB;QAC/B,kBAAa,GAAb,aAAa,CAAe;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,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,gDAAgD,YAAY,CAAC,EAAE,EAAE,EACjE,KAAK,CACN,CAAA;YACD,qEAAqE;YACrE,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CACnC,SAAS,EACT,qCAAgB,CAAC,MAAM,EACvB;gBACE,KAAK,EAAE;oBACL,OAAO,EAAE,kCAAmC,KAAe,CAAC,OAAO,EAAE;iBACtE;aACF,CACF,CAAA;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA;AA5EY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAY,EAAC,qCAAgB,CAAC;IAW1B,WAAA,IAAA,eAAM,EAAC,8CAAmB,CAAC,CAAA;qCAHI,sBAAa;QAChB,0BAAmB;QAChB,8BAAa;QAET,GAAG;GAX9B,0BAA0B,CA4EtC"}
|
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import { IEvent, StepFunctionsContext } from '@mbc-cqrs-serverless/core';
|
|
2
2
|
import { CreateCsvImportDto } from '../dto/create-csv-import.dto';
|
|
3
3
|
import { ICsvRowImport } from '../dto/csv-import-row.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Per-batch metrics emitted by each csv_rows_handler Map iteration.
|
|
6
|
+
* `totalRows` is the row count in this batch; each row is either counted in
|
|
7
|
+
* `succeededRows` (including skipped-equal rows) or `failedRows`.
|
|
8
|
+
*/
|
|
9
|
+
export interface CsvBatchProcessingSummary {
|
|
10
|
+
totalRows: number;
|
|
11
|
+
succeededRows: number;
|
|
12
|
+
failedRows: number;
|
|
13
|
+
}
|
|
14
|
+
/** Map state output merged via `resultPath: '$.processingResults'`. */
|
|
15
|
+
export interface CsvFinalizeParentJobMapOutput {
|
|
16
|
+
readonly processingResults?: readonly CsvBatchProcessingSummary[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Payload for the `finalize_parent_job` state after Distributed Map.
|
|
20
|
+
* Primary shape: Map `resultPath: '$.processingResults'` (see infra stack).
|
|
21
|
+
* Alternate: array whose first element is the batch summaries array.
|
|
22
|
+
*/
|
|
23
|
+
export type CsvFinalizeParentJobInput = CsvFinalizeParentJobMapOutput | readonly CsvBatchProcessingSummary[][];
|
|
4
24
|
export declare class CsvImportSfnEvent implements IEvent {
|
|
5
25
|
source: string;
|
|
6
26
|
context: StepFunctionsContext;
|
|
7
|
-
input: CreateCsvImportDto | ICsvRowImport;
|
|
27
|
+
input: CreateCsvImportDto | ICsvRowImport | CsvFinalizeParentJobInput;
|
|
8
28
|
constructor(event?: Partial<CsvImportSfnEvent>);
|
|
9
29
|
}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { IEventHandler, S3Service } from '@mbc-cqrs-serverless/core';
|
|
2
2
|
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { ImportPublishMode } from '../constant/import-publish';
|
|
3
4
|
import { ImportService } from '../import.service';
|
|
4
|
-
import { IImportStrategy } from '../interface';
|
|
5
|
+
import { IImportStrategy, IProcessStrategy } from '../interface';
|
|
5
6
|
import { CsvImportSfnEvent } from './csv-import.sfn.event';
|
|
6
7
|
export declare class CsvImportSfnEventHandler implements IEventHandler<CsvImportSfnEvent> {
|
|
7
8
|
private readonly importService;
|
|
8
9
|
private readonly importStrategyMap;
|
|
9
10
|
private readonly configService;
|
|
10
11
|
private readonly s3Service;
|
|
12
|
+
private readonly processStrategyMap;
|
|
13
|
+
private readonly publishModeMap;
|
|
11
14
|
private readonly logger;
|
|
12
15
|
private readonly alarmTopicArn;
|
|
13
|
-
constructor(importService: ImportService, importStrategyMap: Map<string, IImportStrategy<any, any>>, configService: ConfigService, s3Service: S3Service);
|
|
16
|
+
constructor(importService: ImportService, importStrategyMap: Map<string, IImportStrategy<any, any>>, configService: ConfigService, s3Service: S3Service, processStrategyMap: Map<string, IProcessStrategy<any, any>>, publishModeMap: Map<string, ImportPublishMode>);
|
|
14
17
|
execute(event: CsvImportSfnEvent): Promise<any>;
|
|
15
18
|
handleStepState(event: CsvImportSfnEvent): Promise<any>;
|
|
16
19
|
private loadCsv;
|
|
17
20
|
private countCsvRows;
|
|
21
|
+
/**
|
|
22
|
+
* Normalizes Step Functions payloads: Map merges `processingResults`, or
|
|
23
|
+
* legacy shape stores the batch array at index 0.
|
|
24
|
+
*/
|
|
25
|
+
private resolveFinalizeProcessingResults;
|
|
26
|
+
private isCsvFinalizeNestedBatchArray;
|
|
18
27
|
private finalizeParentJob;
|
|
19
28
|
}
|
|
@@ -23,17 +23,20 @@ const common_1 = require("@nestjs/common");
|
|
|
23
23
|
const config_1 = require("@nestjs/config");
|
|
24
24
|
const csv_parser_1 = __importDefault(require("csv-parser"));
|
|
25
25
|
const stream_1 = require("stream");
|
|
26
|
+
const import_publish_1 = require("../constant/import-publish");
|
|
26
27
|
const enum_1 = require("../enum");
|
|
27
28
|
const helpers_1 = require("../helpers");
|
|
28
29
|
const import_module_definition_1 = require("../import.module-definition");
|
|
29
30
|
const import_service_1 = require("../import.service");
|
|
30
31
|
const csv_import_sfn_event_1 = require("./csv-import.sfn.event");
|
|
31
32
|
let CsvImportSfnEventHandler = CsvImportSfnEventHandler_1 = class CsvImportSfnEventHandler {
|
|
32
|
-
constructor(importService, importStrategyMap, configService, s3Service) {
|
|
33
|
+
constructor(importService, importStrategyMap, configService, s3Service, processStrategyMap, publishModeMap) {
|
|
33
34
|
this.importService = importService;
|
|
34
35
|
this.importStrategyMap = importStrategyMap;
|
|
35
36
|
this.configService = configService;
|
|
36
37
|
this.s3Service = s3Service;
|
|
38
|
+
this.processStrategyMap = processStrategyMap;
|
|
39
|
+
this.publishModeMap = publishModeMap;
|
|
37
40
|
this.logger = new common_1.Logger(CsvImportSfnEventHandler_1.name);
|
|
38
41
|
this.alarmTopicArn = this.configService.get('SNS_ALARM_TOPIC_ARN');
|
|
39
42
|
}
|
|
@@ -53,15 +56,15 @@ let CsvImportSfnEventHandler = CsvImportSfnEventHandler_1 = class CsvImportSfnEv
|
|
|
53
56
|
// 1. Get the parent job's key from the sourceId
|
|
54
57
|
const parentKey = (0, helpers_1.parseId)(input.sourceId);
|
|
55
58
|
// 2. Count the total rows in the CSV
|
|
56
|
-
this.logger.
|
|
59
|
+
this.logger.debug(`Counting rows for file: ${input.key}`);
|
|
57
60
|
const totalRows = await this.countCsvRows(input);
|
|
58
|
-
this.logger.
|
|
61
|
+
this.logger.debug(`Found ${totalRows} rows. Updating parent job.`);
|
|
59
62
|
// 3. Update the parent job with the total count
|
|
60
63
|
const updatedEntity = await this.importService.updateImportJob(parentKey, {
|
|
61
64
|
set: { totalRows },
|
|
62
65
|
});
|
|
63
66
|
if (updatedEntity.processedRows >= totalRows) {
|
|
64
|
-
this.logger.
|
|
67
|
+
this.logger.debug(`Job ${input.sourceId} already finished. Setting final status.`);
|
|
65
68
|
// Set status to FAILED if any child job failed, otherwise COMPLETED
|
|
66
69
|
// 子ジョブが1つでも失敗していればFAILED、そうでなければCOMPLETED
|
|
67
70
|
const finalStatus = updatedEntity.failedRows > 0
|
|
@@ -73,43 +76,74 @@ let CsvImportSfnEventHandler = CsvImportSfnEventHandler_1 = class CsvImportSfnEv
|
|
|
73
76
|
return this.loadCsv(input);
|
|
74
77
|
}
|
|
75
78
|
if (event.context.State.Name === 'finalize_parent_job') {
|
|
76
|
-
|
|
77
|
-
return this.finalizeParentJob(finalizeEvent);
|
|
79
|
+
return this.finalizeParentJob(event.input, event.context.Execution.Input.sourceId);
|
|
78
80
|
}
|
|
79
81
|
const input = event.input;
|
|
80
82
|
const items = input.Items;
|
|
81
83
|
const attributes = input.BatchInput.Attributes;
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
const importStrategy = this.importStrategyMap.get(attributes.tableName);
|
|
85
|
+
const processStrategy = this.processStrategyMap.get(attributes.tableName);
|
|
86
|
+
const publishMode = this.publishModeMap.get(attributes.tableName) ?? import_publish_1.ImportPublishMode.ASYNC;
|
|
87
|
+
if (!importStrategy || !processStrategy) {
|
|
88
|
+
throw new Error(`Strategies not found for table: ${attributes.tableName}`);
|
|
86
89
|
}
|
|
90
|
+
let succeededRows = 0;
|
|
91
|
+
let failedRows = 0;
|
|
92
|
+
// CommandService publish* requires ICommandOptions.invokeContext; extract from this Lambda invocation.
|
|
93
|
+
const invokeContext = (0, core_1.extractInvokeContext)();
|
|
94
|
+
const options = {
|
|
95
|
+
invokeContext,
|
|
96
|
+
source: 'CSV_BATCH_PROCESSOR',
|
|
97
|
+
};
|
|
98
|
+
const commandService = processStrategy.getCommandService();
|
|
99
|
+
// Rows run sequentially; SYNC awaits publishSync per row (see ImportPublishMode).
|
|
87
100
|
for (const [index, item] of items.entries()) {
|
|
88
101
|
try {
|
|
89
|
-
|
|
90
|
-
await
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
102
|
+
// 1. Transform & Validate
|
|
103
|
+
const transformedData = await importStrategy.transform(item);
|
|
104
|
+
await importStrategy.validate(transformedData);
|
|
105
|
+
// 2. Compare against existing data
|
|
106
|
+
const compareResult = await processStrategy.compare({ ...transformedData, __s3Key: input.BatchInput.Attributes.key }, attributes.tenantCode);
|
|
107
|
+
if (compareResult.status === enum_1.ComparisonStatus.EQUAL) {
|
|
108
|
+
succeededRows++;
|
|
109
|
+
continue; // Skip identical data
|
|
110
|
+
}
|
|
111
|
+
// 3. Map to Command Input
|
|
112
|
+
const mappedData = await processStrategy.map(compareResult.status, { ...transformedData, __s3Key: input.BatchInput.Attributes.key }, attributes.tenantCode, compareResult.existingData);
|
|
113
|
+
// 4. Publish to CommandService
|
|
114
|
+
if (compareResult.status === enum_1.ComparisonStatus.NOT_EXIST) {
|
|
115
|
+
if (publishMode === import_publish_1.ImportPublishMode.SYNC) {
|
|
116
|
+
await commandService.publishSync(mappedData, options);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
await commandService.publishAsync(mappedData, options);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
if (publishMode === import_publish_1.ImportPublishMode.SYNC) {
|
|
124
|
+
await commandService.publishPartialUpdateSync(mappedData, options);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
await commandService.publishPartialUpdateAsync(mappedData, options);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
succeededRows++;
|
|
99
131
|
}
|
|
100
132
|
catch (error) {
|
|
101
|
-
this.logger.warn(`Row ${index + 1} failed
|
|
102
|
-
|
|
133
|
+
this.logger.warn(`Row ${index + 1} failed processing.`, {
|
|
134
|
+
item,
|
|
135
|
+
errorMessage: error.message,
|
|
136
|
+
stack: error.stack,
|
|
137
|
+
});
|
|
138
|
+
failedRows++;
|
|
103
139
|
}
|
|
104
140
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
141
|
+
// Return the summary for Step Functions aggregation
|
|
142
|
+
return {
|
|
143
|
+
totalRows: items.length,
|
|
144
|
+
succeededRows,
|
|
145
|
+
failedRows,
|
|
108
146
|
};
|
|
109
|
-
if (createImportDtos.length > 0) {
|
|
110
|
-
const importPromises = createImportDtos.map((dto) => this.importService.createImport(dto, options));
|
|
111
|
-
await Promise.all(importPromises);
|
|
112
|
-
}
|
|
113
147
|
}
|
|
114
148
|
async loadCsv(input, limit = 10) {
|
|
115
149
|
// 1. Fetch the S3 object stream
|
|
@@ -180,38 +214,62 @@ let CsvImportSfnEventHandler = CsvImportSfnEventHandler_1 = class CsvImportSfnEv
|
|
|
180
214
|
.on('error', (error) => reject(error));
|
|
181
215
|
});
|
|
182
216
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
},
|
|
217
|
+
/**
|
|
218
|
+
* Normalizes Step Functions payloads: Map merges `processingResults`, or
|
|
219
|
+
* legacy shape stores the batch array at index 0.
|
|
220
|
+
*/
|
|
221
|
+
resolveFinalizeProcessingResults(input) {
|
|
222
|
+
if (this.isCsvFinalizeNestedBatchArray(input)) {
|
|
223
|
+
const first = input[0];
|
|
224
|
+
return Array.isArray(first) ? first : [];
|
|
225
|
+
}
|
|
226
|
+
return input.processingResults ?? [];
|
|
227
|
+
}
|
|
228
|
+
isCsvFinalizeNestedBatchArray(input) {
|
|
229
|
+
return Array.isArray(input);
|
|
230
|
+
}
|
|
231
|
+
async finalizeParentJob(input, sourceId) {
|
|
232
|
+
const parentKey = (0, helpers_1.parseId)(sourceId);
|
|
233
|
+
const results = this.resolveFinalizeProcessingResults(input);
|
|
234
|
+
if (results.length === 0) {
|
|
235
|
+
this.logger.warn(`No batch results found for parent job ${sourceId}. Marking as FAILED.`);
|
|
236
|
+
await this.importService.updateStatus(parentKey, enum_1.ImportStatusEnum.FAILED, {
|
|
237
|
+
result: { message: 'No batch processing results received.' },
|
|
204
238
|
});
|
|
239
|
+
return;
|
|
205
240
|
}
|
|
241
|
+
// Sum up the output of all Map / Lambda batches
|
|
242
|
+
const finalSummary = results.reduce((acc, batch) => {
|
|
243
|
+
acc.totalRows += batch.totalRows;
|
|
244
|
+
acc.succeededRows += batch.succeededRows;
|
|
245
|
+
acc.failedRows += batch.failedRows;
|
|
246
|
+
return acc;
|
|
247
|
+
}, { totalRows: 0, succeededRows: 0, failedRows: 0 });
|
|
248
|
+
this.logger.log(`Finalizing parent CSV job ${parentKey.pk}#${parentKey.sk}`, finalSummary);
|
|
249
|
+
const finalStatus = finalSummary.failedRows > 0
|
|
250
|
+
? enum_1.ImportStatusEnum.FAILED
|
|
251
|
+
: enum_1.ImportStatusEnum.COMPLETED;
|
|
252
|
+
await this.importService.updateStatus(parentKey, finalStatus, {
|
|
253
|
+
result: {
|
|
254
|
+
message: 'All batches have been processed.',
|
|
255
|
+
total: finalSummary.totalRows,
|
|
256
|
+
succeeded: finalSummary.succeededRows,
|
|
257
|
+
failed: finalSummary.failedRows,
|
|
258
|
+
},
|
|
259
|
+
});
|
|
206
260
|
}
|
|
207
261
|
};
|
|
208
262
|
exports.CsvImportSfnEventHandler = CsvImportSfnEventHandler;
|
|
209
263
|
exports.CsvImportSfnEventHandler = CsvImportSfnEventHandler = CsvImportSfnEventHandler_1 = __decorate([
|
|
210
264
|
(0, core_1.EventHandler)(csv_import_sfn_event_1.CsvImportSfnEvent),
|
|
211
265
|
__param(1, (0, common_1.Inject)(import_module_definition_1.IMPORT_STRATEGY_MAP)),
|
|
266
|
+
__param(4, (0, common_1.Inject)(import_module_definition_1.PROCESS_STRATEGY_MAP)),
|
|
267
|
+
__param(5, (0, common_1.Inject)(import_module_definition_1.PUBLISH_MODE_MAP)),
|
|
212
268
|
__metadata("design:paramtypes", [import_service_1.ImportService,
|
|
213
269
|
Map,
|
|
214
270
|
config_1.ConfigService,
|
|
215
|
-
core_1.S3Service
|
|
271
|
+
core_1.S3Service,
|
|
272
|
+
Map,
|
|
273
|
+
Map])
|
|
216
274
|
], CsvImportSfnEventHandler);
|
|
217
275
|
//# sourceMappingURL=csv-import.sfn.event.handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv-import.sfn.event.handler.js","sourceRoot":"","sources":["../../src/event/csv-import.sfn.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,kDAAqD;AACrD,
|
|
1
|
+
{"version":3,"file":"csv-import.sfn.event.handler.js","sourceRoot":"","sources":["../../src/event/csv-import.sfn.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,kDAAqD;AACrD,oDAQkC;AAClC,2CAA+C;AAC/C,2CAA8C;AAC9C,4DAA4B;AAC5B,mCAAiC;AAEjC,+DAA8D;AAG9D,kCAA4D;AAC5D,wCAAoC;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a;QAET,GAAG;QACP,sBAAa;QACjB,gBAAS;QAEA,GAAG;QAKP,GAAG;GAlB3B,wBAAwB,CAwUpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csv-import.sfn.event.js","sourceRoot":"","sources":["../../src/event/csv-import.sfn.event.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"csv-import.sfn.event.js","sourceRoot":"","sources":["../../src/event/csv-import.sfn.event.ts"],"names":[],"mappings":";;;AA8BA,MAAa,iBAAiB;IAK5B,YAAY,KAAkC;QAC5C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAA;IAC1C,CAAC;CACF;AATD,8CASC;AAED,IAAI;AACJ,eAAe;AACf,gCAAgC;AAChC,6BAA6B;AAC7B,6BAA6B;AAC7B,iCAAiC;AACjC,OAAO;AACP,iBAAiB;AACjB,qBAAqB;AACrB,oGAAoG;AACpG,mBAAmB;AACnB,oCAAoC;AACpC,iCAAiC;AACjC,iCAAiC;AACjC,qCAAqC;AACrC,WAAW;AACX,sCAAsC;AACtC,+DAA+D;AAC/D,gDAAgD;AAChD,SAAS;AACT,iBAAiB;AACjB,mDAAmD;AACnD,8BAA8B;AAC9B,wBAAwB;AACxB,SAAS;AACT,wBAAwB;AACxB,oFAAoF;AACpF,6BAA6B;AAC7B,QAAQ;AACR,MAAM;AACN,IAAI"}
|
|
@@ -36,7 +36,7 @@ let ImportStatusHandler = ImportStatusHandler_1 = class ImportStatusHandler {
|
|
|
36
36
|
if (!isTerminalStatus || !isCsvImportJob) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
this.logger.
|
|
39
|
+
this.logger.debug(`Received ${status} master CSV job event for: ${notification.id}`);
|
|
40
40
|
try {
|
|
41
41
|
// 2. Get the full import job entity from DynamoDB.
|
|
42
42
|
const importKey = { pk: notification.pk, sk: notification.sk };
|
|
@@ -48,7 +48,7 @@ let ImportStatusHandler = ImportStatusHandler_1 = class ImportStatusHandler {
|
|
|
48
48
|
// 3. Check if a taskToken was saved in its attributes.
|
|
49
49
|
const taskToken = importJob.attributes?.taskToken;
|
|
50
50
|
if (taskToken) {
|
|
51
|
-
this.logger.
|
|
51
|
+
this.logger.debug(`Found task token. Sending ${status} signal to Step Function.`);
|
|
52
52
|
// 4. Send the appropriate signal based on status.
|
|
53
53
|
if (status === enum_1.ImportStatusEnum.COMPLETED) {
|
|
54
54
|
await this.sendTaskSuccess(taskToken, importJob.result);
|
|
@@ -58,7 +58,7 @@ let ImportStatusHandler = ImportStatusHandler_1 = class ImportStatusHandler {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
this.logger.
|
|
61
|
+
this.logger.debug('No task token found in import job attributes. Nothing to do.');
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
@@ -72,7 +72,7 @@ let ImportStatusHandler = ImportStatusHandler_1 = class ImportStatusHandler {
|
|
|
72
72
|
* @param output The JSON output to send back to the state machine.
|
|
73
73
|
*/
|
|
74
74
|
async sendTaskSuccess(taskToken, output) {
|
|
75
|
-
this.logger.
|
|
75
|
+
this.logger.debug(`Sending task success for token: ${taskToken}`);
|
|
76
76
|
return this.sfnService.client.send(new client_sfn_1.SendTaskSuccessCommand({
|
|
77
77
|
taskToken: taskToken,
|
|
78
78
|
output: JSON.stringify(output),
|
|
@@ -85,7 +85,7 @@ let ImportStatusHandler = ImportStatusHandler_1 = class ImportStatusHandler {
|
|
|
85
85
|
* @param cause The detailed cause of the failure (will be JSON stringified).
|
|
86
86
|
*/
|
|
87
87
|
async sendTaskFailure(taskToken, error, cause) {
|
|
88
|
-
this.logger.
|
|
88
|
+
this.logger.debug(`Sending task failure for token: ${taskToken}`);
|
|
89
89
|
return this.sfnService.client.send(new client_sfn_1.SendTaskFailureCommand({
|
|
90
90
|
taskToken: taskToken,
|
|
91
91
|
error: error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-status.queue.event.handler.js","sourceRoot":"","sources":["../../src/event/import-status.queue.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oDAG4B;AAC5B,oDAMkC;AAClC,2CAAmD;AAEnD,0CAAkD;AAClD,kCAA0C;AAC1C,sDAAiD;AACjD,2EAAoE;AAI7D,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAK9B,YACmB,aAA4B,EAC5B,UAA+B;QAD/B,kBAAa,GAAb,aAAa,CAAe;QAC5B,eAAU,GAAV,UAAU,CAAqB;QAJjC,WAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAA;IAK3D,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAA6B;QACzC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAE3C,sEAAsE;QACtE,MAAM,EAAE,GAAG,YAAY,CAAC,EAAY,CAAA;QACpC,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,MAAM,CAAA;QAE3C,8DAA8D;QAC9D,MAAM,gBAAgB,GACpB,MAAM,KAAK,uBAAgB,CAAC,SAAS;YACrC,MAAM,KAAK,uBAAgB,CAAC,MAAM,CAAA;QACpC,MAAM,cAAc,GAAG,EAAE,EAAE,UAAU,CACnC,GAAG,+BAAoB,GAAG,oBAAa,EAAE,CAC1C,CAAA;QAED,IAAI,CAAC,gBAAgB,IAAI,CAAC,cAAc,EAAE,CAAC;YACzC,OAAM;QACR,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"import-status.queue.event.handler.js","sourceRoot":"","sources":["../../src/event/import-status.queue.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oDAG4B;AAC5B,oDAMkC;AAClC,2CAAmD;AAEnD,0CAAkD;AA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,CAAC,mCAAmC,SAAS,EAAE,CAAC,CAAA;QACjE,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAChC,IAAI,mCAAsB,CAAC;YACzB,SAAS,EAAE,SAAS;YACpB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SAC7B,CAAC,CACH,CAAA;IACH,CAAC;CACF,CAAA;AAtGY,kDAAmB;8BAAnB,mBAAmB;IAF/B,IAAA,mBAAU,GAAE;IACZ,IAAA,mBAAY,EAAC,kDAAsB,CAAC;qCAOD,8BAAa;QAChB,0BAAmB;GAPvC,mBAAmB,CAsG/B"}
|
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* strategy for the record's table type, and executes them sequentially.
|
|
6
6
|
*/
|
|
7
7
|
import { IEventHandler } from '@mbc-cqrs-serverless/core';
|
|
8
|
+
import { ImportPublishMode } from '../constant';
|
|
8
9
|
import { ImportService } from '../import.service';
|
|
9
10
|
import { IProcessStrategy } from '../interface/processing-strategy.interface';
|
|
10
11
|
import { ImportQueueEvent } from './import.queue.event';
|
|
11
12
|
export declare class ImportQueueEventHandler implements IEventHandler<ImportQueueEvent> {
|
|
12
13
|
private readonly importService;
|
|
13
14
|
private readonly strategyMap;
|
|
15
|
+
private readonly publishModeMap;
|
|
14
16
|
private readonly logger;
|
|
15
|
-
constructor(importService: ImportService, strategyMap: Map<string, IProcessStrategy<any, any
|
|
17
|
+
constructor(importService: ImportService, strategyMap: Map<string, IProcessStrategy<any, any>>, publishModeMap: Map<string, ImportPublishMode>);
|
|
16
18
|
execute(event: ImportQueueEvent): Promise<any>;
|
|
17
19
|
/**
|
|
18
20
|
* Orchestrates the processing of a single import record.
|
|
@@ -30,9 +30,10 @@ const import_module_definition_1 = require("../import.module-definition");
|
|
|
30
30
|
const import_service_1 = require("../import.service");
|
|
31
31
|
const import_queue_event_1 = require("./import.queue.event");
|
|
32
32
|
let ImportQueueEventHandler = ImportQueueEventHandler_1 = class ImportQueueEventHandler {
|
|
33
|
-
constructor(importService, strategyMap) {
|
|
33
|
+
constructor(importService, strategyMap, publishModeMap) {
|
|
34
34
|
this.importService = importService;
|
|
35
35
|
this.strategyMap = strategyMap;
|
|
36
|
+
this.publishModeMap = publishModeMap;
|
|
36
37
|
this.logger = new common_1.Logger(ImportQueueEventHandler_1.name);
|
|
37
38
|
}
|
|
38
39
|
async execute(event) {
|
|
@@ -114,7 +115,7 @@ let ImportQueueEventHandler = ImportQueueEventHandler_1 = class ImportQueueEvent
|
|
|
114
115
|
sk: importEntity.sk,
|
|
115
116
|
};
|
|
116
117
|
if (compareResult.status === comparison_status_enum_1.ComparisonStatus.EQUAL) {
|
|
117
|
-
this.logger.
|
|
118
|
+
this.logger.debug(`No changes for import job ${importEntity.id}, marking as completed.`);
|
|
118
119
|
await this.importService.updateStatus(importKey, import_status_enum_1.ImportStatusEnum.COMPLETED, { result: { status: 'EQUAL', message: 'No changes detected.' } });
|
|
119
120
|
const skParts = importEntity.sk.split(core_1.KEY_SEPARATOR);
|
|
120
121
|
const parentId = skParts.slice(0, -1).join(core_1.KEY_SEPARATOR);
|
|
@@ -130,6 +131,8 @@ let ImportQueueEventHandler = ImportQueueEventHandler_1 = class ImportQueueEvent
|
|
|
130
131
|
// The strategy now handles the logic of building the payload.
|
|
131
132
|
const mappedData = await strategy.map(compareResult.status, attributes, tenantCode, compareResult.existingData);
|
|
132
133
|
const commandService = strategy.getCommandService();
|
|
134
|
+
const { type: tableName } = importEntity;
|
|
135
|
+
const publishMode = this.publishModeMap.get(tableName) ?? constant_1.ImportPublishMode.ASYNC;
|
|
133
136
|
let result;
|
|
134
137
|
// 3. Execute the appropriate command
|
|
135
138
|
const invokeContext = (0, core_1.extractInvokeContext)();
|
|
@@ -138,14 +141,21 @@ let ImportQueueEventHandler = ImportQueueEventHandler_1 = class ImportQueueEvent
|
|
|
138
141
|
source: importEntity.id,
|
|
139
142
|
};
|
|
140
143
|
if (compareResult.status === comparison_status_enum_1.ComparisonStatus.NOT_EXIST) {
|
|
141
|
-
result =
|
|
144
|
+
result =
|
|
145
|
+
publishMode === constant_1.ImportPublishMode.SYNC
|
|
146
|
+
? await commandService.publishSync(mappedData, options)
|
|
147
|
+
: await commandService.publishAsync(mappedData, options);
|
|
142
148
|
// 4. Finalize the import status as COMPLETED
|
|
143
149
|
await this.importService.updateStatus(importKey, import_status_enum_1.ImportStatusEnum.PROCESSING, { result: result });
|
|
144
|
-
this.logger.
|
|
150
|
+
this.logger.debug(`Successfully completed import job: ${importKey.pk}#${importKey.sk} with publish mode: ${publishMode}`);
|
|
145
151
|
}
|
|
146
152
|
else {
|
|
147
|
-
result =
|
|
153
|
+
result =
|
|
154
|
+
publishMode === constant_1.ImportPublishMode.SYNC
|
|
155
|
+
? await commandService.publishPartialUpdateSync(mappedData, options)
|
|
156
|
+
: await commandService.publishPartialUpdateAsync(mappedData, options);
|
|
148
157
|
await this.importService.updateStatus(importKey, import_status_enum_1.ImportStatusEnum.PROCESSING, { result: result });
|
|
158
|
+
this.logger.debug(`Successfully completed import job: ${importKey.pk}#${importKey.sk} with publish mode: ${publishMode}`);
|
|
149
159
|
}
|
|
150
160
|
}
|
|
151
161
|
};
|
|
@@ -153,7 +163,9 @@ exports.ImportQueueEventHandler = ImportQueueEventHandler;
|
|
|
153
163
|
exports.ImportQueueEventHandler = ImportQueueEventHandler = ImportQueueEventHandler_1 = __decorate([
|
|
154
164
|
(0, core_1.EventHandler)(import_queue_event_1.ImportQueueEvent),
|
|
155
165
|
__param(1, (0, common_1.Inject)(import_module_definition_1.PROCESS_STRATEGY_MAP)),
|
|
166
|
+
__param(2, (0, common_1.Inject)(import_module_definition_1.PUBLISH_MODE_MAP)),
|
|
156
167
|
__metadata("design:paramtypes", [import_service_1.ImportService,
|
|
168
|
+
Map,
|
|
157
169
|
Map])
|
|
158
170
|
], ImportQueueEventHandler);
|
|
159
171
|
//# sourceMappingURL=import.queue.event.handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.queue.event.handler.js","sourceRoot":"","sources":["../../src/event/import.queue.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,oDAQkC;AAClC,2CAA+C;AAE/C,
|
|
1
|
+
{"version":3,"file":"import.queue.event.handler.js","sourceRoot":"","sources":["../../src/event/import.queue.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,oDAQkC;AAClC,2CAA+C;AAE/C,0CAIoB;AAEpB,2EAAiE;AACjE,mEAA6D;AAC7D,wCAAoC;AACpC,0EAGoC;AACpC,sDAAiD;AAEjD,6DAAuD;AAGhD,IAAM,uBAAuB,+BAA7B,MAAM,uBAAuB;IAKlC,YACmB,aAA4B,EAE7C,WAAqE,EAErE,cAA+D;QAJ9C,kBAAa,GAAb,aAAa,CAAe;QAE5B,gBAAW,GAAX,WAAW,CAAyC;QAEpD,mBAAc,GAAd,cAAc,CAAgC;QAPhD,WAAM,GAAG,IAAI,eAAM,CAAC,yBAAuB,CAAC,IAAI,CAAC,CAAA;IAQ/D,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAAuB;QACnC,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,CAAA;QAEnD,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,2BAAgB,GAAG,oBAAa,EAAE,CAAC,EAAE,CAAC;YACvE,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,yDAAyD,YAAY,CAAC,EAAE,EAAE,CAC3E,CAAA;YACD,OAAM;QACR,CAAC;QAED,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,KAAuB;QACxC,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,SAAS,CAAA;QAC7C,MAAM,YAAY,GAAG,KAAK,CAAC,WA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H,CAAC;CACF,CAAA;AAnNY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAY,EAAC,qCAAgB,CAAC;IAQ1B,WAAA,IAAA,eAAM,EAAC,+CAAoB,CAAC,CAAA;IAE5B,WAAA,IAAA,eAAM,EAAC,2CAAgB,CAAC,CAAA;qCAHO,8BAAa;QAEf,GAAG;QAEA,GAAG;GAV3B,uBAAuB,CAmNnC"}
|
|
@@ -28,7 +28,7 @@ let ZipImportSfnEventHandler = ZipImportSfnEventHandler_1 = class ZipImportSfnEv
|
|
|
28
28
|
}
|
|
29
29
|
async execute(event) {
|
|
30
30
|
const stateName = event.context.State.Name;
|
|
31
|
-
this.logger.
|
|
31
|
+
this.logger.debug(`Executing state: ${stateName} for Zip SFN`);
|
|
32
32
|
if (stateName === 'trigger_single_csv_and_wait') {
|
|
33
33
|
return this.triggerSingleCsvJob(event);
|
|
34
34
|
}
|
|
@@ -46,7 +46,7 @@ let ZipImportSfnEventHandler = ZipImportSfnEventHandler_1 = class ZipImportSfnEv
|
|
|
46
46
|
const s3Key = event.input?.s3Key || event.input;
|
|
47
47
|
const { taskToken } = event;
|
|
48
48
|
const { masterJobKey, parameters } = event.context.Execution.Input;
|
|
49
|
-
this.logger.
|
|
49
|
+
this.logger.debug(`Triggering CSV job for file: ${s3Key}`);
|
|
50
50
|
let tableName = parameters.tableName;
|
|
51
51
|
if (!tableName) {
|
|
52
52
|
// Use a regex to extract the table name from the filename.
|
|
@@ -65,7 +65,7 @@ let ZipImportSfnEventHandler = ZipImportSfnEventHandler_1 = class ZipImportSfnEv
|
|
|
65
65
|
tableName: tableName,
|
|
66
66
|
};
|
|
67
67
|
await this.importService.createCsvJobWithTaskToken(dto, taskToken, masterJobKey);
|
|
68
|
-
this.logger.
|
|
68
|
+
this.logger.debug(`Successfully created CSV job for ${tableName} with task token.`);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Handles the final state of the orchestrator.
|
|
@@ -76,7 +76,7 @@ let ZipImportSfnEventHandler = ZipImportSfnEventHandler_1 = class ZipImportSfnEv
|
|
|
76
76
|
const resultsFromMapState = event.input?.processingResults ||
|
|
77
77
|
event.input; // This will be an array of results
|
|
78
78
|
const { masterJobKey } = event.context.Execution.Input;
|
|
79
|
-
this.logger.
|
|
79
|
+
this.logger.debug(`Finalizing ZIP master job: ${masterJobKey.pk}#${masterJobKey.sk}`);
|
|
80
80
|
this.logger.debug('Aggregated results:', resultsFromMapState);
|
|
81
81
|
// Aggregate the results from each CSV file's processing.
|
|
82
82
|
const finalSummary = resultsFromMapState.reduce((acc, result) => {
|
|
@@ -92,7 +92,7 @@ let ZipImportSfnEventHandler = ZipImportSfnEventHandler_1 = class ZipImportSfnEv
|
|
|
92
92
|
await this.importService.updateStatus(masterJobKey, finalStatus, {
|
|
93
93
|
result: finalSummary,
|
|
94
94
|
});
|
|
95
|
-
this.logger.
|
|
95
|
+
this.logger.debug(`Successfully finalized ZIP master job ${masterJobKey.pk}#${masterJobKey.sk} with status ${finalStatus}`);
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Executes all registered ZIP finalization hooks in parallel.
|
|
@@ -103,7 +103,7 @@ let ZipImportSfnEventHandler = ZipImportSfnEventHandler_1 = class ZipImportSfnEv
|
|
|
103
103
|
this.logger.debug('No ZIP finalization hooks registered');
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
this.logger.
|
|
106
|
+
this.logger.debug(`Executing ${this.finalizationHooks.length} ZIP finalization hook(s)`);
|
|
107
107
|
const context = {
|
|
108
108
|
event,
|
|
109
109
|
masterJobKey,
|
|
@@ -114,9 +114,9 @@ let ZipImportSfnEventHandler = ZipImportSfnEventHandler_1 = class ZipImportSfnEv
|
|
|
114
114
|
// Execute all hooks in parallel with error isolation
|
|
115
115
|
const hookPromises = this.finalizationHooks.map(async (hook, index) => {
|
|
116
116
|
try {
|
|
117
|
-
this.logger.
|
|
117
|
+
this.logger.debug(`Executing ZIP finalization hook ${index + 1}/${this.finalizationHooks.length}`);
|
|
118
118
|
await hook.execute(context);
|
|
119
|
-
this.logger.
|
|
119
|
+
this.logger.debug(`ZIP finalization hook ${index + 1} completed successfully`);
|
|
120
120
|
}
|
|
121
121
|
catch (error) {
|
|
122
122
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -126,7 +126,7 @@ let ZipImportSfnEventHandler = ZipImportSfnEventHandler_1 = class ZipImportSfnEv
|
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
await Promise.allSettled(hookPromises);
|
|
129
|
-
this.logger.
|
|
129
|
+
this.logger.debug(`All ZIP finalization hooks completed`);
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
132
|
exports.ZipImportSfnEventHandler = ZipImportSfnEventHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zip-import.sfn.event.handler.js","sourceRoot":"","sources":["../../src/event/zip-import.sfn.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA2D;AAG3D,kCAA0D;AAC1D,0EAAoE;AACpE,sDAAiD;AAKjD,iEAA0D;AAInD,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAKnC,YACmB,aAA4B,EAE7C,iBAA0D;QAFzC,kBAAa,GAAb,aAAa,CAAe;QAE5B,sBAAiB,GAAjB,iBAAiB,CAAwB;QAL3C,WAAM,GAAW,IAAI,eAAM,CAAC,0BAAwB,CAAC,IAAI,CAAC,CAAA;IAMxE,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,KAAwB;QACpC,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA;QAC1C,IAAI,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"zip-import.sfn.event.handler.js","sourceRoot":"","sources":["../../src/event/zip-import.sfn.event.handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA2D;AAG3D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AA,IAAA,eAAM,EAAC,iDAAsB,CAAC,CAAA;qCADC,8BAAa;GANpC,wBAAwB,CA0KpC"}
|
|
@@ -6,6 +6,8 @@ import { ImportEntityProfile, IZipFinalizationHook } from './interface';
|
|
|
6
6
|
export declare const IMPORT_STRATEGY_MAP = "ImportStrategyMapInjectToken";
|
|
7
7
|
export declare const PROCESS_STRATEGY_MAP = "ProcessStrategyMapInjectToken";
|
|
8
8
|
export declare const ZIP_FINALIZATION_HOOKS = "ZipFinalizationHooksInjectToken";
|
|
9
|
+
/** Injected value: map from `tableName` to publish mode — see `import-publish.ts`. */
|
|
10
|
+
export declare const PUBLISH_MODE_MAP = "PublishModeMapInjectToken";
|
|
9
11
|
/**
|
|
10
12
|
* The main options object for the ImportModule's `register` method.
|
|
11
13
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.OPTIONS_TYPE = exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = exports.ZIP_FINALIZATION_HOOKS = exports.PROCESS_STRATEGY_MAP = exports.IMPORT_STRATEGY_MAP = void 0;
|
|
4
|
+
exports.OPTIONS_TYPE = exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = exports.PUBLISH_MODE_MAP = exports.ZIP_FINALIZATION_HOOKS = exports.PROCESS_STRATEGY_MAP = exports.IMPORT_STRATEGY_MAP = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* @description Defines the configuration for the dynamic ImportModule using ConfigurableModuleBuilder.
|
|
7
7
|
*/
|
|
@@ -10,6 +10,8 @@ const common_1 = require("@nestjs/common");
|
|
|
10
10
|
exports.IMPORT_STRATEGY_MAP = 'ImportStrategyMapInjectToken';
|
|
11
11
|
exports.PROCESS_STRATEGY_MAP = 'ProcessStrategyMapInjectToken';
|
|
12
12
|
exports.ZIP_FINALIZATION_HOOKS = 'ZipFinalizationHooksInjectToken';
|
|
13
|
+
/** Injected value: map from `tableName` to publish mode — see `import-publish.ts`. */
|
|
14
|
+
exports.PUBLISH_MODE_MAP = 'PublishModeMapInjectToken';
|
|
13
15
|
// --- Configurable Module Setup ---
|
|
14
16
|
_a = new common_1.ConfigurableModuleBuilder()
|
|
15
17
|
// The module will always be configured with the profiles array.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.module-definition.js","sourceRoot":"","sources":["../src/import.module-definition.ts"],"names":[],"mappings":";;;;AAAA;;GAEG;AACH,2CAAgF;AAIhF,0DAA0D;AAC7C,QAAA,mBAAmB,GAAG,8BAA8B,CAAA;AACpD,QAAA,oBAAoB,GAAG,+BAA+B,CAAA;AACtD,QAAA,sBAAsB,GAAG,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"import.module-definition.js","sourceRoot":"","sources":["../src/import.module-definition.ts"],"names":[],"mappings":";;;;AAAA;;GAEG;AACH,2CAAgF;AAIhF,0DAA0D;AAC7C,QAAA,mBAAmB,GAAG,8BAA8B,CAAA;AACpD,QAAA,oBAAoB,GAAG,+BAA+B,CAAA;AACtD,QAAA,sBAAsB,GAAG,iCAAiC,CAAA;AACvE,sFAAsF;AACzE,QAAA,gBAAgB,GAAG,2BAA2B,CAAA;AA8B3D,oCAAoC;AACvB,KACX,IAAI,kCAAyB,EAAuB;IAClD,gEAAgE;KAC/D,SAAS,CACR,EAAE,QAAQ,EAAE,EAAE,EAAE,EAChB,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IACvB,GAAG,UAAU;IACb,QAAQ,EAAE,MAAM,CAAC,QAAQ;CAC1B,CAAC,CACH;KACA,KAAK,EAAE,EAVG,+BAAuB,+BAAE,4BAAoB,4BAAE,oBAAY,mBAU9D"}
|
package/dist/import.module.js
CHANGED
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.ImportModule = void 0;
|
|
10
10
|
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
|
+
const import_publish_1 = require("./constant/import-publish");
|
|
12
13
|
const command_finished_queue_event_handler_1 = require("./event/command-finished.queue.event.handler");
|
|
13
14
|
const csv_import_queue_event_handler_1 = require("./event/csv-import.queue.event.handler");
|
|
14
15
|
const csv_import_sfn_event_handler_1 = require("./event/csv-import.sfn.event.handler");
|
|
@@ -28,6 +29,14 @@ let ImportModule = class ImportModule extends import_module_definition_1.Configu
|
|
|
28
29
|
const dynamicProviders = [
|
|
29
30
|
this.createStrategyMapFactory(import_module_definition_1.IMPORT_STRATEGY_MAP, profiles, (p) => p.importStrategy),
|
|
30
31
|
this.createStrategyMapFactory(import_module_definition_1.PROCESS_STRATEGY_MAP, profiles, (p) => p.processStrategy),
|
|
32
|
+
{
|
|
33
|
+
provide: import_module_definition_1.PUBLISH_MODE_MAP,
|
|
34
|
+
useFactory: () => {
|
|
35
|
+
const map = new Map();
|
|
36
|
+
profiles.forEach((p) => map.set(p.tableName, p.publishMode ?? import_publish_1.ImportPublishMode.ASYNC));
|
|
37
|
+
return map;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
31
40
|
];
|
|
32
41
|
// Add hooks provider
|
|
33
42
|
if (zipFinalizationHooks && zipFinalizationHooks.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.module.js","sourceRoot":"","sources":["../src/import.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAwE;AACxE,2CAAsE;AAEtE,uGAAqF;AACrF,2FAAmF;AACnF,uFAA+E;AAC/E,uEAAiE;AACjE,mFAA4E;AAC5E,iGAA+E;AAC/E,2FAAmF;AACnF,uFAA+E;AAC/E,2DAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"import.module.js","sourceRoot":"","sources":["../src/import.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAwE;AACxE,2CAAsE;AAEtE,8DAA6D;AAC7D,uGAA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,CAAA;gBACF,OAAO,GAAG,CAAA;YACZ,CAAC;YACD,MAAM,EAAE,eAAe;SACxB,CAAA;IACH,CAAC;CACF,CAAA;AA7FY,oCAAY;uBAAZ,YAAY;IAfxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAe,EAAE,kBAAW,CAAC;QACvC,SAAS,EAAE;YACT,8BAAa;YACb,yCAAkB;YAClB,oDAAuB;YACvB,2DAA0B;YAC1B,uDAAwB;YACxB,6DAAsB;YACtB,uDAAmB;YACnB,2DAA0B;YAC1B,uDAAwB;SACzB;QACD,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,YAAY,CA6FxB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Type } from '@nestjs/common';
|
|
2
|
+
import type { ImportPublishMode } from '../constant/import-publish';
|
|
2
3
|
import { IImportStrategy } from './import-strategy.interface';
|
|
3
4
|
import { IProcessStrategy } from './processing-strategy.interface';
|
|
4
5
|
/**
|
|
@@ -20,4 +21,11 @@ export interface ImportEntityProfile {
|
|
|
20
21
|
* Must be a class that adheres to the IProcessStrategy interface.
|
|
21
22
|
*/
|
|
22
23
|
processStrategy: Type<IProcessStrategy<any, any>>;
|
|
24
|
+
/**
|
|
25
|
+
* How commands are published for this entity. Defaults to ASYNC when omitted.
|
|
26
|
+
* For CSV Step Functions, prefer ASYNC for large imports; SYNC implies sequential
|
|
27
|
+
* `publishSync` per row — see `ImportPublishMode` docs in `import-publish.ts`.
|
|
28
|
+
* @see ImportPublishMode
|
|
29
|
+
*/
|
|
30
|
+
publishMode?: ImportPublishMode;
|
|
23
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbc-cqrs-serverless/import",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Import module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mbc",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@mbc-cqrs-serverless/core": "1.1.
|
|
44
|
+
"@mbc-cqrs-serverless/core": "1.1.5",
|
|
45
45
|
"csv-parser": "^3.2.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "49613427dee943fe5d821a1c08661ca28c59a3a4"
|
|
48
48
|
}
|