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