@ask-utils/labo

Experimental features of ask-util. Don't recommend to use it for production.

Usage no npm install needed!

<script type="module">
  import askUtilsLabo from 'https://cdn.skypack.dev/@ask-utils/labo';
</script>

README

ASK Utils Labo

npm version License: MIT Maintainability Test Coverage Build Status logo

https://ask-utils.dev

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()