@iobroker/adapter-react-v5 3.5.3 → 4.0.1

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.
@@ -0,0 +1,794 @@
1
+ /** Converts ioB pattern into regex
2
+ * @param {string} pattern
3
+ * @returns {string}
4
+ */
5
+ export function pattern2RegEx(pattern: string): string;
6
+ export namespace PROGRESS {
7
+ const CONNECTING: number;
8
+ const CONNECTED: number;
9
+ const OBJECTS_LOADED: number;
10
+ const READY: number;
11
+ }
12
+ export namespace ERRORS {
13
+ export { PERMISSION_ERROR };
14
+ export { NOT_CONNECTED };
15
+ }
16
+ export default Connection;
17
+ declare const PERMISSION_ERROR: "permissionError";
18
+ declare const NOT_CONNECTED: "notConnectedError";
19
+ declare class Connection {
20
+ /**
21
+ * Checks if this connection is running in a web adapter and not in an admin.
22
+ * @returns {boolean} True if running in a web adapter or in a socketio adapter.
23
+ */
24
+ static isWeb(): boolean;
25
+ /**
26
+ * @param {import('./types').ConnectionProps} props
27
+ */
28
+ constructor(props: import('./types').ConnectionProps);
29
+ props: import("./types").ConnectionProps;
30
+ autoSubscribes: string[];
31
+ autoSubscribeLog: boolean;
32
+ doNotLoadAllObjects: boolean;
33
+ doNotLoadACL: boolean;
34
+ /** @type {Record<string, ioBroker.State>} */
35
+ states: Record<string, ioBroker.State>;
36
+ objects: any;
37
+ acl: any;
38
+ firstConnect: boolean;
39
+ waitForRestart: boolean;
40
+ /** @type {ioBroker.Languages} */
41
+ systemLang: ioBroker.Languages;
42
+ connected: boolean;
43
+ _waitForFirstConnection: Promise<any>;
44
+ _waitForFirstConnectionResolve: (value: any) => void;
45
+ /** @type {Record<string, { reg: RegExp; cbs: ioBroker.StateChangeHandler[]}>} */
46
+ statesSubscribes: Record<string, {
47
+ reg: RegExp;
48
+ cbs: ioBroker.StateChangeHandler[];
49
+ }>;
50
+ /** @type {Record<string, { reg: RegExp; cbs: import('./types').ObjectChangeHandler[]}>} */
51
+ objectsSubscribes: Record<string, {
52
+ reg: RegExp;
53
+ cbs: import('./types').ObjectChangeHandler[];
54
+ }>;
55
+ filesSubscribes: {};
56
+ onProgress: (progress: number) => void;
57
+ onError: (err: any) => void;
58
+ loaded: boolean;
59
+ loadTimer: any;
60
+ loadCounter: number;
61
+ admin5only: any;
62
+ /** @type {((connected: boolean) => void)[]} */
63
+ onConnectionHandlers: ((connected: boolean) => void)[];
64
+ /** @type {((message: string) => void)[]} */
65
+ onLogHandlers: ((message: string) => void)[];
66
+ /** @type {Record<string, Promise<any>>} */
67
+ _promises: Record<string, Promise<any>>;
68
+ /**
69
+ * Starts the socket.io connection.
70
+ * @returns {void}
71
+ */
72
+ startSocket(): void;
73
+ scriptLoadCounter: any;
74
+ _socket: any;
75
+ _authTimer: any;
76
+ subscribed: boolean;
77
+ /**
78
+ * Called internally.
79
+ * @private
80
+ * @param {boolean} isOk
81
+ * @param {boolean} isSecure
82
+ */
83
+ private onPreConnect;
84
+ isSecure: boolean;
85
+ /**
86
+ * Checks if the socket is connected.
87
+ * @returns {boolean} true if connected.
88
+ */
89
+ isConnected(): boolean;
90
+ /**
91
+ * Checks if the socket is connected.
92
+ * @returns {Promise<void>} Promise resolves if once connected.
93
+ */
94
+ waitForFirstConnection(): Promise<void>;
95
+ /**
96
+ * Called internally.
97
+ * @private
98
+ */
99
+ private _getUserPermissions;
100
+ /**
101
+ * Called internally.
102
+ * @private
103
+ */
104
+ private onConnect;
105
+ systemConfig: any;
106
+ /**
107
+ * Called internally.
108
+ * @private
109
+ */
110
+ private authenticate;
111
+ /**
112
+ * Subscribe to changes of the given state.
113
+ * @param {string} id The ioBroker state ID.
114
+ * @param {ioBroker.StateChangeHandler} cb The callback.
115
+ */
116
+ /**
117
+ * Subscribe to changes of the given state.
118
+ * @param {string} id The ioBroker state ID.
119
+ * @param {boolean} binary Set to true if the given state is binary and requires Base64 decoding.
120
+ * @param {ioBroker.StateChangeHandler} cb The callback.
121
+ */
122
+ subscribeState(id: string, binary: boolean, cb: ioBroker.StateChangeHandler): void;
123
+ /**
124
+ * Unsubscribes all callbacks from changes of the given state.
125
+ * @param {string} id The ioBroker state ID.
126
+ */
127
+ /**
128
+ * Unsubscribes the given callback from changes of the given state.
129
+ * @param {string} id The ioBroker state ID.
130
+ * @param {ioBroker.StateChangeHandler} cb The callback.
131
+ */
132
+ unsubscribeState(id: string, cb: ioBroker.StateChangeHandler): void;
133
+ /**
134
+ * Subscribe to changes of the given object.
135
+ * @param {string} id The ioBroker object ID.
136
+ * @param {import('./types').ObjectChangeHandler} cb The callback.
137
+ * @returns {Promise<void>}
138
+ */
139
+ subscribeObject(id: string, cb: import('./types').ObjectChangeHandler): Promise<void>;
140
+ /**
141
+ * Unsubscribes all callbacks from changes of the given object.
142
+ * @param {string} id The ioBroker object ID.
143
+ * @returns {Promise<void>}
144
+ */
145
+ /**
146
+ * Unsubscribes the given callback from changes of the given object.
147
+ * @param {string} id The ioBroker object ID.
148
+ * @param {import('./types').ObjectChangeHandler} cb The callback.
149
+ * @returns {Promise<void>}
150
+ */
151
+ unsubscribeObject(id: string, cb: import('./types').ObjectChangeHandler): Promise<void>;
152
+ /**
153
+ * Called internally.
154
+ * @param id
155
+ * @param fileName
156
+ * @param size
157
+ */
158
+ fileChange(id: any, fileName: any, size: any): void;
159
+ /**
160
+ * Subscribe to changes of the files.
161
+ * @param {string} id The ioBroker state ID for meat object. Could be a pattern
162
+ * @param {string} filePattern Pattern or file name, like 'main/*' or 'main/visViews.json`
163
+ * @param {function} cb The callback.
164
+ */
165
+ subscribeFiles(id: string, filePattern: string, cb: Function): Promise<void>;
166
+ /**
167
+ * Unsubscribes the given callback from changes of files.
168
+ * @param {string} id The ioBroker state ID.
169
+ * @param {string} filePattern Pattern or file name, like 'main/*' or 'main/visViews.json`
170
+ * @param {function} cb The callback.
171
+ */
172
+ unsubscribeFiles(id: string, filePattern: string, cb: Function): void;
173
+ /**
174
+ * Called internally.
175
+ * @private
176
+ * @param {string} id
177
+ * @param {ioBroker.Object | null | undefined} obj
178
+ */
179
+ private objectChange;
180
+ /**
181
+ * Called internally.
182
+ * @private
183
+ * @param {string} id
184
+ * @param {ioBroker.State | null | undefined} state
185
+ */
186
+ private stateChange;
187
+ /**
188
+ * Gets all states.
189
+ * @param {boolean} disableProgressUpdate don't call onProgress() when done
190
+ * @returns {Promise<Record<string, ioBroker.State>>}
191
+ */
192
+ getStates(disableProgressUpdate: boolean): Promise<Record<string, ioBroker.State>>;
193
+ /**
194
+ * Gets the given state.
195
+ * @param {string} id The state ID.
196
+ * @returns {Promise<ioBroker.State | null | undefined>}
197
+ */
198
+ getState(id: string): Promise<ioBroker.State | null | undefined>;
199
+ /**
200
+ * Gets the given binary state.
201
+ * @param {string} id The state ID.
202
+ * @returns {Promise<Buffer | undefined>}
203
+ */
204
+ getBinaryState(id: string): Promise<Buffer | undefined>;
205
+ /**
206
+ * Sets the given binary state.
207
+ * @param {string} id The state ID.
208
+ * @param {string} base64 The Base64 encoded binary data.
209
+ * @returns {Promise<void>}
210
+ */
211
+ setBinaryState(id: string, base64: string): Promise<void>;
212
+ /**
213
+ * Sets the given state value.
214
+ * @param {string} id The state ID.
215
+ * @param {string | number | boolean | ioBroker.State | ioBroker.SettableState | null} val The state value.
216
+ * @param {boolean | null} ack Acknowledge flag
217
+ * @returns {Promise<void>}
218
+ */
219
+ setState(id: string, val: string | number | boolean | ioBroker.State | ioBroker.SettableState | null, ack: boolean | null): Promise<void>;
220
+ /**
221
+ * Gets all objects.
222
+ * @param {(objects?: Record<string, ioBroker.Object>) => void} update Callback that is executed when all objects are retrieved.
223
+ * @returns {void}
224
+ */
225
+ /**
226
+ * Gets all objects.
227
+ * @param {boolean} update Set to true to retrieve all objects from the server (instead of using the local cache).
228
+ * @param {boolean} disableProgressUpdate don't call onProgress() when done
229
+ * @returns {Promise<Record<string, ioBroker.Object>> | undefined}
230
+ */
231
+ getObjects(update: boolean, disableProgressUpdate: boolean): Promise<Record<string, ioBroker.Object>> | undefined;
232
+ /**
233
+ * Called internally.
234
+ * @private
235
+ * @param {boolean} isEnable
236
+ */
237
+ private _subscribe;
238
+ /**
239
+ * Requests log updates.
240
+ * @param {boolean} isEnabled Set to true to get logs.
241
+ * @returns {Promise<void>}
242
+ */
243
+ requireLog(isEnabled: boolean): Promise<void>;
244
+ /**
245
+ * Deletes the given object.
246
+ * @param {string} id The object ID.
247
+ * @param {boolean} maintenance Force deletion of non conform IDs.
248
+ * @returns {Promise<void>}
249
+ */
250
+ delObject(id: string, maintenance: boolean): Promise<void>;
251
+ /**
252
+ * Deletes the given object and all its children.
253
+ * @param {string} id The object ID.
254
+ * @param {boolean} maintenance Force deletion of non conform IDs.
255
+ * @returns {Promise<void>}
256
+ */
257
+ delObjects(id: string, maintenance: boolean): Promise<void>;
258
+ /**
259
+ * Sets the object.
260
+ * @param {string} id The object ID.
261
+ * @param {ioBroker.SettableObject} obj The object.
262
+ * @returns {Promise<void>}
263
+ */
264
+ setObject(id: string, obj: ioBroker.SettableObject): Promise<void>;
265
+ /**
266
+ * Gets the object with the given id from the server.
267
+ * @param {string} id The object ID.
268
+ * @returns {ioBroker.GetObjectPromise} The object.
269
+ */
270
+ getObject(id: string): ioBroker.GetObjectPromise<string>;
271
+ /**
272
+ * Get all adapter instances.
273
+ * @param {boolean} [update] Force update.
274
+ * @returns {Promise<ioBroker.Object[]>}
275
+ */
276
+ /**
277
+ * Get all instances of the given adapter.
278
+ * @param {string} adapter The name of the adapter.
279
+ * @param {boolean} [update] Force update.
280
+ * @returns {Promise<ioBroker.Object[]>}
281
+ */
282
+ getAdapterInstances(adapter: string, update?: boolean): Promise<ioBroker.Object[]>;
283
+ /**
284
+ * Get all adapters.
285
+ * @param {boolean} [update] Force update.
286
+ * @returns {Promise<ioBroker.Object[]>}
287
+ */
288
+ /**
289
+ * Get adapters with the given name.
290
+ * @param {string} adapter The name of the adapter.
291
+ * @param {boolean} [update] Force update.
292
+ * @returns {Promise<ioBroker.Object[]>}
293
+ */
294
+ getAdapters(adapter: string, update?: boolean): Promise<ioBroker.Object[]>;
295
+ /**
296
+ * Called internally.
297
+ * @private
298
+ * @param {any[]} objs
299
+ * @param {(err?: any) => void} cb
300
+ */
301
+ private _renameGroups;
302
+ /**
303
+ * Rename a group.
304
+ * @param {string} id The id.
305
+ * @param {string} newId The new id.
306
+ * @param {string | { [lang in ioBroker.Languages]?: string; }} newName The new name.
307
+ */
308
+ renameGroup(id: string, newId: string, newName: string | {
309
+ en?: string;
310
+ de?: string;
311
+ ru?: string;
312
+ pt?: string;
313
+ nl?: string;
314
+ fr?: string;
315
+ it?: string;
316
+ es?: string;
317
+ pl?: string;
318
+ uk?: string;
319
+ "zh-cn"?: string;
320
+ }): Promise<void>;
321
+ /**
322
+ * Sends a message to a specific instance or all instances of some specific adapter.
323
+ * @param {string} instance The instance to send this message to.
324
+ * @param {string} [command] Command name of the target instance.
325
+ * @param {ioBroker.MessagePayload} [data] The message data to send.
326
+ * @returns {Promise<ioBroker.Message | undefined>}
327
+ */
328
+ sendTo(instance: string, command?: string, data?: ioBroker.MessagePayload): Promise<ioBroker.Message | undefined>;
329
+ /**
330
+ * Extend an object and create it if it might not exist.
331
+ * @param {string} id The id.
332
+ * @param {ioBroker.PartialObject} obj The object.
333
+ */
334
+ extendObject(id: string, obj: ioBroker.PartialObject): Promise<any>;
335
+ /**
336
+ * Register a handler for log messages.
337
+ * @param {(message: string) => void} handler The handler.
338
+ */
339
+ registerLogHandler(handler: (message: string) => void): void;
340
+ /**
341
+ * Unregister a handler for log messages.
342
+ * @param {(message: string) => void} handler The handler.
343
+ */
344
+ unregisterLogHandler(handler: (message: string) => void): void;
345
+ /**
346
+ * Register a handler for the connection state.
347
+ * @param {(connected: boolean) => void} handler The handler.
348
+ */
349
+ registerConnectionHandler(handler: (connected: boolean) => void): void;
350
+ /**
351
+ * Unregister a handler for the connection state.
352
+ * @param {(connected: boolean) => void} handler The handler.
353
+ */
354
+ unregisterConnectionHandler(handler: (connected: boolean) => void): void;
355
+ /**
356
+ * Set the handler for standard output of a command.
357
+ * @param {(id: string, text: string) => void} handler The handler.
358
+ */
359
+ registerCmdStdoutHandler(handler: (id: string, text: string) => void): void;
360
+ onCmdStdoutHandler: (id: string, text: string) => void;
361
+ /**
362
+ * Unset the handler for standard output of a command.
363
+ * @param {(id: string, text: string) => void} handler The handler.
364
+ */
365
+ unregisterCmdStdoutHandler(handler: (id: string, text: string) => void): void;
366
+ /**
367
+ * Set the handler for standard error of a command.
368
+ * @param {(id: string, text: string) => void} handler The handler.
369
+ */
370
+ registerCmdStderrHandler(handler: (id: string, text: string) => void): void;
371
+ onCmdStderrHandler: (id: string, text: string) => void;
372
+ /**
373
+ * Unset the handler for standard error of a command.
374
+ * @param {(id: string, text: string) => void} handler The handler.
375
+ */
376
+ unregisterCmdStderrHandler(handler: (id: string, text: string) => void): void;
377
+ /**
378
+ * Set the handler for exit of a command.
379
+ * @param {(id: string, exitCode: number) => void} handler The handler.
380
+ */
381
+ registerCmdExitHandler(handler: (id: string, exitCode: number) => void): void;
382
+ onCmdExitHandler: (id: string, exitCode: number) => void;
383
+ /**
384
+ * Unset the handler for exit of a command.
385
+ * @param {(id: string, exitCode: number) => void} handler The handler.
386
+ */
387
+ unregisterCmdExitHandler(handler: (id: string, exitCode: number) => void): void;
388
+ /**
389
+ * Get all enums with the given name.
390
+ * @param {string} [_enum] The name of the enum
391
+ * @param {boolean} [update] Force update.
392
+ * @returns {Promise<Record<string, ioBroker.Object>>}
393
+ */
394
+ getEnums(_enum?: string, update?: boolean): Promise<Record<string, ioBroker.Object>>;
395
+ /**
396
+ * Query a predefined object view.
397
+ * @param {string} start The start ID.
398
+ * @param {string} end The end ID.
399
+ * @param {string} type The type of object.
400
+ * @returns {Promise<Record<string, ioBroker.Object>>}
401
+ */
402
+ getObjectView(start: string, end: string, type: string): Promise<Record<string, ioBroker.Object>>;
403
+ /**
404
+ * Get the stored certificates.
405
+ * @param {boolean} [update] Force update.
406
+ * @returns {Promise<{name: string; type: 'public' | 'private' | 'chained'}[]>}
407
+ */
408
+ getCertificates(update?: boolean): Promise<{
409
+ name: string;
410
+ type: 'public' | 'private' | 'chained';
411
+ }[]>;
412
+ /**
413
+ * Get the logs from a host (only for admin connection).
414
+ * @param {string} host
415
+ * @param {number} [linesNumber]
416
+ * @returns {Promise<string[]>}
417
+ */
418
+ getLogs(host: string, linesNumber?: number): Promise<string[]>;
419
+ /**
420
+ * Get the log files (only for admin connection).
421
+ * @returns {Promise<string[]>}
422
+ */
423
+ getLogsFiles(host: any): Promise<string[]>;
424
+ /**
425
+ * Delete the logs from a host (only for admin connection).
426
+ * @param {string} host
427
+ * @returns {Promise<void>}
428
+ */
429
+ delLogs(host: string): Promise<void>;
430
+ /**
431
+ * Read the meta items.
432
+ * @returns {Promise<ioBroker.Object[]>}
433
+ */
434
+ readMetaItems(): Promise<ioBroker.Object[]>;
435
+ /**
436
+ * Read the directory of an adapter.
437
+ * @param {string} adapter The adapter name.
438
+ * @param {string} fileName The directory name.
439
+ * @returns {Promise<ioBroker.ReadDirResult[]>}
440
+ */
441
+ readDir(adapter: string, fileName: string): Promise<ioBroker.ReadDirResult[]>;
442
+ /**
443
+ * Read a file of an adapter.
444
+ * @param {string} adapter The adapter name.
445
+ * @param {string} fileName The file name.
446
+ * @param {boolean} base64 If it must be a base64 format
447
+ * @returns {Promise<string>}
448
+ */
449
+ readFile(adapter: string, fileName: string, base64: boolean): Promise<string>;
450
+ /**
451
+ * Write a file of an adapter.
452
+ * @param {string} adapter The adapter name.
453
+ * @param {string} fileName The file name.
454
+ * @param {Buffer | string} data The data (if it's a Buffer, it will be converted to Base64).
455
+ * @returns {Promise<void>}
456
+ */
457
+ writeFile64(adapter: string, fileName: string, data: Buffer | string): Promise<void>;
458
+ /**
459
+ * Rename a file or folder of an adapter.
460
+ *
461
+ * All files in folder will be renamed too.
462
+ * @param {string} adapter The adapter name.
463
+ * @param {string} oldName The file name of the file to be renamed.
464
+ * @param {string} newName The new file name.
465
+ * @returns {Promise<void>}
466
+ */
467
+ rename(adapter: string, oldName: string, newName: string): Promise<void>;
468
+ /**
469
+ * Delete a file of an adapter.
470
+ * @param {string} adapter The adapter name.
471
+ * @param {string} fileName The file name.
472
+ * @returns {Promise<void>}
473
+ */
474
+ deleteFile(adapter: string, fileName: string): Promise<void>;
475
+ /**
476
+ * Delete a folder of an adapter.
477
+ * All files in folder will be deleted.
478
+ * @param {string} adapter The adapter name.
479
+ * @param {string} folderName The folder name.
480
+ * @returns {Promise<void>}
481
+ */
482
+ deleteFolder(adapter: string, folderName: string): Promise<void>;
483
+ /**
484
+ * Get the list of all hosts.
485
+ * @param {boolean} [update] Force update.
486
+ * @returns {Promise<ioBroker.Object[]>}
487
+ */
488
+ getHosts(update?: boolean): Promise<ioBroker.Object[]>;
489
+ /**
490
+ * Get the list of all users.
491
+ * @param {boolean} [update] Force update.
492
+ * @returns {Promise<ioBroker.Object[]>}
493
+ */
494
+ getUsers(update?: boolean): Promise<ioBroker.Object[]>;
495
+ /**
496
+ * Get the list of all groups.
497
+ * @param {boolean} [update] Force update.
498
+ * @returns {Promise<ioBroker.Object[]>}
499
+ */
500
+ getGroups(update?: boolean): Promise<ioBroker.Object[]>;
501
+ /**
502
+ * Get the host information.
503
+ * @param {string} host
504
+ * @param {boolean} [update] Force update.
505
+ * @param {number} [timeoutMs] optional read timeout.
506
+ * @returns {Promise<any>}
507
+ */
508
+ getHostInfo(host: string, update?: boolean, timeoutMs?: number): Promise<any>;
509
+ /**
510
+ * Get the host information (short version).
511
+ * @param {string} host
512
+ * @param {boolean} [update] Force update.
513
+ * @param {number} [timeoutMs] optional read timeout.
514
+ * @returns {Promise<any>}
515
+ */
516
+ getHostInfoShort(host: string, update?: boolean, timeoutMs?: number): Promise<any>;
517
+ /**
518
+ * Get the repository.
519
+ * @param {string} host
520
+ * @param {any} [args]
521
+ * @param {boolean} [update] Force update.
522
+ * @param {number} [timeoutMs] timeout in ms.
523
+ * @returns {Promise<any>}
524
+ */
525
+ getRepository(host: string, args?: any, update?: boolean, timeoutMs?: number): Promise<any>;
526
+ /**
527
+ * Get the installed.
528
+ * @param {string} host
529
+ * @param {boolean} [update] Force update.
530
+ * @param {number} [cmdTimeout] timeout in ms (optional)
531
+ * @returns {Promise<any>}
532
+ */
533
+ getInstalled(host: string, update?: boolean, cmdTimeout?: number): Promise<any>;
534
+ /**
535
+ * Execute a command on a host.
536
+ * @param {string} host The host name.
537
+ * @param {string} cmd The command.
538
+ * @param {string} cmdId The command ID.
539
+ * @param {number} cmdTimeout Timeout of command in ms
540
+ * @returns {Promise<void>}
541
+ */
542
+ cmdExec(host: string, cmd: string, cmdId: string, cmdTimeout: number): Promise<void>;
543
+ /**
544
+ * Checks if a given feature is supported.
545
+ * @param {string} feature The feature to check.
546
+ * @param {boolean} [update] Force update.
547
+ * @returns {Promise<any>}
548
+ */
549
+ checkFeatureSupported(feature: string, update?: boolean): Promise<any>;
550
+ /**
551
+ * Read the base settings of a given host.
552
+ * @param {string} host
553
+ * @returns {Promise<any>}
554
+ */
555
+ readBaseSettings(host: string): Promise<any>;
556
+ /**
557
+ * Write the base settings of a given host.
558
+ * @param {string} host
559
+ * @param {any} config
560
+ * @returns {Promise<any>}
561
+ */
562
+ writeBaseSettings(host: string, config: any): Promise<any>;
563
+ /**
564
+ * Send command to restart the iobroker on host
565
+ * @param {string} host
566
+ * @returns {Promise<any>}
567
+ */
568
+ restartController(host: string): Promise<any>;
569
+ /**
570
+ * Read statistics information from host
571
+ * @param {string} host
572
+ * @param {string} typeOfDiag one of none, normal, no-city, extended
573
+ * @returns {Promise<any>}
574
+ */
575
+ getDiagData(host: string, typeOfDiag: string): Promise<any>;
576
+ /**
577
+ * Read all states (which might not belong to this adapter) which match the given pattern.
578
+ * @param {string} pattern
579
+ * @returns {ioBroker.GetStatesPromise}
580
+ */
581
+ getForeignStates(pattern: string): ioBroker.GetStatesPromise;
582
+ /**
583
+ * Get foreign objects by pattern, by specific type and resolve their enums.
584
+ * @param {string} pattern
585
+ * @param {string} [type]
586
+ * @returns {ioBroker.GetObjectsPromise}
587
+ */
588
+ getForeignObjects(pattern: string, type?: string): ioBroker.GetObjectsPromise;
589
+ /**
590
+ * Gets the system configuration.
591
+ * @param {boolean} [update] Force update.
592
+ * @returns {Promise<ioBroker.OtherObject>}
593
+ */
594
+ getSystemConfig(update?: boolean): Promise<ioBroker.OtherObject>;
595
+ /**
596
+ * Sets the system configuration.
597
+ * @param {ioBroker.SettableObjectWorker<ioBroker.OtherObject>} obj
598
+ * @returns {Promise<ioBroker.SettableObjectWorker<ioBroker.OtherObject>>}
599
+ */
600
+ setSystemConfig(obj: ioBroker.SettableObjectWorker<ioBroker.OtherObject>): Promise<ioBroker.SettableObjectWorker<ioBroker.OtherObject>>;
601
+ /**
602
+ * Get the raw socket.io socket.
603
+ * @returns {any}
604
+ */
605
+ getRawSocket(): any;
606
+ /**
607
+ * Get the history of a given state.
608
+ * @param {string} id
609
+ * @param {ioBroker.GetHistoryOptions} options
610
+ * @returns {Promise<ioBroker.GetHistoryResult>}
611
+ */
612
+ getHistory(id: string, options: ioBroker.GetHistoryOptions): Promise<ioBroker.GetHistoryResult>;
613
+ /**
614
+ * Get the history of a given state.
615
+ * @param {string} id
616
+ * @param {ioBroker.GetHistoryOptions} options
617
+ * @returns {Promise<{values: ioBroker.GetHistoryResult; sesionId: string; stepIgnore: number}>}
618
+ */
619
+ getHistoryEx(id: string, options: ioBroker.GetHistoryOptions): Promise<{
620
+ values: ioBroker.GetHistoryResult;
621
+ sesionId: string;
622
+ stepIgnore: number;
623
+ }>;
624
+ /**
625
+ * Change the password of the given user.
626
+ * @param {string} user
627
+ * @param {string} password
628
+ * @returns {Promise<void>}
629
+ */
630
+ changePassword(user: string, password: string): Promise<void>;
631
+ /**
632
+ * Get the IP addresses of the given host.
633
+ * @param {string} host
634
+ * @param {boolean} [update] Force update.
635
+ * @returns {Promise<string[]>}
636
+ */
637
+ getIpAddresses(host: string, update?: boolean): Promise<string[]>;
638
+ /**
639
+ * Get the IP addresses with interface names of the given host or find host by IP.
640
+ * @param {string} ipOrHostName
641
+ * @param {boolean} [update] Force update.
642
+ * @returns {Promise<any[<name, address, family>]>}
643
+ */
644
+ getHostByIp(ipOrHostName: string, update?: boolean): Promise<any>;
645
+ /**
646
+ * Encrypt a text
647
+ * @param {string} text
648
+ * @returns {Promise<string>}
649
+ */
650
+ encrypt(text: string): Promise<string>;
651
+ /**
652
+ * Decrypt a text
653
+ * @param {string} encryptedText
654
+ * @returns {Promise<string>}
655
+ */
656
+ decrypt(encryptedText: string): Promise<string>;
657
+ /**
658
+ * Gets the version.
659
+ * @returns {Promise<{version: string; serverName: string}>}
660
+ */
661
+ getVersion(update: any): Promise<{
662
+ version: string;
663
+ serverName: string;
664
+ }>;
665
+ /**
666
+ * Gets the web server name.
667
+ * @returns {Promise<string>}
668
+ */
669
+ getWebServerName(): Promise<string>;
670
+ /**
671
+ * Gets the admin version.
672
+ * @deprecated use getVersion()
673
+ * @returns {Promise<{version: string; serverName: string}>}
674
+ */
675
+ getAdminVersion(): Promise<{
676
+ version: string;
677
+ serverName: string;
678
+ }>;
679
+ /**
680
+ * Change access rights for file
681
+ * @param {string} [adapter] adapter name
682
+ * @param {string} [filename] file name with full path. it could be like vis.0/*
683
+ * @param {object} [options] like {mode: 0x644}
684
+ * @returns {Promise<{entries: array}>}
685
+ */
686
+ chmodFile(adapter?: string, filename?: string, options?: object): Promise<{
687
+ entries: any[];
688
+ }>;
689
+ /**
690
+ * Change owner or/and owner group for file
691
+ * @param {string} [adapter] adapter name
692
+ * @param {string} [filename] file name with full path. it could be like vis.0/*
693
+ * @param {object} [options] like {owner: 'newOwner', ownerGroup: 'newGroup'}
694
+ * @returns {Promise<{entries: array}>}
695
+ */
696
+ chownFile(adapter?: string, filename?: string, options?: object): Promise<{
697
+ entries: any[];
698
+ }>;
699
+ /**
700
+ * Check if the file exists
701
+ * @param {string} [adapter] adapter name
702
+ * @param {string} [filename] file name with full path. it could be like vis.0/*
703
+ * @returns {Promise<boolean>}
704
+ */
705
+ fileExists(adapter?: string, filename?: string): Promise<boolean>;
706
+ /**
707
+ * Get the alarm notifications from a host (only for admin connection).
708
+ * @param {string} host
709
+ * @param {string} [category] - optional
710
+ * @returns {Promise<any>}
711
+ */
712
+ getNotifications(host: string, category?: string): Promise<any>;
713
+ /**
714
+ * Clear the alarm notifications on a host (only for admin connection).
715
+ * @param {string} host
716
+ * @param {string} [category] - optional
717
+ * @returns {Promise<any>}
718
+ */
719
+ clearNotifications(host: string, category?: string): Promise<any>;
720
+ /**
721
+ * Read if only easy mode is allowed (only for admin connection).
722
+ * @returns {Promise<boolean>}
723
+ */
724
+ getIsEasyModeStrict(): Promise<boolean>;
725
+ /**
726
+ * Read easy mode configuration (only for admin connection).
727
+ * @returns {Promise<any>}
728
+ */
729
+ getEasyMode(): Promise<any>;
730
+ /**
731
+ * Read current user
732
+ * @returns {Promise<string>}
733
+ */
734
+ getCurrentUser(): Promise<string>;
735
+ getCurrentSession(cmdTimeout: any): Promise<any>;
736
+ /**
737
+ * Read adapter ratings
738
+ * @returns {Promise<any>}
739
+ */
740
+ getRatings(update: any): Promise<any>;
741
+ /**
742
+ * Read current web, socketio or admin namespace, like admin.0
743
+ * @returns {Promise<string>}
744
+ */
745
+ getCurrentInstance(): Promise<string>;
746
+ getCompactAdapters(update: any): Promise<any>;
747
+ getAdaptersResetCache(adapter: any): void;
748
+ getCompactInstances(update: any): Promise<any>;
749
+ getAdapternInstancesResetCache(adapter: any): void;
750
+ getCompactInstalled(host: any, update: any, cmdTimeout: any): any;
751
+ getCompactSystemRepositories(update: any, cmdTimeout: any): Promise<any>;
752
+ getInstalledResetCache(host: any): void;
753
+ getInstalledResetCache(host: any): void;
754
+ getCompactSystemConfig(update: any): Promise<any>;
755
+ /**
756
+ * Get the repository in compact form (only version and icon).
757
+ * @param {string} host
758
+ * @param {boolean} [update] Force update.
759
+ * @param {number} [timeoutMs] timeout in ms.
760
+ * @returns {Promise<any>}
761
+ */
762
+ getCompactRepository(host: string, update?: boolean, timeoutMs?: number): Promise<any>;
763
+ /**
764
+ * Get the list of all hosts in compact form (only _id, common.name, common.icon, common.color, native.hardware.networkInterfaces)
765
+ * @param {boolean} [update] Force update.
766
+ * @returns {Promise<ioBroker.Object[]>}
767
+ */
768
+ getCompactHosts(update?: boolean): Promise<ioBroker.Object[]>;
769
+ /**
770
+ * Get uuid
771
+ * @returns {Promise<ioBroker.Object[]>}
772
+ */
773
+ getUuid(): Promise<ioBroker.Object[]>;
774
+ /**
775
+ * Send log to ioBroker log
776
+ * @param {string} [text] Log text
777
+ * @param {string} [level] `info`, `debug`, `warn`, `error` or `silly`
778
+ * @returns {void}
779
+ */
780
+ log(text?: string, level?: string): void;
781
+ /**
782
+ * Logout current user
783
+ * @returns {Promise<null>}
784
+ */
785
+ logout(): Promise<null>;
786
+ }
787
+ declare namespace Connection {
788
+ namespace Connection {
789
+ const onLog: PropTypes.Requireable<(...args: any[]) => any>;
790
+ const onReady: PropTypes.Requireable<(...args: any[]) => any>;
791
+ const onProgress: PropTypes.Requireable<(...args: any[]) => any>;
792
+ }
793
+ }
794
+ import PropTypes from "prop-types";