@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.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/chat/chat-service.types.d.ts +6 -6
- package/dist/commands/execute-batch.d.ts +2 -2
- package/dist/commands/execute.js +0 -0
- package/dist/commands/import/credentials.d.ts +2 -2
- package/dist/commands/import/credentials.js +0 -0
- package/dist/commands/import/workflow.d.ts +2 -2
- package/dist/commands/ldap/reset.d.ts +2 -2
- package/dist/commands/mcp.d.ts +23 -0
- package/dist/commands/mcp.js +315 -0
- package/dist/commands/run.d.ts +23 -0
- package/dist/commands/run.js +162 -0
- package/dist/controllers/annotation-tags.controller.ee.d.ts +1 -1
- package/dist/controllers/cli.controller.d.ts +26 -0
- package/dist/controllers/cli.controller.js +334 -0
- package/dist/controllers/orchestration.controller.js +0 -0
- package/dist/controllers/users.controller.d.ts +1 -1
- package/dist/environments.ee/source-control/source-control-status.service.ee.d.ts +2 -2
- package/dist/environments.ee/source-control/source-control.controller.ee.d.ts +4 -4
- package/dist/environments.ee/source-control/source-control.service.ee.d.ts +2 -2
- package/dist/environments.ee/source-control/types/source-control-set-branch.js +0 -0
- package/dist/eventbus/event-message-classes/index.js +0 -0
- package/dist/events/relays/workflow-failure-notification.event-relay.d.ts +13 -0
- package/dist/events/relays/workflow-failure-notification.event-relay.js +77 -0
- package/dist/executions/execution-data/types.d.ts +17 -0
- package/dist/executions/execution-data/types.js +2 -0
- package/dist/executions/failed-run-factory.d.ts +4 -0
- package/dist/executions/failed-run-factory.js +71 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -0
- package/dist/interfaces.d.ts +1 -1
- package/dist/license.js +1 -1
- package/dist/middlewares/webview-frame-options.d.ts +2 -0
- package/dist/middlewares/webview-frame-options.js +22 -0
- package/dist/modules/chat-hub/chat-hub-extractor.d.ts +22 -0
- package/dist/modules/chat-hub/chat-hub-extractor.js +63 -0
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-user-entry-storage.d.ts +11 -0
- package/dist/modules/dynamic-credentials.ee/credential-resolvers/storage/dynamic-credential-user-entry-storage.js +58 -0
- package/dist/modules/dynamic-credentials.ee/database/entities/dynamic-credential-user-entry.d.ts +12 -0
- package/dist/modules/dynamic-credentials.ee/database/entities/dynamic-credential-user-entry.js +64 -0
- package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.d.ts +5 -0
- package/dist/modules/dynamic-credentials.ee/database/repositories/dynamic-credential-user-entry.repository.js +25 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.d.ts +5 -0
- package/dist/modules/dynamic-credentials.ee/dynamic-credentials.config.js +36 -0
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.d.ts +12 -0
- package/dist/modules/dynamic-credentials.ee/services/dynamic-credential-cors.service.js +69 -0
- package/dist/modules/dynamic-credentials.ee/services/resolver-config-expression.service.d.ts +7 -0
- package/dist/modules/dynamic-credentials.ee/services/resolver-config-expression.service.js +46 -0
- package/dist/modules/insights/database/entities/insights-metadata.js +1 -1
- package/dist/modules/insights/database/repositories/insights-by-period-query.helper.js +4 -1
- package/dist/modules/insights/database/repositories/insights-by-period.repository.d.ts +1 -1
- package/dist/modules/insights/insights.module.d.ts +1 -1
- package/dist/modules/insights/insights.service.d.ts +1 -1
- package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.d.ts +6 -0
- package/dist/modules/log-streaming.ee/database/entities/event-destination.entity.js +28 -0
- package/dist/modules/log-streaming.ee/database/entities/index.d.ts +1 -0
- package/dist/modules/log-streaming.ee/database/entities/index.js +5 -0
- package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.d.ts +5 -0
- package/dist/modules/log-streaming.ee/database/repositories/event-destination.repository.js +25 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.d.ts +4 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-from-db.js +24 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.d.ts +17 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.js +131 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.d.ts +22 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.js +116 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.d.ts +35 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.js +328 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.d.ts +28 -0
- package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination.ee.js +74 -0
- package/dist/modules/log-streaming.ee/log-streaming-destination.service.d.ts +32 -0
- package/dist/modules/log-streaming.ee/log-streaming-destination.service.js +175 -0
- package/dist/modules/log-streaming.ee/log-streaming.controller.d.ts +15 -0
- package/dist/modules/log-streaming.ee/log-streaming.controller.js +149 -0
- package/dist/modules/log-streaming.ee/log-streaming.module.d.ts +5 -0
- package/dist/modules/log-streaming.ee/log-streaming.module.js +66 -0
- package/dist/modules/mcp/mcp-oauth.helpers.js +0 -0
- package/dist/modules/mcp/mcp.oauth-clients.controller.js +0 -0
- package/dist/modules/mcp/tools/execute-workflow.tool.d.ts +10 -10
- package/dist/modules/mcp/tools/schemas.d.ts +10 -10
- package/dist/modules/source-control.ee/constants.d.ts +17 -0
- package/dist/modules/source-control.ee/constants.js +22 -0
- package/dist/modules/source-control.ee/middleware/source-control-enabled-middleware.ee.d.ts +2 -0
- package/dist/modules/source-control.ee/middleware/source-control-enabled-middleware.ee.js +18 -0
- package/dist/modules/source-control.ee/source-control-export.service.ee.d.ts +37 -0
- package/dist/modules/source-control.ee/source-control-export.service.ee.js +426 -0
- package/dist/modules/source-control.ee/source-control-git.service.ee.d.ts +59 -0
- package/dist/modules/source-control.ee/source-control-git.service.ee.js +427 -0
- package/dist/modules/source-control.ee/source-control-helper.ee.d.ts +49 -0
- package/dist/modules/source-control.ee/source-control-helper.ee.js +241 -0
- package/dist/modules/source-control.ee/source-control-import.service.ee.d.ts +110 -0
- package/dist/modules/source-control.ee/source-control-import.service.ee.js +957 -0
- package/dist/modules/source-control.ee/source-control-preferences.service.ee.d.ts +46 -0
- package/dist/modules/source-control.ee/source-control-preferences.service.ee.js +309 -0
- package/dist/modules/source-control.ee/source-control-resource-helper.d.ts +4 -0
- package/dist/modules/source-control.ee/source-control-resource-helper.js +20 -0
- package/dist/modules/source-control.ee/source-control-scoped.service.d.ts +17 -0
- package/dist/modules/source-control.ee/source-control-scoped.service.js +134 -0
- package/dist/modules/source-control.ee/source-control-status.service.ee.d.ts +90 -0
- package/dist/modules/source-control.ee/source-control-status.service.ee.js +596 -0
- package/dist/modules/source-control.ee/source-control.config.d.ts +3 -0
- package/dist/modules/source-control.ee/source-control.config.js +26 -0
- package/dist/modules/source-control.ee/source-control.controller.ee.d.ts +157 -0
- package/dist/modules/source-control.ee/source-control.controller.ee.js +347 -0
- package/dist/modules/source-control.ee/source-control.module.d.ts +4 -0
- package/dist/modules/source-control.ee/source-control.module.js +59 -0
- package/dist/modules/source-control.ee/source-control.service.ee.d.ts +125 -0
- package/dist/modules/source-control.ee/source-control.service.ee.js +466 -0
- package/dist/modules/source-control.ee/types/export-result.d.ts +10 -0
- package/dist/modules/source-control.ee/types/export-result.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-credential.d.ts +14 -0
- package/dist/modules/source-control.ee/types/exportable-credential.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-folders.d.ts +11 -0
- package/dist/modules/source-control.ee/types/exportable-folders.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-project.d.ts +17 -0
- package/dist/modules/source-control.ee/types/exportable-project.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-tags.d.ts +5 -0
- package/dist/modules/source-control.ee/types/exportable-tags.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-variable.d.ts +7 -0
- package/dist/modules/source-control.ee/types/exportable-variable.js +2 -0
- package/dist/modules/source-control.ee/types/exportable-workflow.d.ts +14 -0
- package/dist/modules/source-control.ee/types/exportable-workflow.js +2 -0
- package/dist/modules/source-control.ee/types/import-result.d.ts +20 -0
- package/dist/modules/source-control.ee/types/import-result.js +2 -0
- package/dist/modules/source-control.ee/types/key-pair-type.d.ts +1 -0
- package/dist/modules/source-control.ee/types/key-pair-type.js +2 -0
- package/dist/modules/source-control.ee/types/key-pair.d.ts +4 -0
- package/dist/modules/source-control.ee/types/key-pair.js +2 -0
- package/dist/modules/source-control.ee/types/requests.d.ts +21 -0
- package/dist/modules/source-control.ee/types/requests.js +2 -0
- package/dist/modules/source-control.ee/types/resource-owner.d.ts +17 -0
- package/dist/modules/source-control.ee/types/resource-owner.js +2 -0
- package/dist/modules/source-control.ee/types/source-control-commit.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-commit.js +20 -0
- package/dist/modules/source-control.ee/types/source-control-context.d.ts +7 -0
- package/dist/modules/source-control.ee/types/source-control-context.js +16 -0
- package/dist/modules/source-control.ee/types/source-control-disconnect.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-disconnect.js +21 -0
- package/dist/modules/source-control.ee/types/source-control-generate-key-pair.d.ts +4 -0
- package/dist/modules/source-control.ee/types/source-control-generate-key-pair.js +21 -0
- package/dist/modules/source-control.ee/types/source-control-get-status.d.ts +10 -0
- package/dist/modules/source-control.ee/types/source-control-get-status.js +42 -0
- package/dist/modules/source-control.ee/types/source-control-preferences.d.ts +17 -0
- package/dist/modules/source-control.ee/types/source-control-preferences.js +88 -0
- package/dist/modules/source-control.ee/types/source-control-push.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-push.js +21 -0
- package/dist/modules/source-control.ee/types/source-control-set-branch.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-set-branch.js +20 -0
- package/dist/modules/source-control.ee/types/source-control-set-read-only.d.ts +3 -0
- package/dist/modules/source-control.ee/types/source-control-set-read-only.js +20 -0
- package/dist/modules/source-control.ee/types/source-control-stage.d.ts +5 -0
- package/dist/modules/source-control.ee/types/source-control-stage.js +31 -0
- package/dist/modules/source-control.ee/types/source-control-workflow-version-id.d.ts +12 -0
- package/dist/modules/source-control.ee/types/source-control-workflow-version-id.js +2 -0
- package/dist/modules/sso-oidc/constants.d.ts +3 -0
- package/dist/modules/sso-oidc/constants.js +6 -0
- package/dist/modules/sso-oidc/oidc.controller.ee.d.ts +23 -0
- package/dist/modules/sso-oidc/oidc.controller.ee.js +123 -0
- package/dist/modules/sso-oidc/oidc.service.ee.d.ts +56 -0
- package/dist/modules/sso-oidc/oidc.service.ee.js +468 -0
- package/dist/modules/sso-oidc/sso-oidc.module.d.ts +4 -0
- package/dist/modules/sso-oidc/sso-oidc.module.js +55 -0
- package/dist/modules/sso-saml/constants.d.ts +3 -0
- package/dist/modules/sso-saml/constants.js +6 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.d.ts +4 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata-url.error.js +10 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.d.ts +4 -0
- package/dist/modules/sso-saml/errors/invalid-saml-metadata.error.js +10 -0
- package/dist/modules/sso-saml/middleware/saml-enabled-middleware.d.ts +3 -0
- package/dist/modules/sso-saml/middleware/saml-enabled-middleware.js +22 -0
- package/dist/modules/sso-saml/saml-helpers.d.ts +19 -0
- package/dist/modules/sso-saml/saml-helpers.js +129 -0
- package/dist/modules/sso-saml/saml-validator.d.ts +16 -0
- package/dist/modules/sso-saml/saml-validator.js +129 -0
- package/dist/modules/sso-saml/saml.controller.ee.d.ts +50 -0
- package/dist/modules/sso-saml/saml.controller.ee.js +227 -0
- package/dist/modules/sso-saml/saml.service.ee.d.ts +52 -0
- package/dist/modules/sso-saml/saml.service.ee.js +462 -0
- package/dist/modules/sso-saml/schema/metadata-exchange.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/metadata-exchange.xsd.js +118 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-secext-1.0.xsd.js +201 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/oasis-200401-wss-wssecurity-utility-1.0.xsd.js +114 -0
- package/dist/modules/sso-saml/schema/saml-schema-assertion-2.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/saml-schema-assertion-2.0.xsd.js +289 -0
- package/dist/modules/sso-saml/schema/saml-schema-metadata-2.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/saml-schema-metadata-2.0.xsd.js +344 -0
- package/dist/modules/sso-saml/schema/saml-schema-protocol-2.0.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/saml-schema-protocol-2.0.xsd.js +308 -0
- package/dist/modules/sso-saml/schema/ws-addr.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/ws-addr.xsd.js +143 -0
- package/dist/modules/sso-saml/schema/ws-authorization.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/ws-authorization.xsd.js +151 -0
- package/dist/modules/sso-saml/schema/ws-federation.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/ws-federation.xsd.js +476 -0
- package/dist/modules/sso-saml/schema/ws-securitypolicy-1.2.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/ws-securitypolicy-1.2.xsd.js +1211 -0
- package/dist/modules/sso-saml/schema/xenc-schema.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/xenc-schema.xsd.js +151 -0
- package/dist/modules/sso-saml/schema/xml.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/xml.xsd.js +123 -0
- package/dist/modules/sso-saml/schema/xmldsig-core-schema.xsd.d.ts +2 -0
- package/dist/modules/sso-saml/schema/xmldsig-core-schema.xsd.js +324 -0
- package/dist/modules/sso-saml/service-provider.ee.d.ts +6 -0
- package/dist/modules/sso-saml/service-provider.ee.js +44 -0
- package/dist/modules/sso-saml/sso-saml.module.d.ts +4 -0
- package/dist/modules/sso-saml/sso-saml.module.js +55 -0
- package/dist/modules/sso-saml/types.d.ts +4 -0
- package/dist/modules/sso-saml/types.js +2 -0
- package/dist/modules/sso-saml/views/init-sso-post.d.ts +2 -0
- package/dist/modules/sso-saml/views/init-sso-post.js +16 -0
- package/dist/node-lib.d.ts +10 -0
- package/dist/node-lib.js +137 -0
- package/dist/push/index.d.ts +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1 -0
- package/dist/services/cors-service.d.ts +7 -0
- package/dist/services/cors-service.js +50 -0
- package/dist/services/static-auth-service.d.ts +4 -0
- package/dist/services/static-auth-service.js +29 -0
- package/dist/sso.ee/saml/schema/metadata-exchange.xsd.js +0 -0
- package/dist/task-runners/task-broker/errors/task-runner-accept-timeout.error.js +0 -0
- package/dist/typecheck.tsbuildinfo +1 -0
- package/dist/user-management/email/templates/workflow-failure.handlebars +211 -0
- package/dist/utils/cors.util.d.ts +2 -0
- package/dist/utils/cors.util.js +17 -0
- package/dist/webhooks/waiting-forms.js +3 -3
- package/dist/webhooks/waiting-webhooks.js +2 -0
- package/dist/workflows/workflow.service.d.ts +2 -2
- package/dist/workflows/workflows.controller.d.ts +6 -6
- package/package.json +22 -21
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.messageEventBusDestinationFromDb = messageEventBusDestinationFromDb;
|
|
4
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
5
|
+
const di_1 = require("@n8n/di");
|
|
6
|
+
const message_event_bus_destination_sentry_ee_1 = require("./message-event-bus-destination-sentry.ee");
|
|
7
|
+
const message_event_bus_destination_syslog_ee_1 = require("./message-event-bus-destination-syslog.ee");
|
|
8
|
+
const message_event_bus_destination_webhook_ee_1 = require("./message-event-bus-destination-webhook.ee");
|
|
9
|
+
function messageEventBusDestinationFromDb(eventBusInstance, dbData) {
|
|
10
|
+
const destinationData = dbData.destination;
|
|
11
|
+
if ('__type' in destinationData) {
|
|
12
|
+
switch (destinationData.__type) {
|
|
13
|
+
case "$$MessageEventBusDestinationSentry":
|
|
14
|
+
return message_event_bus_destination_sentry_ee_1.MessageEventBusDestinationSentry.deserialize(eventBusInstance, destinationData);
|
|
15
|
+
case "$$MessageEventBusDestinationSyslog":
|
|
16
|
+
return message_event_bus_destination_syslog_ee_1.MessageEventBusDestinationSyslog.deserialize(eventBusInstance, destinationData);
|
|
17
|
+
case "$$MessageEventBusDestinationWebhook":
|
|
18
|
+
return message_event_bus_destination_webhook_ee_1.MessageEventBusDestinationWebhook.deserialize(eventBusInstance, destinationData);
|
|
19
|
+
default:
|
|
20
|
+
di_1.Container.get(backend_common_1.Logger).debug('MessageEventBusDestination __type unknown');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-sentry.ee.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Sentry from '@sentry/node';
|
|
2
|
+
import type { MessageEventBusDestinationOptions, MessageEventBusDestinationSentryOptions } from 'n8n-workflow';
|
|
3
|
+
import type { MessageEventBus, MessageWithCallback } from '../../../eventbus/message-event-bus/message-event-bus';
|
|
4
|
+
import { MessageEventBusDestination } from './message-event-bus-destination.ee';
|
|
5
|
+
export declare const isMessageEventBusDestinationSentryOptions: (candidate: unknown) => candidate is MessageEventBusDestinationSentryOptions;
|
|
6
|
+
export declare class MessageEventBusDestinationSentry extends MessageEventBusDestination implements MessageEventBusDestinationSentryOptions {
|
|
7
|
+
dsn: string;
|
|
8
|
+
tracesSampleRate: number;
|
|
9
|
+
sendPayload: boolean;
|
|
10
|
+
sentryClient?: Sentry.NodeClient;
|
|
11
|
+
constructor(eventBusInstance: MessageEventBus, options: MessageEventBusDestinationSentryOptions);
|
|
12
|
+
receiveFromEventBus(emitterPayload: MessageWithCallback): Promise<boolean>;
|
|
13
|
+
serialize(): MessageEventBusDestinationSentryOptions;
|
|
14
|
+
static deserialize(eventBusInstance: MessageEventBus, data: MessageEventBusDestinationOptions): MessageEventBusDestinationSentry | null;
|
|
15
|
+
toString(): string;
|
|
16
|
+
close(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.MessageEventBusDestinationSentry = exports.isMessageEventBusDestinationSentryOptions = void 0;
|
|
37
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
38
|
+
const constants_1 = require("../../../constants");
|
|
39
|
+
const event_message_generic_1 = require("../../../eventbus/event-message-classes/event-message-generic");
|
|
40
|
+
const message_event_bus_destination_ee_1 = require("./message-event-bus-destination.ee");
|
|
41
|
+
const isMessageEventBusDestinationSentryOptions = (candidate) => {
|
|
42
|
+
const o = candidate;
|
|
43
|
+
if (!o)
|
|
44
|
+
return false;
|
|
45
|
+
return o.dsn !== undefined;
|
|
46
|
+
};
|
|
47
|
+
exports.isMessageEventBusDestinationSentryOptions = isMessageEventBusDestinationSentryOptions;
|
|
48
|
+
class MessageEventBusDestinationSentry extends message_event_bus_destination_ee_1.MessageEventBusDestination {
|
|
49
|
+
constructor(eventBusInstance, options) {
|
|
50
|
+
super(eventBusInstance, options);
|
|
51
|
+
this.tracesSampleRate = 1.0;
|
|
52
|
+
this.label = options.label ?? 'Sentry DSN';
|
|
53
|
+
this.__type = options.__type ?? "$$MessageEventBusDestinationSentry";
|
|
54
|
+
this.dsn = options.dsn;
|
|
55
|
+
if (options.sendPayload)
|
|
56
|
+
this.sendPayload = options.sendPayload;
|
|
57
|
+
if (options.tracesSampleRate)
|
|
58
|
+
this.tracesSampleRate = options.tracesSampleRate;
|
|
59
|
+
const { ENVIRONMENT: environment } = process.env;
|
|
60
|
+
this.sentryClient = new Sentry.NodeClient({
|
|
61
|
+
dsn: this.dsn,
|
|
62
|
+
tracesSampleRate: this.tracesSampleRate,
|
|
63
|
+
environment,
|
|
64
|
+
release: constants_1.N8N_VERSION,
|
|
65
|
+
transport: Sentry.makeNodeTransport,
|
|
66
|
+
integrations: Sentry.getDefaultIntegrations({}),
|
|
67
|
+
stackParser: Sentry.defaultStackParser,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async receiveFromEventBus(emitterPayload) {
|
|
71
|
+
const { msg, confirmCallback } = emitterPayload;
|
|
72
|
+
let sendResult = false;
|
|
73
|
+
if (!this.sentryClient)
|
|
74
|
+
return sendResult;
|
|
75
|
+
if (msg.eventName !== event_message_generic_1.eventMessageGenericDestinationTestEvent) {
|
|
76
|
+
if (!this.license.isLogStreamingEnabled())
|
|
77
|
+
return sendResult;
|
|
78
|
+
if (!this.hasSubscribedToEvent(msg))
|
|
79
|
+
return sendResult;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const payload = this.anonymizeAuditMessages ? msg.anonymize() : msg.payload;
|
|
83
|
+
const scope = new Sentry.Scope();
|
|
84
|
+
const level = (msg.eventName.toLowerCase().endsWith('error') ? 'error' : 'log');
|
|
85
|
+
scope.setLevel(level);
|
|
86
|
+
scope.setTags({
|
|
87
|
+
event: msg.getEventName(),
|
|
88
|
+
logger: this.label ?? this.getId(),
|
|
89
|
+
app: 'n8n',
|
|
90
|
+
});
|
|
91
|
+
if (this.sendPayload) {
|
|
92
|
+
scope.setExtras(payload);
|
|
93
|
+
}
|
|
94
|
+
const sentryResult = this.sentryClient.captureMessage(msg.message ?? msg.eventName, level, { event_id: msg.id, data: payload }, scope);
|
|
95
|
+
if (sentryResult) {
|
|
96
|
+
confirmCallback(msg, { id: this.id, name: this.label });
|
|
97
|
+
sendResult = true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
this.logger.debug(`Failed to send message to Sentry destination: ${this.label}`, { error });
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
return sendResult;
|
|
105
|
+
}
|
|
106
|
+
serialize() {
|
|
107
|
+
const abstractSerialized = super.serialize();
|
|
108
|
+
return {
|
|
109
|
+
...abstractSerialized,
|
|
110
|
+
dsn: this.dsn,
|
|
111
|
+
tracesSampleRate: this.tracesSampleRate,
|
|
112
|
+
sendPayload: this.sendPayload,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
static deserialize(eventBusInstance, data) {
|
|
116
|
+
if ('__type' in data &&
|
|
117
|
+
data.__type === "$$MessageEventBusDestinationSentry" &&
|
|
118
|
+
(0, exports.isMessageEventBusDestinationSentryOptions)(data)) {
|
|
119
|
+
return new MessageEventBusDestinationSentry(eventBusInstance, data);
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
toString() {
|
|
124
|
+
return JSON.stringify(this.serialize());
|
|
125
|
+
}
|
|
126
|
+
async close() {
|
|
127
|
+
await super.close();
|
|
128
|
+
await this.sentryClient?.close();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.MessageEventBusDestinationSentry = MessageEventBusDestinationSentry;
|
package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-syslog.ee.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SyslogClient } from '@n8n/syslog-client';
|
|
2
|
+
import { Facility } from '@n8n/syslog-client';
|
|
3
|
+
import type { MessageEventBusDestinationOptions, MessageEventBusDestinationSyslogOptions } from 'n8n-workflow';
|
|
4
|
+
import type { MessageEventBus, MessageWithCallback } from '../../../eventbus/message-event-bus/message-event-bus';
|
|
5
|
+
import { MessageEventBusDestination } from './message-event-bus-destination.ee';
|
|
6
|
+
export declare const isMessageEventBusDestinationSyslogOptions: (candidate: unknown) => candidate is MessageEventBusDestinationSyslogOptions;
|
|
7
|
+
export declare class MessageEventBusDestinationSyslog extends MessageEventBusDestination implements MessageEventBusDestinationSyslogOptions {
|
|
8
|
+
client: SyslogClient;
|
|
9
|
+
expectedStatusCode?: number;
|
|
10
|
+
host: string;
|
|
11
|
+
port: number;
|
|
12
|
+
protocol: 'udp' | 'tcp' | 'tls';
|
|
13
|
+
facility: Facility;
|
|
14
|
+
app_name: string;
|
|
15
|
+
eol: string;
|
|
16
|
+
constructor(eventBusInstance: MessageEventBus, options: MessageEventBusDestinationSyslogOptions);
|
|
17
|
+
receiveFromEventBus(emitterPayload: MessageWithCallback): Promise<boolean>;
|
|
18
|
+
serialize(): MessageEventBusDestinationSyslogOptions;
|
|
19
|
+
static deserialize(eventBusInstance: MessageEventBus, data: MessageEventBusDestinationOptions): MessageEventBusDestinationSyslog | null;
|
|
20
|
+
toString(): string;
|
|
21
|
+
close(): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageEventBusDestinationSyslog = exports.isMessageEventBusDestinationSyslogOptions = void 0;
|
|
4
|
+
const backend_common_1 = require("@n8n/backend-common");
|
|
5
|
+
const di_1 = require("@n8n/di");
|
|
6
|
+
const syslog_client_1 = require("@n8n/syslog-client");
|
|
7
|
+
const event_message_generic_1 = require("../../../eventbus/event-message-classes/event-message-generic");
|
|
8
|
+
const message_event_bus_destination_ee_1 = require("./message-event-bus-destination.ee");
|
|
9
|
+
const isMessageEventBusDestinationSyslogOptions = (candidate) => {
|
|
10
|
+
const o = candidate;
|
|
11
|
+
if (!o)
|
|
12
|
+
return false;
|
|
13
|
+
return o.host !== undefined;
|
|
14
|
+
};
|
|
15
|
+
exports.isMessageEventBusDestinationSyslogOptions = isMessageEventBusDestinationSyslogOptions;
|
|
16
|
+
class MessageEventBusDestinationSyslog extends message_event_bus_destination_ee_1.MessageEventBusDestination {
|
|
17
|
+
constructor(eventBusInstance, options) {
|
|
18
|
+
super(eventBusInstance, options);
|
|
19
|
+
this.__type = options.__type ?? "$$MessageEventBusDestinationSyslog";
|
|
20
|
+
this.label = options.label ?? 'Syslog Server';
|
|
21
|
+
this.host = options.host ?? 'localhost';
|
|
22
|
+
this.port = options.port ?? 514;
|
|
23
|
+
this.protocol = options.protocol ?? 'udp';
|
|
24
|
+
this.facility = options.facility ?? syslog_client_1.Facility.Local0;
|
|
25
|
+
this.app_name = options.app_name ?? 'n8n';
|
|
26
|
+
this.eol = options.eol ?? '\n';
|
|
27
|
+
this.expectedStatusCode = options.expectedStatusCode ?? 200;
|
|
28
|
+
if (this.protocol === 'tls' && !options.tlsCa) {
|
|
29
|
+
this.logger.error('Syslog - No TLS CA set - Unable to create the syslog client');
|
|
30
|
+
}
|
|
31
|
+
this.client = (0, syslog_client_1.createClient)(this.host, {
|
|
32
|
+
appName: this.app_name,
|
|
33
|
+
facility: syslog_client_1.Facility.Local0,
|
|
34
|
+
port: this.port,
|
|
35
|
+
rfc3164: false,
|
|
36
|
+
tlsCA: options.tlsCa,
|
|
37
|
+
transport: this.protocol === 'tcp'
|
|
38
|
+
? syslog_client_1.Transport.Tcp
|
|
39
|
+
: this.protocol === 'tls'
|
|
40
|
+
? syslog_client_1.Transport.Tls
|
|
41
|
+
: syslog_client_1.Transport.Udp,
|
|
42
|
+
});
|
|
43
|
+
this.logger.debug(`MessageEventBusDestinationSyslog with id ${this.getId()} initialized`);
|
|
44
|
+
this.client.on('error', function (error) {
|
|
45
|
+
di_1.Container.get(backend_common_1.Logger).error(`${error.message}`);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async receiveFromEventBus(emitterPayload) {
|
|
49
|
+
const { msg, confirmCallback } = emitterPayload;
|
|
50
|
+
let sendResult = false;
|
|
51
|
+
if (msg.eventName !== event_message_generic_1.eventMessageGenericDestinationTestEvent) {
|
|
52
|
+
if (!this.license.isLogStreamingEnabled())
|
|
53
|
+
return sendResult;
|
|
54
|
+
if (!this.hasSubscribedToEvent(msg))
|
|
55
|
+
return sendResult;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const serializedMessage = msg.serialize();
|
|
59
|
+
if (this.anonymizeAuditMessages) {
|
|
60
|
+
serializedMessage.payload = msg.anonymize();
|
|
61
|
+
}
|
|
62
|
+
delete serializedMessage.__type;
|
|
63
|
+
await this.client.log(JSON.stringify(serializedMessage), {
|
|
64
|
+
severity: msg.eventName.toLowerCase().endsWith('error') ? syslog_client_1.Severity.Error : syslog_client_1.Severity.Debug,
|
|
65
|
+
msgid: msg.id,
|
|
66
|
+
timestamp: msg.ts.toJSDate(),
|
|
67
|
+
}, async (error) => {
|
|
68
|
+
if (error?.message) {
|
|
69
|
+
this.logger.error(error.message);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
confirmCallback(msg, { id: this.id, name: this.label });
|
|
73
|
+
sendResult = true;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (error.message)
|
|
79
|
+
this.logger.error(error.message);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
if (msg.eventName === event_message_generic_1.eventMessageGenericDestinationTestEvent) {
|
|
83
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
84
|
+
}
|
|
85
|
+
return sendResult;
|
|
86
|
+
}
|
|
87
|
+
serialize() {
|
|
88
|
+
const abstractSerialized = super.serialize();
|
|
89
|
+
return {
|
|
90
|
+
...abstractSerialized,
|
|
91
|
+
expectedStatusCode: this.expectedStatusCode,
|
|
92
|
+
host: this.host,
|
|
93
|
+
port: this.port,
|
|
94
|
+
protocol: this.protocol,
|
|
95
|
+
facility: this.facility,
|
|
96
|
+
app_name: this.app_name,
|
|
97
|
+
eol: this.eol,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
static deserialize(eventBusInstance, data) {
|
|
101
|
+
if ('__type' in data &&
|
|
102
|
+
data.__type === "$$MessageEventBusDestinationSyslog" &&
|
|
103
|
+
(0, exports.isMessageEventBusDestinationSyslogOptions)(data)) {
|
|
104
|
+
return new MessageEventBusDestinationSyslog(eventBusInstance, data);
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
toString() {
|
|
109
|
+
return JSON.stringify(this.serialize());
|
|
110
|
+
}
|
|
111
|
+
async close() {
|
|
112
|
+
await super.close();
|
|
113
|
+
this.client.close();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.MessageEventBusDestinationSyslog = MessageEventBusDestinationSyslog;
|
package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AxiosInstance, AxiosRequestConfig } from 'axios';
|
|
2
|
+
import type { MessageEventBusDestinationOptions, MessageEventBusDestinationWebhookParameterItem, MessageEventBusDestinationWebhookParameterOptions, MessageEventBusDestinationWebhookOptions } from 'n8n-workflow';
|
|
3
|
+
import { CredentialsHelper } from '../../../credentials-helper';
|
|
4
|
+
import type { MessageEventBus, MessageWithCallback } from '../../../eventbus/message-event-bus/message-event-bus';
|
|
5
|
+
import { MessageEventBusDestination } from './message-event-bus-destination.ee';
|
|
6
|
+
export declare const isMessageEventBusDestinationWebhookOptions: (candidate: unknown) => candidate is MessageEventBusDestinationWebhookOptions;
|
|
7
|
+
export declare class MessageEventBusDestinationWebhook extends MessageEventBusDestination implements MessageEventBusDestinationWebhookOptions {
|
|
8
|
+
url: string;
|
|
9
|
+
responseCodeMustMatch: boolean;
|
|
10
|
+
expectedStatusCode: number;
|
|
11
|
+
method: string;
|
|
12
|
+
authentication: 'predefinedCredentialType' | 'genericCredentialType' | 'none';
|
|
13
|
+
sendQuery: boolean;
|
|
14
|
+
sendHeaders: boolean;
|
|
15
|
+
genericAuthType: string;
|
|
16
|
+
nodeCredentialType: string;
|
|
17
|
+
specifyHeaders: string;
|
|
18
|
+
specifyQuery: string;
|
|
19
|
+
jsonQuery: string;
|
|
20
|
+
jsonHeaders: string;
|
|
21
|
+
headerParameters: MessageEventBusDestinationWebhookParameterItem;
|
|
22
|
+
queryParameters: MessageEventBusDestinationWebhookParameterItem;
|
|
23
|
+
options: MessageEventBusDestinationWebhookParameterOptions;
|
|
24
|
+
sendPayload: boolean;
|
|
25
|
+
credentialsHelper?: CredentialsHelper;
|
|
26
|
+
axiosRequestOptions?: AxiosRequestConfig;
|
|
27
|
+
axiosInstance: AxiosInstance;
|
|
28
|
+
constructor(eventBusInstance: MessageEventBus, options: MessageEventBusDestinationWebhookOptions);
|
|
29
|
+
private buildAxiosSetting;
|
|
30
|
+
matchDecryptedCredentialType(credentialType: string): Promise<import("n8n-workflow").ICredentialDataDecryptedObject | null | undefined>;
|
|
31
|
+
generateAxiosOptions(): Promise<void>;
|
|
32
|
+
serialize(): MessageEventBusDestinationWebhookOptions;
|
|
33
|
+
static deserialize(eventBusInstance: MessageEventBus, data: MessageEventBusDestinationOptions): MessageEventBusDestinationWebhook | null;
|
|
34
|
+
receiveFromEventBus(emitterPayload: MessageWithCallback): Promise<boolean>;
|
|
35
|
+
}
|
package/dist/modules/log-streaming.ee/destinations/message-event-bus-destination-webhook.ee.js
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
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.MessageEventBusDestinationWebhook = exports.isMessageEventBusDestinationWebhookOptions = void 0;
|
|
7
|
+
const constants_1 = require("@n8n/constants");
|
|
8
|
+
const di_1 = require("@n8n/di");
|
|
9
|
+
const axios_1 = __importDefault(require("axios"));
|
|
10
|
+
const http_1 = require("http");
|
|
11
|
+
const https_1 = require("https");
|
|
12
|
+
const n8n_core_1 = require("n8n-core");
|
|
13
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
14
|
+
const credentials_helper_1 = require("../../../credentials-helper");
|
|
15
|
+
const event_message_generic_1 = require("../../../eventbus/event-message-classes/event-message-generic");
|
|
16
|
+
const message_event_bus_destination_ee_1 = require("./message-event-bus-destination.ee");
|
|
17
|
+
const isMessageEventBusDestinationWebhookOptions = (candidate) => {
|
|
18
|
+
const o = candidate;
|
|
19
|
+
if (!o)
|
|
20
|
+
return false;
|
|
21
|
+
return o.url !== undefined;
|
|
22
|
+
};
|
|
23
|
+
exports.isMessageEventBusDestinationWebhookOptions = isMessageEventBusDestinationWebhookOptions;
|
|
24
|
+
class MessageEventBusDestinationWebhook extends message_event_bus_destination_ee_1.MessageEventBusDestination {
|
|
25
|
+
constructor(eventBusInstance, options) {
|
|
26
|
+
super(eventBusInstance, options);
|
|
27
|
+
this.responseCodeMustMatch = false;
|
|
28
|
+
this.expectedStatusCode = 200;
|
|
29
|
+
this.method = 'POST';
|
|
30
|
+
this.authentication = 'none';
|
|
31
|
+
this.sendQuery = false;
|
|
32
|
+
this.sendHeaders = false;
|
|
33
|
+
this.genericAuthType = '';
|
|
34
|
+
this.nodeCredentialType = '';
|
|
35
|
+
this.specifyHeaders = '';
|
|
36
|
+
this.specifyQuery = '';
|
|
37
|
+
this.jsonQuery = '';
|
|
38
|
+
this.jsonHeaders = '';
|
|
39
|
+
this.headerParameters = { parameters: [] };
|
|
40
|
+
this.queryParameters = { parameters: [] };
|
|
41
|
+
this.options = {};
|
|
42
|
+
this.sendPayload = true;
|
|
43
|
+
this.url = options.url;
|
|
44
|
+
this.label = options.label ?? 'Webhook Endpoint';
|
|
45
|
+
this.__type = options.__type ?? "$$MessageEventBusDestinationWebhook";
|
|
46
|
+
if (options.responseCodeMustMatch)
|
|
47
|
+
this.responseCodeMustMatch = options.responseCodeMustMatch;
|
|
48
|
+
if (options.expectedStatusCode)
|
|
49
|
+
this.expectedStatusCode = options.expectedStatusCode;
|
|
50
|
+
if (options.method)
|
|
51
|
+
this.method = options.method;
|
|
52
|
+
if (options.authentication)
|
|
53
|
+
this.authentication = options.authentication;
|
|
54
|
+
if (options.sendQuery)
|
|
55
|
+
this.sendQuery = options.sendQuery;
|
|
56
|
+
if (options.sendHeaders)
|
|
57
|
+
this.sendHeaders = options.sendHeaders;
|
|
58
|
+
if (options.genericAuthType)
|
|
59
|
+
this.genericAuthType = options.genericAuthType;
|
|
60
|
+
if (options.nodeCredentialType)
|
|
61
|
+
this.nodeCredentialType = options.nodeCredentialType;
|
|
62
|
+
if (options.specifyHeaders)
|
|
63
|
+
this.specifyHeaders = options.specifyHeaders;
|
|
64
|
+
if (options.specifyQuery)
|
|
65
|
+
this.specifyQuery = options.specifyQuery;
|
|
66
|
+
if (options.jsonQuery)
|
|
67
|
+
this.jsonQuery = options.jsonQuery;
|
|
68
|
+
if (options.jsonHeaders)
|
|
69
|
+
this.jsonHeaders = options.jsonHeaders;
|
|
70
|
+
if (options.headerParameters)
|
|
71
|
+
this.headerParameters = options.headerParameters;
|
|
72
|
+
if (options.queryParameters)
|
|
73
|
+
this.queryParameters = options.queryParameters;
|
|
74
|
+
if (options.sendPayload)
|
|
75
|
+
this.sendPayload = options.sendPayload;
|
|
76
|
+
if (options.options)
|
|
77
|
+
this.options = options.options;
|
|
78
|
+
const axiosSetting = this.buildAxiosSetting(options);
|
|
79
|
+
this.axiosInstance = axios_1.default.create(axiosSetting);
|
|
80
|
+
this.logger.debug(`MessageEventBusDestinationWebhook with id ${this.getId()} initialized`);
|
|
81
|
+
}
|
|
82
|
+
buildAxiosSetting(axiosParameters) {
|
|
83
|
+
const axiosSetting = {
|
|
84
|
+
headers: {},
|
|
85
|
+
method: axiosParameters.method,
|
|
86
|
+
url: axiosParameters.url,
|
|
87
|
+
maxRedirects: 0,
|
|
88
|
+
};
|
|
89
|
+
if (axiosParameters.options?.redirect?.followRedirects) {
|
|
90
|
+
axiosSetting.maxRedirects = axiosParameters.options.redirect?.maxRedirects;
|
|
91
|
+
}
|
|
92
|
+
axiosSetting.proxy = axiosParameters.options?.proxy;
|
|
93
|
+
axiosSetting.timeout =
|
|
94
|
+
axiosParameters.options?.timeout ?? constants_1.LOGSTREAMING_DEFAULT_SOCKET_TIMEOUT_MS;
|
|
95
|
+
const agentOptions = {
|
|
96
|
+
keepAlive: axiosParameters.options?.socket?.keepAlive ?? true,
|
|
97
|
+
maxSockets: axiosParameters.options?.socket?.maxSockets ?? constants_1.LOGSTREAMING_DEFAULT_MAX_SOCKETS,
|
|
98
|
+
maxFreeSockets: axiosParameters.options?.socket?.maxFreeSockets ?? constants_1.LOGSTREAMING_DEFAULT_MAX_FREE_SOCKETS,
|
|
99
|
+
maxTotalSockets: axiosParameters.options?.socket?.maxSockets ?? constants_1.LOGSTREAMING_DEFAULT_MAX_TOTAL_SOCKETS,
|
|
100
|
+
timeout: axiosParameters.options?.timeout ?? constants_1.LOGSTREAMING_DEFAULT_SOCKET_TIMEOUT_MS,
|
|
101
|
+
};
|
|
102
|
+
const httpsAgentOptions = {
|
|
103
|
+
...agentOptions,
|
|
104
|
+
};
|
|
105
|
+
if (axiosParameters.options?.allowUnauthorizedCerts) {
|
|
106
|
+
httpsAgentOptions.rejectUnauthorized = false;
|
|
107
|
+
}
|
|
108
|
+
const url = new URL(axiosParameters.url);
|
|
109
|
+
if (url.protocol === 'https:') {
|
|
110
|
+
axiosSetting.httpsAgent = new https_1.Agent(httpsAgentOptions);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
axiosSetting.httpAgent = new http_1.Agent(agentOptions);
|
|
114
|
+
}
|
|
115
|
+
return axiosSetting;
|
|
116
|
+
}
|
|
117
|
+
async matchDecryptedCredentialType(credentialType) {
|
|
118
|
+
const foundCredential = Object.entries(this.credentials).find((e) => e[0] === credentialType);
|
|
119
|
+
if (foundCredential) {
|
|
120
|
+
const credentialsDecrypted = await this.credentialsHelper?.getDecrypted({
|
|
121
|
+
externalSecretsProxy: di_1.Container.get(n8n_core_1.ExternalSecretsProxy),
|
|
122
|
+
}, foundCredential[1], foundCredential[0], 'internal', undefined, true);
|
|
123
|
+
return credentialsDecrypted;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
async generateAxiosOptions() {
|
|
128
|
+
if (this.axiosRequestOptions) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.axiosRequestOptions = {
|
|
132
|
+
headers: {},
|
|
133
|
+
method: this.method,
|
|
134
|
+
url: this.url,
|
|
135
|
+
maxRedirects: 0,
|
|
136
|
+
};
|
|
137
|
+
this.credentialsHelper ??= di_1.Container.get(credentials_helper_1.CredentialsHelper);
|
|
138
|
+
const sendQuery = this.sendQuery;
|
|
139
|
+
const specifyQuery = this.specifyQuery;
|
|
140
|
+
const sendHeaders = this.sendHeaders;
|
|
141
|
+
const specifyHeaders = this.specifyHeaders;
|
|
142
|
+
if (this.sendQuery && this.options.queryParameterArrays) {
|
|
143
|
+
Object.assign(this.axiosRequestOptions, {
|
|
144
|
+
qsStringifyOptions: { arrayFormat: this.options.queryParameterArrays },
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const parametersToKeyValue = async (acc, cur) => {
|
|
148
|
+
const accumulator = await acc;
|
|
149
|
+
accumulator[cur.name] = cur.value;
|
|
150
|
+
return accumulator;
|
|
151
|
+
};
|
|
152
|
+
if (sendQuery && this.queryParameters.parameters) {
|
|
153
|
+
if (specifyQuery === 'keypair') {
|
|
154
|
+
this.axiosRequestOptions.params = this.queryParameters.parameters.reduce(parametersToKeyValue, Promise.resolve({}));
|
|
155
|
+
}
|
|
156
|
+
else if (specifyQuery === 'json') {
|
|
157
|
+
try {
|
|
158
|
+
JSON.parse(this.jsonQuery);
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
this.logger.error('JSON parameter needs to be valid JSON');
|
|
162
|
+
}
|
|
163
|
+
this.axiosRequestOptions.params = (0, n8n_workflow_1.jsonParse)(this.jsonQuery);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (sendHeaders && this.headerParameters.parameters) {
|
|
167
|
+
if (specifyHeaders === 'keypair') {
|
|
168
|
+
this.axiosRequestOptions.headers = await this.headerParameters.parameters.reduce(parametersToKeyValue, Promise.resolve({}));
|
|
169
|
+
}
|
|
170
|
+
else if (specifyHeaders === 'json') {
|
|
171
|
+
try {
|
|
172
|
+
JSON.parse(this.jsonHeaders);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
this.logger.error('JSON parameter needs to be valid JSON');
|
|
176
|
+
}
|
|
177
|
+
this.axiosRequestOptions.headers = (0, n8n_workflow_1.jsonParse)(this.jsonHeaders);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (this.axiosRequestOptions.headers === undefined) {
|
|
181
|
+
this.axiosRequestOptions.headers = {};
|
|
182
|
+
}
|
|
183
|
+
this.axiosRequestOptions.headers['Content-Type'] = 'application/json';
|
|
184
|
+
}
|
|
185
|
+
serialize() {
|
|
186
|
+
const abstractSerialized = super.serialize();
|
|
187
|
+
return {
|
|
188
|
+
...abstractSerialized,
|
|
189
|
+
url: this.url,
|
|
190
|
+
responseCodeMustMatch: this.responseCodeMustMatch,
|
|
191
|
+
expectedStatusCode: this.expectedStatusCode,
|
|
192
|
+
method: this.method,
|
|
193
|
+
authentication: this.authentication,
|
|
194
|
+
sendQuery: this.sendQuery,
|
|
195
|
+
sendHeaders: this.sendHeaders,
|
|
196
|
+
genericAuthType: this.genericAuthType,
|
|
197
|
+
nodeCredentialType: this.nodeCredentialType,
|
|
198
|
+
specifyHeaders: this.specifyHeaders,
|
|
199
|
+
specifyQuery: this.specifyQuery,
|
|
200
|
+
jsonQuery: this.jsonQuery,
|
|
201
|
+
jsonHeaders: this.jsonHeaders,
|
|
202
|
+
headerParameters: this.headerParameters,
|
|
203
|
+
queryParameters: this.queryParameters,
|
|
204
|
+
sendPayload: this.sendPayload,
|
|
205
|
+
options: this.options,
|
|
206
|
+
credentials: this.credentials,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
static deserialize(eventBusInstance, data) {
|
|
210
|
+
if ('__type' in data &&
|
|
211
|
+
data.__type === "$$MessageEventBusDestinationWebhook" &&
|
|
212
|
+
(0, exports.isMessageEventBusDestinationWebhookOptions)(data)) {
|
|
213
|
+
return new MessageEventBusDestinationWebhook(eventBusInstance, data);
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
async receiveFromEventBus(emitterPayload) {
|
|
218
|
+
const { msg, confirmCallback } = emitterPayload;
|
|
219
|
+
let sendResult = false;
|
|
220
|
+
if (msg.eventName !== event_message_generic_1.eventMessageGenericDestinationTestEvent) {
|
|
221
|
+
if (!this.license.isLogStreamingEnabled())
|
|
222
|
+
return sendResult;
|
|
223
|
+
if (!this.hasSubscribedToEvent(msg))
|
|
224
|
+
return sendResult;
|
|
225
|
+
}
|
|
226
|
+
await this.generateAxiosOptions();
|
|
227
|
+
const request = {
|
|
228
|
+
...(this.axiosRequestOptions ?? {}),
|
|
229
|
+
};
|
|
230
|
+
const payload = this.anonymizeAuditMessages ? msg.anonymize() : msg.payload;
|
|
231
|
+
if (['PATCH', 'POST', 'PUT', 'GET'].includes(this.method.toUpperCase())) {
|
|
232
|
+
if (this.sendPayload) {
|
|
233
|
+
request.data = {
|
|
234
|
+
...msg,
|
|
235
|
+
__type: undefined,
|
|
236
|
+
payload,
|
|
237
|
+
ts: msg.ts.toISO(),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
request.data = {
|
|
242
|
+
...msg,
|
|
243
|
+
__type: undefined,
|
|
244
|
+
payload: undefined,
|
|
245
|
+
ts: msg.ts.toISO(),
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
let httpBasicAuth;
|
|
250
|
+
let httpDigestAuth;
|
|
251
|
+
let httpHeaderAuth;
|
|
252
|
+
let httpQueryAuth;
|
|
253
|
+
if (this.authentication === 'genericCredentialType') {
|
|
254
|
+
if (this.genericAuthType === 'httpBasicAuth') {
|
|
255
|
+
try {
|
|
256
|
+
httpBasicAuth = await this.matchDecryptedCredentialType('httpBasicAuth');
|
|
257
|
+
}
|
|
258
|
+
catch { }
|
|
259
|
+
}
|
|
260
|
+
else if (this.genericAuthType === 'httpDigestAuth') {
|
|
261
|
+
try {
|
|
262
|
+
httpDigestAuth = await this.matchDecryptedCredentialType('httpDigestAuth');
|
|
263
|
+
}
|
|
264
|
+
catch { }
|
|
265
|
+
}
|
|
266
|
+
else if (this.genericAuthType === 'httpHeaderAuth') {
|
|
267
|
+
try {
|
|
268
|
+
httpHeaderAuth = await this.matchDecryptedCredentialType('httpHeaderAuth');
|
|
269
|
+
}
|
|
270
|
+
catch { }
|
|
271
|
+
}
|
|
272
|
+
else if (this.genericAuthType === 'httpQueryAuth') {
|
|
273
|
+
try {
|
|
274
|
+
httpQueryAuth = await this.matchDecryptedCredentialType('httpQueryAuth');
|
|
275
|
+
}
|
|
276
|
+
catch { }
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (httpBasicAuth) {
|
|
280
|
+
request.auth = {
|
|
281
|
+
username: httpBasicAuth.user,
|
|
282
|
+
password: httpBasicAuth.password,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
else if (httpHeaderAuth) {
|
|
286
|
+
request.headers = {
|
|
287
|
+
...request.headers,
|
|
288
|
+
[httpHeaderAuth.name]: httpHeaderAuth.value,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
else if (httpQueryAuth) {
|
|
292
|
+
request.params = {
|
|
293
|
+
...request.params,
|
|
294
|
+
[httpQueryAuth.name]: httpQueryAuth.value,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
else if (httpDigestAuth) {
|
|
298
|
+
request.auth = {
|
|
299
|
+
username: httpDigestAuth.user,
|
|
300
|
+
password: httpDigestAuth.password,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
try {
|
|
304
|
+
const requestResponse = await this.axiosInstance.request(request);
|
|
305
|
+
if (requestResponse) {
|
|
306
|
+
if (this.responseCodeMustMatch) {
|
|
307
|
+
if (requestResponse.status === this.expectedStatusCode) {
|
|
308
|
+
confirmCallback(msg, { id: this.id, name: this.label });
|
|
309
|
+
sendResult = true;
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
sendResult = false;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
confirmCallback(msg, { id: this.id, name: this.label });
|
|
317
|
+
sendResult = true;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
this.logger.warn(`Webhook destination ${this.label} (${this.id}) failed to send message to: ${this.url} - ${error.message}`);
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
return sendResult;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
exports.MessageEventBusDestinationWebhook = MessageEventBusDestinationWebhook;
|