Huge News!Announcing our $40M Series B led by Abstract Ventures.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 9.0.1 to 9.1.1

720

build/index.js

@@ -7,10 +7,8 @@ 'use strict';

var Promise$1 = _interopDefault(require('bluebird'));
var $inject_Object_values = _interopDefault(require('object-values'));
var alexaConstants = require('alexa-constants');
var UUID = _interopDefault(require('uuid'));
var Unauthorized = { code: 401, message: 'Unauthorized application ID' };
var NotFound = { code: 404, message: 'Route not found' };
var InternalServer = { code: 500, message: 'Internal skill error' };
const Unauthorized = { code: 401, message: 'Unauthorized application ID' };
const NotFound = { code: 404, message: 'Route not found' };
const InternalServer = { code: 500, message: 'Internal skill error' };

@@ -23,45 +21,35 @@ var ErrorCodes = Object.freeze({

var isAuthorized = (function () {
var expected = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var actual = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return new Promise$1(function (resolve, reject) {
var isOK = !expected.applicationId || expected.applicationId === actual.applicationId;
return isOK ? resolve() : reject(Unauthorized);
});
});
var isAuthorized = ((expected = {}, actual = {}) => new Promise((resolve, reject) => {
const isOK = !expected.applicationId || expected.applicationId === actual.applicationId;
return isOK ? resolve() : reject(Unauthorized);
}));
var Skill = function Skill(options) {
return function (Skill) {
return function (event, context, callback) {
var _ref = event || {};
const Skill = options => Skill => (event, context, callback) => {
var _ref = event || {};
var session = _ref.session;
const session = _ref.session;
var _ref2 = session || {};
var _ref2 = session || {};
var application = _ref2.application;
var attributes = _ref2.attributes;
const application = _ref2.application,
attributes = _ref2.attributes;
return isAuthorized(options, application).then(function () {
return new Skill(session).route(event) || Promise$1.reject(NotFound);
}).then(function (response) {
return typeof response.build === 'function' ? response.build(attributes) : response;
}).then(function (response) {
callback && callback(null, response);
return response;
}).catch(function () {
var error = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : InternalServer;
return isAuthorized(options, application).then(() => {
return new Skill(session).route(event) || Promise.reject(NotFound);
}).then(response => {
return typeof response.build === 'function' ? response.build(attributes) : response;
}).then(response => {
callback && callback(null, response);
return response;
}).catch((error = InternalServer) => {
callback && callback(error);
return error;
}).then(response => {
if (options.logging !== false) {
console.log(`[${Skill.name}]`, JSON.stringify({ event, response }));
}
callback && callback(error);
return error;
}).then(function (response) {
if (options.logging !== false) {
console.log('[' + Skill.name + ']', JSON.stringify({ event: event, response: response }));
}
return response;
});
};
};
return response;
});
};

@@ -77,373 +65,79 @@

var Skill$1 = (function () {
var optionsOrClass = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var Skill$1 = ((optionsOrClass = {}) => {
const isClass = typeof optionsOrClass === 'function';
const options = isClass ? {} : optionsOrClass;
const handler = Skill(options);
var isClass = typeof optionsOrClass === 'function';
var options = isClass ? {} : optionsOrClass;
var handler = Skill(options);
return isClass ? handler(optionsOrClass) : handler;
});
var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
var annotation = ((predicate, requestTransform, responseTransform = i => i) => (skill, name) => {
const route = skill.route || (() => false);
function AsyncGenerator(gen) {
var front, back;
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}
function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
}
} catch (err) {
settle("throw", err);
}
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}
this._invoke = send;
if (typeof gen.return !== "function") {
this.return = undefined;
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
skill.route = function (event = {}) {
return route.call(this, event) || predicate(event) && responseTransform(skill[name].apply(this, getArgs(requestTransform, event)));
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
}
};
}();
var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
var set = function set(object, property, value, receiver) {
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent !== null) {
set(parent, property, value, receiver);
}
} else if ("value" in desc && desc.writable) {
desc.value = value;
} else {
var setter = desc.set;
if (setter !== undefined) {
setter.call(receiver, value);
}
}
return value;
};
var toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
var annotation = (function (predicate, requestTransform) {
var responseTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (i) {
return i;
};
return function (skill, name) {
var route = skill.route || function () {
return false;
};
skill.route = function () {
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return route.call(this, event) || predicate(event) && responseTransform(skill[name].apply(this, getArgs(requestTransform, event)));
};
return skill;
};
return skill;
});
function getArgs(transform, event) {
var transformed = transform ? transform(event) : [];
var args = Array.isArray(transformed) ? transformed : [transformed];
return [].concat(toConsumableArray(args), [event]);
const transformed = transform ? transform(event) : [];
const args = Array.isArray(transformed) ? transformed : [transformed];
return [...args, event];
}
var Launch = annotation(function (_ref) {
var _ref$request = _ref.request;
var request = _ref$request === undefined ? {} : _ref$request;
return request.type === 'LaunchRequest';
});
var Launch = annotation(({ request = {} }) => request.type === 'LaunchRequest');
var Intent = (function () {
for (var _len = arguments.length, names = Array(_len), _key = 0; _key < _len; _key++) {
names[_key] = arguments[_key];
}
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
return annotation(function (_ref) {
var _ref$request = _ref.request;
var request = _ref$request === undefined ? {} : _ref$request;
var type = request.type;
var _request$intent = request.intent;
var intent = _request$intent === undefined ? {} : _request$intent;
var Intent = ((...names) => annotation(({ request = {} }) => {
const type = request.type;
var _request$intent = request.intent;
const intent = _request$intent === undefined ? {} : _request$intent;
return type === 'IntentRequest' && names.indexOf(intent.name) >= 0;
}, function (_ref2) {
var _ref2$request = _ref2.request;
var request = _ref2$request === undefined ? {} : _ref2$request;
var _request$intent2 = request.intent;
var intent = _request$intent2 === undefined ? {} : _request$intent2;
var _intent$slots = intent.slots;
var slots = _intent$slots === undefined ? {} : _intent$slots;
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 $inject_Object_values(slots).reduce(function (state, _ref3) {
var name = _ref3.name;
var value = _ref3.value;
return Object.values(slots).reduce((state, { name, value }) => {
return name && value != null ? _extends({}, state, { [name]: value }) : state;
}, {});
}));
return name && value != null ? _extends({}, state, defineProperty({}, name, value)) : state;
}, {});
});
});
var SessionEnded = annotation(({ request = {} }) => request.type === 'SessionEndedRequest');
var SessionEnded = annotation(function (_ref) {
var _ref$request = _ref.request;
var request = _ref$request === undefined ? {} : _ref$request;
return request.type === 'SessionEndedRequest';
});
var Discovery = annotation(({ header = {} }) => {
const namespace = header.namespace,
name = header.name;
var Discovery = annotation(function (_ref) {
var _ref$header = _ref.header;
var header = _ref$header === undefined ? {} : _ref$header;
var namespace = header.namespace;
var name = header.name;
return namespace === alexaConstants.ConnectedHome.Discovery && name === alexaConstants.ConnectedHome.Request.DiscoverAppliances;
});
var isControlRequest = function isControlRequest() {
for (var _len = arguments.length, names = Array(_len), _key = 0; _key < _len; _key++) {
names[_key] = arguments[_key];
}
const isControlRequest = (...names) => (event = {}) => {
var _event$header = event.header;
const header = _event$header === undefined ? {} : _event$header;
const namespace = header.namespace,
name = header.name;
return function () {
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var _event$header = event.header;
var header = _event$header === undefined ? {} : _event$header;
var namespace = header.namespace;
var name = header.name;
return namespace === alexaConstants.ConnectedHome.Control && (!names.length || names.indexOf(name) >= 0);
};
return namespace === alexaConstants.ConnectedHome.Control && (!names.length || names.indexOf(name) >= 0);
};
var ControlRequest = function ControlRequest(name, transform) {
return annotation(isControlRequest(name), transform || function (_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
return [payload];
});
};
const ControlRequest = (name, transform) => annotation(isControlRequest(name), transform || (({ payload = {} }) => [payload]));
var Control = (function () {
return annotation(isControlRequest.apply(undefined, arguments), function (_ref2) {
var _ref2$header = _ref2.header;
var header = _ref2$header === undefined ? {} : _ref2$header;
var _ref2$payload = _ref2.payload;
var payload = _ref2$payload === undefined ? {} : _ref2$payload;
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
var Control = ((...names) => annotation(isControlRequest(...names), ({ header = {}, payload = {} }) => {
var _payload$appliance = payload.appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
return [appliance.applianceId, header.name, payload];
});
});
return [appliance.applianceId, header.name, payload];
}));
var name = alexaConstants.ConnectedHome.Request.TurnOn;
const name = alexaConstants.ConnectedHome.Request.TurnOn;
var requestTransform = function requestTransform(_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
const requestTransform = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;

@@ -453,25 +147,19 @@ return [appliance.applianceId, payload];

var responseTransform = function responseTransform(response) {
return Promise$1.resolve(response).then(function () {
return {
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.TurnOn,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
};
});
};
const responseTransform = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.TurnOn,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var TurnOn = ControlRequest(name, requestTransform, responseTransform);
var name$1 = alexaConstants.ConnectedHome.Request.TurnOff;
const name$1 = alexaConstants.ConnectedHome.Request.TurnOff;
var requestTransform$1 = function requestTransform$1(_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
const requestTransform$1 = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;

@@ -481,27 +169,23 @@ return [appliance.applianceId, payload];

var responseTransform$1 = function responseTransform$1(response) {
return Promise$1.resolve(response).then(function () {
return {
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.TurnOff,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
};
});
};
const responseTransform$1 = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.TurnOff,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var TurnOff = ControlRequest(name$1, requestTransform$1, responseTransform$1);
var name$2 = alexaConstants.ConnectedHome.Request.SetTargetTemperature;
var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var requestTransform$2 = function requestTransform$2(_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
const name$2 = alexaConstants.ConnectedHome.Request.SetTargetTemperature;
const requestTransform$2 = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
var _payload$targetTemper = payload.targetTemperature;
var targetTemperature = _payload$targetTemper === undefined ? {} : _payload$targetTemper;
const targetTemperature = _payload$targetTemper === undefined ? {} : _payload$targetTemper;

@@ -511,29 +195,25 @@ return [appliance.applianceId, targetTemperature.value, payload];

var responseTransform$2 = function responseTransform$2(response) {
return Promise$1.resolve(response).then(function (state) {
return {
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.SetTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends({}, state.current, {
previousState: _extends({}, state.previous)
})
};
});
};
const responseTransform$2 = response => Promise.resolve(response).then(state => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.SetTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends$1({}, state.current, {
previousState: _extends$1({}, state.previous)
})
}));
var SetTargetTemperature = ControlRequest(name$2, requestTransform$2, responseTransform$2);
var name$3 = alexaConstants.ConnectedHome.Request.IncrementTargetTemperature;
var _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var requestTransform$3 = function requestTransform$3(_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
const name$3 = alexaConstants.ConnectedHome.Request.IncrementTargetTemperature;
const requestTransform$3 = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
var _payload$deltaTempera = payload.deltaTemperature;
var deltaTemperature = _payload$deltaTempera === undefined ? {} : _payload$deltaTempera;
const deltaTemperature = _payload$deltaTempera === undefined ? {} : _payload$deltaTempera;

@@ -543,29 +223,25 @@ return [appliance.applianceId, deltaTemperature.value, payload];

var responseTransform$3 = function responseTransform$3(response) {
return Promise$1.resolve(response).then(function (state) {
return {
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.IncrementTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends({}, state.current, {
previousState: _extends({}, state.previous)
})
};
});
};
const responseTransform$3 = response => Promise.resolve(response).then(state => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.IncrementTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends$2({}, state.current, {
previousState: _extends$2({}, state.previous)
})
}));
var IncrementTargetTemperature = ControlRequest(name$3, requestTransform$3, responseTransform$3);
var name$4 = alexaConstants.ConnectedHome.Request.DecrementTargetTemperature;
var _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var requestTransform$4 = function requestTransform$4(_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
const name$4 = alexaConstants.ConnectedHome.Request.DecrementTargetTemperature;
const requestTransform$4 = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
var _payload$deltaTempera = payload.deltaTemperature;
var deltaTemperature = _payload$deltaTempera === undefined ? {} : _payload$deltaTempera;
const deltaTemperature = _payload$deltaTempera === undefined ? {} : _payload$deltaTempera;

@@ -575,29 +251,23 @@ return [appliance.applianceId, deltaTemperature.value, payload];

var responseTransform$4 = function responseTransform$4(response) {
return Promise$1.resolve(response).then(function (state) {
return {
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.DecrementTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends({}, state.current, {
previousState: _extends({}, state.previous)
})
};
});
};
const responseTransform$4 = response => Promise.resolve(response).then(state => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.DecrementTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends$3({}, state.current, {
previousState: _extends$3({}, state.previous)
})
}));
var DecrementTargetTemperature = ControlRequest(name$4, requestTransform$4, responseTransform$4);
var name$5 = alexaConstants.ConnectedHome.Request.SetPercentage;
const name$5 = alexaConstants.ConnectedHome.Request.SetPercentage;
var requestTransform$5 = function requestTransform$5(_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
const requestTransform$5 = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
var _payload$percentageSt = payload.percentageState;
var percentageState = _payload$percentageSt === undefined ? {} : _payload$percentageSt;
const percentageState = _payload$percentageSt === undefined ? {} : _payload$percentageSt;

@@ -607,27 +277,21 @@ return [appliance.applianceId, percentageState.value, payload];

var responseTransform$5 = function responseTransform$5(response) {
return Promise$1.resolve(response).then(function () {
return {
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.SetPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
};
});
};
const responseTransform$5 = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.SetPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var SetPercentage = ControlRequest(name$5, requestTransform$5, responseTransform$5);
var name$6 = alexaConstants.ConnectedHome.Request.IncrementPercentage;
const name$6 = alexaConstants.ConnectedHome.Request.IncrementPercentage;
var requestTransform$6 = function requestTransform$6(_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
const requestTransform$6 = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
var _payload$deltaPercent = payload.deltaPercentage;
var deltaPercentage = _payload$deltaPercent === undefined ? {} : _payload$deltaPercent;
const deltaPercentage = _payload$deltaPercent === undefined ? {} : _payload$deltaPercent;

@@ -637,27 +301,21 @@ return [appliance.applianceId, deltaPercentage.value, payload];

var responseTransform$6 = function responseTransform$6(response) {
return Promise$1.resolve(response).then(function () {
return {
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.IncrementPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
};
});
};
const responseTransform$6 = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.IncrementPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var IncrementPercentage = ControlRequest(name$6, requestTransform$6, responseTransform$6);
var name$7 = alexaConstants.ConnectedHome.Request.DecrementPercentage;
const name$7 = alexaConstants.ConnectedHome.Request.DecrementPercentage;
var requestTransform$7 = function requestTransform$7(_ref) {
var _ref$payload = _ref.payload;
var payload = _ref$payload === undefined ? {} : _ref$payload;
const requestTransform$7 = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
var appliance = _payload$appliance === undefined ? {} : _payload$appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
var _payload$deltaPercent = payload.deltaPercentage;
var deltaPercentage = _payload$deltaPercent === undefined ? {} : _payload$deltaPercent;
const deltaPercentage = _payload$deltaPercent === undefined ? {} : _payload$deltaPercent;

@@ -667,15 +325,11 @@ return [appliance.applianceId, deltaPercentage.value, payload];

var responseTransform$7 = function responseTransform$7(response) {
return Promise$1.resolve(response).then(function () {
return {
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.DecrementPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
};
});
};
const responseTransform$7 = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.DecrementPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));

@@ -682,0 +336,0 @@ var DecrementPercentage = ControlRequest(name$7, requestTransform$7, responseTransform$7);

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

"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;
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var alexaConstants = require('alexa-constants');
var UUID = _interopDefault(require('uuid'));
const Unauthorized = { code: 401, message: 'Unauthorized application ID' };
const NotFound = { code: 404, message: 'Route not found' };
const InternalServer = { code: 500, message: 'Internal skill error' };
var ErrorCodes = Object.freeze({
Unauthorized: Unauthorized,
NotFound: NotFound,
InternalServer: InternalServer
});
var isAuthorized = ((expected = {}, actual = {}) => new Promise((resolve, reject) => {
const isOK = !expected.applicationId || expected.applicationId === actual.applicationId;
return isOK ? resolve() : reject(Unauthorized);
}));
const Skill = options => Skill => (event, context, callback) => {
var _ref = event || {};
const session = _ref.session;
var _ref2 = session || {};
const application = _ref2.application,
attributes = _ref2.attributes;
return isAuthorized(options, application).then(() => {
return new Skill(session).route(event) || Promise.reject(NotFound);
}).then(response => {
return typeof response.build === 'function' ? response.build(attributes) : response;
}).then(response => {
callback && callback(null, response);
return response;
}).catch((error = InternalServer) => {
callback && callback(error);
return error;
}).then(response => {
if (options.logging !== false) {
console.log(`[${Skill.name}]`, JSON.stringify({ event, response }));
}
return response;
});
};
/*******************************************************************************
* This provides multiple ways of declaring an annotation, for example:
*
* 1. @Skill
* 2. @Skill()
* 3. @Skill({ applicationId: 'my-authorized-application-id' })
******************************************************************************/
var Skill$1 = ((optionsOrClass = {}) => {
const isClass = typeof optionsOrClass === 'function';
const options = isClass ? {} : optionsOrClass;
const handler = Skill(options);
return isClass ? handler(optionsOrClass) : handler;
});
var annotation = ((predicate, requestTransform, responseTransform = i => i) => (skill, name) => {
const route = skill.route || (() => false);
skill.route = function (event = {}) {
return route.call(this, event) || predicate(event) && responseTransform(skill[name].apply(this, getArgs(requestTransform, event)));
};
return skill;
});
function getArgs(transform, event) {
const transformed = transform ? transform(event) : [];
const args = Array.isArray(transformed) ? transformed : [transformed];
return [...args, event];
}
var Launch = annotation(({ request = {} }) => request.type === 'LaunchRequest');
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var Intent = ((...names) => annotation(({ request = {} }) => {
const type = request.type;
var _request$intent = request.intent;
const intent = _request$intent === undefined ? {} : _request$intent;
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 }) => {
return name && value != null ? _extends({}, state, { [name]: value }) : state;
}, {});
}));
var SessionEnded = annotation(({ request = {} }) => request.type === 'SessionEndedRequest');
var Discovery = annotation(({ header = {} }) => {
const namespace = header.namespace,
name = header.name;
return namespace === alexaConstants.ConnectedHome.Discovery && name === alexaConstants.ConnectedHome.Request.DiscoverAppliances;
});
const isControlRequest = (...names) => (event = {}) => {
var _event$header = event.header;
const header = _event$header === undefined ? {} : _event$header;
const namespace = header.namespace,
name = header.name;
return namespace === alexaConstants.ConnectedHome.Control && (!names.length || names.indexOf(name) >= 0);
};
const ControlRequest = (name, transform) => annotation(isControlRequest(name), transform || (({ payload = {} }) => [payload]));
var Control = ((...names) => annotation(isControlRequest(...names), ({ header = {}, payload = {} }) => {
var _payload$appliance = payload.appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
return [appliance.applianceId, header.name, payload];
}));
const name = alexaConstants.ConnectedHome.Request.TurnOn;
const requestTransform = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
return [appliance.applianceId, payload];
};
const responseTransform = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.TurnOn,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var TurnOn = ControlRequest(name, requestTransform, responseTransform);
const name$1 = alexaConstants.ConnectedHome.Request.TurnOff;
const requestTransform$1 = ({ payload = {} }) => {
var _payload$appliance = payload.appliance;
const appliance = _payload$appliance === undefined ? {} : _payload$appliance;
return [appliance.applianceId, payload];
};
const responseTransform$1 = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.TurnOff,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var TurnOff = ControlRequest(name$1, requestTransform$1, responseTransform$1);
var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const name$2 = alexaConstants.ConnectedHome.Request.SetTargetTemperature;
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;
return [appliance.applianceId, targetTemperature.value, payload];
};
const responseTransform$2 = response => Promise.resolve(response).then(state => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.SetTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends$1({}, state.current, {
previousState: _extends$1({}, state.previous)
})
}));
var SetTargetTemperature = ControlRequest(name$2, requestTransform$2, responseTransform$2);
var _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const name$3 = alexaConstants.ConnectedHome.Request.IncrementTargetTemperature;
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;
return [appliance.applianceId, deltaTemperature.value, payload];
};
const responseTransform$3 = response => Promise.resolve(response).then(state => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.IncrementTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends$2({}, state.current, {
previousState: _extends$2({}, state.previous)
})
}));
var IncrementTargetTemperature = ControlRequest(name$3, requestTransform$3, responseTransform$3);
var _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const name$4 = alexaConstants.ConnectedHome.Request.DecrementTargetTemperature;
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;
return [appliance.applianceId, deltaTemperature.value, payload];
};
const responseTransform$4 = response => Promise.resolve(response).then(state => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.DecrementTargetTemperature,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: _extends$3({}, state.current, {
previousState: _extends$3({}, state.previous)
})
}));
var DecrementTargetTemperature = ControlRequest(name$4, requestTransform$4, responseTransform$4);
const name$5 = alexaConstants.ConnectedHome.Request.SetPercentage;
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;
return [appliance.applianceId, percentageState.value, payload];
};
const responseTransform$5 = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.SetPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var SetPercentage = ControlRequest(name$5, requestTransform$5, responseTransform$5);
const name$6 = alexaConstants.ConnectedHome.Request.IncrementPercentage;
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;
return [appliance.applianceId, deltaPercentage.value, payload];
};
const responseTransform$6 = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.IncrementPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var IncrementPercentage = ControlRequest(name$6, requestTransform$6, responseTransform$6);
const name$7 = alexaConstants.ConnectedHome.Request.DecrementPercentage;
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;
return [appliance.applianceId, deltaPercentage.value, payload];
};
const responseTransform$7 = response => Promise.resolve(response).then(() => ({
header: {
messageId: UUID.v4(),
name: alexaConstants.ConnectedHome.Confirmation.DecrementPercentage,
namespace: alexaConstants.ConnectedHome.Control,
payloadVersion: '2'
},
payload: {}
}));
var DecrementPercentage = ControlRequest(name$7, requestTransform$7, responseTransform$7);
/*******************************************************************************
* Alexa Custom Skill Intents
******************************************************************************/
/*******************************************************************************
* Alexa Smart Home Skill Intents
******************************************************************************/
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;
{
"name": "alexa-annotations",
"description": "Create Alexa skills for the Amazon Echo, easily.",
"version": "9.1.1",
"repository": "https://github.com/cameronhunter/alexa/tree/master/packages/alexa-annotations",
"author": {

@@ -7,8 +11,4 @@ "name": "Cameron Hunter",

},
"name": "alexa-annotations",
"description": "Create Alexa skills for the Amazon Echo, easily.",
"version": "9.0.1",
"main": "build/index.min.js",
"license": "MIT",
"repository": "cameronhunter/alexa",
"files": [

@@ -22,6 +22,6 @@ "build",

"uuid": "^2.0.3",
"alexa-constants": "^0.3.1"
"alexa-constants": "^0.4.1"
},
"devDependencies": {
"alexa-request": "^0.2.1"
"alexa-request": "^0.3.1"
},

@@ -28,0 +28,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc