Solid-compatible data mashup library and Databrowser
The mashlib library (
mashlib.js) is a solid-compatible code library of application-level functionality for the world of Solid. It compiles all of the following repositories into what we know as
- solid-logic — core business logic of SolidOS
- pane-registry - an index to hold all loaded solid panes, whether statically or dynamically loaded
- solid-ui — User Interface widgets and utilities for Solid. Building blocks for solid-based apps
- solid-panes — a set of core solid-compatible panes based on solid-ui.
A colorful dependency tree can be seen here.
Content of README
- Solid-compatible data mashup library and Databrowser
As part of the SolidOS stack, mashlib can be developed locally by setting up the SolidOS code. Read more about that on the SolidOS Readme.
The goals of mashlib overlap with the SolidOS Goals.
One major use of mashlib is as a "databrowser" for a personal data store.
Mashlib is used in SolidOS and contributes to:
- SolidOS Databrowser Frontend - a frontend for Solid Servers like <solidcommunity.net>
- SolidOS Data-Kitchen - a stand-alone desktop app: https://github.com/solidos/data-kitchen
mashlib is also used stand-alone as the SolidOS Databrowser Webapp and can be tried out at https://solidos.github.io/mashlib/dist/browse.html.
mashlib is also used as a library by adding
mashlib.js (or minified version) directly to your applications. For example:
Previous versions of this documentation
Check out SolidOS Pod for an earlier version of this documentation.
SolidOS Databrowser Webapp
static/browse.html page is compiled one to one into the
dist (output) folder of mashlib and makes mashlib available stand-alone as the SolidOS Databrowser Webapp.
You can see and try out a SolidOS Databrowser Webapp deployment at https://solidos.github.io/mashlib/dist/browse.html.
browse.htmlserves as a perfect example for Solid WebID authentication and for making use of mashlib functions and variables.
To run/test it locally we created a script
npm run startStaticOS.
SolidOS Databrowser Frontend
src/databrowser.htmlpage is compiled into the SolidOS Databrowser Frontend which is displayed for each WebID on solidcommunity.net. This is the case because the solidcommunity.net Solid Server is configured with SolidOS as its front-end.
More information about the SolidOS Front-end and how to use it visit the User Guide.
SolidOS Data-Kitchen uses
mashlib.jsas a direct import in its source code. Visit the code at SolidOS Data-Kitchen GitHub.
Mashlib global variables and functions
If one wants to use mashlib as a direct import (as a package dependency or script import), one needs to know which global variables and functions are available.
The availability of these global variables depends on how the sub-modules are imported and exported and on where the variables are instantiated. For a basic theoretical read, please see this resource.
global mean in mashlib? We mean the
global object which depends on different environments. In mashlib, for now, we use the
window context which means these variables will not work if directly used in non-window contexts such as
Node.js environments. (This does not mean you cannot use mashlib in
Node.js environments; just import it through
npm). At some point, we will switch this to the
These are the most important window context/global variables and the sub-repos from which they are exported:
solid-logic exports among others:
- pane-registry is exported entirely through the pane-registry variable
solid-ui exports among others: authn, store, rdf, dom under the
solid-panes exports getOutliner and the entire solid-ui through the
UIvariable, and solid-panes itself can be used through the
For backward compatibility reasons, there are now different ways to make use of the same variables from mashlib. For example:
- to make use of the UI (solid-ui) one can use
- authentication session, part of solid-logic, can be called as
- the store (from solid-logic) can be used as
- rdflib is entirely acessible as
- the currentUser function is called as
You can see example usage in the SolidOS Databrowser Webapp code.
Code changes due to moving authn from solid-ui to solid-logic
One function has been renamed and does not have a backwards-compatible fallback. To make use of the login pop-up, one needs to call the
UI.login.loginStatusBox function. The old
UI.authn.loginStatusBox function will no longer work from v1.8.0 onwards.
Some packages have been moved and with them some functions too. Here we report on these changes:
Solid-ui & Solid-logic related:
- There is no more
authnas you might have known it in solid-ui pre mashlib version 1.7.18 (solid-ui 2.4.16).
- Some functions in solid-ui which initially were found under
solid-ui/authnare now under
- Three functions were renamed:
- logInLoadPreferences -> ensureLoadedPreferences
- logInLoadProfile -> ensureLoadedProfile
- logIn -> ensureLoggedIn
Functions that moved:
offlineTestIDare now part of
solid-logic/authn/SolidAuthnLogic.ts-> this is because
authnitself moved to solid-logic.
fetchACLRelare not part of
solid-logic/src/acl/aclLogic.ts/and are exported in index.ts.
registerInTypeIndexand are exported in index.ts.
The databrowser hack: upgrading your browser
This refers to a specific way in which the mashlib is deployed for users who at first only have a conventional web browser - a hypertext browser not a data browser. It is a hack -- in the original computing sense of a crafty, though not beautiful, little thing which gets the job done.
How does the data browser work?
- The user goes with a normal web browser to access some data object (like a to-do list).
- The server sees the browser doesn't understand the data natively.
- The server sends back a little placeholder HTML file,
databrowser.html, instead of the data.
databrowser.htmlfile loads the
mashlib.jsthen re-requests the original data, but accepting data formats.
- The server supplies the actual data of the to-do list or whatever it was.
mashlib.jscode provides an editable visualization on the data.
The mashlib part of SolidOS Databrowser Frontend is read-write; that is, the user is allowed to edit data and create new things. It is live, in that often the databrowser subscribed (using a websocket) for any changes which other users make, so users' screens are synchronized.
A major limitation of this data browser hack is that current web browsers are made to distrust any code loaded from one domain that uses data from another domain. This makes it hard, strangely complicated, and sometimes impossible to do some things.