iobroker.javascript 9.0.10 → 9.0.11
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.
- package/README.md +4 -5
- package/admin/assets/{OpenAiDialog-B4P-N63e.js → OpenAiDialog-BYXyaWDU.js} +1 -1
- package/admin/assets/{ScriptEditor-MKyboaPj.js → ScriptEditor-CpRWvDSw.js} +1 -1
- package/admin/assets/{ScriptEditorVanillaMonaco-CkDzb80s.js → ScriptEditorVanillaMonaco-BWe9MiKn.js} +1 -1
- package/admin/assets/index-BLZa2V1g.js +1 -0
- package/admin/assets/{index-vw185EVR.js → index-BUU5hWiL.js} +7 -7
- package/admin/assets/{index-Bjydl5_6.js → index-T5pCS60x.js} +1 -1
- package/admin/assets/{index-DJdd5j6E.js → index-fhg5Z_KX.js} +1 -1
- package/admin/custom/assets/{index-K4NodPhU.js → index-DsPFm5o5.js} +1 -1
- package/admin/custom/customComponents.js +2 -2
- package/admin/mf-manifest.json +1 -1
- package/admin/remoteEntry.js +2 -2
- package/admin/tab.html +1 -1
- package/build-backend/lib/javascript.d.ts +1504 -147
- package/build-backend/lib/protectFs.js +111 -104
- package/build-backend/lib/protectFs.js.map +1 -1
- package/io-package.json +13 -13
- package/package.json +2 -2
- package/admin/assets/index-DaagTm0N.js +0 -27
|
@@ -2,7 +2,44 @@
|
|
|
2
2
|
// this has a nice side effect that we may augment the global scope
|
|
3
3
|
import type * as os from 'node:os';
|
|
4
4
|
import type { ChildProcess, ExecException } from 'node:child_process';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
export interface FsStats {
|
|
7
|
+
isFile(): boolean;
|
|
8
|
+
isDirectory(): boolean;
|
|
9
|
+
isBlockDevice(): boolean;
|
|
10
|
+
isCharacterDevice(): boolean;
|
|
11
|
+
isSymbolicLink(): boolean;
|
|
12
|
+
isFIFO(): boolean;
|
|
13
|
+
isSocket(): boolean;
|
|
14
|
+
dev: number;
|
|
15
|
+
ino: number;
|
|
16
|
+
mode: number;
|
|
17
|
+
nlink: number;
|
|
18
|
+
uid: number;
|
|
19
|
+
gid: number;
|
|
20
|
+
rdev: number;
|
|
21
|
+
size: number;
|
|
22
|
+
blksize: number;
|
|
23
|
+
blocks: number;
|
|
24
|
+
atimeMs: number;
|
|
25
|
+
mtimeMs: number;
|
|
26
|
+
ctimeMs: number;
|
|
27
|
+
birthtimeMs: number;
|
|
28
|
+
atime: Date;
|
|
29
|
+
mtime: Date;
|
|
30
|
+
ctime: Date;
|
|
31
|
+
birthtime: Date;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare const __brand: unique symbol;
|
|
35
|
+
type Brand<B> = { [__brand]: B };
|
|
36
|
+
export type Branded<T, B> = T & Brand<B>;
|
|
37
|
+
|
|
38
|
+
type SubscribeObject = {
|
|
39
|
+
name: string;
|
|
40
|
+
pattern: string;
|
|
41
|
+
callback: (id: string, obj?: iobJS.Object | null) => void;
|
|
42
|
+
};
|
|
6
43
|
|
|
7
44
|
type EmptyCallback = () => void | Promise<void>;
|
|
8
45
|
type ErrorCallback = (err?: Error) => void | Promise<void>;
|
|
@@ -66,39 +103,80 @@ type AnyOf<
|
|
|
66
103
|
// tslint:disable:no-namespace
|
|
67
104
|
declare global {
|
|
68
105
|
namespace iobJS {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
106
|
+
/** Two-way mapping for state quality ("q" attribute of a state) */
|
|
107
|
+
interface STATE_QUALITY {
|
|
108
|
+
/** The default value for a state */
|
|
109
|
+
GOOD: 0x00;
|
|
110
|
+
/** General problem */
|
|
111
|
+
BAD: 0x01;
|
|
112
|
+
/** The instance cannot establish a connection */
|
|
113
|
+
CONNECTION_PROBLEM: 0x02;
|
|
114
|
+
/** Substitute value from controller. Do not set this in adapters */
|
|
115
|
+
SUBSTITUTE_FROM_CONTROLLER: 0x10;
|
|
116
|
+
/** Quality for default values */
|
|
117
|
+
SUBSTITUTE_INITIAL_VALUE: 0x20;
|
|
118
|
+
/** Substitute value from instance or device */
|
|
119
|
+
SUBSTITUTE_DEVICE_INSTANCE_VALUE: 0x40;
|
|
120
|
+
/** Substitute value from a sensor */
|
|
121
|
+
SUBSTITUTE_SENSOR_VALUE: 0x80;
|
|
122
|
+
/** General problem by instance */
|
|
123
|
+
GENERAL_INSTANCE_PROBLEM: 0x11;
|
|
124
|
+
/** General problem by device */
|
|
125
|
+
GENERAL_DEVICE_PROBLEM: 0x41;
|
|
126
|
+
/** General problem by sensor */
|
|
127
|
+
GENERAL_SENSOR_PROBLEM: 0x81;
|
|
128
|
+
/** The instance is not connected */
|
|
129
|
+
INSTANCE_NOT_CONNECTED: 0x12;
|
|
130
|
+
/** The device is not connected */
|
|
131
|
+
DEVICE_NOT_CONNECTED: 0x42;
|
|
132
|
+
/** The sensor is not connected */
|
|
133
|
+
SENSOR_NOT_CONNECTED: 0x82;
|
|
134
|
+
/** The device has reported an error */
|
|
135
|
+
DEVICE_ERROR_REPORT: 0x44;
|
|
136
|
+
/** The sensor has reported an error */
|
|
137
|
+
SENSOR_ERROR_REPORT: 0x84;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type StateValue = string | number | boolean | null;
|
|
141
|
+
|
|
142
|
+
interface State {
|
|
143
|
+
/** The value of the state. */
|
|
144
|
+
val: StateValue;
|
|
79
145
|
|
|
80
|
-
|
|
146
|
+
/** Direction flag: false for desired value and true for actual value. Default: false. */
|
|
147
|
+
ack: boolean;
|
|
81
148
|
|
|
82
|
-
|
|
83
|
-
|
|
149
|
+
/** Unix timestamp. Default: current time */
|
|
150
|
+
ts: number;
|
|
151
|
+
|
|
152
|
+
/** Unix timestamp of the last time the value changed */
|
|
153
|
+
lc: number;
|
|
154
|
+
|
|
155
|
+
/** Name of the adapter instance which set the value, e.g. "system.adapter.web.0" */
|
|
156
|
+
from: string;
|
|
157
|
+
|
|
158
|
+
/** The user who set this value */
|
|
159
|
+
user?: string;
|
|
160
|
+
|
|
161
|
+
/** Optional time in seconds after which the state is reset to null */
|
|
162
|
+
expire?: number;
|
|
163
|
+
|
|
164
|
+
/** Optional quality of the state value */
|
|
165
|
+
q?: STATE_QUALITY[keyof STATE_QUALITY];
|
|
166
|
+
|
|
167
|
+
/** Optional comment */
|
|
168
|
+
c?: string;
|
|
84
169
|
}
|
|
85
170
|
|
|
86
|
-
|
|
87
|
-
val: null;
|
|
88
|
-
notExist: true;
|
|
171
|
+
type SettableState = AtLeastOne<State>;
|
|
89
172
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
expire: undefined;
|
|
95
|
-
q: undefined;
|
|
96
|
-
c: undefined;
|
|
173
|
+
interface IdObject {
|
|
174
|
+
device?: string;
|
|
175
|
+
channel?: string;
|
|
176
|
+
state?: string;
|
|
97
177
|
}
|
|
98
178
|
|
|
99
|
-
type
|
|
100
|
-
type StringOrTranslated = string | { [lang in Languages]?: string };
|
|
101
|
-
type CommonType = 'number' | 'string' | 'boolean' | 'array' | 'object' | 'mixed' | 'file';
|
|
179
|
+
type Session = any; // TODO: implement
|
|
102
180
|
|
|
103
181
|
/** Defines access rights for a single object type */
|
|
104
182
|
interface ObjectOperationPermissions {
|
|
@@ -139,6 +217,462 @@ declare global {
|
|
|
139
217
|
};
|
|
140
218
|
}
|
|
141
219
|
|
|
220
|
+
interface Permission {
|
|
221
|
+
/** The type of the permission */
|
|
222
|
+
type: string;
|
|
223
|
+
/** Defines which kind of operation is required */
|
|
224
|
+
operation: string;
|
|
225
|
+
}
|
|
226
|
+
interface ObjectOrStatePermission extends Permission {
|
|
227
|
+
type: 'object' | 'file' | 'users' | 'state';
|
|
228
|
+
operation: 'list' | 'read' | 'write' | 'create' | 'delete';
|
|
229
|
+
}
|
|
230
|
+
interface OtherPermission extends Permission {
|
|
231
|
+
type: 'other';
|
|
232
|
+
operation: 'execute' | 'http' | 'sendto';
|
|
233
|
+
}
|
|
234
|
+
interface CommandsPermissions {
|
|
235
|
+
// TODO: Are all properties required or is a partial object ok?
|
|
236
|
+
getObject: ObjectOrStatePermission;
|
|
237
|
+
getObjects: ObjectOrStatePermission;
|
|
238
|
+
getObjectView: ObjectOrStatePermission;
|
|
239
|
+
setObject: ObjectOrStatePermission;
|
|
240
|
+
subscribeObjects: ObjectOrStatePermission;
|
|
241
|
+
unsubscribeObjects: ObjectOrStatePermission;
|
|
242
|
+
getStates: ObjectOrStatePermission;
|
|
243
|
+
getState: ObjectOrStatePermission;
|
|
244
|
+
setState: ObjectOrStatePermission;
|
|
245
|
+
getStateHistory: ObjectOrStatePermission;
|
|
246
|
+
subscribe: ObjectOrStatePermission;
|
|
247
|
+
unsubscribe: ObjectOrStatePermission;
|
|
248
|
+
getVersion: Permission;
|
|
249
|
+
httpGet: OtherPermission;
|
|
250
|
+
sendTo: OtherPermission;
|
|
251
|
+
sendToHost: OtherPermission;
|
|
252
|
+
readFile: ObjectOrStatePermission;
|
|
253
|
+
readFile64: ObjectOrStatePermission;
|
|
254
|
+
writeFile: ObjectOrStatePermission;
|
|
255
|
+
writeFile64: ObjectOrStatePermission;
|
|
256
|
+
unlink: ObjectOrStatePermission;
|
|
257
|
+
rename: ObjectOrStatePermission;
|
|
258
|
+
mkdir: ObjectOrStatePermission;
|
|
259
|
+
readDir: ObjectOrStatePermission;
|
|
260
|
+
chmodFile: ObjectOrStatePermission;
|
|
261
|
+
authEnabled: Permission;
|
|
262
|
+
disconnect: Permission;
|
|
263
|
+
listPermissions: Permission;
|
|
264
|
+
getUserPermissions: ObjectOrStatePermission;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
type UserGroup = any; // TODO find out how this looks like
|
|
268
|
+
// interface UserGroup { }
|
|
269
|
+
|
|
270
|
+
/** Contains information about a user */
|
|
271
|
+
interface User {
|
|
272
|
+
/** Which groups this user belongs to */
|
|
273
|
+
groups: UserGroup[];
|
|
274
|
+
/** Access rights of this user */
|
|
275
|
+
acl: ObjectPermissions;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Parameters for adapter.getObjectView */
|
|
279
|
+
interface GetObjectViewParams {
|
|
280
|
+
/** First id to include in the return list */
|
|
281
|
+
startkey?: string;
|
|
282
|
+
/** Last id to include in the return list */
|
|
283
|
+
endkey?: string;
|
|
284
|
+
/** Whether docs should be included in the return list */ // TODO: What are docs?
|
|
285
|
+
include_docs?: boolean;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** Parameters for adapter.getObjectList */
|
|
289
|
+
type GetObjectListParams = GetObjectViewParams;
|
|
290
|
+
|
|
291
|
+
interface Logger {
|
|
292
|
+
/** log a message with silly level */
|
|
293
|
+
silly(message: string): void;
|
|
294
|
+
/** log a message with debug level */
|
|
295
|
+
debug(message: string): void;
|
|
296
|
+
/** log a message with info level (default output level for all adapters) */
|
|
297
|
+
info(message: string): void;
|
|
298
|
+
/** log a message with warning severity */
|
|
299
|
+
warn(message: string): void;
|
|
300
|
+
/** log a message with error severity */
|
|
301
|
+
error(message: string): void;
|
|
302
|
+
|
|
303
|
+
/** Verbosity of the log output */
|
|
304
|
+
level: LogLevel;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Log message */
|
|
308
|
+
interface LogMessage {
|
|
309
|
+
/** unique ID */
|
|
310
|
+
_id: number;
|
|
311
|
+
/** id of the source instance */
|
|
312
|
+
from: string;
|
|
313
|
+
/** log level */
|
|
314
|
+
severity: string;
|
|
315
|
+
/** timestamp */
|
|
316
|
+
ts: number;
|
|
317
|
+
/** actual content */
|
|
318
|
+
message: string;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
interface Certificates {
|
|
322
|
+
/** private key file */
|
|
323
|
+
key: string;
|
|
324
|
+
/** public certificate */
|
|
325
|
+
cert: string;
|
|
326
|
+
/** chained CA certificates */
|
|
327
|
+
ca?: string;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
type MessagePayload = any;
|
|
331
|
+
|
|
332
|
+
/** Callback information for a passed message */
|
|
333
|
+
interface MessageCallbackInfo {
|
|
334
|
+
/** The original message payload */
|
|
335
|
+
message: MessagePayload;
|
|
336
|
+
/** ID of this callback */
|
|
337
|
+
id: number;
|
|
338
|
+
/** If ack is false, it means the message is a request. If ack is true, it means the message is a response */
|
|
339
|
+
ack: boolean;
|
|
340
|
+
/** Timestamp of this message */
|
|
341
|
+
time: number;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
interface SendableMessage {
|
|
345
|
+
/** The command to be executed */
|
|
346
|
+
command: string;
|
|
347
|
+
/** The message payload */
|
|
348
|
+
message: MessagePayload;
|
|
349
|
+
/** The source of this message */
|
|
350
|
+
from: string;
|
|
351
|
+
/** Callback information. This is set when the source expects a response */
|
|
352
|
+
callback?: MessageCallbackInfo;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** A message being passed between adapter instances */
|
|
356
|
+
interface Message extends SendableMessage {
|
|
357
|
+
/** ID of this message */
|
|
358
|
+
_id: number;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
type Log = any; // TODO: define this https://github.com/ioBroker/ioBroker.js-controller/blob/master/lib/states/statesInMemServer.js#L873
|
|
362
|
+
|
|
363
|
+
type EnumList = string | string[];
|
|
364
|
+
|
|
365
|
+
type Plugin = Record<string, any>; // TODO: Add definition
|
|
366
|
+
|
|
367
|
+
interface DirectoryEntry {
|
|
368
|
+
file: string;
|
|
369
|
+
stats: FsStats;
|
|
370
|
+
isDir: boolean;
|
|
371
|
+
acl: any; // access control list object
|
|
372
|
+
modifiedAt: number;
|
|
373
|
+
createdAt: number;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
interface GetHistoryOptions {
|
|
377
|
+
instance?: string;
|
|
378
|
+
/** Start time in ms */
|
|
379
|
+
start?: number;
|
|
380
|
+
/** End time in ms. If not defined, it is "now" */
|
|
381
|
+
end?: number;
|
|
382
|
+
/** Step in ms of intervals. Used in aggregate (max, min, average, total, ...) */
|
|
383
|
+
step?: number;
|
|
384
|
+
/** number of values if aggregate is 'onchange' or number of intervals if other aggregate method. Count will be ignored if step is set, else default is 500 if not set */
|
|
385
|
+
count?: number;
|
|
386
|
+
/** if `from` field should be included in answer */
|
|
387
|
+
from?: boolean;
|
|
388
|
+
/** if `ack` field should be included in answer */
|
|
389
|
+
ack?: boolean;
|
|
390
|
+
/** if `q` field should be included in answer */
|
|
391
|
+
q?: boolean;
|
|
392
|
+
/** if `id` field should be included in answer */
|
|
393
|
+
addId?: boolean;
|
|
394
|
+
/** do not return more entries than limit */
|
|
395
|
+
limit?: number;
|
|
396
|
+
/** round result to number of digits after decimal point */
|
|
397
|
+
round?: number;
|
|
398
|
+
/** if null values should be included (false), replaced by last not null value (true) or replaced with 0 (0) */
|
|
399
|
+
ignoreNull?: boolean | 0;
|
|
400
|
+
/** This number will be returned in answer, so the client can assign the request for it */
|
|
401
|
+
sessionId?: number;
|
|
402
|
+
/** aggregate method (Default: 'average') */
|
|
403
|
+
aggregate?:
|
|
404
|
+
| 'onchange'
|
|
405
|
+
| 'minmax'
|
|
406
|
+
| 'min'
|
|
407
|
+
| 'max'
|
|
408
|
+
| 'average'
|
|
409
|
+
| 'total'
|
|
410
|
+
| 'count'
|
|
411
|
+
| 'none'
|
|
412
|
+
| 'percentile'
|
|
413
|
+
| 'quantile'
|
|
414
|
+
| 'integral'
|
|
415
|
+
| 'integralTotal';
|
|
416
|
+
/** Returned data is normally sorted ascending by date, this option lets you return the newest instead of the oldest values if the number of returned points is limited */
|
|
417
|
+
returnNewestEntries?: boolean;
|
|
418
|
+
/** By default, the additional border values are returned to optimize charting. Set this option to true if this is not wanted (e.g., for script data processing) */
|
|
419
|
+
removeBorderValues?: boolean;
|
|
420
|
+
/** when using aggregate method `percentile` defines the percentile level (0..100)(defaults to 50) */
|
|
421
|
+
percentile?: number;
|
|
422
|
+
/** when using aggregate method `quantile` defines the quantile level (0..1)(defaults to 0.5) */
|
|
423
|
+
quantile?: number;
|
|
424
|
+
/** when using aggregate method `integral` defines the unit in seconds (defaults to 60 seconds). E.g., to get integral in hours for Wh or such, set to 3600. */
|
|
425
|
+
integralUnit?: number;
|
|
426
|
+
/** when using aggregate method `integral` defines the interpolation method (defaults to `none`). */
|
|
427
|
+
integralInterpolation?: 'none' | 'linear';
|
|
428
|
+
/** If user is set, it will be checked if this user may read the variable */
|
|
429
|
+
user?: `system.user.${string}`;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
interface DelObjectOptions {
|
|
433
|
+
/** Whether all child objects should be deleted as well */
|
|
434
|
+
recursive?: boolean;
|
|
435
|
+
// Allow non-documented properties
|
|
436
|
+
[other: string]: unknown;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
interface ExtendObjectOptionsPreserve {
|
|
440
|
+
[prop: string]: ExtendObjectOptionsPreserve | boolean | string[];
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
interface ExtendObjectOptions {
|
|
444
|
+
/** Which properties of the original object should be preserved */
|
|
445
|
+
preserve?: ExtendObjectOptionsPreserve;
|
|
446
|
+
// Allow non-documented properties
|
|
447
|
+
[other: string]: unknown;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** Predefined notification scopes and their categories */
|
|
451
|
+
interface NotificationScopes {
|
|
452
|
+
system:
|
|
453
|
+
| 'memIssues'
|
|
454
|
+
| 'fsIoErrors'
|
|
455
|
+
| 'noDiskSpace'
|
|
456
|
+
| 'accessErrors'
|
|
457
|
+
| 'nonExistingFileErrors'
|
|
458
|
+
| 'remoteHostErrors'
|
|
459
|
+
| 'restartLoop'
|
|
460
|
+
| 'fileToJsonl';
|
|
461
|
+
[other: string]: string;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** Additional context for the notification which can be used by notification processing adapters */
|
|
465
|
+
interface NotificationContextData {
|
|
466
|
+
/** Use a `key` specific to the adapter or if a feature is supported by all adapters of a type, the type (e.g. `messaging`) is also fine. */
|
|
467
|
+
[adapterNameOrAdapterType: string]: unknown;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
471
|
+
interface AdapterConfig {
|
|
472
|
+
// This is a stub to be augmented in every adapter
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
type ReadyHandler = () => void | Promise<void>;
|
|
476
|
+
type ObjectChangeHandler = (id: string, obj: iobJS.Object | null | undefined) => void | Promise<void>;
|
|
477
|
+
type OriginalStateChangeHandler = (id: string, obj: State | null | undefined) => void | Promise<void>;
|
|
478
|
+
type OriginalFileChangeHandler = (id: string, fileName: string, size: number | null) => void;
|
|
479
|
+
type MessageHandler = (obj: Message) => void | Promise<void>;
|
|
480
|
+
type UnloadHandler = (callback: EmptyCallback) => void | Promise<void>;
|
|
481
|
+
type ErrorHandler = (err: Error) => boolean;
|
|
482
|
+
|
|
483
|
+
type EmptyCallback = () => void;
|
|
484
|
+
type ErrorCallback = (err?: Error | null) => void;
|
|
485
|
+
/** Special variant of ErrorCallback for methods where Node.js returns an ErrnoException */
|
|
486
|
+
type ErrnoCallback = (err?: NodeJS.ErrnoException | null) => void;
|
|
487
|
+
// TODO: Redefine callbacks as subclass of GenericCallback
|
|
488
|
+
type GenericCallback<T> = (err?: Error | null, result?: T) => void;
|
|
489
|
+
|
|
490
|
+
/** Due to backward compatibility first param can be result or error */
|
|
491
|
+
type OriginalMessageCallback = (response?: Message | Error) => void;
|
|
492
|
+
|
|
493
|
+
type OriginalSetObjectCallback = (err?: Error | null, obj?: { id: string }) => void;
|
|
494
|
+
type OriginalSetObjectPromise = Promise<NonNullCallbackReturnTypeOf<OriginalSetObjectCallback>>;
|
|
495
|
+
|
|
496
|
+
type GetEnumCallback = (err?: Error | null, enums?: Record<string, EnumObject>, requestedEnum?: string) => void;
|
|
497
|
+
type GetEnumsCallback = (
|
|
498
|
+
err?: Error | null,
|
|
499
|
+
result?: {
|
|
500
|
+
[groupName: string]: Record<string, EnumObject>;
|
|
501
|
+
},
|
|
502
|
+
) => void;
|
|
503
|
+
type GetEnumsPromise = Promise<NonNullCallbackReturnTypeOf<GetEnumsCallback>>;
|
|
504
|
+
|
|
505
|
+
type GetObjectsCallback = (err?: Error | null, objects?: Record<string, iobJS.Object>) => void;
|
|
506
|
+
type GetObjectsPromise = Promise<NonNullCallbackReturnTypeOf<GetObjectsCallback>>;
|
|
507
|
+
|
|
508
|
+
type GetObjectsCallbackTyped<T extends ObjectType> = (
|
|
509
|
+
err?: Error | null,
|
|
510
|
+
objects?: Record<string, iobJS.AnyObject & { type: T }>,
|
|
511
|
+
) => void;
|
|
512
|
+
type GetObjectsPromiseTyped<T extends ObjectType> = Promise<
|
|
513
|
+
NonNullCallbackReturnTypeOf<GetObjectsCallbackTyped<T>>
|
|
514
|
+
>;
|
|
515
|
+
|
|
516
|
+
type FindObjectCallback = (
|
|
517
|
+
/** If an error happened, this contains the message */
|
|
518
|
+
err?: Error | null,
|
|
519
|
+
/** If an object was found, this contains the ID */
|
|
520
|
+
id?: string,
|
|
521
|
+
/** If an object was found, this contains the common.name */
|
|
522
|
+
name?: StringOrTranslated,
|
|
523
|
+
) => void;
|
|
524
|
+
|
|
525
|
+
// This is a version used by GetDevices/GetChannelsOf/GetStatesOf
|
|
526
|
+
type GetObjectsCallback3<T extends BaseObject> = (err?: Error | null, result?: T[]) => void;
|
|
527
|
+
|
|
528
|
+
type SecondParameterOf<T extends (...args: any[]) => any> = T extends (
|
|
529
|
+
arg0: any,
|
|
530
|
+
arg1: infer R,
|
|
531
|
+
...args: any[]
|
|
532
|
+
) => any
|
|
533
|
+
? R
|
|
534
|
+
: never;
|
|
535
|
+
/** Infers the return type from a callback-style API and strips out null and undefined */
|
|
536
|
+
type NonNullCallbackReturnTypeOf<T extends (...args: any[]) => any> = Exclude<
|
|
537
|
+
SecondParameterOf<T>,
|
|
538
|
+
null | undefined
|
|
539
|
+
>;
|
|
540
|
+
/** Infers the return type from a callback-style API and leaves null and undefined in */
|
|
541
|
+
type CallbackReturnTypeOf<T extends (...args: any[]) => any> = SecondParameterOf<T>;
|
|
542
|
+
|
|
543
|
+
type OriginalGetStateCallback = (err?: Error | null, state?: State | null) => void;
|
|
544
|
+
type GetStatePromise = Promise<CallbackReturnTypeOf<OriginalGetStateCallback>>;
|
|
545
|
+
|
|
546
|
+
type GetStatesCallback = (err?: Error | null, states?: Record<string, State>) => void;
|
|
547
|
+
type GetStatesPromise = Promise<NonNullCallbackReturnTypeOf<GetStatesCallback>>;
|
|
548
|
+
|
|
549
|
+
type SetStateCallback = (err?: Error | null, id?: string) => void;
|
|
550
|
+
type SetStatePromise = Promise<NonNullCallbackReturnTypeOf<SetStateCallback>>;
|
|
551
|
+
|
|
552
|
+
type SetStateChangedCallback = (err?: Error | null, id?: string, notChanged?: boolean) => void;
|
|
553
|
+
type SetStateChangedPromise = Promise<NonNullCallbackReturnTypeOf<SetStateChangedCallback>>;
|
|
554
|
+
|
|
555
|
+
type DeleteStateCallback = (err?: Error | null, id?: string) => void;
|
|
556
|
+
|
|
557
|
+
type GetHistoryResult = Array<State & { id?: string }>;
|
|
558
|
+
type GetHistoryCallback = (
|
|
559
|
+
err: Error | null,
|
|
560
|
+
result?: GetHistoryResult,
|
|
561
|
+
step?: number,
|
|
562
|
+
sessionId?: number,
|
|
563
|
+
) => void;
|
|
564
|
+
|
|
565
|
+
/** Contains the return values of readDir */
|
|
566
|
+
interface ReadDirResult {
|
|
567
|
+
/** Name of the file or directory */
|
|
568
|
+
file: string;
|
|
569
|
+
/** File system stats */
|
|
570
|
+
stats: Partial<FsStats>;
|
|
571
|
+
/** Whether this is a directory or a file */
|
|
572
|
+
isDir: boolean;
|
|
573
|
+
/** Access rights */
|
|
574
|
+
acl?: EvaluatedFileACL;
|
|
575
|
+
/** Date of last modification */
|
|
576
|
+
modifiedAt?: number;
|
|
577
|
+
/** Date of creation */
|
|
578
|
+
createdAt?: number;
|
|
579
|
+
}
|
|
580
|
+
type ReadDirCallback = (err?: NodeJS.ErrnoException | null, entries?: ReadDirResult[]) => void;
|
|
581
|
+
type ReadDirPromise = Promise<ReadDirResult[]>;
|
|
582
|
+
|
|
583
|
+
type OriginalReadFileCallback = (
|
|
584
|
+
err?: NodeJS.ErrnoException | null,
|
|
585
|
+
data?: Buffer | string,
|
|
586
|
+
mimeType?: string,
|
|
587
|
+
) => void;
|
|
588
|
+
type OriginalReadFilePromise = Promise<{ file: string | Buffer; mimeType?: string }>;
|
|
589
|
+
|
|
590
|
+
/** Contains the return values of chownFile */
|
|
591
|
+
interface ChownFileResult {
|
|
592
|
+
/** The parent directory of the processed file or directory */
|
|
593
|
+
path: string;
|
|
594
|
+
/** Name of the file or directory */
|
|
595
|
+
file: string;
|
|
596
|
+
/** File system stats */
|
|
597
|
+
stats: FsStats;
|
|
598
|
+
/** Whether this is a directory or a file */
|
|
599
|
+
isDir: boolean;
|
|
600
|
+
/** Access rights */
|
|
601
|
+
acl: FileACL;
|
|
602
|
+
/** Date of last modification */
|
|
603
|
+
modifiedAt: number;
|
|
604
|
+
/** Date of creation */
|
|
605
|
+
createdAt: number;
|
|
606
|
+
}
|
|
607
|
+
type ChownFileCallback = (err?: NodeJS.ErrnoException | null, processed?: ChownFileResult[]) => void;
|
|
608
|
+
|
|
609
|
+
/** Contains the return values of rm */
|
|
610
|
+
interface RmResult {
|
|
611
|
+
/** The parent directory of the deleted file or directory */
|
|
612
|
+
path: string;
|
|
613
|
+
/** The name of the deleted file or directory */
|
|
614
|
+
file: string;
|
|
615
|
+
}
|
|
616
|
+
type RmCallback = (err?: NodeJS.ErrnoException | null, entries?: RmResult[]) => void;
|
|
617
|
+
|
|
618
|
+
type ChownObjectCallback = (err?: NodeJS.ErrnoException | null, list?: iobJS.Object[]) => void;
|
|
619
|
+
|
|
620
|
+
type GetKeysCallback = (err?: Error | null, list?: string[]) => void;
|
|
621
|
+
|
|
622
|
+
interface GetObjectViewItem<T extends AnyObject> {
|
|
623
|
+
/** The ID of this object */
|
|
624
|
+
id: T['_id'];
|
|
625
|
+
/** A copy of the object from the DB */
|
|
626
|
+
value: T;
|
|
627
|
+
}
|
|
628
|
+
type GetObjectViewCallback<T extends AnyObject> = (
|
|
629
|
+
err?: Error | null,
|
|
630
|
+
result?: { rows: Array<GetObjectViewItem<T>> },
|
|
631
|
+
) => void;
|
|
632
|
+
type GetObjectViewPromise<T extends AnyObject> = Promise<NonNullCallbackReturnTypeOf<GetObjectViewCallback<T>>>;
|
|
633
|
+
|
|
634
|
+
interface GetObjectListItem<T extends AnyObject> extends GetObjectViewItem<T> {
|
|
635
|
+
/** A copy of the object */
|
|
636
|
+
value: T;
|
|
637
|
+
/** The same as @link{value} */
|
|
638
|
+
doc: T;
|
|
639
|
+
}
|
|
640
|
+
type GetObjectListCallback<T extends iobJS.AnyObject> = (
|
|
641
|
+
err?: Error | null,
|
|
642
|
+
result?: { rows: GetObjectListItem<T>[] },
|
|
643
|
+
) => void;
|
|
644
|
+
type GetObjectListPromise = Promise<NonNullCallbackReturnTypeOf<GetObjectListCallback<iobJS.Object>>>;
|
|
645
|
+
|
|
646
|
+
type ExtendObjectCallback = (
|
|
647
|
+
err?: Error | null,
|
|
648
|
+
result?: { id: string; value: iobJS.Object },
|
|
649
|
+
id?: string,
|
|
650
|
+
) => void;
|
|
651
|
+
|
|
652
|
+
type GetSessionCallback = (session: Session) => void;
|
|
653
|
+
|
|
654
|
+
type Timeout = Branded<number, 'Timeout'> | null; // or null to not allow native clearTimeout
|
|
655
|
+
type Interval = Branded<number, 'Interval'> | null; // or null to not allow native clearInterval
|
|
656
|
+
|
|
657
|
+
/** Defines access rights for a single file */
|
|
658
|
+
interface FileACL {
|
|
659
|
+
/** Full name of the user who owns this file, e.g. "system.user.admin" */
|
|
660
|
+
owner: string;
|
|
661
|
+
/** Full name of the group who owns this file, e.g. "system.group.administrator" */
|
|
662
|
+
ownerGroup: string;
|
|
663
|
+
/** Linux-type permissions defining access to this file */
|
|
664
|
+
permissions: number;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/** Defines access rights for a single file, applied to a user or group */
|
|
668
|
+
interface EvaluatedFileACL extends FileACL {
|
|
669
|
+
/** Whether the user may read the file */
|
|
670
|
+
read: boolean;
|
|
671
|
+
/** Whether the user may write the file */
|
|
672
|
+
write: boolean;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/** Defines access rights for a single object */
|
|
142
676
|
interface ObjectACL {
|
|
143
677
|
/** Full name of the user who owns this object, e.g. "system.user.admin" */
|
|
144
678
|
owner: string;
|
|
@@ -147,6 +681,7 @@ declare global {
|
|
|
147
681
|
/** Linux-type permissions defining access to this object */
|
|
148
682
|
object: number;
|
|
149
683
|
}
|
|
684
|
+
|
|
150
685
|
/** Defines access rights for a single state object */
|
|
151
686
|
interface StateACL extends ObjectACL {
|
|
152
687
|
/** Linux-type permissions defining access to this state */
|
|
@@ -168,7 +703,9 @@ declare global {
|
|
|
168
703
|
| 'meta'
|
|
169
704
|
| 'script'
|
|
170
705
|
| 'user'
|
|
171
|
-
| 'chart'
|
|
706
|
+
| 'chart'
|
|
707
|
+
| 'schedule'
|
|
708
|
+
| 'design';
|
|
172
709
|
|
|
173
710
|
// Define the naming schemes for objects, so we can provide more specific types for get/setObject
|
|
174
711
|
namespace ObjectIDs {
|
|
@@ -194,15 +731,21 @@ declare global {
|
|
|
194
731
|
// Guaranteed instance objects
|
|
195
732
|
type Instance = `system.adapter.${string}.${number}`;
|
|
196
733
|
// Guaranteed adapter objects
|
|
197
|
-
type Adapter = `system.adapter.${string}`;
|
|
734
|
+
type Adapter = `system.adapter.${string}` | `system.host.${string}.adapter.${string}`;
|
|
198
735
|
// Guaranteed group objects
|
|
199
736
|
type Group = `system.group.${string}`;
|
|
200
737
|
// Guaranteed user objects
|
|
201
738
|
type User = `system.user.${string}`;
|
|
202
739
|
// Guaranteed host objects
|
|
203
740
|
type Host = `system.host.${string}`;
|
|
741
|
+
// Guaranteed repository object
|
|
742
|
+
type Repository = 'system.repositories';
|
|
204
743
|
// Guaranteed config objects
|
|
205
|
-
type Config =
|
|
744
|
+
type Config = 'system.certificates';
|
|
745
|
+
// Guaranteed system config objects
|
|
746
|
+
type SystemConfig = 'system.config';
|
|
747
|
+
// Guaranteed design objects
|
|
748
|
+
type Design = `_design/${string}`;
|
|
206
749
|
|
|
207
750
|
// Unsure, can be folder, device, channel or state (or whatever an adapter does)
|
|
208
751
|
type AdapterScoped = `${string}.${number}.${string}`;
|
|
@@ -224,10 +767,9 @@ declare global {
|
|
|
224
767
|
| AdapterScoped;
|
|
225
768
|
}
|
|
226
769
|
|
|
227
|
-
type ObjectIdToObjectType<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
O = T extends ObjectIDs.State // State must come before Adapter or system.adapter.admin.0.foobar will resolve to AdapterObject
|
|
770
|
+
type ObjectIdToObjectType<T extends string, Read extends 'read' | 'write' = 'read'> =
|
|
771
|
+
// State must come before Adapter or system.adapter.admin.0.foobar will resolve to AdapterObject
|
|
772
|
+
T extends ObjectIDs.State
|
|
231
773
|
? StateObject
|
|
232
774
|
: // Instance and Adapter must come before meta or `system.adapter.admin` will resolve to MetaObject
|
|
233
775
|
T extends ObjectIDs.Instance
|
|
@@ -250,23 +792,42 @@ declare global {
|
|
|
250
792
|
? UserObject
|
|
251
793
|
: T extends ObjectIDs.Host
|
|
252
794
|
? HostObject
|
|
253
|
-
: T extends ObjectIDs.
|
|
254
|
-
?
|
|
255
|
-
: T extends ObjectIDs.
|
|
256
|
-
?
|
|
257
|
-
:
|
|
258
|
-
|
|
259
|
-
|
|
795
|
+
: T extends ObjectIDs.Design
|
|
796
|
+
? DesignObject
|
|
797
|
+
: T extends ObjectIDs.Repository
|
|
798
|
+
? RepositoryObject
|
|
799
|
+
: T extends ObjectIDs.SystemConfig
|
|
800
|
+
? SystemConfigObject
|
|
801
|
+
: T extends ObjectIDs.Config
|
|
802
|
+
? OtherObject & { type: 'config' }
|
|
803
|
+
: T extends ObjectIDs.AdapterScoped
|
|
804
|
+
? AdapterScopedObject
|
|
805
|
+
: Read extends 'read'
|
|
806
|
+
? iobJS.Object
|
|
807
|
+
: AnyObject;
|
|
808
|
+
|
|
809
|
+
type Languages = 'en' | 'de' | 'ru' | 'pt' | 'nl' | 'fr' | 'it' | 'es' | 'pl' | 'uk' | 'zh-cn';
|
|
810
|
+
type Translated = { en: string } & { [lang in Languages]?: string };
|
|
811
|
+
|
|
812
|
+
/** For objects, we require the English language to be present */
|
|
813
|
+
type StringOrTranslated = string | Translated;
|
|
814
|
+
|
|
815
|
+
type CommonType = 'number' | 'string' | 'boolean' | 'array' | 'object' | 'mixed';
|
|
260
816
|
|
|
261
817
|
interface ObjectCommon {
|
|
262
818
|
/** The name of this object as a simple string or an object with translations */
|
|
263
819
|
name: StringOrTranslated;
|
|
264
820
|
|
|
821
|
+
/** Description of this object */
|
|
822
|
+
desc?: StringOrTranslated;
|
|
823
|
+
|
|
265
824
|
/** When set to true, this object may not be deleted */
|
|
266
825
|
dontDelete?: true;
|
|
267
826
|
|
|
268
827
|
/** When set to true, this object is only visible when expert mode is turned on in admin */
|
|
269
828
|
expert?: true;
|
|
829
|
+
/** Color attribute used in UI */
|
|
830
|
+
color?: string;
|
|
270
831
|
|
|
271
832
|
// Icon and role aren't defined in SCHEMA.md,
|
|
272
833
|
// but they are being used by some adapters
|
|
@@ -276,18 +837,9 @@ declare global {
|
|
|
276
837
|
role?: string;
|
|
277
838
|
}
|
|
278
839
|
|
|
279
|
-
interface StateCommonAlias {
|
|
280
|
-
/** The target state id or two target states used for reading and writing values */
|
|
281
|
-
id: string | { read: string; write: string };
|
|
282
|
-
/** An optional conversion function when reading, e.g. `"(val − 32) * 5/9"` */
|
|
283
|
-
read?: string;
|
|
284
|
-
/** An optional conversion function when reading, e.g. `"(val * 9/5) + 32"` */
|
|
285
|
-
write?: string;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
840
|
interface StateCommon extends ObjectCommon {
|
|
289
841
|
/** Type of this state. See https://github.com/ioBroker/ioBroker/blob/master/doc/SCHEMA.md#state-commonrole for a detailed description */
|
|
290
|
-
type
|
|
842
|
+
type: CommonType;
|
|
291
843
|
/** minimum value */
|
|
292
844
|
min?: number;
|
|
293
845
|
/** maximum value */
|
|
@@ -296,8 +848,6 @@ declare global {
|
|
|
296
848
|
step?: number;
|
|
297
849
|
/** unit of the value */
|
|
298
850
|
unit?: string;
|
|
299
|
-
/** description of this state */
|
|
300
|
-
desc?: StringOrTranslated;
|
|
301
851
|
|
|
302
852
|
/** if this state is readable */
|
|
303
853
|
read: boolean;
|
|
@@ -307,62 +857,114 @@ declare global {
|
|
|
307
857
|
role: string;
|
|
308
858
|
|
|
309
859
|
/** the default value */
|
|
310
|
-
def?:
|
|
860
|
+
def?: any;
|
|
311
861
|
/** the default status of the ack flag */
|
|
312
862
|
defAck?: boolean;
|
|
313
863
|
|
|
314
864
|
/** Configures this state as an alias for another state */
|
|
315
|
-
alias?:
|
|
865
|
+
alias?: {
|
|
866
|
+
/** The target state id */
|
|
867
|
+
id:
|
|
868
|
+
| string
|
|
869
|
+
| {
|
|
870
|
+
read: string;
|
|
871
|
+
write: string;
|
|
872
|
+
};
|
|
873
|
+
/** An optional conversion function when reading, e.g. `"(val − 32) * 5/9"` */
|
|
874
|
+
read?: string;
|
|
875
|
+
/** An optional conversion function when reading, e.g. `"(val * 9/5) + 32"` */
|
|
876
|
+
write?: string;
|
|
877
|
+
};
|
|
316
878
|
|
|
317
879
|
/**
|
|
318
880
|
* Dictionary of possible values for this state in the form
|
|
319
|
-
*
|
|
881
|
+
* ```jsonc
|
|
320
882
|
* {
|
|
321
883
|
* "internal value 1": "displayed value 1",
|
|
322
884
|
* "internal value 2": "displayed value 2",
|
|
323
|
-
* ...
|
|
885
|
+
* // ...
|
|
324
886
|
* }
|
|
325
|
-
*
|
|
887
|
+
* ```
|
|
888
|
+
*
|
|
889
|
+
* or as an array:
|
|
890
|
+
* ```jsonc
|
|
891
|
+
* [ "value 1", "value 2", // ... ]
|
|
892
|
+
* ```
|
|
893
|
+
*
|
|
326
894
|
* In old ioBroker versions, this could also be a string of the form
|
|
327
|
-
* "val1:text1;val2:text2" (now deprecated)
|
|
895
|
+
* `"val1:text1;val2:text2"` (now deprecated)
|
|
328
896
|
*/
|
|
329
|
-
states?: Record<string, string> | string;
|
|
897
|
+
states?: Record<string, string> | string[] | string;
|
|
330
898
|
|
|
331
899
|
/** ID of a helper state indicating if the handler of this state is working */
|
|
332
900
|
workingID?: string;
|
|
333
901
|
|
|
334
|
-
/**
|
|
902
|
+
/** attached history information */
|
|
335
903
|
history?: any;
|
|
336
904
|
|
|
337
905
|
/** Custom settings for this state */
|
|
338
906
|
custom?: Record<string, any>;
|
|
339
907
|
|
|
908
|
+
/** Custom defined properties for backward compatibility of material adapter */
|
|
909
|
+
material?: any;
|
|
910
|
+
|
|
911
|
+
/** Custom defined properties for backward compatibility of habpanel adapter */
|
|
912
|
+
habpanel?: any;
|
|
913
|
+
|
|
914
|
+
/** Custom defined properties for backward compatibility of habpanel adapter */
|
|
915
|
+
mobile?: any;
|
|
916
|
+
|
|
340
917
|
/**
|
|
341
918
|
* Settings for IOT adapters and how the state should be named in e.g., Alexa.
|
|
342
|
-
* The string "ignore" is a special case, causing the state to be ignored.
|
|
919
|
+
* The string "ignore" (deprecated please use boolean `false` instead) or boolean value `false` is a special case, causing the state to be ignored.
|
|
920
|
+
* A value of `null` means that the device should be removed by the IOT adapters
|
|
343
921
|
*/
|
|
344
922
|
smartName?:
|
|
923
|
+
| null
|
|
924
|
+
| false
|
|
345
925
|
| string
|
|
346
926
|
| ({ [lang in Languages]?: string } & {
|
|
347
|
-
/** Which kind of device
|
|
927
|
+
/** Which kind of device it is */
|
|
348
928
|
smartType?: string | null;
|
|
349
929
|
/** Which value to set when the ON command is issued */
|
|
350
|
-
|
|
930
|
+
byON?: string | null;
|
|
351
931
|
});
|
|
352
932
|
}
|
|
353
|
-
interface ChannelCommon extends ObjectCommon {
|
|
354
|
-
/** description of this channel */
|
|
355
|
-
desc?: string;
|
|
356
933
|
|
|
934
|
+
interface ChannelCommon extends ObjectCommon {
|
|
357
935
|
// Make it possible to narrow the object type using the custom property
|
|
358
936
|
custom?: undefined;
|
|
359
937
|
}
|
|
938
|
+
|
|
360
939
|
interface DeviceCommon extends ObjectCommon {
|
|
361
|
-
|
|
940
|
+
statusStates?: {
|
|
941
|
+
/** State, which is truthy if a device is online */
|
|
942
|
+
onlineId?: string;
|
|
943
|
+
/** State, which is truthy if a device is offline */
|
|
944
|
+
offlineId?: string;
|
|
945
|
+
/** State, which is truthy if a device is in error state */
|
|
946
|
+
errorId?: string;
|
|
947
|
+
};
|
|
948
|
+
// Make it possible to narrow the object type using the custom property
|
|
949
|
+
custom?: undefined;
|
|
950
|
+
}
|
|
362
951
|
|
|
952
|
+
interface ScheduleCommon extends ObjectCommon {
|
|
953
|
+
enabled?: boolean;
|
|
363
954
|
// Make it possible to narrow the object type using the custom property
|
|
364
955
|
custom?: undefined;
|
|
365
956
|
}
|
|
957
|
+
|
|
958
|
+
interface RepositoryCommon extends ObjectCommon {
|
|
959
|
+
custom?: undefined;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
interface ChartCommon extends ObjectCommon {
|
|
963
|
+
enabled?: boolean;
|
|
964
|
+
// Make it possible to narrow the object type using the custom property
|
|
965
|
+
custom?: undefined;
|
|
966
|
+
}
|
|
967
|
+
|
|
366
968
|
interface EnumCommon extends ObjectCommon {
|
|
367
969
|
/** The IDs of the enum members */
|
|
368
970
|
members?: string[];
|
|
@@ -372,21 +974,59 @@ declare global {
|
|
|
372
974
|
}
|
|
373
975
|
|
|
374
976
|
interface MetaCommon extends ObjectCommon {
|
|
375
|
-
//
|
|
376
|
-
type:
|
|
977
|
+
// Can be of type `user` for folders, where a user can store files or `folder` for adapter internal structures
|
|
978
|
+
type: 'meta.user' | 'meta.folder';
|
|
377
979
|
|
|
378
980
|
// Make it possible to narrow the object type using the custom property
|
|
379
981
|
custom?: undefined;
|
|
380
982
|
}
|
|
381
983
|
|
|
382
|
-
type InstanceMode = 'none' | 'daemon' | '
|
|
383
|
-
|
|
984
|
+
type InstanceMode = 'none' | 'daemon' | 'schedule' | 'once' | 'extension';
|
|
985
|
+
|
|
986
|
+
interface AdminUi {
|
|
987
|
+
/** UI type of config page inside admin UI */
|
|
988
|
+
config: 'html' | 'json' | 'materialize' | 'none';
|
|
989
|
+
/** UI type of custom tab inside admin UI */
|
|
990
|
+
custom?: 'json';
|
|
991
|
+
/** UI type of tab inside admin UI */
|
|
992
|
+
tab?: 'html' | 'json' | 'materialize';
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/** Installed from attribute of instance/adapter object */
|
|
996
|
+
type InstalledFrom = Branded<string, 'InstalledFrom'>;
|
|
997
|
+
|
|
998
|
+
interface InstanceCommon extends AdapterCommon {
|
|
999
|
+
version: string;
|
|
384
1000
|
/** The name of the host where this instance is running */
|
|
385
1001
|
host: string;
|
|
386
1002
|
enabled: boolean;
|
|
387
1003
|
/** How and when this instance should be started */
|
|
388
1004
|
mode: InstanceMode;
|
|
389
|
-
|
|
1005
|
+
/**
|
|
1006
|
+
* The starting priority of this adapter:
|
|
1007
|
+
* - **1:** Logic adapters
|
|
1008
|
+
* - **2:** Data providers
|
|
1009
|
+
* - **3:** All other adapters
|
|
1010
|
+
*/
|
|
1011
|
+
tier?: 1 | 2 | 3;
|
|
1012
|
+
/** Variables of this adapter must be subscribed with sendTo to enable updates */
|
|
1013
|
+
subscribable?: boolean;
|
|
1014
|
+
/** If compact mode is supported */
|
|
1015
|
+
compact?: boolean;
|
|
1016
|
+
/** If compact mode is active */
|
|
1017
|
+
runAsCompactMode?: boolean;
|
|
1018
|
+
/** Active compact group, instances in this group will be started in one process */
|
|
1019
|
+
compactGroup?: number;
|
|
1020
|
+
/** String (or array) with names of attributes in common of instance, which will not be deleted. */
|
|
1021
|
+
preserveSettings?: string | string[];
|
|
1022
|
+
/** Source, where this adapter has been installed from, to enable reinstalling on e.g., backup restore */
|
|
1023
|
+
installedFrom?: InstalledFrom;
|
|
1024
|
+
/** Arguments passed to the adapter process, this disables compact mode */
|
|
1025
|
+
nodeProcessParams?: string[];
|
|
1026
|
+
/** If adapter can consume log messages, like admin, javascript or logparser */
|
|
1027
|
+
logTransporter?: boolean;
|
|
1028
|
+
/** Optional memory limit for this instance */
|
|
1029
|
+
memoryLimitMB?: number;
|
|
390
1030
|
// Make it possible to narrow the object type using the custom property
|
|
391
1031
|
custom?: undefined;
|
|
392
1032
|
}
|
|
@@ -394,7 +1034,10 @@ declare global {
|
|
|
394
1034
|
interface HostCommon extends ObjectCommon {
|
|
395
1035
|
/** The display name of this host */
|
|
396
1036
|
name: string;
|
|
1037
|
+
/** Changeable name of the host */
|
|
397
1038
|
title: string;
|
|
1039
|
+
/** base64 encoded icon */
|
|
1040
|
+
icon?: string;
|
|
398
1041
|
installedVersion: string; // e.g. 1.2.3 (following semver)
|
|
399
1042
|
/** The command line of the executable */
|
|
400
1043
|
cmd: string;
|
|
@@ -413,7 +1056,7 @@ declare global {
|
|
|
413
1056
|
process: {
|
|
414
1057
|
title: string;
|
|
415
1058
|
versions: NodeJS.ProcessVersions;
|
|
416
|
-
env:
|
|
1059
|
+
env: NodeJS.ProcessEnv;
|
|
417
1060
|
};
|
|
418
1061
|
os: {
|
|
419
1062
|
hostname: string;
|
|
@@ -425,19 +1068,472 @@ declare global {
|
|
|
425
1068
|
tmpdir: ReturnType<(typeof os)['tmpdir']>;
|
|
426
1069
|
};
|
|
427
1070
|
hardware: {
|
|
428
|
-
|
|
1071
|
+
/** Return value of os.cpu but property `times` could be removed from every entry */
|
|
1072
|
+
cpus: (Omit<ReturnType<(typeof os)['cpus']>[number], 'times'> &
|
|
1073
|
+
Partial<Pick<ReturnType<(typeof os)['cpus']>[number], 'times'>>)[];
|
|
429
1074
|
totalmem: ReturnType<(typeof os)['totalmem']>;
|
|
430
1075
|
networkInterfaces: ReturnType<(typeof os)['networkInterfaces']>;
|
|
431
1076
|
};
|
|
432
1077
|
}
|
|
433
1078
|
|
|
434
|
-
|
|
1079
|
+
interface UserCommon extends ObjectCommon {
|
|
1080
|
+
/** The username */
|
|
1081
|
+
name: StringOrTranslated;
|
|
1082
|
+
/** The hashed password */
|
|
1083
|
+
password: string;
|
|
1084
|
+
/** Whether this user is enabled */
|
|
1085
|
+
enabled: boolean;
|
|
1086
|
+
|
|
1087
|
+
// Make it possible to narrow the object type using the custom property
|
|
1088
|
+
custom?: undefined;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
interface GroupCommon extends ObjectCommon {
|
|
1092
|
+
/** The name of this group */
|
|
1093
|
+
name: StringOrTranslated;
|
|
1094
|
+
/** The users of this group */
|
|
1095
|
+
members: ObjectIDs.User[]; // system.user.name, ...
|
|
1096
|
+
/** The default permissions of this group */
|
|
1097
|
+
acl: Omit<PermissionSet, 'user' | 'groups'>;
|
|
1098
|
+
/** A group can be disabled, if missing, a group is active */
|
|
1099
|
+
enabled?: boolean;
|
|
1100
|
+
// Make it possible to narrow the object type using the custom property
|
|
1101
|
+
custom?: undefined;
|
|
1102
|
+
}
|
|
435
1103
|
|
|
436
|
-
|
|
1104
|
+
interface ScriptCommon extends ObjectCommon {
|
|
1105
|
+
name: string;
|
|
1106
|
+
/** Defines the type of the script, e.g., TypeScript/ts, Javascript/js or Blockly */
|
|
1107
|
+
engineType: 'TypeScript/ts' | 'Blockly' | 'Rules' | 'Javascript/js';
|
|
1108
|
+
/** The instance id of the instance which executes this script */
|
|
1109
|
+
engine: string;
|
|
1110
|
+
/** The source code of this script */
|
|
1111
|
+
source: string;
|
|
1112
|
+
debug: boolean;
|
|
1113
|
+
verbose: boolean;
|
|
1114
|
+
/** Whether this script should be executed */
|
|
1115
|
+
enabled: boolean;
|
|
1116
|
+
/** Is used to determine whether a script has changed and needs to be recompiled */
|
|
1117
|
+
sourceHash?: string;
|
|
1118
|
+
/** If the script uses a compiled language like TypeScript, this contains the compilation output */
|
|
1119
|
+
compiled?: string;
|
|
1120
|
+
/** If the script uses a compiled language like TypeScript, this contains the generated declarations (global scripts only) */
|
|
1121
|
+
declarations?: string;
|
|
437
1122
|
|
|
438
|
-
|
|
1123
|
+
// Make it possible to narrow the object type using the custom property
|
|
1124
|
+
custom?: undefined;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
type WelcomeScreenEntry =
|
|
1128
|
+
| string
|
|
1129
|
+
| {
|
|
1130
|
+
link: string;
|
|
1131
|
+
name: string;
|
|
1132
|
+
img: string;
|
|
1133
|
+
color: string;
|
|
1134
|
+
order?: number;
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Object which defines if the adapter supports receiving messages via sendTo.
|
|
1139
|
+
* Additionally, it defines if specific messages are supported.
|
|
1140
|
+
* If one property is enabled, the object `system.adapter.<adapterName>.<adapterInstance>.messagebox will be created to send messages to the adapter (used for email, pushover, etc...)
|
|
1141
|
+
*/
|
|
1142
|
+
interface SupportedMessages {
|
|
1143
|
+
/** If custom messages are supported (same as legacy messagebox) */
|
|
1144
|
+
custom?: boolean;
|
|
1145
|
+
/** If notification handling is supported, for information, see https://github.com/foxriver76/ioBroker.notification-manager#requirements-for-messaging-adapters */
|
|
1146
|
+
notifications?: boolean;
|
|
1147
|
+
/** If adapter supports signal stopInstance. Use number if you need more than 1000 ms for stop routine. The signal will be sent before stop to the adapter. (used if problems occurred with SIGTERM). */
|
|
1148
|
+
stopInstance?: boolean | number;
|
|
1149
|
+
/** If adapter supports the device manager and thus responds to the corresponding messages */
|
|
1150
|
+
deviceManager?: boolean;
|
|
1151
|
+
/** If adapter supports getHistory message. */
|
|
1152
|
+
getHistory?: boolean;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
type AutoUpgradePolicy = 'none' | 'patch' | 'minor' | 'major';
|
|
1156
|
+
|
|
1157
|
+
interface VisWidget {
|
|
1158
|
+
i18n: 'component' | true | Translated;
|
|
1159
|
+
name: string;
|
|
1160
|
+
url: string;
|
|
1161
|
+
components: string[];
|
|
1162
|
+
/** The vis widget does not support the listed major versions of vis */
|
|
1163
|
+
ignoreInVersions: number[];
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
type PaidLicenseType = 'paid' | 'commercial' | 'limited';
|
|
1167
|
+
|
|
1168
|
+
interface LicenseInformationFree {
|
|
1169
|
+
/** License of the software */
|
|
1170
|
+
license?: string;
|
|
1171
|
+
/** Use 'paid' for adapters which do not work without a paid license. Use 'commercial' for adapters which require a license for commercial use only. Use 'limited' if some functionalities are not available without a paid license. */
|
|
1172
|
+
type: 'free';
|
|
1173
|
+
/**
|
|
1174
|
+
* Hyperlink, where information about the license can be found. For non-free licenses, the linked page should contain information about free features (if applicable), time of validity, link to shop and seller information.
|
|
1175
|
+
* This is required if the license type is different from 'free'. For 'free' licenses, an optional link to the license file can be placed here.
|
|
1176
|
+
*/
|
|
1177
|
+
link?: string;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
interface LicenseInformationWithPayment {
|
|
1181
|
+
/** License of the software */
|
|
1182
|
+
license?: string;
|
|
1183
|
+
/** Use 'paid' for adapters which do not work without a paid license. Use 'commercial' for adapters which require a license for commercial use only. Use 'limited' if some functionalities are not available without a paid license. */
|
|
1184
|
+
type: PaidLicenseType;
|
|
1185
|
+
/**
|
|
1186
|
+
* Hyperlink, where information about the license can be found. For non-free licenses, the linked page should contain information about free features (if applicable), time of validity, link to shop and seller information.
|
|
1187
|
+
* This is required if the license type is different from 'free'. For 'free' licenses, an optional link to the license file can be placed here.
|
|
1188
|
+
*/
|
|
1189
|
+
link: string;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
type LicenseInformation = LicenseInformationFree | LicenseInformationWithPayment;
|
|
1193
|
+
|
|
1194
|
+
interface MessageRule {
|
|
1195
|
+
/** The message title */
|
|
1196
|
+
title: iobJS.Translated;
|
|
1197
|
+
/** The message content */
|
|
1198
|
+
text: iobJS.Translated;
|
|
1199
|
+
/** Optional link */
|
|
1200
|
+
link?: string;
|
|
1201
|
+
/** Text of the link */
|
|
1202
|
+
linkText?: iobJS.Translated;
|
|
1203
|
+
/** The severity level of the message */
|
|
1204
|
+
level: 'warn' | 'error' | 'info';
|
|
1205
|
+
/** The buttons which should be shown on the message dialog */
|
|
1206
|
+
buttons?: ('agree' | 'cancel' | 'ok')[];
|
|
1207
|
+
/** The condition which needs to be met to display the message */
|
|
1208
|
+
condition: {
|
|
1209
|
+
operand: 'and' | 'or';
|
|
1210
|
+
rules: string[];
|
|
1211
|
+
};
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
interface CustomAdminColumn {
|
|
1215
|
+
path: string;
|
|
1216
|
+
name?: iobJS.StringOrTranslated;
|
|
1217
|
+
objTypes?: ObjectType | ObjectType[];
|
|
1218
|
+
width?: number;
|
|
1219
|
+
edit?: boolean;
|
|
1220
|
+
type?: CommonType;
|
|
1221
|
+
align?: 'left' | 'center' | 'right';
|
|
1222
|
+
}
|
|
439
1223
|
|
|
440
|
-
type
|
|
1224
|
+
type ConnectionType = 'local' | 'cloud';
|
|
1225
|
+
|
|
1226
|
+
type LocalLink = {
|
|
1227
|
+
/** Link to the web service of this adapter, like: "%web_protocol%://%ip%:%web_port%/vis-2/edit.html" */
|
|
1228
|
+
link: string;
|
|
1229
|
+
/** Name of the link. Could be multi-language */
|
|
1230
|
+
name?: iobJS.StringOrTranslated;
|
|
1231
|
+
/** Color */
|
|
1232
|
+
color?: string;
|
|
1233
|
+
/** Link to icon, like "vis-2/img/favicon.png" */
|
|
1234
|
+
icon?: string;
|
|
1235
|
+
/** Link to the adapter if it could be shown in the free cloud, like: vis-2/index.html according to "https://iobroker.net/" */
|
|
1236
|
+
cloud?: string;
|
|
1237
|
+
/** Link to the adapter if it could be shown in the pro-cloud, like: vis-2/edit.html according to "https://iobroker.pro/" */
|
|
1238
|
+
pro?: string;
|
|
1239
|
+
/** If this link should be shown on the intro tab in admin. false = do not show */
|
|
1240
|
+
intro?: boolean;
|
|
1241
|
+
/** Order of the card. Used on "intro" and cloud tabs to sort the links */
|
|
1242
|
+
order?: number;
|
|
1243
|
+
/** Description of the link. Could be multi-language */
|
|
1244
|
+
description?: iobJS.StringOrTranslated;
|
|
1245
|
+
};
|
|
1246
|
+
|
|
1247
|
+
/** Format for local and global dependencies */
|
|
1248
|
+
type Dependencies = { [adapterName: string]: string }[] | string[];
|
|
1249
|
+
|
|
1250
|
+
interface AdapterCommon extends ObjectCommon {
|
|
1251
|
+
/** Custom attributes to be shown in admin in the object browser */
|
|
1252
|
+
adminColumns?: string | (string | CustomAdminColumn)[];
|
|
1253
|
+
/** Type of the admin UI */
|
|
1254
|
+
adminUI?: AdminUi;
|
|
1255
|
+
/** Settings for custom Admin Tabs */
|
|
1256
|
+
adminTab?: {
|
|
1257
|
+
name?: StringOrTranslated;
|
|
1258
|
+
/** Base 64 icon for the tab */
|
|
1259
|
+
icon?: string;
|
|
1260
|
+
/** @deprecated icon name for FontAwesome (works only in admin 4)*/
|
|
1261
|
+
'fa-icon'?: string;
|
|
1262
|
+
/** If true, the Tab is not reloaded when the configuration changes */
|
|
1263
|
+
ignoreConfigUpdate?: boolean;
|
|
1264
|
+
/** Describes which URL should be loaded in the tab. Supports placeholders like http://%ip%:%port% or JSON(5) configs. If empty `adapter/ADAPTERNAME/tab(_m).html` will be taken. JSON config file must be defined relative to "admin" folder, like "jsonTab.json" */
|
|
1265
|
+
link?: string;
|
|
1266
|
+
/** If true, only one instance of this tab will be created for all instances */
|
|
1267
|
+
singleton?: boolean;
|
|
1268
|
+
/** Order number in admin tabs */
|
|
1269
|
+
order?: number;
|
|
1270
|
+
};
|
|
1271
|
+
/** If the mode is `schedule`, start one time adapter by ioBroker start, or by the configuration changes */
|
|
1272
|
+
allowInit?: boolean;
|
|
1273
|
+
/** If the adapter should be automatically upgraded and which version ranges are supported */
|
|
1274
|
+
automaticUpgrade?: AutoUpgradePolicy;
|
|
1275
|
+
/** Possible values for the instance mode (if more than one is possible) */
|
|
1276
|
+
availableModes?: InstanceMode[];
|
|
1277
|
+
/** Array which lists all blocked versions. Blocked versions will not be started. Use semver notation to specify the version ranges. The information is always used from the io-package.json in the GitHub repository. */
|
|
1278
|
+
blockedVersions?: string[];
|
|
1279
|
+
/** Whether this adapter includes custom blocks for Blockly. If true, `admin/blockly.js` must exist. */
|
|
1280
|
+
blockly?: boolean;
|
|
1281
|
+
/** Where the adapter will get its data from. Set this together with @see dataSource */
|
|
1282
|
+
connectionType?: ConnectionType;
|
|
1283
|
+
/** If true, this adapter can be started in compact mode (in the same process as other adapters) */
|
|
1284
|
+
compact?: boolean;
|
|
1285
|
+
/** The directory relative to iobroker-data where the adapter stores the data. Supports the placeholder `%INSTANCE%`. This folder will be backed up and restored automatically. */
|
|
1286
|
+
dataFolder?: string;
|
|
1287
|
+
/** How the adapter will mainly receive its data. Set this together with @see connectionType */
|
|
1288
|
+
dataSource?: 'poll' | 'push' | 'assumption';
|
|
1289
|
+
/** A record of ioBroker adapters (including "js-controller") and version ranges which are required for this adapter on the same host. */
|
|
1290
|
+
dependencies?: Dependencies;
|
|
1291
|
+
/** A record of ioBroker adapters (including "js-controller") and version ranges which are required for this adapter in the whole system. */
|
|
1292
|
+
globalDependencies?: Dependencies;
|
|
1293
|
+
/** Similar to `dependencies`, but only checked if the specified adapter is already installed. If the adapter is not installed, the version check will pass */
|
|
1294
|
+
ifInstalledDependencies?: { [adapterName: string]: string };
|
|
1295
|
+
/** Which files outside the README.md have documentation for the adapter */
|
|
1296
|
+
docs?: Partial<Record<Languages, string | string[]>>;
|
|
1297
|
+
/** Whether new instances should be enabled by default. *Should* be `false`! */
|
|
1298
|
+
enabled: boolean;
|
|
1299
|
+
/** If true, all previous data in the target directory (web) should be deleted before uploading */
|
|
1300
|
+
eraseOnUpload?: boolean;
|
|
1301
|
+
/** URL of an external icon that is shown for adapters that are not installed */
|
|
1302
|
+
extIcon?: string;
|
|
1303
|
+
/** Whether this adapter responds to `getHistory` messages */
|
|
1304
|
+
getHistory?: boolean;
|
|
1305
|
+
/** Filename of the local icon which is shown for installed adapters. Should be located in the `admin` directory */
|
|
1306
|
+
icon?: string;
|
|
1307
|
+
/** The adapter will be executed once additionally after installation, and the `install` event will be emitted during this run. This allows for executing one time installation code. */
|
|
1308
|
+
install?: boolean;
|
|
1309
|
+
/** Source, where this adapter has been installed from, to enable reinstalling on e.g., backup restore */
|
|
1310
|
+
installedFrom?: InstalledFrom;
|
|
1311
|
+
/** Shows which version of this adapter is installed */
|
|
1312
|
+
installedVersion: string;
|
|
1313
|
+
/** Keywords are used by search in admin. Do not write ioBroker here */
|
|
1314
|
+
keywords?: string[];
|
|
1315
|
+
/** A dictionary of links to web services this adapter provides */
|
|
1316
|
+
localLinks?: Record<string, string | LocalLink>;
|
|
1317
|
+
/** @deprecated Use @see localLinks */
|
|
1318
|
+
localLink?: string;
|
|
1319
|
+
/** Default log level for this adapter. It can be changed for every instance separately */
|
|
1320
|
+
loglevel?: LogLevel;
|
|
1321
|
+
/** Whether this adapter receives logs from other hosts and adapters (e.g., to store them somewhere) */
|
|
1322
|
+
logTransporter?: boolean;
|
|
1323
|
+
/** Path to the start file of the adapter. Should be the same as in `package.json` */
|
|
1324
|
+
main?: string;
|
|
1325
|
+
/** Whether the admin tab is written in materialized style. Required for Admin 3+ */
|
|
1326
|
+
materializeTab?: boolean;
|
|
1327
|
+
/** Whether the admin configuration dialog is written in materialized style. Required for Admin 3+ */
|
|
1328
|
+
materialize: boolean;
|
|
1329
|
+
/** @deprecated Use @see supportedMessages up from controller v5 */
|
|
1330
|
+
messagebox?: true;
|
|
1331
|
+
/** Messages which are supported by the adapter, supportedMessages.custom: true is the equivalent to messagebox: true */
|
|
1332
|
+
supportedMessages?: SupportedMessages;
|
|
1333
|
+
/** Running mode: `none`, `daemon`, `schedule`, `once`, `extension` */
|
|
1334
|
+
mode: InstanceMode;
|
|
1335
|
+
/** Name of the adapter (without leading `ioBroker.`) */
|
|
1336
|
+
name: string;
|
|
1337
|
+
/** News per version in i18n */
|
|
1338
|
+
news?: { [version: string]: Translated };
|
|
1339
|
+
/** If `true`, no configuration dialog will be shown */
|
|
1340
|
+
noConfig?: true;
|
|
1341
|
+
/** If `true`, this adapter's instances will not be shown in the admin overview screen. Useful for icon sets and widgets... */
|
|
1342
|
+
noIntro?: true;
|
|
1343
|
+
/** Set to `true` if the adapter is not available in the official ioBroker repositories. */
|
|
1344
|
+
noRepository?: true;
|
|
1345
|
+
/** If `true`, manual installation from GitHub is not possible */
|
|
1346
|
+
nogit?: true;
|
|
1347
|
+
/** If `true`, this adapter cannot be deleted or updated manually. */
|
|
1348
|
+
nondeletable?: true;
|
|
1349
|
+
/** If `true`, this "adapter" only contains HTML files and no main executable */
|
|
1350
|
+
onlyWWW?: boolean;
|
|
1351
|
+
/** Used to configure native (OS) dependencies of this adapter that need to be installed with system package manager before installing the adapter */
|
|
1352
|
+
osDependencies?: {
|
|
1353
|
+
/** For OSX */
|
|
1354
|
+
darwin: string[];
|
|
1355
|
+
/** For Linux */
|
|
1356
|
+
linux: string[];
|
|
1357
|
+
/** For Windows */
|
|
1358
|
+
win32: string[];
|
|
1359
|
+
};
|
|
1360
|
+
/** Which OSes this adapter supports */
|
|
1361
|
+
os?: 'linux' | 'darwin' | 'win32' | Array<'linux' | 'darwin' | 'win32'>;
|
|
1362
|
+
/** Constant */
|
|
1363
|
+
platform: 'Javascript/Node.js';
|
|
1364
|
+
/** The keys of common attributes (e.g. `history`) which are not deleted in a `setObject` call even if they are not present. Deletion must be done explicitly by setting them to `null`. */
|
|
1365
|
+
preserveSettings?: string | string[];
|
|
1366
|
+
/** Url of the ReadMe file */
|
|
1367
|
+
readme?: string;
|
|
1368
|
+
/** Which adapters must be restarted after installing or updating this adapter. */
|
|
1369
|
+
restartAdapters?: string[];
|
|
1370
|
+
/** CRON schedule to restart mode `daemon` adapters */
|
|
1371
|
+
restartSchedule?: string;
|
|
1372
|
+
/** If the adapter runs in `schedule` mode, this contains the CRON */
|
|
1373
|
+
schedule?: string;
|
|
1374
|
+
/** Whether this adapter may only be installed once per host */
|
|
1375
|
+
singletonHost?: boolean;
|
|
1376
|
+
/** Whether this adapter may only be installed once in the whole system */
|
|
1377
|
+
singleton?: boolean;
|
|
1378
|
+
/** Whether the adapter must be stopped before an update */
|
|
1379
|
+
stopBeforeUpdate?: boolean;
|
|
1380
|
+
/** Overrides the default timeout that ioBroker will wait before force-stopping the adapter */
|
|
1381
|
+
stopTimeout?: number;
|
|
1382
|
+
/** This adapter supports a special mode: if someone subscribes on its states, it starts to read them. It is done to save the bandwidth or load of the slave device */
|
|
1383
|
+
subscribable?: boolean;
|
|
1384
|
+
/** If `true`, this adapter provides custom per-state settings. Requires a `custom_m.html` file in the `admin` directory. */
|
|
1385
|
+
supportCustoms?: boolean;
|
|
1386
|
+
/** @deprecated Use @see supportedMessages up from controller v5 */
|
|
1387
|
+
supportStopInstance?: boolean;
|
|
1388
|
+
/** The translated names of this adapter to be shown in the admin UI */
|
|
1389
|
+
titleLang?: StringOrTranslated;
|
|
1390
|
+
/** @deprecated The name of this adapter to be shown in the admin UI. Use @see titleLang instead. */
|
|
1391
|
+
title?: string;
|
|
1392
|
+
/** The type of this adapter */
|
|
1393
|
+
type?:
|
|
1394
|
+
| 'alarm'
|
|
1395
|
+
| 'climate-control'
|
|
1396
|
+
| 'communication'
|
|
1397
|
+
| 'date-and-time'
|
|
1398
|
+
| 'energy'
|
|
1399
|
+
| 'garden'
|
|
1400
|
+
| 'general'
|
|
1401
|
+
| 'geoposition'
|
|
1402
|
+
| 'hardware'
|
|
1403
|
+
| 'health'
|
|
1404
|
+
| 'household'
|
|
1405
|
+
| 'infrastructure'
|
|
1406
|
+
| 'iot-systems'
|
|
1407
|
+
| 'lighting'
|
|
1408
|
+
| 'logic'
|
|
1409
|
+
| 'messaging'
|
|
1410
|
+
| 'metering'
|
|
1411
|
+
| 'misc-data'
|
|
1412
|
+
| 'multimedia'
|
|
1413
|
+
| 'network'
|
|
1414
|
+
| 'protocols'
|
|
1415
|
+
| 'storage'
|
|
1416
|
+
| 'utility'
|
|
1417
|
+
| 'vehicle'
|
|
1418
|
+
| 'visualization'
|
|
1419
|
+
| 'visualization-icons'
|
|
1420
|
+
| 'visualization-widgets'
|
|
1421
|
+
| 'weather';
|
|
1422
|
+
/** If `true`, the `npm` package must be installed with the `--unsafe-perm` flag */
|
|
1423
|
+
unsafePerm?: true;
|
|
1424
|
+
/** The available version in the ioBroker repo. */
|
|
1425
|
+
version: string;
|
|
1426
|
+
/** Definition of the vis-2 widgets */
|
|
1427
|
+
visWidgets?: Record<string, VisWidget>;
|
|
1428
|
+
/** Include the adapter version in the URL of the web adapter, e.g. `http://ip:port/1.2.3/material` instead of `http://ip:port/material` */
|
|
1429
|
+
webByVersion?: boolean;
|
|
1430
|
+
/** Whether the web server in this adapter can be extended with plugin/extensions */
|
|
1431
|
+
webExtendable?: boolean;
|
|
1432
|
+
/** Relative path to a module that contains an extension for the web adapter. Use together with @see native.webInstance to configure which instances this affects */
|
|
1433
|
+
webExtension?: string;
|
|
1434
|
+
/** List of parameters that must be included in info.js by webServer adapter. (Example material: `"webPreSettings": { "materialBackground": "native.loadingBackground" }`). Web adapter uses this setting to create a customized info.js file to provide some essential settings for index.html file before the socket connection is established to provide e.g., background color of the loading screen. */
|
|
1435
|
+
webPreSettings?: Record<string, any>;
|
|
1436
|
+
/** @deprecated (where is it necessary?) Array of web server's instances that should serve content from the adapter's www folder */
|
|
1437
|
+
webservers?: string[];
|
|
1438
|
+
/** @deprecated (use localLinks) A list of pages that should be shown on the "web" index page */
|
|
1439
|
+
welcomeScreen?: WelcomeScreenEntry[];
|
|
1440
|
+
/** @deprecated (use localLinks) A list of pages that should be shown on the ioBroker cloud index page */
|
|
1441
|
+
welcomeScreenPro?: WelcomeScreenEntry[];
|
|
1442
|
+
/** @deprecated (rename the `www` folder in e.g. `adminWww`) If true, the `www` folder will be not uploaded into DB */
|
|
1443
|
+
wwwDontUpload?: boolean;
|
|
1444
|
+
/** @deprecated Use 'common.licenseInformation' instead */
|
|
1445
|
+
license?: string;
|
|
1446
|
+
/** An object representing information with the license details */
|
|
1447
|
+
licenseInformation?: LicenseInformation;
|
|
1448
|
+
/** Messages, that will be shown (if condition evaluates to true) by upgrade or installation */
|
|
1449
|
+
messages?: MessageRule[];
|
|
1450
|
+
/** If a specific update of this adapter should be ignored, specifies version number to be ignored */
|
|
1451
|
+
ignoreVersion?: string;
|
|
1452
|
+
/** Sentry and other plugins */
|
|
1453
|
+
plugins?: { [pluginName: string]: Record<string, any> };
|
|
1454
|
+
/** Rules blocks for JavaScript rules */
|
|
1455
|
+
javascriptRules?: {
|
|
1456
|
+
/** Translations */
|
|
1457
|
+
i18n?: boolean | Record<string, Record<iobJS.Languages, string>> | Record<string, string>;
|
|
1458
|
+
/** Where to load the blocks, like "rules/customRuleBlocks.js" */
|
|
1459
|
+
url: string;
|
|
1460
|
+
/** Rules block name, like "ActionTelegram" */
|
|
1461
|
+
name: string;
|
|
1462
|
+
/** Load it as TypeScript module */
|
|
1463
|
+
type?: 'module';
|
|
1464
|
+
};
|
|
1465
|
+
|
|
1466
|
+
// Make it possible to narrow the object type using the custom property
|
|
1467
|
+
custom?: undefined;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
interface SystemConfigCommon extends ObjectCommon {
|
|
1471
|
+
/** Name of all active repositories */
|
|
1472
|
+
activeRepo: string[];
|
|
1473
|
+
/** Current configured language */
|
|
1474
|
+
language: Languages;
|
|
1475
|
+
/** If floating comma is used instead of dot */
|
|
1476
|
+
isFloatComma: boolean;
|
|
1477
|
+
/** Configured longitude */
|
|
1478
|
+
longitude?: number;
|
|
1479
|
+
/** Configured latitude */
|
|
1480
|
+
latitude?: number;
|
|
1481
|
+
/** Optional user's city (only for diagnostics) */
|
|
1482
|
+
city?: string;
|
|
1483
|
+
/** Optional user's country (only for diagnostics) */
|
|
1484
|
+
country?: string;
|
|
1485
|
+
/** User-defined temperature unit */
|
|
1486
|
+
tempUnit?: '°C' | '°F';
|
|
1487
|
+
/** User-defined currency */
|
|
1488
|
+
currency?: string;
|
|
1489
|
+
/** User-defined first day of the week */
|
|
1490
|
+
firstDayOfWeek?: 'monday' | 'sunday';
|
|
1491
|
+
/** Default history instance */
|
|
1492
|
+
defaultHistory: string;
|
|
1493
|
+
/** Which diag data is allowed to be sent */
|
|
1494
|
+
diag: 'none' | 'extended' | 'no-city';
|
|
1495
|
+
/** If license has already been confirmed */
|
|
1496
|
+
licenseConfirmed: boolean;
|
|
1497
|
+
/** System wide default log level */
|
|
1498
|
+
defaultLogLevel?: LogLevel;
|
|
1499
|
+
/** Used date format for formatting */
|
|
1500
|
+
dateFormat: string;
|
|
1501
|
+
/** This name will be shown in admin's header. Just to identify the whole installation */
|
|
1502
|
+
siteName?: string;
|
|
1503
|
+
/** Default acl for new objects */
|
|
1504
|
+
defaultNewAcl: {
|
|
1505
|
+
object: number;
|
|
1506
|
+
state: number;
|
|
1507
|
+
file: number;
|
|
1508
|
+
owner: ObjectIDs.User;
|
|
1509
|
+
ownerGroup: ObjectIDs.Group;
|
|
1510
|
+
};
|
|
1511
|
+
/** Configured auto upgrade policy */
|
|
1512
|
+
adapterAutoUpgrade?: {
|
|
1513
|
+
/** Configuration for each repository */
|
|
1514
|
+
repositories: {
|
|
1515
|
+
[repoName: string]: boolean;
|
|
1516
|
+
};
|
|
1517
|
+
/** Default policy, if none has been set explicit for the adapter */
|
|
1518
|
+
defaultPolicy: AutoUpgradePolicy;
|
|
1519
|
+
};
|
|
1520
|
+
/** Deactivated instances, that should not be shown in admin/Intro page */
|
|
1521
|
+
intro?: string[];
|
|
1522
|
+
/** Defines which tabs are visible in the left menu of the admin */
|
|
1523
|
+
tabsVisible?: {
|
|
1524
|
+
/** Name of the tab */
|
|
1525
|
+
name: string;
|
|
1526
|
+
/** If the tab should be visible */
|
|
1527
|
+
visible: boolean;
|
|
1528
|
+
/** Optional color of the tab */
|
|
1529
|
+
color?: string;
|
|
1530
|
+
}[];
|
|
1531
|
+
/** Global saved expert mode for admin */
|
|
1532
|
+
expertMode?: boolean;
|
|
1533
|
+
|
|
1534
|
+
// Make it possible to narrow the object type using the custom property
|
|
1535
|
+
custom?: undefined;
|
|
1536
|
+
}
|
|
441
1537
|
|
|
442
1538
|
interface OtherCommon extends ObjectCommon {
|
|
443
1539
|
[propName: string]: any;
|
|
@@ -446,6 +1542,24 @@ declare global {
|
|
|
446
1542
|
custom?: undefined;
|
|
447
1543
|
}
|
|
448
1544
|
|
|
1545
|
+
/**
|
|
1546
|
+
* ioBroker has built-in protection for specific attributes of objects. If this protection is installed in the object, then the protected attributes of an object cannot be changed by the user without a valid password.
|
|
1547
|
+
* To protect the properties from change, the special attribute "nonEdit" must be added to the object. This attribute contains the password, which is required to change the object.
|
|
1548
|
+
* If an object does not have "nonEdit" attribute, so the hash will be saved into "nonEdit.passHash". After that, if someone changes the object, he must provide the password in "nonEdit.password".
|
|
1549
|
+
* If the password is correct, the object attributes will be updated. If the password is wrong, the object will not be changed.
|
|
1550
|
+
* Note, that all properties outside "nonEdit" can be updated without providing the password. Furthermore, do not confuse e.g. "nonEdit.common" with "obj.common" they are not linked in any way.
|
|
1551
|
+
*/
|
|
1552
|
+
interface NonEditable {
|
|
1553
|
+
/** Password needed to edit non-editable information */
|
|
1554
|
+
password?: string;
|
|
1555
|
+
/** Hashed version of current password */
|
|
1556
|
+
passHash?: string;
|
|
1557
|
+
/** These properties can only be changed by providing the password, else they stay on the initial value */
|
|
1558
|
+
common?: Record<string, any>;
|
|
1559
|
+
/** These properties can only be changed by providing the password, else they stay on the initial value */
|
|
1560
|
+
native?: Record<string, any>;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
449
1563
|
/* Base type for Objects. Should not be used directly */
|
|
450
1564
|
interface BaseObject {
|
|
451
1565
|
/** The ID of this object */
|
|
@@ -455,12 +1569,14 @@ declare global {
|
|
|
455
1569
|
// without bugging users to change their code --> https://github.com/microsoft/TypeScript/issues/15300
|
|
456
1570
|
native: Record<string, any>;
|
|
457
1571
|
common: Record<string, any>;
|
|
458
|
-
enums?: Record<string, string>;
|
|
1572
|
+
enums?: Record<string, string | Translated>;
|
|
459
1573
|
acl?: ObjectACL;
|
|
460
1574
|
from?: string;
|
|
461
1575
|
/** The user who created or updated this object */
|
|
462
1576
|
user?: string;
|
|
463
1577
|
ts?: number;
|
|
1578
|
+
/** These properties can only be edited if the correct password is provided */
|
|
1579
|
+
nonEdit?: NonEditable;
|
|
464
1580
|
}
|
|
465
1581
|
|
|
466
1582
|
interface StateObject extends BaseObject {
|
|
@@ -472,6 +1588,7 @@ declare global {
|
|
|
472
1588
|
/** The names of enums this state is assigned to. For example ["Licht","Garten"] */
|
|
473
1589
|
enumNames?: Array<iobJS.StringOrTranslated>;
|
|
474
1590
|
}
|
|
1591
|
+
|
|
475
1592
|
interface PartialStateObject extends Partial<Omit<StateObject, 'common' | 'acl'>> {
|
|
476
1593
|
common?: Partial<StateCommon>;
|
|
477
1594
|
acl?: Partial<StateACL>;
|
|
@@ -481,6 +1598,7 @@ declare global {
|
|
|
481
1598
|
type: 'channel';
|
|
482
1599
|
common: ChannelCommon;
|
|
483
1600
|
}
|
|
1601
|
+
|
|
484
1602
|
interface PartialChannelObject extends Partial<Omit<ChannelObject, 'common'>> {
|
|
485
1603
|
common?: Partial<ChannelCommon>;
|
|
486
1604
|
}
|
|
@@ -489,6 +1607,7 @@ declare global {
|
|
|
489
1607
|
type: 'device';
|
|
490
1608
|
common: DeviceCommon;
|
|
491
1609
|
}
|
|
1610
|
+
|
|
492
1611
|
interface PartialDeviceObject extends Partial<Omit<DeviceObject, 'common'>> {
|
|
493
1612
|
common?: Partial<DeviceCommon>;
|
|
494
1613
|
}
|
|
@@ -498,6 +1617,7 @@ declare global {
|
|
|
498
1617
|
// Nothing is set in stone here, so start with allowing every property
|
|
499
1618
|
common: OtherCommon;
|
|
500
1619
|
}
|
|
1620
|
+
|
|
501
1621
|
interface PartialFolderObject extends Partial<Omit<FolderObject, 'common'>> {
|
|
502
1622
|
common?: Partial<OtherCommon>;
|
|
503
1623
|
}
|
|
@@ -506,6 +1626,7 @@ declare global {
|
|
|
506
1626
|
type: 'enum';
|
|
507
1627
|
common: EnumCommon;
|
|
508
1628
|
}
|
|
1629
|
+
|
|
509
1630
|
interface PartialEnumObject extends Partial<Omit<EnumObject, 'common'>> {
|
|
510
1631
|
common?: Partial<EnumCommon>;
|
|
511
1632
|
}
|
|
@@ -514,52 +1635,190 @@ declare global {
|
|
|
514
1635
|
type: 'meta';
|
|
515
1636
|
common: MetaCommon;
|
|
516
1637
|
}
|
|
1638
|
+
|
|
517
1639
|
interface PartialMetaObject extends Partial<Omit<MetaObject, 'common'>> {
|
|
518
1640
|
common?: Partial<MetaCommon>;
|
|
519
1641
|
}
|
|
520
1642
|
|
|
521
|
-
interface
|
|
1643
|
+
interface ChartObject extends BaseObject {
|
|
1644
|
+
type: 'chart';
|
|
1645
|
+
common: ChartCommon;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
type PartialChartObject = ChartObject;
|
|
1649
|
+
|
|
1650
|
+
interface ScheduleObject extends BaseObject {
|
|
1651
|
+
type: 'schedule';
|
|
1652
|
+
common: ScheduleCommon;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
interface PartialScheduleObject extends Partial<Omit<ScheduleObject, 'common'>> {
|
|
1656
|
+
common?: Partial<ScheduleCommon>;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
interface PartialRepositoryObject extends Partial<Omit<RepositoryObject, 'common'>> {
|
|
1660
|
+
common?: Partial<RepositoryCommon>;
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
interface RepositoryJsonAdapterContent {
|
|
1664
|
+
/** Adapter name */
|
|
1665
|
+
name: string;
|
|
1666
|
+
/** Newest available version */
|
|
1667
|
+
version: string;
|
|
1668
|
+
/** Array of blocked versions, each entry represents a semver range */
|
|
1669
|
+
blockedVersions: string[];
|
|
1670
|
+
/** If true, the unsafe perm flag is needed on install */
|
|
1671
|
+
unsafePerm?: boolean;
|
|
1672
|
+
/** If given, the packet name differs from the adapter name, e.g. because it is a scoped package */
|
|
1673
|
+
packetName?: string;
|
|
1674
|
+
|
|
1675
|
+
/** Other Adapter related properties, not important for this implementation */
|
|
1676
|
+
[other: string]: unknown;
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
interface RepoInfo {
|
|
1680
|
+
/** If it is the official stable repository */
|
|
1681
|
+
stable?: boolean;
|
|
1682
|
+
/** i18n name of the repository */
|
|
1683
|
+
name: Required<iobJS.Translated>;
|
|
1684
|
+
/** Time of repository update */
|
|
1685
|
+
repoTime: string;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
interface RepositoryJson {
|
|
1689
|
+
/** Information about the repository: creation time, name, is it stable */
|
|
1690
|
+
_repoInfo: RepoInfo;
|
|
1691
|
+
|
|
1692
|
+
/** Information about each adapter */
|
|
1693
|
+
[adapter: string]: RepositoryJsonAdapterContent | RepoInfo;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
interface RepositoryInformation {
|
|
1697
|
+
/** Url to the repository */
|
|
1698
|
+
link: string;
|
|
1699
|
+
json: RepositoryJson | null;
|
|
1700
|
+
hash?: string;
|
|
1701
|
+
time?: string;
|
|
1702
|
+
/** If this repository stable */
|
|
1703
|
+
stable?: boolean;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
interface RepositoryObject extends BaseObject {
|
|
1707
|
+
_id: ObjectIDs.Repository;
|
|
1708
|
+
type: 'config';
|
|
1709
|
+
native: {
|
|
1710
|
+
repositories: {
|
|
1711
|
+
[repoName: string]: RepositoryInformation;
|
|
1712
|
+
};
|
|
1713
|
+
oldRepositories?: {
|
|
1714
|
+
[repoName: string]: RepositoryInformation;
|
|
1715
|
+
};
|
|
1716
|
+
};
|
|
1717
|
+
common: RepositoryCommon;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
interface InstanceObject extends Omit<AdapterObject, 'type'>, BaseObject {
|
|
1721
|
+
_id: ObjectIDs.Instance;
|
|
522
1722
|
type: 'instance';
|
|
523
1723
|
common: InstanceCommon;
|
|
524
1724
|
}
|
|
1725
|
+
|
|
525
1726
|
interface PartialInstanceObject extends Partial<Omit<InstanceObject, 'common'>> {
|
|
526
1727
|
common?: Partial<InstanceCommon>;
|
|
527
1728
|
}
|
|
528
1729
|
|
|
1730
|
+
// it is defined in notificationHandler.ts
|
|
1731
|
+
type NotificationCategory = {
|
|
1732
|
+
/** The unique category identifier */
|
|
1733
|
+
category:
|
|
1734
|
+
| 'memIssues'
|
|
1735
|
+
| 'fsIoErrors'
|
|
1736
|
+
| 'noDiskSpace'
|
|
1737
|
+
| 'accessErrors'
|
|
1738
|
+
| 'nonExistingFileErrors'
|
|
1739
|
+
| 'remoteHostErrors'
|
|
1740
|
+
| 'restartLoop'
|
|
1741
|
+
| 'fileToJsonl'
|
|
1742
|
+
| 'automaticAdapterUpgradeFailed'
|
|
1743
|
+
| 'automaticAdapterUpgradeSuccessful'
|
|
1744
|
+
| 'blockedVersions'
|
|
1745
|
+
| 'databaseErrors'
|
|
1746
|
+
| 'securityIssues'
|
|
1747
|
+
| 'packageUpdates'
|
|
1748
|
+
| 'systemRebootRequired'
|
|
1749
|
+
| 'diskSpaceIssues'
|
|
1750
|
+
| (string & {});
|
|
1751
|
+
/** The human-readable category name */
|
|
1752
|
+
name: Translated;
|
|
1753
|
+
/** The human-readable category description */
|
|
1754
|
+
description: Translated;
|
|
1755
|
+
/** Allows to define the severity of the notification with `info` being the lowest `notify` representing middle priority, `alert` representing high priority and often containing critical information */
|
|
1756
|
+
severity: 'info' | 'notify' | 'alert';
|
|
1757
|
+
/** If a regex is specified, the js-controller will check error messages on adapter crashes against this regex and will generate a notification of this category */
|
|
1758
|
+
regex: string[];
|
|
1759
|
+
/** Deletes older messages if more than the specified amount is present for this category */
|
|
1760
|
+
limit: number;
|
|
1761
|
+
};
|
|
1762
|
+
|
|
1763
|
+
interface Notification {
|
|
1764
|
+
/** E.g., `system`. Each adapter can define its own "scopes" for own notifications with its own categories which then will be available in the system. Adapters should only register one scope which matches the name of the adapter. */
|
|
1765
|
+
scope: string;
|
|
1766
|
+
/** The human-readable name of this scope */
|
|
1767
|
+
name: Translated;
|
|
1768
|
+
/** The human-readable description of this scope */
|
|
1769
|
+
description: Translated;
|
|
1770
|
+
/** All notification categories of this scope */
|
|
1771
|
+
categories: NotificationCategory[];
|
|
1772
|
+
}
|
|
1773
|
+
|
|
529
1774
|
interface AdapterObject extends BaseObject {
|
|
1775
|
+
_id: ObjectIDs.Adapter;
|
|
530
1776
|
type: 'adapter';
|
|
531
1777
|
common: AdapterCommon;
|
|
532
1778
|
/** An array of `native` properties which cannot be accessed from outside the defining adapter */
|
|
533
1779
|
protectedNative?: string[];
|
|
534
1780
|
/** Like protectedNative, but the properties are also encrypted and decrypted automatically */
|
|
535
1781
|
encryptedNative?: string[];
|
|
1782
|
+
/** Register notifications for the built-in notification system */
|
|
1783
|
+
notifications?: Notification[];
|
|
1784
|
+
/** Objects created for each instance, inside the namespace of this adapter */
|
|
1785
|
+
instanceObjects: (StateObject | DeviceObject | ChannelObject | FolderObject | MetaObject)[];
|
|
1786
|
+
/** Objects created for the adapter, anywhere in the global namespace */
|
|
1787
|
+
objects: iobJS.AnyObject[];
|
|
536
1788
|
}
|
|
1789
|
+
|
|
537
1790
|
interface PartialAdapterObject extends Partial<Omit<AdapterObject, 'common'>> {
|
|
538
1791
|
common?: Partial<AdapterCommon>;
|
|
539
1792
|
}
|
|
540
1793
|
|
|
541
1794
|
interface HostObject extends BaseObject {
|
|
1795
|
+
_id: ObjectIDs.Host;
|
|
542
1796
|
type: 'host';
|
|
543
1797
|
common: HostCommon;
|
|
544
1798
|
native: HostNative;
|
|
545
1799
|
}
|
|
1800
|
+
|
|
546
1801
|
interface PartialHostObject extends Partial<Omit<HostObject, 'common' | 'native'>> {
|
|
547
1802
|
common?: Partial<HostCommon>;
|
|
548
1803
|
native?: Partial<HostNative>;
|
|
549
1804
|
}
|
|
550
1805
|
|
|
551
1806
|
interface UserObject extends BaseObject {
|
|
1807
|
+
_id: ObjectIDs.User;
|
|
552
1808
|
type: 'user';
|
|
553
1809
|
common: UserCommon;
|
|
554
1810
|
}
|
|
1811
|
+
|
|
555
1812
|
interface PartialUserObject extends Partial<Omit<UserObject, 'common'>> {
|
|
556
1813
|
common?: Partial<UserCommon>;
|
|
557
1814
|
}
|
|
558
1815
|
|
|
559
1816
|
interface GroupObject extends BaseObject {
|
|
1817
|
+
_id: ObjectIDs.Group;
|
|
560
1818
|
type: 'group';
|
|
561
1819
|
common: GroupCommon;
|
|
562
1820
|
}
|
|
1821
|
+
|
|
563
1822
|
interface PartialGroupObject extends Partial<Omit<GroupObject, 'common'>> {
|
|
564
1823
|
common?: Partial<GroupCommon>;
|
|
565
1824
|
}
|
|
@@ -568,18 +1827,42 @@ declare global {
|
|
|
568
1827
|
type: 'script';
|
|
569
1828
|
common: ScriptCommon;
|
|
570
1829
|
}
|
|
1830
|
+
|
|
571
1831
|
interface PartialScriptObject extends Partial<Omit<ScriptObject, 'common'>> {
|
|
572
1832
|
common?: Partial<ScriptCommon>;
|
|
573
1833
|
}
|
|
574
1834
|
|
|
1835
|
+
interface SystemConfigObject extends BaseObject {
|
|
1836
|
+
type: 'config';
|
|
1837
|
+
common: SystemConfigCommon;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
interface PartialSystemConfigObject extends Partial<Omit<SystemConfigObject, 'common'>> {
|
|
1841
|
+
common?: Partial<SystemConfigCommon>;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
575
1844
|
interface OtherObject extends BaseObject {
|
|
576
1845
|
type: 'config' | 'chart';
|
|
577
1846
|
common: OtherCommon;
|
|
578
1847
|
}
|
|
1848
|
+
|
|
579
1849
|
interface PartialOtherObject extends Partial<Omit<OtherObject, 'common'>> {
|
|
580
1850
|
common?: Partial<OtherCommon>;
|
|
581
1851
|
}
|
|
582
1852
|
|
|
1853
|
+
interface DesignObject extends Omit<BaseObject, 'common'> {
|
|
1854
|
+
// allow narrowing the type without making it a pain
|
|
1855
|
+
type: 'design';
|
|
1856
|
+
_id: ObjectIDs.Design;
|
|
1857
|
+
language: 'javascript';
|
|
1858
|
+
common?: OtherCommon;
|
|
1859
|
+
views: Record<string, { map: string }>;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
interface PartialDesignObject extends Partial<Omit<DesignObject, 'common'>> {
|
|
1863
|
+
common?: Partial<OtherCommon>;
|
|
1864
|
+
}
|
|
1865
|
+
|
|
583
1866
|
type AnyObject =
|
|
584
1867
|
| StateObject
|
|
585
1868
|
| ChannelObject
|
|
@@ -593,7 +1876,11 @@ declare global {
|
|
|
593
1876
|
| UserObject
|
|
594
1877
|
| GroupObject
|
|
595
1878
|
| ScriptObject
|
|
596
|
-
|
|
|
1879
|
+
| ChartObject
|
|
1880
|
+
| ScheduleObject
|
|
1881
|
+
| RepositoryObject
|
|
1882
|
+
| OtherObject
|
|
1883
|
+
| DesignObject;
|
|
597
1884
|
|
|
598
1885
|
type AnyPartialObject =
|
|
599
1886
|
| PartialStateObject
|
|
@@ -608,14 +1895,22 @@ declare global {
|
|
|
608
1895
|
| PartialUserObject
|
|
609
1896
|
| PartialGroupObject
|
|
610
1897
|
| PartialScriptObject
|
|
611
|
-
|
|
|
1898
|
+
| PartialChartObject
|
|
1899
|
+
| PartialScheduleObject
|
|
1900
|
+
| PartialRepositoryObject
|
|
1901
|
+
| PartialSystemConfigObject
|
|
1902
|
+
| PartialOtherObject
|
|
1903
|
+
| PartialDesignObject;
|
|
612
1904
|
|
|
613
1905
|
/** All objects that usually appear in an adapter scope */
|
|
614
1906
|
type AdapterScopedObject = FolderObject | DeviceObject | ChannelObject | StateObject;
|
|
615
1907
|
|
|
616
|
-
// For all objects that are exposed to the user we need to tone the strictness down.
|
|
1908
|
+
// For all objects that are exposed to the user, we need to tone the strictness down.
|
|
617
1909
|
// Otherwise, every operation on objects becomes a pain to work with
|
|
618
|
-
type Object = AnyObject
|
|
1910
|
+
type Object = AnyObject & {
|
|
1911
|
+
common: Record<string, any>;
|
|
1912
|
+
native: Record<string, any>;
|
|
1913
|
+
};
|
|
619
1914
|
|
|
620
1915
|
// In set[Foreign]Object[NotExists] methods, the ID and acl of the object is optional
|
|
621
1916
|
type SettableObjectWorker<T> = T extends AnyObject
|
|
@@ -629,6 +1924,86 @@ declare global {
|
|
|
629
1924
|
|
|
630
1925
|
type PartialObject<T extends AnyObject = AnyObject> = PartialObjectWorker<T>;
|
|
631
1926
|
|
|
1927
|
+
// Used to infer the return type of GetObjectView
|
|
1928
|
+
type InferGetObjectViewItemType<Design extends string, View extends string> = Design extends 'system'
|
|
1929
|
+
? View extends 'host'
|
|
1930
|
+
? HostObject
|
|
1931
|
+
: View extends 'adapter'
|
|
1932
|
+
? AdapterObject
|
|
1933
|
+
: View extends 'instance'
|
|
1934
|
+
? InstanceObject
|
|
1935
|
+
: View extends 'meta'
|
|
1936
|
+
? MetaObject
|
|
1937
|
+
: View extends 'device'
|
|
1938
|
+
? DeviceObject
|
|
1939
|
+
: View extends 'channel'
|
|
1940
|
+
? ChannelObject
|
|
1941
|
+
: View extends 'state'
|
|
1942
|
+
? StateObject
|
|
1943
|
+
: View extends 'folder'
|
|
1944
|
+
? FolderObject
|
|
1945
|
+
: View extends 'enum'
|
|
1946
|
+
? EnumObject
|
|
1947
|
+
: View extends 'script'
|
|
1948
|
+
? ScriptObject
|
|
1949
|
+
: View extends 'group'
|
|
1950
|
+
? GroupObject
|
|
1951
|
+
: View extends 'user'
|
|
1952
|
+
? UserObject
|
|
1953
|
+
: View extends 'chart'
|
|
1954
|
+
? ChartObject
|
|
1955
|
+
: View extends 'schedule'
|
|
1956
|
+
? ScheduleObject
|
|
1957
|
+
: View extends 'config'
|
|
1958
|
+
?
|
|
1959
|
+
| RepositoryObject
|
|
1960
|
+
| SystemConfigObject
|
|
1961
|
+
| (OtherObject & {
|
|
1962
|
+
type: 'config';
|
|
1963
|
+
})
|
|
1964
|
+
: View extends 'custom'
|
|
1965
|
+
? NonNullable<StateObject['common']['custom']>
|
|
1966
|
+
: iobJS.Object
|
|
1967
|
+
: any;
|
|
1968
|
+
|
|
1969
|
+
enum StateQuality {
|
|
1970
|
+
good = 0x00, // or undefined or null
|
|
1971
|
+
bad = 0x01,
|
|
1972
|
+
general_device_problem = 0x41,
|
|
1973
|
+
general_sensor_problem = 0x81,
|
|
1974
|
+
device_not_connected = 0x42,
|
|
1975
|
+
sensor_not_connected = 0x82,
|
|
1976
|
+
device_reports_error = 0x44,
|
|
1977
|
+
sensor_reports_error = 0x84,
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
interface TypedState<T extends iobJS.StateValue = any> extends iobJS.State {
|
|
1981
|
+
val: T;
|
|
1982
|
+
notExist?: true;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
interface AbsentState extends Omit<iobJS.State, 'ack' | 'from' | 'ts' | 'lc'> {
|
|
1986
|
+
val: null;
|
|
1987
|
+
notExist: true;
|
|
1988
|
+
|
|
1989
|
+
ack: undefined;
|
|
1990
|
+
ts: undefined;
|
|
1991
|
+
lc: undefined;
|
|
1992
|
+
from: undefined;
|
|
1993
|
+
expire: undefined;
|
|
1994
|
+
q: undefined;
|
|
1995
|
+
c: undefined;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
interface StateCommonAlias {
|
|
1999
|
+
/** The target state id or two target states used for reading and writing values */
|
|
2000
|
+
id: string | { read: string; write: string };
|
|
2001
|
+
/** An optional conversion function when reading, e.g. `"(val − 32) * 5/9"` */
|
|
2002
|
+
read?: string;
|
|
2003
|
+
/** An optional conversion function when reading, e.g. `"(val * 9/5) + 32"` */
|
|
2004
|
+
write?: string;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
632
2007
|
// Convenient definitions for manually specifying settable object types
|
|
633
2008
|
type SettableObject<T extends AnyObject = AnyObject> = SettableObjectWorker<T>;
|
|
634
2009
|
type SettableStateObject = SettableObject<StateObject>;
|
|
@@ -646,7 +2021,7 @@ declare global {
|
|
|
646
2021
|
type SettableOtherObject = SettableObject<OtherObject>;
|
|
647
2022
|
|
|
648
2023
|
/** Represents the change of a state */
|
|
649
|
-
interface ChangedStateObject<TOld extends
|
|
2024
|
+
interface ChangedStateObject<TOld extends iobJS.StateValue = any, TNew extends iobJS.StateValue = TOld>
|
|
650
2025
|
extends StateObject {
|
|
651
2026
|
common: StateCommon;
|
|
652
2027
|
native: Record<string, any>;
|
|
@@ -682,13 +2057,9 @@ declare global {
|
|
|
682
2057
|
) => void | Promise<void>;
|
|
683
2058
|
type ExistsStateCallback = (err?: Error | null, exists?: boolean) => void | Promise<void>;
|
|
684
2059
|
|
|
685
|
-
type SetStateCallback = (err?: Error | null, id?: string) => void | Promise<void>;
|
|
686
|
-
type SetStatePromise = Promise<NonNullCallbackReturnTypeOf<SetStateCallback>>;
|
|
687
|
-
|
|
688
2060
|
type StateChangeHandler<TOld extends ioBroker.StateValue = any, TNew extends TOld = any> = (
|
|
689
2061
|
obj: ChangedStateObject<TOld, TNew>,
|
|
690
2062
|
) => void | Promise<void>;
|
|
691
|
-
type ObjectChangeHandler = (id: string, obj: iobJS.Object) => void | Promise<void>;
|
|
692
2063
|
|
|
693
2064
|
type FileChangeHandler<WithFile extends boolean> =
|
|
694
2065
|
// Variant 1: WithFile is false, data/mimeType is definitely not there
|
|
@@ -732,17 +2103,6 @@ declare global {
|
|
|
732
2103
|
type ReadFileCallback = (err?: Error | null, file?: Buffer | string, mimeType?: string) => void | Promise<void>;
|
|
733
2104
|
type ReadFilePromise = Promise<NonNullCallbackReturnTypeOf<ReadFileCallback>>;
|
|
734
2105
|
|
|
735
|
-
/** Callback information for a passed message */
|
|
736
|
-
interface MessageCallbackInfo {
|
|
737
|
-
/** The original message payload */
|
|
738
|
-
message: string | object;
|
|
739
|
-
/** ID of this callback */
|
|
740
|
-
id: number;
|
|
741
|
-
// ???
|
|
742
|
-
ack: boolean;
|
|
743
|
-
/** Timestamp of this message */
|
|
744
|
-
time: number;
|
|
745
|
-
}
|
|
746
2106
|
type MessageCallback = (result?: any) => void | Promise<void>;
|
|
747
2107
|
|
|
748
2108
|
interface SendToOptions {
|
|
@@ -763,10 +2123,10 @@ declare global {
|
|
|
763
2123
|
/** name is equal or matches to given one */
|
|
764
2124
|
name?: string | string[] | RegExp;
|
|
765
2125
|
/** type of change */
|
|
766
|
-
change?: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le' | 'any';
|
|
767
|
-
val?:
|
|
2126
|
+
change?: 'eq' | 'ne' | 'gt' | 'ge' | 'lt' | 'le' | 'any' | '*';
|
|
2127
|
+
val?: iobJS.StateValue;
|
|
768
2128
|
/** New value must not be equal to given one */
|
|
769
|
-
valNe?:
|
|
2129
|
+
valNe?: iobJS.StateValue;
|
|
770
2130
|
/** New value must be greater than given one */
|
|
771
2131
|
valGt?: number;
|
|
772
2132
|
/** New value must be greater or equal to given one */
|
|
@@ -778,9 +2138,9 @@ declare global {
|
|
|
778
2138
|
/** The acknowledged state of new value is equal to given one */
|
|
779
2139
|
ack?: boolean;
|
|
780
2140
|
/** Previous value must be equal to given one */
|
|
781
|
-
oldVal?:
|
|
2141
|
+
oldVal?: iobJS.StateValue;
|
|
782
2142
|
/** Previous value must be not equal to given one */
|
|
783
|
-
oldValNe?:
|
|
2143
|
+
oldValNe?: iobJS.StateValue;
|
|
784
2144
|
/** The previous value must be greater than given one */
|
|
785
2145
|
oldValGt?: number;
|
|
786
2146
|
/** Previous value must be greater or equal given one */
|
|
@@ -878,9 +2238,9 @@ declare global {
|
|
|
878
2238
|
* this can be called synchronously and immediately returns the state.
|
|
879
2239
|
* Otherwise, you need to provide a callback.
|
|
880
2240
|
*/
|
|
881
|
-
getState<T extends
|
|
882
|
-
getState<T extends
|
|
883
|
-
getStateAsync<T extends
|
|
2241
|
+
getState<T extends iobJS.StateValue = any>(callback: GetStateCallback<T>): void;
|
|
2242
|
+
getState<T extends iobJS.StateValue = any>(): TypedState<T> | iobJS.AbsentState | null | undefined;
|
|
2243
|
+
getStateAsync<T extends iobJS.StateValue = any>(): Promise<
|
|
884
2244
|
TypedState<T> | iobJS.AbsentState | null | undefined
|
|
885
2245
|
>;
|
|
886
2246
|
|
|
@@ -888,16 +2248,16 @@ declare global {
|
|
|
888
2248
|
* Sets all queried states to the given value.
|
|
889
2249
|
*/
|
|
890
2250
|
setState(
|
|
891
|
-
state:
|
|
2251
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
892
2252
|
ack?: boolean | 'true' | 'false' | SetStateCallback,
|
|
893
2253
|
callback?: SetStateCallback,
|
|
894
2254
|
): this;
|
|
895
2255
|
setStateAsync(
|
|
896
|
-
state:
|
|
2256
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
897
2257
|
ack?: boolean | 'true' | 'false',
|
|
898
2258
|
): Promise<void>;
|
|
899
2259
|
setStateDelayed(
|
|
900
|
-
state:
|
|
2260
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
901
2261
|
isAck: boolean | number | undefined,
|
|
902
2262
|
delay?: number | boolean,
|
|
903
2263
|
clearRunning?: boolean | (() => void),
|
|
@@ -908,11 +2268,11 @@ declare global {
|
|
|
908
2268
|
* Sets all queried states to the given value only if the value really changed.
|
|
909
2269
|
*/
|
|
910
2270
|
setStateChanged(
|
|
911
|
-
state:
|
|
2271
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
912
2272
|
ack?: boolean,
|
|
913
2273
|
callback?: SetStateCallback,
|
|
914
2274
|
): this;
|
|
915
|
-
setStateChangedAsync(state:
|
|
2275
|
+
setStateChangedAsync(state: iobJS.StateValue | iobJS.SettableState, ack?: boolean): Promise<void>;
|
|
916
2276
|
|
|
917
2277
|
/**
|
|
918
2278
|
* Subscribes the given callback to changes of the matched states.
|
|
@@ -1046,13 +2406,6 @@ declare global {
|
|
|
1046
2406
|
id: string;
|
|
1047
2407
|
}
|
|
1048
2408
|
|
|
1049
|
-
interface LogMessage {
|
|
1050
|
-
severity: LogLevel; // severity
|
|
1051
|
-
ts: number; // timestamp as Date.now()
|
|
1052
|
-
message: string; // message
|
|
1053
|
-
from: string; // origin of the message
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
2409
|
type SchedulePattern = ScheduleRule | ScheduleRuleConditional | Date | string | number;
|
|
1057
2410
|
|
|
1058
2411
|
interface SubscribeTime {
|
|
@@ -1359,19 +2712,19 @@ declare global {
|
|
|
1359
2712
|
*/
|
|
1360
2713
|
function setState(
|
|
1361
2714
|
id: string,
|
|
1362
|
-
state:
|
|
2715
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1363
2716
|
callback?: iobJS.SetStateCallback,
|
|
1364
2717
|
): void;
|
|
1365
2718
|
function setState(
|
|
1366
2719
|
id: string,
|
|
1367
|
-
state:
|
|
2720
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1368
2721
|
ack: boolean,
|
|
1369
2722
|
callback?: iobJS.SetStateCallback,
|
|
1370
2723
|
): void;
|
|
1371
2724
|
|
|
1372
2725
|
function setStateAsync(
|
|
1373
2726
|
id: string,
|
|
1374
|
-
state:
|
|
2727
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1375
2728
|
ack?: boolean,
|
|
1376
2729
|
): iobJS.SetStatePromise;
|
|
1377
2730
|
|
|
@@ -1384,19 +2737,19 @@ declare global {
|
|
|
1384
2737
|
*/
|
|
1385
2738
|
function setStateChanged(
|
|
1386
2739
|
id: string,
|
|
1387
|
-
state:
|
|
2740
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1388
2741
|
callback?: iobJS.SetStateCallback,
|
|
1389
2742
|
): void;
|
|
1390
2743
|
function setStateChanged(
|
|
1391
2744
|
id: string,
|
|
1392
|
-
state:
|
|
2745
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1393
2746
|
ack: boolean,
|
|
1394
2747
|
callback?: iobJS.SetStateCallback,
|
|
1395
2748
|
): void;
|
|
1396
2749
|
|
|
1397
2750
|
function setStateChangedAsync(
|
|
1398
2751
|
id: string,
|
|
1399
|
-
state:
|
|
2752
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1400
2753
|
ack?: boolean,
|
|
1401
2754
|
): iobJS.SetStatePromise;
|
|
1402
2755
|
|
|
@@ -1413,39 +2766,39 @@ declare global {
|
|
|
1413
2766
|
*/
|
|
1414
2767
|
function setStateDelayed(
|
|
1415
2768
|
id: string,
|
|
1416
|
-
state:
|
|
2769
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1417
2770
|
delay: number,
|
|
1418
2771
|
clearRunning: boolean,
|
|
1419
2772
|
callback?: iobJS.SetStateCallback,
|
|
1420
2773
|
): number | null;
|
|
1421
2774
|
function setStateDelayed(
|
|
1422
2775
|
id: string,
|
|
1423
|
-
state:
|
|
2776
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1424
2777
|
ack: boolean,
|
|
1425
2778
|
clearRunning: boolean,
|
|
1426
2779
|
callback?: iobJS.SetStateCallback,
|
|
1427
2780
|
): number | null;
|
|
1428
2781
|
function setStateDelayed(
|
|
1429
2782
|
id: string,
|
|
1430
|
-
state:
|
|
2783
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1431
2784
|
ack: boolean,
|
|
1432
2785
|
delay: number,
|
|
1433
2786
|
callback?: iobJS.SetStateCallback,
|
|
1434
2787
|
): number | null;
|
|
1435
2788
|
function setStateDelayed(
|
|
1436
2789
|
id: string,
|
|
1437
|
-
state:
|
|
2790
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1438
2791
|
delay: number,
|
|
1439
2792
|
callback?: iobJS.SetStateCallback,
|
|
1440
2793
|
): number | null;
|
|
1441
2794
|
function setStateDelayed(
|
|
1442
2795
|
id: string,
|
|
1443
|
-
state:
|
|
2796
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1444
2797
|
callback?: iobJS.SetStateCallback,
|
|
1445
2798
|
): number | null;
|
|
1446
2799
|
function setStateDelayed(
|
|
1447
2800
|
id: string,
|
|
1448
|
-
state:
|
|
2801
|
+
state: iobJS.StateValue | iobJS.SettableState,
|
|
1449
2802
|
ack: boolean,
|
|
1450
2803
|
delay: number,
|
|
1451
2804
|
clearRunning: boolean,
|
|
@@ -1479,9 +2832,9 @@ declare global {
|
|
|
1479
2832
|
* this can be called synchronously and immediately returns the state.
|
|
1480
2833
|
* Otherwise, you need to provide a callback.
|
|
1481
2834
|
*/
|
|
1482
|
-
function getState<T extends
|
|
1483
|
-
function getState<T extends
|
|
1484
|
-
function getStateAsync<T extends
|
|
2835
|
+
function getState<T extends iobJS.StateValue = any>(id: string, callback: iobJS.GetStateCallback<T>): void;
|
|
2836
|
+
function getState<T extends iobJS.StateValue = any>(id: string): iobJS.TypedState<T> | iobJS.AbsentState;
|
|
2837
|
+
function getStateAsync<T extends iobJS.StateValue = any>(id: string): Promise<iobJS.TypedState<T>>;
|
|
1485
2838
|
|
|
1486
2839
|
/**
|
|
1487
2840
|
* Checks if the state with the given ID exists
|
|
@@ -1509,7 +2862,7 @@ declare global {
|
|
|
1509
2862
|
* @param id Object ID
|
|
1510
2863
|
* @param enumName Which enum should be included in the returned object. `true` to return all enums.
|
|
1511
2864
|
*/
|
|
1512
|
-
function getObject<T extends string>(id: T, enumName?: string | true): iobJS.ObjectIdToObjectType<T
|
|
2865
|
+
function getObject<T extends string>(id: T, enumName?: string | true): iobJS.ObjectIdToObjectType<T>;
|
|
1513
2866
|
function getObject<T extends string>(id: T, callback: iobJS.GetObjectCallback<T>): void;
|
|
1514
2867
|
function getObject<T extends string>(id: T, enumName: string | true, callback: iobJS.GetObjectCallback<T>): void;
|
|
1515
2868
|
function getObjectAsync<T extends string>(id: T, enumName?: string | true): iobJS.GetObjectPromise<T>;
|
|
@@ -1526,7 +2879,7 @@ declare global {
|
|
|
1526
2879
|
function deleteObject(id: string, recursive: boolean, callback?: ErrorCallback): void;
|
|
1527
2880
|
function deleteObjectAsync(id: string, recursive?: boolean): Promise<void>;
|
|
1528
2881
|
|
|
1529
|
-
function getEnums(enumName?: string): { id: string; members: string[]; name:
|
|
2882
|
+
function getEnums(enumName?: string): { id: string; members: string[]; name: iobJS.StringOrTranslated }[];
|
|
1530
2883
|
|
|
1531
2884
|
/**
|
|
1532
2885
|
* Creates a state and the corresponding object under the JavaScript namespace.
|
|
@@ -1540,7 +2893,7 @@ declare global {
|
|
|
1540
2893
|
*/
|
|
1541
2894
|
function createState(
|
|
1542
2895
|
name: string,
|
|
1543
|
-
initValue:
|
|
2896
|
+
initValue: iobJS.StateValue,
|
|
1544
2897
|
forceCreation: boolean,
|
|
1545
2898
|
common: Partial<iobJS.StateCommon>,
|
|
1546
2899
|
native: any,
|
|
@@ -1548,24 +2901,24 @@ declare global {
|
|
|
1548
2901
|
): void;
|
|
1549
2902
|
function createState(
|
|
1550
2903
|
name: string,
|
|
1551
|
-
initValue:
|
|
2904
|
+
initValue: iobJS.StateValue,
|
|
1552
2905
|
forceCreation: boolean,
|
|
1553
2906
|
common: Partial<iobJS.StateCommon>,
|
|
1554
2907
|
callback?: iobJS.SetStateCallback,
|
|
1555
2908
|
): void;
|
|
1556
2909
|
function createState(
|
|
1557
2910
|
name: string,
|
|
1558
|
-
initValue:
|
|
2911
|
+
initValue: iobJS.StateValue,
|
|
1559
2912
|
forceCreation: boolean,
|
|
1560
2913
|
callback?: iobJS.SetStateCallback,
|
|
1561
2914
|
): void;
|
|
1562
2915
|
function createState(name: string, callback?: iobJS.SetStateCallback): void;
|
|
1563
|
-
function createState(name: string, initValue:
|
|
2916
|
+
function createState(name: string, initValue: iobJS.StateValue, callback?: iobJS.SetStateCallback): void;
|
|
1564
2917
|
|
|
1565
2918
|
function createState(name: string, common: Partial<iobJS.StateCommon>, callback?: iobJS.SetStateCallback): void;
|
|
1566
2919
|
function createState(
|
|
1567
2920
|
name: string,
|
|
1568
|
-
initValue:
|
|
2921
|
+
initValue: iobJS.StateValue,
|
|
1569
2922
|
common: Partial<iobJS.StateCommon>,
|
|
1570
2923
|
callback?: iobJS.SetStateCallback,
|
|
1571
2924
|
): void;
|
|
@@ -1577,7 +2930,7 @@ declare global {
|
|
|
1577
2930
|
): void;
|
|
1578
2931
|
function createState(
|
|
1579
2932
|
name: string,
|
|
1580
|
-
initValue:
|
|
2933
|
+
initValue: iobJS.StateValue,
|
|
1581
2934
|
common: Partial<iobJS.StateCommon>,
|
|
1582
2935
|
native: any,
|
|
1583
2936
|
callback?: iobJS.SetStateCallback,
|
|
@@ -1585,7 +2938,7 @@ declare global {
|
|
|
1585
2938
|
|
|
1586
2939
|
function createStateAsync(
|
|
1587
2940
|
name: string,
|
|
1588
|
-
initValue?:
|
|
2941
|
+
initValue?: iobJS.StateValue,
|
|
1589
2942
|
forceCreation?: boolean,
|
|
1590
2943
|
common?: Partial<iobJS.StateCommon>,
|
|
1591
2944
|
native?: any,
|
|
@@ -1594,12 +2947,12 @@ declare global {
|
|
|
1594
2947
|
function createStateAsync(name: string, common: Partial<iobJS.StateCommon>, native?: any): iobJS.SetStatePromise;
|
|
1595
2948
|
function createStateAsync(
|
|
1596
2949
|
name: string,
|
|
1597
|
-
initValue:
|
|
2950
|
+
initValue: iobJS.StateValue,
|
|
1598
2951
|
common: Partial<iobJS.StateCommon>,
|
|
1599
2952
|
): iobJS.SetStatePromise;
|
|
1600
2953
|
function createStateAsync(
|
|
1601
2954
|
name: string,
|
|
1602
|
-
initValue:
|
|
2955
|
+
initValue: iobJS.StateValue,
|
|
1603
2956
|
common: Partial<iobJS.StateCommon>,
|
|
1604
2957
|
native?: any,
|
|
1605
2958
|
): iobJS.SetStatePromise;
|
|
@@ -1662,6 +3015,7 @@ declare global {
|
|
|
1662
3015
|
/**
|
|
1663
3016
|
* Deletes the state with the given ID
|
|
1664
3017
|
*
|
|
3018
|
+
* @param id The ID of the state to be deleted
|
|
1665
3019
|
* @param callback (optional) Is called after the state was deleted (or not).
|
|
1666
3020
|
*/
|
|
1667
3021
|
function deleteState(id: string, callback?: GenericCallback<boolean>): void;
|
|
@@ -1748,6 +3102,9 @@ declare global {
|
|
|
1748
3102
|
/**
|
|
1749
3103
|
* Compares two or more times
|
|
1750
3104
|
*
|
|
3105
|
+
* @param startTime - The start time to compare with
|
|
3106
|
+
* @param endTime - The end time to compare with
|
|
3107
|
+
* @param operation - The operation to use for comparison. Possible values:
|
|
1751
3108
|
* @param timeToCompare - The time to compare with startTime and/or endTime. If none is given, the current time is used
|
|
1752
3109
|
*/
|
|
1753
3110
|
function compareTime(
|