UNPKG

n8n

Version:

n8n Workflow Automation Tool

26 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProjectScope = exports.GlobalScope = void 0; const constants_1 = require("./constants"); const Scoped = (scope, { globalOnly } = { globalOnly: false }) => { return (target, handlerName) => { var _a; const controllerClass = handlerName ? target.constructor : target; const scopes = ((_a = Reflect.getMetadata(constants_1.CONTROLLER_ROUTE_SCOPES, controllerClass)) !== null && _a !== void 0 ? _a : {}); const metadata = { scopes: Array.isArray(scope) ? scope : [scope], globalOnly, }; scopes[handlerName !== null && handlerName !== void 0 ? handlerName : '*'] = metadata; Reflect.defineMetadata(constants_1.CONTROLLER_ROUTE_SCOPES, scopes, controllerClass); }; }; const GlobalScope = (scope) => { return Scoped(scope, { globalOnly: true }); }; exports.GlobalScope = GlobalScope; const ProjectScope = (scope) => { return Scoped(scope); }; exports.ProjectScope = ProjectScope; //# sourceMappingURL=Scoped.js.map