From 3818cea8018cc217d7af191bb79d361aca14590b Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 28 Jan 2019 09:25:32 +0100 Subject: [PATCH 01/15] Add prettier, husky and lint-staged --- package.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/package.json b/package.json index 88c4a03a..296f6ce5 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "iotagent-json", + "license": "AGPL-3.0-only", "description": "IoT Agent for the JSON protocol", "version": "1.9.0-next", "homepage": "https://github.com/telefonicaid/iotagent-json", @@ -23,16 +24,20 @@ "test": "mocha --recursive 'test/**/*.js' --reporter spec --timeout 3000 --ui bdd --exit", "test:watch": "npm run test -- -w ./lib", "lint": "jshint lib/ --config .jshintrc && jshint test/ --config test/.jshintrc", + "prettier": "prettier --single-quote --trailing-comma es5 --write **/*.js *.js", "test:coverage": "istanbul cover _mocha -- --recursive 'test/**/*.js' --reporter spec --exit", "test:coveralls": "npm run test:coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", "watch": "watch 'npm test && npm run lint' ./lib ./test" }, "devDependencies": { "coveralls": "~3.0.2", + "husky": "^1.1.0", + "lint-staged": "^7.3.0", "nock": "10.0.1", "mocha": "5.2.0", "should": "13.2.3", "istanbul": "~0.4.5", + "prettier": "^1.14.2", "proxyquire": "2.1.0", "moment": "~2.22.2", "watch": "~1.0.2", @@ -50,5 +55,16 @@ "mqtt": "2.18.8", "request": "2.88.0", "underscore": "1.9.1" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.js": [ + "prettier --parser flow --single-quote --trailing-comma es5 --write", + "git add" + ] } } From 289d721f1262b699c7cb6ceb73e56af361d9ca82 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 28 Jan 2019 09:26:42 +0100 Subject: [PATCH 02/15] Run `npm run prettier` to format files - whitespace changes only. --- bin/iotaJsonTester.js | 210 +++++++++--------- client-config.js | 18 +- config.js | 296 +++++++++++++------------- index.js | 2 +- lib/commandHandler.js | 169 +++++++++------ lib/commonBindings.js | 334 ++++++++++++++++++----------- lib/configService.js | 293 +++++++++++++------------ lib/constants.js | 42 ++-- lib/errors.js | 120 ++++++----- lib/iotaUtils.js | 331 ++++++++++++++++++----------- lib/iotagent-json.js | 220 +++++++++++-------- lib/thinkingThingPlugin.js | 389 ++++++++++++++++++---------------- lib/timestampProcessPlugin.js | 74 ++++--- lib/transportSelector.js | 92 +++++--- test/config-startup.js | 58 ++--- test/config-test.js | 60 +++--- test/utils.js | 18 +- 17 files changed, 1530 insertions(+), 1196 deletions(-) diff --git a/bin/iotaJsonTester.js b/bin/iotaJsonTester.js index 3607bf01..f1a5f708 100755 --- a/bin/iotaJsonTester.js +++ b/bin/iotaJsonTester.js @@ -26,146 +26,154 @@ 'use strict'; var fs = require('fs'), - defaultConfig = require('../client-config.js'), - commandLine = require('iotagent-node-lib').commandLine, - clUtils = commandLine.clUtils, - mqtt = require('mqtt'), - async = require('async'), - _ = require('underscore'), - mqttClient, - configCb = { - host: 'localhost', - port: 1026, - service: 'tester', - subservice: '/test' - }, - configIot = { - host: 'localhost', - port: 4041, - name: 'default', - service: 'tester', - subservice: '/test' - }, - config = { - host: defaultConfig.mqtt.host, - port: defaultConfig.mqtt.port, - apikey: defaultConfig.device.apikey, - deviceId: defaultConfig.device.id - }, - separator = '\n\n\t', - token; + defaultConfig = require('../client-config.js'), + commandLine = require('iotagent-node-lib').commandLine, + clUtils = commandLine.clUtils, + mqtt = require('mqtt'), + async = require('async'), + _ = require('underscore'), + mqttClient, + configCb = { + host: 'localhost', + port: 1026, + service: 'tester', + subservice: '/test', + }, + configIot = { + host: 'localhost', + port: 4041, + name: 'default', + service: 'tester', + subservice: '/test', + }, + config = { + host: defaultConfig.mqtt.host, + port: defaultConfig.mqtt.port, + apikey: defaultConfig.device.apikey, + deviceId: defaultConfig.device.id, + }, + separator = '\n\n\t', + token; function setConfig(commands) { - config.host = commands[0]; - config.port = commands[1]; - config.apikey = commands[2]; - config.deviceId = commands[3]; + config.host = commands[0]; + config.port = commands[1]; + config.apikey = commands[2]; + config.deviceId = commands[3]; } function getConfig(commands) { - console.log('\nCurrent configuration:\n\n'); - console.log(JSON.stringify(config, null, 4)); - console.log('\n'); - clUtils.prompt(); + console.log('\nCurrent configuration:\n\n'); + console.log(JSON.stringify(config, null, 4)); + console.log('\n'); + clUtils.prompt(); } function mqttPublishHandler(error) { - if (error) { - console.log('There was an error publishing to the MQTT broker: %s', error); - } else { - console.log('Message successfully published'); - } + if (error) { + console.log('There was an error publishing to the MQTT broker: %s', error); + } else { + console.log('Message successfully published'); + } - clUtils.prompt(); + clUtils.prompt(); } function checkConnection(fn) { - return function(commands) { - if (mqttClient) { - fn(commands); - } else { - console.log('Please, check your configuration and connect before using MQTT commands.'); - } + return function(commands) { + if (mqttClient) { + fn(commands); + } else { + console.log( + 'Please, check your configuration and connect before using MQTT commands.' + ); } + }; } function singleMeasure(commands) { - var topic = '/' + config.apikey + '/' + config.deviceId + '/attributes/' + commands[0]; + var topic = + '/' + config.apikey + '/' + config.deviceId + '/attributes/' + commands[0]; - mqttClient.publish(topic, commands[1], null, mqttPublishHandler); + mqttClient.publish(topic, commands[1], null, mqttPublishHandler); } function parseMultipleAttributes(attributeString) { - var result, - attributes, - attribute; + var result, attributes, attribute; - if (!attributeString) { - result = null; - } else { - attributes = attributeString.split(';'); - result = {}; + if (!attributeString) { + result = null; + } else { + attributes = attributeString.split(';'); + result = {}; - for (var i = 0; i < attributes.length; i++) { - attribute = attributes[i].split('='); - result[attribute[0]] = attribute[1]; - } + for (var i = 0; i < attributes.length; i++) { + attribute = attributes[i].split('='); + result[attribute[0]] = attribute[1]; } + } - return result; + return result; } function multipleMeasure(commands) { - var values = parseMultipleAttributes(commands[0]), - topic = '/' + config.apikey + '/' + config.deviceId + '/attributes'; + var values = parseMultipleAttributes(commands[0]), + topic = '/' + config.apikey + '/' + config.deviceId + '/attributes'; - mqttClient.publish(topic, JSON.stringify(values), null, mqttPublishHandler); + mqttClient.publish(topic, JSON.stringify(values), null, mqttPublishHandler); } function connect(commands) { - console.log('\nConnecting to MQTT Broker...'); + console.log('\nConnecting to MQTT Broker...'); - mqttClient = mqtt.connect('mqtt://' + config.host, defaultConfig.mqtt.options); + mqttClient = mqtt.connect( + 'mqtt://' + config.host, + defaultConfig.mqtt.options + ); - clUtils.prompt(); + clUtils.prompt(); } function exitClient() { - process.exit(0); + process.exit(0); } var commands = { - 'config': { - parameters: ['host', 'port', 'apiKey', 'deviceId'], - description: '\tConfigure the client to emulate the selected device, connecting to the given host.', - handler: setConfig - }, - 'showConfig': { - parameters: [], - description: '\tConfigure the client to emulate the selected device, connecting to the given host.', - handler: getConfig - }, - 'connect': { - parameters: [], - description: '\tConnect to the MQTT broker.', - handler: connect - }, - 'singleMeasure': { - parameters: ['attribute', 'value'], - description: '\tSend the given value for the selected attribute to the MQTT broker.', - handler: checkConnection(singleMeasure) - }, - 'multipleMeasure': { - parameters: ['attributes'], - description: '\tSend a collection of attributes to the MQTT broker, using JSON format. The "attributes"\n' + - '\tstring should have the following syntax: name=value[;name=value]*', - handler: checkConnection(multipleMeasure) - }, - 'exit': { - parameters: [], - description: '\tExit the client', - handler: exitClient - } + config: { + parameters: ['host', 'port', 'apiKey', 'deviceId'], + description: + '\tConfigure the client to emulate the selected device, connecting to the given host.', + handler: setConfig, + }, + showConfig: { + parameters: [], + description: + '\tConfigure the client to emulate the selected device, connecting to the given host.', + handler: getConfig, + }, + connect: { + parameters: [], + description: '\tConnect to the MQTT broker.', + handler: connect, + }, + singleMeasure: { + parameters: ['attribute', 'value'], + description: + '\tSend the given value for the selected attribute to the MQTT broker.', + handler: checkConnection(singleMeasure), + }, + multipleMeasure: { + parameters: ['attributes'], + description: + '\tSend a collection of attributes to the MQTT broker, using JSON format. The "attributes"\n' + + '\tstring should have the following syntax: name=value[;name=value]*', + handler: checkConnection(multipleMeasure), + }, + exit: { + parameters: [], + description: '\tExit the client', + handler: exitClient, + }, }; commands = _.extend(commands, commandLine.commands); diff --git a/client-config.js b/client-config.js index 4e2713fb..8e3ddcea 100644 --- a/client-config.js +++ b/client-config.js @@ -23,17 +23,17 @@ var config = {}; config.mqtt = { - host: 'localhost', - port: 1883, - options: { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - } + host: 'localhost', + port: 1883, + options: { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + }, }; config.device = { - id: 'myDeviceId', - apikey: '1234' -} + id: 'myDeviceId', + apikey: '1234', +}; module.exports = config; diff --git a/config.js b/config.js index 1f949fbd..67b498ab 100644 --- a/config.js +++ b/config.js @@ -26,180 +26,180 @@ var config = {}; * Configuration for the MQTT binding. */ config.mqtt = { - /** - * Host where the MQTT Broker is located. - */ - host: 'localhost', - /** - * Port where the MQTT Broker is listening. - */ - port: 1883, - /** - * Activating thinkingThingsPlugin flag. When it is set to true the constraint devices sends an HTTP POST request - * to the server with a Content-Type, containing a field name and a payload. The payload can be divided in modules, - * each one of them responsible for a single measure. Modules are separated by the '#' character, and all of them - * consists of a series of parameters separated by commas. - */ - thinkingThingsPlugin: true, - /** - * QoS Level: at most once (0), at least once (1), exactly once (2). (default is 2). - */ - qos: 0, - /** - * Retain flag. (default is true.) Normally if a publisher publishes a message to a topic, and no one is - * subscribed to that topic (i.e retain flag is set to false) the message is simply discarded by the broker. - * The publisher can tell the broker to keep the last message on that topic by setting the retained message flag to true . - */ - retain: false + /** + * Host where the MQTT Broker is located. + */ + host: 'localhost', + /** + * Port where the MQTT Broker is listening. + */ + port: 1883, + /** + * Activating thinkingThingsPlugin flag. When it is set to true the constraint devices sends an HTTP POST request + * to the server with a Content-Type, containing a field name and a payload. The payload can be divided in modules, + * each one of them responsible for a single measure. Modules are separated by the '#' character, and all of them + * consists of a series of parameters separated by commas. + */ + thinkingThingsPlugin: true, + /** + * QoS Level: at most once (0), at least once (1), exactly once (2). (default is 2). + */ + qos: 0, + /** + * Retain flag. (default is true.) Normally if a publisher publishes a message to a topic, and no one is + * subscribed to that topic (i.e retain flag is set to false) the message is simply discarded by the broker. + * The publisher can tell the broker to keep the last message on that topic by setting the retained message flag to true . + */ + retain: false, }; /** * Configuration for the AMQP binding. */ config.amqp = { - /** - * Host where the AMQP broker is located. - */ - host: 'localhost', - /** - * Port where the AMQP broker is listening. - */ - port: 5672, - /** - * user name that identifies the IOTA against the AMQP broker (optional). - */ - // username: 'guest', - /** - * password to be used if the username is provided (optional). - */ - // password: 'guest', - /** - * Exchange in the AMQP broker - */ - exchange: 'iota-exchange', - /** - * Queue in the AMQP broker - */ - queue: 'iotaqueue', - /** - * durable queue flag (default is false). - */ - options: {durable: true} + /** + * Host where the AMQP broker is located. + */ + host: 'localhost', + /** + * Port where the AMQP broker is listening. + */ + port: 5672, + /** + * user name that identifies the IOTA against the AMQP broker (optional). + */ + // username: 'guest', + /** + * password to be used if the username is provided (optional). + */ + // password: 'guest', + /** + * Exchange in the AMQP broker + */ + exchange: 'iota-exchange', + /** + * Queue in the AMQP broker + */ + queue: 'iotaqueue', + /** + * durable queue flag (default is false). + */ + options: { durable: true }, }; /** * Configuration for the HTTP transport binding. */ config.http = { - /** - * South Port where the Ultralight transport binding for HTTP will be listening for device requests. - */ - port: 7896, - /** - * HTTP Timeout for the http command endpoint (in miliseconds). - */ - //timeout: 1000 + /** + * South Port where the Ultralight transport binding for HTTP will be listening for device requests. + */ + port: 7896, + /** + * HTTP Timeout for the http command endpoint (in miliseconds). + */ + //timeout: 1000 }; config.iota = { - /** - * Configures the log level. Appropriate values are: FATAL, ERROR, INFO, WARN and DEBUG. - */ - logLevel: 'DEBUG', - /** - * When this flag is active, the IoTAgent will add the TimeInstant attribute to every entity created, as well - * as a TimeInstant metadata to each attribute, with the current timestamp. - */ - timestamp: true, - /** - * Context Broker configuration. Defines the connection information to the instance of the Context Broker where - * the IoT Agent will send the device data. - */ - contextBroker: { + /** + * Configures the log level. Appropriate values are: FATAL, ERROR, INFO, WARN and DEBUG. + */ + logLevel: 'DEBUG', + /** + * When this flag is active, the IoTAgent will add the TimeInstant attribute to every entity created, as well + * as a TimeInstant metadata to each attribute, with the current timestamp. + */ + timestamp: true, + /** + * Context Broker configuration. Defines the connection information to the instance of the Context Broker where + * the IoT Agent will send the device data. + */ + contextBroker: { /** * Host where the Context Broker is located. */ - host: 'localhost', + host: 'localhost', /** * Port where the Context Broker is listening. */ - port: '1026' - }, - /** - * Configuration of the North Port of the IoT Agent. - */ - server: { + port: '1026', + }, + /** + * Configuration of the North Port of the IoT Agent. + */ + server: { /** * Port where the IoT Agent will be listening for NGSI and Provisioning requests. */ - port: 4041 - }, - /** - * Defines the configuration for the Device Registry, where all the information about devices and configuration - * groups will be stored. There are currently just two types of registries allowed: - * - * - 'memory': transient memory-based repository for testing purposes. All the information in the repository is - * wiped out when the process is restarted. - * - * - 'mongodb': persistent MongoDB storage repository. All the details for the MongoDB configuration will be read - * from the 'mongodb' configuration property. - */ - deviceRegistry: { - type: 'mongodb' - }, - /** - * Mongo DB configuration section. This section will only be used if the deviceRegistry property has the type - * 'mongodb'. - */ - mongodb: { - /** - * Host where MongoDB is located. If the MongoDB used is a replicaSet, this property will contain a - * comma-separated list of the instance names or IPs. - */ - host: 'localhost', - /** - * Port where MongoDB is listening. In the case of a replicaSet, all the instances are supposed to be listening - * in the same port. - */ - port: '27017', - /** - * Name of the Mongo database that will be created to store IoT Agent data. - */ - db: 'iotagentjson' - }, - /** - * Types array for static configuration of services. Check documentation in the IoT Agent Library for Node.js for - * further details: - * - * https://github.com/telefonicaid/iotagent-json#type-configuration - */ - types: {}, - /** - * Default service, for IoT Agent installations that won't require preregistration. - */ - service: 'howtoService', - /** - * Default subservice, for IoT Agent installations that won't require preregistration. - */ - subservice: '/howto', - /** - * URL Where the IoT Agent Will listen for incoming updateContext and queryContext requests (for commands and passive - * attributes). This URL will be sent in the Context Registration requests. - */ - providerUrl: 'http://localhost:4041', - /** - * Default maximum expire date for device registrations. + port: 4041, + }, + /** + * Defines the configuration for the Device Registry, where all the information about devices and configuration + * groups will be stored. There are currently just two types of registries allowed: + * + * - 'memory': transient memory-based repository for testing purposes. All the information in the repository is + * wiped out when the process is restarted. + * + * - 'mongodb': persistent MongoDB storage repository. All the details for the MongoDB configuration will be read + * from the 'mongodb' configuration property. + */ + deviceRegistry: { + type: 'mongodb', + }, + /** + * Mongo DB configuration section. This section will only be used if the deviceRegistry property has the type + * 'mongodb'. + */ + mongodb: { + /** + * Host where MongoDB is located. If the MongoDB used is a replicaSet, this property will contain a + * comma-separated list of the instance names or IPs. */ - deviceRegistrationDuration: 'P1M', - /** - * Default type, for IoT Agent installations that won't require preregistration. - */ - defaultType: 'Thing', + host: 'localhost', /** - * Default resource of the IoT Agent. This value must be different for every IoT Agent connecting to the IoT - * Manager. - */ - defaultResource: '/iot/json' + * Port where MongoDB is listening. In the case of a replicaSet, all the instances are supposed to be listening + * in the same port. + */ + port: '27017', + /** + * Name of the Mongo database that will be created to store IoT Agent data. + */ + db: 'iotagentjson', + }, + /** + * Types array for static configuration of services. Check documentation in the IoT Agent Library for Node.js for + * further details: + * + * https://github.com/telefonicaid/iotagent-json#type-configuration + */ + types: {}, + /** + * Default service, for IoT Agent installations that won't require preregistration. + */ + service: 'howtoService', + /** + * Default subservice, for IoT Agent installations that won't require preregistration. + */ + subservice: '/howto', + /** + * URL Where the IoT Agent Will listen for incoming updateContext and queryContext requests (for commands and passive + * attributes). This URL will be sent in the Context Registration requests. + */ + providerUrl: 'http://localhost:4041', + /** + * Default maximum expire date for device registrations. + */ + deviceRegistrationDuration: 'P1M', + /** + * Default type, for IoT Agent installations that won't require preregistration. + */ + defaultType: 'Thing', + /** + * Default resource of the IoT Agent. This value must be different for every IoT Agent connecting to the IoT + * Manager. + */ + defaultResource: '/iot/json', }; /** diff --git a/index.js b/index.js index e93808a2..eb890ac1 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -module.exports = require('./lib/iotagent-json'); \ No newline at end of file +module.exports = require('./lib/iotagent-json'); diff --git a/lib/commandHandler.js b/lib/commandHandler.js index b4564f8f..76d98d5b 100644 --- a/lib/commandHandler.js +++ b/lib/commandHandler.js @@ -24,14 +24,14 @@ 'use strict'; var async = require('async'), - iotAgentLib = require('iotagent-node-lib'), - iotaUtils = require('./iotaUtils'), - constants = require('./constants'), - transportSelector = require('./transportSelector'), - config = require('./configService'), - context = { - op: 'IoTAgentJSON.Commands' - }; + iotAgentLib = require('iotagent-node-lib'), + iotaUtils = require('./iotaUtils'), + constants = require('./constants'), + transportSelector = require('./transportSelector'), + config = require('./configService'), + context = { + op: 'IoTAgentJSON.Commands', + }; /** * Generate a function that executes the given command in the device. @@ -42,20 +42,30 @@ var async = require('async'), * @return {Function} Command execution function ready to be called with async.series. */ function generateCommandExecution(apiKey, device, attribute) { - var payload = {}, - serialized, - executions; + var payload = {}, + serialized, + executions; - payload[attribute.name] = attribute.value; - serialized = JSON.stringify(payload); + payload[attribute.name] = attribute.value; + serialized = JSON.stringify(payload); - config.getLogger().debug(context, 'Sending command execution to device [%s] with apikey [%s] and payload [%j] ', - apiKey, device.id, attribute); + config + .getLogger() + .debug( + context, + 'Sending command execution to device [%s] with apikey [%s] and payload [%j] ', + apiKey, + device.id, + attribute + ); - executions = transportSelector.createExecutionsForBinding( - [apiKey, device, serialized], 'executeCommand', device.transport); + executions = transportSelector.createExecutionsForBinding( + [apiKey, device, serialized], + 'executeCommand', + device.transport + ); - return executions; + return executions; } /** @@ -71,33 +81,50 @@ function generateCommandExecution(apiKey, device, attribute) { * @param {Array} attributes List of NGSI attributes of type command to execute. */ function commandHandler(id, type, service, subservice, attributes, callback) { - config.getLogger().debug(context, - 'Handling MQTT command for device [%s] in service [%s - %s]', id, service, subservice); + config + .getLogger() + .debug( + context, + 'Handling MQTT command for device [%s] in service [%s - %s]', + id, + service, + subservice + ); - function concat(previous, current) { - previous = previous.concat(current); - return previous; - } + function concat(previous, current) { + previous = previous.concat(current); + return previous; + } - iotAgentLib.getDeviceByName(id, service, subservice, function(error, device) { + iotAgentLib.getDeviceByName(id, service, subservice, function(error, device) { + if (error) { + config + .getLogger() + .error( + context, + "COMMAND-001: Command execution could not be handled, as device for entity [%s] [%s] wasn't found", + id, + type + ); + callback(error); + } else { + iotaUtils.getEffectiveApiKey(device.service, device.subservice, function( + error, + apiKey + ) { if (error) { - config.getLogger().error(context, - 'COMMAND-001: Command execution could not be handled, as device for entity [%s] [%s] wasn\'t found', - id, type); - callback(error); + callback(error); } else { - iotaUtils.getEffectiveApiKey(device.service, device.subservice, function(error, apiKey) { - if (error) { - callback(error); - } else { - async.series(attributes - .map(generateCommandExecution.bind(null, apiKey, device)) - .reduce(concat, []), - callback); - } - }); + async.series( + attributes + .map(generateCommandExecution.bind(null, apiKey, device)) + .reduce(concat, []), + callback + ); } - }); + }); + } + }); } /** @@ -109,33 +136,47 @@ function commandHandler(id, type, service, subservice, attributes, callback) { * @param {Object} messageObj JSON object sent using MQTT. */ function updateCommand(apiKey, deviceId, device, messageObj) { - var commandList = Object.keys(messageObj), - commandUpdates = []; + var commandList = Object.keys(messageObj), + commandUpdates = []; - for (var i = 0; i < commandList.length; i++) { - commandUpdates.push( - async.apply(iotAgentLib.setCommandResult, - device.name, - config.getConfig().iota.defaultResource, - apiKey, - commandList[i], - messageObj[commandList[i]], - constants.COMMAND_STATUS_COMPLETED, - device) + for (var i = 0; i < commandList.length; i++) { + commandUpdates.push( + async.apply( + iotAgentLib.setCommandResult, + device.name, + config.getConfig().iota.defaultResource, + apiKey, + commandList[i], + messageObj[commandList[i]], + constants.COMMAND_STATUS_COMPLETED, + device + ) + ); + } + + async.series(commandUpdates, function(error) { + if (error) { + config + .getLogger() + .error( + context, + "COMMANDS-002: Couldn't update command status in the Context broker " + + 'for device [%s] with apiKey [%s]: %s', + device.id, + apiKey, + error + ); + } else { + config + .getLogger() + .debug( + context, + 'Single measure for device [%s] with apiKey [%s] successfully updated', + device.id, + apiKey ); } - - async.series(commandUpdates, function(error) { - if (error) { - config.getLogger().error(context, - 'COMMANDS-002: Couldn\'t update command status in the Context broker ' + - 'for device [%s] with apiKey [%s]: %s', - device.id, apiKey, error); - } else { - config.getLogger().debug(context, 'Single measure for device [%s] with apiKey [%s] successfully updated', - device.id, apiKey); - } - }); + }); } exports.generateCommandExecution = generateCommandExecution; diff --git a/lib/commonBindings.js b/lib/commonBindings.js index f59c8621..4fb23033 100644 --- a/lib/commonBindings.js +++ b/lib/commonBindings.js @@ -26,16 +26,15 @@ 'use strict'; var iotAgentLib = require('iotagent-node-lib'), - commandHandler = require('./commandHandler'), - transportSelector = require('./transportSelector'), - async = require('async'), - iotaUtils = require('./iotaUtils'), - constants = require('./constants'), - context = { - op: 'IoTAgentJSON.commonBinding' - }, - config = require('./configService'); - + commandHandler = require('./commandHandler'), + transportSelector = require('./transportSelector'), + async = require('async'), + iotaUtils = require('./iotaUtils'), + constants = require('./constants'), + context = { + op: 'IoTAgentJSON.commonBinding', + }, + config = require('./configService'); /** * Parse a message received from a Topic. @@ -44,22 +43,34 @@ var iotAgentLib = require('iotagent-node-lib'), * @return {Object} Parsed message or null if an error has occurred. */ function parseMessage(message) { - var parsedMessage, - stringMessage; + var parsedMessage, stringMessage; - try { - stringMessage = message.toString(); - parsedMessage = JSON.parse(stringMessage); - } catch (e) { - config.getLogger().debug(context, 'Parse error treating message [%s]: %j', stringMessage, e); - parsedMessage = null; - } + try { + stringMessage = message.toString(); + parsedMessage = JSON.parse(stringMessage); + } catch (e) { + config + .getLogger() + .debug( + context, + 'Parse error treating message [%s]: %j', + stringMessage, + e + ); + parsedMessage = null; + } - if (!parsedMessage) { - config.getLogger().error(context, 'MEASURES-003: Impossible to handle malformed message: %s', message); - } + if (!parsedMessage) { + config + .getLogger() + .error( + context, + 'MEASURES-003: Impossible to handle malformed message: %s', + message + ); + } - return parsedMessage; + return parsedMessage; } /** @@ -71,48 +82,54 @@ function parseMessage(message) { * @return {String} String identifier of the attribute type. */ function guessType(attribute, device) { - if (device.active) { - for (var i = 0; i < device.active.length; i++) { - if (device.active[i].name === attribute) { - return device.active[i].type; - } - } + if (device.active) { + for (var i = 0; i < device.active.length; i++) { + if (device.active[i].name === attribute) { + return device.active[i].type; + } } + } - if (attribute === constants.TIMESTAMP_ATTRIBUTE) { - if (iotAgentLib.configModule.checkNgsi2()) { - return constants.TIMESTAMP_TYPE_NGSI2; - } - else { - return constants.TIMESTAMP_TYPE; - } + if (attribute === constants.TIMESTAMP_ATTRIBUTE) { + if (iotAgentLib.configModule.checkNgsi2()) { + return constants.TIMESTAMP_TYPE_NGSI2; } else { - return constants.DEFAULT_ATTRIBUTE_TYPE; + return constants.TIMESTAMP_TYPE; } + } else { + return constants.DEFAULT_ATTRIBUTE_TYPE; + } } function extractAttributes(device, current) { - var values = []; + var values = []; - for (var i in current) { - if (current.hasOwnProperty(i)) { - values.push({ - name: i, - type: guessType(i, device), - value: current[i] - }); - } + for (var i in current) { + if (current.hasOwnProperty(i)) { + values.push({ + name: i, + type: guessType(i, device), + value: current[i], + }); } + } - return values; + return values; } -function sendConfigurationToDevice(device, apiKey, deviceId, results, callback) { - transportSelector.applyFunctionFromBinding( - [apiKey, deviceId, results], - 'sendConfigurationToDevice', - device.transport, - callback); +function sendConfigurationToDevice( + device, + apiKey, + deviceId, + results, + callback +) { + transportSelector.applyFunctionFromBinding( + [apiKey, deviceId, results], + 'sendConfigurationToDevice', + device.transport, + callback + ); } /** @@ -126,18 +143,28 @@ function sendConfigurationToDevice(device, apiKey, deviceId, results, callback) * @param {Object} objMessage JSON object received. */ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { - iotaUtils.manageConfiguration( - apiKey, deviceId, device, objMessage, - async.apply(sendConfigurationToDevice, device), - function(error) { - if (error) { - iotAgentLib.alarms.raise(constants.MQTTB_ALARM, error); - } else { - iotAgentLib.alarms.release(constants.MQTTB_ALARM); - config.getLogger().debug( - context, 'Configuration request finished for APIKey [%s] and Device [%s]', apiKey, deviceId); - } - }); + iotaUtils.manageConfiguration( + apiKey, + deviceId, + device, + objMessage, + async.apply(sendConfigurationToDevice, device), + function(error) { + if (error) { + iotAgentLib.alarms.raise(constants.MQTTB_ALARM, error); + } else { + iotAgentLib.alarms.release(constants.MQTTB_ALARM); + config + .getLogger() + .debug( + context, + 'Configuration request finished for APIKey [%s] and Device [%s]', + apiKey, + deviceId + ); + } + } + ); } /** @@ -151,27 +178,47 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { * @param {Buffer} message Raw message coming from the client. */ function singleMeasure(apiKey, deviceId, attribute, device, message) { - var values; + var values; - config.getLogger().debug(context, 'Processing single measure for device [%s] with apiKey [%s]', deviceId, apiKey); + config + .getLogger() + .debug( + context, + 'Processing single measure for device [%s] with apiKey [%s]', + deviceId, + apiKey + ); - values = [ - { - name: attribute, - type: guessType(attribute, device), - value: message.toString() - } - ]; + values = [ + { + name: attribute, + type: guessType(attribute, device), + value: message.toString(), + }, + ]; - iotAgentLib.update(device.name, device.type, '', values, device, function(error) { - if (error) { - config.getLogger().error(context, - 'MEASURES-002: Couldn\'t send the updated values to the Context Broker due to an error: %s', error); - } else { - config.getLogger().debug(context, 'Single measure for device [%s] with apiKey [%s] successfully updated', - deviceId, apiKey); - } - }); + iotAgentLib.update(device.name, device.type, '', values, device, function( + error + ) { + if (error) { + config + .getLogger() + .error( + context, + "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", + error + ); + } else { + config + .getLogger() + .debug( + context, + 'Single measure for device [%s] with apiKey [%s] successfully updated', + deviceId, + apiKey + ); + } + }); } /** @@ -184,30 +231,49 @@ function singleMeasure(apiKey, deviceId, attribute, device, message) { * @param {Object} messageObj JSON object sent using. */ function multipleMeasures(apiKey, deviceId, device, messageObj) { - var values = []; + var values = []; - config.getLogger().debug(context, - 'Processing multiple measures for device [%s] with apiKey [%s]', deviceId, apiKey); + config + .getLogger() + .debug( + context, + 'Processing multiple measures for device [%s] with apiKey [%s]', + deviceId, + apiKey + ); - for (var i in messageObj) { - if (messageObj.hasOwnProperty(i)) { - values.push({ - name: i, - type: guessType(i, device), - value: messageObj[i] - }); - } + for (var i in messageObj) { + if (messageObj.hasOwnProperty(i)) { + values.push({ + name: i, + type: guessType(i, device), + value: messageObj[i], + }); } + } - iotAgentLib.update(device.name, device.type, '', values, device, function(error) { - if (error) { - config.getLogger().error(context, - 'MEASURES-002: Couldn\'t send the updated values to the Context Broker due to an error: %s', error); - } else { - config.getLogger().debug(context, 'Multiple measures for device [%s] with apiKey [%s] successfully updated', - deviceId, apiKey); - } - }); + iotAgentLib.update(device.name, device.type, '', values, device, function( + error + ) { + if (error) { + config + .getLogger() + .error( + context, + "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", + error + ); + } else { + config + .getLogger() + .debug( + context, + 'Multiple measures for device [%s] with apiKey [%s] successfully updated', + deviceId, + apiKey + ); + } + }); } /** @@ -218,31 +284,45 @@ function multipleMeasures(apiKey, deviceId, device, messageObj) { * @param {Object} message message body (Object or Buffer, depending on the value). */ function messageHandler(topic, message, protocol) { - var topicInformation = topic.split('/'), - apiKey = topicInformation[1], - deviceId = topicInformation[2], - parsedMessage = parseMessage(message); + var topicInformation = topic.split('/'), + apiKey = topicInformation[1], + deviceId = topicInformation[2], + parsedMessage = parseMessage(message); - function processDeviceMeasure(error, device) { - if (error) { - config.getLogger().error(context, 'MEASURES-004: Device not found for topic [%s]', topic); - } else { - if (topicInformation[3] === 'configuration' && topicInformation[4] === 'commands' && parsedMessage) { - manageConfigurationRequest(apiKey, deviceId, device, parsedMessage); - } else if (topicInformation[4]) { - singleMeasure(apiKey, deviceId, topicInformation[4], device, message); - } else if (topicInformation[3] === constants.CONFIGURATION_COMMAND_UPDATE) { - commandHandler.updateCommand(apiKey, deviceId, device, parsedMessage); - } else if (parsedMessage && typeof parsedMessage === 'object') { - multipleMeasures(apiKey, deviceId, device, parsedMessage); - } else { - config.getLogger().error(context, 'Couldn\'t process message [%s] due to format issues.', message); - } - } + function processDeviceMeasure(error, device) { + if (error) { + config + .getLogger() + .error(context, 'MEASURES-004: Device not found for topic [%s]', topic); + } else { + if ( + topicInformation[3] === 'configuration' && + topicInformation[4] === 'commands' && + parsedMessage + ) { + manageConfigurationRequest(apiKey, deviceId, device, parsedMessage); + } else if (topicInformation[4]) { + singleMeasure(apiKey, deviceId, topicInformation[4], device, message); + } else if ( + topicInformation[3] === constants.CONFIGURATION_COMMAND_UPDATE + ) { + commandHandler.updateCommand(apiKey, deviceId, device, parsedMessage); + } else if (parsedMessage && typeof parsedMessage === 'object') { + multipleMeasures(apiKey, deviceId, device, parsedMessage); + } else { + config + .getLogger() + .error( + context, + "Couldn't process message [%s] due to format issues.", + message + ); + } } + } - iotAgentLib.alarms.release(constants.MQTTB_ALARM); - iotaUtils.retrieveDevice(deviceId, apiKey, protocol, processDeviceMeasure); + iotAgentLib.alarms.release(constants.MQTTB_ALARM); + iotaUtils.retrieveDevice(deviceId, apiKey, protocol, processDeviceMeasure); } /** @@ -253,7 +333,7 @@ function messageHandler(topic, message, protocol) { * @param {Object} message AMQP message body (Object or Buffer, depending on the value). */ function amqpMessageHandler(topic, message) { - messageHandler(topic, message, 'AMQP'); + messageHandler(topic, message, 'AMQP'); } /** @@ -264,7 +344,7 @@ function amqpMessageHandler(topic, message) { * @param {Object} message MQTT message body (Object or Buffer, depending on the value). */ function mqttMessageHandler(topic, message) { - messageHandler(topic, message, 'MQTT'); + messageHandler(topic, message, 'MQTT'); } exports.amqpMessageHandler = amqpMessageHandler; diff --git a/lib/configService.js b/lib/configService.js index c2504e26..0ce0ad93 100644 --- a/lib/configService.js +++ b/lib/configService.js @@ -24,173 +24,172 @@ 'use strict'; var config = {}, - logger = require('logops'); + logger = require('logops'); function anyIsSet(variableSet) { - for (var i = 0; i < variableSet.length; i++) { - if (process.env[variableSet[i]]) { - return true; - } + for (var i = 0; i < variableSet.length; i++) { + if (process.env[variableSet[i]]) { + return true; } + } - return false; + return false; } function processEnvironmentVariables() { - var environmentVariables = [ - 'IOTA_MQTT_HOST', - 'IOTA_MQTT_PORT', - 'IOTA_MQTT_USERNAME', - 'IOTA_MQTT_PASSWORD', - 'IOTA_MQTT_QOS', - 'IOTA_MQTT_RETAIN', - 'IOTA_AMQP_HOST', - 'IOTA_AMQP_PORT', - 'IOTA_AMQP_USERNAME', - 'IOTA_AMQP_PASSWORD', - 'IOTA_AMQP_EXCHANGE', - 'IOTA_AMQP_QUEUE', - 'IOTA_AMQP_DURABLE', - 'IOTA_AMQP_RETRIES', - 'IOTA_AMQP_RETRY_TIME', - 'IOTA_HTTP_HOST', - 'IOTA_HTTP_PORT', - 'IOTA_HTTP_TIMEOUT' - ], - mqttVariables = [ - 'IOTA_MQTT_HOST', - 'IOTA_MQTT_PORT', - 'IOTA_MQTT_USERNAME', - 'IOTA_MQTT_PASSWORD', - 'IOTA_MQTT_QOS', - 'IOTA_MQTT_RETAIN' - ], - amqpVariables = [ - 'IOTA_AMQP_HOST', - 'IOTA_AMQP_PORT', - 'IOTA_AMQP_USERNAME', - 'IOTA_AMQP_PASSWORD', - 'IOTA_AMQP_EXCHANGE', - 'IOTA_AMQP_QUEUE', - 'IOTA_AMQP_DURABLE', - 'IOTA_AMQP_RETRIES', - 'IOTA_AMQP_RETRY_TIME', - ], - httpVariables = [ - 'IOTA_HTTP_HOST', - 'IOTA_HTTP_PORT', - 'IOTA_HTTP_TIMEOUT' - ]; - - for (var i = 0; i < environmentVariables.length; i++) { - if (process.env[environmentVariables[i]]) { - logger.info('Setting %s to environment value: %s', - environmentVariables[i], process.env[environmentVariables[i]]); - } - } - - if (anyIsSet(mqttVariables)) { - config.mqtt = {}; - } - - if (process.env.IOTA_MQTT_HOST) { - config.mqtt.host = process.env.IOTA_MQTT_HOST; - } - - if (process.env.IOTA_MQTT_PORT) { - config.mqtt.port = process.env.IOTA_MQTT_PORT; - } - - if (process.env.IOTA_MQTT_USERNAME) { - config.mqtt.username = process.env.IOTA_MQTT_USERNAME; - } - - if (process.env.IOTA_MQTT_PASSWORD) { - config.mqtt.password = process.env.IOTA_MQTT_PASSWORD; - } - - if (process.env.IOTA_MQTT_QOS) { - config.mqtt.qos = process.env.IOTA_MQTT_QOS; - } - - if (process.env.IOTA_MQTT_RETAIN) { - config.mqtt.retain = process.env.IOTA_MQTT_RETAIN === 'true'; - } - - if (anyIsSet(amqpVariables)) { - config.amqp = {}; - } - - if (process.env.IOTA_AMQP_HOST) { - config.amqp.host = process.env.IOTA_AMQP_HOST; - } - - if (process.env.IOTA_AMQP_PORT) { - config.amqp.port = process.env.IOTA_AMQP_PORT; - } - - if (process.env.IOTA_AMQP_USERNAME) { - config.amqp.username = process.env.IOTA_AMQP_USERNAME; - } - - if (process.env.IOTA_AMQP_PASSWORD) { - config.amqp.password = process.env.IOTA_AMQP_PASSWORD; - } - - if (process.env.IOTA_AMQP_EXCHANGE) { - config.amqp.exchange = process.env.IOTA_AMQP_EXCHANGE; - } - - if (process.env.IOTA_AMQP_QUEUE) { - config.amqp.queue = process.env.IOTA_AMQP_QUEUE; - } - - if (process.env.IOTA_AMQP_DURABLE) { - config.amqp.options = {}; - config.amqp.options.durable = process.env.IOTA_AMQP_DURABLE === 'true'; - } - - if (process.env.IOTA_AMQP_RETRIES) { - config.amqp.retries = process.env.IOTA_AMQP_RETRIES; - } - - if (process.env.IOTA_AMQP_RETRY_TIME) { - config.amqp.retryTime = process.env.IOTA_AMQP_RETRY_TIME; - } - - if (anyIsSet(httpVariables)) { - config.http = {}; - } - - if (process.env.IOTA_HTTP_HOST) { - config.http.host = process.env.IOTA_HTTP_HOST; - } - - if (process.env.IOTA_HTTP_PORT) { - config.http.port = process.env.IOTA_HTTP_PORT; - } - - if (process.env.IOTA_HTTP_TIMEOUT) { - config.http.timeout = process.env.IOTA_HTTP_TIMEOUT; - } + var environmentVariables = [ + 'IOTA_MQTT_HOST', + 'IOTA_MQTT_PORT', + 'IOTA_MQTT_USERNAME', + 'IOTA_MQTT_PASSWORD', + 'IOTA_MQTT_QOS', + 'IOTA_MQTT_RETAIN', + 'IOTA_AMQP_HOST', + 'IOTA_AMQP_PORT', + 'IOTA_AMQP_USERNAME', + 'IOTA_AMQP_PASSWORD', + 'IOTA_AMQP_EXCHANGE', + 'IOTA_AMQP_QUEUE', + 'IOTA_AMQP_DURABLE', + 'IOTA_AMQP_RETRIES', + 'IOTA_AMQP_RETRY_TIME', + 'IOTA_HTTP_HOST', + 'IOTA_HTTP_PORT', + 'IOTA_HTTP_TIMEOUT', + ], + mqttVariables = [ + 'IOTA_MQTT_HOST', + 'IOTA_MQTT_PORT', + 'IOTA_MQTT_USERNAME', + 'IOTA_MQTT_PASSWORD', + 'IOTA_MQTT_QOS', + 'IOTA_MQTT_RETAIN', + ], + amqpVariables = [ + 'IOTA_AMQP_HOST', + 'IOTA_AMQP_PORT', + 'IOTA_AMQP_USERNAME', + 'IOTA_AMQP_PASSWORD', + 'IOTA_AMQP_EXCHANGE', + 'IOTA_AMQP_QUEUE', + 'IOTA_AMQP_DURABLE', + 'IOTA_AMQP_RETRIES', + 'IOTA_AMQP_RETRY_TIME', + ], + httpVariables = ['IOTA_HTTP_HOST', 'IOTA_HTTP_PORT', 'IOTA_HTTP_TIMEOUT']; + + for (var i = 0; i < environmentVariables.length; i++) { + if (process.env[environmentVariables[i]]) { + logger.info( + 'Setting %s to environment value: %s', + environmentVariables[i], + process.env[environmentVariables[i]] + ); + } + } + + if (anyIsSet(mqttVariables)) { + config.mqtt = {}; + } + + if (process.env.IOTA_MQTT_HOST) { + config.mqtt.host = process.env.IOTA_MQTT_HOST; + } + + if (process.env.IOTA_MQTT_PORT) { + config.mqtt.port = process.env.IOTA_MQTT_PORT; + } + + if (process.env.IOTA_MQTT_USERNAME) { + config.mqtt.username = process.env.IOTA_MQTT_USERNAME; + } + + if (process.env.IOTA_MQTT_PASSWORD) { + config.mqtt.password = process.env.IOTA_MQTT_PASSWORD; + } + + if (process.env.IOTA_MQTT_QOS) { + config.mqtt.qos = process.env.IOTA_MQTT_QOS; + } + + if (process.env.IOTA_MQTT_RETAIN) { + config.mqtt.retain = process.env.IOTA_MQTT_RETAIN === 'true'; + } + + if (anyIsSet(amqpVariables)) { + config.amqp = {}; + } + + if (process.env.IOTA_AMQP_HOST) { + config.amqp.host = process.env.IOTA_AMQP_HOST; + } + + if (process.env.IOTA_AMQP_PORT) { + config.amqp.port = process.env.IOTA_AMQP_PORT; + } + + if (process.env.IOTA_AMQP_USERNAME) { + config.amqp.username = process.env.IOTA_AMQP_USERNAME; + } + + if (process.env.IOTA_AMQP_PASSWORD) { + config.amqp.password = process.env.IOTA_AMQP_PASSWORD; + } + + if (process.env.IOTA_AMQP_EXCHANGE) { + config.amqp.exchange = process.env.IOTA_AMQP_EXCHANGE; + } + + if (process.env.IOTA_AMQP_QUEUE) { + config.amqp.queue = process.env.IOTA_AMQP_QUEUE; + } + + if (process.env.IOTA_AMQP_DURABLE) { + config.amqp.options = {}; + config.amqp.options.durable = process.env.IOTA_AMQP_DURABLE === 'true'; + } + + if (process.env.IOTA_AMQP_RETRIES) { + config.amqp.retries = process.env.IOTA_AMQP_RETRIES; + } + + if (process.env.IOTA_AMQP_RETRY_TIME) { + config.amqp.retryTime = process.env.IOTA_AMQP_RETRY_TIME; + } + + if (anyIsSet(httpVariables)) { + config.http = {}; + } + + if (process.env.IOTA_HTTP_HOST) { + config.http.host = process.env.IOTA_HTTP_HOST; + } + + if (process.env.IOTA_HTTP_PORT) { + config.http.port = process.env.IOTA_HTTP_PORT; + } + + if (process.env.IOTA_HTTP_TIMEOUT) { + config.http.timeout = process.env.IOTA_HTTP_TIMEOUT; + } } function setConfig(newConfig) { - config = newConfig; + config = newConfig; - processEnvironmentVariables(); + processEnvironmentVariables(); } function getConfig() { - return config; + return config; } function setLogger(newLogger) { - logger = newLogger; + logger = newLogger; } function getLogger() { - return logger; + return logger; } exports.setConfig = setConfig; diff --git a/lib/constants.js b/lib/constants.js index 03448aad..eecaf680 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -26,32 +26,32 @@ 'use strict'; module.exports = { - MEASURES_SUFIX: 'attrs', - CONFIGURATION_SUFIX: 'configuration', - CONFIGURATION_COMMAND_SUFIX: 'commands', - CONFIGURATION_COMMAND_UPDATE: 'cmdexe', - CONFIGURATION_VALUES_SUFIX: 'values', + MEASURES_SUFIX: 'attrs', + CONFIGURATION_SUFIX: 'configuration', + CONFIGURATION_COMMAND_SUFIX: 'commands', + CONFIGURATION_COMMAND_UPDATE: 'cmdexe', + CONFIGURATION_VALUES_SUFIX: 'values', - DATE_FORMAT: 'yyyymmdd\'T\'HHMMss\'Z\'', + DATE_FORMAT: "yyyymmdd'T'HHMMss'Z'", - HTTP_MEASURE_PATH: '/iot/d', - HTTP_CONFIGURATION_PATH: '/configuration', - HTTP_COMMANDS_PATH: '/commands', + HTTP_MEASURE_PATH: '/iot/d', + HTTP_CONFIGURATION_PATH: '/configuration', + HTTP_COMMANDS_PATH: '/commands', - TIMESTAMP_ATTRIBUTE: 'TimeInstant', - TIMESTAMP_TYPE: 'ISO8601', - TIMESTAMP_TYPE_NGSI2: 'DateTime', + TIMESTAMP_ATTRIBUTE: 'TimeInstant', + TIMESTAMP_TYPE: 'ISO8601', + TIMESTAMP_TYPE_NGSI2: 'DateTime', - DEFAULT_ATTRIBUTE_TYPE: 'string', + DEFAULT_ATTRIBUTE_TYPE: 'string', - COMMAND_STATUS_PENDING: 'PENDING', - COMMAND_STATUS_ERROR: 'ERROR', - COMMAND_STATUS_COMPLETED: 'OK', + COMMAND_STATUS_PENDING: 'PENDING', + COMMAND_STATUS_ERROR: 'ERROR', + COMMAND_STATUS_COMPLETED: 'OK', - MQTTB_ALARM: 'MQTTB-ALARM', + MQTTB_ALARM: 'MQTTB-ALARM', - AMQP_DEFAULT_EXCHANGE: 'amq.topic', - AMQP_DEFAULT_QUEUE: 'iotaqueue', - AMQP_DEFAULT_RETRIES: 5, - AMQP_DEFAULT_RETRY_TIME: 5 + AMQP_DEFAULT_EXCHANGE: 'amq.topic', + AMQP_DEFAULT_QUEUE: 'iotaqueue', + AMQP_DEFAULT_RETRIES: 5, + AMQP_DEFAULT_RETRY_TIME: 5, }; diff --git a/lib/errors.js b/lib/errors.js index f933ed41..d931157b 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -24,53 +24,75 @@ 'use strict'; module.exports = { - InvalidResource: function() { - this.name = 'INVALID_RESOURCE'; - this.message = 'MQTT+JSON Groups must have an empty resource field.'; - this.code = 400; - }, - BadPayload: function(payload) { - this.name = 'BAD_PAYLOAD'; - this.message = 'The request payload [' + payload + '] could not be parsed'; - this.code = 400; - }, - GroupNotFound: function(service, subservice) { - this.name = 'GROUP_NOT_FOUND'; - this.message = 'Group not found for service [' + service + '] and subservice [' + subservice + ']'; - }, - MandatoryParamsNotFound: function(paramList) { - this.name = 'MANDATORY_PARAMS_NOT_FOUND'; - this.message = 'Some of the mandatory params weren\'t found in the request: ' + JSON.stringify(paramList); - this.code = 400; - }, - UnsupportedType: function(expectedType) { - this.name = 'UNSUPPORTED_TYPE'; - this.message = 'The request content didn\'t have the expected type [' + expectedType + ' ]'; - this.code = 400; - }, - DeviceNotFound: function(deviceId) { - this.name = 'DEVICE_NOT_FOUND'; - this.message = 'Device not found with ID [' + deviceId + ']'; - this.code = 404; - }, - ConfigurationError: function(parameter) { - this.name = 'CONFIGURATION_ERROR'; - this.message = 'Mandatory configuration parameter not found: ' + parameter; - this.code = 500; - }, - HTTPCommandResponseError: function(code, error) { - this.name = 'HTTP_COMMAND_RESPONSE_ERROR'; - this.message = 'There was an error in the response of a device to a command [' + code + ' ]:' + error; - this.code = 400; - }, - EndpointNotFound: function(id) { - this.name = 'ENDPOINT_NOT_FOUND'; - this.message = 'The provisioned device [' + id + ' ] did not have an HTTP endpoint to call'; - this.code = 400; - }, - DeviceEndpointError: function(code, msg) { - this.name = 'DEVICE_ENDPOINT_ERROR'; - this.message = 'Request to the device ended up in error with code [' + code + ' ] and message [' + msg + ']'; - this.code = code; - } + InvalidResource: function() { + this.name = 'INVALID_RESOURCE'; + this.message = 'MQTT+JSON Groups must have an empty resource field.'; + this.code = 400; + }, + BadPayload: function(payload) { + this.name = 'BAD_PAYLOAD'; + this.message = 'The request payload [' + payload + '] could not be parsed'; + this.code = 400; + }, + GroupNotFound: function(service, subservice) { + this.name = 'GROUP_NOT_FOUND'; + this.message = + 'Group not found for service [' + + service + + '] and subservice [' + + subservice + + ']'; + }, + MandatoryParamsNotFound: function(paramList) { + this.name = 'MANDATORY_PARAMS_NOT_FOUND'; + this.message = + "Some of the mandatory params weren't found in the request: " + + JSON.stringify(paramList); + this.code = 400; + }, + UnsupportedType: function(expectedType) { + this.name = 'UNSUPPORTED_TYPE'; + this.message = + "The request content didn't have the expected type [" + + expectedType + + ' ]'; + this.code = 400; + }, + DeviceNotFound: function(deviceId) { + this.name = 'DEVICE_NOT_FOUND'; + this.message = 'Device not found with ID [' + deviceId + ']'; + this.code = 404; + }, + ConfigurationError: function(parameter) { + this.name = 'CONFIGURATION_ERROR'; + this.message = 'Mandatory configuration parameter not found: ' + parameter; + this.code = 500; + }, + HTTPCommandResponseError: function(code, error) { + this.name = 'HTTP_COMMAND_RESPONSE_ERROR'; + this.message = + 'There was an error in the response of a device to a command [' + + code + + ' ]:' + + error; + this.code = 400; + }, + EndpointNotFound: function(id) { + this.name = 'ENDPOINT_NOT_FOUND'; + this.message = + 'The provisioned device [' + + id + + ' ] did not have an HTTP endpoint to call'; + this.code = 400; + }, + DeviceEndpointError: function(code, msg) { + this.name = 'DEVICE_ENDPOINT_ERROR'; + this.message = + 'Request to the device ended up in error with code [' + + code + + ' ] and message [' + + msg + + ']'; + this.code = code; + }, }; diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 347e8ece..7973808d 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -22,15 +22,15 @@ */ var iotAgentLib = require('iotagent-node-lib'), - errors = require('./errors'), - dateFormat = require('dateformat'), - async = require('async'), - apply = async.apply, - constants = require('./constants'), - context = { - op: 'IoTAgentJSON.Utils' - }, - config = require('./configService'); + errors = require('./errors'), + dateFormat = require('dateformat'), + async = require('async'), + apply = async.apply, + constants = require('./constants'), + context = { + op: 'IoTAgentJSON.Utils', + }, + config = require('./configService'); /** * Get the API Key for the selected service if there is any, or the default API Key if a specific one does not exist. @@ -39,116 +39,179 @@ var iotAgentLib = require('iotagent-node-lib'), * @param {String} subservice Name of the subservice whose API Key we are retrieving. */ function getEffectiveApiKey(service, subservice, callback) { - config.getLogger().debug(context, 'Getting effective API Key'); + config.getLogger().debug(context, 'Getting effective API Key'); - iotAgentLib.findConfiguration(service, subservice, function(error, group) { - if (group) { - config.getLogger().debug(context, 'Using found group: %j', group); - callback(null, group.apikey); - } else if (config.getConfig().defaultKey) { - config.getLogger().debug(context, 'Using default API Key: %s', config.getConfig().defaultKey); - callback(null, config.getConfig().defaultKey); - } else { - config.getLogger().error(context, 'Could not find any API Key information for device.'); - callback(new errors.GroupNotFound(service, subservice)); - } - }); + iotAgentLib.findConfiguration(service, subservice, function(error, group) { + if (group) { + config.getLogger().debug(context, 'Using found group: %j', group); + callback(null, group.apikey); + } else if (config.getConfig().defaultKey) { + config + .getLogger() + .debug( + context, + 'Using default API Key: %s', + config.getConfig().defaultKey + ); + callback(null, config.getConfig().defaultKey); + } else { + config + .getLogger() + .error(context, 'Could not find any API Key information for device.'); + callback(new errors.GroupNotFound(service, subservice)); + } + }); } -function manageConfiguration(apiKey, deviceId, device, objMessage, sendFunction, callback) { - function handleSendConfigurationError(error, results) { - if (error) { - config.getLogger().error(context, - 'CONFIG-001: Couldn\'t get the requested values from the Context Broker: %s', error); - } else { - config.getLogger().debug(context, 'Configuration attributes sent to the device successfully.', - deviceId, apiKey); - } +function manageConfiguration( + apiKey, + deviceId, + device, + objMessage, + sendFunction, + callback +) { + function handleSendConfigurationError(error, results) { + if (error) { + config + .getLogger() + .error( + context, + "CONFIG-001: Couldn't get the requested values from the Context Broker: %s", + error + ); + } else { + config + .getLogger() + .debug( + context, + 'Configuration attributes sent to the device successfully.', + deviceId, + apiKey + ); + } - callback(error); + callback(error); + } + + function extractAttributes(results, callback) { + if ( + results.contextResponses && + results.contextResponses[0] && + results.contextResponses[0].contextElement.attributes + ) { + callback(null, results.contextResponses[0].contextElement.attributes); + } else { + callback("Couldn't find any information in Context Broker response"); } + } - function extractAttributes(results, callback) { - if (results.contextResponses && results.contextResponses[0] && - results.contextResponses[0].contextElement.attributes) { - callback(null, results.contextResponses[0].contextElement.attributes); + if (objMessage.type === 'configuration') { + async.waterfall( + [ + apply( + iotAgentLib.query, + device.name, + device.type, + '', + objMessage.fields, + device + ), + extractAttributes, + apply(sendFunction, apiKey, deviceId), + ], + handleSendConfigurationError + ); + } else if (objMessage.type === 'subscription') { + iotAgentLib.subscribe( + device, + objMessage.fields, + objMessage.fields, + function(error) { + if (error) { + config + .getLogger() + .error( + context, + 'CONFIG-002: There was an error subscribing device [%s] to attributes [%j]', + device.name, + objMessage.fields + ); } else { - callback('Couldn\'t find any information in Context Broker response'); + config + .getLogger() + .debug( + context, + 'Successfully subscribed device [%s] to attributes[%j]', + device.name, + objMessage.fields + ); } - } - - if (objMessage.type === 'configuration') { - async.waterfall([ - apply(iotAgentLib.query, device.name, device.type, '', objMessage.fields, device), - extractAttributes, - apply(sendFunction, apiKey, deviceId) - ], handleSendConfigurationError); - } else if (objMessage.type === 'subscription') { - iotAgentLib.subscribe(device, objMessage.fields, objMessage.fields, function(error) { - if (error) { - config.getLogger().error( - context, - 'CONFIG-002: There was an error subscribing device [%s] to attributes [%j]', - device.name, objMessage.fields); - } else { - config.getLogger().debug(context, 'Successfully subscribed device [%s] to attributes[%j]', - device.name, objMessage.fields); - } - callback(error); - }); - } else { - config.getLogger().error(context, 'CONFIG-003: Unknown command type from device [%s]', device.name); - callback(); - } + callback(error); + } + ); + } else { + config + .getLogger() + .error( + context, + 'CONFIG-003: Unknown command type from device [%s]', + device.name + ); + callback(); + } } function createConfigurationNotification(results) { - var configurations = {}, - now = new Date(); + var configurations = {}, + now = new Date(); - for (var i = 0; i < results.length; i++) { - configurations[results[i].name] = - results[i].value; - } + for (var i = 0; i < results.length; i++) { + configurations[results[i].name] = results[i].value; + } - configurations.dt = dateFormat(now, constants.DATE_FORMAT); - return configurations; + configurations.dt = dateFormat(now, constants.DATE_FORMAT); + return configurations; } function findOrCreate(deviceId, transport, group, callback) { - iotAgentLib.getDevice(deviceId, group.service, group.subservice, function(error, device) { - if (!error && device) { - callback(null, device, group); - } else if (error.name === 'DEVICE_NOT_FOUND') { - var newDevice = { - id: deviceId, - service: group.service, - subservice: group.subservice, - type: group.type - }; - if (config.getConfig().iota && config.getConfig().iota.iotManager && - config.getConfig().iota.iotManager.protocol) { - newDevice.protocol = config.getConfig().iota.iotManager.protocol; - } - // Fix transport depending on binding - if (!newDevice.transport) { - newDevice.transport = transport; - } - if ('timestamp' in group) { - newDevice.timestamp = group.timestamp; - } - iotAgentLib.register(newDevice, function(error, device) { - callback(error, device, group); - }); - } else { - callback(error); - } - }); + iotAgentLib.getDevice(deviceId, group.service, group.subservice, function( + error, + device + ) { + if (!error && device) { + callback(null, device, group); + } else if (error.name === 'DEVICE_NOT_FOUND') { + var newDevice = { + id: deviceId, + service: group.service, + subservice: group.subservice, + type: group.type, + }; + if ( + config.getConfig().iota && + config.getConfig().iota.iotManager && + config.getConfig().iota.iotManager.protocol + ) { + newDevice.protocol = config.getConfig().iota.iotManager.protocol; + } + // Fix transport depending on binding + if (!newDevice.transport) { + newDevice.transport = transport; + } + if ('timestamp' in group) { + newDevice.timestamp = group.timestamp; + } + iotAgentLib.register(newDevice, function(error, device) { + callback(error, device, group); + }); + } else { + callback(error); + } + }); } - - /** * Retrieve a device from the device repository based on the given APIKey and DeviceID, creating one if none is * found for the given data. @@ -157,36 +220,46 @@ function findOrCreate(deviceId, transport, group, callback) { * @param {String} apiKey APIKey of the Device Group (or default APIKey). */ function retrieveDevice(deviceId, apiKey, transport, callback) { - if (apiKey === config.getConfig().defaultKey) { - iotAgentLib.getDevicesByAttribute('id', deviceId, null, null, function(error, devices) { - if (error) { - callback(error); - } else if (devices && devices.length === 1) { - callback(null, devices[0]); - } else { - config.getLogger().error(context, - 'MEASURES-001: Couldn\'t find device data for APIKey [%s] and DeviceId[%s]', - apiKey, deviceId); + if (apiKey === config.getConfig().defaultKey) { + iotAgentLib.getDevicesByAttribute('id', deviceId, null, null, function( + error, + devices + ) { + if (error) { + callback(error); + } else if (devices && devices.length === 1) { + callback(null, devices[0]); + } else { + config + .getLogger() + .error( + context, + "MEASURES-001: Couldn't find device data for APIKey [%s] and DeviceId[%s]", + apiKey, + deviceId + ); - callback(new errors.DeviceNotFound(deviceId)); - } - }); - } else { - async.waterfall([ - apply(iotAgentLib.getConfiguration, config.getConfig().iota.defaultResource || '', apiKey), - apply(findOrCreate, deviceId, transport), - apply(iotAgentLib.mergeDeviceWithConfiguration, - [ - 'lazy', - 'active', - 'staticAttributes', - 'commands', - 'subscriptions' - ], - [null, null, [], [], [], [], []] - ) - ], callback); - } + callback(new errors.DeviceNotFound(deviceId)); + } + }); + } else { + async.waterfall( + [ + apply( + iotAgentLib.getConfiguration, + config.getConfig().iota.defaultResource || '', + apiKey + ), + apply(findOrCreate, deviceId, transport), + apply( + iotAgentLib.mergeDeviceWithConfiguration, + ['lazy', 'active', 'staticAttributes', 'commands', 'subscriptions'], + [null, null, [], [], [], [], []] + ), + ], + callback + ); + } } exports.createConfigurationNotification = createConfigurationNotification; diff --git a/lib/iotagent-json.js b/lib/iotagent-json.js index add376eb..d96b74df 100644 --- a/lib/iotagent-json.js +++ b/lib/iotagent-json.js @@ -24,17 +24,17 @@ 'use strict'; var iotAgentLib = require('iotagent-node-lib'), - transportSelector = require('./transportSelector'), - commandHandler = require('./commandHandler'), - iotaUtils = require('./iotaUtils'), - async = require('async'), - errors = require('./errors'), - thinkingThingPlugin = require('./thinkingThingPlugin'), - apply = async.apply, - context = { - op: 'IoTAgentJSON.Agent' - }, - config = require('./configService'); + transportSelector = require('./transportSelector'), + commandHandler = require('./commandHandler'), + iotaUtils = require('./iotaUtils'), + async = require('async'), + errors = require('./errors'), + thinkingThingPlugin = require('./thinkingThingPlugin'), + apply = async.apply, + context = { + op: 'IoTAgentJSON.Agent', + }, + config = require('./configService'); /** * Handler for incoming notifications for the configuration subscription mechanism. @@ -44,28 +44,36 @@ var iotAgentLib = require('iotagent-node-lib'), */ function configurationNotificationHandler(device, updates, callback) { - function invokeConfiguration(apiKey, callback) { - transportSelector.applyFunctionFromBinding( - [apiKey, device.id, updates], - 'sendConfigurationToDevice', - device.transport || config.getConfig().defaultTransport, - callback); - } - - async.waterfall([ - apply(iotaUtils.getEffectiveApiKey, device.service, device.subservice), - invokeConfiguration - ], callback); - + function invokeConfiguration(apiKey, callback) { + transportSelector.applyFunctionFromBinding( + [apiKey, device.id, updates], + 'sendConfigurationToDevice', + device.transport || config.getConfig().defaultTransport, + callback + ); + } + + async.waterfall( + [ + apply(iotaUtils.getEffectiveApiKey, device.service, device.subservice), + invokeConfiguration, + ], + callback + ); } function configurationHandler(configuration, callback) { - if (configuration.resource && config.getConfig().iota.iotManager && config.getConfig().iota.defaultResource && - configuration.resource !== config.getConfig().iota.defaultResource) { - callback(new errors.InvalidResource()); - } else { - callback(); - }} + if ( + configuration.resource && + config.getConfig().iota.iotManager && + config.getConfig().iota.defaultResource && + configuration.resource !== config.getConfig().iota.defaultResource + ) { + callback(new errors.InvalidResource()); + } else { + callback(); + } +} /** * Handles incoming updateContext requests related with lazy attributes. This handler is still just registered, @@ -76,12 +84,16 @@ function configurationHandler(configuration, callback) { * @param {Array} attributes List of NGSI attributes to update. */ function updateHandler(id, type, attributes, service, subservice, callback) { - callback(); + callback(); } function bidirectionalityNotificationHandler(device, updates, callback) { - transportSelector.applyFunctionFromBinding([device, updates], 'notificationHandler', - device.transport || config.getConfig().defaultTransport, callback); + transportSelector.applyFunctionFromBinding( + [device, updates], + 'notificationHandler', + device.transport || config.getConfig().defaultTransport, + callback + ); } /** @@ -91,13 +103,18 @@ function bidirectionalityNotificationHandler(device, updates, callback) { * @param {Object} device Device provisioning information. */ function deviceProvisioningHandler(device, callback) { - transportSelector.applyFunctionFromBinding([device], 'deviceProvisioningHandler', null, function(error, devices) { - if (error) { - callback(error); - } else { - callback(null, devices[0]); - } - }); + transportSelector.applyFunctionFromBinding( + [device], + 'deviceProvisioningHandler', + null, + function(error, devices) { + if (error) { + callback(error); + } else { + callback(null, devices[0]); + } + } + ); } /** @@ -106,50 +123,70 @@ function deviceProvisioningHandler(device, callback) { * @param {Object} newConfig New configuration object. */ function start(newConfig, callback) { - config.setLogger(iotAgentLib.logModule); - config.setConfig(newConfig); - - iotAgentLib.activate(config.getConfig().iota, function(error) { - if (error) { - callback(error); - } else { - config.getLogger().info(context, 'IoT Agent services activated'); - - iotAgentLib.setConfigurationHandler(configurationHandler); - iotAgentLib.setCommandHandler(commandHandler.handler); - iotAgentLib.setProvisioningHandler(deviceProvisioningHandler); - - iotAgentLib.setDataUpdateHandler(updateHandler); - iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.attributeAlias.update); - iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.addEvents.update); - - if (config.getConfig().iota && config.getConfig().iota.compressTimestamp) { - iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.compressTimestamp.update); - iotAgentLib.addQueryMiddleware(iotAgentLib.dataPlugins.compressTimestamp.query); - } - - if (config.getConfig().mqtt.thinkingThingsPlugin) { - iotAgentLib.addUpdateMiddleware(thinkingThingPlugin.updatePlugin); - } - - iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.expressionTransformation.update); - iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.multiEntity.update); - iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.timestampProcess.update); - - iotAgentLib.addDeviceProvisionMiddleware(iotAgentLib.dataPlugins.bidirectionalData.deviceProvision); - iotAgentLib.addConfigurationProvisionMiddleware(iotAgentLib.dataPlugins.bidirectionalData.groupProvision); - iotAgentLib.addNotificationMiddleware(iotAgentLib.dataPlugins.bidirectionalData.notification); - - if (config.getConfig().configRetrieval) { - iotAgentLib.setNotificationHandler(configurationNotificationHandler); - } else { - iotAgentLib.setNotificationHandler(bidirectionalityNotificationHandler); - } - - - transportSelector.startTransportBindings(newConfig, callback); - } - }); + config.setLogger(iotAgentLib.logModule); + config.setConfig(newConfig); + + iotAgentLib.activate(config.getConfig().iota, function(error) { + if (error) { + callback(error); + } else { + config.getLogger().info(context, 'IoT Agent services activated'); + + iotAgentLib.setConfigurationHandler(configurationHandler); + iotAgentLib.setCommandHandler(commandHandler.handler); + iotAgentLib.setProvisioningHandler(deviceProvisioningHandler); + + iotAgentLib.setDataUpdateHandler(updateHandler); + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.attributeAlias.update + ); + iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.addEvents.update); + + if ( + config.getConfig().iota && + config.getConfig().iota.compressTimestamp + ) { + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.compressTimestamp.update + ); + iotAgentLib.addQueryMiddleware( + iotAgentLib.dataPlugins.compressTimestamp.query + ); + } + + if (config.getConfig().mqtt.thinkingThingsPlugin) { + iotAgentLib.addUpdateMiddleware(thinkingThingPlugin.updatePlugin); + } + + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.expressionTransformation.update + ); + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.multiEntity.update + ); + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.timestampProcess.update + ); + + iotAgentLib.addDeviceProvisionMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.deviceProvision + ); + iotAgentLib.addConfigurationProvisionMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.groupProvision + ); + iotAgentLib.addNotificationMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.notification + ); + + if (config.getConfig().configRetrieval) { + iotAgentLib.setNotificationHandler(configurationNotificationHandler); + } else { + iotAgentLib.setNotificationHandler(bidirectionalityNotificationHandler); + } + + transportSelector.startTransportBindings(newConfig, callback); + } + }); } /** @@ -157,12 +194,15 @@ function start(newConfig, callback) { * */ function stop(callback) { - config.getLogger().info(context, 'Stopping IoT Agent'); - async.series([ - transportSelector.stopTransportBindings, - iotAgentLib.resetMiddlewares, - iotAgentLib.deactivate - ], callback); + config.getLogger().info(context, 'Stopping IoT Agent'); + async.series( + [ + transportSelector.stopTransportBindings, + iotAgentLib.resetMiddlewares, + iotAgentLib.deactivate, + ], + callback + ); } exports.start = start; diff --git a/lib/thinkingThingPlugin.js b/lib/thinkingThingPlugin.js index 1e6f1f47..b74ca185 100644 --- a/lib/thinkingThingPlugin.js +++ b/lib/thinkingThingPlugin.js @@ -26,71 +26,83 @@ 'use strict'; var iotAgentLib = require('iotagent-node-lib'), - errors = require('./errors'), - config = require('./configService'), - context = { - op: 'IoTAgentJSON.ThinkingThingsPlugin' - }; + errors = require('./errors'), + config = require('./configService'), + context = { + op: 'IoTAgentJSON.ThinkingThingsPlugin', + }; function parseBattery(payload) { - var rawValue = '0,B,' + payload, - fields = rawValue.split(','), - result = []; + var rawValue = '0,B,' + payload, + fields = rawValue.split(','), + result = []; - config.getLogger().debug(context, 'Parsing Battery module: %s', JSON.stringify(fields, null, 4)); + config + .getLogger() + .debug( + context, + 'Parsing Battery module: %s', + JSON.stringify(fields, null, 4) + ); - if (fields.length >= 8) { - result.push({ - name: 'voltage', - type: 'string', - value: fields[2] - }); - result.push({ - name: 'state', - type: 'string', - value: fields[3] - }); - result.push({ - name: 'charger', - type: 'string', - value: fields[4] - }); - result.push({ - name: 'charging', - type: 'string', - value: fields[5] - }); - result.push({ - name: 'mode', - type: 'string', - value: fields[6] - }); - result.push({ - name: 'disconnection', - type: 'string', - value: fields[7] - }); - } + if (fields.length >= 8) { + result.push({ + name: 'voltage', + type: 'string', + value: fields[2], + }); + result.push({ + name: 'state', + type: 'string', + value: fields[3], + }); + result.push({ + name: 'charger', + type: 'string', + value: fields[4], + }); + result.push({ + name: 'charging', + type: 'string', + value: fields[5], + }); + result.push({ + name: 'mode', + type: 'string', + value: fields[6], + }); + result.push({ + name: 'disconnection', + type: 'string', + value: fields[7], + }); + } - if (fields.length === 10) { - result.push({ - name: 'batteryType', - type: 'string', - value: fields[8] - }); - result.push({ - name: 'percentage', - type: 'string', - value: fields[9] - }); - } + if (fields.length === 10) { + result.push({ + name: 'batteryType', + type: 'string', + value: fields[8], + }); + result.push({ + name: 'percentage', + type: 'string', + value: fields[9], + }); + } - if (result.length !== 0) { - return result; - } else { - config.getLogger().error(context, 'TTHINGS-001: Too few fields parsing Battery module: %s', rawValue); - return []; - } + if (result.length !== 0) { + return result; + } else { + config + .getLogger() + .error( + context, + 'TTHINGS-001: Too few fields parsing Battery module: %s', + rawValue + ); + return []; + } } /** @@ -100,44 +112,52 @@ function parseBattery(payload) { * @return {Array} Collection of the attributes generated by the payload. */ function parseGSM(payload) { - var rawValue = '0,P1,' + payload, - fields = rawValue.split(','), - result = []; + var rawValue = '0,P1,' + payload, + fields = rawValue.split(','), + result = []; - config.getLogger().debug(context, 'Parsing GSM module: %s', JSON.stringify(fields, null, 4)); + config + .getLogger() + .debug(context, 'Parsing GSM module: %s', JSON.stringify(fields, null, 4)); - if (fields.length >= 7) { - result.push({ - name: 'mcc', - type: 'string', - value: fields[2] - }); - result.push({ - name: 'mnc', - type: 'string', - value: fields[3] - }); - result.push({ - name: 'lac', - type: 'string', - value: fields[4] - }); - result.push({ - name: 'cell-id', - type: 'string', - value: fields[5] - }); - result.push({ - name: 'dbm', - type: 'string', - value: fields[6] - }); + if (fields.length >= 7) { + result.push({ + name: 'mcc', + type: 'string', + value: fields[2], + }); + result.push({ + name: 'mnc', + type: 'string', + value: fields[3], + }); + result.push({ + name: 'lac', + type: 'string', + value: fields[4], + }); + result.push({ + name: 'cell-id', + type: 'string', + value: fields[5], + }); + result.push({ + name: 'dbm', + type: 'string', + value: fields[6], + }); - return result; - } else { - config.getLogger().error(context, 'TTHINGS-002: Too few fields parsing GSM module: %s', rawValue); - return []; - } + return result; + } else { + config + .getLogger() + .error( + context, + 'TTHINGS-002: Too few fields parsing GSM module: %s', + rawValue + ); + return []; + } } /** @@ -148,39 +168,47 @@ function parseGSM(payload) { * @return {Array} Collection of the attributes generated by the payload. */ function parseCell(payload) { - var rawValue = payload, - fields = rawValue.match(/..../g), - result = []; + var rawValue = payload, + fields = rawValue.match(/..../g), + result = []; - config.getLogger().debug(context, 'Parsing GSM module: %s', JSON.stringify(fields, null, 4)); + config + .getLogger() + .debug(context, 'Parsing GSM module: %s', JSON.stringify(fields, null, 4)); - if (fields.length === 4) { - result.push({ - name: 'mcc', - type: 'string', - value: fields[0] - }); - result.push({ - name: 'mnc', - type: 'string', - value: fields[1] - }); - result.push({ - name: 'lac', - type: 'string', - value: fields[2] - }); - result.push({ - name: 'cell-id', - type: 'string', - value: fields[3] - }); + if (fields.length === 4) { + result.push({ + name: 'mcc', + type: 'string', + value: fields[0], + }); + result.push({ + name: 'mnc', + type: 'string', + value: fields[1], + }); + result.push({ + name: 'lac', + type: 'string', + value: fields[2], + }); + result.push({ + name: 'cell-id', + type: 'string', + value: fields[3], + }); - return result; - } else { - config.getLogger().error(context, 'TTHINGS-003: Too few fields parsing C1 module: %s', rawValue); - return []; - } + return result; + } else { + config + .getLogger() + .error( + context, + 'TTHINGS-003: Too few fields parsing C1 module: %s', + rawValue + ); + return []; + } } /** @@ -191,23 +219,23 @@ function parseCell(payload) { * @return {Object} Modified NGSI attribute with the parsed TT payload if applicable. */ function modifyAttributes(attribute) { - switch (attribute.name) { - case 'P1': - attribute.value = parseGSM(attribute.value); - attribute.type = 'compound'; - break; - case 'C1': - attribute.name = 'P1'; - attribute.value = parseCell(attribute.value); - attribute.type = 'compound'; - break; - case 'B': - attribute.value = parseBattery(attribute.value); - attribute.type = 'compound'; - break; - } + switch (attribute.name) { + case 'P1': + attribute.value = parseGSM(attribute.value); + attribute.type = 'compound'; + break; + case 'C1': + attribute.name = 'P1'; + attribute.value = parseCell(attribute.value); + attribute.type = 'compound'; + break; + case 'B': + attribute.value = parseBattery(attribute.value); + attribute.type = 'compound'; + break; + } - return attribute; + return attribute; } /** @@ -218,23 +246,23 @@ function modifyAttributes(attribute) { * @return {Object} Modified NGSI attribute with the parsed TT payload if applicable. */ function modifyAttributesNgsi2(attributeName, attribute) { - switch (attributeName) { - case 'P1': - attribute.value = parseGSM(attribute.value); - attribute.type = 'compound'; - break; - case 'C1': - attribute.name = 'P1'; - attribute.value = parseCell(attribute.value); - attribute.type = 'compound'; - break; - case 'B': - attribute.value = parseBattery(attribute.value); - attribute.type = 'compound'; - break; - } + switch (attributeName) { + case 'P1': + attribute.value = parseGSM(attribute.value); + attribute.type = 'compound'; + break; + case 'C1': + attribute.name = 'P1'; + attribute.value = parseCell(attribute.value); + attribute.type = 'compound'; + break; + case 'B': + attribute.value = parseBattery(attribute.value); + attribute.type = 'compound'; + break; + } - return attribute; + return attribute; } /** @@ -244,16 +272,15 @@ function modifyAttributesNgsi2(attributeName, attribute) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePluginNgsi2(entity, entityType, callback) { - if (entity) { - Object.keys(entity).map(function(key, index) { - entity[key] = modifyAttributesNgsi2(key, entity[key]); - }); - - callback(null, entity, entityType); - } else { - callback(new errors.BadPayload(entity)); - } + if (entity) { + Object.keys(entity).map(function(key, index) { + entity[key] = modifyAttributesNgsi2(key, entity[key]); + }); + callback(null, entity, entityType); + } else { + callback(new errors.BadPayload(entity)); + } } /** @@ -263,16 +290,21 @@ function updatePluginNgsi2(entity, entityType, callback) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePluginNgsi1(entity, entityType, callback) { - if (entity.contextElements && entity.contextElements[0] && entity.contextElements[0].attributes) { - var moduleAttributes = entity.contextElements[0].attributes.map(modifyAttributes); - - entity.contextElements[0].attributes = moduleAttributes; + if ( + entity.contextElements && + entity.contextElements[0] && + entity.contextElements[0].attributes + ) { + var moduleAttributes = entity.contextElements[0].attributes.map( + modifyAttributes + ); - callback(null, entity, entityType); - } else { - callback(new errors.BadPayload(entity)); - } + entity.contextElements[0].attributes = moduleAttributes; + callback(null, entity, entityType); + } else { + callback(new errors.BadPayload(entity)); + } } /** @@ -281,12 +313,11 @@ function updatePluginNgsi1(entity, entityType, callback) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePlugin(entity, entityType, callback) { - if (iotAgentLib.configModule.checkNgsi2()) { - updatePluginNgsi2(entity, entityType, callback); - } - else { - updatePluginNgsi1(entity, entityType, callback); - } + if (iotAgentLib.configModule.checkNgsi2()) { + updatePluginNgsi2(entity, entityType, callback); + } else { + updatePluginNgsi1(entity, entityType, callback); + } } exports.updatePlugin = updatePlugin; diff --git a/lib/timestampProcessPlugin.js b/lib/timestampProcessPlugin.js index addafa6b..79eb21c5 100644 --- a/lib/timestampProcessPlugin.js +++ b/lib/timestampProcessPlugin.js @@ -24,11 +24,11 @@ 'use strict'; var errors = require('./errors'), - constants = require('./constants'), - config = require('./configService'), - context = { - op: 'IoTAgentJSON.TimestampProcessPlugin' - }; + constants = require('./constants'), + config = require('./configService'), + context = { + op: 'IoTAgentJSON.TimestampProcessPlugin', + }; /** * Looks for Thinking Thing modules and parses them, updating the entity with the transformed value. @@ -36,36 +36,52 @@ var errors = require('./errors'), * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePlugin(entity, entityType, callback) { - var timestamp; + var timestamp; - function insertMetadata(element) { - if (element.name !== constants.TIMESTAMP_ATTRIBUTE) { - element.metadatas = [{ - name: constants.TIMESTAMP_ATTRIBUTE, - type: constants.TIMESTAMP_TYPE, - value: timestamp.value - }]; - } - - return element; + function insertMetadata(element) { + if (element.name !== constants.TIMESTAMP_ATTRIBUTE) { + element.metadatas = [ + { + name: constants.TIMESTAMP_ATTRIBUTE, + type: constants.TIMESTAMP_TYPE, + value: timestamp.value, + }, + ]; } - if (entity.contextElements && entity.contextElements[0] && entity.contextElements[0].attributes) { - for (var i in entity.contextElements[0].attributes) { - if (entity.contextElements[0].attributes[i].name === constants.TIMESTAMP_ATTRIBUTE) { - timestamp = entity.contextElements[0].attributes[i]; - } - } + return element; + } - if (timestamp) { - entity.contextElements[0].attributes = entity.contextElements[0].attributes.map(insertMetadata); - } + if ( + entity.contextElements && + entity.contextElements[0] && + entity.contextElements[0].attributes + ) { + for (var i in entity.contextElements[0].attributes) { + if ( + entity.contextElements[0].attributes[i].name === + constants.TIMESTAMP_ATTRIBUTE + ) { + timestamp = entity.contextElements[0].attributes[i]; + } + } - callback(null, entity, entityType); - } else { - config.getLogger().error(context, 'MEASURES-001: Bad payload received while processing timestamps'); - callback(new errors.BadPayload(entity)); + if (timestamp) { + entity.contextElements[0].attributes = entity.contextElements[0].attributes.map( + insertMetadata + ); } + + callback(null, entity, entityType); + } else { + config + .getLogger() + .error( + context, + 'MEASURES-001: Bad payload received while processing timestamps' + ); + callback(new errors.BadPayload(entity)); + } } exports.updatePlugin = updatePlugin; diff --git a/lib/transportSelector.js b/lib/transportSelector.js index 5fcbefb6..999e049a 100644 --- a/lib/transportSelector.js +++ b/lib/transportSelector.js @@ -24,10 +24,10 @@ 'use strict'; var path = require('path'), - fs = require('fs'), - config = require('./configService'), - async = require('async'), - transportBindings = []; + fs = require('fs'), + config = require('./configService'), + async = require('async'), + transportBindings = []; /** * Start all the transport protocol bindings found in the bindings directory. @@ -35,37 +35,52 @@ var path = require('path'), * @param {Object} newConfig Configuration object to start the bindings */ function startTransportBindings(newConfig, callback) { - function invokeBinding(binding, callback) { - binding.start(callback); - } + function invokeBinding(binding, callback) { + binding.start(callback); + } - var bindings = fs.readdirSync(path.join(__dirname, './bindings')); + var bindings = fs.readdirSync(path.join(__dirname, './bindings')); - transportBindings = bindings.map(function(item) { - return require('./bindings/' + item); - }); + transportBindings = bindings.map(function(item) { + return require('./bindings/' + item); + }); - async.map(transportBindings, invokeBinding, function(error) { - callback(); - }); + async.map(transportBindings, invokeBinding, function(error) { + callback(); + }); } function createExecutionsForBinding(argument, functionName, protocol) { - config.getLogger().debug('Creating execution for function [%s] and protocol [%s]', functionName, protocol); - - function addHandler(current, binding) { - if (binding[functionName] && (!protocol || binding.protocol === protocol)) { - var args = [binding[functionName]].concat(argument), - boundFunction = binding[functionName].bind.apply(binding[functionName], args); - - config.getLogger().debug('Binding found for function [%s] and protocol [%s]', functionName, protocol); - current.push(boundFunction); - } - - return current; + config + .getLogger() + .debug( + 'Creating execution for function [%s] and protocol [%s]', + functionName, + protocol + ); + + function addHandler(current, binding) { + if (binding[functionName] && (!protocol || binding.protocol === protocol)) { + var args = [binding[functionName]].concat(argument), + boundFunction = binding[functionName].bind.apply( + binding[functionName], + args + ); + + config + .getLogger() + .debug( + 'Binding found for function [%s] and protocol [%s]', + functionName, + protocol + ); + current.push(boundFunction); } - return transportBindings.reduce(addHandler, []); + return current; + } + + return transportBindings.reduce(addHandler, []); } /** @@ -78,20 +93,29 @@ function createExecutionsForBinding(argument, functionName, protocol) { * @param {String} protocol Transport protocol where the function must be executed. */ function applyFunctionFromBinding(argument, functionName, protocol, callback) { - config.getLogger().debug('Looking for bindings for the function [%s] and protocol [%s]', functionName, protocol); - - async.series(createExecutionsForBinding(argument, functionName, protocol), callback); + config + .getLogger() + .debug( + 'Looking for bindings for the function [%s] and protocol [%s]', + functionName, + protocol + ); + + async.series( + createExecutionsForBinding(argument, functionName, protocol), + callback + ); } /** * Stop all the transport protocol bindings of the agent. */ function stopTransportBindings(callback) { - function invokeBinding(binding, callback) { - binding.stop(callback); - } + function invokeBinding(binding, callback) { + binding.stop(callback); + } - async.map(transportBindings, invokeBinding, callback); + async.map(transportBindings, invokeBinding, callback); } exports.stopTransportBindings = stopTransportBindings; diff --git a/test/config-startup.js b/test/config-startup.js index ab1b5773..929dec64 100644 --- a/test/config-startup.js +++ b/test/config-startup.js @@ -23,44 +23,44 @@ var config = {}; config.mqtt = { - host: 'localhost', - port: 1883, - thinkingThingsPlugin: true, - username: 'guest', - password: 'guest' + host: 'localhost', + port: 1883, + thinkingThingsPlugin: true, + username: 'guest', + password: 'guest', }; config.http = { - port: 7896 + port: 7896, }; config.amqp = { - host: 'localhost', - port: 5672, - exchange: 'amq.topic', - queue: 'iota_queue', - options: {durable: true} + host: 'localhost', + port: 5672, + exchange: 'amq.topic', + queue: 'iota_queue', + options: { durable: true }, }; config.iota = { - logLevel: 'FATAL', - contextBroker: { - host: '192.168.1.1', - port: '1026' - }, - server: { - port: 4041 - }, - deviceRegistry: { - type: 'memory' - }, - types: {}, - service: 'howtoService', - subservice: '/howto', - providerUrl: 'http://localhost:4041', - deviceRegistrationDuration: 'P1M', - defaultType: 'Thing', - defaultResource: '/iot/json' + logLevel: 'FATAL', + contextBroker: { + host: '192.168.1.1', + port: '1026', + }, + server: { + port: 4041, + }, + deviceRegistry: { + type: 'memory', + }, + types: {}, + service: 'howtoService', + subservice: '/howto', + providerUrl: 'http://localhost:4041', + deviceRegistrationDuration: 'P1M', + defaultType: 'Thing', + defaultResource: '/iot/json', }; config.defaultKey = '1234'; diff --git a/test/config-test.js b/test/config-test.js index 9a9b1f6d..9fb2a5dc 100644 --- a/test/config-test.js +++ b/test/config-test.js @@ -23,45 +23,45 @@ var config = {}; config.mqtt = { - host: 'localhost', - port: 1883, - thinkingThingsPlugin: true, - username: 'guest', - password: 'guest' + host: 'localhost', + port: 1883, + thinkingThingsPlugin: true, + username: 'guest', + password: 'guest', }; config.http = { - port: 7896 + port: 7896, }; config.amqp = { - host: 'localhost', - port: 5672, - exchange: 'amq.topic', - queue: 'iota_queue', - options: {durable: true} + host: 'localhost', + port: 5672, + exchange: 'amq.topic', + queue: 'iota_queue', + options: { durable: true }, }; config.iota = { - logLevel: 'FATAL', - contextBroker: { - host: '192.168.1.1', - port: '1026' - }, - server: { - port: 4041 - }, - deviceRegistry: { - type: 'memory' - }, - types: {}, - service: 'howtoService', - subservice: '/howto', - providerUrl: 'http://localhost:4041', - deviceRegistrationDuration: 'P1M', - defaultType: 'Thing', - defaultResource: '/iot/json', - compressTimestamp: true + logLevel: 'FATAL', + contextBroker: { + host: '192.168.1.1', + port: '1026', + }, + server: { + port: 4041, + }, + deviceRegistry: { + type: 'memory', + }, + types: {}, + service: 'howtoService', + subservice: '/howto', + providerUrl: 'http://localhost:4041', + deviceRegistrationDuration: 'P1M', + defaultType: 'Thing', + defaultResource: '/iot/json', + compressTimestamp: true, }; config.defaultKey = '1234'; diff --git a/test/utils.js b/test/utils.js index 086758e5..a1e71f92 100644 --- a/test/utils.js +++ b/test/utils.js @@ -25,19 +25,19 @@ var fs = require('fs'); function readExampleFile(name, raw) { - var text = fs.readFileSync(name, 'UTF8'); + var text = fs.readFileSync(name, 'UTF8'); - if (raw) { - return text; - } else { - return JSON.parse(text); - } + if (raw) { + return text; + } else { + return JSON.parse(text); + } } function delay(ms) { - return function(callback) { - setTimeout(callback, ms); - }; + return function(callback) { + setTimeout(callback, ms); + }; } exports.readExampleFile = readExampleFile; From 4099678e70153f36578a93c806c35c1ebedcd215 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Mon, 28 Jan 2019 13:21:37 +0100 Subject: [PATCH 03/15] Add exception for single/double quote to pass linter * Prettier will always double quote a string containing an apostrophe. --- lib/commandHandler.js | 36 ++++++++++++++++++------------------ lib/commonBindings.js | 42 +++++++++++++++++++++--------------------- lib/constants.js | 2 ++ lib/errors.js | 4 ++++ lib/iotaUtils.js | 32 +++++++++++++++++--------------- 5 files changed, 62 insertions(+), 54 deletions(-) diff --git a/lib/commandHandler.js b/lib/commandHandler.js index 76d98d5b..5bd38f67 100644 --- a/lib/commandHandler.js +++ b/lib/commandHandler.js @@ -98,14 +98,14 @@ function commandHandler(id, type, service, subservice, attributes, callback) { iotAgentLib.getDeviceByName(id, service, subservice, function(error, device) { if (error) { - config - .getLogger() - .error( - context, - "COMMAND-001: Command execution could not be handled, as device for entity [%s] [%s] wasn't found", - id, - type - ); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "COMMAND-001: Command execution could not be handled, as device for entity [%s] [%s] wasn't found", + /*jshint quotmark: single */ + id, + type + ); callback(error); } else { iotaUtils.getEffectiveApiKey(device.service, device.subservice, function( @@ -156,16 +156,16 @@ function updateCommand(apiKey, deviceId, device, messageObj) { async.series(commandUpdates, function(error) { if (error) { - config - .getLogger() - .error( - context, - "COMMANDS-002: Couldn't update command status in the Context broker " + - 'for device [%s] with apiKey [%s]: %s', - device.id, - apiKey, - error - ); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "COMMANDS-002: Couldn't update command status in the Context broker " + + /*jshint quotmark: single */ + 'for device [%s] with apiKey [%s]: %s', + device.id, + apiKey, + error + ); } else { config .getLogger() diff --git a/lib/commonBindings.js b/lib/commonBindings.js index 4fb23033..4fa83617 100644 --- a/lib/commonBindings.js +++ b/lib/commonBindings.js @@ -201,13 +201,13 @@ function singleMeasure(apiKey, deviceId, attribute, device, message) { error ) { if (error) { - config - .getLogger() - .error( - context, - "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", - error - ); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", + /*jshint quotmark: single */ + error + ); } else { config .getLogger() @@ -256,13 +256,13 @@ function multipleMeasures(apiKey, deviceId, device, messageObj) { error ) { if (error) { - config - .getLogger() - .error( - context, - "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", - error - ); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", + /*jshint quotmark: single */ + error + ); } else { config .getLogger() @@ -310,13 +310,13 @@ function messageHandler(topic, message, protocol) { } else if (parsedMessage && typeof parsedMessage === 'object') { multipleMeasures(apiKey, deviceId, device, parsedMessage); } else { - config - .getLogger() - .error( - context, - "Couldn't process message [%s] due to format issues.", - message - ); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "Couldn't process message [%s] due to format issues.", + /*jshint quotmark: single */ + message + ); } } } diff --git a/lib/constants.js b/lib/constants.js index eecaf680..f4f1a637 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -32,7 +32,9 @@ module.exports = { CONFIGURATION_COMMAND_UPDATE: 'cmdexe', CONFIGURATION_VALUES_SUFIX: 'values', + /*jshint quotmark: double */ DATE_FORMAT: "yyyymmdd'T'HHMMss'Z'", + /*jshint quotmark: single */ HTTP_MEASURE_PATH: '/iot/d', HTTP_CONFIGURATION_PATH: '/configuration', diff --git a/lib/errors.js b/lib/errors.js index d931157b..ff9da363 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -46,14 +46,18 @@ module.exports = { MandatoryParamsNotFound: function(paramList) { this.name = 'MANDATORY_PARAMS_NOT_FOUND'; this.message = + /*jshint quotmark: double */ "Some of the mandatory params weren't found in the request: " + + /*jshint quotmark: single */ JSON.stringify(paramList); this.code = 400; }, UnsupportedType: function(expectedType) { this.name = 'UNSUPPORTED_TYPE'; this.message = + /*jshint quotmark: double */ "The request content didn't have the expected type [" + + /*jshint quotmark: single */ expectedType + ' ]'; this.code = 400; diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 7973808d..560bc6bd 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -73,13 +73,13 @@ function manageConfiguration( ) { function handleSendConfigurationError(error, results) { if (error) { - config - .getLogger() - .error( - context, - "CONFIG-001: Couldn't get the requested values from the Context Broker: %s", - error - ); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "CONFIG-001: Couldn't get the requested values from the Context Broker: %s", + /*jshint quotmark: single */ + error + ); } else { config .getLogger() @@ -102,7 +102,9 @@ function manageConfiguration( ) { callback(null, results.contextResponses[0].contextElement.attributes); } else { + /*jshint quotmark: double */ callback("Couldn't find any information in Context Broker response"); + /*jshint quotmark: single */ } } @@ -230,14 +232,14 @@ function retrieveDevice(deviceId, apiKey, transport, callback) { } else if (devices && devices.length === 1) { callback(null, devices[0]); } else { - config - .getLogger() - .error( - context, - "MEASURES-001: Couldn't find device data for APIKey [%s] and DeviceId[%s]", - apiKey, - deviceId - ); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "MEASURES-001: Couldn't find device data for APIKey [%s] and DeviceId[%s]", + /*jshint quotmark: single */ + apiKey, + deviceId + ); callback(new errors.DeviceNotFound(deviceId)); } From 5137c40d37b1a24cc5bcaca2d2adbc6ab92cbcaf Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Tue, 29 Jan 2019 09:42:43 +0100 Subject: [PATCH 04/15] Husky Update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 296f6ce5..6bff97e5 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "coveralls": "~3.0.2", - "husky": "^1.1.0", + "husky": "~1.1.0", "lint-staged": "^7.3.0", "nock": "10.0.1", "mocha": "5.2.0", From 2d474ba4d37f13a14b7308b99858aea9c7486742 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Wed, 30 Jan 2019 13:30:44 +0100 Subject: [PATCH 05/15] Amend tab width --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6bff97e5..6039064d 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "test": "mocha --recursive 'test/**/*.js' --reporter spec --timeout 3000 --ui bdd --exit", "test:watch": "npm run test -- -w ./lib", "lint": "jshint lib/ --config .jshintrc && jshint test/ --config test/.jshintrc", - "prettier": "prettier --single-quote --trailing-comma es5 --write **/*.js *.js", + "prettier": "prettier --tab-width 4 --single-quote --trailing-comma es5 --write **/*.js *.js", "test:coverage": "istanbul cover _mocha -- --recursive 'test/**/*.js' --reporter spec --exit", "test:coveralls": "npm run test:coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", "watch": "watch 'npm test && npm run lint' ./lib ./test" @@ -63,7 +63,7 @@ }, "lint-staged": { "*.js": [ - "prettier --parser flow --single-quote --trailing-comma es5 --write", + "prettier --tab-width 4 --parser flow --single-quote --trailing-comma es5 --write", "git add" ] } From 7e183c75ec46616e2cc393a433caa97ef13fa7d1 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Wed, 30 Jan 2019 13:32:15 +0100 Subject: [PATCH 06/15] Rerun prettier across all files --- bin/iotaJsonTester.js | 230 +++++++++--------- client-config.js | 16 +- config.js | 310 ++++++++++++------------ lib/commandHandler.js | 218 ++++++++--------- lib/commonBindings.js | 426 +++++++++++++++++---------------- lib/configService.js | 296 +++++++++++------------ lib/constants.js | 46 ++-- lib/errors.js | 152 ++++++------ lib/iotaUtils.js | 414 ++++++++++++++++---------------- lib/iotagent-json.js | 268 +++++++++++---------- lib/thinkingThingPlugin.js | 428 +++++++++++++++++----------------- lib/timestampProcessPlugin.js | 90 +++---- lib/transportSelector.js | 111 ++++----- test/config-startup.js | 58 ++--- test/config-test.js | 60 ++--- test/utils.js | 18 +- 16 files changed, 1611 insertions(+), 1530 deletions(-) diff --git a/bin/iotaJsonTester.js b/bin/iotaJsonTester.js index f1a5f708..d9496359 100755 --- a/bin/iotaJsonTester.js +++ b/bin/iotaJsonTester.js @@ -26,154 +26,162 @@ 'use strict'; var fs = require('fs'), - defaultConfig = require('../client-config.js'), - commandLine = require('iotagent-node-lib').commandLine, - clUtils = commandLine.clUtils, - mqtt = require('mqtt'), - async = require('async'), - _ = require('underscore'), - mqttClient, - configCb = { - host: 'localhost', - port: 1026, - service: 'tester', - subservice: '/test', - }, - configIot = { - host: 'localhost', - port: 4041, - name: 'default', - service: 'tester', - subservice: '/test', - }, - config = { - host: defaultConfig.mqtt.host, - port: defaultConfig.mqtt.port, - apikey: defaultConfig.device.apikey, - deviceId: defaultConfig.device.id, - }, - separator = '\n\n\t', - token; + defaultConfig = require('../client-config.js'), + commandLine = require('iotagent-node-lib').commandLine, + clUtils = commandLine.clUtils, + mqtt = require('mqtt'), + async = require('async'), + _ = require('underscore'), + mqttClient, + configCb = { + host: 'localhost', + port: 1026, + service: 'tester', + subservice: '/test', + }, + configIot = { + host: 'localhost', + port: 4041, + name: 'default', + service: 'tester', + subservice: '/test', + }, + config = { + host: defaultConfig.mqtt.host, + port: defaultConfig.mqtt.port, + apikey: defaultConfig.device.apikey, + deviceId: defaultConfig.device.id, + }, + separator = '\n\n\t', + token; function setConfig(commands) { - config.host = commands[0]; - config.port = commands[1]; - config.apikey = commands[2]; - config.deviceId = commands[3]; + config.host = commands[0]; + config.port = commands[1]; + config.apikey = commands[2]; + config.deviceId = commands[3]; } function getConfig(commands) { - console.log('\nCurrent configuration:\n\n'); - console.log(JSON.stringify(config, null, 4)); - console.log('\n'); - clUtils.prompt(); + console.log('\nCurrent configuration:\n\n'); + console.log(JSON.stringify(config, null, 4)); + console.log('\n'); + clUtils.prompt(); } function mqttPublishHandler(error) { - if (error) { - console.log('There was an error publishing to the MQTT broker: %s', error); - } else { - console.log('Message successfully published'); - } + if (error) { + console.log( + 'There was an error publishing to the MQTT broker: %s', + error + ); + } else { + console.log('Message successfully published'); + } - clUtils.prompt(); + clUtils.prompt(); } function checkConnection(fn) { - return function(commands) { - if (mqttClient) { - fn(commands); - } else { - console.log( - 'Please, check your configuration and connect before using MQTT commands.' - ); - } - }; + return function(commands) { + if (mqttClient) { + fn(commands); + } else { + console.log( + 'Please, check your configuration and connect before using MQTT commands.' + ); + } + }; } function singleMeasure(commands) { - var topic = - '/' + config.apikey + '/' + config.deviceId + '/attributes/' + commands[0]; - - mqttClient.publish(topic, commands[1], null, mqttPublishHandler); + var topic = + '/' + + config.apikey + + '/' + + config.deviceId + + '/attributes/' + + commands[0]; + + mqttClient.publish(topic, commands[1], null, mqttPublishHandler); } function parseMultipleAttributes(attributeString) { - var result, attributes, attribute; + var result, attributes, attribute; - if (!attributeString) { - result = null; - } else { - attributes = attributeString.split(';'); - result = {}; + if (!attributeString) { + result = null; + } else { + attributes = attributeString.split(';'); + result = {}; - for (var i = 0; i < attributes.length; i++) { - attribute = attributes[i].split('='); - result[attribute[0]] = attribute[1]; + for (var i = 0; i < attributes.length; i++) { + attribute = attributes[i].split('='); + result[attribute[0]] = attribute[1]; + } } - } - return result; + return result; } function multipleMeasure(commands) { - var values = parseMultipleAttributes(commands[0]), - topic = '/' + config.apikey + '/' + config.deviceId + '/attributes'; + var values = parseMultipleAttributes(commands[0]), + topic = '/' + config.apikey + '/' + config.deviceId + '/attributes'; - mqttClient.publish(topic, JSON.stringify(values), null, mqttPublishHandler); + mqttClient.publish(topic, JSON.stringify(values), null, mqttPublishHandler); } function connect(commands) { - console.log('\nConnecting to MQTT Broker...'); + console.log('\nConnecting to MQTT Broker...'); - mqttClient = mqtt.connect( - 'mqtt://' + config.host, - defaultConfig.mqtt.options - ); + mqttClient = mqtt.connect( + 'mqtt://' + config.host, + defaultConfig.mqtt.options + ); - clUtils.prompt(); + clUtils.prompt(); } function exitClient() { - process.exit(0); + process.exit(0); } var commands = { - config: { - parameters: ['host', 'port', 'apiKey', 'deviceId'], - description: - '\tConfigure the client to emulate the selected device, connecting to the given host.', - handler: setConfig, - }, - showConfig: { - parameters: [], - description: - '\tConfigure the client to emulate the selected device, connecting to the given host.', - handler: getConfig, - }, - connect: { - parameters: [], - description: '\tConnect to the MQTT broker.', - handler: connect, - }, - singleMeasure: { - parameters: ['attribute', 'value'], - description: - '\tSend the given value for the selected attribute to the MQTT broker.', - handler: checkConnection(singleMeasure), - }, - multipleMeasure: { - parameters: ['attributes'], - description: - '\tSend a collection of attributes to the MQTT broker, using JSON format. The "attributes"\n' + - '\tstring should have the following syntax: name=value[;name=value]*', - handler: checkConnection(multipleMeasure), - }, - exit: { - parameters: [], - description: '\tExit the client', - handler: exitClient, - }, + config: { + parameters: ['host', 'port', 'apiKey', 'deviceId'], + description: + '\tConfigure the client to emulate the selected device, connecting to the given host.', + handler: setConfig, + }, + showConfig: { + parameters: [], + description: + '\tConfigure the client to emulate the selected device, connecting to the given host.', + handler: getConfig, + }, + connect: { + parameters: [], + description: '\tConnect to the MQTT broker.', + handler: connect, + }, + singleMeasure: { + parameters: ['attribute', 'value'], + description: + '\tSend the given value for the selected attribute to the MQTT broker.', + handler: checkConnection(singleMeasure), + }, + multipleMeasure: { + parameters: ['attributes'], + description: + '\tSend a collection of attributes to the MQTT broker, using JSON format. The "attributes"\n' + + '\tstring should have the following syntax: name=value[;name=value]*', + handler: checkConnection(multipleMeasure), + }, + exit: { + parameters: [], + description: '\tExit the client', + handler: exitClient, + }, }; commands = _.extend(commands, commandLine.commands); diff --git a/client-config.js b/client-config.js index 8e3ddcea..639301d1 100644 --- a/client-config.js +++ b/client-config.js @@ -23,17 +23,17 @@ var config = {}; config.mqtt = { - host: 'localhost', - port: 1883, - options: { - keepalive: 0, - connectTimeout: 60 * 60 * 1000, - }, + host: 'localhost', + port: 1883, + options: { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + }, }; config.device = { - id: 'myDeviceId', - apikey: '1234', + id: 'myDeviceId', + apikey: '1234', }; module.exports = config; diff --git a/config.js b/config.js index 67b498ab..3ad59862 100644 --- a/config.js +++ b/config.js @@ -26,180 +26,180 @@ var config = {}; * Configuration for the MQTT binding. */ config.mqtt = { - /** - * Host where the MQTT Broker is located. - */ - host: 'localhost', - /** - * Port where the MQTT Broker is listening. - */ - port: 1883, - /** - * Activating thinkingThingsPlugin flag. When it is set to true the constraint devices sends an HTTP POST request - * to the server with a Content-Type, containing a field name and a payload. The payload can be divided in modules, - * each one of them responsible for a single measure. Modules are separated by the '#' character, and all of them - * consists of a series of parameters separated by commas. - */ - thinkingThingsPlugin: true, - /** - * QoS Level: at most once (0), at least once (1), exactly once (2). (default is 2). - */ - qos: 0, - /** - * Retain flag. (default is true.) Normally if a publisher publishes a message to a topic, and no one is - * subscribed to that topic (i.e retain flag is set to false) the message is simply discarded by the broker. - * The publisher can tell the broker to keep the last message on that topic by setting the retained message flag to true . - */ - retain: false, + /** + * Host where the MQTT Broker is located. + */ + host: 'localhost', + /** + * Port where the MQTT Broker is listening. + */ + port: 1883, + /** + * Activating thinkingThingsPlugin flag. When it is set to true the constraint devices sends an HTTP POST request + * to the server with a Content-Type, containing a field name and a payload. The payload can be divided in modules, + * each one of them responsible for a single measure. Modules are separated by the '#' character, and all of them + * consists of a series of parameters separated by commas. + */ + thinkingThingsPlugin: true, + /** + * QoS Level: at most once (0), at least once (1), exactly once (2). (default is 2). + */ + qos: 0, + /** + * Retain flag. (default is true.) Normally if a publisher publishes a message to a topic, and no one is + * subscribed to that topic (i.e retain flag is set to false) the message is simply discarded by the broker. + * The publisher can tell the broker to keep the last message on that topic by setting the retained message flag to true . + */ + retain: false, }; /** * Configuration for the AMQP binding. */ config.amqp = { - /** - * Host where the AMQP broker is located. - */ - host: 'localhost', - /** - * Port where the AMQP broker is listening. - */ - port: 5672, - /** - * user name that identifies the IOTA against the AMQP broker (optional). - */ - // username: 'guest', - /** - * password to be used if the username is provided (optional). - */ - // password: 'guest', - /** - * Exchange in the AMQP broker - */ - exchange: 'iota-exchange', - /** - * Queue in the AMQP broker - */ - queue: 'iotaqueue', - /** - * durable queue flag (default is false). - */ - options: { durable: true }, + /** + * Host where the AMQP broker is located. + */ + host: 'localhost', + /** + * Port where the AMQP broker is listening. + */ + port: 5672, + /** + * user name that identifies the IOTA against the AMQP broker (optional). + */ + // username: 'guest', + /** + * password to be used if the username is provided (optional). + */ + // password: 'guest', + /** + * Exchange in the AMQP broker + */ + exchange: 'iota-exchange', + /** + * Queue in the AMQP broker + */ + queue: 'iotaqueue', + /** + * durable queue flag (default is false). + */ + options: { durable: true }, }; /** * Configuration for the HTTP transport binding. */ config.http = { - /** - * South Port where the Ultralight transport binding for HTTP will be listening for device requests. - */ - port: 7896, - /** - * HTTP Timeout for the http command endpoint (in miliseconds). - */ - //timeout: 1000 + /** + * South Port where the Ultralight transport binding for HTTP will be listening for device requests. + */ + port: 7896, + /** + * HTTP Timeout for the http command endpoint (in miliseconds). + */ + //timeout: 1000 }; config.iota = { - /** - * Configures the log level. Appropriate values are: FATAL, ERROR, INFO, WARN and DEBUG. - */ - logLevel: 'DEBUG', - /** - * When this flag is active, the IoTAgent will add the TimeInstant attribute to every entity created, as well - * as a TimeInstant metadata to each attribute, with the current timestamp. - */ - timestamp: true, - /** - * Context Broker configuration. Defines the connection information to the instance of the Context Broker where - * the IoT Agent will send the device data. - */ - contextBroker: { - /** - * Host where the Context Broker is located. + /** + * Configures the log level. Appropriate values are: FATAL, ERROR, INFO, WARN and DEBUG. */ - host: 'localhost', + logLevel: 'DEBUG', /** - * Port where the Context Broker is listening. - */ - port: '1026', - }, - /** - * Configuration of the North Port of the IoT Agent. - */ - server: { - /** - * Port where the IoT Agent will be listening for NGSI and Provisioning requests. - */ - port: 4041, - }, - /** - * Defines the configuration for the Device Registry, where all the information about devices and configuration - * groups will be stored. There are currently just two types of registries allowed: - * - * - 'memory': transient memory-based repository for testing purposes. All the information in the repository is - * wiped out when the process is restarted. - * - * - 'mongodb': persistent MongoDB storage repository. All the details for the MongoDB configuration will be read - * from the 'mongodb' configuration property. - */ - deviceRegistry: { - type: 'mongodb', - }, - /** - * Mongo DB configuration section. This section will only be used if the deviceRegistry property has the type - * 'mongodb'. - */ - mongodb: { - /** - * Host where MongoDB is located. If the MongoDB used is a replicaSet, this property will contain a - * comma-separated list of the instance names or IPs. + * When this flag is active, the IoTAgent will add the TimeInstant attribute to every entity created, as well + * as a TimeInstant metadata to each attribute, with the current timestamp. */ - host: 'localhost', + timestamp: true, + /** + * Context Broker configuration. Defines the connection information to the instance of the Context Broker where + * the IoT Agent will send the device data. + */ + contextBroker: { + /** + * Host where the Context Broker is located. + */ + host: 'localhost', + /** + * Port where the Context Broker is listening. + */ + port: '1026', + }, + /** + * Configuration of the North Port of the IoT Agent. + */ + server: { + /** + * Port where the IoT Agent will be listening for NGSI and Provisioning requests. + */ + port: 4041, + }, + /** + * Defines the configuration for the Device Registry, where all the information about devices and configuration + * groups will be stored. There are currently just two types of registries allowed: + * + * - 'memory': transient memory-based repository for testing purposes. All the information in the repository is + * wiped out when the process is restarted. + * + * - 'mongodb': persistent MongoDB storage repository. All the details for the MongoDB configuration will be read + * from the 'mongodb' configuration property. + */ + deviceRegistry: { + type: 'mongodb', + }, + /** + * Mongo DB configuration section. This section will only be used if the deviceRegistry property has the type + * 'mongodb'. + */ + mongodb: { + /** + * Host where MongoDB is located. If the MongoDB used is a replicaSet, this property will contain a + * comma-separated list of the instance names or IPs. + */ + host: 'localhost', + /** + * Port where MongoDB is listening. In the case of a replicaSet, all the instances are supposed to be listening + * in the same port. + */ + port: '27017', + /** + * Name of the Mongo database that will be created to store IoT Agent data. + */ + db: 'iotagentjson', + }, /** - * Port where MongoDB is listening. In the case of a replicaSet, all the instances are supposed to be listening - * in the same port. - */ - port: '27017', - /** - * Name of the Mongo database that will be created to store IoT Agent data. - */ - db: 'iotagentjson', - }, - /** - * Types array for static configuration of services. Check documentation in the IoT Agent Library for Node.js for - * further details: - * - * https://github.com/telefonicaid/iotagent-json#type-configuration - */ - types: {}, - /** - * Default service, for IoT Agent installations that won't require preregistration. - */ - service: 'howtoService', - /** - * Default subservice, for IoT Agent installations that won't require preregistration. - */ - subservice: '/howto', - /** - * URL Where the IoT Agent Will listen for incoming updateContext and queryContext requests (for commands and passive - * attributes). This URL will be sent in the Context Registration requests. - */ - providerUrl: 'http://localhost:4041', - /** - * Default maximum expire date for device registrations. - */ - deviceRegistrationDuration: 'P1M', - /** - * Default type, for IoT Agent installations that won't require preregistration. - */ - defaultType: 'Thing', - /** - * Default resource of the IoT Agent. This value must be different for every IoT Agent connecting to the IoT - * Manager. - */ - defaultResource: '/iot/json', + * Types array for static configuration of services. Check documentation in the IoT Agent Library for Node.js for + * further details: + * + * https://github.com/telefonicaid/iotagent-json#type-configuration + */ + types: {}, + /** + * Default service, for IoT Agent installations that won't require preregistration. + */ + service: 'howtoService', + /** + * Default subservice, for IoT Agent installations that won't require preregistration. + */ + subservice: '/howto', + /** + * URL Where the IoT Agent Will listen for incoming updateContext and queryContext requests (for commands and passive + * attributes). This URL will be sent in the Context Registration requests. + */ + providerUrl: 'http://localhost:4041', + /** + * Default maximum expire date for device registrations. + */ + deviceRegistrationDuration: 'P1M', + /** + * Default type, for IoT Agent installations that won't require preregistration. + */ + defaultType: 'Thing', + /** + * Default resource of the IoT Agent. This value must be different for every IoT Agent connecting to the IoT + * Manager. + */ + defaultResource: '/iot/json', }; /** diff --git a/lib/commandHandler.js b/lib/commandHandler.js index 5bd38f67..23218ed7 100644 --- a/lib/commandHandler.js +++ b/lib/commandHandler.js @@ -24,14 +24,14 @@ 'use strict'; var async = require('async'), - iotAgentLib = require('iotagent-node-lib'), - iotaUtils = require('./iotaUtils'), - constants = require('./constants'), - transportSelector = require('./transportSelector'), - config = require('./configService'), - context = { - op: 'IoTAgentJSON.Commands', - }; + iotAgentLib = require('iotagent-node-lib'), + iotaUtils = require('./iotaUtils'), + constants = require('./constants'), + transportSelector = require('./transportSelector'), + config = require('./configService'), + context = { + op: 'IoTAgentJSON.Commands', + }; /** * Generate a function that executes the given command in the device. @@ -42,30 +42,30 @@ var async = require('async'), * @return {Function} Command execution function ready to be called with async.series. */ function generateCommandExecution(apiKey, device, attribute) { - var payload = {}, - serialized, - executions; + var payload = {}, + serialized, + executions; - payload[attribute.name] = attribute.value; - serialized = JSON.stringify(payload); + payload[attribute.name] = attribute.value; + serialized = JSON.stringify(payload); - config - .getLogger() - .debug( - context, - 'Sending command execution to device [%s] with apikey [%s] and payload [%j] ', - apiKey, - device.id, - attribute - ); + config + .getLogger() + .debug( + context, + 'Sending command execution to device [%s] with apikey [%s] and payload [%j] ', + apiKey, + device.id, + attribute + ); - executions = transportSelector.createExecutionsForBinding( - [apiKey, device, serialized], - 'executeCommand', - device.transport - ); + executions = transportSelector.createExecutionsForBinding( + [apiKey, device, serialized], + 'executeCommand', + device.transport + ); - return executions; + return executions; } /** @@ -81,50 +81,60 @@ function generateCommandExecution(apiKey, device, attribute) { * @param {Array} attributes List of NGSI attributes of type command to execute. */ function commandHandler(id, type, service, subservice, attributes, callback) { - config - .getLogger() - .debug( - context, - 'Handling MQTT command for device [%s] in service [%s - %s]', - id, - service, - subservice - ); + config + .getLogger() + .debug( + context, + 'Handling MQTT command for device [%s] in service [%s - %s]', + id, + service, + subservice + ); - function concat(previous, current) { - previous = previous.concat(current); - return previous; - } + function concat(previous, current) { + previous = previous.concat(current); + return previous; + } - iotAgentLib.getDeviceByName(id, service, subservice, function(error, device) { - if (error) { - config.getLogger().error( - context, - /*jshint quotmark: double */ - "COMMAND-001: Command execution could not be handled, as device for entity [%s] [%s] wasn't found", - /*jshint quotmark: single */ - id, - type - ); - callback(error); - } else { - iotaUtils.getEffectiveApiKey(device.service, device.subservice, function( + iotAgentLib.getDeviceByName(id, service, subservice, function( error, - apiKey - ) { + device + ) { if (error) { - callback(error); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "COMMAND-001: Command execution could not be handled, as device for entity [%s] [%s] wasn't found", + /*jshint quotmark: single */ + id, + type + ); + callback(error); } else { - async.series( - attributes - .map(generateCommandExecution.bind(null, apiKey, device)) - .reduce(concat, []), - callback - ); + iotaUtils.getEffectiveApiKey( + device.service, + device.subservice, + function(error, apiKey) { + if (error) { + callback(error); + } else { + async.series( + attributes + .map( + generateCommandExecution.bind( + null, + apiKey, + device + ) + ) + .reduce(concat, []), + callback + ); + } + } + ); } - }); - } - }); + }); } /** @@ -136,47 +146,47 @@ function commandHandler(id, type, service, subservice, attributes, callback) { * @param {Object} messageObj JSON object sent using MQTT. */ function updateCommand(apiKey, deviceId, device, messageObj) { - var commandList = Object.keys(messageObj), - commandUpdates = []; + var commandList = Object.keys(messageObj), + commandUpdates = []; - for (var i = 0; i < commandList.length; i++) { - commandUpdates.push( - async.apply( - iotAgentLib.setCommandResult, - device.name, - config.getConfig().iota.defaultResource, - apiKey, - commandList[i], - messageObj[commandList[i]], - constants.COMMAND_STATUS_COMPLETED, - device - ) - ); - } - - async.series(commandUpdates, function(error) { - if (error) { - config.getLogger().error( - context, - /*jshint quotmark: double */ - "COMMANDS-002: Couldn't update command status in the Context broker " + - /*jshint quotmark: single */ - 'for device [%s] with apiKey [%s]: %s', - device.id, - apiKey, - error - ); - } else { - config - .getLogger() - .debug( - context, - 'Single measure for device [%s] with apiKey [%s] successfully updated', - device.id, - apiKey + for (var i = 0; i < commandList.length; i++) { + commandUpdates.push( + async.apply( + iotAgentLib.setCommandResult, + device.name, + config.getConfig().iota.defaultResource, + apiKey, + commandList[i], + messageObj[commandList[i]], + constants.COMMAND_STATUS_COMPLETED, + device + ) ); } - }); + + async.series(commandUpdates, function(error) { + if (error) { + config.getLogger().error( + context, + /*jshint quotmark: double */ + "COMMANDS-002: Couldn't update command status in the Context broker " + + /*jshint quotmark: single */ + 'for device [%s] with apiKey [%s]: %s', + device.id, + apiKey, + error + ); + } else { + config + .getLogger() + .debug( + context, + 'Single measure for device [%s] with apiKey [%s] successfully updated', + device.id, + apiKey + ); + } + }); } exports.generateCommandExecution = generateCommandExecution; diff --git a/lib/commonBindings.js b/lib/commonBindings.js index 4fa83617..998a7f06 100644 --- a/lib/commonBindings.js +++ b/lib/commonBindings.js @@ -26,15 +26,15 @@ 'use strict'; var iotAgentLib = require('iotagent-node-lib'), - commandHandler = require('./commandHandler'), - transportSelector = require('./transportSelector'), - async = require('async'), - iotaUtils = require('./iotaUtils'), - constants = require('./constants'), - context = { - op: 'IoTAgentJSON.commonBinding', - }, - config = require('./configService'); + commandHandler = require('./commandHandler'), + transportSelector = require('./transportSelector'), + async = require('async'), + iotaUtils = require('./iotaUtils'), + constants = require('./constants'), + context = { + op: 'IoTAgentJSON.commonBinding', + }, + config = require('./configService'); /** * Parse a message received from a Topic. @@ -43,34 +43,34 @@ var iotAgentLib = require('iotagent-node-lib'), * @return {Object} Parsed message or null if an error has occurred. */ function parseMessage(message) { - var parsedMessage, stringMessage; + var parsedMessage, stringMessage; - try { - stringMessage = message.toString(); - parsedMessage = JSON.parse(stringMessage); - } catch (e) { - config - .getLogger() - .debug( - context, - 'Parse error treating message [%s]: %j', - stringMessage, - e - ); - parsedMessage = null; - } + try { + stringMessage = message.toString(); + parsedMessage = JSON.parse(stringMessage); + } catch (e) { + config + .getLogger() + .debug( + context, + 'Parse error treating message [%s]: %j', + stringMessage, + e + ); + parsedMessage = null; + } - if (!parsedMessage) { - config - .getLogger() - .error( - context, - 'MEASURES-003: Impossible to handle malformed message: %s', - message - ); - } + if (!parsedMessage) { + config + .getLogger() + .error( + context, + 'MEASURES-003: Impossible to handle malformed message: %s', + message + ); + } - return parsedMessage; + return parsedMessage; } /** @@ -82,54 +82,54 @@ function parseMessage(message) { * @return {String} String identifier of the attribute type. */ function guessType(attribute, device) { - if (device.active) { - for (var i = 0; i < device.active.length; i++) { - if (device.active[i].name === attribute) { - return device.active[i].type; - } + if (device.active) { + for (var i = 0; i < device.active.length; i++) { + if (device.active[i].name === attribute) { + return device.active[i].type; + } + } } - } - if (attribute === constants.TIMESTAMP_ATTRIBUTE) { - if (iotAgentLib.configModule.checkNgsi2()) { - return constants.TIMESTAMP_TYPE_NGSI2; + if (attribute === constants.TIMESTAMP_ATTRIBUTE) { + if (iotAgentLib.configModule.checkNgsi2()) { + return constants.TIMESTAMP_TYPE_NGSI2; + } else { + return constants.TIMESTAMP_TYPE; + } } else { - return constants.TIMESTAMP_TYPE; + return constants.DEFAULT_ATTRIBUTE_TYPE; } - } else { - return constants.DEFAULT_ATTRIBUTE_TYPE; - } } function extractAttributes(device, current) { - var values = []; + var values = []; - for (var i in current) { - if (current.hasOwnProperty(i)) { - values.push({ - name: i, - type: guessType(i, device), - value: current[i], - }); + for (var i in current) { + if (current.hasOwnProperty(i)) { + values.push({ + name: i, + type: guessType(i, device), + value: current[i], + }); + } } - } - return values; + return values; } function sendConfigurationToDevice( - device, - apiKey, - deviceId, - results, - callback -) { - transportSelector.applyFunctionFromBinding( - [apiKey, deviceId, results], - 'sendConfigurationToDevice', - device.transport, + device, + apiKey, + deviceId, + results, callback - ); +) { + transportSelector.applyFunctionFromBinding( + [apiKey, deviceId, results], + 'sendConfigurationToDevice', + device.transport, + callback + ); } /** @@ -143,28 +143,28 @@ function sendConfigurationToDevice( * @param {Object} objMessage JSON object received. */ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { - iotaUtils.manageConfiguration( - apiKey, - deviceId, - device, - objMessage, - async.apply(sendConfigurationToDevice, device), - function(error) { - if (error) { - iotAgentLib.alarms.raise(constants.MQTTB_ALARM, error); - } else { - iotAgentLib.alarms.release(constants.MQTTB_ALARM); - config - .getLogger() - .debug( - context, - 'Configuration request finished for APIKey [%s] and Device [%s]', - apiKey, - deviceId - ); - } - } - ); + iotaUtils.manageConfiguration( + apiKey, + deviceId, + device, + objMessage, + async.apply(sendConfigurationToDevice, device), + function(error) { + if (error) { + iotAgentLib.alarms.raise(constants.MQTTB_ALARM, error); + } else { + iotAgentLib.alarms.release(constants.MQTTB_ALARM); + config + .getLogger() + .debug( + context, + 'Configuration request finished for APIKey [%s] and Device [%s]', + apiKey, + deviceId + ); + } + } + ); } /** @@ -178,47 +178,47 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { * @param {Buffer} message Raw message coming from the client. */ function singleMeasure(apiKey, deviceId, attribute, device, message) { - var values; - - config - .getLogger() - .debug( - context, - 'Processing single measure for device [%s] with apiKey [%s]', - deviceId, - apiKey - ); - - values = [ - { - name: attribute, - type: guessType(attribute, device), - value: message.toString(), - }, - ]; + var values; - iotAgentLib.update(device.name, device.type, '', values, device, function( - error - ) { - if (error) { - config.getLogger().error( - context, - /*jshint quotmark: double */ - "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", - /*jshint quotmark: single */ - error - ); - } else { - config + config .getLogger() .debug( - context, - 'Single measure for device [%s] with apiKey [%s] successfully updated', - deviceId, - apiKey + context, + 'Processing single measure for device [%s] with apiKey [%s]', + deviceId, + apiKey ); - } - }); + + values = [ + { + name: attribute, + type: guessType(attribute, device), + value: message.toString(), + }, + ]; + + iotAgentLib.update(device.name, device.type, '', values, device, function( + error + ) { + if (error) { + config.getLogger().error( + context, + /*jshint quotmark: double */ + "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", + /*jshint quotmark: single */ + error + ); + } else { + config + .getLogger() + .debug( + context, + 'Single measure for device [%s] with apiKey [%s] successfully updated', + deviceId, + apiKey + ); + } + }); } /** @@ -231,49 +231,49 @@ function singleMeasure(apiKey, deviceId, attribute, device, message) { * @param {Object} messageObj JSON object sent using. */ function multipleMeasures(apiKey, deviceId, device, messageObj) { - var values = []; + var values = []; - config - .getLogger() - .debug( - context, - 'Processing multiple measures for device [%s] with apiKey [%s]', - deviceId, - apiKey - ); - - for (var i in messageObj) { - if (messageObj.hasOwnProperty(i)) { - values.push({ - name: i, - type: guessType(i, device), - value: messageObj[i], - }); - } - } - - iotAgentLib.update(device.name, device.type, '', values, device, function( - error - ) { - if (error) { - config.getLogger().error( - context, - /*jshint quotmark: double */ - "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", - /*jshint quotmark: single */ - error - ); - } else { - config + config .getLogger() .debug( - context, - 'Multiple measures for device [%s] with apiKey [%s] successfully updated', - deviceId, - apiKey + context, + 'Processing multiple measures for device [%s] with apiKey [%s]', + deviceId, + apiKey ); + + for (var i in messageObj) { + if (messageObj.hasOwnProperty(i)) { + values.push({ + name: i, + type: guessType(i, device), + value: messageObj[i], + }); + } } - }); + + iotAgentLib.update(device.name, device.type, '', values, device, function( + error + ) { + if (error) { + config.getLogger().error( + context, + /*jshint quotmark: double */ + "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", + /*jshint quotmark: single */ + error + ); + } else { + config + .getLogger() + .debug( + context, + 'Multiple measures for device [%s] with apiKey [%s] successfully updated', + deviceId, + apiKey + ); + } + }); } /** @@ -284,45 +284,65 @@ function multipleMeasures(apiKey, deviceId, device, messageObj) { * @param {Object} message message body (Object or Buffer, depending on the value). */ function messageHandler(topic, message, protocol) { - var topicInformation = topic.split('/'), - apiKey = topicInformation[1], - deviceId = topicInformation[2], - parsedMessage = parseMessage(message); + var topicInformation = topic.split('/'), + apiKey = topicInformation[1], + deviceId = topicInformation[2], + parsedMessage = parseMessage(message); - function processDeviceMeasure(error, device) { - if (error) { - config - .getLogger() - .error(context, 'MEASURES-004: Device not found for topic [%s]', topic); - } else { - if ( - topicInformation[3] === 'configuration' && - topicInformation[4] === 'commands' && - parsedMessage - ) { - manageConfigurationRequest(apiKey, deviceId, device, parsedMessage); - } else if (topicInformation[4]) { - singleMeasure(apiKey, deviceId, topicInformation[4], device, message); - } else if ( - topicInformation[3] === constants.CONFIGURATION_COMMAND_UPDATE - ) { - commandHandler.updateCommand(apiKey, deviceId, device, parsedMessage); - } else if (parsedMessage && typeof parsedMessage === 'object') { - multipleMeasures(apiKey, deviceId, device, parsedMessage); - } else { - config.getLogger().error( - context, - /*jshint quotmark: double */ - "Couldn't process message [%s] due to format issues.", - /*jshint quotmark: single */ - message - ); - } + function processDeviceMeasure(error, device) { + if (error) { + config + .getLogger() + .error( + context, + 'MEASURES-004: Device not found for topic [%s]', + topic + ); + } else { + if ( + topicInformation[3] === 'configuration' && + topicInformation[4] === 'commands' && + parsedMessage + ) { + manageConfigurationRequest( + apiKey, + deviceId, + device, + parsedMessage + ); + } else if (topicInformation[4]) { + singleMeasure( + apiKey, + deviceId, + topicInformation[4], + device, + message + ); + } else if ( + topicInformation[3] === constants.CONFIGURATION_COMMAND_UPDATE + ) { + commandHandler.updateCommand( + apiKey, + deviceId, + device, + parsedMessage + ); + } else if (parsedMessage && typeof parsedMessage === 'object') { + multipleMeasures(apiKey, deviceId, device, parsedMessage); + } else { + config.getLogger().error( + context, + /*jshint quotmark: double */ + "Couldn't process message [%s] due to format issues.", + /*jshint quotmark: single */ + message + ); + } + } } - } - iotAgentLib.alarms.release(constants.MQTTB_ALARM); - iotaUtils.retrieveDevice(deviceId, apiKey, protocol, processDeviceMeasure); + iotAgentLib.alarms.release(constants.MQTTB_ALARM); + iotaUtils.retrieveDevice(deviceId, apiKey, protocol, processDeviceMeasure); } /** @@ -333,7 +353,7 @@ function messageHandler(topic, message, protocol) { * @param {Object} message AMQP message body (Object or Buffer, depending on the value). */ function amqpMessageHandler(topic, message) { - messageHandler(topic, message, 'AMQP'); + messageHandler(topic, message, 'AMQP'); } /** @@ -344,7 +364,7 @@ function amqpMessageHandler(topic, message) { * @param {Object} message MQTT message body (Object or Buffer, depending on the value). */ function mqttMessageHandler(topic, message) { - messageHandler(topic, message, 'MQTT'); + messageHandler(topic, message, 'MQTT'); } exports.amqpMessageHandler = amqpMessageHandler; diff --git a/lib/configService.js b/lib/configService.js index 0ce0ad93..6429d272 100644 --- a/lib/configService.js +++ b/lib/configService.js @@ -24,172 +24,176 @@ 'use strict'; var config = {}, - logger = require('logops'); + logger = require('logops'); function anyIsSet(variableSet) { - for (var i = 0; i < variableSet.length; i++) { - if (process.env[variableSet[i]]) { - return true; + for (var i = 0; i < variableSet.length; i++) { + if (process.env[variableSet[i]]) { + return true; + } } - } - return false; + return false; } function processEnvironmentVariables() { - var environmentVariables = [ - 'IOTA_MQTT_HOST', - 'IOTA_MQTT_PORT', - 'IOTA_MQTT_USERNAME', - 'IOTA_MQTT_PASSWORD', - 'IOTA_MQTT_QOS', - 'IOTA_MQTT_RETAIN', - 'IOTA_AMQP_HOST', - 'IOTA_AMQP_PORT', - 'IOTA_AMQP_USERNAME', - 'IOTA_AMQP_PASSWORD', - 'IOTA_AMQP_EXCHANGE', - 'IOTA_AMQP_QUEUE', - 'IOTA_AMQP_DURABLE', - 'IOTA_AMQP_RETRIES', - 'IOTA_AMQP_RETRY_TIME', - 'IOTA_HTTP_HOST', - 'IOTA_HTTP_PORT', - 'IOTA_HTTP_TIMEOUT', - ], - mqttVariables = [ - 'IOTA_MQTT_HOST', - 'IOTA_MQTT_PORT', - 'IOTA_MQTT_USERNAME', - 'IOTA_MQTT_PASSWORD', - 'IOTA_MQTT_QOS', - 'IOTA_MQTT_RETAIN', - ], - amqpVariables = [ - 'IOTA_AMQP_HOST', - 'IOTA_AMQP_PORT', - 'IOTA_AMQP_USERNAME', - 'IOTA_AMQP_PASSWORD', - 'IOTA_AMQP_EXCHANGE', - 'IOTA_AMQP_QUEUE', - 'IOTA_AMQP_DURABLE', - 'IOTA_AMQP_RETRIES', - 'IOTA_AMQP_RETRY_TIME', - ], - httpVariables = ['IOTA_HTTP_HOST', 'IOTA_HTTP_PORT', 'IOTA_HTTP_TIMEOUT']; - - for (var i = 0; i < environmentVariables.length; i++) { - if (process.env[environmentVariables[i]]) { - logger.info( - 'Setting %s to environment value: %s', - environmentVariables[i], - process.env[environmentVariables[i]] - ); - } - } - - if (anyIsSet(mqttVariables)) { - config.mqtt = {}; - } - - if (process.env.IOTA_MQTT_HOST) { - config.mqtt.host = process.env.IOTA_MQTT_HOST; - } - - if (process.env.IOTA_MQTT_PORT) { - config.mqtt.port = process.env.IOTA_MQTT_PORT; - } - - if (process.env.IOTA_MQTT_USERNAME) { - config.mqtt.username = process.env.IOTA_MQTT_USERNAME; - } - - if (process.env.IOTA_MQTT_PASSWORD) { - config.mqtt.password = process.env.IOTA_MQTT_PASSWORD; - } - - if (process.env.IOTA_MQTT_QOS) { - config.mqtt.qos = process.env.IOTA_MQTT_QOS; - } - - if (process.env.IOTA_MQTT_RETAIN) { - config.mqtt.retain = process.env.IOTA_MQTT_RETAIN === 'true'; - } - - if (anyIsSet(amqpVariables)) { - config.amqp = {}; - } - - if (process.env.IOTA_AMQP_HOST) { - config.amqp.host = process.env.IOTA_AMQP_HOST; - } - - if (process.env.IOTA_AMQP_PORT) { - config.amqp.port = process.env.IOTA_AMQP_PORT; - } - - if (process.env.IOTA_AMQP_USERNAME) { - config.amqp.username = process.env.IOTA_AMQP_USERNAME; - } - - if (process.env.IOTA_AMQP_PASSWORD) { - config.amqp.password = process.env.IOTA_AMQP_PASSWORD; - } - - if (process.env.IOTA_AMQP_EXCHANGE) { - config.amqp.exchange = process.env.IOTA_AMQP_EXCHANGE; - } - - if (process.env.IOTA_AMQP_QUEUE) { - config.amqp.queue = process.env.IOTA_AMQP_QUEUE; - } - - if (process.env.IOTA_AMQP_DURABLE) { - config.amqp.options = {}; - config.amqp.options.durable = process.env.IOTA_AMQP_DURABLE === 'true'; - } - - if (process.env.IOTA_AMQP_RETRIES) { - config.amqp.retries = process.env.IOTA_AMQP_RETRIES; - } - - if (process.env.IOTA_AMQP_RETRY_TIME) { - config.amqp.retryTime = process.env.IOTA_AMQP_RETRY_TIME; - } - - if (anyIsSet(httpVariables)) { - config.http = {}; - } - - if (process.env.IOTA_HTTP_HOST) { - config.http.host = process.env.IOTA_HTTP_HOST; - } - - if (process.env.IOTA_HTTP_PORT) { - config.http.port = process.env.IOTA_HTTP_PORT; - } - - if (process.env.IOTA_HTTP_TIMEOUT) { - config.http.timeout = process.env.IOTA_HTTP_TIMEOUT; - } + var environmentVariables = [ + 'IOTA_MQTT_HOST', + 'IOTA_MQTT_PORT', + 'IOTA_MQTT_USERNAME', + 'IOTA_MQTT_PASSWORD', + 'IOTA_MQTT_QOS', + 'IOTA_MQTT_RETAIN', + 'IOTA_AMQP_HOST', + 'IOTA_AMQP_PORT', + 'IOTA_AMQP_USERNAME', + 'IOTA_AMQP_PASSWORD', + 'IOTA_AMQP_EXCHANGE', + 'IOTA_AMQP_QUEUE', + 'IOTA_AMQP_DURABLE', + 'IOTA_AMQP_RETRIES', + 'IOTA_AMQP_RETRY_TIME', + 'IOTA_HTTP_HOST', + 'IOTA_HTTP_PORT', + 'IOTA_HTTP_TIMEOUT', + ], + mqttVariables = [ + 'IOTA_MQTT_HOST', + 'IOTA_MQTT_PORT', + 'IOTA_MQTT_USERNAME', + 'IOTA_MQTT_PASSWORD', + 'IOTA_MQTT_QOS', + 'IOTA_MQTT_RETAIN', + ], + amqpVariables = [ + 'IOTA_AMQP_HOST', + 'IOTA_AMQP_PORT', + 'IOTA_AMQP_USERNAME', + 'IOTA_AMQP_PASSWORD', + 'IOTA_AMQP_EXCHANGE', + 'IOTA_AMQP_QUEUE', + 'IOTA_AMQP_DURABLE', + 'IOTA_AMQP_RETRIES', + 'IOTA_AMQP_RETRY_TIME', + ], + httpVariables = [ + 'IOTA_HTTP_HOST', + 'IOTA_HTTP_PORT', + 'IOTA_HTTP_TIMEOUT', + ]; + + for (var i = 0; i < environmentVariables.length; i++) { + if (process.env[environmentVariables[i]]) { + logger.info( + 'Setting %s to environment value: %s', + environmentVariables[i], + process.env[environmentVariables[i]] + ); + } + } + + if (anyIsSet(mqttVariables)) { + config.mqtt = {}; + } + + if (process.env.IOTA_MQTT_HOST) { + config.mqtt.host = process.env.IOTA_MQTT_HOST; + } + + if (process.env.IOTA_MQTT_PORT) { + config.mqtt.port = process.env.IOTA_MQTT_PORT; + } + + if (process.env.IOTA_MQTT_USERNAME) { + config.mqtt.username = process.env.IOTA_MQTT_USERNAME; + } + + if (process.env.IOTA_MQTT_PASSWORD) { + config.mqtt.password = process.env.IOTA_MQTT_PASSWORD; + } + + if (process.env.IOTA_MQTT_QOS) { + config.mqtt.qos = process.env.IOTA_MQTT_QOS; + } + + if (process.env.IOTA_MQTT_RETAIN) { + config.mqtt.retain = process.env.IOTA_MQTT_RETAIN === 'true'; + } + + if (anyIsSet(amqpVariables)) { + config.amqp = {}; + } + + if (process.env.IOTA_AMQP_HOST) { + config.amqp.host = process.env.IOTA_AMQP_HOST; + } + + if (process.env.IOTA_AMQP_PORT) { + config.amqp.port = process.env.IOTA_AMQP_PORT; + } + + if (process.env.IOTA_AMQP_USERNAME) { + config.amqp.username = process.env.IOTA_AMQP_USERNAME; + } + + if (process.env.IOTA_AMQP_PASSWORD) { + config.amqp.password = process.env.IOTA_AMQP_PASSWORD; + } + + if (process.env.IOTA_AMQP_EXCHANGE) { + config.amqp.exchange = process.env.IOTA_AMQP_EXCHANGE; + } + + if (process.env.IOTA_AMQP_QUEUE) { + config.amqp.queue = process.env.IOTA_AMQP_QUEUE; + } + + if (process.env.IOTA_AMQP_DURABLE) { + config.amqp.options = {}; + config.amqp.options.durable = process.env.IOTA_AMQP_DURABLE === 'true'; + } + + if (process.env.IOTA_AMQP_RETRIES) { + config.amqp.retries = process.env.IOTA_AMQP_RETRIES; + } + + if (process.env.IOTA_AMQP_RETRY_TIME) { + config.amqp.retryTime = process.env.IOTA_AMQP_RETRY_TIME; + } + + if (anyIsSet(httpVariables)) { + config.http = {}; + } + + if (process.env.IOTA_HTTP_HOST) { + config.http.host = process.env.IOTA_HTTP_HOST; + } + + if (process.env.IOTA_HTTP_PORT) { + config.http.port = process.env.IOTA_HTTP_PORT; + } + + if (process.env.IOTA_HTTP_TIMEOUT) { + config.http.timeout = process.env.IOTA_HTTP_TIMEOUT; + } } function setConfig(newConfig) { - config = newConfig; + config = newConfig; - processEnvironmentVariables(); + processEnvironmentVariables(); } function getConfig() { - return config; + return config; } function setLogger(newLogger) { - logger = newLogger; + logger = newLogger; } function getLogger() { - return logger; + return logger; } exports.setConfig = setConfig; diff --git a/lib/constants.js b/lib/constants.js index f4f1a637..6a156025 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -26,34 +26,34 @@ 'use strict'; module.exports = { - MEASURES_SUFIX: 'attrs', - CONFIGURATION_SUFIX: 'configuration', - CONFIGURATION_COMMAND_SUFIX: 'commands', - CONFIGURATION_COMMAND_UPDATE: 'cmdexe', - CONFIGURATION_VALUES_SUFIX: 'values', + MEASURES_SUFIX: 'attrs', + CONFIGURATION_SUFIX: 'configuration', + CONFIGURATION_COMMAND_SUFIX: 'commands', + CONFIGURATION_COMMAND_UPDATE: 'cmdexe', + CONFIGURATION_VALUES_SUFIX: 'values', - /*jshint quotmark: double */ - DATE_FORMAT: "yyyymmdd'T'HHMMss'Z'", - /*jshint quotmark: single */ + /*jshint quotmark: double */ + DATE_FORMAT: "yyyymmdd'T'HHMMss'Z'", + /*jshint quotmark: single */ - HTTP_MEASURE_PATH: '/iot/d', - HTTP_CONFIGURATION_PATH: '/configuration', - HTTP_COMMANDS_PATH: '/commands', + HTTP_MEASURE_PATH: '/iot/d', + HTTP_CONFIGURATION_PATH: '/configuration', + HTTP_COMMANDS_PATH: '/commands', - TIMESTAMP_ATTRIBUTE: 'TimeInstant', - TIMESTAMP_TYPE: 'ISO8601', - TIMESTAMP_TYPE_NGSI2: 'DateTime', + TIMESTAMP_ATTRIBUTE: 'TimeInstant', + TIMESTAMP_TYPE: 'ISO8601', + TIMESTAMP_TYPE_NGSI2: 'DateTime', - DEFAULT_ATTRIBUTE_TYPE: 'string', + DEFAULT_ATTRIBUTE_TYPE: 'string', - COMMAND_STATUS_PENDING: 'PENDING', - COMMAND_STATUS_ERROR: 'ERROR', - COMMAND_STATUS_COMPLETED: 'OK', + COMMAND_STATUS_PENDING: 'PENDING', + COMMAND_STATUS_ERROR: 'ERROR', + COMMAND_STATUS_COMPLETED: 'OK', - MQTTB_ALARM: 'MQTTB-ALARM', + MQTTB_ALARM: 'MQTTB-ALARM', - AMQP_DEFAULT_EXCHANGE: 'amq.topic', - AMQP_DEFAULT_QUEUE: 'iotaqueue', - AMQP_DEFAULT_RETRIES: 5, - AMQP_DEFAULT_RETRY_TIME: 5, + AMQP_DEFAULT_EXCHANGE: 'amq.topic', + AMQP_DEFAULT_QUEUE: 'iotaqueue', + AMQP_DEFAULT_RETRIES: 5, + AMQP_DEFAULT_RETRY_TIME: 5, }; diff --git a/lib/errors.js b/lib/errors.js index ff9da363..e44b4dc6 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -24,79 +24,81 @@ 'use strict'; module.exports = { - InvalidResource: function() { - this.name = 'INVALID_RESOURCE'; - this.message = 'MQTT+JSON Groups must have an empty resource field.'; - this.code = 400; - }, - BadPayload: function(payload) { - this.name = 'BAD_PAYLOAD'; - this.message = 'The request payload [' + payload + '] could not be parsed'; - this.code = 400; - }, - GroupNotFound: function(service, subservice) { - this.name = 'GROUP_NOT_FOUND'; - this.message = - 'Group not found for service [' + - service + - '] and subservice [' + - subservice + - ']'; - }, - MandatoryParamsNotFound: function(paramList) { - this.name = 'MANDATORY_PARAMS_NOT_FOUND'; - this.message = - /*jshint quotmark: double */ - "Some of the mandatory params weren't found in the request: " + - /*jshint quotmark: single */ - JSON.stringify(paramList); - this.code = 400; - }, - UnsupportedType: function(expectedType) { - this.name = 'UNSUPPORTED_TYPE'; - this.message = - /*jshint quotmark: double */ - "The request content didn't have the expected type [" + - /*jshint quotmark: single */ - expectedType + - ' ]'; - this.code = 400; - }, - DeviceNotFound: function(deviceId) { - this.name = 'DEVICE_NOT_FOUND'; - this.message = 'Device not found with ID [' + deviceId + ']'; - this.code = 404; - }, - ConfigurationError: function(parameter) { - this.name = 'CONFIGURATION_ERROR'; - this.message = 'Mandatory configuration parameter not found: ' + parameter; - this.code = 500; - }, - HTTPCommandResponseError: function(code, error) { - this.name = 'HTTP_COMMAND_RESPONSE_ERROR'; - this.message = - 'There was an error in the response of a device to a command [' + - code + - ' ]:' + - error; - this.code = 400; - }, - EndpointNotFound: function(id) { - this.name = 'ENDPOINT_NOT_FOUND'; - this.message = - 'The provisioned device [' + - id + - ' ] did not have an HTTP endpoint to call'; - this.code = 400; - }, - DeviceEndpointError: function(code, msg) { - this.name = 'DEVICE_ENDPOINT_ERROR'; - this.message = - 'Request to the device ended up in error with code [' + - code + - ' ] and message [' + - msg + - ']'; - this.code = code; - }, + InvalidResource: function() { + this.name = 'INVALID_RESOURCE'; + this.message = 'MQTT+JSON Groups must have an empty resource field.'; + this.code = 400; + }, + BadPayload: function(payload) { + this.name = 'BAD_PAYLOAD'; + this.message = + 'The request payload [' + payload + '] could not be parsed'; + this.code = 400; + }, + GroupNotFound: function(service, subservice) { + this.name = 'GROUP_NOT_FOUND'; + this.message = + 'Group not found for service [' + + service + + '] and subservice [' + + subservice + + ']'; + }, + MandatoryParamsNotFound: function(paramList) { + this.name = 'MANDATORY_PARAMS_NOT_FOUND'; + this.message = + /*jshint quotmark: double */ + "Some of the mandatory params weren't found in the request: " + + /*jshint quotmark: single */ + JSON.stringify(paramList); + this.code = 400; + }, + UnsupportedType: function(expectedType) { + this.name = 'UNSUPPORTED_TYPE'; + this.message = + /*jshint quotmark: double */ + "The request content didn't have the expected type [" + + /*jshint quotmark: single */ + expectedType + + ' ]'; + this.code = 400; + }, + DeviceNotFound: function(deviceId) { + this.name = 'DEVICE_NOT_FOUND'; + this.message = 'Device not found with ID [' + deviceId + ']'; + this.code = 404; + }, + ConfigurationError: function(parameter) { + this.name = 'CONFIGURATION_ERROR'; + this.message = + 'Mandatory configuration parameter not found: ' + parameter; + this.code = 500; + }, + HTTPCommandResponseError: function(code, error) { + this.name = 'HTTP_COMMAND_RESPONSE_ERROR'; + this.message = + 'There was an error in the response of a device to a command [' + + code + + ' ]:' + + error; + this.code = 400; + }, + EndpointNotFound: function(id) { + this.name = 'ENDPOINT_NOT_FOUND'; + this.message = + 'The provisioned device [' + + id + + ' ] did not have an HTTP endpoint to call'; + this.code = 400; + }, + DeviceEndpointError: function(code, msg) { + this.name = 'DEVICE_ENDPOINT_ERROR'; + this.message = + 'Request to the device ended up in error with code [' + + code + + ' ] and message [' + + msg + + ']'; + this.code = code; + }, }; diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 560bc6bd..77eb3802 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -22,15 +22,15 @@ */ var iotAgentLib = require('iotagent-node-lib'), - errors = require('./errors'), - dateFormat = require('dateformat'), - async = require('async'), - apply = async.apply, - constants = require('./constants'), - context = { - op: 'IoTAgentJSON.Utils', - }, - config = require('./configService'); + errors = require('./errors'), + dateFormat = require('dateformat'), + async = require('async'), + apply = async.apply, + constants = require('./constants'), + context = { + op: 'IoTAgentJSON.Utils', + }, + config = require('./configService'); /** * Get the API Key for the selected service if there is any, or the default API Key if a specific one does not exist. @@ -39,179 +39,187 @@ var iotAgentLib = require('iotagent-node-lib'), * @param {String} subservice Name of the subservice whose API Key we are retrieving. */ function getEffectiveApiKey(service, subservice, callback) { - config.getLogger().debug(context, 'Getting effective API Key'); + config.getLogger().debug(context, 'Getting effective API Key'); - iotAgentLib.findConfiguration(service, subservice, function(error, group) { - if (group) { - config.getLogger().debug(context, 'Using found group: %j', group); - callback(null, group.apikey); - } else if (config.getConfig().defaultKey) { - config - .getLogger() - .debug( - context, - 'Using default API Key: %s', - config.getConfig().defaultKey - ); - callback(null, config.getConfig().defaultKey); - } else { - config - .getLogger() - .error(context, 'Could not find any API Key information for device.'); - callback(new errors.GroupNotFound(service, subservice)); - } - }); + iotAgentLib.findConfiguration(service, subservice, function(error, group) { + if (group) { + config.getLogger().debug(context, 'Using found group: %j', group); + callback(null, group.apikey); + } else if (config.getConfig().defaultKey) { + config + .getLogger() + .debug( + context, + 'Using default API Key: %s', + config.getConfig().defaultKey + ); + callback(null, config.getConfig().defaultKey); + } else { + config + .getLogger() + .error( + context, + 'Could not find any API Key information for device.' + ); + callback(new errors.GroupNotFound(service, subservice)); + } + }); } function manageConfiguration( - apiKey, - deviceId, - device, - objMessage, - sendFunction, - callback + apiKey, + deviceId, + device, + objMessage, + sendFunction, + callback ) { - function handleSendConfigurationError(error, results) { - if (error) { - config.getLogger().error( - context, - /*jshint quotmark: double */ - "CONFIG-001: Couldn't get the requested values from the Context Broker: %s", - /*jshint quotmark: single */ - error - ); - } else { - config - .getLogger() - .debug( - context, - 'Configuration attributes sent to the device successfully.', - deviceId, - apiKey - ); - } - - callback(error); - } + function handleSendConfigurationError(error, results) { + if (error) { + config.getLogger().error( + context, + /*jshint quotmark: double */ + "CONFIG-001: Couldn't get the requested values from the Context Broker: %s", + /*jshint quotmark: single */ + error + ); + } else { + config + .getLogger() + .debug( + context, + 'Configuration attributes sent to the device successfully.', + deviceId, + apiKey + ); + } - function extractAttributes(results, callback) { - if ( - results.contextResponses && - results.contextResponses[0] && - results.contextResponses[0].contextElement.attributes - ) { - callback(null, results.contextResponses[0].contextElement.attributes); - } else { - /*jshint quotmark: double */ - callback("Couldn't find any information in Context Broker response"); - /*jshint quotmark: single */ + callback(error); } - } - if (objMessage.type === 'configuration') { - async.waterfall( - [ - apply( - iotAgentLib.query, - device.name, - device.type, - '', - objMessage.fields, - device - ), - extractAttributes, - apply(sendFunction, apiKey, deviceId), - ], - handleSendConfigurationError - ); - } else if (objMessage.type === 'subscription') { - iotAgentLib.subscribe( - device, - objMessage.fields, - objMessage.fields, - function(error) { - if (error) { - config - .getLogger() - .error( - context, - 'CONFIG-002: There was an error subscribing device [%s] to attributes [%j]', - device.name, - objMessage.fields + function extractAttributes(results, callback) { + if ( + results.contextResponses && + results.contextResponses[0] && + results.contextResponses[0].contextElement.attributes + ) { + callback( + null, + results.contextResponses[0].contextElement.attributes ); } else { - config - .getLogger() - .debug( - context, - 'Successfully subscribed device [%s] to attributes[%j]', - device.name, - objMessage.fields + /*jshint quotmark: double */ + callback( + "Couldn't find any information in Context Broker response" ); + /*jshint quotmark: single */ } + } - callback(error); - } - ); - } else { - config - .getLogger() - .error( - context, - 'CONFIG-003: Unknown command type from device [%s]', - device.name - ); - callback(); - } + if (objMessage.type === 'configuration') { + async.waterfall( + [ + apply( + iotAgentLib.query, + device.name, + device.type, + '', + objMessage.fields, + device + ), + extractAttributes, + apply(sendFunction, apiKey, deviceId), + ], + handleSendConfigurationError + ); + } else if (objMessage.type === 'subscription') { + iotAgentLib.subscribe( + device, + objMessage.fields, + objMessage.fields, + function(error) { + if (error) { + config + .getLogger() + .error( + context, + 'CONFIG-002: There was an error subscribing device [%s] to attributes [%j]', + device.name, + objMessage.fields + ); + } else { + config + .getLogger() + .debug( + context, + 'Successfully subscribed device [%s] to attributes[%j]', + device.name, + objMessage.fields + ); + } + + callback(error); + } + ); + } else { + config + .getLogger() + .error( + context, + 'CONFIG-003: Unknown command type from device [%s]', + device.name + ); + callback(); + } } function createConfigurationNotification(results) { - var configurations = {}, - now = new Date(); + var configurations = {}, + now = new Date(); - for (var i = 0; i < results.length; i++) { - configurations[results[i].name] = results[i].value; - } + for (var i = 0; i < results.length; i++) { + configurations[results[i].name] = results[i].value; + } - configurations.dt = dateFormat(now, constants.DATE_FORMAT); - return configurations; + configurations.dt = dateFormat(now, constants.DATE_FORMAT); + return configurations; } function findOrCreate(deviceId, transport, group, callback) { - iotAgentLib.getDevice(deviceId, group.service, group.subservice, function( - error, - device - ) { - if (!error && device) { - callback(null, device, group); - } else if (error.name === 'DEVICE_NOT_FOUND') { - var newDevice = { - id: deviceId, - service: group.service, - subservice: group.subservice, - type: group.type, - }; - if ( - config.getConfig().iota && - config.getConfig().iota.iotManager && - config.getConfig().iota.iotManager.protocol - ) { - newDevice.protocol = config.getConfig().iota.iotManager.protocol; - } - // Fix transport depending on binding - if (!newDevice.transport) { - newDevice.transport = transport; - } - if ('timestamp' in group) { - newDevice.timestamp = group.timestamp; - } - iotAgentLib.register(newDevice, function(error, device) { - callback(error, device, group); - }); - } else { - callback(error); - } - }); + iotAgentLib.getDevice(deviceId, group.service, group.subservice, function( + error, + device + ) { + if (!error && device) { + callback(null, device, group); + } else if (error.name === 'DEVICE_NOT_FOUND') { + var newDevice = { + id: deviceId, + service: group.service, + subservice: group.subservice, + type: group.type, + }; + if ( + config.getConfig().iota && + config.getConfig().iota.iotManager && + config.getConfig().iota.iotManager.protocol + ) { + newDevice.protocol = config.getConfig().iota.iotManager.protocol; + } + // Fix transport depending on binding + if (!newDevice.transport) { + newDevice.transport = transport; + } + if ('timestamp' in group) { + newDevice.timestamp = group.timestamp; + } + iotAgentLib.register(newDevice, function(error, device) { + callback(error, device, group); + }); + } else { + callback(error); + } + }); } /** @@ -222,46 +230,52 @@ function findOrCreate(deviceId, transport, group, callback) { * @param {String} apiKey APIKey of the Device Group (or default APIKey). */ function retrieveDevice(deviceId, apiKey, transport, callback) { - if (apiKey === config.getConfig().defaultKey) { - iotAgentLib.getDevicesByAttribute('id', deviceId, null, null, function( - error, - devices - ) { - if (error) { - callback(error); - } else if (devices && devices.length === 1) { - callback(null, devices[0]); - } else { - config.getLogger().error( - context, - /*jshint quotmark: double */ - "MEASURES-001: Couldn't find device data for APIKey [%s] and DeviceId[%s]", - /*jshint quotmark: single */ - apiKey, - deviceId - ); + if (apiKey === config.getConfig().defaultKey) { + iotAgentLib.getDevicesByAttribute('id', deviceId, null, null, function( + error, + devices + ) { + if (error) { + callback(error); + } else if (devices && devices.length === 1) { + callback(null, devices[0]); + } else { + config.getLogger().error( + context, + /*jshint quotmark: double */ + "MEASURES-001: Couldn't find device data for APIKey [%s] and DeviceId[%s]", + /*jshint quotmark: single */ + apiKey, + deviceId + ); - callback(new errors.DeviceNotFound(deviceId)); - } - }); - } else { - async.waterfall( - [ - apply( - iotAgentLib.getConfiguration, - config.getConfig().iota.defaultResource || '', - apiKey - ), - apply(findOrCreate, deviceId, transport), - apply( - iotAgentLib.mergeDeviceWithConfiguration, - ['lazy', 'active', 'staticAttributes', 'commands', 'subscriptions'], - [null, null, [], [], [], [], []] - ), - ], - callback - ); - } + callback(new errors.DeviceNotFound(deviceId)); + } + }); + } else { + async.waterfall( + [ + apply( + iotAgentLib.getConfiguration, + config.getConfig().iota.defaultResource || '', + apiKey + ), + apply(findOrCreate, deviceId, transport), + apply( + iotAgentLib.mergeDeviceWithConfiguration, + [ + 'lazy', + 'active', + 'staticAttributes', + 'commands', + 'subscriptions', + ], + [null, null, [], [], [], [], []] + ), + ], + callback + ); + } } exports.createConfigurationNotification = createConfigurationNotification; diff --git a/lib/iotagent-json.js b/lib/iotagent-json.js index d96b74df..e5f1c8ed 100644 --- a/lib/iotagent-json.js +++ b/lib/iotagent-json.js @@ -24,17 +24,17 @@ 'use strict'; var iotAgentLib = require('iotagent-node-lib'), - transportSelector = require('./transportSelector'), - commandHandler = require('./commandHandler'), - iotaUtils = require('./iotaUtils'), - async = require('async'), - errors = require('./errors'), - thinkingThingPlugin = require('./thinkingThingPlugin'), - apply = async.apply, - context = { - op: 'IoTAgentJSON.Agent', - }, - config = require('./configService'); + transportSelector = require('./transportSelector'), + commandHandler = require('./commandHandler'), + iotaUtils = require('./iotaUtils'), + async = require('async'), + errors = require('./errors'), + thinkingThingPlugin = require('./thinkingThingPlugin'), + apply = async.apply, + context = { + op: 'IoTAgentJSON.Agent', + }, + config = require('./configService'); /** * Handler for incoming notifications for the configuration subscription mechanism. @@ -44,35 +44,39 @@ var iotAgentLib = require('iotagent-node-lib'), */ function configurationNotificationHandler(device, updates, callback) { - function invokeConfiguration(apiKey, callback) { - transportSelector.applyFunctionFromBinding( - [apiKey, device.id, updates], - 'sendConfigurationToDevice', - device.transport || config.getConfig().defaultTransport, - callback + function invokeConfiguration(apiKey, callback) { + transportSelector.applyFunctionFromBinding( + [apiKey, device.id, updates], + 'sendConfigurationToDevice', + device.transport || config.getConfig().defaultTransport, + callback + ); + } + + async.waterfall( + [ + apply( + iotaUtils.getEffectiveApiKey, + device.service, + device.subservice + ), + invokeConfiguration, + ], + callback ); - } - - async.waterfall( - [ - apply(iotaUtils.getEffectiveApiKey, device.service, device.subservice), - invokeConfiguration, - ], - callback - ); } function configurationHandler(configuration, callback) { - if ( - configuration.resource && - config.getConfig().iota.iotManager && - config.getConfig().iota.defaultResource && - configuration.resource !== config.getConfig().iota.defaultResource - ) { - callback(new errors.InvalidResource()); - } else { - callback(); - } + if ( + configuration.resource && + config.getConfig().iota.iotManager && + config.getConfig().iota.defaultResource && + configuration.resource !== config.getConfig().iota.defaultResource + ) { + callback(new errors.InvalidResource()); + } else { + callback(); + } } /** @@ -84,16 +88,16 @@ function configurationHandler(configuration, callback) { * @param {Array} attributes List of NGSI attributes to update. */ function updateHandler(id, type, attributes, service, subservice, callback) { - callback(); + callback(); } function bidirectionalityNotificationHandler(device, updates, callback) { - transportSelector.applyFunctionFromBinding( - [device, updates], - 'notificationHandler', - device.transport || config.getConfig().defaultTransport, - callback - ); + transportSelector.applyFunctionFromBinding( + [device, updates], + 'notificationHandler', + device.transport || config.getConfig().defaultTransport, + callback + ); } /** @@ -103,18 +107,18 @@ function bidirectionalityNotificationHandler(device, updates, callback) { * @param {Object} device Device provisioning information. */ function deviceProvisioningHandler(device, callback) { - transportSelector.applyFunctionFromBinding( - [device], - 'deviceProvisioningHandler', - null, - function(error, devices) { - if (error) { - callback(error); - } else { - callback(null, devices[0]); - } - } - ); + transportSelector.applyFunctionFromBinding( + [device], + 'deviceProvisioningHandler', + null, + function(error, devices) { + if (error) { + callback(error); + } else { + callback(null, devices[0]); + } + } + ); } /** @@ -123,70 +127,78 @@ function deviceProvisioningHandler(device, callback) { * @param {Object} newConfig New configuration object. */ function start(newConfig, callback) { - config.setLogger(iotAgentLib.logModule); - config.setConfig(newConfig); - - iotAgentLib.activate(config.getConfig().iota, function(error) { - if (error) { - callback(error); - } else { - config.getLogger().info(context, 'IoT Agent services activated'); - - iotAgentLib.setConfigurationHandler(configurationHandler); - iotAgentLib.setCommandHandler(commandHandler.handler); - iotAgentLib.setProvisioningHandler(deviceProvisioningHandler); - - iotAgentLib.setDataUpdateHandler(updateHandler); - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.attributeAlias.update - ); - iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.addEvents.update); - - if ( - config.getConfig().iota && - config.getConfig().iota.compressTimestamp - ) { - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.compressTimestamp.update - ); - iotAgentLib.addQueryMiddleware( - iotAgentLib.dataPlugins.compressTimestamp.query - ); - } - - if (config.getConfig().mqtt.thinkingThingsPlugin) { - iotAgentLib.addUpdateMiddleware(thinkingThingPlugin.updatePlugin); - } - - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.expressionTransformation.update - ); - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.multiEntity.update - ); - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.timestampProcess.update - ); - - iotAgentLib.addDeviceProvisionMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.deviceProvision - ); - iotAgentLib.addConfigurationProvisionMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.groupProvision - ); - iotAgentLib.addNotificationMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.notification - ); - - if (config.getConfig().configRetrieval) { - iotAgentLib.setNotificationHandler(configurationNotificationHandler); - } else { - iotAgentLib.setNotificationHandler(bidirectionalityNotificationHandler); - } - - transportSelector.startTransportBindings(newConfig, callback); - } - }); + config.setLogger(iotAgentLib.logModule); + config.setConfig(newConfig); + + iotAgentLib.activate(config.getConfig().iota, function(error) { + if (error) { + callback(error); + } else { + config.getLogger().info(context, 'IoT Agent services activated'); + + iotAgentLib.setConfigurationHandler(configurationHandler); + iotAgentLib.setCommandHandler(commandHandler.handler); + iotAgentLib.setProvisioningHandler(deviceProvisioningHandler); + + iotAgentLib.setDataUpdateHandler(updateHandler); + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.attributeAlias.update + ); + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.addEvents.update + ); + + if ( + config.getConfig().iota && + config.getConfig().iota.compressTimestamp + ) { + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.compressTimestamp.update + ); + iotAgentLib.addQueryMiddleware( + iotAgentLib.dataPlugins.compressTimestamp.query + ); + } + + if (config.getConfig().mqtt.thinkingThingsPlugin) { + iotAgentLib.addUpdateMiddleware( + thinkingThingPlugin.updatePlugin + ); + } + + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.expressionTransformation.update + ); + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.multiEntity.update + ); + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.timestampProcess.update + ); + + iotAgentLib.addDeviceProvisionMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.deviceProvision + ); + iotAgentLib.addConfigurationProvisionMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.groupProvision + ); + iotAgentLib.addNotificationMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.notification + ); + + if (config.getConfig().configRetrieval) { + iotAgentLib.setNotificationHandler( + configurationNotificationHandler + ); + } else { + iotAgentLib.setNotificationHandler( + bidirectionalityNotificationHandler + ); + } + + transportSelector.startTransportBindings(newConfig, callback); + } + }); } /** @@ -194,15 +206,15 @@ function start(newConfig, callback) { * */ function stop(callback) { - config.getLogger().info(context, 'Stopping IoT Agent'); - async.series( - [ - transportSelector.stopTransportBindings, - iotAgentLib.resetMiddlewares, - iotAgentLib.deactivate, - ], - callback - ); + config.getLogger().info(context, 'Stopping IoT Agent'); + async.series( + [ + transportSelector.stopTransportBindings, + iotAgentLib.resetMiddlewares, + iotAgentLib.deactivate, + ], + callback + ); } exports.start = start; diff --git a/lib/thinkingThingPlugin.js b/lib/thinkingThingPlugin.js index b74ca185..827e01bf 100644 --- a/lib/thinkingThingPlugin.js +++ b/lib/thinkingThingPlugin.js @@ -26,83 +26,83 @@ 'use strict'; var iotAgentLib = require('iotagent-node-lib'), - errors = require('./errors'), - config = require('./configService'), - context = { - op: 'IoTAgentJSON.ThinkingThingsPlugin', - }; + errors = require('./errors'), + config = require('./configService'), + context = { + op: 'IoTAgentJSON.ThinkingThingsPlugin', + }; function parseBattery(payload) { - var rawValue = '0,B,' + payload, - fields = rawValue.split(','), - result = []; + var rawValue = '0,B,' + payload, + fields = rawValue.split(','), + result = []; - config - .getLogger() - .debug( - context, - 'Parsing Battery module: %s', - JSON.stringify(fields, null, 4) - ); + config + .getLogger() + .debug( + context, + 'Parsing Battery module: %s', + JSON.stringify(fields, null, 4) + ); - if (fields.length >= 8) { - result.push({ - name: 'voltage', - type: 'string', - value: fields[2], - }); - result.push({ - name: 'state', - type: 'string', - value: fields[3], - }); - result.push({ - name: 'charger', - type: 'string', - value: fields[4], - }); - result.push({ - name: 'charging', - type: 'string', - value: fields[5], - }); - result.push({ - name: 'mode', - type: 'string', - value: fields[6], - }); - result.push({ - name: 'disconnection', - type: 'string', - value: fields[7], - }); - } + if (fields.length >= 8) { + result.push({ + name: 'voltage', + type: 'string', + value: fields[2], + }); + result.push({ + name: 'state', + type: 'string', + value: fields[3], + }); + result.push({ + name: 'charger', + type: 'string', + value: fields[4], + }); + result.push({ + name: 'charging', + type: 'string', + value: fields[5], + }); + result.push({ + name: 'mode', + type: 'string', + value: fields[6], + }); + result.push({ + name: 'disconnection', + type: 'string', + value: fields[7], + }); + } - if (fields.length === 10) { - result.push({ - name: 'batteryType', - type: 'string', - value: fields[8], - }); - result.push({ - name: 'percentage', - type: 'string', - value: fields[9], - }); - } + if (fields.length === 10) { + result.push({ + name: 'batteryType', + type: 'string', + value: fields[8], + }); + result.push({ + name: 'percentage', + type: 'string', + value: fields[9], + }); + } - if (result.length !== 0) { - return result; - } else { - config - .getLogger() - .error( - context, - 'TTHINGS-001: Too few fields parsing Battery module: %s', - rawValue - ); - return []; - } + if (result.length !== 0) { + return result; + } else { + config + .getLogger() + .error( + context, + 'TTHINGS-001: Too few fields parsing Battery module: %s', + rawValue + ); + return []; + } } /** @@ -112,52 +112,56 @@ function parseBattery(payload) { * @return {Array} Collection of the attributes generated by the payload. */ function parseGSM(payload) { - var rawValue = '0,P1,' + payload, - fields = rawValue.split(','), - result = []; + var rawValue = '0,P1,' + payload, + fields = rawValue.split(','), + result = []; - config - .getLogger() - .debug(context, 'Parsing GSM module: %s', JSON.stringify(fields, null, 4)); + config + .getLogger() + .debug( + context, + 'Parsing GSM module: %s', + JSON.stringify(fields, null, 4) + ); - if (fields.length >= 7) { - result.push({ - name: 'mcc', - type: 'string', - value: fields[2], - }); - result.push({ - name: 'mnc', - type: 'string', - value: fields[3], - }); - result.push({ - name: 'lac', - type: 'string', - value: fields[4], - }); - result.push({ - name: 'cell-id', - type: 'string', - value: fields[5], - }); - result.push({ - name: 'dbm', - type: 'string', - value: fields[6], - }); + if (fields.length >= 7) { + result.push({ + name: 'mcc', + type: 'string', + value: fields[2], + }); + result.push({ + name: 'mnc', + type: 'string', + value: fields[3], + }); + result.push({ + name: 'lac', + type: 'string', + value: fields[4], + }); + result.push({ + name: 'cell-id', + type: 'string', + value: fields[5], + }); + result.push({ + name: 'dbm', + type: 'string', + value: fields[6], + }); - return result; - } else { - config - .getLogger() - .error( - context, - 'TTHINGS-002: Too few fields parsing GSM module: %s', - rawValue - ); - return []; - } + return result; + } else { + config + .getLogger() + .error( + context, + 'TTHINGS-002: Too few fields parsing GSM module: %s', + rawValue + ); + return []; + } } /** @@ -168,47 +172,51 @@ function parseGSM(payload) { * @return {Array} Collection of the attributes generated by the payload. */ function parseCell(payload) { - var rawValue = payload, - fields = rawValue.match(/..../g), - result = []; + var rawValue = payload, + fields = rawValue.match(/..../g), + result = []; - config - .getLogger() - .debug(context, 'Parsing GSM module: %s', JSON.stringify(fields, null, 4)); + config + .getLogger() + .debug( + context, + 'Parsing GSM module: %s', + JSON.stringify(fields, null, 4) + ); - if (fields.length === 4) { - result.push({ - name: 'mcc', - type: 'string', - value: fields[0], - }); - result.push({ - name: 'mnc', - type: 'string', - value: fields[1], - }); - result.push({ - name: 'lac', - type: 'string', - value: fields[2], - }); - result.push({ - name: 'cell-id', - type: 'string', - value: fields[3], - }); + if (fields.length === 4) { + result.push({ + name: 'mcc', + type: 'string', + value: fields[0], + }); + result.push({ + name: 'mnc', + type: 'string', + value: fields[1], + }); + result.push({ + name: 'lac', + type: 'string', + value: fields[2], + }); + result.push({ + name: 'cell-id', + type: 'string', + value: fields[3], + }); - return result; - } else { - config - .getLogger() - .error( - context, - 'TTHINGS-003: Too few fields parsing C1 module: %s', - rawValue - ); - return []; - } + return result; + } else { + config + .getLogger() + .error( + context, + 'TTHINGS-003: Too few fields parsing C1 module: %s', + rawValue + ); + return []; + } } /** @@ -219,23 +227,23 @@ function parseCell(payload) { * @return {Object} Modified NGSI attribute with the parsed TT payload if applicable. */ function modifyAttributes(attribute) { - switch (attribute.name) { - case 'P1': - attribute.value = parseGSM(attribute.value); - attribute.type = 'compound'; - break; - case 'C1': - attribute.name = 'P1'; - attribute.value = parseCell(attribute.value); - attribute.type = 'compound'; - break; - case 'B': - attribute.value = parseBattery(attribute.value); - attribute.type = 'compound'; - break; - } + switch (attribute.name) { + case 'P1': + attribute.value = parseGSM(attribute.value); + attribute.type = 'compound'; + break; + case 'C1': + attribute.name = 'P1'; + attribute.value = parseCell(attribute.value); + attribute.type = 'compound'; + break; + case 'B': + attribute.value = parseBattery(attribute.value); + attribute.type = 'compound'; + break; + } - return attribute; + return attribute; } /** @@ -246,23 +254,23 @@ function modifyAttributes(attribute) { * @return {Object} Modified NGSI attribute with the parsed TT payload if applicable. */ function modifyAttributesNgsi2(attributeName, attribute) { - switch (attributeName) { - case 'P1': - attribute.value = parseGSM(attribute.value); - attribute.type = 'compound'; - break; - case 'C1': - attribute.name = 'P1'; - attribute.value = parseCell(attribute.value); - attribute.type = 'compound'; - break; - case 'B': - attribute.value = parseBattery(attribute.value); - attribute.type = 'compound'; - break; - } + switch (attributeName) { + case 'P1': + attribute.value = parseGSM(attribute.value); + attribute.type = 'compound'; + break; + case 'C1': + attribute.name = 'P1'; + attribute.value = parseCell(attribute.value); + attribute.type = 'compound'; + break; + case 'B': + attribute.value = parseBattery(attribute.value); + attribute.type = 'compound'; + break; + } - return attribute; + return attribute; } /** @@ -272,15 +280,15 @@ function modifyAttributesNgsi2(attributeName, attribute) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePluginNgsi2(entity, entityType, callback) { - if (entity) { - Object.keys(entity).map(function(key, index) { - entity[key] = modifyAttributesNgsi2(key, entity[key]); - }); + if (entity) { + Object.keys(entity).map(function(key, index) { + entity[key] = modifyAttributesNgsi2(key, entity[key]); + }); - callback(null, entity, entityType); - } else { - callback(new errors.BadPayload(entity)); - } + callback(null, entity, entityType); + } else { + callback(new errors.BadPayload(entity)); + } } /** @@ -290,21 +298,21 @@ function updatePluginNgsi2(entity, entityType, callback) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePluginNgsi1(entity, entityType, callback) { - if ( - entity.contextElements && - entity.contextElements[0] && - entity.contextElements[0].attributes - ) { - var moduleAttributes = entity.contextElements[0].attributes.map( - modifyAttributes - ); + if ( + entity.contextElements && + entity.contextElements[0] && + entity.contextElements[0].attributes + ) { + var moduleAttributes = entity.contextElements[0].attributes.map( + modifyAttributes + ); - entity.contextElements[0].attributes = moduleAttributes; + entity.contextElements[0].attributes = moduleAttributes; - callback(null, entity, entityType); - } else { - callback(new errors.BadPayload(entity)); - } + callback(null, entity, entityType); + } else { + callback(new errors.BadPayload(entity)); + } } /** @@ -313,11 +321,11 @@ function updatePluginNgsi1(entity, entityType, callback) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePlugin(entity, entityType, callback) { - if (iotAgentLib.configModule.checkNgsi2()) { - updatePluginNgsi2(entity, entityType, callback); - } else { - updatePluginNgsi1(entity, entityType, callback); - } + if (iotAgentLib.configModule.checkNgsi2()) { + updatePluginNgsi2(entity, entityType, callback); + } else { + updatePluginNgsi1(entity, entityType, callback); + } } exports.updatePlugin = updatePlugin; diff --git a/lib/timestampProcessPlugin.js b/lib/timestampProcessPlugin.js index 79eb21c5..13e29dfc 100644 --- a/lib/timestampProcessPlugin.js +++ b/lib/timestampProcessPlugin.js @@ -24,11 +24,11 @@ 'use strict'; var errors = require('./errors'), - constants = require('./constants'), - config = require('./configService'), - context = { - op: 'IoTAgentJSON.TimestampProcessPlugin', - }; + constants = require('./constants'), + config = require('./configService'), + context = { + op: 'IoTAgentJSON.TimestampProcessPlugin', + }; /** * Looks for Thinking Thing modules and parses them, updating the entity with the transformed value. @@ -36,52 +36,52 @@ var errors = require('./errors'), * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePlugin(entity, entityType, callback) { - var timestamp; + var timestamp; - function insertMetadata(element) { - if (element.name !== constants.TIMESTAMP_ATTRIBUTE) { - element.metadatas = [ - { - name: constants.TIMESTAMP_ATTRIBUTE, - type: constants.TIMESTAMP_TYPE, - value: timestamp.value, - }, - ]; + function insertMetadata(element) { + if (element.name !== constants.TIMESTAMP_ATTRIBUTE) { + element.metadatas = [ + { + name: constants.TIMESTAMP_ATTRIBUTE, + type: constants.TIMESTAMP_TYPE, + value: timestamp.value, + }, + ]; + } + + return element; } - return element; - } + if ( + entity.contextElements && + entity.contextElements[0] && + entity.contextElements[0].attributes + ) { + for (var i in entity.contextElements[0].attributes) { + if ( + entity.contextElements[0].attributes[i].name === + constants.TIMESTAMP_ATTRIBUTE + ) { + timestamp = entity.contextElements[0].attributes[i]; + } + } - if ( - entity.contextElements && - entity.contextElements[0] && - entity.contextElements[0].attributes - ) { - for (var i in entity.contextElements[0].attributes) { - if ( - entity.contextElements[0].attributes[i].name === - constants.TIMESTAMP_ATTRIBUTE - ) { - timestamp = entity.contextElements[0].attributes[i]; - } - } + if (timestamp) { + entity.contextElements[0].attributes = entity.contextElements[0].attributes.map( + insertMetadata + ); + } - if (timestamp) { - entity.contextElements[0].attributes = entity.contextElements[0].attributes.map( - insertMetadata - ); + callback(null, entity, entityType); + } else { + config + .getLogger() + .error( + context, + 'MEASURES-001: Bad payload received while processing timestamps' + ); + callback(new errors.BadPayload(entity)); } - - callback(null, entity, entityType); - } else { - config - .getLogger() - .error( - context, - 'MEASURES-001: Bad payload received while processing timestamps' - ); - callback(new errors.BadPayload(entity)); - } } exports.updatePlugin = updatePlugin; diff --git a/lib/transportSelector.js b/lib/transportSelector.js index 999e049a..e84d21a4 100644 --- a/lib/transportSelector.js +++ b/lib/transportSelector.js @@ -24,10 +24,10 @@ 'use strict'; var path = require('path'), - fs = require('fs'), - config = require('./configService'), - async = require('async'), - transportBindings = []; + fs = require('fs'), + config = require('./configService'), + async = require('async'), + transportBindings = []; /** * Start all the transport protocol bindings found in the bindings directory. @@ -35,52 +35,55 @@ var path = require('path'), * @param {Object} newConfig Configuration object to start the bindings */ function startTransportBindings(newConfig, callback) { - function invokeBinding(binding, callback) { - binding.start(callback); - } + function invokeBinding(binding, callback) { + binding.start(callback); + } - var bindings = fs.readdirSync(path.join(__dirname, './bindings')); + var bindings = fs.readdirSync(path.join(__dirname, './bindings')); - transportBindings = bindings.map(function(item) { - return require('./bindings/' + item); - }); + transportBindings = bindings.map(function(item) { + return require('./bindings/' + item); + }); - async.map(transportBindings, invokeBinding, function(error) { - callback(); - }); + async.map(transportBindings, invokeBinding, function(error) { + callback(); + }); } function createExecutionsForBinding(argument, functionName, protocol) { - config - .getLogger() - .debug( - 'Creating execution for function [%s] and protocol [%s]', - functionName, - protocol - ); - - function addHandler(current, binding) { - if (binding[functionName] && (!protocol || binding.protocol === protocol)) { - var args = [binding[functionName]].concat(argument), - boundFunction = binding[functionName].bind.apply( - binding[functionName], - args - ); - - config + config .getLogger() .debug( - 'Binding found for function [%s] and protocol [%s]', - functionName, - protocol + 'Creating execution for function [%s] and protocol [%s]', + functionName, + protocol ); - current.push(boundFunction); - } - return current; - } + function addHandler(current, binding) { + if ( + binding[functionName] && + (!protocol || binding.protocol === protocol) + ) { + var args = [binding[functionName]].concat(argument), + boundFunction = binding[functionName].bind.apply( + binding[functionName], + args + ); + + config + .getLogger() + .debug( + 'Binding found for function [%s] and protocol [%s]', + functionName, + protocol + ); + current.push(boundFunction); + } + + return current; + } - return transportBindings.reduce(addHandler, []); + return transportBindings.reduce(addHandler, []); } /** @@ -93,29 +96,29 @@ function createExecutionsForBinding(argument, functionName, protocol) { * @param {String} protocol Transport protocol where the function must be executed. */ function applyFunctionFromBinding(argument, functionName, protocol, callback) { - config - .getLogger() - .debug( - 'Looking for bindings for the function [%s] and protocol [%s]', - functionName, - protocol - ); + config + .getLogger() + .debug( + 'Looking for bindings for the function [%s] and protocol [%s]', + functionName, + protocol + ); - async.series( - createExecutionsForBinding(argument, functionName, protocol), - callback - ); + async.series( + createExecutionsForBinding(argument, functionName, protocol), + callback + ); } /** * Stop all the transport protocol bindings of the agent. */ function stopTransportBindings(callback) { - function invokeBinding(binding, callback) { - binding.stop(callback); - } + function invokeBinding(binding, callback) { + binding.stop(callback); + } - async.map(transportBindings, invokeBinding, callback); + async.map(transportBindings, invokeBinding, callback); } exports.stopTransportBindings = stopTransportBindings; diff --git a/test/config-startup.js b/test/config-startup.js index 929dec64..ceab1129 100644 --- a/test/config-startup.js +++ b/test/config-startup.js @@ -23,44 +23,44 @@ var config = {}; config.mqtt = { - host: 'localhost', - port: 1883, - thinkingThingsPlugin: true, - username: 'guest', - password: 'guest', + host: 'localhost', + port: 1883, + thinkingThingsPlugin: true, + username: 'guest', + password: 'guest', }; config.http = { - port: 7896, + port: 7896, }; config.amqp = { - host: 'localhost', - port: 5672, - exchange: 'amq.topic', - queue: 'iota_queue', - options: { durable: true }, + host: 'localhost', + port: 5672, + exchange: 'amq.topic', + queue: 'iota_queue', + options: { durable: true }, }; config.iota = { - logLevel: 'FATAL', - contextBroker: { - host: '192.168.1.1', - port: '1026', - }, - server: { - port: 4041, - }, - deviceRegistry: { - type: 'memory', - }, - types: {}, - service: 'howtoService', - subservice: '/howto', - providerUrl: 'http://localhost:4041', - deviceRegistrationDuration: 'P1M', - defaultType: 'Thing', - defaultResource: '/iot/json', + logLevel: 'FATAL', + contextBroker: { + host: '192.168.1.1', + port: '1026', + }, + server: { + port: 4041, + }, + deviceRegistry: { + type: 'memory', + }, + types: {}, + service: 'howtoService', + subservice: '/howto', + providerUrl: 'http://localhost:4041', + deviceRegistrationDuration: 'P1M', + defaultType: 'Thing', + defaultResource: '/iot/json', }; config.defaultKey = '1234'; diff --git a/test/config-test.js b/test/config-test.js index 9fb2a5dc..82cf0419 100644 --- a/test/config-test.js +++ b/test/config-test.js @@ -23,45 +23,45 @@ var config = {}; config.mqtt = { - host: 'localhost', - port: 1883, - thinkingThingsPlugin: true, - username: 'guest', - password: 'guest', + host: 'localhost', + port: 1883, + thinkingThingsPlugin: true, + username: 'guest', + password: 'guest', }; config.http = { - port: 7896, + port: 7896, }; config.amqp = { - host: 'localhost', - port: 5672, - exchange: 'amq.topic', - queue: 'iota_queue', - options: { durable: true }, + host: 'localhost', + port: 5672, + exchange: 'amq.topic', + queue: 'iota_queue', + options: { durable: true }, }; config.iota = { - logLevel: 'FATAL', - contextBroker: { - host: '192.168.1.1', - port: '1026', - }, - server: { - port: 4041, - }, - deviceRegistry: { - type: 'memory', - }, - types: {}, - service: 'howtoService', - subservice: '/howto', - providerUrl: 'http://localhost:4041', - deviceRegistrationDuration: 'P1M', - defaultType: 'Thing', - defaultResource: '/iot/json', - compressTimestamp: true, + logLevel: 'FATAL', + contextBroker: { + host: '192.168.1.1', + port: '1026', + }, + server: { + port: 4041, + }, + deviceRegistry: { + type: 'memory', + }, + types: {}, + service: 'howtoService', + subservice: '/howto', + providerUrl: 'http://localhost:4041', + deviceRegistrationDuration: 'P1M', + defaultType: 'Thing', + defaultResource: '/iot/json', + compressTimestamp: true, }; config.defaultKey = '1234'; diff --git a/test/utils.js b/test/utils.js index a1e71f92..086758e5 100644 --- a/test/utils.js +++ b/test/utils.js @@ -25,19 +25,19 @@ var fs = require('fs'); function readExampleFile(name, raw) { - var text = fs.readFileSync(name, 'UTF8'); + var text = fs.readFileSync(name, 'UTF8'); - if (raw) { - return text; - } else { - return JSON.parse(text); - } + if (raw) { + return text; + } else { + return JSON.parse(text); + } } function delay(ms) { - return function(callback) { - setTimeout(callback, ms); - }; + return function(callback) { + setTimeout(callback, ms); + }; } exports.readExampleFile = readExampleFile; From 6119ef619c0df85b48c1b153a99928ab589e4ed0 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Wed, 30 Jan 2019 13:46:52 +0100 Subject: [PATCH 07/15] Replace ^ with ~ in dependencies --- package-lock.json | 4820 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- 2 files changed, 4822 insertions(+), 2 deletions(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..122a4c20 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,4820 @@ +{ + "name": "iotagent-json", + "version": "1.9.0-next", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@samverschueren/stream-to-observable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", + "integrity": "sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg==", + "dev": true, + "requires": { + "any-observable": "^0.3.0" + } + }, + "JSONSelect": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", + "integrity": "sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40=" + }, + "JSV": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", + "integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c=" + }, + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "dev": true + }, + "accepts": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", + "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "requires": { + "mime-types": "~2.1.18", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz", + "integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==", + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "optional": true + }, + "amqplib": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/amqplib/-/amqplib-0.5.3.tgz", + "integrity": "sha512-ZOdUhMxcF+u62rPI+hMtU1NBXSDFQ3eCJJrenamtdQ7YYwh7RZJHOIM1gonVbZ5PyVdYH4xqBPje9OYqk7fnqw==", + "requires": { + "bitsyntax": "~0.1.0", + "bluebird": "^3.5.2", + "buffer-more-ints": "~1.0.0", + "readable-stream": "1.x >=1.1.9", + "safe-buffer": "~5.1.2", + "url-parse": "~1.4.3" + } + }, + "ansi-escapes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", + "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "any-observable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz", + "integrity": "sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", + "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", + "requires": { + "lodash": "^4.17.10" + } + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bitsyntax": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", + "integrity": "sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==", + "requires": { + "buffer-more-ints": "~1.0.0", + "debug": "~2.6.9", + "safe-buffer": "~5.1.2" + } + }, + "bl": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", + "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "bluebird": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", + "integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==" + }, + "body-parser": { + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", + "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "~1.6.3", + "iconv-lite": "0.4.23", + "on-finished": "~2.3.0", + "qs": "6.5.2", + "raw-body": "2.3.3", + "type-is": "~1.6.16" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "bson": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz", + "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==" + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + }, + "buffer-more-ints": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-1.0.0.tgz", + "integrity": "sha512-EMetuGFz5SLsT0QTnXzINh4Ksr+oo4i+UGTXEshiGCQWnsgSs7ZhJ8fzlwQ+OzEMs0MpDAMr1hxnblp5a4vcHg==" + }, + "builtin-modules": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.0.0.tgz", + "integrity": "sha512-hMIeU4K2ilbXV6Uv93ZZ0Avg/M91RaKXucQ+4me2Do1txxBDyDZWCBa5bJSLqoNTRpXTLwEzIk1KmloenDDjhg==", + "dev": true + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "callback-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/callback-stream/-/callback-stream-1.1.0.tgz", + "integrity": "sha1-RwGlEmbwbgbqpx/BcjOCLYdfSQg=", + "requires": { + "inherits": "^2.0.1", + "readable-stream": "> 1.0.0 < 3.0.0" + } + }, + "caller-callsite": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", + "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", + "dev": true, + "requires": { + "callsites": "^2.0.0" + } + }, + "caller-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", + "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", + "dev": true, + "requires": { + "caller-callsite": "^2.0.0" + } + }, + "callsites": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", + "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "ci-info": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", + "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", + "dev": true + }, + "cjson": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/cjson/-/cjson-0.3.0.tgz", + "integrity": "sha1-5kObkHA9MS/24iJAl76pLOPQKhQ=", + "requires": { + "jsonlint": "1.6.0" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "cli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", + "integrity": "sha1-IoF1NPJL+klQw01TLUjsvGIbjBQ=", + "dev": true, + "requires": { + "exit": "0.1.2", + "glob": "^7.1.1" + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-truncate": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-0.2.1.tgz", + "integrity": "sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ=", + "dev": true, + "requires": { + "slice-ansi": "0.0.4", + "string-width": "^1.0.1" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz", + "integrity": "sha1-fQAj6usVTo7p/Oddy5I9DtFmd3Q=" + }, + "combined-stream": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", + "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "command-shell-lib": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/command-shell-lib/-/command-shell-lib-1.0.0.tgz", + "integrity": "sha1-KWC3MJvpBwojAYYjcvvjjtL3+RA=", + "requires": { + "async": "*" + } + }, + "commander": { + "version": "2.17.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", + "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "dev": true + }, + "commist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/commist/-/commist-1.0.0.tgz", + "integrity": "sha1-wMNSUBz29S6RJOPvicmAbiAi6+8=", + "requires": { + "leven": "^1.0.0", + "minimist": "^1.1.0" + } + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "^0.1.4" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cosmiconfig": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.0.7.tgz", + "integrity": "sha512-PcLqxTKiDmNT6pSpy4N6KtuPwb53W+2tzNvwOZw0WH9N6O0vLIBq0x8aj8Oj75ere4YcGi48bDFCL+3fRJdlNA==", + "dev": true, + "requires": { + "import-fresh": "^2.0.0", + "is-directory": "^0.3.1", + "js-yaml": "^3.9.0", + "parse-json": "^4.0.0" + } + }, + "coveralls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.2.tgz", + "integrity": "sha512-Tv0LKe/MkBOilH2v7WBiTBdudg2ChfGbdXafc/s330djpF3zKOmuehTeRwjXWc7pzfj9FrDUTA7tEx6Div8NFw==", + "dev": true, + "requires": { + "growl": "~> 1.10.0", + "js-yaml": "^3.11.0", + "lcov-parse": "^0.0.10", + "log-driver": "^1.2.7", + "minimist": "^1.2.0", + "request": "^2.85.0" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "d": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "requires": { + "es5-ext": "^0.10.9" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-fns": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", + "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==", + "dev": true + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==" + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" + }, + "dedent": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "deep-equal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", + "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "dev": true, + "requires": { + "domelementtype": "~1.1.1", + "entities": "~1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "dev": true + }, + "entities": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "dev": true + } + } + }, + "domelementtype": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", + "dev": true + }, + "domhandler": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", + "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "duplexify": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz", + "integrity": "sha512-vM58DwdnKmty+FSPzT14K9JXb90H+j5emaR4KYbr2KTIz00WHGbWOe5ghQTx233ZCLZtrGDALzKwcjEtSt35mA==", + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "ebnf-parser": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/ebnf-parser/-/ebnf-parser-0.1.10.tgz", + "integrity": "sha1-zR9rpHfFY4xAyX7ZtXLbW6tdgzE=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elegant-spinner": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", + "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", + "dev": true + }, + "encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "requires": { + "once": "^1.4.0" + } + }, + "entities": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", + "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es5-ext": { + "version": "0.10.47", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.47.tgz", + "integrity": "sha512-/1TItLfj+TTfWoeRcDn/0FbGV6SNo4R+On2GGVucPU/j3BWnXE2Co8h8CTo4Tu34gFJtnmwS9xiScKs4EjZhdw==", + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.1", + "next-tick": "1" + } + }, + "es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-map": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", + "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", + "requires": { + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", + "es6-set": "~0.1.5", + "es6-symbol": "~3.1.1", + "event-emitter": "~0.3.5" + } + }, + "es6-set": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", + "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", + "requires": { + "d": "1", + "es5-ext": "~0.10.14", + "es6-iterator": "~2.0.1", + "es6-symbol": "3.1.1", + "event-emitter": "~0.3.5" + } + }, + "es6-symbol": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escodegen": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz", + "integrity": "sha1-8CQBb1qI4Eb9EgBQVek5gC5sXyM=", + "requires": { + "esprima": "~1.1.1", + "estraverse": "~1.5.0", + "esutils": "~1.0.0", + "source-map": "~0.1.33" + } + }, + "esprima": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.1.1.tgz", + "integrity": "sha1-W28VR/TRAuZw4UDFCb5ncdautUk=" + }, + "estraverse": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz", + "integrity": "sha1-hno+jlip+EYYr7bC3bzZFrfLr3E=" + }, + "esutils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.0.0.tgz", + "integrity": "sha1-gVHTWOIMisx/t0XnRywAJf5JZXA=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "event-emitter": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", + "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", + "requires": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "exec-sh": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.2.tgz", + "integrity": "sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw==", + "dev": true, + "requires": { + "merge": "^1.2.0" + } + }, + "execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "express": { + "version": "4.16.4", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", + "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", + "requires": { + "accepts": "~1.3.5", + "array-flatten": "1.1.1", + "body-parser": "1.18.3", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.1", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.4", + "qs": "6.5.2", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.2", + "send": "0.16.2", + "serve-static": "1.13.2", + "setprototypeof": "1.1.0", + "statuses": "~1.4.0", + "type-is": "~1.6.16", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "fill-keys": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", + "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=", + "dev": true, + "requires": { + "is-object": "~1.0.1", + "merge-descriptors": "~1.0.0" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "finalhandler": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.4.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "find-parent-dir": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.0.tgz", + "integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-own-enumerable-property-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz", + "integrity": "sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg==", + "dev": true + }, + "get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true + }, + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + } + }, + "glob-stream": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", + "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", + "requires": { + "extend": "^3.0.0", + "glob": "^7.1.1", + "glob-parent": "^3.1.0", + "is-negated-glob": "^1.0.0", + "ordered-read-streams": "^1.0.0", + "pumpify": "^1.3.5", + "readable-stream": "^2.1.5", + "remove-trailing-separator": "^1.0.1", + "to-absolute-glob": "^2.0.0", + "unique-stream": "^2.0.2" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "handlebars": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", + "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", + "dev": true, + "requires": { + "async": "^2.5.0", + "optimist": "^0.6.1", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", + "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", + "requires": { + "ajv": "^6.5.5", + "har-schema": "^2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "help-me": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-1.1.0.tgz", + "integrity": "sha1-jy1QjQYAtKRW2i8IZVbn5cBWo8Y=", + "requires": { + "callback-stream": "^1.0.2", + "glob-stream": "^6.1.0", + "through2": "^2.0.1", + "xtend": "^4.0.0" + } + }, + "hosted-git-info": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", + "dev": true + }, + "htmlparser2": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", + "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", + "dev": true, + "requires": { + "domelementtype": "1", + "domhandler": "2.3", + "domutils": "1.5", + "entities": "1.0", + "readable-stream": "1.1" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "husky": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/husky/-/husky-1.1.4.tgz", + "integrity": "sha512-cZjGpS7qsaBSo3fOMUuR7erQloX3l5XzL1v/RkIqU6zrQImDdU70z5Re9fGDp7+kbYlM2EtS4aYMlahBeiCUGw==", + "dev": true, + "requires": { + "cosmiconfig": "^5.0.6", + "execa": "^1.0.0", + "find-up": "^3.0.0", + "get-stdin": "^6.0.0", + "is-ci": "^1.2.1", + "pkg-dir": "^3.0.0", + "please-upgrade-node": "^3.1.1", + "read-pkg": "^4.0.1", + "run-node": "^1.0.0", + "slash": "^2.0.0" + } + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "import-fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", + "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", + "dev": true, + "requires": { + "caller-path": "^2.0.0", + "resolve-from": "^3.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + } + } + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "iotagent-node-lib": { + "version": "git://github.com/telefonicaid/iotagent-node-lib.git#8a649e2c8d985f2f51ad426afdcceb2a04c362ce", + "from": "git://github.com/telefonicaid/iotagent-node-lib.git#master", + "requires": { + "async": "2.6.1", + "body-parser": "~1.18.3", + "command-shell-lib": "1.0.0", + "express": "~4.16.4", + "jison": "0.4.18", + "logops": "2.1.0", + "moment": "~2.22.2", + "moment-timezone": "~0.5.21", + "mongodb": "3.1.8", + "mongoose": "5.3.6", + "mu2": "~0.5.20", + "node-uuid": "~1.4.1", + "query-string": "6.2.0", + "request": "2.88.0", + "revalidator": "~0.3.1", + "underscore": "~1.9.1" + } + }, + "ipaddr.js": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.0.0.tgz", + "integrity": "sha512-/93sDihsAD652hrMEbJGbMAVBf1qc96kyThHQ0CAOONHaE3aROLpTjDe4WQ5aoC5ITHFxEq1z8XqSU7km+8amw==", + "dev": true, + "requires": { + "builtin-modules": "^3.0.0" + } + }, + "is-ci": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "dev": true, + "requires": { + "ci-info": "^1.5.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "requires": { + "is-extglob": "^2.1.0" + } + }, + "is-negated-glob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", + "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=" + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", + "dev": true + }, + "is-observable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-observable/-/is-observable-1.1.0.tgz", + "integrity": "sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA==", + "dev": true, + "requires": { + "symbol-observable": "^1.1.0" + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", + "dev": true + }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "requires": { + "is-unc-path": "^1.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "requires": { + "unc-path-regex": "^0.1.2" + } + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "istanbul": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", + "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", + "dev": true, + "requires": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "escodegen": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "dev": true, + "requires": { + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.2.0" + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "estraverse": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "dev": true, + "optional": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "jest-get-type": { + "version": "22.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", + "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", + "dev": true + }, + "jest-validate": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-23.6.0.tgz", + "integrity": "sha512-OFKapYxe72yz7agrDAWi8v2WL8GIfVqcbKRCLbRG9PAxtzF9b1SEDdTpytNDN12z2fJynoBwpMpvj2R39plI2A==", + "dev": true, + "requires": { + "chalk": "^2.0.1", + "jest-get-type": "^22.1.0", + "leven": "^2.1.0", + "pretty-format": "^23.6.0" + }, + "dependencies": { + "leven": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", + "dev": true + } + } + }, + "jison": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/jison/-/jison-0.4.18.tgz", + "integrity": "sha512-FKkCiJvozgC7VTHhMJ00a0/IApSxhlGsFIshLW6trWJ8ONX2TQJBBz6DlcO1Gffy4w9LT+uL+PA+CVnUSJMF7w==", + "requires": { + "JSONSelect": "0.4.0", + "cjson": "0.3.0", + "ebnf-parser": "0.1.10", + "escodegen": "1.3.x", + "esprima": "1.1.x", + "jison-lex": "0.3.x", + "lex-parser": "~0.1.3", + "nomnom": "1.5.2" + } + }, + "jison-lex": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/jison-lex/-/jison-lex-0.3.4.tgz", + "integrity": "sha1-gcoo2E+ESZ36jFlNzePYo/Jux6U=", + "requires": { + "lex-parser": "0.1.x", + "nomnom": "1.5.2" + } + }, + "js-yaml": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", + "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "dependencies": { + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + } + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, + "jshint": { + "version": "2.9.7", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.7.tgz", + "integrity": "sha512-Q8XN38hGsVQhdlM+4gd1Xl7OB1VieSuCJf+fEJjpo59JH99bVJhXRXAh26qQ15wfdd1VPMuDWNeSWoNl53T4YA==", + "dev": true, + "requires": { + "cli": "~1.0.0", + "console-browserify": "1.1.x", + "exit": "0.1.x", + "htmlparser2": "3.8.x", + "lodash": "~4.17.10", + "minimatch": "~3.0.2", + "shelljs": "0.3.x", + "strip-json-comments": "1.0.x" + } + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonlint": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.0.tgz", + "integrity": "sha1-iKpGvCiaesk7tGyuLVihh6m7SUo=", + "requires": { + "JSV": ">= 4.0.x", + "nomnom": ">= 1.5.x" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kareem": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.0.tgz", + "integrity": "sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg==" + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "lcov-parse": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", + "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", + "dev": true + }, + "leven": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/leven/-/leven-1.0.2.tgz", + "integrity": "sha1-kUS27ryl8dBoAWnxpncNzqYLdcM=" + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "lex-parser": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/lex-parser/-/lex-parser-0.1.4.tgz", + "integrity": "sha1-ZMTwJfF/1Tv7RXY/rrFvAVp0dVA=" + }, + "lint-staged": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-7.3.0.tgz", + "integrity": "sha512-AXk40M9DAiPi7f4tdJggwuKIViUplYtVj1os1MVEteW7qOkU50EOehayCfO9TsoGK24o/EsWb41yrEgfJDDjCw==", + "dev": true, + "requires": { + "chalk": "^2.3.1", + "commander": "^2.14.1", + "cosmiconfig": "^5.0.2", + "debug": "^3.1.0", + "dedent": "^0.7.0", + "execa": "^0.9.0", + "find-parent-dir": "^0.3.0", + "is-glob": "^4.0.0", + "is-windows": "^1.0.2", + "jest-validate": "^23.5.0", + "listr": "^0.14.1", + "lodash": "^4.17.5", + "log-symbols": "^2.2.0", + "micromatch": "^3.1.8", + "npm-which": "^3.0.1", + "p-map": "^1.1.1", + "path-is-inside": "^1.0.2", + "pify": "^3.0.0", + "please-upgrade-node": "^3.0.2", + "staged-git-files": "1.1.1", + "string-argv": "^0.0.2", + "stringify-object": "^3.2.2" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "execa": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.9.0.tgz", + "integrity": "sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA==", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "listr": { + "version": "0.14.3", + "resolved": "https://registry.npmjs.org/listr/-/listr-0.14.3.tgz", + "integrity": "sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA==", + "dev": true, + "requires": { + "@samverschueren/stream-to-observable": "^0.3.0", + "is-observable": "^1.1.0", + "is-promise": "^2.1.0", + "is-stream": "^1.1.0", + "listr-silent-renderer": "^1.1.1", + "listr-update-renderer": "^0.5.0", + "listr-verbose-renderer": "^0.5.0", + "p-map": "^2.0.0", + "rxjs": "^6.3.3" + }, + "dependencies": { + "p-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.0.0.tgz", + "integrity": "sha512-GO107XdrSUmtHxVoi60qc9tUl/KkNKm+X2CF4P9amalpGxv5YqVPJNfSb0wcA+syCopkZvYYIzW8OVTQW59x/w==", + "dev": true + } + } + }, + "listr-silent-renderer": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz", + "integrity": "sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=", + "dev": true + }, + "listr-update-renderer": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz", + "integrity": "sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA==", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "cli-truncate": "^0.2.1", + "elegant-spinner": "^1.0.1", + "figures": "^1.7.0", + "indent-string": "^3.0.0", + "log-symbols": "^1.0.2", + "log-update": "^2.3.0", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "log-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", + "dev": true, + "requires": { + "chalk": "^1.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "listr-verbose-renderer": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/listr-verbose-renderer/-/listr-verbose-renderer-0.5.0.tgz", + "integrity": "sha512-04PDPqSlsqIOaaaGZ+41vq5FejI9auqTInicFRndCBgE3bXG8D6W1I+mWhk+1nqbHmyhla/6BUrd5OSiHwKRXw==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "cli-cursor": "^2.1.0", + "date-fns": "^1.27.2", + "figures": "^2.0.0" + }, + "dependencies": { + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + } + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "log-driver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", + "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", + "dev": true + }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, + "log-update": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-2.3.0.tgz", + "integrity": "sha1-iDKP19HOeTiykoN0bwsbwSayRwg=", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "cli-cursor": "^2.0.0", + "wrap-ansi": "^3.0.1" + } + }, + "logops": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/logops/-/logops-2.1.0.tgz", + "integrity": "sha1-mHIkVNeHG9KqR2j7QWZvFCuVNc8=", + "requires": { + "colors": "^1.1.2", + "lodash": "^4.1.0", + "safe-json-stringify": "^1.0.4", + "serr": "^1.0.0" + }, + "dependencies": { + "colors": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", + "integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==" + } + } + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "memory-pager": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", + "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", + "optional": true + }, + "merge": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz", + "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==", + "dev": true + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.37.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", + "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + }, + "mime-types": { + "version": "2.1.21", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", + "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "requires": { + "mime-db": "~1.37.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "dependencies": { + "commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "module-not-found-error": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", + "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=", + "dev": true + }, + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" + }, + "moment-timezone": { + "version": "0.5.23", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.23.tgz", + "integrity": "sha512-WHFH85DkCfiNMDX5D3X7hpNH3/PUhjTGcD0U1SgfBGZxJ3qUmJh5FdvaFjcClxOvB3rzdfj4oRffbI38jEnC1w==", + "requires": { + "moment": ">= 2.9.0" + } + }, + "mongodb": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.8.tgz", + "integrity": "sha512-yNKwYxQ6m00NV6+pMoWoheFTHSQVv1KkSrfOhRDYMILGWDYtUtQRqHrFqU75rmPIY8hMozVft8zdC4KYMWaM3Q==", + "requires": { + "mongodb-core": "3.1.7", + "safe-buffer": "^5.1.2" + } + }, + "mongodb-core": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.7.tgz", + "integrity": "sha512-YffpSrLmgFNmrvkGx+yX00KyBNk64C0BalfEn6vHHkXtcMUGXw8nxrMmhq5eXPLLlYeBpD/CsgNxE2Chf0o4zQ==", + "requires": { + "bson": "^1.1.0", + "require_optional": "^1.0.1", + "safe-buffer": "^5.1.2", + "saslprep": "^1.0.0" + } + }, + "mongoose": { + "version": "5.3.6", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.3.6.tgz", + "integrity": "sha512-EuHmtc7T6dIaHANd/A6J7dSSRhw9LVWdiGcmFYzOCdIYWwbrc1k5klN8U57KKeJUPvfhgVCmm6p5L5VueVpSjw==", + "requires": { + "async": "2.6.1", + "bson": "~1.0.5", + "kareem": "2.3.0", + "lodash.get": "4.4.2", + "mongodb": "3.1.6", + "mongodb-core": "3.1.5", + "mongoose-legacy-pluralize": "1.0.2", + "mpath": "0.5.1", + "mquery": "3.2.0", + "ms": "2.0.0", + "regexp-clone": "0.0.1", + "safe-buffer": "5.1.2", + "sliced": "1.0.1" + }, + "dependencies": { + "bson": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.9.tgz", + "integrity": "sha512-IQX9/h7WdMBIW/q/++tGd+emQr0XMdeZ6icnT/74Xk9fnabWn+gZgpE+9V+gujL3hhJOoNrnDVY7tWdzc7NUTg==" + }, + "mongodb": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.6.tgz", + "integrity": "sha512-E5QJuXQoMlT7KyCYqNNMfAkhfQD79AT4F8Xd+6x37OX+8BL17GyXyWvfm6wuyx4wnzCCPoCSLeMeUN2S7dU9yw==", + "requires": { + "mongodb-core": "3.1.5", + "safe-buffer": "^5.1.2" + } + }, + "mongodb-core": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.5.tgz", + "integrity": "sha512-emT/tM4ZBinqd6RZok+EzDdtN4LjYJIckv71qQVOEFmvXgT5cperZegVmTgox/1cx4XQu6LJ5ZuIwipP/eKdQg==", + "requires": { + "bson": "^1.1.0", + "require_optional": "^1.0.1", + "safe-buffer": "^5.1.2", + "saslprep": "^1.0.0" + }, + "dependencies": { + "bson": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz", + "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==" + } + } + } + } + }, + "mongoose-legacy-pluralize": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", + "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" + }, + "mpath": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.5.1.tgz", + "integrity": "sha512-H8OVQ+QEz82sch4wbODFOz+3YQ61FYz/z3eJ5pIdbMEaUzDqA268Wd+Vt4Paw9TJfvDgVKaayC0gBzMIw2jhsg==" + }, + "mqtt": { + "version": "2.18.8", + "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-2.18.8.tgz", + "integrity": "sha512-3h6oHlPY/yWwtC2J3geraYRtVVoRM6wdI+uchF4nvSSafXPZnaKqF8xnX+S22SU/FcgEAgockVIlOaAX3fkMpA==", + "requires": { + "commist": "^1.0.0", + "concat-stream": "^1.6.2", + "end-of-stream": "^1.4.1", + "es6-map": "^0.1.5", + "help-me": "^1.0.1", + "inherits": "^2.0.3", + "minimist": "^1.2.0", + "mqtt-packet": "^5.6.0", + "pump": "^3.0.0", + "readable-stream": "^2.3.6", + "reinterval": "^1.1.0", + "split2": "^2.1.1", + "websocket-stream": "^5.1.2", + "xtend": "^4.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "mqtt-packet": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-5.6.0.tgz", + "integrity": "sha512-QECe2ivqcR1LRsPobRsjenEKAC3i1a5gmm+jNKJLrsiq9PaSQ18LlKFuxvhGxWkvGEPadWv6rKd31O4ICqS1Xw==", + "requires": { + "bl": "^1.2.1", + "inherits": "^2.0.3", + "process-nextick-args": "^2.0.0", + "safe-buffer": "^5.1.0" + } + }, + "mquery": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.0.tgz", + "integrity": "sha512-qPJcdK/yqcbQiKoemAt62Y0BAc0fTEKo1IThodBD+O5meQRJT/2HSe5QpBNwaa4CjskoGrYWsEyjkqgiE0qjhg==", + "requires": { + "bluebird": "3.5.1", + "debug": "3.1.0", + "regexp-clone": "0.0.1", + "safe-buffer": "5.1.2", + "sliced": "1.0.1" + }, + "dependencies": { + "bluebird": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "mu2": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/mu2/-/mu2-0.5.21.tgz", + "integrity": "sha1-iIqPD9kOsc/anbgUdvbhmcyeWNM=" + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "nock": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/nock/-/nock-10.0.1.tgz", + "integrity": "sha512-M0aL9IDbUFURmokoXqejZQybZk8EtlYjUBjaoICVbW62uOlyPRsnEsceyOlUik4spCOt50ptwM4BTPt20ITtcQ==", + "dev": true, + "requires": { + "chai": "^4.1.2", + "debug": "^4.1.0", + "deep-equal": "^1.0.0", + "json-stringify-safe": "^5.0.1", + "lodash": "^4.17.5", + "mkdirp": "^0.5.0", + "propagate": "^1.0.0", + "qs": "^6.5.1", + "semver": "^5.5.0" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "node-uuid": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", + "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" + }, + "nomnom": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz", + "integrity": "sha1-9DRUSKhTz71cDSYyDyR3qwUm/i8=", + "requires": { + "colors": "0.5.x", + "underscore": "1.1.x" + }, + "dependencies": { + "underscore": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz", + "integrity": "sha1-QLq4S60Z0jAJbo1u9ii/8FXYPbA=" + } + } + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-package-data": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.1.tgz", + "integrity": "sha512-ZVuHxWJv1bopjv/SD5uPhgwUhLqxdJ+SsdUQbGR9HWlXrvnd/C08Cn9Bq48PbvX3y5V97GIpAHpL5Bk9BwChGg==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^3.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-path": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.4.tgz", + "integrity": "sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==", + "dev": true, + "requires": { + "which": "^1.2.10" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "npm-which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-which/-/npm-which-3.0.1.tgz", + "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", + "dev": true, + "requires": { + "commander": "^2.9.0", + "npm-path": "^2.0.2", + "which": "^1.2.10" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + } + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + } + }, + "ordered-read-streams": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", + "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", + "requires": { + "readable-stream": "^2.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", + "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "please-upgrade-node": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz", + "integrity": "sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "prettier": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz", + "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==", + "dev": true + }, + "pretty-format": { + "version": "23.6.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-23.6.0.tgz", + "integrity": "sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw==", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0", + "ansi-styles": "^3.2.0" + } + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" + }, + "propagate": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", + "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=", + "dev": true + }, + "proxy-addr": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.8.0" + } + }, + "proxyquire": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.0.tgz", + "integrity": "sha512-kptdFArCfGRtQFv3Qwjr10lwbEV0TBJYvfqzhwucyfEXqVgmnAkyEw/S3FYzR5HI9i5QOq4rcqQjZ6AlknlCDQ==", + "dev": true, + "requires": { + "fill-keys": "^1.0.2", + "module-not-found-error": "^1.0.0", + "resolve": "~1.8.1" + }, + "dependencies": { + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + } + } + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.1.31", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", + "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + }, + "dependencies": { + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + } + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "query-string": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.2.0.tgz", + "integrity": "sha512-5wupExkIt8RYL4h/FE+WTg3JHk62e6fFPWtAZA9J5IWK1PfTfKkMS93HBUHcFpeYi9KsY5pFbh+ldvEyaz5MyA==", + "requires": { + "decode-uri-component": "^0.2.0", + "strict-uri-encode": "^2.0.0" + } + }, + "querystringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", + "integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", + "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.3", + "iconv-lite": "0.4.23", + "unpipe": "1.0.0" + } + }, + "read-pkg": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz", + "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=", + "dev": true, + "requires": { + "normalize-package-data": "^2.3.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0" + } + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexp-clone": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz", + "integrity": "sha1-p8LgmJH9vzj7sQ03b7cwA+aKxYk=" + }, + "reinterval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reinterval/-/reinterval-1.1.0.tgz", + "integrity": "sha1-M2Hs+jymwYKDOA3Qu5VG85D17Oc=" + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + } + } + }, + "require_optional": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", + "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", + "requires": { + "resolve-from": "^2.0.0", + "semver": "^5.1.0" + } + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, + "resolve-from": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", + "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "revalidator": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.3.1.tgz", + "integrity": "sha1-/yzEz3zHxjhaxxAXgnbm280Ddi8=" + }, + "run-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/run-node/-/run-node-1.0.0.tgz", + "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==", + "dev": true + }, + "rxjs": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz", + "integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safe-json-stringify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", + "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==" + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "saslprep": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.2.tgz", + "integrity": "sha512-4cDsYuAjXssUSjxHKRe4DTZC0agDwsCqcMqtJAQPzC74nJ7LfAJflAtC1Zed5hMzEQKj82d3tuzqdGNRsLJ4Gw==", + "optional": true, + "requires": { + "sparse-bitfield": "^3.0.3" + } + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "send": { + "version": "0.16.2", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", + "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.4.0" + }, + "dependencies": { + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + } + } + }, + "serr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/serr/-/serr-1.0.1.tgz", + "integrity": "sha1-dKW55/rdW1X4qF5+crwApBm25II=", + "requires": { + "lodash": "^4.0.0" + } + }, + "serve-static": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", + "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.2" + } + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shelljs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", + "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", + "dev": true + }, + "should": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", + "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", + "dev": true, + "requires": { + "should-equal": "^2.0.0", + "should-format": "^3.0.3", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" + } + }, + "should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "dev": true, + "requires": { + "should-type": "^1.4.0" + } + }, + "should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=", + "dev": true, + "requires": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" + } + }, + "should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=", + "dev": true + }, + "should-type-adaptors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", + "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", + "dev": true, + "requires": { + "should-type": "^1.3.0", + "should-util": "^1.0.0" + } + }, + "should-util": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz", + "integrity": "sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true + }, + "slice-ansi": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", + "dev": true + }, + "sliced": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", + "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "source-map": { + "version": "0.1.43", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", + "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", + "optional": true, + "requires": { + "amdefine": ">=0.0.4" + } + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "sparse-bitfield": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", + "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", + "optional": true, + "requires": { + "memory-pager": "^1.0.2" + } + }, + "spdx-correct": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", + "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", + "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.3.tgz", + "integrity": "sha512-uBIcIl3Ih6Phe3XHK1NqboJLdGfwr1UN3k6wSD1dZpmPsIkb8AGNbZYJ1fOBk834+Gxy8rpfDxrS6XLEMZMY2g==", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "split2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", + "requires": { + "through2": "^2.0.2" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "staged-git-files": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/staged-git-files/-/staged-git-files-1.1.1.tgz", + "integrity": "sha512-H89UNKr1rQJvI1c/PIR3kiAMBV23yvR7LItZiV74HWZwzt7f3YHuujJ9nJZlt58WlFox7XQsOahexwk7nTe69A==", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "statuses": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", + "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" + }, + "strict-uri-encode": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", + "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY=" + }, + "string-argv": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.0.2.tgz", + "integrity": "sha1-2sMECGkMIfPDYwo/86BYd73L1zY=", + "dev": true + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "stringify-object": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz", + "integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==", + "dev": true, + "requires": { + "get-own-enumerable-property-symbols": "^3.0.0", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", + "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", + "dev": true + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "through2-filter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz", + "integrity": "sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==", + "requires": { + "through2": "~2.0.0", + "xtend": "~4.0.0" + } + }, + "to-absolute-glob": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", + "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", + "requires": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + } + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + } + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-is": { + "version": "1.6.16", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.18" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" + }, + "uglify-js": { + "version": "3.4.9", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", + "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", + "dev": true, + "optional": true, + "requires": { + "commander": "~2.17.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true + } + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unique-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz", + "integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==", + "requires": { + "json-stable-stringify-without-jsonify": "^1.0.1", + "through2-filter": "^3.0.0" + } + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + } + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url-parse": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.4.tgz", + "integrity": "sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg==", + "requires": { + "querystringify": "^2.0.0", + "requires-port": "^1.0.0" + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "watch": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/watch/-/watch-1.0.2.tgz", + "integrity": "sha1-NApxe952Vyb6CqB9ch4BR6VR3ww=", + "dev": true, + "requires": { + "exec-sh": "^0.2.0", + "minimist": "^1.2.0" + } + }, + "websocket-stream": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/websocket-stream/-/websocket-stream-5.1.2.tgz", + "integrity": "sha512-lchLOk435iDWs0jNuL+hiU14i3ERSrMA0IKSiJh7z6X/i4XNsutBZrtqu2CPOZuA4G/zabiqVAos0vW+S7GEVw==", + "requires": { + "duplexify": "^3.5.1", + "inherits": "^2.0.1", + "readable-stream": "^2.3.3", + "safe-buffer": "^5.1.1", + "ws": "^3.2.0", + "xtend": "^4.0.0" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "wrap-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-3.0.1.tgz", + "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } +} diff --git a/package.json b/package.json index 6039064d..eaf3c49c 100644 --- a/package.json +++ b/package.json @@ -32,12 +32,12 @@ "devDependencies": { "coveralls": "~3.0.2", "husky": "~1.1.0", - "lint-staged": "^7.3.0", + "lint-staged": "~7.3.0", "nock": "10.0.1", "mocha": "5.2.0", "should": "13.2.3", "istanbul": "~0.4.5", - "prettier": "^1.14.2", + "prettier": "~1.14.2", "proxyquire": "2.1.0", "moment": "~2.22.2", "watch": "~1.0.2", From f9a9b686195f4be1b5d87037aa7c5960a2bf7373 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Thu, 31 Jan 2019 10:10:41 +0100 Subject: [PATCH 08/15] Create Prettier Config --- .prettierrc.json | 9 +++++++++ package.json | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..6bc2f8e4 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,9 @@ +{ + "arrowParens": "always", + "bracketSpacing": true, + "singleQuote": true, + "parser": "flow", + "printWidth": 120, + "trailingComma": "es5", + "tabWidth": 4 +} \ No newline at end of file diff --git a/package.json b/package.json index eaf3c49c..4900b0d4 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "test": "mocha --recursive 'test/**/*.js' --reporter spec --timeout 3000 --ui bdd --exit", "test:watch": "npm run test -- -w ./lib", "lint": "jshint lib/ --config .jshintrc && jshint test/ --config test/.jshintrc", - "prettier": "prettier --tab-width 4 --single-quote --trailing-comma es5 --write **/*.js *.js", + "prettier": "prettier --config .prettierrc.json --write '**/**/**/*.js' '**/**/*.js' '**/*.js' '*.js'", "test:coverage": "istanbul cover _mocha -- --recursive 'test/**/*.js' --reporter spec --exit", "test:coveralls": "npm run test:coverage && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", "watch": "watch 'npm test && npm run lint' ./lib ./test" @@ -63,7 +63,7 @@ }, "lint-staged": { "*.js": [ - "prettier --tab-width 4 --parser flow --single-quote --trailing-comma es5 --write", + "prettier --config .prettierrc.json --write", "git add" ] } From 9a8fe5befdd12b759b55855b80b391c6b2cd1858 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Thu, 31 Jan 2019 10:12:55 +0100 Subject: [PATCH 09/15] Rerun prettier - 120 width --- bin/iotaJsonTester.js | 26 +-- ghpages/javascripts/scale.fix.js | 20 +- lib/bindings/AMQPBinding.js | 111 +++++----- lib/bindings/HTTPBinding.js | 168 ++++++++------- lib/bindings/MQTTBinding.js | 38 ++-- lib/commandHandler.js | 43 +--- lib/commonBindings.js | 96 ++------- lib/configService.js | 6 +- lib/errors.js | 31 +-- lib/iotaUtils.js | 130 +++-------- lib/iotagent-json.js | 93 +++----- lib/thinkingThingPlugin.js | 58 +---- lib/timestampProcessPlugin.js | 22 +- lib/transportSelector.js | 43 +--- test/unit/HTTP_commands_test.js | 17 +- test/unit/HTTP_get-configuration_test.js | 64 +++--- test/unit/HTTP_reveice_measures-test.js | 73 +++---- test/unit/MQTT_commands_test.js | 28 ++- test/unit/MQTT_get-configuration_test.js | 204 +++++++++--------- test/unit/MQTT_receive_measures-test.js | 60 +++--- test/unit/amqpBinding-test.js | 66 +++--- test/unit/attribute-alias_test.js | 22 +- test/unit/bidirectionalityHttp-test.js | 90 +++++--- test/unit/commandsAmqp-test.js | 90 ++++---- test/unit/commandsPolling-test.js | 34 ++- test/unit/configuration-api_test.js | 61 +++--- .../unit/ngsiv2/HTTP_reveice_measures-test.js | 96 ++++----- .../unit/ngsiv2/MQTT_receive_measures-test.js | 90 ++++---- test/unit/ngsiv2/amqpBinding-test.js | 96 +++++---- test/unit/ngsiv2/attribute-alias_test.js | 28 +-- test/unit/ngsiv2/bidirectionalityHttp-test.js | 69 +++--- test/unit/ngsiv2/config-test.js | 14 +- test/unit/ngsiv2/configuration-api_test.js | 64 +++--- .../ngsiv2/subscription-management_test.js | 106 +++++---- .../supportThinkingThingModules_test.js | 66 +++--- test/unit/subscription-management_test.js | 82 +++---- test/unit/supportThinkingThingModules_test.js | 29 ++- 37 files changed, 1100 insertions(+), 1334 deletions(-) diff --git a/bin/iotaJsonTester.js b/bin/iotaJsonTester.js index d9496359..e38e94eb 100755 --- a/bin/iotaJsonTester.js +++ b/bin/iotaJsonTester.js @@ -71,10 +71,7 @@ function getConfig(commands) { function mqttPublishHandler(error) { if (error) { - console.log( - 'There was an error publishing to the MQTT broker: %s', - error - ); + console.log('There was an error publishing to the MQTT broker: %s', error); } else { console.log('Message successfully published'); } @@ -87,21 +84,13 @@ function checkConnection(fn) { if (mqttClient) { fn(commands); } else { - console.log( - 'Please, check your configuration and connect before using MQTT commands.' - ); + console.log('Please, check your configuration and connect before using MQTT commands.'); } }; } function singleMeasure(commands) { - var topic = - '/' + - config.apikey + - '/' + - config.deviceId + - '/attributes/' + - commands[0]; + var topic = '/' + config.apikey + '/' + config.deviceId + '/attributes/' + commands[0]; mqttClient.publish(topic, commands[1], null, mqttPublishHandler); } @@ -149,14 +138,12 @@ function exitClient() { var commands = { config: { parameters: ['host', 'port', 'apiKey', 'deviceId'], - description: - '\tConfigure the client to emulate the selected device, connecting to the given host.', + description: '\tConfigure the client to emulate the selected device, connecting to the given host.', handler: setConfig, }, showConfig: { parameters: [], - description: - '\tConfigure the client to emulate the selected device, connecting to the given host.', + description: '\tConfigure the client to emulate the selected device, connecting to the given host.', handler: getConfig, }, connect: { @@ -166,8 +153,7 @@ var commands = { }, singleMeasure: { parameters: ['attribute', 'value'], - description: - '\tSend the given value for the selected attribute to the MQTT broker.', + description: '\tSend the given value for the selected attribute to the MQTT broker.', handler: checkConnection(singleMeasure), }, multipleMeasure: { diff --git a/ghpages/javascripts/scale.fix.js b/ghpages/javascripts/scale.fix.js index 87a40ca7..39cdc766 100644 --- a/ghpages/javascripts/scale.fix.js +++ b/ghpages/javascripts/scale.fix.js @@ -1,17 +1,17 @@ var metas = document.getElementsByTagName('meta'); var i; if (navigator.userAgent.match(/iPhone/i)) { - for (i=0; i 0) { iotAgentLib.update(device.name, device.type, '', values, device, updateCommandHandler); @@ -225,9 +236,10 @@ function handleIncomingMeasure(req, res, next) { } function isCommand(req, res, next) { - if (req.path === - (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_COMMANDS_PATH) { - + if ( + req.path === + (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_COMMANDS_PATH + ) { req.isCommand = true; } @@ -235,7 +247,6 @@ function isCommand(req, res, next) { } function sendConfigurationToDevice(apiKey, deviceId, results, callback) { - function handleDeviceResponse(innerCallback) { return function(error, response, body) { if (error) { @@ -255,8 +266,8 @@ function sendConfigurationToDevice(apiKey, deviceId, results, callback) { json: iotaUtils.createConfigurationNotification(results), headers: { 'fiware-service': device.service, - 'fiware-servicepath': device.subservice - } + 'fiware-servicepath': device.subservice, + }, }; request(resultRequest, handleDeviceResponse(innerCallback)); @@ -281,12 +292,18 @@ function handleConfigurationRequest(req, res, next) { } } iotaUtils.retrieveDevice(req.deviceId, req.apiKey, transport, function(error, device) { - if (error) { - next(error); - } else { - iotaUtils.manageConfiguration( - req.apiKey, req.deviceId, device, req.jsonPayload, sendConfigurationToDevice, replyToDevice); - } + if (error) { + next(error); + } else { + iotaUtils.manageConfiguration( + req.apiKey, + req.deviceId, + device, + req.jsonPayload, + sendConfigurationToDevice, + replyToDevice + ); + } }); } @@ -301,7 +318,7 @@ function handleError(error, req, res, next) { res.status(code).json({ name: error.name, - message: error.message + message: error.message, }); } @@ -331,13 +348,12 @@ function deviceProvisioningHandler(device, callback) { * add the command information to the return payload. Otherwise it returns an empty payload. */ function returnCommands(req, res, next) { - function updateCommandStatus(device, commandList) { - var updates, - cleanCommands; + var updates, cleanCommands; function createCommandUpdate(command) { - return apply(iotAgentLib.setCommandResult, + return apply( + iotAgentLib.setCommandResult, device.name, device.resource, req.query.k, @@ -349,11 +365,7 @@ function returnCommands(req, res, next) { } function cleanCommand(command) { - return apply(iotAgentLib.removeCommand, - device.service, - device.subservice, - device.id, - command.name); + return apply(iotAgentLib.removeCommand, device.service, device.subservice, device.id, command.name); } updates = commandList.map(createCommandUpdate); @@ -361,13 +373,21 @@ function returnCommands(req, res, next) { if (updates) { async.parallel(updates.concat(cleanCommands), function(error, results) { if (error) { - config.getLogger().error(context, - 'Error updating command status after delivering commands for device [%s]', - device.id); + config + .getLogger() + .error( + context, + 'Error updating command status after delivering commands for device [%s]', + device.id + ); } else { - config.getLogger().debug(context, - 'Command status updated successfully after delivering command list to device [%s]', - device.id); + config + .getLogger() + .debug( + context, + 'Command status updated successfully after delivering command list to device [%s]', + device.id + ); } }); } @@ -392,21 +412,15 @@ function returnCommands(req, res, next) { } } if (req.query && req.query.getCmd === '1') { - iotAgentLib.commandQueue( - req.device.service, - req.device.subservice, - req.deviceId, - function(error, list) { - if (error || !list || list.count === 0) { - res.status(200).send(''); - } else { - res.status(200).send( - JSON.stringify(list.commands.map(parseCommand).reduce(concatCommand, {})) - ); + iotAgentLib.commandQueue(req.device.service, req.device.subservice, req.deviceId, function(error, list) { + if (error || !list || list.count === 0) { + res.status(200).send(''); + } else { + res.status(200).send(JSON.stringify(list.commands.map(parseCommand).reduce(concatCommand, {}))); - process.nextTick(updateCommandStatus.bind(null, req.device, list.commands)); - } - }); + process.nextTick(updateCommandStatus.bind(null, req.device, list.commands)); + } + }); } else { res.status(200).send(''); } @@ -418,12 +432,13 @@ function start(callback) { httpBindingServer = { server: null, app: express(), - router: express.Router() + router: express.Router(), }; if (!config.getConfig().http) { - config.getLogger().fatal(context, - 'GLOBAL-002: Configuration error. Configuration object [config.http] is missing'); + config + .getLogger() + .fatal(context, 'GLOBAL-002: Configuration error. Configuration object [config.http] is missing'); callback(new errors.ConfigurationError('config.http')); return; } @@ -439,7 +454,8 @@ function start(callback) { parseData, addTimestamp, handleIncomingMeasure, - returnCommands); + returnCommands + ); httpBindingServer.router.post( config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH, @@ -448,7 +464,8 @@ function start(callback) { parseData, addTimestamp, handleIncomingMeasure, - returnCommands); + returnCommands + ); httpBindingServer.router.post( (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_COMMANDS_PATH, @@ -458,7 +475,8 @@ function start(callback) { addTimestamp, isCommand, handleIncomingMeasure, - returnCommands); + returnCommands + ); httpBindingServer.router.post( (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_CONFIGURATION_PATH, @@ -489,7 +507,6 @@ function stop(callback) { } } - function sendPushNotifications(device, values, callback) { var executions = _.flatten(values.map(commandHandler.generateCommandExecution.bind(null, null, device))); @@ -499,7 +516,6 @@ function sendPushNotifications(device, values, callback) { } function storePollNotifications(device, values, callback) { - function addPollNotification(item, innerCallback) { iotAgentLib.addCommand(device.service, device.subservice, device.id, item, innerCallback); } diff --git a/lib/bindings/MQTTBinding.js b/lib/bindings/MQTTBinding.js index 7224ebe6..5107275e 100644 --- a/lib/bindings/MQTTBinding.js +++ b/lib/bindings/MQTTBinding.js @@ -30,7 +30,7 @@ var iotAgentLib = require('iotagent-node-lib'), iotaUtils = require('../iotaUtils'), constants = require('../constants'), context = { - op: 'IOTAJSON.MQTT.Binding' + op: 'IOTAJSON.MQTT.Binding', }, mqttClient, config = require('../configService'); @@ -72,10 +72,7 @@ function recreateSubscriptions(callback) { }); } - async.waterfall([ - generateTopics, - subscribeToTopics - ], callback); + async.waterfall([generateTopics, subscribeToTopics], callback); } /** @@ -98,9 +95,18 @@ function sendConfigurationToDevice(apiKey, deviceId, results, callback) { config.getLogger().debug(context, 'Sending requested configuration to the device:\n %j', configurations); mqttClient.publish( - '/' + apiKey + '/' + deviceId + '/' + constants.CONFIGURATION_SUFIX + '/' + - constants.CONFIGURATION_VALUES_SUFIX, - JSON.stringify(configurations), options, callback); + '/' + + apiKey + + '/' + + deviceId + + '/' + + constants.CONFIGURATION_SUFIX + + '/' + + constants.CONFIGURATION_VALUES_SUFIX, + JSON.stringify(configurations), + options, + callback + ); } /** @@ -113,10 +119,7 @@ function unsubscribeAll(callback) { callback(); } - async.waterfall([ - generateTopics, - unsubscribeFromTopics - ], callback); + async.waterfall([generateTopics, unsubscribeFromTopics], callback); } /** @@ -125,7 +128,7 @@ function unsubscribeAll(callback) { function start(callback) { var options = { keepalive: 0, - connectTimeout: 60 * 60 * 1000 + connectTimeout: 60 * 60 * 1000, }; if (config.getConfig().mqtt.username && config.getConfig().mqtt.password) { @@ -134,7 +137,9 @@ function start(callback) { } mqttClient = mqtt.connect( - 'mqtt://' + config.getConfig().mqtt.host + ':' + config.getConfig().mqtt.port, options); + 'mqtt://' + config.getConfig().mqtt.host + ':' + config.getConfig().mqtt.port, + options + ); mqttClient.on('message', commonBindings.mqttMessageHandler); @@ -157,10 +162,7 @@ function deviceProvisioningHandler(device, callback) { * Stop the binding, releasing its resources. */ function stop(callback) { - async.series([ - unsubscribeAll, - mqttClient.end.bind(mqttClient, true) - ], callback); + async.series([unsubscribeAll, mqttClient.end.bind(mqttClient, true)], callback); } /** diff --git a/lib/commandHandler.js b/lib/commandHandler.js index 23218ed7..c394bb4b 100644 --- a/lib/commandHandler.js +++ b/lib/commandHandler.js @@ -83,23 +83,14 @@ function generateCommandExecution(apiKey, device, attribute) { function commandHandler(id, type, service, subservice, attributes, callback) { config .getLogger() - .debug( - context, - 'Handling MQTT command for device [%s] in service [%s - %s]', - id, - service, - subservice - ); + .debug(context, 'Handling MQTT command for device [%s] in service [%s - %s]', id, service, subservice); function concat(previous, current) { previous = previous.concat(current); return previous; } - iotAgentLib.getDeviceByName(id, service, subservice, function( - error, - device - ) { + iotAgentLib.getDeviceByName(id, service, subservice, function(error, device) { if (error) { config.getLogger().error( context, @@ -111,28 +102,16 @@ function commandHandler(id, type, service, subservice, attributes, callback) { ); callback(error); } else { - iotaUtils.getEffectiveApiKey( - device.service, - device.subservice, - function(error, apiKey) { - if (error) { - callback(error); - } else { - async.series( - attributes - .map( - generateCommandExecution.bind( - null, - apiKey, - device - ) - ) - .reduce(concat, []), - callback - ); - } + iotaUtils.getEffectiveApiKey(device.service, device.subservice, function(error, apiKey) { + if (error) { + callback(error); + } else { + async.series( + attributes.map(generateCommandExecution.bind(null, apiKey, device)).reduce(concat, []), + callback + ); } - ); + }); } }); } diff --git a/lib/commonBindings.js b/lib/commonBindings.js index 998a7f06..94be3f37 100644 --- a/lib/commonBindings.js +++ b/lib/commonBindings.js @@ -49,25 +49,12 @@ function parseMessage(message) { stringMessage = message.toString(); parsedMessage = JSON.parse(stringMessage); } catch (e) { - config - .getLogger() - .debug( - context, - 'Parse error treating message [%s]: %j', - stringMessage, - e - ); + config.getLogger().debug(context, 'Parse error treating message [%s]: %j', stringMessage, e); parsedMessage = null; } if (!parsedMessage) { - config - .getLogger() - .error( - context, - 'MEASURES-003: Impossible to handle malformed message: %s', - message - ); + config.getLogger().error(context, 'MEASURES-003: Impossible to handle malformed message: %s', message); } return parsedMessage; @@ -117,13 +104,7 @@ function extractAttributes(device, current) { return values; } -function sendConfigurationToDevice( - device, - apiKey, - deviceId, - results, - callback -) { +function sendConfigurationToDevice(device, apiKey, deviceId, results, callback) { transportSelector.applyFunctionFromBinding( [apiKey, deviceId, results], 'sendConfigurationToDevice', @@ -156,12 +137,7 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { iotAgentLib.alarms.release(constants.MQTTB_ALARM); config .getLogger() - .debug( - context, - 'Configuration request finished for APIKey [%s] and Device [%s]', - apiKey, - deviceId - ); + .debug(context, 'Configuration request finished for APIKey [%s] and Device [%s]', apiKey, deviceId); } } ); @@ -180,14 +156,7 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { function singleMeasure(apiKey, deviceId, attribute, device, message) { var values; - config - .getLogger() - .debug( - context, - 'Processing single measure for device [%s] with apiKey [%s]', - deviceId, - apiKey - ); + config.getLogger().debug(context, 'Processing single measure for device [%s] with apiKey [%s]', deviceId, apiKey); values = [ { @@ -197,9 +166,7 @@ function singleMeasure(apiKey, deviceId, attribute, device, message) { }, ]; - iotAgentLib.update(device.name, device.type, '', values, device, function( - error - ) { + iotAgentLib.update(device.name, device.type, '', values, device, function(error) { if (error) { config.getLogger().error( context, @@ -235,12 +202,7 @@ function multipleMeasures(apiKey, deviceId, device, messageObj) { config .getLogger() - .debug( - context, - 'Processing multiple measures for device [%s] with apiKey [%s]', - deviceId, - apiKey - ); + .debug(context, 'Processing multiple measures for device [%s] with apiKey [%s]', deviceId, apiKey); for (var i in messageObj) { if (messageObj.hasOwnProperty(i)) { @@ -252,9 +214,7 @@ function multipleMeasures(apiKey, deviceId, device, messageObj) { } } - iotAgentLib.update(device.name, device.type, '', values, device, function( - error - ) { + iotAgentLib.update(device.name, device.type, '', values, device, function(error) { if (error) { config.getLogger().error( context, @@ -291,42 +251,14 @@ function messageHandler(topic, message, protocol) { function processDeviceMeasure(error, device) { if (error) { - config - .getLogger() - .error( - context, - 'MEASURES-004: Device not found for topic [%s]', - topic - ); + config.getLogger().error(context, 'MEASURES-004: Device not found for topic [%s]', topic); } else { - if ( - topicInformation[3] === 'configuration' && - topicInformation[4] === 'commands' && - parsedMessage - ) { - manageConfigurationRequest( - apiKey, - deviceId, - device, - parsedMessage - ); + if (topicInformation[3] === 'configuration' && topicInformation[4] === 'commands' && parsedMessage) { + manageConfigurationRequest(apiKey, deviceId, device, parsedMessage); } else if (topicInformation[4]) { - singleMeasure( - apiKey, - deviceId, - topicInformation[4], - device, - message - ); - } else if ( - topicInformation[3] === constants.CONFIGURATION_COMMAND_UPDATE - ) { - commandHandler.updateCommand( - apiKey, - deviceId, - device, - parsedMessage - ); + singleMeasure(apiKey, deviceId, topicInformation[4], device, message); + } else if (topicInformation[3] === constants.CONFIGURATION_COMMAND_UPDATE) { + commandHandler.updateCommand(apiKey, deviceId, device, parsedMessage); } else if (parsedMessage && typeof parsedMessage === 'object') { multipleMeasures(apiKey, deviceId, device, parsedMessage); } else { diff --git a/lib/configService.js b/lib/configService.js index 6429d272..630a52d7 100644 --- a/lib/configService.js +++ b/lib/configService.js @@ -76,11 +76,7 @@ function processEnvironmentVariables() { 'IOTA_AMQP_RETRIES', 'IOTA_AMQP_RETRY_TIME', ], - httpVariables = [ - 'IOTA_HTTP_HOST', - 'IOTA_HTTP_PORT', - 'IOTA_HTTP_TIMEOUT', - ]; + httpVariables = ['IOTA_HTTP_HOST', 'IOTA_HTTP_PORT', 'IOTA_HTTP_TIMEOUT']; for (var i = 0; i < environmentVariables.length; i++) { if (process.env[environmentVariables[i]]) { diff --git a/lib/errors.js b/lib/errors.js index e44b4dc6..53a1e0e3 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -31,18 +31,12 @@ module.exports = { }, BadPayload: function(payload) { this.name = 'BAD_PAYLOAD'; - this.message = - 'The request payload [' + payload + '] could not be parsed'; + this.message = 'The request payload [' + payload + '] could not be parsed'; this.code = 400; }, GroupNotFound: function(service, subservice) { this.name = 'GROUP_NOT_FOUND'; - this.message = - 'Group not found for service [' + - service + - '] and subservice [' + - subservice + - ']'; + this.message = 'Group not found for service [' + service + '] and subservice [' + subservice + ']'; }, MandatoryParamsNotFound: function(paramList) { this.name = 'MANDATORY_PARAMS_NOT_FOUND'; @@ -70,35 +64,22 @@ module.exports = { }, ConfigurationError: function(parameter) { this.name = 'CONFIGURATION_ERROR'; - this.message = - 'Mandatory configuration parameter not found: ' + parameter; + this.message = 'Mandatory configuration parameter not found: ' + parameter; this.code = 500; }, HTTPCommandResponseError: function(code, error) { this.name = 'HTTP_COMMAND_RESPONSE_ERROR'; - this.message = - 'There was an error in the response of a device to a command [' + - code + - ' ]:' + - error; + this.message = 'There was an error in the response of a device to a command [' + code + ' ]:' + error; this.code = 400; }, EndpointNotFound: function(id) { this.name = 'ENDPOINT_NOT_FOUND'; - this.message = - 'The provisioned device [' + - id + - ' ] did not have an HTTP endpoint to call'; + this.message = 'The provisioned device [' + id + ' ] did not have an HTTP endpoint to call'; this.code = 400; }, DeviceEndpointError: function(code, msg) { this.name = 'DEVICE_ENDPOINT_ERROR'; - this.message = - 'Request to the device ended up in error with code [' + - code + - ' ] and message [' + - msg + - ']'; + this.message = 'Request to the device ended up in error with code [' + code + ' ] and message [' + msg + ']'; this.code = code; }, }; diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 77eb3802..269a6608 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -46,34 +46,16 @@ function getEffectiveApiKey(service, subservice, callback) { config.getLogger().debug(context, 'Using found group: %j', group); callback(null, group.apikey); } else if (config.getConfig().defaultKey) { - config - .getLogger() - .debug( - context, - 'Using default API Key: %s', - config.getConfig().defaultKey - ); + config.getLogger().debug(context, 'Using default API Key: %s', config.getConfig().defaultKey); callback(null, config.getConfig().defaultKey); } else { - config - .getLogger() - .error( - context, - 'Could not find any API Key information for device.' - ); + config.getLogger().error(context, 'Could not find any API Key information for device.'); callback(new errors.GroupNotFound(service, subservice)); } }); } -function manageConfiguration( - apiKey, - deviceId, - device, - objMessage, - sendFunction, - callback -) { +function manageConfiguration(apiKey, deviceId, device, objMessage, sendFunction, callback) { function handleSendConfigurationError(error, results) { if (error) { config.getLogger().error( @@ -86,12 +68,7 @@ function manageConfiguration( } else { config .getLogger() - .debug( - context, - 'Configuration attributes sent to the device successfully.', - deviceId, - apiKey - ); + .debug(context, 'Configuration attributes sent to the device successfully.', deviceId, apiKey); } callback(error); @@ -103,15 +80,10 @@ function manageConfiguration( results.contextResponses[0] && results.contextResponses[0].contextElement.attributes ) { - callback( - null, - results.contextResponses[0].contextElement.attributes - ); + callback(null, results.contextResponses[0].contextElement.attributes); } else { /*jshint quotmark: double */ - callback( - "Couldn't find any information in Context Broker response" - ); + callback("Couldn't find any information in Context Broker response"); /*jshint quotmark: single */ } } @@ -119,56 +91,38 @@ function manageConfiguration( if (objMessage.type === 'configuration') { async.waterfall( [ - apply( - iotAgentLib.query, - device.name, - device.type, - '', - objMessage.fields, - device - ), + apply(iotAgentLib.query, device.name, device.type, '', objMessage.fields, device), extractAttributes, apply(sendFunction, apiKey, deviceId), ], handleSendConfigurationError ); } else if (objMessage.type === 'subscription') { - iotAgentLib.subscribe( - device, - objMessage.fields, - objMessage.fields, - function(error) { - if (error) { - config - .getLogger() - .error( - context, - 'CONFIG-002: There was an error subscribing device [%s] to attributes [%j]', - device.name, - objMessage.fields - ); - } else { - config - .getLogger() - .debug( - context, - 'Successfully subscribed device [%s] to attributes[%j]', - device.name, - objMessage.fields - ); - } - - callback(error); + iotAgentLib.subscribe(device, objMessage.fields, objMessage.fields, function(error) { + if (error) { + config + .getLogger() + .error( + context, + 'CONFIG-002: There was an error subscribing device [%s] to attributes [%j]', + device.name, + objMessage.fields + ); + } else { + config + .getLogger() + .debug( + context, + 'Successfully subscribed device [%s] to attributes[%j]', + device.name, + objMessage.fields + ); } - ); + + callback(error); + }); } else { - config - .getLogger() - .error( - context, - 'CONFIG-003: Unknown command type from device [%s]', - device.name - ); + config.getLogger().error(context, 'CONFIG-003: Unknown command type from device [%s]', device.name); callback(); } } @@ -186,10 +140,7 @@ function createConfigurationNotification(results) { } function findOrCreate(deviceId, transport, group, callback) { - iotAgentLib.getDevice(deviceId, group.service, group.subservice, function( - error, - device - ) { + iotAgentLib.getDevice(deviceId, group.service, group.subservice, function(error, device) { if (!error && device) { callback(null, device, group); } else if (error.name === 'DEVICE_NOT_FOUND') { @@ -231,10 +182,7 @@ function findOrCreate(deviceId, transport, group, callback) { */ function retrieveDevice(deviceId, apiKey, transport, callback) { if (apiKey === config.getConfig().defaultKey) { - iotAgentLib.getDevicesByAttribute('id', deviceId, null, null, function( - error, - devices - ) { + iotAgentLib.getDevicesByAttribute('id', deviceId, null, null, function(error, devices) { if (error) { callback(error); } else if (devices && devices.length === 1) { @@ -255,21 +203,11 @@ function retrieveDevice(deviceId, apiKey, transport, callback) { } else { async.waterfall( [ - apply( - iotAgentLib.getConfiguration, - config.getConfig().iota.defaultResource || '', - apiKey - ), + apply(iotAgentLib.getConfiguration, config.getConfig().iota.defaultResource || '', apiKey), apply(findOrCreate, deviceId, transport), apply( iotAgentLib.mergeDeviceWithConfiguration, - [ - 'lazy', - 'active', - 'staticAttributes', - 'commands', - 'subscriptions', - ], + ['lazy', 'active', 'staticAttributes', 'commands', 'subscriptions'], [null, null, [], [], [], [], []] ), ], diff --git a/lib/iotagent-json.js b/lib/iotagent-json.js index e5f1c8ed..8c822801 100644 --- a/lib/iotagent-json.js +++ b/lib/iotagent-json.js @@ -54,14 +54,7 @@ function configurationNotificationHandler(device, updates, callback) { } async.waterfall( - [ - apply( - iotaUtils.getEffectiveApiKey, - device.service, - device.subservice - ), - invokeConfiguration, - ], + [apply(iotaUtils.getEffectiveApiKey, device.service, device.subservice), invokeConfiguration], callback ); } @@ -107,18 +100,13 @@ function bidirectionalityNotificationHandler(device, updates, callback) { * @param {Object} device Device provisioning information. */ function deviceProvisioningHandler(device, callback) { - transportSelector.applyFunctionFromBinding( - [device], - 'deviceProvisioningHandler', - null, - function(error, devices) { - if (error) { - callback(error); - } else { - callback(null, devices[0]); - } + transportSelector.applyFunctionFromBinding([device], 'deviceProvisioningHandler', null, function(error, devices) { + if (error) { + callback(error); + } else { + callback(null, devices[0]); } - ); + }); } /** @@ -141,59 +129,30 @@ function start(newConfig, callback) { iotAgentLib.setProvisioningHandler(deviceProvisioningHandler); iotAgentLib.setDataUpdateHandler(updateHandler); - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.attributeAlias.update - ); - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.addEvents.update - ); - - if ( - config.getConfig().iota && - config.getConfig().iota.compressTimestamp - ) { - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.compressTimestamp.update - ); - iotAgentLib.addQueryMiddleware( - iotAgentLib.dataPlugins.compressTimestamp.query - ); + iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.attributeAlias.update); + iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.addEvents.update); + + if (config.getConfig().iota && config.getConfig().iota.compressTimestamp) { + iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.compressTimestamp.update); + iotAgentLib.addQueryMiddleware(iotAgentLib.dataPlugins.compressTimestamp.query); } if (config.getConfig().mqtt.thinkingThingsPlugin) { - iotAgentLib.addUpdateMiddleware( - thinkingThingPlugin.updatePlugin - ); + iotAgentLib.addUpdateMiddleware(thinkingThingPlugin.updatePlugin); } - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.expressionTransformation.update - ); - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.multiEntity.update - ); - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.timestampProcess.update - ); - - iotAgentLib.addDeviceProvisionMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.deviceProvision - ); - iotAgentLib.addConfigurationProvisionMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.groupProvision - ); - iotAgentLib.addNotificationMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.notification - ); + iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.expressionTransformation.update); + iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.multiEntity.update); + iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.timestampProcess.update); + + iotAgentLib.addDeviceProvisionMiddleware(iotAgentLib.dataPlugins.bidirectionalData.deviceProvision); + iotAgentLib.addConfigurationProvisionMiddleware(iotAgentLib.dataPlugins.bidirectionalData.groupProvision); + iotAgentLib.addNotificationMiddleware(iotAgentLib.dataPlugins.bidirectionalData.notification); if (config.getConfig().configRetrieval) { - iotAgentLib.setNotificationHandler( - configurationNotificationHandler - ); + iotAgentLib.setNotificationHandler(configurationNotificationHandler); } else { - iotAgentLib.setNotificationHandler( - bidirectionalityNotificationHandler - ); + iotAgentLib.setNotificationHandler(bidirectionalityNotificationHandler); } transportSelector.startTransportBindings(newConfig, callback); @@ -208,11 +167,7 @@ function start(newConfig, callback) { function stop(callback) { config.getLogger().info(context, 'Stopping IoT Agent'); async.series( - [ - transportSelector.stopTransportBindings, - iotAgentLib.resetMiddlewares, - iotAgentLib.deactivate, - ], + [transportSelector.stopTransportBindings, iotAgentLib.resetMiddlewares, iotAgentLib.deactivate], callback ); } diff --git a/lib/thinkingThingPlugin.js b/lib/thinkingThingPlugin.js index 827e01bf..be115980 100644 --- a/lib/thinkingThingPlugin.js +++ b/lib/thinkingThingPlugin.js @@ -37,13 +37,7 @@ function parseBattery(payload) { fields = rawValue.split(','), result = []; - config - .getLogger() - .debug( - context, - 'Parsing Battery module: %s', - JSON.stringify(fields, null, 4) - ); + config.getLogger().debug(context, 'Parsing Battery module: %s', JSON.stringify(fields, null, 4)); if (fields.length >= 8) { result.push({ @@ -94,13 +88,7 @@ function parseBattery(payload) { if (result.length !== 0) { return result; } else { - config - .getLogger() - .error( - context, - 'TTHINGS-001: Too few fields parsing Battery module: %s', - rawValue - ); + config.getLogger().error(context, 'TTHINGS-001: Too few fields parsing Battery module: %s', rawValue); return []; } } @@ -116,13 +104,7 @@ function parseGSM(payload) { fields = rawValue.split(','), result = []; - config - .getLogger() - .debug( - context, - 'Parsing GSM module: %s', - JSON.stringify(fields, null, 4) - ); + config.getLogger().debug(context, 'Parsing GSM module: %s', JSON.stringify(fields, null, 4)); if (fields.length >= 7) { result.push({ @@ -153,13 +135,7 @@ function parseGSM(payload) { return result; } else { - config - .getLogger() - .error( - context, - 'TTHINGS-002: Too few fields parsing GSM module: %s', - rawValue - ); + config.getLogger().error(context, 'TTHINGS-002: Too few fields parsing GSM module: %s', rawValue); return []; } } @@ -176,13 +152,7 @@ function parseCell(payload) { fields = rawValue.match(/..../g), result = []; - config - .getLogger() - .debug( - context, - 'Parsing GSM module: %s', - JSON.stringify(fields, null, 4) - ); + config.getLogger().debug(context, 'Parsing GSM module: %s', JSON.stringify(fields, null, 4)); if (fields.length === 4) { result.push({ @@ -208,13 +178,7 @@ function parseCell(payload) { return result; } else { - config - .getLogger() - .error( - context, - 'TTHINGS-003: Too few fields parsing C1 module: %s', - rawValue - ); + config.getLogger().error(context, 'TTHINGS-003: Too few fields parsing C1 module: %s', rawValue); return []; } } @@ -298,14 +262,8 @@ function updatePluginNgsi2(entity, entityType, callback) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePluginNgsi1(entity, entityType, callback) { - if ( - entity.contextElements && - entity.contextElements[0] && - entity.contextElements[0].attributes - ) { - var moduleAttributes = entity.contextElements[0].attributes.map( - modifyAttributes - ); + if (entity.contextElements && entity.contextElements[0] && entity.contextElements[0].attributes) { + var moduleAttributes = entity.contextElements[0].attributes.map(modifyAttributes); entity.contextElements[0].attributes = moduleAttributes; diff --git a/lib/timestampProcessPlugin.js b/lib/timestampProcessPlugin.js index 13e29dfc..f7ff301d 100644 --- a/lib/timestampProcessPlugin.js +++ b/lib/timestampProcessPlugin.js @@ -52,34 +52,20 @@ function updatePlugin(entity, entityType, callback) { return element; } - if ( - entity.contextElements && - entity.contextElements[0] && - entity.contextElements[0].attributes - ) { + if (entity.contextElements && entity.contextElements[0] && entity.contextElements[0].attributes) { for (var i in entity.contextElements[0].attributes) { - if ( - entity.contextElements[0].attributes[i].name === - constants.TIMESTAMP_ATTRIBUTE - ) { + if (entity.contextElements[0].attributes[i].name === constants.TIMESTAMP_ATTRIBUTE) { timestamp = entity.contextElements[0].attributes[i]; } } if (timestamp) { - entity.contextElements[0].attributes = entity.contextElements[0].attributes.map( - insertMetadata - ); + entity.contextElements[0].attributes = entity.contextElements[0].attributes.map(insertMetadata); } callback(null, entity, entityType); } else { - config - .getLogger() - .error( - context, - 'MEASURES-001: Bad payload received while processing timestamps' - ); + config.getLogger().error(context, 'MEASURES-001: Bad payload received while processing timestamps'); callback(new errors.BadPayload(entity)); } } diff --git a/lib/transportSelector.js b/lib/transportSelector.js index e84d21a4..5fcbefb6 100644 --- a/lib/transportSelector.js +++ b/lib/transportSelector.js @@ -51,32 +51,14 @@ function startTransportBindings(newConfig, callback) { } function createExecutionsForBinding(argument, functionName, protocol) { - config - .getLogger() - .debug( - 'Creating execution for function [%s] and protocol [%s]', - functionName, - protocol - ); + config.getLogger().debug('Creating execution for function [%s] and protocol [%s]', functionName, protocol); function addHandler(current, binding) { - if ( - binding[functionName] && - (!protocol || binding.protocol === protocol) - ) { + if (binding[functionName] && (!protocol || binding.protocol === protocol)) { var args = [binding[functionName]].concat(argument), - boundFunction = binding[functionName].bind.apply( - binding[functionName], - args - ); - - config - .getLogger() - .debug( - 'Binding found for function [%s] and protocol [%s]', - functionName, - protocol - ); + boundFunction = binding[functionName].bind.apply(binding[functionName], args); + + config.getLogger().debug('Binding found for function [%s] and protocol [%s]', functionName, protocol); current.push(boundFunction); } @@ -96,18 +78,9 @@ function createExecutionsForBinding(argument, functionName, protocol) { * @param {String} protocol Transport protocol where the function must be executed. */ function applyFunctionFromBinding(argument, functionName, protocol, callback) { - config - .getLogger() - .debug( - 'Looking for bindings for the function [%s] and protocol [%s]', - functionName, - protocol - ); - - async.series( - createExecutionsForBinding(argument, functionName, protocol), - callback - ); + config.getLogger().debug('Looking for bindings for the function [%s] and protocol [%s]', functionName, protocol); + + async.series(createExecutionsForBinding(argument, functionName, protocol), callback); } /** diff --git a/test/unit/HTTP_commands_test.js b/test/unit/HTTP_commands_test.js index 17fa1c9d..748b07e1 100644 --- a/test/unit/HTTP_commands_test.js +++ b/test/unit/HTTP_commands_test.js @@ -41,8 +41,8 @@ describe('HTTP: Commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandHTTP.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; config.logLevel = 'INFO'; @@ -53,8 +53,7 @@ describe('HTTP: Commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, - utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -71,10 +70,7 @@ describe('HTTP: Commands', function() { afterEach(function(done) { nock.cleanAll(); - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a command arrive to the Agent for a device with the HTTP protocol', function() { @@ -84,8 +80,8 @@ describe('HTTP: Commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; beforeEach(function() { @@ -138,4 +134,3 @@ describe('HTTP: Commands', function() { }); }); }); - diff --git a/test/unit/HTTP_get-configuration_test.js b/test/unit/HTTP_get-configuration_test.js index a49ca2e6..e6d9077c 100644 --- a/test/unit/HTTP_get-configuration_test.js +++ b/test/unit/HTTP_get-configuration_test.js @@ -45,8 +45,8 @@ describe('HTTP: Get configuration from the devices', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandHTTP.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -55,8 +55,7 @@ describe('HTTP: Get configuration from the devices', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, - utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -78,10 +77,7 @@ describe('HTTP: Get configuration from the devices', function() { nock.cleanAll(); config.configRetrieval = oldConfigurationFlag; - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a configuration request is received in the path /configuration/commands', function() { @@ -90,19 +86,16 @@ describe('HTTP: Get configuration from the devices', function() { method: 'POST', json: { type: 'configuration', - fields: [ - 'sleepTime', - 'warningLevel' - ] + fields: ['sleepTime', 'warningLevel'], }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'MQTT_2', - k: '1234' - } + k: '1234', + }, }; beforeEach(function() { @@ -110,14 +103,17 @@ describe('HTTP: Get configuration from the devices', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/queryContext', utils.readExampleFile('./test/contextRequests/getConfiguration.json')) - .reply(200, - utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json')); + .reply(200, utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json')); mockedClientServer = nock('http://localhost:9876') .post('/command/configuration', function(result) { - return result.sleepTime && result.sleepTime === '200' && - result.warningLevel && result.warningLevel === '80' && - result.dt; + return ( + result.sleepTime && + result.sleepTime === '200' && + result.warningLevel && + result.warningLevel === '80' && + result.dt + ); }) .reply(200, ''); }); @@ -149,19 +145,16 @@ describe('HTTP: Get configuration from the devices', function() { method: 'POST', json: { type: 'subscription', - fields: [ - 'sleepTime', - 'warningLevel' - ] + fields: ['sleepTime', 'warningLevel'], }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'MQTT_2', - k: '1234' - } + k: '1234', + }, }; beforeEach(function() { @@ -169,14 +162,17 @@ describe('HTTP: Get configuration from the devices', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/subscribeContext', utils.readExampleFile('./test/subscriptions/subscriptionRequest.json')) - .reply(200, - utils.readExampleFile('./test/subscriptions/subscriptionResponse.json')); + .reply(200, utils.readExampleFile('./test/subscriptions/subscriptionResponse.json')); mockedClientServer = nock('http://localhost:9876') .post('/command/configuration', function(result) { - return result.sleepTime && result.sleepTime === '200' && - result.warningLevel && result.warningLevel === 'ERROR' && - result.dt; + return ( + result.sleepTime && + result.sleepTime === '200' && + result.warningLevel && + result.warningLevel === 'ERROR' && + result.dt + ); }) .reply(200, ''); }); @@ -194,8 +190,8 @@ describe('HTTP: Get configuration from the devices', function() { json: utils.readExampleFile('./test/subscriptions/notification.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; request(configurationRequest, function(error, response, body) { diff --git a/test/unit/HTTP_reveice_measures-test.js b/test/unit/HTTP_reveice_measures-test.js index 2e293d60..18d342b7 100644 --- a/test/unit/HTTP_reveice_measures-test.js +++ b/test/unit/HTTP_reveice_measures-test.js @@ -49,17 +49,17 @@ var iotagentMqtt = require('../../'), attributes: [ { name: 'status', - type: 'Boolean' - } + type: 'Boolean', + }, ], - static_attributes: [] - } - ] + static_attributes: [], + }, + ], }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, contextBrokerMock, contextBrokerUnprovMock; @@ -72,8 +72,8 @@ describe('HTTP: Measure reception ', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceHTTP.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -94,10 +94,7 @@ describe('HTTP: Measure reception ', function() { afterEach(function(done) { nock.cleanAll(); - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a POST measure arrives for the HTTP binding', function() { @@ -106,16 +103,16 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '32', - temperature: '87' + temperature: '87', }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'MQTT_2', - k: '1234' - } + k: '1234', + }, }; beforeEach(function() { @@ -146,16 +143,16 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '111222', - TimeInstant: '20200222T222222' + TimeInstant: '20200222T222222', }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'dev0130101', - k: '1234' - } + k: '1234', + }, }, provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', @@ -163,9 +160,9 @@ describe('HTTP: Measure reception ', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } - }; + 'fiware-servicepath': '/gardens', + }, + }; beforeEach(function(done) { nock.cleanAll(); @@ -211,17 +208,17 @@ describe('HTTP: Measure reception ', function() { url: 'http://localhost:' + config.http.port + '/iot/json', method: 'POST', json: { - humidity: '111222' + humidity: '111222', }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'dev0130101', k: '1234', - t: '20200222T222222' - } + t: '20200222T222222', + }, }, provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', @@ -229,8 +226,8 @@ describe('HTTP: Measure reception ', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; beforeEach(function(done) { @@ -278,16 +275,16 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '32', - temperature: '87' + temperature: '87', }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'MQTT_UNPROVISIONED', - k: 'KL223HHV8732SFL1' - } + k: 'KL223HHV8732SFL1', + }, }; beforeEach(function(done) { @@ -320,12 +317,12 @@ describe('HTTP: Measure reception ', function() { method: 'GET', headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'MQTT_UNPROVISIONED', - k: 'KL223HHV8732SFL1' - } + k: 'KL223HHV8732SFL1', + }, }; request(optionsMeasure, function(error, response, body) { @@ -344,5 +341,3 @@ describe('HTTP: Measure reception ', function() { }); }); }); - - diff --git a/test/unit/MQTT_commands_test.js b/test/unit/MQTT_commands_test.js index afec802d..53bc4d3b 100644 --- a/test/unit/MQTT_commands_test.js +++ b/test/unit/MQTT_commands_test.js @@ -34,7 +34,6 @@ var iotagentMqtt = require('../../'), contextBrokerMock, mqttClient; - describe('MQTT: Commands', function() { beforeEach(function(done) { var provisionOptions = { @@ -43,18 +42,21 @@ describe('MQTT: Commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; config.logLevel = 'INFO'; nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); mqttClient.subscribe('/1234/MQTT_2/cmd', null); @@ -62,8 +64,7 @@ describe('MQTT: Commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, - utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -83,10 +84,7 @@ describe('MQTT: Commands', function() { mqttClient.unsubscribe('/1234/MQTT_2/cmd', null); mqttClient.end(); - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a command arrive to the Agent for a device with the MQTT_UL protocol', function() { @@ -96,8 +94,8 @@ describe('MQTT: Commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; beforeEach(function() { diff --git a/test/unit/MQTT_get-configuration_test.js b/test/unit/MQTT_get-configuration_test.js index 3f693950..1b107a7e 100644 --- a/test/unit/MQTT_get-configuration_test.js +++ b/test/unit/MQTT_get-configuration_test.js @@ -43,16 +43,19 @@ describe('MQTT: Get configuration from the devices', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') @@ -76,94 +79,90 @@ describe('MQTT: Get configuration from the devices', function() { nock.cleanAll(); mqttClient.end(); - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); - describe('When a configuration request is received in the topic ' + - '"/{{apikey}}/{{deviceid}}/configuration/commands"', function() { - var values = { - type: 'configuration', - fields: [ - 'sleepTime', - 'warningLevel' - ] - }, - configurationReceived; - - beforeEach(function() { - contextBrokerMock - .matchHeader('fiware-service', 'smartGondor') - .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/queryContext', utils.readExampleFile('./test/contextRequests/getConfiguration.json')) - .reply(200, - utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json')); - - mqttClient.subscribe('/1234/MQTT_2/configuration/values', null); - - configurationReceived = false; - }); + describe( + 'When a configuration request is received in the topic ' + '"/{{apikey}}/{{deviceid}}/configuration/commands"', + function() { + var values = { + type: 'configuration', + fields: ['sleepTime', 'warningLevel'], + }, + configurationReceived; + + beforeEach(function() { + contextBrokerMock + .matchHeader('fiware-service', 'smartGondor') + .matchHeader('fiware-servicepath', '/gardens') + .post('/v1/queryContext', utils.readExampleFile('./test/contextRequests/getConfiguration.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json')); + + mqttClient.subscribe('/1234/MQTT_2/configuration/values', null); + + configurationReceived = false; + }); - afterEach(function(done) { - mqttClient.unsubscribe('/1234/MQTT_2/configuration/values', null); + afterEach(function(done) { + mqttClient.unsubscribe('/1234/MQTT_2/configuration/values', null); - done(); - }); + done(); + }); - it('should ask the Context Broker for the request attributes', function(done) { - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function(error) { - setTimeout(function() { - contextBrokerMock.done(); - done(); - }, 100); + it('should ask the Context Broker for the request attributes', function(done) { + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + contextBrokerMock.done(); + done(); + }, 100); + }); }); - }); - it('should return the requested attributes to the client in /1234/MQTT_2/configuration/values', - function(done) { + it('should return the requested attributes to the client in /1234/MQTT_2/configuration/values', function(done) { mqttClient.on('message', function(topic, data) { var result = JSON.parse(data); configurationReceived = - result.sleepTime && result.sleepTime === '200' && - result.warningLevel && result.warningLevel === '80'; + result.sleepTime && + result.sleepTime === '200' && + result.warningLevel && + result.warningLevel === '80'; }); - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, - function(error) { - setTimeout(function() { - configurationReceived.should.equal(true); - done(); - }, 100); + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + configurationReceived.should.equal(true); + done(); + }, 100); }); - }); + }); - it('should add the system timestamp in compressed format to the request', - function(done) { + it('should add the system timestamp in compressed format to the request', function(done) { mqttClient.on('message', function(topic, data) { var result = JSON.parse(data); configurationReceived = result.dt && result.dt.should.match(/^\d{8}T\d{6}Z$/); }); - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, - function(error) { - setTimeout(function() { - should.exist(configurationReceived); - done(); - }, 100); - }); + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + should.exist(configurationReceived); + done(); + }, 100); + }); }); - }); + } + ); describe('When a subscription request is received in the IoT Agent', function() { var values = { type: 'subscription', - fields: [ - 'sleepTime', - 'warningLevel' - ] + fields: ['sleepTime', 'warningLevel'], }, configurationReceived; @@ -172,8 +171,7 @@ describe('MQTT: Get configuration from the devices', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/subscribeContext', utils.readExampleFile('./test/subscriptions/subscriptionRequest.json')) - .reply(200, - utils.readExampleFile('./test/subscriptions/subscriptionResponse.json')); + .reply(200, utils.readExampleFile('./test/subscriptions/subscriptionResponse.json')); mqttClient.subscribe('/1234/MQTT_2/configuration/values', null); @@ -186,45 +184,41 @@ describe('MQTT: Get configuration from the devices', function() { done(); }); - it('should create a subscription in the ContextBroker', - function(done) { - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, - function(error) { - setTimeout(function() { - contextBrokerMock.done(); - done(); - }, 100); - }); + it('should create a subscription in the ContextBroker', function(done) { + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function(error) { + setTimeout(function() { + contextBrokerMock.done(); + done(); + }, 100); + }); + }); + it('should update the values in the MQTT topic when a notification is received', function(done) { + var optionsNotify = { + url: 'http://localhost:' + config.iota.server.port + '/notify', + method: 'POST', + json: utils.readExampleFile('./test/subscriptions/notification.json'), + headers: { + 'fiware-service': 'smartGondor', + 'fiware-servicepath': '/gardens', + }, + }; + + mqttClient.on('message', function(topic, data) { + var result = JSON.parse(data); + + configurationReceived = result.sleepTime === '200' && result.warningLevel === 'ERROR'; }); - it('should update the values in the MQTT topic when a notification is received', - function(done) { - var optionsNotify = { - url: 'http://localhost:' + config.iota.server.port + '/notify', - method: 'POST', - json: utils.readExampleFile('./test/subscriptions/notification.json'), - headers: { - 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } - }; - - mqttClient.on('message', function(topic, data) { - var result = JSON.parse(data); - - configurationReceived = result.sleepTime === '200' && result.warningLevel === 'ERROR'; - }); - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, - function(error) { + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function(error) { + setTimeout(function() { + request(optionsNotify, function(error, response, body) { setTimeout(function() { - request(optionsNotify, function(error, response, body) { - setTimeout(function() { - configurationReceived.should.equal(true); - done(); - }, 100); - }); + configurationReceived.should.equal(true); + done(); }, 100); }); + }, 100); }); + }); }); }); diff --git a/test/unit/MQTT_receive_measures-test.js b/test/unit/MQTT_receive_measures-test.js index 7486c8fc..a057789b 100644 --- a/test/unit/MQTT_receive_measures-test.js +++ b/test/unit/MQTT_receive_measures-test.js @@ -49,17 +49,17 @@ var iotagentMqtt = require('../../'), attributes: [ { name: 'status', - type: 'Boolean' - } + type: 'Boolean', + }, ], - static_attributes: [] - } - ] + static_attributes: [], + }, + ], }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, contextBrokerMock, contextBrokerUnprovMock, @@ -73,16 +73,19 @@ describe('MQTT: Measure reception ', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') @@ -101,10 +104,7 @@ describe('MQTT: Measure reception ', function() { nock.cleanAll(); mqttClient.end(); - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a new multiple measure arrives to the MQTT Topic', function() { @@ -118,7 +118,7 @@ describe('MQTT: Measure reception ', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - temperature: '87' + temperature: '87', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -151,16 +151,17 @@ describe('MQTT: Measure reception ', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - temperature: '87' + temperature: '87', }; - mqttClient.publish('/KL223HHV8732SFL1/MQTT_UNPROVISIONED/attrs', JSON.stringify(values), null, - function(error) { - setTimeout(function() { - contextBrokerUnprovMock.done(); - done(); - }, 100); - }); + mqttClient.publish('/KL223HHV8732SFL1/MQTT_UNPROVISIONED/attrs', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + contextBrokerUnprovMock.done(); + done(); + }, 100); + }); }); }); @@ -175,7 +176,7 @@ describe('MQTT: Measure reception ', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - weight: '87' + weight: '87', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -199,7 +200,7 @@ describe('MQTT: Measure reception ', function() { var values = { humidity: '32', temperature: '87', - TimeInstant: '20071103T131805' + TimeInstant: '20071103T131805', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -217,8 +218,7 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasure.json')) - .reply(200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should send its values to the Context Broker', function(done) { mqttClient.publish('/1234/MQTT_2/attrs/temperature', '87', null, function(error) { diff --git a/test/unit/amqpBinding-test.js b/test/unit/amqpBinding-test.js index 4cee5a36..8fa095e1 100644 --- a/test/unit/amqpBinding-test.js +++ b/test/unit/amqpBinding-test.js @@ -39,16 +39,19 @@ var iotagentMqtt = require('../../'), channel; function startConnection(exchange, callback) { - amqp.connect('amqp://localhost', function(err, conn) { - amqpConn = conn; + amqp.connect( + 'amqp://localhost', + function(err, conn) { + amqpConn = conn; - conn.createChannel(function(err, ch) { - ch.assertExchange(exchange, 'topic', {}); + conn.createChannel(function(err, ch) { + ch.assertExchange(exchange, 'topic', {}); - channel = ch; - callback(err); - }); - }); + channel = ch; + callback(err); + }); + } + ); } describe('AMQP Transport binding: measures', function() { @@ -59,8 +62,8 @@ describe('AMQP Transport binding: measures', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceAMQP1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -74,11 +77,14 @@ describe('AMQP Transport binding: measures', function() { .post('/v1/updateContext') .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); - async.series([ - apply(iotagentMqtt.start, config), - apply(request, provisionOptions), - apply(startConnection, config.amqp.exchange) - ], done); + async.series( + [ + apply(iotagentMqtt.start, config), + apply(request, provisionOptions), + apply(startConnection, config.amqp.exchange), + ], + done + ); }); afterEach(function(done) { @@ -87,10 +93,7 @@ describe('AMQP Transport binding: measures', function() { amqpConn.close(); config.iota.defaultResource = oldResource; - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a new single measure arrives to a Device routing key', function() { @@ -119,8 +122,8 @@ describe('AMQP Transport binding: measures', function() { json: utils.readExampleFile('./test/groupProvisioning/provisionFullGroupAMQP.json'), headers: { 'fiware-service': 'TestService', - 'fiware-servicepath': '/testingPath' - } + 'fiware-servicepath': '/testingPath', + }, }; beforeEach(function(done) { @@ -130,7 +133,6 @@ describe('AMQP Transport binding: measures', function() { .post('/v1/updateContext') .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); - contextBrokerUnprovMock .matchHeader('fiware-service', 'TestService') .matchHeader('fiware-servicepath', '/testingPath') @@ -162,9 +164,7 @@ describe('AMQP Transport binding: measures', function() { }); it('should send a single update context request with all the attributes', function(done) { - channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer( - JSON.stringify({a: '23'}) - )); + channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer(JSON.stringify({ a: '23' }))); setTimeout(function() { contextBrokerMock.done(); @@ -201,12 +201,16 @@ describe('AMQP Transport binding: measures', function() { }); it('should send one update context per measure group to the Contet Broker', function(done) { - channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer( - JSON.stringify({ - a: '23', - b: '98' - }) - )); + channel.publish( + config.amqp.exchange, + '.1234.MQTT_2.attrs', + new Buffer( + JSON.stringify({ + a: '23', + b: '98', + }) + ) + ); setTimeout(function() { contextBrokerMock.done(); diff --git a/test/unit/attribute-alias_test.js b/test/unit/attribute-alias_test.js index 76498890..e69d826b 100644 --- a/test/unit/attribute-alias_test.js +++ b/test/unit/attribute-alias_test.js @@ -41,16 +41,19 @@ describe('Attribute alias', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice2.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') @@ -69,10 +72,7 @@ describe('Attribute alias', function() { nock.cleanAll(); mqttClient.end(); - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a new multiple measure arrives with a timestamp in an attribute alias', function() { @@ -87,7 +87,7 @@ describe('Attribute alias', function() { var values = { humidity: '32', temperature: '87', - tt: '20071103T131805' + tt: '20071103T131805', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { diff --git a/test/unit/bidirectionalityHttp-test.js b/test/unit/bidirectionalityHttp-test.js index 1e82d4e0..19ae78e0 100644 --- a/test/unit/bidirectionalityHttp-test.js +++ b/test/unit/bidirectionalityHttp-test.js @@ -40,8 +40,8 @@ describe('Data Bidirectionality: HTTP', function() { json: utils.readExampleFile('./test/subscriptions/bidirectionalNotification.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; afterEach(function(done) { @@ -60,8 +60,8 @@ describe('Data Bidirectionality: HTTP', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectional.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -69,26 +69,35 @@ describe('Data Bidirectionality: HTTP', function() { contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/subscribeContext', utils.readExampleFile( - './test//subscriptions/bidirectionalSubscriptionRequest.json')) - .reply(200, utils.readExampleFile( - './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json')); + .post( + '/v1/subscribeContext', + utils.readExampleFile('./test//subscriptions/bidirectionalSubscriptionRequest.json') + ) + .reply( + 200, + utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile( - './test/contextRequests/createBidirectionalDevice.json')) - .reply(200, utils.readExampleFile( - './test/contextResponses/createBidirectionalDeviceSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/createBidirectionalDevice.json') + ) + .reply(200, utils.readExampleFile('./test/contextResponses/createBidirectionalDeviceSuccess.json')); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/unsubscribeContext', utils.readExampleFile( - './test/subscriptions/simpleSubscriptionRemove.json')) - .reply(200, utils.readExampleFile( - './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json')); + .post( + '/v1/unsubscribeContext', + utils.readExampleFile('./test/subscriptions/simpleSubscriptionRemove.json') + ) + .reply( + 200, + utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') + ); iotagentJson.start(config, function(error) { request(provisionOptions, function(error, response, body) { @@ -123,15 +132,19 @@ describe('Data Bidirectionality: HTTP', function() { longitudeFound = false; for (var i = 0; i < list.commands.length; i++) { - if (list.commands[i].name === 'latitude' && + if ( + list.commands[i].name === 'latitude' && list.commands[i].type === 'string' && - list.commands[i].value === '-9.6') { + list.commands[i].value === '-9.6' + ) { latitudeFound = true; } - if (list.commands[i].name === 'longitude' && + if ( + list.commands[i].name === 'longitude' && list.commands[i].type === 'string' && - list.commands[i].value === '12.4') { + list.commands[i].value === '12.4' + ) { longitudeFound = true; } } @@ -153,8 +166,8 @@ describe('Data Bidirectionality: HTTP', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -162,26 +175,35 @@ describe('Data Bidirectionality: HTTP', function() { contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/subscribeContext', utils.readExampleFile( - './test//subscriptions/bidirectionalSubscriptionRequest.json')) - .reply(200, utils.readExampleFile( - './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json')); + .post( + '/v1/subscribeContext', + utils.readExampleFile('./test//subscriptions/bidirectionalSubscriptionRequest.json') + ) + .reply( + 200, + utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile( - './test/contextRequests/createBidirectionalDevice.json')) - .reply(200, utils.readExampleFile( - './test/contextResponses/createBidirectionalDeviceSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/createBidirectionalDevice.json') + ) + .reply(200, utils.readExampleFile('./test/contextResponses/createBidirectionalDeviceSuccess.json')); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/unsubscribeContext', utils.readExampleFile( - './test/subscriptions/simpleSubscriptionRemove.json')) - .reply(200, utils.readExampleFile( - './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json')); + .post( + '/v1/unsubscribeContext', + utils.readExampleFile('./test/subscriptions/simpleSubscriptionRemove.json') + ) + .reply( + 200, + utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') + ); mockedClientServer = nock('http://localhost:9876') .post('/command', '{"location":"12.4, -9.6"}') diff --git a/test/unit/commandsAmqp-test.js b/test/unit/commandsAmqp-test.js index 95499f3f..bae5dab2 100644 --- a/test/unit/commandsAmqp-test.js +++ b/test/unit/commandsAmqp-test.js @@ -39,16 +39,19 @@ var iotagentMqtt = require('../../'), channel; function startConnection(exchange, callback) { - amqp.connect('amqp://localhost', function(err, conn) { - amqpConn = conn; + amqp.connect( + 'amqp://localhost', + function(err, conn) { + amqpConn = conn; - conn.createChannel(function(err, ch) { - ch.assertExchange(exchange, 'topic', {}); + conn.createChannel(function(err, ch) { + ch.assertExchange(exchange, 'topic', {}); - channel = ch; - callback(err); - }); - }); + channel = ch; + callback(err); + }); + } + ); } describe('AMQP Transport binding: commands', function() { @@ -59,8 +62,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommand5.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; config.logLevel = 'INFO'; @@ -71,8 +74,7 @@ describe('AMQP Transport binding: commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, - utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -83,11 +85,14 @@ describe('AMQP Transport binding: commands', function() { oldTransport = config.defaultTransport; config.defaultTransport = 'AMQP'; - async.series([ - apply(iotagentMqtt.start, config), - apply(request, provisionOptions), - apply(startConnection, config.amqp.exchange) - ], done); + async.series( + [ + apply(iotagentMqtt.start, config), + apply(request, provisionOptions), + apply(startConnection, config.amqp.exchange), + ], + done + ); }); afterEach(function(done) { @@ -97,10 +102,7 @@ describe('AMQP Transport binding: commands', function() { config.defaultTransport = oldTransport; - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a command arrive to the Agent for a device with the AMQP protocol', function() { @@ -110,8 +112,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; beforeEach(function() { @@ -147,12 +149,16 @@ describe('AMQP Transport binding: commands', function() { channel.assertExchange(config.amqp.exchange, 'topic', config.amqp.options); - channel.assertQueue('client-queue', {exclusive: false}, function(err, q) { + channel.assertQueue('client-queue', { exclusive: false }, function(err, q) { channel.bindQueue(q.queue, config.amqp.exchange, '.' + config.defaultKey + '.MQTT_2.cmd'); - channel.consume(q.queue, function(msg) { - payload = msg.content.toString(); - }, {noAck: true}); + channel.consume( + q.queue, + function(msg) { + payload = msg.content.toString(); + }, + { noAck: true } + ); request(commandOptions, function(error, response, body) { setTimeout(function() { @@ -176,8 +182,7 @@ describe('AMQP Transport binding: commands', function() { it('should send an update request to the Context Broker', function(done) { channel.assertExchange(config.amqp.exchange, 'topic', config.amqp.options); - channel.publish( - config.amqp.exchange, '.1234.MQTT_2.cmdexe', new Buffer('{"PING":"1234567890"}')); + channel.publish(config.amqp.exchange, '.1234.MQTT_2.cmdexe', new Buffer('{"PING":"1234567890"}')); setTimeout(function() { contextBrokerMock.done(); @@ -193,8 +198,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommand6.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, configurationOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -202,8 +207,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionGroup1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, commandOptions = { url: 'http://localhost:' + config.iota.server.port + '/v1/updateContext', @@ -211,8 +216,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand3.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; beforeEach(function(done) { @@ -222,8 +227,7 @@ describe('AMQP Transport binding: commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, - utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -250,12 +254,16 @@ describe('AMQP Transport binding: commands', function() { channel.assertExchange(config.amqp.exchange, 'topic', config.amqp.options); - channel.assertQueue('client-queue', {exclusive: false}, function(err, q) { + channel.assertQueue('client-queue', { exclusive: false }, function(err, q) { channel.bindQueue(q.queue, config.amqp.exchange, '.ALTERNATIVE.MQTT_4.cmd'); - channel.consume(q.queue, function(msg) { - payload = msg.content.toString(); - }, {noAck: true}); + channel.consume( + q.queue, + function(msg) { + payload = msg.content.toString(); + }, + { noAck: true } + ); request(commandOptions, function(error, response, body) { setTimeout(function() { diff --git a/test/unit/commandsPolling-test.js b/test/unit/commandsPolling-test.js index f7521225..e31570ff 100644 --- a/test/unit/commandsPolling-test.js +++ b/test/unit/commandsPolling-test.js @@ -40,8 +40,8 @@ describe('HTTP Transport binding: polling commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; beforeEach(function(done) { @@ -51,8 +51,8 @@ describe('HTTP Transport binding: polling commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommand4.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -61,8 +61,7 @@ describe('HTTP Transport binding: polling commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, - utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -121,13 +120,13 @@ describe('HTTP Transport binding: polling commands', function() { url: 'http://localhost:' + config.http.port + '/iot/json', method: 'POST', json: { - a: 23 + a: 23, }, qs: { i: 'MQTT_2', k: '1234', - getCmd: 1 - } + getCmd: 1, + }, }; beforeEach(function(done) { @@ -177,19 +176,18 @@ describe('HTTP Transport binding: polling commands', function() { }); }); - describe('When a device asks for the pending commands without body', function() { var deviceRequest = { url: 'http://localhost:' + config.http.port + '/iot/json', method: 'POST', json: { - a: 23 + a: 23, }, qs: { i: 'MQTT_2', k: '1234', - getCmd: 1 - } + getCmd: 1, + }, }; var deviceRequestWithoutPayload = { @@ -199,8 +197,8 @@ describe('HTTP Transport binding: polling commands', function() { qs: { i: 'MQTT_2', k: '1234', - getCmd: 1 - } + getCmd: 1, + }, }; beforeEach(function(done) { @@ -259,12 +257,12 @@ describe('HTTP Transport binding: polling commands', function() { uri: 'http://localhost:' + config.http.port + '/iot/json/commands', method: 'POST', json: { - PING: 'MADE_OK' + PING: 'MADE_OK', }, qs: { i: 'MQTT_2', - k: '1234' - } + k: '1234', + }, }; beforeEach(function(done) { diff --git a/test/unit/configuration-api_test.js b/test/unit/configuration-api_test.js index 55fdc1ff..eb13127e 100644 --- a/test/unit/configuration-api_test.js +++ b/test/unit/configuration-api_test.js @@ -45,8 +45,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, configurationOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -54,8 +54,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionConfiguration1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, configurationOptionsWithResource = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -63,37 +63,39 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionConfiguration2.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; - beforeEach(function(done) { nock.cleanAll(); originalResource = config.iota.defaultResource; - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); config.iota.iotManager = { host: '127.0.0.1', port: 8081, path: '/iot/protocols', protocol: 'TT_MQTT-JSON', - description: 'MQTT-JSON protocol for TT' + description: 'MQTT-JSON protocol for TT', }; config.iota.defaultResource = '/iotamqtt'; iotamMock = nock('http://127.0.0.1:8081') .post('/iot/protocols', { - protocol: 'TT_MQTT-JSON', - description: 'MQTT-JSON protocol for TT', - iotagent: 'http://localhost:4041', - resource: '/iotamqtt', - services: [] - }) + protocol: 'TT_MQTT-JSON', + description: 'MQTT-JSON protocol for TT', + iotagent: 'http://localhost:4041', + resource: '/iotamqtt', + services: [], + }) .reply(200, {}); contextBrokerMock = nock('http://192.168.1.1:1026') @@ -117,7 +119,8 @@ describe('Configuration API support', function() { describe('When a configuration is provisioned for a service', function() { beforeEach(function() { - iotamMock.post('/iot/protocols', { + iotamMock + .post('/iot/protocols', { protocol: 'TT_MQTT-JSON', description: 'MQTT-JSON protocol for TT', iotagent: 'http://localhost:4041', @@ -130,9 +133,9 @@ describe('Configuration API support', function() { entity_type: 'Light', resource: '', service: 'smartGondor', - service_path: '/gardens' - } - ] + service_path: '/gardens', + }, + ], }) .reply(200, {}); @@ -140,8 +143,7 @@ describe('Configuration API support', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasure.json')) - .reply(200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should use the API Key of that configuration in device topics', function(done) { @@ -175,15 +177,12 @@ describe('Configuration API support', function() { cbHost: 'http://unexistentHost:1026', resource: '/AnotherValue', service: 'smartGondor', - service_path: '/gardens' - } - ] + service_path: '/gardens', + }, + ], }; - iotamMock - .post('/iot/protocols', configurationProvision) - .reply(200, {}); - + iotamMock.post('/iot/protocols', configurationProvision).reply(200, {}); }); it('should reject the configuration provisioning with a BAD FORMAT error', function(done) { diff --git a/test/unit/ngsiv2/HTTP_reveice_measures-test.js b/test/unit/ngsiv2/HTTP_reveice_measures-test.js index 8fa35e7a..69f0db05 100644 --- a/test/unit/ngsiv2/HTTP_reveice_measures-test.js +++ b/test/unit/ngsiv2/HTTP_reveice_measures-test.js @@ -51,17 +51,17 @@ var iotaJson = require('../../../'), attributes: [ { name: 'status', - type: 'Boolean' - } + type: 'Boolean', + }, ], - static_attributes: [] - } - ] + static_attributes: [], + }, + ], }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, contextBrokerMock, contextBrokerUnprovMock; @@ -74,8 +74,8 @@ describe('HTTP: Measure reception ', function() { json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDeviceHTTP.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -99,10 +99,7 @@ describe('HTTP: Measure reception ', function() { afterEach(function(done) { nock.cleanAll(); - async.series([ - iotAgentLib.clearAll, - iotaJson.stop - ], done); + async.series([iotAgentLib.clearAll, iotaJson.stop], done); }); describe('When a POST measure arrives for the HTTP binding', function() { @@ -114,27 +111,29 @@ describe('HTTP: Measure reception ', function() { temperature: '87', luminosity: 10, pollution: 43.4, - configuration: {firmware: {version: '1.1.0', hash: 'cf23df2207d99a74fbe169e3eba035e633b65d94'}}, + configuration: { firmware: { version: '1.1.0', hash: 'cf23df2207d99a74fbe169e3eba035e633b65d94' } }, tags: ['iot', 'device'], enabled: true, - alive: null + alive: null, }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'MQTT_2', - k: '1234' - } + k: '1234', + }, }; beforeEach(function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json') + ) .reply(204); }); it('should return a 200 OK with no error', function(done) { @@ -151,7 +150,6 @@ describe('HTTP: Measure reception ', function() { done(); }); }); - }); describe('When a POST measure arrives with a TimeInstant attribute in the body', function() { @@ -160,16 +158,16 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '111222', - TimeInstant: '20200222T222222' + TimeInstant: '20200222T222222', }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'dev0130101', - k: '1234' - } + k: '1234', + }, }, provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', @@ -177,9 +175,9 @@ describe('HTTP: Measure reception ', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } - }; + 'fiware-servicepath': '/gardens', + }, + }; beforeEach(function(done) { nock.cleanAll(); @@ -195,8 +193,10 @@ describe('HTTP: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/e0130101/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timeInstantMeasures.json')) + .post( + '/v2/entities/e0130101/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timeInstantMeasures.json') + ) .reply(204); iotaJson.stop(function() { @@ -228,17 +228,17 @@ describe('HTTP: Measure reception ', function() { url: 'http://localhost:' + config.http.port + '/iot/json', method: 'POST', json: { - humidity: '111222' + humidity: '111222', }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'dev0130101', k: '1234', - t: '20200222T222222' - } + t: '20200222T222222', + }, }, provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', @@ -246,8 +246,8 @@ describe('HTTP: Measure reception ', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; beforeEach(function(done) { @@ -264,8 +264,10 @@ describe('HTTP: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/e0130101/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timeInstantMeasures.json')) + .post( + '/v2/entities/e0130101/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timeInstantMeasures.json') + ) .reply(204); iotaJson.stop(function() { @@ -298,16 +300,16 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '32', - temperature: '87' + temperature: '87', }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' + 'fiware-servicepath': '/gardens', }, qs: { i: 'JSON_UNPROVISIONED', - k: 'KL223HHV8732SFL1' - } + k: 'KL223HHV8732SFL1', + }, }; // This mock does not check the payload since the aim of the test is not to verify // device provisioning functionality. Appropriate verification is done in tests under @@ -322,8 +324,10 @@ describe('HTTP: Measure reception ', function() { contextBrokerUnprovMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/TheLightType:JSON_UNPROVISIONED/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedDevice.json')) + .post( + '/v2/entities/TheLightType:JSON_UNPROVISIONED/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedDevice.json') + ) .reply(204); request(groupCreation, function(error, response, body) { @@ -338,8 +342,4 @@ describe('HTTP: Measure reception ', function() { }); }); }); - - }); - - diff --git a/test/unit/ngsiv2/MQTT_receive_measures-test.js b/test/unit/ngsiv2/MQTT_receive_measures-test.js index 3759172b..c33300b9 100644 --- a/test/unit/ngsiv2/MQTT_receive_measures-test.js +++ b/test/unit/ngsiv2/MQTT_receive_measures-test.js @@ -51,17 +51,17 @@ var iotaJson = require('../../../'), attributes: [ { name: 'status', - type: 'Boolean' - } + type: 'Boolean', + }, ], - static_attributes: [] - } - ] + static_attributes: [], + }, + ], }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, contextBrokerMock, contextBrokerUnprovMock, @@ -75,16 +75,19 @@ describe('MQTT: Measure reception ', function() { json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); // This mock does not check the payload since the aim of the test is not to verify // device provisioning functionality. Appropriate verification is done in tests under @@ -106,10 +109,7 @@ describe('MQTT: Measure reception ', function() { nock.cleanAll(); mqttClient.end(); - async.series([ - iotAgentLib.clearAll, - iotaJson.stop - ], done); + async.series([iotAgentLib.clearAll, iotaJson.stop], done); }); describe('When a new multiple measure arrives to the MQTT Topic', function() { @@ -117,8 +117,10 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { @@ -127,10 +129,10 @@ describe('MQTT: Measure reception ', function() { temperature: '87', luminosity: 10, pollution: 43.4, - configuration: {firmware: {version: '1.1.0', hash: 'cf23df2207d99a74fbe169e3eba035e633b65d94'}}, + configuration: { firmware: { version: '1.1.0', hash: 'cf23df2207d99a74fbe169e3eba035e633b65d94' } }, tags: ['iot', 'device'], enabled: true, - alive: null + alive: null, }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -144,7 +146,6 @@ describe('MQTT: Measure reception ', function() { describe('When a new multiple measure arrives for an unprovisioned device', function() { beforeEach(function(done) { - // This mock does not check the payload since the aim of the test is not to verify // device provisioning functionality. Appropriate verification is done in tests under // provisioning folder of iotagent-node-lib @@ -157,8 +158,10 @@ describe('MQTT: Measure reception ', function() { contextBrokerUnprovMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/TheLightType:JSON_UNPROVISIONED/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedDevice.json')) + .post( + '/v2/entities/TheLightType:JSON_UNPROVISIONED/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedDevice.json') + ) .reply(204); request(groupCreation, function(error, response, body) { @@ -168,16 +171,17 @@ describe('MQTT: Measure reception ', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - temperature: '87' + temperature: '87', }; - mqttClient.publish('/KL223HHV8732SFL1/JSON_UNPROVISIONED/attrs', JSON.stringify(values), null, - function(error) { - setTimeout(function() { - contextBrokerUnprovMock.done(); - done(); - }, 100); - }); + mqttClient.publish('/KL223HHV8732SFL1/JSON_UNPROVISIONED/attrs', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + contextBrokerUnprovMock.done(); + done(); + }, 100); + }); }); }); @@ -186,14 +190,16 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unknownMeasures.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unknownMeasures.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - weight: '87' + weight: '87', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -210,15 +216,17 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timestampMeasure.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timestampMeasure.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', temperature: '87', - TimeInstant: '20071103T131805' + TimeInstant: '20071103T131805', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -235,8 +243,10 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasure.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasure.json') + ) .reply(204); }); it('should send its values to the Context Broker', function(done) { diff --git a/test/unit/ngsiv2/amqpBinding-test.js b/test/unit/ngsiv2/amqpBinding-test.js index 43fa768b..a79f300b 100644 --- a/test/unit/ngsiv2/amqpBinding-test.js +++ b/test/unit/ngsiv2/amqpBinding-test.js @@ -41,16 +41,19 @@ var iotaJson = require('../../../'), channel; function startConnection(exchange, callback) { - amqp.connect('amqp://localhost', function(err, conn) { - amqpConn = conn; + amqp.connect( + 'amqp://localhost', + function(err, conn) { + amqpConn = conn; - conn.createChannel(function(err, ch) { - ch.assertExchange(exchange, 'topic', {}); + conn.createChannel(function(err, ch) { + ch.assertExchange(exchange, 'topic', {}); - channel = ch; - callback(err); - }); - }); + channel = ch; + callback(err); + }); + } + ); } describe('AMQP Transport binding: measures', function() { @@ -61,8 +64,8 @@ describe('AMQP Transport binding: measures', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceAMQP1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -79,11 +82,14 @@ describe('AMQP Transport binding: measures', function() { .post('/v2/entities?options=upsert') .reply(204); - async.series([ - apply(iotaJson.start, config), - apply(request, provisionOptions), - apply(startConnection, config.amqp.exchange) - ], done); + async.series( + [ + apply(iotaJson.start, config), + apply(request, provisionOptions), + apply(startConnection, config.amqp.exchange), + ], + done + ); }); afterEach(function(done) { @@ -92,10 +98,7 @@ describe('AMQP Transport binding: measures', function() { amqpConn.close(); config.iota.defaultResource = oldResource; - async.series([ - iotAgentLib.clearAll, - iotaJson.stop - ], done); + async.series([iotAgentLib.clearAll, iotaJson.stop], done); }); describe('When a new single measure arrives to a Device routing key', function() { @@ -103,8 +106,10 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') + ) .reply(204); }); @@ -125,12 +130,11 @@ describe('AMQP Transport binding: measures', function() { json: utils.readExampleFile('./test/groupProvisioning/provisionFullGroupAMQP.json'), headers: { 'fiware-service': 'TestService', - 'fiware-servicepath': '/testingPath' - } + 'fiware-servicepath': '/testingPath', + }, }; beforeEach(function(done) { - // This mock does not check the payload since the aim of the test is not to verify // device provisioning functionality. Appropriate verification is done in tests under // provisioning folder of iotagent-node-lib @@ -143,8 +147,10 @@ describe('AMQP Transport binding: measures', function() { contextBrokerUnprovMock .matchHeader('fiware-service', 'TestService') .matchHeader('fiware-servicepath', '/testingPath') - .post('/v2/entities/SensorMachine:JSON_UNPROVISIONED/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedMeasure.json')) + .post( + '/v2/entities/SensorMachine:JSON_UNPROVISIONED/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedMeasure.json') + ) .reply(204); request(groupCreation, function(error, response, body) { @@ -167,15 +173,15 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') + ) .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should send a single update context request with all the attributes', function(done) { - channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer( - JSON.stringify({a: '23'}) - )); + channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer(JSON.stringify({ a: '23' }))); setTimeout(function() { contextBrokerMock.done(); @@ -189,8 +195,10 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') + ) .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); @@ -208,18 +216,24 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasure.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasure.json') + ) .reply(204); }); it('should send one update context per measure group to the Contet Broker', function(done) { - channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer( - JSON.stringify({ - a: '23', - b: '98' - }) - )); + channel.publish( + config.amqp.exchange, + '.1234.MQTT_2.attrs', + new Buffer( + JSON.stringify({ + a: '23', + b: '98', + }) + ) + ); setTimeout(function() { contextBrokerMock.done(); diff --git a/test/unit/ngsiv2/attribute-alias_test.js b/test/unit/ngsiv2/attribute-alias_test.js index 5627d859..a667b9e3 100644 --- a/test/unit/ngsiv2/attribute-alias_test.js +++ b/test/unit/ngsiv2/attribute-alias_test.js @@ -43,16 +43,19 @@ describe('Attribute alias', function() { json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDevice2.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); // This mock does not check the payload since the aim of the test is not to verify // device provisioning functionality. Appropriate verification is done in tests under @@ -74,10 +77,7 @@ describe('Attribute alias', function() { nock.cleanAll(); mqttClient.end(); - async.series([ - iotAgentLib.clearAll, - iotaJson.stop - ], done); + async.series([iotAgentLib.clearAll, iotaJson.stop], done); }); describe('When a new multiple measure arrives with a timestamp in an attribute alias', function() { @@ -85,15 +85,17 @@ describe('Attribute alias', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timestampAliasMeasure.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timestampAliasMeasure.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', temperature: '87', - tt: '20071103T131805' + tt: '20071103T131805', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { diff --git a/test/unit/ngsiv2/bidirectionalityHttp-test.js b/test/unit/ngsiv2/bidirectionalityHttp-test.js index eacf6249..bd4bf006 100644 --- a/test/unit/ngsiv2/bidirectionalityHttp-test.js +++ b/test/unit/ngsiv2/bidirectionalityHttp-test.js @@ -43,8 +43,8 @@ describe('Data Bidirectionality: HTTP', function() { json: utils.readExampleFile('./test/unit/ngsiv2/subscriptions/bidirectionalNotification.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; afterEach(function(done) { @@ -63,8 +63,8 @@ describe('Data Bidirectionality: HTTP', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectional.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -73,18 +73,15 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v2/subscriptions', function(body) { - var expectedBody = utils.readExampleFile( - './test/unit/ngsiv2/subscriptions/bidirectionalSubscriptionRequest.json'); + './test/unit/ngsiv2/subscriptions/bidirectionalSubscriptionRequest.json' + ); // Note that expired field is not included in the json used by this mock as it is a dynamic // field. The following code performs such calculation and adds the field to the subscription // payload of the mock. - if (!body.expires) - { + if (!body.expires) { return false; - } - else if (moment(body.expires, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isValid()) - { + } else if (moment(body.expires, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isValid()) { expectedBody.expires = moment().add(config.deviceRegistrationDuration); var expiresDiff = moment(expectedBody.expires).diff(body.expires, 'milliseconds'); if (expiresDiff < 500) { @@ -95,21 +92,21 @@ describe('Data Bidirectionality: HTTP', function() { } return false; - } - else { + } else { return false; } }) - .reply(201, null, {'Location': '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8'}); + .reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' }); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities?options=upsert', utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json')) + .post( + '/v2/entities?options=upsert', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json') + ) .reply(204); - iotagentJson.start(config, function(error) { request(provisionOptions, function(error, response, body) { done(); @@ -143,15 +140,19 @@ describe('Data Bidirectionality: HTTP', function() { longitudeFound = false; for (var i = 0; i < list.commands.length; i++) { - if (list.commands[i].name === 'latitude' && + if ( + list.commands[i].name === 'latitude' && list.commands[i].type === 'string' && - list.commands[i].value === '-9.6') { + list.commands[i].value === '-9.6' + ) { latitudeFound = true; } - if (list.commands[i].name === 'longitude' && + if ( + list.commands[i].name === 'longitude' && list.commands[i].type === 'string' && - list.commands[i].value === '12.4') { + list.commands[i].value === '12.4' + ) { longitudeFound = true; } } @@ -173,8 +174,8 @@ describe('Data Bidirectionality: HTTP', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); @@ -183,18 +184,15 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v2/subscriptions', function(body) { - var expectedBody = utils.readExampleFile( - './test/unit/ngsiv2/subscriptions/bidirectionalSubscriptionRequest.json'); + './test/unit/ngsiv2/subscriptions/bidirectionalSubscriptionRequest.json' + ); // Note that expired field is not included in the json used by this mock as it is a dynamic // field. The following code performs such calculation and adds the field to the subscription // payload of the mock. - if (!body.expires) - { + if (!body.expires) { return false; - } - else if (moment(body.expires, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isValid()) - { + } else if (moment(body.expires, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isValid()) { expectedBody.expires = moment().add(config.deviceRegistrationDuration); var expiresDiff = moment(expectedBody.expires).diff(body.expires, 'milliseconds'); if (expiresDiff < 500) { @@ -205,18 +203,19 @@ describe('Data Bidirectionality: HTTP', function() { } return false; - } - else { + } else { return false; } }) - .reply(201, null, {'Location': '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8'}); + .reply(201, null, { Location: '/v2/subscriptions/51c0ac9ed714fb3b37d7d5a8' }); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities?options=upsert', utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json')) + .post( + '/v2/entities?options=upsert', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json') + ) .reply(204); contextBrokerMock diff --git a/test/unit/ngsiv2/config-test.js b/test/unit/ngsiv2/config-test.js index 68e77b97..64de0653 100644 --- a/test/unit/ngsiv2/config-test.js +++ b/test/unit/ngsiv2/config-test.js @@ -27,18 +27,18 @@ var config = {}; config.mqtt = { host: 'localhost', port: 1883, - thinkingThingsPlugin: true + thinkingThingsPlugin: true, }; config.http = { - port: 7896 + port: 7896, }; config.amqp = { port: 5672, exchange: 'amq.topic', queue: 'iota_queue', - options: {durable: true} + options: { durable: true }, }; config.iota = { @@ -46,13 +46,13 @@ config.iota = { contextBroker: { host: '192.168.1.1', port: '1026', - ngsiVersion: 'v2' + ngsiVersion: 'v2', }, server: { - port: 4041 + port: 4041, }, deviceRegistry: { - type: 'memory' + type: 'memory', }, types: {}, service: 'howtoService', @@ -61,7 +61,7 @@ config.iota = { deviceRegistrationDuration: 'P1M', defaultType: 'Thing', defaultResource: '/iot/json', - compressTimestamp: true + compressTimestamp: true, }; config.defaultKey = '1234'; diff --git a/test/unit/ngsiv2/configuration-api_test.js b/test/unit/ngsiv2/configuration-api_test.js index b06b7dbb..3d00cdb1 100644 --- a/test/unit/ngsiv2/configuration-api_test.js +++ b/test/unit/ngsiv2/configuration-api_test.js @@ -47,8 +47,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, configurationOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -56,8 +56,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionConfiguration1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }, configurationOptionsWithResource = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -65,37 +65,39 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionConfiguration2.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; - beforeEach(function(done) { nock.cleanAll(); originalResource = config.iota.defaultResource; - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); config.iota.iotManager = { host: '127.0.0.1', port: 8081, path: '/iot/protocols', protocol: 'TT_MQTT-JSON', - description: 'MQTT-JSON protocol for TT' + description: 'MQTT-JSON protocol for TT', }; config.iota.defaultResource = '/iotamqtt'; iotamMock = nock('http://127.0.0.1:8081') .post('/iot/protocols', { - protocol: 'TT_MQTT-JSON', - description: 'MQTT-JSON protocol for TT', - iotagent: 'http://localhost:4041', - resource: '/iotamqtt', - services: [] - }) + protocol: 'TT_MQTT-JSON', + description: 'MQTT-JSON protocol for TT', + iotagent: 'http://localhost:4041', + resource: '/iotamqtt', + services: [], + }) .reply(200, {}); // This mock does not check the payload since the aim of the test is not to verify @@ -122,7 +124,8 @@ describe('Configuration API support', function() { describe('When a configuration is provisioned for a service', function() { beforeEach(function() { - iotamMock.post('/iot/protocols', { + iotamMock + .post('/iot/protocols', { protocol: 'TT_MQTT-JSON', description: 'MQTT-JSON protocol for TT', iotagent: 'http://localhost:4041', @@ -134,17 +137,19 @@ describe('Configuration API support', function() { entity_type: 'Light', resource: '', service: 'smartGondor', - service_path: '/gardens' - } - ] + service_path: '/gardens', + }, + ], }) .reply(200, {}); contextBrokerUnprovMock = nock('http://unexistentHost:1026') .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasure.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasure.json') + ) .reply(204); }); @@ -179,15 +184,12 @@ describe('Configuration API support', function() { cbHost: 'http://unexistentHost:1026', resource: '/AnotherValue', service: 'smartGondor', - service_path: '/gardens' - } - ] + service_path: '/gardens', + }, + ], }; - iotamMock - .post('/iot/protocols', configurationProvision) - .reply(200, {}); - + iotamMock.post('/iot/protocols', configurationProvision).reply(200, {}); }); it('should reject the configuration provisioning with a BAD FORMAT error', function(done) { diff --git a/test/unit/ngsiv2/subscription-management_test.js b/test/unit/ngsiv2/subscription-management_test.js index 6db70eae..9e31e245 100644 --- a/test/unit/ngsiv2/subscription-management_test.js +++ b/test/unit/ngsiv2/subscription-management_test.js @@ -43,15 +43,15 @@ describe('Subscription management', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; function sendMeasures(humidity, temperature) { return function(callback) { var values = { humidity: humidity, - temperature: temperature + temperature: temperature, }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -69,15 +69,18 @@ describe('Subscription management', function() { beforeEach(function(done) { nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); // This mock does not check the payload since the aim of the test is not to verify // device provisioning functionality. Appropriate verification is done in tests under // provisioning folder of iotagent-node-lib - contextBrokerMock = nock('http://192.168.1.1:1026', {allowUnmocked: false}) + contextBrokerMock = nock('http://192.168.1.1:1026', { allowUnmocked: false }) .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v2/entities?options=upsert') @@ -99,31 +102,38 @@ describe('Subscription management', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasures.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasures.json') + ) .reply(204); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/alternativeUpdate.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/alternativeUpdate.json') + ) .reply(204); }); it('should cease sending measures to the CB', function(done) { - async.series([ - async.apply(request, provisionOptions), - sendMeasures('32', '87'), - waitForMqttRelay(50), - iotaJson.stop, - sendMeasures('53', '1'), - waitForMqttRelay(50) - ], function(error, results) { - should.not.exist(error); - contextBrokerMock.isDone().should.equal(false); - done(); - }); + async.series( + [ + async.apply(request, provisionOptions), + sendMeasures('32', '87'), + waitForMqttRelay(50), + iotaJson.stop, + sendMeasures('53', '1'), + waitForMqttRelay(50), + ], + function(error, results) { + should.not.exist(error); + contextBrokerMock.isDone().should.equal(false); + done(); + } + ); }); }); @@ -132,40 +142,44 @@ describe('Subscription management', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasures.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasures.json') + ) .reply(204); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/alternativeUpdate.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/alternativeUpdate.json') + ) .reply(204); }); afterEach(function(done) { - async.series([ - iotAgentLib.clearAll, - iotaJson.stop - ], done); + async.series([iotAgentLib.clearAll, iotaJson.stop], done); }); it('should resume sending measures for the provisioned devices', function(done) { - async.series([ - async.apply(request, provisionOptions), - sendMeasures('32', '87'), - waitForMqttRelay(50), - iotaJson.stop, - async.apply(iotaJson.start, config), - waitForMqttRelay(50), - sendMeasures('53', '1'), - waitForMqttRelay(50) - ], function(error, results) { - should.not.exist(error); - contextBrokerMock.isDone().should.equal(true); - done(); - }); + async.series( + [ + async.apply(request, provisionOptions), + sendMeasures('32', '87'), + waitForMqttRelay(50), + iotaJson.stop, + async.apply(iotaJson.start, config), + waitForMqttRelay(50), + sendMeasures('53', '1'), + waitForMqttRelay(50), + ], + function(error, results) { + should.not.exist(error); + contextBrokerMock.isDone().should.equal(true); + done(); + } + ); }); }); }); diff --git a/test/unit/ngsiv2/supportThinkingThingModules_test.js b/test/unit/ngsiv2/supportThinkingThingModules_test.js index ebacbe55..a6f7bdc7 100644 --- a/test/unit/ngsiv2/supportThinkingThingModules_test.js +++ b/test/unit/ngsiv2/supportThinkingThingModules_test.js @@ -43,16 +43,19 @@ describe('Support for Thinking Things Modules', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); // This mock does not check the payload since the aim of the test is not to verify // device provisioning functionality. Appropriate verification is done in tests under @@ -73,11 +76,7 @@ describe('Support for Thinking Things Modules', function() { afterEach(function(done) { nock.cleanAll(); mqttClient.end(); - async.series([ - iotAgentLib.clearAll, - iotaJson.stop - ], done); - + async.series([iotAgentLib.clearAll, iotaJson.stop], done); }); describe('When a new measure with Thinking Thing module P1 arrives to a multiattribute topic', function() { @@ -85,14 +84,16 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleP1.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleP1.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - P1: '214,7,d22,b00,-64,' + P1: '214,7,d22,b00,-64,', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -109,8 +110,10 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleP1Single.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleP1Single.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { @@ -130,14 +133,16 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleC1.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleC1.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - C1: '00D600070d220b00' + C1: '00D600070d220b00', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -154,8 +159,10 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleC1Single.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleC1Single.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { @@ -175,14 +182,16 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleB.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleB.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - B: '4.70,1,1,1,1,0' + B: '4.70,1,1,1,1,0', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -199,14 +208,16 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleBLong.json')) + .post( + '/v2/entities/Second%20MQTT%20Device/attrs', + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleBLong.json') + ) .reply(204); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - B: '4.70,1,1,1,1,0,9,18' + B: '4.70,1,1,1,1,0,9,18', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -217,5 +228,4 @@ describe('Support for Thinking Things Modules', function() { }); }); }); - }); diff --git a/test/unit/subscription-management_test.js b/test/unit/subscription-management_test.js index 8ef1e56b..56cf43dd 100644 --- a/test/unit/subscription-management_test.js +++ b/test/unit/subscription-management_test.js @@ -41,15 +41,15 @@ describe('Subscription management', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; function sendMeasures(humidity, temperature) { return function(callback) { var values = { humidity: humidity, - temperature: temperature + temperature: temperature, }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -67,12 +67,15 @@ describe('Subscription management', function() { beforeEach(function(done) { nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); - contextBrokerMock = nock('http://192.168.1.1:1026', {allowUnmocked: false}) + contextBrokerMock = nock('http://192.168.1.1:1026', { allowUnmocked: false }) .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') @@ -105,18 +108,21 @@ describe('Subscription management', function() { }); it('should cease sending measures to the CB', function(done) { - async.series([ - async.apply(request, provisionOptions), - sendMeasures('32', '87'), - waitForMqttRelay(50), - iotagentMqtt.stop, - sendMeasures('53', '1'), - waitForMqttRelay(50) - ], function(error, results) { - should.not.exist(error); - contextBrokerMock.isDone().should.equal(false); - done(); - }); + async.series( + [ + async.apply(request, provisionOptions), + sendMeasures('32', '87'), + waitForMqttRelay(50), + iotagentMqtt.stop, + sendMeasures('53', '1'), + waitForMqttRelay(50), + ], + function(error, results) { + should.not.exist(error); + contextBrokerMock.isDone().should.equal(false); + done(); + } + ); }); }); @@ -136,27 +142,27 @@ describe('Subscription management', function() { }); afterEach(function(done) { - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); it('should resume sending measures for the provisioned devices', function(done) { - async.series([ - async.apply(request, provisionOptions), - sendMeasures('32', '87'), - waitForMqttRelay(50), - iotagentMqtt.stop, - async.apply(iotagentMqtt.start, config), - waitForMqttRelay(50), - sendMeasures('53', '1'), - waitForMqttRelay(50) - ], function(error, results) { - should.not.exist(error); - contextBrokerMock.isDone().should.equal(true); - done(); - }); + async.series( + [ + async.apply(request, provisionOptions), + sendMeasures('32', '87'), + waitForMqttRelay(50), + iotagentMqtt.stop, + async.apply(iotagentMqtt.start, config), + waitForMqttRelay(50), + sendMeasures('53', '1'), + waitForMqttRelay(50), + ], + function(error, results) { + should.not.exist(error); + contextBrokerMock.isDone().should.equal(true); + done(); + } + ); }); }); }); diff --git a/test/unit/supportThinkingThingModules_test.js b/test/unit/supportThinkingThingModules_test.js index 44f68eee..b16df5c9 100644 --- a/test/unit/supportThinkingThingModules_test.js +++ b/test/unit/supportThinkingThingModules_test.js @@ -41,16 +41,19 @@ describe('Support for Thinking Things Modules', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens' - } + 'fiware-servicepath': '/gardens', + }, }; nock.cleanAll(); - mqttClient = mqtt.connect('mqtt://' + config.mqtt.host, { - keepalive: 0, - connectTimeout: 60 * 60 * 1000 - }); + mqttClient = mqtt.connect( + 'mqtt://' + config.mqtt.host, + { + keepalive: 0, + connectTimeout: 60 * 60 * 1000, + } + ); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') @@ -68,11 +71,7 @@ describe('Support for Thinking Things Modules', function() { afterEach(function(done) { nock.cleanAll(); mqttClient.end(); - async.series([ - iotAgentLib.clearAll, - iotagentMqtt.stop - ], done); - + async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe('When a new measure with Thinking Thing module P1 arrives to a multiattribute topic', function() { @@ -86,7 +85,7 @@ describe('Support for Thinking Things Modules', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - P1: '214,7,d22,b00,-64,' + P1: '214,7,d22,b00,-64,', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -129,7 +128,7 @@ describe('Support for Thinking Things Modules', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - C1: '00D600070d220b00' + C1: '00D600070d220b00', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -172,7 +171,7 @@ describe('Support for Thinking Things Modules', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - B: '4.70,1,1,1,1,0' + B: '4.70,1,1,1,1,0', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -195,7 +194,7 @@ describe('Support for Thinking Things Modules', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - B: '4.70,1,1,1,1,0,9,18' + B: '4.70,1,1,1,1,0,9,18', }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { From d98de8e94fc719a14fd61e2ab31b6678315eda6e Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Thu, 31 Jan 2019 11:39:56 +0100 Subject: [PATCH 10/15] Expand maxlen for tests only --- lib/bindings/HTTPBinding.js | 14 +++++++------- test/.jshintrc | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/bindings/HTTPBinding.js b/lib/bindings/HTTPBinding.js index de8625c8..817d8d49 100644 --- a/lib/bindings/HTTPBinding.js +++ b/lib/bindings/HTTPBinding.js @@ -161,13 +161,13 @@ function handleIncomingMeasure(req, res, next) { function updateCommandHandler(error) { if (error) { next(error); - config - .getLogger() - .error( - context, - "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", - error - ); + config.getLogger().error( + context, + /*jshint quotmark: double */ + "MEASURES-002: Couldn't send the updated values to the Context Broker due to an error: %s", + /*jshint quotmark: single */ + error + ); } else { config .getLogger() diff --git a/test/.jshintrc b/test/.jshintrc index d4425445..e0b7d710 100644 --- a/test/.jshintrc +++ b/test/.jshintrc @@ -13,7 +13,7 @@ "maxparams": 6, "maxdepth": 4, "camelcase": true, - "maxlen": 120, + "maxlen": 180, "node": true, "expr": true, "unused": "vars", From 5c57098ff1065924d7186ecac4ca9f49fdf07f3f Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Fri, 1 Feb 2019 15:31:49 +0100 Subject: [PATCH 11/15] Re-running prettier with no trailing comma. --- .prettierrc.json | 4 +- bin/iotaJsonTester.js | 26 ++-- client-config.js | 6 +- config.js | 16 +- lib/bindings/AMQPBinding.js | 21 ++- lib/bindings/HTTPBinding.js | 85 +++++++--- lib/bindings/MQTTBinding.js | 24 ++- lib/commandHandler.js | 19 ++- lib/commonBindings.js | 51 ++++-- lib/configService.js | 6 +- lib/constants.js | 2 +- lib/errors.js | 15 +- lib/iotaUtils.js | 29 +++- lib/iotagent-json.js | 46 ++++-- lib/thinkingThingPlugin.js | 58 ++++--- lib/timestampProcessPlugin.js | 20 ++- lib/transportSelector.js | 16 +- test/config-startup.js | 14 +- test/config-test.js | 14 +- test/unit/HTTP_commands_test.js | 35 +++-- test/unit/HTTP_get-configuration_test.js | 51 ++++-- test/unit/HTTP_reveice_measures-test.js | 132 ++++++++++------ test/unit/MQTT_commands_test.js | 41 +++-- test/unit/MQTT_get-configuration_test.js | 146 +++++++++++------- test/unit/MQTT_receive_measures-test.js | 107 +++++++++---- test/unit/amqpBinding-test.js | 90 ++++++++--- test/unit/attribute-alias_test.js | 23 ++- test/unit/bidirectionalityHttp-test.js | 68 +++++--- test/unit/commandsAmqp-test.js | 83 +++++++--- test/unit/commandsPolling-test.js | 102 ++++++++---- test/unit/configuration-api_test.js | 49 +++--- .../unit/ngsiv2/HTTP_reveice_measures-test.js | 90 ++++++----- .../unit/ngsiv2/MQTT_receive_measures-test.js | 67 ++++---- test/unit/ngsiv2/amqpBinding-test.js | 56 +++++-- test/unit/ngsiv2/attribute-alias_test.js | 16 +- test/unit/ngsiv2/bidirectionalityHttp-test.js | 52 +++++-- test/unit/ngsiv2/config-test.js | 14 +- test/unit/ngsiv2/configuration-api_test.js | 34 ++-- .../ngsiv2/subscription-management_test.js | 28 ++-- .../supportThinkingThingModules_test.js | 22 +-- test/unit/subscription-management_test.js | 57 +++++-- test/unit/supportThinkingThingModules_test.js | 69 ++++++--- 42 files changed, 1293 insertions(+), 611 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 6bc2f8e4..e8ed7737 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,7 +3,7 @@ "bracketSpacing": true, "singleQuote": true, "parser": "flow", - "printWidth": 120, - "trailingComma": "es5", + "printWidth": 100, + "trailingComma": "none", "tabWidth": 4 } \ No newline at end of file diff --git a/bin/iotaJsonTester.js b/bin/iotaJsonTester.js index e38e94eb..8ef4331d 100755 --- a/bin/iotaJsonTester.js +++ b/bin/iotaJsonTester.js @@ -37,20 +37,20 @@ var fs = require('fs'), host: 'localhost', port: 1026, service: 'tester', - subservice: '/test', + subservice: '/test' }, configIot = { host: 'localhost', port: 4041, name: 'default', service: 'tester', - subservice: '/test', + subservice: '/test' }, config = { host: defaultConfig.mqtt.host, port: defaultConfig.mqtt.port, apikey: defaultConfig.device.apikey, - deviceId: defaultConfig.device.id, + deviceId: defaultConfig.device.id }, separator = '\n\n\t', token; @@ -138,36 +138,38 @@ function exitClient() { var commands = { config: { parameters: ['host', 'port', 'apiKey', 'deviceId'], - description: '\tConfigure the client to emulate the selected device, connecting to the given host.', - handler: setConfig, + description: + '\tConfigure the client to emulate the selected device, connecting to the given host.', + handler: setConfig }, showConfig: { parameters: [], - description: '\tConfigure the client to emulate the selected device, connecting to the given host.', - handler: getConfig, + description: + '\tConfigure the client to emulate the selected device, connecting to the given host.', + handler: getConfig }, connect: { parameters: [], description: '\tConnect to the MQTT broker.', - handler: connect, + handler: connect }, singleMeasure: { parameters: ['attribute', 'value'], description: '\tSend the given value for the selected attribute to the MQTT broker.', - handler: checkConnection(singleMeasure), + handler: checkConnection(singleMeasure) }, multipleMeasure: { parameters: ['attributes'], description: '\tSend a collection of attributes to the MQTT broker, using JSON format. The "attributes"\n' + '\tstring should have the following syntax: name=value[;name=value]*', - handler: checkConnection(multipleMeasure), + handler: checkConnection(multipleMeasure) }, exit: { parameters: [], description: '\tExit the client', - handler: exitClient, - }, + handler: exitClient + } }; commands = _.extend(commands, commandLine.commands); diff --git a/client-config.js b/client-config.js index 639301d1..0b074f11 100644 --- a/client-config.js +++ b/client-config.js @@ -27,13 +27,13 @@ config.mqtt = { port: 1883, options: { keepalive: 0, - connectTimeout: 60 * 60 * 1000, - }, + connectTimeout: 60 * 60 * 1000 + } }; config.device = { id: 'myDeviceId', - apikey: '1234', + apikey: '1234' }; module.exports = config; diff --git a/config.js b/config.js index 3ad59862..9cbe0c68 100644 --- a/config.js +++ b/config.js @@ -50,7 +50,7 @@ config.mqtt = { * subscribed to that topic (i.e retain flag is set to false) the message is simply discarded by the broker. * The publisher can tell the broker to keep the last message on that topic by setting the retained message flag to true . */ - retain: false, + retain: false }; /** @@ -84,7 +84,7 @@ config.amqp = { /** * durable queue flag (default is false). */ - options: { durable: true }, + options: { durable: true } }; /** @@ -94,7 +94,7 @@ config.http = { /** * South Port where the Ultralight transport binding for HTTP will be listening for device requests. */ - port: 7896, + port: 7896 /** * HTTP Timeout for the http command endpoint (in miliseconds). */ @@ -123,7 +123,7 @@ config.iota = { /** * Port where the Context Broker is listening. */ - port: '1026', + port: '1026' }, /** * Configuration of the North Port of the IoT Agent. @@ -132,7 +132,7 @@ config.iota = { /** * Port where the IoT Agent will be listening for NGSI and Provisioning requests. */ - port: 4041, + port: 4041 }, /** * Defines the configuration for the Device Registry, where all the information about devices and configuration @@ -145,7 +145,7 @@ config.iota = { * from the 'mongodb' configuration property. */ deviceRegistry: { - type: 'mongodb', + type: 'mongodb' }, /** * Mongo DB configuration section. This section will only be used if the deviceRegistry property has the type @@ -165,7 +165,7 @@ config.iota = { /** * Name of the Mongo database that will be created to store IoT Agent data. */ - db: 'iotagentjson', + db: 'iotagentjson' }, /** * Types array for static configuration of services. Check documentation in the IoT Agent Library for Node.js for @@ -199,7 +199,7 @@ config.iota = { * Default resource of the IoT Agent. This value must be different for every IoT Agent connecting to the IoT * Manager. */ - defaultResource: '/iot/json', + defaultResource: '/iot/json' }; /** diff --git a/lib/bindings/AMQPBinding.js b/lib/bindings/AMQPBinding.js index f247662a..f54d3e8b 100644 --- a/lib/bindings/AMQPBinding.js +++ b/lib/bindings/AMQPBinding.js @@ -29,7 +29,7 @@ var config = require('../configService'), commons = require('./../commonBindings'), async = require('async'), context = { - op: 'IOTAJSON.AMQP.Binding', + op: 'IOTAJSON.AMQP.Binding' }, amqpConn, amqpChannel; @@ -53,7 +53,11 @@ function executeCommand(apiKey, device, serializedPayload, callback) { serializedPayload ); - amqpChannel.assertExchange(config.getConfig().amqp.exchange, 'topic', config.getConfig().amqp.options); + amqpChannel.assertExchange( + config.getConfig().amqp.exchange, + 'topic', + config.getConfig().amqp.options + ); amqpChannel.publish( config.getConfig().amqp.exchange, '.' + apiKey + '.' + device.id + '.cmd', @@ -203,12 +207,15 @@ function start(callback) { callback(); } - async.waterfall([createConnection, createChannel, assertExchange, assertQueue, createListener], function(error) { - if (error) { - config.getLogger().debug('AMQP error %j', error); + async.waterfall( + [createConnection, createChannel, assertExchange, assertQueue, createListener], + function(error) { + if (error) { + config.getLogger().debug('AMQP error %j', error); + } + callback(); } - callback(); - }); + ); } /** diff --git a/lib/bindings/HTTPBinding.js b/lib/bindings/HTTPBinding.js index 817d8d49..c7e0b11d 100644 --- a/lib/bindings/HTTPBinding.js +++ b/lib/bindings/HTTPBinding.js @@ -38,7 +38,7 @@ var iotAgentLib = require('iotagent-node-lib'), bodyParser = require('body-parser'), constants = require('../constants'), context = { - op: 'IOTASON.HTTP.Binding', + op: 'IOTASON.HTTP.Binding' }, config = require('../configService'), httpBindingServer, @@ -113,8 +113,8 @@ function executeCommand(apiKey, device, serializedPayload, callback) { body: serializedPayload, headers: { 'fiware-service': device.service, - 'fiware-servicepath': device.subservice, - }, + 'fiware-servicepath': device.subservice + } }; if (config.getConfig().http.timeout) { @@ -130,7 +130,15 @@ function executeCommand(apiKey, device, serializedPayload, callback) { try { parsedBody = JSON.parse(body); - process.nextTick(commandHandler.updateCommand.bind(null, apiKey, device.id, device, parsedBody)); + process.nextTick( + commandHandler.updateCommand.bind( + null, + apiKey, + device.id, + device, + parsedBody + ) + ); callback(); } catch (e) { @@ -156,7 +164,12 @@ function handleIncomingMeasure(req, res, next) { config .getLogger() - .debug(context, 'Processing multiple HTTP measures for device [%s] with apiKey [%s]', req.deviceId, req.apiKey); + .debug( + context, + 'Processing multiple HTTP measures for device [%s] with apiKey [%s]', + req.deviceId, + req.apiKey + ); function updateCommandHandler(error) { if (error) { @@ -210,7 +223,14 @@ function handleIncomingMeasure(req, res, next) { async.parallel(executions, updateCommandHandler); } else { if (values.length > 0) { - iotAgentLib.update(device.name, device.type, '', values, device, updateCommandHandler); + iotAgentLib.update( + device.name, + device.type, + '', + values, + device, + updateCommandHandler + ); } else { next(); } @@ -238,7 +258,8 @@ function handleIncomingMeasure(req, res, next) { function isCommand(req, res, next) { if ( req.path === - (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_COMMANDS_PATH + (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + + constants.HTTP_COMMANDS_PATH ) { req.isCommand = true; } @@ -266,8 +287,8 @@ function sendConfigurationToDevice(apiKey, deviceId, results, callback) { json: iotaUtils.createConfigurationNotification(results), headers: { 'fiware-service': device.service, - 'fiware-servicepath': device.subservice, - }, + 'fiware-servicepath': device.subservice + } }; request(resultRequest, handleDeviceResponse(innerCallback)); @@ -318,7 +339,7 @@ function handleError(error, req, res, next) { res.status(code).json({ name: error.name, - message: error.message, + message: error.message }); } @@ -365,7 +386,13 @@ function returnCommands(req, res, next) { } function cleanCommand(command) { - return apply(iotAgentLib.removeCommand, device.service, device.subservice, device.id, command.name); + return apply( + iotAgentLib.removeCommand, + device.service, + device.subservice, + device.id, + command.name + ); } updates = commandList.map(createCommandUpdate); @@ -412,11 +439,16 @@ function returnCommands(req, res, next) { } } if (req.query && req.query.getCmd === '1') { - iotAgentLib.commandQueue(req.device.service, req.device.subservice, req.deviceId, function(error, list) { + iotAgentLib.commandQueue(req.device.service, req.device.subservice, req.deviceId, function( + error, + list + ) { if (error || !list || list.count === 0) { res.status(200).send(''); } else { - res.status(200).send(JSON.stringify(list.commands.map(parseCommand).reduce(concatCommand, {}))); + res.status(200).send( + JSON.stringify(list.commands.map(parseCommand).reduce(concatCommand, {})) + ); process.nextTick(updateCommandStatus.bind(null, req.device, list.commands)); } @@ -432,18 +464,23 @@ function start(callback) { httpBindingServer = { server: null, app: express(), - router: express.Router(), + router: express.Router() }; if (!config.getConfig().http) { config .getLogger() - .fatal(context, 'GLOBAL-002: Configuration error. Configuration object [config.http] is missing'); + .fatal( + context, + 'GLOBAL-002: Configuration error. Configuration object [config.http] is missing' + ); callback(new errors.ConfigurationError('config.http')); return; } - config.getLogger().info(context, 'HTTP Binding listening on port [%s]', config.getConfig().http.port); + config + .getLogger() + .info(context, 'HTTP Binding listening on port [%s]', config.getConfig().http.port); httpBindingServer.app.set('port', config.getConfig().http.port); httpBindingServer.app.set('host', config.getConfig().http.host || '0.0.0.0'); @@ -468,7 +505,8 @@ function start(callback) { ); httpBindingServer.router.post( - (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_COMMANDS_PATH, + (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + + constants.HTTP_COMMANDS_PATH, bodyParser.json(), checkMandatoryParams(false), parseData, @@ -479,7 +517,8 @@ function start(callback) { ); httpBindingServer.router.post( - (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_CONFIGURATION_PATH, + (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + + constants.HTTP_CONFIGURATION_PATH, bodyParser.json(), checkMandatoryParams(false), parseData, @@ -491,7 +530,11 @@ function start(callback) { httpBindingServer.server = http.createServer(httpBindingServer.app); - httpBindingServer.server.listen(httpBindingServer.app.get('port'), httpBindingServer.app.get('host'), callback); + httpBindingServer.server.listen( + httpBindingServer.app.get('port'), + httpBindingServer.app.get('host'), + callback + ); } function stop(callback) { @@ -508,7 +551,9 @@ function stop(callback) { } function sendPushNotifications(device, values, callback) { - var executions = _.flatten(values.map(commandHandler.generateCommandExecution.bind(null, null, device))); + var executions = _.flatten( + values.map(commandHandler.generateCommandExecution.bind(null, null, device)) + ); async.series(executions, function(error) { callback(error); diff --git a/lib/bindings/MQTTBinding.js b/lib/bindings/MQTTBinding.js index 5107275e..e0270ed0 100644 --- a/lib/bindings/MQTTBinding.js +++ b/lib/bindings/MQTTBinding.js @@ -30,7 +30,7 @@ var iotAgentLib = require('iotagent-node-lib'), iotaUtils = require('../iotaUtils'), constants = require('../constants'), context = { - op: 'IOTAJSON.MQTT.Binding', + op: 'IOTAJSON.MQTT.Binding' }, mqttClient, config = require('../configService'); @@ -44,7 +44,9 @@ function generateTopics(callback) { config.getLogger().debug(context, 'Generating topics'); topics.push('/+/+/' + constants.MEASURES_SUFIX + '/+'); topics.push('/+/+/' + constants.MEASURES_SUFIX); - topics.push('/+/+/' + constants.CONFIGURATION_SUFIX + '/' + constants.CONFIGURATION_COMMAND_SUFIX); + topics.push( + '/+/+/' + constants.CONFIGURATION_SUFIX + '/' + constants.CONFIGURATION_COMMAND_SUFIX + ); topics.push('/+/+/' + constants.CONFIGURATION_COMMAND_UPDATE); callback(null, topics); @@ -62,11 +64,19 @@ function recreateSubscriptions(callback) { mqttClient.subscribe(topics, null, function(error) { if (error) { iotAgentLib.alarms.raise(constants.MQTTB_ALARM, error); - config.getLogger().error(context, 'GLOBAL-001: Error subscribing to topics: %s', error); + config + .getLogger() + .error(context, 'GLOBAL-001: Error subscribing to topics: %s', error); callback(error); } else { iotAgentLib.alarms.release(constants.MQTTB_ALARM); - config.getLogger().debug(context, 'Successfully subscribed to the following topics:\n%j\n', topics); + config + .getLogger() + .debug( + context, + 'Successfully subscribed to the following topics:\n%j\n', + topics + ); callback(null); } }); @@ -92,7 +102,9 @@ function sendConfigurationToDevice(apiKey, deviceId, results, callback) { if (config.getConfig().mqtt.retain === true) { options.retain = config.getConfig().mqtt.retain; } - config.getLogger().debug(context, 'Sending requested configuration to the device:\n %j', configurations); + config + .getLogger() + .debug(context, 'Sending requested configuration to the device:\n %j', configurations); mqttClient.publish( '/' + @@ -128,7 +140,7 @@ function unsubscribeAll(callback) { function start(callback) { var options = { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 }; if (config.getConfig().mqtt.username && config.getConfig().mqtt.password) { diff --git a/lib/commandHandler.js b/lib/commandHandler.js index c394bb4b..a98256b6 100644 --- a/lib/commandHandler.js +++ b/lib/commandHandler.js @@ -30,7 +30,7 @@ var async = require('async'), transportSelector = require('./transportSelector'), config = require('./configService'), context = { - op: 'IoTAgentJSON.Commands', + op: 'IoTAgentJSON.Commands' }; /** @@ -83,7 +83,13 @@ function generateCommandExecution(apiKey, device, attribute) { function commandHandler(id, type, service, subservice, attributes, callback) { config .getLogger() - .debug(context, 'Handling MQTT command for device [%s] in service [%s - %s]', id, service, subservice); + .debug( + context, + 'Handling MQTT command for device [%s] in service [%s - %s]', + id, + service, + subservice + ); function concat(previous, current) { previous = previous.concat(current); @@ -102,12 +108,17 @@ function commandHandler(id, type, service, subservice, attributes, callback) { ); callback(error); } else { - iotaUtils.getEffectiveApiKey(device.service, device.subservice, function(error, apiKey) { + iotaUtils.getEffectiveApiKey(device.service, device.subservice, function( + error, + apiKey + ) { if (error) { callback(error); } else { async.series( - attributes.map(generateCommandExecution.bind(null, apiKey, device)).reduce(concat, []), + attributes + .map(generateCommandExecution.bind(null, apiKey, device)) + .reduce(concat, []), callback ); } diff --git a/lib/commonBindings.js b/lib/commonBindings.js index 94be3f37..bbf0402c 100644 --- a/lib/commonBindings.js +++ b/lib/commonBindings.js @@ -32,7 +32,7 @@ var iotAgentLib = require('iotagent-node-lib'), iotaUtils = require('./iotaUtils'), constants = require('./constants'), context = { - op: 'IoTAgentJSON.commonBinding', + op: 'IoTAgentJSON.commonBinding' }, config = require('./configService'); @@ -49,12 +49,16 @@ function parseMessage(message) { stringMessage = message.toString(); parsedMessage = JSON.parse(stringMessage); } catch (e) { - config.getLogger().debug(context, 'Parse error treating message [%s]: %j', stringMessage, e); + config + .getLogger() + .debug(context, 'Parse error treating message [%s]: %j', stringMessage, e); parsedMessage = null; } if (!parsedMessage) { - config.getLogger().error(context, 'MEASURES-003: Impossible to handle malformed message: %s', message); + config + .getLogger() + .error(context, 'MEASURES-003: Impossible to handle malformed message: %s', message); } return parsedMessage; @@ -96,7 +100,7 @@ function extractAttributes(device, current) { values.push({ name: i, type: guessType(i, device), - value: current[i], + value: current[i] }); } } @@ -137,7 +141,12 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { iotAgentLib.alarms.release(constants.MQTTB_ALARM); config .getLogger() - .debug(context, 'Configuration request finished for APIKey [%s] and Device [%s]', apiKey, deviceId); + .debug( + context, + 'Configuration request finished for APIKey [%s] and Device [%s]', + apiKey, + deviceId + ); } } ); @@ -156,14 +165,21 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { function singleMeasure(apiKey, deviceId, attribute, device, message) { var values; - config.getLogger().debug(context, 'Processing single measure for device [%s] with apiKey [%s]', deviceId, apiKey); + config + .getLogger() + .debug( + context, + 'Processing single measure for device [%s] with apiKey [%s]', + deviceId, + apiKey + ); values = [ { name: attribute, type: guessType(attribute, device), - value: message.toString(), - }, + value: message.toString() + } ]; iotAgentLib.update(device.name, device.type, '', values, device, function(error) { @@ -202,14 +218,19 @@ function multipleMeasures(apiKey, deviceId, device, messageObj) { config .getLogger() - .debug(context, 'Processing multiple measures for device [%s] with apiKey [%s]', deviceId, apiKey); + .debug( + context, + 'Processing multiple measures for device [%s] with apiKey [%s]', + deviceId, + apiKey + ); for (var i in messageObj) { if (messageObj.hasOwnProperty(i)) { values.push({ name: i, type: guessType(i, device), - value: messageObj[i], + value: messageObj[i] }); } } @@ -251,9 +272,15 @@ function messageHandler(topic, message, protocol) { function processDeviceMeasure(error, device) { if (error) { - config.getLogger().error(context, 'MEASURES-004: Device not found for topic [%s]', topic); + config + .getLogger() + .error(context, 'MEASURES-004: Device not found for topic [%s]', topic); } else { - if (topicInformation[3] === 'configuration' && topicInformation[4] === 'commands' && parsedMessage) { + if ( + topicInformation[3] === 'configuration' && + topicInformation[4] === 'commands' && + parsedMessage + ) { manageConfigurationRequest(apiKey, deviceId, device, parsedMessage); } else if (topicInformation[4]) { singleMeasure(apiKey, deviceId, topicInformation[4], device, message); diff --git a/lib/configService.js b/lib/configService.js index 630a52d7..5726f8a8 100644 --- a/lib/configService.js +++ b/lib/configService.js @@ -55,7 +55,7 @@ function processEnvironmentVariables() { 'IOTA_AMQP_RETRY_TIME', 'IOTA_HTTP_HOST', 'IOTA_HTTP_PORT', - 'IOTA_HTTP_TIMEOUT', + 'IOTA_HTTP_TIMEOUT' ], mqttVariables = [ 'IOTA_MQTT_HOST', @@ -63,7 +63,7 @@ function processEnvironmentVariables() { 'IOTA_MQTT_USERNAME', 'IOTA_MQTT_PASSWORD', 'IOTA_MQTT_QOS', - 'IOTA_MQTT_RETAIN', + 'IOTA_MQTT_RETAIN' ], amqpVariables = [ 'IOTA_AMQP_HOST', @@ -74,7 +74,7 @@ function processEnvironmentVariables() { 'IOTA_AMQP_QUEUE', 'IOTA_AMQP_DURABLE', 'IOTA_AMQP_RETRIES', - 'IOTA_AMQP_RETRY_TIME', + 'IOTA_AMQP_RETRY_TIME' ], httpVariables = ['IOTA_HTTP_HOST', 'IOTA_HTTP_PORT', 'IOTA_HTTP_TIMEOUT']; diff --git a/lib/constants.js b/lib/constants.js index 6a156025..9c584840 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -55,5 +55,5 @@ module.exports = { AMQP_DEFAULT_EXCHANGE: 'amq.topic', AMQP_DEFAULT_QUEUE: 'iotaqueue', AMQP_DEFAULT_RETRIES: 5, - AMQP_DEFAULT_RETRY_TIME: 5, + AMQP_DEFAULT_RETRY_TIME: 5 }; diff --git a/lib/errors.js b/lib/errors.js index 53a1e0e3..70613544 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -36,7 +36,8 @@ module.exports = { }, GroupNotFound: function(service, subservice) { this.name = 'GROUP_NOT_FOUND'; - this.message = 'Group not found for service [' + service + '] and subservice [' + subservice + ']'; + this.message = + 'Group not found for service [' + service + '] and subservice [' + subservice + ']'; }, MandatoryParamsNotFound: function(paramList) { this.name = 'MANDATORY_PARAMS_NOT_FOUND'; @@ -69,7 +70,8 @@ module.exports = { }, HTTPCommandResponseError: function(code, error) { this.name = 'HTTP_COMMAND_RESPONSE_ERROR'; - this.message = 'There was an error in the response of a device to a command [' + code + ' ]:' + error; + this.message = + 'There was an error in the response of a device to a command [' + code + ' ]:' + error; this.code = 400; }, EndpointNotFound: function(id) { @@ -79,7 +81,12 @@ module.exports = { }, DeviceEndpointError: function(code, msg) { this.name = 'DEVICE_ENDPOINT_ERROR'; - this.message = 'Request to the device ended up in error with code [' + code + ' ] and message [' + msg + ']'; + this.message = + 'Request to the device ended up in error with code [' + + code + + ' ] and message [' + + msg + + ']'; this.code = code; - }, + } }; diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 269a6608..7a6b9bf8 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -28,7 +28,7 @@ var iotAgentLib = require('iotagent-node-lib'), apply = async.apply, constants = require('./constants'), context = { - op: 'IoTAgentJSON.Utils', + op: 'IoTAgentJSON.Utils' }, config = require('./configService'); @@ -46,7 +46,9 @@ function getEffectiveApiKey(service, subservice, callback) { config.getLogger().debug(context, 'Using found group: %j', group); callback(null, group.apikey); } else if (config.getConfig().defaultKey) { - config.getLogger().debug(context, 'Using default API Key: %s', config.getConfig().defaultKey); + config + .getLogger() + .debug(context, 'Using default API Key: %s', config.getConfig().defaultKey); callback(null, config.getConfig().defaultKey); } else { config.getLogger().error(context, 'Could not find any API Key information for device.'); @@ -68,7 +70,12 @@ function manageConfiguration(apiKey, deviceId, device, objMessage, sendFunction, } else { config .getLogger() - .debug(context, 'Configuration attributes sent to the device successfully.', deviceId, apiKey); + .debug( + context, + 'Configuration attributes sent to the device successfully.', + deviceId, + apiKey + ); } callback(error); @@ -93,7 +100,7 @@ function manageConfiguration(apiKey, deviceId, device, objMessage, sendFunction, [ apply(iotAgentLib.query, device.name, device.type, '', objMessage.fields, device), extractAttributes, - apply(sendFunction, apiKey, deviceId), + apply(sendFunction, apiKey, deviceId) ], handleSendConfigurationError ); @@ -122,7 +129,9 @@ function manageConfiguration(apiKey, deviceId, device, objMessage, sendFunction, callback(error); }); } else { - config.getLogger().error(context, 'CONFIG-003: Unknown command type from device [%s]', device.name); + config + .getLogger() + .error(context, 'CONFIG-003: Unknown command type from device [%s]', device.name); callback(); } } @@ -148,7 +157,7 @@ function findOrCreate(deviceId, transport, group, callback) { id: deviceId, service: group.service, subservice: group.subservice, - type: group.type, + type: group.type }; if ( config.getConfig().iota && @@ -203,13 +212,17 @@ function retrieveDevice(deviceId, apiKey, transport, callback) { } else { async.waterfall( [ - apply(iotAgentLib.getConfiguration, config.getConfig().iota.defaultResource || '', apiKey), + apply( + iotAgentLib.getConfiguration, + config.getConfig().iota.defaultResource || '', + apiKey + ), apply(findOrCreate, deviceId, transport), apply( iotAgentLib.mergeDeviceWithConfiguration, ['lazy', 'active', 'staticAttributes', 'commands', 'subscriptions'], [null, null, [], [], [], [], []] - ), + ) ], callback ); diff --git a/lib/iotagent-json.js b/lib/iotagent-json.js index 8c822801..d67d2013 100644 --- a/lib/iotagent-json.js +++ b/lib/iotagent-json.js @@ -32,7 +32,7 @@ var iotAgentLib = require('iotagent-node-lib'), thinkingThingPlugin = require('./thinkingThingPlugin'), apply = async.apply, context = { - op: 'IoTAgentJSON.Agent', + op: 'IoTAgentJSON.Agent' }, config = require('./configService'); @@ -54,7 +54,10 @@ function configurationNotificationHandler(device, updates, callback) { } async.waterfall( - [apply(iotaUtils.getEffectiveApiKey, device.service, device.subservice), invokeConfiguration], + [ + apply(iotaUtils.getEffectiveApiKey, device.service, device.subservice), + invokeConfiguration + ], callback ); } @@ -100,13 +103,18 @@ function bidirectionalityNotificationHandler(device, updates, callback) { * @param {Object} device Device provisioning information. */ function deviceProvisioningHandler(device, callback) { - transportSelector.applyFunctionFromBinding([device], 'deviceProvisioningHandler', null, function(error, devices) { - if (error) { - callback(error); - } else { - callback(null, devices[0]); + transportSelector.applyFunctionFromBinding( + [device], + 'deviceProvisioningHandler', + null, + function(error, devices) { + if (error) { + callback(error); + } else { + callback(null, devices[0]); + } } - }); + ); } /** @@ -141,13 +149,21 @@ function start(newConfig, callback) { iotAgentLib.addUpdateMiddleware(thinkingThingPlugin.updatePlugin); } - iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.expressionTransformation.update); + iotAgentLib.addUpdateMiddleware( + iotAgentLib.dataPlugins.expressionTransformation.update + ); iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.multiEntity.update); iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.timestampProcess.update); - iotAgentLib.addDeviceProvisionMiddleware(iotAgentLib.dataPlugins.bidirectionalData.deviceProvision); - iotAgentLib.addConfigurationProvisionMiddleware(iotAgentLib.dataPlugins.bidirectionalData.groupProvision); - iotAgentLib.addNotificationMiddleware(iotAgentLib.dataPlugins.bidirectionalData.notification); + iotAgentLib.addDeviceProvisionMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.deviceProvision + ); + iotAgentLib.addConfigurationProvisionMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.groupProvision + ); + iotAgentLib.addNotificationMiddleware( + iotAgentLib.dataPlugins.bidirectionalData.notification + ); if (config.getConfig().configRetrieval) { iotAgentLib.setNotificationHandler(configurationNotificationHandler); @@ -167,7 +183,11 @@ function start(newConfig, callback) { function stop(callback) { config.getLogger().info(context, 'Stopping IoT Agent'); async.series( - [transportSelector.stopTransportBindings, iotAgentLib.resetMiddlewares, iotAgentLib.deactivate], + [ + transportSelector.stopTransportBindings, + iotAgentLib.resetMiddlewares, + iotAgentLib.deactivate + ], callback ); } diff --git a/lib/thinkingThingPlugin.js b/lib/thinkingThingPlugin.js index be115980..1032d3cd 100644 --- a/lib/thinkingThingPlugin.js +++ b/lib/thinkingThingPlugin.js @@ -29,7 +29,7 @@ var iotAgentLib = require('iotagent-node-lib'), errors = require('./errors'), config = require('./configService'), context = { - op: 'IoTAgentJSON.ThinkingThingsPlugin', + op: 'IoTAgentJSON.ThinkingThingsPlugin' }; function parseBattery(payload) { @@ -37,38 +37,40 @@ function parseBattery(payload) { fields = rawValue.split(','), result = []; - config.getLogger().debug(context, 'Parsing Battery module: %s', JSON.stringify(fields, null, 4)); + config + .getLogger() + .debug(context, 'Parsing Battery module: %s', JSON.stringify(fields, null, 4)); if (fields.length >= 8) { result.push({ name: 'voltage', type: 'string', - value: fields[2], + value: fields[2] }); result.push({ name: 'state', type: 'string', - value: fields[3], + value: fields[3] }); result.push({ name: 'charger', type: 'string', - value: fields[4], + value: fields[4] }); result.push({ name: 'charging', type: 'string', - value: fields[5], + value: fields[5] }); result.push({ name: 'mode', type: 'string', - value: fields[6], + value: fields[6] }); result.push({ name: 'disconnection', type: 'string', - value: fields[7], + value: fields[7] }); } @@ -76,19 +78,21 @@ function parseBattery(payload) { result.push({ name: 'batteryType', type: 'string', - value: fields[8], + value: fields[8] }); result.push({ name: 'percentage', type: 'string', - value: fields[9], + value: fields[9] }); } if (result.length !== 0) { return result; } else { - config.getLogger().error(context, 'TTHINGS-001: Too few fields parsing Battery module: %s', rawValue); + config + .getLogger() + .error(context, 'TTHINGS-001: Too few fields parsing Battery module: %s', rawValue); return []; } } @@ -110,32 +114,34 @@ function parseGSM(payload) { result.push({ name: 'mcc', type: 'string', - value: fields[2], + value: fields[2] }); result.push({ name: 'mnc', type: 'string', - value: fields[3], + value: fields[3] }); result.push({ name: 'lac', type: 'string', - value: fields[4], + value: fields[4] }); result.push({ name: 'cell-id', type: 'string', - value: fields[5], + value: fields[5] }); result.push({ name: 'dbm', type: 'string', - value: fields[6], + value: fields[6] }); return result; } else { - config.getLogger().error(context, 'TTHINGS-002: Too few fields parsing GSM module: %s', rawValue); + config + .getLogger() + .error(context, 'TTHINGS-002: Too few fields parsing GSM module: %s', rawValue); return []; } } @@ -158,27 +164,29 @@ function parseCell(payload) { result.push({ name: 'mcc', type: 'string', - value: fields[0], + value: fields[0] }); result.push({ name: 'mnc', type: 'string', - value: fields[1], + value: fields[1] }); result.push({ name: 'lac', type: 'string', - value: fields[2], + value: fields[2] }); result.push({ name: 'cell-id', type: 'string', - value: fields[3], + value: fields[3] }); return result; } else { - config.getLogger().error(context, 'TTHINGS-003: Too few fields parsing C1 module: %s', rawValue); + config + .getLogger() + .error(context, 'TTHINGS-003: Too few fields parsing C1 module: %s', rawValue); return []; } } @@ -262,7 +270,11 @@ function updatePluginNgsi2(entity, entityType, callback) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePluginNgsi1(entity, entityType, callback) { - if (entity.contextElements && entity.contextElements[0] && entity.contextElements[0].attributes) { + if ( + entity.contextElements && + entity.contextElements[0] && + entity.contextElements[0].attributes + ) { var moduleAttributes = entity.contextElements[0].attributes.map(modifyAttributes); entity.contextElements[0].attributes = moduleAttributes; diff --git a/lib/timestampProcessPlugin.js b/lib/timestampProcessPlugin.js index f7ff301d..4d12a067 100644 --- a/lib/timestampProcessPlugin.js +++ b/lib/timestampProcessPlugin.js @@ -27,7 +27,7 @@ var errors = require('./errors'), constants = require('./constants'), config = require('./configService'), context = { - op: 'IoTAgentJSON.TimestampProcessPlugin', + op: 'IoTAgentJSON.TimestampProcessPlugin' }; /** @@ -44,15 +44,19 @@ function updatePlugin(entity, entityType, callback) { { name: constants.TIMESTAMP_ATTRIBUTE, type: constants.TIMESTAMP_TYPE, - value: timestamp.value, - }, + value: timestamp.value + } ]; } return element; } - if (entity.contextElements && entity.contextElements[0] && entity.contextElements[0].attributes) { + if ( + entity.contextElements && + entity.contextElements[0] && + entity.contextElements[0].attributes + ) { for (var i in entity.contextElements[0].attributes) { if (entity.contextElements[0].attributes[i].name === constants.TIMESTAMP_ATTRIBUTE) { timestamp = entity.contextElements[0].attributes[i]; @@ -60,12 +64,16 @@ function updatePlugin(entity, entityType, callback) { } if (timestamp) { - entity.contextElements[0].attributes = entity.contextElements[0].attributes.map(insertMetadata); + entity.contextElements[0].attributes = entity.contextElements[0].attributes.map( + insertMetadata + ); } callback(null, entity, entityType); } else { - config.getLogger().error(context, 'MEASURES-001: Bad payload received while processing timestamps'); + config + .getLogger() + .error(context, 'MEASURES-001: Bad payload received while processing timestamps'); callback(new errors.BadPayload(entity)); } } diff --git a/lib/transportSelector.js b/lib/transportSelector.js index 5fcbefb6..d4fc3a8c 100644 --- a/lib/transportSelector.js +++ b/lib/transportSelector.js @@ -51,14 +51,18 @@ function startTransportBindings(newConfig, callback) { } function createExecutionsForBinding(argument, functionName, protocol) { - config.getLogger().debug('Creating execution for function [%s] and protocol [%s]', functionName, protocol); + config + .getLogger() + .debug('Creating execution for function [%s] and protocol [%s]', functionName, protocol); function addHandler(current, binding) { if (binding[functionName] && (!protocol || binding.protocol === protocol)) { var args = [binding[functionName]].concat(argument), boundFunction = binding[functionName].bind.apply(binding[functionName], args); - config.getLogger().debug('Binding found for function [%s] and protocol [%s]', functionName, protocol); + config + .getLogger() + .debug('Binding found for function [%s] and protocol [%s]', functionName, protocol); current.push(boundFunction); } @@ -78,7 +82,13 @@ function createExecutionsForBinding(argument, functionName, protocol) { * @param {String} protocol Transport protocol where the function must be executed. */ function applyFunctionFromBinding(argument, functionName, protocol, callback) { - config.getLogger().debug('Looking for bindings for the function [%s] and protocol [%s]', functionName, protocol); + config + .getLogger() + .debug( + 'Looking for bindings for the function [%s] and protocol [%s]', + functionName, + protocol + ); async.series(createExecutionsForBinding(argument, functionName, protocol), callback); } diff --git a/test/config-startup.js b/test/config-startup.js index ceab1129..a5fb7bcb 100644 --- a/test/config-startup.js +++ b/test/config-startup.js @@ -27,11 +27,11 @@ config.mqtt = { port: 1883, thinkingThingsPlugin: true, username: 'guest', - password: 'guest', + password: 'guest' }; config.http = { - port: 7896, + port: 7896 }; config.amqp = { @@ -39,20 +39,20 @@ config.amqp = { port: 5672, exchange: 'amq.topic', queue: 'iota_queue', - options: { durable: true }, + options: { durable: true } }; config.iota = { logLevel: 'FATAL', contextBroker: { host: '192.168.1.1', - port: '1026', + port: '1026' }, server: { - port: 4041, + port: 4041 }, deviceRegistry: { - type: 'memory', + type: 'memory' }, types: {}, service: 'howtoService', @@ -60,7 +60,7 @@ config.iota = { providerUrl: 'http://localhost:4041', deviceRegistrationDuration: 'P1M', defaultType: 'Thing', - defaultResource: '/iot/json', + defaultResource: '/iot/json' }; config.defaultKey = '1234'; diff --git a/test/config-test.js b/test/config-test.js index 82cf0419..0aa06723 100644 --- a/test/config-test.js +++ b/test/config-test.js @@ -27,11 +27,11 @@ config.mqtt = { port: 1883, thinkingThingsPlugin: true, username: 'guest', - password: 'guest', + password: 'guest' }; config.http = { - port: 7896, + port: 7896 }; config.amqp = { @@ -39,20 +39,20 @@ config.amqp = { port: 5672, exchange: 'amq.topic', queue: 'iota_queue', - options: { durable: true }, + options: { durable: true } }; config.iota = { logLevel: 'FATAL', contextBroker: { host: '192.168.1.1', - port: '1026', + port: '1026' }, server: { - port: 4041, + port: 4041 }, deviceRegistry: { - type: 'memory', + type: 'memory' }, types: {}, service: 'howtoService', @@ -61,7 +61,7 @@ config.iota = { deviceRegistrationDuration: 'P1M', defaultType: 'Thing', defaultResource: '/iot/json', - compressTimestamp: true, + compressTimestamp: true }; config.defaultKey = '1234'; diff --git a/test/unit/HTTP_commands_test.js b/test/unit/HTTP_commands_test.js index 748b07e1..c73fbc6c 100644 --- a/test/unit/HTTP_commands_test.js +++ b/test/unit/HTTP_commands_test.js @@ -41,8 +41,8 @@ describe('HTTP: Commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandHTTP.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; config.logLevel = 'INFO'; @@ -53,7 +53,12 @@ describe('HTTP: Commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply( + 200, + utils.readExampleFile( + './test/contextAvailabilityResponses/registerIoTAgent1Success.json' + ) + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -80,22 +85,34 @@ describe('HTTP: Commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus1.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus1.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus6.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus6.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') + ); mockedClientServer = nock('http://localhost:9876') .post('/command', function(body) { diff --git a/test/unit/HTTP_get-configuration_test.js b/test/unit/HTTP_get-configuration_test.js index e6d9077c..423ae1be 100644 --- a/test/unit/HTTP_get-configuration_test.js +++ b/test/unit/HTTP_get-configuration_test.js @@ -45,8 +45,8 @@ describe('HTTP: Get configuration from the devices', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandHTTP.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -55,7 +55,12 @@ describe('HTTP: Get configuration from the devices', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply( + 200, + utils.readExampleFile( + './test/contextAvailabilityResponses/registerIoTAgent1Success.json' + ) + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -86,24 +91,30 @@ describe('HTTP: Get configuration from the devices', function() { method: 'POST', json: { type: 'configuration', - fields: ['sleepTime', 'warningLevel'], + fields: ['sleepTime', 'warningLevel'] }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'MQTT_2', - k: '1234', - }, + k: '1234' + } }; beforeEach(function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/queryContext', utils.readExampleFile('./test/contextRequests/getConfiguration.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json')); + .post( + '/v1/queryContext', + utils.readExampleFile('./test/contextRequests/getConfiguration.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json') + ); mockedClientServer = nock('http://localhost:9876') .post('/command/configuration', function(result) { @@ -145,24 +156,30 @@ describe('HTTP: Get configuration from the devices', function() { method: 'POST', json: { type: 'subscription', - fields: ['sleepTime', 'warningLevel'], + fields: ['sleepTime', 'warningLevel'] }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'MQTT_2', - k: '1234', - }, + k: '1234' + } }; beforeEach(function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/subscribeContext', utils.readExampleFile('./test/subscriptions/subscriptionRequest.json')) - .reply(200, utils.readExampleFile('./test/subscriptions/subscriptionResponse.json')); + .post( + '/v1/subscribeContext', + utils.readExampleFile('./test/subscriptions/subscriptionRequest.json') + ) + .reply( + 200, + utils.readExampleFile('./test/subscriptions/subscriptionResponse.json') + ); mockedClientServer = nock('http://localhost:9876') .post('/command/configuration', function(result) { @@ -190,8 +207,8 @@ describe('HTTP: Get configuration from the devices', function() { json: utils.readExampleFile('./test/subscriptions/notification.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; request(configurationRequest, function(error, response, body) { diff --git a/test/unit/HTTP_reveice_measures-test.js b/test/unit/HTTP_reveice_measures-test.js index 18d342b7..3133a9f8 100644 --- a/test/unit/HTTP_reveice_measures-test.js +++ b/test/unit/HTTP_reveice_measures-test.js @@ -49,17 +49,17 @@ var iotagentMqtt = require('../../'), attributes: [ { name: 'status', - type: 'Boolean', - }, + type: 'Boolean' + } ], - static_attributes: [], - }, - ], + static_attributes: [] + } + ] }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, contextBrokerMock, contextBrokerUnprovMock; @@ -72,8 +72,8 @@ describe('HTTP: Measure reception ', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceHTTP.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -82,7 +82,10 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); iotagentMqtt.start(config, function() { request(provisionOptions, function(error, response, body) { @@ -103,24 +106,30 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '32', - temperature: '87', + temperature: '87' }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'MQTT_2', - k: '1234', - }, + k: '1234' + } }; beforeEach(function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasures.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/multipleMeasures.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); }); it('should return a 200 OK with no error', function(done) { request(optionsMeasure, function(error, result, body) { @@ -143,25 +152,27 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '111222', - TimeInstant: '20200222T222222', + TimeInstant: '20200222T222222' }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'dev0130101', - k: '1234', - }, + k: '1234' + } }, provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), + json: utils.readExampleFile( + './test/deviceProvisioning/provisionDeviceTimeinstant.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function(done) { @@ -171,13 +182,22 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/timeInstantMeasures.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/timeInstantMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/timeInstantMeasures.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/timeInstantMeasuresSuccess.json') + ); iotagentMqtt.stop(function() { config.iota.timestamp = true; @@ -208,26 +228,28 @@ describe('HTTP: Measure reception ', function() { url: 'http://localhost:' + config.http.port + '/iot/json', method: 'POST', json: { - humidity: '111222', + humidity: '111222' }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'dev0130101', k: '1234', - t: '20200222T222222', - }, + t: '20200222T222222' + } }, provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), + json: utils.readExampleFile( + './test/deviceProvisioning/provisionDeviceTimeinstant.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function(done) { @@ -237,13 +259,22 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/timeInstantMeasures.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/timeInstantMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/timeInstantMeasures.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/timeInstantMeasuresSuccess.json') + ); iotagentMqtt.stop(function() { config.iota.timestamp = true; @@ -275,16 +306,16 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '32', - temperature: '87', + temperature: '87' }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'MQTT_UNPROVISIONED', - k: 'KL223HHV8732SFL1', - }, + k: 'KL223HHV8732SFL1' + } }; beforeEach(function(done) { @@ -292,13 +323,22 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); contextBrokerUnprovMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/unprovisionedDevice.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/unprovisionedDevice.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); request(groupCreation, function(error, response, body) { done(); @@ -317,12 +357,12 @@ describe('HTTP: Measure reception ', function() { method: 'GET', headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'MQTT_UNPROVISIONED', - k: 'KL223HHV8732SFL1', - }, + k: 'KL223HHV8732SFL1' + } }; request(optionsMeasure, function(error, response, body) { diff --git a/test/unit/MQTT_commands_test.js b/test/unit/MQTT_commands_test.js index 53bc4d3b..7aa32b5b 100644 --- a/test/unit/MQTT_commands_test.js +++ b/test/unit/MQTT_commands_test.js @@ -42,8 +42,8 @@ describe('MQTT: Commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; config.logLevel = 'INFO'; @@ -54,7 +54,7 @@ describe('MQTT: Commands', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -64,7 +64,12 @@ describe('MQTT: Commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply( + 200, + utils.readExampleFile( + './test/contextAvailabilityResponses/registerIoTAgent1Success.json' + ) + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -94,16 +99,22 @@ describe('MQTT: Commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus1.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus1.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') + ); }); it('should return a 200 OK without errors', function(done) { @@ -149,12 +160,20 @@ describe('MQTT: Commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus2.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus2Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus2.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus2Success.json') + ); }); it('should send an update request to the Context Broker', function(done) { - mqttClient.publish('/1234/MQTT_2/cmdexe', '{ "PING": "1234567890" }', null, function(error) { + mqttClient.publish('/1234/MQTT_2/cmdexe', '{ "PING": "1234567890" }', null, function( + error + ) { setTimeout(function() { contextBrokerMock.done(); done(); diff --git a/test/unit/MQTT_get-configuration_test.js b/test/unit/MQTT_get-configuration_test.js index 1b107a7e..9e865c43 100644 --- a/test/unit/MQTT_get-configuration_test.js +++ b/test/unit/MQTT_get-configuration_test.js @@ -43,8 +43,8 @@ describe('MQTT: Get configuration from the devices', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -53,7 +53,7 @@ describe('MQTT: Get configuration from the devices', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -61,7 +61,10 @@ describe('MQTT: Get configuration from the devices', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); oldConfigurationFlag = config.configRetrieval; config.configRetrieval = true; @@ -82,11 +85,12 @@ describe('MQTT: Get configuration from the devices', function() { async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe( - 'When a configuration request is received in the topic ' + '"/{{apikey}}/{{deviceid}}/configuration/commands"', + 'When a configuration request is received in the topic ' + + '"/{{apikey}}/{{deviceid}}/configuration/commands"', function() { var values = { type: 'configuration', - fields: ['sleepTime', 'warningLevel'], + fields: ['sleepTime', 'warningLevel'] }, configurationReceived; @@ -94,8 +98,16 @@ describe('MQTT: Get configuration from the devices', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/queryContext', utils.readExampleFile('./test/contextRequests/getConfiguration.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json')); + .post( + '/v1/queryContext', + utils.readExampleFile('./test/contextRequests/getConfiguration.json') + ) + .reply( + 200, + utils.readExampleFile( + './test/contextResponses/getConfigurationSuccess.json' + ) + ); mqttClient.subscribe('/1234/MQTT_2/configuration/values', null); @@ -109,14 +121,17 @@ describe('MQTT: Get configuration from the devices', function() { }); it('should ask the Context Broker for the request attributes', function(done) { - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( - error - ) { - setTimeout(function() { - contextBrokerMock.done(); - done(); - }, 100); - }); + mqttClient.publish( + '/1234/MQTT_2/configuration/commands', + JSON.stringify(values), + null, + function(error) { + setTimeout(function() { + contextBrokerMock.done(); + done(); + }, 100); + } + ); }); it('should return the requested attributes to the client in /1234/MQTT_2/configuration/values', function(done) { @@ -130,14 +145,17 @@ describe('MQTT: Get configuration from the devices', function() { result.warningLevel === '80'; }); - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( - error - ) { - setTimeout(function() { - configurationReceived.should.equal(true); - done(); - }, 100); - }); + mqttClient.publish( + '/1234/MQTT_2/configuration/commands', + JSON.stringify(values), + null, + function(error) { + setTimeout(function() { + configurationReceived.should.equal(true); + done(); + }, 100); + } + ); }); it('should add the system timestamp in compressed format to the request', function(done) { @@ -147,14 +165,17 @@ describe('MQTT: Get configuration from the devices', function() { configurationReceived = result.dt && result.dt.should.match(/^\d{8}T\d{6}Z$/); }); - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( - error - ) { - setTimeout(function() { - should.exist(configurationReceived); - done(); - }, 100); - }); + mqttClient.publish( + '/1234/MQTT_2/configuration/commands', + JSON.stringify(values), + null, + function(error) { + setTimeout(function() { + should.exist(configurationReceived); + done(); + }, 100); + } + ); }); } ); @@ -162,7 +183,7 @@ describe('MQTT: Get configuration from the devices', function() { describe('When a subscription request is received in the IoT Agent', function() { var values = { type: 'subscription', - fields: ['sleepTime', 'warningLevel'], + fields: ['sleepTime', 'warningLevel'] }, configurationReceived; @@ -170,8 +191,14 @@ describe('MQTT: Get configuration from the devices', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/subscribeContext', utils.readExampleFile('./test/subscriptions/subscriptionRequest.json')) - .reply(200, utils.readExampleFile('./test/subscriptions/subscriptionResponse.json')); + .post( + '/v1/subscribeContext', + utils.readExampleFile('./test/subscriptions/subscriptionRequest.json') + ) + .reply( + 200, + utils.readExampleFile('./test/subscriptions/subscriptionResponse.json') + ); mqttClient.subscribe('/1234/MQTT_2/configuration/values', null); @@ -185,12 +212,17 @@ describe('MQTT: Get configuration from the devices', function() { }); it('should create a subscription in the ContextBroker', function(done) { - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function(error) { - setTimeout(function() { - contextBrokerMock.done(); - done(); - }, 100); - }); + mqttClient.publish( + '/1234/MQTT_2/configuration/commands', + JSON.stringify(values), + null, + function(error) { + setTimeout(function() { + contextBrokerMock.done(); + done(); + }, 100); + } + ); }); it('should update the values in the MQTT topic when a notification is received', function(done) { var optionsNotify = { @@ -199,26 +231,32 @@ describe('MQTT: Get configuration from the devices', function() { json: utils.readExampleFile('./test/subscriptions/notification.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; mqttClient.on('message', function(topic, data) { var result = JSON.parse(data); - configurationReceived = result.sleepTime === '200' && result.warningLevel === 'ERROR'; + configurationReceived = + result.sleepTime === '200' && result.warningLevel === 'ERROR'; }); - mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function(error) { - setTimeout(function() { - request(optionsNotify, function(error, response, body) { - setTimeout(function() { - configurationReceived.should.equal(true); - done(); - }, 100); - }); - }, 100); - }); + mqttClient.publish( + '/1234/MQTT_2/configuration/commands', + JSON.stringify(values), + null, + function(error) { + setTimeout(function() { + request(optionsNotify, function(error, response, body) { + setTimeout(function() { + configurationReceived.should.equal(true); + done(); + }, 100); + }); + }, 100); + } + ); }); }); }); diff --git a/test/unit/MQTT_receive_measures-test.js b/test/unit/MQTT_receive_measures-test.js index a057789b..ef2f7517 100644 --- a/test/unit/MQTT_receive_measures-test.js +++ b/test/unit/MQTT_receive_measures-test.js @@ -49,17 +49,17 @@ var iotagentMqtt = require('../../'), attributes: [ { name: 'status', - type: 'Boolean', - }, + type: 'Boolean' + } ], - static_attributes: [], - }, - ], + static_attributes: [] + } + ] }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, contextBrokerMock, contextBrokerUnprovMock, @@ -73,8 +73,8 @@ describe('MQTT: Measure reception ', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -83,7 +83,7 @@ describe('MQTT: Measure reception ', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -91,7 +91,10 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); iotagentMqtt.start(config, function() { request(provisionOptions, function(error, response, body) { @@ -112,13 +115,19 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasures.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/multipleMeasures.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - temperature: '87', + temperature: '87' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -136,13 +145,22 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); contextBrokerUnprovMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/unprovisionedDevice.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/unprovisionedDevice.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); request(groupCreation, function(error, response, body) { done(); @@ -151,17 +169,20 @@ describe('MQTT: Measure reception ', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - temperature: '87', + temperature: '87' }; - mqttClient.publish('/KL223HHV8732SFL1/MQTT_UNPROVISIONED/attrs', JSON.stringify(values), null, function( - error - ) { - setTimeout(function() { - contextBrokerUnprovMock.done(); - done(); - }, 100); - }); + mqttClient.publish( + '/KL223HHV8732SFL1/MQTT_UNPROVISIONED/attrs', + JSON.stringify(values), + null, + function(error) { + setTimeout(function() { + contextBrokerUnprovMock.done(); + done(); + }, 100); + } + ); }); }); @@ -170,13 +191,19 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/unknownMeasures.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/unknownMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/unknownMeasures.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/unknownMeasuresSuccess.json') + ); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - weight: '87', + weight: '87' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -193,14 +220,20 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/timestampMeasure.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/timestampMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/timestampMeasure.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/timestampMeasureSuccess.json') + ); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', temperature: '87', - TimeInstant: '20071103T131805', + TimeInstant: '20071103T131805' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -217,8 +250,14 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasure.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/singleMeasure.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') + ); }); it('should send its values to the Context Broker', function(done) { mqttClient.publish('/1234/MQTT_2/attrs/temperature', '87', null, function(error) { diff --git a/test/unit/amqpBinding-test.js b/test/unit/amqpBinding-test.js index 8fa095e1..e6bfcf65 100644 --- a/test/unit/amqpBinding-test.js +++ b/test/unit/amqpBinding-test.js @@ -62,8 +62,8 @@ describe('AMQP Transport binding: measures', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceAMQP1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -75,13 +75,16 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); async.series( [ apply(iotagentMqtt.start, config), apply(request, provisionOptions), - apply(startConnection, config.amqp.exchange), + apply(startConnection, config.amqp.exchange) ], done ); @@ -101,8 +104,14 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') + ); }); it('should send a new update context request to the Context Broker with just that attribute', function(done) { @@ -122,8 +131,8 @@ describe('AMQP Transport binding: measures', function() { json: utils.readExampleFile('./test/groupProvisioning/provisionFullGroupAMQP.json'), headers: { 'fiware-service': 'TestService', - 'fiware-servicepath': '/testingPath', - }, + 'fiware-servicepath': '/testingPath' + } }; beforeEach(function(done) { @@ -131,13 +140,22 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-service', 'TestService') .matchHeader('fiware-servicepath', '/testingPath') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); contextBrokerUnprovMock .matchHeader('fiware-service', 'TestService') .matchHeader('fiware-servicepath', '/testingPath') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/unprovisionedMeasure.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/unprovisionedSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/unprovisionedMeasure.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/unprovisionedSuccess.json') + ); request(groupCreation, function(error, response, body) { done(); @@ -145,7 +163,11 @@ describe('AMQP Transport binding: measures', function() { }); it('should send a new update context request to the Context Broker with just that attribute', function(done) { - channel.publish(config.amqp.exchange, '.80K09H324HV8732.MQTT_UNPROVISIONED.attrs.a', new Buffer('23')); + channel.publish( + config.amqp.exchange, + '.80K09H324HV8732.MQTT_UNPROVISIONED.attrs.a', + new Buffer('23') + ); setTimeout(function() { contextBrokerUnprovMock.done(); @@ -159,12 +181,22 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') + ); }); it('should send a single update context request with all the attributes', function(done) { - channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer(JSON.stringify({ a: '23' }))); + channel.publish( + config.amqp.exchange, + '.1234.MQTT_2.attrs', + new Buffer(JSON.stringify({ a: '23' })) + ); setTimeout(function() { contextBrokerMock.done(); @@ -178,12 +210,22 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') + ); }); it('should silently ignore the error (without crashing)', function(done) { - channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer('notAULPayload ')); + channel.publish( + config.amqp.exchange, + '.1234.MQTT_2.attrs', + new Buffer('notAULPayload ') + ); setTimeout(function() { done(); @@ -196,8 +238,14 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasure.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/multipleMeasure.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); }); it('should send one update context per measure group to the Contet Broker', function(done) { @@ -207,7 +255,7 @@ describe('AMQP Transport binding: measures', function() { new Buffer( JSON.stringify({ a: '23', - b: '98', + b: '98' }) ) ); diff --git a/test/unit/attribute-alias_test.js b/test/unit/attribute-alias_test.js index e69d826b..50ccc5f9 100644 --- a/test/unit/attribute-alias_test.js +++ b/test/unit/attribute-alias_test.js @@ -41,8 +41,8 @@ describe('Attribute alias', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice2.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -51,7 +51,7 @@ describe('Attribute alias', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -59,7 +59,10 @@ describe('Attribute alias', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); iotagentMqtt.start(config, function() { request(provisionOptions, function(error, response, body) { @@ -80,14 +83,20 @@ describe('Attribute alias', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/timestampAliasMeasure.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/timestampMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/timestampAliasMeasure.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/timestampMeasureSuccess.json') + ); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', temperature: '87', - tt: '20071103T131805', + tt: '20071103T131805' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { diff --git a/test/unit/bidirectionalityHttp-test.js b/test/unit/bidirectionalityHttp-test.js index 19ae78e0..0e9640cb 100644 --- a/test/unit/bidirectionalityHttp-test.js +++ b/test/unit/bidirectionalityHttp-test.js @@ -40,8 +40,8 @@ describe('Data Bidirectionality: HTTP', function() { json: utils.readExampleFile('./test/subscriptions/bidirectionalNotification.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; afterEach(function(done) { @@ -57,11 +57,13 @@ describe('Data Bidirectionality: HTTP', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectional.json'), + json: utils.readExampleFile( + './test/deviceProvisioning/provisionCommandBidirectional.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -71,11 +73,15 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v1/subscribeContext', - utils.readExampleFile('./test//subscriptions/bidirectionalSubscriptionRequest.json') + utils.readExampleFile( + './test//subscriptions/bidirectionalSubscriptionRequest.json' + ) ) .reply( 200, - utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') + utils.readExampleFile( + './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json' + ) ); contextBrokerMock @@ -85,7 +91,12 @@ describe('Data Bidirectionality: HTTP', function() { '/v1/updateContext', utils.readExampleFile('./test/contextRequests/createBidirectionalDevice.json') ) - .reply(200, utils.readExampleFile('./test/contextResponses/createBidirectionalDeviceSuccess.json')); + .reply( + 200, + utils.readExampleFile( + './test/contextResponses/createBidirectionalDeviceSuccess.json' + ) + ); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') @@ -96,7 +107,9 @@ describe('Data Bidirectionality: HTTP', function() { ) .reply( 200, - utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') + utils.readExampleFile( + './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json' + ) ); iotagentJson.start(config, function(error) { @@ -116,7 +129,10 @@ describe('Data Bidirectionality: HTTP', function() { it('should leave the data in the polling queue', function(done) { request(notificationOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( + error, + list + ) { should.not.exist(error); list.commands.length.should.equal(3); @@ -127,7 +143,10 @@ describe('Data Bidirectionality: HTTP', function() { it('should send all the data from the notification in command syntax', function(done) { request(notificationOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( + error, + list + ) { var latitudeFound = false, longitudeFound = false; @@ -163,11 +182,13 @@ describe('Data Bidirectionality: HTTP', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json'), + json: utils.readExampleFile( + './test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -177,11 +198,15 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v1/subscribeContext', - utils.readExampleFile('./test//subscriptions/bidirectionalSubscriptionRequest.json') + utils.readExampleFile( + './test//subscriptions/bidirectionalSubscriptionRequest.json' + ) ) .reply( 200, - utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') + utils.readExampleFile( + './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json' + ) ); contextBrokerMock @@ -191,7 +216,12 @@ describe('Data Bidirectionality: HTTP', function() { '/v1/updateContext', utils.readExampleFile('./test/contextRequests/createBidirectionalDevice.json') ) - .reply(200, utils.readExampleFile('./test/contextResponses/createBidirectionalDeviceSuccess.json')); + .reply( + 200, + utils.readExampleFile( + './test/contextResponses/createBidirectionalDeviceSuccess.json' + ) + ); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') @@ -202,7 +232,9 @@ describe('Data Bidirectionality: HTTP', function() { ) .reply( 200, - utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') + utils.readExampleFile( + './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json' + ) ); mockedClientServer = nock('http://localhost:9876') diff --git a/test/unit/commandsAmqp-test.js b/test/unit/commandsAmqp-test.js index bae5dab2..58f94e68 100644 --- a/test/unit/commandsAmqp-test.js +++ b/test/unit/commandsAmqp-test.js @@ -62,8 +62,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommand5.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; config.logLevel = 'INFO'; @@ -74,7 +74,12 @@ describe('AMQP Transport binding: commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply( + 200, + utils.readExampleFile( + './test/contextAvailabilityResponses/registerIoTAgent1Success.json' + ) + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -89,7 +94,7 @@ describe('AMQP Transport binding: commands', function() { [ apply(iotagentMqtt.start, config), apply(request, provisionOptions), - apply(startConnection, config.amqp.exchange), + apply(startConnection, config.amqp.exchange) ], done ); @@ -112,16 +117,22 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus1.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus1.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') + ); }); it('should return a 200 OK without errors', function(done) { @@ -150,7 +161,11 @@ describe('AMQP Transport binding: commands', function() { channel.assertExchange(config.amqp.exchange, 'topic', config.amqp.options); channel.assertQueue('client-queue', { exclusive: false }, function(err, q) { - channel.bindQueue(q.queue, config.amqp.exchange, '.' + config.defaultKey + '.MQTT_2.cmd'); + channel.bindQueue( + q.queue, + config.amqp.exchange, + '.' + config.defaultKey + '.MQTT_2.cmd' + ); channel.consume( q.queue, @@ -176,13 +191,23 @@ describe('AMQP Transport binding: commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus2.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus2Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus2.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus2Success.json') + ); }); it('should send an update request to the Context Broker', function(done) { channel.assertExchange(config.amqp.exchange, 'topic', config.amqp.options); - channel.publish(config.amqp.exchange, '.1234.MQTT_2.cmdexe', new Buffer('{"PING":"1234567890"}')); + channel.publish( + config.amqp.exchange, + '.1234.MQTT_2.cmdexe', + new Buffer('{"PING":"1234567890"}') + ); setTimeout(function() { contextBrokerMock.done(); @@ -198,8 +223,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommand6.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, configurationOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -207,8 +232,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionGroup1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, commandOptions = { url: 'http://localhost:' + config.iota.server.port + '/v1/updateContext', @@ -216,8 +241,8 @@ describe('AMQP Transport binding: commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand3.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function(done) { @@ -227,19 +252,33 @@ describe('AMQP Transport binding: commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply( + 200, + utils.readExampleFile( + './test/contextAvailabilityResponses/registerIoTAgent1Success.json' + ) + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus3.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus3.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') + ); request(configurationOptions, function(error, response, body) { request(provisionOptionsAlt, function(error, response, body) { diff --git a/test/unit/commandsPolling-test.js b/test/unit/commandsPolling-test.js index e31570ff..67c70044 100644 --- a/test/unit/commandsPolling-test.js +++ b/test/unit/commandsPolling-test.js @@ -40,8 +40,8 @@ describe('HTTP Transport binding: polling commands', function() { json: utils.readExampleFile('./test/contextRequests/updateCommand1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function(done) { @@ -51,8 +51,8 @@ describe('HTTP Transport binding: polling commands', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionCommand4.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -61,7 +61,12 @@ describe('HTTP Transport binding: polling commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); + .reply( + 200, + utils.readExampleFile( + './test/contextAvailabilityResponses/registerIoTAgent1Success.json' + ) + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -105,7 +110,10 @@ describe('HTTP Transport binding: polling commands', function() { it('should be stored in the commands collection', function(done) { request(commandOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( + error, + list + ) { should.not.exist(error); list.count.should.equal(1); list.commands[0].name.should.equal('PING'); @@ -120,27 +128,39 @@ describe('HTTP Transport binding: polling commands', function() { url: 'http://localhost:' + config.http.port + '/iot/json', method: 'POST', json: { - a: 23, + a: 23 }, qs: { i: 'MQTT_2', k: '1234', - getCmd: 1, - }, + getCmd: 1 + } }; beforeEach(function(done) { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/pollingMeasure.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/pollingMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/pollingMeasure.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/pollingMeasureSuccess.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus4.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus4Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus4.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus4Success.json') + ); request(commandOptions, done); }); @@ -167,7 +187,10 @@ describe('HTTP Transport binding: polling commands', function() { it('should remove them from the IoTAgent', function(done) { request(deviceRequest, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( + error, + list + ) { should.not.exist(error); list.count.should.equal(0); done(); @@ -181,13 +204,13 @@ describe('HTTP Transport binding: polling commands', function() { url: 'http://localhost:' + config.http.port + '/iot/json', method: 'POST', json: { - a: 23, + a: 23 }, qs: { i: 'MQTT_2', k: '1234', - getCmd: 1, - }, + getCmd: 1 + } }; var deviceRequestWithoutPayload = { @@ -197,22 +220,34 @@ describe('HTTP Transport binding: polling commands', function() { qs: { i: 'MQTT_2', k: '1234', - getCmd: 1, - }, + getCmd: 1 + } }; beforeEach(function(done) { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/pollingMeasure.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/pollingMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/pollingMeasure.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/pollingMeasureSuccess.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus4.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus4Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus4.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus4Success.json') + ); request(commandOptions, done); }); @@ -239,7 +274,10 @@ describe('HTTP Transport binding: polling commands', function() { it('should remove them from the IoTAgent', function(done) { request(deviceRequest, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( + error, + list + ) { should.not.exist(error); list.count.should.equal(0); done(); @@ -257,20 +295,26 @@ describe('HTTP Transport binding: polling commands', function() { uri: 'http://localhost:' + config.http.port + '/iot/json/commands', method: 'POST', json: { - PING: 'MADE_OK', + PING: 'MADE_OK' }, qs: { i: 'MQTT_2', - k: '1234', - }, + k: '1234' + } }; beforeEach(function(done) { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus5.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus4Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/updateStatus5.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/updateStatus4Success.json') + ); request(commandOptions, done); }); diff --git a/test/unit/configuration-api_test.js b/test/unit/configuration-api_test.js index eb13127e..f5b51eb7 100644 --- a/test/unit/configuration-api_test.js +++ b/test/unit/configuration-api_test.js @@ -45,8 +45,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, configurationOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -54,8 +54,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionConfiguration1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, configurationOptionsWithResource = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -63,8 +63,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionConfiguration2.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function(done) { @@ -74,7 +74,7 @@ describe('Configuration API support', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -83,7 +83,7 @@ describe('Configuration API support', function() { port: 8081, path: '/iot/protocols', protocol: 'TT_MQTT-JSON', - description: 'MQTT-JSON protocol for TT', + description: 'MQTT-JSON protocol for TT' }; config.iota.defaultResource = '/iotamqtt'; @@ -94,7 +94,7 @@ describe('Configuration API support', function() { description: 'MQTT-JSON protocol for TT', iotagent: 'http://localhost:4041', resource: '/iotamqtt', - services: [], + services: [] }) .reply(200, {}); @@ -102,7 +102,10 @@ describe('Configuration API support', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); iotagentMqtt.start(config, done); }); @@ -133,23 +136,31 @@ describe('Configuration API support', function() { entity_type: 'Light', resource: '', service: 'smartGondor', - service_path: '/gardens', - }, - ], + service_path: '/gardens' + } + ] }) .reply(200, {}); contextBrokerUnprovMock = nock('http://unexistentHost:1026') .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasure.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/singleMeasure.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') + ); }); it('should use the API Key of that configuration in device topics', function(done) { request(configurationOptions, function(error, response, body) { request(provisionOptions, function(error, response, body) { - mqttClient.publish('/728289/MQTT_2/attrs/temperature', '87', null, function(error) { + mqttClient.publish('/728289/MQTT_2/attrs/temperature', '87', null, function( + error + ) { setTimeout(function() { contextBrokerUnprovMock.done(); done(); @@ -177,9 +188,9 @@ describe('Configuration API support', function() { cbHost: 'http://unexistentHost:1026', resource: '/AnotherValue', service: 'smartGondor', - service_path: '/gardens', - }, - ], + service_path: '/gardens' + } + ] }; iotamMock.post('/iot/protocols', configurationProvision).reply(200, {}); diff --git a/test/unit/ngsiv2/HTTP_reveice_measures-test.js b/test/unit/ngsiv2/HTTP_reveice_measures-test.js index 5b81e30c..bde17543 100644 --- a/test/unit/ngsiv2/HTTP_reveice_measures-test.js +++ b/test/unit/ngsiv2/HTTP_reveice_measures-test.js @@ -51,17 +51,17 @@ var iotaJson = require('../../../'), attributes: [ { name: 'status', - type: 'Boolean', - }, + type: 'Boolean' + } ], - static_attributes: [], - }, - ], + static_attributes: [] + } + ] }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, contextBrokerMock, contextBrokerUnprovMock; @@ -71,11 +71,13 @@ describe('HTTP: Measure reception ', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDeviceHTTP.json'), + json: utils.readExampleFile( + './test/unit/ngsiv2/deviceProvisioning/provisionDeviceHTTP.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -111,19 +113,21 @@ describe('HTTP: Measure reception ', function() { temperature: '87', luminosity: 10, pollution: 43.4, - configuration: { firmware: { version: '1.1.0', hash: 'cf23df2207d99a74fbe169e3eba035e633b65d94' } }, + configuration: { + firmware: { version: '1.1.0', hash: 'cf23df2207d99a74fbe169e3eba035e633b65d94' } + }, tags: ['iot', 'device'], enabled: true, - alive: null, + alive: null }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'MQTT_2', - k: '1234', - }, + k: '1234' + } }; beforeEach(function() { @@ -132,7 +136,9 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -159,25 +165,27 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '111222', - TimeInstant: '20200222T222222', + TimeInstant: '20200222T222222' }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'dev0130101', - k: '1234', - }, + k: '1234' + } }, provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), + json: utils.readExampleFile( + './test/deviceProvisioning/provisionDeviceTimeinstant.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function(done) { @@ -196,7 +204,9 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/e0130101/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timeInstantMeasures.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/timeInstantMeasures.json' + ) ) .query({ type: 'sensor' }) .reply(204); @@ -230,26 +240,28 @@ describe('HTTP: Measure reception ', function() { url: 'http://localhost:' + config.http.port + '/iot/json', method: 'POST', json: { - humidity: '111222', + humidity: '111222' }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'dev0130101', k: '1234', - t: '20200222T222222', - }, + t: '20200222T222222' + } }, provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), + json: utils.readExampleFile( + './test/deviceProvisioning/provisionDeviceTimeinstant.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function(done) { @@ -268,7 +280,9 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/e0130101/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timeInstantMeasures.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/timeInstantMeasures.json' + ) ) .query({ type: 'sensor' }) .reply(204); @@ -303,16 +317,16 @@ describe('HTTP: Measure reception ', function() { method: 'POST', json: { humidity: '32', - temperature: '87', + temperature: '87' }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', + 'fiware-servicepath': '/gardens' }, qs: { i: 'JSON_UNPROVISIONED', - k: 'KL223HHV8732SFL1', - }, + k: 'KL223HHV8732SFL1' + } }; // This mock does not check the payload since the aim of the test is not to verify // device provisioning functionality. Appropriate verification is done in tests under @@ -329,7 +343,9 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/TheLightType:JSON_UNPROVISIONED/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedDevice.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/unprovisionedDevice.json' + ) ) .query({ type: 'TheLightType' }) .reply(204); diff --git a/test/unit/ngsiv2/MQTT_receive_measures-test.js b/test/unit/ngsiv2/MQTT_receive_measures-test.js index 034a5e1c..de634431 100644 --- a/test/unit/ngsiv2/MQTT_receive_measures-test.js +++ b/test/unit/ngsiv2/MQTT_receive_measures-test.js @@ -51,17 +51,17 @@ var iotaJson = require('../../../'), attributes: [ { name: 'status', - type: 'Boolean', - }, + type: 'Boolean' + } ], - static_attributes: [], - }, - ], + static_attributes: [] + } + ] }, headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, contextBrokerMock, contextBrokerUnprovMock, @@ -72,11 +72,13 @@ describe('MQTT: Measure reception ', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDevice1.json'), + json: utils.readExampleFile( + './test/unit/ngsiv2/deviceProvisioning/provisionDevice1.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -85,7 +87,7 @@ describe('MQTT: Measure reception ', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -119,7 +121,9 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -130,10 +134,12 @@ describe('MQTT: Measure reception ', function() { temperature: '87', luminosity: 10, pollution: 43.4, - configuration: { firmware: { version: '1.1.0', hash: 'cf23df2207d99a74fbe169e3eba035e633b65d94' } }, + configuration: { + firmware: { version: '1.1.0', hash: 'cf23df2207d99a74fbe169e3eba035e633b65d94' } + }, tags: ['iot', 'device'], enabled: true, - alive: null, + alive: null }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -161,7 +167,9 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/TheLightType:JSON_UNPROVISIONED/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedDevice.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/unprovisionedDevice.json' + ) ) .query({ type: 'TheLightType' }) .reply(204); @@ -173,17 +181,20 @@ describe('MQTT: Measure reception ', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - temperature: '87', + temperature: '87' }; - mqttClient.publish('/KL223HHV8732SFL1/JSON_UNPROVISIONED/attrs', JSON.stringify(values), null, function( - error - ) { - setTimeout(function() { - contextBrokerUnprovMock.done(); - done(); - }, 100); - }); + mqttClient.publish( + '/KL223HHV8732SFL1/JSON_UNPROVISIONED/attrs', + JSON.stringify(values), + null, + function(error) { + setTimeout(function() { + contextBrokerUnprovMock.done(); + done(); + }, 100); + } + ); }); }); @@ -202,7 +213,7 @@ describe('MQTT: Measure reception ', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - weight: '87', + weight: '87' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -221,7 +232,9 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timestampMeasure.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/timestampMeasure.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -230,7 +243,7 @@ describe('MQTT: Measure reception ', function() { var values = { humidity: '32', temperature: '87', - TimeInstant: '20071103T131805', + TimeInstant: '20071103T131805' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { diff --git a/test/unit/ngsiv2/amqpBinding-test.js b/test/unit/ngsiv2/amqpBinding-test.js index b48506b5..89c45007 100644 --- a/test/unit/ngsiv2/amqpBinding-test.js +++ b/test/unit/ngsiv2/amqpBinding-test.js @@ -64,8 +64,8 @@ describe('AMQP Transport binding: measures', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceAMQP1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -86,7 +86,7 @@ describe('AMQP Transport binding: measures', function() { [ apply(iotaJson.start, config), apply(request, provisionOptions), - apply(startConnection, config.amqp.exchange), + apply(startConnection, config.amqp.exchange) ], done ); @@ -108,7 +108,9 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -131,8 +133,8 @@ describe('AMQP Transport binding: measures', function() { json: utils.readExampleFile('./test/groupProvisioning/provisionFullGroupAMQP.json'), headers: { 'fiware-service': 'TestService', - 'fiware-servicepath': '/testingPath', - }, + 'fiware-servicepath': '/testingPath' + } }; beforeEach(function(done) { @@ -150,7 +152,9 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-servicepath', '/testingPath') .post( '/v2/entities/SensorMachine:JSON_UNPROVISIONED/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedMeasure.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/unprovisionedMeasure.json' + ) ) .query({ type: 'SensorMachine' }) .reply(204); @@ -161,7 +165,11 @@ describe('AMQP Transport binding: measures', function() { }); it('should send a new update context request to the Context Broker with just that attribute', function(done) { - channel.publish(config.amqp.exchange, '.80K09H324HV8732.JSON_UNPROVISIONED.attrs.a', new Buffer('23')); + channel.publish( + config.amqp.exchange, + '.80K09H324HV8732.JSON_UNPROVISIONED.attrs.a', + new Buffer('23') + ); setTimeout(function() { contextBrokerUnprovMock.done(); @@ -177,14 +185,23 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json' + ) ) .query({ type: 'AnMQTTDevice' }) - .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') + ); }); it('should send a single update context request with all the attributes', function(done) { - channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer(JSON.stringify({ a: '23' }))); + channel.publish( + config.amqp.exchange, + '.1234.MQTT_2.attrs', + new Buffer(JSON.stringify({ a: '23' })) + ); setTimeout(function() { contextBrokerMock.done(); @@ -200,13 +217,22 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json' + ) ) - .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') + ); }); it('should silently ignore the error (without crashing)', function(done) { - channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer('notAULPayload ')); + channel.publish( + config.amqp.exchange, + '.1234.MQTT_2.attrs', + new Buffer('notAULPayload ') + ); setTimeout(function() { done(); @@ -234,7 +260,7 @@ describe('AMQP Transport binding: measures', function() { new Buffer( JSON.stringify({ a: '23', - b: '98', + b: '98' }) ) ); diff --git a/test/unit/ngsiv2/attribute-alias_test.js b/test/unit/ngsiv2/attribute-alias_test.js index 32657ab1..ee29dec6 100644 --- a/test/unit/ngsiv2/attribute-alias_test.js +++ b/test/unit/ngsiv2/attribute-alias_test.js @@ -40,11 +40,13 @@ describe('Attribute alias', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDevice2.json'), + json: utils.readExampleFile( + './test/unit/ngsiv2/deviceProvisioning/provisionDevice2.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -53,7 +55,7 @@ describe('Attribute alias', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -87,7 +89,9 @@ describe('Attribute alias', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timestampAliasMeasure.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/timestampAliasMeasure.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -96,7 +100,7 @@ describe('Attribute alias', function() { var values = { humidity: '32', temperature: '87', - tt: '20071103T131805', + tt: '20071103T131805' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { diff --git a/test/unit/ngsiv2/bidirectionalityHttp-test.js b/test/unit/ngsiv2/bidirectionalityHttp-test.js index bd4bf006..27914bdd 100644 --- a/test/unit/ngsiv2/bidirectionalityHttp-test.js +++ b/test/unit/ngsiv2/bidirectionalityHttp-test.js @@ -40,11 +40,13 @@ describe('Data Bidirectionality: HTTP', function() { var notificationOptions = { url: 'http://localhost:' + config.iota.server.port + '/notify', method: 'POST', - json: utils.readExampleFile('./test/unit/ngsiv2/subscriptions/bidirectionalNotification.json'), + json: utils.readExampleFile( + './test/unit/ngsiv2/subscriptions/bidirectionalNotification.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; afterEach(function(done) { @@ -60,11 +62,13 @@ describe('Data Bidirectionality: HTTP', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectional.json'), + json: utils.readExampleFile( + './test/deviceProvisioning/provisionCommandBidirectional.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -83,7 +87,10 @@ describe('Data Bidirectionality: HTTP', function() { return false; } else if (moment(body.expires, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isValid()) { expectedBody.expires = moment().add(config.deviceRegistrationDuration); - var expiresDiff = moment(expectedBody.expires).diff(body.expires, 'milliseconds'); + var expiresDiff = moment(expectedBody.expires).diff( + body.expires, + 'milliseconds' + ); if (expiresDiff < 500) { delete expectedBody.expires; delete body.expires; @@ -103,7 +110,9 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities?options=upsert', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json' + ) ) .reply(204); @@ -124,7 +133,10 @@ describe('Data Bidirectionality: HTTP', function() { it('should leave the data in the polling queue', function(done) { request(notificationOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( + error, + list + ) { should.not.exist(error); list.commands.length.should.equal(3); @@ -135,7 +147,10 @@ describe('Data Bidirectionality: HTTP', function() { it('should send all the data from the notification in command syntax', function(done) { request(notificationOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( + error, + list + ) { var latitudeFound = false, longitudeFound = false; @@ -171,11 +186,13 @@ describe('Data Bidirectionality: HTTP', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json'), + json: utils.readExampleFile( + './test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json' + ), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -194,7 +211,10 @@ describe('Data Bidirectionality: HTTP', function() { return false; } else if (moment(body.expires, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isValid()) { expectedBody.expires = moment().add(config.deviceRegistrationDuration); - var expiresDiff = moment(expectedBody.expires).diff(body.expires, 'milliseconds'); + var expiresDiff = moment(expectedBody.expires).diff( + body.expires, + 'milliseconds' + ); if (expiresDiff < 500) { delete expectedBody.expires; delete body.expires; @@ -214,7 +234,9 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities?options=upsert', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json' + ) ) .reply(204); diff --git a/test/unit/ngsiv2/config-test.js b/test/unit/ngsiv2/config-test.js index 64de0653..b61800c1 100644 --- a/test/unit/ngsiv2/config-test.js +++ b/test/unit/ngsiv2/config-test.js @@ -27,18 +27,18 @@ var config = {}; config.mqtt = { host: 'localhost', port: 1883, - thinkingThingsPlugin: true, + thinkingThingsPlugin: true }; config.http = { - port: 7896, + port: 7896 }; config.amqp = { port: 5672, exchange: 'amq.topic', queue: 'iota_queue', - options: { durable: true }, + options: { durable: true } }; config.iota = { @@ -46,13 +46,13 @@ config.iota = { contextBroker: { host: '192.168.1.1', port: '1026', - ngsiVersion: 'v2', + ngsiVersion: 'v2' }, server: { - port: 4041, + port: 4041 }, deviceRegistry: { - type: 'memory', + type: 'memory' }, types: {}, service: 'howtoService', @@ -61,7 +61,7 @@ config.iota = { deviceRegistrationDuration: 'P1M', defaultType: 'Thing', defaultResource: '/iot/json', - compressTimestamp: true, + compressTimestamp: true }; config.defaultKey = '1234'; diff --git a/test/unit/ngsiv2/configuration-api_test.js b/test/unit/ngsiv2/configuration-api_test.js index 4b79b536..a034b8f5 100644 --- a/test/unit/ngsiv2/configuration-api_test.js +++ b/test/unit/ngsiv2/configuration-api_test.js @@ -47,8 +47,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, configurationOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -56,8 +56,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionConfiguration1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }, configurationOptionsWithResource = { url: 'http://localhost:' + config.iota.server.port + '/iot/services', @@ -65,8 +65,8 @@ describe('Configuration API support', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionConfiguration2.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; beforeEach(function(done) { @@ -76,7 +76,7 @@ describe('Configuration API support', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -85,7 +85,7 @@ describe('Configuration API support', function() { port: 8081, path: '/iot/protocols', protocol: 'TT_MQTT-JSON', - description: 'MQTT-JSON protocol for TT', + description: 'MQTT-JSON protocol for TT' }; config.iota.defaultResource = '/iotamqtt'; @@ -96,7 +96,7 @@ describe('Configuration API support', function() { description: 'MQTT-JSON protocol for TT', iotagent: 'http://localhost:4041', resource: '/iotamqtt', - services: [], + services: [] }) .reply(200, {}); @@ -137,9 +137,9 @@ describe('Configuration API support', function() { entity_type: 'Light', resource: '', service: 'smartGondor', - service_path: '/gardens', - }, - ], + service_path: '/gardens' + } + ] }) .reply(200, {}); @@ -157,7 +157,9 @@ describe('Configuration API support', function() { it('should use the API Key of that configuration in device topics', function(done) { request(configurationOptions, function(error, response, body) { request(provisionOptions, function(error, response, body) { - mqttClient.publish('/728289/MQTT_2/attrs/temperature', '87', null, function(error) { + mqttClient.publish('/728289/MQTT_2/attrs/temperature', '87', null, function( + error + ) { setTimeout(function() { contextBrokerUnprovMock.done(); done(); @@ -185,9 +187,9 @@ describe('Configuration API support', function() { cbHost: 'http://unexistentHost:1026', resource: '/AnotherValue', service: 'smartGondor', - service_path: '/gardens', - }, - ], + service_path: '/gardens' + } + ] }; iotamMock.post('/iot/protocols', configurationProvision).reply(200, {}); diff --git a/test/unit/ngsiv2/subscription-management_test.js b/test/unit/ngsiv2/subscription-management_test.js index ae6edb7c..a6cd2ca9 100644 --- a/test/unit/ngsiv2/subscription-management_test.js +++ b/test/unit/ngsiv2/subscription-management_test.js @@ -43,15 +43,15 @@ describe('Subscription management', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; function sendMeasures(humidity, temperature) { return function(callback) { var values = { humidity: humidity, - temperature: temperature, + temperature: temperature }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -73,7 +73,7 @@ describe('Subscription management', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -104,7 +104,9 @@ describe('Subscription management', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasures.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/multipleMeasures.json' + ) ) .reply(204); @@ -113,7 +115,9 @@ describe('Subscription management', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/alternativeUpdate.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/alternativeUpdate.json' + ) ) .reply(204); }); @@ -126,7 +130,7 @@ describe('Subscription management', function() { waitForMqttRelay(50), iotaJson.stop, sendMeasures('53', '1'), - waitForMqttRelay(50), + waitForMqttRelay(50) ], function(error, results) { should.not.exist(error); @@ -144,7 +148,9 @@ describe('Subscription management', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasures.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/multipleMeasures.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -154,7 +160,9 @@ describe('Subscription management', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/alternativeUpdate.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/alternativeUpdate.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -174,7 +182,7 @@ describe('Subscription management', function() { async.apply(iotaJson.start, config), waitForMqttRelay(50), sendMeasures('53', '1'), - waitForMqttRelay(50), + waitForMqttRelay(50) ], function(error, results) { should.not.exist(error); diff --git a/test/unit/ngsiv2/supportThinkingThingModules_test.js b/test/unit/ngsiv2/supportThinkingThingModules_test.js index 43b64acc..a6a58c58 100644 --- a/test/unit/ngsiv2/supportThinkingThingModules_test.js +++ b/test/unit/ngsiv2/supportThinkingThingModules_test.js @@ -43,8 +43,8 @@ describe('Support for Thinking Things Modules', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -53,7 +53,7 @@ describe('Support for Thinking Things Modules', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -94,7 +94,7 @@ describe('Support for Thinking Things Modules', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - P1: '214,7,d22,b00,-64,', + P1: '214,7,d22,b00,-64,' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -113,7 +113,9 @@ describe('Support for Thinking Things Modules', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleP1Single.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/TTModuleP1Single.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -145,7 +147,7 @@ describe('Support for Thinking Things Modules', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - C1: '00D600070d220b00', + C1: '00D600070d220b00' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -164,7 +166,9 @@ describe('Support for Thinking Things Modules', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleC1Single.json') + utils.readExampleFile( + './test/unit/ngsiv2/contextRequests/TTModuleC1Single.json' + ) ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -196,7 +200,7 @@ describe('Support for Thinking Things Modules', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - B: '4.70,1,1,1,1,0', + B: '4.70,1,1,1,1,0' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -223,7 +227,7 @@ describe('Support for Thinking Things Modules', function() { it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - B: '4.70,1,1,1,1,0,9,18', + B: '4.70,1,1,1,1,0,9,18' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { diff --git a/test/unit/subscription-management_test.js b/test/unit/subscription-management_test.js index 56cf43dd..c48d6057 100644 --- a/test/unit/subscription-management_test.js +++ b/test/unit/subscription-management_test.js @@ -41,15 +41,15 @@ describe('Subscription management', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; function sendMeasures(humidity, temperature) { return function(callback) { var values = { humidity: humidity, - temperature: temperature, + temperature: temperature }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -71,7 +71,7 @@ describe('Subscription management', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -79,7 +79,10 @@ describe('Subscription management', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); iotagentMqtt.start(config, function() { iotAgentLib.clearAll(done); @@ -97,14 +100,26 @@ describe('Subscription management', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasures.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/multipleMeasures.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/alternativeUpdate.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/alternativeUpdate.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); }); it('should cease sending measures to the CB', function(done) { @@ -115,7 +130,7 @@ describe('Subscription management', function() { waitForMqttRelay(50), iotagentMqtt.stop, sendMeasures('53', '1'), - waitForMqttRelay(50), + waitForMqttRelay(50) ], function(error, results) { should.not.exist(error); @@ -131,14 +146,26 @@ describe('Subscription management', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasures.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/multipleMeasures.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/alternativeUpdate.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/alternativeUpdate.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); }); afterEach(function(done) { @@ -155,7 +182,7 @@ describe('Subscription management', function() { async.apply(iotagentMqtt.start, config), waitForMqttRelay(50), sendMeasures('53', '1'), - waitForMqttRelay(50), + waitForMqttRelay(50) ], function(error, results) { should.not.exist(error); diff --git a/test/unit/supportThinkingThingModules_test.js b/test/unit/supportThinkingThingModules_test.js index b16df5c9..a22ed9c5 100644 --- a/test/unit/supportThinkingThingModules_test.js +++ b/test/unit/supportThinkingThingModules_test.js @@ -41,8 +41,8 @@ describe('Support for Thinking Things Modules', function() { json: utils.readExampleFile('./test/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', - 'fiware-servicepath': '/gardens', - }, + 'fiware-servicepath': '/gardens' + } }; nock.cleanAll(); @@ -51,7 +51,7 @@ describe('Support for Thinking Things Modules', function() { 'mqtt://' + config.mqtt.host, { keepalive: 0, - connectTimeout: 60 * 60 * 1000, + connectTimeout: 60 * 60 * 1000 } ); @@ -59,7 +59,10 @@ describe('Support for Thinking Things Modules', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); + .reply( + 200, + utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') + ); iotagentMqtt.start(config, function() { request(provisionOptions, function(error, response, body) { @@ -79,13 +82,19 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleP1.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleP1Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/TTModuleP1.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/TTModuleP1Success.json') + ); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - P1: '214,7,d22,b00,-64,', + P1: '214,7,d22,b00,-64,' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -102,8 +111,14 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleP1Single.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleP1SingleSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/TTModuleP1Single.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/TTModuleP1SingleSuccess.json') + ); }); it('should send its value to the Context Broker', function(done) { var values = '214,7,d22,b00,-64,'; @@ -122,13 +137,19 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleC1.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleP1Success.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/TTModuleC1.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/TTModuleP1Success.json') + ); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - C1: '00D600070d220b00', + C1: '00D600070d220b00' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -145,8 +166,14 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleC1Single.json')) - .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleP1SingleSuccess.json')); + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/TTModuleC1Single.json') + ) + .reply( + 200, + utils.readExampleFile('./test/contextResponses/TTModuleP1SingleSuccess.json') + ); }); it('should send its value to the Context Broker', function(done) { var values = '00D600070d220b00'; @@ -165,13 +192,16 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleB.json')) + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/TTModuleB.json') + ) .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleBSuccess.json')); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - B: '4.70,1,1,1,1,0', + B: '4.70,1,1,1,1,0' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { @@ -188,13 +218,16 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleBLong.json')) + .post( + '/v1/updateContext', + utils.readExampleFile('./test/contextRequests/TTModuleBLong.json') + ) .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleBSuccess.json')); }); it('should send its value to the Context Broker', function(done) { var values = { humidity: '32', - B: '4.70,1,1,1,1,0,9,18', + B: '4.70,1,1,1,1,0,9,18' }; mqttClient.publish('/1234/MQTT_2/attrs', JSON.stringify(values), null, function(error) { From 22fc6cc3124c3ae3bec38a2840651662b28a1459 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Thu, 7 Feb 2019 22:05:39 +0100 Subject: [PATCH 12/15] Add command --- docs/usermanual.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/usermanual.md b/docs/usermanual.md index 1e945c28..a8fcc27b 100644 --- a/docs/usermanual.md +++ b/docs/usermanual.md @@ -441,6 +441,16 @@ Removes `node_modules` and `coverage` folders, and `package-lock.json` file so npm run clean ``` +### Prettify Code + +Runs the [prettier](https://prettier.io) code formatter to ensure consistent code style (whitespacing, parameter +placement and breakup of long lines etc.) within the codebase. + +```bash +# Use git-bash on Windows +npm run prettier +``` + ## New transport development ### Overview From f90c273e50e0404613bfc0698a2d840172cc13d2 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Sat, 23 Feb 2019 01:09:42 +0100 Subject: [PATCH 13/15] Re-run prettier at 120 width --- .prettierrc.json | 2 +- bin/iotaJsonTester.js | 6 +- lib/bindings/AMQPBinding.js | 19 +-- lib/bindings/HTTPBinding.js | 71 ++-------- lib/bindings/MQTTBinding.js | 23 +-- lib/commandHandler.js | 17 +-- lib/commonBindings.js | 41 +----- lib/configService.js | 3 +- lib/errors.js | 13 +- lib/iotaUtils.js | 21 +-- lib/iotagent-json.js | 44 ++---- lib/thinkingThingPlugin.js | 22 +-- lib/timestampProcessPlugin.js | 14 +- lib/transportSelector.js | 16 +-- test/unit/HTTP_commands_test.js | 27 +--- test/unit/HTTP_get-configuration_test.js | 27 +--- test/unit/HTTP_reveice_measures-test.js | 68 ++------- test/unit/MQTT_commands_test.js | 31 +--- test/unit/MQTT_get-configuration_test.js | 132 +++++++----------- test/unit/MQTT_receive_measures-test.js | 79 +++-------- test/unit/amqpBinding-test.js | 78 ++--------- test/unit/attribute-alias_test.js | 15 +- test/unit/bidirectionalityHttp-test.js | 56 ++------ test/unit/commandsAmqp-test.js | 61 ++------ test/unit/commandsPolling-test.js | 72 ++-------- test/unit/configuration-api_test.js | 19 +-- .../unit/ngsiv2/HTTP_reveice_measures-test.js | 28 +--- .../unit/ngsiv2/MQTT_receive_measures-test.js | 35 ++--- test/unit/ngsiv2/amqpBinding-test.js | 44 ++---- test/unit/ngsiv2/attribute-alias_test.js | 8 +- test/unit/ngsiv2/bidirectionalityHttp-test.js | 40 ++---- test/unit/ngsiv2/configuration-api_test.js | 4 +- .../ngsiv2/subscription-management_test.js | 16 +-- .../supportThinkingThingModules_test.js | 8 +- test/unit/subscription-management_test.js | 45 ++---- test/unit/supportThinkingThingModules_test.js | 55 ++------ 36 files changed, 290 insertions(+), 970 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index e8ed7737..8238852e 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,7 +3,7 @@ "bracketSpacing": true, "singleQuote": true, "parser": "flow", - "printWidth": 100, + "printWidth": 120, "trailingComma": "none", "tabWidth": 4 } \ No newline at end of file diff --git a/bin/iotaJsonTester.js b/bin/iotaJsonTester.js index 8ef4331d..c8ecedc2 100755 --- a/bin/iotaJsonTester.js +++ b/bin/iotaJsonTester.js @@ -138,14 +138,12 @@ function exitClient() { var commands = { config: { parameters: ['host', 'port', 'apiKey', 'deviceId'], - description: - '\tConfigure the client to emulate the selected device, connecting to the given host.', + description: '\tConfigure the client to emulate the selected device, connecting to the given host.', handler: setConfig }, showConfig: { parameters: [], - description: - '\tConfigure the client to emulate the selected device, connecting to the given host.', + description: '\tConfigure the client to emulate the selected device, connecting to the given host.', handler: getConfig }, connect: { diff --git a/lib/bindings/AMQPBinding.js b/lib/bindings/AMQPBinding.js index f54d3e8b..b55ec0de 100644 --- a/lib/bindings/AMQPBinding.js +++ b/lib/bindings/AMQPBinding.js @@ -53,11 +53,7 @@ function executeCommand(apiKey, device, serializedPayload, callback) { serializedPayload ); - amqpChannel.assertExchange( - config.getConfig().amqp.exchange, - 'topic', - config.getConfig().amqp.options - ); + amqpChannel.assertExchange(config.getConfig().amqp.exchange, 'topic', config.getConfig().amqp.options); amqpChannel.publish( config.getConfig().amqp.exchange, '.' + apiKey + '.' + device.id + '.cmd', @@ -207,15 +203,12 @@ function start(callback) { callback(); } - async.waterfall( - [createConnection, createChannel, assertExchange, assertQueue, createListener], - function(error) { - if (error) { - config.getLogger().debug('AMQP error %j', error); - } - callback(); + async.waterfall([createConnection, createChannel, assertExchange, assertQueue, createListener], function(error) { + if (error) { + config.getLogger().debug('AMQP error %j', error); } - ); + callback(); + }); } /** diff --git a/lib/bindings/HTTPBinding.js b/lib/bindings/HTTPBinding.js index c7e0b11d..301cc72c 100644 --- a/lib/bindings/HTTPBinding.js +++ b/lib/bindings/HTTPBinding.js @@ -130,15 +130,7 @@ function executeCommand(apiKey, device, serializedPayload, callback) { try { parsedBody = JSON.parse(body); - process.nextTick( - commandHandler.updateCommand.bind( - null, - apiKey, - device.id, - device, - parsedBody - ) - ); + process.nextTick(commandHandler.updateCommand.bind(null, apiKey, device.id, device, parsedBody)); callback(); } catch (e) { @@ -164,12 +156,7 @@ function handleIncomingMeasure(req, res, next) { config .getLogger() - .debug( - context, - 'Processing multiple HTTP measures for device [%s] with apiKey [%s]', - req.deviceId, - req.apiKey - ); + .debug(context, 'Processing multiple HTTP measures for device [%s] with apiKey [%s]', req.deviceId, req.apiKey); function updateCommandHandler(error) { if (error) { @@ -223,14 +210,7 @@ function handleIncomingMeasure(req, res, next) { async.parallel(executions, updateCommandHandler); } else { if (values.length > 0) { - iotAgentLib.update( - device.name, - device.type, - '', - values, - device, - updateCommandHandler - ); + iotAgentLib.update(device.name, device.type, '', values, device, updateCommandHandler); } else { next(); } @@ -258,8 +238,7 @@ function handleIncomingMeasure(req, res, next) { function isCommand(req, res, next) { if ( req.path === - (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + - constants.HTTP_COMMANDS_PATH + (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_COMMANDS_PATH ) { req.isCommand = true; } @@ -386,13 +365,7 @@ function returnCommands(req, res, next) { } function cleanCommand(command) { - return apply( - iotAgentLib.removeCommand, - device.service, - device.subservice, - device.id, - command.name - ); + return apply(iotAgentLib.removeCommand, device.service, device.subservice, device.id, command.name); } updates = commandList.map(createCommandUpdate); @@ -439,16 +412,11 @@ function returnCommands(req, res, next) { } } if (req.query && req.query.getCmd === '1') { - iotAgentLib.commandQueue(req.device.service, req.device.subservice, req.deviceId, function( - error, - list - ) { + iotAgentLib.commandQueue(req.device.service, req.device.subservice, req.deviceId, function(error, list) { if (error || !list || list.count === 0) { res.status(200).send(''); } else { - res.status(200).send( - JSON.stringify(list.commands.map(parseCommand).reduce(concatCommand, {})) - ); + res.status(200).send(JSON.stringify(list.commands.map(parseCommand).reduce(concatCommand, {}))); process.nextTick(updateCommandStatus.bind(null, req.device, list.commands)); } @@ -470,17 +438,12 @@ function start(callback) { if (!config.getConfig().http) { config .getLogger() - .fatal( - context, - 'GLOBAL-002: Configuration error. Configuration object [config.http] is missing' - ); + .fatal(context, 'GLOBAL-002: Configuration error. Configuration object [config.http] is missing'); callback(new errors.ConfigurationError('config.http')); return; } - config - .getLogger() - .info(context, 'HTTP Binding listening on port [%s]', config.getConfig().http.port); + config.getLogger().info(context, 'HTTP Binding listening on port [%s]', config.getConfig().http.port); httpBindingServer.app.set('port', config.getConfig().http.port); httpBindingServer.app.set('host', config.getConfig().http.host || '0.0.0.0'); @@ -505,8 +468,7 @@ function start(callback) { ); httpBindingServer.router.post( - (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + - constants.HTTP_COMMANDS_PATH, + (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_COMMANDS_PATH, bodyParser.json(), checkMandatoryParams(false), parseData, @@ -517,8 +479,7 @@ function start(callback) { ); httpBindingServer.router.post( - (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + - constants.HTTP_CONFIGURATION_PATH, + (config.getConfig().iota.defaultResource || constants.HTTP_MEASURE_PATH) + constants.HTTP_CONFIGURATION_PATH, bodyParser.json(), checkMandatoryParams(false), parseData, @@ -530,11 +491,7 @@ function start(callback) { httpBindingServer.server = http.createServer(httpBindingServer.app); - httpBindingServer.server.listen( - httpBindingServer.app.get('port'), - httpBindingServer.app.get('host'), - callback - ); + httpBindingServer.server.listen(httpBindingServer.app.get('port'), httpBindingServer.app.get('host'), callback); } function stop(callback) { @@ -551,9 +508,7 @@ function stop(callback) { } function sendPushNotifications(device, values, callback) { - var executions = _.flatten( - values.map(commandHandler.generateCommandExecution.bind(null, null, device)) - ); + var executions = _.flatten(values.map(commandHandler.generateCommandExecution.bind(null, null, device))); async.series(executions, function(error) { callback(error); diff --git a/lib/bindings/MQTTBinding.js b/lib/bindings/MQTTBinding.js index 917168e0..633c20c1 100644 --- a/lib/bindings/MQTTBinding.js +++ b/lib/bindings/MQTTBinding.js @@ -44,9 +44,7 @@ function generateTopics(callback) { config.getLogger().debug(context, 'Generating topics'); topics.push('/+/+/' + constants.MEASURES_SUFIX + '/+'); topics.push('/+/+/' + constants.MEASURES_SUFIX); - topics.push( - '/+/+/' + constants.CONFIGURATION_SUFIX + '/' + constants.CONFIGURATION_COMMAND_SUFIX - ); + topics.push('/+/+/' + constants.CONFIGURATION_SUFIX + '/' + constants.CONFIGURATION_COMMAND_SUFIX); topics.push('/+/+/' + constants.CONFIGURATION_COMMAND_UPDATE); callback(null, topics); @@ -64,19 +62,11 @@ function recreateSubscriptions(callback) { mqttClient.subscribe(topics, null, function(error) { if (error) { iotAgentLib.alarms.raise(constants.MQTTB_ALARM, error); - config - .getLogger() - .error(context, 'GLOBAL-001: Error subscribing to topics: %s', error); + config.getLogger().error(context, 'GLOBAL-001: Error subscribing to topics: %s', error); callback(error); } else { iotAgentLib.alarms.release(constants.MQTTB_ALARM); - config - .getLogger() - .debug( - context, - 'Successfully subscribed to the following topics:\n%j\n', - topics - ); + config.getLogger().debug(context, 'Successfully subscribed to the following topics:\n%j\n', topics); callback(null); } }); @@ -102,9 +92,7 @@ function sendConfigurationToDevice(apiKey, deviceId, results, callback) { if (config.getConfig().mqtt.retain === true) { options.retain = config.getConfig().mqtt.retain; } - config - .getLogger() - .debug(context, 'Sending requested configuration to the device:\n %j', configurations); + config.getLogger().debug(context, 'Sending requested configuration to the device:\n %j', configurations); mqttClient.publish( '/' + @@ -139,8 +127,7 @@ function unsubscribeAll(callback) { */ function start(callback) { var mqttConfig = config.getConfig().mqtt; - var rejectUnauthorized = - typeof mqttConfig.rejectUnauthorized === 'boolean' ? mqttConfig.rejectUnauthorized : true; + var rejectUnauthorized = typeof mqttConfig.rejectUnauthorized === 'boolean' ? mqttConfig.rejectUnauthorized : true; var options = { protocol: mqttConfig.protocol ? mqttConfig.protocol : 'mqtt', host: mqttConfig.host ? mqttConfig.host : 'localhost', diff --git a/lib/commandHandler.js b/lib/commandHandler.js index a98256b6..2f966a0f 100644 --- a/lib/commandHandler.js +++ b/lib/commandHandler.js @@ -83,13 +83,7 @@ function generateCommandExecution(apiKey, device, attribute) { function commandHandler(id, type, service, subservice, attributes, callback) { config .getLogger() - .debug( - context, - 'Handling MQTT command for device [%s] in service [%s - %s]', - id, - service, - subservice - ); + .debug(context, 'Handling MQTT command for device [%s] in service [%s - %s]', id, service, subservice); function concat(previous, current) { previous = previous.concat(current); @@ -108,17 +102,12 @@ function commandHandler(id, type, service, subservice, attributes, callback) { ); callback(error); } else { - iotaUtils.getEffectiveApiKey(device.service, device.subservice, function( - error, - apiKey - ) { + iotaUtils.getEffectiveApiKey(device.service, device.subservice, function(error, apiKey) { if (error) { callback(error); } else { async.series( - attributes - .map(generateCommandExecution.bind(null, apiKey, device)) - .reduce(concat, []), + attributes.map(generateCommandExecution.bind(null, apiKey, device)).reduce(concat, []), callback ); } diff --git a/lib/commonBindings.js b/lib/commonBindings.js index bbf0402c..1dfaf798 100644 --- a/lib/commonBindings.js +++ b/lib/commonBindings.js @@ -49,16 +49,12 @@ function parseMessage(message) { stringMessage = message.toString(); parsedMessage = JSON.parse(stringMessage); } catch (e) { - config - .getLogger() - .debug(context, 'Parse error treating message [%s]: %j', stringMessage, e); + config.getLogger().debug(context, 'Parse error treating message [%s]: %j', stringMessage, e); parsedMessage = null; } if (!parsedMessage) { - config - .getLogger() - .error(context, 'MEASURES-003: Impossible to handle malformed message: %s', message); + config.getLogger().error(context, 'MEASURES-003: Impossible to handle malformed message: %s', message); } return parsedMessage; @@ -141,12 +137,7 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { iotAgentLib.alarms.release(constants.MQTTB_ALARM); config .getLogger() - .debug( - context, - 'Configuration request finished for APIKey [%s] and Device [%s]', - apiKey, - deviceId - ); + .debug(context, 'Configuration request finished for APIKey [%s] and Device [%s]', apiKey, deviceId); } } ); @@ -165,14 +156,7 @@ function manageConfigurationRequest(apiKey, deviceId, device, objMessage) { function singleMeasure(apiKey, deviceId, attribute, device, message) { var values; - config - .getLogger() - .debug( - context, - 'Processing single measure for device [%s] with apiKey [%s]', - deviceId, - apiKey - ); + config.getLogger().debug(context, 'Processing single measure for device [%s] with apiKey [%s]', deviceId, apiKey); values = [ { @@ -218,12 +202,7 @@ function multipleMeasures(apiKey, deviceId, device, messageObj) { config .getLogger() - .debug( - context, - 'Processing multiple measures for device [%s] with apiKey [%s]', - deviceId, - apiKey - ); + .debug(context, 'Processing multiple measures for device [%s] with apiKey [%s]', deviceId, apiKey); for (var i in messageObj) { if (messageObj.hasOwnProperty(i)) { @@ -272,15 +251,9 @@ function messageHandler(topic, message, protocol) { function processDeviceMeasure(error, device) { if (error) { - config - .getLogger() - .error(context, 'MEASURES-004: Device not found for topic [%s]', topic); + config.getLogger().error(context, 'MEASURES-004: Device not found for topic [%s]', topic); } else { - if ( - topicInformation[3] === 'configuration' && - topicInformation[4] === 'commands' && - parsedMessage - ) { + if (topicInformation[3] === 'configuration' && topicInformation[4] === 'commands' && parsedMessage) { manageConfigurationRequest(apiKey, deviceId, device, parsedMessage); } else if (topicInformation[4]) { singleMeasure(apiKey, deviceId, topicInformation[4], device, message); diff --git a/lib/configService.js b/lib/configService.js index 829e8ac7..c4c9064d 100644 --- a/lib/configService.js +++ b/lib/configService.js @@ -128,8 +128,7 @@ function processEnvironmentVariables() { } if (process.env.IOTA_MQTT_REJECT_UNAUTHORIZED) { - config.mqtt.rejectUnauthorized = - process.env.IOTA_MQTT_REJECT_UNAUTHORIZED.trim().toLowerCase() === 'true'; + config.mqtt.rejectUnauthorized = process.env.IOTA_MQTT_REJECT_UNAUTHORIZED.trim().toLowerCase() === 'true'; } if (process.env.IOTA_MQTT_USERNAME) { diff --git a/lib/errors.js b/lib/errors.js index 70613544..c04a9eec 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -36,8 +36,7 @@ module.exports = { }, GroupNotFound: function(service, subservice) { this.name = 'GROUP_NOT_FOUND'; - this.message = - 'Group not found for service [' + service + '] and subservice [' + subservice + ']'; + this.message = 'Group not found for service [' + service + '] and subservice [' + subservice + ']'; }, MandatoryParamsNotFound: function(paramList) { this.name = 'MANDATORY_PARAMS_NOT_FOUND'; @@ -70,8 +69,7 @@ module.exports = { }, HTTPCommandResponseError: function(code, error) { this.name = 'HTTP_COMMAND_RESPONSE_ERROR'; - this.message = - 'There was an error in the response of a device to a command [' + code + ' ]:' + error; + this.message = 'There was an error in the response of a device to a command [' + code + ' ]:' + error; this.code = 400; }, EndpointNotFound: function(id) { @@ -81,12 +79,7 @@ module.exports = { }, DeviceEndpointError: function(code, msg) { this.name = 'DEVICE_ENDPOINT_ERROR'; - this.message = - 'Request to the device ended up in error with code [' + - code + - ' ] and message [' + - msg + - ']'; + this.message = 'Request to the device ended up in error with code [' + code + ' ] and message [' + msg + ']'; this.code = code; } }; diff --git a/lib/iotaUtils.js b/lib/iotaUtils.js index 7a6b9bf8..cab28fc8 100644 --- a/lib/iotaUtils.js +++ b/lib/iotaUtils.js @@ -46,9 +46,7 @@ function getEffectiveApiKey(service, subservice, callback) { config.getLogger().debug(context, 'Using found group: %j', group); callback(null, group.apikey); } else if (config.getConfig().defaultKey) { - config - .getLogger() - .debug(context, 'Using default API Key: %s', config.getConfig().defaultKey); + config.getLogger().debug(context, 'Using default API Key: %s', config.getConfig().defaultKey); callback(null, config.getConfig().defaultKey); } else { config.getLogger().error(context, 'Could not find any API Key information for device.'); @@ -70,12 +68,7 @@ function manageConfiguration(apiKey, deviceId, device, objMessage, sendFunction, } else { config .getLogger() - .debug( - context, - 'Configuration attributes sent to the device successfully.', - deviceId, - apiKey - ); + .debug(context, 'Configuration attributes sent to the device successfully.', deviceId, apiKey); } callback(error); @@ -129,9 +122,7 @@ function manageConfiguration(apiKey, deviceId, device, objMessage, sendFunction, callback(error); }); } else { - config - .getLogger() - .error(context, 'CONFIG-003: Unknown command type from device [%s]', device.name); + config.getLogger().error(context, 'CONFIG-003: Unknown command type from device [%s]', device.name); callback(); } } @@ -212,11 +203,7 @@ function retrieveDevice(deviceId, apiKey, transport, callback) { } else { async.waterfall( [ - apply( - iotAgentLib.getConfiguration, - config.getConfig().iota.defaultResource || '', - apiKey - ), + apply(iotAgentLib.getConfiguration, config.getConfig().iota.defaultResource || '', apiKey), apply(findOrCreate, deviceId, transport), apply( iotAgentLib.mergeDeviceWithConfiguration, diff --git a/lib/iotagent-json.js b/lib/iotagent-json.js index d67d2013..13998938 100644 --- a/lib/iotagent-json.js +++ b/lib/iotagent-json.js @@ -54,10 +54,7 @@ function configurationNotificationHandler(device, updates, callback) { } async.waterfall( - [ - apply(iotaUtils.getEffectiveApiKey, device.service, device.subservice), - invokeConfiguration - ], + [apply(iotaUtils.getEffectiveApiKey, device.service, device.subservice), invokeConfiguration], callback ); } @@ -103,18 +100,13 @@ function bidirectionalityNotificationHandler(device, updates, callback) { * @param {Object} device Device provisioning information. */ function deviceProvisioningHandler(device, callback) { - transportSelector.applyFunctionFromBinding( - [device], - 'deviceProvisioningHandler', - null, - function(error, devices) { - if (error) { - callback(error); - } else { - callback(null, devices[0]); - } + transportSelector.applyFunctionFromBinding([device], 'deviceProvisioningHandler', null, function(error, devices) { + if (error) { + callback(error); + } else { + callback(null, devices[0]); } - ); + }); } /** @@ -149,21 +141,13 @@ function start(newConfig, callback) { iotAgentLib.addUpdateMiddleware(thinkingThingPlugin.updatePlugin); } - iotAgentLib.addUpdateMiddleware( - iotAgentLib.dataPlugins.expressionTransformation.update - ); + iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.expressionTransformation.update); iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.multiEntity.update); iotAgentLib.addUpdateMiddleware(iotAgentLib.dataPlugins.timestampProcess.update); - iotAgentLib.addDeviceProvisionMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.deviceProvision - ); - iotAgentLib.addConfigurationProvisionMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.groupProvision - ); - iotAgentLib.addNotificationMiddleware( - iotAgentLib.dataPlugins.bidirectionalData.notification - ); + iotAgentLib.addDeviceProvisionMiddleware(iotAgentLib.dataPlugins.bidirectionalData.deviceProvision); + iotAgentLib.addConfigurationProvisionMiddleware(iotAgentLib.dataPlugins.bidirectionalData.groupProvision); + iotAgentLib.addNotificationMiddleware(iotAgentLib.dataPlugins.bidirectionalData.notification); if (config.getConfig().configRetrieval) { iotAgentLib.setNotificationHandler(configurationNotificationHandler); @@ -183,11 +167,7 @@ function start(newConfig, callback) { function stop(callback) { config.getLogger().info(context, 'Stopping IoT Agent'); async.series( - [ - transportSelector.stopTransportBindings, - iotAgentLib.resetMiddlewares, - iotAgentLib.deactivate - ], + [transportSelector.stopTransportBindings, iotAgentLib.resetMiddlewares, iotAgentLib.deactivate], callback ); } diff --git a/lib/thinkingThingPlugin.js b/lib/thinkingThingPlugin.js index 1032d3cd..a4bc9c6e 100644 --- a/lib/thinkingThingPlugin.js +++ b/lib/thinkingThingPlugin.js @@ -37,9 +37,7 @@ function parseBattery(payload) { fields = rawValue.split(','), result = []; - config - .getLogger() - .debug(context, 'Parsing Battery module: %s', JSON.stringify(fields, null, 4)); + config.getLogger().debug(context, 'Parsing Battery module: %s', JSON.stringify(fields, null, 4)); if (fields.length >= 8) { result.push({ @@ -90,9 +88,7 @@ function parseBattery(payload) { if (result.length !== 0) { return result; } else { - config - .getLogger() - .error(context, 'TTHINGS-001: Too few fields parsing Battery module: %s', rawValue); + config.getLogger().error(context, 'TTHINGS-001: Too few fields parsing Battery module: %s', rawValue); return []; } } @@ -139,9 +135,7 @@ function parseGSM(payload) { return result; } else { - config - .getLogger() - .error(context, 'TTHINGS-002: Too few fields parsing GSM module: %s', rawValue); + config.getLogger().error(context, 'TTHINGS-002: Too few fields parsing GSM module: %s', rawValue); return []; } } @@ -184,9 +178,7 @@ function parseCell(payload) { return result; } else { - config - .getLogger() - .error(context, 'TTHINGS-003: Too few fields parsing C1 module: %s', rawValue); + config.getLogger().error(context, 'TTHINGS-003: Too few fields parsing C1 module: %s', rawValue); return []; } } @@ -270,11 +262,7 @@ function updatePluginNgsi2(entity, entityType, callback) { * @param {Object} entity NGSI Entity as it would have been sent before the plugin. */ function updatePluginNgsi1(entity, entityType, callback) { - if ( - entity.contextElements && - entity.contextElements[0] && - entity.contextElements[0].attributes - ) { + if (entity.contextElements && entity.contextElements[0] && entity.contextElements[0].attributes) { var moduleAttributes = entity.contextElements[0].attributes.map(modifyAttributes); entity.contextElements[0].attributes = moduleAttributes; diff --git a/lib/timestampProcessPlugin.js b/lib/timestampProcessPlugin.js index 4d12a067..3d93a3f1 100644 --- a/lib/timestampProcessPlugin.js +++ b/lib/timestampProcessPlugin.js @@ -52,11 +52,7 @@ function updatePlugin(entity, entityType, callback) { return element; } - if ( - entity.contextElements && - entity.contextElements[0] && - entity.contextElements[0].attributes - ) { + if (entity.contextElements && entity.contextElements[0] && entity.contextElements[0].attributes) { for (var i in entity.contextElements[0].attributes) { if (entity.contextElements[0].attributes[i].name === constants.TIMESTAMP_ATTRIBUTE) { timestamp = entity.contextElements[0].attributes[i]; @@ -64,16 +60,12 @@ function updatePlugin(entity, entityType, callback) { } if (timestamp) { - entity.contextElements[0].attributes = entity.contextElements[0].attributes.map( - insertMetadata - ); + entity.contextElements[0].attributes = entity.contextElements[0].attributes.map(insertMetadata); } callback(null, entity, entityType); } else { - config - .getLogger() - .error(context, 'MEASURES-001: Bad payload received while processing timestamps'); + config.getLogger().error(context, 'MEASURES-001: Bad payload received while processing timestamps'); callback(new errors.BadPayload(entity)); } } diff --git a/lib/transportSelector.js b/lib/transportSelector.js index d4fc3a8c..5fcbefb6 100644 --- a/lib/transportSelector.js +++ b/lib/transportSelector.js @@ -51,18 +51,14 @@ function startTransportBindings(newConfig, callback) { } function createExecutionsForBinding(argument, functionName, protocol) { - config - .getLogger() - .debug('Creating execution for function [%s] and protocol [%s]', functionName, protocol); + config.getLogger().debug('Creating execution for function [%s] and protocol [%s]', functionName, protocol); function addHandler(current, binding) { if (binding[functionName] && (!protocol || binding.protocol === protocol)) { var args = [binding[functionName]].concat(argument), boundFunction = binding[functionName].bind.apply(binding[functionName], args); - config - .getLogger() - .debug('Binding found for function [%s] and protocol [%s]', functionName, protocol); + config.getLogger().debug('Binding found for function [%s] and protocol [%s]', functionName, protocol); current.push(boundFunction); } @@ -82,13 +78,7 @@ function createExecutionsForBinding(argument, functionName, protocol) { * @param {String} protocol Transport protocol where the function must be executed. */ function applyFunctionFromBinding(argument, functionName, protocol, callback) { - config - .getLogger() - .debug( - 'Looking for bindings for the function [%s] and protocol [%s]', - functionName, - protocol - ); + config.getLogger().debug('Looking for bindings for the function [%s] and protocol [%s]', functionName, protocol); async.series(createExecutionsForBinding(argument, functionName, protocol), callback); } diff --git a/test/unit/HTTP_commands_test.js b/test/unit/HTTP_commands_test.js index c73fbc6c..3307237f 100644 --- a/test/unit/HTTP_commands_test.js +++ b/test/unit/HTTP_commands_test.js @@ -53,12 +53,7 @@ describe('HTTP: Commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply( - 200, - utils.readExampleFile( - './test/contextAvailabilityResponses/registerIoTAgent1Success.json' - ) - ); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -93,26 +88,14 @@ describe('HTTP: Commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus1.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus1.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus6.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus6.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); mockedClientServer = nock('http://localhost:9876') .post('/command', function(body) { diff --git a/test/unit/HTTP_get-configuration_test.js b/test/unit/HTTP_get-configuration_test.js index 423ae1be..15895589 100644 --- a/test/unit/HTTP_get-configuration_test.js +++ b/test/unit/HTTP_get-configuration_test.js @@ -55,12 +55,7 @@ describe('HTTP: Get configuration from the devices', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply( - 200, - utils.readExampleFile( - './test/contextAvailabilityResponses/registerIoTAgent1Success.json' - ) - ); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -107,14 +102,8 @@ describe('HTTP: Get configuration from the devices', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/queryContext', - utils.readExampleFile('./test/contextRequests/getConfiguration.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json') - ); + .post('/v1/queryContext', utils.readExampleFile('./test/contextRequests/getConfiguration.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json')); mockedClientServer = nock('http://localhost:9876') .post('/command/configuration', function(result) { @@ -172,14 +161,8 @@ describe('HTTP: Get configuration from the devices', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/subscribeContext', - utils.readExampleFile('./test/subscriptions/subscriptionRequest.json') - ) - .reply( - 200, - utils.readExampleFile('./test/subscriptions/subscriptionResponse.json') - ); + .post('/v1/subscribeContext', utils.readExampleFile('./test/subscriptions/subscriptionRequest.json')) + .reply(200, utils.readExampleFile('./test/subscriptions/subscriptionResponse.json')); mockedClientServer = nock('http://localhost:9876') .post('/command/configuration', function(result) { diff --git a/test/unit/HTTP_reveice_measures-test.js b/test/unit/HTTP_reveice_measures-test.js index 3133a9f8..429a6820 100644 --- a/test/unit/HTTP_reveice_measures-test.js +++ b/test/unit/HTTP_reveice_measures-test.js @@ -82,10 +82,7 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); iotagentMqtt.start(config, function() { request(provisionOptions, function(error, response, body) { @@ -122,14 +119,8 @@ describe('HTTP: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/multipleMeasures.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasures.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); }); it('should return a 200 OK with no error', function(done) { request(optionsMeasure, function(error, result, body) { @@ -166,9 +157,7 @@ describe('HTTP: Measure reception ', function() { provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/deviceProvisioning/provisionDeviceTimeinstant.json' - ), + json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -182,22 +171,13 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/timeInstantMeasures.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/timeInstantMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/timeInstantMeasures.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/timeInstantMeasuresSuccess.json')); iotagentMqtt.stop(function() { config.iota.timestamp = true; @@ -243,9 +223,7 @@ describe('HTTP: Measure reception ', function() { provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/deviceProvisioning/provisionDeviceTimeinstant.json' - ), + json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -259,22 +237,13 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/timeInstantMeasures.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/timeInstantMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/timeInstantMeasures.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/timeInstantMeasuresSuccess.json')); iotagentMqtt.stop(function() { config.iota.timestamp = true; @@ -323,22 +292,13 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); contextBrokerUnprovMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/unprovisionedDevice.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/unprovisionedDevice.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); request(groupCreation, function(error, response, body) { done(); diff --git a/test/unit/MQTT_commands_test.js b/test/unit/MQTT_commands_test.js index 7aa32b5b..a2f95949 100644 --- a/test/unit/MQTT_commands_test.js +++ b/test/unit/MQTT_commands_test.js @@ -64,12 +64,7 @@ describe('MQTT: Commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply( - 200, - utils.readExampleFile( - './test/contextAvailabilityResponses/registerIoTAgent1Success.json' - ) - ); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -107,14 +102,8 @@ describe('MQTT: Commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus1.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus1.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); }); it('should return a 200 OK without errors', function(done) { @@ -160,20 +149,12 @@ describe('MQTT: Commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus2.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus2Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus2.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus2Success.json')); }); it('should send an update request to the Context Broker', function(done) { - mqttClient.publish('/1234/MQTT_2/cmdexe', '{ "PING": "1234567890" }', null, function( - error - ) { + mqttClient.publish('/1234/MQTT_2/cmdexe', '{ "PING": "1234567890" }', null, function(error) { setTimeout(function() { contextBrokerMock.done(); done(); diff --git a/test/unit/MQTT_get-configuration_test.js b/test/unit/MQTT_get-configuration_test.js index 9e865c43..82805343 100644 --- a/test/unit/MQTT_get-configuration_test.js +++ b/test/unit/MQTT_get-configuration_test.js @@ -61,10 +61,7 @@ describe('MQTT: Get configuration from the devices', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); oldConfigurationFlag = config.configRetrieval; config.configRetrieval = true; @@ -85,8 +82,7 @@ describe('MQTT: Get configuration from the devices', function() { async.series([iotAgentLib.clearAll, iotagentMqtt.stop], done); }); describe( - 'When a configuration request is received in the topic ' + - '"/{{apikey}}/{{deviceid}}/configuration/commands"', + 'When a configuration request is received in the topic ' + '"/{{apikey}}/{{deviceid}}/configuration/commands"', function() { var values = { type: 'configuration', @@ -98,16 +94,8 @@ describe('MQTT: Get configuration from the devices', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/queryContext', - utils.readExampleFile('./test/contextRequests/getConfiguration.json') - ) - .reply( - 200, - utils.readExampleFile( - './test/contextResponses/getConfigurationSuccess.json' - ) - ); + .post('/v1/queryContext', utils.readExampleFile('./test/contextRequests/getConfiguration.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/getConfigurationSuccess.json')); mqttClient.subscribe('/1234/MQTT_2/configuration/values', null); @@ -121,17 +109,14 @@ describe('MQTT: Get configuration from the devices', function() { }); it('should ask the Context Broker for the request attributes', function(done) { - mqttClient.publish( - '/1234/MQTT_2/configuration/commands', - JSON.stringify(values), - null, - function(error) { - setTimeout(function() { - contextBrokerMock.done(); - done(); - }, 100); - } - ); + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + contextBrokerMock.done(); + done(); + }, 100); + }); }); it('should return the requested attributes to the client in /1234/MQTT_2/configuration/values', function(done) { @@ -145,17 +130,14 @@ describe('MQTT: Get configuration from the devices', function() { result.warningLevel === '80'; }); - mqttClient.publish( - '/1234/MQTT_2/configuration/commands', - JSON.stringify(values), - null, - function(error) { - setTimeout(function() { - configurationReceived.should.equal(true); - done(); - }, 100); - } - ); + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + configurationReceived.should.equal(true); + done(); + }, 100); + }); }); it('should add the system timestamp in compressed format to the request', function(done) { @@ -165,17 +147,14 @@ describe('MQTT: Get configuration from the devices', function() { configurationReceived = result.dt && result.dt.should.match(/^\d{8}T\d{6}Z$/); }); - mqttClient.publish( - '/1234/MQTT_2/configuration/commands', - JSON.stringify(values), - null, - function(error) { - setTimeout(function() { - should.exist(configurationReceived); - done(); - }, 100); - } - ); + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + should.exist(configurationReceived); + done(); + }, 100); + }); }); } ); @@ -191,14 +170,8 @@ describe('MQTT: Get configuration from the devices', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/subscribeContext', - utils.readExampleFile('./test/subscriptions/subscriptionRequest.json') - ) - .reply( - 200, - utils.readExampleFile('./test/subscriptions/subscriptionResponse.json') - ); + .post('/v1/subscribeContext', utils.readExampleFile('./test/subscriptions/subscriptionRequest.json')) + .reply(200, utils.readExampleFile('./test/subscriptions/subscriptionResponse.json')); mqttClient.subscribe('/1234/MQTT_2/configuration/values', null); @@ -212,17 +185,12 @@ describe('MQTT: Get configuration from the devices', function() { }); it('should create a subscription in the ContextBroker', function(done) { - mqttClient.publish( - '/1234/MQTT_2/configuration/commands', - JSON.stringify(values), - null, - function(error) { - setTimeout(function() { - contextBrokerMock.done(); - done(); - }, 100); - } - ); + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function(error) { + setTimeout(function() { + contextBrokerMock.done(); + done(); + }, 100); + }); }); it('should update the values in the MQTT topic when a notification is received', function(done) { var optionsNotify = { @@ -238,25 +206,19 @@ describe('MQTT: Get configuration from the devices', function() { mqttClient.on('message', function(topic, data) { var result = JSON.parse(data); - configurationReceived = - result.sleepTime === '200' && result.warningLevel === 'ERROR'; + configurationReceived = result.sleepTime === '200' && result.warningLevel === 'ERROR'; }); - mqttClient.publish( - '/1234/MQTT_2/configuration/commands', - JSON.stringify(values), - null, - function(error) { - setTimeout(function() { - request(optionsNotify, function(error, response, body) { - setTimeout(function() { - configurationReceived.should.equal(true); - done(); - }, 100); - }); - }, 100); - } - ); + mqttClient.publish('/1234/MQTT_2/configuration/commands', JSON.stringify(values), null, function(error) { + setTimeout(function() { + request(optionsNotify, function(error, response, body) { + setTimeout(function() { + configurationReceived.should.equal(true); + done(); + }, 100); + }); + }, 100); + }); }); }); }); diff --git a/test/unit/MQTT_receive_measures-test.js b/test/unit/MQTT_receive_measures-test.js index ef2f7517..e92b6ee3 100644 --- a/test/unit/MQTT_receive_measures-test.js +++ b/test/unit/MQTT_receive_measures-test.js @@ -91,10 +91,7 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); iotagentMqtt.start(config, function() { request(provisionOptions, function(error, response, body) { @@ -115,14 +112,8 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/multipleMeasures.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasures.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); }); it('should send its value to the Context Broker', function(done) { var values = { @@ -145,22 +136,13 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); contextBrokerUnprovMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/unprovisionedDevice.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/unprovisionedDevice.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); request(groupCreation, function(error, response, body) { done(); @@ -172,17 +154,14 @@ describe('MQTT: Measure reception ', function() { temperature: '87' }; - mqttClient.publish( - '/KL223HHV8732SFL1/MQTT_UNPROVISIONED/attrs', - JSON.stringify(values), - null, - function(error) { - setTimeout(function() { - contextBrokerUnprovMock.done(); - done(); - }, 100); - } - ); + mqttClient.publish('/KL223HHV8732SFL1/MQTT_UNPROVISIONED/attrs', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + contextBrokerUnprovMock.done(); + done(); + }, 100); + }); }); }); @@ -191,14 +170,8 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/unknownMeasures.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/unknownMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/unknownMeasures.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/unknownMeasuresSuccess.json')); }); it('should send its value to the Context Broker', function(done) { var values = { @@ -220,14 +193,8 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/timestampMeasure.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/timestampMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/timestampMeasure.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/timestampMeasureSuccess.json')); }); it('should send its value to the Context Broker', function(done) { var values = { @@ -250,14 +217,8 @@ describe('MQTT: Measure reception ', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/singleMeasure.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasure.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should send its values to the Context Broker', function(done) { mqttClient.publish('/1234/MQTT_2/attrs/temperature', '87', null, function(error) { diff --git a/test/unit/amqpBinding-test.js b/test/unit/amqpBinding-test.js index e6bfcf65..b0ecd050 100644 --- a/test/unit/amqpBinding-test.js +++ b/test/unit/amqpBinding-test.js @@ -75,10 +75,7 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); async.series( [ @@ -104,14 +101,8 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should send a new update context request to the Context Broker with just that attribute', function(done) { @@ -140,22 +131,13 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-service', 'TestService') .matchHeader('fiware-servicepath', '/testingPath') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); contextBrokerUnprovMock .matchHeader('fiware-service', 'TestService') .matchHeader('fiware-servicepath', '/testingPath') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/unprovisionedMeasure.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/unprovisionedSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/unprovisionedMeasure.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/unprovisionedSuccess.json')); request(groupCreation, function(error, response, body) { done(); @@ -163,11 +145,7 @@ describe('AMQP Transport binding: measures', function() { }); it('should send a new update context request to the Context Broker with just that attribute', function(done) { - channel.publish( - config.amqp.exchange, - '.80K09H324HV8732.MQTT_UNPROVISIONED.attrs.a', - new Buffer('23') - ); + channel.publish(config.amqp.exchange, '.80K09H324HV8732.MQTT_UNPROVISIONED.attrs.a', new Buffer('23')); setTimeout(function() { contextBrokerUnprovMock.done(); @@ -181,22 +159,12 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should send a single update context request with all the attributes', function(done) { - channel.publish( - config.amqp.exchange, - '.1234.MQTT_2.attrs', - new Buffer(JSON.stringify({ a: '23' })) - ); + channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer(JSON.stringify({ a: '23' }))); setTimeout(function() { contextBrokerMock.done(); @@ -210,22 +178,12 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasureAMQP.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should silently ignore the error (without crashing)', function(done) { - channel.publish( - config.amqp.exchange, - '.1234.MQTT_2.attrs', - new Buffer('notAULPayload ') - ); + channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer('notAULPayload ')); setTimeout(function() { done(); @@ -238,14 +196,8 @@ describe('AMQP Transport binding: measures', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/multipleMeasure.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasure.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); }); it('should send one update context per measure group to the Contet Broker', function(done) { diff --git a/test/unit/attribute-alias_test.js b/test/unit/attribute-alias_test.js index 50ccc5f9..c01a7df9 100644 --- a/test/unit/attribute-alias_test.js +++ b/test/unit/attribute-alias_test.js @@ -59,10 +59,7 @@ describe('Attribute alias', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); iotagentMqtt.start(config, function() { request(provisionOptions, function(error, response, body) { @@ -83,14 +80,8 @@ describe('Attribute alias', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/timestampAliasMeasure.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/timestampMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/timestampAliasMeasure.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/timestampMeasureSuccess.json')); }); it('should send its value to the Context Broker', function(done) { var values = { diff --git a/test/unit/bidirectionalityHttp-test.js b/test/unit/bidirectionalityHttp-test.js index 0e9640cb..7d08a266 100644 --- a/test/unit/bidirectionalityHttp-test.js +++ b/test/unit/bidirectionalityHttp-test.js @@ -57,9 +57,7 @@ describe('Data Bidirectionality: HTTP', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/deviceProvisioning/provisionCommandBidirectional.json' - ), + json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectional.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -73,15 +71,11 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v1/subscribeContext', - utils.readExampleFile( - './test//subscriptions/bidirectionalSubscriptionRequest.json' - ) + utils.readExampleFile('./test//subscriptions/bidirectionalSubscriptionRequest.json') ) .reply( 200, - utils.readExampleFile( - './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json' - ) + utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') ); contextBrokerMock @@ -91,12 +85,7 @@ describe('Data Bidirectionality: HTTP', function() { '/v1/updateContext', utils.readExampleFile('./test/contextRequests/createBidirectionalDevice.json') ) - .reply( - 200, - utils.readExampleFile( - './test/contextResponses/createBidirectionalDeviceSuccess.json' - ) - ); + .reply(200, utils.readExampleFile('./test/contextResponses/createBidirectionalDeviceSuccess.json')); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') @@ -107,9 +96,7 @@ describe('Data Bidirectionality: HTTP', function() { ) .reply( 200, - utils.readExampleFile( - './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json' - ) + utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') ); iotagentJson.start(config, function(error) { @@ -129,10 +116,7 @@ describe('Data Bidirectionality: HTTP', function() { it('should leave the data in the polling queue', function(done) { request(notificationOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( - error, - list - ) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { should.not.exist(error); list.commands.length.should.equal(3); @@ -143,10 +127,7 @@ describe('Data Bidirectionality: HTTP', function() { it('should send all the data from the notification in command syntax', function(done) { request(notificationOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( - error, - list - ) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { var latitudeFound = false, longitudeFound = false; @@ -182,9 +163,7 @@ describe('Data Bidirectionality: HTTP', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json' - ), + json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -198,15 +177,11 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v1/subscribeContext', - utils.readExampleFile( - './test//subscriptions/bidirectionalSubscriptionRequest.json' - ) + utils.readExampleFile('./test//subscriptions/bidirectionalSubscriptionRequest.json') ) .reply( 200, - utils.readExampleFile( - './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json' - ) + utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') ); contextBrokerMock @@ -216,12 +191,7 @@ describe('Data Bidirectionality: HTTP', function() { '/v1/updateContext', utils.readExampleFile('./test/contextRequests/createBidirectionalDevice.json') ) - .reply( - 200, - utils.readExampleFile( - './test/contextResponses/createBidirectionalDeviceSuccess.json' - ) - ); + .reply(200, utils.readExampleFile('./test/contextResponses/createBidirectionalDeviceSuccess.json')); contextBrokerMock = nock('http://192.168.1.1:1026') .matchHeader('fiware-service', 'smartGondor') @@ -232,9 +202,7 @@ describe('Data Bidirectionality: HTTP', function() { ) .reply( 200, - utils.readExampleFile( - './test/subscriptionResponses/bidirectionalSubscriptionSuccess.json' - ) + utils.readExampleFile('./test/subscriptionResponses/bidirectionalSubscriptionSuccess.json') ); mockedClientServer = nock('http://localhost:9876') diff --git a/test/unit/commandsAmqp-test.js b/test/unit/commandsAmqp-test.js index 58f94e68..cec22700 100644 --- a/test/unit/commandsAmqp-test.js +++ b/test/unit/commandsAmqp-test.js @@ -74,12 +74,7 @@ describe('AMQP Transport binding: commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply( - 200, - utils.readExampleFile( - './test/contextAvailabilityResponses/registerIoTAgent1Success.json' - ) - ); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -125,14 +120,8 @@ describe('AMQP Transport binding: commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus1.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus1.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); }); it('should return a 200 OK without errors', function(done) { @@ -161,11 +150,7 @@ describe('AMQP Transport binding: commands', function() { channel.assertExchange(config.amqp.exchange, 'topic', config.amqp.options); channel.assertQueue('client-queue', { exclusive: false }, function(err, q) { - channel.bindQueue( - q.queue, - config.amqp.exchange, - '.' + config.defaultKey + '.MQTT_2.cmd' - ); + channel.bindQueue(q.queue, config.amqp.exchange, '.' + config.defaultKey + '.MQTT_2.cmd'); channel.consume( q.queue, @@ -191,23 +176,13 @@ describe('AMQP Transport binding: commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus2.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus2Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus2.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus2Success.json')); }); it('should send an update request to the Context Broker', function(done) { channel.assertExchange(config.amqp.exchange, 'topic', config.amqp.options); - channel.publish( - config.amqp.exchange, - '.1234.MQTT_2.cmdexe', - new Buffer('{"PING":"1234567890"}') - ); + channel.publish(config.amqp.exchange, '.1234.MQTT_2.cmdexe', new Buffer('{"PING":"1234567890"}')); setTimeout(function() { contextBrokerMock.done(); @@ -252,33 +227,19 @@ describe('AMQP Transport binding: commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply( - 200, - utils.readExampleFile( - './test/contextAvailabilityResponses/registerIoTAgent1Success.json' - ) - ); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus3.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus1Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus3.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus1Success.json')); request(configurationOptions, function(error, response, body) { request(provisionOptionsAlt, function(error, response, body) { diff --git a/test/unit/commandsPolling-test.js b/test/unit/commandsPolling-test.js index 67c70044..03b7fa9d 100644 --- a/test/unit/commandsPolling-test.js +++ b/test/unit/commandsPolling-test.js @@ -61,12 +61,7 @@ describe('HTTP Transport binding: polling commands', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/NGSI9/registerContext') - .reply( - 200, - utils.readExampleFile( - './test/contextAvailabilityResponses/registerIoTAgent1Success.json' - ) - ); + .reply(200, utils.readExampleFile('./test/contextAvailabilityResponses/registerIoTAgent1Success.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') @@ -110,10 +105,7 @@ describe('HTTP Transport binding: polling commands', function() { it('should be stored in the commands collection', function(done) { request(commandOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( - error, - list - ) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { should.not.exist(error); list.count.should.equal(1); list.commands[0].name.should.equal('PING'); @@ -141,26 +133,14 @@ describe('HTTP Transport binding: polling commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/pollingMeasure.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/pollingMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/pollingMeasure.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/pollingMeasureSuccess.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus4.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus4Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus4.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus4Success.json')); request(commandOptions, done); }); @@ -187,10 +167,7 @@ describe('HTTP Transport binding: polling commands', function() { it('should remove them from the IoTAgent', function(done) { request(deviceRequest, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( - error, - list - ) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { should.not.exist(error); list.count.should.equal(0); done(); @@ -228,26 +205,14 @@ describe('HTTP Transport binding: polling commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/pollingMeasure.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/pollingMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/pollingMeasure.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/pollingMeasureSuccess.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus4.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus4Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus4.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus4Success.json')); request(commandOptions, done); }); @@ -274,10 +239,7 @@ describe('HTTP Transport binding: polling commands', function() { it('should remove them from the IoTAgent', function(done) { request(deviceRequest, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( - error, - list - ) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { should.not.exist(error); list.count.should.equal(0); done(); @@ -307,14 +269,8 @@ describe('HTTP Transport binding: polling commands', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/updateStatus5.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/updateStatus4Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/updateStatus5.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/updateStatus4Success.json')); request(commandOptions, done); }); diff --git a/test/unit/configuration-api_test.js b/test/unit/configuration-api_test.js index f5b51eb7..288e407f 100644 --- a/test/unit/configuration-api_test.js +++ b/test/unit/configuration-api_test.js @@ -102,10 +102,7 @@ describe('Configuration API support', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); iotagentMqtt.start(config, done); }); @@ -145,22 +142,14 @@ describe('Configuration API support', function() { contextBrokerUnprovMock = nock('http://unexistentHost:1026') .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/singleMeasure.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/singleMeasure.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should use the API Key of that configuration in device topics', function(done) { request(configurationOptions, function(error, response, body) { request(provisionOptions, function(error, response, body) { - mqttClient.publish('/728289/MQTT_2/attrs/temperature', '87', null, function( - error - ) { + mqttClient.publish('/728289/MQTT_2/attrs/temperature', '87', null, function(error) { setTimeout(function() { contextBrokerUnprovMock.done(); done(); diff --git a/test/unit/ngsiv2/HTTP_reveice_measures-test.js b/test/unit/ngsiv2/HTTP_reveice_measures-test.js index bde17543..74e90e4f 100644 --- a/test/unit/ngsiv2/HTTP_reveice_measures-test.js +++ b/test/unit/ngsiv2/HTTP_reveice_measures-test.js @@ -71,9 +71,7 @@ describe('HTTP: Measure reception ', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/unit/ngsiv2/deviceProvisioning/provisionDeviceHTTP.json' - ), + json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDeviceHTTP.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -136,9 +134,7 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -179,9 +175,7 @@ describe('HTTP: Measure reception ', function() { provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/deviceProvisioning/provisionDeviceTimeinstant.json' - ), + json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -204,9 +198,7 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/e0130101/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/timeInstantMeasures.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timeInstantMeasures.json') ) .query({ type: 'sensor' }) .reply(204); @@ -255,9 +247,7 @@ describe('HTTP: Measure reception ', function() { provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/deviceProvisioning/provisionDeviceTimeinstant.json' - ), + json: utils.readExampleFile('./test/deviceProvisioning/provisionDeviceTimeinstant.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -280,9 +270,7 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/e0130101/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/timeInstantMeasures.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timeInstantMeasures.json') ) .query({ type: 'sensor' }) .reply(204); @@ -343,9 +331,7 @@ describe('HTTP: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/TheLightType:JSON_UNPROVISIONED/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/unprovisionedDevice.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedDevice.json') ) .query({ type: 'TheLightType' }) .reply(204); diff --git a/test/unit/ngsiv2/MQTT_receive_measures-test.js b/test/unit/ngsiv2/MQTT_receive_measures-test.js index de634431..f525351a 100644 --- a/test/unit/ngsiv2/MQTT_receive_measures-test.js +++ b/test/unit/ngsiv2/MQTT_receive_measures-test.js @@ -72,9 +72,7 @@ describe('MQTT: Measure reception ', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/unit/ngsiv2/deviceProvisioning/provisionDevice1.json' - ), + json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDevice1.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -121,9 +119,7 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasuresJsonTypes.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -167,9 +163,7 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/TheLightType:JSON_UNPROVISIONED/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/unprovisionedDevice.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedDevice.json') ) .query({ type: 'TheLightType' }) .reply(204); @@ -184,17 +178,14 @@ describe('MQTT: Measure reception ', function() { temperature: '87' }; - mqttClient.publish( - '/KL223HHV8732SFL1/JSON_UNPROVISIONED/attrs', - JSON.stringify(values), - null, - function(error) { - setTimeout(function() { - contextBrokerUnprovMock.done(); - done(); - }, 100); - } - ); + mqttClient.publish('/KL223HHV8732SFL1/JSON_UNPROVISIONED/attrs', JSON.stringify(values), null, function( + error + ) { + setTimeout(function() { + contextBrokerUnprovMock.done(); + done(); + }, 100); + }); }); }); @@ -232,9 +223,7 @@ describe('MQTT: Measure reception ', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/timestampMeasure.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timestampMeasure.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); diff --git a/test/unit/ngsiv2/amqpBinding-test.js b/test/unit/ngsiv2/amqpBinding-test.js index 89c45007..40157966 100644 --- a/test/unit/ngsiv2/amqpBinding-test.js +++ b/test/unit/ngsiv2/amqpBinding-test.js @@ -108,9 +108,7 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -152,9 +150,7 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-servicepath', '/testingPath') .post( '/v2/entities/SensorMachine:JSON_UNPROVISIONED/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/unprovisionedMeasure.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/unprovisionedMeasure.json') ) .query({ type: 'SensorMachine' }) .reply(204); @@ -165,11 +161,7 @@ describe('AMQP Transport binding: measures', function() { }); it('should send a new update context request to the Context Broker with just that attribute', function(done) { - channel.publish( - config.amqp.exchange, - '.80K09H324HV8732.JSON_UNPROVISIONED.attrs.a', - new Buffer('23') - ); + channel.publish(config.amqp.exchange, '.80K09H324HV8732.JSON_UNPROVISIONED.attrs.a', new Buffer('23')); setTimeout(function() { contextBrokerUnprovMock.done(); @@ -185,23 +177,14 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') ) .query({ type: 'AnMQTTDevice' }) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should send a single update context request with all the attributes', function(done) { - channel.publish( - config.amqp.exchange, - '.1234.MQTT_2.attrs', - new Buffer(JSON.stringify({ a: '23' })) - ); + channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer(JSON.stringify({ a: '23' }))); setTimeout(function() { contextBrokerMock.done(); @@ -217,22 +200,13 @@ describe('AMQP Transport binding: measures', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/singleMeasureAMQP.json') ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/singleMeasureSuccess.json')); }); it('should silently ignore the error (without crashing)', function(done) { - channel.publish( - config.amqp.exchange, - '.1234.MQTT_2.attrs', - new Buffer('notAULPayload ') - ); + channel.publish(config.amqp.exchange, '.1234.MQTT_2.attrs', new Buffer('notAULPayload ')); setTimeout(function() { done(); diff --git a/test/unit/ngsiv2/attribute-alias_test.js b/test/unit/ngsiv2/attribute-alias_test.js index ee29dec6..16fbff3e 100644 --- a/test/unit/ngsiv2/attribute-alias_test.js +++ b/test/unit/ngsiv2/attribute-alias_test.js @@ -40,9 +40,7 @@ describe('Attribute alias', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/unit/ngsiv2/deviceProvisioning/provisionDevice2.json' - ), + json: utils.readExampleFile('./test/unit/ngsiv2/deviceProvisioning/provisionDevice2.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -89,9 +87,7 @@ describe('Attribute alias', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/timestampAliasMeasure.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/timestampAliasMeasure.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); diff --git a/test/unit/ngsiv2/bidirectionalityHttp-test.js b/test/unit/ngsiv2/bidirectionalityHttp-test.js index 27914bdd..7241b682 100644 --- a/test/unit/ngsiv2/bidirectionalityHttp-test.js +++ b/test/unit/ngsiv2/bidirectionalityHttp-test.js @@ -40,9 +40,7 @@ describe('Data Bidirectionality: HTTP', function() { var notificationOptions = { url: 'http://localhost:' + config.iota.server.port + '/notify', method: 'POST', - json: utils.readExampleFile( - './test/unit/ngsiv2/subscriptions/bidirectionalNotification.json' - ), + json: utils.readExampleFile('./test/unit/ngsiv2/subscriptions/bidirectionalNotification.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -62,9 +60,7 @@ describe('Data Bidirectionality: HTTP', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/deviceProvisioning/provisionCommandBidirectional.json' - ), + json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectional.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -87,10 +83,7 @@ describe('Data Bidirectionality: HTTP', function() { return false; } else if (moment(body.expires, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isValid()) { expectedBody.expires = moment().add(config.deviceRegistrationDuration); - var expiresDiff = moment(expectedBody.expires).diff( - body.expires, - 'milliseconds' - ); + var expiresDiff = moment(expectedBody.expires).diff(body.expires, 'milliseconds'); if (expiresDiff < 500) { delete expectedBody.expires; delete body.expires; @@ -110,9 +103,7 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities?options=upsert', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json') ) .reply(204); @@ -133,10 +124,7 @@ describe('Data Bidirectionality: HTTP', function() { it('should leave the data in the polling queue', function(done) { request(notificationOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( - error, - list - ) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { should.not.exist(error); list.commands.length.should.equal(3); @@ -147,10 +135,7 @@ describe('Data Bidirectionality: HTTP', function() { it('should send all the data from the notification in command syntax', function(done) { request(notificationOptions, function(error, response, body) { - iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function( - error, - list - ) { + iotAgentLib.commandQueue('smartGondor', '/gardens', 'MQTT_2', function(error, list) { var latitudeFound = false, longitudeFound = false; @@ -186,9 +171,7 @@ describe('Data Bidirectionality: HTTP', function() { var provisionOptions = { url: 'http://localhost:' + config.iota.server.port + '/iot/devices', method: 'POST', - json: utils.readExampleFile( - './test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json' - ), + json: utils.readExampleFile('./test/deviceProvisioning/provisionCommandBidirectionalWithUrl.json'), headers: { 'fiware-service': 'smartGondor', 'fiware-servicepath': '/gardens' @@ -211,10 +194,7 @@ describe('Data Bidirectionality: HTTP', function() { return false; } else if (moment(body.expires, 'YYYY-MM-DDTHH:mm:ss.SSSZ').isValid()) { expectedBody.expires = moment().add(config.deviceRegistrationDuration); - var expiresDiff = moment(expectedBody.expires).diff( - body.expires, - 'milliseconds' - ); + var expiresDiff = moment(expectedBody.expires).diff(body.expires, 'milliseconds'); if (expiresDiff < 500) { delete expectedBody.expires; delete body.expires; @@ -234,9 +214,7 @@ describe('Data Bidirectionality: HTTP', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities?options=upsert', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/createBidirectionalDevice.json') ) .reply(204); diff --git a/test/unit/ngsiv2/configuration-api_test.js b/test/unit/ngsiv2/configuration-api_test.js index a034b8f5..ffad4bbf 100644 --- a/test/unit/ngsiv2/configuration-api_test.js +++ b/test/unit/ngsiv2/configuration-api_test.js @@ -157,9 +157,7 @@ describe('Configuration API support', function() { it('should use the API Key of that configuration in device topics', function(done) { request(configurationOptions, function(error, response, body) { request(provisionOptions, function(error, response, body) { - mqttClient.publish('/728289/MQTT_2/attrs/temperature', '87', null, function( - error - ) { + mqttClient.publish('/728289/MQTT_2/attrs/temperature', '87', null, function(error) { setTimeout(function() { contextBrokerUnprovMock.done(); done(); diff --git a/test/unit/ngsiv2/subscription-management_test.js b/test/unit/ngsiv2/subscription-management_test.js index a6cd2ca9..2d4936ad 100644 --- a/test/unit/ngsiv2/subscription-management_test.js +++ b/test/unit/ngsiv2/subscription-management_test.js @@ -104,9 +104,7 @@ describe('Subscription management', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/multipleMeasures.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasures.json') ) .reply(204); @@ -115,9 +113,7 @@ describe('Subscription management', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/alternativeUpdate.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/alternativeUpdate.json') ) .reply(204); }); @@ -148,9 +144,7 @@ describe('Subscription management', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/multipleMeasures.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/multipleMeasures.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -160,9 +154,7 @@ describe('Subscription management', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/alternativeUpdate.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/alternativeUpdate.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); diff --git a/test/unit/ngsiv2/supportThinkingThingModules_test.js b/test/unit/ngsiv2/supportThinkingThingModules_test.js index a6a58c58..8bed4a80 100644 --- a/test/unit/ngsiv2/supportThinkingThingModules_test.js +++ b/test/unit/ngsiv2/supportThinkingThingModules_test.js @@ -113,9 +113,7 @@ describe('Support for Thinking Things Modules', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/TTModuleP1Single.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleP1Single.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); @@ -166,9 +164,7 @@ describe('Support for Thinking Things Modules', function() { .matchHeader('fiware-servicepath', '/gardens') .post( '/v2/entities/Second%20MQTT%20Device/attrs', - utils.readExampleFile( - './test/unit/ngsiv2/contextRequests/TTModuleC1Single.json' - ) + utils.readExampleFile('./test/unit/ngsiv2/contextRequests/TTModuleC1Single.json') ) .query({ type: 'AnMQTTDevice' }) .reply(204); diff --git a/test/unit/subscription-management_test.js b/test/unit/subscription-management_test.js index c48d6057..7242e29f 100644 --- a/test/unit/subscription-management_test.js +++ b/test/unit/subscription-management_test.js @@ -79,10 +79,7 @@ describe('Subscription management', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); iotagentMqtt.start(config, function() { iotAgentLib.clearAll(done); @@ -100,26 +97,14 @@ describe('Subscription management', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/multipleMeasures.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasures.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/alternativeUpdate.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/alternativeUpdate.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); }); it('should cease sending measures to the CB', function(done) { @@ -146,26 +131,14 @@ describe('Subscription management', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/multipleMeasures.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/multipleMeasures.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/alternativeUpdate.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/alternativeUpdate.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); }); afterEach(function(done) { diff --git a/test/unit/supportThinkingThingModules_test.js b/test/unit/supportThinkingThingModules_test.js index a22ed9c5..8c74689d 100644 --- a/test/unit/supportThinkingThingModules_test.js +++ b/test/unit/supportThinkingThingModules_test.js @@ -59,10 +59,7 @@ describe('Support for Thinking Things Modules', function() { .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') .post('/v1/updateContext') - .reply( - 200, - utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json') - ); + .reply(200, utils.readExampleFile('./test/contextResponses/multipleMeasuresSuccess.json')); iotagentMqtt.start(config, function() { request(provisionOptions, function(error, response, body) { @@ -82,14 +79,8 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/TTModuleP1.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/TTModuleP1Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleP1.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleP1Success.json')); }); it('should send its value to the Context Broker', function(done) { var values = { @@ -111,14 +102,8 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/TTModuleP1Single.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/TTModuleP1SingleSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleP1Single.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleP1SingleSuccess.json')); }); it('should send its value to the Context Broker', function(done) { var values = '214,7,d22,b00,-64,'; @@ -137,14 +122,8 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/TTModuleC1.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/TTModuleP1Success.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleC1.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleP1Success.json')); }); it('should send its value to the Context Broker', function(done) { var values = { @@ -166,14 +145,8 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/TTModuleC1Single.json') - ) - .reply( - 200, - utils.readExampleFile('./test/contextResponses/TTModuleP1SingleSuccess.json') - ); + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleC1Single.json')) + .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleP1SingleSuccess.json')); }); it('should send its value to the Context Broker', function(done) { var values = '00D600070d220b00'; @@ -192,10 +165,7 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/TTModuleB.json') - ) + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleB.json')) .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleBSuccess.json')); }); it('should send its value to the Context Broker', function(done) { @@ -218,10 +188,7 @@ describe('Support for Thinking Things Modules', function() { contextBrokerMock .matchHeader('fiware-service', 'smartGondor') .matchHeader('fiware-servicepath', '/gardens') - .post( - '/v1/updateContext', - utils.readExampleFile('./test/contextRequests/TTModuleBLong.json') - ) + .post('/v1/updateContext', utils.readExampleFile('./test/contextRequests/TTModuleBLong.json')) .reply(200, utils.readExampleFile('./test/contextResponses/TTModuleBSuccess.json')); }); it('should send its value to the Context Broker', function(done) { From 6f5a131a02b587c9317f4363d8597d145068520e Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Wed, 27 Feb 2019 12:31:49 +0100 Subject: [PATCH 14/15] Remove package-lock.json --- package-lock.json | 4820 --------------------------------------------- 1 file changed, 4820 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 122a4c20..00000000 --- a/package-lock.json +++ /dev/null @@ -1,4820 +0,0 @@ -{ - "name": "iotagent-json", - "version": "1.9.0-next", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@samverschueren/stream-to-observable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", - "integrity": "sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg==", - "dev": true, - "requires": { - "any-observable": "^0.3.0" - } - }, - "JSONSelect": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz", - "integrity": "sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40=" - }, - "JSV": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz", - "integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c=" - }, - "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", - "dev": true - }, - "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", - "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" - } - }, - "ajv": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.7.0.tgz", - "integrity": "sha512-RZXPviBTtfmtka9n9sy1N5M5b82CbxWIR6HIis4s3WQTXDJamc/0gpCWNGz6EWdWp4DOfjzJfhz/AS9zVPjjWg==", - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "optional": true - }, - "amqplib": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/amqplib/-/amqplib-0.5.3.tgz", - "integrity": "sha512-ZOdUhMxcF+u62rPI+hMtU1NBXSDFQ3eCJJrenamtdQ7YYwh7RZJHOIM1gonVbZ5PyVdYH4xqBPje9OYqk7fnqw==", - "requires": { - "bitsyntax": "~0.1.0", - "bluebird": "^3.5.2", - "buffer-more-ints": "~1.0.0", - "readable-stream": "1.x >=1.1.9", - "safe-buffer": "~5.1.2", - "url-parse": "~1.4.3" - } - }, - "ansi-escapes": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz", - "integrity": "sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==", - "dev": true - }, - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "any-observable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz", - "integrity": "sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog==", - "dev": true - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true - }, - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "requires": { - "lodash": "^4.17.10" - } - }, - "async-limiter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "bitsyntax": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/bitsyntax/-/bitsyntax-0.1.0.tgz", - "integrity": "sha512-ikAdCnrloKmFOugAfxWws89/fPc+nw0OOG1IzIE72uSOg/A3cYptKCjSUhDTuj7fhsJtzkzlv7l3b8PzRHLN0Q==", - "requires": { - "buffer-more-ints": "~1.0.0", - "debug": "~2.6.9", - "safe-buffer": "~5.1.2" - } - }, - "bl": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", - "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "bluebird": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.3.tgz", - "integrity": "sha512-/qKPUQlaW1OyR51WeCPBvRnAlnZFUJkCSG5HzGnuIqhgyJtF+T94lFnn33eiazjRm2LAHVy2guNnaq48X9SJuw==" - }, - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" - } - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "bson": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz", - "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==" - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" - }, - "buffer-more-ints": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-more-ints/-/buffer-more-ints-1.0.0.tgz", - "integrity": "sha512-EMetuGFz5SLsT0QTnXzINh4Ksr+oo4i+UGTXEshiGCQWnsgSs7ZhJ8fzlwQ+OzEMs0MpDAMr1hxnblp5a4vcHg==" - }, - "builtin-modules": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.0.0.tgz", - "integrity": "sha512-hMIeU4K2ilbXV6Uv93ZZ0Avg/M91RaKXucQ+4me2Do1txxBDyDZWCBa5bJSLqoNTRpXTLwEzIk1KmloenDDjhg==", - "dev": true - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - } - }, - "callback-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/callback-stream/-/callback-stream-1.1.0.tgz", - "integrity": "sha1-RwGlEmbwbgbqpx/BcjOCLYdfSQg=", - "requires": { - "inherits": "^2.0.1", - "readable-stream": "> 1.0.0 < 3.0.0" - } - }, - "caller-callsite": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", - "integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=", - "dev": true, - "requires": { - "callsites": "^2.0.0" - } - }, - "caller-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz", - "integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=", - "dev": true, - "requires": { - "caller-callsite": "^2.0.0" - } - }, - "callsites": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz", - "integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=", - "dev": true - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "chai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", - "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.0", - "type-detect": "^4.0.5" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "ci-info": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.6.0.tgz", - "integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==", - "dev": true - }, - "cjson": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/cjson/-/cjson-0.3.0.tgz", - "integrity": "sha1-5kObkHA9MS/24iJAl76pLOPQKhQ=", - "requires": { - "jsonlint": "1.6.0" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "cli": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", - "integrity": "sha1-IoF1NPJL+klQw01TLUjsvGIbjBQ=", - "dev": true, - "requires": { - "exit": "0.1.2", - "glob": "^7.1.1" - } - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-truncate": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-0.2.1.tgz", - "integrity": "sha1-nxXPuwcFAFNpIWxiasfQWrkN1XQ=", - "dev": true, - "requires": { - "slice-ansi": "0.0.4", - "string-width": "^1.0.1" - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "colors": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz", - "integrity": "sha1-fQAj6usVTo7p/Oddy5I9DtFmd3Q=" - }, - "combined-stream": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", - "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "command-shell-lib": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/command-shell-lib/-/command-shell-lib-1.0.0.tgz", - "integrity": "sha1-KWC3MJvpBwojAYYjcvvjjtL3+RA=", - "requires": { - "async": "*" - } - }, - "commander": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", - "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", - "dev": true - }, - "commist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/commist/-/commist-1.0.0.tgz", - "integrity": "sha1-wMNSUBz29S6RJOPvicmAbiAi6+8=", - "requires": { - "leven": "^1.0.0", - "minimist": "^1.1.0" - } - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "^0.1.4" - } - }, - "content-disposition": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", - "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cosmiconfig": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.0.7.tgz", - "integrity": "sha512-PcLqxTKiDmNT6pSpy4N6KtuPwb53W+2tzNvwOZw0WH9N6O0vLIBq0x8aj8Oj75ere4YcGi48bDFCL+3fRJdlNA==", - "dev": true, - "requires": { - "import-fresh": "^2.0.0", - "is-directory": "^0.3.1", - "js-yaml": "^3.9.0", - "parse-json": "^4.0.0" - } - }, - "coveralls": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.2.tgz", - "integrity": "sha512-Tv0LKe/MkBOilH2v7WBiTBdudg2ChfGbdXafc/s330djpF3zKOmuehTeRwjXWc7pzfj9FrDUTA7tEx6Div8NFw==", - "dev": true, - "requires": { - "growl": "~> 1.10.0", - "js-yaml": "^3.11.0", - "lcov-parse": "^0.0.10", - "log-driver": "^1.2.7", - "minimist": "^1.2.0", - "request": "^2.85.0" - } - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "d": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", - "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", - "requires": { - "es5-ext": "^0.10.9" - } - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "date-fns": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", - "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==", - "dev": true - }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true - }, - "dateformat": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", - "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" - }, - "dedent": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", - "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", - "dev": true - }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "deep-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", - "dev": true - }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", - "dev": true - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - }, - "dom-serializer": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", - "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", - "dev": true, - "requires": { - "domelementtype": "~1.1.1", - "entities": "~1.1.1" - }, - "dependencies": { - "domelementtype": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", - "dev": true - }, - "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", - "dev": true - } - } - }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true - }, - "domhandler": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", - "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", - "dev": true, - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "duplexify": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz", - "integrity": "sha512-vM58DwdnKmty+FSPzT14K9JXb90H+j5emaR4KYbr2KTIz00WHGbWOe5ghQTx233ZCLZtrGDALzKwcjEtSt35mA==", - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "ebnf-parser": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/ebnf-parser/-/ebnf-parser-0.1.10.tgz", - "integrity": "sha1-zR9rpHfFY4xAyX7ZtXLbW6tdgzE=" - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, - "elegant-spinner": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", - "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", - "dev": true - }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "requires": { - "once": "^1.4.0" - } - }, - "entities": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", - "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", - "dev": true - }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "es5-ext": { - "version": "0.10.47", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.47.tgz", - "integrity": "sha512-/1TItLfj+TTfWoeRcDn/0FbGV6SNo4R+On2GGVucPU/j3BWnXE2Co8h8CTo4Tu34gFJtnmwS9xiScKs4EjZhdw==", - "requires": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.1", - "next-tick": "1" - } - }, - "es6-iterator": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", - "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", - "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "es6-map": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", - "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", - "requires": { - "d": "1", - "es5-ext": "~0.10.14", - "es6-iterator": "~2.0.1", - "es6-set": "~0.1.5", - "es6-symbol": "~3.1.1", - "event-emitter": "~0.3.5" - } - }, - "es6-set": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", - "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", - "requires": { - "d": "1", - "es5-ext": "~0.10.14", - "es6-iterator": "~2.0.1", - "es6-symbol": "3.1.1", - "event-emitter": "~0.3.5" - } - }, - "es6-symbol": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", - "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "escodegen": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz", - "integrity": "sha1-8CQBb1qI4Eb9EgBQVek5gC5sXyM=", - "requires": { - "esprima": "~1.1.1", - "estraverse": "~1.5.0", - "esutils": "~1.0.0", - "source-map": "~0.1.33" - } - }, - "esprima": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.1.1.tgz", - "integrity": "sha1-W28VR/TRAuZw4UDFCb5ncdautUk=" - }, - "estraverse": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz", - "integrity": "sha1-hno+jlip+EYYr7bC3bzZFrfLr3E=" - }, - "esutils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.0.0.tgz", - "integrity": "sha1-gVHTWOIMisx/t0XnRywAJf5JZXA=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, - "event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } - }, - "exec-sh": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.2.2.tgz", - "integrity": "sha512-FIUCJz1RbuS0FKTdaAafAByGS0CPvU3R0MeHxgtl+djzCc//F8HakL8GzmVNZanasTbTAY/3DRFA0KpVqj/eAw==", - "dev": true, - "requires": { - "merge": "^1.2.0" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", - "dev": true - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "express": { - "version": "4.16.4", - "resolved": "https://registry.npmjs.org/express/-/express-4.16.4.tgz", - "integrity": "sha512-j12Uuyb4FMrd/qQAm6uCHAkPtO8FDTRJZBDd5D2KOL2eLaz1yUNdUB/NOIyq0iU4q4cFarsUCrnFDPBcnksuOg==", - "requires": { - "accepts": "~1.3.5", - "array-flatten": "1.1.1", - "body-parser": "1.18.3", - "content-disposition": "0.5.2", - "content-type": "~1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.1.1", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.4", - "qs": "6.5.2", - "range-parser": "~1.2.0", - "safe-buffer": "5.1.2", - "send": "0.16.2", - "serve-static": "1.13.2", - "setprototypeof": "1.1.0", - "statuses": "~1.4.0", - "type-is": "~1.6.16", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", - "dev": true - }, - "figures": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", - "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5", - "object-assign": "^4.1.0" - } - }, - "fill-keys": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", - "integrity": "sha1-mo+jb06K1jTjv2tPPIiCVRRS6yA=", - "dev": true, - "requires": { - "is-object": "~1.0.1", - "merge-descriptors": "~1.0.0" - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "finalhandler": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", - "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.2", - "statuses": "~1.4.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "find-parent-dir": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.0.tgz", - "integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, - "get-own-enumerable-property-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz", - "integrity": "sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg==", - "dev": true - }, - "get-stdin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", - "dev": true - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "glob-stream": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", - "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", - "requires": { - "extend": "^3.0.0", - "glob": "^7.1.1", - "glob-parent": "^3.1.0", - "is-negated-glob": "^1.0.0", - "ordered-read-streams": "^1.0.0", - "pumpify": "^1.3.5", - "readable-stream": "^2.1.5", - "remove-trailing-separator": "^1.0.1", - "to-absolute-glob": "^2.0.0", - "unique-stream": "^2.0.2" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "handlebars": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", - "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", - "dev": true, - "requires": { - "async": "^2.5.0", - "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", - "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - } - } - }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, - "help-me": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/help-me/-/help-me-1.1.0.tgz", - "integrity": "sha1-jy1QjQYAtKRW2i8IZVbn5cBWo8Y=", - "requires": { - "callback-stream": "^1.0.2", - "glob-stream": "^6.1.0", - "through2": "^2.0.1", - "xtend": "^4.0.0" - } - }, - "hosted-git-info": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", - "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", - "dev": true - }, - "htmlparser2": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", - "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", - "dev": true, - "requires": { - "domelementtype": "1", - "domhandler": "2.3", - "domutils": "1.5", - "entities": "1.0", - "readable-stream": "1.1" - } - }, - "http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "husky": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/husky/-/husky-1.1.4.tgz", - "integrity": "sha512-cZjGpS7qsaBSo3fOMUuR7erQloX3l5XzL1v/RkIqU6zrQImDdU70z5Re9fGDp7+kbYlM2EtS4aYMlahBeiCUGw==", - "dev": true, - "requires": { - "cosmiconfig": "^5.0.6", - "execa": "^1.0.0", - "find-up": "^3.0.0", - "get-stdin": "^6.0.0", - "is-ci": "^1.2.1", - "pkg-dir": "^3.0.0", - "please-upgrade-node": "^3.1.1", - "read-pkg": "^4.0.1", - "run-node": "^1.0.0", - "slash": "^2.0.0" - } - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "import-fresh": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", - "integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=", - "dev": true, - "requires": { - "caller-path": "^2.0.0", - "resolve-from": "^3.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", - "dev": true - } - } - }, - "indent-string": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", - "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "iotagent-node-lib": { - "version": "git://github.com/telefonicaid/iotagent-node-lib.git#8a649e2c8d985f2f51ad426afdcceb2a04c362ce", - "from": "git://github.com/telefonicaid/iotagent-node-lib.git#master", - "requires": { - "async": "2.6.1", - "body-parser": "~1.18.3", - "command-shell-lib": "1.0.0", - "express": "~4.16.4", - "jison": "0.4.18", - "logops": "2.1.0", - "moment": "~2.22.2", - "moment-timezone": "~0.5.21", - "mongodb": "3.1.8", - "mongoose": "5.3.6", - "mu2": "~0.5.20", - "node-uuid": "~1.4.1", - "query-string": "6.2.0", - "request": "2.88.0", - "revalidator": "~0.3.1", - "underscore": "~1.9.1" - } - }, - "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" - }, - "is-absolute": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-builtin-module": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.0.0.tgz", - "integrity": "sha512-/93sDihsAD652hrMEbJGbMAVBf1qc96kyThHQ0CAOONHaE3aROLpTjDe4WQ5aoC5ITHFxEq1z8XqSU7km+8amw==", - "dev": true, - "requires": { - "builtin-modules": "^3.0.0" - } - }, - "is-ci": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", - "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", - "dev": true, - "requires": { - "ci-info": "^1.5.0" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "is-directory": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", - "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", - "dev": true - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "requires": { - "is-extglob": "^2.1.0" - } - }, - "is-negated-glob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", - "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=" - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", - "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", - "dev": true - }, - "is-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", - "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=", - "dev": true - }, - "is-observable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-observable/-/is-observable-1.1.0.tgz", - "integrity": "sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA==", - "dev": true, - "requires": { - "symbol-observable": "^1.1.0" - } - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-regexp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", - "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", - "dev": true - }, - "is-relative": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", - "requires": { - "is-unc-path": "^1.0.0" - } - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "is-unc-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", - "requires": { - "unc-path-regex": "^0.1.2" - } - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "istanbul": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", - "dev": true, - "requires": { - "abbrev": "1.0.x", - "async": "1.x", - "escodegen": "1.8.x", - "esprima": "2.7.x", - "glob": "^5.0.15", - "handlebars": "^4.0.1", - "js-yaml": "3.x", - "mkdirp": "0.5.x", - "nopt": "3.x", - "once": "1.x", - "resolve": "1.1.x", - "supports-color": "^3.1.0", - "which": "^1.1.1", - "wordwrap": "^1.0.0" - }, - "dependencies": { - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, - "escodegen": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", - "dev": true, - "requires": { - "esprima": "^2.7.1", - "estraverse": "^1.9.1", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" - } - }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "estraverse": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "requires": { - "amdefine": ">=0.0.4" - } - } - } - }, - "jest-get-type": { - "version": "22.4.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-22.4.3.tgz", - "integrity": "sha512-/jsz0Y+V29w1chdXVygEKSz2nBoHoYqNShPe+QgxSNjAuP1i8+k4LbQNrfoliKej0P45sivkSCh7yiD6ubHS3w==", - "dev": true - }, - "jest-validate": { - "version": "23.6.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-23.6.0.tgz", - "integrity": "sha512-OFKapYxe72yz7agrDAWi8v2WL8GIfVqcbKRCLbRG9PAxtzF9b1SEDdTpytNDN12z2fJynoBwpMpvj2R39plI2A==", - "dev": true, - "requires": { - "chalk": "^2.0.1", - "jest-get-type": "^22.1.0", - "leven": "^2.1.0", - "pretty-format": "^23.6.0" - }, - "dependencies": { - "leven": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", - "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=", - "dev": true - } - } - }, - "jison": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/jison/-/jison-0.4.18.tgz", - "integrity": "sha512-FKkCiJvozgC7VTHhMJ00a0/IApSxhlGsFIshLW6trWJ8ONX2TQJBBz6DlcO1Gffy4w9LT+uL+PA+CVnUSJMF7w==", - "requires": { - "JSONSelect": "0.4.0", - "cjson": "0.3.0", - "ebnf-parser": "0.1.10", - "escodegen": "1.3.x", - "esprima": "1.1.x", - "jison-lex": "0.3.x", - "lex-parser": "~0.1.3", - "nomnom": "1.5.2" - } - }, - "jison-lex": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/jison-lex/-/jison-lex-0.3.4.tgz", - "integrity": "sha1-gcoo2E+ESZ36jFlNzePYo/Jux6U=", - "requires": { - "lex-parser": "0.1.x", - "nomnom": "1.5.2" - } - }, - "js-yaml": { - "version": "3.12.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.1.tgz", - "integrity": "sha512-um46hB9wNOKlwkHgiuyEVAybXBjwFUV0Z/RaHJblRd9DXltue9FTYvzCr9ErQrK9Adz5MU4gHWVaNUfdmrC8qA==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "dependencies": { - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true - } - } - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, - "jshint": { - "version": "2.9.7", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.7.tgz", - "integrity": "sha512-Q8XN38hGsVQhdlM+4gd1Xl7OB1VieSuCJf+fEJjpo59JH99bVJhXRXAh26qQ15wfdd1VPMuDWNeSWoNl53T4YA==", - "dev": true, - "requires": { - "cli": "~1.0.0", - "console-browserify": "1.1.x", - "exit": "0.1.x", - "htmlparser2": "3.8.x", - "lodash": "~4.17.10", - "minimatch": "~3.0.2", - "shelljs": "0.3.x", - "strip-json-comments": "1.0.x" - } - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsonlint": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.0.tgz", - "integrity": "sha1-iKpGvCiaesk7tGyuLVihh6m7SUo=", - "requires": { - "JSV": ">= 4.0.x", - "nomnom": ">= 1.5.x" - } - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "kareem": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.0.tgz", - "integrity": "sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg==" - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - }, - "lcov-parse": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", - "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", - "dev": true - }, - "leven": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/leven/-/leven-1.0.2.tgz", - "integrity": "sha1-kUS27ryl8dBoAWnxpncNzqYLdcM=" - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "lex-parser": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/lex-parser/-/lex-parser-0.1.4.tgz", - "integrity": "sha1-ZMTwJfF/1Tv7RXY/rrFvAVp0dVA=" - }, - "lint-staged": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-7.3.0.tgz", - "integrity": "sha512-AXk40M9DAiPi7f4tdJggwuKIViUplYtVj1os1MVEteW7qOkU50EOehayCfO9TsoGK24o/EsWb41yrEgfJDDjCw==", - "dev": true, - "requires": { - "chalk": "^2.3.1", - "commander": "^2.14.1", - "cosmiconfig": "^5.0.2", - "debug": "^3.1.0", - "dedent": "^0.7.0", - "execa": "^0.9.0", - "find-parent-dir": "^0.3.0", - "is-glob": "^4.0.0", - "is-windows": "^1.0.2", - "jest-validate": "^23.5.0", - "listr": "^0.14.1", - "lodash": "^4.17.5", - "log-symbols": "^2.2.0", - "micromatch": "^3.1.8", - "npm-which": "^3.0.1", - "p-map": "^1.1.1", - "path-is-inside": "^1.0.2", - "pify": "^3.0.0", - "please-upgrade-node": "^3.0.2", - "staged-git-files": "1.1.1", - "string-argv": "^0.0.2", - "stringify-object": "^3.2.2" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "execa": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.9.0.tgz", - "integrity": "sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA==", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "is-glob": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", - "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - } - } - }, - "listr": { - "version": "0.14.3", - "resolved": "https://registry.npmjs.org/listr/-/listr-0.14.3.tgz", - "integrity": "sha512-RmAl7su35BFd/xoMamRjpIE4j3v+L28o8CT5YhAXQJm1fD+1l9ngXY8JAQRJ+tFK2i5njvi0iRUKV09vPwA0iA==", - "dev": true, - "requires": { - "@samverschueren/stream-to-observable": "^0.3.0", - "is-observable": "^1.1.0", - "is-promise": "^2.1.0", - "is-stream": "^1.1.0", - "listr-silent-renderer": "^1.1.1", - "listr-update-renderer": "^0.5.0", - "listr-verbose-renderer": "^0.5.0", - "p-map": "^2.0.0", - "rxjs": "^6.3.3" - }, - "dependencies": { - "p-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.0.0.tgz", - "integrity": "sha512-GO107XdrSUmtHxVoi60qc9tUl/KkNKm+X2CF4P9amalpGxv5YqVPJNfSb0wcA+syCopkZvYYIzW8OVTQW59x/w==", - "dev": true - } - } - }, - "listr-silent-renderer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz", - "integrity": "sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=", - "dev": true - }, - "listr-update-renderer": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/listr-update-renderer/-/listr-update-renderer-0.5.0.tgz", - "integrity": "sha512-tKRsZpKz8GSGqoI/+caPmfrypiaq+OQCbd+CovEC24uk1h952lVj5sC7SqyFUm+OaJ5HN/a1YLt5cit2FMNsFA==", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "cli-truncate": "^0.2.1", - "elegant-spinner": "^1.0.1", - "figures": "^1.7.0", - "indent-string": "^3.0.0", - "log-symbols": "^1.0.2", - "log-update": "^2.3.0", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "log-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", - "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", - "dev": true, - "requires": { - "chalk": "^1.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "listr-verbose-renderer": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/listr-verbose-renderer/-/listr-verbose-renderer-0.5.0.tgz", - "integrity": "sha512-04PDPqSlsqIOaaaGZ+41vq5FejI9auqTInicFRndCBgE3bXG8D6W1I+mWhk+1nqbHmyhla/6BUrd5OSiHwKRXw==", - "dev": true, - "requires": { - "chalk": "^2.4.1", - "cli-cursor": "^2.1.0", - "date-fns": "^1.27.2", - "figures": "^2.0.0" - }, - "dependencies": { - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - } - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" - }, - "lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" - }, - "log-driver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", - "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", - "dev": true - }, - "log-symbols": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", - "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", - "dev": true, - "requires": { - "chalk": "^2.0.1" - } - }, - "log-update": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-2.3.0.tgz", - "integrity": "sha1-iDKP19HOeTiykoN0bwsbwSayRwg=", - "dev": true, - "requires": { - "ansi-escapes": "^3.0.0", - "cli-cursor": "^2.0.0", - "wrap-ansi": "^3.0.1" - } - }, - "logops": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/logops/-/logops-2.1.0.tgz", - "integrity": "sha1-mHIkVNeHG9KqR2j7QWZvFCuVNc8=", - "requires": { - "colors": "^1.1.2", - "lodash": "^4.1.0", - "safe-json-stringify": "^1.0.4", - "serr": "^1.0.0" - }, - "dependencies": { - "colors": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", - "integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==" - } - } - }, - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==", - "optional": true - }, - "merge": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz", - "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==", - "dev": true - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "mime": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", - "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" - }, - "mime-db": { - "version": "1.37.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", - "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" - }, - "mime-types": { - "version": "2.1.21", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", - "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", - "requires": { - "mime-db": "~1.37.0" - } - }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" - }, - "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, - "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", - "dev": true, - "requires": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" - }, - "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "module-not-found-error": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", - "integrity": "sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=", - "dev": true - }, - "moment": { - "version": "2.22.2", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", - "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" - }, - "moment-timezone": { - "version": "0.5.23", - "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.23.tgz", - "integrity": "sha512-WHFH85DkCfiNMDX5D3X7hpNH3/PUhjTGcD0U1SgfBGZxJ3qUmJh5FdvaFjcClxOvB3rzdfj4oRffbI38jEnC1w==", - "requires": { - "moment": ">= 2.9.0" - } - }, - "mongodb": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.8.tgz", - "integrity": "sha512-yNKwYxQ6m00NV6+pMoWoheFTHSQVv1KkSrfOhRDYMILGWDYtUtQRqHrFqU75rmPIY8hMozVft8zdC4KYMWaM3Q==", - "requires": { - "mongodb-core": "3.1.7", - "safe-buffer": "^5.1.2" - } - }, - "mongodb-core": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.7.tgz", - "integrity": "sha512-YffpSrLmgFNmrvkGx+yX00KyBNk64C0BalfEn6vHHkXtcMUGXw8nxrMmhq5eXPLLlYeBpD/CsgNxE2Chf0o4zQ==", - "requires": { - "bson": "^1.1.0", - "require_optional": "^1.0.1", - "safe-buffer": "^5.1.2", - "saslprep": "^1.0.0" - } - }, - "mongoose": { - "version": "5.3.6", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.3.6.tgz", - "integrity": "sha512-EuHmtc7T6dIaHANd/A6J7dSSRhw9LVWdiGcmFYzOCdIYWwbrc1k5klN8U57KKeJUPvfhgVCmm6p5L5VueVpSjw==", - "requires": { - "async": "2.6.1", - "bson": "~1.0.5", - "kareem": "2.3.0", - "lodash.get": "4.4.2", - "mongodb": "3.1.6", - "mongodb-core": "3.1.5", - "mongoose-legacy-pluralize": "1.0.2", - "mpath": "0.5.1", - "mquery": "3.2.0", - "ms": "2.0.0", - "regexp-clone": "0.0.1", - "safe-buffer": "5.1.2", - "sliced": "1.0.1" - }, - "dependencies": { - "bson": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/bson/-/bson-1.0.9.tgz", - "integrity": "sha512-IQX9/h7WdMBIW/q/++tGd+emQr0XMdeZ6icnT/74Xk9fnabWn+gZgpE+9V+gujL3hhJOoNrnDVY7tWdzc7NUTg==" - }, - "mongodb": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.1.6.tgz", - "integrity": "sha512-E5QJuXQoMlT7KyCYqNNMfAkhfQD79AT4F8Xd+6x37OX+8BL17GyXyWvfm6wuyx4wnzCCPoCSLeMeUN2S7dU9yw==", - "requires": { - "mongodb-core": "3.1.5", - "safe-buffer": "^5.1.2" - } - }, - "mongodb-core": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-3.1.5.tgz", - "integrity": "sha512-emT/tM4ZBinqd6RZok+EzDdtN4LjYJIckv71qQVOEFmvXgT5cperZegVmTgox/1cx4XQu6LJ5ZuIwipP/eKdQg==", - "requires": { - "bson": "^1.1.0", - "require_optional": "^1.0.1", - "safe-buffer": "^5.1.2", - "saslprep": "^1.0.0" - }, - "dependencies": { - "bson": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.0.tgz", - "integrity": "sha512-9Aeai9TacfNtWXOYarkFJRW2CWo+dRon+fuLZYJmvLV3+MiUp0bEI6IAZfXEIg7/Pl/7IWlLaDnhzTsD81etQA==" - } - } - } - } - }, - "mongoose-legacy-pluralize": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/mongoose-legacy-pluralize/-/mongoose-legacy-pluralize-1.0.2.tgz", - "integrity": "sha512-Yo/7qQU4/EyIS8YDFSeenIvXxZN+ld7YdV9LqFVQJzTLye8unujAWPZ4NWKfFA+RNjh+wvTWKY9Z3E5XM6ZZiQ==" - }, - "mpath": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.5.1.tgz", - "integrity": "sha512-H8OVQ+QEz82sch4wbODFOz+3YQ61FYz/z3eJ5pIdbMEaUzDqA268Wd+Vt4Paw9TJfvDgVKaayC0gBzMIw2jhsg==" - }, - "mqtt": { - "version": "2.18.8", - "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-2.18.8.tgz", - "integrity": "sha512-3h6oHlPY/yWwtC2J3geraYRtVVoRM6wdI+uchF4nvSSafXPZnaKqF8xnX+S22SU/FcgEAgockVIlOaAX3fkMpA==", - "requires": { - "commist": "^1.0.0", - "concat-stream": "^1.6.2", - "end-of-stream": "^1.4.1", - "es6-map": "^0.1.5", - "help-me": "^1.0.1", - "inherits": "^2.0.3", - "minimist": "^1.2.0", - "mqtt-packet": "^5.6.0", - "pump": "^3.0.0", - "readable-stream": "^2.3.6", - "reinterval": "^1.1.0", - "split2": "^2.1.1", - "websocket-stream": "^5.1.2", - "xtend": "^4.0.1" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "mqtt-packet": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-5.6.0.tgz", - "integrity": "sha512-QECe2ivqcR1LRsPobRsjenEKAC3i1a5gmm+jNKJLrsiq9PaSQ18LlKFuxvhGxWkvGEPadWv6rKd31O4ICqS1Xw==", - "requires": { - "bl": "^1.2.1", - "inherits": "^2.0.3", - "process-nextick-args": "^2.0.0", - "safe-buffer": "^5.1.0" - } - }, - "mquery": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.0.tgz", - "integrity": "sha512-qPJcdK/yqcbQiKoemAt62Y0BAc0fTEKo1IThodBD+O5meQRJT/2HSe5QpBNwaa4CjskoGrYWsEyjkqgiE0qjhg==", - "requires": { - "bluebird": "3.5.1", - "debug": "3.1.0", - "regexp-clone": "0.0.1", - "safe-buffer": "5.1.2", - "sliced": "1.0.1" - }, - "dependencies": { - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "mu2": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/mu2/-/mu2-0.5.21.tgz", - "integrity": "sha1-iIqPD9kOsc/anbgUdvbhmcyeWNM=" - }, - "nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - } - }, - "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" - }, - "next-tick": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", - "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" - }, - "nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true - }, - "nock": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/nock/-/nock-10.0.1.tgz", - "integrity": "sha512-M0aL9IDbUFURmokoXqejZQybZk8EtlYjUBjaoICVbW62uOlyPRsnEsceyOlUik4spCOt50ptwM4BTPt20ITtcQ==", - "dev": true, - "requires": { - "chai": "^4.1.2", - "debug": "^4.1.0", - "deep-equal": "^1.0.0", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.5", - "mkdirp": "^0.5.0", - "propagate": "^1.0.0", - "qs": "^6.5.1", - "semver": "^5.5.0" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true - } - } - }, - "node-uuid": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", - "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" - }, - "nomnom": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz", - "integrity": "sha1-9DRUSKhTz71cDSYyDyR3qwUm/i8=", - "requires": { - "colors": "0.5.x", - "underscore": "1.1.x" - }, - "dependencies": { - "underscore": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz", - "integrity": "sha1-QLq4S60Z0jAJbo1u9ii/8FXYPbA=" - } - } - }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "dev": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-package-data": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.1.tgz", - "integrity": "sha512-ZVuHxWJv1bopjv/SD5uPhgwUhLqxdJ+SsdUQbGR9HWlXrvnd/C08Cn9Bq48PbvX3y5V97GIpAHpL5Bk9BwChGg==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "is-builtin-module": "^3.0.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "npm-path": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.4.tgz", - "integrity": "sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==", - "dev": true, - "requires": { - "which": "^1.2.10" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "npm-which": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/npm-which/-/npm-which-3.0.1.tgz", - "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", - "dev": true, - "requires": { - "commander": "^2.9.0", - "npm-path": "^2.0.2", - "which": "^1.2.10" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, - "dependencies": { - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", - "dev": true - }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - } - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "wordwrap": "~1.0.0" - } - }, - "ordered-read-streams": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", - "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", - "requires": { - "readable-stream": "^2.0.1" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz", - "integrity": "sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "p-map": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", - "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", - "dev": true - }, - "p-try": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", - "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", - "dev": true - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" - }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "pkg-dir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", - "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", - "dev": true, - "requires": { - "find-up": "^3.0.0" - } - }, - "please-upgrade-node": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz", - "integrity": "sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ==", - "dev": true, - "requires": { - "semver-compare": "^1.0.0" - } - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, - "prelude-ls": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true - }, - "prettier": { - "version": "1.14.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.14.3.tgz", - "integrity": "sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg==", - "dev": true - }, - "pretty-format": { - "version": "23.6.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-23.6.0.tgz", - "integrity": "sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw==", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0", - "ansi-styles": "^3.2.0" - } - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" - }, - "propagate": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", - "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=", - "dev": true - }, - "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" - } - }, - "proxyquire": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.0.tgz", - "integrity": "sha512-kptdFArCfGRtQFv3Qwjr10lwbEV0TBJYvfqzhwucyfEXqVgmnAkyEw/S3FYzR5HI9i5QOq4rcqQjZ6AlknlCDQ==", - "dev": true, - "requires": { - "fill-keys": "^1.0.2", - "module-not-found-error": "^1.0.0", - "resolve": "~1.8.1" - }, - "dependencies": { - "resolve": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", - "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } - } - } - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "psl": { - "version": "1.1.31", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", - "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==" - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", - "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - }, - "dependencies": { - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "query-string": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.2.0.tgz", - "integrity": "sha512-5wupExkIt8RYL4h/FE+WTg3JHk62e6fFPWtAZA9J5IWK1PfTfKkMS93HBUHcFpeYi9KsY5pFbh+ldvEyaz5MyA==", - "requires": { - "decode-uri-component": "^0.2.0", - "strict-uri-encode": "^2.0.0" - } - }, - "querystringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.0.tgz", - "integrity": "sha512-sluvZZ1YiTLD5jsqZcDmFyV2EwToyXZBfpoVOmktMmW+VEnhgakFHnasVph65fOjGPTWN0Nw3+XQaSeMayr0kg==" - }, - "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" - }, - "raw-body": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.3", - "iconv-lite": "0.4.23", - "unpipe": "1.0.0" - } - }, - "read-pkg": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz", - "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=", - "dev": true, - "requires": { - "normalize-package-data": "^2.3.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0" - } - }, - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "regexp-clone": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz", - "integrity": "sha1-p8LgmJH9vzj7sQ03b7cwA+aKxYk=" - }, - "reinterval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reinterval/-/reinterval-1.1.0.tgz", - "integrity": "sha1-M2Hs+jymwYKDOA3Qu5VG85D17Oc=" - }, - "remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" - }, - "repeat-element": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", - "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - } - } - }, - "require_optional": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", - "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", - "requires": { - "resolve-from": "^2.0.0", - "semver": "^5.1.0" - } - }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - }, - "resolve-from": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", - "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true - }, - "revalidator": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.3.1.tgz", - "integrity": "sha1-/yzEz3zHxjhaxxAXgnbm280Ddi8=" - }, - "run-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/run-node/-/run-node-1.0.0.tgz", - "integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==", - "dev": true - }, - "rxjs": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz", - "integrity": "sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safe-json-stringify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", - "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==" - }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", - "dev": true, - "requires": { - "ret": "~0.1.10" - } - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "saslprep": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.2.tgz", - "integrity": "sha512-4cDsYuAjXssUSjxHKRe4DTZC0agDwsCqcMqtJAQPzC74nJ7LfAJflAtC1Zed5hMzEQKj82d3tuzqdGNRsLJ4Gw==", - "optional": true, - "requires": { - "sparse-bitfield": "^3.0.3" - } - }, - "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" - }, - "semver-compare": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", - "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", - "dev": true - }, - "send": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/send/-/send-0.16.2.tgz", - "integrity": "sha512-E64YFPUssFHEFBvpbbjr44NCLtI1AohxQ8ZSiJjQLskAdKuriYEP6VyGEsRDH8ScozGpkaX1BGvhanqCwkcEZw==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "~2.3.0", - "range-parser": "~1.2.0", - "statuses": "~1.4.0" - }, - "dependencies": { - "statuses": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", - "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" - } - } - }, - "serr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/serr/-/serr-1.0.1.tgz", - "integrity": "sha1-dKW55/rdW1X4qF5+crwApBm25II=", - "requires": { - "lodash": "^4.0.0" - } - }, - "serve-static": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.2.tgz", - "integrity": "sha512-p/tdJrO4U387R9oMjb1oj7qSMaMfmOyd4j9hOFoxZe2baQszgHcSWjuya/CiT5kgZZKRudHNOA0pYXOl8rQ5nw==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.2", - "send": "0.16.2" - } - }, - "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shelljs": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", - "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", - "dev": true - }, - "should": { - "version": "13.2.3", - "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", - "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", - "dev": true, - "requires": { - "should-equal": "^2.0.0", - "should-format": "^3.0.3", - "should-type": "^1.4.0", - "should-type-adaptors": "^1.0.1", - "should-util": "^1.0.0" - } - }, - "should-equal": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", - "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", - "dev": true, - "requires": { - "should-type": "^1.4.0" - } - }, - "should-format": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", - "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=", - "dev": true, - "requires": { - "should-type": "^1.3.0", - "should-type-adaptors": "^1.0.1" - } - }, - "should-type": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", - "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=", - "dev": true - }, - "should-type-adaptors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", - "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", - "dev": true, - "requires": { - "should-type": "^1.3.0", - "should-util": "^1.0.0" - } - }, - "should-util": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz", - "integrity": "sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slash": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", - "dev": true - }, - "slice-ansi": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", - "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", - "dev": true - }, - "sliced": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", - "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" - }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "source-map": { - "version": "0.1.43", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", - "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", - "optional": true, - "requires": { - "amdefine": ">=0.0.4" - } - }, - "source-map-resolve": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", - "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", - "dev": true, - "requires": { - "atob": "^2.1.1", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=", - "optional": true, - "requires": { - "memory-pager": "^1.0.2" - } - }, - "spdx-correct": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", - "integrity": "sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q==", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz", - "integrity": "sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA==", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", - "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.3.tgz", - "integrity": "sha512-uBIcIl3Ih6Phe3XHK1NqboJLdGfwr1UN3k6wSD1dZpmPsIkb8AGNbZYJ1fOBk834+Gxy8rpfDxrS6XLEMZMY2g==", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "split2": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", - "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", - "requires": { - "through2": "^2.0.2" - } - }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "staged-git-files": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/staged-git-files/-/staged-git-files-1.1.1.tgz", - "integrity": "sha512-H89UNKr1rQJvI1c/PIR3kiAMBV23yvR7LItZiV74HWZwzt7f3YHuujJ9nJZlt58WlFox7XQsOahexwk7nTe69A==", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, - "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" - }, - "strict-uri-encode": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", - "integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY=" - }, - "string-argv": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.0.2.tgz", - "integrity": "sha1-2sMECGkMIfPDYwo/86BYd73L1zY=", - "dev": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" - }, - "stringify-object": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz", - "integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==", - "dev": true, - "requires": { - "get-own-enumerable-property-symbols": "^3.0.0", - "is-obj": "^1.0.1", - "is-regexp": "^1.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - } - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "strip-json-comments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", - "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", - "dev": true - }, - "supports-color": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", - "dev": true, - "requires": { - "has-flag": "^1.0.0" - } - }, - "symbol-observable": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", - "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", - "dev": true - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "through2-filter": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz", - "integrity": "sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==", - "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" - } - }, - "to-absolute-glob": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", - "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", - "requires": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" - } - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - } - } - }, - "tslib": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", - "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", - "dev": true - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "type-check": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - }, - "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.18" - } - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" - }, - "uglify-js": { - "version": "3.4.9", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", - "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", - "dev": true, - "optional": true, - "requires": { - "commander": "~2.17.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true - } - } - }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, - "unc-path-regex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", - "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" - }, - "underscore": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", - "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" - }, - "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } - } - }, - "unique-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz", - "integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==", - "requires": { - "json-stable-stringify-without-jsonify": "^1.0.1", - "through2-filter": "^3.0.0" - } - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - } - } - }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "requires": { - "punycode": "^2.1.0" - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "url-parse": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.4.tgz", - "integrity": "sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg==", - "requires": { - "querystringify": "^2.0.0", - "requires-port": "^1.0.0" - } - }, - "use": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" - }, - "validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "watch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/watch/-/watch-1.0.2.tgz", - "integrity": "sha1-NApxe952Vyb6CqB9ch4BR6VR3ww=", - "dev": true, - "requires": { - "exec-sh": "^0.2.0", - "minimist": "^1.2.0" - } - }, - "websocket-stream": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/websocket-stream/-/websocket-stream-5.1.2.tgz", - "integrity": "sha512-lchLOk435iDWs0jNuL+hiU14i3ERSrMA0IKSiJh7z6X/i4XNsutBZrtqu2CPOZuA4G/zabiqVAos0vW+S7GEVw==", - "requires": { - "duplexify": "^3.5.1", - "inherits": "^2.0.1", - "readable-stream": "^2.3.3", - "safe-buffer": "^5.1.1", - "ws": "^3.2.0", - "xtend": "^4.0.0" - }, - "dependencies": { - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, - "wrap-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-3.0.1.tgz", - "integrity": "sha1-KIoE2H7aXChuBg3+jxNc6NAH+Lo=", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" - }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - } - } -} From 7657825637da9acef8f32c0282e94281d8ac58e0 Mon Sep 17 00:00:00 2001 From: Jason Fox Date: Wed, 27 Feb 2019 13:08:43 +0100 Subject: [PATCH 15/15] Add prettier ignore overrides --- lib/bindings/MQTTBinding.js | 11 ++--- lib/errors.js | 8 ++-- test/unit/startup-test.js | 90 ++++++++++++++++++------------------- 3 files changed, 52 insertions(+), 57 deletions(-) diff --git a/lib/bindings/MQTTBinding.js b/lib/bindings/MQTTBinding.js index 633c20c1..98ab5905 100644 --- a/lib/bindings/MQTTBinding.js +++ b/lib/bindings/MQTTBinding.js @@ -94,15 +94,10 @@ function sendConfigurationToDevice(apiKey, deviceId, results, callback) { } config.getLogger().debug(context, 'Sending requested configuration to the device:\n %j', configurations); + //prettier-ignore mqttClient.publish( - '/' + - apiKey + - '/' + - deviceId + - '/' + - constants.CONFIGURATION_SUFIX + - '/' + - constants.CONFIGURATION_VALUES_SUFIX, + '/' + apiKey + '/' + deviceId + '/' + constants.CONFIGURATION_SUFIX + '/' + + constants.CONFIGURATION_VALUES_SUFIX, JSON.stringify(configurations), options, callback diff --git a/lib/errors.js b/lib/errors.js index c04a9eec..69be8f5b 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -50,11 +50,11 @@ module.exports = { UnsupportedType: function(expectedType) { this.name = 'UNSUPPORTED_TYPE'; this.message = + //prettier-ignore /*jshint quotmark: double */ - "The request content didn't have the expected type [" + - /*jshint quotmark: single */ - expectedType + - ' ]'; + "The request content didn't have the expected type [" + expectedType + " ]"; + /*jshint quotmark: single */ + this.code = 400; }, DeviceNotFound: function(deviceId) { diff --git a/test/unit/startup-test.js b/test/unit/startup-test.js index b44d133e..8bc26700 100644 --- a/test/unit/startup-test.js +++ b/test/unit/startup-test.js @@ -81,21 +81,21 @@ describe('Startup tests', function() { iotagentJSON.start(iotAgentConfig, function(error) { should.not.exist(error); - mqtt.connect - .calledOnceWithExactly({ - ca: null, - cert: null, - connectTimeout: 3600000, - host: '127.0.0.1', - keepalive: 0, - key: null, - password: 'passmqtt', - port: '1883', - protocol: 'mqtt', - rejectUnauthorized: true, - username: 'usermqtt' - }) - .should.equal(true); + //prettier-ignore + mqtt.connect.calledOnceWithExactly({ + ca: null, + cert: null, + connectTimeout: 3600000, + host: '127.0.0.1', + keepalive: 0, + key: null, + password: 'passmqtt', + port: '1883', + protocol: 'mqtt', + rejectUnauthorized: true, + username: 'usermqtt' + }) + .should.equal(true); var mqttConfig = config.getConfig().mqtt; mqttConfig.host.should.equal('127.0.0.1'); @@ -120,21 +120,21 @@ describe('Startup tests', function() { iotagentJSON.start(iotAgentConfig, function(error) { should.not.exist(error); - mqtt.connect - .calledOnceWithExactly({ - ca: null, - cert: null, - connectTimeout: 3600000, - host: '127.0.0.1', - keepalive: 0, - key: null, - password: null, - port: '8883', - protocol: 'mqtts', - rejectUnauthorized: false, - username: null - }) - .should.equal(true); + //prettier-ignore + mqtt.connect.calledOnceWithExactly({ + ca: null, + cert: null, + connectTimeout: 3600000, + host: '127.0.0.1', + keepalive: 0, + key: null, + password: null, + port: '8883', + protocol: 'mqtts', + rejectUnauthorized: false, + username: null + }) + .should.equal(true); var mqttConfig = config.getConfig().mqtt; mqttConfig.protocol.should.equal('mqtts'); @@ -169,21 +169,21 @@ describe('Startup tests', function() { iotagentJSON.start(iotAgentConfig, function(error) { should.not.exist(error); - mqtt.connect - .calledOnceWithExactly({ - ca: 'cacontent', - cert: 'certcontent', - connectTimeout: 3600000, - host: '127.0.0.1', - keepalive: 0, - key: 'keycontent', - password: null, - port: '8883', - protocol: 'mqtts', - rejectUnauthorized: true, - username: null - }) - .should.equal(true); + //prettier-ignore + mqtt.connect.calledOnceWithExactly({ + ca: 'cacontent', + cert: 'certcontent', + connectTimeout: 3600000, + host: '127.0.0.1', + keepalive: 0, + key: 'keycontent', + password: null, + port: '8883', + protocol: 'mqtts', + rejectUnauthorized: true, + username: null + }) + .should.equal(true); var mqttConfig = config.getConfig().mqtt; mqttConfig.protocol.should.equal('mqtts');