ProtectedconstructorStaticregistryThe global RulesEngine instance.
StaticdefaultGet the common workspace instance. This is a singleton workspace that can be used as a shared space for common rules, constants, types, and functions that can be sufficient for small applications.
The common Workspace instance.
Check if a workspace with the given name exists in this engine.
The name of the workspace.
True if the workspace exists, false otherwise.
Get the names of all workspaces in this engine.
An array of workspace names.
StaticworkspaceGet the names of all workspaces in the global registry.
An array of workspace names.
StatichasCheck if a workspace with the given name exists in the global registry.
The name of the workspace.
True if the workspace exists, false otherwise.
Get a workspace by name from this engine.
The name of the workspace to retrieve.
The Workspace instance associated with the given name, or undefined if not found.
StaticgetGet a workspace by name from the global registry.
The name of the workspace to retrieve.
The Workspace instance associated with the given name, or undefined if not found.
Add a workspace to this engine with the given name. If a workspace with the same name already exists, an error will be thrown.
N.B. To reuse a name, get the workspace instance using getWorkspace() and call clear() to reset it.
The name of the workspace.
The Workspace instance to add.
StaticannotationStaticaddAdd a workspace to the global registry with the given name. If a workspace with the same name already exists, an error will be thrown.
N.B. To reuse a name, get the workspace instance using getWorkspace() and call clear() to reset it.
The name of the workspace.
The Workspace instance to add.
Create a clone of the original Workspace instance, including all rules, constants, types, and functions. This is useful for creating isolated copies of the workspace for testing, experimentation, or parallel processing without affecting the original workspace. You can safely mutate a cloned workspace without affecting the source, since no references are shared.
N.B. To clone a Workspace without adding it to a registry, you can simply call the clone() method on the Workspace instance itself, which will return a deep clone of the workspace.
the Workspace instance or name of the workspace to clone.
name for the cloned workspace. The cloned workspace will be added to the engine's workspace map with this name.
a new Workspace instance that is a deep clone of the original workspace.
StaticcloneClone a workspace by name from the global registry and add it to the global registry with a new name.
the workspace instance or name of the workspace to clone.
the name for the cloned workspace in the global registry.
a new Workspace instance that is a deep clone of the original workspace, added to the global registry with the new name.
Get the global registry instance of the RulesEngine. This is a singleton instance that can be used throughout the application to manage workspaces and rules.