Skip to content

Repository files navigation

solid-logic

[Solid logo]

MIT license

Core business logic of SolidOS which can be used for any webapp as well.

Usage

📦 Install via npm

npm install solid-logic rdflib

Important: rdflib is a peer dependency - you must install it separately.

Import in your project (ESM/TypeScript)

import{solidLogicSingleton,store,authn}from'solid-logic';// Example usageconsole.log('Current user:',authn.currentUser());

🌐 Use directly in a browser

Both UMD and ESM bundles externalize rdflib to keep bundle sizes small and avoid version conflicts.

Available Files

FormatFileUsageGlobal Variable
UMDdist/solid-logic.jsDevelopmentwindow.SolidLogic
UMDdist/solid-logic.min.jsProductionwindow.SolidLogic
ESMdist/solid-logic.esm.jsDevelopmentImport only
ESMdist/solid-logic.esm.min.jsProductionImport only

UMD Bundle (Script Tags)

⚠️ Important: Load rdflib before solid-logic or you'll get $rdf is not defined errors.

<!-- 1. Load rdflib first (creates window.$rdf) --><scriptsrc="https://cdn.jsdelivr.net/npm/rdflib/dist/rdflib.min.js"></script><!-- 2. Load solid-logic (expects $rdf to exist) --><scriptsrc="https://unpkg.com/solid-logic/dist/solid-logic.min.js"></script><script>// Access via global variableconst{ solidLogicSingleton, store, authn }=window.SolidLogic;// Example usageconsole.log('Store:',store);console.log('Authentication:',authn.currentUser());</script>

ESM Bundle (Native Modules)

<scripttype="module">import*as$rdffrom'https://esm.sh/rdflib';import{solidLogicSingleton,store,authn}from'https://esm.sh/solid-logic@4.0.1';// Example usageconsole.log('Store:',store);console.log('Authentication:',authn.currentUser());</script>

ESM with Import Maps (Recommended)

<scripttype="importmap">{"imports": {"rdflib": "https://esm.sh/rdflib","solid-logic": "https://esm.sh/solid-logic@4.0.1"}}</script><scripttype="module">import*as$rdffrom'rdflib';import{solidLogicSingleton,store,authn}from'solid-logic';// Example usage - cleaner imports!console.log('Store:',store);console.log('Authentication:',authn.currentUser());</script>

Common Exports

import{solidLogicSingleton,// Complete singleton instancestore,// RDF storeauthn,// Authentication logicauthSession,// Authentication sessionACL_LINK,// ACL constantsgetSuggestedIssuers,// Identity provider suggestionscreateTypeIndexLogic,// Type index functionality// Error classesUnauthorizedError,NotFoundError,FetchError}from'solid-logic';

How to develop

Check the scripts in the package.json for build, watch, lint and test.

Used stack

  • TypeScript + Babel
  • Jest
  • ESLint
  • Webpack

How to release

Change version and push directly to main. This will trigger the npm release latest script in CI.

History

Solid-logic was a move to separate business logic from UI functionality so that people using different UI frameworks could use logic code.

It was created when the "chat with me" feature was built. We needed to share logic between chat-pane and profile-pane (which was part of solid-panes back then I think) due to that feature. The whole idea of it is to separate core solid logic from UI components, to make logic reusable, e.g. by other UI libraries or even non web apps like CLI tools etc.

About

Core business logic of SolidOS

Topics

Resources

Stars

12 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages