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

ssb-crut-authors

v3.1.1

Published

ssb-crut but with author permissions baked in!

Downloads

39

Readme

ssb-crut-authors

Basically ssb-crut but adds authors field and rules which go with that to control who can publish valid updates to a record.

Example usage

const CRUT = require('ssb-crut-authors')
const Overwrite = require('@tangle/overwrite')

const server = Server() // some scuttlebutt instance
const spec = {
  type: 'gathering',
  props: {
    title: Overwrite({ type: 'string' }),
    description: Overwrite({ type: 'string' }),
    date: Overwrite({ type: 'string', pattern: '^2020-\d\d-\d\d' }),
    // authors    <-- automatically added
  },
  // isValidNextStep    <-- auto-adds authoship logic, you can add more logic on top
}

const crut = new CRUT(serve, spec)

const details = {
  title: 'party',
  authors: { add: [server.id] }
}
crut.create(details, (err, gatheringId) => {
  //
})

Authorship Rules

  1. You must add at least one author when creating a record
  2. A valid update is one which
    • a) is authored by someone in the list of active authors on the tip(s) the update is extending
    • b) leaves the record with > 1 author (after update is applied)
  3. An Author must be one of:
    • a FeedId
    • * (wildcard), and means anyone can author
  4. If * is active (has been added and not removed) then anyone can update, regardless of whehter they have been removed.

Rare edge cases:

Edge Case (A) - authors simultaneously remove one another

An example of edge case (A) would be:

  • there are two authors added in initial message A
  • update B removes one author, C removes the other
  • one of those authors tries to publish M
graph TB
A-->B-.->M
A-->C-.->M

classDef default fill: purple, color: white, stroke: none;
classDef proposed fill: hotpink, color: white, stroke: none;
class M proposed

Diagram of a branched state (tips B, C) and you're trying to publish an update (merge node M)

This could be a block because of rule (2.a), as to extend two tips you must be an active author according to each tip, (and no author is valid for both tips).

Special Rule: in this case the "original author" is considered a valid author to publish a resolving message

Notes:

  • this special rule only applies if there exists no valid author who could merge
  • publishing an "empty" transformation M is insufficient as merging these authors state would violate rule (2.b)
    • i.e. M here must contain add at least one author

Requirements

Same as ssb-crut: https://gitlab.com/ahau/lib/ssb-crut#requirements

API

Same as ssb-crut except authors is a reserved variable:

  • spec.props cannot include authors
  • spec.staticProps cannot include authors

TODO

This was extracted from ssb-profile in order to generalise it to more records.

  • Need to review if we've extracted all the relevant tests about authorship from there

We might want to consider modifying ssb-crut to take "plugins" to extend core functionality and make this a plugin