JSPM

@jcm/nexus-plugin-relay-node-interface

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q47380F
  • License MIT

Creates the Relay Node interface and add node/nodes fields to the Query type

Package Exports

  • @jcm/nexus-plugin-relay-node-interface

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jcm/nexus-plugin-relay-node-interface) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@jcm/nexus-plugin-relay-node-interface

Patreon Logo
Discord Logo

This plugin adds the following to the GraphQL schema generated by nexus:

  • Node interface
  • node($id: ID!): Node field on Query
  • nodes($ids: [ID!]!): Node! field on Query

The plugin itself accepts a few configuration options:

idFetcher [required]

A function with signature (idValue, ctx, info) => Object, which should return the node for given idValue

resolveType [required]

A function with signature (object) => string | GraphQLType, which should return the GraphQL type for the given object. This is basically the resolveType of the Node interface created by the plugin.

idParser

A function with signature (id) => any. It will be called with the ID passed to the node / nodes fields, and their result will be used as the first argument passed to idFetcher above. By default this is set to fromGlobalId from graphql-relay.