Sources are what Mosaic uses to pull content from disparate locations and merge into a single virtual filesystem that can be used by a Mosaic Site.

Depending on the mode used, sources can update periodically ensuring that new content is made available automatically.

Source Definitions are specified in the sources collection of a mosaic config file.

Each source uses a zod schema to validate the provided JSON to ensure that all required information for the source to pull content has been provided.

A source definition at a minimum needs to provide the module path of the source and the namespace that it will use. A namespace is not unique across sources though it is common that each source has a different namespace.

Lastly, the options field can be used as a bucket for configuration values needed to configure the source e.g. credentials.

Warning

Users are free to add any property as a source option but please read the gotchas first regarding the allowed values.

A Source Namespace is a scoping mechanism for Mosaic sources used to filter the content loaded by Mosaic. By default all sources specified in the mosaic config file are loaded.

The following command will ensure mosaic only loads sources with the local scope.

Source schedules define how often sources pull in content that exists remotely and if a failed source is retried. More information can be found here

Out of the box, Mosaic provides 3 source "types":

Sources must expose an observable interface so it is possible to compose sources together e.g. the Git Repo source uses the Local Folder source internally to watch the cloned folder for changes.

When running in active mode, Mosaic will watch for any changes to the source content and if a change is detected, will initiate a pull of that new content.

How often to check for updates and how updates are triggered are a matter for the source to handle. Mosaic simply responds when a source emits new content.

Sources are executed inside their own worker thread to ensure that the main thread is not overloaded. It is here that a local virtual filesystem for the source is created and where several of the Plugin Lifecycle events are triggered.

A service worker thread uses postMessage to communicate with the main thread and vice-versa.

This is important because it limits what values can be provided in the source definition to those that can be processed by the Structured Clone Algorithm.

Mosaic BETA

Coming soon