Files
n8n-enterprise-unlocked/packages/@n8n/decorators/src/licensed.ts
T

16 lines
536 B
TypeScript

import type { BooleanLicenseFeature } from '@n8n/constants';
import { Container } from '@n8n/di';
import { ControllerRegistryMetadata } from './controller-registry-metadata';
import type { Controller } from './types';
export const Licensed =
(licenseFeature: BooleanLicenseFeature): MethodDecorator =>
(target, handlerName) => {
const routeMetadata = Container.get(ControllerRegistryMetadata).getRouteMetadata(
target.constructor as Controller,
String(handlerName),
);
routeMetadata.licenseFeature = licenseFeature;
};