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

@seneca/entity-depend

v0.6.0

Published

Handle dependency relationships on entity verison

Downloads

3

Readme

seneca-entity-depend

Handle dependency relationships on entity verison

npm version !Build Coverage Status Maintainability DeepScan grade

NOTE

  • Only works on @seneca/entity-history enabled ents (as per ent option of @seneca/entity-history).

Message Tutorial

These can be run interactively with [seneca-repl](senecajs/seneca-repl. To use in code, call with let out = await seneca.post(msg).

Create some entities

> sys:entity,cmd:save,name:foo,ent:{x:1,y:'Y'} => foo1=out
{ id: <ID>, x: 1, y: 'Y' }
> sys:entity,cmd:save,name:foo,ent:{x:2,y:'YY'} => foo2=out
{ id: <ID>, x: 2, y: 'YY' }

Create a dependency

> sys:entity,rig:depend,name:foo,make:child,parent_id:`$.foo1.id` => foo1c1=out
{ id: <ID>, x: 1, y: 'Y' }

Pull latest updates from parent, child's changes have precedence

Pulls all changes from previous pull point (initially the depend point). Default is to keep child's conflicting changes.

> sys:entity,rig:depend,name:foo,pull:parent,child_id:`$.foo1c1.id` => foo1c1=out

Pull latest updates from parent, parents's changes have precedence

> sys:entity,rig:depend,name:foo,pull:parent,keep:parent,child_id:`$.foo1c1.id` 
    => foo1c1=out

Pull latest updates from child

Pulls all changes since previous pull point (initially the depend point). Default is to keep parent's conflicting changes.

> sys:entity,rig:depend,name:foo,pull:child,parent_id:`$.foo1.id`,child_id:`$.foo1c1.id` 
    => foo1=out

Keep child's conflicting changes:

> sys:entity,rig:depend,name:foo,pull:child,keep:child,parent_id:`$.foo1.id`,child_id:`$.foo1c1.id` 
    => foo1=out

Parent to child relationship is one-to-many. Thus pull:child needs both child_id and parent_id.

Generate a pull request

> sys:entity,rig:depend,name:foo,pull:child,make:request,parent_id:`$.foo1.id`,child_id:`$.foo1c1.id` 
    => pr0=out

Pull request operations

List pull requests against child and parent, as provided

> sys:entity,rig:depend,name:foo,list:request,parent_id?,child_id?

Apply a pull request. Same as applying pull operation above.

> sys:entity,rig:depend,name:foo,apply:request,request_id

Preview pull operation

See which fields are changed in parent and child.

> sys:entity,rig:depend,name:foo,pull-preview:parent,child_id:`$.foo1c1.id` => preview1=out

Pull latest updates from parent, specific version

Pulls all changes from specified version. NOTE: uses entity-history directly

> sys:entity,rig:depend,entity:depend,ent:{name:foo,id:`$.foo1`} => h0=out.items
> sys:entity,rig:depend,name:foo,pull:parent,child_id:`$.foo1c1.id`,
    parent_ver_id:`$.h0[0].id` => foo1c1=out

Implementation

Entities

  • sys/entdep: Dependency relationships established with make:child
  • sys/pullhist: Pull history.
  • sys/pullreq: Pull requests.

TODO:

  • Patterns should support ent param as well as top level base,name,id.
  • Support make:parent