Framework
PluginSetupContext<TState>
Interface: PluginSetupContext<TState>
Context passed to plugin setup() function.
Type Parameters
| Type Parameter | Default type |
|---|---|
TState | Record<string, unknown> |
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
models | readonly | ModelInfo[] | Information about all registered models. |
state | public | TState | Plugin state - persists across middleware calls. Initialized as empty object, can be mutated by plugin. |
Methods
getModel()
getModel<T>(name): FlashcoreModel<T>Get a model by name.
Type Parameters
| Type Parameter |
|---|
T extends { id: string; } |
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
hasModel()
hasModel(name): booleanCheck if a model with the given name is registered.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
boolean
markModel()
markModel(
name,
key,
value): voidMark a model with metadata (accessible via model.meta).
Parameters
| Parameter | Type |
|---|---|
name | string |
key | string |
value | unknown |
Returns
void
registerIndex()
registerIndex(
model,
field,
indexType): voidRegister a custom index for a field.
Parameters
| Parameter | Type |
|---|---|
model | string |
field | string |
indexType | string |
Returns
void
registerModel()
registerModel<T>(name, schema): FlashcoreModel<T>Register a new model (for plugins that create helper models, like audit).
Type Parameters
| Type Parameter |
|---|
T extends { id: string; } |
Parameters
| Parameter | Type |
|---|---|
name | string |
schema | SchemaFields |
