From 65f11bec099b88c6e3c13bf4f388164bcd1def6a Mon Sep 17 00:00:00 2001 From: watsonb8 Date: Thu, 10 Dec 2020 12:51:35 -0500 Subject: [PATCH] WIP adding custom event classes --- package-lock.json | 195 +++++++++++++++++++++++++++--------- src/common.ts | 9 +- src/config.ts | 1 + src/events/event.ts | 12 +++ src/events/eventDelegate.ts | 1 + src/locationAccessory.ts | 91 +++++++++++++++++ src/locationMonitor.ts | 39 -------- src/monitor.ts | 151 ++++++++++++++++++++++++++++ src/monitorAccessory.ts | 191 ----------------------------------- src/platform.ts | 59 +++++------ 10 files changed, 435 insertions(+), 314 deletions(-) create mode 100644 src/events/event.ts create mode 100644 src/events/eventDelegate.ts create mode 100644 src/locationAccessory.ts delete mode 100644 src/locationMonitor.ts create mode 100644 src/monitor.ts delete mode 100644 src/monitorAccessory.ts diff --git a/package-lock.json b/package-lock.json index 6ab6a37..80603d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -199,7 +199,8 @@ "arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true }, "argparse": { "version": "1.0.10", @@ -212,12 +213,14 @@ "array-filter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", - "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=" + "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", + "dev": true }, "array-flatten": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", - "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==" + "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", + "dev": true }, "asynckit": { "version": "0.4.0", @@ -236,6 +239,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", "integrity": "sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==", + "dev": true, "requires": { "array-filter": "^1.0.0" } @@ -249,6 +253,7 @@ "version": "3.5.11", "resolved": "https://registry.npmjs.org/bonjour-hap/-/bonjour-hap-3.5.11.tgz", "integrity": "sha512-pSYWWxjx3t2vh3sMkBMxQ0QaCqFgqWFz9he9U1JSQ6Lvwev5W19J+nBQWFj55dzUOcH0rPtZh/A+k/MvI5etQw==", + "dev": true, "requires": { "array-flatten": "^2.1.2", "deep-equal": "^2.0.2", @@ -269,12 +274,14 @@ "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true }, "call-bind": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz", "integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==", + "dev": true, "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.0" @@ -367,7 +374,8 @@ "commander": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", - "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==" + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true }, "concat-map": { "version": "0.0.1", @@ -383,6 +391,7 @@ "version": "2.4.0", "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.0.tgz", "integrity": "sha512-yGjpR3yjQdxccW8EcJ4a7ZCA6wGER6/Q2Y+b7bXbVxGeSHBf93i9d7MzTsx+VV1CpMKQa3v4ThZfXBcltMzl0w==", + "dev": true, "requires": { "glob": "^7.0.5", "minimatch": "^3.0.3", @@ -397,6 +406,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -406,12 +416,14 @@ "mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true }, "wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, "requires": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -421,12 +433,14 @@ "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==" + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true }, "yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, "requires": { "cliui": "^6.0.0", "decamelize": "^1.2.0", @@ -445,6 +459,7 @@ "version": "18.1.3", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" @@ -483,12 +498,14 @@ "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true }, "decimal.js": { "version": "10.2.1", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz", - "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==" + "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw==", + "dev": true }, "decompress-response": { "version": "4.2.1", @@ -502,6 +519,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.4.tgz", "integrity": "sha512-BUfaXrVoCfgkOQY/b09QdO9L3XNoF2XH0A3aY9IQwQL/ZjLOe8FQgCNVl1wiolhsFo8kFdO9zdPViCPbmaJA5w==", + "dev": true, "requires": { "es-abstract": "^1.18.0-next.1", "es-get-iterator": "^1.1.0", @@ -522,7 +540,8 @@ "isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true } } }, @@ -535,6 +554,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -557,12 +577,14 @@ "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==" + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true }, "dns-packet": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-4.2.0.tgz", "integrity": "sha512-bn1AKpfkFbm0MIioOMHZ5qJzl2uypdBwI4nYNsqvhjsegBhcKJUlCrMPWLx6JEezRjxZmxhtIz/FkBEur2l8Cw==", + "dev": true, "requires": { "ip": "^1.1.5", "safe-buffer": "^5.1.1" @@ -593,6 +615,7 @@ "version": "1.18.0-next.1", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", + "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", @@ -612,6 +635,7 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.1.tgz", "integrity": "sha512-qorBw8Y7B15DVLaJWy6WdEV/ZkieBcu6QCq/xzWzGOKJqgG1j754vXRfZ3NY7HSShneqU43mPB4OkQBTkvHhFw==", + "dev": true, "requires": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.1", @@ -626,7 +650,8 @@ "isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true } } }, @@ -634,6 +659,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -661,12 +687,14 @@ "fast-srp-hap": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fast-srp-hap/-/fast-srp-hap-2.0.2.tgz", - "integrity": "sha512-wABhZRrFhlovqJQ1HygOUB4R6WZW2hmlpvVYh2dVCy8BPLabDrB/Tu6XI3B4QfmhtHk8s1OeiFqJHY7FBsphug==" + "integrity": "sha512-wABhZRrFhlovqJQ1HygOUB4R6WZW2hmlpvVYh2dVCy8BPLabDrB/Tu6XI3B4QfmhtHk8s1OeiFqJHY7FBsphug==", + "dev": true }, "find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, "requires": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -675,7 +703,8 @@ "foreach": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true }, "form-data": { "version": "3.0.0", @@ -703,7 +732,8 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "function.name": { "version": "1.0.13", @@ -716,7 +746,8 @@ "futoin-hkdf": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/futoin-hkdf/-/futoin-hkdf-1.3.2.tgz", - "integrity": "sha512-3EVi3ETTyJg5PSXlxLCaUVVn0pSbDf62L3Gwxne7Uq+d8adOSNWQAad4gg7WToHkcgnCJb3Wlb1P8r4Evj4GPw==" + "integrity": "sha512-3EVi3ETTyJg5PSXlxLCaUVVn0pSbDf62L3Gwxne7Uq+d8adOSNWQAad4gg7WToHkcgnCJb3Wlb1P8r4Evj4GPw==", + "dev": true }, "gauge": { "version": "2.7.4", @@ -775,6 +806,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.1.tgz", "integrity": "sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg==", + "dev": true, "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -803,6 +835,7 @@ "version": "0.7.9", "resolved": "https://registry.npmjs.org/hap-nodejs/-/hap-nodejs-0.7.9.tgz", "integrity": "sha512-ic0H0iajNKKq8O2a5HJgZPaxwhgt0PjXZ/rZFGdGhtM+ivfi9LykkC1FZufjHljUhMTvWe1GYXQaF06UVWhyHA==", + "dev": true, "requires": { "bonjour-hap": "~3.5.11", "debug": "^4.1.1", @@ -817,6 +850,7 @@ "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, "requires": { "ms": "2.1.2" } @@ -827,6 +861,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -839,7 +874,8 @@ "has-symbols": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", - "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==" + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true }, "has-unicode": { "version": "2.0.1", @@ -850,6 +886,7 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/homebridge/-/homebridge-1.1.6.tgz", "integrity": "sha512-fsHEeUGp0t3Ry5Awc2U4LZraEHWmgnokUAa3JOfcTZOY9uxjv4buVMkBCa4CdMUCpMPL25Vit+I8doNqfn4Owg==", + "dev": true, "requires": { "chalk": "^4.1.0", "commander": "5.1.0", @@ -863,7 +900,8 @@ "semver": { "version": "7.3.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true } } }, @@ -914,32 +952,38 @@ "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", - "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=", + "dev": true }, "is-arguments": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", - "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==" + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", + "dev": true }, "is-bigint": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.0.tgz", - "integrity": "sha512-t5mGUXC/xRheCK431ylNiSkGGpBp8bHENBcENTkDT6ppwPzEVxNGZRvgvmOEfbWkFhA7D2GEuE2mmQTr78sl2g==" + "integrity": "sha512-t5mGUXC/xRheCK431ylNiSkGGpBp8bHENBcENTkDT6ppwPzEVxNGZRvgvmOEfbWkFhA7D2GEuE2mmQTr78sl2g==", + "dev": true }, "is-boolean-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.0.1.tgz", - "integrity": "sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ==" + "integrity": "sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ==", + "dev": true }, "is-callable": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", - "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==" + "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", + "dev": true }, "is-date-object": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==" + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true }, "is-fullwidth-code-point": { "version": "3.0.0", @@ -949,22 +993,26 @@ "is-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", - "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==" + "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", + "dev": true }, "is-negative-zero": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", - "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=" + "integrity": "sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE=", + "dev": true }, "is-number-object": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", - "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==" + "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", + "dev": true }, "is-regex": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", + "dev": true, "requires": { "has-symbols": "^1.0.1" } @@ -972,17 +1020,20 @@ "is-set": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz", - "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==" + "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==", + "dev": true }, "is-string": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==" + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true }, "is-symbol": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, "requires": { "has-symbols": "^1.0.1" } @@ -991,6 +1042,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.3.tgz", "integrity": "sha512-BSYUBOK/HJibQ30wWkWold5txYwMUXQct9YHAQJr8fSwvZoiglcqB0pd7vEN23+Tsi9IUEjztdOSzl4qLVYGTQ==", + "dev": true, "requires": { "available-typed-arrays": "^1.0.0", "es-abstract": "^1.17.4", @@ -1002,6 +1054,7 @@ "version": "1.17.7", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", + "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", @@ -1021,12 +1074,14 @@ "is-weakmap": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", - "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==" + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true }, "is-weakset": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.1.tgz", - "integrity": "sha512-pi4vhbhVHGLxohUw7PhGsueT4vRGFoXhP7+RGN0jKIv9+8PWYCQTqtADngrxOm2g46hoH0+g8uZZBzMrvVGDmw==" + "integrity": "sha512-pi4vhbhVHGLxohUw7PhGsueT4vRGFoXhP7+RGN0jKIv9+8PWYCQTqtADngrxOm2g46hoH0+g8uZZBzMrvVGDmw==", + "dev": true }, "isarray": { "version": "1.0.0", @@ -1042,6 +1097,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, "requires": { "p-locate": "^4.1.0" } @@ -1049,7 +1105,8 @@ "make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true }, "mime-db": { "version": "1.44.0", @@ -1116,6 +1173,7 @@ "version": "7.2.2", "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.2.tgz", "integrity": "sha512-XqSMeO8EWV/nOXOpPV8ztIpNweVfE1dSpz6SQvDPp71HD74lMXjt4m/mWB1YBMG0kHtOodxRWc5WOb/UNN1A5g==", + "dev": true, "requires": { "dns-packet": "^4.0.0", "thunky": "^1.0.2" @@ -1124,7 +1182,8 @@ "multicast-dns-service-types": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/multicast-dns-service-types/-/multicast-dns-service-types-1.1.0.tgz", - "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=" + "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", + "dev": true }, "nan": { "version": "2.14.2", @@ -1150,6 +1209,7 @@ "version": "0.0.11", "resolved": "https://registry.npmjs.org/node-persist/-/node-persist-0.0.11.tgz", "integrity": "sha1-1m66Pr72IPB5Uw+nsTB2qQZmWHQ=", + "dev": true, "requires": { "mkdirp": "~0.5.1", "q": "~1.1.1" @@ -1176,6 +1236,7 @@ "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" @@ -1184,12 +1245,14 @@ "isarray": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "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", @@ -1200,7 +1263,8 @@ "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true } } }, @@ -1265,12 +1329,14 @@ "object-inspect": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", - "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==" + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "dev": true }, "object-is": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.4.tgz", "integrity": "sha512-1ZvAZ4wlF7IyPVOcE1Omikt7UpaFlOQq0HlSti+ZvDH3UiD2brwGMwDbyV43jao2bKJ+4+WdPJHSd7kgzKYVqg==", + "dev": true, "requires": { "call-bind": "^1.0.0", "define-properties": "^1.1.3" @@ -1279,12 +1345,14 @@ "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true }, "object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, "requires": { "call-bind": "^1.0.0", "define-properties": "^1.1.3", @@ -1323,6 +1391,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, "requires": { "p-try": "^2.0.0" } @@ -1331,6 +1400,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, "requires": { "p-limit": "^2.2.0" } @@ -1338,12 +1408,14 @@ "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==" + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true }, "path-is-absolute": { "version": "1.0.1", @@ -1368,12 +1440,14 @@ "q": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/q/-/q-1.1.2.tgz", - "integrity": "sha1-Y1fikSBnAdmfGXq4TlforRlvKok=" + "integrity": "sha1-Y1fikSBnAdmfGXq4TlforRlvKok=", + "dev": true }, "qrcode-terminal": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz", - "integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==" + "integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==", + "dev": true }, "rc": { "version": "1.2.8", @@ -1409,6 +1483,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz", "integrity": "sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ==", + "dev": true, "requires": { "define-properties": "^1.1.3", "es-abstract": "^1.17.0-next.1" @@ -1418,6 +1493,7 @@ "version": "1.17.7", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", + "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", @@ -1442,7 +1518,8 @@ "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==" + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true }, "rimraf": { "version": "2.7.1", @@ -1517,6 +1594,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.3.tgz", "integrity": "sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g==", + "dev": true, "requires": { "es-abstract": "^1.18.0-next.0", "object-inspect": "^1.8.0" @@ -1545,12 +1623,14 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true }, "source-map-support": { "version": "0.5.19", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -1575,6 +1655,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.3.tgz", "integrity": "sha512-ayH0pB+uf0U28CtjlLvL7NaohvR1amUvVZk+y3DYb0Ey2PUV5zPkkKy9+U1ndVEIXO8hNg18eIv9Jntbii+dKw==", + "dev": true, "requires": { "call-bind": "^1.0.0", "define-properties": "^1.1.3" @@ -1584,6 +1665,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.3.tgz", "integrity": "sha512-oBIBUy5lea5tt0ovtOFiEQaBkoBBkyJhZXzJYrSmDo5IUUqbOPvVezuRs/agBIdZ2p2Eo1FD6bD9USyBLfl3xg==", + "dev": true, "requires": { "call-bind": "^1.0.0", "define-properties": "^1.1.3" @@ -1636,6 +1718,7 @@ "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" @@ -1644,12 +1727,14 @@ "thunky": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", - "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==" + "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", + "dev": true }, "ts-node": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", + "dev": true, "requires": { "arg": "^4.1.0", "diff": "^4.0.1", @@ -1674,12 +1759,14 @@ "tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", - "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "dev": true }, "typescript": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz", - "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==" + "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==", + "dev": true }, "typpy": { "version": "2.3.11", @@ -1692,7 +1779,8 @@ "untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==" + "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", + "dev": true }, "util-deprecate": { "version": "1.0.2", @@ -1711,6 +1799,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.1.tgz", "integrity": "sha512-7BT4TwISdDGBgaemWU0N0OU7FeAEJ9Oo2P1PHRm/FCWoEi2VLWC9b6xvxAA3C/NMpxg3HXVgi0sMmGbNUbNepQ==", + "dev": true, "requires": { "is-bigint": "^1.0.0", "is-boolean-object": "^1.0.0", @@ -1723,6 +1812,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, "requires": { "is-map": "^2.0.1", "is-set": "^2.0.1", @@ -1733,12 +1823,14 @@ "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true }, "which-typed-array": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.2.tgz", "integrity": "sha512-KT6okrd1tE6JdZAy3o2VhMoYPh3+J6EMZLyrxBQsZflI1QCZIxMrIYLkosd8Twf+YfknVIHmYQPgJt238p8dnQ==", + "dev": true, "requires": { "available-typed-arrays": "^1.0.2", "es-abstract": "^1.17.5", @@ -1752,6 +1844,7 @@ "version": "1.17.7", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.7.tgz", "integrity": "sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g==", + "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", @@ -1823,7 +1916,8 @@ "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true }, "y18n": { "version": "5.0.5", @@ -1857,7 +1951,8 @@ "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==" + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true } } } diff --git a/src/common.ts b/src/common.ts index 50d2541..803decb 100644 --- a/src/common.ts +++ b/src/common.ts @@ -15,13 +15,12 @@ export const getFaceDetectorOptions = (net: faceapi.NeuralNetwork) => { : new faceapi.TinyFaceDetectorOptions({ inputSize, scoreThreshold }); }; -export function saveFile(fileName: string, buf: Buffer) { - const baseDir = process.env.OUT_DIR as string; - if (!fs.existsSync(baseDir)) { - fs.mkdirSync(baseDir); +export function saveFile(basePath: string, fileName: string, buf: Buffer) { + if (!fs.existsSync(basePath)) { + fs.mkdirSync(basePath); } - fs.writeFileSync(path.resolve(baseDir, fileName), buf, "base64"); + fs.writeFileSync(path.resolve(basePath, fileName), buf, "base64"); } export const delay = (ms: number): Promise => { diff --git a/src/config.ts b/src/config.ts index 43559a1..9556ff7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -6,6 +6,7 @@ export interface IConfig extends PlatformConfig { weightDirectory: string; trainOnStartup: boolean; rooms: Array; + detectionTimeout: number; } export interface IRoom { diff --git a/src/events/event.ts b/src/events/event.ts new file mode 100644 index 0000000..2790a48 --- /dev/null +++ b/src/events/event.ts @@ -0,0 +1,12 @@ +import { EventDelegate } from "./eventDelegate"; + +export class Event extends Array> { + constructor() { + super(); + } + public fire = (source: T, args: K) => { + for (const delegate of this) { + delegate(source, args); + } + }; +} diff --git a/src/events/eventDelegate.ts b/src/events/eventDelegate.ts new file mode 100644 index 0000000..5f14e97 --- /dev/null +++ b/src/events/eventDelegate.ts @@ -0,0 +1 @@ +export type EventDelegate = (sender: T, args: K) => void; diff --git a/src/locationAccessory.ts b/src/locationAccessory.ts new file mode 100644 index 0000000..de1e1da --- /dev/null +++ b/src/locationAccessory.ts @@ -0,0 +1,91 @@ +import { + Service, + CharacteristicGetCallback, + PlatformAccessory, +} from "homebridge"; +import { Monitor, IStateChangeEventArgs } from "./monitor"; +import { HomeLocationPlatform } from "./platform"; +import { IRoom } from "./config"; + +/** + * Platform Accessory + * An instance of this class is created for each accessory your platform registers + * Each accessory may expose multiple services of different service types. + */ +export class LocationAccessory { + private _services: Array; + + constructor( + private readonly _platform: HomeLocationPlatform, + private readonly _accessory: PlatformAccessory, + private _monitor: Monitor, + private _room: IRoom + ) { + this._services = []; + // set accessory information + this._accessory + .getService(this._platform.Service.AccessoryInformation)! + .setCharacteristic( + this._platform.Characteristic.Manufacturer, + "Brandon Watson" + ) + .setCharacteristic( + this._platform.Characteristic.Model, + "Person Location Sensor" + ) + .setCharacteristic( + this._platform.Characteristic.SerialNumber, + "123-456-789" + ); + + //Init motion services + for (const label of this._monitor.labels) { + const newService = + this._accessory.getService(label) || + this._accessory.addService( + this._platform.Service.MotionSensor, + label, + this._room + label + ); + + newService + .getCharacteristic(this._platform.Characteristic.MotionDetected) + .on("get", (callback: CharacteristicGetCallback) => + this.onMotionDetectedGet(label, callback) + ); + + this._services.push(newService); + } + + //Register monitor state change events + this._monitor.stateChangedEvent.push(this.onMonitorStateChange.bind(this)); + } + + private onMotionDetectedGet = ( + label: string, + callback: CharacteristicGetCallback + ) => { + this._platform.log.debug("Triggered GET MotionDetected"); + + // set this to a valid value for MotionDetected + const currentValue = + this._monitor.getState(label) === this._room.name ? 1 : 0; + + callback(null, currentValue); + }; + + private onMonitorStateChange = ( + sender: Monitor, + args: IStateChangeEventArgs + ) => { + const service = this._services.find( + (service) => service.displayName == args.label + ); + if (service) { + service.setCharacteristic( + this._platform.Characteristic.MotionDetected, + args.new === this._room.name + ); + } + }; +} diff --git a/src/locationMonitor.ts b/src/locationMonitor.ts deleted file mode 100644 index e63f20c..0000000 --- a/src/locationMonitor.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { FaceMatcher } from "@vladmandic/face-api"; -import { IRoom } from "./config"; -import { Rtsp } from "rtsp-stream/lib"; - -export interface ILabelState { - label: string; - detected: boolean; -} - -export type IRoomState = { [roomName: string]: Array }; - -export class LocationMonitor { - private _state: IRoomState = {}; - - private _streams: Array = []; - - constructor(private rooms: Array, private matcher: FaceMatcher) { - //Initialize state - for (const room of rooms) { - this._streams.push( - ...room.rtspConnectionStrings.map( - (e) => new Rtsp(e, { rate: 0.5, image: true }) - ) - ); - - this._state[room.name] = matcher.labeledDescriptors.map((e) => { - return { label: e.label, detected: false }; - }); - } - } - - public get state(): IRoomState { - return this._state; - } - - private async startStreams() {} - - private async stopStreams() {} -} diff --git a/src/monitor.ts b/src/monitor.ts new file mode 100644 index 0000000..dac9842 --- /dev/null +++ b/src/monitor.ts @@ -0,0 +1,151 @@ +import { FaceMatcher } from "@vladmandic/face-api"; +import { IRoom } from "./config"; +import { Rtsp } from "rtsp-stream/lib"; +import canvas from "canvas"; +import * as faceapi from "@vladmandic/face-api"; +import { getFaceDetectorOptions, saveFile } from "./common"; +import { nets } from "@vladmandic/face-api"; +import { Logger } from "homebridge"; +import { Event } from "./events/event"; +const { Canvas, Image, ImageData } = canvas; + +export type MonitorState = { [label: string]: string | null }; +export interface IStateChangeEventArgs { + label: string; + old: string | null; + new: string; +} + +export class Monitor { + private _state: MonitorState = {}; + private _streamsByRoom: { [roomName: string]: Array } = {}; + private _faceDetectionNet = nets.ssdMobilenetv1; + private _stateChangedEvent: Event; + + constructor( + private _rooms: Array, + private _matcher: FaceMatcher, + private _logger: Logger + ) { + this._stateChangedEvent = new Event(); + + //Initialize state + for (const room of this._rooms) { + this._streamsByRoom[room.name] = [ + ...room.rtspConnectionStrings.map((connectionString) => { + return new Rtsp(connectionString, { + rate: 0.5, + image: true, + }) + .on("data", async (data: Buffer) => this.onData(room.name, data)) + .on("error", async (error: string) => + this.onError(error, connectionString) + ); + }), + ]; + + _matcher.labeledDescriptors.forEach((descriptor) => { + this._state[descriptor.label] = null; + }); + } + } + + /** + * @method getState + * + * @param label The name of the label to retrieve state for + * + * The last known room of the requested label + */ + public getState(label: string): string | null { + return this._state[label]; + } + + /** + * @property labels + * + * Gets the list of labels associated with the monitor + */ + public get labels(): Array { + return this._matcher.labeledDescriptors + .map((descriptor) => descriptor.label) + .filter( + (label: string, index: number, array: Array) => + array.indexOf(label) === index + ); + } + + public get stateChangedEvent(): Event { + return this._stateChangedEvent; + } + + /** + * @method startStreams + * + * Starts monitoring rtsp streams + */ + public startStreams() { + for (const key in this._streamsByRoom) { + for (const stream of this._streamsByRoom[key]) { + stream.start(); + } + } + } + + /** + * @method closeStreams + * + * Stops monitoring rtsp streams + */ + public closeStreams() { + for (const key in this._streamsByRoom) { + for (const stream of this._streamsByRoom[key]) { + stream.close(); + } + } + } + + private onData = async (room: string, data: Buffer) => { + const input = ((await canvas.loadImage(data)) as unknown) as ImageData; + const out = faceapi.createCanvasFromMedia(input); + const resultsQuery = await faceapi + .detectAllFaces(out, getFaceDetectorOptions(this._faceDetectionNet)) + .withFaceLandmarks() + .withFaceDescriptors(); + switch (room) { + case "Kitchen": { + saveFile( + "/Users/brandonwatson/Documents/Git/Gitea/homebridge-face-location/out", + "Kitchen.jpg", + data + ); + break; + } + case "LivingRoom": { + saveFile( + "/Users/brandonwatson/Documents/Git/Gitea/homebridge-face-location/out", + "LivingRoom.jpg", + data + ); + break; + } + } + + for (const res of resultsQuery) { + const bestMatch = this._matcher.matchDescriptor(res.descriptor); + const old = this._state[bestMatch.label]; + this._state[bestMatch.label] = room; + this._stateChangedEvent.fire(this, { + old: old, + new: room, + label: bestMatch.label, + }); + + this._logger.info(`Face Detected: ${bestMatch.label} in room ${room}`); + } + }; + + private onError = async (error: string, streamName: string) => { + this._logger.info(`[${streamName}] ${error}`); + }; +} diff --git a/src/monitorAccessory.ts b/src/monitorAccessory.ts deleted file mode 100644 index 8a7ea6f..0000000 --- a/src/monitorAccessory.ts +++ /dev/null @@ -1,191 +0,0 @@ -import { - Service, - PlatformAccessory, - CharacteristicValue, - CharacteristicSetCallback, - CharacteristicGetCallback, -} from "homebridge"; -import { LocationMonitor } from "./locationMonitor"; -import { HomeLocationPlatform } from "./platform"; - -/** - * Platform Accessory - * An instance of this class is created for each accessory your platform registers - * Each accessory may expose multiple services of different service types. - */ -export class MonitorAccessory { - private service: Service; - - /** - * These are just used to create a working example - * You should implement your own code to track the state of your accessory - */ - private exampleStates = { - On: false, - Brightness: 100, - }; - - constructor( - private readonly platform: HomeLocationPlatform, - private readonly accessory: PlatformAccessory, - private monitor: LocationMonitor - ) { - // set accessory information - this.accessory - .getService(this.platform.Service.AccessoryInformation)! - .setCharacteristic( - this.platform.Characteristic.Manufacturer, - "Default-Manufacturer" - ) - .setCharacteristic(this.platform.Characteristic.Model, "Default-Model") - .setCharacteristic( - this.platform.Characteristic.SerialNumber, - "Default-Serial" - ); - - // get the MotionSensor service if it exists, otherwise create a new MotionSensor service - // you can create multiple services for each accessory - this.service = - this.accessory.getService(this.platform.Service.MotionSensor) || - this.accessory.addService(this.platform.Service.MotionSensor); - - // set the service name, this is what is displayed as the default name on the Home app - // in this example we are using the name we stored in the `accessory.context` in the `discoverDevices` method. - this.service.setCharacteristic( - this.platform.Characteristic.Name, - accessory.context["DeviceName"] - ); - - // each service must implement at-minimum the "required characteristics" for the given service type - // see https://developers.homebridge.io/#/service/Lightbulb - - // register handlers for the On/Off Characteristic - this.service - .getCharacteristic(this.platform.Characteristic.On) - .on("set", this.setOn.bind(this)) // SET - bind to the `setOn` method below - .on("get", this.getOn.bind(this)); // GET - bind to the `getOn` method below - - // register handlers for the Brightness Characteristic - this.service - .getCharacteristic(this.platform.Characteristic.Brightness) - .on("set", this.setBrightness.bind(this)); // SET - bind to the 'setBrightness` method below - - /** - * Creating multiple services of the same type. - * - * To avoid "Cannot add a Service with the same UUID another Service without also defining a unique 'subtype' property." error, - * when creating multiple services of the same type, you need to use the following syntax to specify a name and subtype id: - * this.accessory.getService('NAME') || this.accessory.addService(this.platform.Service.Lightbulb, 'NAME', 'USER_DEFINED_SUBTYPE_ID'); - * - * The USER_DEFINED_SUBTYPE must be unique to the platform accessory (if you platform exposes multiple accessories, each accessory - * can use the same sub type id.) - */ - - // Example: add two "motion sensor" services to the accessory - const motionSensorOneService = - this.accessory.getService("Motion Sensor One Name") || - this.accessory.addService( - this.platform.Service.MotionSensor, - "Motion Sensor One Name", - "YourUniqueIdentifier-1" - ); - - const motionSensorTwoService = - this.accessory.getService("Motion Sensor Two Name") || - this.accessory.addService( - this.platform.Service.MotionSensor, - "Motion Sensor Two Name", - "YourUniqueIdentifier-2" - ); - - /** - * Updating characteristics values asynchronously. - * - * Example showing how to update the state of a Characteristic asynchronously instead - * of using the `on('get')` handlers. - * Here we change update the motion sensor trigger states on and off every 10 seconds - * the `updateCharacteristic` method. - * - */ - let motionDetected = false; - setInterval(() => { - // EXAMPLE - inverse the trigger - motionDetected = !motionDetected; - - // push the new value to HomeKit - motionSensorOneService.updateCharacteristic( - this.platform.Characteristic.MotionDetected, - motionDetected - ); - motionSensorTwoService.updateCharacteristic( - this.platform.Characteristic.MotionDetected, - !motionDetected - ); - - this.platform.log.debug( - "Triggering motionSensorOneService:", - motionDetected - ); - this.platform.log.debug( - "Triggering motionSensorTwoService:", - !motionDetected - ); - }, 10000); - } - - /** - * Handle "SET" requests from HomeKit - * These are sent when the user changes the state of an accessory, for example, turning on a Light bulb. - */ - setOn(value: CharacteristicValue, callback: CharacteristicSetCallback) { - // implement your own code to turn your device on/off - this.exampleStates.On = value as boolean; - - this.platform.log.debug("Set Characteristic On ->", value); - - // you must call the callback function - callback(null); - } - - /** - * Handle the "GET" requests from HomeKit - * These are sent when HomeKit wants to know the current state of the accessory, for example, checking if a Light bulb is on. - * - * GET requests should return as fast as possbile. A long delay here will result in - * HomeKit being unresponsive and a bad user experience in general. - * - * If your device takes time to respond you should update the status of your device - * asynchronously instead using the `updateCharacteristic` method instead. - - * @example - * this.service.updateCharacteristic(this.platform.Characteristic.On, true) - */ - getOn(callback: CharacteristicGetCallback) { - // implement your own code to check if the device is on - const isOn = this.exampleStates.On; - - this.platform.log.debug("Get Characteristic On ->", isOn); - - // you must call the callback function - // the first argument should be null if there were no errors - // the second argument should be the value to return - callback(null, isOn); - } - - /** - * Handle "SET" requests from HomeKit - * These are sent when the user changes the state of an accessory, for example, changing the Brightness - */ - setBrightness( - value: CharacteristicValue, - callback: CharacteristicSetCallback - ) { - // implement your own code to set the brightness - this.exampleStates.Brightness = value as number; - - this.platform.log.debug("Set Characteristic Brightness -> ", value); - - // you must call the callback function - callback(null); - } -} diff --git a/src/platform.ts b/src/platform.ts index 2291199..4ed8792 100644 --- a/src/platform.ts +++ b/src/platform.ts @@ -19,7 +19,7 @@ import { FaceMatcher, } from "@vladmandic/face-api"; import * as mime from "mime-types"; -import { LocationMonitor } from "./locationMonitor"; +import { Monitor } from "./monitor"; import { getFaceDetectorOptions } from "./common"; require("@tensorflow/tfjs-node"); @@ -28,7 +28,7 @@ const { Canvas, Image, ImageData } = canvas; faceapi.env.monkeyPatch({ Canvas, Image, ImageData }); import { PLATFORM_NAME, PLUGIN_NAME } from "./settings"; -import { MonitorAccessory } from "./monitorAccessory"; +import { LocationAccessory } from "./locationAccessory"; /** * HomebridgePlatform @@ -100,43 +100,44 @@ export class HomeLocationPlatform implements DynamicPlatformPlugin { faceMatcher = FaceMatcher.fromJSON(JSON.parse(raw)); } - const locationMonitor = new LocationMonitor(this.config.rooms, faceMatcher); + const locationMonitor = new Monitor( + this.config.rooms, + faceMatcher, + this.log + ); + + locationMonitor.startStreams(); const labels = faceMatcher.labeledDescriptors.map((e) => e.label); for (const room of this.config.rooms) { - for (const label of labels) { - const uuid = this.api.hap.uuid.generate(room.name + label); + const uuid = this.api.hap.uuid.generate(room.name); - const existingAccessory = this.accessories.find((e) => e.UUID === uuid); - if (existingAccessory) { - this.log.info( - "Restoring existing accessory from cache: ", - existingAccessory.displayName - ); + const existingAccessory = this.accessories.find((e) => e.UUID === uuid); + if (existingAccessory) { + this.log.info( + "Restoring existing accessory from cache: ", + existingAccessory.displayName + ); - new MonitorAccessory(this, existingAccessory, locationMonitor); + new LocationAccessory(this, existingAccessory, locationMonitor, room); - this.api.updatePlatformAccessories([existingAccessory]); - } else { - this.log.info("Adding new accessory:", `${room.name}+${label}`); + this.api.updatePlatformAccessories([existingAccessory]); + } else { + this.log.info("Adding new accessory:", `${room.name}`); - // create a new accessory - const accessory = new this.api.platformAccessory( - `${room.name} ${label}`, - uuid - ); + // create a new accessory + const accessory = new this.api.platformAccessory(`${room.name}`, uuid); - accessory.context["DeviceName"] = `${room.name} ${label}`; + accessory.context["DeviceName"] = `${room.name}`; - // create the accessory handler for the newly create accessory - // this is imported from `platformAccessory.ts` - new MonitorAccessory(this, accessory, locationMonitor); + // create the accessory handler for the newly create accessory + // this is imported from `platformAccessory.ts` + new LocationAccessory(this, accessory, locationMonitor, room); - // link the accessory to your platform - this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [ - accessory, - ]); - } + // link the accessory to your platform + this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [ + accessory, + ]); } } }