graphbrainz/src/types/node.js
Brian Beck f095cd4de7
Modernize dependencies, syntax, imports (#93)
* wip: Modernize dependencies, syntax, imports

* Use final release of ava-nock v2

* Update Travis config

* Remove Node 13 from test matrix

* Replace errorClass with parseErrorMessage in subclasses

* define exports, apply updated lint rules

* Remove markdown eslint plugin

* Update README

* v9.0.0-beta.1

* Add gql tag to exports

* v9.0.0-beta.2

* Bump ava-nock, add test

* Update dataloader loadMany usage

* Add modules note to README

* Add retry option to got calls
2021-04-15 21:34:29 -07:00

17 lines
501 B
JavaScript

import GraphQLRelay from 'graphql-relay';
import { toDashed } from '../util.js';
import { resolveType } from './helpers.js';
const { nodeDefinitions, fromGlobalId } = GraphQLRelay;
const { nodeInterface, nodeField } = nodeDefinitions(
(globalID, { loaders }) => {
const { type, id } = fromGlobalId(globalID);
const entityType = toDashed(type);
return loaders.lookup.load([entityType, id]);
},
resolveType
);
export const Node = nodeInterface;
export { nodeInterface, nodeField };