mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
refactor(core): Rename ActiveWebhooks to LiveWebhooks (no-changelog) (#10355)
This commit is contained in:
parent
9b647a9837
commit
cdd0ab4031
|
@ -17,7 +17,7 @@ import { WaitingForms } from '@/WaitingForms';
|
||||||
import { TestWebhooks } from '@/webhooks/TestWebhooks';
|
import { TestWebhooks } from '@/webhooks/TestWebhooks';
|
||||||
import { WaitingWebhooks } from '@/webhooks/WaitingWebhooks';
|
import { WaitingWebhooks } from '@/webhooks/WaitingWebhooks';
|
||||||
import { createWebhookHandlerFor } from '@/webhooks/WebhookRequestHandler';
|
import { createWebhookHandlerFor } from '@/webhooks/WebhookRequestHandler';
|
||||||
import { ActiveWebhooks } from '@/webhooks/ActiveWebhooks';
|
import { LiveWebhooks } from '@/webhooks/LiveWebhooks';
|
||||||
import { generateHostInstanceId } from './databases/utils/generators';
|
import { generateHostInstanceId } from './databases/utils/generators';
|
||||||
import { Logger } from '@/Logger';
|
import { Logger } from '@/Logger';
|
||||||
import { ServiceUnavailableError } from './errors/response-errors/service-unavailable.error';
|
import { ServiceUnavailableError } from './errors/response-errors/service-unavailable.error';
|
||||||
|
@ -181,12 +181,12 @@ export abstract class AbstractServer {
|
||||||
|
|
||||||
// Setup webhook handlers before bodyParser, to let the Webhook node handle binary data in requests
|
// Setup webhook handlers before bodyParser, to let the Webhook node handle binary data in requests
|
||||||
if (this.webhooksEnabled) {
|
if (this.webhooksEnabled) {
|
||||||
const activeWebhooksRequestHandler = createWebhookHandlerFor(Container.get(ActiveWebhooks));
|
const liveWebhooksRequestHandler = createWebhookHandlerFor(Container.get(LiveWebhooks));
|
||||||
// Register a handler for active forms
|
// Register a handler for live forms
|
||||||
this.app.all(`/${this.endpointForm}/:path(*)`, activeWebhooksRequestHandler);
|
this.app.all(`/${this.endpointForm}/:path(*)`, liveWebhooksRequestHandler);
|
||||||
|
|
||||||
// Register a handler for active webhooks
|
// Register a handler for live webhooks
|
||||||
this.app.all(`/${this.endpointWebhook}/:path(*)`, activeWebhooksRequestHandler);
|
this.app.all(`/${this.endpointWebhook}/:path(*)`, liveWebhooksRequestHandler);
|
||||||
|
|
||||||
// Register a handler for waiting forms
|
// Register a handler for waiting forms
|
||||||
this.app.all(
|
this.app.all(
|
||||||
|
|
|
@ -20,12 +20,12 @@ import * as WebhookHelpers from '@/webhooks/WebhookHelpers';
|
||||||
import { WorkflowStaticDataService } from '@/workflows/workflowStaticData.service';
|
import { WorkflowStaticDataService } from '@/workflows/workflowStaticData.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for handling the execution of production webhooks, i.e. webhooks
|
* Service for handling the execution of live webhooks, i.e. webhooks
|
||||||
* that belong to activated workflows and use the production URL
|
* that belong to activated workflows and use the production URL
|
||||||
* (https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/#webhook-urls)
|
* (https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.webhook/#webhook-urls)
|
||||||
*/
|
*/
|
||||||
@Service()
|
@Service()
|
||||||
export class ActiveWebhooks implements IWebhookManager {
|
export class LiveWebhooks implements IWebhookManager {
|
||||||
constructor(
|
constructor(
|
||||||
private readonly logger: Logger,
|
private readonly logger: Logger,
|
||||||
private readonly nodeTypes: NodeTypes,
|
private readonly nodeTypes: NodeTypes,
|
|
@ -3,7 +3,7 @@ import { agent as testAgent } from 'supertest';
|
||||||
import { mock } from 'jest-mock-extended';
|
import { mock } from 'jest-mock-extended';
|
||||||
|
|
||||||
import { AbstractServer } from '@/AbstractServer';
|
import { AbstractServer } from '@/AbstractServer';
|
||||||
import { ActiveWebhooks } from '@/webhooks/ActiveWebhooks';
|
import { LiveWebhooks } from '@/webhooks/LiveWebhooks';
|
||||||
import { ExternalHooks } from '@/ExternalHooks';
|
import { ExternalHooks } from '@/ExternalHooks';
|
||||||
import { TestWebhooks } from '@/webhooks/TestWebhooks';
|
import { TestWebhooks } from '@/webhooks/TestWebhooks';
|
||||||
import { WaitingWebhooks } from '@/webhooks/WaitingWebhooks';
|
import { WaitingWebhooks } from '@/webhooks/WaitingWebhooks';
|
||||||
|
@ -21,7 +21,7 @@ describe('WebhookServer', () => {
|
||||||
|
|
||||||
describe('CORS', () => {
|
describe('CORS', () => {
|
||||||
const corsOrigin = 'https://example.com';
|
const corsOrigin = 'https://example.com';
|
||||||
const activeWebhooks = mockInstance(ActiveWebhooks);
|
const liveWebhooks = mockInstance(LiveWebhooks);
|
||||||
const testWebhooks = mockInstance(TestWebhooks);
|
const testWebhooks = mockInstance(TestWebhooks);
|
||||||
mockInstance(WaitingWebhooks);
|
mockInstance(WaitingWebhooks);
|
||||||
mockInstance(WaitingForms);
|
mockInstance(WaitingForms);
|
||||||
|
@ -35,7 +35,7 @@ describe('WebhookServer', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
['webhook', activeWebhooks],
|
['webhook', liveWebhooks],
|
||||||
['webhookTest', testWebhooks],
|
['webhookTest', testWebhooks],
|
||||||
// TODO: enable webhookWaiting & waitingForms after CORS support is added
|
// TODO: enable webhookWaiting & waitingForms after CORS support is added
|
||||||
// ['webhookWaiting', waitingWebhooks],
|
// ['webhookWaiting', waitingWebhooks],
|
||||||
|
|
Loading…
Reference in a new issue