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 🙏

© 2024 – Pkg Stats / Ryan Hefner

keystone-field-nested-set

v4.0.1-2

Published

nested set field for keystonejs

Downloads

31

Readme

Nested Set Keystone field type

Add nested set field for Keystone headless CNS. It allows you to create and manipulate with tree-like structures with child and parent items.

Nested Set model

The Nested Set model is described here: https://en.wikipedia.org/wiki/Nested_set_model

This module stores nested set data in the database using field names: left, rigth, depth

Graphql Scheme

Output

  • left: Int
  • right: Int
  • depth: Int
  • weight: Int // Serial number through current branch
  • parentId: ID// Keystone id of direct parent element
  • isLeaf: Boolean, true if have no children
  • childrenCount // counts children

Filters

  • parentId: type ID // Keystone id of direct parent element
  • childOf // filters all elements that are children of that Keystone id
  • parentOf // filters all elements that are parent of that Keystone id
  • prevSiblingOf: ID! // left sibling element, null if absent
  • nextSiblingOf: ID! // right sibling element, null if absent

Mutation

Create and Update
  • parentId: ID // Keystone id of direct parent element
  • prevSiblingId: ID // Keystone id of left sibling element
  • nextSiblingId: ID // Keystone id of right sibling element
Delete

If node has children they move to the parent of deleted node.

Recompiling

The module requires to be compiled with the same major versions of the NPM modules:

  • keystone-6/core
  • @keystone-ui/core
  • @keystone-ui/fields
  • graphql

So, if you get problems on launching Keystone with this module, getting these errors:

  • Schema must contain uniquely named types but contains multiple types named "OrderDirection".
  • Duplicate "graphql" modules cannot be used at the same time

You need to change dependencies to the exact ones, that is uses in your application and in the keystone-6/core package.

Recompiling procedure in case you have the Keystone Core from sources in your project.

  1. Create a link to the sources of both projects - execute this command on each directory:
yarn link
  1. In your project directory: cleanup the node_modules folder, link the Nested Set module, and preconstruct:
rm -rf ./node-modules && yarn link && yarn link keystone-field-nested-set && yarn preconstruct && yarn install
  1. In keystone-nested-set directory: build with linked Keystone sources:
rm -rf ./node-modules && yarn link @keystone-6/core && yarn && yarn build
  1. On your project directory: build with recently rebuilt Nested Set module:
yarn build