npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@litewarp/graphile-relation-inputs-plugin

v0.0.3-alpha

Published

A plugin for PostGraphile v5 that allows you to mutate a resource's nested relations

Readme

Graphile Relation Inputs Plugin (i.e., "Nested Mutations" Plugin for Graphile v5)

A Postgraphile Plugin to Update Nested Relations as Part of a Create or Update Mutation.

This is a port of the "Nested Mutations" plugin for Postgraphile v4. Given the ambiguity regarding the term "nested mutations" (see, e.g., Benjie's screed), I've renamed it Relation Inputs to more accurately reflect it's purpose. That is, this plugin allows you to edit related resources in a single mutation graph. Importantly, the plugin utilizes existing step plans to recursively apply mutations down the line.

Given a schema of:

type School implements Node {
  id: ID!
  name: String!

  teachers(
    after: Cursor
    before: Cursor
    condition: TeacherCondition
    first: Int
    last: Int
    offset: Int
    orderBy: [TeacherOrderBy!] = [PRIMARY_KEY_ASC]
  ): TeacherConnection!
}

type Teacher implements Node {
  id: ID!
  name: String!
  schoolId: Int!

  school: School
}

input SchoolInput {
  name: String!
  rowId: Int
}

input TeacherInput {
  name: String!
  rowId: Int
}

It adds the following fields to the Input Objects:

input TeacherInput {
  name: String!
  otherId: Int
  schoolId: Int!

  school: SchoolByMySchoolIdInput
}

input SchoolByMySchoolIdInput {
  connectById: SchoolByMySchoolIdConnectByNodeIdInput
  create: SchoolByMySchoolIdCreateInput
  deleteById: SchoolByMySchoolIdDeleteByNodeIdInput
  disconnectById: SchoolByMySchoolIdDisconnectByNodeIdInput
  updateById: SchoolByMySchoolIdUpdateByNodeIdInput
}

input SchoolByMySchoolIdConnectByNodeIdInput {
  id: ID!
}

input SchoolByMySchoolIdCreateInput {
  name: String!
  rowId: Int

  teachers: TeachersByTheirSchoolIdInput
}

input SchoolByMySchoolIdDeleteByNodeIdInput {
  id: ID!
}

input SchoolByMySchoolIdDisconnectByNodeIdInput {
  id: ID!
}

input SchoolByMySchoolIdUpdateByNodeIdInput {
  id: ID!
  patch: SchoolPatch!
}

input SchoolInput {
  name: String!

  teachers: TeachersByTheirSchoolIdInput
}

input TeachersByTheirSchoolIdInput {
  connectById: [TeachersByTheirSchoolIdConnectByNodeIdInput!]
  create: [TeachersByTheirSchoolIdCreateInput!]
  deleteById: [TeachersByTheirSchoolIdDeleteByNodeIdInput!]
  disconnectById: [TeachersByTheirSchoolIdDisconnectByNodeIdInput!]
  updateById: [TeachersByTheirSchoolIdUpdateByNodeIdInput!]
}

input TeachersByTheirSchoolIdConnectByNodeIdInput {
  id: ID!
}

input TeachersByTheirSchoolIdCreateInput {
  name: String!
  otherId: Int

  school: SchoolByMySchoolIdInput
  schoolId: Int!
}

input TeachersByTheirSchoolIdDeleteByNodeIdInput {
  id: ID!
}

input TeachersByTheirSchoolIdDisconnectByNodeIdInput {
  id: ID!
}

input TeachersByTheirSchoolIdUpdateByNodeIdInput {
  id: ID!
  patch: TeacherPatch!
}

Warning! This is a work in progress and experimental.

The Following Mutations are Currently Supported

  • [x] Create
  • [X] ConnectByNodeId
  • [X] ConnectByUniqueKeys
  • [X] UpdateByNodeId
  • [X] UpdateByUniqueKeys
  • [ ] DisconnectByNodeId
  • [ ] DisconnectByUniqueKeys
  • [ ] DeleteByNodeId
  • [ ] DeleteByUniqueKeys

TODO:

  • [ ] Add semantic version / changesets
  • [ ] Migrate tests from version 4 library
  • [ ] Make Plugin "Exportable"
  • [ ] Use Behaviors ("nested:resource:update", etc.)
  • [ ] Use tags (override fieldname)
  • [ ] Add config options to limit complexity / recursive depth
  • [ ] Publish to JSR?

Shoutout to Benjie and the entire graphile team. This is a small addition to their voluminous efforts.