How to use the @nestjsx/util.getOwnPropNames function in @nestjsx/util

To help you get started, we’ve selected a few @nestjsx/util 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 nestjsx / crud / packages / crud / src / crud / crud-routes.factory.ts View on Github external
private overrideRoutes(routesSchema: BaseRoute[]) {
    getOwnPropNames(this.targetProto).forEach((name) => {
      const override = R.getOverrideRoute(this.targetProto[name]);
      const route = routesSchema.find((r) => isEqual(r.name, override));

      if (override && route && route.enable) {
        // get metadata
        const interceptors = R.getInterceptors(this.targetProto[name]);
        const baseInterceptors = R.getInterceptors(this.targetProto[override]);
        const baseAction = R.getAction(this.targetProto[override]);
        const operation = Swagger.getOperation(this.targetProto[name]);
        const baseOperation = Swagger.getOperation(this.targetProto[override]);
        const swaggerParams = Swagger.getParams(this.targetProto[name]);
        const baseSwaggerParams = Swagger.getParams(this.targetProto[override]);
        const responseOk = Swagger.getResponseOk(this.targetProto[name]);
        const baseResponseOk = Swagger.getResponseOk(this.targetProto[override]);
        // set metadata
        R.setInterceptors([...baseInterceptors, ...interceptors], this.targetProto[name]);
github nestjsx / crud / packages / crud / lib / crud / crud-routes.factory.js View on Github external
overrideRoutes(routesSchema) {
        util_1.getOwnPropNames(this.targetProto).forEach((name) => {
            const override = reflection_helper_1.R.getOverrideRoute(this.targetProto[name]);
            const route = routesSchema.find((r) => util_1.isEqual(r.name, override));
            if (override && route && route.enable) {
                const interceptors = reflection_helper_1.R.getInterceptors(this.targetProto[name]);
                const baseInterceptors = reflection_helper_1.R.getInterceptors(this.targetProto[override]);
                const baseAction = reflection_helper_1.R.getAction(this.targetProto[override]);
                const baseSwaggerParams = swagger_helper_1.Swagger.getParams(this.targetProto[override]);
                const baseResponseOk = swagger_helper_1.Swagger.getResponseOk(this.targetProto[override]);
                reflection_helper_1.R.setInterceptors([...baseInterceptors, ...interceptors], this.targetProto[name]);
                reflection_helper_1.R.setAction(baseAction, this.targetProto[name]);
                swagger_helper_1.Swagger.setOperation(override, this.modelName, this.targetProto[name]);
                swagger_helper_1.Swagger.setParams(baseSwaggerParams, this.targetProto[name]);
                swagger_helper_1.Swagger.setResponseOk(baseResponseOk, this.targetProto[name]);
                this.overrideParsedBodyDecorator(override, name);
                reflection_helper_1.R.setRoute(route, this.targetProto[name]);
                route.override = true;