import { IDecorator, Meta } from "oly-core"; import { olyRouterKeys } from "oly-router"; import { IRouterPropertyApi } from "../interfaces"; export type IApiOptions = Partial; export class ApiDecorator implements IDecorator { public constructor(private options: IApiOptions = {}) { } public asMethod(target: object, propertyKey: string, descriptor: TypedPropertyDescriptor): void { Meta.of({key: olyRouterKeys.router, target, propertyKey}).set({ api: this.options, }); } public asProperty(target: object, propertyKey: string): void { this.asMethod(target, propertyKey, {}); } } export const api = Meta.decoratorWithOptions(ApiDecorator);