A Node.JS and CLI interface for Solid

Overview

Bashlib

This repository contains a suite of functionality to facilitate use and development for Solid, mainly focused on supporting the Community Solid Server. The Bashlib-css library provides functionality for pod-creation and authentication options that are mostly restricted in compatilibty with the Community Solid Server. The Bashlib-solid library provides functionality to interact with Solid environments from Node.JS and the CLI, providing shell-like functionality to facilitate the use of and development for Solid for people without knowledge of Solid or LDP.

Setup

To setup all the libraries, please run the setup script.

git clone [email protected]:MellonScholarlyCommunication/css-suite.git
cd css-suite
bash setup.sh

Bashlib-css

Bashlib-css provides a set of modules created for development and testing using the Community Solid Server. It enables quick setting up of new Solid accounts and pods and authenticating users in Node.JS or the CLI.

Creating new data pods on a CSS instance

Compatibility: CSSv2.0.0 - current The create-pod module handles the creation of new data pods on a Community Solid Server instance. It automates the process of creating a Solid-account and accompanying data pod for new users, and can be used from Node.JS or the CLI.

Generating Client Credentials tokens for authentication

Compatibility: CSSv4.0.0 - current The create-token module handles the creation of Client Credentials tokens, a CSS-specific authentication mechanism that does not require browser interaction. The resulting tokens are stored on the file system, and can be used to automatically authenticate users in Node.JS and on the CLI.

Building an authenticated fetch using Node.JS or CLI

This module handles the building of an authenticated fetch function for Node.JS. It provides multiple options to authenticate the user.

Interactive

compatibility: all versions of all pods The interactive login option authenticates the user via an interactive prompt in the browser. This follows the default Inrupt Node.JS authentication flow. The active session information is stored, resulting in subsequent runs of the application re-using previous sessions where possible.

From Client Credentials token

compatibility: CSSv4.0.0 - current The Client Credentials Token generated by the create-token module is used to automatically authenticate the user in Node.JS without any browser interaction. The active session information is stored, resulting in subsequent runs of the application re-using previous sessions where possible.

From Client Credentials

compatibility: CSSv2.x.x - deprecated This authentication option makes use of client credentials being passed to authenticate the user. For this, it hijacks the browser flow for this specific CSS version. Using a Client Credentials token authentication flow more up-to-date version of the CSS is advised.


Bashlib-solid

Bashlib-solid provides a set of functions to interact with Solid environments from Node.JS and the CLI, providing shell-like functionality to facilitate the use of and development for Solid for people without knowledge of Solid or LDP. All modules provide their functionality both on the CLI interface, as well as through Node.JS.

CLI-Interface

The CLI-interface exposes all functions as commands on the CLI. It makes use of the Authentication module of Bashlib-css to authenticate the user.

Node.JS Interface

All functions are exposed in Node.JS as exports of the Bashlib-solid library. Authentication can be done using the Authentication module of Bashlib-css, or you can provide a custom authenticated fetch function.

Functions

This is a listing of all the functions made available on the CLI and Node.JS.

Fetch

The fetch function can be used to fetch authenticated resources from a Solid environment.

List

The list function can be used to list resources in a container in a Solid environment. It provides additional CLI options include .acl files and more if needed.

Tree

The tree function can be used to write a tree-structure of all resources in a container in a Solid environment to the command line. In Node.JS, this function writes the same output to the console, and returns nothing. When listing files in Node.JS, please use the find function.

Copy

The copy function provides functionality to copy files to and from both the local filesystem and a Solid environement. Recursive copying of containers is set as a default.

Move

The move function provides functionality to move files to and from both the local filesystem and a Solid environement. Recursive moving of containers is set as a default.

Remove

The remove function provides functionality to remove files on a Solid environement. Recursive removing of containers is added with a flag to prevent accidents.

Mkdir

The mkdir function provides functionality to create empty containers in a Solid environment.

Touch

The Touch function provides functionality to create empty resources in a Solid environment.

Find

The find function allows you to recursively find resources in a container in a Solid environment matching a given file name regex.

Query

The query function allows you to recursively query resources in a container in a Solid environment using a given SPARQL query.

Perms

The perms function provides functionality for the listing and editing of resource permissions in a Solid environment.

Edit

The edit function is only available on the CLI interface! It can be used to fetch a remote resource, edit it locally in your editor, and put the result back on the resource location.

Comments
  • `list` not showing all resources in a container

    `list` not showing all resources in a container

    I have created this minimal repro which:

    1. Inserts a contacts resource into the root of a Pod storage
    2. Calls list on that root

    As seen in the repro list does not show contacts when I expect that it would.

    opened by jeswr 2
  • Fixed failing npm build on Windows machines

    Fixed failing npm build on Windows machines

    OS: Windows 10 CLI: Git Bash Node version: 16.15.1, most recent LTS at the time of writing

    Building bashlib would give errors when deleting, and then not run typescript. The error was code ELIFECYCLE, errno 1.

    After trying to do the regular solution (clearing node_modules & cache, reinstalling node & npm...), I've found that modifying the npm build command to not throw errors on rm (rm -rf instead of rm -r), and using the more commonly used && instead of ; were a fix for the issue.

    Normally ";" should indeed run the next command, even on error, so this might be a Windows exclusive issue? But more testing would be required for that.

    opened by Denperidge 2
  • Fix undefined fetch

    Fix undefined fetch

    • the docs were calling aync functions without await
    • fetch on https://github.com/SolidLabResearch/Bashlib/blob/master/bashlib/css/src/functions/SessionCreationCSSv4.ts#L111 was undefined. I assume nodefetch was meant here
    opened by mielvds 1
  • Interactive shell

    Interactive shell

    This has become kind of a mess of a branch.

    Original goal was to include an interactive shell, which turned out to be a real hassle to get working and be more of a pain than a gain.

    In the end, the branch contains a lot of bugfixes, a bit of restructuring of the code, as well as a rework of the authentication system (although I am still not 100% happy at this time).

    Will need some more testing before I merge.

    I want to include some real tests, but can't find the time right now sadly

    opened by Dexagod 1
  • Replace node-fetch by cross-fetch

    Replace node-fetch by cross-fetch

    opened by mielvds 0
  • Prevent setting invalid contenttype 'false' for PUT request

    Prevent setting invalid contenttype 'false' for PUT request

    Result of mime.lookup(path) can set the Content-Type to false resulting in a 400. This fix sets text/turtle as the default contenttype if none can be guessed.

    opened by mielvds 0
  • solid edit command should provide a warning when trying to update a file that has not been changed.

    solid edit command should provide a warning when trying to update a file that has not been changed.

    Maybe add a question when you notice that the edit function didn't update the file (e.g. by calculating a checksum before and after the start/finish of the editor).

    Use case:

    • solid.js edit root:myfile.txt
    • Vi opens, I don't see anything that needs to be changed
    • :q
    • I get warning on the command line Update without changes? [y/N]
    • default N : no updates.
    • with a y the resource will be updated
    opened by phochste 0
  • Prefix doesn't work for copy commands

    Prefix doesn't work for copy commands

    E.g. I have a file README.txt I want to put in the /demo container of my pod. I would expect to use the command:

    node bin/solid.js copy README.txt root:/demo/README.txt
    

    But the result is empty

    opened by phochste 0
  • Override wanted for all prompts

    Override wanted for all prompts

    Found more prompts to override in addition to #38. This time on node bin/solid.js ls <container> on a container with public read access, while no WebID active for authentication.

    Do you want to authenticate the current request? [y, N]
    

    Request for a solution to provide prompt overrides for all possible prompts.

    opened by mvanbrab 1
  • solid.js auth create-token prompt

    solid.js auth create-token prompt "Do you want to create an authentication token for ...": the "..." refers to the wrong WebID

    Example (because bob was active, the prompt says bob while we request a token for ann):

    $ sld auth show
    http://localhost:3000/bob/profile/card#me - auth token 
    $ sld auth list
    http://localhost:3000/bob/profile/card#me - auth token 
    $ sld auth create-token -v -b "http://localhost:3000/" -n anns-auth-token -e [email protected] -p annIsTheBest123
    Do you want to create an authentication token for http://localhost:3000/bob/profile/card#me? [Y/n] 
    Successfully created new token anns-auth-token
    $ sld auth list
    http://localhost:3000/bob/profile/card#me - auth token 
    http://localhost:3000/ann/profile/card#me - auth token 
    

    (Note: sld is an alias for node bin/solid.js)

    opened by mvanbrab 1
  • Add supported node versions

    Add supported node versions

    There might be incompatibilities between node versions and certain packages, so it might be good to add a supported engine constaint in the package.json.

    opened by mielvds 0
Releases(0.2.2)
  • 0.2.2(Jan 3, 2023)

    • Fix: Fixed issue where listings are not shown if no additional metadata is present for them in the container rdf data (797f099)
    • Fix: Fixed bug where copying files without extension from a pod to the local file system gave error (f350ba4)
    • Set solid.js as executable (b04514d)
    • Merge pull request #20 from mvanbrab/doc-details (c39af13)
    • Add some info on release procedure to README (ab8b273)
    • (c329c9c)

    • perms list argument correction (879f5a6)
    • "all files in a given container" (or one file) (a35d7ab)
    • typo desintation (dd81451)
    • alias bashlib-auth consistent with text below (029bddf)
    • typo de the (b6f1d0d)
    • Typo 'promt' (f114f74)
    • Bob's profile URL is lower case (ad52b8a)
    • Local ref to tutorial (e547e8e)
    • LDP (43734cc)
    Source code(tar.gz)
    Source code(zip)
  • 0.2.1(Nov 30, 2022)

Owner
SolidLab
SolidLab
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Add cmd+k interface to your solid site

solid-ninja-keys Add cmd+k interface to your solid site. Built on top of ninja-keys. Quick start Install it: yarn add solid-ninja-keys Use it: import

Robert Soriano 20 Dec 19, 2022
Node-cli-starter - Basic starter kit for building Node CLI applications with TypeScript.

node-cli-starter Minimal starter kit for building Node CLI applications with TypeScript. Getting Started To get started clone repo locally and run npm

Cory Rylan 7 May 17, 2022
CloudCrafter CLI is a command-line interface tool that provides templates for common cloud resources to help you get started quickly.

CloudCrafter CLI CloudCrafter CLI is a command-line interface tool that provides templates for common cloud resources to help you get started quickly.

Missio 7 May 5, 2023
Repositório do curso de TDD do Manguinho (Node + TS + SOLID + TDD + Clean Architecture)

Curso Rodrigo Manguinho - NodeJs, Typescript, TDD, DDD, Clean Architecture e SOLID Curso tem como objetivo aprender de verdade a criar uma API complet

Glaucia Lemos 4 Dec 15, 2022
A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and configure Typescript on it.

CTSP- Create TS Project A CLI tool to create a NodeJS project with TypeScript CTSP is a CLI tool to make easier to start a new NodeJS project and conf

Jean Rodríguez 7 Sep 13, 2022
Generate meshes from signed distance functions and constructive solid geometry operations.

sdf-csg Generate meshes from signed distance functions and constructive solid geometry operations. This library is heavily based upon Inigo Quilez's 3

Rye Terrell 151 Oct 24, 2022
Solid component and library for LiveKit (unofficial)

This package provides Solid components that makes it easier to use LiveKit in a Solid app. Inspired completely by https://github.com/livekit/livekit-r

Prince Neil Cedrick Castro 6 Mar 8, 2022
A complete guide for learning Object Oriented Programming Pillars, SOLID Principles and Design Patterns with TypeScript!

Object Oriented Programming Expert With TypeScript This repository is a complete guide and tutorial for the principles and techniques of object-orient

Ahmad Jafari 44 Dec 29, 2022
Solid, AssemblyScriptified and compiled to WebAssembly

solid-as Solid as _____! Solid, AssemblyScriptified and compiled to WebAssembly (very work in progress). Installation TODO Test npm i && npm test TODO

Joe Pea 4 Jul 19, 2022
Experimental tool inspired by Capsize, implemented in Solid JS. Generates x-height and cap-height CSS

Usage Those templates dependencies are maintained via pnpm via pnpm up -Lri. This is the reason you see a pnpm-lock.yaml. That being said, any package

Zaydek MG 2 Jul 5, 2022
Custom navigations for Solid written in Typescript. Implement custom page transition logic and ✨ animations ✨

solid-custom-navigation Get, Set, Go! Custom navigations for Solid, written in Typescript. Implement custom page transition logic and ✨ animations ✨ .

Dirag Biswas 8 Nov 27, 2022
Playground for studying design patterns, solid principles, GoF, testing and more with TypeScript

TypeScript design patterns study Playground for studying design patterns, solid principles, GoF, testing and more with TypeScript Index TypeScript des

Lucas Souza 9 Dec 9, 2022
A contact app built with Solid.js, Vite, Hope UI and Typescript.

Solid Contacts Solid Contacts is a contact app to learn more about concepts like Solid.js (router / store / resources / reactivity), Vite and Hope UI.

Berkay Cimsir 2 Sep 21, 2022
Simple and minimal split pane component for Solid!

solid-split-pane Split pane component for Solid! Uses Split.Js under the hood. Takes all props that split.js takes, plus a gutterClass. (Q) Why not so

blusk 5 Oct 28, 2022
Solid.js library adding a services layer for global shared state.

Solid Services Services are "global" objects useful for features that require shared state or persistent connections. Example uses of services might i

Maciej Kwaśniak 55 Dec 30, 2022
solid material ui port (ported from blazor port)

solid-material-ui solid material ui port (porting from blazor port) In preparation for solid hack Turbo Mono-repository is used for component package

skclusive 18 Apr 30, 2022