n8n
Version:
n8n Workflow Automation Tool
20 lines • 1.02 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.OnShutdown = void 0;
const typedi_1 = require("typedi");
const n8n_workflow_1 = require("n8n-workflow");
const Shutdown_service_1 = require("../shutdown/Shutdown.service");
const constants_1 = require("../constants");
const OnShutdown = (priority = constants_1.DEFAULT_SHUTDOWN_PRIORITY) => (prototype, propertyKey, descriptor) => {
const serviceClass = prototype.constructor;
const methodName = String(propertyKey);
if (typeof (descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) === 'function') {
typedi_1.Container.get(Shutdown_service_1.ShutdownService).register(priority, { serviceClass, methodName });
}
else {
const name = `${serviceClass.name}.${methodName}()`;
throw new n8n_workflow_1.ApplicationError(`${name} must be a method on ${serviceClass.name} to use "OnShutdown"`);
}
};
exports.OnShutdown = OnShutdown;
//# sourceMappingURL=OnShutdown.js.map
;