@graphql-tools/utils 8.2.5 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -5
- package/index.mjs +8 -7
- package/package.json +1 -1
- package/validate-documents.d.ts +1 -0
package/index.js
CHANGED
|
@@ -1179,8 +1179,7 @@ if (typeof exports.AggregateError === 'undefined') {
|
|
|
1179
1179
|
};
|
|
1180
1180
|
}
|
|
1181
1181
|
|
|
1182
|
-
async function validateGraphQlDocuments(schema, documentFiles, effectiveRules) {
|
|
1183
|
-
effectiveRules = effectiveRules || createDefaultRules();
|
|
1182
|
+
async function validateGraphQlDocuments(schema, documentFiles, effectiveRules = createDefaultRules()) {
|
|
1184
1183
|
const allFragmentMap = new Map();
|
|
1185
1184
|
const documentFileObjectsToValidate = [];
|
|
1186
1185
|
for (const documentFile of documentFiles) {
|
|
@@ -1242,9 +1241,11 @@ function checkValidationErrors(loadDocumentErrors) {
|
|
|
1242
1241
|
}
|
|
1243
1242
|
}
|
|
1244
1243
|
function createDefaultRules() {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1244
|
+
let ignored = ['NoUnusedFragmentsRule', 'NoUnusedVariablesRule', 'KnownDirectivesRule'];
|
|
1245
|
+
if (graphql.versionInfo.major < 15) {
|
|
1246
|
+
ignored = ignored.map(rule => rule.replace(/Rule$/, ''));
|
|
1247
|
+
}
|
|
1248
|
+
return graphql.specifiedRules.filter((f) => !ignored.includes(f.name));
|
|
1248
1249
|
}
|
|
1249
1250
|
|
|
1250
1251
|
function stripBOM(content) {
|
|
@@ -4206,6 +4207,7 @@ exports.collectSubFields = collectSubFields;
|
|
|
4206
4207
|
exports.compareNodes = compareNodes;
|
|
4207
4208
|
exports.compareStrings = compareStrings;
|
|
4208
4209
|
exports.correctASTNodes = correctASTNodes;
|
|
4210
|
+
exports.createDefaultRules = createDefaultRules;
|
|
4209
4211
|
exports.createNamedStub = createNamedStub;
|
|
4210
4212
|
exports.createStub = createStub;
|
|
4211
4213
|
exports.createVariableNameGenerator = createVariableNameGenerator;
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parse, isNonNullType, GraphQLError, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, buildClientSchema, visit, TokenKind, Source, isTypeSystemDefinitionNode, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isDirective, isCompositeType, doTypesOverlap, getDirectiveValues, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, getOperationAST, getOperationRootType, TypeNameMetaFieldDef, buildASTSchema } from 'graphql';
|
|
1
|
+
import { parse, isNonNullType, GraphQLError, Kind, valueFromAST, print, isObjectType, isListType, isSpecifiedDirective, astFromValue, isSpecifiedScalarType, isIntrospectionType, isInterfaceType, isUnionType, isInputObjectType, isEnumType, isScalarType, GraphQLDeprecatedDirective, specifiedRules, concatAST, validate, versionInfo, buildClientSchema, visit, TokenKind, Source, isTypeSystemDefinitionNode, getNamedType, GraphQLString, GraphQLNonNull, GraphQLList, GraphQLID, GraphQLBoolean, GraphQLFloat, GraphQLInt, GraphQLObjectType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLDirective, GraphQLUnionType, GraphQLEnumType, GraphQLScalarType, isNamedType, getNullableType, isLeafType, GraphQLSchema, isDirective, isCompositeType, doTypesOverlap, getDirectiveValues, GraphQLSkipDirective, GraphQLIncludeDirective, typeFromAST, isAbstractType, getOperationAST, getOperationRootType, TypeNameMetaFieldDef, buildASTSchema } from 'graphql';
|
|
2
2
|
|
|
3
3
|
const asArray = (fns) => (Array.isArray(fns) ? fns : fns ? [fns] : []);
|
|
4
4
|
const invalidDocRegex = /\.[a-z0-9]+$/i;
|
|
@@ -1175,8 +1175,7 @@ if (typeof AggregateErrorImpl === 'undefined') {
|
|
|
1175
1175
|
};
|
|
1176
1176
|
}
|
|
1177
1177
|
|
|
1178
|
-
async function validateGraphQlDocuments(schema, documentFiles, effectiveRules) {
|
|
1179
|
-
effectiveRules = effectiveRules || createDefaultRules();
|
|
1178
|
+
async function validateGraphQlDocuments(schema, documentFiles, effectiveRules = createDefaultRules()) {
|
|
1180
1179
|
const allFragmentMap = new Map();
|
|
1181
1180
|
const documentFileObjectsToValidate = [];
|
|
1182
1181
|
for (const documentFile of documentFiles) {
|
|
@@ -1238,9 +1237,11 @@ function checkValidationErrors(loadDocumentErrors) {
|
|
|
1238
1237
|
}
|
|
1239
1238
|
}
|
|
1240
1239
|
function createDefaultRules() {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1240
|
+
let ignored = ['NoUnusedFragmentsRule', 'NoUnusedVariablesRule', 'KnownDirectivesRule'];
|
|
1241
|
+
if (versionInfo.major < 15) {
|
|
1242
|
+
ignored = ignored.map(rule => rule.replace(/Rule$/, ''));
|
|
1243
|
+
}
|
|
1244
|
+
return specifiedRules.filter((f) => !ignored.includes(f.name));
|
|
1244
1245
|
}
|
|
1245
1246
|
|
|
1246
1247
|
function stripBOM(content) {
|
|
@@ -4178,4 +4179,4 @@ function fixSchemaAst(schema, options) {
|
|
|
4178
4179
|
return schema;
|
|
4179
4180
|
}
|
|
4180
4181
|
|
|
4181
|
-
export { AggregateErrorImpl as AggregateError, MapperKind, addTypes, appendObjectFields, asArray, assertSome, astFromArg, astFromDirective, astFromEnumType, astFromEnumValue, astFromField, astFromInputField, astFromInputObjectType, astFromInterfaceType, astFromObjectType, astFromScalarType, astFromSchema, astFromUnionType, astFromValueUntyped, buildOperationNodeForField, checkValidationErrors, collectComment, collectFields, collectSubFields, compareNodes, compareStrings, correctASTNodes, createNamedStub, createStub, createVariableNameGenerator, dedentBlockStringValue, filterSchema, fixSchemaAst, forEachDefaultValue, forEachField, getArgumentValues, getBlockStringIndentation, getBuiltInForStub, getComment, getDefinedRootType, getDeprecatableDirectiveNodes, getDescription, getDirective, getDirectiveInExtensions, getDirectiveNodes, getDirectives, getDirectivesInExtensions, getDocumentNodeFromSchema, getFieldsWithDirectives, getImplementingTypes, getLeadingCommentBlock, getResolversFromSchema, getResponseKeyFromInfo, getRootTypeMap, getRootTypeNames, getRootTypes, healSchema, healTypes, implementsAbstractType, inspect, isAsyncIterable, isDescribable, isDocumentNode, isDocumentString, isNamedStub, isSome, isValidPath, makeDeprecatedDirective, makeDirectiveNode, makeDirectiveNodes, mapAsyncIterator, mapSchema, memoize1, memoize2, memoize2of4, memoize3, memoize4, memoize5, mergeDeep, modifyObjectFields, nodeToString, observableToAsyncIterable, parseGraphQLJSON, parseGraphQLSDL, parseInputValue, parseInputValueLiteral, parseSelectionSet, printComment, printSchemaWithDirectives, printWithComments, pruneSchema, pushComment, relocatedError, removeObjectFields, renameType, resetComments, rewireTypes, selectObjectFields, serializeInputValue, transformCommentsToDescriptions, transformInputValue, updateArgument, validateGraphQlDocuments, valueMatchesCriteria, visitData, visitErrors, visitResult, withCancel };
|
|
4182
|
+
export { AggregateErrorImpl as AggregateError, MapperKind, addTypes, appendObjectFields, asArray, assertSome, astFromArg, astFromDirective, astFromEnumType, astFromEnumValue, astFromField, astFromInputField, astFromInputObjectType, astFromInterfaceType, astFromObjectType, astFromScalarType, astFromSchema, astFromUnionType, astFromValueUntyped, buildOperationNodeForField, checkValidationErrors, collectComment, collectFields, collectSubFields, compareNodes, compareStrings, correctASTNodes, createDefaultRules, createNamedStub, createStub, createVariableNameGenerator, dedentBlockStringValue, filterSchema, fixSchemaAst, forEachDefaultValue, forEachField, getArgumentValues, getBlockStringIndentation, getBuiltInForStub, getComment, getDefinedRootType, getDeprecatableDirectiveNodes, getDescription, getDirective, getDirectiveInExtensions, getDirectiveNodes, getDirectives, getDirectivesInExtensions, getDocumentNodeFromSchema, getFieldsWithDirectives, getImplementingTypes, getLeadingCommentBlock, getResolversFromSchema, getResponseKeyFromInfo, getRootTypeMap, getRootTypeNames, getRootTypes, healSchema, healTypes, implementsAbstractType, inspect, isAsyncIterable, isDescribable, isDocumentNode, isDocumentString, isNamedStub, isSome, isValidPath, makeDeprecatedDirective, makeDirectiveNode, makeDirectiveNodes, mapAsyncIterator, mapSchema, memoize1, memoize2, memoize2of4, memoize3, memoize4, memoize5, mergeDeep, modifyObjectFields, nodeToString, observableToAsyncIterable, parseGraphQLJSON, parseGraphQLSDL, parseInputValue, parseInputValueLiteral, parseSelectionSet, printComment, printSchemaWithDirectives, printWithComments, pruneSchema, pushComment, relocatedError, removeObjectFields, renameType, resetComments, rewireTypes, selectObjectFields, serializeInputValue, transformCommentsToDescriptions, transformInputValue, updateArgument, validateGraphQlDocuments, valueMatchesCriteria, visitData, visitErrors, visitResult, withCancel };
|
package/package.json
CHANGED
package/validate-documents.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export interface LoadDocumentError {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function validateGraphQlDocuments(schema: GraphQLSchema, documentFiles: Source[], effectiveRules?: ValidationRule[]): Promise<ReadonlyArray<LoadDocumentError>>;
|
|
9
9
|
export declare function checkValidationErrors(loadDocumentErrors: ReadonlyArray<LoadDocumentError>): void | never;
|
|
10
|
+
export declare function createDefaultRules(): import("graphql").ValidationRule[];
|