New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ask-utils/router

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ask-utils/router

Skill Routing library for ask-sdk v2

latest
Source
npmnpm
Version
3.11.0
Version published
Weekly downloads
20
42.86%
Maintainers
1
Weekly downloads
 
Created
Source

Router

npm version License: MIT Maintainability Test Coverage Build Status logo

https://ask-utils.dev

Simple skill handler routing libs.

Getting started

$ npm i -S @ask-utils/router

Basic Usage


import {
    RequestHandlerFactory
} from '@ask-utils/router'
const router = new RequestHandlerFactory()
router.addRoutes({
    requestType: 'LaunchRequest',
    handler: (input) => {
        return input.responseBuilder
            .speak('hello world').getResponse()
    }
}, {
    requestType: 'IntentRequest',
    intentName: 'HelloIntent',
    handler: (input, helpers) => {
        helpers.stateManager.setState('step1')
        return input.responseBuilder
        .speak('Go to step 1').reprompt('will you go?').getResponse()
    }
}, {
    requestType: 'IntentRequest',
    intentName: 'Step1Intent',
    situation: {
        state: {
            current: 'step1',
            next: 'step2'
        }
    },
    handler: (input) => {
        return input.responseBuilder
        .speak('Go to step 2').reprompt('will you go?').getResponse()
    }
}, {
    requestType: 'IntentRequest',
    intentName: 'Step2Intent',
    situation: {
        state: {
            current: 'step2',
            next: 'end'
        }
    },
    handler: (input) => {
        return input.responseBuilder
        .speak('Finnaly').reprompt('will you go?').getResponse()
    }
}, {
    requestType: 'IntentRequest',
    intentName: ['AMAZON.StopIntent', 'AMAZON.CancelIntent'],
    situation: {
        shouldEndSession: true
    },
    handler: (input) => {
        return input.responseBuilder
        .speak('Bye!').getResponse()
    }
})

export const handler = CustomSkillFactory.init()
    .addRequestHandlers(
        ...router.createHandlers()
    ).lambda()

FAQs

Package last updated on 27 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts