alexa-response
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -286,3 +286,6 @@ 'use strict'; | ||
var Response$1 = function () { | ||
var _class; | ||
var _temp; | ||
var Response$1 = (_temp = _class = function () { | ||
function Response() { | ||
@@ -380,41 +383,27 @@ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
return Response; | ||
}(); | ||
Response$1.ask = function () { | ||
}(), _class.ask = function () { | ||
var _ref3; | ||
return (_ref3 = new Response$1()).ask.apply(_ref3, arguments); | ||
}; | ||
Response$1.say = function () { | ||
}, _class.say = function () { | ||
var _ref4; | ||
return (_ref4 = new Response$1()).say.apply(_ref4, arguments); | ||
}; | ||
Response$1.card = function () { | ||
}, _class.card = function () { | ||
var _ref5; | ||
return (_ref5 = new Response$1()).card.apply(_ref5, arguments); | ||
}; | ||
Response$1.reprompt = function () { | ||
}, _class.reprompt = function () { | ||
var _ref6; | ||
return (_ref6 = new Response$1()).reprompt.apply(_ref6, arguments); | ||
}; | ||
Response$1.shouldEndSession = function () { | ||
}, _class.shouldEndSession = function () { | ||
var _ref7; | ||
return (_ref7 = new Response$1()).shouldEndSession.apply(_ref7, arguments); | ||
}; | ||
Response$1.directives = function () { | ||
}, _class.directives = function () { | ||
var _ref8; | ||
return (_ref8 = new Response$1()).directives.apply(_ref8, arguments); | ||
}; | ||
Response$1.build = function (params) { | ||
}, _class.build = function (params) { | ||
return Object.keys(params).reduce(function (response, action) { | ||
@@ -441,4 +430,3 @@ var options = params[action]; | ||
}, new Response$1()); | ||
}; | ||
}, _temp); | ||
var outputSpeech = function outputSpeech(text) { | ||
@@ -445,0 +433,0 @@ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SpeechType.PlainText; |
@@ -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 a={key:e,arg:t,resolve:n,reject:s,next:null};i?i=i.next=a:(o=i=a,r(e,t))})}function r(n,o){try{var i=t[n](o),a=i.value;a instanceof e?Promise.resolve(a.value).then(function(e){r("next",e)},function(e){r("throw",e)}):s(i.done?"return":"normal",i.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):i=null}var o,i;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 i=s.get;if(void 0!==i)return i.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 i=Object.getPrototypeOf(t);null!==i&&e(i,n,r,s)}else if("value"in o&&o.writable)o.value=r;else{var a=o.set;void 0!==a&&a.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)},Response$1=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),i=this.state.response||{},a=i.directives,u=void 0===a?[]:a;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}();Response$1.ask=function(){var e;return(e=new Response$1).ask.apply(e,arguments)},Response$1.say=function(){var e;return(e=new Response$1).say.apply(e,arguments)},Response$1.card=function(){var e;return(e=new Response$1).card.apply(e,arguments)},Response$1.reprompt=function(){var e;return(e=new Response$1).reprompt.apply(e,arguments)},Response$1.shouldEndSession=function(){var e;return(e=new Response$1).shouldEndSession.apply(e,arguments)},Response$1.directives=function(){var e;return(e=new Response$1).directives.apply(e,arguments)},Response$1.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)};var 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 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; |
{ | ||
"name": "alexa-response", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Build JSON responses for Amazon Alexa, easily.", | ||
@@ -8,13 +8,2 @@ "author": "Cameron Hunter <hello@cameronhunter.co.uk>", | ||
"main": "build/index.min.js", | ||
"jsnext:main": "src/index.js", | ||
"scripts": { | ||
"build:dev": "rollup -c", | ||
"build:production": "NODE_ENV=production rollup -c", | ||
"build": "npm-run-all --parallel build:dev build:production", | ||
"test": "ava --require babel-register", | ||
"posttest": "npm run lint", | ||
"lint": "eslint src/ test/", | ||
"preversion": "npm run build && npm test", | ||
"postversion": "git push && git push --tags" | ||
}, | ||
"files": [ | ||
@@ -33,21 +22,3 @@ "build", | ||
"alexa-ssml": "^0.5.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.16.0", | ||
"babel-eslint": "^7.0.0", | ||
"babel-plugin-transform-react-jsx": "^6.5.2", | ||
"babel-polyfill": "^6.7.4", | ||
"babel-preset-es2015": "^6.5.0", | ||
"babel-preset-es2015-rollup": "^1.1.1", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"babel-register": "^6.5.2", | ||
"eslint": "^3.7.0", | ||
"npm-run-all": "^3.1.0", | ||
"rollup": "^0.36.1", | ||
"rollup-plugin-babel": "^2.4.0", | ||
"rollup-plugin-uglify": "^1.0.1" | ||
}, | ||
"ava": { | ||
"babel": "inherit" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
0
28439
9
572