@fsai-flow/core 0.0.4 → 0.0.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.
Files changed (80) hide show
  1. package/dist/package.json +1 -1
  2. package/package.json +2 -2
  3. package/dist/src/index.d.ts +0 -16
  4. package/dist/src/index.js +0 -30
  5. package/dist/src/index.js.map +0 -1
  6. package/dist/src/lib/ActiveWebhooks.d.ts +0 -59
  7. package/dist/src/lib/ActiveWebhooks.js +0 -184
  8. package/dist/src/lib/ActiveWebhooks.js.map +0 -1
  9. package/dist/src/lib/ActiveWorkflows.d.ts +0 -87
  10. package/dist/src/lib/ActiveWorkflows.js +0 -456
  11. package/dist/src/lib/ActiveWorkflows.js.map +0 -1
  12. package/dist/src/lib/BinaryDataManager/FileSystem.d.ts +0 -26
  13. package/dist/src/lib/BinaryDataManager/FileSystem.js +0 -179
  14. package/dist/src/lib/BinaryDataManager/FileSystem.js.map +0 -1
  15. package/dist/src/lib/BinaryDataManager/index.d.ts +0 -21
  16. package/dist/src/lib/BinaryDataManager/index.js +0 -146
  17. package/dist/src/lib/BinaryDataManager/index.js.map +0 -1
  18. package/dist/src/lib/ChangeCase.d.ts +0 -9
  19. package/dist/src/lib/ChangeCase.js +0 -43
  20. package/dist/src/lib/ChangeCase.js.map +0 -1
  21. package/dist/src/lib/Constants.d.ts +0 -14
  22. package/dist/src/lib/Constants.js +0 -19
  23. package/dist/src/lib/Constants.js.map +0 -1
  24. package/dist/src/lib/Credentials.d.ts +0 -27
  25. package/dist/src/lib/Credentials.js +0 -89
  26. package/dist/src/lib/Credentials.js.map +0 -1
  27. package/dist/src/lib/FileSystem.d.ts +0 -26
  28. package/dist/src/lib/FileSystem.js +0 -179
  29. package/dist/src/lib/FileSystem.js.map +0 -1
  30. package/dist/src/lib/InputConnectionDataLegacy.d.ts +0 -2
  31. package/dist/src/lib/InputConnectionDataLegacy.js +0 -79
  32. package/dist/src/lib/InputConnectionDataLegacy.js.map +0 -1
  33. package/dist/src/lib/Interfaces.d.ts +0 -148
  34. package/dist/src/lib/Interfaces.js +0 -3
  35. package/dist/src/lib/Interfaces.js.map +0 -1
  36. package/dist/src/lib/LoadNodeParameterOptions.d.ts +0 -39
  37. package/dist/src/lib/LoadNodeParameterOptions.js +0 -150
  38. package/dist/src/lib/LoadNodeParameterOptions.js.map +0 -1
  39. package/dist/src/lib/NodeExecuteFunctions.d.ts +0 -226
  40. package/dist/src/lib/NodeExecuteFunctions.js +0 -2479
  41. package/dist/src/lib/NodeExecuteFunctions.js.map +0 -1
  42. package/dist/src/lib/NodesLoader/constants.d.ts +0 -5
  43. package/dist/src/lib/NodesLoader/constants.js +0 -106
  44. package/dist/src/lib/NodesLoader/constants.js.map +0 -1
  45. package/dist/src/lib/NodesLoader/custom-directory-loader.d.ts +0 -9
  46. package/dist/src/lib/NodesLoader/custom-directory-loader.js +0 -36
  47. package/dist/src/lib/NodesLoader/custom-directory-loader.js.map +0 -1
  48. package/dist/src/lib/NodesLoader/directory-loader.d.ts +0 -66
  49. package/dist/src/lib/NodesLoader/directory-loader.js +0 -325
  50. package/dist/src/lib/NodesLoader/directory-loader.js.map +0 -1
  51. package/dist/src/lib/NodesLoader/index.d.ts +0 -5
  52. package/dist/src/lib/NodesLoader/index.js +0 -12
  53. package/dist/src/lib/NodesLoader/index.js.map +0 -1
  54. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.d.ts +0 -7
  55. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js +0 -52
  56. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js.map +0 -1
  57. package/dist/src/lib/NodesLoader/load-class-in-isolation.d.ts +0 -1
  58. package/dist/src/lib/NodesLoader/load-class-in-isolation.js +0 -22
  59. package/dist/src/lib/NodesLoader/load-class-in-isolation.js.map +0 -1
  60. package/dist/src/lib/NodesLoader/package-directory-loader.d.ts +0 -17
  61. package/dist/src/lib/NodesLoader/package-directory-loader.js +0 -100
  62. package/dist/src/lib/NodesLoader/package-directory-loader.js.map +0 -1
  63. package/dist/src/lib/NodesLoader/types.d.ts +0 -14
  64. package/dist/src/lib/NodesLoader/types.js +0 -3
  65. package/dist/src/lib/NodesLoader/types.js.map +0 -1
  66. package/dist/src/lib/RedisLeaderElectionManager.d.ts +0 -53
  67. package/dist/src/lib/RedisLeaderElectionManager.js +0 -294
  68. package/dist/src/lib/RedisLeaderElectionManager.js.map +0 -1
  69. package/dist/src/lib/UserSettings.d.ts +0 -80
  70. package/dist/src/lib/UserSettings.js +0 -261
  71. package/dist/src/lib/UserSettings.js.map +0 -1
  72. package/dist/src/lib/WorkflowExecute.d.ts +0 -53
  73. package/dist/src/lib/WorkflowExecute.js +0 -854
  74. package/dist/src/lib/WorkflowExecute.js.map +0 -1
  75. package/dist/src/lib/index.d.ts +0 -21
  76. package/dist/src/lib/index.js +0 -146
  77. package/dist/src/lib/index.js.map +0 -1
  78. package/dist/src/utils/crypto.d.ts +0 -1
  79. package/dist/src/utils/crypto.js +0 -8
  80. package/dist/src/utils/crypto.js.map +0 -1
package/dist/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fsai-flow/core",
3
3
  "version": "0.0.4",
4
4
  "dependencies": {
5
- "@fsai-flow/workflow": "workspace:^",
5
+ "@fsai-flow/workflow": "0.0.3",
6
6
  "client-oauth2": "^4.3.3",
7
7
  "cron": "~3.3.0",
8
8
  "crypto-js": "~4.2.0",
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@fsai-flow/core",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "dependencies": {
5
- "@fsai-flow/workflow": "workspace:^",
5
+ "@fsai-flow/workflow": "0.0.3",
6
6
  "client-oauth2": "^4.3.3",
7
7
  "cron": "~3.3.0",
8
8
  "crypto-js": "~4.2.0",
@@ -1,16 +0,0 @@
1
- import * as NodeExecuteFunctions from './lib/NodeExecuteFunctions';
2
- import * as UserSettings from './lib/UserSettings';
3
- import * as getInputConnectionDataLegacy from './lib/InputConnectionDataLegacy';
4
- export * from './lib/ActiveWorkflows';
5
- export * from './lib/ActiveWebhooks';
6
- export * from './lib/BinaryDataManager';
7
- export * from './lib/Constants';
8
- export * from './lib/Credentials';
9
- export * from './lib/Interfaces';
10
- export * from './lib/RedisLeaderElectionManager';
11
- export * from './lib/LoadNodeParameterOptions';
12
- export * from './lib/NodeExecuteFunctions';
13
- export * from './lib/WorkflowExecute';
14
- export * from './lib/ChangeCase';
15
- export * from './lib/NodesLoader';
16
- export { NodeExecuteFunctions, UserSettings, getInputConnectionDataLegacy };
package/dist/src/index.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInputConnectionDataLegacy = exports.UserSettings = exports.NodeExecuteFunctions = void 0;
4
- const tslib_1 = require("tslib");
5
- /* eslint-disable import/no-cycle */
6
- const NodeExecuteFunctions = tslib_1.__importStar(require("./lib/NodeExecuteFunctions"));
7
- exports.NodeExecuteFunctions = NodeExecuteFunctions;
8
- const UserSettings = tslib_1.__importStar(require("./lib/UserSettings"));
9
- exports.UserSettings = UserSettings;
10
- const getInputConnectionDataLegacy = tslib_1.__importStar(require("./lib/InputConnectionDataLegacy"));
11
- exports.getInputConnectionDataLegacy = getInputConnectionDataLegacy;
12
- try {
13
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, import/no-extraneous-dependencies, global-require, @typescript-eslint/no-var-requires
14
- require('source-map-support').install();
15
- // eslint-disable-next-line no-empty
16
- }
17
- catch (error) { }
18
- tslib_1.__exportStar(require("./lib/ActiveWorkflows"), exports);
19
- tslib_1.__exportStar(require("./lib/ActiveWebhooks"), exports);
20
- tslib_1.__exportStar(require("./lib/BinaryDataManager"), exports);
21
- tslib_1.__exportStar(require("./lib/Constants"), exports);
22
- tslib_1.__exportStar(require("./lib/Credentials"), exports);
23
- tslib_1.__exportStar(require("./lib/Interfaces"), exports);
24
- tslib_1.__exportStar(require("./lib/RedisLeaderElectionManager"), exports);
25
- tslib_1.__exportStar(require("./lib/LoadNodeParameterOptions"), exports);
26
- tslib_1.__exportStar(require("./lib/NodeExecuteFunctions"), exports);
27
- tslib_1.__exportStar(require("./lib/WorkflowExecute"), exports);
28
- tslib_1.__exportStar(require("./lib/ChangeCase"), exports);
29
- tslib_1.__exportStar(require("./lib/NodesLoader"), exports);
30
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,oCAAoC;AACpC,yFAAmE;AAuBlE,oDAAoB;AAtBrB,yEAAmD;AAuBlD,oCAAY;AAtBb,sGAAgF;AAuB/E,oEAA4B;AArB7B,IAAI,CAAC;IACJ,gMAAgM;IAChM,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,EAAE,CAAC;IACxC,oCAAoC;AACrC,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC,CAAA,CAAC;AAElB,gEAAsC;AACtC,+DAAqC;AACrC,kEAAwC;AACxC,0DAAgC;AAChC,4DAAkC;AAClC,2DAAiC;AACjC,2EAAiD;AACjD,yEAA+C;AAC/C,qEAA2C;AAC3C,gEAAsC;AACtC,2DAAiC;AACjC,4DAAkC"}
@@ -1,59 +0,0 @@
1
- import { IWebhookData, WebhookHttpMethod, Workflow, WorkflowActivateMode, WorkflowExecuteMode } from '@fsai-flow/workflow';
2
- export declare class ActiveWebhooks {
3
- private workflowWebhooks;
4
- private webhookUrls;
5
- testWebhooks: boolean;
6
- /**
7
- * Adds a new webhook
8
- *
9
- * @param {IWebhookData} webhookData
10
- * @param {WorkflowExecuteMode} mode
11
- * @returns {Promise<void>}
12
- * @memberof ActiveWebhooks
13
- */
14
- add(workflow: Workflow, webhookData: IWebhookData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode): Promise<void>;
15
- /**
16
- * Returns webhookData if a webhook with matches is currently registered
17
- *
18
- * @param {WebhookHttpMethod} httpMethod
19
- * @param {string} path
20
- * @param {(string | undefined)} webhookId
21
- * @returns {(IWebhookData | undefined)}
22
- * @memberof ActiveWebhooks
23
- */
24
- get(httpMethod: WebhookHttpMethod, path: string, webhookId?: string): IWebhookData | undefined;
25
- /**
26
- * Gets all request methods associated with a single webhook
27
- * @param path
28
- */
29
- getWebhookMethods(path: string): string[];
30
- /**
31
- * Returns the ids of all the workflows which have active webhooks
32
- *
33
- * @returns {string[]}
34
- * @memberof ActiveWebhooks
35
- */
36
- getWorkflowIds(): string[];
37
- /**
38
- * Returns key to uniquely identify a webhook
39
- *
40
- * @param {WebhookHttpMethod} httpMethod
41
- * @param {string} path
42
- * @param {(string | undefined)} webhookId
43
- * @returns {string}
44
- * @memberof ActiveWebhooks
45
- */
46
- getWebhookKey(httpMethod: WebhookHttpMethod, path: string, webhookId?: string): string;
47
- /**
48
- * Removes all webhooks of a workflow
49
- *
50
- * @param {Workflow} workflow
51
- * @returns {boolean}
52
- * @memberof ActiveWebhooks
53
- */
54
- removeWorkflow(workflow: Workflow): Promise<boolean>;
55
- /**
56
- * Removes all the webhooks of the given workflows
57
- */
58
- removeAll(workflows: Workflow[]): Promise<void>;
59
- }
@@ -1,184 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActiveWebhooks = void 0;
4
- const tslib_1 = require("tslib");
5
- // eslint-disable-next-line import/no-cycle
6
- const __1 = require("..");
7
- class ActiveWebhooks {
8
- constructor() {
9
- this.workflowWebhooks = {};
10
- this.webhookUrls = {};
11
- this.testWebhooks = false;
12
- }
13
- /**
14
- * Adds a new webhook
15
- *
16
- * @param {IWebhookData} webhookData
17
- * @param {WorkflowExecuteMode} mode
18
- * @returns {Promise<void>}
19
- * @memberof ActiveWebhooks
20
- */
21
- add(workflow, webhookData, mode, activation) {
22
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
- if (workflow.id === undefined) {
24
- throw new Error('Webhooks can only be added for saved workflows as an id is needed!');
25
- }
26
- if (webhookData.path.endsWith('/')) {
27
- // eslint-disable-next-line no-param-reassign
28
- webhookData.path = webhookData.path.slice(0, -1);
29
- }
30
- const webhookKey = this.getWebhookKey(webhookData.httpMethod, webhookData.path, webhookData.webhookId);
31
- // check that there is not a webhook already registed with that path/method
32
- if (this.webhookUrls[webhookKey] && !webhookData.webhookId) {
33
- throw new Error(`The URL path that the "${webhookData.node}" node uses is already taken. Please change it to something else.`);
34
- }
35
- if (this.workflowWebhooks[webhookData.workflowId] === undefined) {
36
- this.workflowWebhooks[webhookData.workflowId] = [];
37
- }
38
- // Make the webhook available directly because sometimes to create it successfully
39
- // it gets called
40
- if (!this.webhookUrls[webhookKey]) {
41
- this.webhookUrls[webhookKey] = [];
42
- }
43
- this.webhookUrls[webhookKey].push(webhookData);
44
- try {
45
- const webhookExists = yield workflow.runWebhookMethod('checkExists', webhookData, __1.NodeExecuteFunctions, mode, activation, this.testWebhooks);
46
- if (webhookExists !== true) {
47
- // If webhook does not exist yet create it
48
- yield workflow.runWebhookMethod('create', webhookData, __1.NodeExecuteFunctions, mode, activation, this.testWebhooks);
49
- }
50
- }
51
- catch (error) {
52
- // If there was a problem unregister the webhook again
53
- if (this.webhookUrls[webhookKey].length <= 1) {
54
- delete this.webhookUrls[webhookKey];
55
- }
56
- else {
57
- this.webhookUrls[webhookKey] = this.webhookUrls[webhookKey].filter((webhook) => webhook.path !== webhookData.path);
58
- }
59
- throw error;
60
- }
61
- this.workflowWebhooks[webhookData.workflowId].push(webhookData);
62
- });
63
- }
64
- /**
65
- * Returns webhookData if a webhook with matches is currently registered
66
- *
67
- * @param {WebhookHttpMethod} httpMethod
68
- * @param {string} path
69
- * @param {(string | undefined)} webhookId
70
- * @returns {(IWebhookData | undefined)}
71
- * @memberof ActiveWebhooks
72
- */
73
- get(httpMethod, path, webhookId) {
74
- const webhookKey = this.getWebhookKey(httpMethod, path, webhookId);
75
- if (this.webhookUrls[webhookKey] === undefined) {
76
- return undefined;
77
- }
78
- let webhook;
79
- let maxMatches = 0;
80
- const pathElementsSet = new Set(path.split('/'));
81
- // check if static elements match in path
82
- // if more results have been returned choose the one with the most static-route matches
83
- this.webhookUrls[webhookKey].forEach((dynamicWebhook) => {
84
- const staticElements = dynamicWebhook.path.split('/').filter((ele) => !ele.startsWith(':'));
85
- const allStaticExist = staticElements.every((staticEle) => pathElementsSet.has(staticEle));
86
- if (allStaticExist && staticElements.length > maxMatches) {
87
- maxMatches = staticElements.length;
88
- webhook = dynamicWebhook;
89
- }
90
- // handle routes with no static elements
91
- else if (staticElements.length === 0 && !webhook) {
92
- webhook = dynamicWebhook;
93
- }
94
- });
95
- return webhook;
96
- }
97
- /**
98
- * Gets all request methods associated with a single webhook
99
- * @param path
100
- */
101
- getWebhookMethods(path) {
102
- const methods = [];
103
- Object.keys(this.webhookUrls)
104
- .filter((key) => key.includes(path))
105
- // eslint-disable-next-line array-callback-return
106
- .map((key) => {
107
- methods.push(key.split('|')[0]);
108
- });
109
- return methods;
110
- }
111
- /**
112
- * Returns the ids of all the workflows which have active webhooks
113
- *
114
- * @returns {string[]}
115
- * @memberof ActiveWebhooks
116
- */
117
- getWorkflowIds() {
118
- return Object.keys(this.workflowWebhooks);
119
- }
120
- /**
121
- * Returns key to uniquely identify a webhook
122
- *
123
- * @param {WebhookHttpMethod} httpMethod
124
- * @param {string} path
125
- * @param {(string | undefined)} webhookId
126
- * @returns {string}
127
- * @memberof ActiveWebhooks
128
- */
129
- getWebhookKey(httpMethod, path, webhookId) {
130
- if (webhookId) {
131
- if (path.startsWith(webhookId)) {
132
- const cutFromIndex = path.indexOf('/') + 1;
133
- // eslint-disable-next-line no-param-reassign
134
- path = path.slice(cutFromIndex);
135
- }
136
- return `${httpMethod}|${webhookId}|${path.split('/').length}`;
137
- }
138
- return `${httpMethod}|${path}`;
139
- }
140
- /**
141
- * Removes all webhooks of a workflow
142
- *
143
- * @param {Workflow} workflow
144
- * @returns {boolean}
145
- * @memberof ActiveWebhooks
146
- */
147
- removeWorkflow(workflow) {
148
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
149
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
150
- const workflowId = workflow.id.toString();
151
- if (this.workflowWebhooks[workflowId] === undefined) {
152
- // If it did not exist then there is nothing to remove
153
- return false;
154
- }
155
- const webhooks = this.workflowWebhooks[workflowId];
156
- const mode = 'internal';
157
- // Go through all the registered webhooks of the workflow and remove them
158
- // eslint-disable-next-line no-restricted-syntax
159
- for (const webhookData of webhooks) {
160
- // eslint-disable-next-line no-await-in-loop
161
- yield workflow.runWebhookMethod('delete', webhookData, __1.NodeExecuteFunctions, mode, 'update', this.testWebhooks);
162
- delete this.webhookUrls[this.getWebhookKey(webhookData.httpMethod, webhookData.path, webhookData.webhookId)];
163
- }
164
- // Remove also the workflow-webhook entry
165
- delete this.workflowWebhooks[workflowId];
166
- return true;
167
- });
168
- }
169
- /**
170
- * Removes all the webhooks of the given workflows
171
- */
172
- removeAll(workflows) {
173
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
174
- const removePromises = [];
175
- // eslint-disable-next-line no-restricted-syntax
176
- for (const workflow of workflows) {
177
- removePromises.push(this.removeWorkflow(workflow));
178
- }
179
- yield Promise.all(removePromises);
180
- });
181
- }
182
- }
183
- exports.ActiveWebhooks = ActiveWebhooks;
184
- //# sourceMappingURL=ActiveWebhooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActiveWebhooks.js","sourceRoot":"","sources":["../../../src/lib/ActiveWebhooks.ts"],"names":[],"mappings":";;;;AAQA,2CAA2C;AAC3C,0BAA0C;AAE1C,MAAa,cAAc;IAA3B;QACS,qBAAgB,GAEpB,EAAE,CAAC;QAEC,gBAAW,GAEf,EAAE,CAAC;QAEP,iBAAY,GAAG,KAAK,CAAC;IAgOtB,CAAC;IA9NA;;;;;;;OAOG;IACG,GAAG,CACR,QAAkB,EAClB,WAAyB,EACzB,IAAyB,EACzB,UAAgC;;YAEhC,IAAI,QAAQ,CAAC,EAAE,KAA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;YACH,CAAC;YAED,yCAAyC;YACzC,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;YAEzC,OAAO,IAAI,CAAC;QACb,CAAC;KAAA;IAED;;OAEG;IACG,SAAS,CAAC,SAAqB;;YACpC,MAAM,cAAc,GAAG,EAAE,CAAC;YAC1B,gDAAgD;YAChD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;gBAClC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;YACpD,CAAC;YAED,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QACnC,CAAC;KAAA;CACD;AAzOD,wCAyOC"}
@@ -1,87 +0,0 @@
1
- import { IGetExecutePollFunctions, IGetExecuteTriggerFunctions, INode, IPollResponse, IWorkflowExecuteAdditionalData, Workflow, WorkflowActivateMode, WorkflowExecuteMode } from '@fsai-flow/workflow';
2
- import { IWorkflowData } from '..';
3
- import { RedisOptions } from 'ioredis';
4
- export declare class ActiveWorkflows {
5
- private workflowData;
6
- private redisConfig;
7
- private instanceLeaderElection;
8
- private pollingWorkflows;
9
- private isLeader;
10
- private isInitializingLeaderElection;
11
- private leaderElectionInitialized;
12
- private leaderElectionEnabled;
13
- constructor(redisConfig?: string | RedisOptions);
14
- /**
15
- * Returns if the workflow is active
16
- *
17
- * @param {string} id The id of the workflow to check
18
- * @returns {boolean}
19
- * @memberof ActiveWorkflows
20
- */
21
- isActive(id: string): boolean;
22
- /**
23
- * Returns the ids of the currently active workflows
24
- *
25
- * @returns {string[]}
26
- * @memberof ActiveWorkflows
27
- */
28
- allActiveWorkflows(): string[];
29
- /**
30
- * Returns the Workflow data for the workflow with
31
- * the given id if it is currently active
32
- *
33
- * @param {string} id
34
- * @returns {(WorkflowData | undefined)}
35
- * @memberof ActiveWorkflows
36
- */
37
- get(id: string): IWorkflowData | undefined;
38
- /**
39
- * Makes a workflow active
40
- *
41
- * @param {string} id The id of the workflow to activate
42
- * @param {Workflow} workflow The workflow to activate
43
- * @param {IWorkflowExecuteAdditionalData} additionalData The additional data which is needed to run workflows
44
- * @returns {Promise<void>}
45
- * @memberof ActiveWorkflows
46
- */
47
- add(id: string, workflow: Workflow, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode, getTriggerFunctions: IGetExecuteTriggerFunctions, getPollFunctions: IGetExecutePollFunctions): Promise<void>;
48
- /**
49
- * Initialize global leader election (called once per instance)
50
- */
51
- private initializeLeaderElection;
52
- /**
53
- * Start all registered polling workflows (called when becoming leader)
54
- */
55
- private startAllPollingWorkflows;
56
- /**
57
- * Stop all polling workflows (called when losing leadership)
58
- */
59
- private stopAllPollingWorkflows;
60
- /**
61
- * Activates polling for the given node with global Redis leader election
62
- *
63
- * @param {INode} node
64
- * @param {Workflow} workflow
65
- * @param {IWorkflowExecuteAdditionalData} additionalData
66
- * @param {IGetExecutePollFunctions} getPollFunctions
67
- * @returns {Promise<IPollResponse>}
68
- * @memberof ActiveWorkflows
69
- */
70
- activatePolling(node: INode, workflow: Workflow, additionalData: IWorkflowExecuteAdditionalData, getPollFunctions: IGetExecutePollFunctions, mode: WorkflowExecuteMode, activation: WorkflowActivateMode): Promise<IPollResponse>;
71
- /**
72
- * Extract cron time building logic (same as original)
73
- */
74
- private buildCronTimes;
75
- /**
76
- * Validate cron times (same as original)
77
- */
78
- private validateCronTimes;
79
- /**
80
- * Makes a workflow inactive
81
- *
82
- * @param {string} id The id of the workflow to deactivate
83
- * @returns {Promise<void>}
84
- * @memberof ActiveWorkflows
85
- */
86
- remove(id: string): Promise<void>;
87
- }