diff --git a/.gitignore b/.gitignore index 51de42b..d893c9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ -/node_modules/homey-zwavedriver/.npmignore /env.json /.vscode /*.png +/node_modules/ + +# Using Homey Compose +/app.json diff --git a/.homeycompose/app.json b/.homeycompose/app.json new file mode 100644 index 0000000..7a9284a --- /dev/null +++ b/.homeycompose/app.json @@ -0,0 +1,65 @@ +{ + "id": "com.sensative", + "sdk": 2, + "name": { + "en": "Sensative", + "nl": "Sensative" + }, + "description": { + "en": "Sensative Z-Wave Strips support for Homey", + "nl": "Sensative Z-Wave Strips ondersteuning voor Homey" + }, + "category": [ + "appliances", + "security", + "climate" + ], + "images": { + "large": "/assets/images/large.png", + "small": "/assets/images/small.png" + }, + "version": "2.2.0", + "compatibility": ">=1.5.6", + "tags": { + "en": [ + "security", + "alarm", + "contact", + "window", + "door", + "temperature", + "humidity" + ], + "nl": [ + "beveiliging", + "alarm", + "contact", + "raam", + "deur", + "temperatuur", + "vochtigheid" + ] + }, + "author": { + "name": "Marcel Veldhuizen", + "email": "marcel@thorarin.net" + }, + "contributors": { + "developers": [ + { + "name": "Marcel Veldhuizen", + "email": "marcel@thorarin.net" + }, + { + "name": "Marco Ruiter", + "email": "mruiter@tuxweb.nl" + } + ] + }, + "bugs": { + "url": "https://github.com/Thorarin/com.sensative/issues" + }, + "source": "https://github.com/Thorarin/com.sensative", + "homepage": "https://homey.app", + "support": "mailto:sensative@thorarin.net" +} \ No newline at end of file diff --git a/.homeycompose/drivers/settings/maintenanceActions.json b/.homeycompose/drivers/settings/maintenanceActions.json new file mode 100644 index 0000000..8874b39 --- /dev/null +++ b/.homeycompose/drivers/settings/maintenanceActions.json @@ -0,0 +1,13 @@ +{ + "id": "maintenance_actions", + "label": { + "en": "Maintenance actions", + "nl": "Maintenance actions" + }, + "hint": { + "en": "Disabling this hides maintenance actions on this device. Maintenance actions are known to confuse HomeyKit, classifying the sensor as a switch.", + "nl": "Wanneer uitgeschakeld worden de onderhoudsacties voor dit apparaat verborgen. Onderhoudsacties verwarren HomeyKit, waardoor de sensor als schakelaar geclassificeerd wordt." + }, + "type": "checkbox", + "value": true +} \ No newline at end of file diff --git a/.homeycompose/drivers/settings/tamperAlarm.json b/.homeycompose/drivers/settings/tamperAlarm.json new file mode 100644 index 0000000..37f21a7 --- /dev/null +++ b/.homeycompose/drivers/settings/tamperAlarm.json @@ -0,0 +1,13 @@ +{ + "id": "tamper_alarm", + "label": { + "en": "Tamper alarm", + "nl": "Sabotage-alarm" + }, + "hint": { + "en": "Used to show or hide the tamper alarm capability.", + "nl": "Hiermee kan de sabotage-alarmfunctie getoond of verborgen worden." + }, + "type": "checkbox", + "value": true +} \ No newline at end of file diff --git a/.homeyignore b/.homeyignore index e13ae84..fffa808 100644 --- a/.homeyignore +++ b/.homeyignore @@ -1,3 +1,33 @@ -/node_modules/homey-meshdriver/examples +# Exclude development assets *.psd /*.png +/drivers/**/*.compose.json +/package.json +/package-lock.json + +# Strip down homey-meshdriver to bare minimum for supported devices +/node_modules/homey-meshdriver/assets +/node_modules/homey-meshdriver/examples +/node_modules/homey-meshdriver/jsdoc.json +/node_modules/homey-meshdriver/Gruntfile.js +/node_modules/homey-meshdriver/README.md +/node_modules/homey-meshdriver/lib/util +/node_modules/homey-meshdriver/lib/zigbee +/node_modules/homey-meshdriver/lib/zwave/ZwaveLightDevice.js +/node_modules/homey-meshdriver/lib/zwave/ZwaveLockDevice.js +/node_modules/homey-meshdriver/lib/zwave/ZwaveMeteringDevice.js +/node_modules/homey-meshdriver/lib/zwave/system/capabilities/* +!/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact +!/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat +!/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper +!/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water +!/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_battery +!/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_humidity +!/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_luminance +!/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_temperature + +# Remove modules only required by removed homey-meshdriver functionality +/node_modules/color-space +/node_modules/almost-equal +/node_modules/hsluv +/node_modules/mumath diff --git a/.homeyplugins.json b/.homeyplugins.json new file mode 100644 index 0000000..7fa530b --- /dev/null +++ b/.homeyplugins.json @@ -0,0 +1,5 @@ +[ + { + "id": "compose" + } +] \ No newline at end of file diff --git a/README.md b/README.md index 43993cf..a165879 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,14 @@ This app adds support for the Sensative Strips family of products in Homey. Release notes ------------- -**2.1.0:** +**2.2.0** +* Improved grouping of device settings +* Option to select Strips Comfort or Strips Drip in device settings, hiding unused capabilties and UI elements +* Option to enable tamper alarm capability for Comfort and Drip +* Option to disable maintenance actions. + This can help HomeyKit users to work around an issue where the sensors are displayed as switches. + +**2.1.3:** * Fixed an issue with Strips Comfort heat alarm (thanks Vegard!) * Added maintenance actions to reset alarms manually (requires Homey 3.1+) * Added battery information for all supported devices @@ -35,6 +42,20 @@ Release notes * In this initial version, Strips will be set to a simple binary sensor. I'd like to switch to using its default operating mode in the future, which may require the device to be re-added. * The US version of Strips is not yet recognized. It may be added in a future version (testers needed). + +Getting Started +--------------- +If you haven't already installed the Homey CLI, do that first: + + npm i -g homey + +After that, running the app on your Homey is easy: + + npm i + npm start + +Of course, you're free to call `homey app run` manually, but you may have to copy the `app.json` from the `.homeycompose` folder once before being able to run the application. + Disclaimer ---------- -This application is not affiliated with Sensative AB. Sensative AB is not responsible for the operation or content of this application. +This application is not affiliated with Sensative AB. Sensative AB is not responsible for the operation or content of this application. \ No newline at end of file diff --git a/app.js b/app.js index 27aeaf6..327b21a 100644 --- a/app.js +++ b/app.js @@ -1,7 +1,6 @@ 'use strict'; const Homey = require('homey'); -require('homey-log').Log; class SensativeZwave extends Homey.App { diff --git a/app.json b/app.json deleted file mode 100644 index 5184fcd..0000000 --- a/app.json +++ /dev/null @@ -1,551 +0,0 @@ -{ - "id": "com.sensative", - "sdk": 2, - "name": { - "en": "Sensative", - "nl": "Sensative" - }, - "description": { - "en": "Sensative Z-Wave Strips support for Homey", - "nl": "Sensative Z-Wave Strips ondersteuning voor Homey" - }, - "category": [ - "appliances", - "security", - "climate" - ], - "images": { - "large": "/assets/images/large.png", - "small": "/assets/images/small.png" - }, - "version": "2.1.3", - "compatibility": ">=1.5.6", - "tags": { - "en": [ - "security", - "alarm", - "contact", - "window", - "door", - "temperature", - "humidity" - ], - "nl": [ - "beveiliging", - "alarm", - "contact", - "raam", - "deur", - "temperatuur", - "vochtigheid" - ] - }, - "author": { - "name": "Marcel Veldhuizen", - "email": "marcel@thorarin.net" - }, - "contributors": { - "developers": [ - { - "name": "Marcel Veldhuizen", - "email": "marcel@thorarin.net" - }, - { - "name": "Marco Ruiter", - "email": "mruiter@tuxweb.nl" - } - ] - }, - "bugs": { - "url": "https://github.com/Thorarin/com.sensative/issues" - }, - "source": "https://github.com/Thorarin/com.sensative", - "homepage": "https://homey.app", - "support": "mailto:sensative@thorarin.net", - "drivers": [ - { - "id": "1101011", - "name": { - "en": "Strips Guard", - "nl": "Strips Guard" - }, - "zwave": { - "manufacturerId": 410, - "productTypeId": 3, - "productId": 3, - "learnmode": { - "image": "/drivers/1101011/assets/wakeup.svg", - "instruction": { - "en": "Place the round magnet at the rounded edge. When the LED blinks, move the magnet away. Repeat 3 times within 10 seconds.", - "nl": "Plaats de ronde magneet op de afgeronde zijde. Haal de magneet weer weg als de LED knippert. Herhaal 3 keer binnen 10 seconden." - } - }, - "associationGroups": [ - 1 - ], - "associationGroupsOptions": { - "1": { - "hint": { - "en": "Z-Wave Plus Lifeline" - } - } - }, - "defaultConfiguration": [ - { - "id": 1, - "size": 1, - "value": 1 - }, - { - "id": 2, - "size": 1, - "value": 1 - } - ] - }, - "class": "sensor", - "capabilities": [ - "alarm_contact", - "alarm_tamper", - "measure_battery", - "alarm_battery", - "button.reset_tamper_alarm" - ], - "capabilitiesOptions": { - "button.reset_tamper_alarm": { - "maintenanceAction": true, - "title": { - "en": "Reset tamper alarm", - "nl": "Sabotage-alarm resetten" - }, - "desc": { - "en": "Manually reset the tamper alarm after it has been triggered.", - "nl": "Schakel het sabotage-alarm handmatig uit nadat deze is getriggerd." - } - } - }, - "energy": { - "batteries": [ "INTERNAL" ] - }, - "images": { - "large": "/drivers/1101011/assets/images/large.jpg", - "small": "/drivers/1101011/assets/images/small.jpg" - }, - "settings": [ - { - "id": "report_type", - "zwave": { - "index": 1, - "size": 1 - }, - "label": { - "en": "Notification type", - "nl": "Notificatietype" - }, - "hint": { - "en": "Z-Wave command class used for reporting contact sensor events. Notification is typically best.", - "nl": "Z-Wave command class die gebruikt wordt voor rapportages van de contactsensor. Notification heeft meestal de voorkeur." - }, - "type": "dropdown", - "value": "1", - "values": [ - { - "id": "0", - "label": { - "en": "Binary Sensor", - "nl": "Binary Sensor" - } - }, - { - "id": "1", - "label": { - "en": "Notification", - "nl": "Notification" - } - } - ] - }, - { - "id": "led_indication", - "zwave": { - "index": 2, - "size": 1 - }, - "label": { - "en": "LED indication", - "nl": "led-indicatie" - }, - "hint": { - "en": "When enabled, the LED on Strips will flash shortly when the door/window is opened.", - "nl": "Wanneer ingeschakeld zal de led op Strips kort oplichten als de deur of het raam wordt geopened." - }, - "type": "checkbox", - "value": true - } - ] - }, - { - "id": "1102011", - "name": { - "en": "Strips Drip/Comfort", - "nl": "Strips Drip/Comfort" - }, - "zwave": { - "manufacturerId": 410, - "productTypeId": 3, - "productId": 10, - "learnmode": { - "image": "/drivers/1102011/assets/wakeup.svg", - "instruction": { - "en": "Place the round magnet at the rounded edge. When the LED blinks, move the magnet away. Repeat 3 times within 10 seconds.", - "nl": "Plaats de ronde magneet op de afgeronde zijde. Haal de magneet weer weg als de LED knippert. Herhaal 3 keer binnen 10 seconden." - } - }, - "associationGroups": [ - 1 - ], - "associationGroupsOptions": { - "1": { - "hint": { - "en": "Z-Wave Plus Lifeline" - } - } - } - }, - "class": "sensor", - "capabilities": [ - "measure_temperature", - "measure_luminance", - "measure_humidity", - "alarm_heat", - "alarm_water", - "measure_battery", - "alarm_battery", - "button.reset_heat_alarm", - "button.reset_water_alarm" - ], - "capabilitiesOptions": { - "button.reset_heat_alarm": { - "maintenanceAction": true, - "title": { - "en": "Reset heat alarm", - "nl": "Hitte-alarm resetten" - }, - "desc": { - "en": "Manually reset the heat alarm after it has been triggered.", - "nl": "Schakel het hitte-alarm handmatig uit nadat deze is getriggerd." - } - }, - "button.reset_water_alarm": { - "maintenanceAction": true, - "title": { - "en": "Reset water alarm", - "nl": "wateralarm resetten" - }, - "desc": { - "en": "Manually reset the water alarm after it has been triggered.", - "nl": "Schakel het wateralarm handmatig uit nadat deze is getriggerd." - } - } - }, - "energy": { - "batteries": [ "INTERNAL" ] - }, - "images": { - "large": "/drivers/1102011/assets/images/large.jpg", - "small": "/drivers/1102011/assets/images/small.jpg" - }, - "settings": [ - { - "id": "led_indication", - "zwave": { - "index": 2, - "size": 1 - }, - "label": { - "en": "LED alarm event reporting", - "nl": "LED alarm event rapportage" - }, - "type": "checkbox", - "value": true - }, - { - "id": "reporting_frequency", - "zwave": { - "index": 3, - "size": 1 - }, - "label": { - "en": "Temperature & Light reporting frequency", - "nl": "Temperatuur & Light rapportage frequency" - }, - "hint": { - "en": "Refer to the Sensative support site for details on how this affects the accuracy, number of reports and battery life", - "nl": "Kijk op de Sensative support site voor informatie over hoe dit accuraatheid, aantal rapportages en levensduur van de batterij beïnvloedt" - }, - "type": "dropdown", - "value": "1", - "values": [ - { - "id": "1", - "label": { - "en": "Normal", - "nl": "Normaal" - } - }, - { - "id": "2", - "label": { - "en": "Frequent", - "nl": "Frequent" - } - } - ] - }, - { - "id": "temperature_reporting", - "zwave": { - "index": 4, - "size": 1 - }, - "label": { - "en": "Temperature reporting", - "nl": "Temperatuur rapportage" - }, - "hint": { - "en": "Does not affect temperature alarms", - "nl": "Heeft geen invloed op temperatuuralarmering" - }, - "type": "checkbox", - "value": true - }, - { - "id": "temperature_unit", - "zwave": { - "index": 5, - "size": 1 - }, - "label": { - "en": "Temperature reporting unit", - "nl": "Temperatuur rapportage-eenheid" - }, - "hint": { - "en": "This has no effect on how Homey displays the temperature", - "nl": "Dit heeft geen invloed op hoe Homey de temperatuur weergeeft" - }, - "type": "dropdown", - "value": "0", - "values": [ - { - "id": "0", - "label": { - "en": "Celcius", - "nl": "Celcius" - } - }, - { - "id": "1", - "label": { - "en": "Fahrenheit", - "nl": "Fahrenheit" - } - } - ] - }, - { - "id": "temperature_alarms", - "zwave": { - "index": 6, - "size": 1 - }, - "label": { - "en": "Temperature alarms", - "nl": "Temperatuuralarmering" - }, - "type": "checkbox", - "value": false - }, - { - "id": "temperature_high", - "zwave": { - "index": 7, - "size": 1 - }, - "label": { - "en": "High temperature alarm level", - "nl": "Hoge temperatuur alarm niveau" - }, - "hint": { - "en": "-20 to +60 degrees Celcius", - "nl": "-20 tot +60 graden Celsius" - }, - "type": "number", - "value": 60, - "attr": { - "min": -20, - "max": 60 - } - }, - { - "id": "temperature_low", - "zwave": { - "index": 8, - "size": 1 - }, - "label": { - "en": "Low temperature alarm level", - "nl": "Lage temperatuur alarm niveau" - }, - "hint": { - "en": "-20 to +60 degrees Celcius", - "nl": "-20 tot +60 graden Celcius" - }, - "type": "number", - "value": -20, - "attr": { - "min": -20, - "max": 60 - } - }, - { - "id": "light_reporting", - "zwave": { - "index": 9, - "size": 1 - }, - "value": "1", - "label": { - "en": "Ambient light reporting", - "nl": "Omgevingslicht rapportage" - }, - "hint": { - "en": "Bounds are configured by high and low ambient light report level.", - "nl": "Bounds are configured by high and low ambient light report level." - }, - "type": "dropdown", - "values": [ - { - "id": "0", - "label": { - "en": "Off", - "nl": "Uit" - } - }, - { - "id": "1", - "label": { - "en": "On", - "nl": "Aan" - } - }, - { - "id": "2", - "label": { - "en": "Only outside configured bounds", - "nl": "Alleen buiten ingestelde grenzen" - } - } - ] - }, - { - "id": "light_high", - "zwave": { - "index": 10, - "size": 4 - }, - "label": { - "en": "High ambient light report level", - "nl": "High ambient light report level" - }, - "hint": { - "en": "3 to 64000", - "nl": "3 tot 64000" - }, - "type": "number", - "value": 40000, - "attr": { - "min": 3, - "max": 64000 - } - }, - { - "id": "light_low", - "zwave": { - "index": 11, - "size": 4 - }, - "label": { - "en": "Low ambient light report level", - "nl": "Low ambient light report level" - }, - "hint": { - "en": "1 to 42000. Must be significantly lower than high ambient light report level.", - "nl": "1 tot 42000. Must be significantly lower than high ambient light report level." - }, - "type": "number", - "value": 5000, - "attr": { - "min": 1, - "max": 42000 - } - }, - { - "id": "leakage_alarm", - "zwave": { - "index": 12, - "size": 1 - }, - "label": { - "en": "Leakage alarm", - "nl": "Lekkage-alarm" - }, - "type": "checkbox", - "value": true - }, - { - "id": "leakage_alarm_level", - "zwave": { - "index": 13, - "size": 1 - }, - "label": { - "en": "Leakage alarm level", - "nl": "Lekkage-alarm level" - }, - "hint": { - "en": "1 to 100\r\n(1=almost dry, 100=wet)", - "nl": "1 tot 100\r\n(1=Bijna droog, 100=nat)" - }, - "type": "number", - "value": 10, - "attr": { - "min": 1, - "max": 100 - } - }, - { - "id": "humidity_reporting_interval", - "zwave": { - "index": 14, - "size": 1 - }, - "label": { - "en": "Moisture reporting period", - "nl": "Vochtigheid rapportageperiode" - }, - "hint": { - "en": "0-120: Number of hours between moisture reports (0=off)", - "nl": "0-120: Aantal uren tussen vochtigheidsrapportage (0=uit)" - }, - "type": "number", - "value": 0, - "attr": { - "min": 0, - "max": 120 - } - } - ] - } - ], - "flow": {} -} \ No newline at end of file diff --git a/drivers/1101011/device.js b/drivers/1101011/device.js index 4cfde3a..f6e0b7f 100644 --- a/drivers/1101011/device.js +++ b/drivers/1101011/device.js @@ -11,18 +11,6 @@ const i18n = { } }; -function tamperReportParser(report) { - if (report && report['Notification Type'] === 'Home Security' && report.hasOwnProperty('Event (Parsed)')) { - if (report['Event (Parsed)'] === 'Tampering, Invalid Code') { - return true; - } - if (report['Event'] === 254) { - return false; - } - } - return null; -} - class StripsMaZw extends StripsZwaveDevice { async onMeshInit() { this.registerSetting('report_type', value => new Buffer([parseInt(value)])); @@ -30,21 +18,26 @@ class StripsMaZw extends StripsZwaveDevice { const settings = this.getSettings(); this.registerAlarmContactCapability(settings.report_type); - this.registerCapability('measure_battery', 'BATTERY', { getOpts: { getOnOnline: true } }); - - await this.ensureCapabilitiesAdded(['alarm_battery', 'alarm_tamper', 'button.reset_tamper_alarm']); + await this.registerDynamicCapabilities(settings, true); this.registerBatteryCapabilities(); - this.registerMaintenanceActions(); + this.updateMaintenanceActionRegistrations(); } - registerBatteryCapabilities() { - this.registerCapability('alarm_battery', 'BATTERY'); - this.registerCapability('alarm_tamper', 'NOTIFICATION', { reportParser: tamperReportParser }); + determineCapabilityIds(settings) { + const capabilities = super.determineCapabilityIds(settings); + capabilities.unshift('alarm_contact'); + return capabilities; } async onSettings(oldSettings, newSettings, changedKeysArr) { let result = await super.onSettings(oldSettings, newSettings, changedKeysArr); + // Changing capabilities here seems to crash the Homey App UI on most occasions. + //await this.registerDynamicCapabilities(newSettings, false); + // if (changedKeysArr.includes('maintenance_actions')) { + // this.updateMaintenanceActionRegistrations(); + // } + if (changedKeysArr.includes('report_type')) { this.registerAlarmContactCapability(newSettings.report_type); return i18n.settings.notificationTypeChangedSaveMessage; @@ -53,6 +46,15 @@ class StripsMaZw extends StripsZwaveDevice { return result; } + async registerDynamicCapabilities(settings, initializing) { + const addedCapabilities = await this.ensureCapabilitiesMatch(this.determineCapabilityIds(settings)); + const capabilities = initializing ? this.getCapabilities() : addedCapabilities; + + if (capabilities.includes('alarm_tamper')) { + this.registerTamperAlarmCapability(); + } + } + registerAlarmContactCapability(notificationType) { switch (notificationType) { case '0': @@ -69,14 +71,12 @@ class StripsMaZw extends StripsZwaveDevice { } } - async registerMaintenanceActions() { - const capabilities = this.getCapabilities(); - - if (!capabilities.includes('button.reset_tamper_alarm')) { - await this.addCapability('button.reset_tamper_alarm'); - } + updateMaintenanceActionRegistrations() { + const maintenanceActions = { + 'button.reset_tamper_alarm': () => this.setCapabilityValue('alarm_tamper', false) + }; - this.registerCapabilityListener('button.reset_tamper_alarm', () => this.setCapabilityValue('alarm_tamper', false)); + this.registerMaintenanceActions(maintenanceActions); } } diff --git a/drivers/1101011/driver.compose.json b/drivers/1101011/driver.compose.json new file mode 100644 index 0000000..dd9e40b --- /dev/null +++ b/drivers/1101011/driver.compose.json @@ -0,0 +1,70 @@ +{ + "name": { + "en": "Strips Guard", + "nl": "Strips Guard" + }, + "zwave": { + "manufacturerId": 410, + "productTypeId": 3, + "productId": 3, + "learnmode": { + "image": "/drivers/1101011/assets/wakeup.svg", + "instruction": { + "en": "Place the round magnet at the rounded edge. When the LED blinks, move the magnet away. Repeat 3 times within 10 seconds.", + "nl": "Plaats de ronde magneet op de afgeronde zijde. Haal de magneet weer weg als de LED knippert. Herhaal 3 keer binnen 10 seconden." + } + }, + "associationGroups": [ + 1 + ], + "associationGroupsOptions": { + "1": { + "hint": { + "en": "Z-Wave Plus Lifeline" + } + } + }, + "defaultConfiguration": [ + { + "id": 1, + "size": 1, + "value": 1 + }, + { + "id": 2, + "size": 1, + "value": 1 + } + ] + }, + "class": "sensor", + "capabilities": [ + "alarm_contact", + "alarm_tamper", + "measure_battery", + "alarm_battery", + "button.reset_tamper_alarm" + ], + "capabilitiesOptions": { + "button.reset_tamper_alarm": { + "maintenanceAction": true, + "title": { + "en": "Reset tamper alarm", + "nl": "Sabotage-alarm resetten" + }, + "desc": { + "en": "Manually reset the tamper alarm after it has been triggered.", + "nl": "Schakel het sabotage-alarm handmatig uit nadat deze is getriggerd." + } + } + }, + "energy": { + "batteries": [ + "INTERNAL" + ] + }, + "images": { + "large": "/drivers/1101011/assets/images/large.jpg", + "small": "/drivers/1101011/assets/images/small.jpg" + } +} \ No newline at end of file diff --git a/drivers/1101011/driver.settings.compose.json b/drivers/1101011/driver.settings.compose.json new file mode 100644 index 0000000..21064dd --- /dev/null +++ b/drivers/1101011/driver.settings.compose.json @@ -0,0 +1,67 @@ +[ + { + "id": "report_type", + "zwave": { + "index": 1, + "size": 1 + }, + "label": { + "en": "Notification type", + "nl": "Notificatietype" + }, + "hint": { + "en": "Z-Wave command class used for reporting contact sensor events. Notification is typically best.", + "nl": "Z-Wave command class die gebruikt wordt voor rapportages van de contactsensor. Notification heeft meestal de voorkeur." + }, + "type": "dropdown", + "value": "1", + "values": [ + { + "id": "0", + "label": { + "en": "Binary Sensor", + "nl": "Binary Sensor" + } + }, + { + "id": "1", + "label": { + "en": "Notification", + "nl": "Notification" + } + } + ] + }, + { + "id": "led_indication", + "zwave": { + "index": 2, + "size": 1 + }, + "label": { + "en": "LED indication", + "nl": "led-indicatie" + }, + "hint": { + "en": "When enabled, the LED on Strips will flash shortly when the door/window is opened.", + "nl": "Wanneer ingeschakeld zal de led op Strips kort oplichten als de deur of het raam wordt geopened." + }, + "type": "checkbox", + "value": true + }, + { + "type": "group", + "label": { + "en": "Capabilities", + "nl": "Functies" + }, + "children": [ + { + "$extends": "tamperAlarm" + }, + { + "$extends": "maintenanceActions" + } + ] + } +] \ No newline at end of file diff --git a/drivers/1102011/device.js b/drivers/1102011/device.js index 1fcb771..f4114ef 100644 --- a/drivers/1102011/device.js +++ b/drivers/1102011/device.js @@ -25,31 +25,55 @@ function luminanceReportParser(report) { class StripsMultiSensor extends StripsZwaveDevice { async onMeshInit() { - this.registerCapability('measure_temperature', 'SENSOR_MULTILEVEL', { - getOpts: { - getOnOnline: true, - }, - }); + this.registerTemperatureCapability(); + this.registerHeatAlarmCapability(); - this.registerCapability('measure_luminance', 'SENSOR_MULTILEVEL', { - reportParser: luminanceReportParser, - getOpts: { - getOnOnline: true, - }, - }); - - this.registerCapability('measure_humidity', 'SENSOR_MULTILEVEL', { - reportParser: report => { - if (report['Sensor Type'] === 'Moisture (v5)') { - return report['Sensor Value (Parsed)']; - } - return null; - }, + const settings = this.getSettings(); + this.registerDynamicCapabilities(settings, true); + this.updateMaintenanceActionRegistrations(); + } + + determineCapabilityIds(settings) { + const capabilities = []; + + capabilities.push('measure_temperature', 'alarm_heat'); + if (settings.maintenance_actions) { + capabilities.push('button.reset_heat_alarm'); + } + + if (settings.device_type !== 'drip') { + capabilities.push('measure_luminance'); + } + + if (settings.device_type !== 'comfort') { + capabilities.push('measure_humidity', 'alarm_water'); + if (settings.maintenance_actions) { + capabilities.push('button.reset_water_alarm'); + } + } + + return capabilities.concat(super.determineCapabilityIds(settings)); + } + + // Changing capabilities here seems to crash the Homey App UI on most occasions. + // async onSettings(oldSettings, newSettings, changedKeysArr) { + // let result = await super.onSettings(oldSettings, newSettings, changedKeysArr); + // await this.registerDynamicCapabilities(newSettings, false); + // if (changedKeysArr.includes('maintenance_actions')) { + // this.updateMaintenanceActionRegistrations(); + // } + // return result; + // } + + registerTemperatureCapability() { + this.registerCapability('measure_temperature', 'SENSOR_MULTILEVEL', { getOpts: { getOnOnline: true, }, }); + } + registerHeatAlarmCapability() { this.registerCapability('alarm_heat', 'NOTIFICATION', { reportParser: report => { if (report['Notification Type'] === 'Heat') { @@ -68,33 +92,69 @@ class StripsMultiSensor extends StripsZwaveDevice { getOnOnline: true, }, }); + } - this.registerCapability('alarm_water', 'NOTIFICATION', { + registerLuminanceCapability() { + this.registerCapability('measure_luminance', 'SENSOR_MULTILEVEL', { + reportParser: luminanceReportParser, getOpts: { getOnOnline: true, }, }); + } - this.registerCapability('alarm_battery', 'BATTERY', { + registerHumidityCapability() { + this.registerCapability('measure_humidity', 'SENSOR_MULTILEVEL', { + reportParser: report => { + if (report['Sensor Type'] === 'Moisture (v5)') { + return report['Sensor Value (Parsed)']; + } + return null; + }, getOpts: { getOnOnline: true, }, }); + } - this.registerCapability('measure_battery', 'BATTERY', { + registerWaterAlarmCapability() { + this.registerCapability('alarm_water', 'NOTIFICATION', { getOpts: { getOnOnline: true, }, }); + } + + async registerDynamicCapabilities(settings, initializing) { + const addedCapabilities = await this.ensureCapabilitiesMatch(this.determineCapabilityIds(settings)); + const capabilities = initializing ? this.getCapabilities() : addedCapabilities; - await this.registerMaintenanceActions(); + if (capabilities.includes('measure_luminance')) { + this.registerLuminanceCapability(); + } + + if (capabilities.includes('measure_humidity')) { + this.registerHumidityCapability(); + } + + if (capabilities.includes('alarm_water')) { + this.registerWaterAlarmCapability(); + } + + if (capabilities.includes('alarm_tamper')) { + this.registerTamperAlarmCapability(); + } } - async registerMaintenanceActions() { - await this.ensureCapabilitiesAdded(['button.reset_heat_alarm', 'button.reset_water_alarm']); + updateMaintenanceActionRegistrations() { + const maintenanceActions = { + 'button.reset_heat_alarm': () => this.setCapabilityValue('alarm_heat', false), + 'button.reset_water_alarm': () => this.setCapabilityValue('alarm_water', false), + 'button.reset_tamper_alarm': () => this.setCapabilityValue('alarm_tamper', false) + }; - this.registerCapabilityListener('button.reset_heat_alarm', () => this.setCapabilityValue('alarm_heat', false)); - this.registerCapabilityListener('button.reset_water_alarm', () => this.setCapabilityValue('alarm_water', false)); - } + this.registerMaintenanceActions(maintenanceActions); + } } + module.exports = StripsMultiSensor; \ No newline at end of file diff --git a/drivers/1102011/driver.compose.json b/drivers/1102011/driver.compose.json new file mode 100644 index 0000000..296eb9a --- /dev/null +++ b/drivers/1102011/driver.compose.json @@ -0,0 +1,84 @@ +{ + "name": { + "en": "Strips Drip/Comfort", + "nl": "Strips Drip/Comfort" + }, + "zwave": { + "manufacturerId": 410, + "productTypeId": 3, + "productId": 10, + "learnmode": { + "image": "/drivers/1102011/assets/wakeup.svg", + "instruction": { + "en": "Place the round magnet at the rounded edge. When the LED blinks, move the magnet away. Repeat 3 times within 10 seconds.", + "nl": "Plaats de ronde magneet op de afgeronde zijde. Haal de magneet weer weg als de LED knippert. Herhaal 3 keer binnen 10 seconden." + } + }, + "associationGroups": [ + 1 + ], + "associationGroupsOptions": { + "1": { + "hint": { + "en": "Z-Wave Plus Lifeline" + } + } + } + }, + "class": "sensor", + "capabilities": [ + "measure_temperature", + "measure_luminance", + "measure_humidity", + "alarm_heat", + "alarm_water", + "measure_battery", + "alarm_battery", + "alarm_tamper", + "button.reset_heat_alarm", + "button.reset_water_alarm", + "button.reset_tamper_alarm" + ], + "capabilitiesOptions": { + "button.reset_heat_alarm": { + "maintenanceAction": true, + "title": { + "en": "Reset heat alarm", + "nl": "Hitte-alarm resetten" + }, + "desc": { + "en": "Manually reset the heat alarm after it has been triggered.", + "nl": "Schakel het hitte-alarm handmatig uit nadat deze is getriggerd." + } + }, + "button.reset_water_alarm": { + "maintenanceAction": true, + "title": { + "en": "Reset water alarm", + "nl": "wateralarm resetten" + }, + "desc": { + "en": "Manually reset the water alarm after it has been triggered.", + "nl": "Schakel het wateralarm handmatig uit nadat deze is getriggerd." + } + }, + "button.reset_tamper_alarm": { + "maintenanceAction": true, + "title": { + "en": "Reset tamper alarm", + "nl": "Sabotage-alarm resetten" + }, + "desc": { + "en": "Manually reset the tamper alarm after it has been triggered.", + "nl": "Schakel het sabotage-alarm handmatig uit nadat deze is getriggerd." + } + } + }, + "energy": { + "batteries": [ "INTERNAL" ] + }, + "images": { + "large": "/drivers/1102011/assets/images/large.jpg", + "small": "/drivers/1102011/assets/images/small.jpg" + } +} \ No newline at end of file diff --git a/drivers/1102011/driver.settings.compose.json b/drivers/1102011/driver.settings.compose.json new file mode 100644 index 0000000..4ade2f2 --- /dev/null +++ b/drivers/1102011/driver.settings.compose.json @@ -0,0 +1,369 @@ +[ + { + "id": "led_indication", + "zwave": { + "index": 2, + "size": 1 + }, + "label": { + "en": "LED alarm event reporting", + "nl": "LED alarm event rapportage" + }, + "type": "checkbox", + "value": true + }, + { + "id": "reporting_frequency", + "zwave": { + "index": 3, + "size": 1 + }, + "label": { + "en": "Temperature & Light reporting frequency", + "nl": "Temperatuur & Light rapportage frequency" + }, + "hint": { + "en": "Refer to the Sensative support site for details on how this affects the accuracy, number of reports and battery life", + "nl": "Kijk op de Sensative support site voor informatie over hoe dit accuraatheid, aantal rapportages en levensduur van de batterij beïnvloedt" + }, + "type": "dropdown", + "value": "1", + "values": [ + { + "id": "1", + "label": { + "en": "Normal", + "nl": "Normaal" + } + }, + { + "id": "2", + "label": { + "en": "Frequent", + "nl": "Frequent" + } + } + ] + }, + { + "type": "group", + "label": { + "en": "Temperature", + "nl": "Temperatuur" + }, + "children": [ + { + "id": "temperature_reporting", + "zwave": { + "index": 4, + "size": 1 + }, + "label": { + "en": "Temperature reporting", + "nl": "Temperatuur rapportage" + }, + "hint": { + "en": "Does not affect temperature alarms", + "nl": "Heeft geen invloed op temperatuuralarmering" + }, + "type": "checkbox", + "value": true + }, + { + "id": "temperature_unit", + "zwave": { + "index": 5, + "size": 1 + }, + "label": { + "en": "Temperature reporting unit", + "nl": "Temperatuur rapportage-eenheid" + }, + "hint": { + "en": "This has no effect on how Homey displays the temperature", + "nl": "Dit heeft geen invloed op hoe Homey de temperatuur weergeeft" + }, + "type": "dropdown", + "value": "0", + "values": [ + { + "id": "0", + "label": { + "en": "Celcius", + "nl": "Celcius" + } + }, + { + "id": "1", + "label": { + "en": "Fahrenheit", + "nl": "Fahrenheit" + } + } + ] + }, + { + "id": "temperature_alarms", + "zwave": { + "index": 6, + "size": 1 + }, + "label": { + "en": "Temperature alarms", + "nl": "Temperatuuralarmering" + }, + "type": "checkbox", + "value": false + }, + { + "id": "temperature_high", + "zwave": { + "index": 7, + "size": 1 + }, + "label": { + "en": "High temperature alarm level", + "nl": "Hoge temperatuur alarm niveau" + }, + "hint": { + "en": "-20 to +60 degrees Celcius", + "nl": "-20 tot +60 graden Celsius" + }, + "type": "number", + "value": 60, + "attr": { + "min": -20, + "max": 60 + } + }, + { + "id": "temperature_low", + "zwave": { + "index": 8, + "size": 1 + }, + "label": { + "en": "Low temperature alarm level", + "nl": "Lage temperatuur alarm niveau" + }, + "hint": { + "en": "-20 to +60 degrees Celcius", + "nl": "-20 tot +60 graden Celcius" + }, + "type": "number", + "value": -20, + "attr": { + "min": -20, + "max": 60 + } + } + ] + }, + { + "type": "group", + "label": { + "en": "Light", + "nl": "Licht" + }, + "children": [ + { + "id": "light_reporting", + "zwave": { + "index": 9, + "size": 1 + }, + "value": "1", + "label": { + "en": "Ambient light reporting", + "nl": "Omgevingslicht rapportage" + }, + "hint": { + "en": "Bounds are configured by high and low ambient light report level.", + "nl": "Bounds are configured by high and low ambient light report level." + }, + "type": "dropdown", + "values": [ + { + "id": "0", + "label": { + "en": "Off", + "nl": "Uit" + } + }, + { + "id": "1", + "label": { + "en": "On", + "nl": "Aan" + } + }, + { + "id": "2", + "label": { + "en": "Only outside configured bounds", + "nl": "Alleen buiten ingestelde grenzen" + } + } + ] + }, + { + "id": "light_high", + "zwave": { + "index": 10, + "size": 4 + }, + "label": { + "en": "High ambient light report level", + "nl": "High ambient light report level" + }, + "hint": { + "en": "3 to 64000", + "nl": "3 tot 64000" + }, + "type": "number", + "value": 40000, + "attr": { + "min": 3, + "max": 64000 + } + }, + { + "id": "light_low", + "zwave": { + "index": 11, + "size": 4 + }, + "label": { + "en": "Low ambient light report level", + "nl": "Low ambient light report level" + }, + "hint": { + "en": "1 to 42000. Must be significantly lower than high ambient light report level.", + "nl": "1 tot 42000. Must be significantly lower than high ambient light report level." + }, + "type": "number", + "value": 5000, + "attr": { + "min": 1, + "max": 42000 + } + } + ] + }, + { + "type": "group", + "label": { + "en": "Humidity", + "nl": "Vochtigheid" + }, + "children": [ + { + "id": "leakage_alarm", + "zwave": { + "index": 12, + "size": 1 + }, + "label": { + "en": "Leakage alarm", + "nl": "Lekkage-alarm" + }, + "type": "checkbox", + "value": true + }, + { + "id": "leakage_alarm_level", + "zwave": { + "index": 13, + "size": 1 + }, + "label": { + "en": "Leakage alarm level", + "nl": "Lekkage-alarm level" + }, + "hint": { + "en": "1 to 100\r\n(1=almost dry, 100=wet)", + "nl": "1 tot 100\r\n(1=Bijna droog, 100=nat)" + }, + "type": "number", + "value": 10, + "attr": { + "min": 1, + "max": 100 + } + }, + { + "id": "humidity_reporting_interval", + "zwave": { + "index": 14, + "size": 1 + }, + "label": { + "en": "Moisture reporting period", + "nl": "Vochtigheid rapportageperiode" + }, + "hint": { + "en": "0-120: Number of hours between moisture reports (0=off)", + "nl": "0-120: Aantal uren tussen vochtigheidsrapportage (0=uit)" + }, + "type": "number", + "value": 0, + "attr": { + "min": 0, + "max": 120 + } + } + ] + }, + { + "type": "group", + "label": { + "en": "Capabilities", + "nl": "Functies" + }, + "children": [ + { + "id": "device_type", + "label": { + "en": "Device type", + "nl": "Apparaattype" + }, + "hint": { + "en": "Used to show or hide measurement capabilities of the Strips Comfort and Drip, which are identical on an electronics level.\r\nHybrid: All measurement capabilities are shown.\r\nComfort: Only temperature and light measurement capabilities are shown.\r\nDrip: Only temperature and humidity measurement capabilities are shown.", + "nl": "Hiermee kunnen meetfuncties van de Strips Comfort en Drop (die identiek zijn op elektronica-niveau) getoond of verborgen worden.\r\nHybride: alle meetfuncties worden getoond.\r\nComfort: enkel temperatuur- en lichtmeetfuncties worden getoond.\r\nDrip: enkel temperatuur- en vochtigheidmeetfuncties worden getoond." + }, + "type": "dropdown", + "value": "hybrid", + "values": [ + { + "id": "hybrid", + "label": { + "en": "Comfort/Drip Hybrid", + "nl": "Comfort/Drip-hybride" + } + }, + { + "id": "comfort", + "label": { + "en": "Comfort", + "nl": "Comfort" + } + }, + { + "id": "drip", + "label": { + "en": "Drip", + "nl": "Drip" + } + } + ] + }, + { + "$extends": "tamperAlarm", + "value": false + }, + { + "$extends": "maintenanceActions" + } + ] + } +] \ No newline at end of file diff --git a/drivers/StripsZwaveDevice.js b/drivers/StripsZwaveDevice.js index 5ded3eb..5ed738a 100644 --- a/drivers/StripsZwaveDevice.js +++ b/drivers/StripsZwaveDevice.js @@ -1,21 +1,113 @@ 'use strict'; -const ZwaveDevice = require('homey-meshdriver').ZwaveDevice; +const Homey = require('homey'); +const ZwaveDevice = require('homey-meshdriver/lib/zwave/ZwaveDevice'); + +const i18n = { + settings: { + restartNeeded: { + en: 'Restart the Sensative app for changes to take effect. You may also need to restart your Homey app if you get a blank screen.', + nl: 'Herstart de Sensative app om de wijzigingen door te voeren. Het zou kunnen, dat u de Homey app moet herstarten, als u een leeg scherm krijgt.' + } + } +}; + +function tamperReportParser(report) { + if (report && report['Notification Type'] === 'Home Security' && report.hasOwnProperty('Event (Parsed)')) { + if (report['Event (Parsed)'] === 'Tampering, Invalid Code') { + return true; + } + if (report['Event'] === 254) { + return false; + } + } + return null; +} class StripsZwaveDevice extends ZwaveDevice { - async ensureCapabilitiesAdded(capabilityIds) { - const capabilities = this.getCapabilities(); - for (const capabilityId of capabilityIds) { - if (capabilities.includes(capabilityId)) continue; + async ensureCapabilitiesMatch(capabilityIds) { + const existingCapabilities = this.getCapabilities(); + const capabilitiesToAdd = capabilityIds.filter(x => !existingCapabilities.includes(x)); + const capabilitiesToRemove = existingCapabilities.filter(x => !capabilityIds.includes(x)); + + for (const capability of capabilitiesToRemove) { + this.tryRemoveCapability(capability); + } - if (this.addCapability) { - this.log(`Adding capability ${capabilityId}`); - await this.addCapability(capabilityId); - } else { - this.log(`Unable to add capability ${capabilityId}; probably running an older Homey firmware.`); + for (const capability of capabilitiesToAdd) { + this.tryAddCapability(capability); + } + + return capabilitiesToAdd; + } + + async tryAddCapability(capabilityId) { + if (this.addCapability) { + this.log(`Adding capability ${capabilityId}`); + await this.addCapability(capabilityId); + } else { + this.log(`Unable to add capability ${capabilityId}; probably running an older Homey firmware.`); + } + } + + async tryRemoveCapability(capabilityId) { + if (this.removeCapability) { + this.log(`Removing capability ${capabilityId}`); + await this.removeCapability(capabilityId); + } else { + this.log(`Unable to remove capability ${capabilityId}; probably running an older Homey firmware.`); + } + } + + async registerMaintenanceActions(actions) { + const actionCapabilityIds = Object.keys(actions); + const currentCapabilities = this.getCapabilities(); + + for (const capabilityId of actionCapabilityIds) { + if (!currentCapabilities.includes(capabilityId)) continue; + this.registerCapabilityListener(capabilityId, actions[capabilityId]); + } + } + + determineCapabilityIds(settings) { + const capabilities = ['measure_battery', 'alarm_battery' ]; + + if (settings.tamper_alarm) { + capabilities.push('alarm_tamper'); + if (settings.maintenance_actions) { + capabilities.push('button.reset_tamper_alarm'); } } + + return capabilities; + } + + determineCapabilitiesChanging(oldSettings, newSettings) { + const prev = this.determineCapabilityIds(oldSettings); + const next = this.determineCapabilityIds(newSettings); + return prev.length !== next.length || prev.some((value, index) => value !== next[index]); + } + + registerBatteryCapabilities() { + this.registerCapability('measure_battery', 'BATTERY', { getOpts: { getOnOnline: true } }); + this.registerCapability('alarm_battery', 'BATTERY'); + } + + registerTamperAlarmCapability() { + this.registerCapability('alarm_tamper', 'NOTIFICATION', { reportParser: tamperReportParser }); + } + + async onSettings(oldSettings, newSettings, changedKeysArr) { + const zwaveSettingsChanged = this.getManifestSettings() + .some(setting => typeof setting.zwave !== 'undefined' && changedKeysArr.includes(setting.id)); + + let message = await super.onSettings(oldSettings, newSettings, changedKeysArr); + if (!zwaveSettingsChanged && this.determineCapabilitiesChanging(oldSettings, newSettings)) { + message = Homey.__(i18n.settings.restartNeeded); + } + + return message; } } diff --git a/node_modules/.bin/raven b/node_modules/.bin/raven deleted file mode 100644 index f9a6282..0000000 --- a/node_modules/.bin/raven +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../raven/bin/raven" "$@" - ret=$? -else - node "$basedir/../raven/bin/raven" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/raven.cmd b/node_modules/.bin/raven.cmd deleted file mode 100644 index 2916959..0000000 --- a/node_modules/.bin/raven.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\raven\bin\raven" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\raven\bin\raven" %* -) \ No newline at end of file diff --git a/node_modules/.bin/raven.ps1 b/node_modules/.bin/raven.ps1 deleted file mode 100644 index fe7f573..0000000 --- a/node_modules/.bin/raven.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - & "$basedir/node$exe" "$basedir/../raven/bin/raven" $args - $ret=$LASTEXITCODE -} else { - & "node$exe" "$basedir/../raven/bin/raven" $args - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/.bin/uuid b/node_modules/.bin/uuid deleted file mode 100644 index f3bfcf4..0000000 --- a/node_modules/.bin/uuid +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/../uuid/bin/uuid" "$@" - ret=$? -else - node "$basedir/../uuid/bin/uuid" "$@" - ret=$? -fi -exit $ret diff --git a/node_modules/.bin/uuid.cmd b/node_modules/.bin/uuid.cmd deleted file mode 100644 index da52d68..0000000 --- a/node_modules/.bin/uuid.cmd +++ /dev/null @@ -1,7 +0,0 @@ -@IF EXIST "%~dp0\node.exe" ( - "%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %* -) ELSE ( - @SETLOCAL - @SET PATHEXT=%PATHEXT:;.JS;=;% - node "%~dp0\..\uuid\bin\uuid" %* -) \ No newline at end of file diff --git a/node_modules/.bin/uuid.ps1 b/node_modules/.bin/uuid.ps1 deleted file mode 100644 index 3fcb264..0000000 --- a/node_modules/.bin/uuid.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - & "$basedir/node$exe" "$basedir/../uuid/bin/uuid" $args - $ret=$LASTEXITCODE -} else { - & "node$exe" "$basedir/../uuid/bin/uuid" $args - $ret=$LASTEXITCODE -} -exit $ret diff --git a/node_modules/almost-equal/.npmignore b/node_modules/almost-equal/.npmignore deleted file mode 100644 index 0d1b0b0..0000000 --- a/node_modules/almost-equal/.npmignore +++ /dev/null @@ -1,15 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -npm-debug.log -node_modules/* \ No newline at end of file diff --git a/node_modules/almost-equal/LICENSE b/node_modules/almost-equal/LICENSE deleted file mode 100644 index 8ce206a..0000000 --- a/node_modules/almost-equal/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2013 Mikola Lysenko - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/almost-equal/README.md b/node_modules/almost-equal/README.md deleted file mode 100644 index 7e4b095..0000000 --- a/node_modules/almost-equal/README.md +++ /dev/null @@ -1,47 +0,0 @@ -almost-equal -============ -Checks when two floats are almost equal. - -Use -=== -First install using npm: - - npm install almost-equal - -Then use as follows: - -```javascript -var almostEqual = require("almost-equal") - -var a = 100 - , b = 100 + 1e-12 - -//Check if a == b up to float precision -console.log(almostEqual(a, b, almostEqual.FLT_EPSILON, almostEqual.FLT_EPSILON)) - -//Check if a == b up to double precision -console.log(almostEqual(a, b, almostEqual.DBL_EPSILON, almostEqual.DBL_EPSILON)) -``` - -### `almostEqual(a, b[, absoluteTolerance [, relativeTolerance]])` -Checks if two floats are within the given tolerances of one another using the formula: - - |a - b| < max(absoluteTolerance, min(|a|, |b|) * relativeTolerance) - -* `a` and `b` are the two numbers to comapre -* `absoluteTolerance` is a fixed minimal tolerance (set to 0 to ignore) -* `relativeTolerance` is a tolerance that scales with a/b (set to 0 to ignore) - -**Returns** `true` if `a` and `b` are approximately equal. - -If tolerance argument is omitted, `almostEqual.DBL_EPSILON` value is used by default. - -### `almostEqual.FLT_EPSILON` -Floating point (32-bit) epsilon - -### `almostEqual.DBL_EPSILON` -Double precision (64-bit) epsilon - -Credits -======= -(c) 2013 Mikola Lysenko. MIT License diff --git a/node_modules/almost-equal/almost_equal.js b/node_modules/almost-equal/almost_equal.js deleted file mode 100644 index fa48e48..0000000 --- a/node_modules/almost-equal/almost_equal.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict" - -var abs = Math.abs - , min = Math.min - -function almostEqual(a, b, absoluteError, relativeError) { - var d = abs(a - b) - - if (absoluteError == null) absoluteError = almostEqual.DBL_EPSILON; - if (relativeError == null) relativeError = absoluteError; - - if(d <= absoluteError) { - return true - } - if(d <= relativeError * min(abs(a), abs(b))) { - return true - } - return a === b -} - -almostEqual.FLT_EPSILON = 1.19209290e-7 -almostEqual.DBL_EPSILON = 2.2204460492503131e-16 - -module.exports = almostEqual diff --git a/node_modules/almost-equal/package.json b/node_modules/almost-equal/package.json deleted file mode 100644 index 6a39a30..0000000 --- a/node_modules/almost-equal/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "_from": "almost-equal@^1.1.0", - "_id": "almost-equal@1.1.0", - "_inBundle": false, - "_integrity": "sha1-+FHGMROHV5lCdqou++jfowZszN0=", - "_location": "/almost-equal", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "almost-equal@^1.1.0", - "name": "almost-equal", - "escapedName": "almost-equal", - "rawSpec": "^1.1.0", - "saveSpec": null, - "fetchSpec": "^1.1.0" - }, - "_requiredBy": [ - "/mumath" - ], - "_resolved": "https://registry.npmjs.org/almost-equal/-/almost-equal-1.1.0.tgz", - "_shasum": "f851c631138757994276aa2efbe8dfa3066cccdd", - "_spec": "almost-equal@^1.1.0", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\mumath", - "author": { - "name": "Mikola Lysenko" - }, - "bugs": { - "url": "https://github.com/mikolalysenko/almost-equal/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Test if two floats are almost equal", - "devDependencies": { - "tap": "~0.4.1" - }, - "directories": { - "test": "test" - }, - "gitHead": "bb9919030f650a6b1b5a9f0f65c406055146d259", - "homepage": "https://github.com/mikolalysenko/almost-equal#readme", - "keywords": [ - "float", - "compare", - "double", - "round", - "equal", - "almost", - "near", - "tolerance", - "epsilon", - "FLT_EPSILON", - "DBL_EPSILON" - ], - "license": "MIT", - "main": "almost_equal.js", - "name": "almost-equal", - "repository": { - "type": "git", - "url": "git://github.com/mikolalysenko/almost-equal.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "1.1.0" -} diff --git a/node_modules/almost-equal/test/test.js b/node_modules/almost-equal/test/test.js deleted file mode 100644 index 199327a..0000000 --- a/node_modules/almost-equal/test/test.js +++ /dev/null @@ -1,15 +0,0 @@ -var almostEqual = require("../almost_equal.js") - -require("tap").test("almost-equal", function(t) { - - var a = 100 - , b = 100 + 1e-12 - - //Check if a == b up to float precision - t.assert(almostEqual(a, b, almostEqual.FLT_EPSILON, almostEqual.FLT_EPSILON)) - - //Check if a == b up to double precision - t.assert(!almostEqual(a, b, almostEqual.DBL_EPSILON, almostEqual.DBL_EPSILON)) - - t.end() -}) \ No newline at end of file diff --git a/node_modules/color-space/LICENSE b/node_modules/color-space/LICENSE deleted file mode 100644 index 00d2e13..0000000 --- a/node_modules/color-space/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to \ No newline at end of file diff --git a/node_modules/color-space/ciecam.js b/node_modules/color-space/ciecam.js deleted file mode 100644 index bc8fd81..0000000 --- a/node_modules/color-space/ciecam.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * CIECAM02 http://en.wikipedia.org/wiki/CIECAM02 - * - * @todo add transforms - * - * @module cam - */ -'use strict' - -var xyz = require('./xyz'); - - -var cam = module.exports = { - name: 'cam', - - alias: ['ciecam', 'ciecam02'], -}; - - -//extend xyz -xyz.cam = function(xyz){ - var x = xyz[0], y = xyz[1], z = xyz[2]; - //TODO -}; - -cam.xyz = function () { - -} diff --git a/node_modules/color-space/cmy.js b/node_modules/color-space/cmy.js deleted file mode 100644 index 495db22..0000000 --- a/node_modules/color-space/cmy.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @module color-space/cmy - */ -'use strict' - -var rgb = require('./rgb'); - -var cmy = module.exports = { - name: 'cmy', - min: [0,0,0], - max: [100,100,100], - channel: ['cyan', 'magenta', 'yellow'], - alias: ['CMY'] -}; - - -/** - * CMY to RGB - * - * @param {Array} cmy Channels - * - * @return {Array} RGB channels - */ -cmy.rgb = function(cmy) { - var c = cmy[0] / 100, - m = cmy[1] / 100, - y = cmy[2] / 100; - - return [ - (1 - c) * 255, - (1 - m) * 255, - (1 - y) * 255 - ]; -}; - - -/** - * RGB to CMY - * - * @param {Array} rgb channels - * - * @return {Array} CMY channels - */ -rgb.cmy = function(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255; - - return [ - (1-r) * 100 || 0, - (1-g) * 100 || 0, - (1-b) * 100 || 0 - ]; -}; diff --git a/node_modules/color-space/cmyk.js b/node_modules/color-space/cmyk.js deleted file mode 100644 index 831b1e8..0000000 --- a/node_modules/color-space/cmyk.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @module color-space/cmyk - */ -'use strict' - -var rgb = require('./rgb'); - -module.exports = { - name: 'cmyk', - min: [0,0,0,0], - max: [100,100,100,100], - channel: ['cyan', 'magenta', 'yellow', 'black'], - alias: ['CMYK'], - - rgb: function(cmyk) { - var c = cmyk[0] / 100, - m = cmyk[1] / 100, - y = cmyk[2] / 100, - k = cmyk[3] / 100, - r, g, b; - - r = 1 - Math.min(1, c * (1 - k) + k); - g = 1 - Math.min(1, m * (1 - k) + k); - b = 1 - Math.min(1, y * (1 - k) + k); - return [r * 255, g * 255, b * 255]; - } -}; - - -//extend rgb -rgb.cmyk = function(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255, - c, m, y, k; - - k = Math.min(1 - r, 1 - g, 1 - b); - c = (1 - r - k) / (1 - k) || 0; - m = (1 - g - k) / (1 - k) || 0; - y = (1 - b - k) / (1 - k) || 0; - return [c * 100, m * 100, y * 100, k * 100]; -}; diff --git a/node_modules/color-space/coloroid.js b/node_modules/color-space/coloroid.js deleted file mode 100644 index 84aa48e..0000000 --- a/node_modules/color-space/coloroid.js +++ /dev/null @@ -1,281 +0,0 @@ - -/** - * Architects and visual constructors hungarian color space. - * - * http://hej.sze.hu/ARC/ARC-030520-A/arc030520a.pdf - * - * @module color-space/coloroid - */ -'use strict' - -var xyy = require('./xyy'); -var xyz = require('./xyz'); - - -/** - * Main color space object - */ -var coloroid = { - name: 'coloroid', - alias: ['ATV'], - - //hue, saturation, luminosity - //note that hue values are ids, not the numbers - not every value is possible - //e.g. 38 will be rounded to 36 - channel: ['A','T','V'], - min: [10, 0, 0], - max: [76, 100, 100] -}; - - -/** - * Coloroid table - * Regression of values is almost impossible, as hues don’t correlate - * Even angle values are picked very inconsistently, based on aesthetical evaluation. - * - * - tgф, ctgф are removed, ф is searched instead - * - eλ = xλ + yλ + zλ - * - λ is removed as not used - */ -coloroid.table = [ - //A angle eλ xλ yλ - [ 10, 59.0, 1.724349, 0.44987, 0.53641 ], - [ 11, 55.3, 1.740844, 0.46248, 0.52444 ], - [ 12, 51.7, 1.754985, 0.47451, 0.51298 ], - [ 13, 48.2, 1.767087, 0.48601, 0.50325 ], - [ 14, 44.8, 1.775953, 0.49578, 0.49052 ], - [ 15, 41.5, 1.785073, 0.50790, 0.43035 ], - [ 16, 38.2, 1.791104, 0.51874, 0.46934 ], - [ 20, 34.9, 1.794831, 0.52980, 0.45783 ], - [ 21, 31.5, 1.798664, 0.54137, 0.44559 ], - [ 22, 28.0, 1.794819, 0.55367, 0.43253 ], - [ 23, 24.4, 1.789610, 0.56680, 0.41811 ], - [ 24, 20.6, 1.809483, 0.58128, 0.40176 ], - [ 25, 16.6, 1.760983, 0.59766, 0.38300 ], - [ 26, 12.3, 1.723443, 0.61653, 0.36061 ], - [ 30, 7.7, 1.652891, 0.63896, 0.33358 ], - [ 31, 2.8, 1.502607, 0.66619, 0.29930 ], - [ 32, -2.5, 1.072500, 0.70061, 0.26753 ], - [ 33, -8.4, 1.136637, 0.63925, 0.22631 ], - [ 34, -19.8, 1.232286, 0.53962, 0.19721 ], - [ 35, -31.6, 1.310120, 0.50340, 0.17495 ], - [ 40, -43.2, 1.376610, 0.46041, 0.15603 ], - [ 41, -54.6, 1.438692, 0.42386, 0.13846 ], - [ 42, -65.8, 1.501582, 0.38991, 0.12083 ], - [ 43, -76.8, 1.570447, 0.35586, 0.10328 ], - [ 44, -86.8, 1.645583, 0.32195, 0.08496 ], - [ 45, -95.8, 1.732083, 0.28657, 0.05155 ], - [ 46, -108.4, 1.915753, 0.22202, 0.01771 ], - [ 50, -117.2, 2.146310, 0.15664, 0.05227 ], - [ 51, -124.7, 1.649939, 0.12736, 0.09020 ], - [ 52, -131.8, 1.273415, 0.10813, 0.12506 ], - [ 53, -138.5, 1.080809, 0.09414, 0.15741 ], - [ 54, -145.1, 0.957076, 0.03249, 0.18958 ], - [ 55, -152.0, 0.868976, 0.07206, 0.24109 ], - [ 56, -163.4, 0.771731, 0.05787, 0.30378 ], - [ 60, -177.2, 0.697108, 0.04353, 0.35696 ], - [ 61, 171.6, 0.655803, 0.03291, 0.41971 ], - [ 62, 152.4, 0.623958, 0.02240, 0.49954 ], - [ 63, 148.4, 0.596037, 0.01196, 0.60321 ], - [ 64, 136.8, 0.607413, 0.00425, 0.73542 ], - [ 65, 125.4, 0.659923, 0.01099, 0.83391 ], - [ 66, 114.2, 0.859517, 0.08050, 0.77474 ], - [ 70, 103.2, 1.195683, 0.20259, 0.70460 ], - [ 71, 93.2, 1.407534, 0.28807, 0.65230 ], - [ 72, 84.2, 1.532829, 0.34422, 0.61930 ], - [ 73, 77.3, 1.603792, 0.37838, 0.59533 ], - [ 74, 71.6, 1.649448, 0.40290, 0.57716 ], - [ 75, 66.9, 1.681080, 0.42141, 0.56222 ], - [ 76, 62.8, 1.704979, 0.43647, 0.54895 ] -]; - - -/** -Coloroid table source -Some negative angle typos are fixed. -Angle typo on the A=62 is fixed. -xλ typo on A=73 is fixed. - - -Beware, tg/ctg values don’t agree with angle. -Also don’t trust the calculated eλ = xλ + yλ + zλ. -Also, unfortunately, some values might be wrong, as coloroid range looks uneven. - -A λ ф tg ф ctg ф xλ yλ zλ xλ yλ eλ - -10 570.83 59.0 0.6009 0.775745 0.946572 0.002032 0.44987 0.54895 1.724349 -11 572.64 55.3 0.6924 0.805130 0.933804 0.001910 0.46248 0.53641 1.740845 -12 574.38 51.7 0.7898 0.832782 0.920395 0.001808 0.47451 0.52444 1.754986 -13 576.06 48.2 1.1180 0.8941 0.858841 0.906482 0.001764 0.48601 0.51298 1.767088 -14 577.50 44.8 0.9330 1.0070 0.880488 0.893741 0.001724 0.49578 0.50325 1.775953 -15 579.31 41.5 0.8847 0.906652 0.876749 0.001672 0.50790 0.49052 1.785074 -16 580.95 38.2 0.7869 0.929124 0.860368 0.001612 0.51874 0.43035 1.791104 -20 582.65 34.9 0.6976 0.950909 0.842391 0.001531 0.52980 0.46934 1.794831 -21 584.46 31.5 0.6128 0.972454 0.824779 0.001431 0.54137 0.45783 1.798665 -22 586.43 28.0 0.5317 0.993753 0.799758 0.001308 0.55367 0.44559 1.794822 -23 588.59 24.4 0.4536 1.014350 0.774090 0.001170 0.56680 0.43253 1.789610 -24 591.06 20.6 0.3759 1.034402 0.774014 0.001067 0.58128 0.41811 1.779484 -25 594.00 16.6 0.2974 1.052466 0.707496 0.001021 0.59766 0.40176 1.760984 -26 597.74 12.3 0.2180 1.062544 0.660001 0.000898 0.61653 0.38300 1.723444 -30 602.72 7.7 0.1352 1.056125 0.596070 0.000696 0.63896 0.36061 1.652892 -31 610.14 2.8 0.0489 1.001027 0.501245 0.000335 0.66619 0.33358 1.502608 -32 625.00 -2.5 -0.0435 0.751400 0.321000 0.000100 0.70061 0.29930 1.072500 -33 -492.79 -8.4 -0.1477 0.726603 0.304093 0.105941 0.63925 0.26753 1.136638 -34 -495.28 -19.8 -0.3600 0.689620 0.278886 0.263780 0.53962 0.22631 1.232286 -35 -498.45 -31.6 -0.6152 0.659523 0.258373 0.392224 0.50340 0.19721 1.310122 -40 -502.69 -43.2 -0.9391 0.633815 0.240851 0.501944 0.46041 0.17495 1.376610 -41 -509.12 -54.6 -0.7107 0.609810 0.224490 0.604392 0.42386 0.15603 1.438692 -42 -520.40 -65.8 -0.4494 0.585492 0.207915 0.708175 0.38991 0.13846 1.501583 -43 -536.31 -76.8 -0.2345 0.558865 0.189767 0.821815 0.35586 0.12083 1.570447 -44 -548.11 -86.8 -0.0559 0.529811 0.169965 0.945807 0.32195 0.10328 1.645584 -45 -555.96 -95.8 -0.1016 0.496364 0.147168 1.088551 0.28657 0.08496 1.732085 -46 -564.18 -108.4 0.3327 0.425346 0.098764 1.391643 0.22202 0.05155 1.915754 -50 450.00 -117.2 0.5141 0.336200 0.038000 1.772110 0.15664 0.01771 2.146310 -51 468.71 -124.7 0.6924 0.210174 0.086198 1.353567 0.12736 0.05227 1.649940 -52 475.44 -131.8 0.8941 0.137734 0.114770 1.020911 0.10813 0.09020 1.273415 -53 479.00 -138.5 0.8847 0.101787 0.135067 0.843955 0.09414 0.12506 1.080809 -54 482.04 -145.1 0.6976 0.079004 0.150709 0.727363 0.03249 0.15741 0.957577 -55 484.29 -152.0 0.5317 0.062658 0.164626 0.641692 0.07206 0.18958 0.868977 -56 487.31 -163.4 0.2981 0.044691 0.185949 0.541091 0.05787 0.24109 0.771732 -60 490.40 -177.2 0.0489 0.030372 0.211659 0.455077 0.04353 0.30378 0.697110 -61 492.72 171.6 -0.1477 0.021655 0.234022 0.400126 0.03291 0.35696 0.655804 -62 495.28 125.4 -0.3600 0.013989 0.261843 0.348126 0.02240 0.41971 0.623969 -63 498.45 148.4 -0.6152 0.007215 0.301137 0.287685 0.01196 0.49954 0.596037 -64 502.69 136.8 -0.9391 -1.0650 0.002586 0.366425 0.238402 0.00425 0.60321 0.607414 -65 509.12 125.4 -1.4070 -0.7107 0.007260 0.485346 0.167317 0.01099 0.73542 0.659924 -66 520.40 114.2 -0.4494 0.066010 0.717274 0.076233 0.08050 0.83391 0.859523 -70 536.31 103.2 -0.2345 0.242272 0.926325 0.027086 0.20259 0.77474 1.195684 -71 548.11 93.2 -0.0559 0.406663 0.990587 0.010284 0.28807 0.70460 1.410097 -72 555.96 84.2 0.1016 0.527646 0.999862 0.005321 0.34422 0.65230 1.532830 -73 560.74 77.3 0.2254 0.606873 0.993224 0.003695 0.37838 0.61930 1.603793 -74 564.18 71.6 0.3327 0.664599 0.981981 0.002868 0.40290 0.59533 1.649449 -75 566.78 66.9 0.4265 0.708358 0.970252 0.002470 0.42141 0.57716 1.681081 -76 568.92 62.8 0.5140 0.744182 0.958592 0.002205 0.43647 0.56222 1.704981 -*/ - - - - -/** Create angle-sorted table */ -var table = coloroid.table; -var angleTable = [].concat(table.slice(-13),table.slice(0, -13)); - - -/** - * Some precalculations - * 2° D65 whitepoint is used - */ -var i = 'D65'; -var o = 2; - -var Xn = xyz.whitepoint[o][i][0]; -var Yn = xyz.whitepoint[o][i][1]; -var Zn = xyz.whitepoint[o][i][2]; - -var y0 = Xn / (Xn + Yn + Zn); -var x0 = Yn / (Xn + Yn + Zn); -var ew = (Xn + Yn + Zn) / 100; - - - -/** - * From xyY to coloroid - * - * @param {Array} arg xyY tuple - * - * @return {Array} ATV coloroid channels - */ -xyy.coloroid = function (arg) { - var x = arg[0], y = arg[1], Y = arg[2]; - - //coloroid luminocity is the same as hunter-lab lightness (the easier part) - var V = 10 * Math.sqrt(Y); - - //get the hue angle, -π ... +π - var angle = Math.atan2(y - y0, x - x0) * 180 / Math.PI; - var row; - - //find the closest row in the table - var prev = angleTable.length - 1; - for (var i = 0; i < angleTable.length; i++) { - if (angle > angleTable[i][1]) { - break; - } - prev = i; - } - //round instead of ceil - row = Math.abs(angleTable[i+1][1] - angle) > Math.abs(angleTable[prev][1] - angle) ? angleTable[i+1] : angleTable[prev]; - - //get hue id - var A = row[0]; - - //calc saturation - var yl = row[4], el = row[2], xl = row[3]; - - //yl should be scaled to 0..100; - var Yl = yl * el * 100; - - var T = 100 * Y*(x0*ew - x*ew) / (100*(x*el - xl*el) + Yl*(x0*ew - x*ew)); - // var T = 100 * Y*(1 - y*ew) / (100*(y*el - yl*el) + Yl*(1 - y*ew)); - - return [A, T, V]; -}; - - - - - -/** - * Backwise - from coloroid to xyY - * - * @param {Array} arg Coloroid values - * - * @return {Array} xyY values - */ -coloroid.xyy = function (arg) { - var A = arg[0], T = arg[1], V = arg[2]; - - //find the closest row in the table - var row; - for (var i = 0; i < table.length; i++) { - if (A <= table[i][0]) { - row = table[i]; - break; - } - } - - var yl = row[4], el = row[2], xl = row[3]; - - var Y = V*V / 100; - - var Yl = yl * el * 100; - - var x = (100*Y*x0*ew + 100*xl*el*T - Yl*T*x0*ew) / (100*T*el - Yl*T*ew + 100*Y*ew); - var y = (100*Y + 100*T*yl*el - Yl*T) / (Y*ew*100 + T*100*el - T*Yl*ew); - - // var x = (100*Y*ew*x0 + 100*T*el*xl - T*Yl*ew*x0) / (100*T*el - T*Yl*ew + 100*Y*ew); - // var y = 100*Y / (100*T*el + 100*T*ew*Yl + 100*ew*Y); - - // var x = (ew*x0*(V*V - 100*T*row[6]) + 100*T*el*xl) / (ew*(V*V - 100*T*row[6]) + 100*T*el); - // var y = V*V/(ew*(V*V + 100*T*row[6]) + 100*T*el); - - return [x,y,Y]; -}; - - - -/** Proper transformation to a XYZ (via xyY) */ -xyz.coloroid = function (arg) { - return xyy.coloroid(xyz.xyy(arg)); -}; -coloroid.xyz = function (arg) { - return xyy.xyz(coloroid.xyy(arg)); -}; - - - -module.exports = coloroid; - - - - diff --git a/node_modules/color-space/cubehelix.js b/node_modules/color-space/cubehelix.js deleted file mode 100644 index aa87912..0000000 --- a/node_modules/color-space/cubehelix.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Cubehelix http://astron-soc.in/bulletin/11June/289392011.pdf - * - * @module color-space/cubehelix - */ -'use strict' - -var rgb = require('./rgb'); -var clamp = require('mumath/clamp'); - - -var cubehelix = module.exports = { - name: 'cubehelix', - channel: ['fraction'], - min: [0], - max: [1] -}; - - -/** Default options for space */ -var defaults = cubehelix.defaults = { - //0..3 - start: 0, - //-10..10 - rotation: 0.5, - //0..1+ - hue: 1, - //0..2 - gamma: 1 -}; - - -/** - * Transform cubehelix level to RGB - * - * @param {Number} fraction 0..1 cubehelix level - * @param {Object} options Mapping options, overrides defaults - * - * @return {Array} rgb tuple - */ -cubehelix.rgb = function(fraction, options) { - options = options || {}; - - if (fraction.length) fraction = fraction[0]; - - var start = options.start !== undefined ? options.start : defaults.start; - var rotation = options.rotation !== undefined ? options.rotation : defaults.rotation; - var gamma = options.gamma !== undefined ? options.gamma : defaults.gamma; - var hue = options.hue !== undefined ? options.hue : defaults.hue; - - var angle = 2 * Math.PI * (start/3 + 1.0 + rotation * fraction); - - fraction = Math.pow(fraction, gamma); - - var amp = hue * fraction * (1-fraction)/2.0; - - var r = fraction + amp*(-0.14861*Math.cos(angle)+1.78277*Math.sin(angle)); - var g = fraction + amp*(-0.29227*Math.cos(angle)-0.90649*Math.sin(angle)); - var b = fraction + amp*(+1.97294*Math.cos(angle)); - - r = clamp(r, 0, 1); - g = clamp(g, 0, 1); - b = clamp(b, 0, 1); - - return [r * 255, g * 255, b * 255]; -}; - - -/** - * RGB to cubehelix - * - * @param {Array} rgb RGB values - * - * @return {Array} cubehelix fraction(s) - */ -rgb.cubehelix = function(rgb) { - //TODO - there is no backwise conversion yet -}; diff --git a/node_modules/color-space/hcg.js b/node_modules/color-space/hcg.js deleted file mode 100644 index 4cf5449..0000000 --- a/node_modules/color-space/hcg.js +++ /dev/null @@ -1,171 +0,0 @@ -/** - * @module color-space/hcg - */ -'use strict' - -var rgb = require('./rgb'); -var hsl = require('./hsl'); -var hsv = require('./hsv'); -var hwb = require('./hwb'); -var mod = require('mumath/mod'); - - -module.exports = { - name: 'hcg', - min: [0,0,0], - max: [360,100,100], - channel: ['hue', 'chroma', 'gray'], - alias: ['HCG', 'HSG'], - - rgb: function(hcg) { - var h = hcg[0] / 360; - var c = hcg[1] / 100; - var g = hcg[2] / 100; - if (c === 0.0) { - return [g * 255, g * 255, g * 255]; - } - var hi = mod(h, 1) * 6; - var v = mod(hi, 1); - var pure = [0, 0, 0]; - var w = 1 - v; - switch (Math.floor(hi)) { - case 0: - pure[0] = 1; pure[1] = v; pure[2] = 0; break; - case 1: - pure[0] = w; pure[1] = 1; pure[2] = 0; break; - case 2: - pure[0] = 0; pure[1] = 1; pure[2] = v; break; - case 3: - pure[0] = 0; pure[1] = w; pure[2] = 1; break; - case 4: - pure[0] = v; pure[1] = 0; pure[2] = 1; break; - default: - pure[0] = 1; pure[1] = 0; pure[2] = w; - } - var mg = (1.0 - c) * g; - var rgb = [ - (c * pure[0] + mg) * 255, - (c * pure[1] + mg) * 255, - (c * pure[2] + mg) * 255 - ]; - return rgb; - }, - - hsl: function(hcg) { - var c = hcg[1] / 100; - var g = hcg[2] / 100; - var l = g * (1.0 - c) + 0.5 * c; - var s = 0; - if (l < 1.0 && l > 0.0) { - if (l < 0.5) { - s = c / (2 * l); - } else { - s = c / (2 * (1 - l)); - } - } - return [hcg[0], s * 100, l * 100]; - }, - - hsv: function(hcg){ - var c = hcg[1] / 100; - var g = hcg[2] / 100; - var v = c + g * (1.0 - c); - var res; - if (v > 0.0) { - var f = c / v; - res = [hcg[0], f * 100, v * 100]; - } else { - res = [hcg[0], 0, v * 100]; - } - return res; - }, - - hwb: function(hcg){ - var c = hcg[1] / 100; - var g = hcg[2] / 100; - var v = c + g * (1.0 - c); - return [hcg[0], (v - c) * 100, (1 - v) * 100]; - } -}; - - -//append rgb -rgb.hcg = function(rgb) { - var r = rgb[0] / 255; - var g = rgb[1] / 255; - var b = rgb[2] / 255; - var max = Math.max(Math.max(r, g), b); - var min = Math.min(Math.min(r, g), b); - var chroma = (max - min); - var grayscale; - var hue; - if (chroma < 1) { - grayscale = min / (1 - chroma); - } else { - grayscale = 0; - } - if (chroma > 0) { - if (max === r) { - hue = mod((g - b) / chroma, 6); - } else - if (max === g) { - hue = 2 + (b - r) / chroma; - } else { - hue = 4 + (r - g) / chroma; - } - hue /= 6; - hue = mod(hue, 1); - } else { - hue = 0; - } - return [hue * 360, chroma * 100, grayscale * 100]; -}; - -//extend hsl -hsl.hcg = function(hsl) { - var s = hsl[1] / 100; - var l = hsl[2] / 100; - var c = 0; - if (l < 0.5) { - c = 2.0 * s * l; - } else { - c = 2.0 * s * (1.0 - l); - } - var res; - if (c < 1.0) { - var f = (l - 0.5 * c) / (1.0 - c); - res = [hsl[0], c * 100, f * 100]; - } else { - res = [hsl[0], c * 100, 0]; - } - return res; -}; - -//extend hsv -hsv.hcg = function(hsv){ - var s = hsv[1] / 100; - var v = hsv[2] / 100; - var c = s * v; - var res; - if (c < 1.0) { - var f = (v - c) / (1 - c); - res = [hsv[0], c * 100, f * 100]; - } else { - res = [hsv[0], c * 100, 0]; - } - return res; -} - - -//extend hwb -hwb.hcg = function(hwb){ - var w = hwb[1] / 100; - var b = hwb[2] / 100; - var v = 1 - b; - var c = v - w; - var g = 0; - if (c < 1) { - g = (v - c) / (1 - c); - } - return [hwb[0], c * 100, g * 100]; -} diff --git a/node_modules/color-space/hcy.js b/node_modules/color-space/hcy.js deleted file mode 100644 index 188b55e..0000000 --- a/node_modules/color-space/hcy.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * HSV optimized for shaders - * http://chilliant.blogspot.ca/2012/08/rgbhcy-in-hlsl.html - * - * @module color-space/hcy - */ -'use strict' - -var rgb = require('./rgb'); - -var loop = require('mumath/mod'); -var clamp = require('mumath/clamp'); - - -var hcy = module.exports = { - name: 'hcy', - min: [0,0,0], - max: [360,100,255], - channel: ['hue', 'chroma', 'luminance'], - alias: ['HCY'] -}; - - -/** - * HCY to RGB - * - * @param {Array} hcy Channel values - * - * @return {Array} RGB channel values - */ -hcy.rgb = function (hcy) { - var h = loop(hcy[0], 0, 360) * Math.PI / 180; - var s = clamp(hcy[1], 0, 100) / 100; - var i = clamp(hcy[2], 0, 255) / 255; - - var pi3 = Math.PI / 3; - - var r, g, b; - if (h < (2 * pi3) ) { - b = i * ( 1 - s ); - r = i * (1 + ( s * Math.cos(h) / Math.cos(pi3 - h) )); - g = i * (1 + ( s * ( 1 - Math.cos(h) / Math.cos(pi3 - h) ))); - } - else if (h < (4 * pi3) ) { - h = h - 2 * pi3; - r = i * ( 1 - s ); - g = i * (1 + ( s * Math.cos(h) / Math.cos(pi3 - h) )); - b = i * (1 + ( s * ( 1 - Math.cos(h) / Math.cos(pi3 - h) ))); - } - else { - h = h - 4 * pi3; - g = i * ( 1 - s ); - b = i * (1 + ( s * Math.cos(h) / Math.cos(pi3 - h) )); - r = i * (1 + ( s * ( 1 - Math.cos(h) / Math.cos(pi3 - h) ))); - } - - return [r * 255, g * 255, b * 255]; -}; - - -/** - * RGB to HCY - * - * @param {Array} rgb Channel values - * - * @return {Array} HCY channel values - */ -rgb.hcy = function (rgb) { - var sum = rgb[0] + rgb[1] + rgb[2]; - - var r = rgb[0] / sum; - var g = rgb[1] / sum; - var b = rgb[2] / sum; - - var h = Math.acos( - ( 0.5 * ((r - g) + (r - b)) ) / - Math.sqrt( (r - g)*(r - g) + (r - b)*(g - b) ) - ); - if (b > g) { - h = 2 * Math.PI - h; - } - - var s = 1 - 3 * Math.min(r, g, b); - - var i = sum / 3; - - return [h * 180 / Math.PI, s * 100, i]; -}; diff --git a/node_modules/color-space/hpluv.js b/node_modules/color-space/hpluv.js deleted file mode 100644 index eab3e30..0000000 --- a/node_modules/color-space/hpluv.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * A uniform wrapper for hpluv. - * // http://www.hsluv.org/ - * - * @module color-space/hpluv - */ -'use strict' - -var xyz = require('./xyz'); -var lchuv = require('./lchuv'); -var _hsluv = require('hsluv'); - -module.exports = { - name: 'hpluv', - min: [0,0,0], - max: [360,100,100], - channel: ['hue', 'saturation', 'lightness'], - alias: ['HPLuv', 'HuSLp'], - - lchuv: _hsluv.hpluvToLch, - xyz: function(arg){return lchuv.xyz(_hsluv.hpluvToLch(arg));}, - - //a shorter way to convert to husl - hsluv: function(arg){ - return _hsluv.lchToHsluv( _hsluv.hpluvToLch(arg)); - } - -}; - -//extend lchuv, xyz -lchuv.hpluv = _hsluv.lchToHpluv; -xyz.hpluv = function(arg){return _hsluv.lchToHpluv(xyz.lchuv(arg));}; diff --git a/node_modules/color-space/hsi.js b/node_modules/color-space/hsi.js deleted file mode 100644 index a6ddf15..0000000 --- a/node_modules/color-space/hsi.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * http://www.cse.usf.edu/~mshreve/rgb-to-hsi - * http://web.archive.org/web/20130124054245/http://web2.clarkson.edu/class/image_process/RGB_to_HSI.pdf - * - * @module color-space/hsl - */ -'use strict' - -var rgb = require('./rgb'); - -var loop = require('mumath/mod'); -var clamp = require('mumath/clamp'); - - -var hsi = module.exports = { - name: 'hsi', - min: [0,0,0], - max: [360,100,255], - channel: ['hue', 'saturation', 'intensity'], - alias: ['HSI'] -}; - - -/** - * HSI to RGB - * - * @param {Array} hsi Channel values - * - * @return {Array} RGB channel values - */ -hsi.rgb = function (hsi) { - var h = loop(hsi[0], 0, 360) * Math.PI / 180; - var s = clamp(hsi[1], 0, 100) / 100; - var i = clamp(hsi[2], 0, 255) / 255; - - var pi3 = Math.PI / 3; - - var r, g, b; - if (h < (2 * pi3) ) { - b = i * ( 1 - s ); - r = i * (1 + ( s * Math.cos(h) / Math.cos(pi3 - h) )); - g = i * (1 + ( s * ( 1 - Math.cos(h) / Math.cos(pi3 - h) ))); - } - else if (h < (4 * pi3) ) { - h = h - 2 * pi3; - r = i * ( 1 - s ); - g = i * (1 + ( s * Math.cos(h) / Math.cos(pi3 - h) )); - b = i * (1 + ( s * ( 1 - Math.cos(h) / Math.cos(pi3 - h) ))); - } - else { - h = h - 4 * pi3; - g = i * ( 1 - s ); - b = i * (1 + ( s * Math.cos(h) / Math.cos(pi3 - h) )); - r = i * (1 + ( s * ( 1 - Math.cos(h) / Math.cos(pi3 - h) ))); - } - - return [r * 255, g * 255, b * 255]; -}; - - -/** - * RGB to HSI - * - * @param {Array} rgb Channel values - * - * @return {Array} HSI channel values - */ -rgb.hsi = function (rgb) { - var sum = rgb[0] + rgb[1] + rgb[2]; - - var r = rgb[0] / sum; - var g = rgb[1] / sum; - var b = rgb[2] / sum; - - var h = Math.acos( - ( 0.5 * ((r - g) + (r - b)) ) / - Math.sqrt( (r - g)*(r - g) + (r - b)*(g - b) ) - ); - if (b > g) { - h = 2 * Math.PI - h; - } - - var s = 1 - 3 * Math.min(r, g, b); - - var i = sum / 3; - - return [h * 180 / Math.PI, s * 100, i]; -}; diff --git a/node_modules/color-space/hsl.js b/node_modules/color-space/hsl.js deleted file mode 100644 index 066b26f..0000000 --- a/node_modules/color-space/hsl.js +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @module color-space/hsl - */ -'use strict' - -var rgb = require('./rgb'); - -module.exports = { - name: 'hsl', - min: [0,0,0], - max: [360,100,100], - channel: ['hue', 'saturation', 'lightness'], - alias: ['HSL'], - - rgb: function(hsl) { - var h = hsl[0] / 360, - s = hsl[1] / 100, - l = hsl[2] / 100, - t1, t2, t3, rgb, val; - - if (s === 0) { - val = l * 255; - return [val, val, val]; - } - - if (l < 0.5) { - t2 = l * (1 + s); - } - else { - t2 = l + s - l * s; - } - t1 = 2 * l - t2; - - rgb = [0, 0, 0]; - for (var i = 0; i < 3; i++) { - t3 = h + 1 / 3 * - (i - 1); - if (t3 < 0) { - t3++; - } - else if (t3 > 1) { - t3--; - } - - if (6 * t3 < 1) { - val = t1 + (t2 - t1) * 6 * t3; - } - else if (2 * t3 < 1) { - val = t2; - } - else if (3 * t3 < 2) { - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - } - else { - val = t1; - } - - rgb[i] = val * 255; - } - - return rgb; - } -}; - - -//extend rgb -rgb.hsl = function(rgb) { - var r = rgb[0]/255, - g = rgb[1]/255, - b = rgb[2]/255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, l; - - if (max === min) { - h = 0; - } - else if (r === max) { - h = (g - b) / delta; - } - else if (g === max) { - h = 2 + (b - r) / delta; - } - else if (b === max) { - h = 4 + (r - g)/ delta; - } - - h = Math.min(h * 60, 360); - - if (h < 0) { - h += 360; - } - - l = (min + max) / 2; - - if (max === min) { - s = 0; - } - else if (l <= 0.5) { - s = delta / (max + min); - } - else { - s = delta / (2 - max - min); - } - - return [h, s * 100, l * 100]; -}; diff --git a/node_modules/color-space/hsluv.js b/node_modules/color-space/hsluv.js deleted file mode 100644 index 0ac1714..0000000 --- a/node_modules/color-space/hsluv.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * A uniform wrapper for hsluv. - * // http://www.hsluv.org/ - * - * @module color-space/hsluv - */ -'use strict' - -var xyz = require('./xyz'); -var lchuv = require('./lchuv'); -var _hsluv = require('hsluv'); - - -module.exports = { - name: 'hsluv', - min: [0,0,0], - max: [360,100,100], - channel: ['hue', 'saturation', 'lightness'], - alias: ['HSLuv', 'HuSL'], - - lchuv: _hsluv.hsluvToLch, - - xyz: function(arg){ - return lchuv.xyz(_hsluv.hsluvToLch(arg)); - }, - - //a shorter way to convert to hpluv - hpluv: function(arg){ - return _hsluv.lchToHpluv( _hsluv.hsluvToLch(arg)); - } -}; - -//extend lchuv, xyz -lchuv.hsluv = _hsluv.lchToHsluv; -xyz.hsluv = function(arg){ - return _hsluv.lchToHsluv(xyz.lchuv(arg)); -}; diff --git a/node_modules/color-space/hsp.js b/node_modules/color-space/hsp.js deleted file mode 100644 index 2a27eb1..0000000 --- a/node_modules/color-space/hsp.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * @module color-space/hsp - */ -'use strict' - -var rgb = require('./rgb'), - Pr = 0.299, - Pg = 0.587, - Pb = 0.114; - -module.exports = { - name: 'hsp', - min: [0, 0, 0], - max: [360, 100, 255], - channel: ['hue', 'saturation', 'perceived_brightness'], - alias: ['HSP'], - - rgb: function (hsp) { - var h = hsp[0]/360.0, - s = hsp[1]/100.0, - p = hsp[2], - r, g, b, part, - minOverMax = 1.0 - s; - - if (minOverMax > 0.0) { - if (h < 1.0 / 6.0) { // R>G>B - h = 6.0 * (h - 0.0 / 6.0); - part = 1.0 + h * (1.0 / minOverMax - 1.0); - b = p / Math.sqrt(Pr / minOverMax / minOverMax + Pg * part * part + Pb); - r = (b) / minOverMax; - g = (b) + h * ((r) - (b)); - } else if (h < 2.0 / 6.0) { // G>R>B - h = 6.0 * (-h + 2.0 / 6.0); - part = 1.0 + h * (1.0 / minOverMax - 1.0); - b = p / Math.sqrt(Pg / minOverMax / minOverMax + Pr * part * part + Pb); - g = (b) / minOverMax; - r = (b) + h * ((g) - (b)); - } else if (h < 3.0 / 6.0) { // G>B>R - h = 6.0 * (h - 2.0 / 6.0); - part = 1.0 + h * (1.0 / minOverMax - 1.0); - r = p / Math.sqrt(Pg / minOverMax / minOverMax + Pb * part * part + Pr); - g = (r) / minOverMax; - b = (r) + h * ((g) - (r)); - } else if (h < 4.0 / 6.0) { // B>G>R - h = 6.0 * (-h + 4.0 / 6.0); - part = 1.0 + h * (1.0 / minOverMax - 1.0); - r = p / Math.sqrt(Pb / minOverMax / minOverMax + Pg * part * part + Pr); - b = (r) / minOverMax; - g = (r) + h * ((b) - (r)); - } else if (h < 5.0 / 6.0) { // B>R>G - h = 6.0 * (h - 4.0 / 6.0); - part = 1.0 + h * (1.0 / minOverMax - 1.0); - g = p / Math.sqrt(Pb / minOverMax / minOverMax + Pr * part * part + Pg); - b = (g) / minOverMax; - r = (g) + h * ((b) - (g)); - } else { // R>B>G - h = 6.0 * (-h + 6.0 / 6.0); - part = 1.0 + h * (1.0 / minOverMax - 1.0); - g = p / Math.sqrt(Pr / minOverMax / minOverMax + Pb * part * part + Pg); - r = (g) / minOverMax; - b = (g) + h * ((r) - (g)); - } - } else { - if (h < 1.0 / 6.0) { // R>G>B - h = 6.0 * (h - 0.0 / 6.0); - r = Math.sqrt(p * p / (Pr + Pg * h * h)); - g = (r) * h; - b = 0.0; - } else if (h < 2.0 / 6.0) { // G>R>B - h = 6.0 * (-h + 2.0 / 6.0); - g = Math.sqrt(p * p / (Pg + Pr * h * h)); - r = (g) * h; - b = 0.0; - } else if (h < 3.0 / 6.0) { // G>B>R - h = 6.0 * (h - 2.0 / 6.0); - g = Math.sqrt(p * p / (Pg + Pb * h * h)); - b = (g) * h; - r = 0.0; - } else if (h < 4.0 / 6.0) { // B>G>R - h = 6.0 * (-h + 4.0 / 6.0); - b = Math.sqrt(p * p / (Pb + Pg * h * h)); - g = (b) * h; - r = 0.0; - } else if (h < 5.0 / 6.0) { // B>R>G - h = 6.0 * (h - 4.0 / 6.0); - b = Math.sqrt(p * p / (Pb + Pr * h * h)); - r = (b) * h; - g = 0.0; - } else { // R>B>G - h = 6.0 * (-h + 6.0 / 6.0); - r = Math.sqrt(p * p / (Pr + Pb * h * h)); - b = (r) * h; - g = 0.0; - } - } - - return [Math.round(r), Math.round(g), Math.round(b)]; - } - - -}; - - -//append rgb -rgb.hsp = function (rgb) { - var r = parseInt(rgb[0], 10), - g = parseInt(rgb[1], 10), - b = parseInt(rgb[2], 10), - h, s, p; - - // Calculate the Perceived brightness - p = Math.sqrt(r * r * Pr + g * g * Pg + b * b * Pb); - - // Calculate the Hue and Saturation - if (r === g && r === b) { - h = 0.0; - s = 0.0; - } else { - // R is largest - if (r >= g && r >= b) { - if (b >= g) { - h = 6.0 / 6.0 - 1.0 / 6.0 * (b - g) / (r - g); - s = 1.0 - g / r; - } else { - h = 0.0 / 6.0 + 1.0 / 6.0 * (g - b) / (r - b); - s = 1.0 - b / r; - } - } - - // G is largest - if (g >= r && g >= b) { - if (r >= b) { - h = 2.0 / 6.0 - 1.0 / 6.0 * (r - b) / (g - b); - s = 1 - b / g; - } else { - h = 2.0 / 6.0 + 1.0 / 6.0 * (b - r) / (g - r); - s = 1.0 - r / g; - } - } - - // B is largest - if (b >= r && b >= g) { - if (g >= r) { - h = 4.0 / 6.0 - 1.0 / 6.0 * (g - r) / (b - r); - s = 1.0 - r / b; - } else { - h = 4.0 / 6.0 + 1.0 / 6.0 * (r - g) / (b - g); - s = 1.0 - g / b; - } - } - } - - return [Math.round(h*360.0), s*100.0, Math.round(p)]; -}; diff --git a/node_modules/color-space/hsv.js b/node_modules/color-space/hsv.js deleted file mode 100644 index 7601172..0000000 --- a/node_modules/color-space/hsv.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * @module color-space/hsv - */ -'use strict' - -var rgb = require('./rgb'); -var hsl = require('./hsl'); - -module.exports = { - name: 'hsv', - min: [0,0,0], - max: [360,100,100], - channel: ['hue', 'saturation', 'value'], - alias: ['HSV', 'HSB'], - - rgb: function(hsv) { - var h = hsv[0] / 60, - s = hsv[1] / 100, - v = hsv[2] / 100, - hi = Math.floor(h) % 6; - - var f = h - Math.floor(h), - p = 255 * v * (1 - s), - q = 255 * v * (1 - (s * f)), - t = 255 * v * (1 - (s * (1 - f))); - v *= 255; - - switch(hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } - }, - - hsl: function(hsv) { - var h = hsv[0], - s = hsv[1] / 100, - v = hsv[2] / 100, - sl, l; - - l = (2 - s) * v; - sl = s * v; - sl /= (l <= 1) ? l : 2 - l; - sl = sl || 0; - l /= 2; - - return [h, sl * 100, l * 100]; - } -}; - - -//append rgb -rgb.hsv = function(rgb) { - var r = rgb[0], - g = rgb[1], - b = rgb[2], - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, v; - - if (max === 0) { - s = 0; - } - else { - s = (delta/max * 100); - } - - if (max === min) { - h = 0; - } - else if (r === max) { - h = (g - b) / delta; - } - else if (g === max) { - h = 2 + (b - r) / delta; - } - else if (b === max) { - h = 4 + (r - g) / delta; - } - - h = Math.min(h * 60, 360); - - if (h < 0) { - h += 360; - } - - v = ((max / 255) * 1000) / 10; - - return [h, s, v]; -}; - - - -//extend hsl -hsl.hsv = function(hsl) { - var h = hsl[0], - s = hsl[1] / 100, - l = hsl[2] / 100, - sv, v; - l *= 2; - s *= (l <= 1) ? l : 2 - l; - v = (l + s) / 2; - sv = (2 * s) / (l + s) || 0; - - return [h, sv * 100, v * 100]; -}; diff --git a/node_modules/color-space/hwb.js b/node_modules/color-space/hwb.js deleted file mode 100644 index 85264c2..0000000 --- a/node_modules/color-space/hwb.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @module color-space/hwb - */ -'use strict' - -var rgb = require('./rgb'); -var hsv = require('./hsv'); -var hsl = require('./hsl'); - - -var hwb = module.exports = { - name: 'hwb', - min: [0,0,0], - max: [360,100,100], - channel: ['hue', 'whiteness', 'blackness'], - alias: ['HWB'], - - // http://dev.w3.org/csswg/css-color/#hwb-to-rgb - rgb: function(hwb) { - var h = hwb[0] / 360, - wh = hwb[1] / 100, - bl = hwb[2] / 100, - ratio = wh + bl, - i, v, f, n; - - var r, g, b; - - // wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } - - i = Math.floor(6 * h); - v = 1 - bl; - f = 6 * h - i; - - //if it is even - if ((i & 0x01) !== 0) { - f = 1 - f; - } - - n = wh + f * (v - wh); // linear interpolation - - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - - return [r * 255, g * 255, b * 255]; - }, - - - // http://alvyray.com/Papers/CG/HWB_JGTv208.pdf - hsv: function(arg){ - var h = arg[0], w = arg[1], b = arg[2], s, v; - - //if w+b > 100% - take proportion (how many times ) - if (w + b >= 100){ - s = 0; - v = 100 * w/(w+b); - } - - //by default - take wiki formula - else { - s = 100-(w/(1-b/100)); - v = 100-b; - } - - - return [h, s, v]; - }, - - hsl: function(arg){ - return hsv.hsl(hwb.hsv(arg)); - } -}; - - -//extend rgb -rgb.hwb = function(val) { - var r = val[0], - g = val[1], - b = val[2], - h = rgb.hsl(val)[0], - w = 1/255 * Math.min(r, Math.min(g, b)); - - b = 1 - 1/255 * Math.max(r, Math.max(g, b)); - - return [h, w * 100, b * 100]; -}; - - - -//keep proper hue on 0 values (conversion to rgb loses hue on zero-lightness) -hsv.hwb = function(arg){ - var h = arg[0], s = arg[1], v = arg[2]; - return [h, v === 0 ? 0 : (v * (1-s/100)), 100 - v]; -}; - - -//extend hsl with proper conversions -hsl.hwb = function(arg){ - return hsv.hwb(hsl.hsv(arg)); -}; diff --git a/node_modules/color-space/index.js b/node_modules/color-space/index.js deleted file mode 100644 index 2c50580..0000000 --- a/node_modules/color-space/index.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Color space data and conversions - * - * @module color-space - * - */ -'use strict'; - - -/** Exported spaces */ -var spaces = { - rgb: require('./rgb'), - hsl: require('./hsl'), - hsv: require('./hsv'), - hsi: require('./hsi'), - hwb: require('./hwb'), - cmyk: require('./cmyk'), - cmy: require('./cmy'), - xyz: require('./xyz'), - xyy: require('./xyy'), - yiq: require('./yiq'), - yuv: require('./yuv'), - ydbdr: require('./ydbdr'), - ycgco: require('./ycgco'), - ypbpr: require('./ypbpr'), - ycbcr: require('./ycbcr'), - xvycc: require('./xvycc'), - yccbccrc: require('./yccbccrc'), - ucs: require('./ucs'), - uvw: require('./uvw'), - jpeg: require('./jpeg'), - lab: require('./lab'), - labh: require('./labh'), - lms: require('./lms'), - lchab: require('./lchab'), - luv: require('./luv'), - lchuv: require('./lchuv'), - hsluv: require('./hsluv'), - hpluv: require('./hpluv'), - cubehelix: require('./cubehelix'), - coloroid: require('./coloroid'), - hcg: require('./hcg'), - hcy: require('./hcy'), - tsl: require('./tsl'), - yes: require('./yes'), - osaucs: require('./osaucs'), - hsp: require('./hsp') -}; - - - -//build absent convertors from each to every space -var fromSpace; -for (var fromSpaceName in spaces) { - fromSpace = spaces[fromSpaceName]; - for (var toSpaceName in spaces) { - if (!fromSpace[toSpaceName]) fromSpace[toSpaceName] = getConvertor(fromSpaceName, toSpaceName); - } -} - - -/** return converter through xyz/rgb space */ -function getConvertor(fromSpaceName, toSpaceName){ - var fromSpace = spaces[fromSpaceName]; - - //create straight converter - if (fromSpaceName === toSpaceName) { - return function (a) { - return a; - }; - } - - //create xyz converter, if available - else if (fromSpace.xyz && spaces.xyz[toSpaceName]) { - return function(arg){ - return spaces.xyz[toSpaceName](fromSpace.xyz(arg)); - }; - } - //create rgb converter - else if (fromSpace.rgb && spaces.rgb[toSpaceName]) { - return function(arg){ - return spaces.rgb[toSpaceName](fromSpace.rgb(arg)); - }; - } -} - - -module.exports = spaces; diff --git a/node_modules/color-space/jpeg.js b/node_modules/color-space/jpeg.js deleted file mode 100644 index 98bf371..0000000 --- a/node_modules/color-space/jpeg.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * https://en.wikipedia.org/wiki/YCbCr#JPEG_conversion - * - * JPEG conversion without head/footroom - * - * @module color-space/jpeg - */ -'use strict' - -var rgb = require('./rgb'); - -var jpeg = module.exports = { - name: 'jpeg', - min: [0, 0, 0], - max: [255, 255, 255], - channel: ['Y','Cb','Cr'], - alias: ['JPEG'] -}; - - -/** - * JPEG to RGB - * transform through analog form - * - * @param {Array} jpeg RGB values - * - * @return {Array} JPEG values - */ -jpeg.rgb = function (arr) { - var y = arr[0], cb = arr[1], cr = arr[2]; - - return [ - y + 1.402 * (cr - 128), - y - 0.34414 * (cb - 128) - 0.71414 * (cr - 128), - y + 1.772 * (cb - 128) - ] -}; - - -/** - * RGB to JPEG - * transform through analog form - * - * @param {Array} jpeg JPEG values - * - * @return {Array} RGB values - */ -rgb.jpeg = function(arr) { - var r = arr[0], g = arr[1], b = arr[2]; - - return [ - 0.299 * r + 0.587 * g + 0.114 * b, - 128 - 0.168736 * r - 0.331264 * g + 0.5 * b, - 128 + 0.5 * r - 0.418688 * g - 0.081312 * b - ] -}; diff --git a/node_modules/color-space/lab.js b/node_modules/color-space/lab.js deleted file mode 100644 index 2a2c13d..0000000 --- a/node_modules/color-space/lab.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * CIE LAB space model - * - * @module color-space/lab - */ -'use strict' - -var xyz = require('./xyz'); - -module.exports = { - name: 'lab', - min: [0,-100,-100], - max: [100,100,100], - channel: ['lightness', 'a', 'b'], - alias: ['LAB', 'cielab'], - - xyz: function(lab) { - var l = lab[0], - a = lab[1], - b = lab[2], - x, y, z, y2; - - if (l <= 8) { - y = (l * 100) / 903.3; - y2 = (7.787 * (y / 100)) + (16 / 116); - } else { - y = 100 * Math.pow((l + 16) / 116, 3); - y2 = Math.pow(y / 100, 1/3); - } - - x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3); - - z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3); - - return [x, y, z]; - } -}; - - -//extend xyz -xyz.lab = function(xyz){ - var x = xyz[0], - y = xyz[1], - z = xyz[2], - l, a, b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -}; diff --git a/node_modules/color-space/labh.js b/node_modules/color-space/labh.js deleted file mode 100644 index beaf3d7..0000000 --- a/node_modules/color-space/labh.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Hunter-lab space. - * - * @module color-space/labh - */ -'use strict' - -var xyz = require('./xyz'); - -module.exports = { - name: 'labh', - - //mins/maxes are taken from colormine - //FIXME: check whether mins/maxes correct - min: [0,-128,-128], - max: [100,128,128], - channel: ['lightness', 'a', 'b'], - alias: ['LABh', 'hunter-lab', 'hlab'], - - //maths are taken from EasyRGB - xyz: function(lab) { - var l = lab[0], a = lab[1], b = lab[2]; - - var _y = l / 10; - var _x = a / 17.5 * l / 10; - var _z = b / 7 * l / 10; - - var y = _y * _y; - var x = ( _x + y ) / 1.02; - var z = -( _z - y ) / 0.847; - - return [x,y,z]; - } -}; - -//extend xyz -xyz.labh = function(xyz){ - var x = xyz[0], y = xyz[1], z = xyz[2]; - var l = 10 * Math.sqrt( y ); - var a = y === 0 ? 0 : 17.5 * ((( 1.02 * x ) - y ) / Math.sqrt( y ) ); - var b = y === 0 ? 0 : 7 * ( ( y - ( 0.847 * z ) ) / Math.sqrt( y ) ); - - return [l, a, b]; -}; diff --git a/node_modules/color-space/lchab.js b/node_modules/color-space/lchab.js deleted file mode 100644 index 7800508..0000000 --- a/node_modules/color-space/lchab.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Cylindrical LAB - * - * @module color-space/lchab - */ -'use strict' - -var xyz = require('./xyz'); -var lab = require('./lab'); - - -//cylindrical lab -var lchab = module.exports = { - name: 'lchab', - min: [0,0,0], - max: [100,100,360], - channel: ['lightness', 'chroma', 'hue'], - alias: ['LCHab', 'cielch', 'LCH', 'HLC', 'LSH'], - - xyz: function(arg) { - return lab.xyz(lchab.lab(arg)); - }, - - lab: function(lch) { - var l = lch[0], - c = lch[1], - h = lch[2], - a, b, hr; - - hr = h / 360 * 2 * Math.PI; - a = c * Math.cos(hr); - b = c * Math.sin(hr); - return [l, a, b]; - } -}; - - -//extend lab -lab.lchab = function(lab) { - var l = lab[0], - a = lab[1], - b = lab[2], - hr, h, c; - - hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - if (h < 0) { - h += 360; - } - c = Math.sqrt(a * a + b * b); - return [l, c, h]; -}; - -xyz.lchab = function(arg){ - return lab.lchab(xyz.lab(arg)); -}; diff --git a/node_modules/color-space/lchuv.js b/node_modules/color-space/lchuv.js deleted file mode 100644 index b21f6e8..0000000 --- a/node_modules/color-space/lchuv.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Cylindrical CIE LUV - * - * @module color-space/lchuv - */ -'use strict' - -var luv = require('./luv'); -var xyz = require('./xyz'); - -//cylindrical luv -var lchuv = module.exports = { - name: 'lchuv', - channel: ['lightness', 'chroma', 'hue'], - alias: ['LCHuv', 'cielchuv'], - min: [0,0,0], - max: [100,100,360], - - luv: function(luv){ - var l = luv[0], - c = luv[1], - h = luv[2], - u, v, hr; - - hr = h / 360 * 2 * Math.PI; - u = c * Math.cos(hr); - v = c * Math.sin(hr); - return [l, u, v]; - }, - - xyz: function(arg) { - return luv.xyz(lchuv.luv(arg)); - } -}; - -luv.lchuv = function(luv){ - var l = luv[0], u = luv[1], v = luv[2]; - - var c = Math.sqrt(u*u + v*v); - var hr = Math.atan2(v,u); - var h = hr * 360 / 2 / Math.PI; - if (h < 0) { - h += 360; - } - - return [l,c,h] -}; - -xyz.lchuv = function(arg){ - return luv.lchuv(xyz.luv(arg)); -}; diff --git a/node_modules/color-space/lms.js b/node_modules/color-space/lms.js deleted file mode 100644 index 918daff..0000000 --- a/node_modules/color-space/lms.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * A responsivity of cones color space. - * Used for CAT - chromatic adaptation transform. - * - * http://en.wikipedia.org/wiki/LMS_color_space - * http://www.mathworks.com/matlabcentral/fileexchange/28790-colorspace-transformations - * - * @todo xyz -> lms - * @todo tests - * - * @module color-space/lms - */ -'use strict' - -var xyz = require('./xyz'); - -var lms = module.exports = { - name: 'lms', - min: [0,0,0], - max: [100,100,100], - channel: ['long', 'medium', 'short'], - - - //transform matrices - matrix: { - HPE: [ - 0.38971, 0.68898,-0.07868, - -0.22981, 1.18340, 0.04641, - 0.00000, 0.00000, 1.00000], - VONKRIES: [ - 0.4002, 0.7076, -0.0808, - -0.2263, 1.1653, 0.0457, - 0.00000,0.00000, 0.9182], - BFD: [ - 0.8951, 0.2664,-0.1614, - -0.7502, 1.7135, 0.0367, - 0.0389,-0.0686, 1.0296], - CAT97: [ - 0.8562, 0.3372,-0.1934, - -0.8360, 1.8327, 0.0033, - 0.0357,-0.00469,1.0112], - CAT00: [ - 0.7982, 0.3389,-0.1371, - -0.5918, 1.5512, 0.0406, - 0.0008, 0.0239, 0.9753], - CAT02: [ - 0.7328, 0.4296,-0.1624, - -0.7036, 1.6975, 0.0061, - 0.0030, 0.0136, 0.9834] - } -}; - - -lms.xyz = function(arg, matrix){ - var l = arg[0], m = arg[1], s = arg[2]; - - if (!matrix) { - matrix = [ - 1.096123820835514, -0.278869000218287, +0.182745179382773, - 0.454369041975359, + 0.473533154307412, +0.072097803717229, - -0.009627608738429, -0.005698031216113, +1.015325639954543 - ]; - } - - return [ - l * matrix[0] + m * matrix[1] + s * matrix[2], - l * matrix[3] + m * matrix[4] + s * matrix[5], - l * matrix[6] + m * matrix[7] + s * matrix[8] - ]; -}; - -xyz.lms = function(arg, matrix) { - var x = arg[0], y = arg[1], z = arg[2]; - - if (!matrix) { - matrix = lms.matrix.CAT02 - } - - return [ - x * matrix[0] + y * matrix[1] + z * matrix[2], - x * matrix[3] + y * matrix[4] + z * matrix[5], - x * matrix[6] + y * matrix[7] + z * matrix[8] - ]; -}; diff --git a/node_modules/color-space/luv.js b/node_modules/color-space/luv.js deleted file mode 100644 index f2a088e..0000000 --- a/node_modules/color-space/luv.js +++ /dev/null @@ -1,100 +0,0 @@ -/** - * CIE LUV (C'est la vie) - * - * @module color-space/luv - */ -'use strict' - -var xyz = require('./xyz'); - -module.exports = { - name: 'luv', - //NOTE: luv has no rigidly defined limits - //easyrgb fails to get proper coords - //boronine states no rigid limits - //colorMine refers this ones: - min: [0,-134,-140], - max: [100,224,122], - channel: ['lightness', 'u', 'v'], - alias: ['LUV', 'cieluv', 'cie1976'], - - xyz: function(arg, i, o){ - var _u, _v, l, u, v, x, y, z, xn, yn, zn, un, vn; - l = arg[0], u = arg[1], v = arg[2]; - - if (l === 0) return [0,0,0]; - - //get constants - //var e = 0.008856451679035631; //(6/29)^3 - var k = 0.0011070564598794539; //(3/29)^3 - - //get illuminant/observer - i = i || 'D65'; - o = o || 2; - - xn = xyz.whitepoint[o][i][0]; - yn = xyz.whitepoint[o][i][1]; - zn = xyz.whitepoint[o][i][2]; - - un = (4 * xn) / (xn + (15 * yn) + (3 * zn)); - vn = (9 * yn) / (xn + (15 * yn) + (3 * zn)); - // un = 0.19783000664283; - // vn = 0.46831999493879; - - - _u = u / (13 * l) + un || 0; - _v = v / (13 * l) + vn || 0; - - y = l > 8 ? yn * Math.pow( (l + 16) / 116 , 3) : yn * l * k; - - //wikipedia method - x = y * 9 * _u / (4 * _v) || 0; - z = y * (12 - 3 * _u - 20 * _v) / (4 * _v) || 0; - - //boronine method - //https://github.com/boronine/husl/blob/master/husl.coffee#L201 - // x = 0 - (9 * y * _u) / ((_u - 4) * _v - _u * _v); - // z = (9 * y - (15 * _v * y) - (_v * x)) / (3 * _v); - - return [x, y, z]; - } -}; - -// http://www.brucelindbloom.com/index.html?Equations.html -// https://github.com/boronine/husl/blob/master/husl.coffee -//i - illuminant -//o - observer -xyz.luv = function(arg, i, o) { - var _u, _v, l, u, v, x, y, z, xn, yn, zn, un, vn; - - //get constants - var e = 0.008856451679035631; //(6/29)^3 - var k = 903.2962962962961; //(29/3)^3 - - //get illuminant/observer coords - i = i || 'D65'; - o = o || 2; - - xn = xyz.whitepoint[o][i][0]; - yn = xyz.whitepoint[o][i][1]; - zn = xyz.whitepoint[o][i][2]; - - un = (4 * xn) / (xn + (15 * yn) + (3 * zn)); - vn = (9 * yn) / (xn + (15 * yn) + (3 * zn)); - - - x = arg[0], y = arg[1], z = arg[2]; - - - _u = (4 * x) / (x + (15 * y) + (3 * z)) || 0; - _v = (9 * y) / (x + (15 * y) + (3 * z)) || 0; - - var yr = y/yn; - - l = yr <= e ? k * yr : 116 * Math.pow(yr, 1/3) - 16; - - u = 13 * l * (_u - un); - v = 13 * l * (_v - vn); - - return [l, u, v]; -}; diff --git a/node_modules/color-space/munsell.js b/node_modules/color-space/munsell.js deleted file mode 100644 index 3dc48d9..0000000 --- a/node_modules/color-space/munsell.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @module color-space/munsell - */ -'use strict' - -var munsell = { - name: 'munsell', - alias: [], - min: [], - max: [], - - //hue, value, chroma - channel: ['H', 'V', 'C'] -} - -/** - * http://www.pp.bme.hu/ar/article/view/2395/1500 - */ -munsell.coloroid = function (cv) { - var c = arg[0], vm = arg[1]; - - var a,t,v; - - //coloroid chroma / munsell chroma - t = kav * Math.pow(c, 2/3); - - v = 10 * Math.sqrt(1.2219*vm - 0.23111*vm*vm + 0.23951*vm*vm*vm - 0.021009*vm*vm*vm*vm + 0.0008404*vm*vm*vm*vm*vm); -}; - - -module.exports = munsell; diff --git a/node_modules/color-space/osaucs.js b/node_modules/color-space/osaucs.js deleted file mode 100644 index c3ebd79..0000000 --- a/node_modules/color-space/osaucs.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * OSA-UCS - * - * @module color-space/osa-ucs - */ -'use strict' - -var xyz = require('./xyz'); - - -var osaucs = { - name: 'osaucs', - alias: ['OSA-UCS'], - channel: ['L', 'j', 'g'], - min: [-10, -6, -10], - max: [8, 12, 6] -}; - - -/** - * There’s no analytical solution to this - */ -osaucs.xyz = function (arg) { - var x, y, z; - - throw 'Unimplemented'; - //http://www.researchgate.net/publication/259253763_Comparison_of_the_performance_of_inverse_transformation_methods_from_OSA-UCS_to_CIEXYZ - - return [x, y, z]; -}; - - -/** - * Transform to xyz osaucs - * - * @param {Array} arg Input xyz array - * - * @return {Array} Ljg array - */ -xyz.osaucs = function (arg) { - var X = arg[0], Y = arg[1], Z = arg[2]; - - var x = X / (X + Y + Z); - var y = Y / (X + Y + Z); - - //FIXME: there might be a typo, wiki states 1.8103 as a constant value - var K = 4.4934*x*x + 4.3034*y*y - 4.276*x*y - 1.3744*x - 2.56439*y + 1.8103; - var Y0 = K*Y; - - var L_ = 5.9*(Math.pow(Y0, 1/3) - 2/3 + 0.042*Math.pow(Math.max(Y0, 30) - 30, 1/3)); - var L = (L_ - 14.3993) / Math.sqrt(2); - - var C = L_ / (5.9 * (Math.pow(Y0, 1/3) - 2/3)); - - var R = 0.7790*X + 0.4194*Y - 0.1648*Z; - var G = -0.4493*X + 1.3265*Y + 0.0927*Z; - var B = -0.1149*X + 0.3394*Y + 0.7170*Z; - - R = Math.pow(R, 1/3) || 0; - G = Math.pow(G, 1/3) || 0; - B = Math.pow(B, 1/3) || 0; - - var a = -13.7*R + 17.7*G - 4*B; - var b = 1.7*R + 8*G - 9.7*B; - - var g = C*a; - var j = C*b; - - //polar form - // var p = Math.sqrt(j*j + g*g); - // var phi = Math.atan2(j, g); - - return [L, j, g]; -}; - - -module.exports = osaucs; diff --git a/node_modules/color-space/package.json b/node_modules/color-space/package.json deleted file mode 100644 index c273ba4..0000000 --- a/node_modules/color-space/package.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "_from": "color-space@^1.14.7", - "_id": "color-space@1.16.0", - "_inBundle": false, - "_integrity": "sha512-A6WMiFzunQ8KEPFmj02OnnoUnqhmSaHaZ/0LVFcPTdlvm8+3aMJ5x1HRHy3bDHPkovkf4sS0f4wsVvwk71fKkg==", - "_location": "/color-space", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "color-space@^1.14.7", - "name": "color-space", - "escapedName": "color-space", - "rawSpec": "^1.14.7", - "saveSpec": null, - "fetchSpec": "^1.14.7" - }, - "_requiredBy": [ - "/homey-meshdriver" - ], - "_resolved": "https://registry.npmjs.org/color-space/-/color-space-1.16.0.tgz", - "_shasum": "611781bca41cd8582a1466fd9e28a7d3d89772a2", - "_spec": "color-space@^1.14.7", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\homey-meshdriver", - "author": { - "name": "Deema Yvanow", - "email": "dfcreative@gmail.com" - }, - "bugs": { - "url": "https://github.com/colorjs/color-space/issues" - }, - "bundleDependencies": false, - "dependencies": { - "hsluv": "^0.0.3", - "mumath": "^3.3.4" - }, - "deprecated": false, - "description": "Color space conversions and data", - "devDependencies": { - "almost-equal": "^1.1.0", - "closurecompiler": "^1.x", - "gzip-size": "^3.0.0", - "mocha": "latest", - "queried": "^1.4.1" - }, - "files": [ - "*.js", - "dist" - ], - "homepage": "https://github.com/colorjs/color-space#readme", - "keywords": [ - "color", - "colour", - "rgb", - "hsl", - "hsv", - "lab", - "lch", - "luv", - "lch", - "cie", - "hsluv", - "husl", - "color-convert", - "gamut", - "color-conversions", - "color-space", - "color-translation", - "color-data", - "coloroid", - "cubehelix", - "munsell", - "hcg", - "hsp" - ], - "license": "MIT", - "main": "./index.js", - "name": "color-space", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/colorjs/color-space.git" - }, - "scripts": { - "build": "browserify --standalone colorSpace ./index.js > dist/color-space.js", - "min": "ccjs dist/color-space.js --language_in=ECMASCRIPT5 > dist/color-space.min.js && cat dist/color-space.min.js | gzip-size | pretty-bytes", - "test": "mocha", - "watch": "watchify -r ./index:../index -r hsluv -r assert -r mumath -r queried -d -o test/bundle.js" - }, - "version": "1.16.0" -} diff --git a/node_modules/color-space/readme.md b/node_modules/color-space/readme.md deleted file mode 100644 index de219f1..0000000 --- a/node_modules/color-space/readme.md +++ /dev/null @@ -1,195 +0,0 @@ -# Color-space [![Build Status](https://travis-ci.org/colorjs/color-space.svg?branch=master)](https://travis-ci.org/colorjs/color-space) [![stable](https://img.shields.io/badge/stability-stable-brightgreen.svg)](http://github.com/badges/stability-badges) [![OpenCollective](https://opencollective.com/color-space/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/color-space/sponsors/badge.svg)](#sponsors) - - - -Conversions and data for color spaces. [Demo](http://colorjs.github.io/color-space). - - -## Usage - -[![npm install color-space](https://nodei.co/npm/color-space.png?mini=true)](https://npmjs.org/package/color-space/) - -```js -var space = require('color-space'); - -//convert lab to lch -var result = space.lab.lch([80,50,60]); -``` - -You can require a separate space to reduce size significantly: - -```js -var rgb = require('color-space/rgb'); -var hsl = require('color-space/hsl'); - -//convert rgb to hsl -rgb.hsl([200,230,100]); -``` - - -## API - - -```js -.(array); -.name //space name -.min //channel minimums -.max //channel maximums -.channel //channel names -.alias //alias space names -``` - -## Spaces - -* [x] [RGB](https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_RGB_colour_space) — additive color model based on red, green and blue primary colors. -* [x] [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) — cylindrical-coordinates representation of RGB. -* [x] [HSV, HSB](https://en.wikipedia.org/wiki/HSL_and_HSV) -* [x] [HWB](http://dev.w3.org/csswg/css-color/#the-hwb-notation) -* [x] [HSI](https://en.wikipedia.org/wiki/HSL_and_HSV) — used for computer vision due to better separation of shapes in an image, comparing to HSL/HSB. -* [x] [CMYK](https://en.wikipedia.org/wiki/CMYK_color_model) -* [x] [CMY](https://en.wikipedia.org/wiki/CMYK_color_model) -* [x] [XYZ](http://en.wikipedia.org/wiki/CIE_1931_color_space) -* [x] [XYY (YXY)](https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space) -* [x] [LAB](http://en.wikipedia.org/wiki/Lab_color_space) -* [x] [LCHab](https://en.wikipedia.org/wiki/Lab_color_space#Cylindrical_representation:_CIELCh_or_CIEHLC) -* [x] [LUV](http://en.wikipedia.org/wiki/CIELUV) -* [x] [LCHuv](http://en.wikipedia.org/wiki/CIELUV#Cylindrical_representation) -* [x] [HSLuv](http://www.hsluv.org/) -* [x] [HPLuv](http://www.hsluv.org/) -* [x] [LABHunter](http://en.wikipedia.org/wiki/Lab_color_space#Hunter_Lab) -* [x] [YUV](https://en.wikipedia.org/?title=YUV) -* [x] [YIQ](https://en.wikipedia.org/?title=YIQ) -* [x] [YCgCo](https://en.wikipedia.org/wiki/YCgCo) -* [x] [YDbDr](https://en.wikipedia.org/wiki/YDbDr) -* [x] [YPbPr](https://en.wikipedia.org/wiki/YPbPr) -* [x] [YCbCr](https://en.wikipedia.org/wiki/YCbCr) -* [x] [YcCbcCrc](https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.2020_conversion) -* [x] [JPEG](https://en.wikipedia.org/wiki/YCbCr#JPEG_conversion) -* [x] [XvYCC](https://en.wikipedia.org/wiki/XvYCC) -* [x] [UCS](https://en.wikipedia.org/wiki/CIE_1960_color_space) -* [x] [UVW](https://en.wikipedia.org/wiki/CIE_1964_color_space) -* [ ] [Munsell](https://en.wikipedia.org/wiki/Munsell_color_system) -* [ ] [NCS](https://en.wikipedia.org/wiki/Natural_Color_System) -* [ ] [PMS](https://en.wikipedia.org/wiki/Pantone) -* [ ] [RAL](https://en.wikipedia.org/wiki/RAL_colour_standard) -* [ ] [TSL](https://en.wikipedia.org/wiki/TSL_color_space) -* [ ] [RG](https://en.wikipedia.org/wiki/RG_color_space) -* [ ] [RGK](https://en.wikipedia.org/wiki/RG_color_space) -* [x] [Coloroid](https://en.wikipedia.org/wiki/Coloroid) — color space for architects and visual constructors, Hungarian Standard MSZ 7300 since 2000. -* [ ] [OSA-UCS](https://en.wikipedia.org/wiki/OSA-UCS) — accurately reprsenting uniform color differences, developed by the Optical Society of America’s Committee on Uniform Color Scales. -* [ ] [HKS](https://en.wikipedia.org/wiki/HKS_(colour_system)) -* [x] [LMS](http://en.wikipedia.org/wiki/LMS_color_space) — represents sensitivity of the human eye to Long, Medium and Short wavelengths. -* [x] [Cubehelix](https://www.mrao.cam.ac.uk/~dag/CUBEHELIX/) — colormaps for data visualization. -* [ ] [Gray](http://dev.w3.org/csswg/css-color/#grays) -* [ ] [CIECAM02](https://en.wikipedia.org/wiki/CIECAM02) -* [ ] [US Federal Standard 595](https://en.wikipedia.org/wiki/Federal_Standard_595) -* [ ] [Toyo](http://mytoyocolor.com/) -* [ ] [PhotoYCC](http://www5.informatik.tu-muenchen.de/lehre/vorlesungen/graphik/info/csc/COL_34.htm) -* [x] [HCG](https://github.com/acterhd/hcg-legacy) -* [ ] [HCL](http://www.chilliant.com/rgb2hsv.html) -* [x] [HSP](http://alienryderflex.com/hsp.html) -* [ ] [HCY](http://chilliant.blogspot.ca/2012/08/rgbhcy-in-hlsl.html) -* [x] [YES](http://www.atlantis-press.com/php/download_paper.php?id=198) — computationally effective color space for face recognition. -* [ ] [British Standard Colour](http://www.britishstandardcolour.com/) -* [ ] [RG chromacity](https://en.wikipedia.org/wiki/Rg_chromaticity) -* [ ] [CIE DSH](https://en.wikipedia.org/wiki/Rg_chromaticity) -* [ ] [HSM](http://seer.ufrgs.br/rita/article/viewFile/rita_v16_n2_p141/7428) - -## Contribute - -Please fork, add color space with basic _conversions_ to/from XYZ or RGB and _tests_. -The goal of project is to provide the most complete set of color spaces with maximally minimal uniform API. - - -## Credits - -Thanks to all the color scientists, who devoted their lives to color research and delivered their knowledge to us, for now we can trust them and use their formulas and their code. - -### Backers - -Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/color-space#backer)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### Sponsors - -Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/color-space#sponsor)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -## Related - -* [colormap](https://github.com/bpostlethwaite/colormap) — collection of colormaps to map colors of images/data. A replacement for visualising spaces like cubehelix. -* [color-spectrum](https://www.npmjs.com/package/color-spectrum) — convert spectrum to a color. -* [color-interpolate](https://www.npmjs.com/package/color-interpolate) — interpolate between color values. -* [color-tool](https://www.npmjs.com/package/color-tool) — color picker based on color-space. - - -## Similar projects - -* [color-convert](https://github.com/harthur/color-convert) -* [chromatist](https://github.com/jrus/chromatist) -* [spectra](https://github.com/avp/spectra) -* [colorspaces.js](https://github.com/boronine/colorspaces.js) - diff --git a/node_modules/color-space/rgb.js b/node_modules/color-space/rgb.js deleted file mode 100644 index 5c62358..0000000 --- a/node_modules/color-space/rgb.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * RGB space. - * - * @module color-space/rgb - */ -'use strict' - -module.exports = { - name: 'rgb', - min: [0,0,0], - max: [255,255,255], - channel: ['red', 'green', 'blue'], - alias: ['RGB'] -}; diff --git a/node_modules/color-space/tsl.js b/node_modules/color-space/tsl.js deleted file mode 100644 index f71d3d8..0000000 --- a/node_modules/color-space/tsl.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * https://en.wikipedia.org/wiki/TSL_color_space - * http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.86.6037&rep=rep1&type=pdf - * - * Tint, Saturation, Lightness - * - * @module color-space/tsl - */ -'use strict' - -var rgb = require('./rgb'); - -var tsl = module.exports = { - name: 'tsl', - min: [0,0,0], - max: [1, 1, 1], - channel: ['tint','saturation','lightness'] -}; - - -/** - * TSL to RGB - * - * @param {Array} tsl RGB values - * - * @return {Array} TSL values - */ -tsl.rgb = function(tsl) { - var T = tsl[0], - S = tsl[1], - L = tsl[2]; - - //wikipedia solution - /* - // var x = - 1 / Math.tan(Math.PI * 2 * T); - var x = -Math.sin(2*Math.PI*T); - if ( x != 0 ) x = Math.cos(2*Math.PI*T)/x; - - var g = T > .5 ? -S * Math.sqrt( 5 / (9 * (x*x + 1)) ) : - T < .5 ? S * Math.sqrt( 5 / (9 * (x*x + 1)) ) : 0; - var r = T === 0 ? 0.7453559 * S : (x * g + 1/3); - - var R = k * r, G = k * g, B = k * (1 - r - g); - */ - - var x = Math.tan(2 * Math.PI * (T - 1/4)); - x *= x; - - var r = Math.sqrt(5 * S*S / (9 * (1/x + 1))) + 1/3; - var g = Math.sqrt(5 * S*S / (9 * (x + 1))) + 1/3; - - var k = L / (.185 * r + .473 * g + .114); - - var B = k * (1 - r - g); - var G = k * g; - var R = k * r; - - return [ - R * 255, G * 255, B * 255 - ]; -}; - - -/** - * RGB to TSL - * - * @param {Array} tsl TSL values - * - * @return {Array} RGB values - */ -rgb.tsl = function(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255; - - var r_ = (r / (r + g + b) || 0) - 1/3, - g_ = (g / (r + g + b) || 0) - 1/3; - var T = g_ > 0 ? .5 * Math.atan(r_/ g_) / Math.PI + .25 : - g_ < 0 ? .5 * Math.atan(r_/ g_) / Math.PI + .75 : 0; - - var S = Math.sqrt(9/5 * (r_*r_ + g_*g_)); - - var L = (r * 0.299) + (g * 0.587) + (b * 0.114); - - return [T, S, L]; -}; diff --git a/node_modules/color-space/ucs.js b/node_modules/color-space/ucs.js deleted file mode 100644 index 00d718f..0000000 --- a/node_modules/color-space/ucs.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * https://en.wikipedia.org/wiki/CIE_1960_color_space - * - * Obsolete color space - * - * @module color-space/ucs - */ -'use strict' - -var xyz = require('./xyz'); - -var ucs = module.exports = { - name: 'ucs', - min: [0,0,0], - max: [100, 100, 100], - channel: ['U','V','W'], - alias: ['UCS', 'cie1960'] -}; - - -/** - * UCS to XYZ - * - * @param {Array} ucs XYZ values - * - * @return {Array} UCS values - */ -ucs.xyz = function(ucs) { - var u = ucs[0], - v = ucs[1], - w = ucs[2]; - - return [ - 1.5 * u, - v, - 1.5 * u - 3 * v + 2 * w - ]; -}; - - -/** - * XYZ to UCS - * - * @param {Array} ucs UCS values - * - * @return {Array} XYZ values - */ -xyz.ucs = function(xyz) { - var x = xyz[0], - y = xyz[1], - z = xyz[2]; - - return [ - x * 2/3, - y, - 0.5 * (-x + 3*y + z) - ]; -}; diff --git a/node_modules/color-space/uvw.js b/node_modules/color-space/uvw.js deleted file mode 100644 index ac67905..0000000 --- a/node_modules/color-space/uvw.js +++ /dev/null @@ -1,114 +0,0 @@ -/** - * https://en.wikipedia.org/wiki/CIE_1964_color_space - * - * Very similar to LUV, but w and v are calculated a bit differently. - * - * @module color-space/uvw - */ -'use strict' - -var ucs = require('./ucs'); -var xyz = require('./xyz'); - -var uvw = module.exports = { - name: 'uvw', - min: [-134, -140, 0], - max: [224, 122, 100], - channel: ['U','V','W'], - alias: ['UVW', 'cieuvw', 'cie1964'] -}; - - -/** - * UVW to XYZ - */ -uvw.xyz = function (arg, i, o) { - var _u, _v, w, u, v, x, y, z, xn, yn, zn, un, vn; - u = arg[0], v = arg[1], w = arg[2]; - - if (w === 0) return [0,0,0]; - - //get illuminant/observer - i = i || 'D65'; - o = o || 2; - - xn = xyz.whitepoint[o][i][0]; - yn = xyz.whitepoint[o][i][1]; - zn = xyz.whitepoint[o][i][2]; - - un = (4 * xn) / (xn + (15 * yn) + (3 * zn)); - vn = (6 * yn) / (xn + (15 * yn) + (3 * zn)); - - y = Math.pow((w + 17) / 25, 3); - - _u = u / (13 * w) + un || 0; - _v = v / (13 * w) + vn || 0; - - x = (6 / 4) * y * _u / _v; - z = y * (2 / _v - 0.5 * _u / _v - 5); - - return [x, y, z]; -}; - - -/** - * XYZ to UVW - * - * @return {Array} An UVW array - */ -xyz.uvw = function (arr, i, o) { - var x = arr[0], y = arr[1], z = arr[2], xn, yn, zn, un, vn; - - //find out normal source u v - i = i || 'D65'; - o = o || 2; - - xn = xyz.whitepoint[o][i][0]; - yn = xyz.whitepoint[o][i][1]; - zn = xyz.whitepoint[o][i][2]; - - un = (4 * xn) / (xn + (15 * yn) + (3 * zn)); - vn = (6 * yn) / (xn + (15 * yn) + (3 * zn)); - - var _u = 4 * x / (x + 15 * y + 3 * z) || 0; - var _v = 6 * y / (x + 15 * y + 3 * z) || 0; - - //calc values - var w = 25 * Math.pow(y, 1/3) - 17; - var u = 13 * w * (_u - un); - var v = 13 * w * (_v - vn); - - return [u, v, w]; -}; - - - -/** - * UVW to UCS - * - * @param {Array} uvw UCS values - * - * @return {Array} UVW values - */ -uvw.ucs = function(uvw) { - //find chromacity variables -}; - - -/** - * UCS to UVW - * - * @param {Array} uvw UVW values - * - * @return {Array} UCS values - */ -ucs.uvw = function(ucs) { - // //find chromacity variables - // var u = U / (U + V + W); - // var v = V / (U + V + W); - - // //find 1964 UVW - // w = 25 * Math.pow(y, 1/3) - 17; - // u = 13 * w * (u - un); - // v = 13 * w * (v - vn); -}; diff --git a/node_modules/color-space/xvycc.js b/node_modules/color-space/xvycc.js deleted file mode 100644 index 31e71a8..0000000 --- a/node_modules/color-space/xvycc.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * https://en.wikipedia.org/wiki/XvYCC - * - * Sony xvYCC is extended YCbCr - * - * It uses same transformation as - * SD: ITU-R BT.601 - * HD: ITU-R BT.709 - * - * But have extended mins/maxes, which (may) result in negative rgb values - * - * https://web.archive.org/web/20130524104850/http://www.sony.net/SonyInfo/technology/technology/theme/xvycc_01.html - * - * //TODO: look for a spec (120$) - there are xvYCC ←→ XYZ conversion formulas - * - * @module color-space/xvycc - */ -'use strict' - -var rgb = require('./rgb'); -var ypbpr = require('./ypbpr'); - -var xvycc = module.exports = { - name: 'xvycc', - min: [0, 0, 0], - max: [255, 255, 255], - channel: ['Y','Cb','Cr'], - alias: ['xvYCC'] -}; - - -/** - * From analog to digital form. - * Simple scale to min/max ranges - * - * @return {Array} Resulting digitized form - */ -ypbpr.xvycc = function (ypbpr) { - var y = ypbpr[0], pb = ypbpr[1], pr = ypbpr[2]; - - return [ - 16 + 219 * y, - 128 + 224 * pb, - 128 + 224 * pr - ]; -} - - -/** - * From digital to analog form. - * Scale to min/max ranges - */ -xvycc.ypbpr = function (xvycc) { - var y = xvycc[0], cb = xvycc[1], cr = xvycc[2]; - - return [ - (y - 16) / 219, - (cb - 128) / 224, - (cr - 128) / 224 - ]; -} - - -/** - * xvYCC to RGB - * transform through analog form - * - * @param {Array} xvycc RGB values - * - * @return {Array} xvYCC values - */ -xvycc.rgb = function (arr, kb, kr) { - return ypbpr.rgb(xvycc.ypbpr(arr), kb, kr); -}; - - -/** - * RGB to xvYCC - * transform through analog form - * - * @param {Array} xvycc xvYCC values - * - * @return {Array} RGB values - */ -rgb.xvycc = function(arr, kb, kr) { - return ypbpr.xvycc(rgb.ypbpr(arr, kb, kr)); -}; diff --git a/node_modules/color-space/xyy.js b/node_modules/color-space/xyy.js deleted file mode 100644 index b825095..0000000 --- a/node_modules/color-space/xyy.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Additional xyY space, where xy are relative chromacity params - * - * @module color-space/xyy - */ -'use strict' - -var xyz = require('./xyz'); - -var xyy = { - name: 'xyy', - min: [0,0,0], - max: [1,1,100], - channel: ['x','y','Y'], - alias: ['xyY', 'Yxy', 'yxy'] -}; - -xyy.xyz = function(arg) { - var X, Y, Z, x, y; - x = arg[0]; y = arg[1]; Y = arg[2]; - if (y === 0) { - return [0, 0, 0]; - } - X = x * Y / y; - Z = (1 - x - y) * Y / y; - return [X, Y, Z]; -}; - -xyz.xyy = function(arg) { - var sum, X, Y, Z; - X = arg[0]; Y = arg[1]; Z = arg[2]; - sum = X + Y + Z; - if (sum === 0) { - return [0, 0, Y]; - } - return [X / sum, Y / sum, Y]; -}; - -module.exports = xyy; diff --git a/node_modules/color-space/xyz.js b/node_modules/color-space/xyz.js deleted file mode 100644 index dda3ede..0000000 --- a/node_modules/color-space/xyz.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * CIE XYZ - * - * @module color-space/xyz - */ -'use strict' - -var rgb = require('./rgb'); - -var xyz = { - name: 'xyz', - min: [0,0,0], - channel: ['X','Y','Z'], - alias: ['XYZ', 'ciexyz', 'cie1931'] -}; - - -/** - * Whitepoint reference values with observer/illuminant - * - * http://en.wikipedia.org/wiki/Standard_illuminant - */ -xyz.whitepoint = { - //1931 2° - 2: { - //incadescent - A:[109.85, 100, 35.585], - // B:[], - C: [98.074, 100, 118.232], - D50: [96.422, 100, 82.521], - D55: [95.682, 100, 92.149], - //daylight - D65: [95.045592705167, 100, 108.9057750759878], - D75: [94.972, 100, 122.638], - //flourescent - // F1: [], - F2: [99.187, 100, 67.395], - // F3: [], - // F4: [], - // F5: [], - // F6:[], - F7: [95.044, 100, 108.755], - // F8: [], - // F9: [], - // F10: [], - F11: [100.966, 100, 64.370], - // F12: [], - E: [100,100,100] - }, - - //1964 10° - 10: { - //incadescent - A:[111.144, 100, 35.200], - C: [97.285, 100, 116.145], - D50: [96.720, 100, 81.427], - D55: [95.799, 100, 90.926], - //daylight - D65: [94.811, 100, 107.304], - D75: [94.416, 100, 120.641], - //flourescent - F2: [103.280, 100, 69.026], - F7: [95.792, 100, 107.687], - F11: [103.866, 100, 65.627], - E: [100,100,100] - } -}; - - -/** - * Top values are the whitepoint’s top values, default are D65 - */ -xyz.max = xyz.whitepoint[2].D65; - - -/** - * Transform xyz to rgb - * - * @param {Array} xyz Array of xyz values - * - * @return {Array} RGB values - */ -xyz.rgb = function (_xyz, white) { - //FIXME: make sure we have to divide like this. Probably we have to replace matrix as well then - white = white || xyz.whitepoint[2].E; - - var x = _xyz[0] / white[0], - y = _xyz[1] / white[1], - z = _xyz[2] / white[2], - r, g, b; - - // assume sRGB - // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html - r = (x * 3.240969941904521) + (y * -1.537383177570093) + (z * -0.498610760293); - g = (x * -0.96924363628087) + (y * 1.87596750150772) + (z * 0.041555057407175); - b = (x * 0.055630079696993) + (y * -0.20397695888897) + (z * 1.056971514242878); - - r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) - : r = (r * 12.92); - - g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) - : g = (g * 12.92); - - b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) - : b = (b * 12.92); - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -} - - - -/** - * RGB to XYZ - * - * @param {Array} rgb RGB channels - * - * @return {Array} XYZ channels - */ -rgb.xyz = function(rgb, white) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255; - - // assume sRGB - r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); - g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); - b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); - - var x = (r * 0.41239079926595) + (g * 0.35758433938387) + (b * 0.18048078840183); - var y = (r * 0.21263900587151) + (g * 0.71516867876775) + (b * 0.072192315360733); - var z = (r * 0.019330818715591) + (g * 0.11919477979462) + (b * 0.95053215224966); - - white = white || xyz.whitepoint[2].E; - - return [x * white[0], y * white[1], z * white[2]]; -}; - - - -module.exports = xyz; diff --git a/node_modules/color-space/ycbcr.js b/node_modules/color-space/ycbcr.js deleted file mode 100644 index 6ff5fed..0000000 --- a/node_modules/color-space/ycbcr.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * https://en.wikipedia.org/?title=YCbCr - * - * YCbCr is a digital form of YPbPr conversion - * Thence limits are [16...235], according to the ITU-R BT.709 or ITU-R BT.601 - * - * @module color-space/ycbcr - */ -'use strict' - -var rgb = require('./rgb'); -var ypbpr = require('./ypbpr'); - -var ycbcr = module.exports = { - name: 'ycbcr', - min: [16, 16, 16], - max: [235, 240, 240], - channel: ['Y','Cb','Cr'], - alias: ['YCbCr', 'YCC'] -}; - - -/** - * From analog to digital form. - * Simple scale to min/max ranges - * - * @return {Array} Resulting digitized form - */ -ypbpr.ycbcr = function (ypbpr) { - var y = ypbpr[0], pb = ypbpr[1], pr = ypbpr[2]; - - return [ - 16 + 219 * y, - 128 + 224 * pb, - 128 + 224 * pr - ]; -} - - -/** - * From digital to analog form. - * Scale to min/max ranges - */ -ycbcr.ypbpr = function (ycbcr) { - var y = ycbcr[0], cb = ycbcr[1], cr = ycbcr[2]; - - return [ - (y - 16) / 219, - (cb - 128) / 224, - (cr - 128) / 224 - ]; -} - - -/** - * YCbCr to RGB - * transform through analog form - * - * @param {Array} ycbcr RGB values - * - * @return {Array} YCbCr values - */ -ycbcr.rgb = function (arr, kb, kr) { - return ypbpr.rgb(ycbcr.ypbpr(arr), kb, kr); -}; - - -/** - * RGB to YCbCr - * transform through analog form - * - * @param {Array} ycbcr YCbCr values - * - * @return {Array} RGB values - */ -rgb.ycbcr = function(arr, kb, kr) { - return ypbpr.ycbcr(rgb.ypbpr(arr, kb, kr)); -}; diff --git a/node_modules/color-space/yccbccrc.js b/node_modules/color-space/yccbccrc.js deleted file mode 100644 index cd9fa26..0000000 --- a/node_modules/color-space/yccbccrc.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * YcCbcCrc is ITU-R BT.2020 - * - * @module color-space/yccbccrc - */ -'use strict' - -var rgb = require('./rgb'); -var ypbpr = require('./ypbpr'); - -var yccbccrc = module.exports = { - name: 'yccbccrc', - min: [0, -0.5, -0.5], - max: [1, 0.5, 0.5], - channel: ['Yc','Cbc','Crc'], - alias: ['YcCbcCrc'] -}; - - -/** - * YcCbcCrc to RGB - * - * @param {Array} yccbccrc RGB values - * - * @return {Array} YcCbcCrc values - */ -yccbccrc.rgb = function(yccbccrc) { - return ypbpr.rgb(yccbccrc, 0.0593, 0.2627); -}; - - -/** - * RGB to YcCbcCrc - * - * @param {Array} yccbccrc YcCbcCrc values - * - * @return {Array} RGB values - */ -rgb.yccbccrc = function(arr) { - return rgb.ypbpr(arr, 0.0593, 0.2627); -}; diff --git a/node_modules/color-space/ycgco.js b/node_modules/color-space/ycgco.js deleted file mode 100644 index 52c2997..0000000 --- a/node_modules/color-space/ycgco.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * https://en.wikipedia.org/?title=YCgCo - * - * @module color-space/ycgco - */ -'use strict' - -var rgb = require('./rgb'); - -var ycgco = module.exports = { - name: 'ycgco', - min: [0, -0.5, -0.5], - max: [1, 0.5, 0.5], - channel: ['Y','Cg','Co'], - alias: ['YCgCo'] -}; - - -/** - * YCgCo to RGB - * transform through analog form - * - * @param {Array} ycgco RGB values - * - * @return {Array} YCgCo values - */ -ycgco.rgb = function (arr) { - var y = arr[0], cg = arr[1], co = arr[2]; - - var tmp = y - cg; - - return [ - (tmp + co)*255, - (y + cg)*255, - (tmp - co)*255 - ]; -}; - - -/** - * RGB to YCgCo - * transform through analog form - * - * @param {Array} ycgco YCgCo values - * - * @return {Array} RGB values - */ -rgb.ycgco = function(arr) { - var r = arr[0]/255, g = arr[1]/255, b = arr[2]/255; - - return [ - 0.25*r + 0.5*g + 0.25*b, - -0.25*r + 0.5*g - 0.25*b, - 0.5*r - 0.5*b - ]; -}; diff --git a/node_modules/color-space/ydbdr.js b/node_modules/color-space/ydbdr.js deleted file mode 100644 index 00942a3..0000000 --- a/node_modules/color-space/ydbdr.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * https://en.wikipedia.org/?title=YDbDr - * - * @module color-space/ydbdr - */ -'use strict' - -var rgb = require('./rgb'); -var yuv = require('./yuv'); - -var ydbdr = module.exports = { - name: 'ydbdr', - min: [0,-1.333,-1.333], - max: [1, 1.333, 1.333], - channel: ['Y','Db','Dr'], - alias: ['YDbDr'] -}; - - -/** - * YDbDr to RGB - * - * @param {Array} ydbdr RGB values - * - * @return {Array} YDbDr values - */ -ydbdr.rgb = function(ydbdr) { - var y = ydbdr[0], db = ydbdr[1], dr = ydbdr[2]; - - var r = y + 0.000092303716148*db - 0.525912630661865*dr; - var g = y - 0.129132898890509*db + 0.267899328207599*dr; - var b = y + 0.664679059978955*db - 0.000079202543533*dr; - - return [r*255, g*255, b*255]; -}; - - -/** - * RGB to YDbDr - * - * @param {Array} ydbdr YDbDr values - * - * @return {Array} RGB values - */ -rgb.ydbdr = function(rgb) { - var r = rgb[0]/255, g = rgb[1]/255, b = rgb[2]/255; - return [ - 0.299*r + 0.587*g + 0.114*b, - -0.450*r - 0.883*g + 1.333*b, - -1.333*r + 1.116*g + 0.217*b - ]; -}; - - -/** - * To YUV - */ -yuv.ydbdr = function (yuv) { - return [ - yuv[0], 3.059*yuv[1], -2.169*yuv[2] - ] -}; - -/** - * From YUV - */ -ydbdr.yuv = function (ydbdr) { - return [ - ydbdr[0], ydbdr[1] / 3.059, -ydbdr[2] / 2.169 - ] -}; diff --git a/node_modules/color-space/yes.js b/node_modules/color-space/yes.js deleted file mode 100644 index 636a2aa..0000000 --- a/node_modules/color-space/yes.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * YES color space - * http://www.atlantis-press.com/php/download_paper.php?id=198 - * - * @module color-space/yes - */ -'use strict' - -var rgb = require('./rgb'); - -var yes = module.exports = { - name: 'yes', - min: [0,0,0], - max: [1,1,1], - channel: ['luminance', 'e-factor', 's-factor'] -}; - - -yes.rgb = function(arg){ - var y = arg[0], e = arg[1], s = arg[2]; - - var m = [ - 1, 1.431, .126, - 1, -.569, .126, - 1, .431, -1.874 - ]; - - var r = y * m[0] + e * m[1] + s * m[2], - g = y * m[3] + e * m[4] + s * m[5], - b = y * m[6] + e * m[7] + s * m[8]; - - return [r*255, g*255, b*255]; -}; - -rgb.yes = function(arg) { - var r = arg[0] / 255, g = arg[1] / 255, b = arg[2] / 255; - - var m = [ - .253, .684, .063, - .500, -.50, .0, - .250, .250, -.5 - ]; - - return [ - r * m[0] + g * m[1] + b * m[2], - r * m[3] + g * m[4] + b * m[5], - r * m[6] + g * m[7] + b * m[8] - ]; -}; diff --git a/node_modules/color-space/yiq.js b/node_modules/color-space/yiq.js deleted file mode 100644 index 6825ca6..0000000 --- a/node_modules/color-space/yiq.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * YIQ https://en.wikipedia.org/?title=YIQ - * - * @module color-space/yiq - */ -'use strict' - -var rgb = require('./rgb'); - -var yiq = module.exports = { - name: 'yiq', - min: [0,-0.5957,-0.5226], - max: [1, 0.5957, 0.5226], - channel: ['Y','I','Q'], - alias: ['YIQ'] -}; - -yiq.rgb = function(yiq) { - var y = yiq[0], - i = yiq[1], - q = yiq[2], - r, g, b; - - r = (y * 1) + (i * 0.956) + (q * 0.621); - g = (y * 1) + (i * -0.272) + (q * -0.647); - b = (y * 1) + (i * -1.108) + (q * 1.705); - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -}; - - -//extend rgb -rgb.yiq = function(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255; - - - var y = (r * 0.299) + (g * 0.587) + (b * 0.114); - var i = 0, q = 0; - if (r !== g || g !== b) { - i = (r * 0.596) + (g * -0.275) + (b * -0.321); - q = (r * 0.212) + (g * -0.528) + (b * 0.311); - } - return [y, i, q]; -}; diff --git a/node_modules/color-space/ypbpr.js b/node_modules/color-space/ypbpr.js deleted file mode 100644 index 0806851..0000000 --- a/node_modules/color-space/ypbpr.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * https://en.wikipedia.org/?title=YPbPr - * - * YPbPr is analog form of YCbCr - * hence limits are [0..1] - * - * Default conversion is ITU-R BT.709 - * - * @module color-space/ypbpr - */ -'use strict' - -var rgb = require('./rgb'); - -var ypbpr = module.exports = { - name: 'ypbpr', - min: [0,-0.5,-0.5], - max: [1, 0.5, 0.5], - channel: ['Y','Pb','Pr'], - alias: ['YPbPr', 'Y/PB/PR', 'YPRPB', 'PRPBY', 'PBPRY', 'Y/Pb/Pr', 'YPrPb', 'PrPbY', 'PbPrY', 'Y/R-Y/B-Y', 'Y(R-Y)(B-Y)', 'R-Y', 'B-Y'] -}; - - -/** - * YPbPr to RGB - * - * @param {Array} ypbpr RGB values - * - * @return {Array} YPbPr values - */ -ypbpr.rgb = function(ypbpr, kb, kr) { - var y = ypbpr[0], pb = ypbpr[1], pr = ypbpr[2]; - - //default conversion is ITU-R BT.709 - kb = kb || 0.0722; - kr = kr || 0.2126; - - var r = y + 2 * pr * (1 - kr); - var b = y + 2 * pb * (1 - kb); - var g = (y - kr * r - kb * b) / (1 - kr - kb); - - return [r*255,g*255,b*255]; -}; - - -/** - * RGB to YPbPr - * - * @param {Array} ypbpr YPbPr values - * - * @return {Array} RGB values - */ -rgb.ypbpr = function(rgb, kb, kr) { - var r = rgb[0]/255, g = rgb[1]/255, b = rgb[2]/255; - - //ITU-R BT.709 - kb = kb || 0.0722; - kr = kr || 0.2126; - - var y = kr*r + (1 - kr - kb)*g + kb*b; - var pb = 0.5 * (b - y) / (1 - kb); - var pr = 0.5 * (r - y) / (1 - kr); - - return [y, pb, pr]; -}; diff --git a/node_modules/color-space/yuv.js b/node_modules/color-space/yuv.js deleted file mode 100644 index a33236f..0000000 --- a/node_modules/color-space/yuv.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * YUV https://en.wikipedia.org/?title=YUV - * - * @module color-space/yuv - */ -'use strict' - -var rgb = require('./rgb'); - -var yuv = module.exports = { - name: 'yuv', - min: [0,-0.5,-0.5], - max: [1, 0.5, 0.5], - channel: ['Y','U','V'], - alias: ['YUV', 'EBU'], - -}; - -yuv.rgb = function(yuv) { - var y = yuv[0], - u = yuv[1], - v = yuv[2], - r, g, b; - - r = (y * 1) + (u * 0) + (v * 1.13983); - g = (y * 1) + (u * -0.39465) + (v * -0.58060); - b = (y * 1) + (u * 2.02311) + (v * 0); - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -} - - -//extend rgb -rgb.yuv = function(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255; - - var y = (r * 0.299) + (g * 0.587) + (b * 0.114); - var u = (r * -0.14713) + (g * -0.28886) + (b * 0.436); - var v = (r * 0.615) + (g * -0.51499) + (b * -0.10001); - - return [y, u, v]; -}; diff --git a/node_modules/cookie/HISTORY.md b/node_modules/cookie/HISTORY.md deleted file mode 100644 index 5bd6485..0000000 --- a/node_modules/cookie/HISTORY.md +++ /dev/null @@ -1,118 +0,0 @@ -0.3.1 / 2016-05-26 -================== - - * Fix `sameSite: true` to work with draft-7 clients - - `true` now sends `SameSite=Strict` instead of `SameSite` - -0.3.0 / 2016-05-26 -================== - - * Add `sameSite` option - - Replaces `firstPartyOnly` option, never implemented by browsers - * Improve error message when `encode` is not a function - * Improve error message when `expires` is not a `Date` - -0.2.4 / 2016-05-20 -================== - - * perf: enable strict mode - * perf: use for loop in parse - * perf: use string concatination for serialization - -0.2.3 / 2015-10-25 -================== - - * Fix cookie `Max-Age` to never be a floating point number - -0.2.2 / 2015-09-17 -================== - - * Fix regression when setting empty cookie value - - Ease the new restriction, which is just basic header-level validation - * Fix typo in invalid value errors - -0.2.1 / 2015-09-17 -================== - - * Throw on invalid values provided to `serialize` - - Ensures the resulting string is a valid HTTP header value - -0.2.0 / 2015-08-13 -================== - - * Add `firstPartyOnly` option - * Throw better error for invalid argument to parse - * perf: hoist regular expression - -0.1.5 / 2015-09-17 -================== - - * Fix regression when setting empty cookie value - - Ease the new restriction, which is just basic header-level validation - * Fix typo in invalid value errors - -0.1.4 / 2015-09-17 -================== - - * Throw better error for invalid argument to parse - * Throw on invalid values provided to `serialize` - - Ensures the resulting string is a valid HTTP header value - -0.1.3 / 2015-05-19 -================== - - * Reduce the scope of try-catch deopt - * Remove argument reassignments - -0.1.2 / 2014-04-16 -================== - - * Remove unnecessary files from npm package - -0.1.1 / 2014-02-23 -================== - - * Fix bad parse when cookie value contained a comma - * Fix support for `maxAge` of `0` - -0.1.0 / 2013-05-01 -================== - - * Add `decode` option - * Add `encode` option - -0.0.6 / 2013-04-08 -================== - - * Ignore cookie parts missing `=` - -0.0.5 / 2012-10-29 -================== - - * Return raw cookie value if value unescape errors - -0.0.4 / 2012-06-21 -================== - - * Use encode/decodeURIComponent for cookie encoding/decoding - - Improve server/client interoperability - -0.0.3 / 2012-06-06 -================== - - * Only escape special characters per the cookie RFC - -0.0.2 / 2012-06-01 -================== - - * Fix `maxAge` option to not throw error - -0.0.1 / 2012-05-28 -================== - - * Add more tests - -0.0.0 / 2012-05-28 -================== - - * Initial release diff --git a/node_modules/cookie/LICENSE b/node_modules/cookie/LICENSE deleted file mode 100644 index 058b6b4..0000000 --- a/node_modules/cookie/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2012-2014 Roman Shtylman -Copyright (c) 2015 Douglas Christopher Wilson - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/node_modules/cookie/README.md b/node_modules/cookie/README.md deleted file mode 100644 index db0d078..0000000 --- a/node_modules/cookie/README.md +++ /dev/null @@ -1,220 +0,0 @@ -# cookie - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Basic HTTP cookie parser and serializer for HTTP servers. - -## Installation - -```sh -$ npm install cookie -``` - -## API - -```js -var cookie = require('cookie'); -``` - -### cookie.parse(str, options) - -Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs. -The `str` argument is the string representing a `Cookie` header value and `options` is an -optional object containing additional parsing options. - -```js -var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2'); -// { foo: 'bar', equation: 'E=mc^2' } -``` - -#### Options - -`cookie.parse` accepts these properties in the options object. - -##### decode - -Specifies a function that will be used to decode a cookie's value. Since the value of a cookie -has a limited character set (and must be a simple string), this function can be used to decode -a previously-encoded cookie value into a JavaScript string or other object. - -The default function is the global `decodeURIComponent`, which will decode any URL-encoded -sequences into their byte representations. - -**note** if an error is thrown from this function, the original, non-decoded cookie value will -be returned as the cookie's value. - -### cookie.serialize(name, value, options) - -Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the -name for the cookie, the `value` argument is the value to set the cookie to, and the `options` -argument is an optional object containing additional serialization options. - -```js -var setCookie = cookie.serialize('foo', 'bar'); -// foo=bar -``` - -#### Options - -`cookie.serialize` accepts these properties in the options object. - -##### domain - -Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6266-5.2.3]. By default, no -domain is set, and most clients will consider the cookie to apply to only the current domain. - -##### encode - -Specifies a function that will be used to encode a cookie's value. Since value of a cookie -has a limited character set (and must be a simple string), this function can be used to encode -a value into a string suited for a cookie's value. - -The default function is the global `ecodeURIComponent`, which will encode a JavaScript string -into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range. - -##### expires - -Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6266-5.2.1]. -By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and -will delete it on a condition like exiting a web browser application. - -**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and -`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this, -so if both are set, they should point to the same date and time. - -##### httpOnly - -Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6266-5.2.6]. When truthy, -the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set. - -**note** be careful when setting this to `true`, as compliant clients will not allow client-side -JavaScript to see the cookie in `document.cookie`. - -##### maxAge - -Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6266-5.2.2]. -The given number will be converted to an integer by rounding down. By default, no maximum age is set. - -**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and -`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this, -so if both are set, they should point to the same date and time. - -##### path - -Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6266-5.2.4]. By default, the path -is considered the ["default path"][rfc-6266-5.1.4]. By default, no maximum age is set, and most -clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting -a web browser application. - -##### sameSite - -Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][draft-west-first-party-cookies-07]. - - - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement. - - `false` will not set the `SameSite` attribute. - - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement. - - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement. - -More information about the different enforcement levels can be found in the specification -https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.1 - -**note** This is an attribute that has not yet been fully standardized, and may change in the future. -This also means many clients may ignore this attribute until they understand it. - -##### secure - -Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6266-5.2.5]. When truthy, -the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set. - -**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to -the server in the future if the browser does not have an HTTPS connection. - -## Example - -The following example uses this module in conjunction with the Node.js core HTTP server -to prompt a user for their name and display it back on future visits. - -```js -var cookie = require('cookie'); -var escapeHtml = require('escape-html'); -var http = require('http'); -var url = require('url'); - -function onRequest(req, res) { - // Parse the query string - var query = url.parse(req.url, true, true).query; - - if (query && query.name) { - // Set a new cookie with the name - res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), { - httpOnly: true, - maxAge: 60 * 60 * 24 * 7 // 1 week - })); - - // Redirect back after setting cookie - res.statusCode = 302; - res.setHeader('Location', req.headers.referer || '/'); - res.end(); - return; - } - - // Parse the cookies on the request - var cookies = cookie.parse(req.headers.cookie || ''); - - // Get the visitor name set in the cookie - var name = cookies.name; - - res.setHeader('Content-Type', 'text/html; charset=UTF-8'); - - if (name) { - res.write('

Welcome back, ' + escapeHtml(name) + '!

'); - } else { - res.write('

Hello, new visitor!

'); - } - - res.write('
'); - res.write(' '); - res.end(' values - * - * @param {string} str - * @param {object} [options] - * @return {object} - * @public - */ - -function parse(str, options) { - if (typeof str !== 'string') { - throw new TypeError('argument str must be a string'); - } - - var obj = {} - var opt = options || {}; - var pairs = str.split(pairSplitRegExp); - var dec = opt.decode || decode; - - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i]; - var eq_idx = pair.indexOf('='); - - // skip things that don't look like key=value - if (eq_idx < 0) { - continue; - } - - var key = pair.substr(0, eq_idx).trim() - var val = pair.substr(++eq_idx, pair.length).trim(); - - // quoted values - if ('"' == val[0]) { - val = val.slice(1, -1); - } - - // only assign once - if (undefined == obj[key]) { - obj[key] = tryDecode(val, dec); - } - } - - return obj; -} - -/** - * Serialize data into a cookie header. - * - * Serialize the a name value pair into a cookie string suitable for - * http headers. An optional options object specified cookie parameters. - * - * serialize('foo', 'bar', { httpOnly: true }) - * => "foo=bar; httpOnly" - * - * @param {string} name - * @param {string} val - * @param {object} [options] - * @return {string} - * @public - */ - -function serialize(name, val, options) { - var opt = options || {}; - var enc = opt.encode || encode; - - if (typeof enc !== 'function') { - throw new TypeError('option encode is invalid'); - } - - if (!fieldContentRegExp.test(name)) { - throw new TypeError('argument name is invalid'); - } - - var value = enc(val); - - if (value && !fieldContentRegExp.test(value)) { - throw new TypeError('argument val is invalid'); - } - - var str = name + '=' + value; - - if (null != opt.maxAge) { - var maxAge = opt.maxAge - 0; - if (isNaN(maxAge)) throw new Error('maxAge should be a Number'); - str += '; Max-Age=' + Math.floor(maxAge); - } - - if (opt.domain) { - if (!fieldContentRegExp.test(opt.domain)) { - throw new TypeError('option domain is invalid'); - } - - str += '; Domain=' + opt.domain; - } - - if (opt.path) { - if (!fieldContentRegExp.test(opt.path)) { - throw new TypeError('option path is invalid'); - } - - str += '; Path=' + opt.path; - } - - if (opt.expires) { - if (typeof opt.expires.toUTCString !== 'function') { - throw new TypeError('option expires is invalid'); - } - - str += '; Expires=' + opt.expires.toUTCString(); - } - - if (opt.httpOnly) { - str += '; HttpOnly'; - } - - if (opt.secure) { - str += '; Secure'; - } - - if (opt.sameSite) { - var sameSite = typeof opt.sameSite === 'string' - ? opt.sameSite.toLowerCase() : opt.sameSite; - - switch (sameSite) { - case true: - str += '; SameSite=Strict'; - break; - case 'lax': - str += '; SameSite=Lax'; - break; - case 'strict': - str += '; SameSite=Strict'; - break; - default: - throw new TypeError('option sameSite is invalid'); - } - } - - return str; -} - -/** - * Try decoding a string using a decoding function. - * - * @param {string} str - * @param {function} decode - * @private - */ - -function tryDecode(str, decode) { - try { - return decode(str); - } catch (e) { - return str; - } -} diff --git a/node_modules/cookie/package.json b/node_modules/cookie/package.json deleted file mode 100644 index 30c355e..0000000 --- a/node_modules/cookie/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "_from": "cookie@0.3.1", - "_id": "cookie@0.3.1", - "_inBundle": false, - "_integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=", - "_location": "/cookie", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "cookie@0.3.1", - "name": "cookie", - "escapedName": "cookie", - "rawSpec": "0.3.1", - "saveSpec": null, - "fetchSpec": "0.3.1" - }, - "_requiredBy": [ - "/raven" - ], - "_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "_shasum": "e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb", - "_spec": "cookie@0.3.1", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\raven", - "author": { - "name": "Roman Shtylman", - "email": "shtylman@gmail.com" - }, - "bugs": { - "url": "https://github.com/jshttp/cookie/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "deprecated": false, - "description": "HTTP server cookie parsing and serialization", - "devDependencies": { - "istanbul": "0.4.3", - "mocha": "1.21.5" - }, - "engines": { - "node": ">= 0.6" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "README.md", - "index.js" - ], - "homepage": "https://github.com/jshttp/cookie#readme", - "keywords": [ - "cookie", - "cookies" - ], - "license": "MIT", - "name": "cookie", - "repository": { - "type": "git", - "url": "git+https://github.com/jshttp/cookie.git" - }, - "scripts": { - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" - }, - "version": "0.3.1" -} diff --git a/node_modules/homey-log/CONTRIBUTING.md b/node_modules/homey-log/CONTRIBUTING.md deleted file mode 100644 index 1319dd9..0000000 --- a/node_modules/homey-log/CONTRIBUTING.md +++ /dev/null @@ -1,53 +0,0 @@ -# Contributing to Athom and Homey - -First off all, thank you for taking the time to contribute! - -The following is a set of guidelines for contributing to Athom and its packages, which are hosted in the [Athom Organization](https://github.com/athombv) on GitHub. These are just guidelines, not rules. Use your best judgment, and feel free to contact us if you have any questions. - -Please join our [community slack](https://slack.athom.com), if you have not done so already. -We also have a [forum](https://forum.athom.com) for general discussions. - - -## Before submitting a bug or feature request - -* **Have you actually read the error message**? -* Have you searched for similar issues? -* Have you updated homey, all apps, and the development tools (if applicable)? -* Have you checked that it's not a problem with one of the apps you're using, rather than Homey itself? -* Have you looked at what's involved in fixing/implementing this? - -Capable programmers should always attempt to investigate and fix problems themselves before asking for others to help. Submit a pull request instead of an issue! - -Regular support is provided through our [support staff](support@athom.com). - -## A great bug report contains - -* Context – what were you trying to achieve? -* Detailed steps to reproduce the error from scratch. Try isolating the minimal amount of code needed to reproduce the error. -* Any applicable log files or ID's. -* Evidence you've looked into solving the problem and ideally, a theory on the cause and a possible solution. - -## A great feature request contains - -* The current situation. -* How and why the current situation is problematic. -* A detailed proposal or pull request that demonstrates how the problem could be solved. -* A use case – who needs this feature and why? -* Any caveats. - -## A great pull request contains - -* Minimal changes. Only submit code relevant to the current issue. Other changes should go in new pull requests. -* Minimal commits. Please squash to a single commit before sending your pull request. -* No conflicts. Please rebase off the latest master before submitting. -* Code conforming to the existing conventions and formats. i.e. Please don't reformat whitespace. -* Passing tests in the test folder (if applicable). Use existing tests as a reference. -* Relevant documentation. - -## Speeding up your pull request -Merging pull requests takes time. While we always try to merge your pull request as soon as possible, there are certain things you can do to speed up this process. - -* Ask developers to review your code changes and post their feedback. -* Ask users to test your changes and post their feedback. -* Keep your changes to the minimal required amount, and dedicated to one issue/feature only. -* If your PR introduces new features or more than just a small fix, please sign our [Contributor License Agreement](https://go.athom.com/cla). diff --git a/node_modules/homey-log/LICENSE b/node_modules/homey-log/LICENSE deleted file mode 100644 index 9cecc1d..0000000 --- a/node_modules/homey-log/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - {project} Copyright (C) {year} {fullname} - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/node_modules/homey-log/README.md b/node_modules/homey-log/README.md deleted file mode 100644 index 0194c2d..0000000 --- a/node_modules/homey-log/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# homey-log - -This module can be plugged into a Homey app to send logs to [Sentry](http://sentry.io/). - -## Installation - -``` -npm install homey-log -``` - -## Usage - -In your `env.json`, add your Sentry URL: - -```javascript -{ - "HOMEY_LOG_URL": "https://foo:bar@sentry.io/123456" -} -``` - -In your app.js, include the library: - -```javascript -const Log = require('homey-log').Log; -... -throw new Error("Whoops"); -``` - -### Notes - -* When your app crashes due to an uncaughtException, this will automatically be sent to Sentry. -* As of Homey v1.0.3, when running your app using `athom project --run`, logging is disabled. - -### Methods - -#### Log.init( String url ); -Set the URL manually, when not provided using your `env.json`. Not recommended due to security! - -#### Log.setTags( Object tags ); -Set a custom object of 'tags'. Tags that are already set are `appId`, `appVersion` and `homeyVersion` - -#### Log.setExtra( Object extra ); -Set a custom object of 'extra' parameters - -#### Log.setUser( Object user ); -Set a custom object of 'user' data - do not include sensitive data! - -#### Log.captureMessage( String message ) -Send a message to Sentry - -#### Log.captureException( Error err ) -Send an Error object to Sentry diff --git a/node_modules/homey-log/index.js b/node_modules/homey-log/index.js deleted file mode 100644 index d948f55..0000000 --- a/node_modules/homey-log/index.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports.Log = require('./lib/Log.js'); \ No newline at end of file diff --git a/node_modules/homey-log/lib/Log.js b/node_modules/homey-log/lib/Log.js deleted file mode 100644 index 964376b..0000000 --- a/node_modules/homey-log/lib/Log.js +++ /dev/null @@ -1,155 +0,0 @@ -'use strict'; - -const raven = require('raven'); - -class Log { - - constructor() { - - this._capturedExceptions = []; - this._capturedMessages = []; - - if( typeof global.Homey === 'undefined' ) { - try { - this._homey = require('homey'); - } catch( err ) { - console.error(err) - return console.error('Error: Homey not found'); - } - } else { - this._homey = global.Homey; - } - - if( typeof this._homey === 'undefined' ) - return console.error('Error: Homey not found'); - - if( typeof this._homey.env.HOMEY_LOG_URL === 'string' ) { - this.init( this._homey.env.HOMEY_LOG_URL ); - } - - } - - _log() { - console.log.bind( null, Log.logTime(), '[homey-log]' ).apply( null, arguments ); - } - - init( url, opts ) { - - if( process.env.DEBUG === '1' && this._homey.env.HOMEY_LOG_FORCE !== '1' ) - return this._log('App is running in debug mode, disabling log'); - - this._client = new raven.Client( url, opts ); - - this._client.patchGlobal(); - - this.setTags({ - appId : this._homey.manifest.id, - appVersion : this._homey.manifest.version, - homeyVersion : this._homey.version - }); - - if (this._homey.hasOwnProperty('ManagerCloud')) { // SDKv2 - this._homey.ManagerCloud.getHomeyId(this.setHomeyIdTag.bind(this)) - } else if (this._homey.hasOwnProperty('manager')) { // SDKv1 - this._homey.manager('cloud').getHomeyId(this.setHomeyIdTag.bind(this)) - } - - this._log(`App ${this._homey.manifest.id} v${this._homey.manifest.version} logging...`); - - return this; - - } - - setHomeyIdTag(err, result) { - if (!err && typeof result === 'string') { - this.setTags({ homeyId: result }) - } - } - - setTags( tags ) { - if( this._client ) { - this._client.setTagsContext(tags); - } - - return this; - } - - setExtra( extra ) { - if( this._client ) { - this._client.setExtraContext(extra); - } - - return this; - } - - setUser( user ) { - if( this._client ) { - this._client.setUserContext(user); - } - - return this; - } - - captureMessage( message, options, callback) { - this._log('captureMessage:', message); - - if( this._capturedMessages.indexOf( message ) > -1 ) { - this._log('Prevented sending a duplicate message'); - return this; - } - - this._capturedMessages.push( message ) - - if( this._client ) { - this._client.captureMessage( - message, - options && options.constructor.name === 'Object' ? Object.assign({}, options) : options, - callback - ); - } - - return this; - } - - captureException( err, options, callback) { - this._log('captureException:', err); - - if( this._capturedExceptions.indexOf( err ) > -1 ) { - this._log('Prevented sending a duplicate log'); - return this; - } - - this._capturedExceptions.push( err ) - - if( this._client ) { - this._client.captureException( - err, - options && options.constructor.name === 'Object' ? Object.assign({}, options) : options, - callback - ); - } - - return this; - } - - static logTime() { - - let date = new Date(); - - let mm = date.getMonth()+1; - mm = (mm<10?"0"+mm:mm); - let dd = date.getDate(); - dd = (dd<10?"0"+dd:dd); - let hh = date.getHours(); - hh = (hh<10?"0"+hh:hh); - let min = date.getMinutes(); - min = (min<10?"0"+min:min); - let sec = date.getSeconds(); - sec = (sec<10?"0"+sec:sec); - - return `${date.getFullYear()}-${mm}-${dd} ${hh}:${min}:${sec}`; - } - -} - -module.exports = new Log(); diff --git a/node_modules/homey-log/package.json b/node_modules/homey-log/package.json deleted file mode 100644 index 2e51f8f..0000000 --- a/node_modules/homey-log/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_from": "homey-log@^1.0.1", - "_id": "homey-log@1.0.6", - "_inBundle": false, - "_integrity": "sha512-LFOaByu/E2krWNSGwmoazL4HCSSyLVQMoaBo9mgMxV2YC4lEB15SMov1bqZxUclEJCbnR+YUX9xsnFW5brmIbw==", - "_location": "/homey-log", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "homey-log@^1.0.1", - "name": "homey-log", - "escapedName": "homey-log", - "rawSpec": "^1.0.1", - "saveSpec": null, - "fetchSpec": "^1.0.1" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/homey-log/-/homey-log-1.0.6.tgz", - "_shasum": "228e5b126b7dd68e5485b0d41f9fef2d7a46024f", - "_spec": "homey-log@^1.0.1", - "_where": "D:\\Projects\\Homey\\com.sensative", - "author": "", - "bugs": { - "url": "https://github.com/athombv/node-homey-log/issues" - }, - "bundleDependencies": false, - "config": { - "npmPublishTagProduction": "latest", - "npmPublishTagStaging": "beta" - }, - "dependencies": { - "raven": "^0.12.3" - }, - "deprecated": false, - "description": "This module can be plugged into a Homey app to send logs to [Sentry](http://sentry.io/).", - "homepage": "https://github.com/athombv/node-homey-log#readme", - "license": "ISC", - "main": "index.js", - "name": "homey-log", - "repository": { - "type": "git", - "url": "git+https://WeeJewel@github.com/athombv/node-homey-log.git" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "1.0.6" -} diff --git a/node_modules/homey-meshdriver/.editorconfig b/node_modules/homey-meshdriver/.editorconfig deleted file mode 100644 index 12abeb0..0000000 --- a/node_modules/homey-meshdriver/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -# top-most EditorConfig file -root = true - -# Unix-style newlines with a newline ending every file -[*] -end_of_line = lf -indent_style = space -indent_size = 2 -trim_trailing_whitespace = true \ No newline at end of file diff --git a/node_modules/homey-meshdriver/Gruntfile.js b/node_modules/homey-meshdriver/Gruntfile.js deleted file mode 100644 index f08be9c..0000000 --- a/node_modules/homey-meshdriver/Gruntfile.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = function (grunt) { - grunt.initConfig({ - jsdoc: { - dist: { - src: ['lib/**/*.js'], options: { - configure: 'jsdoc.json', destination: 'docs', - }, - }, - }, - watch: { - scripts: { - files: ['lib/**/*.js'], - tasks: ['jsdoc'], - options: { - spawn: false, - }, - }, - }, - }); - grunt.loadNpmTasks('grunt-jsdoc'); - grunt.loadNpmTasks('grunt-contrib-watch'); -}; diff --git a/node_modules/homey-meshdriver/README.md b/node_modules/homey-meshdriver/README.md deleted file mode 100644 index 2ddb766..0000000 --- a/node_modules/homey-meshdriver/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# homey-meshdriver - -## Introduction -This module is used to make the creation of Z-Wave & ZigBee apps easier. - -It is essentially a map-tool from Homey-capabilities to Z-Wave Command Classes or ZigBee endpoints. - -## Installation - -```bash -$ npm install homey-meshdriver -``` - -## Usage - -### Z-Wave -See [examples/fibaroplug.js](examples/fibaroplug.js) and [examples/fibaroplug.json](examples/fibaroplug.json) - -### Zigbee -See [examples/tradfriBulb.js](examples/tradfriBulb.js) and [examples/tradfriBulb.json](examples/tradfriBulb.json) - - -## Docs -See [https://athombv.github.io/node-homey-meshdriver](https://athombv.github.io/node-homey-meshdriver) diff --git a/node_modules/homey-meshdriver/assets/driver/zigbee/device.js b/node_modules/homey-meshdriver/assets/driver/zigbee/device.js deleted file mode 100644 index 7b2a03d..0000000 --- a/node_modules/homey-meshdriver/assets/driver/zigbee/device.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -const { ZigBeeDevice } = require('homey-meshdriver'); - -class MyZigBeeDevice extends ZigBeeDevice { - - onMeshInit() { - this.log('MyZigBeeDevice has been inited'); - } - -} - -module.exports = MyZigBeeDevice; diff --git a/node_modules/homey-meshdriver/assets/driver/zwave/device.js b/node_modules/homey-meshdriver/assets/driver/zwave/device.js deleted file mode 100644 index ed2104d..0000000 --- a/node_modules/homey-meshdriver/assets/driver/zwave/device.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -const { ZwaveDevice } = require('homey-meshdriver'); - -class MyZWaveDevice extends ZwaveDevice { - - onMeshInit() { - this.log('MyZWaveDevice has been inited'); - } - -} - -module.exports = MyZWaveDevice; diff --git a/node_modules/homey-meshdriver/examples/fibaroplug.js b/node_modules/homey-meshdriver/examples/fibaroplug.js deleted file mode 100644 index 746969c..0000000 --- a/node_modules/homey-meshdriver/examples/fibaroplug.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -const ZwaveDevice = require('homey-meshdriver').ZwaveDevice; - -/** - * It is possible to use default system capability handlers (see: lib/zwave/system/capabilities), by registering a - * capability without an options object (see below). There are also various standard ZwaveDevice implementations (see: - * lib/zwave), some of them use settings and flow cards (which are optional) and can be found in - * lib/system/(flows|settings).json. - */ -class FibaroPlugDevice extends ZwaveDevice { - - async onMeshInit() { - - // enable debugging - this.enableDebug(); - - // print the node's info to the console - this.printNode(); - - // register the `measure_battery` capability with COMMAND_CLASS_BATTERY and with the - // default system capability handler (see: lib/zwave/system/capabilities) - this.registerCapability('measure_battery', 'BATTERY'); - - // register the `onoff` capability with COMMAND_CLASS_SWITCH_BINARY while overriding the default system - // capability handler - this.registerCapability('onoff', 'SWITCH_BINARY', { - getOpts: { - getOnStart: true, // get the initial value on app start (only use for non-battery devices) - pollInterval: 'poll_interval', // maps to device settings - // getOnOnline: true, // use only for battery devices - }, - getParserV3: (value, opts) => ({}), - }); - - // register a settings parser - this.registerSetting('always_on', value => new Buffer([(value === true) ? 0 : 1])); - - // register a report listener - this.registerReportListener('SWITCH_BINARY', 'SWITCH_BINARY_REPORT', (rawReport, parsedReport) => { - console.log('registerReportListener', rawReport, parsedReport); - }); - - // Set configuration value that is defined in manifest - await this.configurationSet({ id: 'motion_threshold' }, 10); - - // Or set configuration value that is not defined in manifest - await this.configurationSet({ index: 1, size: 2 }, 10); - } - - // Overwrite the default setting save message - customSaveMessage(oldSettings, newSettings, changedKeysArr) { - return { - en: 'Test message', - nl: 'Test bericht', - }; - } - - // Overwrite the onSettings method, and change the Promise result - onSettings(oldSettings, newSettings, changedKeysArr) { - return super.onSettings(oldSettings, newSettings, changedKeysArr) - .then(res => 'Success!') - .catch(err => 'Error!'); - } - -} - -module.exports = FibaroPlugDevice; diff --git a/node_modules/homey-meshdriver/examples/fibaroplug.json b/node_modules/homey-meshdriver/examples/fibaroplug.json deleted file mode 100644 index ffe447b..0000000 --- a/node_modules/homey-meshdriver/examples/fibaroplug.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "id": "fibaroplug", - "capabilities": [ "onoff" ], - "zwave": { - "manufacturerId": 271, - "productTypeId": 1536, - "productId": 4096, - "associationGroups": [ 1, 3 ] - }, - "settings": [ - - { - "id": "always_on", - "type": "checkbox", - "zwave": { - "index": 1, - "size": 1 - }, - "label": { - "en": "Always on", - "nl": "Altijd aan" - }, - "value": false, - "hint": { - "en": "Once activated, will keep a connected device constantly on, will stop reacting to alarm frames and B-button push", - "nl": "Wanneer geactiveerd zal de plug constant aan zijn, en niet meer reageren op de B-knop en alarm frames" - } - }, - - { - "id": "poll_interval", - "type": "number", - "label": { - "en": "Poll Interval" - }, - "value": 3000 - } - - ] -} \ No newline at end of file diff --git a/node_modules/homey-meshdriver/examples/tradfriBulb.js b/node_modules/homey-meshdriver/examples/tradfriBulb.js deleted file mode 100644 index 84cba45..0000000 --- a/node_modules/homey-meshdriver/examples/tradfriBulb.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -const ZigBeeDevice = require('homey-meshdriver').ZigBeeDevice; - -const maxBrightness = 255; - -class DimmableBulb extends ZigBeeDevice { - onMeshInit() { - - // Register onoff capability - this.registerCapability('onoff', 'genOnOff', { - set: value => value ? 'on' : 'off', - setParser: () => ({}), - get: 'onOff', - reportParser: value => value === 1, - }); - - // Register dim capability - this.registerCapability('dim', 'genLevelCtrl', { - set: 'moveToLevel', - setParser: value => ({ - level: value * maxBrightness, - transtime: this.getSetting('transtime'), - }), - get: 'currentLevel', - reportParser: value => value / maxBrightness, - }); - - // Not useful in this case, but using registerReportListener you can subscribe to incoming reports - this.registerReportListener('genLevelCtrl', 'move', report => { - console.log(report); - }); - - // Register attr report listener - this.registerAttrReportListener( - 'genPowerCfg', // Cluster - 'batteryPercentageRemaining', // Attr - 10, // Min report interval in seconds (must be greater than 1) - 60, // Max report interval in seconds (must be zero or greater than 60 and greater than min report interval) - 1, // Report change value, if value changed more than this value send a report - this.onPowerCfgBatteryPercentageRemainingReport.bind(this)) // Callback with value - .then(() => { - // Registering attr reporting succeeded - this.log('registered attr report listener'); - }) - .catch(err => { - // Registering attr reporting failed - this.error('failed to register attr report listener', err); - }); - } - - onPowerCfgBatteryPercentageRemainingReport(value) { - this.log('onPowerCfgBatteryPercentageRemainingReport', value); - } -} - -module.exports = DimmableBulb; - diff --git a/node_modules/homey-meshdriver/examples/tradfriBulb.json b/node_modules/homey-meshdriver/examples/tradfriBulb.json deleted file mode 100644 index 23ecc3e..0000000 --- a/node_modules/homey-meshdriver/examples/tradfriBulb.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "id": "dimmable_bulb", - "name": { - "en": "Dimmable Bulb", - "nl": "Dimbare Lamp" - }, - "class": "light", - "capabilities": [ - "onoff", - "dim" - ], - "zigbee": { - "manufacturerName": "IKEA of Sweden", - "productId": "TRADFRI bulb E27 opal 1000lm", - "deviceId": 256, - "profileId": 260, - "learnmode": { - "image": "/drivers/dimmable_bulb/assets/icon.svg", - "instruction": { - "en": "Turn the device on and off 6 times", - "nl": "Zet het apparaat 6 keer aan en uit" - } - } - }, - "images": { - "large": "/drivers/dimmable_bulb/assets/images/large.png", - "small": "/drivers/dimmable_bulb/assets/images/small.png" - }, - "settings": [ - { - "id": "transtime", - "type": "number", - "label": { - "nl": "Transitie tijd in seconden", - "en": "Transition time in seconds" - }, - "value": 1, - "attr": { - "min": 0, - "max": 20 - } - } - ] -} \ No newline at end of file diff --git a/node_modules/homey-meshdriver/index.js b/node_modules/homey-meshdriver/index.js deleted file mode 100644 index 0b08377..0000000 --- a/node_modules/homey-meshdriver/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -module.exports.Util = require('./lib/util'); - -module.exports.ZwaveDevice = require('./lib/zwave/ZwaveDevice.js'); -module.exports.ZwaveLockDevice = require('./lib/zwave/ZwaveLockDevice.js'); -module.exports.ZwaveMeteringDevice = require('./lib/zwave/ZwaveMeteringDevice.js'); -module.exports.ZwaveLightDevice = require('./lib/zwave/ZwaveLightDevice.js'); - -module.exports.ZigBeeDevice = require('./lib/zigbee/ZigBeeDevice.js'); -module.exports.ZigBeeLightDevice = require('./lib/zigbee/ZigBeeLightDevice.js'); -module.exports.ZigBeeXYLightDevice = require('./lib/zigbee/ZigBeeXYLightDevice.js'); diff --git a/node_modules/homey-meshdriver/jsdoc.json b/node_modules/homey-meshdriver/jsdoc.json deleted file mode 100644 index 8dc0665..0000000 --- a/node_modules/homey-meshdriver/jsdoc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "plugins": [ - "plugins/markdown" - ], - "templates": { - "default": { - "outputSourceFiles": false - } - } -} \ No newline at end of file diff --git a/node_modules/homey-meshdriver/lib/MeshDevice.js b/node_modules/homey-meshdriver/lib/MeshDevice.js deleted file mode 100644 index e38bdde..0000000 --- a/node_modules/homey-meshdriver/lib/MeshDevice.js +++ /dev/null @@ -1,99 +0,0 @@ -'use strict'; - -const Homey = require('homey'); - -const i18n = { - error: { - unknown: { - en: 'Unknown error', - nl: 'Onbekend probleem', - }, - invalid_ieeeaddr: { - en: 'Device not found in network', - nl: 'Apparaat niet gevonden in netwerk', - }, - }, -}; - -/** - */ -class MeshDevice extends Homey.Device { - - /** - * @private - */ - onInit(protocolId) { - super.onInit(); - - this._protocolId = protocolId; - this._debugEnabled = false; - this._pollIntervals = {}; - - if (this._protocolId === 'zwave') { this._manager = Homey.ManagerZwave; } - - if (this._protocolId === 'zigbee') { this._manager = Homey.ManagerZigBee; } - - this._manager.getNode(this) - .then(node => { - this.node = node; - - process.nextTick(() => { - this.emit('__meshInit'); - }); - }) - .catch(err => { - this.error(err); - - if (err && err.message) { - this.setUnavailable(this.__(i18n.error[err.message] || i18n.error.unknown)); - } else { - this.setUnavailable(err || this.__(i18n.error.unknown)); - } - }); - } - - __(obj) { - const language = Homey.ManagerI18n.getLanguage(); - return obj[language] || obj.en || obj.toString(); - } - - _debug() { - if (this._debugEnabled) { - this.log.bind(this, '[dbg]').apply(this, arguments); - } - } - - /** - * Enable debugging to the console - */ - enableDebug() { - this._debugEnabled = true; - } - - /** - * Disable debugging to the console - */ - disableDebug() { - this._debugEnabled = false; - } - - /** - * Remove all listeners and intervals from node - */ - onDeleted() { - - // Remove listeners on node - if (this.node) this.node.removeAllListeners(); - - // Clear all pollIntervals - if (this._pollIntervals) { // Sometimes it is null/undefined for some reason - Object.keys(this._pollIntervals).forEach(capabilityId => { - Object.values(this._pollIntervals[capabilityId]).forEach(interval => { - clearInterval(interval); - }); - }); - } - } -} - -module.exports = MeshDevice; diff --git a/node_modules/homey-meshdriver/lib/util/color.js b/node_modules/homey-meshdriver/lib/util/color.js deleted file mode 100644 index ab2a0cc..0000000 --- a/node_modules/homey-meshdriver/lib/util/color.js +++ /dev/null @@ -1,246 +0,0 @@ -'use strict'; - -const space = require('color-space'); - -/** - * @typedef {Object} RGB - * @property {number} red - Red value, range 0 - 255. - * @property {number} green - Green value, range 0 - 255. - * @property {number} blue - Blue value, range 0 - 255. - */ - -/** - * @typedef {Object} CIE - * @property {number} x - CIE x (small x) value, range 0 - 0.8 (for ZigBee X multiply by 65279) - * @property {number} y - CIE y (small y) value, range 0 - 0.9 (for ZigBee Y multiply by 65279) - */ - -/** - * @typedef {Object} HSV - * @property {number} hue - Hue value, range 0 - 1. - * @property {number} saturation - Saturation value, range 0 - 1. - * @property {number} value - Value (brightness) value, range 0 - 1. - */ - -/** - * Method that converts colors from the RGB color space to the CIE (1931) color space (the latter is used by some - * ZigBee clusters). - * @param {RGB} - RGB color object - * @returns {CIE|Error} - CIE color space object - * @memberof Util - */ -function convertRGBToCIE({ red, green, blue }) { - if (typeof red !== 'number') red = 0; - if (typeof green !== 'number') green = 0; - if (typeof blue !== 'number') blue = 0; - - const result = rgb_to_cie(red, green, blue); - try { - const x = Number(result[0]); - const y = Number(result[1]); - return { x, y }; - } catch (err) { - return new Error('failed_to_parse_xy_value_to_number'); - } -} - -/** - * Method that converts colors from the HSV (or HSL) color space to the CIE (1931) color space (the latter is used by - * some ZigBee clusters). - * @param {HSV} - HSV color object - * @returns {CIE} - CIE color space object - * @memberof Util - */ -function convertHSVToCIE({ hue, saturation, value }) { - if (typeof hue !== 'number') hue = 1; - if (typeof saturation !== 'number') saturation = 1; - if (typeof value !== 'number') value = 1; - - const { red, green, blue } = convertHSVToRGB({ hue, saturation, value }); - return convertRGBToCIE({ red, green, blue }); -} - -/** - * Method that converts colors from the HSV (or HSL) color space to the RGB color space. - * @param {HSV} - HSV color object - * @returns {RGB} - RGB color object - * @memberof Util - */ -function convertHSVToRGB({ hue, saturation, value }) { - if (typeof hue !== 'number') hue = 1; - if (typeof saturation !== 'number') saturation = 1; - if (typeof value !== 'number') value = 1; - - const [red, green, blue] = space.hsv.rgb([ - hue * 360, - saturation * 100, - value * 100, - ]); - return { red, green, blue }; -} - -/** - * Method that converts colors from the RGB color space to the HSV color space. - * @param {RGB} - RGB color object - * @returns {HSV} - HSV color object - * @memberof Util - */ -function convertRGBToHSV({ red, green, blue }) { - if (typeof red !== 'number') red = 0; - if (typeof green !== 'number') green = 0; - if (typeof blue !== 'number') blue = 0; - - let [hue, saturation, value] = space.rgb.hsv([ - red, - green, - blue, - ]); - - // Convert to 0 - 1 range - hue = hue / 360; - saturation = saturation / 100; - value = value / 100; - - return { hue, saturation, value }; -} - -module.exports = { - convertRGBToCIE, - convertHSVToCIE, - convertHSVToRGB, - convertRGBToHSV, -}; - -/* -With these functions you can convert the CIE color space to the RGB color space and vice versa. - -The developer documentation for Philips Hue provides the formulas used in the code below: -https://developers.meethue.com/documentation/color-conversions-rgb-xy - -I've used the formulas and Objective-C example code and transfered it to JavaScript. - - -Examples: - -var rgb = cie_to_rgb(0.6611, 0.2936) -var cie = rgb_to_cie(255, 39, 60) - ------------------------------------------------------------------------------------- - -The MIT License (MIT) - -Copyright (c) 2017 www.usolved.net -Published under https://github.com/usolved/cie-rgb-converter - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -/** - * Converts CIE color space to RGB color space - * @param {Number} x - * @param {Number} y - * @param {Number} brightness - Ranges from 1 to 254 - * @return {Array} Array that contains the color values for red, green and blue - * @ignore - */ -function cie_to_rgb(x, y, brightness) { - // Set to maximum brightness if no custom value was given (Not the slick ECMAScript 6 way for compatibility reasons) - if (brightness === undefined) { - brightness = 254; - } - - const z = 1.0 - x - y; - const Y = (brightness / 254).toFixed(2); - const X = (Y / y) * x; - const Z = (Y / y) * z; - - // Convert to RGB using Wide RGB D65 conversion - let red = X * 1.656492 - Y * 0.354851 - Z * 0.255038; - let green = -X * 0.707196 + Y * 1.655397 + Z * 0.036152; - let blue = X * 0.051713 - Y * 0.121364 + Z * 1.011530; - - // If red, green or blue is larger than 1.0 set it back to the maximum of 1.0 - if (red > blue && red > green && red > 1.0) { - - green = green / red; - blue = blue / red; - red = 1.0; - } else if (green > blue && green > red && green > 1.0) { - - red = red / green; - blue = blue / green; - green = 1.0; - } else if (blue > red && blue > green && blue > 1.0) { - - red = red / blue; - green = green / blue; - blue = 1.0; - } - - // Reverse gamma correction - red = red <= 0.0031308 ? 12.92 * red : (1.0 + 0.055) * Math.pow(red, (1.0 / 2.4)) - 0.055; - green = green <= 0.0031308 ? 12.92 * green : (1.0 + 0.055) * Math.pow(green, (1.0 / 2.4)) - 0.055; - blue = blue <= 0.0031308 ? 12.92 * blue : (1.0 + 0.055) * Math.pow(blue, (1.0 / 2.4)) - 0.055; - - - // Convert normalized decimal to decimal - red = Math.min(Math.max(Math.round(red * 255), 0), 255); - green = Math.min(Math.max(Math.round(green * 255), 0), 255); - blue = Math.min(Math.max(Math.round(blue * 255), 0), 255); - - if (isNaN(red)) { red = 0; } - - if (isNaN(green)) { green = 0; } - - if (isNaN(blue)) { blue = 0; } - - return [red, green, blue]; -} - - -/** - * Converts RGB color space to CIE color space - * @param {Number} red - * @param {Number} green - * @param {Number} blue - * @return {Array} Array that contains the CIE color values for x and y - * @ignore - */ -function rgb_to_cie(red, green, blue) { - // Apply a gamma correction to the RGB values, which makes the color more vivid and more the like the color displayed on the screen of your device - var red = (red > 0.04045) ? Math.pow((red + 0.055) / (1.0 + 0.055), 2.4) : (red / 12.92); - var green = (green > 0.04045) ? Math.pow((green + 0.055) / (1.0 + 0.055), 2.4) : (green / 12.92); - var blue = (blue > 0.04045) ? Math.pow((blue + 0.055) / (1.0 + 0.055), 2.4) : (blue / 12.92); - - // RGB values to XYZ using the Wide RGB D65 conversion formula - const X = red * 0.664511 + green * 0.154324 + blue * 0.162028; - const Y = red * 0.283881 + green * 0.668433 + blue * 0.047685; - const Z = red * 0.000088 + green * 0.072310 + blue * 0.986039; - - // Calculate the xy values from the XYZ values - let x = (X / (X + Y + Z)).toFixed(4); - let y = (Y / (X + Y + Z)).toFixed(4); - - if (isNaN(x)) { x = 0; } - - if (isNaN(y)) { y = 0; } - - - return [x, y]; -} diff --git a/node_modules/homey-meshdriver/lib/util/index.js b/node_modules/homey-meshdriver/lib/util/index.js deleted file mode 100644 index f6117ba..0000000 --- a/node_modules/homey-meshdriver/lib/util/index.js +++ /dev/null @@ -1,80 +0,0 @@ -'use strict'; - -const color = require('./color'); - -/** - * Map a range of values to a different range of values. - * @param inputStart - * @param inputEnd - * @param outputStart - * @param outputEnd - * @param input - * @returns {number} - * @memberof Util - */ -function mapValueRange(inputStart, inputEnd, outputStart, outputEnd, input) { - if (typeof inputStart !== 'number' || typeof inputEnd !== 'number' || - typeof outputStart !== 'number' || typeof outputEnd !== 'number' || - typeof input !== 'number') { - return null; - } - return outputStart + ((outputEnd - outputStart) / (inputEnd - inputStart)) * (Math.min(Math.max(inputStart, input), inputEnd) - inputStart); -} - -/** - * Calculate a duration value for SWITCH_MULTILEVEL and SWITCH_BINARY from an input value in milliseconds. Below 127 - * the value is in seconds, above the value is in minutes. Hence, above 127 some rounding might occur. If a value larger - * than 7560 is entered it will be maxed at 254 (longest duration possible). - * @param {number} duration - Dim duration in milliseconds (0 - 7560000ms) - * @returns {number} Range 0 - 254 (short to long) - * 1-127 = 1 second – 127 seconds - * 128 – 253 = 1 minute – 126 minutes - * 254 max - */ -function calculateZwaveDimDuration(duration, opts = {}) { - const seconds = duration / 1000; - const maxValue = Object.prototype.hasOwnProperty.call(opts, 'maxValue') ? opts.maxValue : 254; - if (seconds <= 127) return seconds; - else if (seconds > 127 && seconds < 7560) { - return Math.min(Math.round(128 + (seconds / 60)), maxValue); - } - - return maxValue; -} - -/** - * Calculate a transtime value for ZigBee clusters, it takes two parameters, opts and settings. Opts is the opts object - * provided by a capbilityListener which can hold a duration property (in miliseconds), settings is an object which can - * hold a 'transition_time' property (in seconds). If none are available, the default is 0. The valid value range is - * 0 - 6553. - * @param opts {object} - * @param opts.duration {number} - Duration property in miliseconds (preferred over 'transition_time') - * @param settings {object} - * @param settings.transition_time {number} - Transition time property in seconds - * @returns {number} - */ -function calculateZigBeeDimDuration(opts = {}, settings = {}) { - let transtime = 0; - if (opts.hasOwnProperty('duration')) { - transtime = opts.duration / 100; - } else if (typeof settings.transition_time === 'number') { - transtime = Math.round(settings.transition_time * 10); - } - // Cap the range between 0 and 6553 - return Math.max(Math.min(transtime, 6553), 0); -} - - -/** - * Utility class with several color and range conversion methods. - * @class Util - */ -module.exports = { - convertRGBToCIE: color.convertRGBToCIE, - convertHSVToCIE: color.convertHSVToCIE, - convertHSVToRGB: color.convertHSVToRGB, - convertRGBToHSV: color.convertRGBToHSV, - mapValueRange, - calculateZwaveDimDuration, - calculateZigBeeDimDuration, -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/ZigBeeDevice.js b/node_modules/homey-meshdriver/lib/zigbee/ZigBeeDevice.js deleted file mode 100644 index 340a240..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/ZigBeeDevice.js +++ /dev/null @@ -1,714 +0,0 @@ -'use strict'; - -const Homey = require('homey'); -const MeshDevice = require('../MeshDevice.js'); - -// TODO battery node online event - -const i18n = { - error: { - unknown: { - en: 'Unknown error', - nl: 'Onbekend probleem', - }, - could_not_reach_device: { - en: 'Could not reach device', - nl: 'Kon apparaat niet bereiken', - }, - invalid_ieeeaddr: { - en: 'Device not found in network', - nl: 'Apparaat niet gevonden in netwerk', - }, - left_network: { - en: 'Device has left the network, please remove and re-pair', - nl: 'Apparaat heeft het netwerk verlaten, verwijder en voeg opnieuw toe', - }, - }, -}; - -/** - * @extends MeshDevice - */ -class ZigBeeDevice extends MeshDevice { - - /* - * Homey methods - */ - - /** - * @private - */ - onInit() { - super.onInit('zigbee'); - - this._capabilities = {}; - this._settings = {}; - this._reportListeners = {}; - this._attrReportListeners = {}; - this._pollIntervals = {}; - this._pollIntervalsKeys = {}; - this._bindRequests = []; - this._configureReportRequests = []; - - this.once('__meshInit', () => { - this.log('ZigBeeDevice has been inited'); - if (typeof this.onMeshInit === 'function') { - this.onMeshInit(); - } - - // Check if energy map is available, if so set energy object - if (typeof this.getEnergy === 'function') { // Check if energy is available, if not ignore - this._setEnergyObjectByProductId(); - } - - this._initNodeListeners(); - }); - } - - /** - * Stub getter, can be overriden by subclass to provide energy properties per zb_product_id. - * @example - * class DimmableBulb extends ZigBeeDevice { - * get energyMap() { - * return { - * 'TRADFRI bulb E14 W op/ch 400lm': { - * approximation: { - * usageOff: 0, - * usageOn: 10 - * } - * } - * } - * } - * } - * @returns {{}} - */ - get energyMap() { - return {}; - } - - /** - * Method that checks if a energyMap property is available on this device instance. If so it will check if an energy - * object is available corresponding to the zb_product_id property of this device. - * @private - */ - _setEnergyObjectByProductId() { - const zigbeeProductId = this.getSetting('zb_product_id'); - if (!zigbeeProductId) return this.log('WARNING: _setEnergyObjectByProductId() -> could not find zigbeeProductId'); - const energy = this.energyMap[zigbeeProductId] || this.getEnergy() || null; - if (energy) return this.setEnergy(energy); - } - - /* - * Private methods - */ - - /** - * @private - */ - _initNodeListeners() { - - // Start listening for incoming leave events (once device has left network it can not return) - this.node.on('leave', () => { - this.setUnavailable(this.__(i18n.error.left_network)); - }); - - // Start listening for incoming reports - this.node.on('report', report => { - this._debug('report', report); - if (report && report.event === 'report') { - const clusterEndpointId = `${Number(report.endpoint) - 1}_${report.cluster}`; - if ((this._attrReportListeners[clusterEndpointId] && this._attrReportListeners[clusterEndpointId][report.attr])) { - this._attrReportListeners[clusterEndpointId][report.attr](report.value); - } - } - }); - } - - /** - * @private - */ - _registerCapabilityGet(capabilityId, clusterId) { - - const capabilityGetObj = this._getCapabilityObj('get', capabilityId, clusterId); - if (capabilityGetObj instanceof Error) return capabilityGetObj; - - // get initial value on start if null, unless it's an offline battery device and the getOnOnline flag is also set - if (capabilityGetObj.opts.getOnStart - && this.getCapabilityValue(capabilityId) === null - && !(this.node.battery && this.node.online === false && capabilityGetObj.opts.getOnOnline === true)) { - this._getCapabilityValue(capabilityId, clusterId); - } - - if (capabilityGetObj.opts.getOnOnline) { - this.node.on('online', () => { - this._debug(`Node online, getting clusterId '${clusterId}' for capabilityId '${capabilityId}'`); - this._getCapabilityValue(capabilityId, clusterId); - }); - } - - if (capabilityGetObj.opts.pollInterval) { - - let pollInterval; - - if (typeof capabilityGetObj.opts.pollInterval === 'number') { - pollInterval = capabilityGetObj.opts.pollInterval; - } - - if (typeof capabilityGetObj.opts.pollInterval === 'string') { - pollInterval = this.getSetting(capabilityGetObj.opts.pollInterval); - this._pollIntervalsKeys[capabilityGetObj.opts.pollInterval] = { - capabilityId, - clusterId, - }; - } - - this._setPollInterval(capabilityId, clusterId, pollInterval); - } - } - - /** - * @private - */ - _setPollInterval(capabilityId, clusterId, pollInterval) { - - this._pollIntervals[capabilityId] = this._pollIntervals[capabilityId] || {}; - - if (this._pollIntervals[capabilityId][clusterId]) { - clearInterval(this._pollIntervals[capabilityId][clusterId]); - } - - if (pollInterval < 1) return; - - this._pollIntervals[capabilityId][clusterId] = setInterval(() => { - this._debug(`Polling clusterId '${clusterId}' for capabilityId '${capabilityId}'`); - this._getCapabilityValue(capabilityId, clusterId); - }, pollInterval); - - } - - /** - * @private - */ - async _getCapabilityValue(capabilityId, clusterId) { - - const capabilityGetObj = this._getCapabilityObj('get', capabilityId, clusterId); - if (capabilityGetObj instanceof Error) return capabilityGetObj; - - let parsedPayload = {}; - - if (typeof capabilityGetObj.parser === 'function') { - parsedPayload = await capabilityGetObj.parser.call(this); - if (parsedPayload instanceof Error) return this.error(parsedPayload); - } - - try { - const cluster = capabilityGetObj.node.endpoints[capabilityGetObj.endpoint].clusters[capabilityGetObj.clusterId]; - return cluster.read(capabilityGetObj.commandId) - .then(res => this._onReport(capabilityId, capabilityGetObj.clusterId, res)) - .catch(err => this.error(err)); - } catch (err) { - return this.error(err); - } - } - - /** - * @private - */ - _registerCapabilitySet(capabilityId, clusterId) { - - const capabilitySetObj = this._getCapabilityObj('set', capabilityId, clusterId); - if (capabilitySetObj instanceof Error) return capabilitySetObj; - - this.registerCapabilityListener(capabilityId, async (value, opts) => await this._registerCapabilityListenerHandler(capabilitySetObj, capabilityId, value, opts)); - } - - /** - * @param capabilitiesOpts - * @private - */ - _registerCapabilitiesSet(capabilitiesOpts, fn) { - - // Register multiple capabilities with a debouncer - this.registerMultipleCapabilityListener(capabilitiesOpts.map(x => x.capability), async (valueObj, optsObj) => { - - // Let the app try to handle the debounced capabilities updates - const result = await fn(valueObj, optsObj); - - // If it did not handle it for some reason, return to the defaults - if (!result || result instanceof Error) { - - // Loop all changed capabilities - for (const capabilityId of Object.keys(valueObj)) { - const capabilityObj = capabilitiesOpts.find(x => x.capability === capabilityId); - const clusterId = capabilityObj.cluster; - const value = valueObj[capabilityId]; - const opts = optsObj[capabilityId]; - - // Try and get capability set object - const capabilitySetObj = this._getCapabilityObj('set', capabilityId, clusterId); - if (capabilitySetObj instanceof Error) { - this.error(`capabilitySetObj ${capabilityId} ${clusterId} is error`, capabilitySetObj); - break; - } - - // Try to handle executing the capability change event - try { - await this._registerCapabilityListenerHandler(capabilitySetObj, capabilityId, value, opts); - } catch (err) { - this.error('_registerCapabilityListenerHandler() -> failed', err); - break; - } - } - } - }, 500); - } - - /** - * @param capabilitySetObj - * @param capabilityId - * @param value - * @param opts - * @returns {Promise.<*>} - * @private - */ - async _registerCapabilityListenerHandler(capabilitySetObj, capabilityId, value, opts) { - this.log(`set ${capabilityId} -> ${value}`); - if (typeof capabilitySetObj.parser !== 'function') throw new Error('parser_is_not_a_function'); - - let commandId = capabilitySetObj.commandId; - if (typeof capabilitySetObj.commandId === 'function') commandId = capabilitySetObj.commandId(value, opts); - const parsedPayload = await capabilitySetObj.parser.call(this, value, opts); - if (parsedPayload instanceof Error) throw parsedPayload; - if (parsedPayload === null) { - this._debug(`WARNING: got parsedPayload null from capability (${capabilityId}) set parser, ignoring set.`); - return 'IGNORED'; - } - - try { - const cluster = capabilitySetObj.node.endpoints[capabilitySetObj.endpoint].clusters[capabilitySetObj.clusterId]; - return cluster.do(commandId, parsedPayload) - .catch(err => { - this.error(`Error: could not perform ${commandId} on ${capabilitySetObj.clusterId}`, err); - throw new Error(this.__(i18n.error.could_not_reach_device)); - }); - } catch (err) { - return Promise.reject(err); - } - } - - /** - * @param capabilityId - * @param clusterId - * @param userOpts - * @private - */ - _mergeSystemAndUserOpts(capabilityId, clusterId, userOpts) { - - // Merge systemOpts & userOpts - let systemOpts = {}; - try { - systemOpts = Homey.util.recursiveDeepCopy(require(`./system/capabilities/${capabilityId}/${clusterId}.js`)); - - // Bind correct scope - for (const i in systemOpts) { - if (systemOpts.hasOwnProperty(i) && typeof systemOpts[i] === 'function') { - systemOpts[i] = systemOpts[i].bind(this); - } - } - } catch (err) { - if (err.code !== 'MODULE_NOT_FOUND' || err.message.indexOf(`/system/capabilities/${capabilityId}/${clusterId}.js`) < 0) { - process.nextTick(() => { - throw err; - }); - } - } - - // Insert default endpoint zero - if (userOpts && !userOpts.hasOwnProperty('endpoint')) userOpts.endpoint = this.getClusterEndpoint(clusterId); - else if (typeof userOpts === 'undefined') userOpts = { endpoint: this.getClusterEndpoint(clusterId) }; - - this._capabilities[capabilityId][clusterId] = Object.assign( - {}, - systemOpts || {}, - userOpts || {} - ); - } - - /** - * @private - */ - async _onReport(capabilityId, clusterId, payload) { - - const capabilityReportObj = this._getCapabilityObj('report', capabilityId, clusterId); - if (capabilityReportObj instanceof Error) return capabilityReportObj; - - if (typeof capabilityReportObj.parser !== 'function') return; - - const parsedPayload = await capabilityReportObj.parser.call(this, payload); - if (parsedPayload instanceof Error) return; - if (parsedPayload === null) return; - - this.setCapabilityValue(capabilityId, parsedPayload); - - return parsedPayload; - } - - /** - * @private - */ - _getCapabilityObj(commandType, capabilityId, clusterId) { - - const capability = this._capabilities[capabilityId]; - let cluster; - - if (typeof clusterId !== 'undefined') { - cluster = capability[clusterId]; - } else { - return new Error('missing_zigbee_cluster_id'); - } - - if (typeof cluster === 'undefined') return new Error('missing_zigbee_capability'); - const commandId = cluster[commandType]; - const parser = cluster[`${commandType}Parser`] || null; - const opts = cluster[`${commandType}Opts`] || {}; - const node = this.node; - - if (typeof commandId === 'string' || typeof commandId === 'function') { - return { - clusterId, - commandId, - endpoint: cluster.endpoint, - parser, - opts, - node, - }; - } - - return new Error(`capability_${commandType}_is_not_a_function_or_string`); - } - - /* - * Public methods - */ - - /** - * Register a Homey Capability with a Cluster. - * @param {string} capabilityId - The Homey capability id (e.g. `onoff`) - * @param {string} clusterId - The Cluster id (e.g. `genBasic`) - * @param {Object} [userOpts] - The object with options for this capability/cluster combination. These will extend system options, if available (`/lib/zigbee/system/`) - * @param {string} [userOpts.get] - The command to get a value (e.g. `onOff`) - * @param {string} [userOpts.getParser] - The function that is called when a GET request is made. Should return an Object. - * @param {Object} [userOpts.getOpts - * @param {Boolean} [userOpts.getOpts.getOnStart] - Get the value on App start - * @param {Boolean} [userOpts.getOpts.getOnOnline] - Get the value when the device is marked as online - * @param {Number|string} [userOpts.getOpts.pollInterval] - Interval (in ms) to poll with a GET request. When provided a string, the device's setting with the string as ID will be used (e.g. `poll_interval`) - * @param {string} [userOpts.set] - The command to set a value (e.g. `on`) - * @param {Function} [userOpts.setParser] - The function that is called when a SET request is made. Should return an Object. - * @param {*} [userOpts.setParser.value] - The value of the Homey capability - * @param {Object} [userOpts.setParser.opts] - Options for the capability command - * @param {string} [userOpts.report] - The command to report a value (e.g. `onOff`) - * @param {Function} [userOpts.reportParser] - The function that is called when a REPORT request is made. Should return an Object. - * @param {Object} [userOpts.reportParser.report] - The report object - * @param {number} [userOpts.endpoint=0] - An index to identify the endpoint to use for this capability - */ - registerCapability(capabilityId, clusterId, userOpts) { - - // Register the ZigBee capability listener - this._capabilities[capabilityId] = this._capabilities[capabilityId] || {}; - this._capabilities[capabilityId][clusterId] = this._capabilities[capabilityId][clusterId] || {}; - - // Merge systemOpts & userOpts - this._mergeSystemAndUserOpts(capabilityId, clusterId, userOpts); - - // Register get/set - this._registerCapabilitySet(capabilityId, clusterId); - this._registerCapabilityGet(capabilityId, clusterId); - } - - /** - * Register multiple Homey Capabilities with a Cluster. When a capability is changed, the event will be debounced - * with the other capabilities in the capabilitiesOpts array. - * @param {Object[]} capabilitiesOpts - * @param {string} capabilitiesOpts.capability - * @param {string} capabilitiesOpts.cluster - * @param {Object} [capabilitiesOpts.opts] - The object with options for this capability/cluster combination. These will extend system options, if available (`/lib/zigbee/system/`) - * @param {string} [capabilitiesOpts.opts.get] - The command to get a value (e.g. `onOff`) - * @param {string} [capabilitiesOpts.opts.getParser] - The function that is called when a GET request is made. Should return an Object. - * @param {Object} [capabilitiesOpts.opts.getOpts] - * @param {Boolean} [capabilitiesOpts.opts.getOpts.getOnStart] - Get the value on App start - * @param {Boolean} [capabilitiesOpts.opts.getOpts.getOnOnline] - Get the value when the device is marked as online - * @param {Number|string} [capabilitiesOpts.opts.getOpts.pollInterval] - Interval to poll with a GET request. When provided a string, the device's setting with the string as ID will be used (e.g. `poll_interval`) - * @param {string} [capabilitiesOpts.opts.set] - The command to set a value (e.g. `on`) - * @param {Function} [capabilitiesOpts.opts.setParser] - The function that is called when a SET request is made. Should return an Object. - * @param {*} [capabilitiesOpts.opts.setParser.value] - The value of the Homey capability - * @param {Object} [capabilitiesOpts.opts.setParser.opts] - Options for the capability command - * @param {string} [capabilitiesOpts.opts.report] - The command to report a value (e.g. `onOff`) - * @param {Function} [capabilitiesOpts.opts.reportParser] - The function that is called when a REPORT request is made. Should return an Object. - * @param {Object} [capabilitiesOpts.opts.reportParser.report] - The report object - * @param {number} [capabilitiesOpts.opts.endpoint=0] - An index to identify the endpoint to use for this capability - * @param {function} fn - */ - registerMultipleCapabilities(capabilitiesOpts = [], fn) { - - // Loop all provided capabilities - capabilitiesOpts.forEach(capabilityObj => { - const capabilityId = capabilityObj.capability; - const clusterId = capabilityObj.cluster; - const userOpts = capabilityObj.opts || {}; - - // Register the ZigBee capability listener - this._capabilities[capabilityId] = this._capabilities[capabilityId] || {}; - this._capabilities[capabilityId][clusterId] = this._capabilities[capabilityId][clusterId] || {}; - - // Override default system opts with user opts - this._mergeSystemAndUserOpts(capabilityId, clusterId, userOpts); - - // Register capability getter - this._registerCapabilityGet(capabilityId, clusterId); - - // Register debounced capabilities set - this._registerCapabilitiesSet(capabilitiesOpts, fn); - }); - } - - /** - * Method that searches for the first occurrence of a clusterName in a device's endpoints and returns the endpoint id. - * @param {string} clusterName - */ - getClusterEndpoint(clusterName) { - if (typeof clusterName !== 'string') return new Error('invalid_cluster_name'); - if (!this.node || !this.node.hasOwnProperty('endpoints')) return new Error('node_not_initialized'); - - // Loop all endpoints for first occurence of clusterName - for (const endpoint of this.node.endpoints) { - if (endpoint.clusters.hasOwnProperty(clusterName)) { - return this.node.endpoints.indexOf(endpoint); - } - } - - // Not found, probably something wrong, return default - return 0; - } - - /** - * Register a endpoint command listener, which is called when a command has been received from the provided endpoint - * cluster combination. - * @param {string} clusterId - The ID of the cluster (e.g. `genBasic`) - * @param {string} commandId - The ID of the Command (e.g. `onOff`) - * @param {Function} triggerFn - * @param {Object} triggerFn.rawReport - The raw report - * @param {Object} triggerFn.parsedReport - The parsed report (parsed by the first available `reportParser` method) - * @param {number} [endpointId=0] - The endpoint index (e.g. 0) - */ - registerReportListener(clusterId, commandId, triggerFn, endpointId = 0) { - const reportId = `${endpointId}_${clusterId}_${commandId}`; - const clusterEndpointId = `${endpointId}_${clusterId}`; - - const alreadyBound = this.getStoreValue(reportId); - const alreadyRegistered = Object.keys(this._reportListeners[clusterEndpointId] || {}).length > 0; - - this._reportListeners[clusterEndpointId] = this._reportListeners[clusterEndpointId] || {}; - this._reportListeners[clusterEndpointId][commandId] = triggerFn; - - // Make sure to only bind each cluster once - if (alreadyBound || alreadyRegistered) { - this.log('registerReportListener() -> already bound cluster', clusterId, commandId, endpointId); - - // Lister on this cluster for specific commands - this.node.on('command', command => { - const endpointId = command.endpoint; - if (!endpointId) this.error('command missing endpoint id', command); - const commandClusterEndpointId = `${endpointId}_${clusterId}`; - if (this._reportListeners[commandClusterEndpointId] - && this._reportListeners[commandClusterEndpointId][command.attr] - && commandId === command.attr) { - this._reportListeners[commandClusterEndpointId][command.attr](command.value); - } - }); - } else { - - this.log('registerReportListener() -> bind cluster', clusterId, commandId, endpointId); - - // Add to queue - this._bindRequests.push({ endpointId, clusterId, commandId, reportId }); - - // If not already binding start the binding process - if (!this.bindingInProcess) this._bindCluster(); - } - } - - /** - * Start binding process, if there are more than one bindings required perform them one after another. - * @returns {Promise} - * @private - */ - async _bindCluster() { - - // Mark binding true - this.bindingInProcess = true; - - // Get next bind obj in queue - const bindObj = this._bindRequests.shift(); - try { - await this.node.endpoints[bindObj.endpointId].clusters[bindObj.clusterId].bind(); - } catch (err) { - this.error(`registerReportListener() -> error could not bind ${bindObj.clusterId} cluster on endpoint ${bindObj.endpointId}`, err); - if (this._bindRequests.length > 0) return this._bindCluster(); - this.bindingInProcess = false; - return; - } - - this.log(`registerReportListener() -> bind ${bindObj.clusterId} on endpoint ${bindObj.endpointId} successful`); - - // Mark this cluster as bound for this device to prevent rebinding - this.setStoreValue(bindObj.reportId, true); - - // Bind listener for incoming commands - this.node.on('command', command => { - const endpointId = command.endpoint; - if (!endpointId) this.error('command missing endpoint id', command); - const commandClusterEndpointId = `${endpointId}_${bindObj.clusterId}`; - if (this._reportListeners[commandClusterEndpointId] - && this._reportListeners[commandClusterEndpointId][command.attr] - && bindObj.commandId === command.attr) { - this._reportListeners[commandClusterEndpointId][command.attr](command.value); - } - }); - - // If queue not empty continue, else mark as done - if (this._bindRequests.length > 0) return this._bindCluster(); - this.bindingInProcess = false; - } - - /** - * Register an attribute report listener, which is called when a report has been received for the provided endpoint - * cluster and attribute combination. - * @param {string} clusterId - The ID of the cluster (e.g. `genBasic`) - * @param {string} attrId - The ID of the attribute (e.g. `onOff`) - * @param {number} minInt - The minimal reporting interval in seconds (e.g. 10 (seconds)) - * @param {number} maxInt - The maximal reporting interval in seconds (e.g. 300 (seconds)) - * @param {number} repChange - Reportable change; the attribute should report its value when the value is changed more than this setting, for attributes of analog data type this argument is mandatory. - * @param {Function} triggerFn - Function that will be called when attribute report data is received - * @param {number} [endpointId=0] - The endpoint index (e.g. 0) - * @returns {Promise} Resolves if configuration succeeded - */ - async registerAttrReportListener(clusterId, attrId, minInt, maxInt, repChange = null, triggerFn, endpointId = 0) { - const reportId = `attrReport_${endpointId}_${clusterId}_${attrId}`; - const clusterEndpointId = `${endpointId}_${clusterId}`; - - // minInt must be greater than or equal to 1 - if (minInt < 1) throw new Error('invalid_min_int_report_value'); - - // maxInt must be larger than 60 and larger than minInt or 0 - if (maxInt !== 0 && (maxInt < 60 || maxInt < minInt)) { - throw new Error('invalid_max_int_report_value'); - } - - // Check if endpoint cluster combi exists - if (!this.node.endpoints[endpointId] || !this.node.endpoints[endpointId].clusters[clusterId]) { - throw new Error('invalid_endpoint_cluster_combination'); - } - - // Check if already configured - const alreadyConfigured = this.getStoreValue(reportId); - this._attrReportListeners[clusterEndpointId] = this._attrReportListeners[clusterEndpointId] || {}; - - // Store callback - this._attrReportListeners[clusterEndpointId][attrId] = triggerFn; - - // Make sure to configure just once - if (alreadyConfigured && - alreadyConfigured.minInt === minInt && - alreadyConfigured.maxInt === maxInt && - alreadyConfigured.repChange === repChange) { - this.log(`registerAttrReportListener() -> already configured attr reporting ${reportId}`); - return true; - } - - // If was registered before unregister it first - this.unsetStoreValue(reportId); - - return new Promise((resolve, reject) => { - // Add to queue - this._configureReportRequests.push({ - reportId, - endpointId, - clusterId, - attrId, - minInt, - maxInt, - repChange, - promise: { resolve, reject }, - }); - - // If not already binding start the binding process - if (!this.configureReportInProcess) this._configureReport(); - }); - - } - - /** - * Start report configuring process, if there are more than one configurations required perform them one after another. - * @returns {Promise} - * @private - */ - async _configureReport() { - - // Mark configuring true - this.configureReportInProcess = true; - - // Get next configure obj in queue - const configureReportObj = this._configureReportRequests.shift(); - - try { - await this.node.endpoints[configureReportObj.endpointId].clusters[configureReportObj.clusterId] - .report(configureReportObj.attrId, configureReportObj.minInt, configureReportObj.maxInt, configureReportObj.repChange); - - this.log(`registerAttrReportListener() -> configured attr reporting ${configureReportObj.reportId}`); - - // Store configuration succeeded - this.setStoreValue(configureReportObj.reportId, { - minInt: configureReportObj.minInt, - maxInt: configureReportObj.maxInt, - repChange: configureReportObj.repChange, - }); - - if (configureReportObj.promise) configureReportObj.promise.resolve(); - } catch (err) { - this.error(`registerAttrReportListener() -> error could not configure ${configureReportObj.reportId}`, err); - if (configureReportObj.promise) configureReportObj.promise.reject(err); - } - - // If queue not empty continue, else mark as done - if (this._configureReportRequests.length > 0) return this._configureReport(); - this.configureReportInProcess = false; - } - - /** - * Print the current Node information with Endpoints and Clusters - */ - printNode() { - this.log('------------------------------------------'); - - // log the entire Node - this.log('Node:', this.getData().token); - this.log('- Battery:', this.node.battery); - - Object.keys(this.node.endpoints).forEach(endpointsId => { - this.log('- Endpoints:', endpointsId); - this.log('-- Clusters:'); - Object.keys(this.node.endpoints[endpointsId].clusters).forEach(key => { - this.log('---', key); - if (typeof this.node.endpoints[endpointsId].clusters[key].attrs !== 'undefined') { - Object.keys(this.node.endpoints[endpointsId].clusters[key].attrs).forEach(attrKey => { - this.log('----', attrKey, ':', this.node.endpoints[endpointsId].clusters[key].attrs[attrKey]); - }); - } - }); - }); - - this.log('------------------------------------------'); - } -} - -module.exports = ZigBeeDevice; diff --git a/node_modules/homey-meshdriver/lib/zigbee/ZigBeeLightDevice.js b/node_modules/homey-meshdriver/lib/zigbee/ZigBeeLightDevice.js deleted file mode 100644 index 1bb0f3b..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/ZigBeeLightDevice.js +++ /dev/null @@ -1,183 +0,0 @@ -'use strict'; - -const util = require('./../util'); -const ZigBeeDevice = require('homey-meshdriver').ZigBeeDevice; - -const maxHue = 254; -const maxDim = 254; -const maxSaturation = 254; - -const onoffCapabilityDefinition = { - capability: 'onoff', - cluster: 'genOnOff', - opts: { - get: 'onOff', - reportParser(value) { - return value === 1; - }, - report: 'onOff', - getOpts: { - getOnStart: true, - }, - } -}; - -const dimCapabilityDefinition = { - capability: 'dim', - cluster: 'genLevelCtrl', - opts: { - get: 'currentLevel', - reportParser(value) { - return value / maxDim; - }, - report: 'currentLevel', - getOpts: { - getOnStart: true, - }, - } -} - -class ZigBeeLightDevice extends ZigBeeDevice { - - async onMeshInit() { - - // Register multiple capabilities, they will be debounced when one of them is called - this.registerMultipleCapabilities([onoffCapabilityDefinition, dimCapabilityDefinition], (valueObj, optsObj) => { - // Bulb is turned on/off - if (valueObj.hasOwnProperty('onoff')) { - if (valueObj.hasOwnProperty('dim') && valueObj.onoff && valueObj.dim > 0) { - // Bulb is turned on and dimmed to a value, then just dim - return this.node.endpoints[this.getClusterEndpoint('genLevelCtrl')].clusters.genLevelCtrl.do('moveToLevelWithOnOff', { - level: Math.round(valueObj.dim * maxDim), - transtime: util.calculateZigBeeDimDuration(optsObj.dim, this.getSettings()), - }); - } else if (valueObj.hasOwnProperty('dim') && valueObj.onoff === false) { - // Bulb is turned off and dimmed to a value, then turn off - return this.node.endpoints[this.getClusterEndpoint('genOnOff')].clusters.genOnOff.do(valueObj.onoff ? 'on' : 'off', {}) - } else if (valueObj.hasOwnProperty('dim') && valueObj.onoff === true && valueObj.dim === 0) { - // Device is turned on and dimmed to zero, then just turn off - return this.node.endpoints[this.getClusterEndpoint('genOnOff')].clusters.genOnOff.do('off', {}) - } - - // Device is only turned on/off, request new dim level afterwards - return this.node.endpoints[this.getClusterEndpoint('genOnOff')].clusters.genOnOff.do(valueObj.onoff ? 'on' : 'off', {}) - .then(async () => { - if (valueObj.onoff === false) { - await this.setCapabilityValue('dim', 0); // Set dim to zero when turned off - } else if (valueObj.onoff) { - const dimLevel = await this.node.endpoints[this.getClusterEndpoint('genLevelCtrl')].clusters.genLevelCtrl.read('currentLevel'); - return this.setCapabilityValue('dim', Math.max(0.01, dimLevel / maxDim)); // Always set dim to 0.01 or higher since bulb is turned on - } - }) - } else if (valueObj.hasOwnProperty('dim')) { // Bulb is only dimmed - - // Update onoff value - if (valueObj.dim === 0) { - this.setCapabilityValue('onoff', false).catch(err => this.error('failed to set onoff capability value', err)); - } else if (this.getCapabilityValue('onoff') === false && valueObj.dim > 0) { - this.setCapabilityValue('onoff', true).catch(err => this.error('failed to set onoff capability value', err)); - } - - // Execute dim - return this.node.endpoints[this.getClusterEndpoint('genLevelCtrl')].clusters.genLevelCtrl.do('moveToLevelWithOnOff', { - level: Math.round(valueObj.dim * maxDim), - transtime: util.calculateZigBeeDimDuration(optsObj.dim, this.getSettings()), - }); - } - }) - - // Register debounced capabilities - const groupedCapabilities = []; - if (this.hasCapability('light_hue')) { - groupedCapabilities.push({ - capability: 'light_hue', - cluster: 'lightingColorCtrl', - }); - } - if (this.hasCapability('light_saturation')) { - groupedCapabilities.push({ - capability: 'light_saturation', - cluster: 'lightingColorCtrl', - }); - } - if (this.hasCapability('light_temperature')) { - this._colorTempMin = this.getStoreValue('colorTempMin'); - this._colorTempMax = this.getStoreValue('colorTempMax'); - - if (typeof this._colorTempMin !== 'number') { - try { - this._colorTempMin = await this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl.read('colorTempPhysicalMin'); - if (typeof this._colorTempMin === 'number') this.setStoreValue('colorTempMin', this._colorTempMin); - else this.error('retrieved nun-numeric colorTempMin', this._colorTempMin); - } catch (err) { - this.error('could not get colorTempMin', err); - } - } - if (typeof this._colorTempMax !== 'number') { - try { - this._colorTempMax = await this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl.read('colorTempPhysicalMax'); - if (typeof this._colorTempMax === 'number') this.setStoreValue('colorTempMax', this._colorTempMax); - else this.error('retrieved nun-numeric colorTempMax', this._colorTempMax); - } catch (err) { - this.error('could not get colorTempMax', err); - } - } - - groupedCapabilities.push({ - capability: 'light_temperature', - cluster: 'lightingColorCtrl', - }); - } - if (this.hasCapability('light_mode')) { - groupedCapabilities.push({ - capability: 'light_mode', - cluster: 'lightingColorCtrl', - }); - } - - // Register multiple capabilities, they will be debounced when one of them is called - this.registerMultipleCapabilities(groupedCapabilities, (valueObj, optsObj) => { - this.log('registerMultipleCapabilityListener()', valueObj, optsObj); - - if (valueObj.hasOwnProperty('light_hue') && valueObj.hasOwnProperty('light_saturation')) { - - const lightHue = valueObj.light_hue; - const lightSaturation = valueObj.light_saturation; - - this.log('registerMultipleCapabilityListener() -> set hue and saturation'); - - return this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl - .do('moveToHueAndSaturation', { - hue: Math.round(lightHue * maxHue), - saturation: Math.round(lightSaturation * maxSaturation), - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }) - .catch(err => { - throw new Error('failed_to_do_move_to_hue_and_saturation'); - }); - } else if (valueObj.hasOwnProperty('light_mode') && valueObj.hasOwnProperty('light_temperature')) { - - this.log('registerMultipleCapabilityListener() -> set mode and temperature'); - - return this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl - .do('moveToColorTemp', { - colortemp: Math.round(util.mapValueRange(0, 1, this._colorTempMin, this._colorTempMax, valueObj.light_temperature)), - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }); - } else if (valueObj.hasOwnProperty('light_mode') && valueObj.hasOwnProperty('light_hue')) { - - this.log('registerMultipleCapabilityListener() -> set mode and hue'); - - return this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl - .do('moveToHue', { - hue: Math.round(valueObj.light_hue * maxHue), - direction: 0, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }); - } - }); - } -} - - -module.exports = ZigBeeLightDevice; diff --git a/node_modules/homey-meshdriver/lib/zigbee/ZigBeeXYLightDevice.js b/node_modules/homey-meshdriver/lib/zigbee/ZigBeeXYLightDevice.js deleted file mode 100644 index 3f3f8dc..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/ZigBeeXYLightDevice.js +++ /dev/null @@ -1,176 +0,0 @@ -'use strict'; - -const ZigBeeDevice = require('homey-meshdriver').ZigBeeDevice; - -const util = require('../util'); - -const CIEMultiplier = 65279; - -class ZigBeeXYLightDevice extends ZigBeeDevice { - - onMeshInit() { - - this.printNode(); - - // Register capabilities if present on device - if (this.hasCapability('onoff')) this.registerCapability('onoff', 'genOnOff'); - if (this.hasCapability('dim')) this.registerCapability('dim', 'genLevelCtrl'); - - // Register debounced capabilities - const groupedCapabilities = []; - if (this.hasCapability('light_hue')) { - groupedCapabilities.push({ - capability: 'light_hue', - cluster: 'lightingColorCtrl', - opts: { - set: 'moveToColor', - setParser(value) { - const { x, y } = util.convertHSVToCIE({ - hue: value, - saturation: this.getCapabilityValue('light_saturation'), - value: this.getCapabilityValue('dim'), - }); - return { - colorx: x * CIEMultiplier, - colory: y * CIEMultiplier, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }; - }, - }, - }); - } - if (this.hasCapability('light_saturation')) { - groupedCapabilities.push({ - capability: 'light_saturation', - cluster: 'lightingColorCtrl', - opts: { - set: 'moveToColor', - setParser(value) { - const { x, y } = util.convertHSVToCIE({ - hue: this.getCapabilityValue('light_hue'), - saturation: value, - value: this.getCapabilityValue('dim'), - }); - return { - colorx: x * CIEMultiplier, - colory: y * CIEMultiplier, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }; - }, - }, - }); - } - if (this.hasCapability('light_temperature')) { - groupedCapabilities.push({ - capability: 'light_temperature', - cluster: 'lightingColorCtrl', - opts: { - set: 'moveToColor', - setParser(value) { - - // Correct a bit for a nice temperature curve - const temperature = 0.2 + value / 4; - return { - colorx: temperature * CIEMultiplier, - colory: temperature * CIEMultiplier, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }; - }, - }, - }); - } - if (this.hasCapability('light_mode')) { - groupedCapabilities.push({ - capability: 'light_mode', - cluster: 'lightingColorCtrl', - opts: { - set: 'moveToColor', - setParser(value) { - - // Set color - if (value === 'color') { - const { x, y } = util.convertHSVToCIE({ - hue: this.getCapabilityValue('light_hue'), - saturation: this.getCapabilityValue('light_saturation'), - value: this.getCapabilityValue('dim'), - }); - return { - colorx: x * CIEMultiplier, - colory: y * CIEMultiplier, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }; - } - - // Set light temperature - const temperature = 0.2 + this.getCapabilityValue('light_temperature') / 4; - return { - colorx: temperature * CIEMultiplier, - colory: temperature * CIEMultiplier, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }; - }, - }, - }); - } - - // Register multiple capabilities, they will be debounced when one of them is called - this.registerMultipleCapabilities(groupedCapabilities, (valueObj, optsObj) => { - this.log('registerMultipleCapabilityListener()', valueObj, optsObj); - - if (valueObj.hasOwnProperty('light_hue') && valueObj.hasOwnProperty('light_saturation')) { - - const lightHue = valueObj.light_hue; - const lightSaturation = valueObj.light_saturation; - - this.log('registerMultipleCapabilityListener() -> set hue and saturation'); - const { x, y } = util.convertHSVToCIE({ - hue: lightHue, - saturation: lightSaturation, - value: this.getCapabilityValue('dim'), - }); - - return this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl - .do('moveToColor', { - colorx: x * CIEMultiplier, - colory: y * CIEMultiplier, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }) - .catch(() => { - throw new Error('failed_to_do_move_to_hue_and_saturation'); - }); - } else if (valueObj.hasOwnProperty('light_mode') && valueObj.hasOwnProperty('light_temperature')) { - - const lightTemperature = valueObj.light_temperature; - - this.log('registerMultipleCapabilityListener() -> set mode and temperature'); - - return this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl - .do('moveToColor', { - colorx: lightTemperature * CIEMultiplier, - colory: lightTemperature * CIEMultiplier, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }); - } else if (valueObj.hasOwnProperty('light_mode') && valueObj.hasOwnProperty('light_hue')) { - - const lightHue = valueObj.light_hue; - - this.log('registerMultipleCapabilityListener() -> set mode and hue'); - - const { x, y } = util.convertHSVToCIE({ - hue: lightHue, - saturation: this.getCapabilityValue('light_saturation'), - value: this.getCapabilityValue('dim'), - }); - - return this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl - .do('moveToColor', { - colorx: x * CIEMultiplier, - colory: y * CIEMultiplier, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }); - } - }); - } -} - -module.exports = ZigBeeXYLightDevice; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/alarm_battery/genPowerCfg.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/alarm_battery/genPowerCfg.js deleted file mode 100644 index 093732b..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/alarm_battery/genPowerCfg.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -module.exports = { - get: 'batteryVoltage', - reportParser(value) { - /* check if setting bat_thres exists otherwise if batteryThreshold in device.js exist use that. - * if both not exist use value 1 - */ - const batteryThreshold = this.getSetting('batteryThreshold') || this.batteryThreshold || 1; - // console.log(batThreshold); - if (value <= batteryThreshold) return true; - return false; - }, - report: 'batteryVoltage', -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/alarm_motion/msOccupancySensing.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/alarm_motion/msOccupancySensing.js deleted file mode 100644 index 2e22eb4..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/alarm_motion/msOccupancySensing.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -module.exports = { - get: 'occupancy', - reportParser(value) { - if (value === 1) return true; - return false; - }, - report: 'occupancy', -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/dim/genLevelCtrl.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/dim/genLevelCtrl.js deleted file mode 100644 index cf4b548..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/dim/genLevelCtrl.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const maxDim = 254; - -module.exports = { - set: 'moveToLevelWithOnOff', - setParser(value, opts = {}) { - if (value === 0) { - this.setCapabilityValue('onoff', false); - } else if (this.getCapabilityValue('onoff') === false && value > 0) { - this.setCapabilityValue('onoff', true); - } - - return { - level: Math.round(value * maxDim), - transtime: util.calculateZigBeeDimDuration(opts, this.getSettings()), - }; - }, - get: 'currentLevel', - reportParser(value) { - return value / maxDim; - }, - report: 'currentLevel', - getOpts: { - getOnStart: true, - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_hue/lightingColorCtrl.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_hue/lightingColorCtrl.js deleted file mode 100644 index 17e4d8d..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_hue/lightingColorCtrl.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -const maxHue = 254; - -module.exports = { - set: 'moveToHue', - setParser(value) { - return { - hue: Math.round(value * maxHue), - direction: 0, - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }; - }, - get: 'currentHue', - reportParser(value) { - return value / maxHue; - }, - report: 'currentHue', - getOpts: { - getOnStart: true, - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_mode/lightingColorCtrl.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_mode/lightingColorCtrl.js deleted file mode 100644 index 838376d..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_mode/lightingColorCtrl.js +++ /dev/null @@ -1,105 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const maxHue = 254; -const maxSaturation = 254; - -module.exports = { - set: 'moveToColorTemp', - setParser(value) { - switch (value) { - case 'temperature': { - return this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl - .do('moveToColorTemp', { - colortemp: Math.round(util.mapValueRange(0, 1, this._colorTempMin, this._colorTempMax, - this.getCapabilityValue('light_temperature'))), - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }) - .then(res => { - this.log('did moveToColorTemp', res); - return null; - }) - .catch(err => new Error('failed_to_do_move_to_color_temp', err)); - } - case 'color': { - const lightHue = this.getCapabilityValue('light_hue'); - const lightSaturation = this.getCapabilityValue('light_saturation'); - - return this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl - .do('moveToHueAndSaturation', { - hue: Math.round(lightHue * maxHue), - saturation: Math.round(lightSaturation * maxSaturation), - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }).then(() => { - this.log('did moveToHueAndSaturation'); - return null; - }) - .catch(err => new Error('failed_to_do_move_to_hue_and_saturation', err)); - } - default: - return null; - } - }, - get: 'colorMode', - async reportParser(value) { - switch (value) { - case 0: - return 'color'; - case 1: - - // Get temperature to confirm light mode temperature - let currentLightTemperature = this.getCapabilityValue('light_temperature'); - if (typeof currentLightTemperature !== 'number') { - try { - currentLightTemperature = await this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl.read('colorTemperature'); - } catch (err) { - this.error('failed to get light temperature', err); - currentLightTemperature = null; - } - } - - // Probably temperature - if (currentLightTemperature > 0) return 'temperature'; - - // Get hue to confirm light mode color - let currentHue = this.getCapabilityValue('light_hue'); - if (typeof currentHue !== 'number') { - try { - currentHue = await this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl.read('currentHue'); - } catch (err) { - this.error('failed to get light hue', err); - currentHue = null; - } - } - - // Probably color - if (currentHue > 0) return 'color'; - - // Still not certain if color, check for saturation - let currentSaturation = this.getCapabilityValue('light_saturation'); - if (typeof currentSaturation !== 'number') { - try { - currentSaturation = await this.node.endpoints[this.getClusterEndpoint('lightingColorCtrl')].clusters.lightingColorCtrl.read('currentSaturation'); - } catch (err) { - this.error('failed to get light saturation', err); - currentSaturation = null; - } - } - - // Probably color - if (currentSaturation > 0) return 'color'; - - // Could not determine light mode with certainty, assume temperature - return 'temperature'; - case 2: - return 'temperature'; - default: - return null; - } - }, - report: 'colorMode', - getOpts: { - getOnStart: true, - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_saturation/lightingColorCtrl.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_saturation/lightingColorCtrl.js deleted file mode 100644 index 34c3ad3..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_saturation/lightingColorCtrl.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -const maxSaturation = 254; - -module.exports = { - set: 'moveToSaturation', - setParser(value) { - return { - saturation: Math.round(value * maxSaturation), - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }; - }, - get: 'currentSaturation', - reportParser(value) { - return value / maxSaturation; - }, - report: 'currentSaturation', - getOpts: { - getOnStart: true, - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_temperature/lightingColorCtrl.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_temperature/lightingColorCtrl.js deleted file mode 100644 index 2aaba54..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/light_temperature/lightingColorCtrl.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -module.exports = { - set: 'moveToColorTemp', - setParser(value) { - return { - colortemp: Math.round(util.mapValueRange(0, 1, this._colorTempMin, this._colorTempMax, value)), - transtime: this.getSetting('transition_time') ? Math.round(this.getSetting('transition_time') * 10) : 0, - }; - }, - get: 'colorTemperature', - reportParser(value) { - return util.mapValueRange(this._colorTempMin, this._colorTempMax, 0, 1, value); - }, - report: 'colorTemperature', - getOpts: { - getOnStart: true, - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_battery/genPowerCfg.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_battery/genPowerCfg.js deleted file mode 100644 index cd3f3a2..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_battery/genPowerCfg.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -module.exports = { - get: 'batteryPercentageRemaining', - reportParser(value) { - /* max value 200 - * 255 indicates an invalid or unknown reading - */ - if (value <= 200 && value !== 255) return Math.round(value / 2); - return null; - }, - report: 'batteryPercentageRemaining', -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_luminance/msIlluminanceMeasurement.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_luminance/msIlluminanceMeasurement.js deleted file mode 100644 index a5bf821..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_luminance/msIlluminanceMeasurement.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -module.exports = { - get: 'measuredValue', - reportParser(value) { - return Math.round(Math.pow(10, (value - 1) / 10000)); - }, - report: 'measuredValue', -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_power/seMetering.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_power/seMetering.js deleted file mode 100644 index 7f589d2..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_power/seMetering.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -module.exports = { - get: 'instantaneousDemand', - reportParser(value) { - const instantaneousDemandFactor = this.instantaneousDemandFactor || 1; - if (value < 0) return; - return value / instantaneousDemandFactor; - }, - report: 'instantaneousDemand', - getOpts: { - getOnStart: true, - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_temperature/msTemperatureMeasurement.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_temperature/msTemperatureMeasurement.js deleted file mode 100644 index 951712b..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/measure_temperature/msTemperatureMeasurement.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -module.exports = { - get: 'measuredValue', - reportParser(value) { - return Math.round((value / 100) * 10) / 10; - }, - report: 'measuredValue', -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/onoff/genOnOff.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/onoff/genOnOff.js deleted file mode 100644 index f7cc7f7..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/onoff/genOnOff.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -module.exports = { - set: value => value ? 'on' : 'off', - setParser: () => ({}), - get: 'onOff', - reportParser(value) { - return value === 1; - }, - report: 'onOff', - getOpts: { - getOnStart: true, - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/windowcoverings_set/closuresWindowCovering.js b/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/windowcoverings_set/closuresWindowCovering.js deleted file mode 100644 index 96d74a7..0000000 --- a/node_modules/homey-meshdriver/lib/zigbee/system/capabilities/windowcoverings_set/closuresWindowCovering.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const UP_OPEN = 'upOpen'; -const DOWN_CLOSE = 'downClose'; -const CLUSTER_CLOSURES_WINDOW_COVERING = 'closuresWindowCovering'; - -module.exports = { - set: 'goToLiftPercentage', - async setParser(value) { - - // This boolean can be used to determine if incoming report are generated by a set command by Homey or externally - this._reportDebounceEnabled = true; - - // Override goToLiftPercentage to enforce blind to open/close completely - if (value === 0 || value === 1) { - this.log(`do ${value === 1 ? UP_OPEN : DOWN_CLOSE}`); - await this.node.endpoints[this.getClusterEndpoint(CLUSTER_CLOSURES_WINDOW_COVERING)].clusters.closuresWindowCovering.do(value === 1 ? UP_OPEN : DOWN_CLOSE, []); - await this.setCapabilityValue('windowcoverings_set', value); - return null; - } - - // Send goToLiftPercentage command - const mappedValue = util.mapValueRange(0, 1, 100, 0, value); - return { - percentageliftvalue: Math.round(mappedValue), // Round, otherwise might not be accepted by device - }; - }, - get: 'currentPositionLiftPercentage', - reportParser(value) { - if (value => 0 && value <= 100) { - return util.mapValueRange(0, 100, 1, 0, value); - } - return null; - }, - report: 'currentPositionLiftPercentage', - getOpts: { - getOnStart: true, - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/ZwaveDevice.js b/node_modules/homey-meshdriver/lib/zwave/ZwaveDevice.js deleted file mode 100644 index e1e520a..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/ZwaveDevice.js +++ /dev/null @@ -1,1195 +0,0 @@ -'use strict'; - -const Homey = require('homey'); -const MeshDevice = require('../MeshDevice.js'); - -const commandClassParsers = { - NOTIFICATION: payload => require('./system/commandclasses/NOTIFICATION')(payload), - METER: payload => require('./system/commandclasses/METER')(payload), - SENSOR_ALARM: payload => require('./system/commandclasses/SENSOR_ALARM')(payload), - SENSOR_MULTILEVEL: payload => require('./system/commandclasses/SENSOR_MULTILEVEL')(payload), -}; - -const i18n = { - settings: { - offlineNodeSaveMessage: { - en: 'Settings will be saved during the next wakeup of this battery device.', - nl: 'Instelling zullen worden opgeslagen bij volgende wakeup van dit apparaat.', - }, - }, -}; - -// TODO alarm_fire capability parser -// TODO light_hue capability parser -// TODO light_saturation capability parser -// TODO light_temperature capability parser -// TODO light_mode capability parser -// TODO lock_mode capability parser -// TODO alarm_pm25 capability parser -// TODO measure_pressure capability parser - -/** - * @extends MeshDevice - * @desc {@link https://developer.athom.com/docs/apps/Device.html#getSetting Device settings} used by system capabilities: - * - `invertWindowCoveringsDirection {boolean}` - Used by several windowcoverings capabilities, if true it will invert the up/down direction - * - `invertWindowCoveringsTiltDirection {boolean}` - Used by several windowcoverings capabilities, if true it will invert the tilt direction - * @property {string} thermostatSetpointType - The 'Setpoint Type' used in the THERMOSTAT_SETPOINT commandclass for the target_temperature capability - */ -class ZwaveDevice extends MeshDevice { - - /* - * Homey methods - */ - - /** - * @private - */ - onInit() { - super.onInit('zwave'); - - this._capabilities = {}; - this._settings = {}; - this._reportListeners = {}; - this._pollIntervals = {}; - this._pollIntervalsKeys = {}; - - this.once('__meshInit', () => { - this.log('ZwaveDevice has been inited'); - this.printNodeSummary(); - if (typeof this.onMeshInit === 'function') { - this.onMeshInit(); - } - }); - } - - /** - * Remove all listeners and intervals from node - */ - onDeleted() { - super.onDeleted(); - - if (!this.node) return; - - // Remove all report listeners on command classes - if (this.node.CommandClass) { - Object.keys(this.node.CommandClass).forEach(commandClassId => { - this.node.CommandClass[commandClassId].removeAllListeners(); - }); - } - - - // Remove all report listeners on multi channel nodes - if (this.node.MultiChannelNodes) { - Object.keys(this.node.MultiChannelNodes).forEach(multiChannelNodeId => { - Object.keys(this.node.MultiChannelNodes[multiChannelNodeId].CommandClass).forEach(commandClassId => { - this.node.MultiChannelNodes[multiChannelNodeId].CommandClass[commandClassId].removeAllListeners(); - }); - }); - } - } - - /** - * Method that handles changing settings for Z-Wave devices. It iterates over the changed settings and executes - * a CONFIGURATION_SET in sync. If all succeed, it will resolve, if one or more fail it will reject with an error - * of concatenated error messages (to see which settings failed if more than one). - * @param oldSettings - * @param newSettings - * @param changedKeysArr - * @returns {Promise.} - */ - async onSettings(oldSettings, newSettings, changedKeysArr = []) { - let changeSettingError = ''; - - // Loop all changed settings - for (const changedKey of changedKeysArr) { - const newValue = newSettings[changedKey]; - - // check for poll interval - if (this._pollIntervalsKeys[changedKey]) { - const capabilityGetObj = this._getCapabilityObj('get', this._pollIntervalsKeys[changedKey].capabilityId, this._pollIntervalsKeys[changedKey].commandClassId); - const pollMultiplication = capabilityGetObj.opts.pollMultiplication || 1; - const pollInterval = newValue * pollMultiplication; - - this._setPollInterval( - this._pollIntervalsKeys[changedKey].capabilityId, - this._pollIntervalsKeys[changedKey].commandClassId, - pollInterval - ); - continue; - } - - // Get manifest setting object and execute configuration set - const manifestSetting = (this.getManifestSettings().find(setting => setting.id === changedKey) || {}).zwave; - - // Non z-wave settings: see if there is a function to execute, otherwise do nothing. - if (typeof manifestSetting === 'undefined') { - - if (this._settings.hasOwnProperty(changedKey)) { - const parser = this._settings[changedKey]; - - if (typeof parser === 'function') parser.call(this, newValue); - } - continue; - } - - try { - this.log(`configurationSet() -> ${changedKey}: ${newSettings[changedKey]}, ${manifestSetting.index}, ${manifestSetting.size}`); - await this.configurationSet({ - id: changedKey, - index: manifestSetting.index, - size: manifestSetting.size, - signed: (manifestSetting.hasOwnProperty('signed')) ? manifestSetting.signed : true, - }, newSettings[changedKey]); - } catch (err) { - this.error(`failed_to_set_${changedKey}_to_${newValue}_size_${manifestSetting.size}`, err); - let errorString = `${changeSettingError}failed_to_set_${changedKey}_to_${newValue}_size_${manifestSetting.size}`; - if (changeSettingError.length > 0) errorString = `_${errorString}`; - changeSettingError = errorString; - } - } - - // If one or more of the settings failed to set, reject - if (changeSettingError.length > 0) return Promise.reject(new Error(changeSettingError)); - - // Compose save message - const saveMessage = this._composeCustomSaveMessage(oldSettings, newSettings, changedKeysArr); - return Promise.resolve(saveMessage); - } - - /** - * @private - */ - _composeCustomSaveMessage(oldSettings, newSettings, changedKeysArr) { - - // Provide user with proper feedback after clicking save - let saveMessage = null; - if (this.node.battery === true && this.node.online === false) saveMessage = Homey.__(i18n.settings.offlineNodeSaveMessage); - if (typeof this.customSaveMessage === 'function') { - const message = this.customSaveMessage(oldSettings, newSettings, changedKeysArr); - - if (typeof message !== 'object' && typeof message !== 'string') { - this._debug('Save message\'s return value is not an object nor a string'); - } else if (typeof message === 'object' && !message.hasOwnProperty('en')) { - this._debug('A custom save message needs at least the english translation'); - } else { - saveMessage = message; - } - } else if (typeof this.customSaveMessage === 'object') { - if (!this.customSaveMessage.hasOwnProperty('en')) { - this._debug('A custom save message needs at least the english translation'); - } else { - saveMessage = this.customSaveMessage; - } - } - return saveMessage; - } - - /* - Private methods - */ - - /** - * Parses a given setting uses the registered setting parser or the system parser and returns the parsed value. - * @param {Object} settingObj - * @param {string} [settingObj.id] - Optional setting id (key) if provided in manifest - * @param settingObj.index - Parameter index - * @param settingObj.size - Parameter size - * @param settingObj.signed - Parameter signed or not - * @param value - Input value to parse - * @returns {Buffer|Error} - * @private - */ - _parseSetting(settingObj = {}, value) { - let parser; - let customParser; - - // get the parser - if (typeof this._settings[settingObj.id] !== 'undefined') { - parser = this._settings[settingObj.id]; - customParser = true; - } else { - parser = this._systemSettingParser; - } - - if (typeof parser !== 'function') return new Error('invalid_parser'); - - // Parse and check value - let parsedValue = parser.call(this, value, settingObj); - if (parsedValue instanceof Error) return parsedValue; - if (!Buffer.isBuffer(parsedValue)) { - - if (customParser) { - parsedValue = this._systemSettingParser(parsedValue, settingObj); - - if (!Buffer.isBuffer(parsedValue)) { - return new Error('invalid_buffer'); - } - } else { - return new Error('invalid_buffer'); - } - } - - if (parsedValue.length !== settingObj.size) return new Error('invalid_buffer_length'); - return parsedValue; - } - - /** - * @private - */ - _systemSettingParser(newValue, manifestSetting) { - - if (typeof newValue === 'boolean') { - return new Buffer([(newValue === true) ? 1 : 0]); - } - - if (typeof newValue === 'number' || parseInt(newValue, 10).toString() === newValue) { - if (manifestSetting.signed === false) { - - try { - const buf = new Buffer(manifestSetting.size); - buf.writeUIntBE(newValue, 0, manifestSetting.size); - return buf; - } catch (err) { - return err; - } - - } else { - - try { - const buf = new Buffer(manifestSetting.size); - buf.writeIntBE(newValue, 0, manifestSetting.size); - return buf; - } catch (err) { - return err; - } - - } - } - - if (Buffer.isBuffer(newValue)) return newValue; - } - - - /** - * @private - */ - _registerCapabilityGet(capabilityId, commandClassId) { - - const capabilityGetObj = this._getCapabilityObj('get', capabilityId, commandClassId); - if (capabilityGetObj instanceof Error) return capabilityGetObj; - - // Get capability value on device init - if (capabilityGetObj.opts.getOnStart) { - - // But not for battery devices - if (this.node.battery === false) this._getCapabilityValue(capabilityId, commandClassId).catch(err => this.error(`Could not get capability value for capabilityId: ${capabilityId}`, err)); - else this.error('do not use getOnStart for battery devices, use getOnOnline instead'); - } - - // Perform get on online, also when device is initing and device is still online (replacing the getOnStart - // functionality) - if (capabilityGetObj.opts.getOnOnline) { - - // Get immediately if node is still online (right after pairing for example) - if (this.node.battery === true && this.node.online === true) { - this.log(`Node online, getting commandClassId '${commandClassId}' for capabilityId '${capabilityId}'`); - this._getCapabilityValue(capabilityId, commandClassId).catch(err => this.error(`Could not get capability value for capabilityId: ${capabilityId}`, err)); - } - - // Bind online listener for future events - this.node.on('online', online => { - if (online) { - this.log(`Node online, getting commandClassId '${commandClassId}' for capabilityId '${capabilityId}'`); - this._getCapabilityValue(capabilityId, commandClassId).catch(err => this.error(`Could not get capability value for capabilityId: ${capabilityId}`, err)); - } - }); - } - - if (capabilityGetObj.opts.pollInterval) { - - let pollInterval; - const pollMultiplication = capabilityGetObj.opts.pollMultiplication || 1; - - if (typeof capabilityGetObj.opts.pollInterval === 'number') { - pollInterval = (capabilityGetObj.opts.pollInterval * pollMultiplication); - } - - if (typeof capabilityGetObj.opts.pollInterval === 'string') { - pollInterval = (this.getSetting(capabilityGetObj.opts.pollInterval) * pollMultiplication); - this._pollIntervalsKeys[capabilityGetObj.opts.pollInterval] = { - capabilityId, - commandClassId, - }; - } - - this._setPollInterval(capabilityId, commandClassId, pollInterval); - - } - - } - - - /** - * @private - */ - _setPollInterval(capabilityId, commandClassId, pollInterval) { - - this._pollIntervals[capabilityId] = this._pollIntervals[capabilityId] || {}; - - if (this._pollIntervals[capabilityId][commandClassId]) { - clearInterval(this._pollIntervals[capabilityId][commandClassId]); - } - - if (pollInterval < 1) return; - - this._pollIntervals[capabilityId][commandClassId] = setInterval(() => { - this._debug(`Polling commandClassId '${commandClassId}' for capabilityId '${capabilityId}'`); - this._getCapabilityValue(capabilityId, commandClassId).catch(err => this.error(`Could not get capability value for capabilityId: ${capabilityId}`, err)); - }, pollInterval); - - } - - - /** - * @private - */ - async _getCapabilityValue(capabilityId, commandClassId) { - const capabilityGetObj = this._getCapabilityObj('get', capabilityId, commandClassId); - if (capabilityGetObj instanceof Error) throw capabilityGetObj; - - let parsedPayload = {}; - - if (typeof capabilityGetObj.parser === 'function') { - parsedPayload = capabilityGetObj.parser.call(this); - if (parsedPayload instanceof Error) throw parsedPayload; - } - - const commandClass = capabilityGetObj.node.CommandClass[`COMMAND_CLASS_${capabilityGetObj.commandClassId}`]; - const command = commandClass[capabilityGetObj.commandId]; - - return new Promise((resolve, reject) => { - command.call(command, parsedPayload, (err, payload) => { - if (err) return reject(err); - - const result = this._onReport(capabilityId, commandClassId, payload); - if (result instanceof Error) return reject(result); - - return resolve(result); - }); - }); - } - - /** - * This method executes the capability set command for a given capability/commandClass combination. The capability - * and commandClass must be registered before this method is called. - * @param {string} capabilityId - * @param {string} commandClassId - * @param {Mixed} value - the capability value to set (e.g 0 - 1 for dim) - * @param {Object} opts - capability options object - * @returns {Promise} - * @private - */ - async _setCapabilityValue(capabilityId, commandClassId, value, opts = {}) { - if (typeof value === 'undefined') throw new Error(`_setCapabilityValue -> invalid value ${value} (capabilityId: ${capabilityId})`); - if (typeof capabilityId === 'undefined') throw new Error(`_setCapabilityValue -> invalid capabilityId ${capabilityId}`); - if (typeof commandClassId === 'undefined') throw new Error(`_setCapabilityValue -> invalid commandClassId ${commandClassId}`); - - const capabilitySetObj = this._getCapabilityObj('set', capabilityId, commandClassId); - if (capabilitySetObj instanceof Error) throw capabilitySetObj; - if (typeof capabilitySetObj.parser !== 'function') throw new Error('missing_parser'); - - const parsedPayload = capabilitySetObj.parser.call(this, value, opts); - if (parsedPayload instanceof Promise) return parsedPayload; - if (parsedPayload instanceof Error) throw parsedPayload; - if (parsedPayload === null) { - this._debug(`WARNING: got parsedPayload null from capability (${capabilityId}) set parser, ignoring set.`); - return 'IGNORED'; - } - - const commandClass = capabilitySetObj.node.CommandClass[`COMMAND_CLASS_${capabilitySetObj.commandClassId}`]; - const command = commandClass[capabilitySetObj.commandId]; - const commandSetPromise = command.call(command, parsedPayload); - if (this.node.battery === true && this.node.online === false) return 'TRANSMIT_QUEUED'; - return commandSetPromise; - } - - /** - * @private - */ - _registerCapabilitySet(capabilityId, commandClassId) { - - const capabilitySetObj = this._getCapabilityObj('set', capabilityId, commandClassId); - if (capabilitySetObj instanceof Error) return capabilitySetObj; - - this.registerCapabilityListener(capabilityId, (value, opts) => (async () => { - return this._setCapabilityValue(capabilityId, commandClassId, value, opts) - })().then(result => { - if (typeof capabilitySetObj.opts.fn === 'function') { - process.nextTick(() => { - try { - capabilitySetObj.opts.fn.call(this, value, opts); - } catch (err) { - this.error(err); - } - }); - } - return result; - })); - } - - /** - * @private - */ - _registerCapabilityRealtime(capabilityId, commandClassId) { - - const capabilityReportObj = this._getCapabilityObj('report', capabilityId, commandClassId); - if (capabilityReportObj instanceof Error) return capabilityReportObj; - - const commandClass = capabilityReportObj.node.CommandClass[`COMMAND_CLASS_${capabilityReportObj.commandClassId}`]; - if (typeof commandClass === 'undefined') return this.error('Invalid commandClass:', capabilityReportObj.commandClassId); - - commandClass.on('report', (command, payload) => { - if (command.name !== capabilityReportObj.commandId) return; - - const parsedPayload = this._onReport(capabilityId, commandClassId, payload); - if (parsedPayload instanceof Error) return; - if (parsedPayload === null) return; - - if (this._reportListeners[commandClassId] && - this._reportListeners[commandClassId][command.name]) { - this._reportListeners[commandClassId][command.name](payload, parsedPayload); - } - }); - } - - /** - * @private - */ - _onReport(capabilityId, commandClassId, payload) { - - const capabilityReportObj = this._getCapabilityObj('report', capabilityId, commandClassId); - if (capabilityReportObj instanceof Error) return capabilityReportObj; - if (typeof capabilityReportObj.parser !== 'function') return new Error('Missing report parser'); - - // parse the payload using a built-in Command Class parser - const commandClassParsedPayload = this._parseCommandClassPayload(commandClassId, payload); - - const parsedPayload = capabilityReportObj.parser.call(this, commandClassParsedPayload); - if (parsedPayload instanceof Error) return parsedPayload; - if (parsedPayload === null) return parsedPayload; - this._debug(`_onReport() -> ${capabilityId}, ${commandClassId} -> parsed payload: ${parsedPayload}`); - this.setCapabilityValue(capabilityId, parsedPayload); - - try { - if (typeof capabilityReportObj.opts.fn === 'function') { - capabilityReportObj.opts.fn.call(this, parsedPayload); - } - } catch (err) { - this.error(err); - } - - return parsedPayload; - } - - /** - * Extend a Command Class payload with parsed values, as provided by the Z-Wave specification - * @private - */ - _parseCommandClassPayload(commandClassId, payload) { - const parser = commandClassParsers[commandClassId]; - if (parser) return parser(payload); - return payload; - } - - /** - * @private - */ - _getCapabilityObj(commandType, capabilityId, commandClassId) { - - // get capability and command class from the _capabilities object - const capability = this._capabilities[capabilityId]; - let commandClass; - - if (typeof commandClassId !== 'undefined') { - commandClass = capability[commandClassId]; - } else { - for (const commandClassId in capability) { - if (Object.prototype.hasOwnProperty.call(capabilityId, commandClassId)) { - commandClass = capability[commandClassId]; - } - } - } - - if (typeof commandClass === 'undefined') { - return new Error('missing_zwave_capability'); - } - - const commandId = commandClass[commandType]; - const opts = commandClass[`${commandType}Opts`] || {}; - let node = this.node; - - if (typeof commandClass.multiChannelNodeId === 'number') { - node = this.node.MultiChannelNodes[commandClass.multiChannelNodeId]; - if (typeof node === 'undefined') { - throw new Error(`Invalid multiChannelNodeId ${commandClass.multiChannelNodeId} for capabilityId ${capabilityId} and commandClassId ${commandClassId}`); - } - } - - let parser = null; - if (commandType === 'report' && commandClass.reportParserOverride && typeof commandClass[`${commandType}Parser`] === 'function') { - parser = commandClass[`${commandType}Parser`]; - } else { - const nodeCommandClass = node.CommandClass[`COMMAND_CLASS_${commandClassId}`]; - if (typeof nodeCommandClass === 'undefined') return new Error(`missing_command_class_${commandClassId}`); - const nodeCommandClassVersion = nodeCommandClass.version; - - for (let i = nodeCommandClassVersion; i > 0; i--) { - const fn = commandClass[`${commandType}ParserV${i}`]; - if (typeof fn === 'function') { - parser = fn; - break; - } - } - - if (parser === null && typeof commandClass[`${commandType}Parser`] === 'function') { - parser = commandClass[`${commandType}Parser`]; - } - } - - if (typeof commandId === 'string') { - return { - commandClassId, - commandId, - parser, - opts, - node, - }; - } - - return new Error('missing_zwave_capability'); - - } - - /** - * Method that checks if a device class specific system capability is available and returns it if possible. Else it - * will return null. - * @param {string} capabilityId - * @param {string} commandClassId - * @returns {Object|null} - * @private - */ - _getDeviceClassSpecificSystemCapability(capabilityId, commandClassId) { - try { - return require(`./system/capabilities/${capabilityId}/${this.getClass()}/${commandClassId}.js`); - } catch (err) { - if (err.code !== 'MODULE_NOT_FOUND') this.error(err); - return null; - } - } - - /* - * Public methods - */ - - /** - * Register a Homey Capability with a Command Class. - * Multiple `parser` methods can be provided by appending a version, e.g. `getParserV3`. This will make sure that the highest matching version will be used, falling back to `getParser`. - * @param {string} capabilityId - The Homey capability id (e.g. `onoff`) - * @param {string} commandClassId - The command class id (e.g. `BASIC`) - * @param {Object} [opts] - The object with options for this capability/commandclass combination. These will extend system options, if available (`/lib/zwave/system/`) - * @param {String} [opts.get] - The command to get a value (e.g. `BASIC_GET`) - * @param {String} [opts.getParser] - The function that is called when a GET request is made. Should return an Object. - * @param {Object} [opts.getOpts - * @param {Boolean} [opts.getOpts.getOnStart] - Get the value on App start - * @param {Boolean} [opts.getOpts.getOnOnline] - Get the value when the device is marked as online - * @param {Number|String} [opts.getOpts.pollInterval] - Interval (in ms) to poll with a GET request. When provided a string, the device's setting with the string as ID will be used (e.g. `poll_interval`) - * @param {Number} [opts.getOpts.pollMultiplication] - Multiplication factor for the pollInterval key, must be a number. (e.g. 1000 to convert to seconds, 60.000 for minutes, 3600000 for hours) - * @param {String} [opts.set] - The command to set a value (e.g. `BASIC_SET`) - * @param {Function} [opts.setParser] - The function that is called when a SET request is made. Should return an Object. - * @param {Mixed} [opts.setParser.value] - The value of the Homey capability - * @param {Object} [opts.setParser.opts] - Options for the capability command - * @param {Function} [opts.fn] - This function is called after a setCapabilityValue has been called - * @param {Object} [opts.fn.value] - The capability value - * @param {Object} [opts.fn.opts] - The capability opts - * @param {String} [opts.report] - The command to report a value (e.g. `BASIC_REPORT`) - * @param {Boolean} [opts.reportParserOverride] - Boolean flag to determine if the `reportParser` method should override all report parsers. (Assumed false when not specified) - * @param {Function} [opts.reportParser] - The function that is called when a REPORT request is made. Should return an Object. - * @param {Object} [opts.reportParser.report] - The report object - * @param {Number} [opts.multiChannelNodeId] - An ID to use a MultiChannel Node for this capability - * @param {Function} [opts.fn] - This function is called after a setCapabilityValue has been executed - * @param {Object} [opts.fn.value] - The capability value - */ - registerCapability(capabilityId, commandClassId, userOpts) { - - // Check if device has the command class we're trying to register, if not, abort - if (userOpts && typeof userOpts.multiChannelNodeId === 'number') { - if (!this.node.MultiChannelNodes || !this.node.MultiChannelNodes[userOpts.multiChannelNodeId] || this.node.MultiChannelNodes[userOpts.multiChannelNodeId].CommandClass[`COMMAND_CLASS_${commandClassId}`] === 'undefined') { - return this.error(`CommandClass: ${commandClassId} in multi channel node ${userOpts.multiChannelNodeId} undefined`); - } - } else if (typeof this.node.CommandClass[`COMMAND_CLASS_${commandClassId}`] === 'undefined') { - return this.error(`CommandClass: ${commandClassId} in main node undefined`); - } - - // register the Z-Wave capability listener - this._capabilities[capabilityId] = this._capabilities[capabilityId] || {}; - this._capabilities[capabilityId][commandClassId] = this._capabilities[capabilityId][commandClassId] || {}; - - // merge systemOpts & userOpts - let systemOpts = {}; - - // First, try get device class specific system capability - systemOpts = this._getDeviceClassSpecificSystemCapability(capabilityId, commandClassId); - - // Second, try get device class specific system capability based on root capability (e.g. onoff.output1) - const rootCapability = capabilityId.split('.')[0]; - if (!systemOpts) systemOpts = this._getDeviceClassSpecificSystemCapability(rootCapability, commandClassId); - - // Third, check for system capability - try { - if (!systemOpts) systemOpts = require(`./system/capabilities/${capabilityId}/${commandClassId}.js`); - } catch(err) { - if (err.code !== 'MODULE_NOT_FOUND') { - process.nextTick(() => { - throw err; - }); - } - } - - // Fourth, check for system capability based on root capability (e.g. onoff.output1) - try { - if (!systemOpts) systemOpts = require(`./system/capabilities/${rootCapability}/${commandClassId}.js`); - } catch(err) { - if (err.code !== 'MODULE_NOT_FOUND') { - process.nextTick(() => { - throw err; - }); - } - } - - // add implicit override for this capability's reportParser - if (userOpts) { - userOpts.reportParserOverride = typeof userOpts.reportParser === 'function' && userOpts.reportParserOverride === true; - } - - this._capabilities[capabilityId][commandClassId] = Object.assign( - {}, - systemOpts || {}, - userOpts || {} - ); - - // register get/set/realtime - this._registerCapabilityRealtime(capabilityId, commandClassId); - this._registerCapabilitySet(capabilityId, commandClassId); - this._registerCapabilityGet(capabilityId, commandClassId); - } - - /** - * Register a setting parser, which is called when a setting has changed. - * @param {string} settingId - The setting ID, as specified in `/app.json` - * @param {Function} parserFn - The parser function, must return a Buffer, number or boolean - * @param {Mixed} parserFn.value - The setting value - * @param {Mixed} parserFn.zwaveObj - The setting's `zwave` object as defined in `/app.json` - */ - registerSetting(settingId, parserFn) { - this._settings[settingId] = parserFn; - } - - /** - * Register a report listener, which is called when a report has been received. - * @param {string} commandClassId - The ID of the Command Class (e.g. `BASIC`) - * @param {string} commandId - The ID of the Command (e.g. `BASIC_REPORT`) - * @param {Function} triggerFn - * @param {Object} triggerFn.report - The received report - */ - registerReportListener(commandClassId, commandId, triggerFn) { - const commandClass = this.node.CommandClass[`COMMAND_CLASS_${commandClassId}`]; - if (typeof commandClass === 'undefined') return this.error('Invalid commandClass:', commandClassId); - let previousSequence; - - this._reportListeners[commandClassId] = this._reportListeners[commandClassId] || {}; - this._reportListeners[commandClassId][commandId] = triggerFn; - - commandClass.on('report', (command, payload) => { - if (command.name !== commandId) return; - - // Catch central scene echos and (sometimes) failing parser - if (command.name === 'CENTRAL_SCENE_NOTIFICATION') { - - if (typeof previousSequence !== 'undefined' && payload.hasOwnProperty('Sequence Number') && payload['Sequence Number'] === previousSequence) return; - previousSequence = payload['Sequence Number']; - - if (payload.hasOwnProperty('Properties1') && - payload.Properties1.hasOwnProperty('Key Attributes') && - typeof payload.Properties1['Key Attributes'] === 'number') { - switch (payload.Properties1['Key Attributes']) { - case 0: - payload.Properties1['Key Attributes'] = 'Key Pressed 1 time'; - break; - case 1: - payload.Properties1['Key Attributes'] = 'Key Released'; - break; - case 2: - payload.Properties1['Key Attributes'] = 'Key Held Down'; - break; - case 3: - payload.Properties1['Key Attributes'] = 'Key Pressed 2 times'; - break; - case 4: - payload.Properties1['Key Attributes'] = 'Key Pressed 3 times'; - break; - case 5: - payload.Properties1['Key Attributes'] = 'Key Pressed 4 times'; - break; - case 6: - payload.Properties1['Key Attributes'] = 'Key Pressed 5 times'; - break; - } - } - } - - if (this._reportListeners[commandClassId] && - this._reportListeners[commandClassId][command.name]) { - this._reportListeners[commandClassId][command.name](payload); - } - }); - } - - /** - * Register a multi channel report listener, which is called when a report has been received. - * @param {number} multiChannelNodeId - The multi channel node id - * @param {string} commandClassId - The ID of the Command Class (e.g. `BASIC`) - * @param {string} commandId - The ID of the Command (e.g. `BASIC_REPORT`) - * @param {Function} triggerFn - * @param {Object} triggerFn.report - The received report - */ - registerMultiChannelReportListener(multiChannelNodeId, commandClassId, commandId, triggerFn) { - // Check for valid multi channel nodes - if (!this.node.MultiChannelNodes || - !this.node.MultiChannelNodes[multiChannelNodeId] || - (Array.isArray(this.node.MultiChannelNodes) && this.node.MultiChannelNodes.length === 0)) { - return this.error('Invalid multi channel node', multiChannelNodeId); - } - - const commandClass = this.node.MultiChannelNodes[multiChannelNodeId].CommandClass[`COMMAND_CLASS_${commandClassId}`]; - if (typeof commandClass === 'undefined') return this.error('Invalid commandClass:', commandClassId); - - this._reportListeners[commandClassId] = this._reportListeners[commandClassId] || {}; - this._reportListeners[commandClassId][`${multiChannelNodeId}_${commandId}`] = triggerFn; - - commandClass.on('report', (command, payload) => { - if (command.name !== commandId) return; - if (typeof this._reportListeners[commandClassId][`${multiChannelNodeId}_${command.name}`] === 'function') { - this._reportListeners[commandClassId][`${multiChannelNodeId}_${command.name}`](payload); - } - }); - } - - /** - * Method that will check if the node has the provided command class - * @param {string} commandClassId - For example: SWITCH_BINARY - * @param {Object} opts - * @param {number} opts.multiChannelNodeId - Multi channel node id to check for command class - * @returns {boolean} - */ - hasCommandClass(commandClassId, opts = {}) { - if (Object.prototype.hasOwnProperty.call(opts, 'multiChannelNodeId')) { - if (typeof opts.multiChannelNodeId !== 'number') throw new Error('multi_channel_node_id_must_be_number'); - return !!( - Object.prototype.hasOwnProperty.call(this.node, 'MultiChannelNodes') && - this.node.MultiChannelNodes[opts.multiChannelNodeId] && - this.node.MultiChannelNodes[opts.multiChannelNodeId].CommandClass[`COMMAND_CLASS_${commandClassId}`] - ); - } - return !(typeof this.node.CommandClass[`COMMAND_CLASS_${commandClassId}`] === 'undefined'); - } - - /** - * Method that gets a CommandClass object by commandClassId. Optionally, it can get the object on a multichannel node - * if the multiChannelNodeId is provided. - * @param {String} commandClassId - * @param {Object} opts - * @param {Number} opts.multiChannelNodeId - Provide this id if the command class should be located on a mc node. - * @returns {Error|boolean|*} - */ - getCommandClass(commandClassId, opts = {}) { - if (Object.prototype.hasOwnProperty.call(opts, 'multiChannelNodeId')) { - if (typeof opts.multiChannelNodeId !== 'number') throw new Error('multi_channel_node_id_must_be_number'); - if (!this.hasCommandClass(commandClassId, { multiChannelNodeId: opts.multiChannelNodeId })) { - return new Error(`multi_channel_node_${opts.multiChannelNodeId}_is_missing_command_class_${commandClassId}`); - } - return this.node.MultiChannelNodes[opts.multiChannelNodeId].CommandClass[`COMMAND_CLASS_${commandClassId}`]; - } - if (!this.hasCommandClass(commandClassId)) return new Error(`missing_command_class_${commandClassId}`); - return this.node.CommandClass[`COMMAND_CLASS_${commandClassId}`]; - } - - /** - * Method that gets all multi channel node ids that have a specific deviceClassGeneric. - * @param {String} deviceClassGeneric - * @returns {Array} - */ - getMultiChannelNodeIdsByDeviceClassGeneric(deviceClassGeneric){ - if (!Object.prototype.hasOwnProperty.call(this.node, 'MultiChannelNodes')) return []; - const foundNodeIds = []; - for (const i in this.node.MultiChannelNodes) { - if (this.node.MultiChannelNodes[i].deviceClassGeneric === deviceClassGeneric) { - foundNodeIds.push(Number(i)) - } - } - return foundNodeIds; - } - - /** - * This method executes the capability set command for a given capability/commandClass combination. The capability - * and commandClass must be registered before this method is called. - * @param {string} capabilityId - * @param {string} commandClassId - * @param {Mixed} value - the capability value to set (e.g 0 - 1 for dim) - * @param {Object} opts - capability options object - * @returns {Promise} - */ - async executeCapabilitySetCommand(capabilityId, commandClassId, value, opts = {}) { - return this._setCapabilityValue(capabilityId, commandClassId, value, opts); - } - - - /** - * Method that resets the accumulated power meter value on the node. It tries to find the root node of the device - * and then looks for the COMMAND_CLASS_METER. - * @param multiChannelNodeId - define the multi channel node id in case the COMMAND_CLASS_METER is on a multi channel node - * @returns {Promise} - */ - async meterReset({ multiChannelNodeId } = {}) { - - // Get command class object (on mc node if needed) - let commandClassMeter = null; - if (typeof multiChannelNodeId === 'number') { - commandClassMeter = this.getCommandClass('METER', { multiChannelNodeId }); - } else { - commandClassMeter = this.getCommandClass('METER'); - } - - if (commandClassMeter && commandClassMeter.hasOwnProperty('METER_RESET')) { - return new Promise((resolve, reject) => { - commandClassMeter.METER_RESET({}, (err, result) => { - if (err || result !== 'TRANSMIT_COMPLETE_OK') return reject(err || result); - return resolve(); - }); - }); - } - return Promise.reject(new Error('missing_meter_reset_command')); - } - - /** - * Wrapper for CONFIGURATION_SET. Provide options.id and/or options.index and options.size. By default - * options.useSettingParser is true, then the value will first be parsed by the registered setting parser or the - * system parser before sending. It will only be able to use the registered setting parser if options.id is provided. - * @param options - * @param options.index - * @param options.size - * @param options.id - * @param [options.signed] - * @param [options.useSettingParser=true] - * @param value - * @returns {Promise.<*>} - */ - async configurationSet(options = {}, value) { - if (!options.hasOwnProperty('index') && !options.hasOwnProperty('id')) return Promise.reject(new Error('missing_setting_index_or_id')); - if (options.hasOwnProperty('index') && !options.hasOwnProperty('size')) return Promise.reject(new Error('missing_setting_size')); - if (options.hasOwnProperty('id') && (!options.hasOwnProperty('size') || !options.hasOwnProperty('index') || !options.hasOwnProperty('signed'))) { - - // Fetch information from manifest by setting id - const settingObj = this.getManifestSetting(options.id); - if (settingObj instanceof Error) return Promise.reject(new Error('invalid_setting_id')); - if (!settingObj.hasOwnProperty('zwave') || !settingObj.zwave.hasOwnProperty('index') || - !settingObj.zwave.hasOwnProperty('size') || typeof settingObj.zwave.index !== 'number' || - typeof settingObj.zwave.size !== 'number') { - - return Promise.reject(new Error('missing_valid_zwave_setting_object')); - } - options.index = settingObj.zwave.index; - options.size = settingObj.zwave.size; - - if (!options.hasOwnProperty('signed')) { - options.signed = (settingObj.zwave.hasOwnProperty('signed')) ? settingObj.zwave.signed : true; - } - } - - // Check if device has command class - const commandClassConfiguration = this.getCommandClass('CONFIGURATION'); - if (commandClassConfiguration instanceof Error || - typeof commandClassConfiguration.CONFIGURATION_SET !== 'function') { - this.error('Missing COMMAND_CLASS_CONFIGURATION'); - return Promise.reject(new Error('missing_command_class_configuration')); - } - - // If desired the input value can be parsed by the provided parser or the system parser - let parsedValue = null; - if (!options.hasOwnProperty('useSettingParser') || options.useSettingParser === true) { - parsedValue = this._parseSetting(options, value); - if (parsedValue instanceof Error) return Promise.reject(parsedValue); - } else if (!Buffer.isBuffer(value)) { - return Promise.reject(new Error('invalid_value_type')); - } - - return new Promise((resolve, reject) => { - commandClassConfiguration.CONFIGURATION_SET({ - 'Parameter Number': options.index, - Level: { - Size: options.size, - Default: false, - }, - 'Configuration Value': parsedValue || value, - }, (err, result) => { - const parsedBufValue = parsedValue.toString('hex').toUpperCase(); - let parsedDecValue; - - try { - if (!options.hasOwnProperty('signed') || options.signed === true) parsedDecValue = parsedValue.readIntBE(0, options.size); - else parsedDecValue = parsedValue.readUIntBE(0, options.size); - } catch (error) { - this.error('failed to read the buffer value', error); - parsedDecValue = 'N/A'; - } - - if (err) { - this.error(`configurationSet() -> failed to set configuration parameter ${options.index}, size: ${options.size} to ${value} (parsed: ${parsedDecValue} / 0x${parsedBufValue})`); - return reject(err); - } - this.log(`configurationSet() -> successfully set ${options.index}, size: ${options.size} to ${value} (parsed: ${parsedDecValue} / 0x${parsedBufValue})`); - return resolve(result); - }); - - // If battery device which is offline, setting will be saved later, continue - if (this.node.battery === true && this.node.online === false) return resolve(); - }); - } - - /** - * Method that retrieves the value of a configuration parameter from the node. - * @param {Object} options - * @param {number} options.index - Parameter index - * @returns {*} - */ - async configurationGet(options = {}) { - if (!options.hasOwnProperty('index')) return Promise.reject(new Error('missing_index')); - if (this.node.battery === true && this.node.online === false) return Promise.reject(new Error('cannot_get_parameter_from_battery_node')); - - // Check if device has command class - const commandClassConfiguration = this.getCommandClass('CONFIGURATION'); - if (commandClassConfiguration instanceof Error || - typeof commandClassConfiguration.CONFIGURATION_GET !== 'function') { - this.error('Missing COMMAND_CLASS_CONFIGURATION'); - return Promise.reject(new Error('missing_command_class_configuration')); - } - - return commandClassConfiguration.CONFIGURATION_GET({ - 'Parameter Number': options.index, - }); - } - - /** - * Method that flattens possibly nested settings and returns a flat settings array. - * @returns {Array} - */ - getManifestSettings() { - if (!this.manifestSettings) { - const manifest = this.getDriver().getManifest(); - if (!manifest || !manifest.settings) return this.manifestSettings = []; - - const flattenSettings = (settings) => settings.reduce((manifestSettings, setting) => { - if (setting.type === 'group') { - return manifestSettings.concat(flattenSettings(setting.children)); - } - manifestSettings.push(setting); - return manifestSettings; - }, []); - - this.manifestSettings = flattenSettings(manifest.settings); - } - return this.manifestSettings; - } - - /** - * Get a specific setting object from the manifest - * @param id - Setting id to retrieve - * @returns {Object|Error} - */ - getManifestSetting(id) { - const settings = this.getManifestSettings(); - if (Array.isArray(settings)) return settings.find(setting => setting.id === id); - return new Error(`missing_setting_id_${id}`); - } - - /** - * Method that refreshes the capability value once. If you want to poll this value please use - * the parameter getOpts.pollInterval at {@link ZwaveDevice#registerCapability} - * @param {String} capabilityId, the string id of the Homey capability - * @param {String} commandClassId, the Z-Wave command class used for this request - * @returns {Promise} - */ - async refreshCapabilityValue(capabilityId, commandClassId) { - return this._getCapabilityValue(capabilityId, commandClassId); - } - - /** - * Prints oneliner node summary, e.g. firmware information and device identifiers. - */ - printNodeSummary() { - let logSummary = `Node: ${this.node.nodeId}`; - if (this._hasProp(this.node, 'manufacturerId') && this._hasProp(this.node.manufacturerId, 'value')) { - logSummary += ` | Manufacturer id: ${this.node.manufacturerId.value}` - } - if (this._hasProp(this.node, 'productTypeId') && this._hasProp(this.node.productTypeId, 'value')) { - logSummary += ` | ProductType id: ${this.node.productTypeId.value}` - } - if (this._hasProp(this.node, 'productId') && this._hasProp(this.node.productId, 'value')) { - logSummary += ` | Product id: ${this.node.productId.value}` - } - if (this._hasProp(this.getSettings(), 'zw_application_version') && this._hasProp(this.getSettings(), 'zw_application_sub_version')) { - logSummary += ` | Firmware Version: ${this.getSetting('zw_application_version')}.${this.getSetting('zw_application_sub_version')}` - } - if (this._hasProp(this.getSettings(), 'zw_hardware_version')) { - logSummary += ` | Hardware Version: ${this.getSetting('zw_hardware_version')}` - } - if (this._hasProp(this.node, 'firmwareId')) { - logSummary += ` | Firmware id: ${this.node.firmwareId}` - } - // Loop additional firmware targets - let i = 1; - Object.keys(this.getSettings()) - .filter(key => key.includes('zw_application_version_')) - .forEach(key => { - logSummary += ` | Firmware Version Target ${1}: ${this.getSetting(`zw_application_version_${i}`)}.${this.getSetting(`zw_application_sub_version_${i}`)}` - i++; - }); - - if (this._hasProp(this.getSettings(), 'zw_secure')) { - logSummary += ` | Secure: ${this.getSetting('zw_secure')}` - } - - logSummary += ` | Battery: ${this.node.battery}` - - this.log(logSummary); - } - - /** - * Print the current Node information with Command Classes and their versions - */ - printNode() { - this.log('------------------------------------------'); - - // log the entire Node - this.log('Node:', this.node.nodeId); - if (this._hasProp(this.node, 'manufacturerId') && this._hasProp(this.node.manufacturerId, 'value')) { - this.log('- Manufacturer id:', this.node.manufacturerId.value); - } - if (this._hasProp(this.node, 'productTypeId') && this._hasProp(this.node.productTypeId, 'value')) { - this.log('- ProductType id:', this.node.productTypeId.value); - } - if (this._hasProp(this.node, 'productId') && this._hasProp(this.node.productId, 'value')) { - this.log('- Product id:', this.node.productId.value); - } - if (this._hasProp(this.getSettings(), 'zw_application_version') && this._hasProp(this.getSettings(), 'zw_application_sub_version')) { - this.log('- Firmware Version:', `${this.getSetting('zw_application_version')}.${this.getSetting('zw_application_sub_version')}`); - } - if (this._hasProp(this.getSettings(), 'zw_hardware_version')) { - this.log('- Hardware Version:', this.getSetting('zw_hardware_version')); - } - if (this._hasProp(this.node, 'firmwareId')) { - this.log('- Firmware id:', this.node.firmwareId); - } - // Loop additional firmware targets - let i = 1; - Object.keys(this.getSettings()) - .filter(key => key.includes('zw_application_version_')) - .forEach(key => { - this.log(`- Firmware Version Target ${1}:`, `${this.getSetting(`zw_application_version_${i}`)}.${this.getSetting(`zw_application_sub_version_${i}`)}`); - i++; - }); - - if (this._hasProp(this.getSettings(), 'zw_secure')) { - this.log('- Secure:', this.getSetting('zw_secure')) - } - - this.log('- Battery:', this.node.battery); - - this.log('- DeviceClassBasic:', this.node.deviceClassBasic); - this.log('- DeviceClassGeneric:', this.node.deviceClassGeneric); - this.log('- DeviceClassSpecific:', this.node.deviceClassSpecific); - this.log('- Token:', this.getData().token); - - Object.keys(this.node.CommandClass).forEach(commandClassId => { - this.log('- CommandClass:', commandClassId); - this.log('-- Version:', this.node.CommandClass[commandClassId].version); - this.log('-- Commands:'); - - Object.keys(this.node.CommandClass[commandClassId]).forEach(key => { - if (typeof this.node.CommandClass[commandClassId][key] === 'function' && key === key.toUpperCase()) { - this.log('---', key); - } - }); - }); - - if (this.node.MultiChannelNodes) { - Object.keys(this.node.MultiChannelNodes).forEach(multiChannelNodeId => { - this.log('- MultiChannelNode:', multiChannelNodeId); - this.log('- DeviceClassGeneric:', this.node.MultiChannelNodes[multiChannelNodeId].deviceClassGeneric); - - Object.keys(this.node.MultiChannelNodes[multiChannelNodeId].CommandClass).forEach(commandClassId => { - this.log('-- CommandClass:', commandClassId); - this.log('--- Version:', - this.node.MultiChannelNodes[multiChannelNodeId].CommandClass[commandClassId].version); - this.log('--- Commands:'); - - Object - .keys(this.node.MultiChannelNodes[multiChannelNodeId].CommandClass[commandClassId]) - .forEach(key => { - if (typeof this.node.MultiChannelNodes[multiChannelNodeId].CommandClass[commandClassId][key] === - 'function' && key === key.toUpperCase()) { - this.log('----', key); - } - }); - }); - }); - } - - this.log('------------------------------------------'); - this.log(''); - } - - /** - * Enable debug logging on this device. Logs all incoming reports. - */ - enableDebug() { - super.enableDebug(); - - Object.keys(this.node.CommandClass).forEach(commandClassId => { - this.node.CommandClass[commandClassId].on('report', function () { - this.log(`node.CommandClass['${commandClassId}'].on('report')`, 'arguments:', arguments); - }.bind(this)); - }); - - if (this.node.MultiChannelNodes) { - Object.keys(this.node.MultiChannelNodes).forEach(multiChannelNodeId => { - Object.keys(this.node.MultiChannelNodes[multiChannelNodeId].CommandClass).forEach(commandClassId => { - this.node.MultiChannelNodes[multiChannelNodeId].CommandClass[commandClassId].on('report', function () { - this.log(`node.MultiChannelNodes['${multiChannelNodeId}']. - CommandClass['${commandClassId}'].on('report')`, 'arguments:', arguments); - }.bind(this)); - }); - }); - } - } - - /** - * Utility method to check if an object has a property. - * @param {*} object - * @param {*} prop - */ - _hasProp(object, prop) { - return object && Object.prototype.hasOwnProperty.call(object, prop); - } -} - -module.exports = ZwaveDevice; diff --git a/node_modules/homey-meshdriver/lib/zwave/ZwaveLightDevice.js b/node_modules/homey-meshdriver/lib/zwave/ZwaveLightDevice.js deleted file mode 100644 index d7b0b08..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/ZwaveLightDevice.js +++ /dev/null @@ -1,282 +0,0 @@ -'use strict'; - -const ZwaveDevice = require('homey-meshdriver').ZwaveDevice; -const Utils = require('homey-meshdriver').Util; -const FACTORY_DEFAULT_COLOR_DURATION = 255; -let debounceColorMode; - -/** - * ZwaveLightDevice takes care of all commands used by XY Lighting devices (COMMAND_CLASS_SWITCH_COLOR). - * Set the capabilitiesOptions "setOnDim" to false for the onoff capability - * - * Duration(s) can be given for: - * - dim (SWITCH_MULTILEVEL >= V2) - * - light_hue (SWITCH_COLOR >= V2) - * - light_saturation (SWITCH_COLOR >= V2) - * - light_temperature (SWITCH_COLOR >= V2) - * - * @extends ZwaveDevice - * @example - * - * // app.json - * { - * "id": YOUR_APP_ID, - * ... - * "drivers": [ - * { - * "id": "YOUR_DRIVER_ID", - * "capabilitiesOptions": { - * "onoff": { - * "setOnDim": false - * }, - * "dim": { - * "opts": { - * "duration": true - * } - * }, - * "light_hue": { - * "opts": { - * "duration": true - * } - * }, - * "light_saturation": { - * "opts": { - * "duration": true - * } - * }, - * "light_temperature": { - * "opts": { - * "duration": true - * } - * } - * } - * ] - * } - * - * // device.js - * const ZwaveLightDevice = require('homey-meshdriver').ZwaveLightDevice; - * - * class myDevice extends ZwaveLightDevice { - * - * async onMeshInit() { - * - * await super.onMeshInit(); - * // YOUR CODE COMES HERE - * } - * } - */ - -class ZwaveLightDevice extends ZwaveDevice { - - onMeshInit() { - - // Check if all used capabilities are present - if (!this.hasCapability('onoff')) return this.error('Missing capability: onoff'); - if (!this.hasCapability('dim')) return this.error('Missing capability: dim'); - if (!this.hasCapability('light_mode')) return this.error('Missing capability: light_mode'); - if (!this.hasCapability('light_hue')) return this.error('Missing capability: light_hue'); - if (!this.hasCapability('light_saturation')) return this.error('Missing capability: light_saturation'); - if (!this.hasCapability('light_temperature')) return this.error('Missing capability: light_temperature'); - - // Register capabilities - if (this.hasCommandClass('SWITCH_MULTILEVEL')) { - this.registerCapability('onoff', 'SWITCH_MULTILEVEL'); - this.registerCapability('dim', 'SWITCH_MULTILEVEL'); - - // If Multilevel Switch is not available fall back to basic - } else if (this.hasCommandClass('BASIC')) { - this.registerCapability('onoff', 'BASIC'); - this.registerCapability('dim', 'BASIC'); - - } - - this.registerMultipleCapabilityListener(['light_hue', 'light_saturation'], async (values, options) => { - let hue; - let saturation; - - typeof values.light_hue === 'number' ? hue = values.light_hue : hue = this.getCapabilityValue('light_hue'); - typeof values.light_saturation === 'number' ? saturation = values.light_saturation : saturation = this.getCapabilityValue('light_saturation'); - const value = 1; // brightness value is not determined in SWITCH_COLOR but with SWITCH_MULTILEVEL, changing this throws the dim value vs real life brightness out of sync - - const rgb = Utils.convertHSVToRGB({ hue, saturation, value }); - - debounceColorMode = setTimeout(() => { - debounceColorMode = false; - }, 200); - - let duration = null; - if (options.hasOwnProperty('light_hue') && options.light_hue.hasOwnProperty('duration')) { - duration = options.light_hue.duration; - } - if (!duration && options.hasOwnProperty('light_saturation') && options.light_saturation.hasOwnProperty('duration')) { - duration = options.light_saturation.duration; - } - - return await this._sendColors({ - warm: 0, - cold: 0, - red: rgb.red, - green: rgb.green, - blue: rgb.blue, - duration, - }); - }); - - this.registerCapabilityListener(['light_temperature'], async (value, options) => { - const warm = Math.floor(value * 255); - const cold = Math.floor((1 - value) * 255); - - debounceColorMode = setTimeout(() => { - debounceColorMode = false; - }, 200); - - let duration = null; - if (options.hasOwnProperty('duration')) duration = options.duration; - - return await this._sendColors({ - warm, - cold, - red: 0, - green: 0, - blue: 0, - duration, - }); - }); - - this.registerCapability('light_mode', 'SWITCH_COLOR', { - set: 'SWITCH_COLOR_SET', - setParser: (value, options) => { - - // set light_mode is always triggered with the set color/temperature flow cards, timeout is needed because of homey's async nature surpassing the debounce - setTimeout(async () => { - if (debounceColorMode) { - clearTimeout(debounceColorMode); - debounceColorMode = false; - return this.setCapabilityValue('light_mode', value); - } - - if (value === 'color') { - const hue = this.getCapabilityValue('light_hue') || 1; - const saturation = this.getCapabilityValue('light_saturation') || 1; - const _value = 1; // brightness value is not determined in SWITCH_COLOR but with SWITCH_MULTILEVEL, changing this throws the dim value vs real life brightness out of sync - - const rgb = Utils.convertHSVToRGB({ hue, saturation, _value }); - - return await this._sendColors({ - warm: 0, - cold: 0, - red: rgb.red, - green: rgb.green, - blue: rgb.blue, - duration: options.duration || null, - }); - - } else if (value === 'temperature') { - const temperature = this.getCapabilityValue('light_temperature') || 1; - const warm = temperature * 255; - const cold = (1 - temperature) * 255; - - return await this._sendColors({ - warm, - cold, - red: 0, - green: 0, - blue: 0, - duration: options.duration || null, - }); - } - }, 50); - return null; - }, - }); - - // Getting all color values during boot - const commandClassColorSwitch = this.getCommandClass('SWITCH_COLOR'); - if (!(commandClassColorSwitch instanceof Error) && typeof commandClassColorSwitch.SWITCH_COLOR_GET === 'function') { - - // Timeout mandatory for stability, often fails getting 1 (or more) value without it - setTimeout(() => { - - // Wait for all color values to arrive - Promise.all([this._getColorValue(0), this._getColorValue(1), this._getColorValue(2), this._getColorValue(3), this._getColorValue(4)]) - .then(result => { - if (result[0] === 0 && result[1] === 0) { - const hsv = Utils.convertRGBToHSV({ - red: result[2], - green: result[3], - blue: result[4], - }); - - this.setCapabilityValue('light_mode', 'color'); - this.setCapabilityValue('light_hue', hsv.hue); - this.setCapabilityValue('light_saturation', hsv.saturation); - } else { - const temperature = Math.round(result[0] / 255 * 100) / 100; - this.setCapabilityValue('light_mode', 'temperature'); - this.setCapabilityValue('light_temperature', temperature); - } - }); - }, 500); - } - } - - async _getColorValue(colorComponentID) { - const commandClassColorSwitch = this.getCommandClass('SWITCH_COLOR'); - if (!(commandClassColorSwitch instanceof Error) && typeof commandClassColorSwitch.SWITCH_COLOR_GET === 'function') { - - try { - const result = await commandClassColorSwitch.SWITCH_COLOR_GET({ 'Color Component ID': colorComponentID }); - return (result && typeof result.Value === 'number') ? result.Value : 0; - } catch (err) { - this.error(err); - return 0; - } - } - return 0; - } - - async _sendColors({ warm, cold, red, green, blue, duration }) { - const SwitchColorVersion = this.getCommandClass('SWITCH_COLOR').version || 1; - - let setCommand = { - Properties1: { - 'Color Component Count': 5, - }, - vg1: [ - { - 'Color Component ID': 0, - Value: Math.round(warm), - }, - { - 'Color Component ID': 1, - Value: Math.round(cold), - }, - { - 'Color Component ID': 2, - Value: Math.round(red), - }, - { - 'Color Component ID': 3, - Value: Math.round(green), - }, - { - 'Color Component ID': 4, - Value: Math.round(blue), - }, - ], - }; - - if (SwitchColorVersion > 1) { - setCommand.duration = typeof duration !== 'number' ? FACTORY_DEFAULT_COLOR_DURATION : Utils.calculateZwaveDimDuration(duration); - } - - // Fix broken CC_SWITCH_COLOR_V2 parser - if (SwitchColorVersion === 2) { - setCommand = new Buffer([setCommand.Properties1['Color Component Count'], 0, setCommand.vg1[0].Value, 1, setCommand.vg1[1].Value, 2, setCommand.vg1[2].Value, 3, setCommand.vg1[3].Value, 4, setCommand.vg1[4].Value, setCommand.duration]); - } - - return this.node.CommandClass.COMMAND_CLASS_SWITCH_COLOR.SWITCH_COLOR_SET(setCommand); - } -} - -module.exports = ZwaveLightDevice; diff --git a/node_modules/homey-meshdriver/lib/zwave/ZwaveLockDevice.js b/node_modules/homey-meshdriver/lib/zwave/ZwaveLockDevice.js deleted file mode 100644 index c57f14e..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/ZwaveLockDevice.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; - -const Homey = require('homey'); -const ZwaveDevice = require('./ZwaveDevice'); - -/** - * The ZwaveLockDevice class has built-in functionality for the lockJammed FlowCardTrigger. Note: this FlowCardAction - * will only be triggered if the NOTIFICATION command class is registered for the 'locked' capability. - * @extends ZwaveDevice - * @example - * - * // device.js - * const ZwaveLockDevice = require('homey-meshdriver').ZwaveLockDevice; - * - * class myDevice extends ZwaveLockDevice { - * - * async onMeshInit() { - * await super.onMeshInit(); - * this.registerCapability('locked', 'DOOR_LOCK'); - * this.registerCapability('locked', 'NOTIFICATION'); - * this.registerCapability('measure_battery', 'BATTERY'); - * } - * } - * - * // app.json (or see zwave/system/flows.json) - * flow: { - * triggers: [ - * { - * "id": "lockJammed", - * "title": { - * "en": "The lock is jammed", - * "nl": "Het slot is geblokkeerd" - * }, - * "hint": { - * "en": "While trying to close the lock something obstructed the lock from closing completely.", - * "nl": "Tijdens het sluiten van het slot blokkeerde er iets waardoor het slot niet kon worden gesloten." - * }, - * "args": [ - * { - * "name": "device", - * "type": "device", - * "filter": "" - * } - * ] - * } - * ] - * } - */ -class ZwaveLockDevice extends ZwaveDevice { - async onMeshInit() { - - // Register Flow card trigger - const lockJammedFlowTrigger = new Homey.FlowCardTriggerDevice('lockJammed'); - lockJammedFlowTrigger.register(); - - // Check if Flow card is registered in app manifest - if (!(lockJammedFlowTrigger instanceof Error)) { - - // Handle lock jammed notification - this.on('lockJammedNotification', async () => { - this.log('lock jammed notification'); - try { - await lockJammedFlowTrigger.trigger(this, {}, {}); - } catch (err) { - this.error('failed_to_trigger_lock_jammed_flow', err); - } - }); - } else this.error('missing_lockJammed_flow_card_in_manifest'); - } -} - -module.exports = ZwaveLockDevice; diff --git a/node_modules/homey-meshdriver/lib/zwave/ZwaveMeteringDevice.js b/node_modules/homey-meshdriver/lib/zwave/ZwaveMeteringDevice.js deleted file mode 100644 index 5a3eee5..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/ZwaveMeteringDevice.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -const ZwaveDevice = require('./ZwaveDevice'); - -/** - * The ZwaveMeteringDevice class. Warning, the METER_RESET FlowCardAction should not be used, remove the FlowCard from your app manifest - * @extends ZwaveDevice - * @example - * - * // device.js - * const ZwaveMeteringDevice = require('homey-meshdriver').ZwaveMeteringDevice; - * - * class myDevice extends ZwaveMeteringDevice { - * - * async onMeshInit() { - * await super.onMeshInit(); - * this.registerCapability('measure_power', 'METER'); - * this.registerCapability('meter_power', 'METER'); - * } - * } - * - */ -class ZwaveMeteringDevice extends ZwaveDevice { - async onMeshInit() { - this.log('WARNING: the METER_RESET FlowCardAction should not be used, remove the FlowCard from your app manifest.'); - } -} - -module.exports = ZwaveMeteringDevice; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/NOTIFICATION.js deleted file mode 100644 index e6f4130..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/NOTIFICATION.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -module.exports = { - get: 'NOTIFICATION_GET', - getParser: () => ({ - 'V1 Alarm Type': 0, - 'Notification Type': 'CO', - Event: 2, - }), - report: 'NOTIFICATION_REPORT', - reportParser: report => { - if (report && report['Notification Type'] === 'CO' && report.hasOwnProperty('Event (Parsed)')) { - - if (report['Event (Parsed)'] === 'Carbon monoxide detected' || - report['Event (Parsed)'] === 'Carbon monoxide detected, Unknown Location' || - report['Event (Parsed)'] === 'Carbon monoxide Test') { - return true; - } - - if (report['Event (Parsed)'] === 'Event inactive' && (!report.hasOwnProperty('Event Parameter') || - typeof report['Event Parameter'][0] === 'undefined' || - report['Event Parameter'][0] === 1 || - report['Event Parameter'][0] === 2 || - report['Event Parameter'][0] === 3)) { - return false; - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/SENSOR_ALARM.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/SENSOR_ALARM.js deleted file mode 100644 index 9b2b8fa..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/SENSOR_ALARM.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_ALARM_GET', - getParser: () => ({ - 'Sensor Type': 'CO Alarm', - }), - report: 'SENSOR_ALARM_REPORT', - reportParser: report => { - if (report && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'CO Alarm' && - report.hasOwnProperty('Sensor State')) { - return report['Sensor State'] === 'alarm'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/SENSOR_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/SENSOR_BINARY.js deleted file mode 100644 index da90271..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co/SENSOR_BINARY.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_BINARY_GET', - getParser: () => ({ - 'Sensor Type': 'CO', - }), - report: 'SENSOR_BINARY_REPORT', - reportParserV1: report => { - if (report && - report.hasOwnProperty('Sensor Value')) { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Sensor Value') && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'CO') { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/NOTIFICATION.js deleted file mode 100644 index 9622da0..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/NOTIFICATION.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -module.exports = { - get: 'NOTIFICATION_GET', - getParser: () => ({ - 'V1 Alarm Type': 0, - 'Notification Type': 'CO2', - Event: 2, - }), - report: 'NOTIFICATION_REPORT', - reportParser: report => { - if (report && report['Notification Type'] === 'CO2' && report.hasOwnProperty('Event (Parsed)')) { - - if (report['Event (Parsed)'] === 'Carbon dioxide detected' || - report['Event (Parsed)'] === 'Carbon dioxide detected, Unknown Location' || - (report['Event (Parsed)'] === 'Carbon dioxide Test' && - report['Event Parameter'][0] === 1)) { - return true; - } - - if (report['Event (Parsed)'] === 'Event inactive' && (!report.hasOwnProperty('Event Parameter') || - typeof report['Event Parameter'][0] === 'undefined' || - report['Event Parameter'][0] === 1 || - report['Event Parameter'][0] === 2 || - report['Event Parameter'][0] === 3)) { - return false; - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/SENSOR_ALARM.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/SENSOR_ALARM.js deleted file mode 100644 index 3ab8f09..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/SENSOR_ALARM.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_ALARM_GET', - getParser: () => ({ - 'Sensor Type': 'CO2 Alarm', - }), - report: 'SENSOR_ALARM_REPORT', - reportParser: report => { - if (report && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'CO2 Alarm' && - report.hasOwnProperty('Sensor State')) { - return report['Sensor State'] === 'alarm'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/SENSOR_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/SENSOR_BINARY.js deleted file mode 100644 index 93961b8..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_co2/SENSOR_BINARY.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_BINARY_GET', - getParser: () => ({ - 'Sensor Type': 'CO2', - }), - report: 'SENSOR_BINARY_REPORT', - reportParserV1: report => { - if (report && report.hasOwnProperty('Sensor Value')) { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Sensor Value') && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'CO2') { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/BASIC.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/BASIC.js deleted file mode 100644 index 641200c..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/BASIC.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -module.exports = { - report: 'BASIC_SET', - reportParser: report => { - if (report && report.hasOwnProperty('Value')) { - return report.Value === 255; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/NOTIFICATION.js deleted file mode 100644 index e103280..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/NOTIFICATION.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -module.exports = { - get: 'NOTIFICATION_GET', - getOpts: { - getOnOnline: true, - }, - getParser: () => ({ - 'V1 Alarm Type': 0, - Event: 23, - 'Notification Type': 'Access Control', - }), - report: 'NOTIFICATION_REPORT', - reportParser: report => { - if (report && report['Notification Type'] === 'Access Control' && report.hasOwnProperty('Event (Parsed)')) { - if (report['Event (Parsed)'] === 'Window/Door is open') return true; - if (report['Event (Parsed)'] === 'Window/Door is closed') return false; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/SENSOR_ALARM.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/SENSOR_ALARM.js deleted file mode 100644 index b4f1e23..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/SENSOR_ALARM.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_ALARM_GET', - getParser: () => ({ - 'Sensor Type': 'General Purpose Alarm', - }), - report: 'SENSOR_ALARM_REPORT', - reportParser: report => { - if (report && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'General Purpose Alarm' && - report.hasOwnProperty('Sensor State')) { - return report['Sensor State'] === 'alarm'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/SENSOR_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/SENSOR_BINARY.js deleted file mode 100644 index 1f0954f..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_contact/SENSOR_BINARY.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_BINARY_GET', - getParser: () => ({ - 'Sensor Type': 'Door/Window', - }), - report: 'SENSOR_BINARY_REPORT', - reportParserV1: report => { - if (report && report.hasOwnProperty('Sensor Value')) { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Sensor Value') && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Door/Window') { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/NOTIFICATION.js deleted file mode 100644 index e087739..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/NOTIFICATION.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -module.exports = { - get: 'NOTIFICATION_GET', - getParser: () => ({ - 'V1 Alarm Type': 0, - 'Notification Type': 'Heat', - Event: 2, - }), - report: 'NOTIFICATION_REPORT', - reportParser: report => { - if (report && report['Notification Type'] === 'Heat' && report.hasOwnProperty('Event (Parsed)')) { - - if (report['Event (Parsed)'] === 'Overheat detected' || - report['Event (Parsed)'] === 'Overheat detected, Unknown Location' || - report['Event (Parsed)'] === 'Rapid Temperature Rise' || - report['Event (Parsed)'] === 'Rapid Temperature Rise, Unknown Location' || - report['Event (Parsed)'] === 'Heat Alarm Test') { - return true; - } - - if (report['Event (Parsed)'] === 'Event inactive' && (!report.hasOwnProperty('Event Parameter') || - typeof report['Event Parameter'][0] === 'undefined' || - report['Event Parameter'][0] === 1 || - report['Event Parameter'][0] === 2 || - report['Event Parameter'][0] === 3 || - report['Event Parameter'][0] === 4 || - report['Event Parameter'][0] === 7)) { - return false; - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/SENSOR_ALARM.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/SENSOR_ALARM.js deleted file mode 100644 index 7fbca7a..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/SENSOR_ALARM.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_ALARM_GET', - getParser: () => ({ - 'Sensor Type': 'Heat Alarm', - }), - report: 'SENSOR_ALARM_REPORT', - reportParser: report => { - if (report && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Heat Alarm' && - report.hasOwnProperty('Sensor State')) { - return report['Sensor State'] === 'alarm'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/SENSOR_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/SENSOR_BINARY.js deleted file mode 100644 index 08ca379..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_heat/SENSOR_BINARY.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_BINARY_GET', - getParser: () => ({ - 'Sensor Type': 'Heat', - }), - report: 'SENSOR_BINARY_REPORT', - reportParserV1: report => { - if (report && report.hasOwnProperty('Sensor Value')) { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Sensor Value') && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Heat') { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_motion/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_motion/NOTIFICATION.js deleted file mode 100644 index d1aac79..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_motion/NOTIFICATION.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -module.exports = { - get: 'NOTIFICATION_GET', - getParser: () => ({ - 'V1 Alarm Type': 0, - 'Notification Type': 'Home Security', - Event: 8, - }), - report: 'NOTIFICATION_REPORT', - reportParser: report => { - if (report && report['Notification Type'] === 'Home Security' && report.hasOwnProperty('Event (Parsed)')) { - - if (report['Event (Parsed)'] === 'Motion Detection' || - report['Event (Parsed)'] === 'Motion Detection, Unknown Location') { - return true; - } - - if (report['Event (Parsed)'] === 'Event inactive' && (!report.hasOwnProperty('Event Parameter') || - typeof report['Event Parameter'][0] === 'undefined' || - report['Event Parameter'][0] === 7 || - report['Event Parameter'][0] === 8)) { - return false; - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_motion/SENSOR_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_motion/SENSOR_BINARY.js deleted file mode 100644 index f672d24..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_motion/SENSOR_BINARY.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_BINARY_GET', - getParser: () => ({ - 'Sensor Type': 'Motion', - }), - report: 'SENSOR_BINARY_REPORT', - reportParserV1: report => { - if (report && report.hasOwnProperty('Sensor Value')) { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Sensor Value') && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Motion') { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/NOTIFICATION.js deleted file mode 100644 index 81d9f01..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/NOTIFICATION.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -module.exports = { - get: 'NOTIFICATION_GET', - getParser: () => ({ - 'V1 Alarm Type': 0, - 'Notification Type': 'Smoke', - Event: 2, - }), - report: 'NOTIFICATION_REPORT', - reportParser: report => { - if (report && report['Notification Type'] === 'Smoke' && report.hasOwnProperty('Event (Parsed)')) { - - if (report['Event (Parsed)'] === 'Smoke detected' || - report['Event (Parsed)'] === 'Smoke detected, Unknown Location' || - report['Event (Parsed)'] === 'Smoke Alarm Test') { - return true; - } - - if (report['Event (Parsed)'] === 'Event inactive' && (!report.hasOwnProperty('Event Parameter') || - typeof report['Event Parameter'][0] === 'undefined' || - report['Event Parameter'][0] === 1 || - report['Event Parameter'][0] === 2 || - report['Event Parameter'][0] === 3)) { - return false; - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/SENSOR_ALARM.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/SENSOR_ALARM.js deleted file mode 100644 index e8022e2..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/SENSOR_ALARM.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_ALARM_GET', - getParser: () => ({ - 'Sensor Type': 'Smoke Alarm', - }), - report: 'SENSOR_ALARM_REPORT', - reportParser: report => { - if (report && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Smoke Alarm' && - report.hasOwnProperty('Sensor State')) { - return report['Sensor State'] === 'alarm'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/SENSOR_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/SENSOR_BINARY.js deleted file mode 100644 index 49a6cd0..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_smoke/SENSOR_BINARY.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_BINARY_GET', - getParser: () => ({ - 'Sensor Type': 'Smoke', - }), - report: 'SENSOR_BINARY_REPORT', - reportParserV1: report => { - if (report && report.hasOwnProperty('Sensor Value')) { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Sensor Value') && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Smoke') { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/NOTIFICATION.js deleted file mode 100644 index dba17df..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/NOTIFICATION.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -module.exports = { - get: 'NOTIFICATION_GET', - getOpts: { - getOnOnline: true, - }, - getParser: () => ({ - 'V1 Alarm Type': 0, - Event: 3, - 'Notification Type': 'Home Security', - }), - report: 'NOTIFICATION_REPORT', - reportParser: report => { - if ((report && report['Notification Type'] === 'Home Security' || - report['Notification Type'] === 'Burglar') && - report.hasOwnProperty('Event (Parsed)')) { - - if (report['Event (Parsed)'] === 'Tampering, Product covering removed' || - report['Event (Parsed)'] === 'Tampering, Invalid Code' || - report['Event (Parsed)'] === 'Tampering, Product Moved') { - return true; - } - if (report['Event (Parsed)'] === 'Event inactive' && (!report.hasOwnProperty('Event Parameter') || - typeof report['Event Parameter'][0] === 'undefined' || - report['Event Parameter'][0] === 3 || - report['Event Parameter'][0] === 4 || - report['Event Parameter'][0] === 9)) { - return false; - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/SENSOR_ALARM.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/SENSOR_ALARM.js deleted file mode 100644 index b4f1e23..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/SENSOR_ALARM.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_ALARM_GET', - getParser: () => ({ - 'Sensor Type': 'General Purpose Alarm', - }), - report: 'SENSOR_ALARM_REPORT', - reportParser: report => { - if (report && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'General Purpose Alarm' && - report.hasOwnProperty('Sensor State')) { - return report['Sensor State'] === 'alarm'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/SENSOR_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/SENSOR_BINARY.js deleted file mode 100644 index ae16473..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_tamper/SENSOR_BINARY.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_BINARY_GET', - getParser: () => ({ - 'Sensor Type': 'Tamper', - }), - report: 'SENSOR_BINARY_REPORT', - reportParserV1: report => { - if (report && report.hasOwnProperty('Sensor Value')) { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Sensor Value') && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Tamper') { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/NOTIFICATION.js deleted file mode 100644 index c3e5b16..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/NOTIFICATION.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -module.exports = { - get: 'NOTIFICATION_GET', - getParser: () => ({ - 'V1 Alarm Type': 0, - 'Notification Type': 'Water', - Event: 2, - }), - report: 'NOTIFICATION_REPORT', - reportParser: report => { - if (report['Notification Type'] === 'Water' && report.hasOwnProperty('Event (Parsed)')) { - - if (report['Event (Parsed)'] === 'Water Leak detected' || - report['Event (Parsed)'] === 'Water Leak detected, Unknown Location') { - return true; - } - - if (report['Event (Parsed)'] === 'Event inactive' && (!report.hasOwnProperty('Event Parameter') || - typeof report['Event Parameter'][0] === 'undefined' || - report['Event Parameter'][0] === 1 || - report['Event Parameter'][0] === 2)) { - return false; - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/SENSOR_ALARM.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/SENSOR_ALARM.js deleted file mode 100644 index 9b17a01..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/SENSOR_ALARM.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_ALARM_GET', - getParser: () => ({ - 'Sensor Type': 'Water Leak Alarm', - }), - report: 'SENSOR_ALARM_REPORT', - reportParser: report => { - if (report && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Water Leak Alarm' && - report.hasOwnProperty('Sensor State')) { - return report['Sensor State'] === 'alarm'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/SENSOR_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/SENSOR_BINARY.js deleted file mode 100644 index 6ff6cb1..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/alarm_water/SENSOR_BINARY.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_BINARY_GET', - getParser: () => ({ - 'Sensor Type': 'Water', - }), - report: 'SENSOR_BINARY_REPORT', - reportParserV1: report => { - if (report && report.hasOwnProperty('Sensor Value')) { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Sensor Value') && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Water') { - return report['Sensor Value'] === 'detected an event'; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/BASIC.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/BASIC.js deleted file mode 100644 index 4d62c15..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/BASIC.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -module.exports = { - get: 'BASIC_GET', - set: 'BASIC_SET', - setParser(value) { - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', value > 0); - return { - Value: Math.round(value * 99), - }; - }, - report: 'BASIC_REPORT', - reportParser(report) { - if (report && report.hasOwnProperty('Value')) { - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', report.Value > 0); - if (report.Value > 99) return 1; - return report.Value / 99; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/SWITCH_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/SWITCH_MULTILEVEL.js deleted file mode 100644 index b5b865f..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/SWITCH_MULTILEVEL.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const FACTORY_DEFAULT_DIMMING_DURATION_V2 = 'Factory default'; -const FACTORY_DEFAULT_DIMMING_DURATION_V4 = 'Default'; - -module.exports = { - get: 'SWITCH_MULTILEVEL_GET', - set: 'SWITCH_MULTILEVEL_SET', - getOpts: { - getOnStart: true, - }, - setParserV1(value) { - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', value > 0); - return { - Value: Math.round(value * 99), - }; - }, - setParserV2(value, options) { - const duration = (options.hasOwnProperty('duration') ? util.calculateZwaveDimDuration(options.duration) : FACTORY_DEFAULT_DIMMING_DURATION_V2); - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', value > 0); - return { - Value: Math.round(value * 99), - 'Dimming Duration': duration, - }; - }, - setParserV4(value, options) { - // Buffer.from() is a fix for difference between V3/V4 dimming duration XML specification - const duration = (options.hasOwnProperty('duration') ? Buffer.from([util.calculateZwaveDimDuration(options.duration)]) : FACTORY_DEFAULT_DIMMING_DURATION_V4); - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', value > 0); - return { - Value: Math.round(value * 99), - 'Dimming Duration': duration, - }; - }, - report: 'SWITCH_MULTILEVEL_REPORT', - reportParserV1(report) { - if (report && report.hasOwnProperty('Value (Raw)')) { - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', report['Value (Raw)'][0] > 0); - if (report['Value (Raw)'][0] === 255) return 1; - return report['Value (Raw)'][0] / 99; - } - return null; - }, - reportParserV4(report) { - if (report && report.hasOwnProperty('Current Value (Raw)')) { - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', report['Current Value (Raw)'][0] > 0); - if (report['Current Value (Raw)'][0] === 255) return 1; - return report['Current Value (Raw)'][0] / 99; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/windowcoverings/SWITCH_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/windowcoverings/SWITCH_MULTILEVEL.js deleted file mode 100644 index 0c7730a..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/dim/windowcoverings/SWITCH_MULTILEVEL.js +++ /dev/null @@ -1,68 +0,0 @@ -'use strict'; - -const util = require('./../../../../../util'); - -const INVERT_WINDOW_COVERINGS_DIRECTION = 'invertWindowCoveringsDirection'; -const FACTORY_DEFAULT_DIMMING_DURATION_V2 = 'Factory default'; -const FACTORY_DEFAULT_DIMMING_DURATION_V4 = 'Default'; - -module.exports = { - get: 'SWITCH_MULTILEVEL_GET', - set: 'SWITCH_MULTILEVEL_SET', - getOpts: { - getOnStart: true, - }, - setParserV1(value) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - if (invertDirection) value = 1 - value; - - return { - Value: Math.round(value * 99), - }; - }, - setParserV2(value, options) { - const duration = (options.hasOwnProperty('duration') ? util.calculateZwaveDimDuration(options.duration) : FACTORY_DEFAULT_DIMMING_DURATION_V2); - - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - if (invertDirection) value = 1 - value; - - return { - Value: Math.round(value * 99), - 'Dimming Duration': duration, - }; - }, - setParserV4(value, options) { - // Buffer.from() is a fix for difference between V3/V4 dimming duration XML specification - const duration = (options.hasOwnProperty('duration') ? Buffer.from([util.calculateZwaveDimDuration(options.duration)]) : FACTORY_DEFAULT_DIMMING_DURATION_V4); - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', value > 0); - - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - if (invertDirection) value = 1 - value; - - return { - Value: Math.round(value * 99), - 'Dimming Duration': duration, - }; - }, - report: 'SWITCH_MULTILEVEL_REPORT', - reportParserV1(report) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - - if (report && report.hasOwnProperty('Value (Raw)')) { - if (report['Value (Raw)'][0] === 254) return null; // TODO: add calibration warning - if (report['Value (Raw)'][0] === 255) return invertDirection ? 0 : 1; - return invertDirection ? (99 - report['Value (Raw)'][0]) / 99 : report['Value (Raw)'][0] / 99; - } - return null; - }, - reportParserV4(report) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - - if (report && report.hasOwnProperty('Current Value (Raw)')) { - if (report['Current Value (Raw)'][0] === 254) return null; // TODO: add calibration warning - if (report['Current Value (Raw)'][0] === 255) return invertDirection ? 0 : 1; - return invertDirection ? (99 - report['Current Value (Raw)'][0]) / 99 : report['Current Value (Raw)'][0] / 99; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/locked/DOOR_LOCK.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/locked/DOOR_LOCK.js deleted file mode 100644 index 3d8e667..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/locked/DOOR_LOCK.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -module.exports = { - get: 'DOOR_LOCK_OPERATION_GET', - getOpts: { - getOnOnline: true, - }, - set: 'DOOR_LOCK_OPERATION_SET', - setParserV2(value) { - return { - 'Door Lock Mode': (!value) ? 'Door Unsecured' : 'Door Secured', - }; - }, - report: 'DOOR_LOCK_OPERATION_REPORT', - reportParserV2(report) { - if (report && report.hasOwnProperty('Door Lock Mode')) return report['Door Lock Mode'] === 'Door Secured'; - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/locked/NOTIFICATION.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/locked/NOTIFICATION.js deleted file mode 100644 index f666942..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/locked/NOTIFICATION.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -module.exports = { - report: 'NOTIFICATION_REPORT', - reportParser(report) { - if (report && report['Notification Type'] === 'Event' && report.hasOwnProperty('Event (Parsed)')) { - if (report['Notification Type'] === 'Access Control') { - - // Lock was locked manually, automatically or via external controller - if (report['Event (Parsed)'] === 'Manual Lock Operation' || - report['Event (Parsed)'] === 'RF Lock Operation' || - report['Event (Parsed)'] === 'Auto Lock Locked Operation' || - report['Event (Parsed)'] === 'Keypad Lock Operation') { - return true; - } - - // Lock was unlocked manually or via external controller - if (report['Event (Parsed)'] === 'Manual Unlock Operation' || - report['Event (Parsed)'] === 'RF Unlock Operation' || - report['Event (Parsed)'] === 'Keypad Unlock Operation') { - return false; - } - - // Lock is jammed, emit event - if (report['Event (Parsed)'] === 'Lock Jammed') { - this.emit('lockJammedNotification'); - return false; - } - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_battery/BATTERY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_battery/BATTERY.js deleted file mode 100644 index 4ade2d0..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_battery/BATTERY.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -/** - * Capability measure_battery handler for BATTERY command class. It will also update the alarm_battery capability if - * the device has it. - */ -module.exports = { - get: 'BATTERY_GET', - getOpts: { - getOnOnline: true, - }, - report: 'BATTERY_REPORT', - reportParser(report) { - if (report) { - if (report.hasOwnProperty('Battery Level') && report['Battery Level'] === 'battery low warning') { - if (this.hasCapability('alarm_battery')) this.setCapabilityValue('alarm_battery', true); - return 1; - } - if (report.hasOwnProperty('Battery Level (Raw)')) { - if (this.hasCapability('alarm_battery')) this.setCapabilityValue('alarm_battery', false); - return report['Battery Level (Raw)'][0]; - } - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_co/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_co/SENSOR_MULTILEVEL.js deleted file mode 100644 index 23a488c..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_co/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -module.exports = { - getParser: () => ({ - 'Sensor Type': 'Carbon Monoxide CO-level (v7)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Carbon Monoxide CO-level (v7)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_co2/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_co2/SENSOR_MULTILEVEL.js deleted file mode 100644 index 70b9888..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_co2/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Current (version 3)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'CO2-level (version 3)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_current/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_current/METER.js deleted file mode 100644 index be5db0c..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_current/METER.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -/** - const exampleReport = { - 'Properties1 (Raw)': '', - Properties1: - { - 'Scale bit 2': true, - 'Meter Type': 'Electric meter', - 'Rate Type': 'Import', - 'Meter Type (Parsed)': { value: 'Electric meter' }, - 'Rate Type (Parsed)': { value: 'Import' }, - }, - 'Properties2 (Raw)': '', - Properties2: { - Size: 4, - 'Scale bits 10': 1, - Precision: 1, - }, - 'Meter Value': '', - 'Delta Time (Raw)': '', - 'Delta Time': 0, - 'Previous Meter Value': '', - 'Scale 2 (Raw)': '', - 'Scale 2': 0, - 'Meter Value (Parsed)': 15.9, - }; - */ - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV3: () => ({ - Properties1: { - Scale: 5, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 5, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 1) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV4: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 1 && - (report.hasOwnProperty('Scale 2') === false || report['Scale 2'] === 0) - ) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_current/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_current/SENSOR_MULTILEVEL.js deleted file mode 100644 index 37f3e0d..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_current/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Current (version 3)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Current (version 3)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_humidity/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_humidity/SENSOR_MULTILEVEL.js deleted file mode 100644 index 852332d..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_humidity/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Relative humidity (version 2)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Relative humidity (version 2)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_luminance/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_luminance/SENSOR_MULTILEVEL.js deleted file mode 100644 index 0195fe4..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_luminance/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Luminance (version 1)', - Properties1: { - Scale: 1, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Luminance (version 1)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_noise/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_noise/SENSOR_MULTILEVEL.js deleted file mode 100644 index d264e07..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_noise/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Loudness (v5)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Loudness (v5)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_pm2.5/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_pm2.5/SENSOR_MULTILEVEL.js deleted file mode 100644 index ba51567..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_pm2.5/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Particulate Matter 2.5 (v7)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Particulate Matter 2.5 (v7)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_power/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_power/METER.js deleted file mode 100644 index 1aa6dd3..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_power/METER.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; - -/** - const exampleReport = { - 'Properties1 (Raw)': '', - Properties1: - { - 'Scale bit 2': false, - 'Meter Type': 'Electric meter', - 'Rate Type': 'Import', - 'Meter Type (Parsed)': { value: 'Electric meter' }, - 'Rate Type (Parsed)': { value: 'Import' }, - }, - 'Properties2 (Raw)': '', - Properties2: { - Size: 4, - 'Scale bits 10': 2, - Precision: 1, - }, - 'Meter Value': '', - 'Delta Time (Raw)': '', - 'Delta Time': 0, - 'Previous Meter Value': '', - 'Scale 2 (Raw)': '', - 'Scale 2': 0, - 'Meter Value (Parsed)': 36.2, - }; - */ - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV2: () => ({ - Properties1: { - Scale: 2, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 2, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV1: report => { - if (report && - report.hasOwnProperty('Meter Type') && - (report['Meter Type'] === 'Electric meter' || report['Meter Type'] === 1) && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Scale') && - report.Properties1.Scale === 2) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale') && - report.Properties2.Scale === 2) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 2) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV4: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 2 && - (report.hasOwnProperty('Scale 2') === false || report['Scale 2'] === 0) - ) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_power/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_power/SENSOR_MULTILEVEL.js deleted file mode 100644 index d28d040..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_power/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Power (version 2)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Power (version 2)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_temperature/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_temperature/SENSOR_MULTILEVEL.js deleted file mode 100644 index 63bd66b..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_temperature/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getOpts: { - getOnOnline: true, - getOnStart: true, - }, - getParser: () => ({ - 'Sensor Type': 'Temperature (version 1)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && - report.hasOwnProperty('Sensor Type') && - report['Sensor Type'] === 'Temperature (version 1)' && - report.hasOwnProperty('Sensor Value (Parsed)') && - report.hasOwnProperty('Level') && - report.Level.hasOwnProperty('Scale')) { - - // Some devices send this when no temperature sensor is connected - if (report['Sensor Value (Parsed)'] === -999.9) return null; - if (report.Level.Scale === 0) return report['Sensor Value (Parsed)']; - if (report.Level.Scale === 1) return (report['Sensor Value (Parsed)'] - 32) / 1.8; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_ultraviolet/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_ultraviolet/SENSOR_MULTILEVEL.js deleted file mode 100644 index 22a1b44..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_ultraviolet/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Ultraviolet (v5)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Ultraviolet (v5)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_voltage/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_voltage/METER.js deleted file mode 100644 index fe2ee3b..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_voltage/METER.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -/** - const exampleReport = { - 'Properties1 (Raw)': '', - Properties1: { - 'Scale bit 2': true, - 'Meter Type': 'Electric meter', - 'Rate Type': 'Import', - 'Meter Type (Parsed)': { value: 'Electric meter' }, - 'Rate Type (Parsed)': { value: 'Import' }, - }, - 'Properties2 (Raw)': '', - Properties2: { - Size: 4, - 'Scale bits 10': 0, - Precision: 1, - }, - 'Meter Value': '', - 'Delta Time (Raw)': '', - 'Delta Time': 0, - 'Previous Meter Value': '', - 'Scale 2 (Raw)': '', - 'Scale 2': 0, - 'Meter Value (Parsed)': 232, - }; - */ - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV3: () => ({ - Properties1: { - Scale: 4, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 4, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV4: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 0 && - (report.hasOwnProperty('Scale 2') === false || report['Scale 2'] === 0) - ) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_voltage/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_voltage/SENSOR_MULTILEVEL.js deleted file mode 100644 index abd8d86..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_voltage/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Voltage (version 3)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Voltage (version 3)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_water/SENSOR_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_water/SENSOR_MULTILEVEL.js deleted file mode 100644 index 2b70551..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/measure_water/SENSOR_MULTILEVEL.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -module.exports = { - get: 'SENSOR_MULTILEVEL_GET', - getParser: () => ({ - 'Sensor Type': 'Water Flow (v9)', - Properties1: { - Scale: 0, - }, - }), - report: 'SENSOR_MULTILEVEL_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Sensor Type') && report.hasOwnProperty('Sensor Value (Parsed)')) { - if (report['Sensor Type'] === 'Water Flow (v9)') return report['Sensor Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_gas/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_gas/METER.js deleted file mode 100644 index 8ccc34d..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_gas/METER.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -module.exports = { - get: 'METER_GET', - getParserV2: () => ({ - Properties1: { - Scale: 0, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 0, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV1: report => { - if (report && - report.hasOwnProperty('Meter Type') && - (report['Meter Type'] === 'Gas meter' || report['Meter Type'] === 2) && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Scale') && - report.Properties1.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Gas meter' || report.Properties1['Meter Type'] === 2) && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale') && - report.Properties2.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Gas meter' || report.Properties1['Meter Type'] === 2) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power.export/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power.export/METER.js deleted file mode 100644 index 01be31b..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power.export/METER.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV2: () => ({ - Properties1: { - Scale: 0, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Export', - Scale: 0, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV1: report => { - if (report && - report.hasOwnProperty('Meter Type') && - (report['Meter Type'] === 'Electric meter' || report['Meter Type'] === 1) && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Scale') && - report.Properties1.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Rate Type') && - report.Properties1['Rate Type'] === 'Export' && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale') && - report.Properties2.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.Properties1.hasOwnProperty('Rate Type') && - report.Properties1['Rate Type'] === 'Export' && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power.import/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power.import/METER.js deleted file mode 100644 index f2959e0..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power.import/METER.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV2: () => ({ - Properties1: { - Scale: 0, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 0, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV1: report => { - if (report && - report.hasOwnProperty('Meter Type') && - (report['Meter Type'] === 'Electric meter' || report['Meter Type'] === 1) && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Scale') && - report.Properties1.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Rate Type') && - report.Properties1['Rate Type'] === 'Import' && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale') && - report.Properties2.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.Properties1.hasOwnProperty('Rate Type') && - report.Properties1['Rate Type'] === 'Import' && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power/METER.js deleted file mode 100644 index f39d31d..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_power/METER.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict'; - -/** - const exampleReport = { - 'Properties1 (Raw)': '', - Properties1: { - 'Scale bit 2': false, - 'Meter Type': 'Electric meter', - 'Rate Type': 'Import', - 'Meter Type (Parsed)': { value: 'Electric meter' }, - 'Rate Type (Parsed)': { value: 'Import' }, - }, - 'Properties2 (Raw)': '', - Properties2: { - Size: 4, - 'Scale bits 10': 0, - Precision: 1, - }, - 'Meter Value': '', - 'Delta Time (Raw)': '', - 'Delta Time': 0, - 'Previous Meter Value': '', - 'Scale 2 (Raw)': '', - 'Scale 2': 0, - 'Meter Value (Parsed)': 0.1, - }; - */ - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV2: () => ({ - Properties1: { - Scale: 0, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 0, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV1: report => { - if (report && - report.hasOwnProperty('Meter Type') && - (report['Meter Type'] === 'Electric meter' || report['Meter Type'] === 1) && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Scale') && - report.Properties1.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale') && - report.Properties2.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV4: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 0 && - (report.hasOwnProperty('Scale 2') === false || report['Scale 2'] === 0) - ) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_water/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_water/METER.js deleted file mode 100644 index 2367807..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/meter_water/METER.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -module.exports = { - get: 'METER_GET', - getParserV2: () => ({ - Properties1: { - Scale: 0, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 0, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV1: report => { - if (report && - report.hasOwnProperty('Meter Type') && - (report['Meter Type'] === 'Water meter' || report['Meter Type'] === 3) && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Scale') && - report.Properties1.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV2: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Water meter' || report.Properties1['Meter Type'] === 3) && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale') && - report.Properties2.Scale === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Water meter' || report.Properties1['Meter Type'] === 3) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/BASIC.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/BASIC.js deleted file mode 100644 index 590bd48..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/BASIC.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -module.exports = { - get: 'BASIC_GET', - set: 'BASIC_SET', - setParser: value => ({ - Value: (value) ? 255 : 0, - }), - report: 'BASIC_REPORT', - reportParser(report) { - if (report && report.hasOwnProperty('Value')) return report.Value > 0; - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/BASIC_SET.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/BASIC_SET.js deleted file mode 100644 index 43020b7..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/BASIC_SET.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -module.exports = { - report: 'BASIC_SET', - reportParser: report => { - if (report && report.hasOwnProperty('Value')) return report.Value === 255; - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/SWITCH_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/SWITCH_BINARY.js deleted file mode 100644 index bb32e50..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/SWITCH_BINARY.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const FACTORY_DEFAULT_DIMMING_DURATION = 'Default'; - -module.exports = { - get: 'SWITCH_BINARY_GET', - set: 'SWITCH_BINARY_SET', - getOpts: { - getOnStart: true, - }, - setParserV1: value => ({ - 'Switch Value': (value) ? 'on/enable' : 'off/disable', - }), - setParserV2(value, options) { - const duration = (options.hasOwnProperty('duration') ? util.calculateZwaveDimDuration(options.duration) : FACTORY_DEFAULT_DIMMING_DURATION); - return { - 'Target Value': (value) ? 'on/enable' : 'off/disable', - Duration: duration, - }; - }, - report: 'SWITCH_BINARY_REPORT', - reportParserV1: report => { - if (report && report.hasOwnProperty('Value')) { - if (report.Value === 'on/enable') return true; - else if (report.Value === 'off/disable') return false; - } - return null; - }, - reportParserV2: report => { - if (report && report.hasOwnProperty('Current Value')) { - if (report['Current Value'] === 'on/enable') return true; - else if (report['Current Value'] === 'off/disable') return false; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/SWITCH_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/SWITCH_MULTILEVEL.js deleted file mode 100644 index 9c9ad8f..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/onoff/SWITCH_MULTILEVEL.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const FACTORY_DEFAULT_DIMMING_DURATION = 'Factory default'; - -module.exports = { - get: 'SWITCH_MULTILEVEL_GET', - set: 'SWITCH_MULTILEVEL_SET', - setParser: value => ({ - Value: (value) ? 'on/enable' : 'off/disable', - }), - setParserV2(value, options) { - const duration = (options.hasOwnProperty('duration') ? util.calculateZwaveDimDuration(options.duration) : FACTORY_DEFAULT_DIMMING_DURATION); - return { - Value: (value) ? 'on/enable' : 'off/disable', - 'Dimming Duration': duration, - }; - }, - report: 'SWITCH_MULTILEVEL_REPORT', - reportParserV1: report => { - if (report) { - if (report.hasOwnProperty('Value')) { - if (typeof report.Value === 'number') return report.Value > 0; - if (typeof report.Value === 'string') return report.Value === 'on/enable'; - } - if (report.hasOwnProperty('Value (Raw)')) return report['Value (Raw)'][0] > 0; - } - return null; - }, - reportParserV4: report => { - if (report && report.hasOwnProperty('Current Value (Raw)')) { - if (report['Current Value (Raw)'][0] === 255) return 1; - return report['Current Value (Raw)'][0] / 99; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerFactor/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerFactor/METER.js deleted file mode 100644 index 2cc4cfd..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerFactor/METER.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -/** - const exampleReport = { - 'Properties1 (Raw)': '', - Properties1: { - 'Scale bit 2': true, - 'Meter Type': 'Electric meter', - 'Rate Type': 'Import', - 'Meter Type (Parsed)': { value: 'Electric meter' }, - 'Rate Type (Parsed)': { value: 'Import' }, - }, - 'Properties2 (Raw)': '', - Properties2: { - Size: 4, - 'Scale bits 10': 2, - Precision: 1, - }, - 'Meter Value': '', - 'Delta Time (Raw)': '', - 'Delta Time': 0, - 'Previous Meter Value': '', - 'Scale 2 (Raw)': '', - 'Scale 2': 0, - 'Meter Value (Parsed)': 1000, - }; - */ - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV3: () => ({ - Properties1: { - Scale: 6, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 6, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 2) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV4: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 2 && - report.hasOwnProperty('Scale 2') === false || - report.hasOwnProperty('Scale 2') - && report['Scale 2'] === 0) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerReactive/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerReactive/METER.js deleted file mode 100644 index 96ca818..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerReactive/METER.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; - -/** - const exampleReport = { - 'Properties1 (Raw)': '', - Properties1: { - 'Scale bit 2': true, - 'Meter Type': 'Electric meter', - 'Rate Type': 'Import', - 'Meter Type (Parsed)': { value: 'Electric meter' }, - 'Rate Type (Parsed)': { value: 'Import' }, - }, - 'Properties2 (Raw)': '', - Properties2: { - Size: 4, - 'Scale bits 10': 3, - Precision: 1, - }, - 'Meter Value': '', - 'Delta Time (Raw)': '', - 'Delta Time': 0, - 'Previous Meter Value': '', - 'Scale 2 (Raw)': '', - 'Scale 2': 0, - 'Meter Value (Parsed)': 0.1, - 'Previous Meter Value (Parsed)': 0, - }; - */ - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV3: () => ({ - Properties1: { - Scale: 7, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 7, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 3) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV4: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 3 && - (report.hasOwnProperty('Scale 2') === false || report['Scale 2'] === 0) - ) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerTotalApparent/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerTotalApparent/METER.js deleted file mode 100644 index 530c22d..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerTotalApparent/METER.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -/** - const exampleReport = { - 'Properties1 (Raw)': '', - Properties1: - { - 'Scale bit 2': false, - 'Meter Type': 'Electric meter', - 'Rate Type': 'Import', - 'Meter Type (Parsed)': { value: 'Electric meter' }, - 'Rate Type (Parsed)': { value: 'Import' }, - }, - 'Properties2 (Raw)': '', - Properties2: { - Size: 4, - 'Scale bits 10': 1, - Precision: 1, - }, - 'Meter Value': '', - 'Delta Time (Raw)': '', - 'Delta Time': 0, - 'Previous Meter Value': '', - 'Scale 2 (Raw)': '', - 'Scale 2': 0, - 'Meter Value (Parsed)': 0.1, - }; - */ -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV2: () => ({ - Properties1: { - Scale: 1, - }, - }), - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 1, - }, - 'Scale 2': 0, - }), - report: 'METER_REPORT', - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 1) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV4: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === false && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 1 && - (report.hasOwnProperty('Scale 2') === false || report['Scale 2'] === 0) - ) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerTotalReactive/METER.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerTotalReactive/METER.js deleted file mode 100644 index 8aa8e8d..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerTotalReactive/METER.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict'; - -/** - const exampleReport = { - 'Properties1 (Raw)': '', - Properties1: - { - 'Scale bit 2': true, - 'Meter Type': 'Electric meter', - 'Rate Type': 'Import', - 'Meter Type (Parsed)': { value: 'Electric meter' }, - 'Rate Type (Parsed)': { value: 'Import' }, - }, - 'Properties2 (Raw)': '', - Properties2: { - Size: 4, - 'Scale bits 10': 3, - Precision: 1, - }, - 'Meter Value': '', - 'Delta Time (Raw)': '', - 'Delta Time': 0, - 'Previous Meter Value': '', - 'Scale 2 (Raw)': '', - 'Scale 2': 1, - 'Meter Value (Parsed)': 0, - 'Previous Meter Value (Parsed)': 0, - }; - */ - -module.exports = { - get: 'METER_GET', - getOpts: { - getOnStart: true, - }, - getParserV4: () => ({ - Properties1: { - 'Rate Type': 'Import', - Scale: 7, - }, - 'Scale 2': 1, - }), - report: 'METER_REPORT', - reportParserV3: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 3) { - return report['Meter Value (Parsed)']; - } - return null; - }, - reportParserV4: report => { - if (report && - report.hasOwnProperty('Properties1') && - report.Properties1.hasOwnProperty('Meter Type') && - (report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) && - report.Properties1.hasOwnProperty('Scale bit 2') && - report.Properties1['Scale bit 2'] === true && - report.hasOwnProperty('Properties2') && - report.Properties2.hasOwnProperty('Scale bits 10') && - report.Properties2['Scale bits 10'] === 3 && - report.hasOwnProperty('Scale 2') && - report['Scale 2'] === 1) { - return report['Meter Value (Parsed)']; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/target_temperature/THERMOSTAT_SETPOINT.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/target_temperature/THERMOSTAT_SETPOINT.js deleted file mode 100644 index f24cf85..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/target_temperature/THERMOSTAT_SETPOINT.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -/** - * Capability target_temperature i.c.w. the THERMOSTAT_SETPOINT command class takes an additional variable (this.thermostatSetpointType) - * which can determine on runtime the setpoint type to use. - */ -module.exports = { - get: 'THERMOSTAT_SETPOINT_GET', - getOpts: { - getOnStart: true, - }, - getParser() { - return { - Level: { - 'Setpoint Type': this.thermostatSetpointType || 'Heating 1', - }, - }; - }, - set: 'THERMOSTAT_SETPOINT_SET', - setParser(value) { - - // Create value buffer - const bufferValue = new Buffer(2); - bufferValue.writeUInt16BE((Math.round(value * 2) / 2 * 10).toFixed(0)); - - return { - Level: { - 'Setpoint Type': this.thermostatSetpointType || 'Heating 1', - }, - Level2: { - Size: 2, - Scale: 0, - Precision: 1, - }, - Value: bufferValue, - }; - }, - report: 'THERMOSTAT_SETPOINT_REPORT', - reportParser: report => { - if (report && report.hasOwnProperty('Level2') - && report.Level2.hasOwnProperty('Scale') - && report.Level2.hasOwnProperty('Precision') - && report.Level2.Scale === 0 - && typeof report.Level2.Size !== 'undefined') { - - let readValue; - try { - readValue = report.Value.readUIntBE(0, report.Level2.Size); - } catch (err) { - return null; - } - - if (typeof readValue !== 'undefined') { - return readValue / Math.pow(10, report.Level2.Precision); - } - return null; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_set/SWITCH_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_set/SWITCH_MULTILEVEL.js deleted file mode 100644 index 0214a79..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_set/SWITCH_MULTILEVEL.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const INVERT_WINDOW_COVERINGS_DIRECTION = 'invertWindowCoveringsDirection'; -const FACTORY_DEFAULT_DIMMING_DURATION_V2 = 'Factory default'; -const FACTORY_DEFAULT_DIMMING_DURATION_V4 = 'Default'; - -module.exports = { - get: 'SWITCH_MULTILEVEL_GET', - set: 'SWITCH_MULTILEVEL_SET', - getOpts: { - getOnStart: true, - }, - setParserV1(value) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - if (invertDirection) value = 1 - value; - return { - Value: Math.round(value * 99), - }; - }, - setParserV2(value, options) { - const duration = (options.hasOwnProperty('duration') ? util.calculateZwaveDimDuration(options.duration) : FACTORY_DEFAULT_DIMMING_DURATION_V2); - - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - if (invertDirection) value = 1 - value; - return { - Value: Math.round(value * 99), - 'Dimming Duration': duration, - }; - }, - setParserV4(value, options) { - // Buffer.from() is a fix for difference between V3/V4 dimming duration XML specification - const duration = (options.hasOwnProperty('duration') ? Buffer.from([util.calculateZwaveDimDuration(options.duration)]) : FACTORY_DEFAULT_DIMMING_DURATION_V4); - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', value > 0); - - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - if (invertDirection) value = 1 - value; - - return { - Value: Math.round(value * 99), - 'Dimming Duration': duration, - }; - }, - report: 'SWITCH_MULTILEVEL_REPORT', - reportParserV1(report) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - - if (report && report.hasOwnProperty('Value (Raw)')) { - if (report['Value (Raw)'][0] === 254) return null; // TODO: add calibration warning - if (report['Value (Raw)'][0] === 255) return invertDirection ? 0 : 1; - return invertDirection ? (99 - report['Value (Raw)'][0]) / 99 : report['Value (Raw)'][0] / 99; - } - return null; - }, - reportParserV4(report) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_DIRECTION); - - if (report && report.hasOwnProperty('Current Value (Raw)')) { - if (report['Current Value (Raw)'][0] === 254) return null; // TODO: add calibration warning - if (report['Current Value (Raw)'][0] === 255) return invertDirection ? 0 : 1; - return invertDirection ? (99 - report['Current Value (Raw)'][0]) / 99 : report['Current Value (Raw)'][0] / 99; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_state/SWITCH_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_state/SWITCH_BINARY.js deleted file mode 100644 index ea8fa0f..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_state/SWITCH_BINARY.js +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const FACTORY_DEFAULT_DIMMING_DURATION = 'Default'; - -/** - * Capability windowcoverings_state handler for SWITCH_BINARY command class. If the device has the - * 'invertWindowCoveringsDirection' setting (see zwave/system/settings.json), this will be used to invert the direction. - */ -module.exports = { - get: 'SWITCH_BINARY_GET', - set: 'SWITCH_BINARY_SET', - setParserV1(value) { - return { - 'Switch Value': determineAndSaveState.call(this, value), - }; - }, - setParserV2: (value, options) => { - const duration = (options.hasOwnProperty('duration') ? util.calculateZwaveDimDuration(options.duration) : FACTORY_DEFAULT_DIMMING_DURATION); - return { - 'Switch Value': determineAndSaveState.call(this, value), - Duration: duration, - }; - }, - report: 'SWITCH_BINARY_REPORT', - reportParser(report) { - const invertDirection = !!this.getSetting('invertWindowCoveringsDirection'); - - // Save latest known position state - this.windowCoveringsPosition = report.Value; - - switch (this.windowCoveringsPosition) { - case 'on/enable': - if (invertDirection) return 'down'; - return 'up'; - case 'off/disable': - if (invertDirection) return 'up'; - return 'down'; - default: - return 'idle'; - } - }, -}; - -/** - * Based on the windowcoverings_state value this method calculates and stores the corresponding SWITCH_BINARY value, - * taking into account the possible invertWindowCoveringsDirection setting. - * @param {string} value - windowcoverings_state value ('down'/'up' or 'idle') - */ -function determineAndSaveState(value) { - const invertDirection = !!this.getSetting('invertWindowCoveringsDirection'); - - let result = 'off/disable'; - switch (value) { - case 'idle': - if (this.windowCoveringsPosition === 'on/enable') result = 'off/disable'; - else if (this.windowCoveringsPosition === 'off/disable') result = 'on/enable'; - break; - case 'up': - result = (invertDirection) ? 'off/disable' : 'on/enable'; - break; - case 'down': - result = (invertDirection) ? 'on/enable' : 'off/disable'; - break; - } - - // Save latest known position state and return it - this.windowCoveringsPosition = result; - return result; -} diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_tilt_set/SWITCH_BINARY.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_tilt_set/SWITCH_BINARY.js deleted file mode 100644 index 9adc28d..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_tilt_set/SWITCH_BINARY.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const FACTORY_DEFAULT_DIMMING_DURATION = 'Default'; - -/** - * Capability windowcoverings_tilt_set handler for SWITCH_BINARY command class. If the device has the - * 'invertWindowCoveringsDirection' setting (see zwave/system/settings.json), this will be used to invert the direction. - */ -module.exports = { - get: 'SWITCH_BINARY_GET', - set: 'SWITCH_BINARY_SET', - setParserV1(value) { - const invertDirection = !!this.getSetting('invertWindowCoveringsDirection'); - return { - 'Switch Value': (invertDirection) ? util.mapValueRange(0, 1, 0, 255, 1 - value) : util.mapValueRange(0, 1, 0, 255, value), - }; - }, - setParserV2: (value, options) => { - const duration = (options.hasOwnProperty('duration') ? util.calculateZwaveDimDuration(options.duration) : FACTORY_DEFAULT_DIMMING_DURATION); - const invertDirection = !!this.getSetting('invertWindowCoveringsDirection'); - return { - 'Switch Value': (invertDirection) ? util.mapValueRange(0, 1, 0, 255, 1 - value) : util.mapValueRange(0, 1, 0, 255, value), - Duration: duration, - }; - }, - report: 'SWITCH_BINARY_REPORT', - reportParser(report) { - const invertDirection = !!this.getSetting('invertWindowCoveringsDirection'); - return (invertDirection) ? 1 - util.mapValueRange(0, 255, 0, 1, report.Value) : util.mapValueRange(0, 255, 0, 1, report.Value); - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_tilt_set/SWITCH_MULTILEVEL.js b/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_tilt_set/SWITCH_MULTILEVEL.js deleted file mode 100644 index 4fe421b..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/capabilities/windowcoverings_tilt_set/SWITCH_MULTILEVEL.js +++ /dev/null @@ -1,66 +0,0 @@ -'use strict'; - -const util = require('./../../../../util'); - -const INVERT_WINDOW_COVERINGS_TILT_DIRECTION = 'invertWindowCoveringsTiltDirection'; -const FACTORY_DEFAULT_DIMMING_DURATION_V2 = 'Factory default'; -const FACTORY_DEFAULT_DIMMING_DURATION_V4 = 'Default'; - -module.exports = { - get: 'SWITCH_MULTILEVEL_GET', - set: 'SWITCH_MULTILEVEL_SET', - getOpts: { - getOnStart: true, - }, - setParserV1(value) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_TILT_DIRECTION); - if (invertDirection) value = 1 - value; - - return { - Value: Math.round(value * 99), - }; - }, - setParserV2(value, options) { - const duration = (options.hasOwnProperty('duration') ? util.calculateZwaveDimDuration(options.duration) : FACTORY_DEFAULT_DIMMING_DURATION_V2); - - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_TILT_DIRECTION); - if (invertDirection) value = 1 - value; - - return { - Value: Math.round(value * 99), - 'Dimming Duration': duration, - }; - }, - setParserV4(value, options) { - // Buffer.from() is a fix for difference between V3/V4 dimming duration XML specification - const duration = (options.hasOwnProperty('duration') ? Buffer.from([util.calculateZwaveDimDuration(options.duration)]) : FACTORY_DEFAULT_DIMMING_DURATION_V4); - if (this.hasCapability('onoff')) this.setCapabilityValue('onoff', value > 0); - - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_TILT_DIRECTION); - if (invertDirection) value = 1 - value; - - return { - Value: Math.round(value * 99), - 'Dimming Duration': duration, - }; - }, - report: 'SWITCH_MULTILEVEL_REPORT', - reportParserV1(report) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_TILT_DIRECTION); - - if (report && report.hasOwnProperty('Value (Raw)')) { - if (report['Value (Raw)'][0] === 255) return invertDirection ? 0 : 1; - return invertDirection ? (99 - report['Value (Raw)'][0]) / 99 : report['Value (Raw)'][0] / 99; - } - return null; - }, - reportParserV4(report) { - const invertDirection = !!this.getSetting(INVERT_WINDOW_COVERINGS_TILT_DIRECTION); - - if (report && report.hasOwnProperty('Current Value (Raw)')) { - if (report['Current Value (Raw)'][0] === 255) return invertDirection ? 0 : 1; - return invertDirection ? (99 - report['Current Value (Raw)'][0]) / 99 : report['Current Value (Raw)'][0] / 99; - } - return null; - }, -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/METER/defines.json b/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/METER/defines.json deleted file mode 100644 index c8ca497..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/METER/defines.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - - "Rate Type": { - "0": "Reserved", - "1": "Import", - "2": "Export", - "3": "Reserved" - }, - - "Meter Scale": { - "Electric meter": { - "0": "kWh", - "1": "kVARh", - "2": "%", - "3": "Pulse count", - "4": "kVAR", - "5": "Voltage (V)", - "6": "Amperes (A)", - "7": "kW" - }, - "Gas and water meter": { - "0": "Cubic meter", - "1": "Cubic feet", - "2": "US gallon", - "3": "Pulse count", - "4": "IMP gallon", - "5": "Liter", - "6": "kPa", - "7": "Centum cubic feet", - "8": "Cubic meter per hour", - "9": "Liter per hour", - "10": "kWh", - "11": "MWh", - "12": "KW", - "13": "Hours" - }, - "Heating and Cooling Meter": { - "0": "Cubic meter (m3)", - "1": "Metric Ton (tonne) (t)", - "2": "Cubic meter per hour (m3/h)", - "3": "Liter per hour (l/h)", - "4": "kW", - "5": "MW", - "6": "kWh", - "7": "MWh", - "8": "Giga Joule (GJ)", - "9": "Giga Calorie (Gcal)", - "10": "Celsius (Co)", - "11": "Fahrenheit (oF)", - "12": "Hours" - }, - "Electric Sub-Meter": { - "0": "kWh", - "1": "kVAh", - "2": "W", - "3": "Pulse Count", - "4": "V", - "5": "A", - "6": "Power Factor (%)" - } - }, - - "Meter Type": { - "1": "Single-E electric meter", - "2": "Gas meter", - "3": "Water meter", - "4": "Twin-E electric meter", - "5": "3P Single Direct electric meter", - "6": "3P Single ECT electric meter", - "7": "1 Phase Direct Electricity Meter", - "8": "Heating meter", - "9": "Cooling meter", - "10": "Combined Heating and Cooling Meter", - "11": "Electric Sub-Meter" - }, - - "Meter Type Scale Map": { - "Single-E electric meter": "Electric meter", - "Gas meter": "Gas and water meter", - "Water meter": "Gas and water meter", - "Twin-E electric meter": "Electric meter", - "3P Single Direct electric meter": "Electric meter", - "3P Single ECT electric meter": "Electric meter", - "1 Phase Direct Electricity Meter": "Electric meter", - "Heating meter": "Heating and Cooling Meter", - "Cooling meter": "Heating and Cooling Meter", - "Combined Heating and Cooling Meter": "Heating and Cooling Meter", - "Electric Sub-Meter": "Electric Sub-Meter" - } - -} \ No newline at end of file diff --git a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/METER/index.js b/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/METER/index.js deleted file mode 100644 index 9a2bd4d..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/METER/index.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -const defines = require('./defines.json'); - -module.exports = payload => { - - // replace Meter Type - try { - if (payload.Properties1 && typeof payload.Properties1['Meter Type'] !== 'undefined') { - payload.Properties1['Meter Type (Parsed)'] = { - value: payload.Properties1['Meter Type'], - name: defines['Meter Type'][payload.Properties1['Meter Type']], - }; - } - } catch (e) {} - - // replace Rate Type - try { - if (payload.Properties1 && typeof payload.Properties1['Rate Type'] !== 'undefined') { - payload.Properties1['Rate Type (Parsed)'] = { - value: payload.Properties1['Rate Type'], - name: defines['Rate Type'][payload.Properties1['Rate Type']], - }; - } - } catch (e) {} - - // replace Scale - try { - if (payload.Properties2 && typeof payload.Properties2.Scale !== 'undefined') { - payload.Properties2['Scale (Parsed)'] = { - value: payload.Properties2.Scale, - name: defines['Meter Scale'][defines['Meter Type Scale Map'][payload.Properties1['Meter Type'].name]][payload.Properties2.Scale], - }; - } - } catch (e) {} - - try { - if (typeof payload['Meter Value'] !== 'undefined') { - payload['Meter Value (Parsed)'] = payload['Meter Value'].readIntBE(0, payload.Properties2.Size); - payload['Meter Value (Parsed)'] /= Math.pow(10, payload.Properties2.Precision); - } - } catch (e) {} - - // parse value - try { - if (typeof payload['Previous Meter Value'] !== 'undefined') { - payload['Previous Meter Value (Parsed)'] = payload['Previous Meter Value'].readIntBE(0, payload.Properties2.Size); - payload['Previous Meter Value (Parsed)'] /= Math.pow(10, payload.Properties2.Precision); - } - } catch (e) {} - - return payload; - -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/NOTIFICATION/events.json b/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/NOTIFICATION/events.json deleted file mode 100644 index ba811e5..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/NOTIFICATION/events.json +++ /dev/null @@ -1,624 +0,0 @@ -{ - "1": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Smoke detected", - "version": "2" - }, - "2": { - "name": "Smoke detected, Unknown Location", - "version": 2 - }, - "3": { - "name": "Smoke Alarm Test", - "version": 3 - }, - "4": { - "name": "Replacement Required", - "version": 5 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "2": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Carbon monoxide detected", - "version": 2 - }, - "2": { - "name": "Carbon monoxide detected, Unknown Location", - "version": 2 - }, - "3": { - "name": "Carbon monoxide Test", - "version": 5 - }, - "4": { - "name": "Replacement Required", - "version": 5 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "3": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Carbon dioxide detected", - "version": 2 - }, - "2": { - "name": "Carbon dioxide detected, Unknown Location", - "version": 2 - }, - "3": { - "name": "Carbon dioxide Test", - "version": 5 - }, - "4": { - "name": "Replacement Required", - "version": 5 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "4": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Overheat detected", - "version": 2 - }, - "2": { - "name": "Overheat detected, Unknown Location", - "version": 2 - }, - "3": { - "name": "Rapid Temperature Rise", - "version": 2 - }, - "4": { - "name": "Rapid Temperature Rise, Unknown Location", - "version": 2 - }, - "5": { - "name": "Under heat detected", - "version": 2 - }, - "6": { - "name": "Under heat detected, Unknown Location", - "version": 2 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "5": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Water Leak detected", - "version": 2 - }, - "2": { - "name": "Water Leak detected, Unknown Location", - "version": 2 - }, - "3": { - "name": "Water Level Dropped", - "version": 2 - }, - "4": { - "name": "Water Level Dropped, Unknown Location", - "version": 2 - }, - "5": { - "name": "Replace Water Filter", - "version": 2 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "6": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Manual Lock Operation", - "version": 2 - }, - "2": { - "name": "Manual Unlock Operation", - "version": 2 - }, - "3": { - "name": "RF Lock Operation", - "version": 2 - }, - "4": { - "name": "RF Unlock Operation", - "version": 2 - }, - "5": { - "name": "Keypad Lock Operation", - "version": 2 - }, - "6": { - "name": "Keypad Unlock Operation", - "version": 2 - }, - "7": { - "name": "Manual Not Fully Locked Operation", - "version": 3 - }, - "8": { - "name": "RF Not Fully Locked Operation", - "version": 3 - }, - "9": { - "name": "Auto Lock Locked Operation", - "version": 3 - }, - "10": { - "name": "Auto Lock Not Fully Operation", - "version": 3 - }, - "11": { - "name": "Lock Jammed", - "version": 3 - }, - "12": { - "name": "All user codes deleted", - "version": 3 - }, - "13": { - "name": "Single user code deleted", - "version": 3 - }, - "14": { - "name": "New user code deleted", - "version": 3 - }, - "15": { - "name": "New user code not added due to duplicate code", - "version": 3 - }, - "16": { - "name": "Keypad temporary disabled", - "version": 3 - }, - "17": { - "name": "Keypad busy", - "version": 3 - }, - "18": { - "name": "New Program code Entered - Unique code for lock configuration", - "version": 3 - }, - "19": { - "name": "Manually Enter user Access code exceeds code limit", - "version": 3 - }, - "20": { - "name": "Unlock By RF with invalid user code", - "version": 3 - }, - "21": { - "name": "Locked By RF with invalid user codes", - "version": 3 - }, - "22": { - "name": "Window/Door is open", - "version": 3 - }, - "23": { - "name": "Window/Door is closed", - "version": 3 - }, - "64": { - "name": "Barrier performing Initialization process", - "version": 4 - }, - "65": { - "name": "Barrier Operation (Open / Close) force has been exceeded", - "version": 4 - }, - "66": { - "name": "Barrier motor has exceeded manufacturer's operational time limit", - "version": 4 - }, - "67": { - "name": "Barrier operation has exceeded physical mechanical limits", - "version": 4 - }, - "68": { - "name": "Barrier unable to perform requested operation due to UL requirements", - "version": 4 - }, - "68": { - "name": "Barrier Unattended operation has been disabled per UL requirements", - "version": 4 - }, - "69": { - "name": "Barrier failed to perform Requested operation, device malfunction", - "version": 4 - }, - "70": { - "name": "Barrier Vacation Mode", - "version": 4 - }, - "71": { - "name": "Barrier Safety Beam Obstacle", - "version": 4 - }, - "72": { - "name": "Barrier Sensor Not Detected / Supervisory Error", - "version": 4 - }, - "73": { - "name": "Barrier Sensor Low Battery Warning", - "version": 4 - }, - "74": { - "name": "Barrier detected short in Wall Station wires", - "version": 4 - }, - "75": { - "name": "Barrier associated with non-Z-wave remote control", - "version": 4 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - - "7": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Intrusion", - "version": 2 - }, - "2": { - "name": "Intrusion, Unknown Location", - "version": 2 - }, - "3": { - "name": "Tampering, Product covering removed", - "version": 2 - }, - "4": { - "name": "Tampering, Invalid Code", - "version": 2 - }, - "5": { - "name": "Glass Breakage", - "version": 2 - }, - "6": { - "name": "Glass Breakage, Unknown Location", - "version": 2 - }, - "7": { - "name": "Motion Detection", - "version": 2 - }, - "8": { - "name": "Motion Detection, Unknown Location", - "version": 4 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - - "8": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Power has been applied", - "version": 2 - }, - "2": { - "name": "AC mains disconnected", - "version": 2 - }, - "3": { - "name": "AC mains reconnected", - "version": 2 - }, - "4": { - "name": "Surge detected", - "version": 2 - }, - "5": { - "name": "Voltage Drop/Drift", - "version": 2 - }, - "6": { - "name": "Over-current detected", - "version": 3 - }, - "7": { - "name": "Over-voltage detected", - "version": 3 - }, - "8": { - "name": "Over-load detected", - "version": 3 - }, - "9": { - "name": "Load error", - "version": 3 - }, - "10": { - "name": "Replace battery soon", - "version": 3 - }, - "11": { - "name": "Replace battery now", - "version": 3 - }, - "12": { - "name": "Battery is charging", - "version": 4 - }, - "13": { - "name": "Battery is fully charged", - "version": 4 - }, - "14": { - "name": "Charge battery soon", - "version": 4 - }, - "15": { - "name": "Charge battery now!", - "version": 4 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "9": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "System hardware failure", - "version": 2 - }, - "2": { - "name": "System software failure", - "version": 2 - }, - "3": { - "name": "System hardware failure with manufacturer proprietary failure code", - "version": 3 - }, - "4": { - "name": "System software failure with manufacturer proprietary failure code", - "version": 3 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "10": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Contact Police", - "version": 2 - }, - "2": { - "name": "Contact Fire Service", - "version": 2 - }, - "3": { - "name": "Contact Medical Service", - "version": 2 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "11": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Wake Up Alert", - "version": 2 - }, - "2": { - "name": "Timer Ended", - "version": 3 - }, - "3": { - "name": "Time remaining", - "version": 4 - }, - "254": { - "name": "Unknown Event", - "version": 2 - } - }, - "12": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Program Started", - "version": 4 - }, - "2": { - "name": "Program in progress", - "version": 4 - }, - "3": { - "name": "Program completed", - "version": 4 - }, - "4": { - "name": "Replace main filter", - "version": 4 - }, - "5": { - "name": "Failure to set target temperature", - "version": 4 - }, - "6": { - "name": "Supplying water", - "version": 4 - }, - "7": { - "name": "Water supply failure", - "version": 4 - }, - "8": { - "name": "Boiling", - "version": 4 - }, - "9": { - "name": "Boiling failure", - "version": 4 - }, - "10": { - "name": "Washing", - "version": 4 - }, - "11": { - "name": "Washing failure", - "version": 4 - }, - "12": { - "name": "Rinsing", - "version": 4 - }, - "13": { - "name": "Rinsing failure", - "version": 4 - }, - "14": { - "name": "Draining", - "version": 4 - }, - "15": { - "name": "Draining failure", - "version": 4 - }, - "16": { - "name": "Spinning", - "version": 4 - }, - "17": { - "name": "Spinning failure", - "version": 4 - }, - "18": { - "name": "Drying", - "version": 4 - }, - "19": { - "name": "Drying failure", - "version": 4 - }, - "20": { - "name": "Fan failure", - "version": 4 - }, - "21": { - "name": "Compressor failure", - "version": 4 - }, - "254": { - "name": "Unknown Event", - "version": 4 - } - }, - "13": { - "0": { - "push": "Event inactive", - "pull": "Previous Events cleared", - "version": 4 - }, - "1": { - "name": "Leaving Bed", - "version": 4 - }, - "2": { - "name": "Sitting on bed", - "version": 4 - }, - "3": { - "name": "Lying on bed", - "version": 4 - }, - "4": { - "name": "Posture changed", - "version": 4 - }, - "5": { - "name": "Sitting on edge of bed", - "version": 4 - }, - "6": { - "name": "Volatile Organic Compound level", - "version": 4 - }, - "254": { - "name": "Unknown Event", - "version": 4 - } - } - -} \ No newline at end of file diff --git a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/NOTIFICATION/index.js b/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/NOTIFICATION/index.js deleted file mode 100644 index da290d0..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/NOTIFICATION/index.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -const events = require('./events.json'); - -module.exports = payload => { - - let eventNotificationType = payload['Notification Type (Raw)']; - if (Buffer.isBuffer(eventNotificationType) && eventNotificationType.length) { eventNotificationType = eventNotificationType[0].toString(); } - - let eventCode = payload['Event (Raw)']; - if (Buffer.isBuffer(eventCode) && eventCode.length) { eventCode = eventCode[0].toString(); } - - if (events[eventNotificationType] - && events[eventNotificationType][eventCode]) { - - let name = null; - if (events[eventNotificationType][eventCode].name) { - name = events[eventNotificationType][eventCode].name; - } else if (events[eventNotificationType][eventCode].push) { - name = events[eventNotificationType][eventCode].push; - } else if (events[eventNotificationType][eventCode].pull) { - name = events[eventNotificationType][eventCode].pull; - } - - payload['Event (Parsed 2)'] = name; - } - - return payload; - -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/SENSOR_ALARM/index.js b/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/SENSOR_ALARM/index.js deleted file mode 100644 index 0f2a11f..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/SENSOR_ALARM/index.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -module.exports = payload => { - - const alarms = { - 0: 'General Purpose Alarm', - 1: 'Smoke Alarm', - 2: 'CO Alarm', - 3: 'CO2 Alarm', - 4: 'Heat Alarm', - 5: 'Water Leak Alarm', - }; - - if (typeof payload['Bit Mask'] !== 'undefined') { - payload['Bit Mask (Parsed)'] = {}; - - for (const alarmValue in alarms) { - payload['Bit Mask (Parsed)'][alarms[alarmValue]] = getBitBE(payload['Bit Mask'][0], parseInt(alarmValue)); - } - } - - return payload; - -}; - -function getBitBE(value, position, size) { - return !!((1 << position) & value); -} diff --git a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/SENSOR_MULTILEVEL/index.js b/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/SENSOR_MULTILEVEL/index.js deleted file mode 100644 index 82b606e..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/commandclasses/SENSOR_MULTILEVEL/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -module.exports = payload => { - - if (typeof payload['Sensor Value'] !== 'undefined') { - try { - payload['Sensor Value (Parsed)'] = payload['Sensor Value'].readIntBE(0, payload.Level.Size); - payload['Sensor Value (Parsed)'] /= Math.pow(10, payload.Level.Precision); - } catch (err) {} - } - - return payload; - -}; diff --git a/node_modules/homey-meshdriver/lib/zwave/system/flows.json b/node_modules/homey-meshdriver/lib/zwave/system/flows.json deleted file mode 100644 index 520e664..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/flows.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "flow": { - "triggers": [ - { - "id": "lockJammed", - "zwaveDevice": "ZwaveLockDevice", - "title": { - "en": "The lock is jammed", - "nl": "Het slot is geblokkeerd" - }, - "hint": { - "en": "While trying to close the lock something obstructed the lock from closing completely.", - "nl": "Tijdens het sluiten van het slot blokkeerde er iets waardoor het slot niet kon worden gesloten." - }, - "args": [ - { - "name": "device", - "type": "device", - "filter": "driver_id=" - } - ] - } - ], - "actions": [ - { - "id": "resetMeter", - "zwaveDevice": "ZwaveMeteringDevice", - "title": { - "en": "Reset meter values", - "nl": "Meter waarden opnieuw instellen" - }, - "hint": { - "en": "Reset the accumulated power usage value (kWh), note that this can not be reversed.", - "nl": "Stel geaccumuleerde stroomverbruik waarde (kWh) opnieuw in, dit kan niet worden teruggedraaid." - }, - "args": [ - { - "name": "device", - "type": "device", - "filter": "" - } - ] - } - ] - } -} \ No newline at end of file diff --git a/node_modules/homey-meshdriver/lib/zwave/system/settings.json b/node_modules/homey-meshdriver/lib/zwave/system/settings.json deleted file mode 100644 index a575b4f..0000000 --- a/node_modules/homey-meshdriver/lib/zwave/system/settings.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "id": "invertWindowCoveringsDirection", - "zwaveDevice": "ZwaveWindowCoveringsDevice", - "type": "checkbox", - "label": { - "en": "Invert shutter movement direction", - "nl": "Keer rolluik beweging om" - }, - "value": false - }, - { - "id": "invertWindowCoveringsTiltDirection", - "zwaveDevice": "ZwaveWindowCoveringsDevice", - "type": "checkbox", - "label": { - "en": "Invert slats tilt direction", - "nl": "Draai lamelrichting om" - }, - "value": false - } -] \ No newline at end of file diff --git a/node_modules/homey-meshdriver/locales/en.json b/node_modules/homey-meshdriver/locales/en.json deleted file mode 100644 index 97c3f3e..0000000 --- a/node_modules/homey-meshdriver/locales/en.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "error": { - "missing_cc_configuration": "Device is not capable of changing settings, re-add it to Homey and try again.", - "invalid_ieeeaddr": "Device not found in network", - "could_not_find_zigbee_shepherd_device": "Device seems to be removed from the network", - "unknown": "Unknown error" - } -} \ No newline at end of file diff --git a/node_modules/homey-meshdriver/locales/nl.json b/node_modules/homey-meshdriver/locales/nl.json deleted file mode 100644 index 121074b..0000000 --- a/node_modules/homey-meshdriver/locales/nl.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "error": { - "missing_cc_configuration": "Apparaat is niet in staat instellingen aan te passen, voeg opnieuw toe aan Homey en probeer opnieuw.", - "invalid_ieeeaddr": "Apparaat niet gevonden in netwerk", - "could_not_find_zigbee_shepherd_device": "Apparaat lijkt te zijn verwijderd van het netwerk", - "unknown": "Onbekend probleem" - } -} diff --git a/node_modules/homey-meshdriver/package.json b/node_modules/homey-meshdriver/package.json deleted file mode 100644 index 0a72b1d..0000000 --- a/node_modules/homey-meshdriver/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "_from": "git+https://github.com/athombv/node-homey-meshdriver.git", - "_id": "homey-meshdriver@1.3.3", - "_inBundle": false, - "_integrity": "", - "_location": "/homey-meshdriver", - "_phantomChildren": {}, - "_requested": { - "type": "git", - "raw": "git+https://github.com/athombv/node-homey-meshdriver.git", - "rawSpec": "git+https://github.com/athombv/node-homey-meshdriver.git", - "saveSpec": "git+https://github.com/athombv/node-homey-meshdriver.git", - "fetchSpec": "https://github.com/athombv/node-homey-meshdriver.git", - "gitCommittish": null - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "git+https://github.com/athombv/node-homey-meshdriver.git#e971e6a55c241ad87b8f91a1c43c5745d6131963", - "_spec": "git+https://github.com/athombv/node-homey-meshdriver.git", - "_where": "D:\\Projects\\Homey\\com.sensative", - "author": "", - "bundleDependencies": false, - "config": { - "npmPublishTagProduction": "latest", - "npmPublishTagStaging": "beta" - }, - "dependencies": { - "color-space": "^1.14.7" - }, - "deprecated": false, - "description": "This module is used to make the creation of Z-Wave & ZigBee apps easier.", - "devDependencies": { - "grunt": "^1.0.1", - "grunt-contrib-watch": "^1.0.0", - "grunt-jsdoc": "^2.2.1" - }, - "engines": { - "node": ">=8" - }, - "license": "ISC", - "main": "index.js", - "name": "homey-meshdriver", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "updateDocs": "npm install --only=dev; grunt jsdoc" - }, - "version": "1.3.3" -} diff --git a/node_modules/hsluv/README.md b/node_modules/hsluv/README.md deleted file mode 100644 index b03c468..0000000 --- a/node_modules/hsluv/README.md +++ /dev/null @@ -1,74 +0,0 @@ -# HSLuv - Human-friendly HSL - -## Installation - -Client-side: download [the latest hsluv.min.js](https://github.com/hsluv/hsluv/tree/master/javascript/dist). - -Once this module is loaded in the browser, you can access it via the -global ``window.hsluv``. - -Server-side: ``npm install hsluv``. - -## Usage - -Most functions take tuples, ie: Javascript arrays with three elements. Make sure you are using -`func([a,b,c])` and not `func(a,b,c)`. If you are getting NaN for output then this is probably -the problem. - -**hsluvToHex([hue, saturation, lightness])** - -*hue* is a number between 0 and 360, *saturation* and *lightness* are -numbers between 0 and 100. This function returns the resulting color as -a hex string. - -**hsluvToRgb([hue, saturation, lightness])** - -Like above, but returns an array of 3 numbers between 0 and 1, for the -r, g, and b channel. - -**hexToHsluv(hex)** - -Takes a hex string and returns the HSLuv color as array that contains -the hue (0-360), saturation (0-100) and lightness (0-100) channel. -_Note:_ The result can have rounding errors. For example saturation can -be 100.00000000000007 - -**rgbToHsluv([red, green, blue])** - -Like above, but *red*, *green* and *blue* are passed as numbers between -0 and 1. - -Use **hpluvToHex**, **hpluvToRgb**, **hexToHpluv** and **rgbToHpluv** for -the pastel variant (HPLuv). Note that HPLuv does not contain all the colors -of RGB, so converting arbitrary RGB to it may generate invalid HPLuv colors. - -For advance use cases, additional functions are avalible: - -**hsluvToLch**, **lchToHsluv** - -**hpluvToLch**, **lchToHpluv** - -**rgbToXyz**, **xyzToRgb** - -**rgbToLch**, **lchToRgb** - -**luvToXyz**, **xyzToLuv** - -**lchToLuv**, **luvToLch** - -Also available for [Stylus](http://stylus-lang.com/). See -[here](https://github.com/hsluv/hsluv-stylus). - -## Changelog - -### 0.0.3 - -- Expose intermediate functions in the public API. - -### 0.0.2 - -- Improve packaging and minification. - -### 0.0.1 - -- Initial release under the name HSLuv. Old releases can be found [here](https://www.npmjs.com/package/husl). diff --git a/node_modules/hsluv/hsluv.js b/node_modules/hsluv/hsluv.js deleted file mode 100644 index 270b9bb..0000000 --- a/node_modules/hsluv/hsluv.js +++ /dev/null @@ -1,329 +0,0 @@ -// Generated by Haxe 3.4.4 -var hsluv = hsluv || {}; -hsluv.Geometry = function() { }; -hsluv.Geometry.intersectLineLine = function(a,b) { - var x = (a.intercept - b.intercept) / (b.slope - a.slope); - var y = a.slope * x + a.intercept; - return { x : x, y : y}; -}; -hsluv.Geometry.distanceFromOrigin = function(point) { - return Math.sqrt(Math.pow(point.x,2) + Math.pow(point.y,2)); -}; -hsluv.Geometry.distanceLineFromOrigin = function(line) { - return Math.abs(line.intercept) / Math.sqrt(Math.pow(line.slope,2) + 1); -}; -hsluv.Geometry.perpendicularThroughPoint = function(line,point) { - var slope = -1 / line.slope; - var intercept = point.y - slope * point.x; - return { slope : slope, intercept : intercept}; -}; -hsluv.Geometry.angleFromOrigin = function(point) { - return Math.atan2(point.y,point.x); -}; -hsluv.Geometry.normalizeAngle = function(angle) { - var m = 2 * Math.PI; - return (angle % m + m) % m; -}; -hsluv.Geometry.lengthOfRayUntilIntersect = function(theta,line) { - return line.intercept / (Math.sin(theta) - line.slope * Math.cos(theta)); -}; -hsluv.Hsluv = function() { }; -hsluv.Hsluv.getBounds = function(L) { - var result = []; - var sub1 = Math.pow(L + 16,3) / 1560896; - var sub2 = sub1 > hsluv.Hsluv.epsilon ? sub1 : L / hsluv.Hsluv.kappa; - var _g = 0; - while(_g < 3) { - var c = _g++; - var m1 = hsluv.Hsluv.m[c][0]; - var m2 = hsluv.Hsluv.m[c][1]; - var m3 = hsluv.Hsluv.m[c][2]; - var _g1 = 0; - while(_g1 < 2) { - var t = _g1++; - var top1 = (284517 * m1 - 94839 * m3) * sub2; - var top2 = (838422 * m3 + 769860 * m2 + 731718 * m1) * L * sub2 - 769860 * t * L; - var bottom = (632260 * m3 - 126452 * m2) * sub2 + 126452 * t; - result.push({ slope : top1 / bottom, intercept : top2 / bottom}); - } - } - return result; -}; -hsluv.Hsluv.maxSafeChromaForL = function(L) { - var bounds = hsluv.Hsluv.getBounds(L); - var min = Infinity; - var _g = 0; - while(_g < bounds.length) { - var bound = bounds[_g]; - ++_g; - var length = hsluv.Geometry.distanceLineFromOrigin(bound); - min = Math.min(min,length); - } - return min; -}; -hsluv.Hsluv.maxChromaForLH = function(L,H) { - var hrad = H / 360 * Math.PI * 2; - var bounds = hsluv.Hsluv.getBounds(L); - var min = Infinity; - var _g = 0; - while(_g < bounds.length) { - var bound = bounds[_g]; - ++_g; - var length = hsluv.Geometry.lengthOfRayUntilIntersect(hrad,bound); - if(length >= 0) { - min = Math.min(min,length); - } - } - return min; -}; -hsluv.Hsluv.dotProduct = function(a,b) { - var sum = 0; - var _g1 = 0; - var _g = a.length; - while(_g1 < _g) { - var i = _g1++; - sum += a[i] * b[i]; - } - return sum; -}; -hsluv.Hsluv.fromLinear = function(c) { - if(c <= 0.0031308) { - return 12.92 * c; - } else { - return 1.055 * Math.pow(c,0.416666666666666685) - 0.055; - } -}; -hsluv.Hsluv.toLinear = function(c) { - if(c > 0.04045) { - return Math.pow((c + 0.055) / 1.055,2.4); - } else { - return c / 12.92; - } -}; -hsluv.Hsluv.xyzToRgb = function(tuple) { - return [hsluv.Hsluv.fromLinear(hsluv.Hsluv.dotProduct(hsluv.Hsluv.m[0],tuple)),hsluv.Hsluv.fromLinear(hsluv.Hsluv.dotProduct(hsluv.Hsluv.m[1],tuple)),hsluv.Hsluv.fromLinear(hsluv.Hsluv.dotProduct(hsluv.Hsluv.m[2],tuple))]; -}; -hsluv.Hsluv.rgbToXyz = function(tuple) { - var rgbl = [hsluv.Hsluv.toLinear(tuple[0]),hsluv.Hsluv.toLinear(tuple[1]),hsluv.Hsluv.toLinear(tuple[2])]; - return [hsluv.Hsluv.dotProduct(hsluv.Hsluv.minv[0],rgbl),hsluv.Hsluv.dotProduct(hsluv.Hsluv.minv[1],rgbl),hsluv.Hsluv.dotProduct(hsluv.Hsluv.minv[2],rgbl)]; -}; -hsluv.Hsluv.yToL = function(Y) { - if(Y <= hsluv.Hsluv.epsilon) { - return Y / hsluv.Hsluv.refY * hsluv.Hsluv.kappa; - } else { - return 116 * Math.pow(Y / hsluv.Hsluv.refY,0.333333333333333315) - 16; - } -}; -hsluv.Hsluv.lToY = function(L) { - if(L <= 8) { - return hsluv.Hsluv.refY * L / hsluv.Hsluv.kappa; - } else { - return hsluv.Hsluv.refY * Math.pow((L + 16) / 116,3); - } -}; -hsluv.Hsluv.xyzToLuv = function(tuple) { - var X = tuple[0]; - var Y = tuple[1]; - var Z = tuple[2]; - var divider = X + 15 * Y + 3 * Z; - var varU = 4 * X; - var varV = 9 * Y; - if(divider != 0) { - varU /= divider; - varV /= divider; - } else { - varU = NaN; - varV = NaN; - } - var L = hsluv.Hsluv.yToL(Y); - if(L == 0) { - return [0,0,0]; - } - var U = 13 * L * (varU - hsluv.Hsluv.refU); - var V = 13 * L * (varV - hsluv.Hsluv.refV); - return [L,U,V]; -}; -hsluv.Hsluv.luvToXyz = function(tuple) { - var L = tuple[0]; - var U = tuple[1]; - var V = tuple[2]; - if(L == 0) { - return [0,0,0]; - } - var varU = U / (13 * L) + hsluv.Hsluv.refU; - var varV = V / (13 * L) + hsluv.Hsluv.refV; - var Y = hsluv.Hsluv.lToY(L); - var X = 0 - 9 * Y * varU / ((varU - 4) * varV - varU * varV); - var Z = (9 * Y - 15 * varV * Y - varV * X) / (3 * varV); - return [X,Y,Z]; -}; -hsluv.Hsluv.luvToLch = function(tuple) { - var L = tuple[0]; - var U = tuple[1]; - var V = tuple[2]; - var C = Math.sqrt(U * U + V * V); - var H; - if(C < 0.00000001) { - H = 0; - } else { - var Hrad = Math.atan2(V,U); - H = Hrad * 180.0 / Math.PI; - if(H < 0) { - H = 360 + H; - } - } - return [L,C,H]; -}; -hsluv.Hsluv.lchToLuv = function(tuple) { - var L = tuple[0]; - var C = tuple[1]; - var H = tuple[2]; - var Hrad = H / 360.0 * 2 * Math.PI; - var U = Math.cos(Hrad) * C; - var V = Math.sin(Hrad) * C; - return [L,U,V]; -}; -hsluv.Hsluv.hsluvToLch = function(tuple) { - var H = tuple[0]; - var S = tuple[1]; - var L = tuple[2]; - if(L > 99.9999999) { - return [100,0,H]; - } - if(L < 0.00000001) { - return [0,0,H]; - } - var max = hsluv.Hsluv.maxChromaForLH(L,H); - var C = max / 100 * S; - return [L,C,H]; -}; -hsluv.Hsluv.lchToHsluv = function(tuple) { - var L = tuple[0]; - var C = tuple[1]; - var H = tuple[2]; - if(L > 99.9999999) { - return [H,0,100]; - } - if(L < 0.00000001) { - return [H,0,0]; - } - var max = hsluv.Hsluv.maxChromaForLH(L,H); - var S = C / max * 100; - return [H,S,L]; -}; -hsluv.Hsluv.hpluvToLch = function(tuple) { - var H = tuple[0]; - var S = tuple[1]; - var L = tuple[2]; - if(L > 99.9999999) { - return [100,0,H]; - } - if(L < 0.00000001) { - return [0,0,H]; - } - var max = hsluv.Hsluv.maxSafeChromaForL(L); - var C = max / 100 * S; - return [L,C,H]; -}; -hsluv.Hsluv.lchToHpluv = function(tuple) { - var L = tuple[0]; - var C = tuple[1]; - var H = tuple[2]; - if(L > 99.9999999) { - return [H,0,100]; - } - if(L < 0.00000001) { - return [H,0,0]; - } - var max = hsluv.Hsluv.maxSafeChromaForL(L); - var S = C / max * 100; - return [H,S,L]; -}; -hsluv.Hsluv.rgbToHex = function(tuple) { - var h = "#"; - var _g = 0; - while(_g < 3) { - var i = _g++; - var chan = tuple[i]; - var c = Math.round(chan * 255); - var digit2 = c % 16; - var digit1 = (c - digit2) / 16 | 0; - h += hsluv.Hsluv.hexChars.charAt(digit1) + hsluv.Hsluv.hexChars.charAt(digit2); - } - return h; -}; -hsluv.Hsluv.hexToRgb = function(hex) { - hex = hex.toLowerCase(); - var ret = []; - var _g = 0; - while(_g < 3) { - var i = _g++; - var digit1 = hsluv.Hsluv.hexChars.indexOf(hex.charAt(i * 2 + 1)); - var digit2 = hsluv.Hsluv.hexChars.indexOf(hex.charAt(i * 2 + 2)); - var n = digit1 * 16 + digit2; - ret.push(n / 255.0); - } - return ret; -}; -hsluv.Hsluv.lchToRgb = function(tuple) { - return hsluv.Hsluv.xyzToRgb(hsluv.Hsluv.luvToXyz(hsluv.Hsluv.lchToLuv(tuple))); -}; -hsluv.Hsluv.rgbToLch = function(tuple) { - return hsluv.Hsluv.luvToLch(hsluv.Hsluv.xyzToLuv(hsluv.Hsluv.rgbToXyz(tuple))); -}; -hsluv.Hsluv.hsluvToRgb = function(tuple) { - return hsluv.Hsluv.lchToRgb(hsluv.Hsluv.hsluvToLch(tuple)); -}; -hsluv.Hsluv.rgbToHsluv = function(tuple) { - return hsluv.Hsluv.lchToHsluv(hsluv.Hsluv.rgbToLch(tuple)); -}; -hsluv.Hsluv.hpluvToRgb = function(tuple) { - return hsluv.Hsluv.lchToRgb(hsluv.Hsluv.hpluvToLch(tuple)); -}; -hsluv.Hsluv.rgbToHpluv = function(tuple) { - return hsluv.Hsluv.lchToHpluv(hsluv.Hsluv.rgbToLch(tuple)); -}; -hsluv.Hsluv.hsluvToHex = function(tuple) { - return hsluv.Hsluv.rgbToHex(hsluv.Hsluv.hsluvToRgb(tuple)); -}; -hsluv.Hsluv.hpluvToHex = function(tuple) { - return hsluv.Hsluv.rgbToHex(hsluv.Hsluv.hpluvToRgb(tuple)); -}; -hsluv.Hsluv.hexToHsluv = function(s) { - return hsluv.Hsluv.rgbToHsluv(hsluv.Hsluv.hexToRgb(s)); -}; -hsluv.Hsluv.hexToHpluv = function(s) { - return hsluv.Hsluv.rgbToHpluv(hsluv.Hsluv.hexToRgb(s)); -}; -hsluv.Hsluv.m = [[3.240969941904521,-1.537383177570093,-0.498610760293],[-0.96924363628087,1.87596750150772,0.041555057407175],[0.055630079696993,-0.20397695888897,1.056971514242878]]; -hsluv.Hsluv.minv = [[0.41239079926595,0.35758433938387,0.18048078840183],[0.21263900587151,0.71516867876775,0.072192315360733],[0.019330818715591,0.11919477979462,0.95053215224966]]; -hsluv.Hsluv.refY = 1.0; -hsluv.Hsluv.refU = 0.19783000664283; -hsluv.Hsluv.refV = 0.46831999493879; -hsluv.Hsluv.kappa = 903.2962962; -hsluv.Hsluv.epsilon = 0.0088564516; -hsluv.Hsluv.hexChars = "0123456789abcdef"; -var root = { - "hsluvToRgb": hsluv.Hsluv.hsluvToRgb, - "rgbToHsluv": hsluv.Hsluv.rgbToHsluv, - "hpluvToRgb": hsluv.Hsluv.hpluvToRgb, - "rgbToHpluv": hsluv.Hsluv.rgbToHpluv, - "hsluvToHex": hsluv.Hsluv.hsluvToHex, - "hexToHsluv": hsluv.Hsluv.hexToHsluv, - "hpluvToHex": hsluv.Hsluv.hpluvToHex, - "hexToHpluv": hsluv.Hsluv.hexToHpluv, - "lchToHpluv": hsluv.Hsluv.lchToHpluv, - "hpluvToLch": hsluv.Hsluv.hpluvToLch, - "lchToHsluv": hsluv.Hsluv.lchToHsluv, - "hsluvToLch": hsluv.Hsluv.hsluvToLch, - "lchToLuv": hsluv.Hsluv.lchToLuv, - "luvToLch": hsluv.Hsluv.luvToLch, - "xyzToLuv": hsluv.Hsluv.xyzToLuv, - "luvToXyz": hsluv.Hsluv.luvToXyz, - "xyzToRgb": hsluv.Hsluv.xyzToRgb, - "rgbToXyz": hsluv.Hsluv.rgbToXyz, - "lchToRgb": hsluv.Hsluv.lchToRgb, - "rgbToLch": hsluv.Hsluv.rgbToLch -}; - -module.exports = root; diff --git a/node_modules/hsluv/package.json b/node_modules/hsluv/package.json deleted file mode 100644 index c4af574..0000000 --- a/node_modules/hsluv/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "_from": "hsluv@^0.0.3", - "_id": "hsluv@0.0.3", - "_inBundle": false, - "_integrity": "sha1-gpEH2vtKn4tSoYCe0C4JHq3mdUw=", - "_location": "/hsluv", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "hsluv@^0.0.3", - "name": "hsluv", - "escapedName": "hsluv", - "rawSpec": "^0.0.3", - "saveSpec": null, - "fetchSpec": "^0.0.3" - }, - "_requiredBy": [ - "/color-space" - ], - "_resolved": "https://registry.npmjs.org/hsluv/-/hsluv-0.0.3.tgz", - "_shasum": "829107dafb4a9f8b52a1809ed02e091eade6754c", - "_spec": "hsluv@^0.0.3", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\color-space", - "author": { - "name": "Alexei Boronine", - "email": "alexei@boronine.com" - }, - "bugs": { - "url": "https://github.com/hsluv/hsluv/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Human-friendly HSL", - "files": [ - "hsluv.js" - ], - "homepage": "http://www.hsluv.org", - "keywords": [ - "color", - "color space", - "CIE", - "RGB", - "HSL", - "HSLuv", - "HPLuv" - ], - "license": "MIT", - "main": "hsluv.js", - "name": "hsluv", - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/hsluv/hsluv.git" - }, - "version": "0.0.3" -} diff --git a/node_modules/json-stringify-safe/.npmignore b/node_modules/json-stringify-safe/.npmignore deleted file mode 100644 index 17d6b36..0000000 --- a/node_modules/json-stringify-safe/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/*.tgz diff --git a/node_modules/json-stringify-safe/CHANGELOG.md b/node_modules/json-stringify-safe/CHANGELOG.md deleted file mode 100644 index 42bcb60..0000000 --- a/node_modules/json-stringify-safe/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -## Unreleased -- Fixes stringify to only take ancestors into account when checking - circularity. - It previously assumed every visited object was circular which led to [false - positives][issue9]. - Uses the tiny serializer I wrote for [Must.js][must] a year and a half ago. -- Fixes calling the `replacer` function in the proper context (`thisArg`). -- Fixes calling the `cycleReplacer` function in the proper context (`thisArg`). -- Speeds serializing by a factor of - Big-O(h-my-god-it-linearly-searched-every-object) it had ever seen. Searching - only the ancestors for a circular references speeds up things considerably. - -[must]: https://github.com/moll/js-must -[issue9]: https://github.com/isaacs/json-stringify-safe/issues/9 diff --git a/node_modules/json-stringify-safe/LICENSE b/node_modules/json-stringify-safe/LICENSE deleted file mode 100644 index 19129e3..0000000 --- a/node_modules/json-stringify-safe/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/json-stringify-safe/Makefile b/node_modules/json-stringify-safe/Makefile deleted file mode 100644 index 36088c7..0000000 --- a/node_modules/json-stringify-safe/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -NODE_OPTS = -TEST_OPTS = - -love: - @echo "Feel like makin' love." - -test: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot $(TEST_OPTS) - -spec: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec $(TEST_OPTS) - -autotest: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot --watch $(TEST_OPTS) - -autospec: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec --watch $(TEST_OPTS) - -pack: - @file=$$(npm pack); echo "$$file"; tar tf "$$file" - -publish: - npm publish - -tag: - git tag "v$$(node -e 'console.log(require("./package").version)')" - -clean: - rm -f *.tgz - npm prune --production - -.PHONY: love -.PHONY: test spec autotest autospec -.PHONY: pack publish tag -.PHONY: clean diff --git a/node_modules/json-stringify-safe/README.md b/node_modules/json-stringify-safe/README.md deleted file mode 100644 index a11f302..0000000 --- a/node_modules/json-stringify-safe/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# json-stringify-safe - -Like JSON.stringify, but doesn't throw on circular references. - -## Usage - -Takes the same arguments as `JSON.stringify`. - -```javascript -var stringify = require('json-stringify-safe'); -var circularObj = {}; -circularObj.circularRef = circularObj; -circularObj.list = [ circularObj, circularObj ]; -console.log(stringify(circularObj, null, 2)); -``` - -Output: - -```json -{ - "circularRef": "[Circular]", - "list": [ - "[Circular]", - "[Circular]" - ] -} -``` - -## Details - -``` -stringify(obj, serializer, indent, decycler) -``` - -The first three arguments are the same as to JSON.stringify. The last -is an argument that's only used when the object has been seen already. - -The default `decycler` function returns the string `'[Circular]'`. -If, for example, you pass in `function(k,v){}` (return nothing) then it -will prune cycles. If you pass in `function(k,v){ return {foo: 'bar'}}`, -then cyclical objects will always be represented as `{"foo":"bar"}` in -the result. - -``` -stringify.getSerialize(serializer, decycler) -``` - -Returns a serializer that can be used elsewhere. This is the actual -function that's passed to JSON.stringify. - -**Note** that the function returned from `getSerialize` is stateful for now, so -do **not** use it more than once. diff --git a/node_modules/json-stringify-safe/package.json b/node_modules/json-stringify-safe/package.json deleted file mode 100644 index 587ec3e..0000000 --- a/node_modules/json-stringify-safe/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "_from": "json-stringify-safe@5.0.1", - "_id": "json-stringify-safe@5.0.1", - "_inBundle": false, - "_integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "_location": "/json-stringify-safe", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "json-stringify-safe@5.0.1", - "name": "json-stringify-safe", - "escapedName": "json-stringify-safe", - "rawSpec": "5.0.1", - "saveSpec": null, - "fetchSpec": "5.0.1" - }, - "_requiredBy": [ - "/raven" - ], - "_resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "_shasum": "1296a2d58fd45f19a0f6ce01d65701e2c735b6eb", - "_spec": "json-stringify-safe@5.0.1", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\raven", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - }, - "bugs": { - "url": "https://github.com/isaacs/json-stringify-safe/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Andri Möll", - "email": "andri@dot.ee", - "url": "http://themoll.com" - } - ], - "deprecated": false, - "description": "Like JSON.stringify, but doesn't blow up on circular refs.", - "devDependencies": { - "mocha": ">= 2.1.0 < 3", - "must": ">= 0.12 < 0.13", - "sinon": ">= 1.12.2 < 2" - }, - "homepage": "https://github.com/isaacs/json-stringify-safe", - "keywords": [ - "json", - "stringify", - "circular", - "safe" - ], - "license": "ISC", - "main": "stringify.js", - "name": "json-stringify-safe", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/json-stringify-safe.git" - }, - "scripts": { - "test": "node test.js" - }, - "version": "5.0.1" -} diff --git a/node_modules/json-stringify-safe/stringify.js b/node_modules/json-stringify-safe/stringify.js deleted file mode 100644 index 124a452..0000000 --- a/node_modules/json-stringify-safe/stringify.js +++ /dev/null @@ -1,27 +0,0 @@ -exports = module.exports = stringify -exports.getSerialize = serializer - -function stringify(obj, replacer, spaces, cycleReplacer) { - return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces) -} - -function serializer(replacer, cycleReplacer) { - var stack = [], keys = [] - - if (cycleReplacer == null) cycleReplacer = function(key, value) { - if (stack[0] === value) return "[Circular ~]" - return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]" - } - - return function(key, value) { - if (stack.length > 0) { - var thisPos = stack.indexOf(this) - ~thisPos ? stack.splice(thisPos + 1) : stack.push(this) - ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key) - if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value) - } - else stack.push(value) - - return replacer == null ? value : replacer.call(this, key, value) - } -} diff --git a/node_modules/json-stringify-safe/test/mocha.opts b/node_modules/json-stringify-safe/test/mocha.opts deleted file mode 100644 index 2544e58..0000000 --- a/node_modules/json-stringify-safe/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---recursive ---require must diff --git a/node_modules/json-stringify-safe/test/stringify_test.js b/node_modules/json-stringify-safe/test/stringify_test.js deleted file mode 100644 index 5b32583..0000000 --- a/node_modules/json-stringify-safe/test/stringify_test.js +++ /dev/null @@ -1,246 +0,0 @@ -var Sinon = require("sinon") -var stringify = require("..") -function jsonify(obj) { return JSON.stringify(obj, null, 2) } - -describe("Stringify", function() { - it("must stringify circular objects", function() { - var obj = {name: "Alice"} - obj.self = obj - var json = stringify(obj, null, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - }) - - it("must stringify circular objects with intermediaries", function() { - var obj = {name: "Alice"} - obj.identity = {self: obj} - var json = stringify(obj, null, 2) - json.must.eql(jsonify({name: "Alice", identity: {self: "[Circular ~]"}})) - }) - - it("must stringify circular objects deeper", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - obj.child.self = obj.child - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - child: {name: "Bob", self: "[Circular ~.child]"} - })) - }) - - it("must stringify circular objects deeper with intermediaries", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - obj.child.identity = {self: obj.child} - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - child: {name: "Bob", identity: {self: "[Circular ~.child]"}} - })) - }) - - it("must stringify circular objects in an array", function() { - var obj = {name: "Alice"} - obj.self = [obj, obj] - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", self: ["[Circular ~]", "[Circular ~]"] - })) - }) - - it("must stringify circular objects deeper in an array", function() { - var obj = {name: "Alice", children: [{name: "Bob"}, {name: "Eve"}]} - obj.children[0].self = obj.children[0] - obj.children[1].self = obj.children[1] - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - children: [ - {name: "Bob", self: "[Circular ~.children.0]"}, - {name: "Eve", self: "[Circular ~.children.1]"} - ] - })) - }) - - it("must stringify circular arrays", function() { - var obj = [] - obj.push(obj) - obj.push(obj) - var json = stringify(obj, null, 2) - json.must.eql(jsonify(["[Circular ~]", "[Circular ~]"])) - }) - - it("must stringify circular arrays with intermediaries", function() { - var obj = [] - obj.push({name: "Alice", self: obj}) - obj.push({name: "Bob", self: obj}) - - stringify(obj, null, 2).must.eql(jsonify([ - {name: "Alice", self: "[Circular ~]"}, - {name: "Bob", self: "[Circular ~]"} - ])) - }) - - it("must stringify repeated objects in objects", function() { - var obj = {} - var alice = {name: "Alice"} - obj.alice1 = alice - obj.alice2 = alice - - stringify(obj, null, 2).must.eql(jsonify({ - alice1: {name: "Alice"}, - alice2: {name: "Alice"} - })) - }) - - it("must stringify repeated objects in arrays", function() { - var alice = {name: "Alice"} - var obj = [alice, alice] - var json = stringify(obj, null, 2) - json.must.eql(jsonify([{name: "Alice"}, {name: "Alice"}])) - }) - - it("must call given decycler and use its output", function() { - var obj = {} - obj.a = obj - obj.b = obj - - var decycle = Sinon.spy(function() { return decycle.callCount }) - var json = stringify(obj, null, 2, decycle) - json.must.eql(jsonify({a: 1, b: 2}, null, 2)) - - decycle.callCount.must.equal(2) - decycle.thisValues[0].must.equal(obj) - decycle.args[0][0].must.equal("a") - decycle.args[0][1].must.equal(obj) - decycle.thisValues[1].must.equal(obj) - decycle.args[1][0].must.equal("b") - decycle.args[1][1].must.equal(obj) - }) - - it("must call replacer and use its output", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - - var replacer = Sinon.spy(bangString) - var json = stringify(obj, replacer, 2) - json.must.eql(jsonify({name: "Alice!", child: {name: "Bob!"}})) - - replacer.callCount.must.equal(4) - replacer.args[0][0].must.equal("") - replacer.args[0][1].must.equal(obj) - replacer.thisValues[1].must.equal(obj) - replacer.args[1][0].must.equal("name") - replacer.args[1][1].must.equal("Alice") - replacer.thisValues[2].must.equal(obj) - replacer.args[2][0].must.equal("child") - replacer.args[2][1].must.equal(obj.child) - replacer.thisValues[3].must.equal(obj.child) - replacer.args[3][0].must.equal("name") - replacer.args[3][1].must.equal("Bob") - }) - - it("must call replacer after describing circular references", function() { - var obj = {name: "Alice"} - obj.self = obj - - var replacer = Sinon.spy(bangString) - var json = stringify(obj, replacer, 2) - json.must.eql(jsonify({name: "Alice!", self: "[Circular ~]!"})) - - replacer.callCount.must.equal(3) - replacer.args[0][0].must.equal("") - replacer.args[0][1].must.equal(obj) - replacer.thisValues[1].must.equal(obj) - replacer.args[1][0].must.equal("name") - replacer.args[1][1].must.equal("Alice") - replacer.thisValues[2].must.equal(obj) - replacer.args[2][0].must.equal("self") - replacer.args[2][1].must.equal("[Circular ~]") - }) - - it("must call given decycler and use its output for nested objects", - function() { - var obj = {} - obj.a = obj - obj.b = {self: obj} - - var decycle = Sinon.spy(function() { return decycle.callCount }) - var json = stringify(obj, null, 2, decycle) - json.must.eql(jsonify({a: 1, b: {self: 2}})) - - decycle.callCount.must.equal(2) - decycle.args[0][0].must.equal("a") - decycle.args[0][1].must.equal(obj) - decycle.args[1][0].must.equal("self") - decycle.args[1][1].must.equal(obj) - }) - - it("must use decycler's output when it returned null", function() { - var obj = {a: "b"} - obj.self = obj - obj.selves = [obj, obj] - - function decycle() { return null } - stringify(obj, null, 2, decycle).must.eql(jsonify({ - a: "b", - self: null, - selves: [null, null] - })) - }) - - it("must use decycler's output when it returned undefined", function() { - var obj = {a: "b"} - obj.self = obj - obj.selves = [obj, obj] - - function decycle() {} - stringify(obj, null, 2, decycle).must.eql(jsonify({ - a: "b", - selves: [null, null] - })) - }) - - it("must throw given a decycler that returns a cycle", function() { - var obj = {} - obj.self = obj - var err - function identity(key, value) { return value } - try { stringify(obj, null, 2, identity) } catch (ex) { err = ex } - err.must.be.an.instanceof(TypeError) - }) - - describe(".getSerialize", function() { - it("must stringify circular objects", function() { - var obj = {a: "b"} - obj.circularRef = obj - obj.list = [obj, obj] - - var json = JSON.stringify(obj, stringify.getSerialize(), 2) - json.must.eql(jsonify({ - "a": "b", - "circularRef": "[Circular ~]", - "list": ["[Circular ~]", "[Circular ~]"] - })) - }) - - // This is the behavior as of Mar 3, 2015. - // The serializer function keeps state inside the returned function and - // so far I'm not sure how to not do that. JSON.stringify's replacer is not - // called _after_ serialization. - xit("must return a function that could be called twice", function() { - var obj = {name: "Alice"} - obj.self = obj - - var json - var serializer = stringify.getSerialize() - - json = JSON.stringify(obj, serializer, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - - json = JSON.stringify(obj, serializer, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - }) - }) -}) - -function bangString(key, value) { - return typeof value == "string" ? value + "!" : value -} diff --git a/node_modules/lsmod/.npmignore b/node_modules/lsmod/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/lsmod/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/lsmod/.travis.yml b/node_modules/lsmod/.travis.yml deleted file mode 100644 index 9400c11..0000000 --- a/node_modules/lsmod/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.6" - - "0.8" - - "0.10" diff --git a/node_modules/lsmod/README.md b/node_modules/lsmod/README.md deleted file mode 100644 index d54c5d3..0000000 --- a/node_modules/lsmod/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# lsmod [![Build Status](https://secure.travis-ci.org/defunctzombie/node-lsmod.png?branch=master)](https://travis-ci.org/defunctzombie/node-lsmod) - -lsmod fetches the list of modules and the versions loaded by the entry file for your node.js app. - -## use - -```javascript -var lsmod = require('lsmod'); - -// get an object with module version information -var modules = lsmod(); - -// modules is an object `key:version` -{ - express: '3.0.5', - hbs: '2.0.1' -} -``` - -Note that the version is the actual installed version and not the dependency version string. - -## install via [npm](https://npmjs.org) - -``` -npm install lsmod -``` diff --git a/node_modules/lsmod/index.js b/node_modules/lsmod/index.js deleted file mode 100644 index 42a9be6..0000000 --- a/node_modules/lsmod/index.js +++ /dev/null @@ -1,55 +0,0 @@ -// builtin -var fs = require('fs'); -var path = require('path'); - -// node 0.6 support -fs.existsSync = fs.existsSync || path.existsSync; - -// main_paths are the paths where our mainprog will be able to load from -// we store these to avoid grabbing the modules that were loaded as a result -// of a dependency module loading its dependencies, we only care about deps our -// mainprog loads -var main_paths = require.main && require.main.paths || []; - -module.exports = function() { - var paths = Object.keys(require.cache || []); - - // module information - var infos = {}; - - // paths we have already inspected to avoid traversing again - var seen = {}; - - paths.forEach(function(p) { - var dir = p; - - (function updir() { - var orig = dir; - dir = path.dirname(orig); - - if (!dir || orig === dir || seen[orig]) { - return; - } - else if (main_paths.indexOf(dir) < 0) { - return updir(); - } - - var pkgfile = path.join(orig, 'package.json'); - var exists = fs.existsSync(pkgfile); - - seen[orig] = true; - - // travel up the tree if no package.json here - if (!exists) { - return updir(); - } - - try { - var info = JSON.parse(fs.readFileSync(pkgfile, 'utf8')); - infos[info.name] = info.version; - } catch (e) {}; - })(); - }); - - return infos; -}; diff --git a/node_modules/lsmod/package.json b/node_modules/lsmod/package.json deleted file mode 100644 index 24fba39..0000000 --- a/node_modules/lsmod/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "_from": "lsmod@1.0.0", - "_id": "lsmod@1.0.0", - "_inBundle": false, - "_integrity": "sha1-mgD3bco26yP6BTUK/htYXUKZ5ks=", - "_location": "/lsmod", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "lsmod@1.0.0", - "name": "lsmod", - "escapedName": "lsmod", - "rawSpec": "1.0.0", - "saveSpec": null, - "fetchSpec": "1.0.0" - }, - "_requiredBy": [ - "/raven" - ], - "_resolved": "https://registry.npmjs.org/lsmod/-/lsmod-1.0.0.tgz", - "_shasum": "9a00f76dca36eb23fa05350afe1b585d4299e64b", - "_spec": "lsmod@1.0.0", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\raven", - "author": { - "name": "Roman Shtylman", - "email": "shtylman@gmail.com" - }, - "bugs": { - "url": "https://github.com/shtylman/node-lsmod/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "fetch list of modules and versions installed for the project root", - "devDependencies": { - "mocha": "1.7.4" - }, - "homepage": "https://github.com/shtylman/node-lsmod#readme", - "keywords": [ - "modules", - "runtime" - ], - "license": "MIT", - "main": "index.js", - "name": "lsmod", - "repository": { - "type": "git", - "url": "git://github.com/shtylman/node-lsmod.git" - }, - "scripts": { - "test": "mocha --ui qunit" - }, - "version": "1.0.0" -} diff --git a/node_modules/lsmod/test.js b/node_modules/lsmod/test.js deleted file mode 100644 index 5d7e5f3..0000000 --- a/node_modules/lsmod/test.js +++ /dev/null @@ -1,19 +0,0 @@ -// mocha puts itself as main, we don't want that -require.main.paths.shift(); -require.main.paths.shift(); - -var assert = require('assert'); -var lsmod = require('./'); - -test('basic', function() { - var modules = lsmod(); - - // our own module is not present because it is not in node_modules - assert.equal(modules.lsmod, undefined); - - // mocha is the only thing we have - assert.equal(modules.mocha, '1.7.4'); - - // diff is a dep of mocha and we should not get it as a result - assert.equal(modules.diff, undefined); -}); diff --git a/node_modules/mumath/.eslintrc.json b/node_modules/mumath/.eslintrc.json deleted file mode 100644 index c50c250..0000000 --- a/node_modules/mumath/.eslintrc.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "commonjs": true, - "es6": true - }, - "extends": "eslint:recommended", - "rules": { - "strict": 2, - "indent": 0, - "linebreak-style": 0, - "quotes": 0, - "semi": 0, - "no-cond-assign": 1, - "no-constant-condition": 1, - "no-duplicate-case": 1, - "no-empty": 1, - "no-ex-assign": 1, - "no-extra-boolean-cast": 1, - "no-extra-semi": 1, - "no-fallthrough": 1, - "no-func-assign": 1, - "no-global-assign": 1, - "no-implicit-globals": 2, - "no-inner-declarations": ["error", "functions"], - "no-irregular-whitespace": 2, - "no-loop-func": 1, - "no-multi-str": 1, - "no-mixed-spaces-and-tabs": 1, - "no-proto": 1, - "no-sequences": 1, - "no-throw-literal": 1, - "no-unmodified-loop-condition": 1, - "no-useless-call": 1, - "no-void": 1, - "no-with": 2, - "wrap-iife": 1, - "no-redeclare": 1, - "no-unused-vars": ["error", { "vars": "all", "args": "none" }], - "no-sparse-arrays": 1 - } -} diff --git a/node_modules/mumath/.npmignore b/node_modules/mumath/.npmignore deleted file mode 100644 index eb1ac13..0000000 --- a/node_modules/mumath/.npmignore +++ /dev/null @@ -1,38 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -node_modules - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history - -bundle.js -demo - -images \ No newline at end of file diff --git a/node_modules/mumath/.travis.yml b/node_modules/mumath/.travis.yml deleted file mode 100644 index a1b29d7..0000000 --- a/node_modules/mumath/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "4" - - "6" - - "node" diff --git a/node_modules/mumath/README.md b/node_modules/mumath/README.md deleted file mode 100644 index 03789b6..0000000 --- a/node_modules/mumath/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# μMath [![Build Status](https://travis-ci.org/dfcreative/mumath.svg?branch=master)](https://travis-ci.org/dfcreative/mumath) [![Code Climate](https://codeclimate.com/github/dfcreative/mumath/badges/gpa.svg)](https://codeclimate.com/github/dfcreative/mumath) - -Set of practical math utils to shorten code. - -[`$ npm install mumath`](https://npmjs.org/package/mumath) - -```js -var round = require('mumath/round'); -round(123.32, .5); //123.5 - -//require any function as -//var = require('mumath/'); -``` - -## API - -### `round(value, step?)` - -Rounds value to optional `step`. - -`round(0.3, .5)` → `.5` - - -### `len(a, b)` - -Return length of a vector. - - -### `precision(value)` - -Get precision from float: - -`1.1 → 1, 1234 → 0, .1234 → 4` - - -### `clamp(value, left, right)` - -Return value clamped by left/right limits (or vice-versa). - - -### `lerp(x, y, ratio)` - -Return value interpolated between x and y. - - -### `within(value, left, right)` - -Whether element is between left & right, including. - - -### `mod(value, min?, max)` - -An enhanced [mod-loop](http://npmjs.org/package/mod-loop) — loops value within a frame. - - -### `closest(value, list)` - -Get closest value out of a set. - - -### `scale(value, list)` - -Get first scale out of a list of basic scales, aligned to the power. E. g. - -`step(.37, [1, 2, 5])` → `.5` -`step(456, [1, 2])` → `1000` - -Similar to closest, but takes all possible powers of scales. - -### `order(value)` - -Get order of magnitude for a number. - -`order(123) → 100; order(-0.0003) → 0.0001;` - - -### `isMultiple(a, b, eps?)` - -Same as `a % b === 0`, but with precision check. - - -## Related - -* [bit-twiddle](https://www.npmjs.com/package/bit-twiddle) — utils for power-of-two numbers. -* [pretty-number](https://www.npmjs.com/package/pretty-number) — format number to pretty view. diff --git a/node_modules/mumath/UNLICENSE b/node_modules/mumath/UNLICENSE deleted file mode 100644 index 00d2e13..0000000 --- a/node_modules/mumath/UNLICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to \ No newline at end of file diff --git a/node_modules/mumath/clamp.js b/node_modules/mumath/clamp.js deleted file mode 100644 index a7db764..0000000 --- a/node_modules/mumath/clamp.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Clamp value. - * Detects proper clamp min/max. - * - * @param {number} a Current value to cut off - * @param {number} min One side limit - * @param {number} max Other side limit - * - * @return {number} Clamped value - */ -'use strict'; -module.exports = function(a, min, max){ - return max > min ? Math.max(Math.min(a,max),min) : Math.max(Math.min(a,min),max); -}; diff --git a/node_modules/mumath/closest.js b/node_modules/mumath/closest.js deleted file mode 100644 index 86b3676..0000000 --- a/node_modules/mumath/closest.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @module mumath/closest - */ -'use strict'; - -module.exports = function closest (num, arr) { - var curr = arr[0]; - var diff = Math.abs (num - curr); - for (var val = 0; val < arr.length; val++) { - var newdiff = Math.abs (num - arr[val]); - if (newdiff < diff) { - diff = newdiff; - curr = arr[val]; - } - } - return curr; -} diff --git a/node_modules/mumath/index.js b/node_modules/mumath/index.js deleted file mode 100644 index 6ed2fcc..0000000 --- a/node_modules/mumath/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Composed set of all math utils, wrapped - * - * @module mumath - */ -'use strict'; -const wrap = require('./wrap'); - -module.exports = { - clamp: wrap(require('./clamp')), - within: wrap(require('./within')), - round: wrap(require('./round')), - precision: wrap(require('./precision')), - mod: wrap(require('./mod')), - log10: wrap(require('./log10')), - len: wrap(require('./len')), - closest: wrap(require('./closest')), - order: wrap(require('./order')), - lerp: wrap(require('./lerp')), - isMultiple: wrap(require('./is-multiple')), - normalize: wrap(require('./normalize')), - scale: wrap(require('./scale')), - // pretty: wrap(require('./pretty')), -}; diff --git a/node_modules/mumath/is-multiple.js b/node_modules/mumath/is-multiple.js deleted file mode 100644 index bb74894..0000000 --- a/node_modules/mumath/is-multiple.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Check if one number is multiple of other - * - * @module mumath/is-multiple - */ -'use strict'; -var almost = require('almost-equal'); - -module.exports = isMultiple; - -function isMultiple (a, b, eps) { - var remainder = a % b; - - if (!eps) eps = almost.FLT_EPSILON; - - if (!remainder) return true; - if (almost(0, remainder, eps, 0) || almost(Math.abs(b), Math.abs(remainder), eps, 0)) return true; - - return false; -} diff --git a/node_modules/mumath/len.js b/node_modules/mumath/len.js deleted file mode 100644 index 1ac9376..0000000 --- a/node_modules/mumath/len.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Return quadratic length - * - * @module mumath/loop - * - */ -'use strict'; - -module.exports = function (a, b) { - return Math.sqrt(a*a + b*b); -}; diff --git a/node_modules/mumath/lerp.js b/node_modules/mumath/lerp.js deleted file mode 100644 index ed65dbc..0000000 --- a/node_modules/mumath/lerp.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @module mumath/lerp - */ -'use strict'; -module.exports = function (x, y, a) { - return x * (1.0 - a) + y * a; -}; diff --git a/node_modules/mumath/log10.js b/node_modules/mumath/log10.js deleted file mode 100644 index b8e74f0..0000000 --- a/node_modules/mumath/log10.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Base 10 logarithm - * - * @module mumath/log10 - */ -'use strict'; -module.exports = Math.log10 || function (a) { - return Math.log(a) / Math.log(10); -}; diff --git a/node_modules/mumath/mod.js b/node_modules/mumath/mod.js deleted file mode 100644 index 1b18b8d..0000000 --- a/node_modules/mumath/mod.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Looping function for any framesize. - * Like fmod. - * - * @module mumath/loop - * - */ - -'use strict'; -module.exports = function (value, left, right) { - //detect single-arg case, like mod-loop or fmod - if (right === undefined) { - right = left; - left = 0; - } - - //swap frame order - if (left > right) { - var tmp = right; - right = left; - left = tmp; - } - - var frame = right - left; - - value = ((value + left) % frame) - left; - if (value < left) value += frame; - if (value > right) value -= frame; - - return value; -}; diff --git a/node_modules/mumath/normalize.js b/node_modules/mumath/normalize.js deleted file mode 100644 index a966f16..0000000 --- a/node_modules/mumath/normalize.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Get rid of float remainder - * - * @module mumath/normalize - */ -'use strict'; - -var almost = require('almost-equal'); - -module.exports = function(value, eps) { - //ignore ints - var rem = value%1; - if (!rem) return value; - - if (eps == null) eps = Number.EPSILON || almost.FLT_EPSILON; - - //pick number’s neighbour, which is way shorter, like 0.4999999999999998 → 0.5 - //O(20) - var range = 5; - var len = (rem+'').length; - - for (var i = 1; i < range; i+=.5) { - var left = rem - eps*i, - right = rem + eps*i; - - var leftStr = left+'', rightStr = right + ''; - - if (len - leftStr.length > 2) return value - eps*i; - if (len - rightStr.length > 2) return value + eps*i; - - // if (leftStr[2] != rightStr[2]) - } - - return value; -}; diff --git a/node_modules/mumath/order.js b/node_modules/mumath/order.js deleted file mode 100644 index f2200d9..0000000 --- a/node_modules/mumath/order.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @module mumath/order - */ -'use strict'; -module.exports = function (n) { - n = Math.abs(n); - var order = Math.floor(Math.log(n) / Math.LN10 + 0.000000001); - return Math.pow(10,order); -}; diff --git a/node_modules/mumath/package.json b/node_modules/mumath/package.json deleted file mode 100644 index 3aefe3f..0000000 --- a/node_modules/mumath/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "_from": "mumath@^3.3.4", - "_id": "mumath@3.3.4", - "_inBundle": false, - "_integrity": "sha1-SNSg8P2MrU57Mglu6JsWGmPTC78=", - "_location": "/mumath", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "mumath@^3.3.4", - "name": "mumath", - "escapedName": "mumath", - "rawSpec": "^3.3.4", - "saveSpec": null, - "fetchSpec": "^3.3.4" - }, - "_requiredBy": [ - "/color-space" - ], - "_resolved": "https://registry.npmjs.org/mumath/-/mumath-3.3.4.tgz", - "_shasum": "48d4a0f0fd8cad4e7b32096ee89b161a63d30bbf", - "_spec": "mumath@^3.3.4", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\color-space", - "author": { - "name": "dfcreative" - }, - "bugs": { - "url": "https://github.com/dfcreative/mumath/issues" - }, - "bundleDependencies": false, - "dependencies": { - "almost-equal": "^1.1.0" - }, - "deprecated": false, - "description": "Practical math utils for components", - "homepage": "https://github.com/dfcreative/mumath", - "keywords": [ - "math", - "geometry" - ], - "license": "Unlicense", - "main": "index.js", - "name": "mumath", - "repository": { - "type": "git", - "url": "git://github.com/dfcreative/mumath.git" - }, - "scripts": { - "test": "node test/index.js" - }, - "version": "3.3.4" -} diff --git a/node_modules/mumath/precision.js b/node_modules/mumath/precision.js deleted file mode 100644 index fcbe8e7..0000000 --- a/node_modules/mumath/precision.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @module mumath/precision - * - * Get precision from float: - * - * @example - * 1.1 → 1, 1234 → 0, .1234 → 4 - * - * @param {number} n - * - * @return {number} decimap places - */ -'use strict'; - -var almost = require('almost-equal'); -var norm = require('./normalize'); - -module.exports = function (n, eps) { - n = norm(n); - - var str = n + ''; - - //1e-10 etc - var e = str.indexOf('e-'); - if (e >= 0) return parseInt(str.substring(e+2)); - - //imperfect ints, like 3.0000000000000004 or 1.9999999999999998 - var remainder = Math.abs(n % 1); - var remStr = remainder + ''; - - if (almost(remainder, 1, eps) || almost(remainder, 0, eps)) return 0; - - //usual floats like .0123 - var d = remStr.indexOf('.') + 1; - - if (d) return remStr.length - d; - - //regular inte - return 0; -}; diff --git a/node_modules/mumath/pretty.js b/node_modules/mumath/pretty.js deleted file mode 100644 index 71c037b..0000000 --- a/node_modules/mumath/pretty.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Format number nicely - * - * @module mumath/loop - * - */ -'use strict'; - -var precision = require('./precision'); -var almost = require('almost-equal'); -var normalize = require('./normalize'); - -module.exports = function (v, prec) { - if (almost(v, 0)) return '0'; - - if (prec == null) { - prec = precision(v); - prec = Math.min(prec, 20); - } - - // return v.toFixed(prec); - return v.toFixed(prec); -}; diff --git a/node_modules/mumath/round.js b/node_modules/mumath/round.js deleted file mode 100644 index 14b674b..0000000 --- a/node_modules/mumath/round.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Precision round - * - * @param {number} value - * @param {number} step Minimal discrete to round - * - * @return {number} - * - * @example - * toPrecision(213.34, 1) == 213 - * toPrecision(213.34, .1) == 213.3 - * toPrecision(213.34, 10) == 210 - */ -'use strict'; -var precision = require('./precision'); - -module.exports = function(value, step) { - if (step === 0) return value; - if (!step) return Math.round(value); - value = Math.round(value / step) * step; - return parseFloat(value.toFixed(precision(step))); -}; diff --git a/node_modules/mumath/scale.js b/node_modules/mumath/scale.js deleted file mode 100644 index ed73492..0000000 --- a/node_modules/mumath/scale.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Get step out of the set - * - * @module mumath/step - */ -'use strict'; - -var lg = require('./log10'); - -module.exports = function (minStep, srcSteps) { - var power = Math.floor(lg(minStep)); - - var order = Math.pow(10, power); - var steps = srcSteps.map(v => v*order); - order = Math.pow(10, power+1); - steps = steps.concat(srcSteps.map(v => v*order)); - - //find closest scale - var step = 0; - for (var i = 0; i < steps.length; i++) { - step = steps[i]; - if (step >= minStep) break; - } - - return step; -}; diff --git a/node_modules/mumath/test/index.js b/node_modules/mumath/test/index.js deleted file mode 100644 index d4ab185..0000000 --- a/node_modules/mumath/test/index.js +++ /dev/null @@ -1,108 +0,0 @@ -var m = require('../index'); -var assert = require('assert'); - -// assert.equal(m.min(0,2),0); -// assert.equal(m.max(0,2),2); -// assert.deepEqual(m.min([0,0],[2,-2]),[0,-2]); - -assert.equal(m.clamp(-100, 0, 100), 0); -assert.equal(m.clamp(-100, 100, 0), 0); -assert.equal(m.clamp(-Infinity, -100, 0), -100); - -//limit arrays -assert.deepEqual(m.clamp([-100, -200], -100, 100), [-100, -100]); -assert.deepEqual(m.clamp([-101, 101], [-50, -100], [100, 50]), [-50, 50]); - -//limit objects -assert.deepEqual(m.clamp({top: 120, bottom: -10}, 0, 100), {top: 100, bottom: 0}); -assert.deepEqual(m.clamp({top: 120, bottom: -10}, {top: 0, bottom:0}, {top: 100, bottom: 100}), {top: 100, bottom: 0}); - -//normalize -assert.equal(m.normalize(-0.4999999999999998), -.5); -assert.equal(m.normalize(1.5000000000000002), 1.5); -assert.equal(m.normalize(10.5000000000000002), 10.5); -assert.equal(m.normalize(-0.7999999999999996), -.8); - - -//precisions -assert.equal(m.precision(1.0000000000000005e+33), 0); -assert.equal(m.precision(3.0000000000000004), 0); -assert.equal(m.precision(1.9999999999999998), 0); -assert.equal(m.precision(0.02), 2); -assert.equal(m.precision(100), 0); -assert.equal(m.precision(1e-1), 1); -assert.equal(m.precision(1e-5), 5); -assert.equal(m.precision(1e-19), 19); -assert.equal(m.precision(1.0000000000000001e+33), 0); -assert.equal(m.precision(-0.4999999999999998), 1); -assert.equal(m.precision(1.5000000000000002), 1); -assert.equal(m.precision(-0.7999999999999996), 1); - - -assert.equal(m.round(0.3, .5), .5); - -//multiple -assert.equal(m.isMultiple(100,10), true); -assert.equal(m.isMultiple(100.1,10, .1), true); - -//loop -assert.equal(m.mod(10, 100), 10); - -assert.equal(m.mod(110, 100), 10); -assert.equal(m.mod(110, 90), 20); - -assert.equal(m.mod(-110, 100), 90); - -assert.equal(m.mod(110, 0, 100), 10); -assert.equal(m.mod(110, -10, 100), 0); -assert.equal(m.mod(110, -10, 90), 10); -assert.equal(m.mod(-110, -100, 0), -10); -assert.equal(m.mod(-110, -100, 10), 0); -assert.equal(m.mod(-110, -90, 10), -10); - -//lg -assert.equal(m.log10(100), 2); -assert.equal(m.log10(10), 1); -assert.equal(m.log10(1), 0); -assert.equal(Math.round(m.log10(0.1)), -1); - -//len -assert.equal(m.len(3,4), 5); - -//closest -assert.equal(m.closest(0.2, [0.01, 0.1, 1, 10, 100]), 0.1); - -//order -assert.equal(m.order(123), 100); -assert.equal(m.order(0.000213), 0.0001); -assert.equal(m.order(-123), 100); -assert.equal(m.order(-0.0000123), 0.00001); - -assert(m.within(1, 0, 2)); -assert(m.within(1, 2, 0)); -assert(!m.within(0, 2, 1)); - - -assert.equal(m.lerp(1,0,.5), .5); - - -//step -assert.equal(m.scale(.1, [1, 2, 5]), .1); -assert.equal(m.scale(.1, [1, 2, 5]), .1); - - - -//formatting -// assert.equal(m.pretty(1.9999999999999998), '2'); -// assert.equal(m.pretty(1.0000000000000005e+33), '1e+33'); -// assert.equal(m.pretty(0.1), '0.1'); -// assert.equal(m.pretty(3.0000000000000004), '3'); -// assert.equal(m.pretty(7.0000000000000036, 2), '7'); -// assert.equal(m.pretty(3.885780586188048e-16), '0'); -// assert.equal(m.pretty(-1.9999999999999993), '-2'); -// assert.equal(m.pretty(-0.9999999999999996), '-1'); -// assert.equal(m.pretty(1.5000000000000002), '1.5'); -// assert.equal(m.pretty(-0.4999999999999998), '-0.5'); -// assert.equal(m.pretty(-0.7999999999999996), '-0.8'); -// assert.equal(m.pretty(500), '500'); -// assert.equal(m.pretty(0.4000000000000002), '0.4'); diff --git a/node_modules/mumath/within.js b/node_modules/mumath/within.js deleted file mode 100644 index 1ddd5ab..0000000 --- a/node_modules/mumath/within.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Whether element is between left & right including - * - * @param {number} a - * @param {number} left - * @param {number} right - * - * @return {Boolean} - */ -'use strict'; -module.exports = function(a, left, right){ - if (left > right) { - var tmp = left; - left = right; - right = tmp; - } - if (a <= right && a >= left) return true; - return false; -}; diff --git a/node_modules/mumath/wrap.js b/node_modules/mumath/wrap.js deleted file mode 100644 index 65ce193..0000000 --- a/node_modules/mumath/wrap.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Get fn wrapped with array/object attrs recognition - * - * @return {Function} Target function - */ -'use strict'; -module.exports = function(fn){ - return function (a) { - var args = arguments; - if (a instanceof Array) { - var result = new Array(a.length), slice; - for (var i = 0; i < a.length; i++){ - slice = []; - for (var j = 0, l = args.length, val; j < l; j++){ - val = args[j] instanceof Array ? args[j][i] : args[j]; - slice.push(val); - } - result[i] = fn.apply(this, slice); - } - return result; - } - else if (typeof a === 'object') { - var result = {}, slice; - for (var i in a){ - slice = []; - for (var j = 0, l = args.length, val; j < l; j++){ - val = typeof args[j] === 'object' ? args[j][i] : args[j]; - slice.push(val); - } - result[i] = fn.apply(this, slice); - } - return result; - } - else { - return fn.apply(this, args); - } - }; -}; diff --git a/node_modules/raven/.eslintignore b/node_modules/raven/.eslintignore deleted file mode 100644 index 404abb2..0000000 --- a/node_modules/raven/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -coverage/ diff --git a/node_modules/raven/.eslintrc b/node_modules/raven/.eslintrc deleted file mode 100644 index 248f817..0000000 --- a/node_modules/raven/.eslintrc +++ /dev/null @@ -1,64 +0,0 @@ -{ - "env": { - "node": true, - "mocha": true, - }, - "rules": { - "block-scoped-var": 2, - "dot-notation": [ - 2, - { - "allowKeywords": true - } - ], - "eqeqeq": [ - 2, - "allow-null" - ], - "guard-for-in": 2, - "new-cap": 2, - "no-caller": 2, - "no-cond-assign": [ - 2, - "except-parens" - ], - "no-debugger": 2, - "no-empty": 2, - "no-eval": 2, - "no-extend-native": 2, - "no-extra-parens": 2, - "no-irregular-whitespace": 2, - "no-iterator": 2, - "no-loop-func": 2, - "no-multi-str": 2, - "no-new": 2, - "no-proto": 2, - "no-script-url": 2, - "no-sequences": 2, - "no-shadow": 2, - "no-undef": 2, - "no-unused-vars": [ - 2, - {"args": "none"} - ], - "no-with": 2, - "quotes": [ - 2, - "single", - "avoid-escape" - ], - "semi": [ - 0, - "never" - ], - "strict": [ - 2, - "global" - ], - "valid-typeof": 2, - "wrap-iife": [ - 2, - "inside" - ] - } -} diff --git a/node_modules/raven/.gitmodules b/node_modules/raven/.gitmodules deleted file mode 100644 index 1e6464a..0000000 --- a/node_modules/raven/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "docs/_sentryext"] - path = docs/_sentryext - url = https://github.com/getsentry/sentry-doc-support diff --git a/node_modules/raven/.npmignore b/node_modules/raven/.npmignore deleted file mode 100644 index c4f7f8c..0000000 --- a/node_modules/raven/.npmignore +++ /dev/null @@ -1,8 +0,0 @@ -test -working -.travis.yml -README.md -History.md -Makefile -test/ -working/ \ No newline at end of file diff --git a/node_modules/raven/AUTHORS b/node_modules/raven/AUTHORS deleted file mode 100644 index 9b60c17..0000000 --- a/node_modules/raven/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -https://github.com/mattrobenolt/raven-node/graphs/contributors diff --git a/node_modules/raven/History.md b/node_modules/raven/History.md deleted file mode 100644 index 798b0cc..0000000 --- a/node_modules/raven/History.md +++ /dev/null @@ -1,160 +0,0 @@ -# 0.12.2 - 11/17/2016 - * Check if `require.main.filename` is defined before passing to `path.dirname` [See #233] - * Add `colno` property to report column number from stack trace [See #235] -# 0.12.1 - 8/4/2016 - * Fix bug where `environment` option was not actually being transmitted to Sentry [See #185] -# 0.12.0 - 8/1/2016 - * Add `environment` config option and `setRelease` method [See #179] - * No longer passes `process.env` values [See #182] - * Connect/Express middleware now attempts to attach `req.user` as User interface [See #177] - * Use json-stringify-safe to prevent circular refs [See #182] - -# 0.11.0 - 5/5/2016 - * `captureError` renamed to `captureException` to match raven-js (alias exists for backwards compat) - * `parsers.parseError` now coerces Error type to string. [See #155] - -# 0.10.0 - 1/24/2016 - * Now supports global context for extra data, tags, user [See #141] - * Added `setUserContext`, `setExtraContext`, `setTagsContext` - -# 0.9.0 - 11/23/2015 - * Always coerce req.body to string. [See 2061d4efbf269c5e2096f2b7b55f5af2249c4aa7] - * Allow passing options to HTTP transports. [See #123] - * Fixed tests for node 4.0/5.0 - * Don't send a body for GET/HEAD requests unless one has been passed. [See 0476a6e9818135b8b258b0be0724c369fe30e3c7] - -# 0.8.1 - 06/15/2015 - * Fixed a missing `domain` import in the Express/Connect middleware [See #120] - -# 0.8.0 - 06/15/2015 - * Drop support for node 0.6 - * Remove `SENTRY_SITE` environment variable usage - * Fixed `express deprecated req.host: Use req.hostname instead` warning [See #101] - * Allow passing custom `ca` options for an https request [See #110 #108] - * Use newer API endpoint [See #105] - * Added support for Sentry's new Releases feature - * Update Express/Connect middleware to support domains [See #116] - -# 0.7.3 - 03/05/2015 - * When calling `captureError` without an Error, generate a fake `Error` object to pull stacktrace from. [See #87] - * Prevent `patchGlobal` from causing recursion [See #84] - * Fixed issues arond capturing tags. - * Removed deprecated `site` parameter. - * Allow explicitly declaring the `culprit` [See #107] - * Publicly export out the various parsers [See #111] - * Support for iojs and node 0.12 - -# 0.7.2 - 09/09/2014 - * Added `dataCallback` option to Client configuration. See: https://github.com/getsentry/raven-node#pre-processing-data - -# 0.7.1 - 08/24/2014 - * Fixed package.json to not install junk from `optionalDependencies`. TIL `optionalDependencies` are still installed. [See #89] - -# 0.7.0 - 06/24/2014 - * Moved from mattrobenolt/raven-node into getsentry/raven-node - * Bumped to sentry protocol version 5 - * Capture all properties off of an Error object and send them along as as `extra` [See #72] - * Better feature detection support for capturing request parameters. Adds support for use in Koa. [See #78 #79] - -# 0.6.3 - 04/02/2014 - * Fix another issue that was breaking when running Raven from the REPL [See #66] - * Add additional meta data on the error callbacks [See #67 #73] - -# 0.6.2 - 02/14/2014 - * Allow overriding the logger name for an individual event - * Update lsmod to not break when running Raven from the REPL - * Added a `raven` bin so you can run `raven test [DSN]` - -# 0.6.1 - 01/23/2014 - * Use lsmod for getting the list of installed modules [See #55] - * Parse cookies on the http request always [See #56] - * Use `stack-trace` to assist in capturing stacks. This should fix compat with the New Relic plugin [See #57] - -# 0.6.0 - 11/9/2013 - * Updated sentry protocol to version 4 (Requires Sentry 6.0+ now) - * Module names now include the full path - * Attach client IP address to env object - -# 0.5.6 - 11/8/2013 - * Include module and function name in stacktrace culprit - -# 0.5.5 - 11/8/2013 - * Only record exceptions for 500 status codes from Connect middleware - -# 0.5.4 - 10/13/2013 - * Fix DSN parser when using Sentry at a non-root URL, thanks @rcoup [See #44] - -# 0.5.3 - 10/4/2013 - * Bump raw-stacktrace version - -# 0.5.2 - 9/10/2013 - * Fix compatibilities with CoffeeScript [Fixes #47] [Fixes #50] - * Doesnt chose on circular references - -# 0.5.1 - 5/1/2013 - * Add support for third party transports, thanks @crankycoder - -# 0.5.0 - 4/8/2013 - * Remove NODE_ENV entirely, fixes many issues since people have different opinions on wtf this means - * Several fixes in collecting a better stack trace, thanks @azylman - * Pass exception through to the patchGlobal callback, thanks @ktmud [See #28] - * Official 0.10 support! - * Other misc things. https://github.com/mattrobenolt/raven-node/compare/v0.4.7...v0.5.0 - -# 0.4.7 - 1/13/2013 - * Actually disable when NODE_ENV does not equal 'production' [Fixes #25] - -# 0.4.6 - 1/13/2013 - * Added `platform=node` to payload for Sentry 5.1 - -# 0.4.5 - 12/05/2012 - * Resolve `node_modules` path properly [Fixes #23] - -# 0.4.4 - 11/10/2012 - * Prevent 'error' event from bubbling up due to no listeners [See #22] - * Augment 'error' event emitter with an actual Error object [See #22] - -# 0.4.3 - 10/02/2012 - * Allow a callback to be given to `patchGlobal()` [Fixes #19] - * Removed old `patch_global()` alias - -# 0.4.2 - 9/29/2012 - * Added test coverage to `patchGlobal()` - * Quit using my own deprecated `get_ident()` method inside `patchGlobal` - * Send string errors as a normal message to prevent Sentry server from crying [Fixes #18] - -# 0.4.1 - 9/3/2012 - * patchGlobal() was actually broken. :( Thanks @ligthyear [Fixes #17] - -# 0.4.0 - 8/14/2012 - * Silence and disable Raven/Sentry when using a non-existent or falsey DSN value - -# 0.3.0 - 6/23/2012 - * Separate transports out into their own module for portability - * Added UDP transport [Fixes #10] - * Ignore sub-transports, such as gevent+https, raven sees it as just https - -# 0.2.4 - 6/16/2012 - * Added parsing DSNs with non-standard port. [Fixes #4] - * Added BSD license - -# 0.2.3 - 3/30/2012 - * Prevent any potentially odd stack traces from causing Raven to crash. [Fixes #2] - -# 0.2.2 - 3/22/2012 - * raven.Client now emits `logged` and `error` events. - -# 0.2.1 - 3/22/2012 - * Fixed connect/express middleware, thanks Almad! - -# 0.2.0 - 3/18/2012 - * Renamed all methods to follow `client.capture*()` pattern. (Sorry if you were already using it!) - * All `npm` installed modules are shoved into Sentry for debugging - * Toggle actual sending based on `NODE_ENV` variable. Check README for information. - * Fixes for more types of stack traces. - * Added `client.captureQuery()` - * Support for `SENTRY_DSN`, `SENTRY_NAME`, and `SENTRY_SITE` enviornment variables - * More test coverage - -# 0.1.0 - 3/17/2012 - * Initial release diff --git a/node_modules/raven/LICENSE b/node_modules/raven/LICENSE deleted file mode 100644 index 77d737d..0000000 --- a/node_modules/raven/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -Copyright (c) 2013, Matt Robenolt -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/raven/README.md b/node_modules/raven/README.md deleted file mode 100644 index cee68da..0000000 --- a/node_modules/raven/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# raven-node [![Build Status](https://travis-ci.org/getsentry/raven-node.svg?branch=master)](https://travis-ci.org/getsentry/raven-node) - -raven-node is a Node.js client for [Sentry](https://getsentry.com/). - -## Resources - -* [Documentation](https://docs.getsentry.com/hosted/clients/node/) -* [Bug Tracker](https://github.com/getsentry/raven-node/issues) -* [IRC](irc://chat.freenode.net/sentry) (chat.freenode.net, #sentry) diff --git a/node_modules/raven/bin/raven b/node_modules/raven/bin/raven deleted file mode 100644 index 8207d8c..0000000 --- a/node_modules/raven/bin/raven +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env node - -var os = require('os'); -var raven = require('../'); - -function usage() { - var path = require('path'); - console.log('usage:', path.basename(process.argv[1]), 'test [SENTRY_DSN]'); -} - -if (process.argv[2] !== 'test') { - usage(); - process.exit(1); -} - -var dsn = process.argv.slice(3).join(' ') || process.env.SENTRY_DSN; -if (!dsn) { - usage(); - console.log(); - console.log('Error: No configuration detected!'); - console.log('You must either pass a DSN to the command or set the SENTRY_DSN environment variable.'); - process.exit(1); -} - -console.log('Using DSN configuration:'); -console.log(' ', dsn); -console.log(); - -var client = new raven.Client(dsn); - -console.log('Sending a test message...'); - -client.on('logged', function(result) { - console.log('success!'); - console.log('Event ID was', client.getIdent(result)); -}); -client.on('error', function(err) { - console.log('error!'); - throw err; -}); - -try { - test -} catch (ex) { - client.captureException(ex, { - message: 'This is a test message generated using ``raven test``', - level: 'info', - logger: 'sentry.test', - culprit: 'bin:raven at main', - request: { - method: 'GET', - url: 'http://example.com' - }, - extra: { - user: process.getuid && process.getuid(), - loadavg: os.loadavg() - } - }); -} \ No newline at end of file diff --git a/node_modules/raven/coverage/coverage.json b/node_modules/raven/coverage/coverage.json deleted file mode 100644 index 06d8122..0000000 --- a/node_modules/raven/coverage/coverage.json +++ /dev/null @@ -1 +0,0 @@ -{"/Users/lewis/dev/raven-node/index.js":{"path":"/Users/lewis/dev/raven-node/index.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1},"b":{},"f":{},"fnMap":{},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":41}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":46}},"3":{"start":{"line":5,"column":0},"end":{"line":7,"column":2}},"4":{"start":{"line":9,"column":0},"end":{"line":9,"column":70}},"5":{"start":{"line":10,"column":0},"end":{"line":10,"column":56}},"6":{"start":{"line":11,"column":0},"end":{"line":11,"column":50}},"7":{"start":{"line":14,"column":0},"end":{"line":14,"column":33}}},"branchMap":{}},"/Users/lewis/dev/raven-node/lib/client.js":{"path":"/Users/lewis/dev/raven-node/lib/client.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":66,"15":2,"16":2,"17":66,"18":1,"19":1,"20":66,"21":66,"22":66,"23":66,"24":66,"25":66,"26":66,"27":66,"28":66,"29":66,"30":66,"31":66,"32":2,"33":66,"34":64,"35":66,"36":66,"37":66,"38":1,"39":66,"40":1,"41":66,"42":4,"43":66,"44":2,"45":0,"46":2,"47":2,"48":1,"49":2,"50":29,"51":29,"52":12,"53":12,"54":12,"55":29,"56":29,"57":29,"58":29,"59":29,"60":29,"61":29,"62":0,"63":29,"64":29,"65":29,"66":29,"67":29,"68":29,"69":29,"70":2,"71":29,"72":2,"73":29,"74":29,"75":0,"76":29,"77":2,"78":29,"79":27,"80":2,"81":2,"82":24,"83":24,"84":24,"85":24,"86":23,"87":23,"88":5,"89":0,"90":0,"91":5,"92":5,"93":5,"94":5,"95":12,"96":1,"97":12,"98":1,"99":1,"100":11,"101":12,"102":12,"103":12,"104":12,"105":12,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":1,"114":1,"115":1,"116":1,"117":1,"118":0,"119":0,"120":1,"121":1,"122":1,"123":1,"124":1,"125":0,"126":1,"127":1,"128":1,"129":0,"130":0,"131":1,"132":1,"133":1,"134":1,"135":1,"136":3,"137":2,"138":2,"139":3,"140":3,"141":3,"142":3,"143":2,"144":1,"145":3,"146":0,"147":0,"148":3,"149":3,"150":3,"151":3,"152":3,"153":1,"154":2,"155":3,"156":0,"157":0,"158":0,"159":4,"160":4,"161":4,"162":4,"163":0,"164":4,"165":2,"166":2,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":1,"180":1,"181":1,"182":4,"183":4,"184":4,"185":4,"186":4,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":1,"194":1,"195":66,"196":0,"197":66,"198":66,"199":1,"200":1,"201":1,"202":1,"203":1,"204":1,"205":1,"206":1,"207":6,"208":6,"209":4,"210":3,"211":1,"212":1,"213":3,"214":0,"215":0,"216":3,"217":1,"218":1,"219":1,"220":2,"221":2,"222":2,"223":3,"224":3,"225":1,"226":1,"227":1,"228":1,"229":1,"230":1,"231":0,"232":0,"233":0,"234":0,"235":0,"236":0,"237":0},"b":{"1":[2,64],"2":[1,65],"3":[66,50],"4":[66,64,63],"5":[66,66],"6":[66,65],"7":[66,63,62],"8":[66,64,63],"9":[66,66],"10":[2,64],"11":[64,2],"12":[64,64],"13":[1,65],"14":[1,65],"15":[0,2],"16":[1,1],"17":[2,1],"18":[12,17],"19":[29,1,28],"20":[29,29],"21":[0,29],"22":[29,28],"23":[29,29],"24":[2,27],"25":[2,27],"26":[0,29],"27":[2,27],"28":[29,2],"29":[27,2],"30":[0,5],"31":[5,5],"32":[5,5],"33":[1,11],"34":[1,11],"35":[12,11],"36":[11,7],"37":[0,0],"38":[0,0],"39":[0,0],"40":[1,0],"41":[1,1],"42":[0,1],"43":[1,0],"44":[1,0],"45":[0,0],"46":[2,1],"47":[3,2],"48":[2,1],"49":[0,0],"50":[1,2],"51":[0,0],"52":[4,0],"53":[0,0,0,0],"54":[0,0],"55":[0,66],"56":[3,1],"57":[1,2],"58":[1,1],"59":[0,0],"60":[0,0],"61":[0,0]},"f":{"1":67,"2":66,"3":4,"4":2,"5":29,"6":29,"7":2,"8":24,"9":23,"10":5,"11":12,"12":12,"13":0,"14":1,"15":1,"16":0,"17":3,"18":3,"19":3,"20":0,"21":0,"22":4,"23":4,"24":2,"25":2,"26":0,"27":0,"28":0,"29":0,"30":1,"31":4,"32":4,"33":0,"34":0,"35":0,"36":66,"37":6,"38":4,"39":1,"40":0,"41":1,"42":1,"43":1,"44":0},"fnMap":{"1":{"name":"Raven","line":15,"loc":{"start":{"line":15,"column":0},"end":{"line":15,"column":17}}},"2":{"name":"config","line":20,"loc":{"start":{"line":20,"column":10},"end":{"line":20,"column":40}}},"3":{"name":"(anonymous_3)","line":65,"loc":{"start":{"line":65,"column":21},"end":{"line":65,"column":36}}},"4":{"name":"install","line":72,"loc":{"start":{"line":72,"column":11},"end":{"line":72,"column":38}}},"5":{"name":"generateEventId","line":84,"loc":{"start":{"line":84,"column":19},"end":{"line":84,"column":46}}},"6":{"name":"process","line":88,"loc":{"start":{"line":88,"column":11},"end":{"line":88,"column":49}}},"7":{"name":"(anonymous_7)","line":133,"loc":{"start":{"line":133,"column":17},"end":{"line":133,"column":29}}},"8":{"name":"send","line":139,"loc":{"start":{"line":139,"column":8},"end":{"line":139,"column":34}}},"9":{"name":"(anonymous_9)","line":144,"loc":{"start":{"line":144,"column":26},"end":{"line":144,"column":47}}},"10":{"name":"captureMessage","line":157,"loc":{"start":{"line":157,"column":18},"end":{"line":157,"column":63}}},"11":{"name":"captureException","line":170,"loc":{"start":{"line":170,"column":20},"end":{"line":170,"column":63}}},"12":{"name":"(anonymous_12)","line":187,"loc":{"start":{"line":187,"column":36},"end":{"line":187,"column":50}}},"13":{"name":"captureQuery","line":194,"loc":{"start":{"line":194,"column":16},"end":{"line":194,"column":65}}},"14":{"name":"(anonymous_14)","line":213,"loc":{"start":{"line":213,"column":11},"end":{"line":213,"column":39}}},"15":{"name":"(anonymous_15)","line":225,"loc":{"start":{"line":225,"column":8},"end":{"line":225,"column":40}}},"16":{"name":"(anonymous_16)","line":237,"loc":{"start":{"line":237,"column":14},"end":{"line":237,"column":29}}},"17":{"name":"(anonymous_17)","line":259,"loc":{"start":{"line":259,"column":16},"end":{"line":259,"column":41}}},"18":{"name":"(anonymous_18)","line":265,"loc":{"start":{"line":265,"column":18},"end":{"line":265,"column":30}}},"19":{"name":"setContext","line":287,"loc":{"start":{"line":287,"column":14},"end":{"line":287,"column":39}}},"20":{"name":"mergeContext","line":296,"loc":{"start":{"line":296,"column":16},"end":{"line":296,"column":43}}},"21":{"name":"getContext","line":301,"loc":{"start":{"line":301,"column":14},"end":{"line":301,"column":36}}},"22":{"name":"(anonymous_22)","line":305,"loc":{"start":{"line":305,"column":21},"end":{"line":305,"column":55}}},"23":{"name":"(anonymous_23)","line":308,"loc":{"start":{"line":308,"column":27},"end":{"line":308,"column":43}}},"24":{"name":"(anonymous_24)","line":325,"loc":{"start":{"line":325,"column":19},"end":{"line":325,"column":39}}},"25":{"name":"(anonymous_25)","line":336,"loc":{"start":{"line":336,"column":25},"end":{"line":336,"column":45}}},"26":{"name":"(anonymous_26)","line":340,"loc":{"start":{"line":340,"column":18},"end":{"line":340,"column":30}}},"27":{"name":"(anonymous_27)","line":342,"loc":{"start":{"line":342,"column":11},"end":{"line":342,"column":37}}},"28":{"name":"(anonymous_28)","line":347,"loc":{"start":{"line":347,"column":16},"end":{"line":347,"column":28}}},"29":{"name":"(anonymous_29)","line":349,"loc":{"start":{"line":349,"column":11},"end":{"line":349,"column":42}}},"30":{"name":"getIdent","line":366,"loc":{"start":{"line":366,"column":12},"end":{"line":366,"column":38}}},"31":{"name":"captureError","line":370,"loc":{"start":{"line":370,"column":16},"end":{"line":370,"column":40}}},"32":{"name":"(anonymous_32)","line":374,"loc":{"start":{"line":374,"column":15},"end":{"line":374,"column":29}}},"33":{"name":"setUserContext","line":379,"loc":{"start":{"line":379,"column":18},"end":{"line":379,"column":44}}},"34":{"name":"setExtraContext","line":383,"loc":{"start":{"line":383,"column":19},"end":{"line":383,"column":46}}},"35":{"name":"setTagsContext","line":387,"loc":{"start":{"line":387,"column":18},"end":{"line":387,"column":44}}},"36":{"name":"Client","line":395,"loc":{"start":{"line":395,"column":0},"end":{"line":395,"column":30}}},"37":{"name":"registerExceptionHandler","line":412,"loc":{"start":{"line":412,"column":0},"end":{"line":412,"column":46}}},"38":{"name":"(anonymous_38)","line":414,"loc":{"start":{"line":414,"column":34},"end":{"line":414,"column":49}}},"39":{"name":"onLogged","line":416,"loc":{"start":{"line":416,"column":21},"end":{"line":416,"column":41}}},"40":{"name":"onError","line":421,"loc":{"start":{"line":421,"column":20},"end":{"line":421,"column":39}}},"41":{"name":"registerRejectionHandler","line":443,"loc":{"start":{"line":443,"column":0},"end":{"line":443,"column":46}}},"42":{"name":"(anonymous_42)","line":444,"loc":{"start":{"line":444,"column":35},"end":{"line":444,"column":53}}},"43":{"name":"(anonymous_43)","line":445,"loc":{"start":{"line":445,"column":50},"end":{"line":445,"column":69}}},"44":{"name":"patchGlobal","line":452,"loc":{"start":{"line":452,"column":0},"end":{"line":452,"column":33}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":47}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":35}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":27}},"4":{"start":{"line":6,"column":0},"end":{"line":6,"column":31}},"5":{"start":{"line":7,"column":0},"end":{"line":7,"column":32}},"6":{"start":{"line":8,"column":0},"end":{"line":8,"column":41}},"7":{"start":{"line":9,"column":0},"end":{"line":9,"column":31}},"8":{"start":{"line":10,"column":0},"end":{"line":10,"column":31}},"9":{"start":{"line":11,"column":0},"end":{"line":11,"column":31}},"10":{"start":{"line":13,"column":0},"end":{"line":13,"column":26}},"11":{"start":{"line":15,"column":0},"end":{"line":15,"column":19}},"12":{"start":{"line":17,"column":0},"end":{"line":17,"column":46}},"13":{"start":{"line":19,"column":0},"end":{"line":361,"column":3}},"14":{"start":{"line":21,"column":4},"end":{"line":25,"column":5}},"15":{"start":{"line":23,"column":6},"end":{"line":23,"column":35}},"16":{"start":{"line":24,"column":6},"end":{"line":24,"column":19}},"17":{"start":{"line":26,"column":4},"end":{"line":30,"column":5}},"18":{"start":{"line":28,"column":6},"end":{"line":28,"column":20}},"19":{"start":{"line":29,"column":6},"end":{"line":29,"column":35}},"20":{"start":{"line":31,"column":4},"end":{"line":31,"column":28}},"21":{"start":{"line":33,"column":4},"end":{"line":33,"column":23}},"22":{"start":{"line":34,"column":4},"end":{"line":34,"column":35}},"23":{"start":{"line":35,"column":4},"end":{"line":35,"column":84}},"24":{"start":{"line":36,"column":4},"end":{"line":36,"column":46}},"25":{"start":{"line":37,"column":4},"end":{"line":37,"column":72}},"26":{"start":{"line":38,"column":4},"end":{"line":38,"column":71}},"27":{"start":{"line":39,"column":4},"end":{"line":39,"column":83}},"28":{"start":{"line":41,"column":4},"end":{"line":41,"column":43}},"29":{"start":{"line":42,"column":4},"end":{"line":42,"column":45}},"30":{"start":{"line":43,"column":4},"end":{"line":43,"column":57}},"31":{"start":{"line":45,"column":4},"end":{"line":47,"column":5}},"32":{"start":{"line":46,"column":6},"end":{"line":46,"column":70}},"33":{"start":{"line":49,"column":4},"end":{"line":52,"column":5}},"34":{"start":{"line":51,"column":6},"end":{"line":51,"column":35}},"35":{"start":{"line":55,"column":4},"end":{"line":55,"column":31}},"36":{"start":{"line":57,"column":4},"end":{"line":57,"column":49}},"37":{"start":{"line":58,"column":4},"end":{"line":60,"column":5}},"38":{"start":{"line":59,"column":6},"end":{"line":59,"column":40}},"39":{"start":{"line":61,"column":4},"end":{"line":63,"column":5}},"40":{"start":{"line":62,"column":6},"end":{"line":62,"column":42}},"41":{"start":{"line":65,"column":4},"end":{"line":67,"column":7}},"42":{"start":{"line":66,"column":6},"end":{"line":66,"column":79}},"43":{"start":{"line":69,"column":4},"end":{"line":69,"column":16}},"44":{"start":{"line":73,"column":4},"end":{"line":75,"column":5}},"45":{"start":{"line":74,"column":6},"end":{"line":74,"column":16}},"46":{"start":{"line":77,"column":4},"end":{"line":77,"column":39}},"47":{"start":{"line":78,"column":4},"end":{"line":80,"column":5}},"48":{"start":{"line":79,"column":6},"end":{"line":79,"column":41}},"49":{"start":{"line":81,"column":4},"end":{"line":81,"column":16}},"50":{"start":{"line":85,"column":4},"end":{"line":85,"column":36}},"51":{"start":{"line":90,"column":4},"end":{"line":94,"column":5}},"52":{"start":{"line":91,"column":6},"end":{"line":91,"column":18}},"53":{"start":{"line":92,"column":6},"end":{"line":92,"column":23}},"54":{"start":{"line":93,"column":6},"end":{"line":93,"column":39}},"55":{"start":{"line":96,"column":4},"end":{"line":96,"column":75}},"56":{"start":{"line":97,"column":4},"end":{"line":97,"column":88}},"57":{"start":{"line":98,"column":4},"end":{"line":98,"column":88}},"58":{"start":{"line":99,"column":4},"end":{"line":99,"column":92}},"59":{"start":{"line":101,"column":4},"end":{"line":101,"column":40}},"60":{"start":{"line":102,"column":4},"end":{"line":102,"column":57}},"61":{"start":{"line":104,"column":4},"end":{"line":106,"column":5}},"62":{"start":{"line":105,"column":6},"end":{"line":105,"column":42}},"63":{"start":{"line":108,"column":4},"end":{"line":108,"column":64}},"64":{"start":{"line":109,"column":4},"end":{"line":109,"column":53}},"65":{"start":{"line":110,"column":4},"end":{"line":110,"column":30}},"66":{"start":{"line":111,"column":4},"end":{"line":111,"column":62}},"67":{"start":{"line":112,"column":4},"end":{"line":112,"column":41}},"68":{"start":{"line":113,"column":4},"end":{"line":113,"column":29}},"69":{"start":{"line":116,"column":4},"end":{"line":118,"column":5}},"70":{"start":{"line":117,"column":6},"end":{"line":117,"column":36}},"71":{"start":{"line":120,"column":4},"end":{"line":122,"column":5}},"72":{"start":{"line":121,"column":6},"end":{"line":121,"column":41}},"73":{"start":{"line":124,"column":4},"end":{"line":124,"column":26}},"74":{"start":{"line":125,"column":4},"end":{"line":125,"column":43}},"75":{"start":{"line":125,"column":24},"end":{"line":125,"column":43}},"76":{"start":{"line":126,"column":4},"end":{"line":126,"column":82}},"77":{"start":{"line":126,"column":63},"end":{"line":126,"column":82}},"78":{"start":{"line":128,"column":4},"end":{"line":136,"column":5}},"79":{"start":{"line":129,"column":6},"end":{"line":129,"column":28}},"80":{"start":{"line":133,"column":6},"end":{"line":135,"column":12}},"81":{"start":{"line":134,"column":8},"end":{"line":134,"column":26}},"82":{"start":{"line":140,"column":4},"end":{"line":140,"column":20}},"83":{"start":{"line":141,"column":4},"end":{"line":141,"column":36}},"84":{"start":{"line":142,"column":4},"end":{"line":142,"column":34}},"85":{"start":{"line":144,"column":4},"end":{"line":154,"column":7}},"86":{"start":{"line":145,"column":6},"end":{"line":151,"column":12}},"87":{"start":{"line":153,"column":6},"end":{"line":153,"column":63}},"88":{"start":{"line":158,"column":4},"end":{"line":163,"column":5}},"89":{"start":{"line":159,"column":6},"end":{"line":159,"column":18}},"90":{"start":{"line":160,"column":6},"end":{"line":160,"column":18}},"91":{"start":{"line":162,"column":6},"end":{"line":162,"column":28}},"92":{"start":{"line":164,"column":4},"end":{"line":164,"column":41}},"93":{"start":{"line":165,"column":4},"end":{"line":165,"column":66}},"94":{"start":{"line":167,"column":4},"end":{"line":167,"column":19}},"95":{"start":{"line":171,"column":4},"end":{"line":176,"column":5}},"96":{"start":{"line":175,"column":6},"end":{"line":175,"column":27}},"97":{"start":{"line":178,"column":4},"end":{"line":183,"column":5}},"98":{"start":{"line":179,"column":6},"end":{"line":179,"column":18}},"99":{"start":{"line":180,"column":6},"end":{"line":180,"column":18}},"100":{"start":{"line":182,"column":6},"end":{"line":182,"column":28}},"101":{"start":{"line":185,"column":4},"end":{"line":185,"column":20}},"102":{"start":{"line":186,"column":4},"end":{"line":186,"column":41}},"103":{"start":{"line":187,"column":4},"end":{"line":189,"column":7}},"104":{"start":{"line":188,"column":6},"end":{"line":188,"column":36}},"105":{"start":{"line":191,"column":4},"end":{"line":191,"column":19}},"106":{"start":{"line":195,"column":4},"end":{"line":200,"column":5}},"107":{"start":{"line":196,"column":6},"end":{"line":196,"column":18}},"108":{"start":{"line":197,"column":6},"end":{"line":197,"column":18}},"109":{"start":{"line":199,"column":6},"end":{"line":199,"column":28}},"110":{"start":{"line":202,"column":4},"end":{"line":202,"column":41}},"111":{"start":{"line":203,"column":4},"end":{"line":203,"column":73}},"112":{"start":{"line":205,"column":4},"end":{"line":205,"column":19}},"113":{"start":{"line":214,"column":4},"end":{"line":217,"column":5}},"114":{"start":{"line":215,"column":6},"end":{"line":215,"column":17}},"115":{"start":{"line":216,"column":6},"end":{"line":216,"column":15}},"116":{"start":{"line":222,"column":4},"end":{"line":222,"column":51}},"117":{"start":{"line":226,"column":4},"end":{"line":229,"column":5}},"118":{"start":{"line":227,"column":6},"end":{"line":227,"column":21}},"119":{"start":{"line":228,"column":6},"end":{"line":228,"column":19}},"120":{"start":{"line":231,"column":4},"end":{"line":231,"column":37}},"121":{"start":{"line":233,"column":4},"end":{"line":233,"column":39}},"122":{"start":{"line":235,"column":4},"end":{"line":235,"column":20}},"123":{"start":{"line":236,"column":4},"end":{"line":240,"column":5}},"124":{"start":{"line":237,"column":6},"end":{"line":239,"column":8}},"125":{"start":{"line":238,"column":8},"end":{"line":238,"column":61}},"126":{"start":{"line":242,"column":4},"end":{"line":242,"column":34}},"127":{"start":{"line":243,"column":4},"end":{"line":243,"column":40}},"128":{"start":{"line":245,"column":4},"end":{"line":249,"column":5}},"129":{"start":{"line":246,"column":6},"end":{"line":248,"column":7}},"130":{"start":{"line":247,"column":8},"end":{"line":247,"column":43}},"131":{"start":{"line":250,"column":4},"end":{"line":250,"column":39}},"132":{"start":{"line":251,"column":4},"end":{"line":251,"column":29}},"133":{"start":{"line":252,"column":4},"end":{"line":252,"column":29}},"134":{"start":{"line":254,"column":4},"end":{"line":254,"column":36}},"135":{"start":{"line":256,"column":4},"end":{"line":256,"column":19}},"136":{"start":{"line":260,"column":4},"end":{"line":263,"column":5}},"137":{"start":{"line":261,"column":6},"end":{"line":261,"column":21}},"138":{"start":{"line":262,"column":6},"end":{"line":262,"column":19}},"139":{"start":{"line":264,"column":4},"end":{"line":264,"column":20}},"140":{"start":{"line":265,"column":4},"end":{"line":272,"column":6}},"141":{"start":{"line":266,"column":6},"end":{"line":266,"column":29}},"142":{"start":{"line":267,"column":6},"end":{"line":271,"column":7}},"143":{"start":{"line":268,"column":8},"end":{"line":268,"column":44}},"144":{"start":{"line":270,"column":8},"end":{"line":270,"column":36}},"145":{"start":{"line":275,"column":4},"end":{"line":279,"column":5}},"146":{"start":{"line":276,"column":6},"end":{"line":278,"column":7}},"147":{"start":{"line":277,"column":8},"end":{"line":277,"column":43}},"148":{"start":{"line":280,"column":4},"end":{"line":280,"column":39}},"149":{"start":{"line":281,"column":4},"end":{"line":281,"column":29}},"150":{"start":{"line":282,"column":4},"end":{"line":282,"column":29}},"151":{"start":{"line":284,"column":4},"end":{"line":284,"column":19}},"152":{"start":{"line":288,"column":4},"end":{"line":292,"column":5}},"153":{"start":{"line":289,"column":6},"end":{"line":289,"column":40}},"154":{"start":{"line":291,"column":6},"end":{"line":291,"column":32}},"155":{"start":{"line":293,"column":4},"end":{"line":293,"column":16}},"156":{"start":{"line":297,"column":4},"end":{"line":297,"column":35}},"157":{"start":{"line":298,"column":4},"end":{"line":298,"column":16}},"158":{"start":{"line":302,"column":4},"end":{"line":302,"column":77}},"159":{"start":{"line":306,"column":4},"end":{"line":306,"column":38}},"160":{"start":{"line":307,"column":4},"end":{"line":313,"column":5}},"161":{"start":{"line":308,"column":6},"end":{"line":310,"column":8}},"162":{"start":{"line":309,"column":8},"end":{"line":309,"column":40}},"163":{"start":{"line":312,"column":6},"end":{"line":312,"column":36}},"164":{"start":{"line":315,"column":4},"end":{"line":315,"column":16}},"165":{"start":{"line":326,"column":4},"end":{"line":326,"column":60}},"166":{"start":{"line":337,"column":4},"end":{"line":337,"column":66}},"167":{"start":{"line":341,"column":4},"end":{"line":341,"column":20}},"168":{"start":{"line":342,"column":4},"end":{"line":344,"column":6}},"169":{"start":{"line":343,"column":6},"end":{"line":343,"column":35}},"170":{"start":{"line":348,"column":4},"end":{"line":348,"column":20}},"171":{"start":{"line":349,"column":4},"end":{"line":359,"column":6}},"172":{"start":{"line":350,"column":6},"end":{"line":350,"column":74}},"173":{"start":{"line":353,"column":6},"end":{"line":353,"column":41}},"174":{"start":{"line":353,"column":24},"end":{"line":353,"column":41}},"175":{"start":{"line":355,"column":6},"end":{"line":355,"column":45}},"176":{"start":{"line":356,"column":6},"end":{"line":356,"column":55}},"177":{"start":{"line":357,"column":6},"end":{"line":357,"column":27}},"178":{"start":{"line":358,"column":6},"end":{"line":358,"column":23}},"179":{"start":{"line":365,"column":0},"end":{"line":391,"column":3}},"180":{"start":{"line":367,"column":4},"end":{"line":367,"column":83}},"181":{"start":{"line":368,"column":4},"end":{"line":368,"column":18}},"182":{"start":{"line":371,"column":4},"end":{"line":371,"column":87}},"183":{"start":{"line":372,"column":4},"end":{"line":372,"column":56}},"184":{"start":{"line":375,"column":4},"end":{"line":375,"column":86}},"185":{"start":{"line":376,"column":4},"end":{"line":376,"column":39}},"186":{"start":{"line":377,"column":4},"end":{"line":377,"column":16}},"187":{"start":{"line":380,"column":4},"end":{"line":380,"column":113}},"188":{"start":{"line":381,"column":4},"end":{"line":381,"column":16}},"189":{"start":{"line":384,"column":4},"end":{"line":384,"column":114}},"190":{"start":{"line":385,"column":4},"end":{"line":385,"column":16}},"191":{"start":{"line":388,"column":4},"end":{"line":388,"column":113}},"192":{"start":{"line":389,"column":4},"end":{"line":389,"column":16}},"193":{"start":{"line":392,"column":0},"end":{"line":392,"column":53}},"194":{"start":{"line":395,"column":0},"end":{"line":399,"column":1}},"195":{"start":{"line":396,"column":2},"end":{"line":396,"column":40}},"196":{"start":{"line":396,"column":29},"end":{"line":396,"column":40}},"197":{"start":{"line":397,"column":2},"end":{"line":397,"column":34}},"198":{"start":{"line":398,"column":2},"end":{"line":398,"column":62}},"199":{"start":{"line":400,"column":0},"end":{"line":400,"column":33}},"200":{"start":{"line":404,"column":0},"end":{"line":404,"column":34}},"201":{"start":{"line":405,"column":0},"end":{"line":405,"column":32}},"202":{"start":{"line":406,"column":0},"end":{"line":406,"column":42}},"203":{"start":{"line":407,"column":0},"end":{"line":407,"column":61}},"204":{"start":{"line":408,"column":0},"end":{"line":408,"column":66}},"205":{"start":{"line":410,"column":0},"end":{"line":410,"column":33}},"206":{"start":{"line":412,"column":0},"end":{"line":441,"column":1}},"207":{"start":{"line":413,"column":2},"end":{"line":413,"column":21}},"208":{"start":{"line":414,"column":2},"end":{"line":440,"column":5}},"209":{"start":{"line":415,"column":4},"end":{"line":436,"column":5}},"210":{"start":{"line":416,"column":6},"end":{"line":419,"column":8}},"211":{"start":{"line":417,"column":8},"end":{"line":417,"column":23}},"212":{"start":{"line":418,"column":8},"end":{"line":418,"column":22}},"213":{"start":{"line":421,"column":6},"end":{"line":424,"column":8}},"214":{"start":{"line":422,"column":8},"end":{"line":422,"column":23}},"215":{"start":{"line":423,"column":8},"end":{"line":423,"column":23}},"216":{"start":{"line":426,"column":6},"end":{"line":430,"column":7}},"217":{"start":{"line":427,"column":8},"end":{"line":427,"column":50}},"218":{"start":{"line":428,"column":8},"end":{"line":428,"column":48}},"219":{"start":{"line":429,"column":8},"end":{"line":429,"column":30}},"220":{"start":{"line":432,"column":6},"end":{"line":432,"column":38}},"221":{"start":{"line":433,"column":6},"end":{"line":433,"column":36}},"222":{"start":{"line":435,"column":6},"end":{"line":435,"column":20}},"223":{"start":{"line":438,"column":4},"end":{"line":438,"column":47}},"224":{"start":{"line":439,"column":4},"end":{"line":439,"column":63}},"225":{"start":{"line":443,"column":0},"end":{"line":450,"column":1}},"226":{"start":{"line":444,"column":2},"end":{"line":449,"column":5}},"227":{"start":{"line":445,"column":4},"end":{"line":447,"column":7}},"228":{"start":{"line":446,"column":6},"end":{"line":446,"column":33}},"229":{"start":{"line":448,"column":4},"end":{"line":448,"column":64}},"230":{"start":{"line":452,"column":0},"end":{"line":465,"column":1}},"231":{"start":{"line":454,"column":2},"end":{"line":460,"column":3}},"232":{"start":{"line":455,"column":4},"end":{"line":455,"column":16}},"233":{"start":{"line":456,"column":4},"end":{"line":456,"column":26}},"234":{"start":{"line":458,"column":9},"end":{"line":460,"column":3}},"235":{"start":{"line":459,"column":4},"end":{"line":459,"column":32}},"236":{"start":{"line":462,"column":2},"end":{"line":462,"column":56}},"237":{"start":{"line":464,"column":2},"end":{"line":464,"column":39}}},"branchMap":{"1":{"line":21,"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":21,"column":4}},{"start":{"line":21,"column":4},"end":{"line":21,"column":4}}]},"2":{"line":26,"type":"if","locations":[{"start":{"line":26,"column":4},"end":{"line":26,"column":4}},{"start":{"line":26,"column":4},"end":{"line":26,"column":4}}]},"3":{"line":31,"type":"binary-expr","locations":[{"start":{"line":31,"column":14},"end":{"line":31,"column":21}},{"start":{"line":31,"column":25},"end":{"line":31,"column":27}}]},"4":{"line":35,"type":"binary-expr","locations":[{"start":{"line":35,"column":16},"end":{"line":35,"column":28}},{"start":{"line":35,"column":32},"end":{"line":35,"column":55}},{"start":{"line":35,"column":59},"end":{"line":35,"column":83}}]},"5":{"line":36,"type":"binary-expr","locations":[{"start":{"line":36,"column":16},"end":{"line":36,"column":28}},{"start":{"line":36,"column":32},"end":{"line":36,"column":45}}]},"6":{"line":37,"type":"binary-expr","locations":[{"start":{"line":37,"column":21},"end":{"line":37,"column":38}},{"start":{"line":37,"column":42},"end":{"line":37,"column":71}}]},"7":{"line":38,"type":"binary-expr","locations":[{"start":{"line":38,"column":19},"end":{"line":38,"column":34}},{"start":{"line":38,"column":38},"end":{"line":38,"column":64}},{"start":{"line":38,"column":68},"end":{"line":38,"column":70}}]},"8":{"line":39,"type":"binary-expr","locations":[{"start":{"line":39,"column":23},"end":{"line":39,"column":42}},{"start":{"line":39,"column":46},"end":{"line":39,"column":76}},{"start":{"line":39,"column":80},"end":{"line":39,"column":82}}]},"9":{"line":41,"type":"binary-expr","locations":[{"start":{"line":41,"column":22},"end":{"line":41,"column":36}},{"start":{"line":41,"column":40},"end":{"line":41,"column":42}}]},"10":{"line":45,"type":"if","locations":[{"start":{"line":45,"column":4},"end":{"line":45,"column":4}},{"start":{"line":45,"column":4},"end":{"line":45,"column":4}}]},"11":{"line":49,"type":"if","locations":[{"start":{"line":49,"column":4},"end":{"line":49,"column":4}},{"start":{"line":49,"column":4},"end":{"line":49,"column":4}}]},"12":{"line":51,"type":"binary-expr","locations":[{"start":{"line":51,"column":16},"end":{"line":51,"column":26}},{"start":{"line":51,"column":30},"end":{"line":51,"column":34}}]},"13":{"line":58,"type":"if","locations":[{"start":{"line":58,"column":4},"end":{"line":58,"column":4}},{"start":{"line":58,"column":4},"end":{"line":58,"column":4}}]},"14":{"line":61,"type":"if","locations":[{"start":{"line":61,"column":4},"end":{"line":61,"column":4}},{"start":{"line":61,"column":4},"end":{"line":61,"column":4}}]},"15":{"line":73,"type":"if","locations":[{"start":{"line":73,"column":4},"end":{"line":73,"column":4}},{"start":{"line":73,"column":4},"end":{"line":73,"column":4}}]},"16":{"line":78,"type":"if","locations":[{"start":{"line":78,"column":4},"end":{"line":78,"column":4}},{"start":{"line":78,"column":4},"end":{"line":78,"column":4}}]},"17":{"line":78,"type":"binary-expr","locations":[{"start":{"line":78,"column":8},"end":{"line":78,"column":12}},{"start":{"line":78,"column":16},"end":{"line":78,"column":39}}]},"18":{"line":90,"type":"if","locations":[{"start":{"line":90,"column":4},"end":{"line":90,"column":4}},{"start":{"line":90,"column":4},"end":{"line":90,"column":4}}]},"19":{"line":96,"type":"binary-expr","locations":[{"start":{"line":96,"column":24},"end":{"line":96,"column":37}},{"start":{"line":96,"column":41},"end":{"line":96,"column":68}},{"start":{"line":96,"column":72},"end":{"line":96,"column":74}}]},"20":{"line":102,"type":"binary-expr","locations":[{"start":{"line":102,"column":25},"end":{"line":102,"column":43}},{"start":{"line":102,"column":47},"end":{"line":102,"column":56}}]},"21":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":4},"end":{"line":104,"column":4}},{"start":{"line":104,"column":4},"end":{"line":104,"column":4}}]},"22":{"line":108,"type":"binary-expr","locations":[{"start":{"line":108,"column":25},"end":{"line":108,"column":43}},{"start":{"line":108,"column":47},"end":{"line":108,"column":63}}]},"23":{"line":109,"type":"binary-expr","locations":[{"start":{"line":109,"column":20},"end":{"line":109,"column":33}},{"start":{"line":109,"column":37},"end":{"line":109,"column":52}}]},"24":{"line":116,"type":"if","locations":[{"start":{"line":116,"column":4},"end":{"line":116,"column":4}},{"start":{"line":116,"column":4},"end":{"line":116,"column":4}}]},"25":{"line":120,"type":"if","locations":[{"start":{"line":120,"column":4},"end":{"line":120,"column":4}},{"start":{"line":120,"column":4},"end":{"line":120,"column":4}}]},"26":{"line":125,"type":"if","locations":[{"start":{"line":125,"column":4},"end":{"line":125,"column":4}},{"start":{"line":125,"column":4},"end":{"line":125,"column":4}}]},"27":{"line":126,"type":"if","locations":[{"start":{"line":126,"column":4},"end":{"line":126,"column":4}},{"start":{"line":126,"column":4},"end":{"line":126,"column":4}}]},"28":{"line":126,"type":"binary-expr","locations":[{"start":{"line":126,"column":8},"end":{"line":126,"column":31}},{"start":{"line":126,"column":35},"end":{"line":126,"column":61}}]},"29":{"line":128,"type":"if","locations":[{"start":{"line":128,"column":4},"end":{"line":128,"column":4}},{"start":{"line":128,"column":4},"end":{"line":128,"column":4}}]},"30":{"line":158,"type":"if","locations":[{"start":{"line":158,"column":4},"end":{"line":158,"column":4}},{"start":{"line":158,"column":4},"end":{"line":158,"column":4}}]},"31":{"line":158,"type":"binary-expr","locations":[{"start":{"line":158,"column":8},"end":{"line":158,"column":11}},{"start":{"line":158,"column":15},"end":{"line":158,"column":43}}]},"32":{"line":162,"type":"binary-expr","locations":[{"start":{"line":162,"column":15},"end":{"line":162,"column":21}},{"start":{"line":162,"column":25},"end":{"line":162,"column":27}}]},"33":{"line":171,"type":"if","locations":[{"start":{"line":171,"column":4},"end":{"line":171,"column":4}},{"start":{"line":171,"column":4},"end":{"line":171,"column":4}}]},"34":{"line":178,"type":"if","locations":[{"start":{"line":178,"column":4},"end":{"line":178,"column":4}},{"start":{"line":178,"column":4},"end":{"line":178,"column":4}}]},"35":{"line":178,"type":"binary-expr","locations":[{"start":{"line":178,"column":8},"end":{"line":178,"column":11}},{"start":{"line":178,"column":15},"end":{"line":178,"column":43}}]},"36":{"line":182,"type":"binary-expr","locations":[{"start":{"line":182,"column":15},"end":{"line":182,"column":21}},{"start":{"line":182,"column":25},"end":{"line":182,"column":27}}]},"37":{"line":195,"type":"if","locations":[{"start":{"line":195,"column":4},"end":{"line":195,"column":4}},{"start":{"line":195,"column":4},"end":{"line":195,"column":4}}]},"38":{"line":195,"type":"binary-expr","locations":[{"start":{"line":195,"column":8},"end":{"line":195,"column":11}},{"start":{"line":195,"column":15},"end":{"line":195,"column":43}}]},"39":{"line":199,"type":"binary-expr","locations":[{"start":{"line":199,"column":15},"end":{"line":199,"column":21}},{"start":{"line":199,"column":25},"end":{"line":199,"column":27}}]},"40":{"line":214,"type":"if","locations":[{"start":{"line":214,"column":4},"end":{"line":214,"column":4}},{"start":{"line":214,"column":4},"end":{"line":214,"column":4}}]},"41":{"line":214,"type":"binary-expr","locations":[{"start":{"line":214,"column":8},"end":{"line":214,"column":13}},{"start":{"line":214,"column":17},"end":{"line":214,"column":42}}]},"42":{"line":226,"type":"if","locations":[{"start":{"line":226,"column":4},"end":{"line":226,"column":4}},{"start":{"line":226,"column":4},"end":{"line":226,"column":4}}]},"43":{"line":226,"type":"binary-expr","locations":[{"start":{"line":226,"column":8},"end":{"line":226,"column":13}},{"start":{"line":226,"column":17},"end":{"line":226,"column":46}}]},"44":{"line":236,"type":"if","locations":[{"start":{"line":236,"column":4},"end":{"line":236,"column":4}},{"start":{"line":236,"column":4},"end":{"line":236,"column":4}}]},"45":{"line":246,"type":"if","locations":[{"start":{"line":246,"column":6},"end":{"line":246,"column":6}},{"start":{"line":246,"column":6},"end":{"line":246,"column":6}}]},"46":{"line":260,"type":"if","locations":[{"start":{"line":260,"column":4},"end":{"line":260,"column":4}},{"start":{"line":260,"column":4},"end":{"line":260,"column":4}}]},"47":{"line":260,"type":"binary-expr","locations":[{"start":{"line":260,"column":8},"end":{"line":260,"column":13}},{"start":{"line":260,"column":17},"end":{"line":260,"column":46}}]},"48":{"line":267,"type":"if","locations":[{"start":{"line":267,"column":6},"end":{"line":267,"column":6}},{"start":{"line":267,"column":6},"end":{"line":267,"column":6}}]},"49":{"line":276,"type":"if","locations":[{"start":{"line":276,"column":6},"end":{"line":276,"column":6}},{"start":{"line":276,"column":6},"end":{"line":276,"column":6}}]},"50":{"line":288,"type":"if","locations":[{"start":{"line":288,"column":4},"end":{"line":288,"column":4}},{"start":{"line":288,"column":4},"end":{"line":288,"column":4}}]},"51":{"line":302,"type":"cond-expr","locations":[{"start":{"line":302,"column":27},"end":{"line":302,"column":54}},{"start":{"line":302,"column":57},"end":{"line":302,"column":76}}]},"52":{"line":307,"type":"if","locations":[{"start":{"line":307,"column":4},"end":{"line":307,"column":4}},{"start":{"line":307,"column":4},"end":{"line":307,"column":4}}]},"53":{"line":350,"type":"binary-expr","locations":[{"start":{"line":350,"column":19},"end":{"line":350,"column":29}},{"start":{"line":350,"column":33},"end":{"line":350,"column":47}},{"start":{"line":350,"column":51},"end":{"line":350,"column":66}},{"start":{"line":350,"column":70},"end":{"line":350,"column":73}}]},"54":{"line":353,"type":"if","locations":[{"start":{"line":353,"column":6},"end":{"line":353,"column":6}},{"start":{"line":353,"column":6},"end":{"line":353,"column":6}}]},"55":{"line":396,"type":"if","locations":[{"start":{"line":396,"column":2},"end":{"line":396,"column":2}},{"start":{"line":396,"column":2},"end":{"line":396,"column":2}}]},"56":{"line":415,"type":"if","locations":[{"start":{"line":415,"column":4},"end":{"line":415,"column":4}},{"start":{"line":415,"column":4},"end":{"line":415,"column":4}}]},"57":{"line":426,"type":"if","locations":[{"start":{"line":426,"column":6},"end":{"line":426,"column":6}},{"start":{"line":426,"column":6},"end":{"line":426,"column":6}}]},"58":{"line":446,"type":"binary-expr","locations":[{"start":{"line":446,"column":6},"end":{"line":446,"column":8}},{"start":{"line":446,"column":12},"end":{"line":446,"column":32}}]},"59":{"line":454,"type":"if","locations":[{"start":{"line":454,"column":2},"end":{"line":454,"column":2}},{"start":{"line":454,"column":2},"end":{"line":454,"column":2}}]},"60":{"line":458,"type":"if","locations":[{"start":{"line":458,"column":9},"end":{"line":458,"column":9}},{"start":{"line":458,"column":9},"end":{"line":458,"column":9}}]},"61":{"line":462,"type":"binary-expr","locations":[{"start":{"line":462,"column":2},"end":{"line":462,"column":28}},{"start":{"line":462,"column":33},"end":{"line":462,"column":54}}]}}},"/Users/lewis/dev/raven-node/lib/parsers.js":{"path":"/Users/lewis/dev/raven-node/lib/parsers.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":7,"7":7,"8":7,"9":1,"10":21,"11":21,"12":21,"13":21,"14":21,"15":21,"16":21,"17":7,"18":7,"19":4,"20":4,"21":21,"22":1,"23":1,"24":21,"25":21,"26":21,"27":21,"28":21,"29":1,"30":1,"31":1,"32":1,"33":1,"34":1,"35":27,"36":27,"37":27,"38":27,"39":27,"40":27,"41":27,"42":27,"43":27,"44":27,"45":27,"46":5,"47":4,"48":27,"49":1,"50":27,"51":27,"52":27,"53":27,"54":27,"55":26,"56":2,"57":4,"58":4,"59":26,"60":4,"61":26,"62":27},"b":{"1":[7,1],"2":[21,0],"3":[21,2],"4":[7,0],"5":[4,3],"6":[7,5,4],"7":[4,1],"8":[1,20],"9":[1,1],"10":[21,0],"11":[21,20],"12":[1,1],"13":[27,26],"14":[27,18,15],"15":[27,12,11,3],"16":[6,21],"17":[27,24,23],"18":[23,21],"19":[27,26],"20":[27,26],"21":[26,0],"22":[27,25],"23":[5,22],"24":[4,1],"25":[1,26],"26":[27,6],"27":[27,25],"28":[25,23],"29":[26,1],"30":[2,24],"31":[4,0],"32":[4,22]},"f":{"1":7,"2":21,"3":21,"4":1,"5":27},"fnMap":{"1":{"name":"parseText","line":9,"loc":{"start":{"line":9,"column":27},"end":{"line":9,"column":63}}},"2":{"name":"parseError","line":16,"loc":{"start":{"line":16,"column":28},"end":{"line":16,"column":65}}},"3":{"name":"(anonymous_3)","line":17,"loc":{"start":{"line":17,"column":24},"end":{"line":17,"column":42}}},"4":{"name":"parseQuery","line":56,"loc":{"start":{"line":56,"column":28},"end":{"line":56,"column":71}}},"5":{"name":"parseRequest","line":66,"loc":{"start":{"line":66,"column":30},"end":{"line":66,"column":65}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":31}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":31}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":47}},"4":{"start":{"line":7,"column":0},"end":{"line":7,"column":31}},"5":{"start":{"line":9,"column":0},"end":{"line":14,"column":2}},"6":{"start":{"line":10,"column":2},"end":{"line":10,"column":24}},"7":{"start":{"line":11,"column":2},"end":{"line":11,"column":27}},"8":{"start":{"line":13,"column":2},"end":{"line":13,"column":16}},"9":{"start":{"line":16,"column":0},"end":{"line":54,"column":2}},"10":{"start":{"line":17,"column":2},"end":{"line":53,"column":5}},"11":{"start":{"line":18,"column":4},"end":{"line":18,"column":29}},"12":{"start":{"line":19,"column":4},"end":{"line":21,"column":5}},"13":{"start":{"line":20,"column":6},"end":{"line":20,"column":69}},"14":{"start":{"line":22,"column":4},"end":{"line":28,"column":7}},"15":{"start":{"line":31,"column":4},"end":{"line":31,"column":24}},"16":{"start":{"line":32,"column":4},"end":{"line":39,"column":5}},"17":{"start":{"line":33,"column":6},"end":{"line":38,"column":7}},"18":{"start":{"line":34,"column":8},"end":{"line":37,"column":9}},"19":{"start":{"line":35,"column":10},"end":{"line":35,"column":50}},"20":{"start":{"line":36,"column":10},"end":{"line":36,"column":42}},"21":{"start":{"line":40,"column":4},"end":{"line":43,"column":5}},"22":{"start":{"line":41,"column":6},"end":{"line":41,"column":40}},"23":{"start":{"line":42,"column":6},"end":{"line":42,"column":43}},"24":{"start":{"line":45,"column":4},"end":{"line":50,"column":5}},"25":{"start":{"line":46,"column":6},"end":{"line":49,"column":7}},"26":{"start":{"line":47,"column":8},"end":{"line":47,"column":71}},"27":{"start":{"line":48,"column":8},"end":{"line":48,"column":14}},"28":{"start":{"line":52,"column":4},"end":{"line":52,"column":15}},"29":{"start":{"line":56,"column":0},"end":{"line":64,"column":2}},"30":{"start":{"line":57,"column":2},"end":{"line":57,"column":24}},"31":{"start":{"line":58,"column":2},"end":{"line":58,"column":25}},"32":{"start":{"line":59,"column":2},"end":{"line":62,"column":4}},"33":{"start":{"line":63,"column":2},"end":{"line":63,"column":16}},"34":{"start":{"line":66,"column":0},"end":{"line":191,"column":2}},"35":{"start":{"line":67,"column":2},"end":{"line":67,"column":24}},"36":{"start":{"line":75,"column":2},"end":{"line":75,"column":48}},"37":{"start":{"line":83,"column":2},"end":{"line":83,"column":26}},"38":{"start":{"line":91,"column":2},"end":{"line":91,"column":69}},"39":{"start":{"line":99,"column":2},"end":{"line":99,"column":107}},"40":{"start":{"line":107,"column":2},"end":{"line":107,"column":47}},"41":{"start":{"line":110,"column":2},"end":{"line":110,"column":50}},"42":{"start":{"line":118,"column":2},"end":{"line":118,"column":74}},"43":{"start":{"line":126,"column":2},"end":{"line":126,"column":51}},"44":{"start":{"line":134,"column":2},"end":{"line":134,"column":22}},"45":{"start":{"line":135,"column":2},"end":{"line":139,"column":3}},"46":{"start":{"line":136,"column":4},"end":{"line":138,"column":5}},"47":{"start":{"line":137,"column":6},"end":{"line":137,"column":29}},"48":{"start":{"line":141,"column":2},"end":{"line":144,"column":3}},"49":{"start":{"line":143,"column":4},"end":{"line":143,"column":27}},"50":{"start":{"line":152,"column":2},"end":{"line":152,"column":58}},"51":{"start":{"line":155,"column":2},"end":{"line":162,"column":4}},"52":{"start":{"line":165,"column":2},"end":{"line":165,"column":24}},"53":{"start":{"line":171,"column":2},"end":{"line":171,"column":16}},"54":{"start":{"line":172,"column":2},"end":{"line":188,"column":3}},"55":{"start":{"line":173,"column":4},"end":{"line":181,"column":5}},"56":{"start":{"line":176,"column":6},"end":{"line":180,"column":7}},"57":{"start":{"line":177,"column":8},"end":{"line":179,"column":9}},"58":{"start":{"line":178,"column":10},"end":{"line":178,"column":36}},"59":{"start":{"line":183,"column":4},"end":{"line":185,"column":5}},"60":{"start":{"line":184,"column":6},"end":{"line":184,"column":27}},"61":{"start":{"line":187,"column":4},"end":{"line":187,"column":23}},"62":{"start":{"line":190,"column":2},"end":{"line":190,"column":16}}},"branchMap":{"1":{"line":10,"type":"binary-expr","locations":[{"start":{"line":10,"column":11},"end":{"line":10,"column":17}},{"start":{"line":10,"column":21},"end":{"line":10,"column":23}}]},"2":{"line":19,"type":"if","locations":[{"start":{"line":19,"column":4},"end":{"line":19,"column":4}},{"start":{"line":19,"column":4},"end":{"line":19,"column":4}}]},"3":{"line":20,"type":"binary-expr","locations":[{"start":{"line":20,"column":38},"end":{"line":20,"column":49}},{"start":{"line":20,"column":53},"end":{"line":20,"column":67}}]},"4":{"line":33,"type":"if","locations":[{"start":{"line":33,"column":6},"end":{"line":33,"column":6}},{"start":{"line":33,"column":6},"end":{"line":33,"column":6}}]},"5":{"line":34,"type":"if","locations":[{"start":{"line":34,"column":8},"end":{"line":34,"column":8}},{"start":{"line":34,"column":8},"end":{"line":34,"column":8}}]},"6":{"line":34,"type":"binary-expr","locations":[{"start":{"line":34,"column":12},"end":{"line":34,"column":26}},{"start":{"line":34,"column":30},"end":{"line":34,"column":47}},{"start":{"line":34,"column":51},"end":{"line":34,"column":66}}]},"7":{"line":35,"type":"binary-expr","locations":[{"start":{"line":35,"column":28},"end":{"line":35,"column":43}},{"start":{"line":35,"column":47},"end":{"line":35,"column":49}}]},"8":{"line":40,"type":"if","locations":[{"start":{"line":40,"column":4},"end":{"line":40,"column":4}},{"start":{"line":40,"column":4},"end":{"line":40,"column":4}}]},"9":{"line":41,"type":"binary-expr","locations":[{"start":{"line":41,"column":21},"end":{"line":41,"column":33}},{"start":{"line":41,"column":37},"end":{"line":41,"column":39}}]},"10":{"line":46,"type":"if","locations":[{"start":{"line":46,"column":6},"end":{"line":46,"column":6}},{"start":{"line":46,"column":6},"end":{"line":46,"column":6}}]},"11":{"line":47,"type":"binary-expr","locations":[{"start":{"line":47,"column":25},"end":{"line":47,"column":39}},{"start":{"line":47,"column":43},"end":{"line":47,"column":70}}]},"12":{"line":57,"type":"binary-expr","locations":[{"start":{"line":57,"column":11},"end":{"line":57,"column":17}},{"start":{"line":57,"column":21},"end":{"line":57,"column":23}}]},"13":{"line":67,"type":"binary-expr","locations":[{"start":{"line":67,"column":11},"end":{"line":67,"column":17}},{"start":{"line":67,"column":21},"end":{"line":67,"column":23}}]},"14":{"line":75,"type":"binary-expr","locations":[{"start":{"line":75,"column":16},"end":{"line":75,"column":27}},{"start":{"line":75,"column":31},"end":{"line":75,"column":41}},{"start":{"line":75,"column":45},"end":{"line":75,"column":47}}]},"15":{"line":91,"type":"binary-expr","locations":[{"start":{"line":91,"column":13},"end":{"line":91,"column":25}},{"start":{"line":91,"column":29},"end":{"line":91,"column":37}},{"start":{"line":91,"column":41},"end":{"line":91,"column":53}},{"start":{"line":91,"column":57},"end":{"line":91,"column":68}}]},"16":{"line":99,"type":"cond-expr","locations":[{"start":{"line":99,"column":90},"end":{"line":99,"column":97}},{"start":{"line":99,"column":100},"end":{"line":99,"column":106}}]},"17":{"line":99,"type":"binary-expr","locations":[{"start":{"line":99,"column":17},"end":{"line":99,"column":41}},{"start":{"line":99,"column":45},"end":{"line":99,"column":55}},{"start":{"line":99,"column":59},"end":{"line":99,"column":87}}]},"18":{"line":99,"type":"binary-expr","locations":[{"start":{"line":99,"column":60},"end":{"line":99,"column":70}},{"start":{"line":99,"column":74},"end":{"line":99,"column":76}}]},"19":{"line":107,"type":"binary-expr","locations":[{"start":{"line":107,"column":20},"end":{"line":107,"column":35}},{"start":{"line":107,"column":39},"end":{"line":107,"column":46}}]},"20":{"line":118,"type":"binary-expr","locations":[{"start":{"line":118,"column":14},"end":{"line":118,"column":23}},{"start":{"line":118,"column":27},"end":{"line":118,"column":73}}]},"21":{"line":118,"type":"binary-expr","locations":[{"start":{"line":118,"column":43},"end":{"line":118,"column":54}},{"start":{"line":118,"column":58},"end":{"line":118,"column":60}}]},"22":{"line":126,"type":"binary-expr","locations":[{"start":{"line":126,"column":29},"end":{"line":126,"column":43}},{"start":{"line":126,"column":47},"end":{"line":126,"column":49}}]},"23":{"line":135,"type":"if","locations":[{"start":{"line":135,"column":2},"end":{"line":135,"column":2}},{"start":{"line":135,"column":2},"end":{"line":135,"column":2}}]},"24":{"line":136,"type":"if","locations":[{"start":{"line":136,"column":4},"end":{"line":136,"column":4}},{"start":{"line":136,"column":4},"end":{"line":136,"column":4}}]},"25":{"line":141,"type":"if","locations":[{"start":{"line":141,"column":2},"end":{"line":141,"column":2}},{"start":{"line":141,"column":2},"end":{"line":141,"column":2}}]},"26":{"line":141,"type":"binary-expr","locations":[{"start":{"line":141,"column":6},"end":{"line":141,"column":10}},{"start":{"line":141,"column":14},"end":{"line":141,"column":58}}]},"27":{"line":152,"type":"binary-expr","locations":[{"start":{"line":152,"column":11},"end":{"line":152,"column":17}},{"start":{"line":152,"column":21},"end":{"line":152,"column":57}}]},"28":{"line":152,"type":"binary-expr","locations":[{"start":{"line":152,"column":22},"end":{"line":152,"column":36}},{"start":{"line":152,"column":40},"end":{"line":152,"column":42}}]},"29":{"line":172,"type":"if","locations":[{"start":{"line":172,"column":2},"end":{"line":172,"column":2}},{"start":{"line":172,"column":2},"end":{"line":172,"column":2}}]},"30":{"line":173,"type":"if","locations":[{"start":{"line":173,"column":4},"end":{"line":173,"column":4}},{"start":{"line":173,"column":4},"end":{"line":173,"column":4}}]},"31":{"line":177,"type":"if","locations":[{"start":{"line":177,"column":8},"end":{"line":177,"column":8}},{"start":{"line":177,"column":8},"end":{"line":177,"column":8}}]},"32":{"line":183,"type":"if","locations":[{"start":{"line":183,"column":4},"end":{"line":183,"column":4}},{"start":{"line":183,"column":4},"end":{"line":183,"column":4}}]}}},"/Users/lewis/dev/raven-node/lib/utils.js":{"path":"/Users/lewis/dev/raven-node/lib/utils.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":19,"14":0,"15":0,"16":1,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":1,"24":24,"25":24,"26":24,"27":24,"28":24,"29":24,"30":1,"31":73,"32":4,"33":69,"34":69,"35":69,"36":2,"37":69,"38":1,"39":68,"40":68,"41":68,"42":68,"43":68,"44":1,"45":1,"46":24,"47":23,"48":1,"49":1,"50":1,"51":29,"52":1,"53":29,"54":1,"55":1,"56":283,"57":283,"58":0,"59":1,"60":1,"61":286,"62":285,"63":286,"64":286,"65":286,"66":286,"67":194,"68":92,"69":92,"70":1,"71":1,"72":1,"73":1,"74":1,"75":91,"76":1,"77":25,"78":25,"79":1,"80":24,"81":24,"82":3,"83":21,"84":21,"85":21,"86":283,"87":283,"88":283,"89":283,"90":283,"91":65,"92":65,"93":0,"94":65,"95":218,"96":0,"97":0,"98":0,"99":0,"100":218,"101":218,"102":218,"103":218,"104":218,"105":218,"106":218,"107":21,"108":1,"109":218,"110":218,"111":218,"112":1,"113":1},"b":{"1":[0,19],"2":[19,0],"3":[1,0],"4":[0,0],"5":[4,69],"6":[2,67],"7":[1,68],"8":[68,65,0],"9":[23,1],"10":[24,2],"11":[23,1],"12":[23,1],"13":[1,28],"14":[283,91],"15":[91,91],"16":[1,1,0],"17":[285,1],"18":[194,92],"19":[1,91],"20":[1,0],"21":[1,24],"22":[3,21],"23":[24,24,24,21],"24":[283,0],"25":[283,283,65],"26":[283,218],"27":[283,0],"28":[65,218],"29":[0,65],"30":[0,218],"31":[0,0],"32":[218,0],"33":[21,197]},"f":{"1":1,"2":19,"3":0,"4":24,"5":73,"6":24,"7":29,"8":283,"9":286,"10":25,"11":283,"12":218,"13":218},"fnMap":{"1":{"name":"disableConsoleAlerts","line":19,"loc":{"start":{"line":19,"column":38},"end":{"line":19,"column":70}}},"2":{"name":"consoleAlert","line":23,"loc":{"start":{"line":23,"column":30},"end":{"line":23,"column":57}}},"3":{"name":"(anonymous_3)","line":30,"loc":{"start":{"line":30,"column":41},"end":{"line":30,"column":59}}},"4":{"name":"getAuthHeader","line":42,"loc":{"start":{"line":42,"column":31},"end":{"line":42,"column":84}}},"5":{"name":"parseDSN","line":51,"loc":{"start":{"line":51,"column":26},"end":{"line":51,"column":49}}},"6":{"name":"getCulprit","line":83,"loc":{"start":{"line":83,"column":28},"end":{"line":83,"column":55}}},"7":{"name":"getModules","line":91,"loc":{"start":{"line":91,"column":28},"end":{"line":91,"column":50}}},"8":{"name":"getFunction","line":101,"loc":{"start":{"line":101,"column":0},"end":{"line":101,"column":27}}},"9":{"name":"getModule","line":115,"loc":{"start":{"line":115,"column":0},"end":{"line":115,"column":35}}},"10":{"name":"parseStack","line":138,"loc":{"start":{"line":138,"column":0},"end":{"line":138,"column":29}}},"11":{"name":"(anonymous_11)","line":159,"loc":{"start":{"line":159,"column":23},"end":{"line":159,"column":46}}},"12":{"name":"(anonymous_12)","line":186,"loc":{"start":{"line":186,"column":32},"end":{"line":186,"column":54}}},"13":{"name":"parseLines","line":196,"loc":{"start":{"line":196,"column":4},"end":{"line":196,"column":31}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":23}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":25}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":41}},"4":{"start":{"line":6,"column":0},"end":{"line":6,"column":27}},"5":{"start":{"line":7,"column":0},"end":{"line":7,"column":29}},"6":{"start":{"line":8,"column":0},"end":{"line":8,"column":40}},"7":{"start":{"line":10,"column":0},"end":{"line":10,"column":54}},"8":{"start":{"line":12,"column":0},"end":{"line":15,"column":2}},"9":{"start":{"line":17,"column":0},"end":{"line":17,"column":23}},"10":{"start":{"line":19,"column":0},"end":{"line":21,"column":2}},"11":{"start":{"line":20,"column":2},"end":{"line":20,"column":24}},"12":{"start":{"line":23,"column":0},"end":{"line":28,"column":2}},"13":{"start":{"line":24,"column":2},"end":{"line":27,"column":3}},"14":{"start":{"line":25,"column":4},"end":{"line":25,"column":30}},"15":{"start":{"line":26,"column":4},"end":{"line":26,"column":60}},"16":{"start":{"line":30,"column":0},"end":{"line":40,"column":2}},"17":{"start":{"line":31,"column":2},"end":{"line":38,"column":3}},"18":{"start":{"line":32,"column":4},"end":{"line":32,"column":30}},"19":{"start":{"line":33,"column":4},"end":{"line":37,"column":5}},"20":{"start":{"line":34,"column":6},"end":{"line":36,"column":7}},"21":{"start":{"line":35,"column":8},"end":{"line":35,"column":34}},"22":{"start":{"line":39,"column":2},"end":{"line":39,"column":16}},"23":{"start":{"line":42,"column":0},"end":{"line":49,"column":2}},"24":{"start":{"line":43,"column":2},"end":{"line":43,"column":43}},"25":{"start":{"line":44,"column":2},"end":{"line":44,"column":47}},"26":{"start":{"line":45,"column":2},"end":{"line":45,"column":58}},"27":{"start":{"line":46,"column":2},"end":{"line":46,"column":38}},"28":{"start":{"line":47,"column":2},"end":{"line":47,"column":44}},"29":{"start":{"line":48,"column":2},"end":{"line":48,"column":27}},"30":{"start":{"line":51,"column":0},"end":{"line":81,"column":2}},"31":{"start":{"line":52,"column":2},"end":{"line":55,"column":3}},"32":{"start":{"line":54,"column":4},"end":{"line":54,"column":17}},"33":{"start":{"line":56,"column":2},"end":{"line":80,"column":3}},"34":{"start":{"line":57,"column":4},"end":{"line":63,"column":10}},"35":{"start":{"line":65,"column":4},"end":{"line":67,"column":5}},"36":{"start":{"line":66,"column":6},"end":{"line":66,"column":58}},"37":{"start":{"line":69,"column":4},"end":{"line":71,"column":5}},"38":{"start":{"line":70,"column":6},"end":{"line":70,"column":43}},"39":{"start":{"line":73,"column":4},"end":{"line":73,"column":49}},"40":{"start":{"line":74,"column":4},"end":{"line":74,"column":57}},"41":{"start":{"line":75,"column":4},"end":{"line":75,"column":60}},"42":{"start":{"line":76,"column":4},"end":{"line":76,"column":75}},"43":{"start":{"line":77,"column":4},"end":{"line":77,"column":20}},"44":{"start":{"line":79,"column":4},"end":{"line":79,"column":50}},"45":{"start":{"line":83,"column":0},"end":{"line":88,"column":2}},"46":{"start":{"line":84,"column":2},"end":{"line":86,"column":3}},"47":{"start":{"line":85,"column":4},"end":{"line":85,"column":68}},"48":{"start":{"line":87,"column":2},"end":{"line":87,"column":21}},"49":{"start":{"line":90,"column":0},"end":{"line":90,"column":16}},"50":{"start":{"line":91,"column":0},"end":{"line":96,"column":2}},"51":{"start":{"line":92,"column":2},"end":{"line":94,"column":3}},"52":{"start":{"line":93,"column":4},"end":{"line":93,"column":26}},"53":{"start":{"line":95,"column":2},"end":{"line":95,"column":21}},"54":{"start":{"line":99,"column":0},"end":{"line":99,"column":25}},"55":{"start":{"line":101,"column":0},"end":{"line":111,"column":1}},"56":{"start":{"line":102,"column":2},"end":{"line":110,"column":3}},"57":{"start":{"line":103,"column":4},"end":{"line":104,"column":73}},"58":{"start":{"line":109,"column":4},"end":{"line":109,"column":25}},"59":{"start":{"line":113,"column":0},"end":{"line":113,"column":94}},"60":{"start":{"line":115,"column":0},"end":{"line":136,"column":1}},"61":{"start":{"line":116,"column":2},"end":{"line":116,"column":31}},"62":{"start":{"line":116,"column":13},"end":{"line":116,"column":31}},"63":{"start":{"line":119,"column":2},"end":{"line":119,"column":44}},"64":{"start":{"line":120,"column":2},"end":{"line":120,"column":36}},"65":{"start":{"line":121,"column":2},"end":{"line":121,"column":49}},"66":{"start":{"line":122,"column":2},"end":{"line":125,"column":3}},"67":{"start":{"line":124,"column":4},"end":{"line":124,"column":68}},"68":{"start":{"line":128,"column":2},"end":{"line":128,"column":44}},"69":{"start":{"line":129,"column":2},"end":{"line":134,"column":3}},"70":{"start":{"line":130,"column":4},"end":{"line":130,"column":66}},"71":{"start":{"line":131,"column":4},"end":{"line":131,"column":30}},"72":{"start":{"line":131,"column":16},"end":{"line":131,"column":30}},"73":{"start":{"line":132,"column":4},"end":{"line":132,"column":19}},"74":{"start":{"line":133,"column":4},"end":{"line":133,"column":18}},"75":{"start":{"line":135,"column":2},"end":{"line":135,"column":14}},"76":{"start":{"line":138,"column":0},"end":{"line":202,"column":1}},"77":{"start":{"line":139,"column":2},"end":{"line":140,"column":17}},"78":{"start":{"line":142,"column":2},"end":{"line":144,"column":3}},"79":{"start":{"line":143,"column":4},"end":{"line":143,"column":22}},"80":{"start":{"line":146,"column":2},"end":{"line":146,"column":36}},"81":{"start":{"line":149,"column":2},"end":{"line":152,"column":3}},"82":{"start":{"line":151,"column":4},"end":{"line":151,"column":22}},"83":{"start":{"line":154,"column":2},"end":{"line":154,"column":31}},"84":{"start":{"line":157,"column":2},"end":{"line":157,"column":18}},"85":{"start":{"line":159,"column":2},"end":{"line":201,"column":5}},"86":{"start":{"line":160,"column":4},"end":{"line":165,"column":95}},"87":{"start":{"line":168,"column":4},"end":{"line":168,"column":76}},"88":{"start":{"line":171,"column":4},"end":{"line":171,"column":65}},"89":{"start":{"line":171,"column":24},"end":{"line":171,"column":65}},"90":{"start":{"line":174,"column":4},"end":{"line":178,"column":5}},"91":{"start":{"line":175,"column":6},"end":{"line":175,"column":28}},"92":{"start":{"line":176,"column":6},"end":{"line":176,"column":40}},"93":{"start":{"line":176,"column":29},"end":{"line":176,"column":40}},"94":{"start":{"line":177,"column":6},"end":{"line":177,"column":13}},"95":{"start":{"line":180,"column":4},"end":{"line":184,"column":5}},"96":{"start":{"line":181,"column":6},"end":{"line":181,"column":40}},"97":{"start":{"line":182,"column":6},"end":{"line":182,"column":40}},"98":{"start":{"line":182,"column":29},"end":{"line":182,"column":40}},"99":{"start":{"line":183,"column":6},"end":{"line":183,"column":13}},"100":{"start":{"line":186,"column":4},"end":{"line":194,"column":7}},"101":{"start":{"line":187,"column":6},"end":{"line":191,"column":7}},"102":{"start":{"line":188,"column":8},"end":{"line":188,"column":43}},"103":{"start":{"line":189,"column":8},"end":{"line":189,"column":37}},"104":{"start":{"line":190,"column":8},"end":{"line":190,"column":32}},"105":{"start":{"line":192,"column":6},"end":{"line":192,"column":28}},"106":{"start":{"line":193,"column":6},"end":{"line":193,"column":40}},"107":{"start":{"line":193,"column":29},"end":{"line":193,"column":40}},"108":{"start":{"line":196,"column":4},"end":{"line":200,"column":5}},"109":{"start":{"line":197,"column":6},"end":{"line":197,"column":108}},"110":{"start":{"line":198,"column":6},"end":{"line":198,"column":51}},"111":{"start":{"line":199,"column":6},"end":{"line":199,"column":86}},"112":{"start":{"line":205,"column":0},"end":{"line":205,"column":39}},"113":{"start":{"line":206,"column":0},"end":{"line":206,"column":37}}},"branchMap":{"1":{"line":24,"type":"if","locations":[{"start":{"line":24,"column":2},"end":{"line":24,"column":2}},{"start":{"line":24,"column":2},"end":{"line":24,"column":2}}]},"2":{"line":24,"type":"binary-expr","locations":[{"start":{"line":24,"column":6},"end":{"line":24,"column":19}},{"start":{"line":24,"column":23},"end":{"line":24,"column":46}}]},"3":{"line":30,"type":"binary-expr","locations":[{"start":{"line":30,"column":24},"end":{"line":30,"column":37}},{"start":{"line":30,"column":41},"end":{"line":40,"column":1}}]},"4":{"line":34,"type":"if","locations":[{"start":{"line":34,"column":6},"end":{"line":34,"column":6}},{"start":{"line":34,"column":6},"end":{"line":34,"column":6}}]},"5":{"line":52,"type":"if","locations":[{"start":{"line":52,"column":2},"end":{"line":52,"column":2}},{"start":{"line":52,"column":2},"end":{"line":52,"column":2}}]},"6":{"line":65,"type":"if","locations":[{"start":{"line":65,"column":4},"end":{"line":65,"column":4}},{"start":{"line":65,"column":4},"end":{"line":65,"column":4}}]},"7":{"line":69,"type":"if","locations":[{"start":{"line":69,"column":4},"end":{"line":69,"column":4}},{"start":{"line":69,"column":4},"end":{"line":69,"column":4}}]},"8":{"line":76,"type":"binary-expr","locations":[{"start":{"line":76,"column":20},"end":{"line":76,"column":33}},{"start":{"line":76,"column":37},"end":{"line":76,"column":67}},{"start":{"line":76,"column":71},"end":{"line":76,"column":74}}]},"9":{"line":84,"type":"if","locations":[{"start":{"line":84,"column":2},"end":{"line":84,"column":2}},{"start":{"line":84,"column":2},"end":{"line":84,"column":2}}]},"10":{"line":84,"type":"binary-expr","locations":[{"start":{"line":84,"column":6},"end":{"line":84,"column":18}},{"start":{"line":84,"column":22},"end":{"line":84,"column":36}}]},"11":{"line":85,"type":"binary-expr","locations":[{"start":{"line":85,"column":12},"end":{"line":85,"column":24}},{"start":{"line":85,"column":28},"end":{"line":85,"column":31}}]},"12":{"line":85,"type":"binary-expr","locations":[{"start":{"line":85,"column":45},"end":{"line":85,"column":59}},{"start":{"line":85,"column":63},"end":{"line":85,"column":66}}]},"13":{"line":92,"type":"if","locations":[{"start":{"line":92,"column":2},"end":{"line":92,"column":2}},{"start":{"line":92,"column":2},"end":{"line":92,"column":2}}]},"14":{"line":103,"type":"binary-expr","locations":[{"start":{"line":103,"column":11},"end":{"line":103,"column":33}},{"start":{"line":104,"column":6},"end":{"line":104,"column":72}}]},"15":{"line":104,"type":"binary-expr","locations":[{"start":{"line":104,"column":34},"end":{"line":104,"column":54}},{"start":{"line":104,"column":58},"end":{"line":104,"column":71}}]},"16":{"line":113,"type":"binary-expr","locations":[{"start":{"line":113,"column":18},"end":{"line":113,"column":30}},{"start":{"line":113,"column":34},"end":{"line":113,"column":69}},{"start":{"line":113,"column":73},"end":{"line":113,"column":86}}]},"17":{"line":116,"type":"if","locations":[{"start":{"line":116,"column":2},"end":{"line":116,"column":2}},{"start":{"line":116,"column":2},"end":{"line":116,"column":2}}]},"18":{"line":122,"type":"if","locations":[{"start":{"line":122,"column":2},"end":{"line":122,"column":2}},{"start":{"line":122,"column":2},"end":{"line":122,"column":2}}]},"19":{"line":129,"type":"if","locations":[{"start":{"line":129,"column":2},"end":{"line":129,"column":2}},{"start":{"line":129,"column":2},"end":{"line":129,"column":2}}]},"20":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":4},"end":{"line":131,"column":4}},{"start":{"line":131,"column":4},"end":{"line":131,"column":4}}]},"21":{"line":142,"type":"if","locations":[{"start":{"line":142,"column":2},"end":{"line":142,"column":2}},{"start":{"line":142,"column":2},"end":{"line":142,"column":2}}]},"22":{"line":149,"type":"if","locations":[{"start":{"line":149,"column":2},"end":{"line":149,"column":2}},{"start":{"line":149,"column":2},"end":{"line":149,"column":2}}]},"23":{"line":149,"type":"binary-expr","locations":[{"start":{"line":149,"column":6},"end":{"line":149,"column":12}},{"start":{"line":149,"column":16},"end":{"line":149,"column":37}},{"start":{"line":149,"column":41},"end":{"line":149,"column":54}},{"start":{"line":149,"column":58},"end":{"line":149,"column":79}}]},"24":{"line":161,"type":"binary-expr","locations":[{"start":{"line":161,"column":20},"end":{"line":161,"column":38}},{"start":{"line":161,"column":42},"end":{"line":161,"column":44}}]},"25":{"line":165,"type":"binary-expr","locations":[{"start":{"line":165,"column":21},"end":{"line":165,"column":36}},{"start":{"line":165,"column":40},"end":{"line":165,"column":65}},{"start":{"line":165,"column":69},"end":{"line":165,"column":94}}]},"26":{"line":168,"type":"binary-expr","locations":[{"start":{"line":168,"column":19},"end":{"line":168,"column":30}},{"start":{"line":168,"column":34},"end":{"line":168,"column":75}}]},"27":{"line":171,"type":"if","locations":[{"start":{"line":171,"column":4},"end":{"line":171,"column":4}},{"start":{"line":171,"column":4},"end":{"line":171,"column":4}}]},"28":{"line":174,"type":"if","locations":[{"start":{"line":174,"column":4},"end":{"line":174,"column":4}},{"start":{"line":174,"column":4},"end":{"line":174,"column":4}}]},"29":{"line":176,"type":"if","locations":[{"start":{"line":176,"column":6},"end":{"line":176,"column":6}},{"start":{"line":176,"column":6},"end":{"line":176,"column":6}}]},"30":{"line":180,"type":"if","locations":[{"start":{"line":180,"column":4},"end":{"line":180,"column":4}},{"start":{"line":180,"column":4},"end":{"line":180,"column":4}}]},"31":{"line":182,"type":"if","locations":[{"start":{"line":182,"column":6},"end":{"line":182,"column":6}},{"start":{"line":182,"column":6},"end":{"line":182,"column":6}}]},"32":{"line":187,"type":"if","locations":[{"start":{"line":187,"column":6},"end":{"line":187,"column":6}},{"start":{"line":187,"column":6},"end":{"line":187,"column":6}}]},"33":{"line":193,"type":"if","locations":[{"start":{"line":193,"column":6},"end":{"line":193,"column":6}},{"start":{"line":193,"column":6},"end":{"line":193,"column":6}}]}}},"/Users/lewis/dev/raven-node/lib/transports.js":{"path":"/Users/lewis/dev/raven-node/lib/transports.js","s":{"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":22,"13":22,"14":0,"15":0,"16":22,"17":21,"18":21,"19":18,"20":18,"21":3,"22":3,"23":3,"24":3,"25":3,"26":3,"27":3,"28":3,"29":3,"30":3,"31":21,"32":21,"33":21,"34":22,"35":22,"36":1,"37":1,"38":1,"39":1,"40":22,"41":1,"42":1,"43":1,"44":1,"45":1,"46":1,"47":1,"48":1,"49":1,"50":1,"51":1},"b":{"1":[1,1],"2":[22,0],"3":[0,0],"4":[18,3],"5":[21,21],"6":[18,3],"7":[3,0],"8":[1,0],"9":[1,1],"10":[1,1]},"f":{"1":0,"2":1,"3":22,"4":21,"5":42,"6":1,"7":1},"fnMap":{"1":{"name":"Transport","line":6,"loc":{"start":{"line":6,"column":0},"end":{"line":6,"column":21}}},"2":{"name":"HTTPTransport","line":11,"loc":{"start":{"line":11,"column":0},"end":{"line":11,"column":32}}},"3":{"name":"(anonymous_3)","line":17,"loc":{"start":{"line":17,"column":31},"end":{"line":17,"column":80}}},"4":{"name":"(anonymous_4)","line":31,"loc":{"start":{"line":31,"column":44},"end":{"line":31,"column":59}}},"5":{"name":"(anonymous_5)","line":49,"loc":{"start":{"line":49,"column":15},"end":{"line":49,"column":27}}},"6":{"name":"(anonymous_6)","line":55,"loc":{"start":{"line":55,"column":18},"end":{"line":55,"column":31}}},"7":{"name":"HTTPSTransport","line":67,"loc":{"start":{"line":67,"column":0},"end":{"line":67,"column":33}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":31}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":27}},"3":{"start":{"line":6,"column":0},"end":{"line":6,"column":23}},"4":{"start":{"line":7,"column":0},"end":{"line":7,"column":46}},"5":{"start":{"line":9,"column":0},"end":{"line":9,"column":27}},"6":{"start":{"line":11,"column":0},"end":{"line":15,"column":1}},"7":{"start":{"line":12,"column":2},"end":{"line":12,"column":24}},"8":{"start":{"line":13,"column":2},"end":{"line":13,"column":24}},"9":{"start":{"line":14,"column":2},"end":{"line":14,"column":31}},"10":{"start":{"line":16,"column":0},"end":{"line":16,"column":40}},"11":{"start":{"line":17,"column":0},"end":{"line":63,"column":2}},"12":{"start":{"line":18,"column":2},"end":{"line":25,"column":4}},"13":{"start":{"line":26,"column":2},"end":{"line":30,"column":3}},"14":{"start":{"line":27,"column":4},"end":{"line":29,"column":5}},"15":{"start":{"line":28,"column":6},"end":{"line":28,"column":39}},"16":{"start":{"line":31,"column":2},"end":{"line":52,"column":5}},"17":{"start":{"line":32,"column":4},"end":{"line":32,"column":28}},"18":{"start":{"line":33,"column":4},"end":{"line":47,"column":5}},"19":{"start":{"line":34,"column":6},"end":{"line":34,"column":37}},"20":{"start":{"line":35,"column":6},"end":{"line":35,"column":30}},"21":{"start":{"line":37,"column":6},"end":{"line":37,"column":49}},"22":{"start":{"line":38,"column":6},"end":{"line":38,"column":74}},"23":{"start":{"line":39,"column":6},"end":{"line":39,"column":23}},"24":{"start":{"line":40,"column":6},"end":{"line":40,"column":36}},"25":{"start":{"line":41,"column":6},"end":{"line":41,"column":24}},"26":{"start":{"line":42,"column":6},"end":{"line":42,"column":30}},"27":{"start":{"line":43,"column":6},"end":{"line":43,"column":33}},"28":{"start":{"line":44,"column":6},"end":{"line":44,"column":26}},"29":{"start":{"line":45,"column":6},"end":{"line":45,"column":30}},"30":{"start":{"line":46,"column":6},"end":{"line":46,"column":18}},"31":{"start":{"line":49,"column":4},"end":{"line":49,"column":30}},"32":{"start":{"line":50,"column":4},"end":{"line":50,"column":25}},"33":{"start":{"line":51,"column":4},"end":{"line":51,"column":24}},"34":{"start":{"line":54,"column":2},"end":{"line":54,"column":22}},"35":{"start":{"line":55,"column":2},"end":{"line":61,"column":5}},"36":{"start":{"line":56,"column":4},"end":{"line":56,"column":28}},"37":{"start":{"line":57,"column":4},"end":{"line":60,"column":5}},"38":{"start":{"line":58,"column":6},"end":{"line":58,"column":18}},"39":{"start":{"line":59,"column":6},"end":{"line":59,"column":21}},"40":{"start":{"line":62,"column":2},"end":{"line":62,"column":19}},"41":{"start":{"line":65,"column":0},"end":{"line":65,"column":29}},"42":{"start":{"line":67,"column":0},"end":{"line":71,"column":1}},"43":{"start":{"line":68,"column":2},"end":{"line":68,"column":25}},"44":{"start":{"line":69,"column":2},"end":{"line":69,"column":25}},"45":{"start":{"line":70,"column":2},"end":{"line":70,"column":31}},"46":{"start":{"line":72,"column":0},"end":{"line":72,"column":45}},"47":{"start":{"line":74,"column":0},"end":{"line":74,"column":42}},"48":{"start":{"line":75,"column":0},"end":{"line":75,"column":44}},"49":{"start":{"line":76,"column":0},"end":{"line":76,"column":37}},"50":{"start":{"line":77,"column":0},"end":{"line":77,"column":45}},"51":{"start":{"line":78,"column":0},"end":{"line":78,"column":47}}},"branchMap":{"1":{"line":14,"type":"binary-expr","locations":[{"start":{"line":14,"column":17},"end":{"line":14,"column":24}},{"start":{"line":14,"column":28},"end":{"line":14,"column":30}}]},"2":{"line":23,"type":"binary-expr","locations":[{"start":{"line":23,"column":10},"end":{"line":23,"column":25}},{"start":{"line":23,"column":29},"end":{"line":23,"column":45}}]},"3":{"line":27,"type":"if","locations":[{"start":{"line":27,"column":4},"end":{"line":27,"column":4}},{"start":{"line":27,"column":4},"end":{"line":27,"column":4}}]},"4":{"line":33,"type":"if","locations":[{"start":{"line":33,"column":4},"end":{"line":33,"column":4}},{"start":{"line":33,"column":4},"end":{"line":33,"column":4}}]},"5":{"line":33,"type":"binary-expr","locations":[{"start":{"line":33,"column":8},"end":{"line":33,"column":29}},{"start":{"line":33,"column":33},"end":{"line":33,"column":53}}]},"6":{"line":35,"type":"binary-expr","locations":[{"start":{"line":35,"column":6},"end":{"line":35,"column":8}},{"start":{"line":35,"column":12},"end":{"line":35,"column":29}}]},"7":{"line":46,"type":"binary-expr","locations":[{"start":{"line":46,"column":6},"end":{"line":46,"column":8}},{"start":{"line":46,"column":12},"end":{"line":46,"column":17}}]},"8":{"line":57,"type":"if","locations":[{"start":{"line":57,"column":4},"end":{"line":57,"column":4}},{"start":{"line":57,"column":4},"end":{"line":57,"column":4}}]},"9":{"line":58,"type":"binary-expr","locations":[{"start":{"line":58,"column":6},"end":{"line":58,"column":8}},{"start":{"line":58,"column":12},"end":{"line":58,"column":17}}]},"10":{"line":70,"type":"binary-expr","locations":[{"start":{"line":70,"column":17},"end":{"line":70,"column":24}},{"start":{"line":70,"column":28},"end":{"line":70,"column":30}}]}}},"/Users/lewis/dev/raven-node/lib/middleware/connect.js":{"path":"/Users/lewis/dev/raven-node/lib/middleware/connect.js","s":{"1":1,"2":1,"3":0,"4":1,"5":0,"6":0,"7":1,"8":0,"9":0,"10":1},"b":{"1":[0,0],"2":[0,0]},"f":{"1":0,"2":0,"3":0},"fnMap":{"1":{"name":"(anonymous_1)","line":6,"loc":{"start":{"line":6,"column":24},"end":{"line":6,"column":42}}},"2":{"name":"(anonymous_2)","line":12,"loc":{"start":{"line":12,"column":33},"end":{"line":12,"column":51}}},"3":{"name":"(anonymous_3)","line":19,"loc":{"start":{"line":19,"column":35},"end":{"line":19,"column":53}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":3,"column":33}},"2":{"start":{"line":6,"column":0},"end":{"line":8,"column":2}},"3":{"start":{"line":7,"column":2},"end":{"line":7,"column":48}},"4":{"start":{"line":12,"column":0},"end":{"line":15,"column":2}},"5":{"start":{"line":13,"column":2},"end":{"line":13,"column":78}},"6":{"start":{"line":14,"column":2},"end":{"line":14,"column":31}},"7":{"start":{"line":19,"column":0},"end":{"line":22,"column":2}},"8":{"start":{"line":20,"column":2},"end":{"line":20,"column":78}},"9":{"start":{"line":21,"column":2},"end":{"line":21,"column":33}},"10":{"start":{"line":24,"column":0},"end":{"line":24,"column":35}}},"branchMap":{"1":{"line":13,"type":"cond-expr","locations":[{"start":{"line":13,"column":44},"end":{"line":13,"column":50}},{"start":{"line":13,"column":53},"end":{"line":13,"column":77}}]},"2":{"line":20,"type":"cond-expr","locations":[{"start":{"line":20,"column":44},"end":{"line":20,"column":50}},{"start":{"line":20,"column":53},"end":{"line":20,"column":77}}]}}}} \ No newline at end of file diff --git a/node_modules/raven/coverage/lcov-report/base.css b/node_modules/raven/coverage/lcov-report/base.css deleted file mode 100644 index 29737bc..0000000 --- a/node_modules/raven/coverage/lcov-report/base.css +++ /dev/null @@ -1,213 +0,0 @@ -body, html { - margin:0; padding: 0; - height: 100%; -} -body { - font-family: Helvetica Neue, Helvetica, Arial; - font-size: 14px; - color:#333; -} -.small { font-size: 12px; } -*, *:after, *:before { - -webkit-box-sizing:border-box; - -moz-box-sizing:border-box; - box-sizing:border-box; - } -h1 { font-size: 20px; margin: 0;} -h2 { font-size: 14px; } -pre { - font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; - margin: 0; - padding: 0; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} -a { color:#0074D9; text-decoration:none; } -a:hover { text-decoration:underline; } -.strong { font-weight: bold; } -.space-top1 { padding: 10px 0 0 0; } -.pad2y { padding: 20px 0; } -.pad1y { padding: 10px 0; } -.pad2x { padding: 0 20px; } -.pad2 { padding: 20px; } -.pad1 { padding: 10px; } -.space-left2 { padding-left:55px; } -.space-right2 { padding-right:20px; } -.center { text-align:center; } -.clearfix { display:block; } -.clearfix:after { - content:''; - display:block; - height:0; - clear:both; - visibility:hidden; - } -.fl { float: left; } -@media only screen and (max-width:640px) { - .col3 { width:100%; max-width:100%; } - .hide-mobile { display:none!important; } -} - -.quiet { - color: #7f7f7f; - color: rgba(0,0,0,0.5); -} -.quiet a { opacity: 0.7; } - -.fraction { - font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; - font-size: 10px; - color: #555; - background: #E8E8E8; - padding: 4px 5px; - border-radius: 3px; - vertical-align: middle; -} - -div.path a:link, div.path a:visited { color: #333; } -table.coverage { - border-collapse: collapse; - margin: 10px 0 0 0; - padding: 0; -} - -table.coverage td { - margin: 0; - padding: 0; - vertical-align: top; -} -table.coverage td.line-count { - text-align: right; - padding: 0 5px 0 20px; -} -table.coverage td.line-coverage { - text-align: right; - padding-right: 10px; - min-width:20px; -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 100%; -} -.missing-if-branch { - display: inline-block; - margin-right: 5px; - border-radius: 3px; - position: relative; - padding: 0 4px; - background: #333; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} -.coverage-summary { - border-collapse: collapse; - width: 100%; -} -.coverage-summary tr { border-bottom: 1px solid #bbb; } -.keyline-all { border: 1px solid #ddd; } -.coverage-summary td, .coverage-summary th { padding: 10px; } -.coverage-summary tbody { border: 1px solid #bbb; } -.coverage-summary td { border-right: 1px solid #bbb; } -.coverage-summary td:last-child { border-right: none; } -.coverage-summary th { - text-align: left; - font-weight: normal; - white-space: nowrap; -} -.coverage-summary th.file { border-right: none !important; } -.coverage-summary th.pct { } -.coverage-summary th.pic, -.coverage-summary th.abs, -.coverage-summary td.pct, -.coverage-summary td.abs { text-align: right; } -.coverage-summary td.file { white-space: nowrap; } -.coverage-summary td.pic { min-width: 120px !important; } -.coverage-summary tfoot td { } - -.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} -.status-line { height: 10px; } -/* dark red */ -.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } -.low .chart { border:1px solid #C21F39 } -/* medium red */ -.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } -/* light red */ -.low, .cline-no { background:#FCE1E5 } -/* light green */ -.high, .cline-yes { background:rgb(230,245,208) } -/* medium green */ -.cstat-yes { background:rgb(161,215,106) } -/* dark green */ -.status-line.high, .high .cover-fill { background:rgb(77,146,33) } -.high .chart { border:1px solid rgb(77,146,33) } -/* dark yellow (gold) */ -.medium .chart { border:1px solid #f9cd0b; } -.status-line.medium, .medium .cover-fill { background: #f9cd0b; } -/* light yellow */ -.medium { background: #fff4c2; } -/* light gray */ -span.cline-neutral { background: #eaeaea; } - -.cbranch-no { background: yellow !important; color: #111; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - - -.cover-fill, .cover-empty { - display:inline-block; - height: 12px; -} -.chart { - line-height: 0; -} -.cover-empty { - background: white; -} -.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } - -.wrapper { - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -48px; -} -.footer, .push { - height: 48px; -} diff --git a/node_modules/raven/coverage/lcov-report/index.html b/node_modules/raven/coverage/lcov-report/index.html deleted file mode 100644 index 0004f70..0000000 --- a/node_modules/raven/coverage/lcov-report/index.html +++ /dev/null @@ -1,119 +0,0 @@ - - - - Code coverage report for All files - - - - - - - -
-
-

- / -

-
-
- 85% - Statements - 408/480 -
-
- 78.42% - Branches - 229/292 -
-
- 75% - Functions - 54/72 -
-
- 85.74% - Lines - 403/470 -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
raven-node/
100%7/7100%0/0100%0/0100%7/7
raven-node/lib/
85.53%396/46379.51%229/28878.26%54/6986.31%391/453
raven-node/lib/middleware/
50%5/100%0/40%0/350%5/10
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/prettify.css b/node_modules/raven/coverage/lcov-report/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/node_modules/raven/coverage/lcov-report/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/raven/coverage/lcov-report/prettify.js b/node_modules/raven/coverage/lcov-report/prettify.js deleted file mode 100644 index ef51e03..0000000 --- a/node_modules/raven/coverage/lcov-report/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/raven/coverage/lcov-report/raven-node/index.html b/node_modules/raven/coverage/lcov-report/raven-node/index.html deleted file mode 100644 index fd416a4..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - Code coverage report for raven-node/ - - - - - - - -
-
-

- all files raven-node/ -

-
-
- 100% - Statements - 7/7 -
-
- 100% - Branches - 0/0 -
-
- 100% - Functions - 0/0 -
-
- 100% - Lines - 7/7 -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
index.js
100%7/7100%0/0100%0/0100%7/7
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/raven-node/index.js.html b/node_modules/raven/coverage/lcov-report/raven-node/index.js.html deleted file mode 100644 index db71c6a..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/index.js.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - Code coverage report for raven-node/index.js - - - - - - - -
-
-

- all files / raven-node/ index.js -

-
-
- 100% - Statements - 7/7 -
-
- 100% - Branches - 0/0 -
-
- 100% - Functions - 0/0 -
-
- 100% - Lines - 7/7 -
-
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15  -  - - - -  -  -  - - - -  -  - - 
'use strict';
- 
-module.exports = require('./lib/client');
-module.exports.utils = require('./lib/utils');
-module.exports.middleware = {
-  connect: require('./lib/middleware/connect')
-};
-// friendly alias for "raven.middleware.express"
-module.exports.middleware.express = module.exports.middleware.connect;
-module.exports.transports = require('./lib/transports');
-module.exports.parsers = require('./lib/parsers');
- 
-// To infinity and beyond
-Error.stackTraceLimit = Infinity;
- 
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/raven-node/lib/client.js.html b/node_modules/raven/coverage/lcov-report/raven-node/lib/client.js.html deleted file mode 100644 index e6f9237..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/lib/client.js.html +++ /dev/null @@ -1,1460 +0,0 @@ - - - - Code coverage report for raven-node/lib/client.js - - - - - - - -
-
-

- all files / raven-node/lib/ client.js -

-
-
- 78.48% - Statements - 186/237 -
-
- 73.44% - Branches - 94/128 -
-
- 70.45% - Functions - 31/44 -
-
- 79.4% - Lines - 185/233 -
-
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466  -  - - - - - - - - - -  - -  - -  - -  - -  -66× -  - - -  -66× -  - - -  -66× -  -66× -66× -66× -66× -66× -66× -66× -  -66× -66× -66× -  -66× - -  -  -66× -  -64× -  -  -  -66× -  -66× -66× - -  -66× - -  -  -66× - -  -  -66× -  -  -  - -  -  -  - - - -  - -  -  -  -29× -  -  -  -  -29× -12× -12× -12× -  -  -29× -29× -29× -29× -  -29× -29× -  -29× -  -  -  -29× -29× -29× -29× -29× -29× -  -  -29× - -  -  -29× - -  -  -29× -29× -29× -  -29× -27× -  -  -  - - -  -  -  -  -  -24× -24× -24× -  -24× -23× -  -  -  -  -  -  -  -23× -  -  -  -  - -  -  -  - -  - - -  - -  -  -  -12× -  -  -  - -  -  -12× - - -  -11× -  -  -12× -12× -12× -12× -  -  -12× -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - - - -  -  -  -  -  - -  -  -  - -  -  -  -  - -  - -  - - - -  -  -  -  - - -  - -  -  -  -  - - - -  - -  - -  -  -  - - - -  - - - - - -  - -  -  -  -  - -  -  -  -  - - - -  - -  -  -  - - -  - -  - -  -  -  -  -  -  -  -  -  -  -  -  - - - - -  -  -  -  -  - -  -  -  -  -  -  -  -  -  -  - -  -  -  -  -  -  -  -  -  -  - -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - -  - - -  -  - - -  -  - - - -  -  -  -  -  -  -  -  -  -  -  -  -  -  - -  -  - -66× -66× -66× -  - -  -  -  - - - - - -  - -  - - - - - - - -  -  - -  -  -  -  - - - - -  -  - - -  - -  -  - - -  -  -  - - - - -  - -  -  -  - -  -  -  -  -  -  -  -  -  -  -  -  -  - 
'use strict';
- 
-var stringify = require('json-stringify-safe');
-var parsers = require('./parsers');
-var zlib = require('zlib');
-var utils = require('./utils');
-var uuid = require('node-uuid');
-var transports = require('./transports');
-var nodeUtil = require('util'); // nodeUtil to avoid confusion with "utils"
-var events = require('events');
-var domain = require('domain');
- 
-var extend = utils.extend;
- 
-function Raven() {}
- 
-nodeUtil.inherits(Raven, events.EventEmitter);
- 
-extend(Raven.prototype, {
-  config: function config(dsn, options) {
-    if (arguments.length === 0) {
-      // no arguments, use default from environment
-      dsn = process.env.SENTRY_DSN;
-      options = {};
-    }
-    if (typeof dsn === 'object') {
-      // They must only be passing through options
-      options = dsn;
-      dsn = process.env.SENTRY_DSN;
-    }
-    options = options || {};
- 
-    this.raw_dsn = dsn;
-    this.dsn = utils.parseDSN(dsn);
-    this.name = options.name || process.env.SENTRY_NAME || require('os').hostname();
-    this.root = options.root || process.cwd();
-    this.transport = options.transport || transports[this.dsn.protocol];
-    this.release = options.release || process.env.SENTRY_RELEASE || '';
-    this.environment = options.environment || process.env.SENTRY_ENVIRONMENT || '';
- 
-    this.loggerName = options.logger || '';
-    this.dataCallback = options.dataCallback;
-    this.shouldSendCallback = options.shouldSendCallback;
- 
-    if (!this.dsn) {
-      utils.consoleAlert('no DSN provided, error reporting disabled');
-    }
- 
-    if (this.dsn.protocol === 'https') {
-      // In case we want to provide our own SSL certificates / keys
-      this.ca = options.ca || null;
-    }
- 
-    // enabled if a dsn is set
-    this._enabled = !!this.dsn;
- 
-    var globalContext = this._globalContext = {};
-    if (options.tags) {
-      globalContext.tags = options.tags;
-    }
-    if (options.extra) {
-      globalContext.extra = options.extra;
-    }
- 
-    this.on('error', function (err) {
-      utils.consoleAlert('failed to send exception to sentry: ' + err.message);
-    });
- 
-    return this;
-  },
- 
-  install: function install(opts, cb) {
-    Iif (typeof opts === 'function') {
-      cb = opts;
-    }
- 
-    registerExceptionHandler(this, cb);
-    if (opts && opts.unhandledRejection) {
-      registerRejectionHandler(this, cb);
-    }
-    return this;
-  },
- 
-  generateEventId: function generateEventId() {
-    return uuid().replace(/-/g, '');
-  },
- 
-  process: function process(eventId, kwargs, cb) {
-    // prod codepaths shouldn't hit this branch, for testing
-    if (typeof eventId === 'object') {
-      cb = kwargs;
-      kwargs = eventId;
-      eventId = this.generateEventId();
-    }
- 
-    var domainContext = domain.active && domain.active.sentryContext || {};
-    kwargs.user = extend({}, this._globalContext.user, domainContext.user, kwargs.user);
-    kwargs.tags = extend({}, this._globalContext.tags, domainContext.tags, kwargs.tags);
-    kwargs.extra = extend({}, this._globalContext.extra, domainContext.extra, kwargs.extra);
- 
-    kwargs.modules = utils.getModules();
-    kwargs.server_name = kwargs.server_name || this.name;
- 
-    Iif (typeof process.version !== 'undefined') {
-      kwargs.extra.node = process.version;
-    }
- 
-    kwargs.environment = kwargs.environment || this.environment;
-    kwargs.logger = kwargs.logger || this.loggerName;
-    kwargs.event_id = eventId;
-    kwargs.timestamp = new Date().toISOString().split('.')[0];
-    kwargs.project = this.dsn.project_id;
-    kwargs.platform = 'node';
- 
-    // Only include release information if it is set
-    if (this.release) {
-      kwargs.release = this.release;
-    }
- 
-    if (this.dataCallback) {
-      kwargs = this.dataCallback(kwargs);
-    }
- 
-    var shouldSend = true;
-    Iif (!this._enabled) shouldSend = false;
-    if (this.shouldSendCallback && !this.shouldSendCallback()) shouldSend = false;
- 
-    if (shouldSend) {
-      this.send(kwargs, cb);
-    } else {
-      // wish there was a good way to communicate to cb why we didn't send; worth considering cb api change?
-      // avoiding setImmediate here because node 0.8
-      setTimeout(function () {
-        cb(null, eventId);
-      }, 0);
-    }
-  },
- 
-  send: function send(kwargs, cb) {
-    var self = this;
-    var skwargs = stringify(kwargs);
-    var eventId = kwargs.event_id;
- 
-    zlib.deflate(skwargs, function (err, buff) {
-      var message = buff.toString('base64'),
-          timestamp = new Date().getTime(),
-          headers = {
-            'X-Sentry-Auth': utils.getAuthHeader(timestamp, self.dsn.public_key, self.dsn.private_key),
-            'Content-Type': 'application/octet-stream',
-            'Content-Length': message.length
-          };
- 
-      self.transport.send(self, message, headers, eventId, cb);
-    });
-  },
- 
-  captureMessage: function captureMessage(message, kwargs, cb) {
-    Iif (!cb && typeof kwargs === 'function') {
-      cb = kwargs;
-      kwargs = {};
-    } else {
-      kwargs = kwargs || {};
-    }
-    var eventId = this.generateEventId();
-    this.process(eventId, parsers.parseText(message, kwargs), cb);
- 
-    return eventId;
-  },
- 
-  captureException: function captureException(err, kwargs, cb) {
-    if (!(err instanceof Error)) {
-      // This handles when someone does:
-      //   throw "something awesome";
-      // We synthesize an Error here so we can extract a (rough) stack trace.
-      err = new Error(err);
-    }
- 
-    if (!cb && typeof kwargs === 'function') {
-      cb = kwargs;
-      kwargs = {};
-    } else {
-      kwargs = kwargs || {};
-    }
- 
-    var self = this;
-    var eventId = this.generateEventId();
-    parsers.parseError(err, kwargs, function (kw) {
-      self.process(eventId, kw, cb);
-    });
- 
-    return eventId;
-  },
- 
-  captureQuery: function captureQuery(query, engine, kwargs, cb) {
-    if (!cb && typeof kwargs === 'function') {
-      cb = kwargs;
-      kwargs = {};
-    } else {
-      kwargs = kwargs || {};
-    }
- 
-    var eventId = this.generateEventId();
-    this.process(eventId, parsers.parseQuery(query, engine, kwargs), cb);
- 
-    return eventId;
-  },
- 
-  /* The onErr param here is sort of ugly and won't typically be used
-   * but it lets us write the requestHandler middleware in terms of this function.
-   * We could consider getting rid of it and just duplicating the domain
-   * instantiation etc logic in the requestHandler middleware
-   */
-  context: function (ctx, func, onErr) {
-    Eif (!func && typeof ctx === 'function') {
-      func = ctx;
-      ctx = {};
-    }
- 
-    // todo/note: raven-js takes an args param to do apply(this, args)
-    // i don't think it's correct/necessary to bind this to the wrap call
-    // and i don't know if we need to support the args param; it's undocumented
-    return this.wrap(ctx, func, onErr).apply(null);
-  },
- 
-  wrap: function (options, func, onErr) {
-    Iif (!func && typeof options === 'function') {
-      func = options;
-      options = {};
-    }
- 
-    var wrapDomain = domain.create();
-    // todo: better property name than sentryContext, maybe __raven__ or sth?
-    wrapDomain.sentryContext = options;
- 
-    var self = this;
-    Eif (typeof onErr !== 'function') {
-      onErr = function (err) {
-        self.captureException(err, wrapDomain.sentryContext);
-      };
-    }
- 
-    wrapDomain.on('error', onErr);
-    var wrapped = wrapDomain.bind(func);
- 
-    for (var property in func) {
-      if ({}.hasOwnProperty.call(func, property)) {
-        wrapped[property] = func[property];
-      }
-    }
-    wrapped.prototype = func.prototype;
-    wrapped.__raven__ = true;
-    wrapped.__inner__ = func;
-    // note: domain.bind sets wrapped.domain, but it's not documented, unsure if we should rely on that
-    wrapped.__domain__ = wrapDomain;
- 
-    return wrapped;
-  },
- 
-  interceptErr: function (options, func) {
-    if (!func && typeof options === 'function') {
-      func = options;
-      options = {};
-    }
-    var self = this;
-    var wrapped = function () {
-      var err = arguments[0];
-      if (err instanceof Error) {
-        self.captureException(err, options);
-      } else {
-        func.apply(null, arguments);
-      }
-    };
- 
-    // repetitive with wrap
-    for (var property in func) {
-      if ({}.hasOwnProperty.call(func, property)) {
-        wrapped[property] = func[property];
-      }
-    }
-    wrapped.prototype = func.prototype;
-    wrapped.__raven__ = true;
-    wrapped.__inner__ = func;
- 
-    return wrapped;
-  },
- 
-  setContext: function setContext(ctx) {
-    if (domain.active) {
-      domain.active.sentryContext = ctx;
-    } else {
-      this._globalContext = ctx;
-    }
-    return this;
-  },
- 
-  mergeContext: function mergeContext(ctx) {
-    extend(this.getContext(), ctx);
-    return this;
-  },
- 
-  getContext: function getContext() {
-    return domain.active ? domain.active.sentryContext : this._globalContext;
-  },
- 
-  setCallbackHelper: function (propertyName, callback) {
-    var original = this[propertyName];
-    Eif (typeof callback === 'function') {
-      this[propertyName] = function (data) {
-        return callback(data, original);
-      };
-    } else {
-      this[propertyName] = callback;
-    }
- 
-    return this;
-  },
- 
-  /*
-   * Set the dataCallback option
-   *
-   * @param {function} callback The callback to run which allows the
-   *                            data blob to be mutated before sending
-   * @return {Raven}
-   */
-  setDataCallback: function (callback) {
-    return this.setCallbackHelper('dataCallback', callback);
-  },
- 
-  /*
-   * Set the shouldSendCallback option
-   *
-   * @param {function} callback The callback to run which allows
-   *                            introspecting the blob before sending
-   * @return {Raven}
-   */
-  setShouldSendCallback: function (callback) {
-    return this.setCallbackHelper('shouldSendCallback', callback);
-  },
- 
-  requestHandler: function () {
-    var self = this;
-    return function (req, res, next) {
-      self.context({}, next, next);
-    };
-  },
- 
-  errorHandler: function () {
-    var self = this;
-    return function (err, req, res, next) {
-      var status = err.status || err.statusCode || err.status_code || 500;
- 
-      // skip anything not marked as an internal server error
-      if (status < 500) return next(err);
- 
-      var kwargs = parsers.parseRequest(req);
-      var eventId = self.captureException(err, kwargs);
-      res.sentry = eventId;
-      return next(err);
-    };
-  }
-});
- 
- 
-// Deprecations
-extend(Raven.prototype, {
-  getIdent: function getIdent(result) {
-    utils.consoleAlert('getIdent has been deprecated and will be removed in v2.0');
-    return result;
-  },
-  captureError: function captureError() {
-    utils.consoleAlert('captureError has been deprecated and will be removed in v2.0');
-    return this.captureException.apply(this, arguments);
-  },
-  patchGlobal: function (cb) {
-    utils.consoleAlert('patchGlobal has been deprecated and will be removed in v2.0');
-    registerExceptionHandler(this, cb);
-    return this;
-  },
-  setUserContext: function setUserContext() {
-    utils.consoleAlert('setUserContext has been deprecated and will be removed in v2.0; use setContext instead');
-    return this;
-  },
-  setExtraContext: function setExtraContext() {
-    utils.consoleAlert('setExtraContext has been deprecated and will be removed in v2.0; use setContext instead');
-    return this;
-  },
-  setTagsContext: function setTagsContext() {
-    utils.consoleAlert('setTagsContext has been deprecated and will be removed in v2.0; use setContext instead');
-    return this;
-  },
-});
-Raven.prototype.get_ident = Raven.prototype.getIdent;
- 
-// Maintain old API compat, need to make sure arguments length is preserved
-function Client(dsn, options) {
-  Iif (dsn instanceof Client) return dsn;
-  var ravenInstance = new Raven();
-  return ravenInstance.config.apply(ravenInstance, arguments);
-}
-nodeUtil.inherits(Client, Raven);
- 
-// Singleton-by-default but not strictly enforced
-// todo these extra export props are sort of an adhoc mess, better way to manage?
-var defaultInstance = new Raven();
-defaultInstance.Client = Client;
-defaultInstance.patchGlobal = patchGlobal;
-defaultInstance.version = require('../package.json').version;
-defaultInstance.disableConsoleAlerts = utils.disableConsoleAlerts;
- 
-module.exports = defaultInstance;
- 
-function registerExceptionHandler(client, cb) {
-  var called = false;
-  process.on('uncaughtException', function (err) {
-    if (cb) { // bind event listeners only if a callback was supplied
-      var onLogged = function onLogged() {
-        called = false;
-        cb(true, err);
-      };
- 
-      var onError = function onError() {
-        called = false;
-        cb(false, err);
-      };
- 
-      if (called) {
-        client.removeListener('logged', onLogged);
-        client.removeListener('error', onError);
-        return cb(false, err);
-      }
- 
-      client.once('logged', onLogged);
-      client.once('error', onError);
- 
-      called = true;
-    }
- 
-    var eventId = client.captureException(err);
-    return utils.consoleAlert('uncaughtException: ' + eventId);
-  });
-}
- 
-function registerRejectionHandler(client, cb) {
-  process.on('unhandledRejection', function (reason) {
-    var eventId = client.captureException(reason, function (sendErr) {
-      cb && cb(!sendErr, reason);
-    });
-    return utils.consoleAlert('unhandledRejection: ' + eventId);
-  });
-}
- 
-function patchGlobal(client, cb) {
-  // handle when the first argument is the callback, with no client specified
-  if (typeof client === 'function') {
-    cb = client;
-    client = new Client();
-    // first argument is a string DSN
-  } else if (typeof client === 'string') {
-    client = new Client(client);
-  }
-  // at the end, if we still don't have a Client, let's make one!
-  !(client instanceof Raven) && (client = new Client());
- 
-  registerExceptionHandler(client, cb);
-}
- 
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/raven-node/lib/index.html b/node_modules/raven/coverage/lcov-report/raven-node/lib/index.html deleted file mode 100644 index 107598e..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/lib/index.html +++ /dev/null @@ -1,132 +0,0 @@ - - - - Code coverage report for raven-node/lib/ - - - - - - - -
-
-

- all files raven-node/lib/ -

-
-
- 85.53% - Statements - 396/463 -
-
- 79.51% - Branches - 229/288 -
-
- 78.26% - Functions - 54/69 -
-
- 86.31% - Lines - 391/453 -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
client.js
78.48%186/23773.44%94/12870.45%31/4479.4%185/233
parsers.js
100%62/6292.75%64/69100%5/5100%62/62
transports.js
96.08%49/5175%15/2085.71%6/796.08%49/51
utils.js
87.61%99/11378.87%56/7192.31%12/1388.79%95/107
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/raven-node/lib/middleware/connect.js.html b/node_modules/raven/coverage/lcov-report/raven-node/lib/middleware/connect.js.html deleted file mode 100644 index 99d9adf..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/lib/middleware/connect.js.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - Code coverage report for raven-node/lib/middleware/connect.js - - - - - - - -
-
-

- all files / raven-node/lib/middleware/ connect.js -

-
-
- 50% - Statements - 5/10 -
-
- 0% - Branches - 0/4 -
-
- 0% - Functions - 0/3 -
-
- 50% - Lines - 5/10 -
-
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25  -  - -  -  - -  -  -  -  -  - -  -  -  -  -  -  - -  -  -  -  - - 
'use strict';
- 
-var Raven = require('../client');
- 
-// Legacy support
-var connectMiddleware = function (client) {
-  return connectMiddleware.errorHandler(client);
-};
- 
-// Error handler. This should be the last item listed in middleware, but
-// before any other error handlers.
-connectMiddleware.errorHandler = function (client) {
-  client = client instanceof Raven.Client ? client : new Raven.Client(client);
-  return client.errorHandler();
-};
- 
-// Ensures asynchronous exceptions are routed to the errorHandler. This
-// should be the **first** item listed in middleware.
-connectMiddleware.requestHandler = function (client) {
-  client = client instanceof Raven.Client ? client : new Raven.Client(client);
-  return client.requestHandler();
-};
- 
-module.exports = connectMiddleware;
- 
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/raven-node/lib/middleware/index.html b/node_modules/raven/coverage/lcov-report/raven-node/lib/middleware/index.html deleted file mode 100644 index ede89e3..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/lib/middleware/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - Code coverage report for raven-node/lib/middleware/ - - - - - - - -
-
-

- all files raven-node/lib/middleware/ -

-
-
- 50% - Statements - 5/10 -
-
- 0% - Branches - 0/4 -
-
- 0% - Functions - 0/3 -
-
- 50% - Lines - 5/10 -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
connect.js
50%5/100%0/40%0/350%5/10
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/raven-node/lib/parsers.js.html b/node_modules/raven/coverage/lcov-report/raven-node/lib/parsers.js.html deleted file mode 100644 index 0ddbc2b..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/lib/parsers.js.html +++ /dev/null @@ -1,638 +0,0 @@ - - - - Code coverage report for raven-node/lib/parsers.js - - - - - - - -
-
-

- all files / raven-node/lib/ parsers.js -

-
-
- 100% - Statements - 62/62 -
-
- 92.75% - Branches - 64/69 -
-
- 100% - Functions - 5/5 -
-
- 100% - Lines - 62/62 -
-
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192  -  - - - -  - -  - - - -  - -  -  - -21× -21× -21× -21× -  -21× -  -  -  -  -  -  -  -  -21× -21× - - - - -  -  -  -21× - - -  -  -21× -21× -21× -21× -  -  -  -21× -  -  -  - - - - -  -  -  - -  -  - -27× -  -  -  -  -  -  -  -27× -  -  -  -  -  -  -  -27× -  -  -  -  -  -  -  -27× -  -  -  -  -  -  -  -27× -  -  -  -  -  -  -  -27× -  -  -27× -  -  -  -  -  -  -  -27× -  -  -  -  -  -  -  -27× -  -  -  -  -  -  -  -27× -27× - - -  -  -  -27× -  - -  -  -  -  -  -  -  -  -27× -  -  -27× -  -  -  -  -  -  -  -  -  -27× -  -  -  -  -  -27× -27× -26× -  -  - - - -  -  -  -  -26× - -  -  -26× -  -  -27× -  - 
'use strict';
- 
-var cookie = require('cookie');
-var urlParser = require('url');
-var stringify = require('json-stringify-safe');
- 
-var utils = require('./utils');
- 
-module.exports.parseText = function parseText(message, kwargs) {
-  kwargs = kwargs || {};
-  kwargs.message = message;
- 
-  return kwargs;
-};
- 
-module.exports.parseError = function parseError(err, kwargs, cb) {
-  utils.parseStack(err, function (frames) {
-    var name = err.name + '';
-    Eif (typeof kwargs.message === 'undefined') {
-      kwargs.message = name + ': ' + (err.message || '<no message>');
-    }
-    kwargs.exception = [{
-      type: name,
-      value: err.message,
-      stacktrace: {
-        frames: frames
-      }
-    }];
- 
-    // Save additional error properties to `extra` under the error type (e.g. `extra.AttributeError`)
-    var extraErrorProps;
-    for (var key in err) {
-      Eif (err.hasOwnProperty(key)) {
-        if (key !== 'name' && key !== 'message' && key !== 'stack') {
-          extraErrorProps = extraErrorProps || {};
-          extraErrorProps[key] = err[key];
-        }
-      }
-    }
-    if (extraErrorProps) {
-      kwargs.extra = kwargs.extra || {};
-      kwargs.extra[name] = extraErrorProps;
-    }
- 
-    for (var n = frames.length - 1; n >= 0; n--) {
-      Eif (frames[n].in_app) {
-        kwargs.culprit = kwargs.culprit || utils.getCulprit(frames[n]);
-        break;
-      }
-    }
- 
-    cb(kwargs);
-  });
-};
- 
-module.exports.parseQuery = function parseQuery(query, engine, kwargs) {
-  kwargs = kwargs || {};
-  kwargs.message = query;
-  kwargs.query = {
-    query: query,
-    engine: engine
-  };
-  return kwargs;
-};
- 
-module.exports.parseRequest = function parseRequest(req, kwargs) {
-  kwargs = kwargs || {};
- 
-  // headers:
-  //
-  //   node: req.headers
-  //   express: req.headers
-  //   koa: req.header
-  //
-  var headers = req.headers || req.header || {};
- 
-  // method:
-  //
-  //   node: req.method
-  //   express: req.method
-  //   koa: req.method
-  //
-  var method = req.method;
- 
-  // host:
-  //
-  //   node: req.headers.host
-  //   express: req.hostname in > 4 and req.host in < 4
-  //   koa: req.host
-  //
-  var host = req.hostname || req.host || headers.host || '<no host>';
- 
-  // protocol:
-  //
-  //   node: <n/a>
-  //   express: req.protocol
-  //   koa: req.protocol
-  //
-  var protocol = req.protocol === 'https' || req.secure || (req.socket || {}).encrypted ? 'https' : 'http';
- 
-  // url (including path and query string):
-  //
-  //   node: req.originalUrl
-  //   express: req.originalUrl
-  //   koa: req.url
-  //
-  var originalUrl = req.originalUrl || req.url;
- 
-  // absolute url
-  var url = protocol + '://' + host + originalUrl;
- 
-  // query string
-  //
-  //   node: req.url (raw)
-  //   express: req.query
-  //   koa: req.query
-  //
-  var query = req.query || urlParser.parse(originalUrl || '', true).query;
- 
-  // cookies:
-  //
-  //   node: req.headers.cookie
-  //   express: req.headers.cookie
-  //   koa: req.headers.cookie
-  //
-  var cookies = cookie.parse(headers.cookie || '');
- 
-  // body data:
-  //
-  //   node: req.body
-  //   express: req.body
-  //   koa: req.body
-  //
-  var data = req.body;
-  if (['GET', 'HEAD'].indexOf(method) === -1) {
-    if (typeof data === 'undefined') {
-      data = '<unavailable>';
-    }
-  }
- 
-  if (data && {}.toString.call(data) !== '[object String]') {
-    // Make sure the request body is a string
-    data = stringify(data);
-  }
- 
-  // client ip:
-  //
-  //   node: req.connection.remoteAddress
-  //   express: req.ip
-  //   koa: req.ip
-  //
-  var ip = req.ip || (req.connection || {}).remoteAddress;
- 
-  // http interface
-  var http = {
-    method: method,
-    query_string: query,
-    headers: headers,
-    cookies: cookies,
-    data: data,
-    url: url
-  };
- 
-  // expose http interface
-  kwargs.request = http;
- 
-  // user
-  //
-  // typically found on req.user according to Express and Passport
- 
-  var user = {};
-  if (!kwargs.user) {
-    if (req.user) {
-      // shallow copy is okay because we are only modifying top-level
-      // object (req.user)
-      for (var key in req.user) {
-        Eif ({}.hasOwnProperty.call(req.user, key)) {
-          user[key] = req.user[key];
-        }
-      }
-    }
- 
-    if (ip) {
-      user.ip_address = ip;
-    }
- 
-    kwargs.user = user;
-  }
- 
-  return kwargs;
-};
- 
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/raven-node/lib/transports.js.html b/node_modules/raven/coverage/lcov-report/raven-node/lib/transports.js.html deleted file mode 100644 index c4cbea7..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/lib/transports.js.html +++ /dev/null @@ -1,299 +0,0 @@ - - - - Code coverage report for raven-node/lib/transports.js - - - - - - - -
-
-

- all files / raven-node/lib/ transports.js -

-
-
- 96.08% - Statements - 49/51 -
-
- 75% - Branches - 15/20 -
-
- 85.71% - Functions - 6/7 -
-
- 96.08% - Lines - 49/51 -
-
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79  -  - - -  - - -  - -  - - - - -  - - -22× -  -  -  -  -  -  -  -22× -  -  -  -  -22× -21× -21× -18× -18× -  - - - - - - - - - - -  -  -21× -21× -21× -  -  -22× -22× - - - - -  -  -22× -  -  - -  - - - - -  - -  - - - - - - 
'use strict';
- 
-var events = require('events');
-var util = require('util');
- 
-function Transport() {}
-util.inherits(Transport, events.EventEmitter);
- 
-var http = require('http');
- 
-function HTTPTransport(options) {
-  this.defaultPort = 80;
-  this.transport = http;
-  this.options = options || {};
-}
-util.inherits(HTTPTransport, Transport);
-HTTPTransport.prototype.send = function (client, message, headers, eventId, cb) {
-  var options = {
-    hostname: client.dsn.host,
-    path: client.dsn.path + 'api/' + client.dsn.project_id + '/store/',
-    headers: headers,
-    method: 'POST',
-    port: client.dsn.port || this.defaultPort,
-    ca: client.ca
-  };
-  for (var key in this.options) {
-    if (this.options.hasOwnProperty(key)) {
-      options[key] = this.options[key];
-    }
-  }
-  var req = this.transport.request(options, function (res) {
-    res.setEncoding('utf8');
-    if (res.statusCode >= 200 && res.statusCode < 300) {
-      client.emit('logged', eventId);
-      cb && cb(null, eventId);
-    } else {
-      var reason = res.headers['x-sentry-error'];
-      var e = new Error('HTTP Error (' + res.statusCode + '): ' + reason);
-      e.response = res;
-      e.statusCode = res.statusCode;
-      e.reason = reason;
-      e.sendMessage = message;
-      e.requestHeaders = headers;
-      e.eventId = eventId;
-      client.emit('error', e);
-      cb && cb(e);
-    }
-    // force the socket to drain
-    var noop = function () {};
-    res.on('data', noop);
-    res.on('end', noop);
-  });
- 
-  var cbFired = false;
-  req.on('error', function (e) {
-    client.emit('error', e);
-    Eif (!cbFired) {
-      cb && cb(e);
-      cbFired = true;
-    }
-  });
-  req.end(message);
-};
- 
-var https = require('https');
- 
-function HTTPSTransport(options) {
-  this.defaultPort = 443;
-  this.transport = https;
-  this.options = options || {};
-}
-util.inherits(HTTPSTransport, HTTPTransport);
- 
-module.exports.http = new HTTPTransport();
-module.exports.https = new HTTPSTransport();
-module.exports.Transport = Transport;
-module.exports.HTTPTransport = HTTPTransport;
-module.exports.HTTPSTransport = HTTPSTransport;
- 
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/raven-node/lib/utils.js.html b/node_modules/raven/coverage/lcov-report/raven-node/lib/utils.js.html deleted file mode 100644 index 7d66608..0000000 --- a/node_modules/raven/coverage/lcov-report/raven-node/lib/utils.js.html +++ /dev/null @@ -1,683 +0,0 @@ - - - - Code coverage report for raven-node/lib/utils.js - - - - - - - -
-
-

- all files / raven-node/lib/ utils.js -

-
-
- 87.61% - Statements - 99/113 -
-
- 78.87% - Branches - 56/71 -
-
- 92.31% - Functions - 12/13 -
-
- 88.79% - Lines - 95/107 -
-
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207  -  - - - - - - -  - -  - -  -  -  -  - -  - - -  -  - -19× -  -  -  -  -  - -  -  -  -  -  -  -  -  -  -  -  - -24× -24× -24× -24× -24× -24× -  -  - -73× -  - -  -69× -69× -  -  -  -  -  -  -  -69× - -  -  -69× - -  -  -68× -68× -68× -68× -68× -  - -  -  -  - -24× -23× -  - -  -  - - -29× - -  -29× -  -  -  - -  - -283× -283× -  -  -  -  -  -  -  -  -  - -  - -286× -  -  -286× -286× -286× -286× -  -194× -  -  -  -92× -92× - - - - -  -91× -  -  - -25× -  -  -25× - -  -  -24× -  -  -24× -  - -  -  -21× -  -  -21× -  -21× -283× -  -  -  -  -  -  -  -283× -  -  -283× -  -  -283× -65× -65× -65× -  -  -218× -  -  -  -  -  -218× -218× -218× -218× -218× -  -218× -218× -  -  - -218× -218× -218× -  -  -  -  -  - - - 
'use strict';
- 
-var fs = require('fs');
-var url = require('url');
-var transports = require('./transports');
-var path = require('path');
-var lsmod = require('lsmod');
-var stacktrace = require('stack-trace');
- 
-var ravenVersion = require('../package.json').version;
- 
-var protocolMap = {
-  http: 80,
-  https: 443
-};
- 
-var consoleAlerts = {};
- 
-module.exports.disableConsoleAlerts = function disableConsoleAlerts() {
-  consoleAlerts = false;
-};
- 
-module.exports.consoleAlert = function consoleAlert(msg) {
-  Iif (consoleAlerts && !(msg in consoleAlerts)) {
-    consoleAlerts[msg] = true;
-    console.log('raven@' + ravenVersion + ' alert: ' + msg);
-  }
-};
- 
-module.exports.extend = Object.assign || function (target) {
-  for (var i = 1; i < arguments.length; i++) {
-    var source = arguments[i];
-    for (var key in source) {
-      if (Object.prototype.hasOwnProperty.call(source, key)) {
-        target[key] = source[key];
-      }
-    }
-  }
-  return target;
-};
- 
-module.exports.getAuthHeader = function getAuthHeader(timestamp, apiKey, apiSecret) {
-  var header = ['Sentry sentry_version=5'];
-  header.push('sentry_timestamp=' + timestamp);
-  header.push('sentry_client=raven-node/' + ravenVersion);
-  header.push('sentry_key=' + apiKey);
-  header.push('sentry_secret=' + apiSecret);
-  return header.join(', ');
-};
- 
-module.exports.parseDSN = function parseDSN(dsn) {
-  if (!dsn) {
-    // Let a falsey value return false explicitly
-    return false;
-  }
-  try {
-    var parsed = url.parse(dsn),
-        response = {
-          protocol: parsed.protocol.slice(0, -1),
-          public_key: parsed.auth.split(':')[0],
-          private_key: parsed.auth.split(':')[1],
-          host: parsed.host.split(':')[0]
-        };
- 
-    if (~response.protocol.indexOf('+')) {
-      response.protocol = response.protocol.split('+')[1];
-    }
- 
-    if (!transports.hasOwnProperty(response.protocol)) {
-      throw new Error('Invalid transport');
-    }
- 
-    var index = parsed.pathname.lastIndexOf('/');
-    response.path = parsed.pathname.substr(0, index + 1);
-    response.project_id = parsed.pathname.substr(index + 1);
-    response.port = ~~parsed.port || protocolMap[response.protocol] || 443;
-    return response;
-  } catch (e) {
-    throw new Error('Invalid Sentry DSN: ' + dsn);
-  }
-};
- 
-module.exports.getCulprit = function getCulprit(frame) {
-  if (frame.module || frame.function) {
-    return (frame.module || '?') + ' at ' + (frame.function || '?');
-  }
-  return '<unknown>';
-};
- 
-var moduleCache;
-module.exports.getModules = function getModules() {
-  if (!moduleCache) {
-    moduleCache = lsmod();
-  }
-  return moduleCache;
-};
- 
- 
-var LINES_OF_CONTEXT = 7;
- 
-function getFunction(line) {
-  try {
-    return line.getFunctionName() ||
-      line.getTypeName() + '.' + (line.getMethodName() || '<anonymous>');
-  } catch (e) {
-    // This seems to happen sometimes when using 'use strict',
-    // stemming from `getTypeName`.
-    // [TypeError: Cannot read property 'constructor' of undefined]
-    return '<anonymous>';
-  }
-}
- 
-var mainModule = (require.main && path.dirname(require.main.filename) || process.cwd()) + '/';
- 
-function getModule(filename, base) {
-  if (!base) base = mainModule;
- 
-  // It's specifically a module
-  var file = path.basename(filename, '.js');
-  filename = path.dirname(filename);
-  var n = filename.lastIndexOf('/node_modules/');
-  if (n > -1) {
-    // /node_modules/ is 14 chars
-    return filename.substr(n + 14).replace(/\//g, '.') + ':' + file;
-  }
-  // Let's see if it's a part of the main module
-  // To be a part of main module, it has to share the same base
-  n = (filename + '/').lastIndexOf(base, 0);
-  if (n === 0) {
-    var module = filename.substr(base.length).replace(/\//g, '.');
-    Eif (module) module += ':';
-    module += file;
-    return module;
-  }
-  return file;
-}
- 
-function parseStack(err, cb) {
-  var frames = [],
-      cache = {};
- 
-  if (!err) {
-    return cb(frames);
-  }
- 
-  var stack = stacktrace.parse(err);
- 
-  // check to make sure that the stack is what we need it to be.
-  if (!stack || !Array.isArray(stack) || !stack.length || !stack[0].getFileName) {
-    // lol, stack is fucked
-    return cb(frames);
-  }
- 
-  var callbacks = stack.length;
- 
-  // Sentry requires the stack trace to be from oldest to newest
-  stack.reverse();
- 
-  return stack.forEach(function (line, index) {
-    var frame = {
-          filename: line.getFileName() || '',
-          lineno: line.getLineNumber(),
-          'function': getFunction(line),
-        },
-        isInternal = line.isNative() || frame.filename[0] !== '/' && frame.filename[0] !== '.';
- 
-    // in_app is all that's not an internal Node function or a module within node_modules
-    frame.in_app = !isInternal && !~frame.filename.indexOf('node_modules/');
- 
-    // Extract a module name based on the filename
-    Eif (frame.filename) frame.module = getModule(frame.filename);
- 
-    // internal Node files are not full path names. Ignore them.
-    if (isInternal) {
-      frames[index] = frame;
-      Iif (--callbacks === 0) cb(frames);
-      return;
-    }
- 
-    Iif (frame.filename in cache) {
-      parseLines(cache[frame.filename]);
-      if (--callbacks === 0) cb(frames);
-      return;
-    }
- 
-    fs.readFile(frame.filename, function (_err, file) {
-      Eif (!_err) {
-        file = file.toString().split('\n');
-        cache[frame.filename] = file;
-        parseLines(file, frame);
-      }
-      frames[index] = frame;
-      if (--callbacks === 0) cb(frames);
-    });
- 
-    function parseLines(lines) {
-      frame.pre_context = lines.slice(Math.max(0, frame.lineno - (LINES_OF_CONTEXT + 1)), frame.lineno - 1);
-      frame.context_line = lines[frame.lineno - 1];
-      frame.post_context = lines.slice(frame.lineno, frame.lineno + LINES_OF_CONTEXT);
-    }
-  });
-}
- 
-// expose basically for testing because I don't know what I'm doing
-module.exports.parseStack = parseStack;
-module.exports.getModule = getModule;
- 
-
-
- - - - - - - diff --git a/node_modules/raven/coverage/lcov-report/sort-arrow-sprite.png b/node_modules/raven/coverage/lcov-report/sort-arrow-sprite.png deleted file mode 100644 index 03f704a..0000000 Binary files a/node_modules/raven/coverage/lcov-report/sort-arrow-sprite.png and /dev/null differ diff --git a/node_modules/raven/coverage/lcov-report/sorter.js b/node_modules/raven/coverage/lcov-report/sorter.js deleted file mode 100644 index 6c5034e..0000000 --- a/node_modules/raven/coverage/lcov-report/sorter.js +++ /dev/null @@ -1,158 +0,0 @@ -var addSorting = (function () { - "use strict"; - var cols, - currentSort = { - index: 0, - desc: false - }; - - // returns the summary table element - function getTable() { return document.querySelector('.coverage-summary'); } - // returns the thead element of the summary table - function getTableHeader() { return getTable().querySelector('thead tr'); } - // returns the tbody element of the summary table - function getTableBody() { return getTable().querySelector('tbody'); } - // returns the th element for nth column - function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } - - // loads all columns - function loadColumns() { - var colNodes = getTableHeader().querySelectorAll('th'), - colNode, - cols = [], - col, - i; - - for (i = 0; i < colNodes.length; i += 1) { - colNode = colNodes[i]; - col = { - key: colNode.getAttribute('data-col'), - sortable: !colNode.getAttribute('data-nosort'), - type: colNode.getAttribute('data-type') || 'string' - }; - cols.push(col); - if (col.sortable) { - col.defaultDescSort = col.type === 'number'; - colNode.innerHTML = colNode.innerHTML + ''; - } - } - return cols; - } - // attaches a data attribute to every tr element with an object - // of data values keyed by column name - function loadRowData(tableRow) { - var tableCols = tableRow.querySelectorAll('td'), - colNode, - col, - data = {}, - i, - val; - for (i = 0; i < tableCols.length; i += 1) { - colNode = tableCols[i]; - col = cols[i]; - val = colNode.getAttribute('data-value'); - if (col.type === 'number') { - val = Number(val); - } - data[col.key] = val; - } - return data; - } - // loads all row data - function loadData() { - var rows = getTableBody().querySelectorAll('tr'), - i; - - for (i = 0; i < rows.length; i += 1) { - rows[i].data = loadRowData(rows[i]); - } - } - // sorts the table using the data for the ith column - function sortByIndex(index, desc) { - var key = cols[index].key, - sorter = function (a, b) { - a = a.data[key]; - b = b.data[key]; - return a < b ? -1 : a > b ? 1 : 0; - }, - finalSorter = sorter, - tableBody = document.querySelector('.coverage-summary tbody'), - rowNodes = tableBody.querySelectorAll('tr'), - rows = [], - i; - - if (desc) { - finalSorter = function (a, b) { - return -1 * sorter(a, b); - }; - } - - for (i = 0; i < rowNodes.length; i += 1) { - rows.push(rowNodes[i]); - tableBody.removeChild(rowNodes[i]); - } - - rows.sort(finalSorter); - - for (i = 0; i < rows.length; i += 1) { - tableBody.appendChild(rows[i]); - } - } - // removes sort indicators for current column being sorted - function removeSortIndicators() { - var col = getNthColumn(currentSort.index), - cls = col.className; - - cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); - col.className = cls; - } - // adds sort indicators for current column being sorted - function addSortIndicators() { - getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; - } - // adds event listeners for all sorter widgets - function enableUI() { - var i, - el, - ithSorter = function ithSorter(i) { - var col = cols[i]; - - return function () { - var desc = col.defaultDescSort; - - if (currentSort.index === i) { - desc = !currentSort.desc; - } - sortByIndex(i, desc); - removeSortIndicators(); - currentSort.index = i; - currentSort.desc = desc; - addSortIndicators(); - }; - }; - for (i =0 ; i < cols.length; i += 1) { - if (cols[i].sortable) { - // add the click event handler on the th so users - // dont have to click on those tiny arrows - el = getNthColumn(i).querySelector('.sorter').parentElement; - if (el.addEventListener) { - el.addEventListener('click', ithSorter(i)); - } else { - el.attachEvent('onclick', ithSorter(i)); - } - } - } - } - // adds sorting functionality to the UI - return function () { - if (!getTable()) { - return; - } - cols = loadColumns(); - loadData(cols); - addSortIndicators(); - enableUI(); - }; -})(); - -window.addEventListener('load', addSorting); diff --git a/node_modules/raven/coverage/lcov.info b/node_modules/raven/coverage/lcov.info deleted file mode 100644 index 4e1dc6b..0000000 --- a/node_modules/raven/coverage/lcov.info +++ /dev/null @@ -1,960 +0,0 @@ -TN: -SF:/Users/lewis/dev/raven-node/index.js -FNF:0 -FNH:0 -DA:3,1 -DA:4,1 -DA:5,1 -DA:9,1 -DA:10,1 -DA:11,1 -DA:14,1 -LF:7 -LH:7 -BRF:0 -BRH:0 -end_of_record -TN: -SF:/Users/lewis/dev/raven-node/lib/client.js -FN:15,Raven -FN:20,config -FN:65,(anonymous_3) -FN:72,install -FN:84,generateEventId -FN:88,process -FN:133,(anonymous_7) -FN:139,send -FN:144,(anonymous_9) -FN:157,captureMessage -FN:170,captureException -FN:187,(anonymous_12) -FN:194,captureQuery -FN:213,(anonymous_14) -FN:225,(anonymous_15) -FN:237,(anonymous_16) -FN:259,(anonymous_17) -FN:265,(anonymous_18) -FN:287,setContext -FN:296,mergeContext -FN:301,getContext -FN:305,(anonymous_22) -FN:308,(anonymous_23) -FN:325,(anonymous_24) -FN:336,(anonymous_25) -FN:340,(anonymous_26) -FN:342,(anonymous_27) -FN:347,(anonymous_28) -FN:349,(anonymous_29) -FN:366,getIdent -FN:370,captureError -FN:374,(anonymous_32) -FN:379,setUserContext -FN:383,setExtraContext -FN:387,setTagsContext -FN:395,Client -FN:412,registerExceptionHandler -FN:414,(anonymous_38) -FN:416,onLogged -FN:421,onError -FN:443,registerRejectionHandler -FN:444,(anonymous_42) -FN:445,(anonymous_43) -FN:452,patchGlobal -FNF:44 -FNH:31 -FNDA:67,Raven -FNDA:66,config -FNDA:4,(anonymous_3) -FNDA:2,install -FNDA:29,generateEventId -FNDA:29,process -FNDA:2,(anonymous_7) -FNDA:24,send -FNDA:23,(anonymous_9) -FNDA:5,captureMessage -FNDA:12,captureException -FNDA:12,(anonymous_12) -FNDA:0,captureQuery -FNDA:1,(anonymous_14) -FNDA:1,(anonymous_15) -FNDA:0,(anonymous_16) -FNDA:3,(anonymous_17) -FNDA:3,(anonymous_18) -FNDA:3,setContext -FNDA:0,mergeContext -FNDA:0,getContext -FNDA:4,(anonymous_22) -FNDA:4,(anonymous_23) -FNDA:2,(anonymous_24) -FNDA:2,(anonymous_25) -FNDA:0,(anonymous_26) -FNDA:0,(anonymous_27) -FNDA:0,(anonymous_28) -FNDA:0,(anonymous_29) -FNDA:1,getIdent -FNDA:4,captureError -FNDA:4,(anonymous_32) -FNDA:0,setUserContext -FNDA:0,setExtraContext -FNDA:0,setTagsContext -FNDA:66,Client -FNDA:6,registerExceptionHandler -FNDA:4,(anonymous_38) -FNDA:1,onLogged -FNDA:0,onError -FNDA:1,registerRejectionHandler -FNDA:1,(anonymous_42) -FNDA:1,(anonymous_43) -FNDA:0,patchGlobal -DA:3,1 -DA:4,1 -DA:5,1 -DA:6,1 -DA:7,1 -DA:8,1 -DA:9,1 -DA:10,1 -DA:11,1 -DA:13,1 -DA:15,1 -DA:17,1 -DA:19,1 -DA:21,66 -DA:23,2 -DA:24,2 -DA:26,66 -DA:28,1 -DA:29,1 -DA:31,66 -DA:33,66 -DA:34,66 -DA:35,66 -DA:36,66 -DA:37,66 -DA:38,66 -DA:39,66 -DA:41,66 -DA:42,66 -DA:43,66 -DA:45,66 -DA:46,2 -DA:49,66 -DA:51,64 -DA:55,66 -DA:57,66 -DA:58,66 -DA:59,1 -DA:61,66 -DA:62,1 -DA:65,66 -DA:66,4 -DA:69,66 -DA:73,2 -DA:74,0 -DA:77,2 -DA:78,2 -DA:79,1 -DA:81,2 -DA:85,29 -DA:90,29 -DA:91,12 -DA:92,12 -DA:93,12 -DA:96,29 -DA:97,29 -DA:98,29 -DA:99,29 -DA:101,29 -DA:102,29 -DA:104,29 -DA:105,0 -DA:108,29 -DA:109,29 -DA:110,29 -DA:111,29 -DA:112,29 -DA:113,29 -DA:116,29 -DA:117,2 -DA:120,29 -DA:121,2 -DA:124,29 -DA:125,29 -DA:126,29 -DA:128,29 -DA:129,27 -DA:133,2 -DA:134,2 -DA:140,24 -DA:141,24 -DA:142,24 -DA:144,24 -DA:145,23 -DA:153,23 -DA:158,5 -DA:159,0 -DA:160,0 -DA:162,5 -DA:164,5 -DA:165,5 -DA:167,5 -DA:171,12 -DA:175,1 -DA:178,12 -DA:179,1 -DA:180,1 -DA:182,11 -DA:185,12 -DA:186,12 -DA:187,12 -DA:188,12 -DA:191,12 -DA:195,0 -DA:196,0 -DA:197,0 -DA:199,0 -DA:202,0 -DA:203,0 -DA:205,0 -DA:214,1 -DA:215,1 -DA:216,1 -DA:222,1 -DA:226,1 -DA:227,0 -DA:228,0 -DA:231,1 -DA:233,1 -DA:235,1 -DA:236,1 -DA:237,1 -DA:238,0 -DA:242,1 -DA:243,1 -DA:245,1 -DA:246,0 -DA:247,0 -DA:250,1 -DA:251,1 -DA:252,1 -DA:254,1 -DA:256,1 -DA:260,3 -DA:261,2 -DA:262,2 -DA:264,3 -DA:265,3 -DA:266,3 -DA:267,3 -DA:268,2 -DA:270,1 -DA:275,3 -DA:276,0 -DA:277,0 -DA:280,3 -DA:281,3 -DA:282,3 -DA:284,3 -DA:288,3 -DA:289,1 -DA:291,2 -DA:293,3 -DA:297,0 -DA:298,0 -DA:302,0 -DA:306,4 -DA:307,4 -DA:308,4 -DA:309,4 -DA:312,0 -DA:315,4 -DA:326,2 -DA:337,2 -DA:341,0 -DA:342,0 -DA:343,0 -DA:348,0 -DA:349,0 -DA:350,0 -DA:353,0 -DA:355,0 -DA:356,0 -DA:357,0 -DA:358,0 -DA:365,1 -DA:367,1 -DA:368,1 -DA:371,4 -DA:372,4 -DA:375,4 -DA:376,4 -DA:377,4 -DA:380,0 -DA:381,0 -DA:384,0 -DA:385,0 -DA:388,0 -DA:389,0 -DA:392,1 -DA:395,1 -DA:396,66 -DA:397,66 -DA:398,66 -DA:400,1 -DA:404,1 -DA:405,1 -DA:406,1 -DA:407,1 -DA:408,1 -DA:410,1 -DA:412,1 -DA:413,6 -DA:414,6 -DA:415,4 -DA:416,3 -DA:417,1 -DA:418,1 -DA:421,3 -DA:422,0 -DA:423,0 -DA:426,3 -DA:427,1 -DA:428,1 -DA:429,1 -DA:432,2 -DA:433,2 -DA:435,2 -DA:438,3 -DA:439,3 -DA:443,1 -DA:444,1 -DA:445,1 -DA:446,1 -DA:448,1 -DA:452,1 -DA:454,0 -DA:455,0 -DA:456,0 -DA:458,0 -DA:459,0 -DA:462,0 -DA:464,0 -LF:233 -LH:185 -BRDA:21,1,0,2 -BRDA:21,1,1,64 -BRDA:26,2,0,1 -BRDA:26,2,1,65 -BRDA:31,3,0,66 -BRDA:31,3,1,50 -BRDA:35,4,0,66 -BRDA:35,4,1,64 -BRDA:35,4,2,63 -BRDA:36,5,0,66 -BRDA:36,5,1,66 -BRDA:37,6,0,66 -BRDA:37,6,1,65 -BRDA:38,7,0,66 -BRDA:38,7,1,63 -BRDA:38,7,2,62 -BRDA:39,8,0,66 -BRDA:39,8,1,64 -BRDA:39,8,2,63 -BRDA:41,9,0,66 -BRDA:41,9,1,66 -BRDA:45,10,0,2 -BRDA:45,10,1,64 -BRDA:49,11,0,64 -BRDA:49,11,1,2 -BRDA:51,12,0,64 -BRDA:51,12,1,64 -BRDA:58,13,0,1 -BRDA:58,13,1,65 -BRDA:61,14,0,1 -BRDA:61,14,1,65 -BRDA:73,15,0,0 -BRDA:73,15,1,2 -BRDA:78,16,0,1 -BRDA:78,16,1,1 -BRDA:78,17,0,2 -BRDA:78,17,1,1 -BRDA:90,18,0,12 -BRDA:90,18,1,17 -BRDA:96,19,0,29 -BRDA:96,19,1,1 -BRDA:96,19,2,28 -BRDA:102,20,0,29 -BRDA:102,20,1,29 -BRDA:104,21,0,0 -BRDA:104,21,1,29 -BRDA:108,22,0,29 -BRDA:108,22,1,28 -BRDA:109,23,0,29 -BRDA:109,23,1,29 -BRDA:116,24,0,2 -BRDA:116,24,1,27 -BRDA:120,25,0,2 -BRDA:120,25,1,27 -BRDA:125,26,0,0 -BRDA:125,26,1,29 -BRDA:126,27,0,2 -BRDA:126,27,1,27 -BRDA:126,28,0,29 -BRDA:126,28,1,2 -BRDA:128,29,0,27 -BRDA:128,29,1,2 -BRDA:158,30,0,0 -BRDA:158,30,1,5 -BRDA:158,31,0,5 -BRDA:158,31,1,5 -BRDA:162,32,0,5 -BRDA:162,32,1,5 -BRDA:171,33,0,1 -BRDA:171,33,1,11 -BRDA:178,34,0,1 -BRDA:178,34,1,11 -BRDA:178,35,0,12 -BRDA:178,35,1,11 -BRDA:182,36,0,11 -BRDA:182,36,1,7 -BRDA:195,37,0,0 -BRDA:195,37,1,0 -BRDA:195,38,0,0 -BRDA:195,38,1,0 -BRDA:199,39,0,0 -BRDA:199,39,1,0 -BRDA:214,40,0,1 -BRDA:214,40,1,0 -BRDA:214,41,0,1 -BRDA:214,41,1,1 -BRDA:226,42,0,0 -BRDA:226,42,1,1 -BRDA:226,43,0,1 -BRDA:226,43,1,0 -BRDA:236,44,0,1 -BRDA:236,44,1,0 -BRDA:246,45,0,0 -BRDA:246,45,1,0 -BRDA:260,46,0,2 -BRDA:260,46,1,1 -BRDA:260,47,0,3 -BRDA:260,47,1,2 -BRDA:267,48,0,2 -BRDA:267,48,1,1 -BRDA:276,49,0,0 -BRDA:276,49,1,0 -BRDA:288,50,0,1 -BRDA:288,50,1,2 -BRDA:302,51,0,0 -BRDA:302,51,1,0 -BRDA:307,52,0,4 -BRDA:307,52,1,0 -BRDA:350,53,0,0 -BRDA:350,53,1,0 -BRDA:350,53,2,0 -BRDA:350,53,3,0 -BRDA:353,54,0,0 -BRDA:353,54,1,0 -BRDA:396,55,0,0 -BRDA:396,55,1,66 -BRDA:415,56,0,3 -BRDA:415,56,1,1 -BRDA:426,57,0,1 -BRDA:426,57,1,2 -BRDA:446,58,0,1 -BRDA:446,58,1,1 -BRDA:454,59,0,0 -BRDA:454,59,1,0 -BRDA:458,60,0,0 -BRDA:458,60,1,0 -BRDA:462,61,0,0 -BRDA:462,61,1,0 -BRF:128 -BRH:94 -end_of_record -TN: -SF:/Users/lewis/dev/raven-node/lib/parsers.js -FN:9,parseText -FN:16,parseError -FN:17,(anonymous_3) -FN:56,parseQuery -FN:66,parseRequest -FNF:5 -FNH:5 -FNDA:7,parseText -FNDA:21,parseError -FNDA:21,(anonymous_3) -FNDA:1,parseQuery -FNDA:27,parseRequest -DA:3,1 -DA:4,1 -DA:5,1 -DA:7,1 -DA:9,1 -DA:10,7 -DA:11,7 -DA:13,7 -DA:16,1 -DA:17,21 -DA:18,21 -DA:19,21 -DA:20,21 -DA:22,21 -DA:31,21 -DA:32,21 -DA:33,7 -DA:34,7 -DA:35,4 -DA:36,4 -DA:40,21 -DA:41,1 -DA:42,1 -DA:45,21 -DA:46,21 -DA:47,21 -DA:48,21 -DA:52,21 -DA:56,1 -DA:57,1 -DA:58,1 -DA:59,1 -DA:63,1 -DA:66,1 -DA:67,27 -DA:75,27 -DA:83,27 -DA:91,27 -DA:99,27 -DA:107,27 -DA:110,27 -DA:118,27 -DA:126,27 -DA:134,27 -DA:135,27 -DA:136,5 -DA:137,4 -DA:141,27 -DA:143,1 -DA:152,27 -DA:155,27 -DA:165,27 -DA:171,27 -DA:172,27 -DA:173,26 -DA:176,2 -DA:177,4 -DA:178,4 -DA:183,26 -DA:184,4 -DA:187,26 -DA:190,27 -LF:62 -LH:62 -BRDA:10,1,0,7 -BRDA:10,1,1,1 -BRDA:19,2,0,21 -BRDA:19,2,1,0 -BRDA:20,3,0,21 -BRDA:20,3,1,2 -BRDA:33,4,0,7 -BRDA:33,4,1,0 -BRDA:34,5,0,4 -BRDA:34,5,1,3 -BRDA:34,6,0,7 -BRDA:34,6,1,5 -BRDA:34,6,2,4 -BRDA:35,7,0,4 -BRDA:35,7,1,1 -BRDA:40,8,0,1 -BRDA:40,8,1,20 -BRDA:41,9,0,1 -BRDA:41,9,1,1 -BRDA:46,10,0,21 -BRDA:46,10,1,0 -BRDA:47,11,0,21 -BRDA:47,11,1,20 -BRDA:57,12,0,1 -BRDA:57,12,1,1 -BRDA:67,13,0,27 -BRDA:67,13,1,26 -BRDA:75,14,0,27 -BRDA:75,14,1,18 -BRDA:75,14,2,15 -BRDA:91,15,0,27 -BRDA:91,15,1,12 -BRDA:91,15,2,11 -BRDA:91,15,3,3 -BRDA:99,16,0,6 -BRDA:99,16,1,21 -BRDA:99,17,0,27 -BRDA:99,17,1,24 -BRDA:99,17,2,23 -BRDA:99,18,0,23 -BRDA:99,18,1,21 -BRDA:107,19,0,27 -BRDA:107,19,1,26 -BRDA:118,20,0,27 -BRDA:118,20,1,26 -BRDA:118,21,0,26 -BRDA:118,21,1,0 -BRDA:126,22,0,27 -BRDA:126,22,1,25 -BRDA:135,23,0,5 -BRDA:135,23,1,22 -BRDA:136,24,0,4 -BRDA:136,24,1,1 -BRDA:141,25,0,1 -BRDA:141,25,1,26 -BRDA:141,26,0,27 -BRDA:141,26,1,6 -BRDA:152,27,0,27 -BRDA:152,27,1,25 -BRDA:152,28,0,25 -BRDA:152,28,1,23 -BRDA:172,29,0,26 -BRDA:172,29,1,1 -BRDA:173,30,0,2 -BRDA:173,30,1,24 -BRDA:177,31,0,4 -BRDA:177,31,1,0 -BRDA:183,32,0,4 -BRDA:183,32,1,22 -BRF:69 -BRH:64 -end_of_record -TN: -SF:/Users/lewis/dev/raven-node/lib/utils.js -FN:19,disableConsoleAlerts -FN:23,consoleAlert -FN:30,(anonymous_3) -FN:42,getAuthHeader -FN:51,parseDSN -FN:83,getCulprit -FN:91,getModules -FN:101,getFunction -FN:115,getModule -FN:138,parseStack -FN:159,(anonymous_11) -FN:186,(anonymous_12) -FN:196,parseLines -FNF:13 -FNH:12 -FNDA:1,disableConsoleAlerts -FNDA:19,consoleAlert -FNDA:0,(anonymous_3) -FNDA:24,getAuthHeader -FNDA:73,parseDSN -FNDA:24,getCulprit -FNDA:29,getModules -FNDA:283,getFunction -FNDA:286,getModule -FNDA:25,parseStack -FNDA:283,(anonymous_11) -FNDA:218,(anonymous_12) -FNDA:218,parseLines -DA:3,1 -DA:4,1 -DA:5,1 -DA:6,1 -DA:7,1 -DA:8,1 -DA:10,1 -DA:12,1 -DA:17,1 -DA:19,1 -DA:20,1 -DA:23,1 -DA:24,19 -DA:25,0 -DA:26,0 -DA:30,1 -DA:31,0 -DA:32,0 -DA:33,0 -DA:34,0 -DA:35,0 -DA:39,0 -DA:42,1 -DA:43,24 -DA:44,24 -DA:45,24 -DA:46,24 -DA:47,24 -DA:48,24 -DA:51,1 -DA:52,73 -DA:54,4 -DA:56,69 -DA:57,69 -DA:65,69 -DA:66,2 -DA:69,69 -DA:70,1 -DA:73,68 -DA:74,68 -DA:75,68 -DA:76,68 -DA:77,68 -DA:79,1 -DA:83,1 -DA:84,24 -DA:85,23 -DA:87,1 -DA:90,1 -DA:91,1 -DA:92,29 -DA:93,1 -DA:95,29 -DA:99,1 -DA:101,1 -DA:102,283 -DA:103,283 -DA:109,0 -DA:113,1 -DA:115,1 -DA:116,286 -DA:119,286 -DA:120,286 -DA:121,286 -DA:122,286 -DA:124,194 -DA:128,92 -DA:129,92 -DA:130,1 -DA:131,1 -DA:132,1 -DA:133,1 -DA:135,91 -DA:138,1 -DA:139,25 -DA:142,25 -DA:143,1 -DA:146,24 -DA:149,24 -DA:151,3 -DA:154,21 -DA:157,21 -DA:159,21 -DA:160,283 -DA:168,283 -DA:171,283 -DA:174,283 -DA:175,65 -DA:176,65 -DA:177,65 -DA:180,218 -DA:181,0 -DA:182,0 -DA:183,0 -DA:186,218 -DA:187,218 -DA:188,218 -DA:189,218 -DA:190,218 -DA:192,218 -DA:193,218 -DA:196,1 -DA:197,218 -DA:198,218 -DA:199,218 -DA:205,1 -DA:206,1 -LF:107 -LH:95 -BRDA:24,1,0,0 -BRDA:24,1,1,19 -BRDA:24,2,0,19 -BRDA:24,2,1,0 -BRDA:30,3,0,1 -BRDA:30,3,1,0 -BRDA:34,4,0,0 -BRDA:34,4,1,0 -BRDA:52,5,0,4 -BRDA:52,5,1,69 -BRDA:65,6,0,2 -BRDA:65,6,1,67 -BRDA:69,7,0,1 -BRDA:69,7,1,68 -BRDA:76,8,0,68 -BRDA:76,8,1,65 -BRDA:76,8,2,0 -BRDA:84,9,0,23 -BRDA:84,9,1,1 -BRDA:84,10,0,24 -BRDA:84,10,1,2 -BRDA:85,11,0,23 -BRDA:85,11,1,1 -BRDA:85,12,0,23 -BRDA:85,12,1,1 -BRDA:92,13,0,1 -BRDA:92,13,1,28 -BRDA:103,14,0,283 -BRDA:103,14,1,91 -BRDA:104,15,0,91 -BRDA:104,15,1,91 -BRDA:113,16,0,1 -BRDA:113,16,1,1 -BRDA:113,16,2,0 -BRDA:116,17,0,285 -BRDA:116,17,1,1 -BRDA:122,18,0,194 -BRDA:122,18,1,92 -BRDA:129,19,0,1 -BRDA:129,19,1,91 -BRDA:131,20,0,1 -BRDA:131,20,1,0 -BRDA:142,21,0,1 -BRDA:142,21,1,24 -BRDA:149,22,0,3 -BRDA:149,22,1,21 -BRDA:149,23,0,24 -BRDA:149,23,1,24 -BRDA:149,23,2,24 -BRDA:149,23,3,21 -BRDA:161,24,0,283 -BRDA:161,24,1,0 -BRDA:165,25,0,283 -BRDA:165,25,1,283 -BRDA:165,25,2,65 -BRDA:168,26,0,283 -BRDA:168,26,1,218 -BRDA:171,27,0,283 -BRDA:171,27,1,0 -BRDA:174,28,0,65 -BRDA:174,28,1,218 -BRDA:176,29,0,0 -BRDA:176,29,1,65 -BRDA:180,30,0,0 -BRDA:180,30,1,218 -BRDA:182,31,0,0 -BRDA:182,31,1,0 -BRDA:187,32,0,218 -BRDA:187,32,1,0 -BRDA:193,33,0,21 -BRDA:193,33,1,197 -BRF:71 -BRH:56 -end_of_record -TN: -SF:/Users/lewis/dev/raven-node/lib/transports.js -FN:6,Transport -FN:11,HTTPTransport -FN:17,(anonymous_3) -FN:31,(anonymous_4) -FN:49,(anonymous_5) -FN:55,(anonymous_6) -FN:67,HTTPSTransport -FNF:7 -FNH:6 -FNDA:0,Transport -FNDA:1,HTTPTransport -FNDA:22,(anonymous_3) -FNDA:21,(anonymous_4) -FNDA:42,(anonymous_5) -FNDA:1,(anonymous_6) -FNDA:1,HTTPSTransport -DA:3,1 -DA:4,1 -DA:6,1 -DA:7,1 -DA:9,1 -DA:11,1 -DA:12,1 -DA:13,1 -DA:14,1 -DA:16,1 -DA:17,1 -DA:18,22 -DA:26,22 -DA:27,0 -DA:28,0 -DA:31,22 -DA:32,21 -DA:33,21 -DA:34,18 -DA:35,18 -DA:37,3 -DA:38,3 -DA:39,3 -DA:40,3 -DA:41,3 -DA:42,3 -DA:43,3 -DA:44,3 -DA:45,3 -DA:46,3 -DA:49,21 -DA:50,21 -DA:51,21 -DA:54,22 -DA:55,22 -DA:56,1 -DA:57,1 -DA:58,1 -DA:59,1 -DA:62,22 -DA:65,1 -DA:67,1 -DA:68,1 -DA:69,1 -DA:70,1 -DA:72,1 -DA:74,1 -DA:75,1 -DA:76,1 -DA:77,1 -DA:78,1 -LF:51 -LH:49 -BRDA:14,1,0,1 -BRDA:14,1,1,1 -BRDA:23,2,0,22 -BRDA:23,2,1,0 -BRDA:27,3,0,0 -BRDA:27,3,1,0 -BRDA:33,4,0,18 -BRDA:33,4,1,3 -BRDA:33,5,0,21 -BRDA:33,5,1,21 -BRDA:35,6,0,18 -BRDA:35,6,1,3 -BRDA:46,7,0,3 -BRDA:46,7,1,0 -BRDA:57,8,0,1 -BRDA:57,8,1,0 -BRDA:58,9,0,1 -BRDA:58,9,1,1 -BRDA:70,10,0,1 -BRDA:70,10,1,1 -BRF:20 -BRH:15 -end_of_record -TN: -SF:/Users/lewis/dev/raven-node/lib/middleware/connect.js -FN:6,(anonymous_1) -FN:12,(anonymous_2) -FN:19,(anonymous_3) -FNF:3 -FNH:0 -FNDA:0,(anonymous_1) -FNDA:0,(anonymous_2) -FNDA:0,(anonymous_3) -DA:3,1 -DA:6,1 -DA:7,0 -DA:12,1 -DA:13,0 -DA:14,0 -DA:19,1 -DA:20,0 -DA:21,0 -DA:24,1 -LF:10 -LH:5 -BRDA:13,1,0,0 -BRDA:13,1,1,0 -BRDA:20,2,0,0 -BRDA:20,2,1,0 -BRF:4 -BRH:0 -end_of_record diff --git a/node_modules/raven/docs/coffeescript.rst b/node_modules/raven/docs/coffeescript.rst deleted file mode 100644 index 9190999..0000000 --- a/node_modules/raven/docs/coffeescript.rst +++ /dev/null @@ -1,24 +0,0 @@ -CoffeeScript -============ - -In order to use raven-node with coffee-script or another library which overwrites -Error.prepareStackTrace you might run into the exception "Traceback does not -support Error.prepareStackTrace being defined already." - -In order to not have raven-node (and the underlying raw-stacktrace library) require -Traceback you can pass your own stackFunction in the options. For example: - -.. code-block:: coffeescript - - client = new raven.Client('___DSN___', { - stackFunction: {{ Your stack function }} - }); - - -So for example: - -.. code-block:: coffeescript - - client = new raven.Client('___DSN___', { - stackFunction: Error.prepareStackTrace - }); diff --git a/node_modules/raven/docs/conf.py b/node_modules/raven/docs/conf.py deleted file mode 100644 index a38571e..0000000 --- a/node_modules/raven/docs/conf.py +++ /dev/null @@ -1,249 +0,0 @@ -# -*- coding: utf-8 -*- -# -# raven-node documentation build configuration file, created by -# sphinx-quickstart on Mon Jan 21 21:04:27 2013. -# -# This file is execfile()d with the current directory set to its containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys, os, datetime - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) - -# -- General configuration ----------------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'raven-node' -copyright = u'%s, Sentry' % datetime.date.today().year - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# - -import json -# The full version, including alpha/beta/rc tags. -release = json.load(open('../package.json'))['version'] -# The short X.Y version. -version = release.rsplit('.', 1)[0] - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ['_build'] - -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - - -# -- Options for HTML output --------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'default' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Output file base name for HTML help builder. -htmlhelp_basename = 'raven-nodedoc' - - -# -- Options for LaTeX output -------------------------------------------------- - -latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'raven-node.tex', u'raven-node Documentation', - u'Matt Robenolt', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output -------------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'raven-node', u'raven-node Documentation', - [u'Sentry'], 1) -] - -# If true, show URL addresses after external links. -#man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------------ - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ('index', 'raven-node', u'raven-node Documentation', - u'Sentry', 'raven-node', 'One line description of project.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' - -if os.environ.get('SENTRY_FEDERATED_DOCS') != '1': - sys.path.insert(0, os.path.abspath('_sentryext')) - import sentryext - sentryext.activate() diff --git a/node_modules/raven/docs/config.rst b/node_modules/raven/docs/config.rst deleted file mode 100644 index 0bfd274..0000000 --- a/node_modules/raven/docs/config.rst +++ /dev/null @@ -1,117 +0,0 @@ -Configuration -============= - -Configuration is passed as the second argument of the ``raven.Client`` constructor: - -.. code-block:: javascript - - var raven = require("raven"); - - new raven.Client(String dsn[, Object options]) - -Optional settings ------------------ - -.. describe:: logger - - The name of the logger used by Sentry. Default: ``''`` - - .. code-block:: javascript - - { - logger: 'default' - } - -.. describe:: release - - Track the version of your application in Sentry. - - .. code-block:: javascript - - { - release: '721e41770371db95eee98ca2707686226b993eda' - } - -.. describe:: environment - - Track the environment name inside Sentry. - - .. code-block:: javascript - - { - environment: 'staging' - } - -.. describe:: tags - - Additional tags to assign to each event. - - .. code-block:: javascript - - { - tags: {git_commit: 'c0deb10c4'} - } - -.. describe:: extra - - Arbitrary data to associate with the event. - - .. code-block:: javascript - - { - extra: {planet: {name: 'Earth'}} - } - -.. describe:: dataCallback - - A function that allows mutation of the data payload right before being - sent to Sentry. - - .. code-block:: javascript - - { - dataCallback: function(data) { - // add a user context - data.user = { - id: 1337, - name: 'janedoe', - email: 'janedoe@example.com' - }; - return data; - } - } - -.. describe:: transport - - Override the default HTTP data transport handler. - - .. code-block:: javascript - - { - transport: function (options) { - // send data - } - } - - Please see the raven-node source code to see `how transports are implemented - `__. - -Environment Variables ---------------------- - -.. describe:: SENTRY_DSN - - Optionally declare the DSN to use for the client through the environment. Initializing the client in your app won't require setting the DSN. - -.. describe:: SENTRY_NAME - - Optionally set the name for the client to use. `What is name? - `__ - -.. describe:: SENTRY_RELEASE - - Optionally set the application release version for the client to use, this is usually a Git SHA hash. - -.. describe:: SENTRY_ENVIRONMENT - - Optionally set the environment name, e.g. "staging", "production". diff --git a/node_modules/raven/docs/index.rst b/node_modules/raven/docs/index.rst deleted file mode 100644 index 1541afd..0000000 --- a/node_modules/raven/docs/index.rst +++ /dev/null @@ -1,109 +0,0 @@ -.. sentry:edition:: self - - raven-node - ========== - -.. sentry:edition:: hosted, on-premise - - .. class:: platform-node - - Node.js - ======= - -raven-node is a Sentry's officially supported Node.js SDK. - -**Note**: If you're using JavaScript in the browser, you'll need -`raven-js `_. - -Installation ------------- - -Raven is distributed via ``npm``: - -.. code-block:: bash - - $ npm install raven --save - -Configuring the Client ----------------------- - -Next you need to initialize the Raven client and configure it to use your `Sentry DSN -`_: - -.. code-block:: javascript - - var raven = require('raven'); - var client = new raven.Client('___DSN___'); - -You can optionally pass an object of configuration options as the 2nd argument to `Client`. For -more information, see :doc:`config`. - -Reporting Errors ----------------- - -To get started passing errors to Raven, it is recommended to initialize Raven's global error handler using -``patchGlobal``. This will cause any uncaught exception which would bubble up to the Node runtime to be -captured and processed by Raven. - -.. code-block:: javascript - - client.patchGlobal(); - -Additionally, you can manually capture and report potentially problematic code with ``try...catch`` and - ``captureException``: - -.. code-block:: javascript - - try { - doSomething(a[0]) - } catch(e) { - client.captureException(e) - } - -The ``captureException`` method optionally takes an object of configuration options as the 2nd argument. For more information, and to learn about other methods provided by the Raven API, see :doc:`usage`. - -Adding Context --------------- - -While a user is logged in, you can tell Sentry to associate errors with -user data. This data is then submitted with each error which allows you -to figure out which users are affected. - -.. code-block:: javascript - - client.setUserContext({ - email: 'matt@example.com', - id: '123' - }) - -If at any point, the user becomes unauthenticated, you can call -``client.setUserContext()`` with no arguments to remove their data. - -Other similar methods are ``client.setExtraContext`` and -``client.setTagsContext``. See :ref:`raven-node-additional-context` for more info. - -Middleware and Integrations ---------------------------- - -If you're using Node.js with a web server framework/library like Connect, Express, or Koa, it is recommended -to configure one of Raven's server middleware integrations. See doc:`integrations/index`. - -Deep Dive ---------- - -For more detailed information about how to get most out of Raven.js there -is additional documentation available that covers all the rest: - -.. toctree:: - :maxdepth: 2 - :titlesonly: - - config - usage - integrations/index - coffeescript - -Resources: - -* `Bug Tracker `_ -* `Github Project `_ diff --git a/node_modules/raven/docs/integrations/connect.rst b/node_modules/raven/docs/integrations/connect.rst deleted file mode 100644 index cda7563..0000000 --- a/node_modules/raven/docs/integrations/connect.rst +++ /dev/null @@ -1,33 +0,0 @@ -Connect -======= - -.. code-block:: javascript - - var connect = require('connect'); - var raven = require('raven'); - - function mainHandler(req, res) { - throw new Error('Broke!'); - } - - function onError(err, req, res, next) { - // The error id is attached to `res.sentry` to be returned - // and optionally displayed to the user for support. - res.statusCode = 500; - res.end(res.sentry+'\n'); - } - - connect( - // The request handler be the first item - raven.middleware.connect.requestHandler('___DSN___'), - - connect.bodyParser(), - connect.cookieParser(), - mainHandler, - - // The error handler must be before any other error middleware - raven.middleware.connect.errorHandler('___DSN___'), - - // Optional fallthrough error handler - onError, - ).listen(3000); diff --git a/node_modules/raven/docs/integrations/express.rst b/node_modules/raven/docs/integrations/express.rst deleted file mode 100644 index e5abc0a..0000000 --- a/node_modules/raven/docs/integrations/express.rst +++ /dev/null @@ -1,29 +0,0 @@ -Express -======= - -.. code-block:: javascript - - var app = require('express')(); - var raven = require('raven'); - - function onError(err, req, res, next) { - // The error id is attached to `res.sentry` to be returned - // and optionally displayed to the user for support. - res.statusCode = 500; - res.end(res.sentry+'\n'); - } - - // The request handler must be the first item - app.use(raven.middleware.express.requestHandler('{{ SENTRY_DSN }}')); - - app.get('/', function mainHandler(req, res) { - throw new Error('Broke!'); - }); - - // The error handler must be before any other error middleware - app.use(raven.middleware.express.errorHandler('{{ SENTRY_DSN }}')); - - // Optional fallthrough error handler - app.use(onError); - - app.listen(3000); diff --git a/node_modules/raven/docs/integrations/index.rst b/node_modules/raven/docs/integrations/index.rst deleted file mode 100644 index b2fcb57..0000000 --- a/node_modules/raven/docs/integrations/index.rst +++ /dev/null @@ -1,9 +0,0 @@ -Integrations -============ - -.. toctree:: - :maxdepth: 1 - - connect - express - koa diff --git a/node_modules/raven/docs/integrations/koa.rst b/node_modules/raven/docs/integrations/koa.rst deleted file mode 100644 index d7cd386..0000000 --- a/node_modules/raven/docs/integrations/koa.rst +++ /dev/null @@ -1,16 +0,0 @@ -Koa -=== - -.. code-block:: javascript - - var koa = require('koa'); - var raven = require('raven'); - - var app = koa(); - var sentry = new raven.Client('___DSN___'); - - app.on('error', function(err) { - sentry.captureException(err); - }); - - app.listen(3000); diff --git a/node_modules/raven/docs/make.bat b/node_modules/raven/docs/make.bat deleted file mode 100644 index 4e6d1ee..0000000 --- a/node_modules/raven/docs/make.bat +++ /dev/null @@ -1,190 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -set I18NSPHINXOPTS=%SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% - set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. texinfo to make Texinfo files - echo. gettext to make PO message catalogs - echo. changes to make an overview over all changed/added/deprecated items - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\raven-node.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\raven-node.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "texinfo" ( - %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. - goto end -) - -if "%1" == "gettext" ( - %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The message catalogs are in %BUILDDIR%/locale. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -:end diff --git a/node_modules/raven/docs/sentry-doc-config.json b/node_modules/raven/docs/sentry-doc-config.json deleted file mode 100644 index ac1c0ef..0000000 --- a/node_modules/raven/docs/sentry-doc-config.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "support_level": "production", - "platforms": { - "node": { - "name": "Node.js", - "type": "language", - "doc_link": "", - "wizard": [ - "index#installation", - "index#configuring-the-client", - "index#reporting-errors" - ] - }, - "node.express": { - "name": "Express", - "type": "framework", - "doc_link": "integrations/express/", - "wizard": [ - "index#installation", - "integrations/express#express" - ] - }, - "node.koa": { - "name": "Koa", - "type": "framework", - "doc_link": "integrations/koa/", - "wizard": [ - "index#installation", - "integrations/koa#koa" - ] - }, - "node.connect": { - "name": "Connect", - "type": "framework", - "doc_link": "integrations/connect/", - "wizard": [ - "index#installation", - "integrations/connect#connect" - ] - } - } -} diff --git a/node_modules/raven/docs/usage.rst b/node_modules/raven/docs/usage.rst deleted file mode 100644 index 7f33b86..0000000 --- a/node_modules/raven/docs/usage.rst +++ /dev/null @@ -1,201 +0,0 @@ -Usage -===== - -Capturing Errors ----------------- - -.. code-block:: javascript - - try { - doSomething(a[0]) - } catch (err) { - client.captureException(err) - } - -Capturing Messages ------------------- - -.. code-block:: javascript - - client.captureMessage('Broken!') - -.. _raven-node-additional-context: - -Optional Attributes -------------------- - -All optional attributes are passed as part of the options to ``captureException`` and ``captureMessage``. - -.. describe:: extra - - Additional context for this event. Must be a mapping. Children can be any native JSON type. - - .. code-block:: javascript - - { - extra: {'key': 'value'} - } - - You can also set extra data globally to be merged in with future events with ``setExtraContext``: - - .. code-block:: javascript - - client.setExtraContext({ foo: "bar" }) - -.. describe:: tags - - Tags to index with this event. Must be a mapping of strings. - - .. code-block:: javascript - - { - tags: {'key': 'value'} - } - - You can also set tags globally to be merged in with future exceptions events with ``setTagsContext``: - - .. code-block:: javascript - - client.setTagsContext({ key: "value" }); - -.. describe:: fingerprint - - The fingerprint for grouping this event. - - .. code-block:: javascript - - { - // dont group events from the same NODE_ENV together - fingerprint: ['{{ default }}', process.env.NODE_ENV] - } - -.. describe:: level - - The level of the event. Defaults to ``error``. - - .. code-block:: javascript - - { - level: 'warning' - } - - Sentry is aware of the following levels: - - * debug (the least serious) - * info - * warning - * error - * fatal (the most serious) - -Tracking Users --------------- - -While a user is logged in, you can tell Sentry to associate errors with -user data. - -.. code-block:: javascript - - client.setUserContext({ - email: 'matt@example.com', - id: '123' - }) - -If at any point, the user becomes unauthenticated, you can call -``client.setUserContext()`` with no arguments to remove their data. *This -would only really be useful in a large web app where the user logs in/out -without a page reload.* - -This data is generally submitted with each error or message and allows you -to figure out which errors are affected by problems. - -Event IDs ---------- - -To make referencing an event easy (both by the developer and customer), you can grab -the event ID using a callback: - - -.. code-block:: javascript - - client.captureMessage('Hello, world!', function(result) { - console.log(client.getIdent(result)); - }); - -.. code-block:: javascript - - client.captureException(new Error('Broke!'), function(result) { - console.log(client.getIdent(result)); - }); - - -.. note:: - - ``captureMessage`` will also return the result directly without the need for a callback, - such as: ``var result = client.captureMessage('Hello, world!');`` - -Global Error Handler --------------------- - -It is recommended that you install the global error handler, which will ensure any exceptions -that are unhandled will get reported: - -.. code-block:: javascript - - client.patchGlobal(); - // or - raven.patchGlobal(client); - // or - raven.patchGlobal('___DSN___'); - -Generally you don't want to leave the process running after receiving an -`uncaughtException` (http://nodejs.org/api/process.html#process_event_uncaughtexception), -so an optional callback is provided to allow you to hook in something like: - -.. code-block:: javascript - - client.patchGlobal(function() { - console.log('Bye, bye, world.'); - process.exit(1); - }); - -The callback is called **after** the event has been sent to the Sentry server. - -Events ------- - -If you really care if the event was logged or errored out, Client emits two events, `logged` and `error`: - -.. code-block:: javascript - - client.on('logged', function(){ - console.log('Yay, it worked!'); - }); - - client.on('error', function(e){ - // The event contains information about the failure: - // e.reason -- raw response body - // e.statusCode -- response status code - // e.response -- raw http response object - - console.log('uh oh, couldnt record the event'); - }) - - client.captureMessage('Boom'); - -Configuring the HTTP Transport ------------------------------- - -.. code-block:: javascript - - var client = new raven.Client('___DSN___', { - transport: new raven.transports.HTTPSTransport({rejectUnauthorized: false}) - }); - -Disable Raven -------------- - -Passing any falsey value as the DSN will disable sending events upstream: - -.. code-block:: javascript - - client = new raven.Client(process.env.NODE_ENV === 'production' && '___DSN___') diff --git a/node_modules/raven/index.js b/node_modules/raven/index.js deleted file mode 100644 index 1e9a597..0000000 --- a/node_modules/raven/index.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -module.exports = require('./lib/client'); -module.exports.utils = require('./lib/utils'); -module.exports.middleware = { - connect: require('./lib/middleware/connect') -}; -// friendly alias for "raven.middleware.express" -module.exports.middleware.express = module.exports.middleware.connect; -module.exports.transports = require('./lib/transports'); -module.exports.parsers = require('./lib/parsers'); - -// To infinity and beyond -Error.stackTraceLimit = Infinity; diff --git a/node_modules/raven/lib/client.js b/node_modules/raven/lib/client.js deleted file mode 100644 index 1bffb76..0000000 --- a/node_modules/raven/lib/client.js +++ /dev/null @@ -1,261 +0,0 @@ -'use strict'; - -var stringify = require('json-stringify-safe'); -var parsers = require('./parsers'); -var zlib = require('zlib'); -var utils = require('./utils'); -var uuid = require('uuid'); -var transports = require('./transports'); -var node_util = require('util'); // node_util to avoid confusion with "utils" -var events = require('events'); - -module.exports.version = require('../package.json').version; - -var extend = Object.assign || function(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; -}; - -var Client = function Client(dsn, options) { - if (arguments.length === 0) { - // no arguments, use default from environment - dsn = process.env.SENTRY_DSN; - options = {}; - } - if (typeof dsn === 'object') { - // They must only be passing through options - options = dsn; - dsn = process.env.SENTRY_DSN; - } - options = options || {}; - - this.raw_dsn = dsn; - this.dsn = utils.parseDSN(dsn); - this.name = options.name || process.env.SENTRY_NAME || require('os').hostname(); - this.root = options.root || process.cwd(); - this.transport = options.transport || transports[this.dsn.protocol]; - this.release = options.release || process.env.SENTRY_RELEASE || ''; - this.environment = options.environment || process.env.SENTRY_ENVIRONMENT || ''; - - this.loggerName = options.logger || ''; - this.dataCallback = options.dataCallback; - - if (this.dsn.protocol === 'https') { - // In case we want to provide our own SSL certificates / keys - this.ca = options.ca || null; - } - - // enabled if a dsn is set - this._enabled = !!this.dsn; - - var globalContext = this._globalContext = {}; - if (options.tags) { - globalContext.tags = options.tags; - } - if (options.extra) { - globalContext.extra = options.extra; - } - - this.on('error', function(e) {}); // noop -}; -node_util.inherits(Client, events.EventEmitter); -var proto = Client.prototype; - -module.exports.Client = Client; - -proto.getIdent = - proto.get_ident = function getIdent(result) { - return result.id; - }; - -proto.process = function process(kwargs) { - kwargs.modules = utils.getModules(); - kwargs.server_name = kwargs.server_name || this.name; - - if (typeof process.version !== 'undefined') { - kwargs.extra.node = process.version; - } - - kwargs.environment = kwargs.environment || this.environment; - kwargs.extra = extend({}, this._globalContext.extra, kwargs.extra); - kwargs.tags = extend({}, this._globalContext.tags, kwargs.tags); - - kwargs.logger = kwargs.logger || this.loggerName; - kwargs.event_id = uuid().replace(/-/g, ''); - kwargs.timestamp = new Date().toISOString().split('.')[0]; - kwargs.project = this.dsn.project_id; - kwargs.platform = 'node'; - - if (this._globalContext.user) { - kwargs.user = this._globalContext.user || kwargs.user; - } - - // Only include release information if it is set - if (this.release) { - kwargs.release = this.release; - } - - var ident = { - id: kwargs.event_id - }; - - if (this.dataCallback) { - kwargs = this.dataCallback(kwargs); - } - - // this will happen asynchronously. We don't care about it's response. - this._enabled && this.send(kwargs, ident); - - return ident; -}; - -proto.send = function send(kwargs, ident) { - var self = this; - - var skwargs = stringify(kwargs); - - zlib.deflate(skwargs, function(err, buff) { - var message = buff.toString('base64'), - timestamp = new Date().getTime(), - headers = { - 'X-Sentry-Auth': utils.getAuthHeader(timestamp, self.dsn.public_key, self.dsn.private_key), - 'Content-Type': 'application/octet-stream', - 'Content-Length': message.length - }; - - self.transport.send(self, message, headers, ident); - }); -}; - -proto.captureMessage = function captureMessage(message, kwargs, cb) { - if (!cb && typeof kwargs === 'function') { - cb = kwargs; - kwargs = {}; - } else { - kwargs = kwargs || {}; - } - var result = this.process(parsers.parseText(message, kwargs)); - cb && cb(result); - return result; -}; - -proto.captureException = function captureError(err, kwargs, cb) { - if (!(err instanceof Error)) { - // This handles when someone does: - // throw "something awesome"; - // We synthesize an Error here so we can extract a (rough) stack trace. - err = new Error(err); - } - - var self = this; - if (!cb && typeof kwargs === 'function') { - cb = kwargs; - kwargs = {}; - } else { - kwargs = kwargs || {}; - } - parsers.parseError(err, kwargs, function(kw) { - var result = self.process(kw); - cb && cb(result); - }); -}; -proto.captureError = proto.captureException; // legacy alias - -proto.captureQuery = function captureQuery(query, engine, kwargs, cb) { - if (!cb && typeof kwargs === 'function') { - cb = kwargs; - kwargs = {}; - } else { - kwargs = kwargs || {}; - } - var result = this.process(parsers.parseQuery(query, engine, kwargs)); - cb && cb(result); - return result; -}; - -/* - * Set/clear a user to be sent along with the payload. - * - * @param {object} user An object representing user data [optional] - * @return {Raven} - */ -proto.setUserContext = function setUserContext(user) { - this._globalContext.user = user; -}; - -/* - * Merge extra attributes to be sent along with the payload. - * - * @param {object} extra An object representing extra data [optional] - * @return {Raven} - */ -proto.setExtraContext = function setExtraContext(extra) { - this._globalContext.extra = extend({}, this._globalContext.extra, extra); - return this; -}; - -/* - * Merge tags to be sent along with the payload. - * - * @param {object} tags An object representing tags [optional] - * @return {Raven} - */ -proto.setTagsContext = function setTagsContext(tags) { - this._globalContext.tags = extend({}, this._globalContext.tags, tags); - return this; -}; - -proto.patchGlobal = function patchGlobal(cb) { - module.exports.patchGlobal(this, cb); - return this; -}; - -module.exports.patchGlobal = function patchGlobal(client, cb) { - // handle when the first argument is the callback, with no client specified - if (typeof client === 'function') { - cb = client; - client = new Client(); - // first argument is a string DSN - } else if (typeof client === 'string') { - client = new Client(client); - } - // at the end, if we still don't have a Client, let's make one! - !(client instanceof Client) && (client = new Client()); - - var called = false; - process.on('uncaughtException', function(err) { - if (cb) { // bind event listeners only if a callback was supplied - var onLogged = function onLogged() { - called = false; - cb(true, err); - }; - - var onError = function onError() { - called = false; - cb(false, err); - }; - - if (called) { - client.removeListener('logged', onLogged); - client.removeListener('error', onError); - return cb(false, err); - } - - client.once('logged', onLogged); - client.once('error', onError); - } - - called = true; - - client.captureError(err, function(result) { - node_util.log('uncaughtException: ' + client.getIdent(result)); - }); - }); -}; diff --git a/node_modules/raven/lib/middleware/connect.js b/node_modules/raven/lib/middleware/connect.js deleted file mode 100644 index c2a7ba0..0000000 --- a/node_modules/raven/lib/middleware/connect.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; - -var raven = require('../client'); -var parsers = require('../parsers'); - -// Legacy support -var connectMiddleware = function(client) { - return connectMiddleware.errorHandler(client); -}; - -// Error handler. This should be the last item listed in middleware, but -// before any other error handlers. -connectMiddleware.errorHandler = function(client) { - client = client instanceof raven.Client ? client : new raven.Client(client); - return function(err, req, res, next) { - var status = err.status || err.statusCode || err.status_code || 500; - - // skip anything not marked as an internal server error - if (status < 500) return next(err); - - var kwargs = parsers.parseRequest(req); - client.captureError(err, kwargs, function(result) { - res.sentry = client.getIdent(result); - next(err, req, res); - }); - }; -}; - -// Ensures asynchronous exceptions are routed to the errorHandler. This -// should be the **first** item listed in middleware. -connectMiddleware.requestHandler = function(client) { - var domain = require('domain'); - return function(req, res, next) { - var reqDomain = domain.create(); - reqDomain.on('error', next); - return reqDomain.run(next); - }; -}; - -module.exports = connectMiddleware; \ No newline at end of file diff --git a/node_modules/raven/lib/parsers.js b/node_modules/raven/lib/parsers.js deleted file mode 100644 index 444b58a..0000000 --- a/node_modules/raven/lib/parsers.js +++ /dev/null @@ -1,191 +0,0 @@ -'use strict'; - -var cookie = require('cookie'); -var urlParser = require('url'); -var stringify = require('json-stringify-safe'); - -var utils = require('./utils'); - -module.exports.parseText = function parseText(message, kwargs) { - kwargs = kwargs || {}; - kwargs.message = message; - - return kwargs; -}; - -module.exports.parseError = function parseError(err, kwargs, cb) { - utils.parseStack(err, function(frames) { - var name = err.name + ''; - if (typeof kwargs.message === 'undefined') { - kwargs.message = name + ': ' + (err.message || ''); - } - kwargs.exception = [{ - type: name, - value: err.message, - stacktrace: { - frames: frames - } - }]; - - // Save additional error properties to `extra` under the error type (e.g. `extra.AttributeError`) - var extraErrorProps; - for (var key in err) { - if (err.hasOwnProperty(key)) { - if (key !== 'name' && key !== 'message' && key !== 'stack') { - extraErrorProps = extraErrorProps || {}; - extraErrorProps[key] = err[key]; - } - } - } - if (extraErrorProps) { - kwargs.extra = kwargs.extra || {}; - kwargs.extra[name] = extraErrorProps; - } - - for (var n = frames.length - 1; n >= 0; n--) { - if (frames[n].in_app) { - kwargs.culprit = kwargs.culprit || utils.getCulprit(frames[n]); - break; - } - } - - cb(kwargs); - }); -}; - -module.exports.parseQuery = function parseQuery(query, engine, kwargs) { - kwargs = kwargs || {}; - kwargs.message = query; - kwargs.query = { - query: query, - engine: engine - }; - return kwargs; -}; - -module.exports.parseRequest = function parseRequest(req, kwargs) { - kwargs = kwargs || {}; - - // headers: - // - // node: req.headers - // express: req.headers - // koa: req.header - // - var headers = req.headers || req.header || {}; - - // method: - // - // node: req.method - // express: req.method - // koa: req.method - // - var method = req.method; - - // host: - // - // node: req.headers.host - // express: req.hostname in > 4 and req.host in < 4 - // koa: req.host - // - var host = req.hostname || req.host || headers.host || ''; - - // protocol: - // - // node: - // express: req.protocol - // koa: req.protocol - // - var protocol = 'https' === req.protocol || true === req.secure || true === (req.socket || {}).encrypted ? 'https' : 'http'; - - // url (including path and query string): - // - // node: req.originalUrl - // express: req.originalUrl - // koa: req.url - // - var originalUrl = req.originalUrl || req.url; - - // absolute url - var url = protocol + '://' + host + originalUrl; - - // query string - // - // node: req.url (raw) - // express: req.query - // koa: req.query - // - var query = req.query || urlParser.parse(originalUrl || '', true).query; - - // cookies: - // - // node: req.headers.cookie - // express: req.headers.cookie - // koa: req.headers.cookie - // - var cookies = cookie.parse(headers.cookie || ''); - - // body data: - // - // node: req.body - // express: req.body - // koa: req.body - // - var data = req.body; - if (['GET', 'HEAD'].indexOf(method) === -1) { - if (typeof data === 'undefined') { - data = ''; - } - } - - if (data && {}.toString.call(data) !== '[object String]') { - // Make sure the request body is a string - data = stringify(data); - } - - // client ip: - // - // node: req.connection.remoteAddress - // express: req.ip - // koa: req.ip - // - var ip = req.ip || (req.connection || {}).remoteAddress; - - // http interface - var http = { - method: method, - query_string: query, - headers: headers, - cookies: cookies, - data: data, - url: url - }; - - // expose http interface - kwargs.request = http; - - // user - // - // typically found on req.user according to Express and Passport - - var user = {}; - if (!kwargs.user) { - if (req.user) { - // shallow copy is okay because we are only modifying top-level - // object (req.user) - for (var key in req.user) { - if ({}.hasOwnProperty.call(req.user, key)) { - user[key] = req.user[key]; - } - } - } - - if (ip) { - user.ip_address = ip; - } - - kwargs.user = user; - } - - return kwargs; -}; diff --git a/node_modules/raven/lib/transports.js b/node_modules/raven/lib/transports.js deleted file mode 100644 index 5464224..0000000 --- a/node_modules/raven/lib/transports.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -var events = require('events'); -var util = require('util'); - -function Transport() {} -util.inherits(Transport, events.EventEmitter); - -var http = require('http'); - -function HTTPTransport(options) { - this.defaultPort = 80; - this.transport = http; - this.options = options || {}; -} -util.inherits(HTTPTransport, Transport); -HTTPTransport.prototype.send = function(client, message, headers, ident) { - var options = { - hostname: client.dsn.host, - path: client.dsn.path + 'api/' + client.dsn.project_id + '/store/', - headers: headers, - method: 'POST', - port: client.dsn.port || this.defaultPort, - ca: client.ca - }; - for (var key in this.options) { - if (this.options.hasOwnProperty(key)) { - options[key] = this.options[key]; - } - } - var req = this.transport.request(options, function(res) { - res.setEncoding('utf8'); - if (res.statusCode >= 200 && res.statusCode < 300) { - client.emit('logged', ident); - } else { - var reason = res.headers['x-sentry-error']; - var e = new Error('HTTP Error (' + res.statusCode + '): ' + reason); - e.response = res; - e.statusCode = res.statusCode; - e.reason = reason; - e.sendMessage = message; - e.requestHeaders = headers; - e.ident = ident; - client.emit('error', e); - } - // force the socket to drain - var noop = function() {}; - res.on('data', noop); - res.on('end', noop); - }); - req.on('error', function(e) { - client.emit('error', e); - }); - req.end(message); -}; - -var https = require('https'); - -function HTTPSTransport(options) { - this.defaultPort = 443; - this.transport = https; - this.options = options || {}; -} -util.inherits(HTTPSTransport, HTTPTransport); - -var dgram = require('dgram'); - -function UDPTransport() { - this.defaultPort = 12345; -} -util.inherits(UDPTransport, Transport); -UDPTransport.prototype.send = function(client, message, headers, ident) { - message = new Buffer(headers['X-Sentry-Auth'] + '\n\n' + message); - - var udp = dgram.createSocket('udp4'); - udp.send(message, 0, message.length, client.dsn.port || this.defaultPort, client.dsn.host, function(e, bytes) { - if (e) { - return client.emit('error', e); - } - client.emit('logged', ident); - udp.close(); - }); -}; - -module.exports.http = new HTTPTransport(); -module.exports.https = new HTTPSTransport(); -module.exports.udp = new UDPTransport(); -module.exports.Transport = Transport; -module.exports.HTTPTransport = HTTPTransport; -module.exports.HTTPSTransport = HTTPSTransport; \ No newline at end of file diff --git a/node_modules/raven/lib/utils.js b/node_modules/raven/lib/utils.js deleted file mode 100644 index d9cceb7..0000000 --- a/node_modules/raven/lib/utils.js +++ /dev/null @@ -1,183 +0,0 @@ -'use strict'; - -var raven = require('./client'); -var fs = require('fs'); -var url = require('url'); -var transports = require('./transports'); -var path = require('path'); -var lsmod = require('lsmod'); -var stacktrace = require('stack-trace'); - -var protocolMap = { - http: 80, - https: 443 -}; - -module.exports.getAuthHeader = function getAuthHeader(timestamp, api_key, api_secret) { - var header = ['Sentry sentry_version=5']; - header.push('sentry_timestamp=' + timestamp); - header.push('sentry_client=raven-node/' + raven.version); - header.push('sentry_key=' + api_key); - header.push('sentry_secret=' + api_secret); - return header.join(', '); -}; - -module.exports.parseDSN = function parseDSN(dsn) { - if (!dsn) { - // Let a falsey value return false explicitly - return false; - } - try { - var parsed = url.parse(dsn), - response = { - protocol: parsed.protocol.slice(0, -1), - public_key: parsed.auth.split(':')[0], - private_key: parsed.auth.split(':')[1], - host: parsed.host.split(':')[0] - }; - - if (~response.protocol.indexOf('+')) { - response.protocol = response.protocol.split('+')[1]; - } - - if (!transports.hasOwnProperty(response.protocol)) { - throw new Error('Invalid transport'); - } - - var index = parsed.pathname.lastIndexOf('/'); - response.path = parsed.pathname.substr(0, index + 1); - response.project_id = parsed.pathname.substr(index + 1); - response.port = ~~parsed.port || protocolMap[response.protocol] || 443; - return response; - } catch (e) { - throw new Error('Invalid Sentry DSN: ' + dsn); - } -}; - -module.exports.getCulprit = function getCulprit(frame) { - if (frame.module || frame.function) - return (frame.module || '?') + ' at ' + (frame.function || '?'); - return ''; -}; - -var module_cache; -module.exports.getModules = function getModules() { - if (module_cache) { - return module_cache; - } - - return module_cache = lsmod(); -}; - - -var LINES_OF_CONTEXT = 7; - -function getFunction(line) { - try { - return line.getFunctionName() || - line.getTypeName() + '.' + (line.getMethodName() || ''); - } catch (e) { - // This seems to happen sometimes when using 'use strict', - // stemming from `getTypeName`. - // [TypeError: Cannot read property 'constructor' of undefined] - return ''; - } -} - -var main_module = (require.main && require.main.filename && path.dirname(require.main.filename) || process.cwd()) + '/'; - -function getModule(filename, base) { - if (!base) base = main_module; - - // It's specifically a module - var file = path.basename(filename, '.js'); - filename = path.dirname(filename); - var n = filename.lastIndexOf('/node_modules/'); - if (n > -1) { - // /node_modules/ is 14 chars - return filename.substr(n + 14).replace(/\//g, '.') + ':' + file; - } - // Let's see if it's a part of the main module - // To be a part of main module, it has to share the same base - n = (filename + '/').lastIndexOf(base, 0); - if (n === 0) { - var module = filename.substr(base.length).replace(/\//g, '.'); - if (module) module += ':'; - module += file; - return module - } - return file; -} - -function parseStack(err, cb) { - var frames = [], - cache = {} - - if (!err) { - return cb(frames); - } - - var stack = stacktrace.parse(err); - - // check to make sure that the stack is what we need it to be. - if (!stack || !Array.isArray(stack) || !stack.length || !stack[0].getFileName) { - // lol, stack is fucked - return cb(frames); - } - - var callbacks = stack.length; - - // Sentry requires the stack trace to be from oldest to newest - stack.reverse(); - - stack.forEach(function(line, index) { - var frame = { - filename: line.getFileName() || '', - lineno: line.getLineNumber(), - colno: line.getColumnNumber(), - 'function': getFunction(line), - }, - isInternal = line.isNative() || - frame.filename[0] !== '/' && - frame.filename[0] !== '.'; - - // in_app is all that's not an internal Node function or a module within node_modules - frame.in_app = !isInternal && !~frame.filename.indexOf('node_modules/'); - - // Extract a module name based on the filename - if (frame.filename) frame.module = getModule(frame.filename); - - // internal Node files are not full path names. Ignore them. - if (isInternal) { - frames[index] = frame; - if (--callbacks === 0) cb(frames); - return; - } - - if (frame.filename in cache) { - parseLines(cache[frame.filename]); - if (--callbacks === 0) cb(frames); - return; - } - - fs.readFile(frame.filename, function(_err, file) { - if (!_err) { - file = file.toString().split('\n'); - cache[frame.filename] = file; - parseLines(file, frame); - } - frames[index] = frame; - if (--callbacks === 0) cb(frames); - }); - - function parseLines(lines) { - frame.pre_context = lines.slice(Math.max(0, frame.lineno - (LINES_OF_CONTEXT + 1)), frame.lineno - 1); - frame.context_line = lines[frame.lineno - 1]; - frame.post_context = lines.slice(frame.lineno, frame.lineno + LINES_OF_CONTEXT); - } - }); -} - -// expose basically for testing because I don't know what I'm doing -module.exports.parseStack = parseStack; -module.exports.getModule = getModule; diff --git a/node_modules/raven/package.json b/node_modules/raven/package.json deleted file mode 100644 index 34a383e..0000000 --- a/node_modules/raven/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "_from": "raven@^0.12.3", - "_id": "raven@0.12.3", - "_inBundle": false, - "_integrity": "sha1-GnDwSiJA0pHYNgO0AWLEutpxMlw=", - "_location": "/raven", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "raven@^0.12.3", - "name": "raven", - "escapedName": "raven", - "rawSpec": "^0.12.3", - "saveSpec": null, - "fetchSpec": "^0.12.3" - }, - "_requiredBy": [ - "/homey-log" - ], - "_resolved": "https://registry.npmjs.org/raven/-/raven-0.12.3.tgz", - "_shasum": "1a70f04a2240d291d83603b40162c4bada71325c", - "_spec": "raven@^0.12.3", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\homey-log", - "author": { - "name": "Matt Robenolt", - "email": "matt@ydekproductions.com" - }, - "bin": { - "raven": "./bin/raven" - }, - "bugs": { - "url": "https://github.com/getsentry/raven-node/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "https://github.com/mattrobenolt/raven-node/graphs/contributors" - } - ], - "dependencies": { - "cookie": "0.3.1", - "json-stringify-safe": "5.0.1", - "lsmod": "1.0.0", - "stack-trace": "0.0.9", - "uuid": "3.0.0" - }, - "deprecated": false, - "description": "A standalone (Node.js) client for Sentry", - "devDependencies": { - "coffee-script": "~1.10.0", - "connect": "*", - "eslint": "1.10.3", - "express": "*", - "glob": "~3.1.13", - "istanbul": "^0.4.3", - "koa": "*", - "mocha": "*", - "mock-udp": "*", - "nock": "~0.28.2", - "should": "~3.3.1" - }, - "engines": { - "node": ">= 0.8.0" - }, - "homepage": "https://github.com/getsentry/raven-node#readme", - "keywords": [ - "raven", - "sentry", - "python", - "errors", - "debugging", - "exceptions" - ], - "license": "BSD-2-Clause", - "main": "index", - "name": "raven", - "repository": { - "type": "git", - "url": "git://github.com/getsentry/raven-node.git" - }, - "scripts": { - "lint": "node_modules/eslint/bin/eslint.js .", - "pretest": "npm install && npm run lint", - "test": "NODE_ENV=test istanbul cover _mocha -- --reporter dot && NODE_ENV=test node_modules/coffee-script/bin/coffee ./test/run.coffee" - }, - "version": "0.12.3" -} diff --git a/node_modules/stack-trace/.npmignore b/node_modules/stack-trace/.npmignore deleted file mode 100644 index b59f7e3..0000000 --- a/node_modules/stack-trace/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test/ \ No newline at end of file diff --git a/node_modules/stack-trace/License b/node_modules/stack-trace/License deleted file mode 100644 index 11ec094..0000000 --- a/node_modules/stack-trace/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. diff --git a/node_modules/stack-trace/Makefile b/node_modules/stack-trace/Makefile deleted file mode 100644 index a7ce31d..0000000 --- a/node_modules/stack-trace/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -release: - git push - git push --tags - npm publish . - -.PHONY: test diff --git a/node_modules/stack-trace/Readme.md b/node_modules/stack-trace/Readme.md deleted file mode 100644 index fcd1b97..0000000 --- a/node_modules/stack-trace/Readme.md +++ /dev/null @@ -1,98 +0,0 @@ -# stack-trace - -Get v8 stack traces as an array of CallSite objects. - -## Install - -``` bash -npm install stack-trace -``` - -## Usage - -The stack-trace module makes it easy for you to capture the current stack: - -``` javascript -var stackTrace = require('stack-trace'); -var trace = stackTrace.get(); - -require('assert').strictEqual(trace[0].getFileName(), __filename); -``` - -However, sometimes you have already popped the stack you are interested in, -and all you have left is an `Error` object. This module can help: - -``` javascript -var stackTrace = require('stack-trace'); -var err = new Error('something went wrong'); -var trace = stackTrace.parse(err); - -require('assert').strictEqual(trace[0].getFileName(), __filename); -``` - -Please note that parsing the `Error#stack` property is not perfect, only -certain properties can be retrieved with it as noted in the API docs below. - -## Long stack traces - -stack-trace works great with [long-stack-traces][], when parsing an `err.stack` -that has crossed the event loop boundary, a `CallSite` object returning -`'----------------------------------------'` for `getFileName()` is created. -All other methods of the event loop boundary call site return `null`. - -[long-stack-traces]: https://github.com/tlrobinson/long-stack-traces - -## API - -### stackTrace.get([belowFn]) - -Returns an array of `CallSite` objects, where element `0` is the current call -site. - -When passing a function on the current stack as the `belowFn` parameter, the -returned array will only include `CallSite` objects below this function. - -### stackTrace.parse(err) - -Parses the `err.stack` property of an `Error` object into an array compatible -with those returned by `stackTrace.get()`. However, only the following methods -are implemented on the returned `CallSite` objects. - -* getTypeName -* getFunctionName -* getMethodName -* getFileName -* getLineNumber -* getColumnNumber -* isNative - -Note: Except `getFunctionName()`, all of the above methods return exactly the -same values as you would get from `stackTrace.get()`. `getFunctionName()` -is sometimes a little different, but still useful. - -### CallSite - -The official v8 CallSite object API can be found [here][v8stackapi]. A quick -excerpt: - -> A CallSite object defines the following methods: -> -> * **getThis**: returns the value of this -> * **getTypeName**: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property. -> * **getFunction**: returns the current function -> * **getFunctionName**: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context. -> * **getMethodName**: returns the name of the property of this or one of its prototypes that holds the current function -> * **getFileName**: if this function was defined in a script returns the name of the script -> * **getLineNumber**: if this function was defined in a script returns the current line number -> * **getColumnNumber**: if this function was defined in a script returns the current column number -> * **getEvalOrigin**: if this function was created using a call to eval returns a CallSite object representing the location where eval was called -> * **isToplevel**: is this a toplevel invocation, that is, is this the global object? -> * **isEval**: does this call take place in code defined by a call to eval? -> * **isNative**: is this call in native V8 code? -> * **isConstructor**: is this a constructor call? - -[v8stackapi]: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - -## License - -stack-trace is licensed under the MIT license. diff --git a/node_modules/stack-trace/lib/stack-trace.js b/node_modules/stack-trace/lib/stack-trace.js deleted file mode 100644 index a7c38aa..0000000 --- a/node_modules/stack-trace/lib/stack-trace.js +++ /dev/null @@ -1,111 +0,0 @@ -exports.get = function(belowFn) { - var oldLimit = Error.stackTraceLimit; - Error.stackTraceLimit = Infinity; - - var dummyObject = {}; - - var v8Handler = Error.prepareStackTrace; - Error.prepareStackTrace = function(dummyObject, v8StackTrace) { - return v8StackTrace; - }; - Error.captureStackTrace(dummyObject, belowFn || exports.get); - - var v8StackTrace = dummyObject.stack; - Error.prepareStackTrace = v8Handler; - Error.stackTraceLimit = oldLimit; - - return v8StackTrace; -}; - -exports.parse = function(err) { - if (!err.stack) { - return []; - } - - var self = this; - var lines = err.stack.split('\n').slice(1); - - return lines - .map(function(line) { - if (line.match(/^\s*[-]{4,}$/)) { - return self._createParsedCallSite({ - fileName: line, - lineNumber: null, - functionName: null, - typeName: null, - methodName: null, - columnNumber: null, - 'native': null, - }); - } - - var lineMatch = line.match(/at (?:(.+)\s+)?\(?(?:(.+?):(\d+):(\d+)|([^)]+))\)?/); - if (!lineMatch) { - return; - } - - var object = null; - var method = null; - var functionName = null; - var typeName = null; - var methodName = null; - var isNative = (lineMatch[5] === 'native'); - - if (lineMatch[1]) { - var methodMatch = lineMatch[1].match(/([^\.]+)(?:\.(.+))?/); - object = methodMatch[1]; - method = methodMatch[2]; - functionName = lineMatch[1]; - typeName = 'Object'; - } - - if (method) { - typeName = object; - methodName = method; - } - - if (method === '') { - methodName = null; - functionName = ''; - } - - var properties = { - fileName: lineMatch[2] || null, - lineNumber: parseInt(lineMatch[3], 10) || null, - functionName: functionName, - typeName: typeName, - methodName: methodName, - columnNumber: parseInt(lineMatch[4], 10) || null, - 'native': isNative, - }; - - return self._createParsedCallSite(properties); - }) - .filter(function(callSite) { - return !!callSite; - }); -}; - -exports._createParsedCallSite = function(properties) { - var methods = {}; - for (var property in properties) { - var prefix = 'get'; - if (property === 'native') { - prefix = 'is'; - } - var method = prefix + property.substr(0, 1).toUpperCase() + property.substr(1); - - (function(property) { - methods[method] = function() { - return properties[property]; - } - })(property); - } - - var callSite = Object.create(methods); - for (var property in properties) { - callSite[property] = properties[property]; - } - - return callSite; -}; diff --git a/node_modules/stack-trace/package.json b/node_modules/stack-trace/package.json deleted file mode 100644 index a418a32..0000000 --- a/node_modules/stack-trace/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "_from": "stack-trace@0.0.9", - "_id": "stack-trace@0.0.9", - "_inBundle": false, - "_integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=", - "_location": "/stack-trace", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "stack-trace@0.0.9", - "name": "stack-trace", - "escapedName": "stack-trace", - "rawSpec": "0.0.9", - "saveSpec": null, - "fetchSpec": "0.0.9" - }, - "_requiredBy": [ - "/raven" - ], - "_resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz", - "_shasum": "a8f6eaeca90674c333e7c43953f275b451510695", - "_spec": "stack-trace@0.0.9", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\raven", - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "bugs": { - "url": "https://github.com/felixge/node-stack-trace/issues" - }, - "bundleDependencies": false, - "dependencies": {}, - "deprecated": false, - "description": "Get v8 stack traces as an array of CallSite objects.", - "devDependencies": { - "far": "0.0.3", - "long-stack-traces": "0.1.2" - }, - "engines": { - "node": "*" - }, - "homepage": "https://github.com/felixge/node-stack-trace", - "main": "./lib/stack-trace", - "name": "stack-trace", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-stack-trace.git" - }, - "version": "0.0.9" -} diff --git a/node_modules/uuid/.npmignore b/node_modules/uuid/.npmignore deleted file mode 100644 index fd4f2b0..0000000 --- a/node_modules/uuid/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -.DS_Store diff --git a/node_modules/uuid/.travis.yml b/node_modules/uuid/.travis.yml deleted file mode 100644 index d1b90db..0000000 --- a/node_modules/uuid/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "4" - - "6" diff --git a/node_modules/uuid/AUTHORS b/node_modules/uuid/AUTHORS deleted file mode 100644 index 5a10523..0000000 --- a/node_modules/uuid/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -Robert Kieffer -Christoph Tavan -AJ ONeal -Vincent Voyer -Roman Shtylman diff --git a/node_modules/uuid/HISTORY.md b/node_modules/uuid/HISTORY.md deleted file mode 100644 index 716a039..0000000 --- a/node_modules/uuid/HISTORY.md +++ /dev/null @@ -1,24 +0,0 @@ -# 3.0.0 (2016-11-17) - - * remove .parse and .unparse - -# 2.0.0 - - * Removed uuid.BufferClass - -# 1.4.0 - - * Improved module context detection - * Removed public RNG functions - -# 1.3.2 - - * Improve tests and handling of v1() options (Issue #24) - * Expose RNG option to allow for perf testing with different generators - -# 1.3.0 - - * Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)! - * Support for node.js crypto API - * De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code - diff --git a/node_modules/uuid/LICENSE.md b/node_modules/uuid/LICENSE.md deleted file mode 100644 index 652609b..0000000 --- a/node_modules/uuid/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2010-2012 Robert Kieffer - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/uuid/README.md b/node_modules/uuid/README.md deleted file mode 100644 index def14ba..0000000 --- a/node_modules/uuid/README.md +++ /dev/null @@ -1,130 +0,0 @@ -# uuid [![Build Status](https://secure.travis-ci.org/kelektiv/node-uuid.svg?branch=master)](http://travis-ci.org/kelektiv/node-uuid) # - -Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS. - -Features: - -* Generate RFC4122 version 1 or version 4 UUIDs -* Runs in node.js and browsers -* Cryptographically strong random number generation on supporting platforms -* Small footprint (Want something smaller? [Check this out](https://gist.github.com/982883) out!) - -## Quickstart - nodejs - -```shell -npm install uuid -``` - -```javascript -const uuid = require('uuid'); - -// Generate a v4 (random) id -uuid() // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1' - -// Generate a v1 (time-based) id -uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a' -``` - -## Quickstart - browser - -** Not recommende for production or even semi-production use. Use a bundling tool instead (i.e. webpack, browserify, rollup, etc)** - -[wzrd.in](https://github.com/jfhbrook/wzrd.in) will serve up any npm module after performing basic bundling and minification. - -```html - -``` - -## API - -### uuid(...) - -Generate a V4 uuid. See uuid.v4 documentation below. - -### uuid.v1([`options` [, `buffer` [, `offset`]]]) - -Generate and return a RFC4122 v1 (timestamp-based) UUID. - -* `options` - (Object) Optional uuid state to apply. Properties may include: - - * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1. - * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used. - * `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used. - * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2. - -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Notes: - -1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.) - -Example: Generate string UUID with fully-specified options - -```javascript -uuid.v1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date('2011-11-01').getTime(), - nsecs: 5678 -}); // -> "710b962e-041c-11e1-9234-0123456789ab" -``` - -Example: In-place generation of two binary IDs - -```javascript -// Generate two ids in an array -const arr = new Array(32); // -> [] -uuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15] -uuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15] - -// Optionally use uuid.unparse() to get stringify the ids -uuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115' -uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115' -``` - -### uuid.v4([`options` [, `buffer` [, `offset`]]]) - -Generate and return a RFC4122 v4 UUID. - -* `options` - (Object) Optional uuid state to apply. Properties may include: - - * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values - * `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values. - -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Example: Generate string UUID with fully-specified options - -```javascript -uuid.v4({ - random: [ - 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, - 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 - ] -}); -// -> "109156be-c4fb-41ea-b1b4-efe1671c5836" -``` - -Example: Generate two IDs in a single buffer - -```javascript -const buffer = new Array(32); // (or 'new Buffer' in node.js) -uuid.v4(null, buffer, 0); -uuid.v4(null, buffer, 16); -``` - -## Testing - -``` -npm test -``` - -## Legacy node-uuid package - -The code for the legacy node-uuid package is available in the `node-uuid` branch. diff --git a/node_modules/uuid/bin/uuid b/node_modules/uuid/bin/uuid deleted file mode 100644 index f732e99..0000000 --- a/node_modules/uuid/bin/uuid +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var uuid = require(path.join(__dirname, '..')); - -var arg = process.argv[2]; - -if ('--help' === arg) { - console.log('\n USAGE: uuid [version] [options]\n\n'); - console.log(' options:\n'); - console.log(' --help Display this message and exit\n'); - process.exit(0); -} - -if (null == arg) { - console.log(uuid()); - process.exit(0); -} - -if ('v1' !== arg && 'v4' !== arg) { - console.error('Version must be RFC4122 version 1 or version 4, denoted as "v1" or "v4"'); - process.exit(1); -} - -console.log(uuid[arg]()); -process.exit(0); diff --git a/node_modules/uuid/lib/rng-browser.js b/node_modules/uuid/lib/rng-browser.js deleted file mode 100644 index 82ffaf6..0000000 --- a/node_modules/uuid/lib/rng-browser.js +++ /dev/null @@ -1,32 +0,0 @@ - -var rng; - -var crypto = global.crypto || global.msCrypto; // for IE 11 -if (crypto && crypto.getRandomValues) { - // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto - // Moderately fast, high quality - var _rnds8 = new Uint8Array(16); - rng = function whatwgRNG() { - crypto.getRandomValues(_rnds8); - return _rnds8; - }; -} - -if (!rng) { - // Math.random()-based (RNG) - // - // If all else fails, use Math.random(). It's fast, but is of unspecified - // quality. - var _rnds = new Array(16); - rng = function() { - for (var i = 0, r; i < 16; i++) { - if ((i & 0x03) === 0) r = Math.random() * 0x100000000; - _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; - } - - return _rnds; - }; -} - -module.exports = rng; - diff --git a/node_modules/uuid/lib/rng.js b/node_modules/uuid/lib/rng.js deleted file mode 100644 index 3977f79..0000000 --- a/node_modules/uuid/lib/rng.js +++ /dev/null @@ -1,4 +0,0 @@ -var rb = require('crypto').randomBytes; -module.exports = function() { - return rb(16); -}; diff --git a/node_modules/uuid/package.json b/node_modules/uuid/package.json deleted file mode 100644 index 5bc4f86..0000000 --- a/node_modules/uuid/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "_from": "uuid@3.0.0", - "_id": "uuid@3.0.0", - "_inBundle": false, - "_integrity": "sha1-Zyj8BFnEUNeWqZwxg3VpvfZy1yg=", - "_location": "/uuid", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "uuid@3.0.0", - "name": "uuid", - "escapedName": "uuid", - "rawSpec": "3.0.0", - "saveSpec": null, - "fetchSpec": "3.0.0" - }, - "_requiredBy": [ - "/raven" - ], - "_resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz", - "_shasum": "6728fc0459c450d796a99c31837569bdf672d728", - "_spec": "uuid@3.0.0", - "_where": "D:\\Projects\\Homey\\com.sensative\\node_modules\\raven", - "bin": { - "uuid": "./bin/uuid" - }, - "browser": { - "./lib/rng.js": "./lib/rng-browser.js" - }, - "bugs": { - "url": "https://github.com/kelektiv/node-uuid/issues" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Robert Kieffer", - "email": "robert@broofa.com" - }, - { - "name": "Christoph Tavan", - "email": "dev@tavan.de" - }, - { - "name": "AJ ONeal", - "email": "coolaj86@gmail.com" - }, - { - "name": "Vincent Voyer", - "email": "vincent@zeroload.net" - }, - { - "name": "Roman Shtylman", - "email": "shtylman@gmail.com" - } - ], - "deprecated": false, - "description": "RFC4122 (v1 and v4) generator", - "devDependencies": { - "mocha": "3.1.2" - }, - "homepage": "https://github.com/kelektiv/node-uuid#readme", - "keywords": [ - "uuid", - "guid", - "rfc4122" - ], - "license": "MIT", - "main": "./uuid.js", - "name": "uuid", - "repository": { - "type": "git", - "url": "git+https://github.com/kelektiv/node-uuid.git" - }, - "scripts": { - "test": "mocha test/test.js" - }, - "version": "3.0.0" -} diff --git a/node_modules/uuid/test/mocha.opts b/node_modules/uuid/test/mocha.opts deleted file mode 100644 index 5d6a311..0000000 --- a/node_modules/uuid/test/mocha.opts +++ /dev/null @@ -1,3 +0,0 @@ ---ui qunit ---reporter spec ---check-leaks diff --git a/node_modules/uuid/test/test.js b/node_modules/uuid/test/test.js deleted file mode 100644 index ec33bec..0000000 --- a/node_modules/uuid/test/test.js +++ /dev/null @@ -1,96 +0,0 @@ -var assert = require('assert'); - -var uuid = require('../'); - -// Verify ordering of v1 ids created with explicit times -var TIME = 1321644961388; // 2011-11-18 11:36:01.388-08:00 - -function compare(name, ids) { - test(name, function() { - // avoid .map for older browsers - for (var i=0 ; i 10k ids created in 1ms', function() { - // Verify throw if too many ids created - var thrown = false; - try { - uuid.v1({msecs: TIME, nsecs: 10000}); - } catch (e) { - thrown = true; - } - assert(thrown, 'Exception thrown when > 10K ids created in 1 ms'); -}); - -test('clock regression by msec', function() { - // Verify clock regression bumps clockseq - var uidt = uuid.v1({msecs: TIME}); - var uidtb = uuid.v1({msecs: TIME - 1}); - assert( - parseInt(uidtb.split('-')[3], 16) - parseInt(uidt.split('-')[3], 16) === 1, - 'Clock regression by msec increments the clockseq' - ); -}); - -test('clock regression by nsec', function() { - // Verify clock regression bumps clockseq - var uidtn = uuid.v1({msecs: TIME, nsecs: 10}); - var uidtnb = uuid.v1({msecs: TIME, nsecs: 9}); - assert( - parseInt(uidtnb.split('-')[3], 16) - parseInt(uidtn.split('-')[3], 16) === 1, - 'Clock regression by nsec increments the clockseq' - ); -}); - -test('explicit options product expected id', function() { - // Verify explicit options produce expected id - var id = uuid.v1({ - msecs: 1321651533573, - nsecs: 5432, - clockseq: 0x385c, - node: [ 0x61, 0xcd, 0x3c, 0xbb, 0x32, 0x10 ] - }); - assert(id == 'd9428888-122b-11e1-b85c-61cd3cbb3210', 'Explicit options produce expected id'); -}); - -test('ids spanning 1ms boundary are 100ns apart', function() { - // Verify adjacent ids across a msec boundary are 1 time unit apart - var u0 = uuid.v1({msecs: TIME, nsecs: 9999}); - var u1 = uuid.v1({msecs: TIME + 1, nsecs: 0}); - - var before = u0.split('-')[0], after = u1.split('-')[0]; - var dt = parseInt(after, 16) - parseInt(before, 16); - assert(dt === 1, 'Ids spanning 1ms boundary are 100ns apart'); -}); diff --git a/node_modules/uuid/uuid.js b/node_modules/uuid/uuid.js deleted file mode 100644 index a1f28f7..0000000 --- a/node_modules/uuid/uuid.js +++ /dev/null @@ -1,157 +0,0 @@ -// Unique ID creation requires a high quality random # generator. We feature -// detect to determine the best RNG source, normalizing to a function that -// returns 128-bits of randomness, since that's what's usually required -var _rng = require('./lib/rng'); - -// Maps for number <-> hex string conversion -var _byteToHex = []; -var _hexToByte = {}; -for (var i = 0; i < 256; ++i) { - _byteToHex[i] = (i + 0x100).toString(16).substr(1); - _hexToByte[_byteToHex[i]] = i; -} - -function buff_to_string(buf, offset) { - var i = offset || 0; - var bth = _byteToHex; - return bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]]; -} - -// **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html - -// random #'s we need to init node and clockseq -var _seedBytes = _rng(); - -// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) -var _nodeId = [ - _seedBytes[0] | 0x01, - _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5] -]; - -// Per 4.2.2, randomize (14 bit) clockseq -var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff; - -// Previous uuid creation time -var _lastMSecs = 0, _lastNSecs = 0; - -// See https://github.com/broofa/node-uuid for API details -function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || []; - - options = options || {}; - - var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; - - // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); - - // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; - - // Time since last uuid creation (in msecs) - var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; - - // Per 4.2.1.2, Bump clockseq on clock regression - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } - - // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } - - // Per 4.2.1.2 Throw error if too many uuids are requested - if (nsecs >= 10000) { - throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - - // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - msecs += 12219292800000; - - // `time_low` - var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; - - // `time_mid` - var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; - - // `time_high_and_version` - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - b[i++] = tmh >>> 16 & 0xff; - - // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - b[i++] = clockseq >>> 8 | 0x80; - - // `clock_seq_low` - b[i++] = clockseq & 0xff; - - // `node` - var node = options.node || _nodeId; - for (var n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf ? buf : buff_to_string(b); -} - -// **`v4()` - Generate random UUID** - -// See https://github.com/broofa/node-uuid for API details -function v4(options, buf, offset) { - // Deprecated - 'format' argument, as supported in v1.2 - var i = buf && offset || 0; - - if (typeof(options) == 'string') { - buf = options == 'binary' ? new Array(16) : null; - options = null; - } - options = options || {}; - - var rnds = options.random || (options.rng || _rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; - - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ++ii) { - buf[i + ii] = rnds[ii]; - } - } - - return buf || buff_to_string(rnds); -} - -// Export public API -var uuid = v4; -uuid.v1 = v1; -uuid.v4 = v4; - -module.exports = uuid; diff --git a/package-lock.json b/package-lock.json index e8d42c1..6b9d731 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "com.sensative", - "version": "2.1.0", + "version": "2.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -9,6 +9,69 @@ "resolved": "https://registry.npmjs.org/almost-equal/-/almost-equal-1.1.0.tgz", "integrity": "sha1-+FHGMROHV5lCdqou++jfowZszN0=" }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "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" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.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 + }, "color-space": { "version": "1.16.0", "resolved": "https://registry.npmjs.org/color-space/-/color-space-1.16.0.tgz", @@ -18,17 +81,77 @@ "mumath": "^3.3.4" } }, - "cookie": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", - "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, - "homey-log": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/homey-log/-/homey-log-1.0.6.tgz", - "integrity": "sha512-LFOaByu/E2krWNSGwmoazL4HCSSyLVQMoaBo9mgMxV2YC4lEB15SMov1bqZxUclEJCbnR+YUX9xsnFW5brmIbw==", + "copyfiles": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.2.0.tgz", + "integrity": "sha512-iJbHJI+8OKqsq+4JF0rqgRkZzo++jqO6Wf4FUU1JM41cJF6JcY5968XyF4tm3Kkm7ZOMrqlljdm8N9oyY5raGw==", + "dev": true, + "requires": { + "glob": "^7.0.5", + "minimatch": "^3.0.3", + "mkdirp": "^0.5.1", + "noms": "0.0.0", + "through2": "^2.0.1", + "yargs": "^13.2.4" + } + }, + "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=", + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "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" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, "requires": { - "raven": "^0.12.3" + "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" } }, "homey-meshdriver": { @@ -43,15 +166,67 @@ "resolved": "https://registry.npmjs.org/hsluv/-/hsluv-0.0.3.tgz", "integrity": "sha1-gpEH2vtKn4tSoYCe0C4JHq3mdUw=" }, - "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=" + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } }, - "lsmod": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lsmod/-/lsmod-1.0.0.tgz", - "integrity": "sha1-mgD3bco26yP6BTUK/htYXUKZ5ks=" + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "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 + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "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" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "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" + } }, "mumath": { "version": "3.3.4", @@ -61,27 +236,239 @@ "almost-equal": "^1.1.0" } }, - "raven": { - "version": "0.12.3", - "resolved": "https://registry.npmjs.org/raven/-/raven-0.12.3.tgz", - "integrity": "sha1-GnDwSiJA0pHYNgO0AWLEutpxMlw=", + "noms": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz", + "integrity": "sha1-2o69nzr51nYJGbJ9nNyAkqczKFk=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "~1.0.31" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "p-limit": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", + "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "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": { - "cookie": "0.3.1", - "json-stringify-safe": "5.0.1", - "lsmod": "1.0.0", - "stack-trace": "0.0.9", - "uuid": "3.0.0" + "p-limit": "^2.0.0" } }, - "stack-trace": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz", - "integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=" + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true }, - "uuid": { + "path-exists": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz", - "integrity": "sha1-Zyj8BFnEUNeWqZwxg3VpvfZy1yg=" + "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=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "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==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "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=", + "dev": true + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "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==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yargs": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", + "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.1" + } + }, + "yargs-parser": { + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } } diff --git a/package.json b/package.json index 1771d0b..25b712c 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,18 @@ { "name": "com.sensative", - "version": "2.1.0", - "description": "This app adds support for the Z-wave Sensative strips family (http://www.sensative.com/).", + "version": "2.2.0", + "description": "This app adds support for the Z-Wave Sensative Strips family (http://www.sensative.com/).", "main": "app.js", "requires": true, "dependencies": { - "homey-log": "^1.0.6", "homey-meshdriver": "git+https://github.com/athombv/node-homey-meshdriver.git" }, - "devDependencies": {}, + "devDependencies": { + "copyfiles": "^2.2.0" + }, "scripts": { - "run": "homey app run", + "prestart": "copyfiles -sf .homeycompose/app.json .", + "start": "homey app run", "lint": "eslint **/*.js", "test": "echo \"Error: no test specified\" && exit 1" },