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

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

Latest version **0.2.0** (published 2021-01-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jcm/nexus-plugin-relay-node-interface
pnpm add @jcm/nexus-plugin-relay-node-interface
yarn add @jcm/nexus-plugin-relay-node-interface
bun add @jcm/nexus-plugin-relay-node-interface
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-01-24 |
| First published | 2020-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 12 |
| Dependencies | 0 |
| Unpacked size | 23.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jonathan Cardoso |
| Maintainers | jonathancardoso |
| Keywords | nexus, plugin, nexus-plugin, graphql, relay, graphql-relay, node-interface |

## Links

- npm: https://www.npmjs.com/package/@jcm/nexus-plugin-relay-node-interface
- Homepage: https://github.com/JCMais/nexus-plugins/blob/plugins/relay-node-interface
- npm.io page: https://npm.io/package/@jcm/nexus-plugin-relay-node-interface

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2021-01-24
- 0.1.2 — 2020-12-24
- 0.1.1 — 2020-12-24
- 0.0.7 — 2020-08-06
- 0.0.6 — 2020-08-05
- 0.0.5 — 2020-07-31
- 0.0.4 — 2020-07-25
- 0.0.3 — 2020-07-25

## README

# @jcm/nexus-plugin-relay-node-interface<!-- omit in toc -->

<p align="center">
<a href="https://www.patreon.com/bePatron?u=19985213" data-patreon-widget-type="become-patron-button" title="Become a Patreon">
  <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="190" alt="Patreon Logo">
</a>
<br>
<a href="https://discord.io/jonathancardoso" title="Join our Discord Server">
  <img src="https://i.imgur.com/DlKeNmn.png" alt="Discord Logo" width="190" />
</a>
</p>

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`.

---
_Source: https://npm.io/package/@jcm/nexus-plugin-relay-node-interface · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
