Class: QueriesPlugin
Defined in: src/wirestate-core/plugin/queries/queries-plugin.ts:28
Enables query messaging on a container.
Remarks
Register it (new Container({ plugins: [new QueriesPlugin()] })) to bind the QueryBus and wire @OnQuery handlers at provision. Importing this class is what pulls the query bus into the bundle.
A child container can register its own QueriesPlugin for a local bus, or omit it to use the nearest ancestor bus.
Example
import { Container, QueriesPlugin, Injectable } from "@wirestate/core";
@Injectable()
class CartService {}
const container = new Container({ bindings: [CartService], plugins: [new QueriesPlugin()] });Extends
MessagingPlugin
Accessors
handles
Get Signature
get handles(): readonly symbol[];Defined in: src/wirestate-core/plugin/messaging-plugin.ts:23
Messaging-handler kinds this plugin owns (advanced).
Remarks
Used by the built-in messaging plugins. Provision matches declared handler metadata against the union of registered plugins' kinds and throws on a kind no plugin handles. A nearer plugin owning a kind shadows an ancestor's of the same kind. Observer plugins usually omit this field.
Returns
readonly symbol[]
Inherited from
MessagingPlugin.handlesConstructors
Constructor
new QueriesPlugin(): QueriesPlugin;Defined in: src/wirestate-core/plugin/queries/queries-plugin.ts:29
Returns
QueriesPlugin
Overrides
MessagingPlugin.constructorMethods
install()
install(container: Container): void;Defined in: src/wirestate-core/plugin/messaging-plugin.ts:27
Contributes bindings (or other one-time setup) when the plugin is registered.
Parameters
| Parameter | Type | Description |
|---|---|---|
container | Container | Container the plugin is registered on. |
Returns
void
Remarks
Runs once, on the container the plugin is registered on (not on inheriting children), before any binding activates.
Inherited from
MessagingPlugin.installonProvision()
onProvision(
instance: object,
container: Container,
addDisposer: (dispose: () => void) => void): void;Defined in: src/wirestate-core/plugin/messaging-plugin.ts:45
Wires a provisioned instance, before any user @OnProvision.
Parameters
| Parameter | Type | Description |
|---|---|---|
instance | object | The provisioned instance. |
container | Container | Container being provisioned. |
addDisposer | (dispose: () => void) => void | Registers a teardown callback for this provision cycle. |
Returns
void
Remarks
Register teardown with addDisposer. Disposers run (reverse order, failsafe) at deprovision. A throw here unwinds the whole provision cycle.
Inherited from
MessagingPlugin.onProvisionparticipates()
participates(token: ServiceToken): boolean;Defined in: src/wirestate-core/plugin/messaging-plugin.ts:35
Declares whether a binding token is a participant this plugin wires.
Parameters
| Parameter | Type | Description |
|---|---|---|
token | ServiceToken | Binding token to inspect. |
Returns
boolean
Whether the plugin participates in this token.
Remarks
Token/class-level so it can drive force-activation: a token this returns true for is resolved (activated) at provision even if nothing injected it, and the instance is then delivered to WirestatePlugin.onProvision. Omit for a pure observer that force-activates nothing.
Inherited from
MessagingPlugin.participates