@memberjunction/core-actions 2.54.0 → 2.56.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/ai/execute-ai-prompt.action.d.ts +94 -0
- package/dist/custom/ai/execute-ai-prompt.action.d.ts.map +1 -0
- package/dist/custom/ai/execute-ai-prompt.action.js +274 -0
- package/dist/custom/ai/execute-ai-prompt.action.js.map +1 -0
- package/dist/custom/communication/slack-webhook.action.d.ts +101 -0
- package/dist/custom/communication/slack-webhook.action.d.ts.map +1 -0
- package/dist/custom/communication/slack-webhook.action.js +269 -0
- package/dist/custom/communication/slack-webhook.action.js.map +1 -0
- package/dist/custom/communication/teams-webhook.action.d.ts +96 -0
- package/dist/custom/communication/teams-webhook.action.d.ts.map +1 -0
- package/dist/custom/communication/teams-webhook.action.js +275 -0
- package/dist/custom/communication/teams-webhook.action.js.map +1 -0
- package/dist/custom/data/aggregate-data.action.d.ts +91 -0
- package/dist/custom/data/aggregate-data.action.d.ts.map +1 -0
- package/dist/custom/data/aggregate-data.action.js +333 -0
- package/dist/custom/data/aggregate-data.action.js.map +1 -0
- package/dist/custom/data/csv-parser.action.d.ts +68 -0
- package/dist/custom/data/csv-parser.action.d.ts.map +1 -0
- package/dist/custom/data/csv-parser.action.js +184 -0
- package/dist/custom/data/csv-parser.action.js.map +1 -0
- package/dist/custom/data/data-mapper.action.d.ts +89 -0
- package/dist/custom/data/data-mapper.action.d.ts.map +1 -0
- package/dist/custom/data/data-mapper.action.js +325 -0
- package/dist/custom/data/data-mapper.action.js.map +1 -0
- package/dist/custom/data/json-transform.action.d.ts +57 -0
- package/dist/custom/data/json-transform.action.d.ts.map +1 -0
- package/dist/custom/data/json-transform.action.js +205 -0
- package/dist/custom/data/json-transform.action.js.map +1 -0
- package/dist/custom/data/xml-parser.action.d.ts +85 -0
- package/dist/custom/data/xml-parser.action.d.ts.map +1 -0
- package/dist/custom/data/xml-parser.action.js +326 -0
- package/dist/custom/data/xml-parser.action.js.map +1 -0
- package/dist/custom/files/excel-reader.action.d.ts +86 -0
- package/dist/custom/files/excel-reader.action.d.ts.map +1 -0
- package/dist/custom/files/excel-reader.action.js +348 -0
- package/dist/custom/files/excel-reader.action.js.map +1 -0
- package/dist/custom/files/excel-writer.action.d.ts +79 -0
- package/dist/custom/files/excel-writer.action.d.ts.map +1 -0
- package/dist/custom/files/excel-writer.action.js +325 -0
- package/dist/custom/files/excel-writer.action.js.map +1 -0
- package/dist/custom/files/file-compress.action.d.ts +90 -0
- package/dist/custom/files/file-compress.action.d.ts.map +1 -0
- package/dist/custom/files/file-compress.action.js +346 -0
- package/dist/custom/files/file-compress.action.js.map +1 -0
- package/dist/custom/files/pdf-extractor.action.d.ts +86 -0
- package/dist/custom/files/pdf-extractor.action.d.ts.map +1 -0
- package/dist/custom/files/pdf-extractor.action.js +247 -0
- package/dist/custom/files/pdf-extractor.action.js.map +1 -0
- package/dist/custom/files/pdf-generator.action.d.ts +70 -0
- package/dist/custom/files/pdf-generator.action.d.ts.map +1 -0
- package/dist/custom/files/pdf-generator.action.js +286 -0
- package/dist/custom/files/pdf-generator.action.js.map +1 -0
- package/dist/custom/integration/api-rate-limiter.action.d.ts +88 -0
- package/dist/custom/integration/api-rate-limiter.action.d.ts.map +1 -0
- package/dist/custom/integration/api-rate-limiter.action.js +363 -0
- package/dist/custom/integration/api-rate-limiter.action.js.map +1 -0
- package/dist/custom/integration/graphql-query.action.d.ts +92 -0
- package/dist/custom/integration/graphql-query.action.d.ts.map +1 -0
- package/dist/custom/integration/graphql-query.action.js +251 -0
- package/dist/custom/integration/graphql-query.action.js.map +1 -0
- package/dist/custom/integration/http-request.action.d.ts +96 -0
- package/dist/custom/integration/http-request.action.d.ts.map +1 -0
- package/dist/custom/integration/http-request.action.js +316 -0
- package/dist/custom/integration/http-request.action.js.map +1 -0
- package/dist/custom/integration/oauth-flow.action.d.ts +130 -0
- package/dist/custom/integration/oauth-flow.action.d.ts.map +1 -0
- package/dist/custom/integration/oauth-flow.action.js +624 -0
- package/dist/custom/integration/oauth-flow.action.js.map +1 -0
- package/dist/custom/security/password-strength.action.d.ts +129 -0
- package/dist/custom/security/password-strength.action.d.ts.map +1 -0
- package/dist/custom/security/password-strength.action.js +463 -0
- package/dist/custom/security/password-strength.action.js.map +1 -0
- package/dist/custom/utilities/base-file-handler.d.ts +54 -0
- package/dist/custom/utilities/base-file-handler.d.ts.map +1 -0
- package/dist/custom/utilities/base-file-handler.js +167 -0
- package/dist/custom/utilities/base-file-handler.js.map +1 -0
- package/dist/custom/utilities/index.d.ts +3 -0
- package/dist/custom/utilities/index.d.ts.map +1 -0
- package/dist/custom/utilities/index.js +19 -0
- package/dist/custom/utilities/index.js.map +1 -0
- package/dist/custom/utilities/json-param-helper.d.ts +33 -0
- package/dist/custom/utilities/json-param-helper.d.ts.map +1 -0
- package/dist/custom/utilities/json-param-helper.js +66 -0
- package/dist/custom/utilities/json-param-helper.js.map +1 -0
- package/dist/custom/web/duckduckgo-rate-limiter.d.ts +85 -0
- package/dist/custom/web/duckduckgo-rate-limiter.d.ts.map +1 -0
- package/dist/custom/web/duckduckgo-rate-limiter.js +257 -0
- package/dist/custom/web/duckduckgo-rate-limiter.js.map +1 -0
- package/dist/custom/web/web-search.action.d.ts +1 -0
- package/dist/custom/web/web-search.action.d.ts.map +1 -1
- package/dist/custom/web/web-search.action.js +48 -20
- package/dist/custom/web/web-search.action.js.map +1 -1
- package/dist/custom/workflow/conditional.action.d.ts +94 -0
- package/dist/custom/workflow/conditional.action.d.ts.map +1 -0
- package/dist/custom/workflow/conditional.action.js +274 -0
- package/dist/custom/workflow/conditional.action.js.map +1 -0
- package/dist/custom/workflow/delay.action.d.ts +76 -0
- package/dist/custom/workflow/delay.action.d.ts.map +1 -0
- package/dist/custom/workflow/delay.action.js +187 -0
- package/dist/custom/workflow/delay.action.js.map +1 -0
- package/dist/custom/workflow/loop.action.d.ts +112 -0
- package/dist/custom/workflow/loop.action.d.ts.map +1 -0
- package/dist/custom/workflow/loop.action.js +380 -0
- package/dist/custom/workflow/loop.action.js.map +1 -0
- package/dist/custom/workflow/parallel-execute.action.d.ts +105 -0
- package/dist/custom/workflow/parallel-execute.action.d.ts.map +1 -0
- package/dist/custom/workflow/parallel-execute.action.js +457 -0
- package/dist/custom/workflow/parallel-execute.action.js.map +1 -0
- package/dist/custom/workflow/retry.action.d.ts +90 -0
- package/dist/custom/workflow/retry.action.d.ts.map +1 -0
- package/dist/custom/workflow/retry.action.js +378 -0
- package/dist/custom/workflow/retry.action.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -1
- package/package.json +25 -10
- package/readme.md +11270 -101
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Action that adds delays to workflows
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Fixed delay
|
|
9
|
+
* await runAction({
|
|
10
|
+
* ActionName: 'Delay',
|
|
11
|
+
* Params: [{
|
|
12
|
+
* Name: 'DelayMs',
|
|
13
|
+
* Value: 5000
|
|
14
|
+
* }]
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Random delay between min and max
|
|
18
|
+
* await runAction({
|
|
19
|
+
* ActionName: 'Delay',
|
|
20
|
+
* Params: [{
|
|
21
|
+
* Name: 'DelayType',
|
|
22
|
+
* Value: 'random'
|
|
23
|
+
* }, {
|
|
24
|
+
* Name: 'MinDelayMs',
|
|
25
|
+
* Value: 1000
|
|
26
|
+
* }, {
|
|
27
|
+
* Name: 'MaxDelayMs',
|
|
28
|
+
* Value: 5000
|
|
29
|
+
* }]
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Delay with message
|
|
33
|
+
* await runAction({
|
|
34
|
+
* ActionName: 'Delay',
|
|
35
|
+
* Params: [{
|
|
36
|
+
* Name: 'DelayMs',
|
|
37
|
+
* Value: 3000
|
|
38
|
+
* }, {
|
|
39
|
+
* Name: 'Message',
|
|
40
|
+
* Value: 'Waiting for external system to process...'
|
|
41
|
+
* }]
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare class DelayAction extends BaseAction {
|
|
46
|
+
/**
|
|
47
|
+
* Adds a delay to the workflow
|
|
48
|
+
*
|
|
49
|
+
* @param params - The action parameters containing:
|
|
50
|
+
* - DelayMs: Delay in milliseconds (required for fixed delay)
|
|
51
|
+
* - DelayType: "fixed" | "random" (default: "fixed")
|
|
52
|
+
* - MinDelayMs: Minimum delay for random delays (required for random)
|
|
53
|
+
* - MaxDelayMs: Maximum delay for random delays (required for random)
|
|
54
|
+
* - Message: Optional message to include in result
|
|
55
|
+
*
|
|
56
|
+
* @returns Success with actual delay applied
|
|
57
|
+
*/
|
|
58
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
59
|
+
/**
|
|
60
|
+
* Perform the actual delay
|
|
61
|
+
*/
|
|
62
|
+
private delay;
|
|
63
|
+
/**
|
|
64
|
+
* Get numeric parameter with default
|
|
65
|
+
*/
|
|
66
|
+
private getNumericParam;
|
|
67
|
+
/**
|
|
68
|
+
* Get parameter value by name (case-insensitive)
|
|
69
|
+
*/
|
|
70
|
+
private getParamValue;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Loader function to ensure the DelayAction class is included in the bundle
|
|
74
|
+
*/
|
|
75
|
+
export declare function LoadDelayAction(): void;
|
|
76
|
+
//# sourceMappingURL=delay.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.action.d.ts","sourceRoot":"","sources":["../../../src/custom/workflow/delay.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBACa,WAAY,SAAQ,UAAU;IAEvC;;;;;;;;;;;OAWG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoGvF;;OAEG;IACH,OAAO,CAAC,KAAK;IAIb;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,aAAa;CAIxB;AAED;;GAEG;AACH,wBAAgB,eAAe,SAE9B"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.LoadDelayAction = exports.DelayAction = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const actions_1 = require("@memberjunction/actions");
|
|
12
|
+
/**
|
|
13
|
+
* Action that adds delays to workflows
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* // Fixed delay
|
|
18
|
+
* await runAction({
|
|
19
|
+
* ActionName: 'Delay',
|
|
20
|
+
* Params: [{
|
|
21
|
+
* Name: 'DelayMs',
|
|
22
|
+
* Value: 5000
|
|
23
|
+
* }]
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Random delay between min and max
|
|
27
|
+
* await runAction({
|
|
28
|
+
* ActionName: 'Delay',
|
|
29
|
+
* Params: [{
|
|
30
|
+
* Name: 'DelayType',
|
|
31
|
+
* Value: 'random'
|
|
32
|
+
* }, {
|
|
33
|
+
* Name: 'MinDelayMs',
|
|
34
|
+
* Value: 1000
|
|
35
|
+
* }, {
|
|
36
|
+
* Name: 'MaxDelayMs',
|
|
37
|
+
* Value: 5000
|
|
38
|
+
* }]
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Delay with message
|
|
42
|
+
* await runAction({
|
|
43
|
+
* ActionName: 'Delay',
|
|
44
|
+
* Params: [{
|
|
45
|
+
* Name: 'DelayMs',
|
|
46
|
+
* Value: 3000
|
|
47
|
+
* }, {
|
|
48
|
+
* Name: 'Message',
|
|
49
|
+
* Value: 'Waiting for external system to process...'
|
|
50
|
+
* }]
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
let DelayAction = class DelayAction extends actions_1.BaseAction {
|
|
55
|
+
/**
|
|
56
|
+
* Adds a delay to the workflow
|
|
57
|
+
*
|
|
58
|
+
* @param params - The action parameters containing:
|
|
59
|
+
* - DelayMs: Delay in milliseconds (required for fixed delay)
|
|
60
|
+
* - DelayType: "fixed" | "random" (default: "fixed")
|
|
61
|
+
* - MinDelayMs: Minimum delay for random delays (required for random)
|
|
62
|
+
* - MaxDelayMs: Maximum delay for random delays (required for random)
|
|
63
|
+
* - Message: Optional message to include in result
|
|
64
|
+
*
|
|
65
|
+
* @returns Success with actual delay applied
|
|
66
|
+
*/
|
|
67
|
+
async InternalRunAction(params) {
|
|
68
|
+
try {
|
|
69
|
+
const delayType = (this.getParamValue(params, 'delaytype') || 'fixed').toLowerCase();
|
|
70
|
+
const message = this.getParamValue(params, 'message');
|
|
71
|
+
let actualDelay;
|
|
72
|
+
if (delayType === 'random') {
|
|
73
|
+
// Random delay
|
|
74
|
+
const minDelay = this.getNumericParam(params, 'mindelayms', 0);
|
|
75
|
+
const maxDelay = this.getNumericParam(params, 'maxdelayms', 0);
|
|
76
|
+
if (minDelay < 0 || maxDelay < 0) {
|
|
77
|
+
return {
|
|
78
|
+
Success: false,
|
|
79
|
+
Message: "Delay values must be non-negative",
|
|
80
|
+
ResultCode: "INVALID_DELAY"
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (minDelay > maxDelay) {
|
|
84
|
+
return {
|
|
85
|
+
Success: false,
|
|
86
|
+
Message: "MinDelayMs must be less than or equal to MaxDelayMs",
|
|
87
|
+
ResultCode: "INVALID_DELAY_RANGE"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// Calculate random delay
|
|
91
|
+
actualDelay = Math.floor(minDelay + Math.random() * (maxDelay - minDelay + 1));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// Fixed delay
|
|
95
|
+
actualDelay = this.getNumericParam(params, 'delayms', 0);
|
|
96
|
+
if (actualDelay < 0) {
|
|
97
|
+
return {
|
|
98
|
+
Success: false,
|
|
99
|
+
Message: "DelayMs must be non-negative",
|
|
100
|
+
ResultCode: "INVALID_DELAY"
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Record start time
|
|
105
|
+
const startTime = Date.now();
|
|
106
|
+
// Perform the delay
|
|
107
|
+
await this.delay(actualDelay);
|
|
108
|
+
// Calculate actual elapsed time
|
|
109
|
+
const elapsedTime = Date.now() - startTime;
|
|
110
|
+
// Add output parameters
|
|
111
|
+
params.Params.push({
|
|
112
|
+
Name: 'ActualDelayMs',
|
|
113
|
+
Type: 'Output',
|
|
114
|
+
Value: actualDelay
|
|
115
|
+
});
|
|
116
|
+
params.Params.push({
|
|
117
|
+
Name: 'ElapsedTimeMs',
|
|
118
|
+
Type: 'Output',
|
|
119
|
+
Value: elapsedTime
|
|
120
|
+
});
|
|
121
|
+
params.Params.push({
|
|
122
|
+
Name: 'DelayType',
|
|
123
|
+
Type: 'Output',
|
|
124
|
+
Value: delayType
|
|
125
|
+
});
|
|
126
|
+
// Build result message
|
|
127
|
+
const resultData = {
|
|
128
|
+
message: message || `Delay completed`,
|
|
129
|
+
delayType: delayType,
|
|
130
|
+
requestedDelayMs: actualDelay,
|
|
131
|
+
actualElapsedMs: elapsedTime,
|
|
132
|
+
timeDifference: elapsedTime - actualDelay
|
|
133
|
+
};
|
|
134
|
+
if (delayType === 'random') {
|
|
135
|
+
resultData.minDelayMs = this.getNumericParam(params, 'mindelayms', 0);
|
|
136
|
+
resultData.maxDelayMs = this.getNumericParam(params, 'maxdelayms', 0);
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
Success: true,
|
|
140
|
+
ResultCode: "DELAY_COMPLETED",
|
|
141
|
+
Message: JSON.stringify(resultData, null, 2)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
return {
|
|
146
|
+
Success: false,
|
|
147
|
+
Message: `Delay action failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
148
|
+
ResultCode: "DELAY_FAILED"
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Perform the actual delay
|
|
154
|
+
*/
|
|
155
|
+
delay(ms) {
|
|
156
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get numeric parameter with default
|
|
160
|
+
*/
|
|
161
|
+
getNumericParam(params, name, defaultValue) {
|
|
162
|
+
const value = this.getParamValue(params, name);
|
|
163
|
+
if (value === undefined || value === null)
|
|
164
|
+
return defaultValue;
|
|
165
|
+
const num = Number(value);
|
|
166
|
+
return isNaN(num) ? defaultValue : num;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get parameter value by name (case-insensitive)
|
|
170
|
+
*/
|
|
171
|
+
getParamValue(params, name) {
|
|
172
|
+
const param = params.Params.find(p => p.Name.toLowerCase() === name.toLowerCase());
|
|
173
|
+
return param?.Value;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
exports.DelayAction = DelayAction;
|
|
177
|
+
exports.DelayAction = DelayAction = __decorate([
|
|
178
|
+
(0, global_1.RegisterClass)(actions_1.BaseAction, "Delay")
|
|
179
|
+
], DelayAction);
|
|
180
|
+
/**
|
|
181
|
+
* Loader function to ensure the DelayAction class is included in the bundle
|
|
182
|
+
*/
|
|
183
|
+
function LoadDelayAction() {
|
|
184
|
+
// Stub function to prevent tree shaking
|
|
185
|
+
}
|
|
186
|
+
exports.LoadDelayAction = LoadDelayAction;
|
|
187
|
+
//# sourceMappingURL=delay.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.action.js","sourceRoot":"","sources":["../../../src/custom/workflow/delay.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,qDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,oBAAU;IAEvC;;;;;;;;;;;OAWG;IACO,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;YACrF,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YAEtD,IAAI,WAAmB,CAAC;YAExB,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;gBACzB,eAAe;gBACf,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;gBAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,E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O,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,MAAuB,EAAE,IAAY,EAAE,YAAoB;QAC/E,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,YAAY,CAAC;QAC/D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC;IAC3C,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,MAAuB,EAAE,IAAY;QACvD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACnF,OAAO,KAAK,EAAE,KAAK,CAAC;IACxB,CAAC;CACJ,CAAA;AA1IY,kCAAW;sBAAX,WAAW;IADvB,IAAA,sBAAa,EAAC,oBAAU,EAAE,OAAO,CAAC;GACtB,WAAW,CA0IvB;AAED;;GAEG;AACH,SAAgB,eAAe;IAC3B,wCAAwC;AAC5C,CAAC;AAFD,0CAEC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Action that iterates over collections executing actions for each item
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Process array of items
|
|
9
|
+
* await runAction({
|
|
10
|
+
* ActionName: 'Loop',
|
|
11
|
+
* Params: [{
|
|
12
|
+
* Name: 'Items',
|
|
13
|
+
* Value: [
|
|
14
|
+
* { name: 'John', email: 'john@example.com' },
|
|
15
|
+
* { name: 'Jane', email: 'jane@example.com' }
|
|
16
|
+
* ]
|
|
17
|
+
* }, {
|
|
18
|
+
* Name: 'ItemVariableName',
|
|
19
|
+
* Value: 'user'
|
|
20
|
+
* }, {
|
|
21
|
+
* Name: 'Action',
|
|
22
|
+
* Value: {
|
|
23
|
+
* ActionName: 'Send Single Message',
|
|
24
|
+
* Params: {
|
|
25
|
+
* To: '{{user.email}}',
|
|
26
|
+
* Subject: 'Welcome {{user.name}}'
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
* }]
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Parallel processing with limit
|
|
33
|
+
* await runAction({
|
|
34
|
+
* ActionName: 'Loop',
|
|
35
|
+
* Params: [{
|
|
36
|
+
* Name: 'Items',
|
|
37
|
+
* Value: fileUrls
|
|
38
|
+
* }, {
|
|
39
|
+
* Name: 'Parallel',
|
|
40
|
+
* Value: true
|
|
41
|
+
* }, {
|
|
42
|
+
* Name: 'MaxConcurrent',
|
|
43
|
+
* Value: 5
|
|
44
|
+
* }, {
|
|
45
|
+
* Name: 'Action',
|
|
46
|
+
* Value: {
|
|
47
|
+
* ActionName: 'Web Page Content',
|
|
48
|
+
* Params: { URL: '{{item}}' }
|
|
49
|
+
* }
|
|
50
|
+
* }]
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare class LoopAction extends BaseAction {
|
|
55
|
+
/**
|
|
56
|
+
* Iterates over collections executing actions
|
|
57
|
+
*
|
|
58
|
+
* @param params - The action parameters containing:
|
|
59
|
+
* - Items: Array to iterate over (required)
|
|
60
|
+
* - ItemVariableName: Variable name for current item (default: 'item')
|
|
61
|
+
* - IndexVariableName: Variable name for current index (default: 'index')
|
|
62
|
+
* - Action: Action configuration to execute per item (required)
|
|
63
|
+
* - Parallel: Boolean - run iterations in parallel (default: false)
|
|
64
|
+
* - MaxConcurrent: Max parallel executions (default: 10)
|
|
65
|
+
* - ContinueOnError: Boolean - continue if an iteration fails (default: false)
|
|
66
|
+
* - IncludeContext: Additional context to pass to each action (optional)
|
|
67
|
+
*
|
|
68
|
+
* @returns Array of results from each iteration
|
|
69
|
+
*/
|
|
70
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
71
|
+
/**
|
|
72
|
+
* Execute a single iteration
|
|
73
|
+
*/
|
|
74
|
+
private executeIteration;
|
|
75
|
+
/**
|
|
76
|
+
* Prepare action configuration with template replacement
|
|
77
|
+
*/
|
|
78
|
+
private prepareActionConfig;
|
|
79
|
+
/**
|
|
80
|
+
* Replace template variables in object recursively
|
|
81
|
+
*/
|
|
82
|
+
private replaceTemplates;
|
|
83
|
+
/**
|
|
84
|
+
* Replace template variables in a string
|
|
85
|
+
*/
|
|
86
|
+
private replaceTemplateString;
|
|
87
|
+
/**
|
|
88
|
+
* Get value from object by dot-notation path
|
|
89
|
+
*/
|
|
90
|
+
private getValueByPath;
|
|
91
|
+
/**
|
|
92
|
+
* Chunk array into smaller arrays
|
|
93
|
+
*/
|
|
94
|
+
private chunkArray;
|
|
95
|
+
/**
|
|
96
|
+
* Get numeric parameter with default
|
|
97
|
+
*/
|
|
98
|
+
private getNumericParam;
|
|
99
|
+
/**
|
|
100
|
+
* Get boolean parameter with default
|
|
101
|
+
*/
|
|
102
|
+
private getBooleanParam;
|
|
103
|
+
/**
|
|
104
|
+
* Get parameter value by name (case-insensitive)
|
|
105
|
+
*/
|
|
106
|
+
private getParamValue;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Loader function to ensure the LoopAction class is included in the bundle
|
|
110
|
+
*/
|
|
111
|
+
export declare function LoadLoopAction(): void;
|
|
112
|
+
//# sourceMappingURL=loop.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.action.d.ts","sourceRoot":"","sources":["../../../src/custom/workflow/loop.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,qBACa,UAAW,SAAQ,UAAU;IAEtC;;;;;;;;;;;;;;OAcG;cACa,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA8LvF;;OAEG;YACW,gBAAgB;IAgC9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAqBxB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAS7B;;OAEG;IACH,OAAO,CAAC,cAAc;IAetB;;OAEG;IACH,OAAO,CAAC,UAAU;IAQlB;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAUvB;;OAEG;IACH,OAAO,CAAC,aAAa;CAIxB;AAED;;GAEG;AACH,wBAAgB,cAAc,SAE7B"}
|