UNPKG

simple-graphql

Version:

The simple way to generates GraphQL schemas and Sequelize models from your models definition.

30 lines 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const graphql_relay_1 = require("graphql-relay"); exports.default = (context) => { const interfaces = { Node: (0, graphql_relay_1.nodeDefinitions)((globalId) => { const { type, id } = (0, graphql_relay_1.fromGlobalId)(globalId); console.log('Warning-------------------- node id Fetcher not implement' + type + ' ' + id); }, (obj) => { const type = obj._fieldType; const typeConfig = context.typeConfig(type); if (typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.outputType) { return typeConfig.outputType; } throw new Error(`Type ${type} not exist.`); }).nodeInterface }; return { interface: (str) => { return interfaces[str]; }, registerInterface: (name, gInterface) => { interfaces[name] = gInterface; } }; }; //# sourceMappingURL=buildInterfaceContext.js.map