@fsai-flow/core 0.0.1

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 (113) hide show
  1. package/README.md +11 -0
  2. package/dist/README.md +11 -0
  3. package/dist/package.json +44 -0
  4. package/dist/src/index.d.ts +15 -0
  5. package/dist/src/index.js +29 -0
  6. package/dist/src/index.js.map +1 -0
  7. package/dist/src/lib/ActiveWebhooks.d.ts +59 -0
  8. package/dist/src/lib/ActiveWebhooks.js +184 -0
  9. package/dist/src/lib/ActiveWebhooks.js.map +1 -0
  10. package/dist/src/lib/ActiveWorkflows.d.ts +58 -0
  11. package/dist/src/lib/ActiveWorkflows.js +244 -0
  12. package/dist/src/lib/ActiveWorkflows.js.map +1 -0
  13. package/dist/src/lib/BinaryDataManager/FileSystem.d.ts +26 -0
  14. package/dist/src/lib/BinaryDataManager/FileSystem.js +179 -0
  15. package/dist/src/lib/BinaryDataManager/FileSystem.js.map +1 -0
  16. package/dist/src/lib/BinaryDataManager/index.d.ts +21 -0
  17. package/dist/src/lib/BinaryDataManager/index.js +146 -0
  18. package/dist/src/lib/BinaryDataManager/index.js.map +1 -0
  19. package/dist/src/lib/ChangeCase.d.ts +9 -0
  20. package/dist/src/lib/ChangeCase.js +43 -0
  21. package/dist/src/lib/ChangeCase.js.map +1 -0
  22. package/dist/src/lib/Constants.d.ts +14 -0
  23. package/dist/src/lib/Constants.js +19 -0
  24. package/dist/src/lib/Constants.js.map +1 -0
  25. package/dist/src/lib/Credentials.d.ts +27 -0
  26. package/dist/src/lib/Credentials.js +89 -0
  27. package/dist/src/lib/Credentials.js.map +1 -0
  28. package/dist/src/lib/FileSystem.d.ts +26 -0
  29. package/dist/src/lib/FileSystem.js +179 -0
  30. package/dist/src/lib/FileSystem.js.map +1 -0
  31. package/dist/src/lib/InputConnectionDataLegacy.d.ts +2 -0
  32. package/dist/src/lib/InputConnectionDataLegacy.js +79 -0
  33. package/dist/src/lib/InputConnectionDataLegacy.js.map +1 -0
  34. package/dist/src/lib/Interfaces.d.ts +148 -0
  35. package/dist/src/lib/Interfaces.js +3 -0
  36. package/dist/src/lib/Interfaces.js.map +1 -0
  37. package/dist/src/lib/LoadNodeParameterOptions.d.ts +39 -0
  38. package/dist/src/lib/LoadNodeParameterOptions.js +150 -0
  39. package/dist/src/lib/LoadNodeParameterOptions.js.map +1 -0
  40. package/dist/src/lib/NodeExecuteFunctions.d.ts +226 -0
  41. package/dist/src/lib/NodeExecuteFunctions.js +2483 -0
  42. package/dist/src/lib/NodeExecuteFunctions.js.map +1 -0
  43. package/dist/src/lib/NodesLoader/constants.d.ts +5 -0
  44. package/dist/src/lib/NodesLoader/constants.js +106 -0
  45. package/dist/src/lib/NodesLoader/constants.js.map +1 -0
  46. package/dist/src/lib/NodesLoader/custom-directory-loader.d.ts +9 -0
  47. package/dist/src/lib/NodesLoader/custom-directory-loader.js +36 -0
  48. package/dist/src/lib/NodesLoader/custom-directory-loader.js.map +1 -0
  49. package/dist/src/lib/NodesLoader/directory-loader.d.ts +66 -0
  50. package/dist/src/lib/NodesLoader/directory-loader.js +325 -0
  51. package/dist/src/lib/NodesLoader/directory-loader.js.map +1 -0
  52. package/dist/src/lib/NodesLoader/index.d.ts +5 -0
  53. package/dist/src/lib/NodesLoader/index.js +12 -0
  54. package/dist/src/lib/NodesLoader/index.js.map +1 -0
  55. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.d.ts +7 -0
  56. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js +52 -0
  57. package/dist/src/lib/NodesLoader/lazy-package-directory-loader.js.map +1 -0
  58. package/dist/src/lib/NodesLoader/load-class-in-isolation.d.ts +1 -0
  59. package/dist/src/lib/NodesLoader/load-class-in-isolation.js +22 -0
  60. package/dist/src/lib/NodesLoader/load-class-in-isolation.js.map +1 -0
  61. package/dist/src/lib/NodesLoader/package-directory-loader.d.ts +17 -0
  62. package/dist/src/lib/NodesLoader/package-directory-loader.js +100 -0
  63. package/dist/src/lib/NodesLoader/package-directory-loader.js.map +1 -0
  64. package/dist/src/lib/NodesLoader/types.d.ts +14 -0
  65. package/dist/src/lib/NodesLoader/types.js +3 -0
  66. package/dist/src/lib/NodesLoader/types.js.map +1 -0
  67. package/dist/src/lib/UserSettings.d.ts +80 -0
  68. package/dist/src/lib/UserSettings.js +261 -0
  69. package/dist/src/lib/UserSettings.js.map +1 -0
  70. package/dist/src/lib/WorkflowExecute.d.ts +53 -0
  71. package/dist/src/lib/WorkflowExecute.js +835 -0
  72. package/dist/src/lib/WorkflowExecute.js.map +1 -0
  73. package/dist/src/lib/index.d.ts +21 -0
  74. package/dist/src/lib/index.js +146 -0
  75. package/dist/src/lib/index.js.map +1 -0
  76. package/dist/src/utils/crypto.d.ts +1 -0
  77. package/dist/src/utils/crypto.js +8 -0
  78. package/dist/src/utils/crypto.js.map +1 -0
  79. package/eslint.config.js +19 -0
  80. package/jest.config.ts +10 -0
  81. package/package.json +44 -0
  82. package/project.json +19 -0
  83. package/src/index.ts +27 -0
  84. package/src/lib/ActiveWebhooks.ts +245 -0
  85. package/src/lib/ActiveWorkflows.ts +304 -0
  86. package/src/lib/BinaryDataManager/FileSystem.ts +214 -0
  87. package/src/lib/BinaryDataManager/index.ts +187 -0
  88. package/src/lib/ChangeCase.ts +45 -0
  89. package/src/lib/Constants.ts +16 -0
  90. package/src/lib/Credentials.ts +108 -0
  91. package/src/lib/FileSystem.ts +214 -0
  92. package/src/lib/InputConnectionDataLegacy.ts +123 -0
  93. package/src/lib/Interfaces.ts +338 -0
  94. package/src/lib/LoadNodeParameterOptions.ts +235 -0
  95. package/src/lib/NodeExecuteFunctions.ts +3704 -0
  96. package/src/lib/NodesLoader/constants.ts +112 -0
  97. package/src/lib/NodesLoader/custom-directory-loader.ts +31 -0
  98. package/src/lib/NodesLoader/directory-loader.ts +458 -0
  99. package/src/lib/NodesLoader/index.ts +5 -0
  100. package/src/lib/NodesLoader/lazy-package-directory-loader.ts +55 -0
  101. package/src/lib/NodesLoader/load-class-in-isolation.ts +19 -0
  102. package/src/lib/NodesLoader/package-directory-loader.ts +107 -0
  103. package/src/lib/NodesLoader/types.ts +14 -0
  104. package/src/lib/UserSettings.ts +292 -0
  105. package/src/lib/WorkflowExecute.ts +1108 -0
  106. package/src/lib/index.ts +187 -0
  107. package/src/utils/crypto.ts +5 -0
  108. package/tests/Credentials.test.ts +88 -0
  109. package/tests/Helpers.ts +808 -0
  110. package/tests/WorkflowExecute.test.ts +1242 -0
  111. package/tsconfig.json +42 -0
  112. package/tsconfig.lib.json +10 -0
  113. package/tsconfig.spec.json +14 -0
@@ -0,0 +1,325 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DirectoryLoader = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const uniqBy_1 = tslib_1.__importDefault(require("lodash/uniqBy"));
6
+ const workflow_1 = require("@fsai-flow/workflow");
7
+ const path = tslib_1.__importStar(require("path"));
8
+ const constants_1 = require("./constants");
9
+ const load_class_in_isolation_1 = require("./load-class-in-isolation");
10
+ function toJSON() {
11
+ return Object.assign(Object.assign({}, this), { authenticate: typeof this.authenticate === 'function' ? {} : this.authenticate });
12
+ }
13
+ /**
14
+ * Base class for loading n8n nodes and credentials from a directory.
15
+ * Handles the common functionality for resolving paths, loading classes, and managing node and credential types.
16
+ */
17
+ class DirectoryLoader {
18
+ constructor(directory, excludeNodes = [], includeNodes = []) {
19
+ this.directory = directory;
20
+ this.excludeNodes = excludeNodes;
21
+ this.includeNodes = includeNodes;
22
+ this.isLazyLoaded = false;
23
+ // Another way of keeping track of the names and versions of a node. This
24
+ // seems to only be used by the installedPackages repository
25
+ this.loadedNodes = [];
26
+ // Stores the loaded descriptions and sourcepaths
27
+ this.nodeTypes = {};
28
+ this.credentialTypes = {};
29
+ // Stores the location and classnames of the nodes and credentials that are
30
+ // loaded; used to actually load the files in lazy-loading scenario.
31
+ this.known = { nodes: {}, credentials: {} };
32
+ // Stores the different versions with their individual descriptions
33
+ this.types = { nodes: [], credentials: [] };
34
+ this.nodesByCredential = {};
35
+ }
36
+ reset() {
37
+ this.loadedNodes = [];
38
+ this.nodeTypes = {};
39
+ this.credentialTypes = {};
40
+ this.known = { nodes: {}, credentials: {} };
41
+ this.types = { nodes: [], credentials: [] };
42
+ }
43
+ resolvePath(file) {
44
+ return path.resolve(this.directory, file);
45
+ }
46
+ loadClass(sourcePath) {
47
+ const filePath = this.resolvePath(sourcePath);
48
+ const [className] = path.parse(sourcePath).name.split('.');
49
+ try {
50
+ return (0, load_class_in_isolation_1.loadClassInIsolation)(filePath, className);
51
+ }
52
+ catch (error) {
53
+ throw error instanceof TypeError
54
+ ? new Error('Class could not be found. Please check if the class is named correctly.')
55
+ : error;
56
+ }
57
+ }
58
+ /** Loads a nodes class from a file, fixes icons, and augments the codex */
59
+ loadNodeFromFile(filePath) {
60
+ const tempNode = this.loadClass(filePath);
61
+ this.addCodex(tempNode, filePath);
62
+ const nodeType = tempNode.description.name;
63
+ if (this.includeNodes.length && !this.includeNodes.includes(nodeType)) {
64
+ return;
65
+ }
66
+ if (this.excludeNodes.includes(nodeType)) {
67
+ return;
68
+ }
69
+ this.fixIconPaths(tempNode.description, filePath);
70
+ let nodeVersion = 1;
71
+ if ('nodeVersions' in tempNode) {
72
+ for (const versionNode of Object.values(tempNode.nodeVersions)) {
73
+ this.fixIconPaths(versionNode.description, filePath);
74
+ }
75
+ for (const version of Object.values(tempNode.nodeVersions)) {
76
+ this.addLoadOptionsMethods(version);
77
+ this.applySpecialNodeParameters(version);
78
+ }
79
+ const currentVersionNode = tempNode.nodeVersions[tempNode.currentVersion];
80
+ this.addCodex(currentVersionNode, filePath);
81
+ nodeVersion = tempNode.currentVersion;
82
+ if (currentVersionNode.hasOwnProperty('executeSingle')) {
83
+ throw new Error('"executeSingle" has been removed. Please update the code of this node to use "execute" instead.');
84
+ }
85
+ }
86
+ else {
87
+ this.addLoadOptionsMethods(tempNode);
88
+ this.applySpecialNodeParameters(tempNode);
89
+ // Short renaming to avoid type issues
90
+ nodeVersion = Array.isArray(tempNode.description.version)
91
+ ? tempNode.description.version.slice(-1)[0]
92
+ : tempNode.description.version;
93
+ }
94
+ this.known.nodes[nodeType] = {
95
+ className: tempNode.constructor.name,
96
+ sourcePath: filePath,
97
+ };
98
+ this.nodeTypes[nodeType] = {
99
+ type: tempNode,
100
+ sourcePath: filePath,
101
+ };
102
+ this.loadedNodes.push({
103
+ name: nodeType,
104
+ version: nodeVersion,
105
+ });
106
+ this.getVersionedNodeTypeAll(tempNode).forEach(({ description }) => {
107
+ this.types.nodes.push(description);
108
+ });
109
+ for (const credential of this.getCredentialsForNode(tempNode)) {
110
+ if (!this.nodesByCredential[credential.name]) {
111
+ this.nodesByCredential[credential.name] = [];
112
+ }
113
+ this.nodesByCredential[credential.name].push(nodeType);
114
+ }
115
+ }
116
+ getNode(nodeType) {
117
+ const { nodeTypes, known: { nodes: knownNodes }, } = this;
118
+ if (!(nodeType in nodeTypes) && nodeType in knownNodes) {
119
+ const { sourcePath } = knownNodes[nodeType];
120
+ this.loadNodeFromFile(sourcePath);
121
+ }
122
+ if (nodeType in nodeTypes) {
123
+ return nodeTypes[nodeType];
124
+ }
125
+ throw new Error(`Unrecognized node type: ${nodeType}`);
126
+ }
127
+ /** Loads a credential class from a file, and fixes icons */
128
+ loadCredentialFromFile(filePath) {
129
+ const tempCredential = this.loadClass(filePath);
130
+ // Add serializer method "toJSON" to the class so that authenticate method (if defined)
131
+ // gets mapped to the authenticate attribute before it is sent to the client.
132
+ // The authenticate property is used by the client to decide whether or not to
133
+ // include the credential type in the predefined credentials (HTTP node)
134
+ Object.assign(tempCredential, { toJSON });
135
+ this.fixIconPaths(tempCredential, filePath);
136
+ const credentialType = tempCredential.name;
137
+ this.known.credentials[credentialType] = {
138
+ className: tempCredential.constructor.name,
139
+ sourcePath: filePath,
140
+ extends: tempCredential.extends,
141
+ supportedNodes: this.nodesByCredential[credentialType],
142
+ };
143
+ this.credentialTypes[credentialType] = {
144
+ type: tempCredential,
145
+ sourcePath: filePath,
146
+ };
147
+ this.types.credentials.push(tempCredential);
148
+ }
149
+ getCredential(credentialType) {
150
+ const { credentialTypes, known: { credentials: knownCredentials }, } = this;
151
+ if (!(credentialType in credentialTypes) &&
152
+ credentialType in knownCredentials) {
153
+ const { sourcePath } = knownCredentials[credentialType];
154
+ this.loadCredentialFromFile(sourcePath);
155
+ }
156
+ if (credentialType in credentialTypes) {
157
+ return credentialTypes[credentialType];
158
+ }
159
+ throw new Error(`Unrecognized credential type: ${credentialType}`);
160
+ }
161
+ /**
162
+ * Returns an array of credential descriptions that are supported by a node.
163
+ * For versioned nodes, combines and deduplicates credentials from all versions.
164
+ */
165
+ getCredentialsForNode(object) {
166
+ var _a;
167
+ if ('nodeVersions' in object) {
168
+ const credentials = Object.values(object.nodeVersions).flatMap(({ description }) => { var _a; return (_a = description.credentials) !== null && _a !== void 0 ? _a : []; });
169
+ return (0, uniqBy_1.default)(credentials, 'name');
170
+ }
171
+ return (_a = object.description.credentials) !== null && _a !== void 0 ? _a : [];
172
+ }
173
+ /**
174
+ * Returns an array of all versions of a node type.
175
+ * For non-versioned nodes, returns an array with just that node.
176
+ * For versioned nodes, returns all available versions.
177
+ */
178
+ getVersionedNodeTypeAll(object) {
179
+ if ('nodeVersions' in object) {
180
+ const nodeVersions = Object.values(object.nodeVersions).map((element) => {
181
+ element.description.name = object.description.name;
182
+ element.description.codex = object.description.codex;
183
+ return element;
184
+ });
185
+ return (0, uniqBy_1.default)(nodeVersions.reverse(), (node) => {
186
+ const { version } = node.description;
187
+ return Array.isArray(version) ? version.join(',') : version.toString();
188
+ });
189
+ }
190
+ return [object];
191
+ }
192
+ /**
193
+ * Retrieves `categories`, `subcategories` and alias (if defined)
194
+ * from the codex data for the node at the given file path.
195
+ */
196
+ getCodex(filePath) {
197
+ const codexFilePath = this.resolvePath(`${filePath}on`); // .js to .json
198
+ const { categories, subcategories, resources: { primaryDocumentation, credentialDocumentation }, alias, } = module.require(codexFilePath);
199
+ return Object.assign(Object.assign(Object.assign(Object.assign({}, (categories && { categories })), (subcategories && { subcategories })), (alias && { alias })), { resources: {
200
+ primaryDocumentation,
201
+ credentialDocumentation,
202
+ } });
203
+ }
204
+ /**
205
+ * Adds a node codex `categories` and `subcategories` (if defined)
206
+ * to a node description `codex` property.
207
+ */
208
+ addCodex(node, filePath) {
209
+ const isCustom = this.packageName === 'CUSTOM';
210
+ try {
211
+ let codex;
212
+ if (!isCustom) {
213
+ codex = node.description.codex;
214
+ }
215
+ if (codex === undefined) {
216
+ codex = this.getCodex(filePath);
217
+ }
218
+ if (isCustom) {
219
+ codex.categories = codex.categories
220
+ ? codex.categories.concat(constants_1.CUSTOM_NODES_CATEGORY)
221
+ : [constants_1.CUSTOM_NODES_CATEGORY];
222
+ }
223
+ node.description.codex = codex;
224
+ }
225
+ catch (_a) {
226
+ console.debug(`No codex available for: ${node.description.name}`);
227
+ if (isCustom) {
228
+ node.description.codex = {
229
+ categories: [constants_1.CUSTOM_NODES_CATEGORY],
230
+ };
231
+ }
232
+ }
233
+ }
234
+ addLoadOptionsMethods(node) {
235
+ var _a;
236
+ if ((_a = node === null || node === void 0 ? void 0 : node.methods) === null || _a === void 0 ? void 0 : _a.loadOptions) {
237
+ node.description.__loadOptionsMethods = Object.keys(node.methods.loadOptions);
238
+ }
239
+ }
240
+ applySpecialNodeParameters(nodeType) {
241
+ const { properties, polling, supportsCORS } = nodeType.description;
242
+ if (polling) {
243
+ properties.unshift(...constants_1.commonPollingParameters);
244
+ }
245
+ if (nodeType.webhook && supportsCORS) {
246
+ const optionsProperty = properties.find(({ name }) => name === 'options');
247
+ if (optionsProperty)
248
+ optionsProperty.options = [
249
+ ...constants_1.commonCORSParameters,
250
+ ...optionsProperty.options,
251
+ ];
252
+ else
253
+ properties.push(...constants_1.commonCORSParameters);
254
+ }
255
+ DirectoryLoader.applyDeclarativeNodeOptionParameters(nodeType);
256
+ }
257
+ getIconPath(icon, filePath) {
258
+ const iconPath = path.join(path.dirname(filePath), icon.replace('file:', ''));
259
+ return `icons/${this.packageName}/${iconPath}`;
260
+ }
261
+ fixIconPaths(obj, filePath) {
262
+ const { icon } = obj;
263
+ if (!icon)
264
+ return;
265
+ if (typeof icon === 'string') {
266
+ if (icon.startsWith('file:')) {
267
+ obj.iconUrl = this.getIconPath(icon, filePath);
268
+ obj.icon = undefined;
269
+ }
270
+ }
271
+ else if (icon.light.startsWith('file:') &&
272
+ icon.dark.startsWith('file:')) {
273
+ obj.iconUrl = {
274
+ light: this.getIconPath(icon.light, filePath),
275
+ dark: this.getIconPath(icon.dark, filePath),
276
+ };
277
+ obj.icon = undefined;
278
+ }
279
+ }
280
+ /** Augments additional `Request Options` property on declarative node-type */
281
+ static applyDeclarativeNodeOptionParameters(nodeType) {
282
+ var _a, _b, _c, _d;
283
+ if (!!nodeType.execute ||
284
+ !!nodeType.trigger ||
285
+ !!nodeType.webhook ||
286
+ !!nodeType.description.polling ||
287
+ (0, workflow_1.isSubNodeType)(nodeType.description)) {
288
+ return;
289
+ }
290
+ const parameters = nodeType.description.properties;
291
+ if (!parameters) {
292
+ return;
293
+ }
294
+ // Was originally under "options" instead of "requestOptions" so the chance
295
+ // that that existed was quite high. With this name the chance is actually
296
+ // very low that it already exists but lets leave it in anyway to be sure.
297
+ const existingRequestOptionsIndex = parameters.findIndex((parameter) => parameter.name === 'requestOptions');
298
+ if (existingRequestOptionsIndex !== -1) {
299
+ parameters[existingRequestOptionsIndex] = Object.assign(Object.assign({}, constants_1.commonDeclarativeNodeOptionParameters), { options: [
300
+ ...((_a = constants_1.commonDeclarativeNodeOptionParameters.options) !== null && _a !== void 0 ? _a : []),
301
+ ...((_c = (_b = parameters[existingRequestOptionsIndex]) === null || _b === void 0 ? void 0 : _b.options) !== null && _c !== void 0 ? _c : []),
302
+ ] });
303
+ const options = (_d = parameters[existingRequestOptionsIndex]) === null || _d === void 0 ? void 0 : _d.options;
304
+ if (options) {
305
+ options.sort((a, b) => {
306
+ if ('displayName' in a && 'displayName' in b) {
307
+ if (a.displayName < b.displayName) {
308
+ return -1;
309
+ }
310
+ if (a.displayName > b.displayName) {
311
+ return 1;
312
+ }
313
+ }
314
+ return 0;
315
+ });
316
+ }
317
+ }
318
+ else {
319
+ parameters.push(constants_1.commonDeclarativeNodeOptionParameters);
320
+ }
321
+ return;
322
+ }
323
+ }
324
+ exports.DirectoryLoader = DirectoryLoader;
325
+ //# sourceMappingURL=directory-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory-loader.js","sourceRoot":"","sources":["../../../../src/lib/NodesLoader/directory-loader.ts"],"names":[],"mappings":";;;;AAAA,mEAAmC;AAgBnC,kDAAoD;AACpD,mDAA6B;AAE7B,2CAKqB;AACrB,uEAAiE;AAEjE,SAAS,MAAM;IACb,uCACK,IAAI,KACP,YAAY,EACV,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,IAClE;AACJ,CAAC;AAiBD;;;GAGG;AACH,MAAsB,eAAe;IAqBnC,YACW,SAAiB,EAChB,eAAyB,EAAE,EAC3B,eAAyB,EAAE;QAF5B,cAAS,GAAT,SAAS,CAAQ;QAChB,iBAAY,GAAZ,YAAY,CAAe;QAC3B,iBAAY,GAAZ,YAAY,CAAe;QAvBvC,iBAAY,GAAG,KAAK,CAAC;QAErB,yEAAyE;QACzE,4DAA4D;QAC5D,gBAAW,GAA2B,EAAE,CAAC;QAEzC,iDAAiD;QACjD,cAAS,GAAkB,EAAE,CAAC;QAE9B,oBAAe,GAAwB,EAAE,CAAC;QAE1C,2EAA2E;QAC3E,oEAAoE;QACpE,UAAK,GAA6B,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QAEjE,mEAAmE;QACnE,UAAK,GAAU,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;QAErC,sBAAiB,GAA6B,EAAE,CAA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IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;wBAC7C,IAAI,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;4BAClC,OAAO,CAAC,CAAC,CAAC;wBACZ,CAAC;wBACD,IAAI,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;4BAClC,OAAO,CAAC,CAAC;wBACX,CAAC;oBACH,CAAC;oBAED,OAAO,CAAC,CAAC;gBACX,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,IAAI,CAAC,iDAAqC,CAAC,CAAC;QACzD,CAAC;QAED,OAAO;IACT,CAAC;CACF;AAnZD,0CAmZC"}
@@ -0,0 +1,5 @@
1
+ export { DirectoryLoader, type Types } from './directory-loader';
2
+ export { CustomDirectoryLoader } from './custom-directory-loader';
3
+ export { PackageDirectoryLoader } from './package-directory-loader';
4
+ export { LazyPackageDirectoryLoader } from './lazy-package-directory-loader';
5
+ export type { n8n } from './types';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LazyPackageDirectoryLoader = exports.PackageDirectoryLoader = exports.CustomDirectoryLoader = exports.DirectoryLoader = void 0;
4
+ var directory_loader_1 = require("./directory-loader");
5
+ Object.defineProperty(exports, "DirectoryLoader", { enumerable: true, get: function () { return directory_loader_1.DirectoryLoader; } });
6
+ var custom_directory_loader_1 = require("./custom-directory-loader");
7
+ Object.defineProperty(exports, "CustomDirectoryLoader", { enumerable: true, get: function () { return custom_directory_loader_1.CustomDirectoryLoader; } });
8
+ var package_directory_loader_1 = require("./package-directory-loader");
9
+ Object.defineProperty(exports, "PackageDirectoryLoader", { enumerable: true, get: function () { return package_directory_loader_1.PackageDirectoryLoader; } });
10
+ var lazy_package_directory_loader_1 = require("./lazy-package-directory-loader");
11
+ Object.defineProperty(exports, "LazyPackageDirectoryLoader", { enumerable: true, get: function () { return lazy_package_directory_loader_1.LazyPackageDirectoryLoader; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/NodesLoader/index.ts"],"names":[],"mappings":";;;AAAA,uDAAiE;AAAxD,mHAAA,eAAe,OAAA;AACxB,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,uEAAoE;AAA3D,kIAAA,sBAAsB,OAAA;AAC/B,iFAA6E;AAApE,2IAAA,0BAA0B,OAAA"}
@@ -0,0 +1,7 @@
1
+ import { PackageDirectoryLoader } from './package-directory-loader';
2
+ /**
3
+ * This loader extends PackageDirectoryLoader to load node and credentials lazily, if possible
4
+ */
5
+ export declare class LazyPackageDirectoryLoader extends PackageDirectoryLoader {
6
+ loadAll(): Promise<void>;
7
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LazyPackageDirectoryLoader = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const package_directory_loader_1 = require("./package-directory-loader");
6
+ /**
7
+ * This loader extends PackageDirectoryLoader to load node and credentials lazily, if possible
8
+ */
9
+ class LazyPackageDirectoryLoader extends package_directory_loader_1.PackageDirectoryLoader {
10
+ loadAll() {
11
+ const _super = Object.create(null, {
12
+ loadAll: { get: () => super.loadAll }
13
+ });
14
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
15
+ var _a, _b, _c, _d;
16
+ try {
17
+ this.known.nodes = yield this.readJSON('dist/known/nodes.json');
18
+ this.known.credentials = yield this.readJSON('dist/known/credentials.json');
19
+ this.types.nodes = yield this.readJSON('dist/types/nodes.json');
20
+ this.types.credentials = yield this.readJSON('dist/types/credentials.json');
21
+ if (this.includeNodes.length) {
22
+ const allowedNodes = {};
23
+ for (const nodeType of this.includeNodes) {
24
+ if (nodeType in this.known.nodes) {
25
+ allowedNodes[nodeType] = this.known.nodes[nodeType];
26
+ }
27
+ }
28
+ this.known.nodes = allowedNodes;
29
+ this.types.nodes = this.types.nodes.filter((nodeType) => this.includeNodes.includes(nodeType.name));
30
+ }
31
+ if (this.excludeNodes.length) {
32
+ for (const nodeType of this.excludeNodes) {
33
+ delete this.known.nodes[nodeType];
34
+ }
35
+ this.types.nodes = this.types.nodes.filter((nodeType) => !this.excludeNodes.includes(nodeType.name));
36
+ }
37
+ console.debug(`Lazy-loading nodes and credentials from ${this.packageJson.name}`, {
38
+ nodes: (_b = (_a = this.types.nodes) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
39
+ credentials: (_d = (_c = this.types.credentials) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0,
40
+ });
41
+ this.isLazyLoaded = true;
42
+ return; // We can load nodes and credentials lazily now
43
+ }
44
+ catch (_e) {
45
+ console.debug("Can't enable lazy-loading");
46
+ yield _super.loadAll.call(this);
47
+ }
48
+ });
49
+ }
50
+ }
51
+ exports.LazyPackageDirectoryLoader = LazyPackageDirectoryLoader;
52
+ //# sourceMappingURL=lazy-package-directory-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-package-directory-loader.js","sourceRoot":"","sources":["../../../../src/lib/NodesLoader/lazy-package-directory-loader.ts"],"names":[],"mappings":";;;;AAAA,yEAAoE;AAEpE;;GAEG;AACH,MAAa,0BAA2B,SAAQ,iDAAsB;IACtD,OAAO;;;;;;YACrB,IAAI,CAAC;gBACJ,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;gBAChE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;gBAE5E,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;gBAChE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,C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;oBACpC,WAAW,EAAE,MAAA,MAAA,IAAI,CAAC,KAAK,CAAC,WAAW,0CAAE,MAAM,mCAAI,CAAC;iBAChD,CACD,CAAC;gBAEF,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;gBAEzB,OAAO,CAAC,+CAA+C;YACxD,CAAC;YAAC,WAAM,CAAC;gBACR,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;gBAC3C,MAAM,OAAM,OAAO,WAAE,CAAC;YACvB,CAAC;QACF,CAAC;KAAA;CACD;AAjDD,gEAiDC"}
@@ -0,0 +1 @@
1
+ export declare const loadClassInIsolation: <T>(filePath: string, className: string) => T;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadClassInIsolation = void 0;
4
+ const vm_1 = require("vm");
5
+ const Constants_1 = require("../Constants");
6
+ const context = (0, vm_1.createContext)({ require });
7
+ const loadClassInIsolation = (filePath, className) => {
8
+ if (process.platform === 'win32') {
9
+ filePath = filePath.replace(/\\/g, '/');
10
+ }
11
+ // Note: Skip the isolation because it breaks nock mocks in tests
12
+ if (Constants_1.inTest) {
13
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-member-access
14
+ return new (require(filePath)[className])();
15
+ }
16
+ else {
17
+ const script = new vm_1.Script(`new (require('${filePath}').${className})()`);
18
+ return script.runInContext(context);
19
+ }
20
+ };
21
+ exports.loadClassInIsolation = loadClassInIsolation;
22
+ //# sourceMappingURL=load-class-in-isolation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-class-in-isolation.js","sourceRoot":"","sources":["../../../../src/lib/NodesLoader/load-class-in-isolation.ts"],"names":[],"mappings":";;;AAAA,2BAA2C;AAE3C,4CAAsC;AAEtC,MAAM,OAAO,GAAG,IAAA,kBAAa,EAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AACpC,MAAM,oBAAoB,GAAG,CAAI,QAAgB,EAAE,SAAiB,EAAE,EAAE;IAC9E,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QAClC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC;IAED,iEAAiE;IACjE,IAAI,kBAAM,EAAE,CAAC;QACZ,6IAA6I;QAC7I,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,EAAO,CAAC;IAClD,CAAC;SAAM,CAAC;QACP,MAAM,MAAM,GAAG,IAAI,WAAM,CAAC,iBAAiB,QAAQ,MAAM,SAAS,KAAK,CAAC,CAAC;QACzE,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAM,CAAC;IAC1C,CAAC;AACF,CAAC,CAAC;AAbW,QAAA,oBAAoB,wBAa/B"}
@@ -0,0 +1,17 @@
1
+ import { DirectoryLoader } from './directory-loader';
2
+ import type { n8n } from './types';
3
+ /**
4
+ * Loader for source files of nodes and credentials located in a package dir,
5
+ * e.g. /nodes-base or community packages.
6
+ */
7
+ export declare class PackageDirectoryLoader extends DirectoryLoader {
8
+ packageJson: n8n.PackageJson;
9
+ packageName: string;
10
+ constructor(directory: string, excludeNodes?: string[], includeNodes?: string[]);
11
+ private extractNodeTypes;
12
+ loadAll(): Promise<void>;
13
+ private inferSupportedNodes;
14
+ private parseJSON;
15
+ protected readJSONSync<T>(file: string): T;
16
+ protected readJSON<T>(file: string): Promise<T>;
17
+ }
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PackageDirectoryLoader = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const workflow_1 = require("@fsai-flow/workflow");
6
+ const node_fs_1 = require("node:fs");
7
+ const promises_1 = require("node:fs/promises");
8
+ const directory_loader_1 = require("./directory-loader");
9
+ /**
10
+ * Loader for source files of nodes and credentials located in a package dir,
11
+ * e.g. /nodes-base or community packages.
12
+ */
13
+ class PackageDirectoryLoader extends directory_loader_1.DirectoryLoader {
14
+ constructor(directory, excludeNodes = [], includeNodes = []) {
15
+ super(directory, excludeNodes, includeNodes);
16
+ this.packageJson = this.readJSONSync('package.json');
17
+ this.packageName = this.packageJson.name;
18
+ this.excludeNodes = this.extractNodeTypes(excludeNodes);
19
+ this.includeNodes = this.extractNodeTypes(includeNodes);
20
+ }
21
+ extractNodeTypes(fullNodeTypes) {
22
+ return fullNodeTypes
23
+ .map((fullNodeType) => fullNodeType.split('.'))
24
+ .filter(([packageName]) => packageName === this.packageName)
25
+ .map(([_, nodeType]) => nodeType);
26
+ }
27
+ loadAll() {
28
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
+ var _a, _b;
30
+ const { n8n } = this.packageJson;
31
+ if (!n8n)
32
+ return;
33
+ const { nodes, credentials } = n8n;
34
+ if (Array.isArray(nodes)) {
35
+ for (const nodePath of nodes) {
36
+ this.loadNodeFromFile(nodePath);
37
+ }
38
+ }
39
+ if (Array.isArray(credentials)) {
40
+ for (const credentialPath of credentials) {
41
+ this.loadCredentialFromFile(credentialPath);
42
+ }
43
+ }
44
+ this.inferSupportedNodes();
45
+ console.debug(`Loaded all credentials and nodes from ${this.packageName}`, {
46
+ credentials: (_a = credentials === null || credentials === void 0 ? void 0 : credentials.length) !== null && _a !== void 0 ? _a : 0,
47
+ nodes: (_b = nodes === null || nodes === void 0 ? void 0 : nodes.length) !== null && _b !== void 0 ? _b : 0,
48
+ });
49
+ });
50
+ }
51
+ inferSupportedNodes() {
52
+ var _a, _b;
53
+ const knownCredentials = this.known.credentials;
54
+ for (const { type: credentialType } of Object.values(this.credentialTypes)) {
55
+ const supportedNodes = (_a = knownCredentials[credentialType.name].supportedNodes) !== null && _a !== void 0 ? _a : [];
56
+ if (supportedNodes.length > 0 && credentialType.httpRequestNode) {
57
+ credentialType.httpRequestNode.hidden = true;
58
+ }
59
+ credentialType.supportedNodes = supportedNodes;
60
+ if (!credentialType.iconUrl && !credentialType.icon) {
61
+ for (const supportedNode of supportedNodes) {
62
+ const nodeDescription = (_b = this.nodeTypes[supportedNode]) === null || _b === void 0 ? void 0 : _b.type.description;
63
+ if (!nodeDescription)
64
+ continue;
65
+ if (nodeDescription.icon) {
66
+ credentialType.icon = nodeDescription.icon;
67
+ credentialType.iconColor = nodeDescription.iconColor;
68
+ break;
69
+ }
70
+ if (nodeDescription.iconUrl) {
71
+ credentialType.iconUrl = nodeDescription.iconUrl;
72
+ break;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ parseJSON(fileString, filePath) {
79
+ try {
80
+ return (0, workflow_1.jsonParse)(fileString);
81
+ }
82
+ catch (error) {
83
+ throw new Error(`Failed to parse JSON, ${filePath}`);
84
+ }
85
+ }
86
+ readJSONSync(file) {
87
+ const filePath = this.resolvePath(file);
88
+ const fileString = (0, node_fs_1.readFileSync)(filePath, 'utf8');
89
+ return this.parseJSON(fileString, filePath);
90
+ }
91
+ readJSON(file) {
92
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
93
+ const filePath = this.resolvePath(file);
94
+ const fileString = yield (0, promises_1.readFile)(filePath, 'utf8');
95
+ return this.parseJSON(fileString, filePath);
96
+ });
97
+ }
98
+ }
99
+ exports.PackageDirectoryLoader = PackageDirectoryLoader;
100
+ //# sourceMappingURL=package-directory-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-directory-loader.js","sourceRoot":"","sources":["../../../../src/lib/NodesLoader/package-directory-loader.ts"],"names":[],"mappings":";;;;AAAA,kDAAsD;AACtD,qCAAuC;AACvC,+CAA4C;AAE5C,yDAAqD;AAGrD;;;GAGG;AACH,MAAa,sBAAuB,SAAQ,kCAAe;IAK1D,YAAY,SAAiB,EAAE,eAAyB,EAAE,EAAE,eAAyB,EAAE;QACtF,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QAE7C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,YAA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,CAAC,OAAO,CAAC;wBACjD,MAAM;oBACP,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;IAEO,SAAS,CAAI,UAAkB,EAAE,QAAgB;QACxD,IAAI,CAAC;YACJ,OAAO,IAAA,oBAAS,EAAI,UAAU,CAAC,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;QACtD,CAAC;IACF,CAAC;IAES,YAAY,CAAI,IAAY;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,UAAU,GAAG,IAAA,sBAAY,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,SAAS,CAAI,UAAU,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAEe,QAAQ,CAAI,IAAY;;YACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxC,MAAM,UAAU,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACpD,OAAO,IAAI,CAAC,SAAS,CAAI,UAAU,EAAE,QAAQ,CAAC,CAAC;QAChD,CAAC;KAAA;CACD;AA/FD,wDA+FC"}
@@ -0,0 +1,14 @@
1
+ export declare namespace n8n {
2
+ interface PackageJson {
3
+ name: string;
4
+ version: string;
5
+ n8n?: {
6
+ credentials?: string[];
7
+ nodes?: string[];
8
+ };
9
+ author?: {
10
+ name?: string;
11
+ email?: string;
12
+ };
13
+ }
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/NodesLoader/types.ts"],"names":[],"mappings":""}