Conversation Context
A simple class that helps to handle bot conversation context.
Getting started
const Context = require('conv-context');
const context = new Context(contextData, thread);
Resolve context from contextData
const resolvedContext = await context.resolve(resolver=defaultResolver);
Custom resolver (binded to the step's 'this')
const resolver = async function (output, store) {
};
Get context data
context.get('name', data, defaultValue);
context.getStepContext(stepId)
context.findStepContext(query={})
context.findStepId(query={})
context.filterStepContext(query={})
Set context data
context.set('name', data);
context.setStepContext(data)
Save context in the session and shared storage
await context.save(shared=true, ttl=null)
helper methods for each storage
context.setSession();
await context.setShared(ttl);