PluginManager
Class: PluginManager
Plugin Manager - handles plugin lifecycle, middleware, and extensions.
Constructors
new PluginManager()
new PluginManager(): PluginManagerReturns
Methods
applyPendingMarks()
applyPendingMarks(model): voidApply pending model marks to a newly registered model.
Parameters
| Parameter | Type |
|---|---|
model | FlashcoreModel<{ id: string; }> |
Returns
void
clear()
clear(): voidClear all plugins (for testing).
Returns
void
getAllClientExtensions()
getAllClientExtensions(): Record<string, Record<string, unknown>>Get all client extensions (for Flashcore.$).
Returns
Record<string, Record<string, unknown>>
getClientExtensions()
getClientExtensions(name): Record<string, unknown>Get client extensions for a plugin.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
Record<string, unknown>
getCustomIndexes()
getCustomIndexes(model): {
field: string;
indexType: string;
provider: IndexProvider<unknown>;
}[]Get custom indexes registered for a model.
Parameters
| Parameter | Type |
|---|---|
model | string |
Returns
{
field: string;
indexType: string;
provider: IndexProvider<unknown>;
}[]
getIndexProvider()
getIndexProvider(indexType): IndexProvider<unknown>Get an index provider by type.
Parameters
| Parameter | Type |
|---|---|
indexType | string |
Returns
IndexProvider<unknown>
getMiddlewareChain()
getMiddlewareChain<Op>(operation): {
fn: MiddlewareFn<Op>;
plugin: PluginContext;
}[]Get middleware chain for an operation.
Type Parameters
| Type Parameter |
|---|
Op extends OperationType |
Parameters
| Parameter | Type |
|---|---|
operation | Op |
Returns
{
fn: MiddlewareFn<Op>;
plugin: PluginContext;
}[]
getModelExtensions()
getModelExtensions(): Record<string, unknown>Get model extensions from all plugins.
Returns
Record<string, unknown>
getPluginContext()
getPluginContext(name): PluginContextGet plugin context by name.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
getPluginNames()
getPluginNames(): string[]Get all registered plugin names.
Returns
string[]
getQueryOperator()
getQueryOperator(operator): {
context: PluginContext;
fn: QueryOperatorFn;
}Get a query operator.
Parameters
| Parameter | Type |
|---|---|
operator | string |
Returns
{
context: PluginContext;
fn: QueryOperatorFn;
}| Name | Type |
|---|---|
context | PluginContext |
fn | QueryOperatorFn |
hasMiddleware()
hasMiddleware(operation): booleanCheck if an operation has middleware.
Parameters
| Parameter | Type |
|---|---|
operation | OperationType |
Returns
boolean
init()
init(options): voidInitialize the plugin manager with model access functions.
Parameters
| Parameter | Type |
|---|---|
options | { getModel: <T>(name) => FlashcoreModel<T>; models: Map<string, FlashcoreModel<{ id: string; }>>; registerModel: <T>(name, schema) => FlashcoreModel<T>; } |
options.getModel | <T>(name) => FlashcoreModel<T> |
options.models | Map<string, FlashcoreModel<{ id: string; }>> |
options.registerModel | <T>(name, schema) => FlashcoreModel<T> |
Returns
void
register()
register(plugin): voidRegister a plugin.
Parameters
| Parameter | Type |
|---|---|
plugin | FlashcorePluginDefinition<Record<string, unknown>, Record<string, unknown>, Record<string, unknown>> |
Returns
void
setup()
setup(): Promise<void>Run setup() for all registered plugins.
Returns
Promise<void>
setupPlugin()
setupPlugin(plugin): Promise<void>Run setup() for a single plugin. Used for runtime plugin registration via Flashcore.extend().
Parameters
| Parameter | Type |
|---|---|
plugin | FlashcorePluginDefinition<Record<string, unknown>, Record<string, unknown>, Record<string, unknown>> |
Returns
Promise<void>
shutdown()
shutdown(): Promise<void>Run shutdown() for all registered plugins.
Returns
Promise<void>
