@atom8n/n8n 2.4.7 → 2.5.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 (231) hide show
  1. package/dist/build.tsbuildinfo +1 -1
  2. package/dist/chat/chat-service.types.d.ts +6 -6
  3. package/dist/commands/execute-batch.d.ts +2 -2
  4. package/dist/commands/execute.js +0 -0
  5. package/dist/commands/import/credentials.d.ts +2 -2
  6. package/dist/commands/import/credentials.js +0 -0
  7. package/dist/commands/import/workflow.d.ts +2 -2
  8. package/dist/commands/ldap/reset.d.ts +2 -2
  9. package/dist/commands/mcp.d.ts +23 -0
  10. package/dist/commands/mcp.js +315 -0
  11. package/dist/commands/run.d.ts +23 -0
  12. package/dist/commands/run.js +162 -0
  13. package/dist/controllers/annotation-tags.controller.ee.d.ts +1 -1
  14. package/dist/controllers/cli.controller.d.ts +26 -0
  15. package/dist/controllers/cli.controller.js +334 -0
  16. package/dist/controllers/orchestration.controller.js +0 -0
  17. package/dist/controllers/users.controller.d.ts +1 -1
  18. package/dist/environments.ee/source-control/source-control-status.service.ee.d.ts +2 -2
  19. package/dist/environments.ee/source-control/source-control.controller.ee.d.ts +4 -4
  20. package/dist/environments.ee/source-control/source-control.service.ee.d.ts +2 -2
  21. package/dist/environments.ee/source-control/types/source-control-set-branch.js +0 -0
  22. package/dist/eventbus/event-message-classes/index.js +0 -0
  23. package/dist/events/relays/workflow-failure-notification.event-relay.d.ts +13 -0
  24. package/dist/events/relays/workflow-failure-notification.event-relay.js +77 -0
  25. package/dist/executions/execution-data/types.d.ts +17 -0
  26. package/dist/executions/execution-data/types.js +2 -0
  27. package/dist/executions/failed-run-factory.d.ts +4 -0
  28. package/dist/executions/failed-run-factory.js +71 -0
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +8 -0
  31. package/dist/interfaces.d.ts +1 -1
  32. package/dist/license.js +1 -1
  33. package/dist/middlewares/webview-frame-options.d.ts +2 -0
  34. package/dist/middlewares/webview-frame-options.js +22 -0
  35. package/dist/modules/chat-hub/chat-hub-extractor.d.ts +22 -0
  36. package/dist/modules/chat-hub/chat-hub-extractor.js +63 -0
  37. package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-user-entry-storage.d.ts +11 -0
  38. package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-user-entry-storage.js +58 -0
  39. package/dist/modules/dynamic-credentials.ee/database/entities/dynamic-credential-user-entry.d.ts +12 -0
  40. package/dist/modules/dynamic-credentials.ee/database/entities/dynamic-credential-user-entry.js +64 -0
  41. package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.d.ts +5 -0
  42. package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.js +25 -0
  43. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.d.ts +5 -0
  44. package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.js +36 -0
  45. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.d.ts +12 -0
  46. package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js +69 -0
  47. package/dist/modules/dynamic-credentials.ee/services/resolver-config-expression.service.d.ts +7 -0
  48. package/dist/modules/dynamic-credentials.ee/services/resolver-config-expression.service.js +46 -0
  49. package/dist/modules/insights/database/entities/insights-metadata.js +1 -1
  50. package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js +4 -1
  51. package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +1 -1
  52. package/dist/modules/insights/insights.module.d.ts +1 -1
  53. package/dist/modules/insights/insights.service.d.ts +1 -1
  54. package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.d.ts +6 -0
  55. package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.js +28 -0
  56. package/dist/modules/log-streaming.ee/database/entities/index.d.ts +1 -0
  57. package/dist/modules/log-streaming.ee/database/entities/index.js +5 -0
  58. package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.d.ts +5 -0
  59. package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.js +25 -0
  60. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.d.ts +4 -0
  61. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.js +24 -0
  62. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.d.ts +17 -0
  63. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.js +131 -0
  64. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.d.ts +22 -0
  65. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.js +116 -0
  66. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.d.ts +35 -0
  67. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.js +328 -0
  68. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.d.ts +28 -0
  69. package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.js +74 -0
  70. package/dist/modules/log-streaming.ee/log-streaming-destination.service.d.ts +32 -0
  71. package/dist/modules/log-streaming.ee/log-streaming-destination.service.js +175 -0
  72. package/dist/modules/log-streaming.ee/log-streaming.controller.d.ts +15 -0
  73. package/dist/modules/log-streaming.ee/log-streaming.controller.js +149 -0
  74. package/dist/modules/log-streaming.ee/log-streaming.module.d.ts +5 -0
  75. package/dist/modules/log-streaming.ee/log-streaming.module.js +66 -0
  76. package/dist/modules/mcp/mcp-oauth.helpers.js +0 -0
  77. package/dist/modules/mcp/mcp.oauth-clients.controller.js +0 -0
  78. package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +10 -10
  79. package/dist/modules/mcp/tools/schemas.d.ts +10 -10
  80. package/dist/modules/source-control.ee/constants.d.ts +17 -0
  81. package/dist/modules/source-control.ee/constants.js +22 -0
  82. package/dist/modules/source-control.ee/middleware/source-control-enabled-middleware.ee.d.ts +2 -0
  83. package/dist/modules/source-control.ee/middleware/source-control-enabled-middleware.ee.js +18 -0
  84. package/dist/modules/source-control.ee/source-control-export.service.ee.d.ts +37 -0
  85. package/dist/modules/source-control.ee/source-control-export.service.ee.js +426 -0
  86. package/dist/modules/source-control.ee/source-control-git.service.ee.d.ts +59 -0
  87. package/dist/modules/source-control.ee/source-control-git.service.ee.js +427 -0
  88. package/dist/modules/source-control.ee/source-control-helper.ee.d.ts +49 -0
  89. package/dist/modules/source-control.ee/source-control-helper.ee.js +241 -0
  90. package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +110 -0
  91. package/dist/modules/source-control.ee/source-control-import.service.ee.js +957 -0
  92. package/dist/modules/source-control.ee/source-control-preferences.service.ee.d.ts +46 -0
  93. package/dist/modules/source-control.ee/source-control-preferences.service.ee.js +309 -0
  94. package/dist/modules/source-control.ee/source-control-resource-helper.d.ts +4 -0
  95. package/dist/modules/source-control.ee/source-control-resource-helper.js +20 -0
  96. package/dist/modules/source-control.ee/source-control-scoped.service.d.ts +17 -0
  97. package/dist/modules/source-control.ee/source-control-scoped.service.js +134 -0
  98. package/dist/modules/source-control.ee/source-control-status.service.ee.d.ts +90 -0
  99. package/dist/modules/source-control.ee/source-control-status.service.ee.js +596 -0
  100. package/dist/modules/source-control.ee/source-control.config.d.ts +3 -0
  101. package/dist/modules/source-control.ee/source-control.config.js +26 -0
  102. package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +157 -0
  103. package/dist/modules/source-control.ee/source-control.controller.ee.js +347 -0
  104. package/dist/modules/source-control.ee/source-control.module.d.ts +4 -0
  105. package/dist/modules/source-control.ee/source-control.module.js +59 -0
  106. package/dist/modules/source-control.ee/source-control.service.ee.d.ts +125 -0
  107. package/dist/modules/source-control.ee/source-control.service.ee.js +466 -0
  108. package/dist/modules/source-control.ee/types/export-result.d.ts +10 -0
  109. package/dist/modules/source-control.ee/types/export-result.js +2 -0
  110. package/dist/modules/source-control.ee/types/exportable-credential.d.ts +14 -0
  111. package/dist/modules/source-control.ee/types/exportable-credential.js +2 -0
  112. package/dist/modules/source-control.ee/types/exportable-folders.d.ts +11 -0
  113. package/dist/modules/source-control.ee/types/exportable-folders.js +2 -0
  114. package/dist/modules/source-control.ee/types/exportable-project.d.ts +17 -0
  115. package/dist/modules/source-control.ee/types/exportable-project.js +2 -0
  116. package/dist/modules/source-control.ee/types/exportable-tags.d.ts +5 -0
  117. package/dist/modules/source-control.ee/types/exportable-tags.js +2 -0
  118. package/dist/modules/source-control.ee/types/exportable-variable.d.ts +7 -0
  119. package/dist/modules/source-control.ee/types/exportable-variable.js +2 -0
  120. package/dist/modules/source-control.ee/types/exportable-workflow.d.ts +14 -0
  121. package/dist/modules/source-control.ee/types/exportable-workflow.js +2 -0
  122. package/dist/modules/source-control.ee/types/import-result.d.ts +20 -0
  123. package/dist/modules/source-control.ee/types/import-result.js +2 -0
  124. package/dist/modules/source-control.ee/types/key-pair-type.d.ts +1 -0
  125. package/dist/modules/source-control.ee/types/key-pair-type.js +2 -0
  126. package/dist/modules/source-control.ee/types/key-pair.d.ts +4 -0
  127. package/dist/modules/source-control.ee/types/key-pair.js +2 -0
  128. package/dist/modules/source-control.ee/types/requests.d.ts +21 -0
  129. package/dist/modules/source-control.ee/types/requests.js +2 -0
  130. package/dist/modules/source-control.ee/types/resource-owner.d.ts +17 -0
  131. package/dist/modules/source-control.ee/types/resource-owner.js +2 -0
  132. package/dist/modules/source-control.ee/types/source-control-commit.d.ts +3 -0
  133. package/dist/modules/source-control.ee/types/source-control-commit.js +20 -0
  134. package/dist/modules/source-control.ee/types/source-control-context.d.ts +7 -0
  135. package/dist/modules/source-control.ee/types/source-control-context.js +16 -0
  136. package/dist/modules/source-control.ee/types/source-control-disconnect.d.ts +3 -0
  137. package/dist/modules/source-control.ee/types/source-control-disconnect.js +21 -0
  138. package/dist/modules/source-control.ee/types/source-control-generate-key-pair.d.ts +4 -0
  139. package/dist/modules/source-control.ee/types/source-control-generate-key-pair.js +21 -0
  140. package/dist/modules/source-control.ee/types/source-control-get-status.d.ts +10 -0
  141. package/dist/modules/source-control.ee/types/source-control-get-status.js +42 -0
  142. package/dist/modules/source-control.ee/types/source-control-preferences.d.ts +17 -0
  143. package/dist/modules/source-control.ee/types/source-control-preferences.js +88 -0
  144. package/dist/modules/source-control.ee/types/source-control-push.d.ts +3 -0
  145. package/dist/modules/source-control.ee/types/source-control-push.js +21 -0
  146. package/dist/modules/source-control.ee/types/source-control-set-branch.d.ts +3 -0
  147. package/dist/modules/source-control.ee/types/source-control-set-branch.js +20 -0
  148. package/dist/modules/source-control.ee/types/source-control-set-read-only.d.ts +3 -0
  149. package/dist/modules/source-control.ee/types/source-control-set-read-only.js +20 -0
  150. package/dist/modules/source-control.ee/types/source-control-stage.d.ts +5 -0
  151. package/dist/modules/source-control.ee/types/source-control-stage.js +31 -0
  152. package/dist/modules/source-control.ee/types/source-control-workflow-version-id.d.ts +12 -0
  153. package/dist/modules/source-control.ee/types/source-control-workflow-version-id.js +2 -0
  154. package/dist/modules/sso-oidc/constants.d.ts +3 -0
  155. package/dist/modules/sso-oidc/constants.js +6 -0
  156. package/dist/modules/sso-oidc/oidc.controller.ee.d.ts +23 -0
  157. package/dist/modules/sso-oidc/oidc.controller.ee.js +123 -0
  158. package/dist/modules/sso-oidc/oidc.service.ee.d.ts +56 -0
  159. package/dist/modules/sso-oidc/oidc.service.ee.js +468 -0
  160. package/dist/modules/sso-oidc/sso-oidc.module.d.ts +4 -0
  161. package/dist/modules/sso-oidc/sso-oidc.module.js +55 -0
  162. package/dist/modules/sso-saml/constants.d.ts +3 -0
  163. package/dist/modules/sso-saml/constants.js +6 -0
  164. package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.d.ts +4 -0
  165. package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.js +10 -0
  166. package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.d.ts +4 -0
  167. package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.js +10 -0
  168. package/dist/modules/sso-saml/middleware/saml-enabled-middleware.d.ts +3 -0
  169. package/dist/modules/sso-saml/middleware/saml-enabled-middleware.js +22 -0
  170. package/dist/modules/sso-saml/saml-helpers.d.ts +19 -0
  171. package/dist/modules/sso-saml/saml-helpers.js +129 -0
  172. package/dist/modules/sso-saml/saml-validator.d.ts +16 -0
  173. package/dist/modules/sso-saml/saml-validator.js +129 -0
  174. package/dist/modules/sso-saml/saml.controller.ee.d.ts +50 -0
  175. package/dist/modules/sso-saml/saml.controller.ee.js +227 -0
  176. package/dist/modules/sso-saml/saml.service.ee.d.ts +52 -0
  177. package/dist/modules/sso-saml/saml.service.ee.js +462 -0
  178. package/dist/modules/sso-saml/schema/metadata-exchange.xsd.d.ts +2 -0
  179. package/dist/modules/sso-saml/schema/metadata-exchange.xsd.js +118 -0
  180. package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.d.ts +2 -0
  181. package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.js +201 -0
  182. package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.d.ts +2 -0
  183. package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.js +114 -0
  184. package/dist/modules/sso-saml/schema/saml-schema-assertion-2.0.xsd.d.ts +2 -0
  185. package/dist/modules/sso-saml/schema/saml-schema-assertion-2.0.xsd.js +289 -0
  186. package/dist/modules/sso-saml/schema/saml-schema-metadata-2.0.xsd.d.ts +2 -0
  187. package/dist/modules/sso-saml/schema/saml-schema-metadata-2.0.xsd.js +344 -0
  188. package/dist/modules/sso-saml/schema/saml-schema-protocol-2.0.xsd.d.ts +2 -0
  189. package/dist/modules/sso-saml/schema/saml-schema-protocol-2.0.xsd.js +308 -0
  190. package/dist/modules/sso-saml/schema/ws-addr.xsd.d.ts +2 -0
  191. package/dist/modules/sso-saml/schema/ws-addr.xsd.js +143 -0
  192. package/dist/modules/sso-saml/schema/ws-authorization.xsd.d.ts +2 -0
  193. package/dist/modules/sso-saml/schema/ws-authorization.xsd.js +151 -0
  194. package/dist/modules/sso-saml/schema/ws-federation.xsd.d.ts +2 -0
  195. package/dist/modules/sso-saml/schema/ws-federation.xsd.js +476 -0
  196. package/dist/modules/sso-saml/schema/ws-securitypolicy-1.2.xsd.d.ts +2 -0
  197. package/dist/modules/sso-saml/schema/ws-securitypolicy-1.2.xsd.js +1211 -0
  198. package/dist/modules/sso-saml/schema/xenc-schema.xsd.d.ts +2 -0
  199. package/dist/modules/sso-saml/schema/xenc-schema.xsd.js +151 -0
  200. package/dist/modules/sso-saml/schema/xml.xsd.d.ts +2 -0
  201. package/dist/modules/sso-saml/schema/xml.xsd.js +123 -0
  202. package/dist/modules/sso-saml/schema/xmldsig-core-schema.xsd.d.ts +2 -0
  203. package/dist/modules/sso-saml/schema/xmldsig-core-schema.xsd.js +324 -0
  204. package/dist/modules/sso-saml/service-provider.ee.d.ts +6 -0
  205. package/dist/modules/sso-saml/service-provider.ee.js +44 -0
  206. package/dist/modules/sso-saml/sso-saml.module.d.ts +4 -0
  207. package/dist/modules/sso-saml/sso-saml.module.js +55 -0
  208. package/dist/modules/sso-saml/types.d.ts +4 -0
  209. package/dist/modules/sso-saml/types.js +2 -0
  210. package/dist/modules/sso-saml/views/init-sso-post.d.ts +2 -0
  211. package/dist/modules/sso-saml/views/init-sso-post.js +16 -0
  212. package/dist/node-lib.d.ts +10 -0
  213. package/dist/node-lib.js +137 -0
  214. package/dist/push/index.d.ts +1 -1
  215. package/dist/server.d.ts +1 -0
  216. package/dist/server.js +1 -0
  217. package/dist/services/cors-service.d.ts +7 -0
  218. package/dist/services/cors-service.js +50 -0
  219. package/dist/services/static-auth-service.d.ts +4 -0
  220. package/dist/services/static-auth-service.js +29 -0
  221. package/dist/sso.ee/saml/schema/metadata-exchange.xsd.js +0 -0
  222. package/dist/task-runners/task-broker/errors/task-runner-accept-timeout.error.js +0 -0
  223. package/dist/typecheck.tsbuildinfo +1 -0
  224. package/dist/user-management/email/templates/workflow-failure.handlebars +211 -0
  225. package/dist/utils/cors.util.d.ts +2 -0
  226. package/dist/utils/cors.util.js +17 -0
  227. package/dist/webhooks/waiting-forms.js +3 -3
  228. package/dist/webhooks/waiting-webhooks.js +2 -0
  229. package/dist/workflows/workflow.service.d.ts +2 -2
  230. package/dist/workflows/workflows.controller.d.ts +6 -6
  231. package/package.json +22 -21
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ 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;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.SamlModule = void 0;
43
+ const decorators_1 = require("@n8n/decorators");
44
+ const di_1 = require("@n8n/di");
45
+ let SamlModule = class SamlModule {
46
+ async init() {
47
+ await Promise.resolve().then(() => __importStar(require('./saml.controller.ee')));
48
+ const { SamlService } = await Promise.resolve().then(() => __importStar(require('./saml.service.ee')));
49
+ await di_1.Container.get(SamlService).init();
50
+ }
51
+ };
52
+ exports.SamlModule = SamlModule;
53
+ exports.SamlModule = SamlModule = __decorate([
54
+ (0, decorators_1.BackendModule)({ name: 'sso-saml', licenseFlag: 'feat:saml', instanceTypes: ['main'] })
55
+ ], SamlModule);
@@ -0,0 +1,4 @@
1
+ import type { SamlPreferences, SamlPreferencesAttributeMapping } from '@n8n/api-types';
2
+ export type SamlLoginBinding = SamlPreferences['loginBinding'];
3
+ export type SamlAttributeMapping = NonNullable<SamlPreferencesAttributeMapping>;
4
+ export type SamlUserAttributes = SamlAttributeMapping;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import type { PostBindingContext } from 'samlify/types/src/entity';
2
+ export declare function getInitSSOFormView(context: PostBindingContext): string;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getInitSSOFormView = getInitSSOFormView;
4
+ function getInitSSOFormView(context) {
5
+ return `
6
+ <form id="saml-form" method="post" action="${context.entityEndpoint}" autocomplete="off">
7
+ <input type="hidden" name="${context.type}" value="${context.context}" />
8
+ ${context.relayState ? '<input type="hidden" name="RelayState" value="{{relayState}}" />' : ''}
9
+ </form>
10
+ <script type="text/javascript">
11
+ // Automatic form submission
12
+ (function(){
13
+ document.forms[0].submit();
14
+ })();
15
+ </script>`;
16
+ }
@@ -0,0 +1,10 @@
1
+ interface N8nRunOptions {
2
+ port?: number;
3
+ baseUrl?: string;
4
+ }
5
+ declare function run(filePath: string, input?: string | Record<string, unknown>, debug?: boolean, options?: N8nRunOptions): Promise<unknown[]>;
6
+ declare const n8n: {
7
+ run: typeof run;
8
+ };
9
+ export default n8n;
10
+ export { run, type N8nRunOptions };
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.run = run;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const LOG_PREFIX = '[n8n-lib]';
10
+ async function run(filePath, input, debug = false, options) {
11
+ const log = (...args) => {
12
+ if (debug)
13
+ console.log(LOG_PREFIX, ...args);
14
+ };
15
+ const logError = (...args) => {
16
+ if (debug)
17
+ console.error(LOG_PREFIX, ...args);
18
+ };
19
+ const logWarn = (...args) => {
20
+ if (debug)
21
+ console.warn(LOG_PREFIX, ...args);
22
+ };
23
+ log('── RUN START ──');
24
+ log(`filePath: "${filePath}"`);
25
+ log(`input: ${input !== undefined ? JSON.stringify(input) : '(none)'}`);
26
+ const resolvedPath = path_1.default.resolve(filePath);
27
+ log(`Resolved path: "${resolvedPath}"`);
28
+ if (!fs_1.default.existsSync(resolvedPath)) {
29
+ const errorMsg = `Workflow file does not exist: ${resolvedPath}`;
30
+ logError(`ERROR: ${errorMsg}`);
31
+ throw new Error(errorMsg);
32
+ }
33
+ let workflowData;
34
+ try {
35
+ const fileContent = fs_1.default.readFileSync(resolvedPath, { encoding: 'utf8' });
36
+ workflowData = JSON.parse(fileContent);
37
+ log('Successfully parsed workflow file');
38
+ log(` Name: "${workflowData.name}"`);
39
+ log(` Nodes: ${Array.isArray(workflowData.nodes) ? workflowData.nodes.length : 0}`);
40
+ }
41
+ catch (error) {
42
+ const errorMsg = `Failed to parse workflow file: ${error instanceof Error ? error.message : String(error)}`;
43
+ logError(`ERROR: ${errorMsg}`);
44
+ throw new Error(errorMsg);
45
+ }
46
+ let serverUrl;
47
+ if (options?.baseUrl) {
48
+ serverUrl = options.baseUrl.replace(/\/+$/, '');
49
+ log(`Using provided baseUrl: "${serverUrl}"`);
50
+ }
51
+ else {
52
+ const port = options?.port ?? parseInt(process.env.N8N_PORT ?? '5888', 10);
53
+ serverUrl = `http://localhost:${port}`;
54
+ log(`Using server URL: "${serverUrl}" (port: ${port})`);
55
+ }
56
+ const healthUrl = `${serverUrl}/rest/cli/health`;
57
+ log(`Health check: GET ${healthUrl}`);
58
+ try {
59
+ const healthResponse = await fetch(healthUrl);
60
+ if (!healthResponse.ok) {
61
+ throw new Error(`Health check returned status ${healthResponse.status}`);
62
+ }
63
+ log('Server is reachable');
64
+ }
65
+ catch (error) {
66
+ const errorMsg = `Cannot reach n8n server at ${serverUrl}. Is the server running? Error: ${error instanceof Error ? error.message : String(error)}`;
67
+ logError(`ERROR: ${errorMsg}`);
68
+ throw new Error(errorMsg);
69
+ }
70
+ const runUrl = `${serverUrl}/rest/cli/run`;
71
+ log(`Executing workflow: POST ${runUrl}`);
72
+ const requestBody = { workflowData };
73
+ if (input !== undefined) {
74
+ if (typeof input === 'string') {
75
+ requestBody.chatInput = input;
76
+ }
77
+ else {
78
+ requestBody.inputData = input;
79
+ }
80
+ }
81
+ log(`Request body keys: ${Object.keys(requestBody).join(', ')}`);
82
+ let response;
83
+ try {
84
+ response = await fetch(runUrl, {
85
+ method: 'POST',
86
+ headers: { 'Content-Type': 'application/json' },
87
+ body: JSON.stringify(requestBody),
88
+ });
89
+ log(`Response status: ${response.status} ${response.statusText}`);
90
+ }
91
+ catch (error) {
92
+ const errorMsg = `Failed to call n8n API: ${error instanceof Error ? error.message : String(error)}`;
93
+ logError(`ERROR: ${errorMsg}`);
94
+ throw new Error(errorMsg);
95
+ }
96
+ if (!response.ok) {
97
+ const errorBody = await response.text();
98
+ const errorMsg = `API error: ${response.status} ${response.statusText} — ${errorBody}`;
99
+ logError(`ERROR: ${errorMsg}`);
100
+ throw new Error(errorMsg);
101
+ }
102
+ const apiResult = (await response.json());
103
+ log('── RESULT ──');
104
+ log(`Success: ${apiResult.success}`);
105
+ log(`Execution ID: ${apiResult.executionId ?? 'unknown'}`);
106
+ log(`Status: ${apiResult.status ?? 'unknown'}`);
107
+ log(`Execution time: ${apiResult.executionTime ?? '?'}s`);
108
+ if (!apiResult.success) {
109
+ const errorMsg = apiResult.error ?? 'Workflow execution failed';
110
+ logError(`Execution error: ${errorMsg}`);
111
+ throw new Error(String(errorMsg));
112
+ }
113
+ const lastNodeName = apiResult.data?.lastNodeExecuted;
114
+ log(`Last node executed: "${lastNodeName ?? 'unknown'}"`);
115
+ if (!lastNodeName || !apiResult.data?.runData?.[lastNodeName]) {
116
+ logWarn('No output data found for last node');
117
+ log('── RUN END ──');
118
+ return [];
119
+ }
120
+ const lastNodeRuns = apiResult.data.runData[lastNodeName];
121
+ const lastRun = lastNodeRuns[lastNodeRuns.length - 1];
122
+ const outputItems = [];
123
+ if (lastRun?.data?.main) {
124
+ for (const branch of lastRun.data.main) {
125
+ if (branch) {
126
+ for (const item of branch) {
127
+ outputItems.push(item.json);
128
+ }
129
+ }
130
+ }
131
+ }
132
+ log(`Output items: ${outputItems.length}`);
133
+ log('── RUN END ──');
134
+ return outputItems;
135
+ }
136
+ const n8n = { run };
137
+ exports.default = n8n;
@@ -25,7 +25,7 @@ export declare class Push extends TypedEmitter<PushEvents> {
25
25
  isBidirectional: boolean;
26
26
  private backend;
27
27
  constructor(config: PushConfig, instanceSettings: InstanceSettings, logger: Logger, authService: AuthService, publisher: Publisher);
28
- getBackend(): SSEPush | WebSocketPush;
28
+ getBackend(): WebSocketPush | SSEPush;
29
29
  setupPushServer(restEndpoint: string, server: Server, app: Application): void;
30
30
  setupPushHandler(restEndpoint: string, app: Application): void;
31
31
  handleRequest(req: SSEPushRequest | WebSocketPushRequest, res: PushResponse): void;
package/dist/server.d.ts CHANGED
@@ -26,6 +26,7 @@ import './controllers/users.controller';
26
26
  import './controllers/user-settings.controller';
27
27
  import './controllers/workflow-statistics.controller';
28
28
  import './controllers/api-keys.controller';
29
+ import './controllers/cli.controller';
29
30
  import './credentials/credentials.controller';
30
31
  import './eventbus/event-bus.controller';
31
32
  import './events/events.controller';
package/dist/server.js CHANGED
@@ -97,6 +97,7 @@ require("./controllers/users.controller");
97
97
  require("./controllers/user-settings.controller");
98
98
  require("./controllers/workflow-statistics.controller");
99
99
  require("./controllers/api-keys.controller");
100
+ require("./controllers/cli.controller");
100
101
  require("./credentials/credentials.controller");
101
102
  require("./eventbus/event-bus.controller");
102
103
  require("./events/events.controller");
@@ -0,0 +1,7 @@
1
+ import type { CorsOptions } from '@n8n/decorators';
2
+ import type { Response, Request } from 'express';
3
+ export declare class CorsService {
4
+ private readonly defaultOptions;
5
+ applyCorsHeaders(req: Request, res: Response, options?: Partial<CorsOptions>): boolean;
6
+ private isOriginAllowed;
7
+ }
@@ -0,0 +1,50 @@
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.CorsService = void 0;
10
+ const di_1 = require("@n8n/di");
11
+ let CorsService = class CorsService {
12
+ constructor() {
13
+ this.defaultOptions = {
14
+ allowedOrigins: ['*'],
15
+ allowedMethods: ['get', 'post', 'options', 'put', 'patch', 'delete'],
16
+ allowedHeaders: ['Origin', 'X-Requested-With', 'Content-Type', 'Accept'],
17
+ maxAge: 86400,
18
+ };
19
+ }
20
+ applyCorsHeaders(req, res, options) {
21
+ const config = { ...this.defaultOptions, ...options };
22
+ const requestOrigin = req.headers.origin;
23
+ if (!requestOrigin)
24
+ return false;
25
+ const isAllowed = this.isOriginAllowed(requestOrigin, config.allowedOrigins ?? []);
26
+ if (!isAllowed)
27
+ return false;
28
+ res.header('Access-Control-Allow-Origin', requestOrigin);
29
+ if (config.allowCredentials !== undefined) {
30
+ res.header('Access-Control-Allow-Credentials', `${config.allowCredentials}`);
31
+ }
32
+ if (config.allowedMethods) {
33
+ res.header('Access-Control-Allow-Methods', config.allowedMethods.join(', ').toUpperCase());
34
+ }
35
+ if (config.allowedHeaders) {
36
+ res.header('Access-Control-Allow-Headers', config.allowedHeaders.join(', '));
37
+ }
38
+ if (config.maxAge) {
39
+ res.header('Access-Control-Max-Age', config.maxAge.toString());
40
+ }
41
+ return true;
42
+ }
43
+ isOriginAllowed(origin, allowedOrigins) {
44
+ return allowedOrigins.includes('*') || allowedOrigins.includes(origin);
45
+ }
46
+ };
47
+ exports.CorsService = CorsService;
48
+ exports.CorsService = CorsService = __decorate([
49
+ (0, di_1.Service)()
50
+ ], CorsService);
@@ -0,0 +1,4 @@
1
+ import { Request, Response, NextFunction } from 'express';
2
+ export declare class StaticAuthService {
3
+ static getStaticAuthMiddleware(endpointAuthToken: string, headerName?: string): ((req: Request, res: Response, next: NextFunction) => void) | null;
4
+ }
@@ -0,0 +1,29 @@
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.StaticAuthService = void 0;
10
+ const di_1 = require("@n8n/di");
11
+ let StaticAuthService = class StaticAuthService {
12
+ static getStaticAuthMiddleware(endpointAuthToken, headerName = 'authorization') {
13
+ if (!endpointAuthToken?.trim()) {
14
+ return null;
15
+ }
16
+ const expectedAuthorizationHeaderValue = `Bearer ${endpointAuthToken.trim()}`;
17
+ return (req, res, next) => {
18
+ if (req.headers[headerName] !== expectedAuthorizationHeaderValue) {
19
+ res.status(401).send('Unauthorized');
20
+ return;
21
+ }
22
+ next();
23
+ };
24
+ }
25
+ };
26
+ exports.StaticAuthService = StaticAuthService;
27
+ exports.StaticAuthService = StaticAuthService = __decorate([
28
+ (0, di_1.Service)()
29
+ ], StaticAuthService);
File without changes