n8n
Version:
n8n Workflow Automation Tool
50 lines • 2.61 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.InsightsModule = void 0;
const n8n_core_1 = require("n8n-core");
const module_1 = require("../../decorators/module");
const orchestration_service_1 = require("../../services/orchestration.service");
const insights_service_1 = require("./insights.service");
require("./insights.controller");
let InsightsModule = class InsightsModule {
constructor(logger, insightsService, instanceSettings, orchestrationService) {
this.logger = logger;
this.insightsService = insightsService;
this.instanceSettings = instanceSettings;
this.orchestrationService = orchestrationService;
this.logger = this.logger.scoped('insights');
}
initialize() {
if (this.instanceSettings.isLeader) {
this.insightsService.startBackgroundProcess();
}
if (this.instanceSettings.isMultiMain) {
this.orchestrationService.multiMainSetup.on('leader-takeover', () => this.insightsService.startBackgroundProcess());
this.orchestrationService.multiMainSetup.on('leader-stepdown', () => this.insightsService.stopBackgroundProcess());
}
}
registerLifecycleHooks(hooks) {
const insightsService = this.insightsService;
hooks.addHandler('workflowExecuteAfter', async function (fullRunData) {
await insightsService.workflowExecuteAfterHandler(this, fullRunData);
});
}
};
exports.InsightsModule = InsightsModule;
exports.InsightsModule = InsightsModule = __decorate([
(0, module_1.N8nModule)(),
__metadata("design:paramtypes", [n8n_core_1.Logger,
insights_service_1.InsightsService,
n8n_core_1.InstanceSettings,
orchestration_service_1.OrchestrationService])
], InsightsModule);
//# sourceMappingURL=insights.module.js.map
;