IdioDirective
const { IdioDirective } = require("idio-graphql");
Intro
You can use IdioDirective to modularize a DirectiveDefinition
, together with its resolver.
You can only specify directives 'top-level' at combineNodes.
Example
Example uses graphql-auth-directives
const hasScopeDirective = new IdioDirective({
name: "hasScope",
typeDefs: `
directive @hasScope(
scopes: [ String ]!
) on FIELD_DEFINITION
`,
resolver: HasScopeDirective
});
Definition
/**
* You can use IdioDirective to modularize a DirectiveDefinition,
* together with its resolver. You can only specify directives 'top-level'
* at combineNodes.
*/
class IdioDirective {
name: string;
typeDefs: string;
/** @type {SchemaDirectiveVisitor} */
resolver: any;
constructor(input: {
name: string;
typeDefs: string | DocumentNode;
/** @type {SchemaDirectiveVisitor} */ resolver: any;
});
}