From 639857ec6478fd4e04aa71b56c46d9858774dc4e Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Fri, 12 Nov 2021 00:20:12 -0800 Subject: [PATCH] server: missing mixin log spam fix --- server/package-lock.json | 212 ++++++++++++++++++++++------- server/package.json | 2 +- server/src/plugin/plugin-device.ts | 10 +- 3 files changed, 169 insertions(+), 55 deletions(-) diff --git a/server/package-lock.json b/server/package-lock.json index d2e76efb7..4388a8af4 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/server", - "version": "0.0.68", + "version": "0.0.69", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/server", - "version": "0.0.68", + "version": "0.0.69", "license": "ISC", "dependencies": { "@scrypted/sdk": "^0.0.111", @@ -636,6 +636,7 @@ "version": "1.0.6", "inBundle": true, "license": "BSD-3-Clause", + "optional": true, "dependencies": { "detect-libc": "^1.0.3", "https-proxy-agent": "^5.0.0", @@ -655,6 +656,7 @@ "version": "6.0.0", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "yallist": "^4.0.0" }, @@ -666,6 +668,7 @@ "version": "3.0.2", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "glob": "^7.1.3" }, @@ -680,6 +683,7 @@ "version": "7.3.5", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -693,12 +697,14 @@ "node_modules/@koush/wrtc/node_modules/abbrev": { "version": "1.1.1", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/agent-base": { "version": "6.0.2", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "debug": "4" }, @@ -710,6 +716,7 @@ "version": "4.3.2", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "ms": "2.1.2" }, @@ -725,12 +732,14 @@ "node_modules/@koush/wrtc/node_modules/agent-base/node_modules/ms": { "version": "2.1.2", "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/@koush/wrtc/node_modules/ansi-regex": { "version": "3.0.0", "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=4" } @@ -738,12 +747,14 @@ "node_modules/@koush/wrtc/node_modules/aproba": { "version": "2.0.0", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/are-we-there-yet": { "version": "2.0.0", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "delegates": "^1.0.0", "readable-stream": "^3.6.0" @@ -756,6 +767,7 @@ "version": "3.6.0", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -768,12 +780,14 @@ "node_modules/@koush/wrtc/node_modules/balanced-match": { "version": "1.0.2", "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/@koush/wrtc/node_modules/brace-expansion": { "version": "1.1.11", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -783,6 +797,7 @@ "version": "2.0.0", "inBundle": true, "license": "ISC", + "optional": true, "engines": { "node": ">=10" } @@ -791,6 +806,7 @@ "version": "1.1.3", "inBundle": true, "license": "ISC", + "optional": true, "bin": { "color-support": "bin.js" } @@ -798,22 +814,26 @@ "node_modules/@koush/wrtc/node_modules/concat-map": { "version": "0.0.1", "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/@koush/wrtc/node_modules/console-control-strings": { "version": "1.1.0", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/delegates": { "version": "1.0.0", "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/@koush/wrtc/node_modules/detect-libc": { "version": "1.0.3", "inBundle": true, "license": "Apache-2.0", + "optional": true, "bin": { "detect-libc": "bin/detect-libc.js" }, @@ -825,6 +845,7 @@ "version": "2.1.0", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "minipass": "^3.0.0" }, @@ -835,12 +856,14 @@ "node_modules/@koush/wrtc/node_modules/fs.realpath": { "version": "1.0.0", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/gauge": { "version": "3.0.1", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "aproba": "^1.0.3 || ^2.0.0", "color-support": "^1.1.2", @@ -860,6 +883,7 @@ "version": "7.2.0", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -878,12 +902,14 @@ "node_modules/@koush/wrtc/node_modules/has-unicode": { "version": "2.0.1", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/https-proxy-agent": { "version": "5.0.0", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -896,6 +922,7 @@ "version": "4.3.2", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "ms": "2.1.2" }, @@ -911,12 +938,14 @@ "node_modules/@koush/wrtc/node_modules/https-proxy-agent/node_modules/ms": { "version": "2.1.2", "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/@koush/wrtc/node_modules/inflight": { "version": "1.0.6", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -925,12 +954,14 @@ "node_modules/@koush/wrtc/node_modules/inherits": { "version": "2.0.4", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/is-fullwidth-code-point": { "version": "2.0.0", "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=4" } @@ -939,6 +970,7 @@ "version": "3.1.0", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "semver": "^6.0.0" }, @@ -953,6 +985,7 @@ "version": "6.3.0", "inBundle": true, "license": "ISC", + "optional": true, "bin": { "semver": "bin/semver.js" } @@ -961,6 +994,7 @@ "version": "3.0.4", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -972,6 +1006,7 @@ "version": "3.1.5", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "yallist": "^4.0.0" }, @@ -983,6 +1018,7 @@ "version": "2.1.2", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "minipass": "^3.0.0", "yallist": "^4.0.0" @@ -995,6 +1031,7 @@ "version": "2.6.6", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -1005,17 +1042,20 @@ "node_modules/@koush/wrtc/node_modules/node-fetch/node_modules/tr46": { "version": "0.0.3", "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/@koush/wrtc/node_modules/node-fetch/node_modules/webidl-conversions": { "version": "3.0.1", "inBundle": true, - "license": "BSD-2-Clause" + "license": "BSD-2-Clause", + "optional": true }, "node_modules/@koush/wrtc/node_modules/node-fetch/node_modules/whatwg-url": { "version": "5.0.0", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -1025,6 +1065,7 @@ "version": "5.0.0", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "abbrev": "1" }, @@ -1039,6 +1080,7 @@ "version": "5.0.1", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "are-we-there-yet": "^2.0.0", "console-control-strings": "^1.1.0", @@ -1050,6 +1092,7 @@ "version": "4.1.1", "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } @@ -1058,6 +1101,7 @@ "version": "1.4.0", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "wrappy": "1" } @@ -1066,6 +1110,7 @@ "version": "1.0.1", "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } @@ -1087,22 +1132,26 @@ } ], "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/@koush/wrtc/node_modules/set-blocking": { "version": "2.0.0", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/signal-exit": { "version": "3.0.5", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/string_decoder": { "version": "1.3.0", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -1111,6 +1160,7 @@ "version": "2.1.1", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" @@ -1123,6 +1173,7 @@ "version": "4.0.0", "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "ansi-regex": "^3.0.0" }, @@ -1134,6 +1185,7 @@ "version": "6.1.11", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -1150,6 +1202,7 @@ "version": "1.0.4", "inBundle": true, "license": "MIT", + "optional": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -1160,12 +1213,14 @@ "node_modules/@koush/wrtc/node_modules/util-deprecate": { "version": "1.0.2", "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/@koush/wrtc/node_modules/wide-align": { "version": "1.1.5", "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "string-width": "^1.0.2 || 2 || 3 || 4" } @@ -1173,12 +1228,14 @@ "node_modules/@koush/wrtc/node_modules/wrappy": { "version": "1.0.2", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@koush/wrtc/node_modules/yallist": { "version": "4.0.0", "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/@mapbox/node-pre-gyp": { "version": "1.0.6", @@ -6577,6 +6634,7 @@ "@mapbox/node-pre-gyp": { "version": "1.0.6", "bundled": true, + "optional": true, "requires": { "detect-libc": "^1.0.3", "https-proxy-agent": "^5.0.0", @@ -6592,6 +6650,7 @@ "lru-cache": { "version": "6.0.0", "bundled": true, + "optional": true, "requires": { "yallist": "^4.0.0" } @@ -6599,6 +6658,7 @@ "rimraf": { "version": "3.0.2", "bundled": true, + "optional": true, "requires": { "glob": "^7.1.3" } @@ -6606,6 +6666,7 @@ "semver": { "version": "7.3.5", "bundled": true, + "optional": true, "requires": { "lru-cache": "^6.0.0" } @@ -6614,11 +6675,13 @@ }, "abbrev": { "version": "1.1.1", - "bundled": true + "bundled": true, + "optional": true }, "agent-base": { "version": "6.0.2", "bundled": true, + "optional": true, "requires": { "debug": "4" }, @@ -6626,27 +6689,32 @@ "debug": { "version": "4.3.2", "bundled": true, + "optional": true, "requires": { "ms": "2.1.2" } }, "ms": { "version": "2.1.2", - "bundled": true + "bundled": true, + "optional": true } } }, "ansi-regex": { "version": "3.0.0", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "2.0.0", - "bundled": true + "bundled": true, + "optional": true }, "are-we-there-yet": { "version": "2.0.0", "bundled": true, + "optional": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^3.6.0" @@ -6655,6 +6723,7 @@ "readable-stream": { "version": "3.6.0", "bundled": true, + "optional": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -6665,11 +6734,13 @@ }, "balanced-match": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6677,42 +6748,51 @@ }, "chownr": { "version": "2.0.0", - "bundled": true + "bundled": true, + "optional": true }, "color-support": { "version": "1.1.3", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "delegates": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "detect-libc": { "version": "1.0.3", - "bundled": true + "bundled": true, + "optional": true }, "fs-minipass": { "version": "2.1.0", "bundled": true, + "optional": true, "requires": { "minipass": "^3.0.0" } }, "fs.realpath": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "gauge": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "aproba": "^1.0.3 || ^2.0.0", "color-support": "^1.1.2", @@ -6728,6 +6808,7 @@ "glob": { "version": "7.2.0", "bundled": true, + "optional": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -6739,11 +6820,13 @@ }, "has-unicode": { "version": "2.0.1", - "bundled": true + "bundled": true, + "optional": true }, "https-proxy-agent": { "version": "5.0.0", "bundled": true, + "optional": true, "requires": { "agent-base": "6", "debug": "4" @@ -6752,19 +6835,22 @@ "debug": { "version": "4.3.2", "bundled": true, + "optional": true, "requires": { "ms": "2.1.2" } }, "ms": { "version": "2.1.2", - "bundled": true + "bundled": true, + "optional": true } } }, "inflight": { "version": "1.0.6", "bundled": true, + "optional": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -6772,28 +6858,33 @@ }, "inherits": { "version": "2.0.4", - "bundled": true + "bundled": true, + "optional": true }, "is-fullwidth-code-point": { "version": "2.0.0", - "bundled": true + "bundled": true, + "optional": true }, "make-dir": { "version": "3.1.0", "bundled": true, + "optional": true, "requires": { "semver": "^6.0.0" }, "dependencies": { "semver": { "version": "6.3.0", - "bundled": true + "bundled": true, + "optional": true } } }, "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -6801,6 +6892,7 @@ "minipass": { "version": "3.1.5", "bundled": true, + "optional": true, "requires": { "yallist": "^4.0.0" } @@ -6808,6 +6900,7 @@ "minizlib": { "version": "2.1.2", "bundled": true, + "optional": true, "requires": { "minipass": "^3.0.0", "yallist": "^4.0.0" @@ -6816,21 +6909,25 @@ "node-fetch": { "version": "2.6.6", "bundled": true, + "optional": true, "requires": { "whatwg-url": "^5.0.0" }, "dependencies": { "tr46": { "version": "0.0.3", - "bundled": true + "bundled": true, + "optional": true }, "webidl-conversions": { "version": "3.0.1", - "bundled": true + "bundled": true, + "optional": true }, "whatwg-url": { "version": "5.0.0", "bundled": true, + "optional": true, "requires": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -6841,6 +6938,7 @@ "nopt": { "version": "5.0.0", "bundled": true, + "optional": true, "requires": { "abbrev": "1" } @@ -6848,6 +6946,7 @@ "npmlog": { "version": "5.0.1", "bundled": true, + "optional": true, "requires": { "are-we-there-yet": "^2.0.0", "console-control-strings": "^1.1.0", @@ -6857,34 +6956,41 @@ }, "object-assign": { "version": "4.1.1", - "bundled": true + "bundled": true, + "optional": true }, "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } }, "path-is-absolute": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "safe-buffer": { "version": "5.2.1", - "bundled": true + "bundled": true, + "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true + "bundled": true, + "optional": true }, "signal-exit": { "version": "3.0.5", - "bundled": true + "bundled": true, + "optional": true }, "string_decoder": { "version": "1.3.0", "bundled": true, + "optional": true, "requires": { "safe-buffer": "~5.2.0" } @@ -6892,6 +6998,7 @@ "string-width": { "version": "2.1.1", "bundled": true, + "optional": true, "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" @@ -6900,6 +7007,7 @@ "strip-ansi": { "version": "4.0.0", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^3.0.0" } @@ -6907,6 +7015,7 @@ "tar": { "version": "6.1.11", "bundled": true, + "optional": true, "requires": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -6918,28 +7027,33 @@ "dependencies": { "mkdirp": { "version": "1.0.4", - "bundled": true + "bundled": true, + "optional": true } } }, "util-deprecate": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "wide-align": { "version": "1.1.5", "bundled": true, + "optional": true, "requires": { "string-width": "^1.0.2 || 2 || 3 || 4" } }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "4.0.0", - "bundled": true + "bundled": true, + "optional": true } } }, diff --git a/server/package.json b/server/package.json index 585f252fe..12f987222 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/server", - "version": "0.0.68", + "version": "0.0.69", "description": "", "dependencies": { "@scrypted/sdk": "^0.0.111", diff --git a/server/src/plugin/plugin-device.ts b/server/src/plugin/plugin-device.ts index b994835fa..c76cb838e 100644 --- a/server/src/plugin/plugin-device.ts +++ b/server/src/plugin/plugin-device.ts @@ -75,12 +75,8 @@ export class PluginDeviceProxyHandler implements ProxyHandler, ScryptedDevi for (const mixinId of getState(pluginDevice, ScryptedInterfaceProperty.mixins) || []) { const mixinProvider = this.scrypted.getDevice(mixinId) as ScryptedDevice & MixinProvider; - const wrappedHandler = new PluginDeviceProxyHandler(this.scrypted, this.id); - wrappedHandler.mixinTable = Promise.resolve(mixinTable.slice()); - const wrappedProxy = new Proxy(wrappedHandler, wrappedHandler); - try { - const interfaces = await mixinProvider.canMixin(type, allInterfaces) as any as ScryptedInterface[]; + const interfaces = await mixinProvider?.canMixin(type, allInterfaces) as any as ScryptedInterface[]; if (!interfaces) { console.warn(`mixin provider ${mixinId} can no longer mixin ${this.id}`); const mixins: string[] = getState(pluginDevice, ScryptedInterfaceProperty.mixins) || []; @@ -89,6 +85,10 @@ export class PluginDeviceProxyHandler implements ProxyHandler, ScryptedDevi continue; } + const wrappedHandler = new PluginDeviceProxyHandler(this.scrypted, this.id); + wrappedHandler.mixinTable = Promise.resolve(mixinTable.slice()); + const wrappedProxy = new Proxy(wrappedHandler, wrappedHandler); + const host = this.scrypted.getPluginHostForDeviceId(mixinId); const deviceState = await host.remote.createDeviceState(this.id, async (property, value) => this.scrypted.stateManager.setPluginDeviceState(pluginDevice, property, value));