- App ⇐
Component Applications can be deployed to the legacy web using App, a powerful template for building modern web applications.
- Avatar
Deterministic avatar generator inspired by academic visual hash work (e.g. Perrig/Song "Hash Visualization", a.k.a. "drunken bishop").
The algorithm walks a diagonal "bishop" across a board using bits from SHA-256(input), accumulating visit counts to produce a stable identicon.
- Bridge
The Bridge type extends a Fabric application to the web.
- HTTPClient
Generic HTTP Client.
- Compiler
Builder for Fabric-based applications.
- FabricComponent
Generic component.
- Definition :
Object - FabricDistributedExecutionHTTP
- Hub ⇐
Oracle The Hub is a temporary class in the Fabric HTTP library which handles WebRTC and WebSocket connections, wrapping the core Fabric protocol for legacy web clients (including browsers).
- Maki :
Object Maki makes building beautiful apps a breeze.
- Remote :
Remote Interact with a remote Resource. This is currently the only HTTP-related code that should remain in @fabric/core — all else must be moved to @fabric/http before final release!
- Resource
Generic interface for collections of digital objects.
- Router :
Object Simple router.
- FabricHTTPServer ⇐
Service Fabric Service for exposing an Application to clients over HTTP.
- Site
Implements a full-capacity (Native + Edge nodes) for a Fabric Site.
- SPA ⇐
App Fully-managed HTML application.
- UI
User Interface for a Fabric Actor.
- Wallet :
Object Manage keys and track their balances.
StashDeprecated 2021-10-16.
- jsonRpc
POST JSON-RPC over HTTP; same methods as WebSocket
JSONCallwhen enabled.- static
Passed to
express.static(seestart()).- cors
When true, send
Access-Control-Allow-*for browser clients.- compression
When true, use
compressionmiddleware if the package is installed.- sitemap
Sitemap generation settings for
/sitemap.xml.
- merge
HTTP surface for distributed execution: manifest and epoch status for operators. Binds routes on a FabricHTTPServer via
_addRoute(same pattern as Hub services).
- resolvedPathUnderStaticRoot(relativeCandidate, staticRoot) ⇒
string|null Resolve
relativeCandidateunderstaticRootand reject../ absolute escape attempts.
Applications can be deployed to the legacy web using App, a powerful template for building modern web applications.
Kind: global class
Extends: Component
- App ⇐
Component- new App([settings])
- ._handleNavigation(ctx, next) ⇒
Promise - .render() ⇒
String - .start() ⇒
Promise
Create a Web application.
Returns: App - Instance of the application.
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
{} |
Application settings. |
| [settings.circuit] | Circuit |
Instance of an existing Circuit. | |
| [settings.resources] | Object |
Map of Resource classes. |
Trigger navigation.
Kind: instance method of App
Returns: Promise - Resolved on routing complete.
| Param | Type | Description |
|---|---|---|
| ctx | Context |
Navigating context. |
| next | function |
Function called if no route found. |
Generate the rendered HTML output of the application's user interface.
Kind: instance method of App
Returns: String - HTML string.
Launches any necessary processes and notifies the user on ready.
Kind: instance method of App
Returns: Promise - Resolves on completion.
Deterministic avatar generator inspired by academic visual hash work (e.g. Perrig/Song "Hash Visualization", a.k.a. "drunken bishop").
The algorithm walks a diagonal "bishop" across a board using bits from SHA-256(input), accumulating visit counts to produce a stable identicon.
Kind: global class
- Avatar
- new Avatar([input], [settings])
- .toASCII() ⇒
String - .render([settings]) ⇒
String
| Param | Type | Default | Description |
|---|---|---|---|
| [input] | string |
"''" |
Seed input used to derive deterministic avatar bytes. |
| [settings] | Object |
{} |
Optional rendering configuration (size, colors, grid, steps). |
Render a deterministic ASCII visual hash for terminal/text comparison. Lower visit counts use lighter glyphs; higher counts use denser glyphs.
Kind: instance method of Avatar
Render a consumable HTML snippet.
Kind: instance method of Avatar
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
||
| [settings.format] | 'img' | 'svg' |
'img' |
Output format. |
| [settings.className] | String |
'fabric-avatar' |
CSS class for wrapper output. |
| [settings.alt] | String |
'Fabric Avatar' |
alt label for image output. |
The Bridge type extends a Fabric application to the web.
Kind: global class
Create an instance of the bridge by providing a host.
Returns: Bridge - Instance of the bridge.
| Param | Type | Description |
|---|---|---|
| [settings] | Object |
Settings for the bridge. |
bridge.connect() ⇒ Bridge
Attempt to connect to the target host.
Kind: instance method of Bridge
Returns: Bridge - Instance of the bridge.
Request a Document from our Peers.
Kind: instance method of Bridge
| Param | Type | Description |
|---|---|---|
| request | Object |
Request to send. |
| request.path | String |
Document path. |
Generic HTTP Client.
Create an instance of an HTTP client.
| Param | Type | Description |
|---|---|---|
| [settings] | Object |
Configuration for the client. |
Builder for Fabric-based applications.
Kind: global class
- Compiler
- new Compiler([settings])
- .compile([data]) ⇒
String - ._compileToFile(target) ⇒
Boolean
Create an instance of the compiler.
| Param | Type | Description |
|---|---|---|
| [settings] | Object |
Map of settings. |
| [settings.document] | HTTPComponent |
Document to use. |
Build a String representing the HTML-encoded Document.
Kind: instance method of Compiler
Returns: String - Rendered HTML document containing the compiled JavaScript application.
| Param | Type | Description |
|---|---|---|
| [data] | Mixed |
Input data to use for local rendering. |
Compiles a Fabric component to an HTML document.
Kind: instance method of Compiler
Returns: Boolean - True if the build succeeded, false if it did not.
| Param | Type | Default | Description |
|---|---|---|---|
| target | String |
assets/index.html |
Path to output HTML. |
Generic component.
Kind: global class
- FabricComponent
- new FabricComponent([settings])
- ._loadHTML([content]) ⇒
String - .toHTML() ⇒
String
Create a component.
Returns: Component - Fully-configured component.
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
{} |
Settings for the component. |
Load an HTML string into the Component.
Kind: instance method of FabricComponent
Returns: String - HTML document.
| Param | Type | Description |
|---|---|---|
| [content] | String |
HTML string to load (empty by default). |
Generate an HTML representation of the component.
Kind: instance method of FabricComponent
Returns: String - HTML of the rendered component.
Kind: global class
Properties
| Name | Type | Description |
|---|---|---|
| name | String |
Human-friendly name for this type. |
| name | String |
Human-friendly plural name for this type. |
| routes | Object |
Path hint for retrieving an index. |
| routes.list | String |
Path hint for retrieving an index. |
| routes.view | String |
Path hint for retrieving a single entity. |
Kind: global class
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
||
| [settings.basePath] | string |
"'/services/distributed'" |
|
| [settings.getManifest] | function |
Returns Object or Promise.<Object> JSON manifest. |
|
| [settings.getEpochStatus] | function |
Returns Object or Promise.<Object> epoch summary. |
Register routes on an HTTP server instance.
Kind: instance method of FabricDistributedExecutionHTTP
| Param | Type | Description |
|---|---|---|
| httpServer | Object |
HTTP server instance exposing _addRoute(method, path, handler). |
The Hub is a temporary class in the Fabric HTTP library which handles WebRTC and WebSocket connections, wrapping the core Fabric protocol for legacy web clients (including browsers).
Kind: global class
Extends: Oracle
- Hub ⇐
Oracle
Create an instance of the Hub.
| Param | Type | Description |
|---|---|---|
| configuration | Object |
Settings for the Hub. |
Start the Hub and listen for incoming connections.
Kind: instance method of Hub
Maki makes building beautiful apps a breeze.
Kind: global class
- Maki :
Object- new Maki([settings])
- .render() ⇒
String
Build a new application.
Returns: Maki - Instance of Maki.
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
{} |
Configuration for the Maki app. |
Generate an HTML string representing the current state of the app.
Kind: instance method of Maki
Returns: String - HTML-encoded string representing the application.
Remote : Remote
Interact with a remote Resource. This is currently the only HTTP-related code that should remain in @fabric/core — all else must be moved to @fabric/http before final release!
Kind: global class
Properties
| Name | Type |
|---|---|
| settings | Object |
| secure | Boolean |
- Remote :
Remote- new Remote(target)
- .request(type, path, [params]) ⇒
FabricHTTPResult
An in-memory representation of a node in our network.
| Param | Type | Description |
|---|---|---|
| target | Object |
Target object. |
| target.host | String |
Named host, e.g. "localhost". |
| target.secure | String |
Require TLS session. |
Make an HTTP request to the configured authority.
Kind: instance method of Remote
| Param | Type | Description |
|---|---|---|
| type | String |
One of GET, PUT, POST, DELETE, or OPTIONS. |
| path | String |
The path to request from the authority. |
| [params] | Object |
Options. |
Generic interface for collections of digital objects.
| Param | Type | Description |
|---|---|---|
| definition | Object |
Initial parameters |
Simple router.
Kind: global class
- Router :
Object
Builds a new Router.
Returns: Router - Instance of the Router.
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
{} |
Configuration for the router. |
Add a named definition.
Kind: instance method of Router
Returns: Promise - Resolves once added.
| Param | Type | Description |
|---|---|---|
| path | String |
Flat path. |
| definition | Object |
Resource definition? |
Fabric Service for exposing an Application to clients over HTTP.
Kind: global class
Extends: Service
- FabricHTTPServer ⇐
Service- new FabricHTTPServer([settings])
- .webrtcPeerList ⇒
Array - .define(name, definition) ⇒
FabricHTTPServer - ._isJsonRpcTransportAuthorized(req) ⇒
boolean - ._handleWebSocket(socket, request) ⇒
WebSocket - ._handleIndexRequest(req, res)
- ._addRoute(method, path, handler)
- ._notifySubscribers(path, value)
- .formatResponse(req, res, data, options)
Create an instance of the HTTP server.
Returns: FabricHTTPServer - Fully-configured instance of the HTTP server.
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
Configuration values. | |
| [settings.name] | String |
"FabricHTTPServer" |
User-friendly name of this server. |
| [settings.port] | Number |
9999 |
Port to listen for HTTP connections on. |
Get a list of WebRTC peers registered with this server (see Hub RegisterWebRTCPeer).
Kind: instance property of FabricHTTPServer
Returns: Array - Array of WebRTC peer objects
fabricHTTPServer.define(name, definition) ⇒ FabricHTTPServer
Define a Type by name.
Kind: instance method of FabricHTTPServer
Returns: FabricHTTPServer - Instance of the configured server.
| Param | Type | Description |
|---|---|---|
| name | String |
Human-friendly name of the type. |
| definition | Definition |
Configuration object for the type. |
Same authorization inputs as HTTP POST JSON-RPC: verified bearer (req.authenticated),
raw Bearer on the upgrade/request, or websocket client-token channels.
Kind: instance method of FabricHTTPServer
| Param | Type | Description |
|---|---|---|
| req | Object |
Node.js IncomingMessage (HTTP upgrade or Express req). |
Connection manager for WebSockets. Called once the handshake is complete.
Kind: instance method of FabricHTTPServer
Returns: WebSocket - Returns the connected socket.
| Param | Type | Description |
|---|---|---|
| socket | WebSocket |
The associated WebSocket. |
| request | http.IncomingMessage |
Incoming HTTP request. |
Special handler for first-page requests.
Kind: instance method of FabricHTTPServer
| Param | Type | Description |
|---|---|---|
| req | HTTPRequest |
Incoming request. |
| res | HTTPResponse |
Outgoing response. |
Add a route manually.
Kind: instance method of FabricHTTPServer
| Param | Type | Description |
|---|---|---|
| method | String |
HTTP verb. |
| path | String |
HTTP route. |
| handler | function |
HTTP handler (req, res, next) |
Notify subscribers of a state change
Kind: instance method of FabricHTTPServer
| Param | Type | Description |
|---|---|---|
| path | String |
The path that changed |
| value | * |
The new value |
Standardized content negotiation for route handlers. Handles JSON/HTML negotiation with proper precedence.
Kind: instance method of FabricHTTPServer
| Param | Type | Description |
|---|---|---|
| req | Object |
Express request object |
| res | Object |
Express response object |
| data | * |
Data to send |
| options | Object |
Formatting options |
| options.title | String |
HTML page title |
| options.resourceName | String |
Resource name for display |
| options.resourceType | String |
Resource type (for HTML rendering) |
Implements a full-capacity (Native + Edge nodes) for a Fabric Site.
Creates an instance of the Site, which provides general statistics covering a target Fabric node.
Returns: Site - Instance of the Site. Call render(state) to derive a new DOM element.
| Param | Type | Description |
|---|---|---|
| [settings] | Object |
Configuration values for the Site. |
SPA ⇐ App
Fully-managed HTML application.
Kind: global class
Extends: App
- SPA ⇐
App- new SPA([settings], [components])
- .render() ⇒
String - ._handleNavigation(ctx, next) ⇒
Promise - .start() ⇒
Promise
Create a single-page app.
Returns: App - Instance of the application.
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
{} |
Settings for the application. |
| [settings.name] | String |
"@fabric/maki" |
Name of the app. |
| [settings.offline] | Boolean |
true |
Hint offline mode to browsers. |
| [components] | Object |
Map of Web Components for the application to utilize. |
Return a string of HTML for the application.
Kind: instance method of SPA
Overrides: render
Returns: String - Fully-rendered HTML document.
Trigger navigation.
Kind: instance method of SPA
Overrides: _handleNavigation
Returns: Promise - Resolved on routing complete.
| Param | Type | Description |
|---|---|---|
| ctx | Context |
Navigating context. |
| next | function |
Function called if no route found. |
Launches any necessary processes and notifies the user on ready.
Kind: instance method of SPA
Overrides: start
Returns: Promise - Resolves on completion.
User Interface for a Fabric Actor.
Manage keys and track their balances.
Create an instance of a Wallet.
Returns: Wallet - Instance of the wallet.
| Param | Type | Default | Description |
|---|---|---|---|
| [settings] | Object |
{} |
Configure the wallet. |
Deprecated
Deprecated 2021-10-16.
POST JSON-RPC over HTTP; same methods as WebSocket JSONCall when enabled.
When true, HTTP JSON-RPC requires a verified bearer token (request.authenticated).
Kind: static property of jsonRpc
Passed to express.static (see start()).
When true, send Access-Control-Allow-* for browser clients.
When true, use compression middleware if the package is installed.
Sitemap generation settings for /sitemap.xml.
HTTP surface for distributed execution: manifest and epoch status for operators.
Binds routes on a FabricHTTPServer via _addRoute (same pattern as Hub services).
Resolve relativeCandidate under staticRoot and reject .. / absolute escape attempts.
Kind: global function
Returns: string | null - Absolute path, or null if unsafe / invalid.
| Param | Type |
|---|---|
| relativeCandidate | string |
| staticRoot | string |