IdioEnum
const { IdioEnum } = require("idio-graphql");
Intro
You can use IdioEnum to modularize a EnumTypeDefinition
, together with its resolver. You can specify enums 'top-level' at combineNodes or at an GraphQLNode level.
Example
const StatusEnum = new IdioEnum({
name: "StatusEnum",
typeDefs: `
enum StatusEnum {
ONLINE
OFFLINE
INACTIVE
}
`,
resolver: {
ONLINE: "online",
OFFLINE: "offline",
INACTIVE: "inactive"
}
});
Definition
/**
* You can use IdioEnum to modularize a EnumTypeDefinition,
* together with its resolver. You can specify enums 'top-level'
* at combineNodes or at an GraphQLNode level.
*/
class IdioEnum {
name: string;
typeDefs: string;
resolver: { [k: string]: any };
constructor(input: {
name: string;
typeDefs: string | DocumentNode;
resolver: { [k: string]: any };
});
serve: (brokerOptions: IdioBrokerOptions) => Promise<ServiceBroker>;
}