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 Linked Data Platform (LDP).
To setup all the libraries, please run the setup script.
git clone [email protected]:SolidLabResearch/Bashlib.git
cd Bashlib
bash setup.sh
A tutorial for the CLI interface for Bashlib can be found here.
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.
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.
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.
This module handles the building of an authenticated fetch function for Node.JS. It provides multiple options to authenticate the user.
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.
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.
compatibility: CSSv2.x.x - deprecated This authentication option makes use of user 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 with a more up-to-date version of the CSS is advised.
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.
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.
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.
This is a listing of all the functions made available on the CLI and Node.JS.
The fetch function can be used to fetch authenticated resources from a Solid environment.
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.
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.
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.
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.
The remove function provides functionality to remove files on a Solid environement. Recursive removing of containers is added with a flag to prevent accidents.
The mkdir function provides functionality to create empty containers in a Solid environment.
The Touch function provides functionality to create empty resources in a Solid environment.
The find function allows you to recursively find resources in a container in a Solid environment matching a given file name regex.
The query function allows you to recursively query resources in a container in a Solid environment using a given SPARQL query.
The perms function provides functionality for the listing and editing of resource permissions in a Solid environment.
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.
This repo uses release-it to manage SemVer version numbers, create GitHub releases and publish to npm.
Run npm run release
and follow the intructions on the CLI. Don't forget to create a personal access token and expose it through the GITHUB_TOKEN
environment variable, or the github release won't work. For more information, visit the release-it
docs.