@neo4j/graphql
Version:
A GraphQL to Cypher query execution layer for Neo4j and JavaScript GraphQL implementations
94 lines • 5.73 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.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.APP_ID = exports.SCORE_FIELD = exports.PROPAGATED_DIRECTIVES = exports.SHAREABLE = exports.DEPRECATED = exports.DBMS_COMPONENTS_QUERY = exports.META_OLD_PROPS_CYPHER_VARIABLE = exports.META_CYPHER_VARIABLE = exports.RelationshipNestedOperationsOption = exports.RelationshipQueryDirectionOption = exports.AGGREGATION_COMPARISON_OPERATORS = exports.LOGICAL_OPERATORS = exports.SPATIAL_TYPES = exports.SCALAR_TYPES = exports.TEMPORAL_SCALAR_TYPES = exports.GRAPHQL_BUILTIN_SCALAR_TYPES = exports.RESERVED_INTERFACE_FIELDS = exports.RESERVED_TYPE_NAMES = exports.RELATIONSHIP_REQUIREMENT_PREFIX = exports.DEBUG_TRANSLATE = exports.DEBUG_GRAPHQL = exports.DEBUG_GENERATE = exports.DEBUG_EXECUTE = exports.DEBUG_AUTH = exports.DEBUG_ALL = exports.AUTHORIZATION_UNAUTHENTICATED = exports.REQUIRED_APOC_FUNCTIONS = exports.MIN_NEO4J_VERSION = exports.AUTH_UNAUTHENTICATED_ERROR = exports.AUTH_FORBIDDEN_ERROR = void 0;
exports.isTemporal = isTemporal;
exports.isSpatial = isSpatial;
const environment_1 = __importDefault(require("./environment"));
const DEBUG_PREFIX = "@neo4j/graphql";
exports.AUTH_FORBIDDEN_ERROR = "@neo4j/graphql/FORBIDDEN";
exports.AUTH_UNAUTHENTICATED_ERROR = "@neo4j/graphql/UNAUTHENTICATED";
exports.MIN_NEO4J_VERSION = "5.0";
exports.REQUIRED_APOC_FUNCTIONS = ["apoc.util.validatePredicate", "apoc.date.convertFormat"];
exports.AUTHORIZATION_UNAUTHENTICATED = "Unauthenticated";
exports.DEBUG_ALL = `${DEBUG_PREFIX}:*`;
exports.DEBUG_AUTH = `${DEBUG_PREFIX}:auth`;
exports.DEBUG_EXECUTE = `${DEBUG_PREFIX}:execution`;
exports.DEBUG_GENERATE = `${DEBUG_PREFIX}:generate`;
exports.DEBUG_GRAPHQL = `${DEBUG_PREFIX}:graphql`;
exports.DEBUG_TRANSLATE = `${DEBUG_PREFIX}:translate`;
exports.RELATIONSHIP_REQUIREMENT_PREFIX = "@neo4j/graphql/RELATIONSHIP-REQUIRED";
exports.RESERVED_TYPE_NAMES = [
{
regex: /^PageInfo$/,
error: "Type or Interface with name `PageInfo` reserved to support the pagination model of connections. See https://relay.dev/graphql/connections.htm#sec-Reserved-Types for more information.",
},
{
regex: /^.+Connection$/,
error: 'Type or Interface with name ending "Connection" are reserved to support the pagination model of connections. See https://relay.dev/graphql/connections.htm#sec-Reserved-Types for more information.',
},
{
regex: /^Node$/,
error: "Type or Interface with name `Node` reserved to support Relay. See https://relay.dev/graphql/ for more information.",
},
];
// [0]Field [1]Error
exports.RESERVED_INTERFACE_FIELDS = [
["node", "Interface field name 'node' reserved to support relay See https://relay.dev/graphql/"],
["cursor", "Interface field name 'cursor' reserved to support relay See https://relay.dev/graphql/"],
];
exports.GRAPHQL_BUILTIN_SCALAR_TYPES = ["Boolean", "ID", "String", "Int", "Float"];
exports.TEMPORAL_SCALAR_TYPES = ["DateTime", "LocalDateTime", "Time", "LocalTime", "Date"];
exports.SCALAR_TYPES = [...exports.GRAPHQL_BUILTIN_SCALAR_TYPES, ...exports.TEMPORAL_SCALAR_TYPES, "BigInt", "Duration"];
exports.SPATIAL_TYPES = ["Point", "CartesianPoint"];
function isTemporal(typeName) {
return exports.TEMPORAL_SCALAR_TYPES.includes(typeName);
}
function isSpatial(typeName) {
return exports.SPATIAL_TYPES.includes(typeName);
}
exports.LOGICAL_OPERATORS = ["AND", "OR", "NOT"];
// aggregation
exports.AGGREGATION_COMPARISON_OPERATORS = ["EQUAL", "GT", "GTE", "LT", "LTE"];
var RelationshipQueryDirectionOption;
(function (RelationshipQueryDirectionOption) {
RelationshipQueryDirectionOption["DIRECTED"] = "DIRECTED";
RelationshipQueryDirectionOption["UNDIRECTED"] = "UNDIRECTED";
})(RelationshipQueryDirectionOption || (exports.RelationshipQueryDirectionOption = RelationshipQueryDirectionOption = {}));
var RelationshipNestedOperationsOption;
(function (RelationshipNestedOperationsOption) {
RelationshipNestedOperationsOption["CREATE"] = "CREATE";
RelationshipNestedOperationsOption["UPDATE"] = "UPDATE";
RelationshipNestedOperationsOption["DELETE"] = "DELETE";
RelationshipNestedOperationsOption["CONNECT"] = "CONNECT";
RelationshipNestedOperationsOption["DISCONNECT"] = "DISCONNECT";
})(RelationshipNestedOperationsOption || (exports.RelationshipNestedOperationsOption = RelationshipNestedOperationsOption = {}));
exports.META_CYPHER_VARIABLE = "meta";
exports.META_OLD_PROPS_CYPHER_VARIABLE = "oldProps";
exports.DBMS_COMPONENTS_QUERY = "CALL dbms.components() YIELD versions, edition UNWIND versions AS version RETURN version, edition";
exports.DEPRECATED = "deprecated";
exports.SHAREABLE = "shareable";
exports.PROPAGATED_DIRECTIVES = [exports.SHAREABLE, exports.DEPRECATED];
exports.SCORE_FIELD = "score";
exports.APP_ID = `${environment_1.default.NPM_PACKAGE_NAME}@${environment_1.default.NPM_PACKAGE_VERSION}`;
//# sourceMappingURL=constants.js.map
;