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

@treecg/ldes-orchestrator

v0.0.5

Published

Fills the gaps that a Linked Data Platform (LDP) cannot do by itself for creating a Linked Data Event Stream (LDES) in LDP.

Downloads

9

Readme

LDES-Orchestrator

Fills the gaps that a Linked Data Platform (LDP) cannot do by itself for creating a Linked Data Event Stream (LDES) in LDP. It creates extra relations and corresponding metadata when needed to improve the scalability of a growing LDES in LDP.

Set up

Create an environment file in the root directory of where you cloned the repository (.env) has to be made with as content the identity provider used for your WebID. (e.g. SOLID_IDP=https://broker.pod.inrupt.com )

For orchestrating your LDES in Solid, this webID should have acl:Control rights (WAC) to the ldp:Container of the LDES in Solid.

SOLID_IDP=https://broker.pod.inrupt.com

Session

Credentials can be obtained by executing the login() function in your code. When a login was successful, those credentials will be printed out to system out like the following:

These are your login credentials:
{
  "refreshToken" : <token>,
  "clientId"     : <id>,
  "clientSecret" : <secret>,
  "issuer"       : "https://broker.pod.inrupt.com/",
}

Those credentials will be used to get a Session. When logged in, the function getSession() can be used to get a Session using those credentials.

const { login, isLoggedin, getSession } = require("@treecg/ldes-orchestrator")

login();
await isLoggedin(); // code that checks whether you are already logged in
const session = await getSession();

Warning: when you use the credentials once, you will have to log in again to get new credentials.

more information see about the Session class can be found here: https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/authenticate-nodejs/

Using LDESinSolid

Existing LDES in LDP

Here the LDES in LDP already exists on a given url (which is the variable base in the code)

Requirements

  • have the base IRI of an LDES in LDP (e.g. https://tree.linkeddatafragments.org/announcements)
  • have acl:Control rights in the base (more information about ACL: https://solid.github.io/web-access-control-spec/)
  • have a session (see Session)
const { LDESinSolid,login, isLoggedin, getSession } = require('@treecg/ldes-orchestrator');

// log in and get session
login();
await isLoggedin(); 
const session = await getSession();

const base = ... ;
const config = LDESinSolid.getConfig(base);
const ldes = new LDESinSolid(config.LDES, config.ACL, session);

// now you can do stuff with the ldes
// get amount of resources of the current container to which can be written
console.log(await ldes.getAmountResources());

// create a new container to which MUST be written
await ldes.createNextContainer();

Creating a new LDES in LDP instance

Requirements

  • have a solid pod where you have acl:Control rights to when logged in with a session
  • create a base IRI in that solid pod

e.g. https://solid.pod.com/ is the pod where you have acl:Control, then the base can be https://solid.pod.com/base/

const { LDESinSolid,login, isLoggedin, getSession } = require('@treecg/ldes-orchestrator');

// log in and get session
login();
await isLoggedin(); 
const session = await getSession();

const ldesConfig = {
    base : ... ,
    treePath: ... , // valid shacl path
    shape: ... , // IRI of the shape (to which all the members of the EventStream must conform to) (note: currently only SHACL shapes)
    relationType: ... , // default: https://w3id.org/tree#GreaterThanOrEqualToRelation
}
const aclConfig = {
    agent: ... // this is the webId used in the session
}

const ldes = new LDESinSolid(ldesConfig, aclConfig, session);
await ldes.createLDESinLDP();

after executing this code, you can go to base to see that an LDES is created (especially see the root at root.ttl)

It is also possible to create an LDESinSolid which is only visible to you.

const { AccessSubject} = require('@treecg/ldes-orchestrator')
await ldes.createLDESinLDP(AccessSubject.Agent);

The orchestrator

Requirements

  • have a base IRI of an LDES in LDP where you have acl:Control rights when logged in with a session
const { Orchestrator,login, isLoggedin, getSession } = require('@treecg/ldes-orchestrator');

// log in and get session
login();
await isLoggedin(); 
const session = await getSession();

const base = ... ;


// the second parameter is the interval (s), thus each 5 minutes the orchestrator runs and when needed creates a new container
const config = LDESinSolid.getConfig(base);
const ldes = new LDESinSolid(config.LDES, config.ACL, session);
const orchestrator = new Orchestrator(session);
orchestrator.orchestrateLDES(base, 300);

UML sequence diagram creating new container for LDES

img