@neo4j/graphql
Version:
A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations
64 lines • 2.88 kB
JavaScript
;
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryASTFactory = void 0;
const QueryAST_1 = require("../ast/QueryAST");
const AuthFilterFactory_1 = require("./AuthFilterFactory");
const AuthorizationFactory_1 = require("./AuthorizationFactory");
const AuthorizationFactoryDeprecated_1 = require("./AuthorizationFactoryDeprecated");
const FieldFactory_1 = require("./FieldFactory");
const FilterFactory_1 = require("./FilterFactory");
const OperationFactory_1 = require("./OperationFactory");
const SortAndPaginationFactory_1 = require("./SortAndPaginationFactory");
class QueryASTFactory {
constructor(schemaModel) {
this.schemaModel = schemaModel;
this.filterFactory = new FilterFactory_1.FilterFactory(this);
this.fieldFactory = new FieldFactory_1.FieldFactory(this);
this.sortAndPaginationFactory = new SortAndPaginationFactory_1.SortAndPaginationFactory(this);
const authFilterFactory = new AuthFilterFactory_1.AuthFilterFactory(this);
this.authorizationFactory = new AuthorizationFactory_1.AuthorizationFactory(authFilterFactory);
this.authorizationFactoryDeprecated = new AuthorizationFactoryDeprecated_1.AuthorizationFactoryDeprecated(authFilterFactory);
this.operationsFactory = new OperationFactory_1.OperationsFactory(this);
}
createQueryAST({ resolveTree, entityAdapter, context, reference, varName, }) {
const operation = this.operationsFactory.createTopLevelOperation({
entity: entityAdapter,
resolveTree,
context,
varName,
reference,
});
return new QueryAST_1.QueryAST(operation);
}
createMutationAST({ resolveTree, entityAdapter, context, varName, resolveAsUnwind = false, callbackBucket, }) {
const operation = this.operationsFactory.createTopLevelMutationOperation({
entity: entityAdapter,
resolveTree,
context,
varName,
resolveAsUnwind,
callbackBucket,
});
return new QueryAST_1.QueryAST(operation);
}
}
exports.QueryASTFactory = QueryASTFactory;
//# sourceMappingURL=QueryASTFactory.js.map