@iobroker/adapter-react-v5 4.12.2 → 4.13.0

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