@fsai-flow/core 0.0.4 → 0.1.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.
Files changed (136) hide show
  1. package/dist/index.d.ts +17 -0
  2. package/dist/index.js +61 -0
  3. package/dist/{src/lib → lib}/ActiveWebhooks.d.ts +1 -1
  4. package/dist/lib/ActiveWebhooks.js +177 -0
  5. package/dist/{src/lib → lib}/ActiveWorkflows.d.ts +3 -3
  6. package/dist/lib/ActiveWorkflows.js +465 -0
  7. package/dist/{src/lib → lib}/BinaryDataManager/FileSystem.d.ts +1 -1
  8. package/dist/lib/BinaryDataManager/FileSystem.js +180 -0
  9. package/dist/{src/lib → lib}/BinaryDataManager/index.d.ts +2 -2
  10. package/dist/lib/BinaryDataManager/index.js +129 -0
  11. package/dist/{src/lib → lib}/ChangeCase.js +11 -11
  12. package/dist/lib/Constants.js +18 -0
  13. package/dist/{src/lib → lib}/Credentials.d.ts +1 -1
  14. package/dist/{src/lib → lib}/Credentials.js +7 -8
  15. package/dist/{src/lib → lib}/FileSystem.d.ts +1 -1
  16. package/dist/lib/FileSystem.js +180 -0
  17. package/dist/{src/lib → lib}/InputConnectionDataLegacy.d.ts +1 -1
  18. package/dist/lib/InputConnectionDataLegacy.js +72 -0
  19. package/dist/{src/lib → lib}/Interfaces.d.ts +47 -48
  20. package/dist/{src/lib → lib}/Interfaces.js +0 -1
  21. package/dist/{src/lib → lib}/LoadNodeParameterOptions.d.ts +1 -1
  22. package/dist/lib/LoadNodeParameterOptions.js +152 -0
  23. package/dist/{src/lib → lib}/NodeExecuteFunctions.d.ts +9 -10
  24. package/dist/lib/NodeExecuteFunctions.js +2467 -0
  25. package/dist/{src/lib → lib}/NodesLoader/constants.d.ts +1 -1
  26. package/dist/lib/NodesLoader/constants.js +105 -0
  27. package/dist/{src/lib → lib}/NodesLoader/custom-directory-loader.d.ts +1 -1
  28. package/dist/lib/NodesLoader/custom-directory-loader.js +35 -0
  29. package/dist/{src/lib → lib}/NodesLoader/directory-loader.d.ts +1 -1
  30. package/dist/{src/lib → lib}/NodesLoader/directory-loader.js +80 -38
  31. package/dist/lib/NodesLoader/index.d.ts +5 -0
  32. package/dist/{src/lib → lib}/NodesLoader/index.js +5 -6
  33. package/dist/{src/lib → lib}/NodesLoader/lazy-package-directory-loader.d.ts +1 -1
  34. package/dist/lib/NodesLoader/lazy-package-directory-loader.js +44 -0
  35. package/dist/{src/lib → lib}/NodesLoader/load-class-in-isolation.js +6 -11
  36. package/dist/{src/lib → lib}/NodesLoader/package-directory-loader.d.ts +2 -2
  37. package/dist/{src/lib → lib}/NodesLoader/package-directory-loader.js +28 -36
  38. package/dist/{src/lib → lib}/NodesLoader/types.js +0 -1
  39. package/dist/{src/lib → lib}/RedisLeaderElectionManager.d.ts +1 -1
  40. package/dist/lib/RedisLeaderElectionManager.js +279 -0
  41. package/dist/lib/RequestTypes.d.ts +58 -0
  42. package/dist/lib/RequestTypes.js +8 -0
  43. package/dist/{src/lib → lib}/UserSettings.d.ts +1 -1
  44. package/dist/lib/UserSettings.js +269 -0
  45. package/dist/{src/lib → lib}/WorkflowExecute.d.ts +4 -4
  46. package/dist/{src/lib → lib}/WorkflowExecute.js +230 -178
  47. package/dist/{src/lib → lib}/index.d.ts +2 -2
  48. package/dist/lib/index.js +129 -0
  49. package/dist/{src/utils → utils}/crypto.js +2 -3
  50. package/package.json +59 -52
  51. package/dist/README.md +0 -31
  52. package/dist/package.json +0 -54
  53. package/dist/src/index.d.ts +0 -16
  54. package/dist/src/index.js +0 -30
  55. package/dist/src/index.js.map +0 -1
  56. package/dist/src/lib/ActiveWebhooks.js +0 -184
  57. package/dist/src/lib/ActiveWebhooks.js.map +0 -1
  58. package/dist/src/lib/ActiveWorkflows.js +0 -456
  59. package/dist/src/lib/ActiveWorkflows.js.map +0 -1
  60. package/dist/src/lib/BinaryDataManager/FileSystem.js +0 -179
  61. package/dist/src/lib/BinaryDataManager/FileSystem.js.map +0 -1
  62. package/dist/src/lib/BinaryDataManager/index.js +0 -146
  63. package/dist/src/lib/BinaryDataManager/index.js.map +0 -1
  64. package/dist/src/lib/ChangeCase.js.map +0 -1
  65. package/dist/src/lib/Constants.js +0 -19
  66. package/dist/src/lib/Constants.js.map +0 -1
  67. package/dist/src/lib/Credentials.js.map +0 -1
  68. package/dist/src/lib/FileSystem.js +0 -179
  69. package/dist/src/lib/FileSystem.js.map +0 -1
  70. package/dist/src/lib/InputConnectionDataLegacy.js +0 -79
  71. package/dist/src/lib/InputConnectionDataLegacy.js.map +0 -1
  72. package/dist/src/lib/Interfaces.js.map +0 -1
  73. package/dist/src/lib/LoadNodeParameterOptions.js +0 -150
  74. package/dist/src/lib/LoadNodeParameterOptions.js.map +0 -1
  75. package/dist/src/lib/NodeExecuteFunctions.js +0 -2479
  76. package/dist/src/lib/NodeExecuteFunctions.js.map +0 -1
  77. package/dist/src/lib/NodesLoader/constants.js +0 -106
  78. package/dist/src/lib/NodesLoader/constants.js.map +0 -1
  79. package/dist/src/lib/NodesLoader/custom-directory-loader.js +0 -36
  80. package/dist/src/lib/NodesLoader/custom-directory-loader.js.map +0 -1
  81. package/dist/src/lib/NodesLoader/directory-loader.js.map +0 -1
  82. package/dist/src/lib/NodesLoader/index.d.ts +0 -5
  83. package/dist/src/lib/NodesLoader/index.js.map +0 -1
  84. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js +0 -52
  85. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js.map +0 -1
  86. package/dist/src/lib/NodesLoader/load-class-in-isolation.js.map +0 -1
  87. package/dist/src/lib/NodesLoader/package-directory-loader.js.map +0 -1
  88. package/dist/src/lib/NodesLoader/types.js.map +0 -1
  89. package/dist/src/lib/RedisLeaderElectionManager.js +0 -294
  90. package/dist/src/lib/RedisLeaderElectionManager.js.map +0 -1
  91. package/dist/src/lib/UserSettings.js +0 -261
  92. package/dist/src/lib/UserSettings.js.map +0 -1
  93. package/dist/src/lib/WorkflowExecute.js.map +0 -1
  94. package/dist/src/lib/index.js +0 -146
  95. package/dist/src/lib/index.js.map +0 -1
  96. package/dist/src/utils/crypto.js.map +0 -1
  97. package/eslint.config.js +0 -19
  98. package/jest.config.ts +0 -10
  99. package/project.json +0 -19
  100. package/src/index.ts +0 -28
  101. package/src/lib/ActiveWebhooks.ts +0 -245
  102. package/src/lib/ActiveWorkflows.ts +0 -575
  103. package/src/lib/BinaryDataManager/FileSystem.ts +0 -214
  104. package/src/lib/BinaryDataManager/index.ts +0 -187
  105. package/src/lib/ChangeCase.ts +0 -45
  106. package/src/lib/Constants.ts +0 -16
  107. package/src/lib/Credentials.ts +0 -108
  108. package/src/lib/FileSystem.ts +0 -214
  109. package/src/lib/InputConnectionDataLegacy.ts +0 -123
  110. package/src/lib/Interfaces.ts +0 -338
  111. package/src/lib/LoadNodeParameterOptions.ts +0 -235
  112. package/src/lib/NodeExecuteFunctions.ts +0 -3700
  113. package/src/lib/NodesLoader/constants.ts +0 -112
  114. package/src/lib/NodesLoader/custom-directory-loader.ts +0 -31
  115. package/src/lib/NodesLoader/directory-loader.ts +0 -458
  116. package/src/lib/NodesLoader/index.ts +0 -5
  117. package/src/lib/NodesLoader/lazy-package-directory-loader.ts +0 -55
  118. package/src/lib/NodesLoader/load-class-in-isolation.ts +0 -19
  119. package/src/lib/NodesLoader/package-directory-loader.ts +0 -107
  120. package/src/lib/NodesLoader/types.ts +0 -14
  121. package/src/lib/RedisLeaderElectionManager.ts +0 -334
  122. package/src/lib/UserSettings.ts +0 -292
  123. package/src/lib/WorkflowExecute.ts +0 -1128
  124. package/src/lib/index.ts +0 -187
  125. package/src/utils/crypto.ts +0 -5
  126. package/tests/Credentials.test.ts +0 -88
  127. package/tests/Helpers.ts +0 -808
  128. package/tests/WorkflowExecute.test.ts +0 -1242
  129. package/tsconfig.json +0 -41
  130. package/tsconfig.lib.json +0 -10
  131. package/tsconfig.spec.json +0 -14
  132. /package/dist/{src/lib → lib}/ChangeCase.d.ts +0 -0
  133. /package/dist/{src/lib → lib}/Constants.d.ts +0 -0
  134. /package/dist/{src/lib → lib}/NodesLoader/load-class-in-isolation.d.ts +0 -0
  135. /package/dist/{src/lib → lib}/NodesLoader/types.d.ts +0 -0
  136. /package/dist/{src/utils → utils}/crypto.d.ts +0 -0
@@ -1,5 +1,5 @@
1
- import { IBinaryData, INodeExecutionData } from '@fsai-flow/workflow';
2
- import { IBinaryDataConfig } from './Interfaces';
1
+ import type { IBinaryData, INodeExecutionData } from "@fsai-flow/workflow";
2
+ import type { IBinaryDataConfig } from "./Interfaces";
3
3
  export declare class BinaryDataManager {
4
4
  private static instance;
5
5
  private managers;
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BinaryDataManager = void 0;
4
+ const Constants_1 = require("./Constants");
5
+ const FileSystem_1 = require("./FileSystem");
6
+ class BinaryDataManager {
7
+ constructor(config) {
8
+ this.binaryDataMode = config.mode;
9
+ this.availableModes = config.availableModes.split(",");
10
+ this.managers = {};
11
+ }
12
+ static async init(config, mainManager = false) {
13
+ if (BinaryDataManager.instance) {
14
+ throw new Error("Binary Data Manager already initialized");
15
+ }
16
+ BinaryDataManager.instance = new BinaryDataManager(config);
17
+ if (BinaryDataManager.instance.availableModes.includes("filesystem")) {
18
+ BinaryDataManager.instance.managers["filesystem"] =
19
+ new FileSystem_1.BinaryDataFileSystem(config);
20
+ await BinaryDataManager.instance.managers["filesystem"].init(mainManager);
21
+ }
22
+ return undefined;
23
+ }
24
+ static getInstance() {
25
+ if (!BinaryDataManager.instance) {
26
+ throw new Error("Binary Data Manager not initialized");
27
+ }
28
+ return BinaryDataManager.instance;
29
+ }
30
+ async storeBinaryData(binaryData, binaryBuffer, executionId) {
31
+ const retBinaryData = binaryData;
32
+ if (this.managers[this.binaryDataMode]) {
33
+ return this.managers[this.binaryDataMode]
34
+ .storeBinaryData(binaryBuffer, executionId)
35
+ .then((filename) => {
36
+ retBinaryData.id = this.generateBinaryId(filename);
37
+ return retBinaryData;
38
+ });
39
+ }
40
+ retBinaryData.data = binaryBuffer.toString(Constants_1.BINARY_ENCODING);
41
+ return binaryData;
42
+ }
43
+ async retrieveBinaryData(binaryData) {
44
+ if (binaryData.id) {
45
+ return this.retrieveBinaryDataByIdentifier(binaryData.id);
46
+ }
47
+ return Buffer.from(binaryData.data, Constants_1.BINARY_ENCODING);
48
+ }
49
+ async retrieveBinaryDataByIdentifier(identifier) {
50
+ const { mode, id } = this.splitBinaryModeFileId(identifier);
51
+ if (this.managers[mode]) {
52
+ return this.managers[mode].retrieveBinaryDataByIdentifier(id);
53
+ }
54
+ throw new Error("Storage mode used to store binary data not available");
55
+ }
56
+ async markDataForDeletionByExecutionId(executionId) {
57
+ if (this.managers[this.binaryDataMode]) {
58
+ return this.managers[this.binaryDataMode].markDataForDeletionByExecutionId(executionId);
59
+ }
60
+ return Promise.resolve();
61
+ }
62
+ async persistBinaryDataForExecutionId(executionId) {
63
+ if (this.managers[this.binaryDataMode]) {
64
+ return this.managers[this.binaryDataMode].persistBinaryDataForExecutionId(executionId);
65
+ }
66
+ return Promise.resolve();
67
+ }
68
+ async deleteBinaryDataByExecutionId(executionId) {
69
+ if (this.managers[this.binaryDataMode]) {
70
+ return this.managers[this.binaryDataMode].deleteBinaryDataByExecutionId(executionId);
71
+ }
72
+ return Promise.resolve();
73
+ }
74
+ async duplicateBinaryData(inputData, executionId) {
75
+ if (inputData && this.managers[this.binaryDataMode]) {
76
+ const returnInputData = inputData.map(async (executionDataArray) => {
77
+ if (executionDataArray) {
78
+ return Promise.all(executionDataArray.map((executionData) => {
79
+ if (executionData.binary) {
80
+ return this.duplicateBinaryDataInExecData(executionData, executionId);
81
+ }
82
+ return executionData;
83
+ }));
84
+ }
85
+ return executionDataArray;
86
+ });
87
+ return Promise.all(returnInputData);
88
+ }
89
+ return Promise.resolve(inputData);
90
+ }
91
+ generateBinaryId(filename) {
92
+ return `${this.binaryDataMode}:${filename}`;
93
+ }
94
+ splitBinaryModeFileId(fileId) {
95
+ const [mode, id] = fileId.split(":");
96
+ return { mode, id };
97
+ }
98
+ async duplicateBinaryDataInExecData(executionData, executionId) {
99
+ const binaryManager = this.managers[this.binaryDataMode];
100
+ if (executionData.binary) {
101
+ const binaryDataKeys = Object.keys(executionData.binary);
102
+ const bdPromises = binaryDataKeys.map(async (key) => {
103
+ if (!executionData.binary) {
104
+ return { key, newId: undefined };
105
+ }
106
+ const binaryDataId = executionData.binary[key].id;
107
+ if (!binaryDataId) {
108
+ return { key, newId: undefined };
109
+ }
110
+ return binaryManager
111
+ ?.duplicateBinaryDataByIdentifier(this.splitBinaryModeFileId(binaryDataId).id, executionId)
112
+ .then((filename) => ({
113
+ newId: this.generateBinaryId(filename),
114
+ key,
115
+ }));
116
+ });
117
+ return Promise.all(bdPromises).then((b) => {
118
+ return b.reduce((acc, curr) => {
119
+ if (acc.binary && curr) {
120
+ acc.binary[curr.key].id = curr.newId;
121
+ }
122
+ return acc;
123
+ }, executionData);
124
+ });
125
+ }
126
+ return executionData;
127
+ }
128
+ }
129
+ exports.BinaryDataManager = BinaryDataManager;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.secureRandomNumber = secureRandomNumber;
4
- const crypto_1 = require("crypto");
4
+ const node_crypto_1 = require("node:crypto");
5
5
  function secureRandomNumber(min, max) {
6
- return (0, crypto_1.randomInt)(min, max);
6
+ return (0, node_crypto_1.randomInt)(min, max);
7
7
  }
8
- //# sourceMappingURL=crypto.js.map
package/package.json CHANGED
@@ -1,54 +1,61 @@
1
1
  {
2
- "name": "@fsai-flow/core",
3
- "version": "0.0.4",
4
- "dependencies": {
5
- "@fsai-flow/workflow": "workspace:^",
6
- "client-oauth2": "^4.3.3",
7
- "cron": "~3.3.0",
8
- "crypto-js": "~4.2.0",
9
- "file-type": "^16.0.0",
10
- "form-data": "4.0.4",
11
- "https-proxy-agent": "^7.0.6",
12
- "ioredis": "^5.3.2",
13
- "lodash": "^4.17.21",
14
- "mime-types": "^2.1.27",
15
- "oauth-1.0a": "^2.2.6",
16
- "p-cancelable": "^2.0.0",
17
- "qs": "^6.10.1",
18
- "request": "^2.88.2",
19
- "request-promise-native": "^1.0.9",
20
- "simple-oauth2": "^5.1.0",
21
- "tslib": "^2.3.0",
22
- "uuid": "^11.0.3",
23
- "fast-glob": "3.2.12"
24
- },
25
- "devDependencies": {
26
- "@types/crypto-js": "^4.0.1",
27
- "@types/express": "^5.0.0",
28
- "@types/lodash": "^4.17.13",
29
- "@types/lodash.get": "^4.4.9",
30
- "@types/mime-types": "^2.1.0",
31
- "@types/node": "^22.10.2",
32
- "@types/qs": "^6.9.17",
33
- "@types/request": "^2.48.12",
34
- "@types/request-promise-native": "^1.0.15",
35
- "@types/simple-oauth2": "^5.0.7",
36
- "@types/uuid": "^10.0.0",
37
- "axios": "^1.7.9",
38
- "ioredis": "^5.3.2",
39
- "jsonc-eslint-parser": "^2.4.0",
40
- "typescript": "~5.7.2"
41
- },
42
- "type": "commonjs",
43
- "main": "dist/src/index",
44
- "types": "dist/src/index.d.ts",
45
- "overrides": {
46
- "request": {
47
- "form-data": "2.5.4",
48
- "tough-cookie": "4.1.3"
49
- },
50
- "request-promise-native": {
51
- "tough-cookie": "4.1.3"
52
- }
53
- }
2
+ "name": "@fsai-flow/core",
3
+ "version": "0.1.0",
4
+ "dependencies": {
5
+ "@fsai-flow/workflow": "0.1.0",
6
+ "client-oauth2": "^4.3.3",
7
+ "cron": "~4.4.0",
8
+ "crypto-js": "~4.2.0",
9
+ "fast-glob": "3.3.3",
10
+ "file-type": "^21.3.0",
11
+ "form-data": "4.0.5",
12
+ "https-proxy-agent": "^7.0.6",
13
+ "ioredis": "^5.9.3",
14
+ "lodash": "^4.17.23",
15
+ "mime-types": "^3.0.2",
16
+ "oauth-1.0a": "^2.2.6",
17
+ "p-cancelable": "^4.0.1",
18
+ "qs": "^6.15.0",
19
+ "simple-oauth2": "^5.1.0",
20
+ "tslib": "^2.8.1",
21
+ "uuid": "^13.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "@biomejs/biome": "^2.4.4",
25
+ "@types/crypto-js": "^4.2.2",
26
+ "@types/express": "^5.0.6",
27
+ "@types/lodash": "^4.17.23",
28
+ "@types/lodash.get": "^4.4.9",
29
+ "@types/mime-types": "^3.0.1",
30
+ "@types/node": "^25.3.0",
31
+ "@types/qs": "^6.14.0",
32
+ "@types/simple-oauth2": "^5.0.8",
33
+ "@types/uuid": "^11.0.0",
34
+ "@vitest/coverage-v8": "^4.0.18",
35
+ "axios": "^1.13.5",
36
+ "ioredis": "^5.9.3",
37
+ "typescript": "~5.9.3",
38
+ "vitest": "^4.0.18"
39
+ },
40
+ "overrides": {
41
+ "tough-cookie": "^4.1.3",
42
+ "minimatch": "^10.2.1",
43
+ "form-data": "$form-data",
44
+ "ajv": "^8.18.0",
45
+ "qs": "$qs"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc -p tsconfig.lib.json",
49
+ "test": "vitest run",
50
+ "check": "biome check .",
51
+ "prepublishOnly": "npm run check && npm run build && npm run test"
52
+ },
53
+ "type": "commonjs",
54
+ "main": "dist/src/index",
55
+ "types": "dist/src/index.d.ts",
56
+ "files": [
57
+ "dist",
58
+ "README.md",
59
+ "LICENSE"
60
+ ]
54
61
  }
package/dist/README.md DELETED
@@ -1,31 +0,0 @@
1
- # @fsai-flow/core
2
-
3
- This library is a dependency for [FSAI-Flow](https://github.com/your-org/flowx) that contains base classes and types used throughout the application.
4
-
5
- ## Installation
6
-
7
- This project is published to the npm registry. To use it in your project:
8
-
9
- ```bash
10
- npm install @fsai-flow/core
11
- ```
12
-
13
- ## Building
14
-
15
- Run `nx build core` to build the library.
16
-
17
- ## Running unit tests
18
-
19
- Run `nx test core` to execute the unit tests via [Jest](https://jestjs.io).
20
-
21
- ## Contributing
22
-
23
- To contribute to this project:
24
-
25
- 1. Clone this repository
26
- 2. Make your changes
27
- 3. Open a Pull Request
28
-
29
- ## Publishing
30
-
31
- Maintainers can publish a new version to the npm package registry.
package/dist/package.json DELETED
@@ -1,54 +0,0 @@
1
- {
2
- "name": "@fsai-flow/core",
3
- "version": "0.0.4",
4
- "dependencies": {
5
- "@fsai-flow/workflow": "workspace:^",
6
- "client-oauth2": "^4.3.3",
7
- "cron": "~3.3.0",
8
- "crypto-js": "~4.2.0",
9
- "file-type": "^16.0.0",
10
- "form-data": "4.0.4",
11
- "https-proxy-agent": "^7.0.6",
12
- "ioredis": "^5.3.2",
13
- "lodash": "^4.17.21",
14
- "mime-types": "^2.1.27",
15
- "oauth-1.0a": "^2.2.6",
16
- "p-cancelable": "^2.0.0",
17
- "qs": "^6.10.1",
18
- "request": "^2.88.2",
19
- "request-promise-native": "^1.0.9",
20
- "simple-oauth2": "^5.1.0",
21
- "tslib": "^2.3.0",
22
- "uuid": "^11.0.3",
23
- "fast-glob": "3.2.12"
24
- },
25
- "devDependencies": {
26
- "@types/crypto-js": "^4.0.1",
27
- "@types/express": "^5.0.0",
28
- "@types/lodash": "^4.17.13",
29
- "@types/lodash.get": "^4.4.9",
30
- "@types/mime-types": "^2.1.0",
31
- "@types/node": "^22.10.2",
32
- "@types/qs": "^6.9.17",
33
- "@types/request": "^2.48.12",
34
- "@types/request-promise-native": "^1.0.15",
35
- "@types/simple-oauth2": "^5.0.7",
36
- "@types/uuid": "^10.0.0",
37
- "axios": "^1.7.9",
38
- "ioredis": "^5.3.2",
39
- "jsonc-eslint-parser": "^2.4.0",
40
- "typescript": "~5.7.2"
41
- },
42
- "type": "commonjs",
43
- "main": "dist/src/index",
44
- "types": "dist/src/index.d.ts",
45
- "overrides": {
46
- "request": {
47
- "form-data": "2.5.4",
48
- "tough-cookie": "4.1.3"
49
- },
50
- "request-promise-native": {
51
- "tough-cookie": "4.1.3"
52
- }
53
- }
54
- }
@@ -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,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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