server: mixin table refactor

This commit is contained in:
Koushik Dutta
2021-12-10 11:39:06 -08:00
parent 6bb3c61b62
commit bb1ffdea25
5 changed files with 172 additions and 86 deletions

View File

@@ -427,14 +427,35 @@ export class ScryptedRuntime {
}
// should this be async?
invalidatePluginDeviceMixins(id: string) {
rebuildPluginDeviceMixinTable(id: string) {
const proxyPair = this.devices[id];
if (!proxyPair)
return;
proxyPair.handler.invalidateMixinTable();
proxyPair.handler.rebuildMixinTable();
return proxyPair;
}
invalidateMixins(mixinIds: Set<string>) {
// const ret = new Set(mixinIds);
// for (const device of Object.values(this.devices)) {
// const pluginDevice = this.pluginDevices[device.handler.id];
// if (ret.has(pluginDevice._id))
// continue;
// if (!pluginDevice) {
// console.warn('PluginDevice missing?', device.handler.id);
// continue;
// }
// for (const mixin of getState(pluginDevice, ScryptedInterfaceProperty.mixins) || []) {
// if (this.scrypted.findPluginDeviceById(mixin)?.pluginId === this.pluginId) {
// device.handler.invalidate();
// }
// }
// }
// return ret;
}
async installNpm(pkg: string, version?: string): Promise<PluginHost> {
const registry = (await axios(`https://registry.npmjs.org/${pkg}`)).data;
if (!version) {