alexa-annotations
Advanced tools
Comparing version 9.1.3 to 9.1.4
@@ -26,12 +26,5 @@ 'use strict'; | ||
const Skill = options => Skill => (event, context, callback) => { | ||
var _ref = event || {}; | ||
const { session } = event || {}; | ||
const { application, attributes } = session || {}; | ||
const session = _ref.session; | ||
var _ref2 = session || {}; | ||
const application = _ref2.application, | ||
attributes = _ref2.attributes; | ||
return isAuthorized(options, application).then(() => { | ||
@@ -92,15 +85,11 @@ return new Skill(session).route(event) || Promise.reject(NotFound); | ||
const values = (obj = {}) => Object.keys(obj).map(key => obj[key]); | ||
var Intent = ((...names) => annotation(({ request = {} }) => { | ||
const type = request.type; | ||
var _request$intent = request.intent; | ||
const intent = _request$intent === undefined ? {} : _request$intent; | ||
const { type, intent = {} } = request; | ||
return type === 'IntentRequest' && names.indexOf(intent.name) >= 0; | ||
}, ({ request = {} }) => { | ||
var _request$intent2 = request.intent; | ||
const intent = _request$intent2 === undefined ? {} : _request$intent2; | ||
var _intent$slots = intent.slots; | ||
const slots = _intent$slots === undefined ? {} : _intent$slots; | ||
return Object.values(slots).reduce((state, { name, value }) => { | ||
const { intent = {} } = request; | ||
const { slots = {} } = intent; | ||
return values(slots).reduce((state, { name, value }) => { | ||
return name && value != null ? _extends({}, state, { [name]: value }) : state; | ||
@@ -113,5 +102,3 @@ }, {}); | ||
var Discovery = annotation(({ header = {} }) => { | ||
const namespace = header.namespace, | ||
name = header.name; | ||
const { namespace, name } = header; | ||
return namespace === alexaConstants.ConnectedHome.Discovery && name === alexaConstants.ConnectedHome.Request.DiscoverAppliances; | ||
@@ -121,7 +108,4 @@ }); | ||
const isControlRequest = (...names) => (event = {}) => { | ||
var _event$header = event.header; | ||
const header = _event$header === undefined ? {} : _event$header; | ||
const namespace = header.namespace, | ||
name = header.name; | ||
const { header = {} } = event; | ||
const { namespace, name } = header; | ||
return namespace === alexaConstants.ConnectedHome.Control && (!names.length || names.indexOf(name) >= 0); | ||
@@ -133,5 +117,3 @@ }; | ||
var Control = ((...names) => annotation(isControlRequest(...names), ({ header = {}, payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
const { appliance = {} } = payload; | ||
return [appliance.applianceId, header.name, payload]; | ||
@@ -143,5 +125,3 @@ })); | ||
const requestTransform = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
const { appliance = {} } = payload; | ||
return [appliance.applianceId, payload]; | ||
@@ -165,5 +145,3 @@ }; | ||
const requestTransform$1 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
const { appliance = {} } = payload; | ||
return [appliance.applianceId, payload]; | ||
@@ -189,7 +167,3 @@ }; | ||
const requestTransform$2 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$targetTemper = payload.targetTemperature; | ||
const targetTemperature = _payload$targetTemper === undefined ? {} : _payload$targetTemper; | ||
const { appliance = {}, targetTemperature = {} } = payload; | ||
return [appliance.applianceId, targetTemperature.value, payload]; | ||
@@ -217,7 +191,3 @@ }; | ||
const requestTransform$3 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$deltaTempera = payload.deltaTemperature; | ||
const deltaTemperature = _payload$deltaTempera === undefined ? {} : _payload$deltaTempera; | ||
const { appliance = {}, deltaTemperature = {} } = payload; | ||
return [appliance.applianceId, deltaTemperature.value, payload]; | ||
@@ -245,7 +215,3 @@ }; | ||
const requestTransform$4 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$deltaTempera = payload.deltaTemperature; | ||
const deltaTemperature = _payload$deltaTempera === undefined ? {} : _payload$deltaTempera; | ||
const { appliance = {}, deltaTemperature = {} } = payload; | ||
return [appliance.applianceId, deltaTemperature.value, payload]; | ||
@@ -271,7 +237,3 @@ }; | ||
const requestTransform$5 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$percentageSt = payload.percentageState; | ||
const percentageState = _payload$percentageSt === undefined ? {} : _payload$percentageSt; | ||
const { appliance = {}, percentageState = {} } = payload; | ||
return [appliance.applianceId, percentageState.value, payload]; | ||
@@ -295,7 +257,3 @@ }; | ||
const requestTransform$6 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$deltaPercent = payload.deltaPercentage; | ||
const deltaPercentage = _payload$deltaPercent === undefined ? {} : _payload$deltaPercent; | ||
const { appliance = {}, deltaPercentage = {} } = payload; | ||
return [appliance.applianceId, deltaPercentage.value, payload]; | ||
@@ -319,7 +277,3 @@ }; | ||
const requestTransform$7 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$deltaPercent = payload.deltaPercentage; | ||
const deltaPercentage = _payload$deltaPercent === undefined ? {} : _payload$deltaPercent; | ||
const { appliance = {}, deltaPercentage = {} } = payload; | ||
return [appliance.applianceId, deltaPercentage.value, payload]; | ||
@@ -326,0 +280,0 @@ }; |
@@ -26,12 +26,5 @@ 'use strict'; | ||
const Skill = options => Skill => (event, context, callback) => { | ||
var _ref = event || {}; | ||
const { session } = event || {}; | ||
const { application, attributes } = session || {}; | ||
const session = _ref.session; | ||
var _ref2 = session || {}; | ||
const application = _ref2.application, | ||
attributes = _ref2.attributes; | ||
return isAuthorized(options, application).then(() => { | ||
@@ -92,15 +85,11 @@ return new Skill(session).route(event) || Promise.reject(NotFound); | ||
const values = (obj = {}) => Object.keys(obj).map(key => obj[key]); | ||
var Intent = ((...names) => annotation(({ request = {} }) => { | ||
const type = request.type; | ||
var _request$intent = request.intent; | ||
const intent = _request$intent === undefined ? {} : _request$intent; | ||
const { type, intent = {} } = request; | ||
return type === 'IntentRequest' && names.indexOf(intent.name) >= 0; | ||
}, ({ request = {} }) => { | ||
var _request$intent2 = request.intent; | ||
const intent = _request$intent2 === undefined ? {} : _request$intent2; | ||
var _intent$slots = intent.slots; | ||
const slots = _intent$slots === undefined ? {} : _intent$slots; | ||
return Object.values(slots).reduce((state, { name, value }) => { | ||
const { intent = {} } = request; | ||
const { slots = {} } = intent; | ||
return values(slots).reduce((state, { name, value }) => { | ||
return name && value != null ? _extends({}, state, { [name]: value }) : state; | ||
@@ -113,5 +102,3 @@ }, {}); | ||
var Discovery = annotation(({ header = {} }) => { | ||
const namespace = header.namespace, | ||
name = header.name; | ||
const { namespace, name } = header; | ||
return namespace === alexaConstants.ConnectedHome.Discovery && name === alexaConstants.ConnectedHome.Request.DiscoverAppliances; | ||
@@ -121,7 +108,4 @@ }); | ||
const isControlRequest = (...names) => (event = {}) => { | ||
var _event$header = event.header; | ||
const header = _event$header === undefined ? {} : _event$header; | ||
const namespace = header.namespace, | ||
name = header.name; | ||
const { header = {} } = event; | ||
const { namespace, name } = header; | ||
return namespace === alexaConstants.ConnectedHome.Control && (!names.length || names.indexOf(name) >= 0); | ||
@@ -133,5 +117,3 @@ }; | ||
var Control = ((...names) => annotation(isControlRequest(...names), ({ header = {}, payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
const { appliance = {} } = payload; | ||
return [appliance.applianceId, header.name, payload]; | ||
@@ -143,5 +125,3 @@ })); | ||
const requestTransform = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
const { appliance = {} } = payload; | ||
return [appliance.applianceId, payload]; | ||
@@ -165,5 +145,3 @@ }; | ||
const requestTransform$1 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
const { appliance = {} } = payload; | ||
return [appliance.applianceId, payload]; | ||
@@ -189,7 +167,3 @@ }; | ||
const requestTransform$2 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$targetTemper = payload.targetTemperature; | ||
const targetTemperature = _payload$targetTemper === undefined ? {} : _payload$targetTemper; | ||
const { appliance = {}, targetTemperature = {} } = payload; | ||
return [appliance.applianceId, targetTemperature.value, payload]; | ||
@@ -217,7 +191,3 @@ }; | ||
const requestTransform$3 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$deltaTempera = payload.deltaTemperature; | ||
const deltaTemperature = _payload$deltaTempera === undefined ? {} : _payload$deltaTempera; | ||
const { appliance = {}, deltaTemperature = {} } = payload; | ||
return [appliance.applianceId, deltaTemperature.value, payload]; | ||
@@ -245,7 +215,3 @@ }; | ||
const requestTransform$4 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$deltaTempera = payload.deltaTemperature; | ||
const deltaTemperature = _payload$deltaTempera === undefined ? {} : _payload$deltaTempera; | ||
const { appliance = {}, deltaTemperature = {} } = payload; | ||
return [appliance.applianceId, deltaTemperature.value, payload]; | ||
@@ -271,7 +237,3 @@ }; | ||
const requestTransform$5 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$percentageSt = payload.percentageState; | ||
const percentageState = _payload$percentageSt === undefined ? {} : _payload$percentageSt; | ||
const { appliance = {}, percentageState = {} } = payload; | ||
return [appliance.applianceId, percentageState.value, payload]; | ||
@@ -295,7 +257,3 @@ }; | ||
const requestTransform$6 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$deltaPercent = payload.deltaPercentage; | ||
const deltaPercentage = _payload$deltaPercent === undefined ? {} : _payload$deltaPercent; | ||
const { appliance = {}, deltaPercentage = {} } = payload; | ||
return [appliance.applianceId, deltaPercentage.value, payload]; | ||
@@ -319,7 +277,3 @@ }; | ||
const requestTransform$7 = ({ payload = {} }) => { | ||
var _payload$appliance = payload.appliance; | ||
const appliance = _payload$appliance === undefined ? {} : _payload$appliance; | ||
var _payload$deltaPercent = payload.deltaPercentage; | ||
const deltaPercentage = _payload$deltaPercent === undefined ? {} : _payload$deltaPercent; | ||
const { appliance = {}, deltaPercentage = {} } = payload; | ||
return [appliance.applianceId, deltaPercentage.value, payload]; | ||
@@ -326,0 +280,0 @@ }; |
{ | ||
"name": "alexa-annotations", | ||
"description": "Create Alexa skills for the Amazon Echo, easily.", | ||
"version": "9.1.3", | ||
"version": "9.1.4", | ||
"repository": "https://github.com/cameronhunter/alexa/tree/master/packages/alexa-annotations", | ||
@@ -6,0 +6,0 @@ "author": { |
import annotation from '../annotation'; | ||
const values = (obj = {}) => Object.keys(obj).map((key) => obj[key]); | ||
export default (...names) => annotation( | ||
@@ -12,3 +14,3 @@ ({ request = {} }) => { | ||
const { slots = {} } = intent; | ||
return Object.values(slots).reduce((state, { name, value }) => { | ||
return values(slots).reduce((state, { name, value }) => { | ||
return (name && value != null) ? { ...state, [name]: value } : state; | ||
@@ -15,0 +17,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
37759
761