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

alexa-annotations

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alexa-annotations - npm Package Compare versions

Comparing version

to
6.0.0

2

build/index.js

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

return isAuthorized(options, application).then(function () {
return new Skill(attributes).route(request) || Promise.reject(NotFound);
return new Skill(session).route(request) || Promise.reject(NotFound);
}).then(function (response) {

@@ -221,0 +221,0 @@ return typeof response.build === 'function' ? response.build(attributes) : response;

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

"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e["default"]:e}var Promise=_interopDefault(require("bluebird")),$inject_Object_values=_interopDefault(require("object-values")),babelHelpers={};babelHelpers.classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},babelHelpers.createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),babelHelpers.defineProperty=function(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e},babelHelpers["extends"]=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},babelHelpers.slicedToArray=function(){function e(e,n){var t=[],r=!0,o=!1,u=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(a){o=!0,u=a}finally{try{!r&&s["return"]&&s["return"]()}finally{if(o)throw u}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var Unauthorized={code:401,message:"Unauthorized application ID"},NotFound={code:404,message:"Route not found"},InternalServer={code:500,message:"Internal skill error"},_ErrorCode=Object.freeze({Unauthorized:Unauthorized,NotFound:NotFound,InternalServer:InternalServer}),_class,_temp,Request=(_temp=_class=function(){function e(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];babelHelpers.classCallCheck(this,e),this.state=n}return babelHelpers.createClass(e,[{key:"session",value:function(n){return new e(babelHelpers["extends"]({},this.state,{session:babelHelpers["extends"]({},this.state.session,n)}))}},{key:"intent",value:function(n){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=Object.entries(t).reduce(function(e,n){var t=babelHelpers.slicedToArray(n,2),r=t[0],o=t[1];return babelHelpers["extends"]({},e,babelHelpers.defineProperty({},r,{name:r,value:o}))},{});return new e(babelHelpers["extends"]({},this.state,{request:{type:"IntentRequest",intent:babelHelpers["extends"]({name:n},Object.keys(r).length?{slots:r}:null)}}))}},{key:"launchRequest",value:function(){return new e(babelHelpers["extends"]({},this.state,{request:{type:"LaunchRequest"}}))}},{key:"sessionEndedRequest",value:function(){return new e(babelHelpers["extends"]({},this.state,{request:{type:"SessionEndedRequest"}}))}},{key:"build",value:function(){return babelHelpers["extends"]({},this.state)}}]),e}(),_class.session=function(){var e;return(e=new Request).session.apply(e,arguments)},_class.intent=function(){var e;return(e=new Request).intent.apply(e,arguments)},_class.launchRequest=function(){var e;return(e=new Request).launchRequest.apply(e,arguments)},_class.sessionEndedRequest=function(){var e;return(e=new Request).sessionEndedRequest.apply(e,arguments)},_temp),isAuthorized=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(t,r){var o=!e.applicationId||e.applicationId===n.applicationId;return o?t():r(Unauthorized)})},SkillAnnotation=function(e){return function(n){return function(t,r,o){var u=t||{},i=u.request,s=u.session,a=s||{},l=a.application,c=a.attributes;return isAuthorized(e,l).then(function(){return new n(c).route(i)||Promise.reject(NotFound)}).then(function(e){return"function"==typeof e.build?e.build(c):e}).then(function(e){return o&&o(null,e),e})["catch"](function(){var e=arguments.length<=0||void 0===arguments[0]?InternalServer:arguments[0];return o&&o(e),e}).then(function(n){if(e.logging!==!1){var t="string"==typeof e.logging?e.logging:"Skill";console.log("["+t+"]",JSON.stringify({request:i,response:n}))}return n})}}},_Skill=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n="function"==typeof e,t=n?{}:e,r=n&&e;return n?SkillAnnotation(t)(r):SkillAnnotation(t)},annotation=function(e){var n=arguments.length<=1||void 0===arguments[1]?function(e){return e}:arguments[1];return function(t,r){var o=t.route||function(){return!1};return t.route=function(u){return o.call(this,u)||e(u)&&t[r].call(this,n(u),u)},t}},Launch=annotation(function(e){var n=e.type;return"LaunchRequest"===n}),SessionEnded=annotation(function(e){var n=e.type;return"SessionEndedRequest"===n}),Intent=function(){for(var e=arguments.length,n=Array(e),t=0;e>t;t++)n[t]=arguments[t];return annotation(function(e){var t=e.type,r=e.intent,o=void 0===r?{}:r;return"IntentRequest"===t&&n.indexOf(o.name)>=0},function(e){var n=e.intent,t=void 0===n?{}:n;return $inject_Object_values(t.slots||{}).reduce(function(e,n){var t=n.name,r=n.value;return t&&null!=r?babelHelpers["extends"]({},e,babelHelpers.defineProperty({},t,r)):e},{})})};exports.ErrorCode=_ErrorCode,exports.Request=Request,exports.Skill=_Skill,exports.Launch=Launch,exports.Intent=Intent,exports.SessionEnded=SessionEnded;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e["default"]:e}var Promise=_interopDefault(require("bluebird")),$inject_Object_values=_interopDefault(require("object-values")),babelHelpers={};babelHelpers.classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")},babelHelpers.createClass=function(){function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),n}}(),babelHelpers.defineProperty=function(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e},babelHelpers["extends"]=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},babelHelpers.slicedToArray=function(){function e(e,n){var t=[],r=!0,o=!1,u=void 0;try{for(var i,s=e[Symbol.iterator]();!(r=(i=s.next()).done)&&(t.push(i.value),!n||t.length!==n);r=!0);}catch(a){o=!0,u=a}finally{try{!r&&s["return"]&&s["return"]()}finally{if(o)throw u}}return t}return function(n,t){if(Array.isArray(n))return n;if(Symbol.iterator in Object(n))return e(n,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var Unauthorized={code:401,message:"Unauthorized application ID"},NotFound={code:404,message:"Route not found"},InternalServer={code:500,message:"Internal skill error"},_ErrorCode=Object.freeze({Unauthorized:Unauthorized,NotFound:NotFound,InternalServer:InternalServer}),_class,_temp,Request=(_temp=_class=function(){function e(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];babelHelpers.classCallCheck(this,e),this.state=n}return babelHelpers.createClass(e,[{key:"session",value:function(n){return new e(babelHelpers["extends"]({},this.state,{session:babelHelpers["extends"]({},this.state.session,n)}))}},{key:"intent",value:function(n){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=Object.entries(t).reduce(function(e,n){var t=babelHelpers.slicedToArray(n,2),r=t[0],o=t[1];return babelHelpers["extends"]({},e,babelHelpers.defineProperty({},r,{name:r,value:o}))},{});return new e(babelHelpers["extends"]({},this.state,{request:{type:"IntentRequest",intent:babelHelpers["extends"]({name:n},Object.keys(r).length?{slots:r}:null)}}))}},{key:"launchRequest",value:function(){return new e(babelHelpers["extends"]({},this.state,{request:{type:"LaunchRequest"}}))}},{key:"sessionEndedRequest",value:function(){return new e(babelHelpers["extends"]({},this.state,{request:{type:"SessionEndedRequest"}}))}},{key:"build",value:function(){return babelHelpers["extends"]({},this.state)}}]),e}(),_class.session=function(){var e;return(e=new Request).session.apply(e,arguments)},_class.intent=function(){var e;return(e=new Request).intent.apply(e,arguments)},_class.launchRequest=function(){var e;return(e=new Request).launchRequest.apply(e,arguments)},_class.sessionEndedRequest=function(){var e;return(e=new Request).sessionEndedRequest.apply(e,arguments)},_temp),isAuthorized=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new Promise(function(t,r){var o=!e.applicationId||e.applicationId===n.applicationId;return o?t():r(Unauthorized)})},SkillAnnotation=function(e){return function(n){return function(t,r,o){var u=t||{},i=u.request,s=u.session,a=s||{},l=a.application,c=a.attributes;return isAuthorized(e,l).then(function(){return new n(s).route(i)||Promise.reject(NotFound)}).then(function(e){return"function"==typeof e.build?e.build(c):e}).then(function(e){return o&&o(null,e),e})["catch"](function(){var e=arguments.length<=0||void 0===arguments[0]?InternalServer:arguments[0];return o&&o(e),e}).then(function(n){if(e.logging!==!1){var t="string"==typeof e.logging?e.logging:"Skill";console.log("["+t+"]",JSON.stringify({request:i,response:n}))}return n})}}},_Skill=function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n="function"==typeof e,t=n?{}:e,r=n&&e;return n?SkillAnnotation(t)(r):SkillAnnotation(t)},annotation=function(e){var n=arguments.length<=1||void 0===arguments[1]?function(e){return e}:arguments[1];return function(t,r){var o=t.route||function(){return!1};return t.route=function(u){return o.call(this,u)||e(u)&&t[r].call(this,n(u),u)},t}},Launch=annotation(function(e){var n=e.type;return"LaunchRequest"===n}),SessionEnded=annotation(function(e){var n=e.type;return"SessionEndedRequest"===n}),Intent=function(){for(var e=arguments.length,n=Array(e),t=0;e>t;t++)n[t]=arguments[t];return annotation(function(e){var t=e.type,r=e.intent,o=void 0===r?{}:r;return"IntentRequest"===t&&n.indexOf(o.name)>=0},function(e){var n=e.intent,t=void 0===n?{}:n;return $inject_Object_values(t.slots||{}).reduce(function(e,n){var t=n.name,r=n.value;return t&&null!=r?babelHelpers["extends"]({},e,babelHelpers.defineProperty({},t,r)):e},{})})};exports.ErrorCode=_ErrorCode,exports.Request=Request,exports.Skill=_Skill,exports.Launch=Launch,exports.Intent=Intent,exports.SessionEnded=SessionEnded;

@@ -9,3 +9,3 @@ {

"description": "Create Alexa skills for the Amazon Echo, easily.",
"version": "5.0.0",
"version": "6.0.0",
"main": "build/index.min.js",

@@ -12,0 +12,0 @@ "jsnext:main": "src/index.js",

@@ -13,3 +13,3 @@ import { Unauthorized, NotFound, InternalServer } from './error-codes';

return isAuthorized(options, application).then(() => {
return new Skill(attributes).route(request) || Promise.reject(NotFound);
return new Skill(session).route(request) || Promise.reject(NotFound);
}).then(response => {

@@ -16,0 +16,0 @@ return (typeof response.build === 'function') ? response.build(attributes) : response;