New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

alexa-response

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alexa-response - npm Package Compare versions

Comparing version 3.2.1 to 3.2.2

4

build/index.js

@@ -5,3 +5,3 @@ 'use strict';

var alexaSsml = require('alexa-ssml');
var alexaSsmlJsx = require('alexa-ssml-jsx');

@@ -434,3 +434,3 @@ var CardType = {

if (type === SpeechType.SSML || (typeof text === 'undefined' ? 'undefined' : _typeof(text)) === 'object') {
var speech = (typeof text === 'undefined' ? 'undefined' : _typeof(text)) === 'object' ? alexaSsml.renderToString(text) : text;
var speech = (typeof text === 'undefined' ? 'undefined' : _typeof(text)) === 'object' ? alexaSsmlJsx.renderToString(text) : text;
return { outputSpeech: { type: SpeechType.SSML, ssml: speech } };

@@ -437,0 +437,0 @@ } else {

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var alexaSsml=require("alexa-ssml"),CardType={LinkAccount:"LinkAccount",Simple:"Simple",Standard:"Standard"},SpeechType={PlainText:"PlainText",SSML:"SSML"},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},asyncGenerator=function(){function e(e){this.value=e}function t(t){function n(e,t){return new Promise(function(n,s){var i={key:e,arg:t,resolve:n,reject:s,next:null};a?a=a.next=i:(o=a=i,r(e,t))})}function r(n,o){try{var a=t[n](o),i=a.value;i instanceof e?Promise.resolve(i.value).then(function(e){r("next",e)},function(e){r("throw",e)}):s(a.done?"return":"normal",a.value)}catch(e){s("throw",e)}}function s(e,t){switch(e){case"return":o.resolve({value:t,done:!0});break;case"throw":o.reject(t);break;default:o.resolve({value:t,done:!1})}o=o.next,o?r(o.key,o.arg):a=null}var o,a;this._invoke=n,"function"!=typeof t.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)},{wrap:function(e){return function(){return new t(e.apply(this,arguments))}},await:function(t){return new e(t)}}}(),classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},get=function e(t,n,r){null===t&&(t=Function.prototype);var s=Object.getOwnPropertyDescriptor(t,n);if(void 0===s){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in s)return s.value;var a=s.get;if(void 0!==a)return a.call(r)},objectWithoutProperties=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},set=function e(t,n,r,s){var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var a=Object.getPrototypeOf(t);null!==a&&e(a,n,r,s)}else if("value"in o&&o.writable)o.value=r;else{var i=o.set;void 0!==i&&i.call(s,r)}return r},toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},_class,_temp,Response$1=(_temp=_class=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};classCallCheck(this,e),this.state=t}return createClass(e,[{key:"ask",value:function(e,t){return this.say(e,t).shouldEndSession(!1)}},{key:"say",value:function(t,n){return new e(_extends({},this.state,{response:_extends({},this.state.response,{shouldEndSession:!0},outputSpeech(t,n))}))}},{key:"reprompt",value:function(t,n){return new e(_extends({},this.state,{response:_extends({},this.state.response,{reprompt:_extends({},outputSpeech(t,n))})}))}},{key:"card",value:function(t){var n=t.type,r=void 0===n?CardType.Simple:n,s=objectWithoutProperties(t,["type"]);return new e(_extends({},this.state,{response:_extends({},this.state.response,{card:_extends({},s,r&&{type:r})})}))}},{key:"attributes",value:function(t){return new e(_extends({},this.state,{sessionAttributes:_extends({},this.state.sessionAttributes,t)}))}},{key:"shouldEndSession",value:function(t){return new e(_extends({},this.state,{response:_extends({},this.state.response,{shouldEndSession:t})}))}},{key:"directives",value:function t(n){for(var r=arguments.length,s=Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];var t=Array.isArray(n)?n:[n].concat(s),a=this.state.response||{},i=a.directives,u=void 0===i?[]:i;return new e(_extends({},this.state,{response:_extends({},this.state.response,{directives:[].concat(toConsumableArray(u),toConsumableArray(t))})}))}},{key:"build",value:function(e){return _extends({version:"1.0"},this.state,{response:_extends({shouldEndSession:!0},this.state.response)},e||this.state.sessionAttributes?{sessionAttributes:_extends({},e,this.state.sessionAttributes)}:null)}}]),e}(),_class.ask=function(){var e;return(e=new Response$1).ask.apply(e,arguments)},_class.say=function(){var e;return(e=new Response$1).say.apply(e,arguments)},_class.card=function(){var e;return(e=new Response$1).card.apply(e,arguments)},_class.reprompt=function(){var e;return(e=new Response$1).reprompt.apply(e,arguments)},_class.shouldEndSession=function(){var e;return(e=new Response$1).shouldEndSession.apply(e,arguments)},_class.directives=function(){var e;return(e=new Response$1).directives.apply(e,arguments)},_class.build=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n],s="string"==typeof r?r:r,o="string"==typeof r?void 0:r.type;switch(n){case"ask":return t.ask(s,o);case"say":return t.say(s,o);case"reprompt":return t.reprompt(s,o);case"card":return t.card(r);case"attributes":return t.attributes(r);case"shouldEndSession":return t.shouldEndSession(r);case"directives":return t.directives(r)}},new Response$1)},_temp),outputSpeech=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:SpeechType.PlainText;if(t===SpeechType.SSML||"object"===("undefined"==typeof e?"undefined":_typeof(e))){var n="object"===("undefined"==typeof e?"undefined":_typeof(e))?alexaSsml.renderToString(e):e;return{outputSpeech:{type:SpeechType.SSML,ssml:n}}}return{outputSpeech:{type:t,text:e}}},AudioPlayer={play:function(e){return{type:"AudioPlayer.Play",playBehavior:"REPLACE_ALL",audioItem:{stream:e}}},enqueue:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"AudioPlayer.Play",playBehavior:t?"REPLACE_ENQUEUED":"ENQUEUE",audioItem:{stream:e}}},stop:function(){return{type:"AudioPlayer.Stop"}},clearQueue:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{type:"AudioPlayer.ClearQueue",clearBehavior:e?"CLEAR_ALL":"CLEAR_ENQUEUED"}}},ask$1=Response$1.ask,say$1=Response$1.say,card$1=Response$1.card,reprompt$1=Response$1.reprompt,shouldEndSession$1=Response$1.shouldEndSession,directives=Response$1.directives,build$1=Response$1.build;exports.CardType=CardType,exports.SpeechType=SpeechType,exports.AudioPlayer=AudioPlayer,exports.Response=Response$1,exports.default=Response$1,exports.ask=ask$1,exports.say=say$1,exports.card=card$1,exports.reprompt=reprompt$1,exports.shouldEndSession=shouldEndSession$1,exports.directives=directives,exports.build=build$1;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var alexaSsmlJsx=require("alexa-ssml-jsx"),CardType={LinkAccount:"LinkAccount",Simple:"Simple",Standard:"Standard"},SpeechType={PlainText:"PlainText",SSML:"SSML"},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},asyncGenerator=function(){function e(e){this.value=e}function t(t){function n(e,t){return new Promise(function(n,s){var i={key:e,arg:t,resolve:n,reject:s,next:null};a?a=a.next=i:(o=a=i,r(e,t))})}function r(n,o){try{var a=t[n](o),i=a.value;i instanceof e?Promise.resolve(i.value).then(function(e){r("next",e)},function(e){r("throw",e)}):s(a.done?"return":"normal",a.value)}catch(e){s("throw",e)}}function s(e,t){switch(e){case"return":o.resolve({value:t,done:!0});break;case"throw":o.reject(t);break;default:o.resolve({value:t,done:!1})}o=o.next,o?r(o.key,o.arg):a=null}var o,a;this._invoke=n,"function"!=typeof t.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)},{wrap:function(e){return function(){return new t(e.apply(this,arguments))}},await:function(t){return new e(t)}}}(),classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},get=function e(t,n,r){null===t&&(t=Function.prototype);var s=Object.getOwnPropertyDescriptor(t,n);if(void 0===s){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in s)return s.value;var a=s.get;if(void 0!==a)return a.call(r)},objectWithoutProperties=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},set=function e(t,n,r,s){var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var a=Object.getPrototypeOf(t);null!==a&&e(a,n,r,s)}else if("value"in o&&o.writable)o.value=r;else{var i=o.set;void 0!==i&&i.call(s,r)}return r},toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},_class,_temp,Response$1=(_temp=_class=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};classCallCheck(this,e),this.state=t}return createClass(e,[{key:"ask",value:function(e,t){return this.say(e,t).shouldEndSession(!1)}},{key:"say",value:function(t,n){return new e(_extends({},this.state,{response:_extends({},this.state.response,{shouldEndSession:!0},outputSpeech(t,n))}))}},{key:"reprompt",value:function(t,n){return new e(_extends({},this.state,{response:_extends({},this.state.response,{reprompt:_extends({},outputSpeech(t,n))})}))}},{key:"card",value:function(t){var n=t.type,r=void 0===n?CardType.Simple:n,s=objectWithoutProperties(t,["type"]);return new e(_extends({},this.state,{response:_extends({},this.state.response,{card:_extends({},s,r&&{type:r})})}))}},{key:"attributes",value:function(t){return new e(_extends({},this.state,{sessionAttributes:_extends({},this.state.sessionAttributes,t)}))}},{key:"shouldEndSession",value:function(t){return new e(_extends({},this.state,{response:_extends({},this.state.response,{shouldEndSession:t})}))}},{key:"directives",value:function t(n){for(var r=arguments.length,s=Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];var t=Array.isArray(n)?n:[n].concat(s),a=this.state.response||{},i=a.directives,u=void 0===i?[]:i;return new e(_extends({},this.state,{response:_extends({},this.state.response,{directives:[].concat(toConsumableArray(u),toConsumableArray(t))})}))}},{key:"build",value:function(e){return _extends({version:"1.0"},this.state,{response:_extends({shouldEndSession:!0},this.state.response)},e||this.state.sessionAttributes?{sessionAttributes:_extends({},e,this.state.sessionAttributes)}:null)}}]),e}(),_class.ask=function(){var e;return(e=new Response$1).ask.apply(e,arguments)},_class.say=function(){var e;return(e=new Response$1).say.apply(e,arguments)},_class.card=function(){var e;return(e=new Response$1).card.apply(e,arguments)},_class.reprompt=function(){var e;return(e=new Response$1).reprompt.apply(e,arguments)},_class.shouldEndSession=function(){var e;return(e=new Response$1).shouldEndSession.apply(e,arguments)},_class.directives=function(){var e;return(e=new Response$1).directives.apply(e,arguments)},_class.build=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n],s="string"==typeof r?r:r,o="string"==typeof r?void 0:r.type;switch(n){case"ask":return t.ask(s,o);case"say":return t.say(s,o);case"reprompt":return t.reprompt(s,o);case"card":return t.card(r);case"attributes":return t.attributes(r);case"shouldEndSession":return t.shouldEndSession(r);case"directives":return t.directives(r)}},new Response$1)},_temp),outputSpeech=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:SpeechType.PlainText;if(t===SpeechType.SSML||"object"===("undefined"==typeof e?"undefined":_typeof(e))){var n="object"===("undefined"==typeof e?"undefined":_typeof(e))?alexaSsmlJsx.renderToString(e):e;return{outputSpeech:{type:SpeechType.SSML,ssml:n}}}return{outputSpeech:{type:t,text:e}}},AudioPlayer={play:function(e){return{type:"AudioPlayer.Play",playBehavior:"REPLACE_ALL",audioItem:{stream:e}}},enqueue:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:"AudioPlayer.Play",playBehavior:t?"REPLACE_ENQUEUED":"ENQUEUE",audioItem:{stream:e}}},stop:function(){return{type:"AudioPlayer.Stop"}},clearQueue:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return{type:"AudioPlayer.ClearQueue",clearBehavior:e?"CLEAR_ALL":"CLEAR_ENQUEUED"}}},ask$1=Response$1.ask,say$1=Response$1.say,card$1=Response$1.card,reprompt$1=Response$1.reprompt,shouldEndSession$1=Response$1.shouldEndSession,directives=Response$1.directives,build$1=Response$1.build;exports.CardType=CardType,exports.SpeechType=SpeechType,exports.AudioPlayer=AudioPlayer,exports.Response=Response$1,exports.default=Response$1,exports.ask=ask$1,exports.say=say$1,exports.card=card$1,exports.reprompt=reprompt$1,exports.shouldEndSession=shouldEndSession$1,exports.directives=directives,exports.build=build$1;
{
"name": "alexa-response",
"version": "3.2.1",
"version": "3.2.2",
"description": "Build JSON responses for Amazon Alexa, easily.",

@@ -20,4 +20,4 @@ "author": "Cameron Hunter <hello@cameronhunter.co.uk>",

"dependencies": {
"alexa-ssml": "^0.5.0"
"alexa-ssml-jsx": "^1.0.0"
}
}
# Alexa Response
[![Build Status](https://travis-ci.org/cameronhunter/alexa-response.svg?branch=master)](https://travis-ci.org/cameronhunter/alexa-response) [![NPM Version](https://img.shields.io/npm/v/alexa-response.svg)](https://npmjs.org/package/alexa-response) [![License](https://img.shields.io/npm/l/alexa-response.svg)](https://github.com/cameronhunter/alexa-response/blob/master/LICENSE.md)
Build JSON responses for Amazon Alexa, easily. Alexa Response makes use of a

@@ -104,3 +102,3 @@ chainable interface to simplify building complex responses. Try it out in the

directly by including `babel-plugin-transform-react-jsx` in your `.babelrc` and
importing `ssml` from [`alexa-ssml`](https://github.com/nickclaw/alexa-ssml) in your source file.
importing `ssml` from [`alexa-ssml-jsx`](https://github.com/cameronhunter/alexa) in your source file.

@@ -117,5 +115,10 @@ ```json

import Response from 'alexa-response';
import { ssml } from 'alexa-ssml';
import ssml from 'ssml-jsx';
Response.ask(<speak><p>Hello world!</p><p>What would you like to do today?</p></speak>).build();
Response.ask(
<speak>
<p>Hello world!</p>
<p>What would you like to do today?</p>
</speak>
).build();
```

@@ -1,2 +0,2 @@

import { ssml, renderToString } from 'alexa-ssml';
import ssml, { renderToString } from 'alexa-ssml-jsx';
import CardType from './constants/CardType';

@@ -3,0 +3,0 @@ import SpeechType from './constants/SpeechType';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc