UNPKG

@graphql-mocks/falso

Version:

Fake GraphQL queries with graphql-mocks and Falso

18 lines (17 loc) 613 B
import { extractDependencies } from 'graphql-mocks/resolver'; import * as falso from '@ngneat/falso'; function falsoTypeResolver() { return function (value, context, _info, abstractType) { var { graphqlSchema } = extractDependencies(context, ['graphqlSchema']); if (value !== null && value !== void 0 && value.__typename) { return value.__typename; } var possibleTypes = graphqlSchema.getPossibleTypes(abstractType); var chosenType = falso.rand(possibleTypes); return chosenType.name; }; } export { falsoTypeResolver }; //# sourceMappingURL=falso-type-resolver.mjs.map