How to use the @tsed/core.UnsupportedDecoratorType function in @tsed/core

To help you get started, we’ve selected a few @tsed/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / test / units / core / utils / DecoratorUtils.spec.ts View on Github external
const createError = (args: any[]) => {
      return new UnsupportedDecoratorType({name: "Decorator"}, args).message;
    };
github TypedProject / ts-express-decorators / packages / common / src / mvc / decorators / method / authOptions.ts View on Github external
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);
    }
  };
}
github TypedProject / ts-express-decorators / packages / common / src / mvc / decorators / method / useAfter.ts View on Github external
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);
    }
  };
}
github TypedProject / ts-express-decorators / packages / common / src / mvc / decorators / method / useAuth.ts View on Github external
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);
    }
  };
}
github TypedProject / ts-express-decorators / packages / swagger / src / decorators / operation.ts View on Github external
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);
    }
  };
}
github TypedProject / ts-express-decorators / packages / common / src / mvc / decorators / required.ts View on Github external
(...decoratorArgs: DecoratorParameters) => {
      const metadata = getStorableMetadata(decoratorArgs);

      if (!metadata) {
        throw new UnsupportedDecoratorType(Required, decoratorArgs);
      }

      metadata.required = true;

      if (allowedRequiredValues.length) {
        Allow(...allowedRequiredValues)(...decoratorArgs);
      }
    },
    StoreMerge("responses", {
github TypedProject / ts-express-decorators / packages / swagger / src / decorators / responses.ts View on Github external
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);
    }
  };
}
github TypedProject / ts-express-decorators / packages / common / src / mvc / decorators / method / useBeforeEach.ts View on Github external
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);
    }
  };
}
github TypedProject / ts-express-decorators / packages / di / src / decorators / inject.ts View on Github external
}
        });
        break;

      case "method":
        Store.from(target).merge("injectableProperties", {
          [propertyKey]: {
            bindingType,
            propertyKey
          }
        });

        return descriptor;

      default:
        throw new UnsupportedDecoratorType(Inject, [target, propertyKey, descriptor]);
    }
  };
}
github TypedProject / ts-express-decorators / packages / common / src / mvc / decorators / method / useBefore.ts View on Github external
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);
    }
  };
}