alexa-annotations
Advanced tools
Comparing version 8.1.1 to 9.0.0
@@ -9,2 +9,4 @@ 'use strict'; | ||
var $inject_Object_values = _interopDefault(require('object-values')); | ||
var alexaConstants = require('alexa-constants'); | ||
var UUID = _interopDefault(require('uuid')); | ||
@@ -398,3 +400,3 @@ var Unauthorized = { code: 401, message: 'Unauthorized application ID' }; | ||
return namespace === 'Alexa.ConnectedHome.Discovery' && name === 'DiscoverAppliancesRequest'; | ||
return namespace === alexaConstants.ConnectedHome.Discovery && name === alexaConstants.ConnectedHome.Request.DiscoverAppliances; | ||
}); | ||
@@ -414,3 +416,3 @@ | ||
return namespace === 'Alexa.ConnectedHome.Control' && (!names.length || names.indexOf(name) >= 0); | ||
return namespace === alexaConstants.ConnectedHome.Control && (!names.length || names.indexOf(name) >= 0); | ||
}; | ||
@@ -440,3 +442,3 @@ }; | ||
var name = 'TurnOnRequest'; | ||
var name = alexaConstants.ConnectedHome.Request.TurnOn; | ||
@@ -456,5 +458,5 @@ var requestTransform = function requestTransform(_ref) { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'TurnOnConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: alexaConstants.ConnectedHome.Confirmation.TurnOn, | ||
namespace: alexaConstants.ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -469,3 +471,3 @@ }, | ||
var name$1 = 'TurnOffRequest'; | ||
var name$1 = alexaConstants.ConnectedHome.Request.TurnOff; | ||
@@ -485,5 +487,5 @@ var requestTransform$1 = function requestTransform$1(_ref) { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'TurnOffConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: alexaConstants.ConnectedHome.Confirmation.TurnOff, | ||
namespace: alexaConstants.ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -498,3 +500,3 @@ }, | ||
var name$2 = 'SetTargetTemperatureRequest'; | ||
var name$2 = alexaConstants.ConnectedHome.Request.SetTargetTemperature; | ||
@@ -516,5 +518,5 @@ var requestTransform$2 = function requestTransform$2(_ref) { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'SetTargetTemperatureConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: alexaConstants.ConnectedHome.Confirmation.SetTargetTemperature, | ||
namespace: alexaConstants.ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -531,3 +533,3 @@ }, | ||
var name$3 = 'IncrementTargetTemperatureRequest'; | ||
var name$3 = alexaConstants.ConnectedHome.Request.IncrementTargetTemperature; | ||
@@ -549,5 +551,5 @@ var requestTransform$3 = function requestTransform$3(_ref) { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'IncrementTargetTemperatureConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: alexaConstants.ConnectedHome.Confirmation.IncrementTargetTemperature, | ||
namespace: alexaConstants.ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -564,3 +566,3 @@ }, | ||
var name$4 = 'DecrementTargetTemperatureRequest'; | ||
var name$4 = alexaConstants.ConnectedHome.Request.DecrementTargetTemperature; | ||
@@ -582,5 +584,5 @@ var requestTransform$4 = function requestTransform$4(_ref) { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'DecrementTargetTemperatureConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: alexaConstants.ConnectedHome.Confirmation.DecrementTargetTemperature, | ||
namespace: alexaConstants.ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -597,3 +599,3 @@ }, | ||
var name$5 = 'SetPercentageRequest'; | ||
var name$5 = alexaConstants.ConnectedHome.Request.SetPercentage; | ||
@@ -615,5 +617,5 @@ var requestTransform$5 = function requestTransform$5(_ref) { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'SetPercentageConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: alexaConstants.ConnectedHome.Confirmation.SetPercentage, | ||
namespace: alexaConstants.ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -628,3 +630,3 @@ }, | ||
var name$6 = 'IncrementPercentageRequest'; | ||
var name$6 = alexaConstants.ConnectedHome.Request.IncrementPercentage; | ||
@@ -646,5 +648,5 @@ var requestTransform$6 = function requestTransform$6(_ref) { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'IncrementPercentageConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: alexaConstants.ConnectedHome.Confirmation.IncrementPercentage, | ||
namespace: alexaConstants.ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -659,3 +661,3 @@ }, | ||
var name$7 = 'DecrementPercentageRequest'; | ||
var name$7 = alexaConstants.ConnectedHome.Request.DecrementPercentage; | ||
@@ -677,5 +679,5 @@ var requestTransform$7 = function requestTransform$7(_ref) { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'DecrementPercentageConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: alexaConstants.ConnectedHome.Confirmation.DecrementPercentage, | ||
namespace: alexaConstants.ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -682,0 +684,0 @@ }, |
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function getArgs(e,n){var r=e?e(n):[],t=Array.isArray(r)?r:[r];return[].concat(toConsumableArray(t),[n])}Object.defineProperty(exports,"__esModule",{value:!0});var Promise$1=_interopDefault(require("bluebird")),$inject_Object_values=_interopDefault(require("object-values")),Unauthorized={code:401,message:"Unauthorized application ID"},NotFound={code:404,message:"Route not found"},InternalServer={code:500,message:"Internal skill error"},ErrorCodes=Object.freeze({Unauthorized:Unauthorized,NotFound:NotFound,InternalServer:InternalServer}),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$1(function(r,t){var o=!e.applicationId||e.applicationId===n.applicationId;return o?r():t(Unauthorized)})},Skill=function(e){return function(n){return function(r,t,o){var a=r||{},u=a.session,i=u||{},s=i.application,c=i.attributes;return isAuthorized(e,s).then(function(){return new n(u).route(r)||Promise$1.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]?arguments[0]:InternalServer;return o&&o(e),e}).then(function(t){return e.logging!==!1&&console.log("["+n.name+"]",JSON.stringify({event:r,response:t})),t})}}},Skill$1=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n="function"==typeof e,r=n?{}:e,t=Skill(r);return n?t(e):t},asyncGenerator=function(){function e(e){this.value=e}function n(n){function r(e,n){return new Promise(function(r,o){var i={key:e,arg:n,resolve:r,reject:o,next:null};u?u=u.next=i:(a=u=i,t(e,n))})}function t(r,a){try{var u=n[r](a),i=u.value;i instanceof e?Promise.resolve(i.value).then(function(e){t("next",e)},function(e){t("throw",e)}):o(u.done?"return":"normal",u.value)}catch(e){o("throw",e)}}function o(e,n){switch(e){case"return":a.resolve({value:n,done:!0});break;case"throw":a.reject(n);break;default:a.resolve({value:n,done:!1})}a=a.next,a?t(a.key,a.arg):u=null}var a,u;this._invoke=r,"function"!=typeof n.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(n.prototype[Symbol.asyncIterator]=function(){return this}),n.prototype.next=function(e){return this._invoke("next",e)},n.prototype.throw=function(e){return this._invoke("throw",e)},n.prototype.return=function(e){return this._invoke("return",e)},{wrap:function(e){return function(){return new n(e.apply(this,arguments))}},await:function(n){return new e(n)}}}(),defineProperty=function(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e},_extends=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},get=function e(n,r,t){null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,r);if(void 0===o){var a=Object.getPrototypeOf(n);return null===a?void 0:e(a,r,t)}if("value"in o)return o.value;var u=o.get;if(void 0!==u)return u.call(t)},set=function e(n,r,t,o){var a=Object.getOwnPropertyDescriptor(n,r);if(void 0===a){var u=Object.getPrototypeOf(n);null!==u&&e(u,r,t,o)}else if("value"in a&&a.writable)a.value=t;else{var i=a.set;void 0!==i&&i.call(o,t)}return t},toConsumableArray=function(e){if(Array.isArray(e)){for(var n=0,r=Array(e.length);n<e.length;n++)r[n]=e[n];return r}return Array.from(e)},annotation=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){return e};return function(t,o){var a=t.route||function(){return!1};return t.route=function(){var u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a.call(this,u)||e(u)&&r(t[o].apply(this,getArgs(n,u)))},t}},Launch=annotation(function(e){var n=e.request,r=void 0===n?{}:n;return"LaunchRequest"===r.type}),Intent=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return annotation(function(e){var r=e.request,t=void 0===r?{}:r,o=t.type,a=t.intent,u=void 0===a?{}:a;return"IntentRequest"===o&&n.indexOf(u.name)>=0},function(e){var n=e.request,r=void 0===n?{}:n,t=r.intent,o=void 0===t?{}:t,a=o.slots,u=void 0===a?{}:a;return $inject_Object_values(u).reduce(function(e,n){var r=n.name,t=n.value;return r&&null!=t?_extends({},e,defineProperty({},r,t)):e},{})})},SessionEnded=annotation(function(e){var n=e.request,r=void 0===n?{}:n;return"SessionEndedRequest"===r.type}),Discovery=annotation(function(e){var n=e.header,r=void 0===n?{}:n,t=r.namespace,o=r.name;return"Alexa.ConnectedHome.Discovery"===t&&"DiscoverAppliancesRequest"===o}),isControlRequest=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.header,t=void 0===r?{}:r,o=t.namespace,a=t.name;return"Alexa.ConnectedHome.Control"===o&&(!n.length||n.indexOf(a)>=0)}},ControlRequest=function(e,n){return annotation(isControlRequest(e),n||function(e){var n=e.payload,r=void 0===n?{}:n;return[r]})},Control=function(){return annotation(isControlRequest.apply(void 0,arguments),function(e){var n=e.header,r=void 0===n?{}:n,t=e.payload,o=void 0===t?{}:t,a=o.appliance,u=void 0===a?{}:a;return[u.applianceId,r.name,o]})},name="TurnOnRequest",requestTransform=function(e){var n=e.payload,r=void 0===n?{}:n,t=r.appliance,o=void 0===t?{}:t;return[o.applianceId,r]},responseTransform=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:"26fa11a8-accb-4f66-a272-8b1ff7abd722",name:"TurnOnConfirmation",namespace:"Alexa.ConnectedHome.Control",payloadVersion:"2"},payload:{}}})},TurnOn=ControlRequest(name,requestTransform,responseTransform),name$1="TurnOffRequest",requestTransform$1=function(e){var n=e.payload,r=void 0===n?{}:n,t=r.appliance,o=void 0===t?{}:t;return[o.applianceId,r]},responseTransform$1=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:"26fa11a8-accb-4f66-a272-8b1ff7abd722",name:"TurnOffConfirmation",namespace:"Alexa.ConnectedHome.Control",payloadVersion:"2"},payload:{}}})},TurnOff=ControlRequest(name$1,requestTransform$1,responseTransform$1),name$2="SetTargetTemperatureRequest",requestTransform$2=function(e){var n=e.payload,r=void 0===n?{}:n,t=r.appliance,o=void 0===t?{}:t,a=r.targetTemperature,u=void 0===a?{}:a;return[o.applianceId,u.value,r]},responseTransform$2=function(e){return Promise$1.resolve(e).then(function(e){return{header:{messageId:"26fa11a8-accb-4f66-a272-8b1ff7abd722",name:"SetTargetTemperatureConfirmation",namespace:"Alexa.ConnectedHome.Control",payloadVersion:"2"},payload:_extends({},e.current,{previousState:_extends({},e.previous)})}})},SetTargetTemperature=ControlRequest(name$2,requestTransform$2,responseTransform$2),name$3="IncrementTargetTemperatureRequest",requestTransform$3=function(e){var n=e.payload,r=void 0===n?{}:n,t=r.appliance,o=void 0===t?{}:t,a=r.deltaTemperature,u=void 0===a?{}:a;return[o.applianceId,u.value,r]},responseTransform$3=function(e){return Promise$1.resolve(e).then(function(e){return{header:{messageId:"26fa11a8-accb-4f66-a272-8b1ff7abd722",name:"IncrementTargetTemperatureConfirmation",namespace:"Alexa.ConnectedHome.Control",payloadVersion:"2"},payload:_extends({},e.current,{previousState:_extends({},e.previous)})}})},IncrementTargetTemperature=ControlRequest(name$3,requestTransform$3,responseTransform$3),name$4="DecrementTargetTemperatureRequest",requestTransform$4=function(e){var n=e.payload,r=void 0===n?{}:n,t=r.appliance,o=void 0===t?{}:t,a=r.deltaTemperature,u=void 0===a?{}:a;return[o.applianceId,u.value,r]},responseTransform$4=function(e){return Promise$1.resolve(e).then(function(e){return{header:{messageId:"26fa11a8-accb-4f66-a272-8b1ff7abd722",name:"DecrementTargetTemperatureConfirmation",namespace:"Alexa.ConnectedHome.Control",payloadVersion:"2"},payload:_extends({},e.current,{previousState:_extends({},e.previous)})}})},DecrementTargetTemperature=ControlRequest(name$4,requestTransform$4,responseTransform$4),name$5="SetPercentageRequest",requestTransform$5=function(e){var n=e.payload,r=void 0===n?{}:n,t=r.appliance,o=void 0===t?{}:t,a=r.percentageState,u=void 0===a?{}:a;return[o.applianceId,u.value,r]},responseTransform$5=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:"26fa11a8-accb-4f66-a272-8b1ff7abd722",name:"SetPercentageConfirmation",namespace:"Alexa.ConnectedHome.Control",payloadVersion:"2"},payload:{}}})},SetPercentage=ControlRequest(name$5,requestTransform$5,responseTransform$5),name$6="IncrementPercentageRequest",requestTransform$6=function(e){var n=e.payload,r=void 0===n?{}:n,t=r.appliance,o=void 0===t?{}:t,a=r.deltaPercentage,u=void 0===a?{}:a;return[o.applianceId,u.value,r]},responseTransform$6=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:"26fa11a8-accb-4f66-a272-8b1ff7abd722",name:"IncrementPercentageConfirmation",namespace:"Alexa.ConnectedHome.Control",payloadVersion:"2"},payload:{}}})},IncrementPercentage=ControlRequest(name$6,requestTransform$6,responseTransform$6),name$7="DecrementPercentageRequest",requestTransform$7=function(e){var n=e.payload,r=void 0===n?{}:n,t=r.appliance,o=void 0===t?{}:t,a=r.deltaPercentage,u=void 0===a?{}:a;return[o.applianceId,u.value,r]},responseTransform$7=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:"26fa11a8-accb-4f66-a272-8b1ff7abd722",name:"DecrementPercentageConfirmation",namespace:"Alexa.ConnectedHome.Control",payloadVersion:"2"},payload:{}}})},DecrementPercentage=ControlRequest(name$7,requestTransform$7,responseTransform$7);exports.Skill=Skill$1,exports.annotation=annotation,exports.ErrorCode=ErrorCodes,exports.Launch=Launch,exports.Intent=Intent,exports.SessionEnded=SessionEnded,exports.Discovery=Discovery,exports.Control=Control,exports.TurnOn=TurnOn,exports.TurnOff=TurnOff,exports.SetTargetTemperature=SetTargetTemperature,exports.IncrementTargetTemperature=IncrementTargetTemperature,exports.DecrementTargetTemperature=DecrementTargetTemperature,exports.SetPercentage=SetPercentage,exports.IncrementPercentage=IncrementPercentage,exports.DecrementPercentage=DecrementPercentage; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}function getArgs(e,n){var t=e?e(n):[],r=Array.isArray(t)?t:[t];return[].concat(toConsumableArray(r),[n])}Object.defineProperty(exports,"__esModule",{value:!0});var Promise$1=_interopDefault(require("bluebird")),$inject_Object_values=_interopDefault(require("object-values")),alexaConstants=require("alexa-constants"),UUID=_interopDefault(require("uuid")),Unauthorized={code:401,message:"Unauthorized application ID"},NotFound={code:404,message:"Route not found"},InternalServer={code:500,message:"Internal skill error"},ErrorCodes=Object.freeze({Unauthorized:Unauthorized,NotFound:NotFound,InternalServer:InternalServer}),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$1(function(t,r){var o=!e.applicationId||e.applicationId===n.applicationId;return o?t():r(Unauthorized)})},Skill=function(e){return function(n){return function(t,r,o){var a=t||{},s=a.session,u=s||{},i=u.application,c=u.attributes;return isAuthorized(e,i).then(function(){return new n(s).route(t)||Promise$1.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]?arguments[0]:InternalServer;return o&&o(e),e}).then(function(r){return e.logging!==!1&&console.log("["+n.name+"]",JSON.stringify({event:t,response:r})),r})}}},Skill$1=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n="function"==typeof e,t=n?{}:e,r=Skill(t);return n?r(e):r},asyncGenerator=function(){function e(e){this.value=e}function n(n){function t(e,n){return new Promise(function(t,o){var u={key:e,arg:n,resolve:t,reject:o,next:null};s?s=s.next=u:(a=s=u,r(e,n))})}function r(t,a){try{var s=n[t](a),u=s.value;u instanceof e?Promise.resolve(u.value).then(function(e){r("next",e)},function(e){r("throw",e)}):o(s.done?"return":"normal",s.value)}catch(e){o("throw",e)}}function o(e,n){switch(e){case"return":a.resolve({value:n,done:!0});break;case"throw":a.reject(n);break;default:a.resolve({value:n,done:!1})}a=a.next,a?r(a.key,a.arg):s=null}var a,s;this._invoke=t,"function"!=typeof n.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(n.prototype[Symbol.asyncIterator]=function(){return this}),n.prototype.next=function(e){return this._invoke("next",e)},n.prototype.throw=function(e){return this._invoke("throw",e)},n.prototype.return=function(e){return this._invoke("return",e)},{wrap:function(e){return function(){return new n(e.apply(this,arguments))}},await:function(n){return new e(n)}}}(),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},_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},get=function e(n,t,r){null===n&&(n=Function.prototype);var o=Object.getOwnPropertyDescriptor(n,t);if(void 0===o){var a=Object.getPrototypeOf(n);return null===a?void 0:e(a,t,r)}if("value"in o)return o.value;var s=o.get;if(void 0!==s)return s.call(r)},set=function e(n,t,r,o){var a=Object.getOwnPropertyDescriptor(n,t);if(void 0===a){var s=Object.getPrototypeOf(n);null!==s&&e(s,t,r,o)}else if("value"in a&&a.writable)a.value=r;else{var u=a.set;void 0!==u&&u.call(o,r)}return r},toConsumableArray=function(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)},annotation=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){return e};return function(r,o){var a=r.route||function(){return!1};return r.route=function(){var s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a.call(this,s)||e(s)&&t(r[o].apply(this,getArgs(n,s)))},r}},Launch=annotation(function(e){var n=e.request,t=void 0===n?{}:n;return"LaunchRequest"===t.type}),Intent=function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];return annotation(function(e){var t=e.request,r=void 0===t?{}:t,o=r.type,a=r.intent,s=void 0===a?{}:a;return"IntentRequest"===o&&n.indexOf(s.name)>=0},function(e){var n=e.request,t=void 0===n?{}:n,r=t.intent,o=void 0===r?{}:r,a=o.slots,s=void 0===a?{}:a;return $inject_Object_values(s).reduce(function(e,n){var t=n.name,r=n.value;return t&&null!=r?_extends({},e,defineProperty({},t,r)):e},{})})},SessionEnded=annotation(function(e){var n=e.request,t=void 0===n?{}:n;return"SessionEndedRequest"===t.type}),Discovery=annotation(function(e){var n=e.header,t=void 0===n?{}:n,r=t.namespace,o=t.name;return r===alexaConstants.ConnectedHome.Discovery&&o===alexaConstants.ConnectedHome.Request.DiscoverAppliances}),isControlRequest=function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.header,r=void 0===t?{}:t,o=r.namespace,a=r.name;return o===alexaConstants.ConnectedHome.Control&&(!n.length||n.indexOf(a)>=0)}},ControlRequest=function(e,n){return annotation(isControlRequest(e),n||function(e){var n=e.payload,t=void 0===n?{}:n;return[t]})},Control=function(){return annotation(isControlRequest.apply(void 0,arguments),function(e){var n=e.header,t=void 0===n?{}:n,r=e.payload,o=void 0===r?{}:r,a=o.appliance,s=void 0===a?{}:a;return[s.applianceId,t.name,o]})},name=alexaConstants.ConnectedHome.Request.TurnOn,requestTransform=function(e){var n=e.payload,t=void 0===n?{}:n,r=t.appliance,o=void 0===r?{}:r;return[o.applianceId,t]},responseTransform=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:UUID.v4(),name:alexaConstants.ConnectedHome.Confirmation.TurnOn,namespace:alexaConstants.ConnectedHome.Control,payloadVersion:"2"},payload:{}}})},TurnOn=ControlRequest(name,requestTransform,responseTransform),name$1=alexaConstants.ConnectedHome.Request.TurnOff,requestTransform$1=function(e){var n=e.payload,t=void 0===n?{}:n,r=t.appliance,o=void 0===r?{}:r;return[o.applianceId,t]},responseTransform$1=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:UUID.v4(),name:alexaConstants.ConnectedHome.Confirmation.TurnOff,namespace:alexaConstants.ConnectedHome.Control,payloadVersion:"2"},payload:{}}})},TurnOff=ControlRequest(name$1,requestTransform$1,responseTransform$1),name$2=alexaConstants.ConnectedHome.Request.SetTargetTemperature,requestTransform$2=function(e){var n=e.payload,t=void 0===n?{}:n,r=t.appliance,o=void 0===r?{}:r,a=t.targetTemperature,s=void 0===a?{}:a;return[o.applianceId,s.value,t]},responseTransform$2=function(e){return Promise$1.resolve(e).then(function(e){return{header:{messageId:UUID.v4(),name:alexaConstants.ConnectedHome.Confirmation.SetTargetTemperature,namespace:alexaConstants.ConnectedHome.Control,payloadVersion:"2"},payload:_extends({},e.current,{previousState:_extends({},e.previous)})}})},SetTargetTemperature=ControlRequest(name$2,requestTransform$2,responseTransform$2),name$3=alexaConstants.ConnectedHome.Request.IncrementTargetTemperature,requestTransform$3=function(e){var n=e.payload,t=void 0===n?{}:n,r=t.appliance,o=void 0===r?{}:r,a=t.deltaTemperature,s=void 0===a?{}:a;return[o.applianceId,s.value,t]},responseTransform$3=function(e){return Promise$1.resolve(e).then(function(e){return{header:{messageId:UUID.v4(),name:alexaConstants.ConnectedHome.Confirmation.IncrementTargetTemperature,namespace:alexaConstants.ConnectedHome.Control,payloadVersion:"2"},payload:_extends({},e.current,{previousState:_extends({},e.previous)})}})},IncrementTargetTemperature=ControlRequest(name$3,requestTransform$3,responseTransform$3),name$4=alexaConstants.ConnectedHome.Request.DecrementTargetTemperature,requestTransform$4=function(e){var n=e.payload,t=void 0===n?{}:n,r=t.appliance,o=void 0===r?{}:r,a=t.deltaTemperature,s=void 0===a?{}:a;return[o.applianceId,s.value,t]},responseTransform$4=function(e){return Promise$1.resolve(e).then(function(e){return{header:{messageId:UUID.v4(),name:alexaConstants.ConnectedHome.Confirmation.DecrementTargetTemperature,namespace:alexaConstants.ConnectedHome.Control,payloadVersion:"2"},payload:_extends({},e.current,{previousState:_extends({},e.previous)})}})},DecrementTargetTemperature=ControlRequest(name$4,requestTransform$4,responseTransform$4),name$5=alexaConstants.ConnectedHome.Request.SetPercentage,requestTransform$5=function(e){var n=e.payload,t=void 0===n?{}:n,r=t.appliance,o=void 0===r?{}:r,a=t.percentageState,s=void 0===a?{}:a;return[o.applianceId,s.value,t]},responseTransform$5=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:UUID.v4(),name:alexaConstants.ConnectedHome.Confirmation.SetPercentage,namespace:alexaConstants.ConnectedHome.Control,payloadVersion:"2"},payload:{}}})},SetPercentage=ControlRequest(name$5,requestTransform$5,responseTransform$5),name$6=alexaConstants.ConnectedHome.Request.IncrementPercentage,requestTransform$6=function(e){var n=e.payload,t=void 0===n?{}:n,r=t.appliance,o=void 0===r?{}:r,a=t.deltaPercentage,s=void 0===a?{}:a;return[o.applianceId,s.value,t]},responseTransform$6=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:UUID.v4(),name:alexaConstants.ConnectedHome.Confirmation.IncrementPercentage,namespace:alexaConstants.ConnectedHome.Control,payloadVersion:"2"},payload:{}}})},IncrementPercentage=ControlRequest(name$6,requestTransform$6,responseTransform$6),name$7=alexaConstants.ConnectedHome.Request.DecrementPercentage,requestTransform$7=function(e){var n=e.payload,t=void 0===n?{}:n,r=t.appliance,o=void 0===r?{}:r,a=t.deltaPercentage,s=void 0===a?{}:a;return[o.applianceId,s.value,t]},responseTransform$7=function(e){return Promise$1.resolve(e).then(function(){return{header:{messageId:UUID.v4(),name:alexaConstants.ConnectedHome.Confirmation.DecrementPercentage,namespace:alexaConstants.ConnectedHome.Control,payloadVersion:"2"},payload:{}}})},DecrementPercentage=ControlRequest(name$7,requestTransform$7,responseTransform$7);exports.Skill=Skill$1,exports.annotation=annotation,exports.ErrorCode=ErrorCodes,exports.Launch=Launch,exports.Intent=Intent,exports.SessionEnded=SessionEnded,exports.Discovery=Discovery,exports.Control=Control,exports.TurnOn=TurnOn,exports.TurnOff=TurnOff,exports.SetTargetTemperature=SetTargetTemperature,exports.IncrementTargetTemperature=IncrementTargetTemperature,exports.DecrementTargetTemperature=DecrementTargetTemperature,exports.SetPercentage=SetPercentage,exports.IncrementPercentage=IncrementPercentage,exports.DecrementPercentage=DecrementPercentage; |
@@ -9,3 +9,3 @@ { | ||
"description": "Create Alexa skills for the Amazon Echo, easily.", | ||
"version": "8.1.1", | ||
"version": "9.0.0", | ||
"main": "build/index.min.js", | ||
@@ -20,6 +20,8 @@ "license": "MIT", | ||
"bluebird": "^3.3.4", | ||
"object-values": "^1.0.0" | ||
"object-values": "^1.0.0", | ||
"uuid": "^2.0.3", | ||
"alexa-constants": "^0.3.0" | ||
}, | ||
"devDependencies": { | ||
"alexa-request": "^0.1.1" | ||
"alexa-request": "^0.2.0" | ||
}, | ||
@@ -26,0 +28,0 @@ "keywords": [ |
import annotation from '../annotation'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
@@ -6,3 +7,3 @@ const isControlRequest = (...names) => (event = {}) => { | ||
const { namespace, name } = header; | ||
return namespace === 'Alexa.ConnectedHome.Control' && (!names.length || names.indexOf(name) >= 0); | ||
return namespace === ConnectedHome.Control && (!names.length || names.indexOf(name) >= 0); | ||
}; | ||
@@ -9,0 +10,0 @@ |
import { ControlRequest } from './Control'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
import UUID from 'uuid'; | ||
const name = 'DecrementPercentageRequest'; | ||
const name = ConnectedHome.Request.DecrementPercentage; | ||
@@ -12,5 +14,5 @@ const requestTransform = ({ payload = {} }) => { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'DecrementPercentageConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: ConnectedHome.Confirmation.DecrementPercentage, | ||
namespace: ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -17,0 +19,0 @@ }, |
import { ControlRequest } from './Control'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
import UUID from 'uuid'; | ||
const name = 'DecrementTargetTemperatureRequest'; | ||
const name = ConnectedHome.Request.DecrementTargetTemperature; | ||
@@ -12,5 +14,5 @@ const requestTransform = ({ payload = {} }) => { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'DecrementTargetTemperatureConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: ConnectedHome.Confirmation.DecrementTargetTemperature, | ||
namespace: ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -17,0 +19,0 @@ }, |
import annotation from '../annotation'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
export default annotation(({ header = {} }) => { | ||
const { namespace, name } = header; | ||
return namespace === 'Alexa.ConnectedHome.Discovery' && name === 'DiscoverAppliancesRequest'; | ||
return namespace === ConnectedHome.Discovery && name === ConnectedHome.Request.DiscoverAppliances; | ||
}); |
import { ControlRequest } from './Control'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
import UUID from 'uuid'; | ||
const name = 'IncrementPercentageRequest'; | ||
const name = ConnectedHome.Request.IncrementPercentage; | ||
@@ -12,5 +14,5 @@ const requestTransform = ({ payload = {} }) => { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'IncrementPercentageConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: ConnectedHome.Confirmation.IncrementPercentage, | ||
namespace: ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -17,0 +19,0 @@ }, |
import { ControlRequest } from './Control'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
import UUID from 'uuid'; | ||
const name = 'IncrementTargetTemperatureRequest'; | ||
const name = ConnectedHome.Request.IncrementTargetTemperature; | ||
@@ -12,5 +14,5 @@ const requestTransform = ({ payload = {} }) => { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'IncrementTargetTemperatureConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: ConnectedHome.Confirmation.IncrementTargetTemperature, | ||
namespace: ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -17,0 +19,0 @@ }, |
import { ControlRequest } from './Control'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
import UUID from 'uuid'; | ||
const name = 'SetPercentageRequest'; | ||
const name = ConnectedHome.Request.SetPercentage; | ||
@@ -12,5 +14,5 @@ const requestTransform = ({ payload = {} }) => { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'SetPercentageConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: ConnectedHome.Confirmation.SetPercentage, | ||
namespace: ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -17,0 +19,0 @@ }, |
import { ControlRequest } from './Control'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
import UUID from 'uuid'; | ||
const name = 'SetTargetTemperatureRequest'; | ||
const name = ConnectedHome.Request.SetTargetTemperature; | ||
@@ -12,5 +14,5 @@ const requestTransform = ({ payload = {} }) => { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'SetTargetTemperatureConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: ConnectedHome.Confirmation.SetTargetTemperature, | ||
namespace: ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -17,0 +19,0 @@ }, |
import { ControlRequest } from './Control'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
import UUID from 'uuid'; | ||
const name = 'TurnOffRequest'; | ||
const name = ConnectedHome.Request.TurnOff; | ||
@@ -12,5 +14,5 @@ const requestTransform = ({ payload = {} }) => { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'TurnOffConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: ConnectedHome.Confirmation.TurnOff, | ||
namespace: ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -17,0 +19,0 @@ }, |
import { ControlRequest } from './Control'; | ||
import { ConnectedHome } from 'alexa-constants'; | ||
import UUID from 'uuid'; | ||
const name = 'TurnOnRequest'; | ||
const name = ConnectedHome.Request.TurnOn; | ||
@@ -12,5 +14,5 @@ const requestTransform = ({ payload = {} }) => { | ||
header: { | ||
messageId: '26fa11a8-accb-4f66-a272-8b1ff7abd722', | ||
name: 'TurnOnConfirmation', | ||
namespace: 'Alexa.ConnectedHome.Control', | ||
messageId: UUID.v4(), | ||
name: ConnectedHome.Confirmation.TurnOn, | ||
namespace: ConnectedHome.Control, | ||
payloadVersion: '2' | ||
@@ -17,0 +19,0 @@ }, |
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
45913
858
4
+ Addedalexa-constants@^0.3.0
+ Addeduuid@^2.0.3
+ Addedalexa-constants@0.3.1(transitive)
+ Addeduuid@2.0.3(transitive)