Resolver
TypeScript Support
A view model resolver object has an associated TypeScript type:
- Type Name -
ViewModelResolver
- Package -
@resolve-js/core
A view model resolver function has the following structure:
async(api, query, context) => {
...
return {
data, // Built view model data.
meta: { // Metadata about the resolver execution results.
cursor, // The data cursor used to traverse the events included into the query result set.
eventTypes, // The list of event types available to the client.
aggregateIds, // List of aggregate IDs available to the client.
}
}
}
APIā
The API
argument is an object that contains the following API:
Function Name | Description |
---|---|
buildViewModel | Runs a projection for the view model |
Queryā
The query
argument is an object with the following fields:
Field Name | Description |
---|---|
aggregateIds | An array of aggregate IDs. |
aggregateArgs | An object that contains arguments attached to the query. |
Contextā
The context
argument is an object of the following structure:
{
jwt, // Optional. The JSON web token attached to the request.
viewModel: {
name, // The name of the view model.
eventTypes // The event types available to the view model.
}
}