LogoRobo.js
Framework

PluginSetupContext<TState>

Interface: PluginSetupContext<TState>

Context passed to plugin setup() function.

Type Parameters

Type ParameterDefault type
TStateRecord<string, unknown>

Properties

PropertyModifierTypeDescription
modelsreadonlyModelInfo[]Information about all registered models.
statepublicTStatePlugin 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

ParameterType
namestring

Returns

FlashcoreModel<T>


hasModel()

hasModel(name): boolean

Check if a model with the given name is registered.

Parameters

ParameterType
namestring

Returns

boolean


markModel()

markModel(
   name, 
   key, 
   value): void

Mark a model with metadata (accessible via model.meta).

Parameters

ParameterType
namestring
keystring
valueunknown

Returns

void


registerIndex()

registerIndex(
   model, 
   field, 
   indexType): void

Register a custom index for a field.

Parameters

ParameterType
modelstring
fieldstring
indexTypestring

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

ParameterType
namestring
schemaSchemaFields

Returns

FlashcoreModel<T>

On this page