mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* add types for graphql-depth-limit * improve type declaration * remove "strict-export-declare-modifiers" rule disable
30 lines
678 B
TypeScript
30 lines
678 B
TypeScript
import graphqlDepthLimit = require('graphql-depth-limit');
|
|
import {
|
|
GraphQLSchema,
|
|
DocumentNode,
|
|
buildSchema,
|
|
Source,
|
|
parse,
|
|
validate,
|
|
specifiedRules
|
|
} from 'graphql';
|
|
|
|
const schema: GraphQLSchema = buildSchema(`
|
|
# graphql schema goes here...
|
|
`);
|
|
const document: DocumentNode = parse(new Source(`
|
|
# graphql query goes here...
|
|
`, 'GraphQL request'));
|
|
|
|
validate(schema, document, [ graphqlDepthLimit(5) ]);
|
|
|
|
validate(schema, document, [ ...specifiedRules, graphqlDepthLimit(10) ]);
|
|
|
|
validate(schema, document, [ graphqlDepthLimit(
|
|
10,
|
|
{ ignore: [ /_trusted$/, 'idontcare' ] },
|
|
(depths: any) => {
|
|
// do something....
|
|
},
|
|
)]);
|