Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const createError = (args: any[]) => {
return new UnsupportedDecoratorType({name: "Decorator"}, args).message;
};
if (options.security) {
const {security} = options;
store.merge("operation", {security}, true);
delete options.security;
}
store.merge(guardAuth, options, true);
})(...args);
case "class":
decorateMethodsOf(args[0], AuthOptions(guardAuth, options));
break;
default:
throw new UnsupportedDecoratorType(AuthOptions, args);
}
};
}
return (...decoratorArgs: DecoratorParameters): TypedPropertyDescriptor | void => {
switch (getDecoratorType(decoratorArgs, true)) {
case "method":
EndpointRegistry.useAfter(decoratorArgs[0], decoratorArgs[1]!, args);
return decoratorArgs[2] as any;
case "class":
StoreMerge("middlewares", {useAfter: args})(...decoratorArgs);
break;
default:
throw new UnsupportedDecoratorType(UseAfter, decoratorArgs);
}
};
}
case "method":
return applyDecorators(
StoreFn((store: Store) => {
if (!store.has(guardAuth)) {
return UseBefore(guardAuth);
}
}),
AuthOptions(guardAuth, options)
)(...args);
case "class":
decorateMethodsOf(args[0], UseAuth(guardAuth, options));
break;
default:
throw new UnsupportedDecoratorType(UseAuth, args);
}
};
}
return (...args: DecoratorParameters) => {
const type = getDecoratorType(args, true);
switch (type) {
case "method":
return StoreMerge("operation", operation)(...args);
case "class":
decorateMethodsOf(args[0], Operation(operation));
break;
default:
throw new UnsupportedDecoratorType(Operation, args);
}
};
}
(...decoratorArgs: DecoratorParameters) => {
const metadata = getStorableMetadata(decoratorArgs);
if (!metadata) {
throw new UnsupportedDecoratorType(Required, decoratorArgs);
}
metadata.required = true;
if (allowedRequiredValues.length) {
Allow(...allowedRequiredValues)(...decoratorArgs);
}
},
StoreMerge("responses", {
return (...args: DecoratorParameters) => {
const type = getDecoratorType(args, true);
switch (type) {
case "method":
return StoreMerge("responses", {[status]: response})(...args);
case "class":
decorateMethodsOf(args[0], Responses(status, response));
break;
default:
throw new UnsupportedDecoratorType(Responses, args);
}
};
}
return (...decoratorArgs: DecoratorParameters): TypedPropertyDescriptor | void => {
switch (getDecoratorType(decoratorArgs, true)) {
case "method":
return UseBefore(...args)(...decoratorArgs);
case "class":
decorateMethodsOf(decoratorArgs[0], UseBefore(...args));
break;
default:
throw new UnsupportedDecoratorType(UseBeforeEach, decoratorArgs);
}
};
}
}
});
break;
case "method":
Store.from(target).merge("injectableProperties", {
[propertyKey]: {
bindingType,
propertyKey
}
});
return descriptor;
default:
throw new UnsupportedDecoratorType(Inject, [target, propertyKey, descriptor]);
}
};
}
return (...decoratorArgs: DecoratorParameters): TypedPropertyDescriptor | void => {
switch (getDecoratorType(decoratorArgs, true)) {
case "method":
EndpointRegistry.useBefore(decoratorArgs[0], decoratorArgs[1]!, args);
return decoratorArgs[2] as any;
case "class":
StoreMerge("middlewares", {useBefore: args})(...decoratorArgs);
break;
default:
throw new UnsupportedDecoratorType(UseBefore, decoratorArgs);
}
};
}