alexa-lambda-skill
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -11,2 +11,26 @@ 'use strict'; | ||
babelHelpers.classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
babelHelpers.createClass = function () { | ||
function defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
return function (Constructor, protoProps, staticProps) { | ||
if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
}; | ||
}(); | ||
babelHelpers.defineProperty = function (obj, key, value) { | ||
@@ -41,2 +65,40 @@ if (key in obj) { | ||
babelHelpers.slicedToArray = function () { | ||
function sliceIterator(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"]) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
return function (arr, i) { | ||
if (Array.isArray(arr)) { | ||
return arr; | ||
} else if (Symbol.iterator in Object(arr)) { | ||
return sliceIterator(arr, i); | ||
} else { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
} | ||
}; | ||
}(); | ||
babelHelpers; | ||
@@ -80,2 +142,72 @@ | ||
var _class; | ||
var _temp; | ||
var Request = (_temp = _class = function () { | ||
function Request() { | ||
var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
babelHelpers.classCallCheck(this, Request); | ||
this.state = state; | ||
} | ||
babelHelpers.createClass(Request, [{ | ||
key: 'intent', | ||
value: function intent(name) { | ||
var slots = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var slotData = Object.entries(slots).reduce(function (state, _ref) { | ||
var _ref2 = babelHelpers.slicedToArray(_ref, 2); | ||
var name = _ref2[0]; | ||
var value = _ref2[1]; | ||
return babelHelpers.extends({}, state, babelHelpers.defineProperty({}, name, { name: name, value: value })); | ||
}, {}); | ||
return new Request(babelHelpers.extends({}, this.state, { | ||
request: { | ||
type: 'IntentRequest', | ||
intent: babelHelpers.extends({ | ||
name: name | ||
}, Object.keys(slotData).length ? { slots: slotData } : null) | ||
} | ||
})); | ||
} | ||
}, { | ||
key: 'launchRequest', | ||
value: function launchRequest() { | ||
return new Request(babelHelpers.extends({}, this.state, { | ||
request: { | ||
type: 'LaunchRequest' | ||
} | ||
})); | ||
} | ||
}, { | ||
key: 'sessionEndedRequest', | ||
value: function sessionEndedRequest() { | ||
return new Request(babelHelpers.extends({}, this.state, { | ||
request: { | ||
type: 'SessionEndedRequest' | ||
} | ||
})); | ||
} | ||
}, { | ||
key: 'build', | ||
value: function build() { | ||
return babelHelpers.extends({}, this.state); | ||
} | ||
}]); | ||
return Request; | ||
}(), _class.intent = function () { | ||
var _ref3; | ||
return (_ref3 = new Request()).intent.apply(_ref3, arguments); | ||
}, _class.launchRequest = function () { | ||
var _ref4; | ||
return (_ref4 = new Request()).launchRequest.apply(_ref4, arguments); | ||
}, _class.sessionEndedRequest = function () { | ||
var _ref5; | ||
return (_ref5 = new Request()).sessionEndedRequest.apply(_ref5, arguments); | ||
}, _temp); | ||
var annotation = function annotation(predicate) { | ||
@@ -136,4 +268,5 @@ var transform = arguments.length <= 1 || arguments[1] === undefined ? function (i) { | ||
exports.Skill = _Skill; | ||
exports.Request = Request; | ||
exports.Launch = Launch; | ||
exports.Intent = Intent; | ||
exports.SessionEnded = SessionEnded; |
@@ -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")),alexaResponse=require("alexa-response"),$inject_Object_values=_interopDefault(require("object-values")),babelHelpers={};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};var NotFound=alexaResponse.say("I'm sorry, I don't know how to do that."),_Skill=function(e){return function(n,t){var r=t||{},o=r.succeed,u=r.fail,a=n||{},i=a.request,l=a.session,s=l||{},c=s.attributes,f=new e(c),p=f.route&&f.route(i)||NotFound;return Promise.resolve(p).then(function(e){return e.build&&"function"==typeof e.build?e.build(c):e}).then(function(e){return o&&o(e),e})["catch"](function(){var e=arguments.length<=0||void 0===arguments[0]?"Unknown error":arguments[0];return u&&u(e),e})}},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(){for(var u,a=arguments.length,i=Array(a),l=0;a>l;l++)i[l]=arguments[l];return o.apply(void 0,i)||e.apply(void 0,i)&&(u=t[r]).call.apply(u,[t,n.apply(void 0,i)].concat(i))},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.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")),alexaResponse=require("alexa-response"),$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,a=!1,u=void 0;try{for(var s,o=e[Symbol.iterator]();!(r=(s=o.next()).done)&&(t.push(s.value),!n||t.length!==n);r=!0);}catch(l){a=!0,u=l}finally{try{!r&&o["return"]&&o["return"]()}finally{if(a)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 NotFound=alexaResponse.say("I'm sorry, I don't know how to do that."),_Skill=function(e){return function(n,t){var r=t||{},a=r.succeed,u=r.fail,s=n||{},o=s.request,l=s.session,i=l||{},c=i.attributes,p=new e(c),f=p.route&&p.route(o)||NotFound;return Promise.resolve(f).then(function(e){return e.build&&"function"==typeof e.build?e.build(c):e}).then(function(e){return a&&a(e),e})["catch"](function(){var e=arguments.length<=0||void 0===arguments[0]?"Unknown error":arguments[0];return u&&u(e),e})}},_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:"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],a=t[1];return babelHelpers["extends"]({},e,babelHelpers.defineProperty({},r,{name:r,value:a}))},{});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.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),annotation=function(e){var n=arguments.length<=1||void 0===arguments[1]?function(e){return e}:arguments[1];return function(t,r){var a=t.route||function(){return!1};return t.route=function(){for(var u,s=arguments.length,o=Array(s),l=0;s>l;l++)o[l]=arguments[l];return a.apply(void 0,o)||e.apply(void 0,o)&&(u=t[r]).call.apply(u,[t,n.apply(void 0,o)].concat(o))},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,a=void 0===r?{}:r;return"IntentRequest"===t&&n.indexOf(a.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.Skill=_Skill,exports.Request=Request,exports.Launch=Launch,exports.Intent=Intent,exports.SessionEnded=SessionEnded; |
@@ -9,3 +9,3 @@ { | ||
"description": "Create Alexa Skills for AWS Lambda, easily.", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"main": "build/index.min.js", | ||
@@ -37,13 +37,14 @@ "jsnext:main": "src/index.js", | ||
"ava": "^0.13.0", | ||
"babel-eslint": "^6.0.0-beta.6", | ||
"babel-eslint": "^6.0.0", | ||
"babel-plugin-transform-class-properties": "^6.6.0", | ||
"babel-plugin-transform-decorators-legacy": "^1.3.4", | ||
"babel-polyfill": "^6.7.2", | ||
"babel-preset-es2015": "^6.5.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-preset-es2015-rollup": "^1.1.1", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"babel-register": "^6.5.2", | ||
"eslint": "^2.4.0", | ||
"babel-register": "^6.7.2", | ||
"eslint": "^2.5.3", | ||
"isomorphic-fetch": "^2.2.1", | ||
"npm-run-all": "^1.5.3", | ||
"rollup": "^0.25.4", | ||
"npm-run-all": "^1.7.0", | ||
"rollup": "^0.25.7", | ||
"rollup-plugin-babel": "^2.4.0", | ||
@@ -60,3 +61,6 @@ "rollup-plugin-inject": "^1.4.0", | ||
"lambda" | ||
] | ||
], | ||
"ava": { | ||
"babel": "inherit" | ||
} | ||
} |
export Skill from './skill'; | ||
export Request from './request'; | ||
export { Launch, Intent, SessionEnded } from './annotations'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19029
303
17