Abstract
Instances of MeshOS are typically initialized as a set, using a manifest.json file that describes statically the fully set names, passwords, entities, etc. The static init method is invoked to start this process (typically at server startup).
Optional
entity: stringOptional
taskQueue: stringOptional
schema: WorkflowSearchSchemaStatic
classesStatic
databasesStatic
entitiesStatic
loggerStatic
namespacesStatic
profilesStatic
schemasAggregate matching entities
Create the data record NOTE: subclasses should override this method (or create an alternate method) for invoking a workflow when creating the record.
Protected
defaultFind matching records
Get schema
Get Search options (initializes the search index, specific to the backend provider)
Retrieve the record data
Update the record data
Static
findStatic
findFind schemas
Static
initInitialize profiles
Static
registerRegister a class
Static
registerRegister a database
Static
registerRegister an entity
Static
registerRegister a namespace
Static
registerRegister a profile
Static
registerRegister a schema
Static
shutdownStatic
toJSONSerialize profiles to JSON
MeshOS is an abstract base class for schema-driven entity management within the Mesh network. It provides a foundation for defining custom entities. By subclassing MeshOS, you can create entities with specific schemas and behaviors, enabling structured data storage, retrieval, and transactional workflows.
Subclassing MeshOS
Standard CRUD methods are included and use your provided schema to fields to return in the response: create, retrieve, update, delete.
Search methods are included and use your provided schema to fields to return in the response: count, find, aggregate.
Implement other methods as needed for the entity's functionality; For example, subclass/override methods like
create
to also spawn a transactional workflowExample
Defining the Schema
The schema defines the data model for your entity and is used for indexing and searching within the mesh network. Each field in the schema specifies the data type, whether it's required, and other indexing options.
Here's an example of a schema (
schema.ts
):In your entity class (
Widget
), you use this schema in thegetSearchOptions
method to define how your entity's data is indexed and searched.