@scrypted/server 0.7.92 → 0.7.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @scrypted/server might be problematic. Click here for more details.
- package/package.json +1 -1
- package/dist/asynciterable-utils.d.ts +0 -2
- package/dist/asynciterable-utils.js +0 -24
- package/dist/asynciterable-utils.js.map +0 -1
- package/dist/cert.d.ts +0 -6
- package/dist/cert.js +0 -75
- package/dist/cert.js.map +0 -1
- package/dist/collection.d.ts +0 -1
- package/dist/collection.js +0 -16
- package/dist/collection.js.map +0 -1
- package/dist/db-types.d.ts +0 -38
- package/dist/db-types.js +0 -45
- package/dist/db-types.js.map +0 -1
- package/dist/event-registry.d.ts +0 -19
- package/dist/event-registry.js +0 -92
- package/dist/event-registry.js.map +0 -1
- package/dist/http-interfaces.d.ts +0 -3
- package/dist/http-interfaces.js +0 -73
- package/dist/http-interfaces.js.map +0 -1
- package/dist/infer-defaults.d.ts +0 -11
- package/dist/infer-defaults.js +0 -119
- package/dist/infer-defaults.js.map +0 -1
- package/dist/io.d.ts +0 -22
- package/dist/io.js +0 -3
- package/dist/io.js.map +0 -1
- package/dist/level.d.ts +0 -110
- package/dist/level.js +0 -135
- package/dist/level.js.map +0 -1
- package/dist/listen-zero.d.ts +0 -13
- package/dist/listen-zero.js +0 -48
- package/dist/listen-zero.js.map +0 -1
- package/dist/logger.d.ts +0 -29
- package/dist/logger.js +0 -78
- package/dist/logger.js.map +0 -1
- package/dist/media-helpers.d.ts +0 -5
- package/dist/media-helpers.js +0 -89
- package/dist/media-helpers.js.map +0 -1
- package/dist/mixin/mixin-cycle.d.ts +0 -3
- package/dist/mixin/mixin-cycle.js +0 -32
- package/dist/mixin/mixin-cycle.js.map +0 -1
- package/dist/plugin/acl.d.ts +0 -16
- package/dist/plugin/acl.js +0 -83
- package/dist/plugin/acl.js.map +0 -1
- package/dist/plugin/descriptor.d.ts +0 -22
- package/dist/plugin/descriptor.js +0 -35
- package/dist/plugin/descriptor.js.map +0 -1
- package/dist/plugin/media.d.ts +0 -71
- package/dist/plugin/media.js +0 -420
- package/dist/plugin/media.js.map +0 -1
- package/dist/plugin/mediaobject.d.ts +0 -10
- package/dist/plugin/mediaobject.js +0 -26
- package/dist/plugin/mediaobject.js.map +0 -1
- package/dist/plugin/plugin-api.d.ts +0 -106
- package/dist/plugin/plugin-api.js +0 -120
- package/dist/plugin/plugin-api.js.map +0 -1
- package/dist/plugin/plugin-console.d.ts +0 -28
- package/dist/plugin/plugin-console.js +0 -291
- package/dist/plugin/plugin-console.js.map +0 -1
- package/dist/plugin/plugin-debug.d.ts +0 -4
- package/dist/plugin/plugin-debug.js +0 -3
- package/dist/plugin/plugin-debug.js.map +0 -1
- package/dist/plugin/plugin-device.d.ts +0 -54
- package/dist/plugin/plugin-device.js +0 -413
- package/dist/plugin/plugin-device.js.map +0 -1
- package/dist/plugin/plugin-error.d.ts +0 -2
- package/dist/plugin/plugin-error.js +0 -7
- package/dist/plugin/plugin-error.js.map +0 -1
- package/dist/plugin/plugin-host-api.d.ts +0 -43
- package/dist/plugin/plugin-host-api.js +0 -177
- package/dist/plugin/plugin-host-api.js.map +0 -1
- package/dist/plugin/plugin-host.d.ts +0 -45
- package/dist/plugin/plugin-host.js +0 -398
- package/dist/plugin/plugin-host.js.map +0 -1
- package/dist/plugin/plugin-http.d.ts +0 -18
- package/dist/plugin/plugin-http.js +0 -120
- package/dist/plugin/plugin-http.js.map +0 -1
- package/dist/plugin/plugin-lazy-remote.d.ts +0 -31
- package/dist/plugin/plugin-lazy-remote.js +0 -75
- package/dist/plugin/plugin-lazy-remote.js.map +0 -1
- package/dist/plugin/plugin-npm-dependencies.d.ts +0 -8
- package/dist/plugin/plugin-npm-dependencies.js +0 -103
- package/dist/plugin/plugin-npm-dependencies.js.map +0 -1
- package/dist/plugin/plugin-remote-stats.d.ts +0 -8
- package/dist/plugin/plugin-remote-stats.js +0 -30
- package/dist/plugin/plugin-remote-stats.js.map +0 -1
- package/dist/plugin/plugin-remote-websocket.d.ts +0 -29
- package/dist/plugin/plugin-remote-websocket.js +0 -152
- package/dist/plugin/plugin-remote-websocket.js.map +0 -1
- package/dist/plugin/plugin-remote-worker.d.ts +0 -5
- package/dist/plugin/plugin-remote-worker.js +0 -348
- package/dist/plugin/plugin-remote-worker.js.map +0 -1
- package/dist/plugin/plugin-remote.d.ts +0 -75
- package/dist/plugin/plugin-remote.js +0 -598
- package/dist/plugin/plugin-remote.js.map +0 -1
- package/dist/plugin/plugin-repl.d.ts +0 -2
- package/dist/plugin/plugin-repl.js +0 -74
- package/dist/plugin/plugin-repl.js.map +0 -1
- package/dist/plugin/plugin-state-check.d.ts +0 -1
- package/dist/plugin/plugin-state-check.js +0 -27
- package/dist/plugin/plugin-state-check.js.map +0 -1
- package/dist/plugin/plugin-volume.d.ts +0 -3
- package/dist/plugin/plugin-volume.js +0 -31
- package/dist/plugin/plugin-volume.js.map +0 -1
- package/dist/plugin/runtime/child-process-worker.d.ts +0 -20
- package/dist/plugin/runtime/child-process-worker.js +0 -42
- package/dist/plugin/runtime/child-process-worker.js.map +0 -1
- package/dist/plugin/runtime/node-fork-worker.d.ts +0 -9
- package/dist/plugin/runtime/node-fork-worker.js +0 -67
- package/dist/plugin/runtime/node-fork-worker.js.map +0 -1
- package/dist/plugin/runtime/node-thread-worker.d.ts +0 -20
- package/dist/plugin/runtime/node-thread-worker.js +0 -73
- package/dist/plugin/runtime/node-thread-worker.js.map +0 -1
- package/dist/plugin/runtime/python-worker.d.ts +0 -10
- package/dist/plugin/runtime/python-worker.js +0 -91
- package/dist/plugin/runtime/python-worker.js.map +0 -1
- package/dist/plugin/runtime/runtime-worker.d.ts +0 -26
- package/dist/plugin/runtime/runtime-worker.js +0 -3
- package/dist/plugin/runtime/runtime-worker.js.map +0 -1
- package/dist/plugin/socket-serializer.d.ts +0 -5
- package/dist/plugin/socket-serializer.js +0 -17
- package/dist/plugin/socket-serializer.js.map +0 -1
- package/dist/plugin/system.d.ts +0 -39
- package/dist/plugin/system.js +0 -216
- package/dist/plugin/system.js.map +0 -1
- package/dist/rpc-buffer-serializer.d.ts +0 -11
- package/dist/rpc-buffer-serializer.js +0 -30
- package/dist/rpc-buffer-serializer.js.map +0 -1
- package/dist/rpc-serializer.d.ts +0 -24
- package/dist/rpc-serializer.js +0 -144
- package/dist/rpc-serializer.js.map +0 -1
- package/dist/rpc.d.ts +0 -147
- package/dist/rpc.js +0 -689
- package/dist/rpc.js.map +0 -1
- package/dist/runtime.d.ts +0 -103
- package/dist/runtime.js +0 -815
- package/dist/runtime.js.map +0 -1
- package/dist/scrypted-main-exports.d.ts +0 -6
- package/dist/scrypted-main-exports.js +0 -57
- package/dist/scrypted-main-exports.js.map +0 -1
- package/dist/scrypted-main.d.ts +0 -1
- package/dist/scrypted-main.js +0 -8
- package/dist/scrypted-main.js.map +0 -1
- package/dist/scrypted-plugin-main.d.ts +0 -2
- package/dist/scrypted-plugin-main.js +0 -43
- package/dist/scrypted-plugin-main.js.map +0 -1
- package/dist/scrypted-server-main.d.ts +0 -6
- package/dist/scrypted-server-main.js +0 -559
- package/dist/scrypted-server-main.js.map +0 -1
- package/dist/server-settings.d.ts +0 -5
- package/dist/server-settings.js +0 -91
- package/dist/server-settings.js.map +0 -1
- package/dist/services/addresses.d.ts +0 -7
- package/dist/services/addresses.js +0 -41
- package/dist/services/addresses.js.map +0 -1
- package/dist/services/alerts.d.ts +0 -9
- package/dist/services/alerts.js +0 -27
- package/dist/services/alerts.js.map +0 -1
- package/dist/services/cors.d.ts +0 -18
- package/dist/services/cors.js +0 -18
- package/dist/services/cors.js.map +0 -1
- package/dist/services/info.d.ts +0 -5
- package/dist/services/info.js +0 -18
- package/dist/services/info.js.map +0 -1
- package/dist/services/plugin.d.ts +0 -46
- package/dist/services/plugin.js +0 -172
- package/dist/services/plugin.js.map +0 -1
- package/dist/services/service-control.d.ts +0 -8
- package/dist/services/service-control.js +0 -39
- package/dist/services/service-control.js.map +0 -1
- package/dist/services/users.d.ts +0 -19
- package/dist/services/users.js +0 -75
- package/dist/services/users.js.map +0 -1
- package/dist/sleep.d.ts +0 -1
- package/dist/sleep.js +0 -8
- package/dist/sleep.js.map +0 -1
- package/dist/state.d.ts +0 -39
- package/dist/state.js +0 -247
- package/dist/state.js.map +0 -1
- package/dist/threading.d.ts +0 -3
- package/dist/threading.js +0 -93
- package/dist/threading.js.map +0 -1
- package/dist/usertoken.d.ts +0 -11
- package/dist/usertoken.js +0 -52
- package/dist/usertoken.js.map +0 -1
package/package.json
CHANGED
@@ -1,24 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.asyncFind = exports.asyncFilter = void 0;
|
4
|
-
function asyncFilter(asyncIterable, predicate) {
|
5
|
-
return {
|
6
|
-
async *[Symbol.asyncIterator]() {
|
7
|
-
for await (const value of asyncIterable) {
|
8
|
-
if (await predicate(value)) {
|
9
|
-
yield value;
|
10
|
-
}
|
11
|
-
}
|
12
|
-
}
|
13
|
-
};
|
14
|
-
}
|
15
|
-
exports.asyncFilter = asyncFilter;
|
16
|
-
async function asyncFind(asyncIterable, predicate) {
|
17
|
-
for await (const value of asyncIterable) {
|
18
|
-
if (await predicate(value)) {
|
19
|
-
return value;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
exports.asyncFind = asyncFind;
|
24
|
-
//# sourceMappingURL=asynciterable-utils.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"asynciterable-utils.js","sourceRoot":"","sources":["../src/asynciterable-utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAI,aAA+B,EAAE,SAAqC;IACjG,OAAO;QACH,KAAK,CAAA,CAAE,CAAC,MAAM,CAAC,aAAa,CAAC;YACzB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,aAAa,EAAE;gBACrC,IAAI,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE;oBACxB,MAAM,KAAK,CAAC;iBACf;aACJ;QACL,CAAC;KACJ,CAAA;AACL,CAAC;AAVD,kCAUC;AAEM,KAAK,UAAU,SAAS,CAAI,aAA+B,EAAE,SAAqC;IACrG,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,aAAa,EAAE;QACrC,IAAI,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE;YACxB,OAAO,KAAK,CAAC;SAChB;KACJ;AACL,CAAC;AAND,8BAMC"}
|
package/dist/cert.d.ts
DELETED
package/dist/cert.js
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.createSelfSignedCertificate = exports.CURRENT_SELF_SIGNED_CERTIFICATE_VERSION = void 0;
|
7
|
-
// import libraries
|
8
|
-
const node_forge_1 = __importDefault(require("node-forge"));
|
9
|
-
const crypto_1 = __importDefault(require("crypto"));
|
10
|
-
const { pki } = node_forge_1.default;
|
11
|
-
exports.CURRENT_SELF_SIGNED_CERTIFICATE_VERSION = 'v2';
|
12
|
-
function createSelfSignedCertificate() {
|
13
|
-
// generate a keypair and create an X.509v3 certificate
|
14
|
-
const keys = pki.rsa.generateKeyPair(2048);
|
15
|
-
const cert = pki.createCertificate();
|
16
|
-
cert.publicKey = keys.publicKey;
|
17
|
-
// NOTE: serialNumber is the hex encoded value of an ASN.1 INTEGER.
|
18
|
-
// Conforming CAs should ensure serialNumber is:
|
19
|
-
// - no more than 20 octets
|
20
|
-
// - non-negative (prefix a '00' if your value starts with a '1' bit)
|
21
|
-
cert.serialNumber = '01' + crypto_1.default.randomBytes(19).toString("hex"); // 1 octet = 8 bits = 1 byte = 2 hex chars
|
22
|
-
cert.validity.notBefore = new Date();
|
23
|
-
cert.validity.notAfter = new Date();
|
24
|
-
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1); // adding 1 year of validity from now
|
25
|
-
const attrs = [{
|
26
|
-
name: 'commonName',
|
27
|
-
value: 'localhost'
|
28
|
-
}];
|
29
|
-
cert.setSubject(attrs);
|
30
|
-
cert.setIssuer(attrs);
|
31
|
-
cert.setExtensions([{
|
32
|
-
name: 'basicConstraints',
|
33
|
-
cA: true
|
34
|
-
}, {
|
35
|
-
name: 'keyUsage',
|
36
|
-
keyCertSign: true,
|
37
|
-
digitalSignature: true,
|
38
|
-
nonRepudiation: true,
|
39
|
-
keyEncipherment: true,
|
40
|
-
dataEncipherment: true
|
41
|
-
}, {
|
42
|
-
name: 'extKeyUsage',
|
43
|
-
serverAuth: true,
|
44
|
-
clientAuth: true,
|
45
|
-
codeSigning: true,
|
46
|
-
emailProtection: true,
|
47
|
-
timeStamping: true
|
48
|
-
}, {
|
49
|
-
name: 'nsCertType',
|
50
|
-
client: true,
|
51
|
-
server: true,
|
52
|
-
email: true,
|
53
|
-
objsign: true,
|
54
|
-
sslCA: true,
|
55
|
-
emailCA: true,
|
56
|
-
objCA: true
|
57
|
-
}, {
|
58
|
-
name: 'subjectAltName',
|
59
|
-
altNames: [{
|
60
|
-
type: 7,
|
61
|
-
ip: '127.0.0.1'
|
62
|
-
}]
|
63
|
-
}, {
|
64
|
-
name: 'subjectKeyIdentifier'
|
65
|
-
}]);
|
66
|
-
// self-sign certificate
|
67
|
-
cert.sign(keys.privateKey);
|
68
|
-
return {
|
69
|
-
serviceKey: pki.privateKeyToPem(keys.privateKey),
|
70
|
-
certificate: pki.certificateToPem(cert),
|
71
|
-
version: exports.CURRENT_SELF_SIGNED_CERTIFICATE_VERSION,
|
72
|
-
};
|
73
|
-
}
|
74
|
-
exports.createSelfSignedCertificate = createSelfSignedCertificate;
|
75
|
-
//# sourceMappingURL=cert.js.map
|
package/dist/cert.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"cert.js","sourceRoot":"","sources":["../src/cert.ts"],"names":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AI;YACpB,eAAe,EAAE,IAAI;YACrB,gBAAgB,EAAE,IAAI;SACzB,EAAE;YACC,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE,IAAI;YAChB,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,IAAI;YACjB,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,IAAI;SACrB,EAAE;YACC,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;SACd,EAAE;YACC,IAAI,EAAE,gBAAgB;YACtB,QAAQ,EAAE,CAAC;oBACP,IAAI,EAAE,CAAC;oBACP,EAAE,EAAE,WAAW;iBAClB,CAAC;SACL,EAAE;YACC,IAAI,EAAE,sBAAsB;SAC/B,CAAC,CAAC,CAAC;IAEJ,wBAAwB;IACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3B,OAAO;QACH,UAAU,EAAE,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC;QAChD,WAAW,EAAE,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC;QACvC,OAAO,EAAE,+CAAuC;KACnD,CAAC;AACN,CAAC;AAhED,kEAgEC"}
|
package/dist/collection.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export declare function hasSameElements<T>(a: T[], b: T[]): boolean;
|
package/dist/collection.js
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.hasSameElements = void 0;
|
4
|
-
function hasSameElements(a, b) {
|
5
|
-
const s1 = new Set(a);
|
6
|
-
const s2 = new Set(b);
|
7
|
-
if (s1.size != s2.size)
|
8
|
-
return false;
|
9
|
-
for (const e of s1) {
|
10
|
-
if (!s2.has(e))
|
11
|
-
return false;
|
12
|
-
}
|
13
|
-
return true;
|
14
|
-
}
|
15
|
-
exports.hasSameElements = hasSameElements;
|
16
|
-
//# sourceMappingURL=collection.js.map
|
package/dist/collection.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"collection.js","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAI,CAAM,EAAE,CAAM;IAC7C,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,IAAI;QAClB,OAAO,KAAK,CAAC;IACjB,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE;QAChB,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACV,OAAO,KAAK,CAAC;KACpB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAXD,0CAWC"}
|
package/dist/db-types.d.ts
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
import { LevelDocument } from "./level";
|
2
|
-
import { ScryptedNativeId, SystemDeviceState } from "@scrypted/types";
|
3
|
-
export declare class ScryptedDocument implements LevelDocument {
|
4
|
-
_id?: string;
|
5
|
-
_documentType?: string;
|
6
|
-
}
|
7
|
-
export declare class Settings extends ScryptedDocument {
|
8
|
-
value?: any;
|
9
|
-
}
|
10
|
-
export declare class Plugin extends ScryptedDocument {
|
11
|
-
packageJson?: any;
|
12
|
-
zip?: string;
|
13
|
-
}
|
14
|
-
export declare class ScryptedUser extends ScryptedDocument {
|
15
|
-
passwordDate: number;
|
16
|
-
passwordHash: string;
|
17
|
-
token: string;
|
18
|
-
salt: string;
|
19
|
-
aclId: string;
|
20
|
-
}
|
21
|
-
export declare class ScryptedAlert extends ScryptedDocument {
|
22
|
-
timestamp: number;
|
23
|
-
title: string;
|
24
|
-
path: string;
|
25
|
-
message: string;
|
26
|
-
}
|
27
|
-
export declare class PluginDevice extends ScryptedDocument {
|
28
|
-
constructor(id?: string);
|
29
|
-
nativeId: ScryptedNativeId;
|
30
|
-
pluginId: string;
|
31
|
-
state: {
|
32
|
-
[property: string]: SystemDeviceState;
|
33
|
-
};
|
34
|
-
stateVersion: number;
|
35
|
-
storage: {
|
36
|
-
[key: string]: string;
|
37
|
-
};
|
38
|
-
}
|
package/dist/db-types.js
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.PluginDevice = exports.ScryptedAlert = exports.ScryptedUser = exports.Plugin = exports.Settings = exports.ScryptedDocument = void 0;
|
4
|
-
class ScryptedDocument {
|
5
|
-
_id;
|
6
|
-
_documentType;
|
7
|
-
}
|
8
|
-
exports.ScryptedDocument = ScryptedDocument;
|
9
|
-
class Settings extends ScryptedDocument {
|
10
|
-
value;
|
11
|
-
}
|
12
|
-
exports.Settings = Settings;
|
13
|
-
class Plugin extends ScryptedDocument {
|
14
|
-
packageJson;
|
15
|
-
zip;
|
16
|
-
}
|
17
|
-
exports.Plugin = Plugin;
|
18
|
-
class ScryptedUser extends ScryptedDocument {
|
19
|
-
passwordDate;
|
20
|
-
passwordHash;
|
21
|
-
token;
|
22
|
-
salt;
|
23
|
-
aclId;
|
24
|
-
}
|
25
|
-
exports.ScryptedUser = ScryptedUser;
|
26
|
-
class ScryptedAlert extends ScryptedDocument {
|
27
|
-
timestamp;
|
28
|
-
title;
|
29
|
-
path;
|
30
|
-
message;
|
31
|
-
}
|
32
|
-
exports.ScryptedAlert = ScryptedAlert;
|
33
|
-
class PluginDevice extends ScryptedDocument {
|
34
|
-
constructor(id) {
|
35
|
-
super();
|
36
|
-
this._id = id;
|
37
|
-
}
|
38
|
-
nativeId;
|
39
|
-
pluginId;
|
40
|
-
state;
|
41
|
-
stateVersion;
|
42
|
-
storage;
|
43
|
-
}
|
44
|
-
exports.PluginDevice = PluginDevice;
|
45
|
-
//# sourceMappingURL=db-types.js.map
|
package/dist/db-types.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"db-types.js","sourceRoot":"","sources":["../src/db-types.ts"],"names":[],"mappings":";;;AAGA,MAAa,gBAAgB;IACzB,GAAG,CAAU;IACb,aAAa,CAAU;CAC1B;AAHD,4CAGC;AAED,MAAa,QAAS,SAAQ,gBAAgB;IAC1C,KAAK,CAAO;CACf;AAFD,4BAEC;AAED,MAAa,MAAO,SAAQ,gBAAgB;IACxC,WAAW,CAAO;IAClB,GAAG,CAAU;CAChB;AAHD,wBAGC;AAED,MAAa,YAAa,SAAQ,gBAAgB;IAC9C,YAAY,CAAS;IACrB,YAAY,CAAS;IACrB,KAAK,CAAS;IACd,IAAI,CAAS;IACb,KAAK,CAAS;CACjB;AAND,oCAMC;AAED,MAAa,aAAc,SAAQ,gBAAgB;IAC/C,SAAS,CAAS;IAClB,KAAK,CAAS;IACd,IAAI,CAAS;IACb,OAAO,CAAS;CACnB;AALD,sCAKC;AAED,MAAa,YAAa,SAAQ,gBAAgB;IAC9C,YAAY,EAAW;QACnB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAClB,CAAC;IACD,QAAQ,CAAmB;IAC3B,QAAQ,CAAS;IACjB,KAAK,CAA4C;IACjD,YAAY,CAAS;IACrB,OAAO,CAA4B;CACtC;AAVD,oCAUC"}
|
package/dist/event-registry.d.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { EventDetails, EventListenerOptions, EventListenerRegister } from "@scrypted/types";
|
2
|
-
export declare class EventListenerRegisterImpl implements EventListenerRegister {
|
3
|
-
removeListener: () => void;
|
4
|
-
constructor(removeListener: () => void);
|
5
|
-
}
|
6
|
-
export declare function getMixinEventName(options: string | EventListenerOptions): string;
|
7
|
-
export declare class EventRegistry {
|
8
|
-
systemListeners: Set<(id: string, eventDetails: EventDetails, eventData: any) => void>;
|
9
|
-
listeners: {
|
10
|
-
[token: string]: Set<(eventDetails: EventDetails, eventData: any) => void>;
|
11
|
-
};
|
12
|
-
listen(callback: (id: string, eventDetails: EventDetails, eventData: any) => void): EventListenerRegister;
|
13
|
-
listenDevice(id: string, options: string | EventListenerOptions, callback: (eventDetails: EventDetails, eventData: any) => void): EventListenerRegister;
|
14
|
-
notify(id: string | undefined, eventTime: number, eventInterface: string, property: string | undefined, value: any, options?: {
|
15
|
-
changed?: boolean;
|
16
|
-
mixinId?: string;
|
17
|
-
}): boolean;
|
18
|
-
notifyEventDetails(id: string | undefined, eventDetails: EventDetails, value: any, eventInterface?: string): boolean;
|
19
|
-
}
|
package/dist/event-registry.js
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.EventRegistry = exports.getMixinEventName = exports.EventListenerRegisterImpl = void 0;
|
4
|
-
const types_1 = require("@scrypted/types");
|
5
|
-
class EventListenerRegisterImpl {
|
6
|
-
removeListener;
|
7
|
-
constructor(removeListener) {
|
8
|
-
this.removeListener = removeListener;
|
9
|
-
}
|
10
|
-
}
|
11
|
-
exports.EventListenerRegisterImpl = EventListenerRegisterImpl;
|
12
|
-
function getMixinEventName(options) {
|
13
|
-
let { event, mixinId } = (options || {});
|
14
|
-
if (!event && typeof options === 'string')
|
15
|
-
event = options;
|
16
|
-
if (!event)
|
17
|
-
event = undefined;
|
18
|
-
if (!mixinId)
|
19
|
-
return event;
|
20
|
-
let ret = `${event}-mixin-${mixinId}`;
|
21
|
-
return ret;
|
22
|
-
}
|
23
|
-
exports.getMixinEventName = getMixinEventName;
|
24
|
-
// todo: storage should only go to host plugin
|
25
|
-
const allowedEventInterfaces = new Set([types_1.ScryptedInterface.ScryptedDevice, 'Logger', 'Storage']);
|
26
|
-
class EventRegistry {
|
27
|
-
systemListeners = new Set();
|
28
|
-
listeners = {};
|
29
|
-
listen(callback) {
|
30
|
-
const events = this.systemListeners;
|
31
|
-
events.add(callback);
|
32
|
-
return new EventListenerRegisterImpl(() => {
|
33
|
-
events.delete(callback);
|
34
|
-
callback = undefined;
|
35
|
-
});
|
36
|
-
}
|
37
|
-
listenDevice(id, options, callback) {
|
38
|
-
let event = getMixinEventName(options);
|
39
|
-
const token = `${id}#${event}`;
|
40
|
-
let events = this.listeners[token];
|
41
|
-
if (!events) {
|
42
|
-
events = new Set();
|
43
|
-
this.listeners[token] = events;
|
44
|
-
}
|
45
|
-
events.add(callback);
|
46
|
-
return new EventListenerRegisterImpl(() => {
|
47
|
-
events.delete(callback);
|
48
|
-
callback = undefined;
|
49
|
-
});
|
50
|
-
}
|
51
|
-
notify(id, eventTime, eventInterface, property, value, options) {
|
52
|
-
const { changed, mixinId } = options || {};
|
53
|
-
// prevent property event noise
|
54
|
-
if (property && !changed)
|
55
|
-
return false;
|
56
|
-
const eventDetails = {
|
57
|
-
eventId: undefined,
|
58
|
-
eventInterface,
|
59
|
-
eventTime,
|
60
|
-
property,
|
61
|
-
mixinId,
|
62
|
-
};
|
63
|
-
return this.notifyEventDetails(id, eventDetails, value);
|
64
|
-
}
|
65
|
-
notifyEventDetails(id, eventDetails, value, eventInterface) {
|
66
|
-
eventDetails.eventId ||= Math.random().toString(36).substring(2);
|
67
|
-
eventInterface ||= eventDetails.eventInterface;
|
68
|
-
// system listeners only get state changes.
|
69
|
-
// there are many potentially noisy stateless events, like
|
70
|
-
// object detection and settings changes.
|
71
|
-
if ((eventDetails.property && !eventDetails.mixinId) || allowedEventInterfaces.has(eventInterface)) {
|
72
|
-
for (const event of this.systemListeners) {
|
73
|
-
event(id, eventDetails, value);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
const events = this.listeners[`${id}#${eventInterface}`];
|
77
|
-
if (events) {
|
78
|
-
for (const event of events) {
|
79
|
-
event(eventDetails, value);
|
80
|
-
}
|
81
|
-
}
|
82
|
-
const allEvents = this.listeners[`${id}#${undefined}`];
|
83
|
-
if (allEvents) {
|
84
|
-
for (const event of allEvents) {
|
85
|
-
event(eventDetails, value);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
return true;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
exports.EventRegistry = EventRegistry;
|
92
|
-
//# sourceMappingURL=event-registry.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"event-registry.js","sourceRoot":"","sources":["../src/event-registry.ts"],"names":[],"mappings":";;;AAAA,2CAA+G;AAE/G,MAAa,yBAAyB;IAClC,cAAc,CAAa;IAE3B,YAAY,cAA0B;QAClC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;CACJ;AAND,8DAMC;AAED,SAAgB,iBAAiB,CAAC,OAAsC;IACpE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAyB,CAAC;IACjE,IAAI,CAAC,KAAK,IAAI,OAAO,OAAO,KAAK,QAAQ;QACrC,KAAK,GAAG,OAAiB,CAAC;IAC9B,IAAI,CAAC,KAAK;QACN,KAAK,GAAG,SAAS,CAAC;IACtB,IAAI,CAAC,OAAO;QACR,OAAO,KAAK,CAAC;IACjB,IAAI,GAAG,GAAG,GAAG,KAAK,UAAU,OAAO,EAAE,CAAC;IACtC,OAAO,GAAG,CAAC;AACf,CAAC;AAVD,8CAUC;AAED,8CAA8C;AAC9C,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAS,CAAC,yBAAiB,CAAC,cAAc,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;AAEvG,MAAa,aAAa;IACtB,eAAe,GAAG,IAAI,GAAG,EAAoE,CAAC;IAC9F,SAAS,GAAmF,EAAE,CAAC;IAE/F,MAAM,CAAC,QAA0E;QAC7E,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;QACpC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrB,OAAO,IAAI,yBAAyB,CAAC,GAAG,E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AK,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACjE,cAAc,KAAK,YAAY,CAAC,cAAc,CAAC;QAE/C,2CAA2C;QAC3C,0DAA0D;QAC1D,yCAAyC;QACzC,IAAI,CAAC,YAAY,CAAC,QAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,sBAAsB,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE;YAChG,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,eAAe,EAAE;gBACtC,KAAK,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;aAClC;SACJ;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,cAAc,EAAE,CAAC,CAAC;QACzD,IAAI,MAAM,EAAE;YACR,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;gBACxB,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;aAC9B;SACJ;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,SAAS,EAAE,CAAC,CAAC;QACvD,IAAI,SAAS,EAAE;YACX,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE;gBAC3B,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;aAC9B;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA9ED,sCA8EC"}
|
package/dist/http-interfaces.js
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.createResponseInterface = void 0;
|
7
|
-
const rpc_1 = require("./rpc");
|
8
|
-
const path_1 = require("path");
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
10
|
-
const mime = require('mime/lite');
|
11
|
-
function createResponseInterface(res, unzippedDir, filesPath) {
|
12
|
-
class HttpResponseImpl {
|
13
|
-
[rpc_1.RpcPeer.PROPERTY_PROXY_ONEWAY_METHODS] = [
|
14
|
-
'send',
|
15
|
-
'sendFile',
|
16
|
-
'sendSocket',
|
17
|
-
];
|
18
|
-
send(body, options) {
|
19
|
-
if (options?.code)
|
20
|
-
res.status(options.code);
|
21
|
-
if (options?.headers) {
|
22
|
-
for (const header of Object.keys(options.headers)) {
|
23
|
-
res.setHeader(header, options.headers[header]);
|
24
|
-
}
|
25
|
-
}
|
26
|
-
res.send(body);
|
27
|
-
}
|
28
|
-
sendFile(path, options) {
|
29
|
-
if (options?.code)
|
30
|
-
res.status(options.code);
|
31
|
-
if (options?.headers) {
|
32
|
-
for (const header of Object.keys(options.headers)) {
|
33
|
-
res.setHeader(header, options.headers[header]);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
if (!res.getHeader('Content-Type')) {
|
37
|
-
const type = mime.getType(path);
|
38
|
-
if (type) {
|
39
|
-
res.contentType(mime.getExtension(type));
|
40
|
-
}
|
41
|
-
}
|
42
|
-
let filePath = (0, path_1.join)(unzippedDir, 'fs', path);
|
43
|
-
if (!fs_1.default.existsSync(filePath)) {
|
44
|
-
filePath = (0, path_1.join)(filesPath, path);
|
45
|
-
if (!fs_1.default.existsSync(filePath)) {
|
46
|
-
filePath = path;
|
47
|
-
if (!fs_1.default.existsSync(filePath)) {
|
48
|
-
res.status(404);
|
49
|
-
res.end();
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
// prefer etag
|
55
|
-
res.sendFile(filePath, {
|
56
|
-
cacheControl: false,
|
57
|
-
});
|
58
|
-
}
|
59
|
-
sendSocket(socket, options) {
|
60
|
-
if (options?.code)
|
61
|
-
res.status(options.code);
|
62
|
-
if (options?.headers) {
|
63
|
-
for (const header of Object.keys(options.headers)) {
|
64
|
-
res.setHeader(header, options.headers[header]);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
socket.pipe(res);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
return new HttpResponseImpl();
|
71
|
-
}
|
72
|
-
exports.createResponseInterface = createResponseInterface;
|
73
|
-
//# sourceMappingURL=http-interfaces.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"http-interfaces.js","sourceRoot":"","sources":["../src/http-interfaces.ts"],"names":[],"mappings":";;;;;;AAEA,+BAAgC;AAChC,+BAAwC;AACxC,4CAAoB;AAGpB,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAElC,SAAgB,uBAAuB,CAAC,GAAa,EAAE,WAAmB,EAAE,SAAiB;IACzF,MAAM,gBAAgB;QAClB,CAAC,aAAO,CAAC,6BAA6B,CAAC,GAAG;YACtC,MAAM;YACN,UAAU;YACV,YAAY;SACf,CAAC;QAMF,IAAI,CAAC,IAAS,EAAE,OAAa;YACzB,IAAI,OAAO,EAAE,IAAI;gBACb,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,OAAO,EAAE,OAAO,EAAE;gBAClB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;oBAC/C,GAAG,CAAC,SAAS,CAAC,MAAM,EAAG,OAAO,CAAC,OAAe,CAAC,MAAM,CAAC,CAAC,CAAC;iBAC3D;aACJ;YAED,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;QAID,QAAQ,CAAC,IAAS,EAAE,OAA6B;YAC7C,IAAI,OAAO,EAAE,IAAI;gBACb,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,OAAO,EAAE,OAAO,EAAE;gBAClB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;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CAAC,MAAM,EAAG,OAAO,CAAC,OAAe,CAAC,MAAM,CAAC,CAAC,CAAC;iBAC3D;aACJ;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;KACJ;IAED,OAAO,IAAI,gBAAgB,EAAE,CAAC;AAClC,CAAC;AA1ED,0DA0EC"}
|
package/dist/infer-defaults.d.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import { ScryptedDeviceType, ScryptedInterface } from "@scrypted/types";
|
2
|
-
import { PluginDevice } from "./db-types";
|
3
|
-
export declare function inferTypeFromInterfaces(interfaces: ScryptedInterface[]): ScryptedDeviceType;
|
4
|
-
export declare function inferTypesFromInterfaces(interfaces: ScryptedInterface[]): ScryptedDeviceType[];
|
5
|
-
export declare function getProvidedNameOrDefault(pluginDevice: PluginDevice): string;
|
6
|
-
export declare function getDisplayName(pluginDevice: PluginDevice): string;
|
7
|
-
export declare function getProvidedTypeOrDefault(pluginDevice: PluginDevice): ScryptedDeviceType;
|
8
|
-
export declare function getDisplayType(pluginDevice: PluginDevice): ScryptedDeviceType;
|
9
|
-
export declare function inferRoomFromName(name: string): string;
|
10
|
-
export declare function getProvidedRoomOrDefault(pluginDevice: PluginDevice): string;
|
11
|
-
export declare function getDisplayRoom(pluginDevice: PluginDevice): string;
|
package/dist/infer-defaults.js
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getDisplayRoom = exports.getProvidedRoomOrDefault = exports.inferRoomFromName = exports.getDisplayType = exports.getProvidedTypeOrDefault = exports.getDisplayName = exports.getProvidedNameOrDefault = exports.inferTypesFromInterfaces = exports.inferTypeFromInterfaces = void 0;
|
4
|
-
const types_1 = require("@scrypted/types");
|
5
|
-
const state_1 = require("./state");
|
6
|
-
const inferenceTable = {};
|
7
|
-
function addType(iface, ...type) {
|
8
|
-
let entries = inferenceTable[iface];
|
9
|
-
if (!entries) {
|
10
|
-
entries = [];
|
11
|
-
inferenceTable[iface] = entries;
|
12
|
-
}
|
13
|
-
entries.push(...type);
|
14
|
-
}
|
15
|
-
addType(types_1.ScryptedInterface.MediaPlayer, types_1.ScryptedDeviceType.Display);
|
16
|
-
addType(types_1.ScryptedInterface.MediaPlayer, types_1.ScryptedDeviceType.Speaker);
|
17
|
-
addType(types_1.ScryptedInterface.ColorSettingHsv, types_1.ScryptedDeviceType.Light);
|
18
|
-
addType(types_1.ScryptedInterface.ColorSettingRgb, types_1.ScryptedDeviceType.Light);
|
19
|
-
addType(types_1.ScryptedInterface.ColorSettingTemperature, types_1.ScryptedDeviceType.Light);
|
20
|
-
addType(types_1.ScryptedInterface.VideoCamera, types_1.ScryptedDeviceType.Camera);
|
21
|
-
addType(types_1.ScryptedInterface.OnOff, types_1.ScryptedDeviceType.Light);
|
22
|
-
addType(types_1.ScryptedInterface.Brightness, types_1.ScryptedDeviceType.Light);
|
23
|
-
addType(types_1.ScryptedInterface.StartStop, types_1.ScryptedDeviceType.Vacuum);
|
24
|
-
addType(types_1.ScryptedInterface.Dock, types_1.ScryptedDeviceType.Vacuum);
|
25
|
-
addType(types_1.ScryptedInterface.Scene, types_1.ScryptedDeviceType.Scene);
|
26
|
-
addType(types_1.ScryptedInterface.TemperatureSetting, types_1.ScryptedDeviceType.Thermostat);
|
27
|
-
addType(types_1.ScryptedInterface.Lock, types_1.ScryptedDeviceType.Lock);
|
28
|
-
addType(types_1.ScryptedInterface.Entry, types_1.ScryptedDeviceType.Entry, types_1.ScryptedDeviceType.Garage);
|
29
|
-
addType(types_1.ScryptedInterface.Notifier, types_1.ScryptedDeviceType.Notifier, types_1.ScryptedDeviceType.Speaker, types_1.ScryptedDeviceType.Display);
|
30
|
-
addType(types_1.ScryptedInterface.PasswordStore, types_1.ScryptedDeviceType.PasswordControl);
|
31
|
-
addType(types_1.ScryptedInterface.BinarySensor, types_1.ScryptedDeviceType.Sensor);
|
32
|
-
addType(types_1.ScryptedInterface.HttpRequestHandler, types_1.ScryptedDeviceType.API);
|
33
|
-
addType(types_1.ScryptedInterface.HttpRequestHandler, types_1.ScryptedDeviceType.DataSource);
|
34
|
-
addType(types_1.ScryptedInterface.BufferConverter, types_1.ScryptedDeviceType.API);
|
35
|
-
addType(types_1.ScryptedInterface.DeviceProvider, types_1.ScryptedDeviceType.DeviceProvider);
|
36
|
-
function inferTypeFromInterfaces(interfaces) {
|
37
|
-
return inferTypesFromInterfaces(interfaces)[0];
|
38
|
-
}
|
39
|
-
exports.inferTypeFromInterfaces = inferTypeFromInterfaces;
|
40
|
-
function inferTypesFromInterfaces(interfaces) {
|
41
|
-
const types = Object.keys(inferenceTable).filter(iface => interfaces.includes(iface)).map(iface => inferenceTable[iface]).flat();
|
42
|
-
return types;
|
43
|
-
}
|
44
|
-
exports.inferTypesFromInterfaces = inferTypesFromInterfaces;
|
45
|
-
function getProvidedNameOrDefault(pluginDevice) {
|
46
|
-
const providedName = (0, state_1.getState)(pluginDevice, types_1.ScryptedInterfaceProperty.providedName);
|
47
|
-
if (providedName)
|
48
|
-
return providedName;
|
49
|
-
const type = getProvidedTypeOrDefault(pluginDevice);
|
50
|
-
return `New ${type}`;
|
51
|
-
}
|
52
|
-
exports.getProvidedNameOrDefault = getProvidedNameOrDefault;
|
53
|
-
function getDisplayName(pluginDevice) {
|
54
|
-
const name = (0, state_1.getState)(pluginDevice, types_1.ScryptedInterfaceProperty.name);
|
55
|
-
if (name)
|
56
|
-
return name;
|
57
|
-
return getProvidedNameOrDefault(pluginDevice);
|
58
|
-
}
|
59
|
-
exports.getDisplayName = getDisplayName;
|
60
|
-
function getProvidedTypeOrDefault(pluginDevice) {
|
61
|
-
const providedType = (0, state_1.getState)(pluginDevice, types_1.ScryptedInterfaceProperty.providedType);
|
62
|
-
if (providedType)
|
63
|
-
return providedType;
|
64
|
-
const type = inferTypeFromInterfaces((0, state_1.getState)(pluginDevice, types_1.ScryptedInterfaceProperty.interfaces) || []) || types_1.ScryptedDeviceType.Unknown;
|
65
|
-
return type;
|
66
|
-
}
|
67
|
-
exports.getProvidedTypeOrDefault = getProvidedTypeOrDefault;
|
68
|
-
function getDisplayType(pluginDevice) {
|
69
|
-
const type = (0, state_1.getState)(pluginDevice, types_1.ScryptedInterfaceProperty.type);
|
70
|
-
if (type)
|
71
|
-
return type;
|
72
|
-
return getProvidedTypeOrDefault(pluginDevice);
|
73
|
-
}
|
74
|
-
exports.getDisplayType = getDisplayType;
|
75
|
-
const roomHints = {
|
76
|
-
'Exterior': 'Exterior',
|
77
|
-
'Backyard': 'Exterior',
|
78
|
-
'Front Yard': 'Exterior',
|
79
|
-
'Back Yard': 'Exterior',
|
80
|
-
'Basement': 'Basement',
|
81
|
-
'Den': 'Den',
|
82
|
-
'Dining': 'Dining Room',
|
83
|
-
'Entry': 'Entryway',
|
84
|
-
'Family': 'Family Room',
|
85
|
-
'Gym': 'Gym',
|
86
|
-
'Garage': 'Garage',
|
87
|
-
'Guest': 'Guest Bedroom',
|
88
|
-
'Kitchen': 'Kitchen',
|
89
|
-
'Living': 'Living Room',
|
90
|
-
'Master': 'Master Bedroom',
|
91
|
-
'Office': 'Office',
|
92
|
-
'Powder': 'Powder Room',
|
93
|
-
'Laundry': 'Laundry Room',
|
94
|
-
};
|
95
|
-
function inferRoomFromName(name) {
|
96
|
-
if (!name)
|
97
|
-
return;
|
98
|
-
for (const hint of Object.keys(roomHints)) {
|
99
|
-
if (name.includes(hint))
|
100
|
-
return roomHints[hint];
|
101
|
-
}
|
102
|
-
}
|
103
|
-
exports.inferRoomFromName = inferRoomFromName;
|
104
|
-
function getProvidedRoomOrDefault(pluginDevice) {
|
105
|
-
const providedRoom = (0, state_1.getState)(pluginDevice, types_1.ScryptedInterfaceProperty.providedRoom);
|
106
|
-
if (providedRoom)
|
107
|
-
return providedRoom;
|
108
|
-
const room = inferRoomFromName(getDisplayName(pluginDevice));
|
109
|
-
return room;
|
110
|
-
}
|
111
|
-
exports.getProvidedRoomOrDefault = getProvidedRoomOrDefault;
|
112
|
-
function getDisplayRoom(pluginDevice) {
|
113
|
-
const room = (0, state_1.getState)(pluginDevice, types_1.ScryptedInterfaceProperty.room);
|
114
|
-
if (room)
|
115
|
-
return room;
|
116
|
-
return getProvidedRoomOrDefault(pluginDevice);
|
117
|
-
}
|
118
|
-
exports.getDisplayRoom = getDisplayRoom;
|
119
|
-
//# sourceMappingURL=infer-defaults.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"infer-defaults.js","sourceRoot":"","sources":["../src/infer-defaults.ts"],"names":[],"mappings":";;;AAAA,2CAAmG;AAEnG,mCAAmC;AAEnC,MAAM,cAAc,GAA4C,EAAE,CAAC;AAEnE,SAAS,OAAO,CAAC,KAAwB,EAAE,GAAG,IAA0B;IACpE,IAAI,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,GAAG,EAAE,CAAC;QACb,cAAc,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;KACnC;IACD,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,OAAO,CAAC,yBAAiB,CAAC,WAAW,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAC;AACnE,OAAO,CAAC,yBAAiB,CAAC,WAAW,EAAE,0BAAkB,CAAC,OAAO,CAAC,CAAC;AAEnE,OAAO,CAAC,yBAAiB,CAAC,eAAe,EAAE,0BAAkB,CAAC,KAAK,CAAC,CAAC;AACrE,OAAO,CAAC,yBAAiB,CAAC,eAAe,EAAE,0BAAkB,CAAC,KAAK,CAAC,CAAC;AACrE,OAAO,CAAC,yBAAiB,CAAC,uBAAuB,EAAE,0BAAkB,CAAC,KAAK,CAAC,CAAC;AAC7E,OAAO,CAAC,yBAAiB,CAAC,WAAW,EAAE,0BAAkB,CAAC,MAAM,CAAC,CAAC;AAClE,OAAO,CAAC,yBAAiB,CAAC,KAAK,EAAE,0BAAkB,CAAC,KAA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AC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC;AAChB,CAAC;AAND,4DAMC;AAED,SAAgB,cAAc,CAAC,YAA0B;IACrD,MAAM,IAAI,GAAG,IAAA,gBAAQ,EAAC,YAAY,EAAE,iCAAyB,CAAC,IAAI,CAAC,CAAC;IACpE,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC;IAChB,OAAO,wBAAwB,CAAC,YAAY,CAAC,CAAC;AAClD,CAAC;AALD,wCAKC"}
|
package/dist/io.d.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
/// <reference types="node" />
|
2
|
-
import type { Server, Socket as ServerSocket } from "engine.io";
|
3
|
-
export type IOServer = {
|
4
|
-
on(ev: 'connection' | 'drain', fn: (socket: IOServerSocket & IOServerSocket) => void): IOServer;
|
5
|
-
} & Server;
|
6
|
-
export type IOServerSocket = ServerSocket & IOSocket;
|
7
|
-
export interface IOSocket {
|
8
|
-
send(data: any, options?: any, callback?: any): this;
|
9
|
-
on(ev: "close", fn: (reason: string, description?: Error) => void): this;
|
10
|
-
/**
|
11
|
-
* Fired when the client sends a message.
|
12
|
-
*/
|
13
|
-
on(ev: "message", fn: (data: string | Buffer) => void): this;
|
14
|
-
/**
|
15
|
-
* Fired when an error occurs.
|
16
|
-
*/
|
17
|
-
on(ev: "error", fn: (err: Error) => void): this;
|
18
|
-
/**
|
19
|
-
* Called when the write buffer is drained
|
20
|
-
*/
|
21
|
-
on(ev: "drain", fn: () => void): this;
|
22
|
-
}
|
package/dist/io.js
DELETED
package/dist/io.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"io.js","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":""}
|