@cran/lib.gql.core
Version:
GQL Core Functionality
36 lines (35 loc) • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isInternalDirective = exports.isInternalLocation = exports.isInternal = void 0;
const graphql_1 = require("graphql");
exports.isInternal = {
// Request Definitions
[graphql_1.DirectiveLocation.QUERY]: false,
[graphql_1.DirectiveLocation.MUTATION]: false,
[graphql_1.DirectiveLocation.SUBSCRIPTION]: false,
[graphql_1.DirectiveLocation.FIELD]: false,
[graphql_1.DirectiveLocation.FRAGMENT_DEFINITION]: false,
[graphql_1.DirectiveLocation.FRAGMENT_SPREAD]: false,
[graphql_1.DirectiveLocation.INLINE_FRAGMENT]: false,
[graphql_1.DirectiveLocation.VARIABLE_DEFINITION]: false,
// Type System Definitions
[graphql_1.DirectiveLocation.SCHEMA]: true,
[graphql_1.DirectiveLocation.SCALAR]: true,
[graphql_1.DirectiveLocation.OBJECT]: true,
[graphql_1.DirectiveLocation.FIELD_DEFINITION]: true,
[graphql_1.DirectiveLocation.ARGUMENT_DEFINITION]: true,
[graphql_1.DirectiveLocation.INTERFACE]: true,
[graphql_1.DirectiveLocation.UNION]: true,
[graphql_1.DirectiveLocation.ENUM]: true,
[graphql_1.DirectiveLocation.ENUM_VALUE]: true,
[graphql_1.DirectiveLocation.INPUT_OBJECT]: true,
[graphql_1.DirectiveLocation.INPUT_FIELD_DEFINITION]: true,
};
function isInternalLocation(location) {
return exports.isInternal[location];
}
exports.isInternalLocation = isInternalLocation;
function isInternalDirective(directive) {
return directive.locations.every(isInternalLocation);
}
exports.isInternalDirective = isInternalDirective;