ASK Utils Labo
Experimental modules of ask-utils
Getting started
$ npm i -S @ask-utils/labo
Features
PersistentAttributesManager
Wrapper class of PersistentAttributesManager to handle the props more easily.
Usage
const persistentAttributesManager = PersistanteAttributesManager.getInstance(handlerInput.attributesManager)
await persistentAttributesManager.updatePersistentAttributes({
name: 'John'
})
await persistentAttributesManager.save()
Auto merge the props
await persistentAttributesManager.updatePersistentAttributes({
name: 'John',
count: 1,
})
await persistentAttributesManager.save()
await persistentAttributesManager.updatePersistentAttributes({
message: 'hello',
count: 2,
})
await persistentAttributesManager.save()
console.log(await persistentAttributesManager.getPersistentAttributes())
{
name: 'John',
count: 2,
message: 'hello',
}
Detect should call AWS APIs
If no property has been updated, it will not call AWS API.
const persistentAttributesManager = PersistanteAttributesManager.getInstance(handlerInput.attributesManager)
// NOTHING TO DO
await persistentAttributesManager.save()
await persistentAttributesManager.updatePersistentAttributes({
name: 'John'
})
// CALL attributeManager.savePersistentAttributes to save the update
await persistentAttributesManager.save()
// NOTHING TO DO
await persistentAttributesManager.save()