API - createEvalSource
A client that will be used on the server side to evaluate functions against the database.
import createEvalSource from "@aven-cloud/cloud/createEvalSource";
const source = createEvalSource({
source: storageSource,
domain: 'todo.aven.io',
evalDocs: {
TaskReducer: createReducerLambda('TaskReducer', TaskReducer, []),
},
});
The resulting source conforms to the source API.
Evaluated Docs
Now you can access special docs that only exist downstream from the eval source. In this example, we want to pass the 'TodoActions' doc as the argument of our new 'TodoReducer' cloud function.
const result = await source.dispatch({
type: 'GetDocValue',
domain: 'todo.aven.io',
name: 'TodoActions^TodoReducer'
})
You can also subscribe to the results from the client by accessing `cloud.get('TodoActions^TodoReducer')`