@memberjunction/core-actions 5.5.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom/utilities/external-change-detection.action.d.ts +4 -0
- package/dist/custom/utilities/external-change-detection.action.d.ts.map +1 -1
- package/dist/custom/utilities/external-change-detection.action.js +40 -7
- package/dist/custom/utilities/external-change-detection.action.js.map +1 -1
- package/package.json +25 -25
|
@@ -4,6 +4,10 @@ import { BaseAction } from "@memberjunction/actions";
|
|
|
4
4
|
* This class provides a simple wrapper to execute the External Change Detection process.
|
|
5
5
|
* Possible params:
|
|
6
6
|
* EntityList - a comma separated list of entity names to detect changes for. If not provided, all eligible entities will be processed.
|
|
7
|
+
* ReplayBatchSize - Number of concurrent record replays to process at once. Default is 20.
|
|
8
|
+
* DetectionBatchSize - Number of entities to process in parallel during detection. Default is 10.
|
|
9
|
+
* AutoReplay - If true, detected changes will be automatically replayed through the entity system. Default is true.
|
|
10
|
+
* StaleTimeoutHours - Number of hours a run can be in progress before it is considered stale. Default is 24.
|
|
7
11
|
*/
|
|
8
12
|
export declare class ExternalChangeDetectionAction extends BaseAction {
|
|
9
13
|
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-change-detection.action.d.ts","sourceRoot":"","sources":["../../../src/custom/utilities/external-change-detection.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMrD
|
|
1
|
+
{"version":3,"file":"external-change-detection.action.d.ts","sourceRoot":"","sources":["../../../src/custom/utilities/external-change-detection.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMrD;;;;;;;;GAQG;AACH,qBACa,6BAA8B,SAAQ,UAAU;cACzC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA0E1F"}
|
|
@@ -12,34 +12,67 @@ import { RegisterClass } from "@memberjunction/global";
|
|
|
12
12
|
* This class provides a simple wrapper to execute the External Change Detection process.
|
|
13
13
|
* Possible params:
|
|
14
14
|
* EntityList - a comma separated list of entity names to detect changes for. If not provided, all eligible entities will be processed.
|
|
15
|
+
* ReplayBatchSize - Number of concurrent record replays to process at once. Default is 20.
|
|
16
|
+
* DetectionBatchSize - Number of entities to process in parallel during detection. Default is 10.
|
|
17
|
+
* AutoReplay - If true, detected changes will be automatically replayed through the entity system. Default is true.
|
|
18
|
+
* StaleTimeoutHours - Number of hours a run can be in progress before it is considered stale. Default is 24.
|
|
15
19
|
*/
|
|
16
20
|
let ExternalChangeDetectionAction = class ExternalChangeDetectionAction extends BaseAction {
|
|
17
21
|
async InternalRunAction(params) {
|
|
18
22
|
const entityListParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'entitylist');
|
|
23
|
+
const replayBatchSizeParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'replaybatchsize' || p.Name.trim().toLowerCase() === 'batchsize');
|
|
24
|
+
const detectionBatchSizeParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'detectionbatchsize');
|
|
25
|
+
const autoReplayParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'autoreplay');
|
|
26
|
+
const staleTimeoutParam = params.Params.find(p => p.Name.trim().toLowerCase() === 'staletimeouthours');
|
|
27
|
+
const replayBatchSize = replayBatchSizeParam && replayBatchSizeParam.Value ? parseInt(replayBatchSizeParam.Value) : 20;
|
|
28
|
+
const detectionBatchSize = detectionBatchSizeParam && detectionBatchSizeParam.Value ? parseInt(detectionBatchSizeParam.Value) : 10;
|
|
29
|
+
const staleTimeoutHours = staleTimeoutParam && staleTimeoutParam.Value ? parseInt(staleTimeoutParam.Value) : 24;
|
|
30
|
+
const autoReplay = autoReplayParam && autoReplayParam.Value !== undefined ?
|
|
31
|
+
(typeof autoReplayParam.Value === 'string' ? autoReplayParam.Value.toLowerCase() === 'true' : !!autoReplayParam.Value) :
|
|
32
|
+
true;
|
|
19
33
|
await ExternalChangeDetectorEngine.Instance.Config(false, params.ContextUser);
|
|
20
34
|
let changes;
|
|
21
35
|
if (entityListParam && entityListParam.Value && entityListParam.Value.length > 0) {
|
|
22
36
|
const md = new Metadata();
|
|
23
37
|
const entityNames = entityListParam.Value.split(',');
|
|
24
|
-
const entities = entityNames.map(entityName => md.EntityByName(entityName));
|
|
25
|
-
changes = await ExternalChangeDetectorEngine.Instance.DetectChangesForEntities(entities);
|
|
38
|
+
const entities = entityNames.map(entityName => md.EntityByName(entityName)).filter(e => !!e);
|
|
39
|
+
changes = await ExternalChangeDetectorEngine.Instance.DetectChangesForEntities(entities, detectionBatchSize);
|
|
26
40
|
}
|
|
27
41
|
else {
|
|
28
|
-
changes = await ExternalChangeDetectorEngine.Instance.DetectChangesForAllEligibleEntities();
|
|
42
|
+
changes = await ExternalChangeDetectorEngine.Instance.DetectChangesForAllEligibleEntities(detectionBatchSize);
|
|
29
43
|
}
|
|
30
44
|
if (changes && changes.Success) {
|
|
45
|
+
const changeCount = changes.Changes ? changes.Changes.length : 0;
|
|
46
|
+
const creations = changes.Changes.filter(c => c.Type === 'Create').length;
|
|
47
|
+
const updates = changes.Changes.filter(c => c.Type === 'Update').length;
|
|
48
|
+
const deletions = changes.Changes.filter(c => c.Type === 'Delete').length;
|
|
49
|
+
const summary = `Detected ${changeCount} changes (Creations: ${creations}, Updates: ${updates}, Deletions: ${deletions}).`;
|
|
50
|
+
if (!autoReplay) {
|
|
51
|
+
return {
|
|
52
|
+
Success: true,
|
|
53
|
+
Message: `${summary} AutoReplay is disabled, so no changes were replayed.`,
|
|
54
|
+
ResultCode: "SUCCESS"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (changeCount === 0) {
|
|
58
|
+
return {
|
|
59
|
+
Success: true,
|
|
60
|
+
Message: "No changes detected.",
|
|
61
|
+
ResultCode: "SUCCESS"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
31
64
|
// attempt to replay the changes
|
|
32
|
-
if (await ExternalChangeDetectorEngine.Instance.ReplayChanges(changes.Changes)) {
|
|
65
|
+
if (await ExternalChangeDetectorEngine.Instance.ReplayChanges(changes.Changes, replayBatchSize, staleTimeoutHours)) {
|
|
33
66
|
return {
|
|
34
67
|
Success: true,
|
|
35
|
-
Message:
|
|
68
|
+
Message: `${summary} All changes replayed successfully.`,
|
|
36
69
|
ResultCode: "SUCCESS"
|
|
37
70
|
};
|
|
38
71
|
}
|
|
39
72
|
else {
|
|
40
73
|
return {
|
|
41
74
|
Success: false,
|
|
42
|
-
Message:
|
|
75
|
+
Message: `${summary} Some or all changes failed to replay. Check the Record Change Replay Runs for details.`,
|
|
43
76
|
ResultCode: "FAILED"
|
|
44
77
|
};
|
|
45
78
|
}
|
|
@@ -47,7 +80,7 @@ let ExternalChangeDetectionAction = class ExternalChangeDetectionAction extends
|
|
|
47
80
|
else {
|
|
48
81
|
return {
|
|
49
82
|
Success: false,
|
|
50
|
-
Message: changes.ErrorMessage,
|
|
83
|
+
Message: changes ? changes.ErrorMessage : "Unknown error during change detection",
|
|
51
84
|
ResultCode: "FAILED"
|
|
52
85
|
};
|
|
53
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-change-detection.action.js","sourceRoot":"","sources":["../../../src/custom/utilities/external-change-detection.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAc,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAyB,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAChH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"external-change-detection.action.js","sourceRoot":"","sources":["../../../src/custom/utilities/external-change-detection.action.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAc,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAyB,4BAA4B,EAAE,MAAM,2CAA2C,CAAC;AAChH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;;;GAQG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,UAAU;IAC/C,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,CAAC;QAC9F,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,CAAC;QACvJ,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,oBAAoB,CAAC,CAAC;QAC9G,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,CAAC;QAC9F,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EA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;gBACpB,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,sBAAsB;oBAC/B,UAAU,EAAE,SAAS;iBACxB,CAAA;YACL,CAAC;YAED,gCAAgC;YAChC,IAAI,MAAM,4BAA4B,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,iBAAiB,CAAC,EAAE,CAAC;gBACjH,OAAO;oBACH,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,GAAG,OAAO,qCAAqC;oBACxD,UAAU,EAAE,SAAS;iBACxB,CAAA;YACL,CAAC;iBACI,CAAC;gBACF,OAAO;oBACH,OAAO,EAAE,KAAK;oBACd,OAAO,EAAE,GAAG,OAAO,yFAAyF;oBAC5G,UAAU,EAAE,QAAQ;iBACvB,CAAA;YACL,CAAC;QACL,CAAC;aACI,CAAC;YACF,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,uCAAuC;gBACjF,UAAU,EAAE,QAAQ;aACvB,CAAA;QACL,CAAC;IACL,CAAC;CACJ,CAAA;AA3EY,6BAA6B;IADzC,aAAa,CAAC,UAAU,EAAE,8BAA8B,CAAC;GAC7C,6BAA6B,CA2EzC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/core-actions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.7.0",
|
|
5
5
|
"description": "Library of generated and custom actions for the core MemberJunction framework. This library is maintained by MemberJunction and includes actions for use within the framework itself.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -24,30 +24,30 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@asamuzakjp/css-color": "^4.1.2",
|
|
26
26
|
"@dagrejs/dagre": "^1.1.8",
|
|
27
|
-
"@memberjunction/actions": "5.
|
|
28
|
-
"@memberjunction/actions-base": "5.
|
|
29
|
-
"@memberjunction/ai": "5.
|
|
30
|
-
"@memberjunction/ai-mcp-client": "5.
|
|
31
|
-
"@memberjunction/ai-agent-manager": "5.
|
|
32
|
-
"@memberjunction/ai-agents": "5.
|
|
33
|
-
"@memberjunction/ai-betty-bot": "5.
|
|
34
|
-
"@memberjunction/ai-core-plus": "5.
|
|
35
|
-
"@memberjunction/ai-engine-base": "5.
|
|
36
|
-
"@memberjunction/ai-prompts": "5.
|
|
37
|
-
"@memberjunction/ai-vector-sync": "5.
|
|
38
|
-
"@memberjunction/aiengine": "5.
|
|
39
|
-
"@memberjunction/code-execution": "5.
|
|
40
|
-
"@memberjunction/communication-engine": "5.
|
|
41
|
-
"@memberjunction/communication-types": "5.
|
|
42
|
-
"@memberjunction/content-autotagging": "5.
|
|
43
|
-
"@memberjunction/core": "5.
|
|
44
|
-
"@memberjunction/core-entities": "5.
|
|
45
|
-
"@memberjunction/core-entities-server": "5.
|
|
46
|
-
"@memberjunction/export-engine": "5.
|
|
47
|
-
"@memberjunction/external-change-detection": "5.
|
|
48
|
-
"@memberjunction/global": "5.
|
|
49
|
-
"@memberjunction/sqlserver-dataprovider": "5.
|
|
50
|
-
"@memberjunction/storage": "5.
|
|
27
|
+
"@memberjunction/actions": "5.7.0",
|
|
28
|
+
"@memberjunction/actions-base": "5.7.0",
|
|
29
|
+
"@memberjunction/ai": "5.7.0",
|
|
30
|
+
"@memberjunction/ai-mcp-client": "5.7.0",
|
|
31
|
+
"@memberjunction/ai-agent-manager": "5.7.0",
|
|
32
|
+
"@memberjunction/ai-agents": "5.7.0",
|
|
33
|
+
"@memberjunction/ai-betty-bot": "5.7.0",
|
|
34
|
+
"@memberjunction/ai-core-plus": "5.7.0",
|
|
35
|
+
"@memberjunction/ai-engine-base": "5.7.0",
|
|
36
|
+
"@memberjunction/ai-prompts": "5.7.0",
|
|
37
|
+
"@memberjunction/ai-vector-sync": "5.7.0",
|
|
38
|
+
"@memberjunction/aiengine": "5.7.0",
|
|
39
|
+
"@memberjunction/code-execution": "5.7.0",
|
|
40
|
+
"@memberjunction/communication-engine": "5.7.0",
|
|
41
|
+
"@memberjunction/communication-types": "5.7.0",
|
|
42
|
+
"@memberjunction/content-autotagging": "5.7.0",
|
|
43
|
+
"@memberjunction/core": "5.7.0",
|
|
44
|
+
"@memberjunction/core-entities": "5.7.0",
|
|
45
|
+
"@memberjunction/core-entities-server": "5.7.0",
|
|
46
|
+
"@memberjunction/export-engine": "5.7.0",
|
|
47
|
+
"@memberjunction/external-change-detection": "5.7.0",
|
|
48
|
+
"@memberjunction/global": "5.7.0",
|
|
49
|
+
"@memberjunction/sqlserver-dataprovider": "5.7.0",
|
|
50
|
+
"@memberjunction/storage": "5.7.0",
|
|
51
51
|
"@types/d3-cloud": "^1.2.9",
|
|
52
52
|
"@types/d3-force": "^3.0.10",
|
|
53
53
|
"@types/d3-hierarchy": "^3.1.7",
|