How to use the @nestjs/graphql.GraphQLFactory function in @nestjs/graphql

To help you get started, we’ve selected a few @nestjs/graphql 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 notadd / next / packages / graphql / factories / graphql.factory.js View on Github external
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const glob = require("glob");
const common_1 = require("@nestjs/common");
const merge_graphql_schemas_1 = require("merge-graphql-schemas");
const graphql_1 = require("@nestjs/graphql");
let GraphqlFactory = class GraphqlFactory extends graphql_1.GraphQLFactory {
    loadTypesFromFiles(pattern) {
        const paths = glob.sync(pattern);
        return paths.map(path => fs.readFileSync(path, "utf8"));
    }
    mergeTypesFromPaths(pathsToTypes) {
        const types = pathsToTypes.map(pattern => this.loadTypesFromFiles(pattern));
        return merge_graphql_schemas_1.mergeTypes(types.map(item => {
            return Array.isArray(item) ? item.join("\n") : item;
        }));
    }
};
GraphqlFactory = __decorate([
    common_1.Injectable()
], GraphqlFactory);
exports.GraphqlFactory = GraphqlFactory;
github notadd / next / packages / server / modules / application.module.js View on Github external
}
};
ApplicationModule = __decorate([
    common_1.Module({
        imports: [
            typeorm_1.TypeOrmModule.forRoot(),
            graphql_1.GraphQLModule,
            configuration_1.ConfigurationModule,
            logger_1.LoggerModule,
            setting_1.SettingModule,
            backend_1.BackendModule,
            user_1.UserModule,
            authentication_1.AuthenticationModule,
        ],
    }),
    __metadata("design:paramtypes", [graphql_1.GraphQLFactory])
], ApplicationModule);
exports.ApplicationModule = ApplicationModule;