@iobroker/db-states-redis 7.2.3 → 8.0.0-alpha.1-20260921-e5941ca8a
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/build/cjs/index.d.ts +1 -1
- package/build/cjs/index.js +5 -3
- package/build/cjs/index.js.map +2 -2
- package/build/cjs/lib/states/interview.js +2 -0
- package/build/cjs/lib/states/interview.js.map +1 -1
- package/build/cjs/lib/states/statesInRedisClient.d.ts +303 -30
- package/build/cjs/lib/states/statesInRedisClient.js +175 -61
- package/build/cjs/lib/states/statesInRedisClient.js.map +2 -2
- package/build/esm/index.d.ts +1 -1
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/lib/states/statesInRedisClient.d.ts +303 -30
- package/build/esm/lib/states/statesInRedisClient.d.ts.map +1 -1
- package/build/esm/lib/states/statesInRedisClient.js +179 -70
- package/build/esm/lib/states/statesInRedisClient.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { StateRedisClient as Client } from './lib/states/statesInRedisClient.js';
|
|
1
|
+
export { StateRedisClient as Client, type StatesSettings } from './lib/states/statesInRedisClient.js';
|
|
2
2
|
export { interview } from './lib/states/interview.js';
|
|
3
3
|
/**
|
|
4
4
|
* Get the default port for the database
|
package/build/cjs/index.js
CHANGED
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -16,19 +17,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
17
|
return to;
|
|
17
18
|
};
|
|
18
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
20
|
+
var index_exports = {};
|
|
21
|
+
__export(index_exports, {
|
|
21
22
|
Client: () => import_statesInRedisClient.StateRedisClient,
|
|
22
23
|
Server: () => Server,
|
|
23
24
|
getDefaultPort: () => getDefaultPort,
|
|
24
25
|
interview: () => import_interview.interview
|
|
25
26
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
28
|
var import_statesInRedisClient = require("./lib/states/statesInRedisClient.js");
|
|
28
29
|
var import_interview = require("./lib/states/interview.js");
|
|
29
30
|
function getDefaultPort(host) {
|
|
30
31
|
return host.includes(",") ? 26379 : 6379;
|
|
31
32
|
}
|
|
33
|
+
__name(getDefaultPort, "getDefaultPort");
|
|
32
34
|
const Server = null;
|
|
33
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
36
|
0 && (module.exports = {
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/// <reference types=\"@iobroker/types-dev\" />\nexport { StateRedisClient as Client } from '@/lib/states/statesInRedisClient.js';\nexport { interview } from '@/lib/states/interview.js';\n/**\n * Get the default port for the database\n *\n * @param host string of host(s)\n */\nexport function getDefaultPort(host: string): number {\n return host.includes(',') ? 26379 : 6379;\n}\nexport const Server = null;\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/// <reference types=\"@iobroker/types-dev\" />\nexport { StateRedisClient as Client, type StatesSettings } from '@/lib/states/statesInRedisClient.js';\nexport { interview } from '@/lib/states/interview.js';\n/**\n * Get the default port for the database\n *\n * @param host string of host(s)\n */\nexport function getDefaultPort(host: string): number {\n return host.includes(',') ? 26379 : 6379;\n}\nexport const Server = null;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AACA,iCAAgE;AAChE,uBAA0B;AAMpB,SAAU,eAAe,MAAY;AACvC,SAAO,KAAK,SAAS,GAAG,IAAI,QAAQ;AACxC;AAFgB;AAGT,MAAM,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,6 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -25,6 +26,7 @@ var import_js_controller_common_db = require("@iobroker/js-controller-common-db"
|
|
|
25
26
|
function interview(config) {
|
|
26
27
|
return (0, import_js_controller_common_db.defaultRedisInterview)({ config, type: "states" });
|
|
27
28
|
}
|
|
29
|
+
__name(interview, "interview");
|
|
28
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
31
|
0 && (module.exports = {
|
|
30
32
|
interview
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/states/interview.ts"],
|
|
4
4
|
"sourcesContent": ["import { defaultRedisInterview } from '@iobroker/js-controller-common-db';\n\n/**\n * Custom interview during setup\n *\n * @param config the prefilled database config\n */\nexport function interview(config: ioBroker.StatesDatabaseOptions): Promise<ioBroker.StatesDatabaseOptions> {\n return defaultRedisInterview<ioBroker.StatesDatabaseOptions>({ config, type: 'states' });\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,qCAAsC;AAOhC,SAAU,UAAU,QAAsC;AAC5D,aAAO,sDAAsD,EAAE,QAAQ,MAAM,SAAQ,CAAE;AAC3F;AAFgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* States DB in redis - Client
|
|
3
3
|
*
|
|
4
|
-
* Copyright 2013-
|
|
4
|
+
* Copyright 2013-2026 bluefox <dogafox@gmail.com>
|
|
5
5
|
* Copyright 2013-2014 hobbyquaker
|
|
6
6
|
*
|
|
7
7
|
* MIT License
|
|
@@ -11,29 +11,47 @@ import type { InternalLogger } from '@iobroker/js-controller-common-db/tools';
|
|
|
11
11
|
import type { DbStatus, ConnectionOptions } from '@iobroker/db-base/inMemFileDB';
|
|
12
12
|
type UserChangeFunction = (id: string, state: ioBroker.State | null) => void;
|
|
13
13
|
type ChangeFunction = (id: string, state: ioBroker.State | ioBroker.Message | null) => void;
|
|
14
|
+
/** Settings for the states database client */
|
|
14
15
|
export interface StatesSettings {
|
|
16
|
+
/** Called once the client is connected */
|
|
15
17
|
connected?: () => void;
|
|
18
|
+
/** Called when the client gets disconnected */
|
|
16
19
|
disconnected?: () => void;
|
|
20
|
+
/** Handler for user-level state changes */
|
|
17
21
|
changeUser?: UserChangeFunction;
|
|
22
|
+
/** Handler for system-level state and message changes */
|
|
18
23
|
change?: ChangeFunction;
|
|
24
|
+
/** Connection options for the redis server */
|
|
19
25
|
connection: ConnectionOptions;
|
|
26
|
+
/** Whether to connect to the database immediately (default true) */
|
|
20
27
|
autoConnect?: boolean;
|
|
28
|
+
/** Logger instance to use */
|
|
21
29
|
logger?: InternalLogger;
|
|
30
|
+
/** Name of this host */
|
|
22
31
|
hostname?: string;
|
|
32
|
+
/** Namespace of this client */
|
|
23
33
|
namespace?: string;
|
|
34
|
+
/** Namespace used for meta information */
|
|
24
35
|
metaNamespace?: string;
|
|
36
|
+
/** Namespace used for sessions */
|
|
25
37
|
namespaceSession?: string;
|
|
38
|
+
/** Namespace used for log messages */
|
|
26
39
|
namespaceLog?: string;
|
|
40
|
+
/** Namespace used for the message box */
|
|
27
41
|
namespaceMsg?: string;
|
|
42
|
+
/** Redis key prefix (defaults to "io") */
|
|
28
43
|
redisNamespace?: string;
|
|
29
44
|
}
|
|
30
45
|
/** The internal log message does not have an _id parameter */
|
|
31
46
|
type LogMessageInternal = Omit<ioBroker.LogMessage, '_id'>;
|
|
47
|
+
/**
|
|
48
|
+
* Client for the states database backed by Redis (or the in-memory redis-protocol server)
|
|
49
|
+
*/
|
|
32
50
|
export declare class StateRedisClient {
|
|
33
51
|
private settings;
|
|
34
52
|
private readonly namespaceRedis;
|
|
35
53
|
private readonly namespaceRedisL;
|
|
36
|
-
namespaceMsg
|
|
54
|
+
private readonly namespaceMsg;
|
|
37
55
|
private readonly namespaceLog;
|
|
38
56
|
private readonly namespaceSession;
|
|
39
57
|
private readonly metaNamespace;
|
|
@@ -52,73 +70,328 @@ export declare class StateRedisClient {
|
|
|
52
70
|
private readonly userSubscriptions;
|
|
53
71
|
/** System level subscriptions value true means messagebox is subscribed */
|
|
54
72
|
private readonly systemSubscriptions;
|
|
73
|
+
/**
|
|
74
|
+
* @param settings Settings for the states client including connection and namespaces
|
|
75
|
+
*/
|
|
55
76
|
constructor(settings: StatesSettings);
|
|
56
77
|
/**
|
|
57
78
|
* Checks if we are allowed to start and sets the protocol version accordingly
|
|
58
79
|
*
|
|
59
80
|
*/
|
|
60
81
|
_determineProtocolVersion(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Connect to the states database and set up the change and message subscriptions
|
|
84
|
+
*/
|
|
61
85
|
connectDb(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Get the current status of the database
|
|
88
|
+
*/
|
|
62
89
|
getStatus(): DbStatus;
|
|
90
|
+
/**
|
|
91
|
+
* Set the value of a state
|
|
92
|
+
*
|
|
93
|
+
* @param id The id of the state to set
|
|
94
|
+
* @param state The value (or full state object) to set
|
|
95
|
+
*/
|
|
63
96
|
setState(id: string, state: ioBroker.SettableState | ioBroker.StateValue): Promise<string>;
|
|
64
97
|
/** @deprecated migrate to promisified version (without callback) */
|
|
65
|
-
setState(id: string, state: ioBroker.SettableState | ioBroker.StateValue, callback: (err: Error | null | undefined, id: string) => void):
|
|
98
|
+
setState(id: string, state: ioBroker.SettableState | ioBroker.StateValue, callback: (err: Error | null | undefined, id: string) => void): void;
|
|
66
99
|
/**
|
|
67
100
|
* Promise-version of setState
|
|
68
101
|
*
|
|
69
|
-
* @param id
|
|
70
|
-
* @param state
|
|
102
|
+
* @param id The id of the state to set
|
|
103
|
+
* @param state The value (or full state object) to set
|
|
71
104
|
* @deprecated use version without `Async` postfix
|
|
72
105
|
*/
|
|
73
106
|
setStateAsync(id: string, state: ioBroker.SettableState | ioBroker.StateValue): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Directly set the raw stored value of a state without publishing a change (used for restore, do not call it)
|
|
109
|
+
*
|
|
110
|
+
* @param id The id of the state to set
|
|
111
|
+
* @param state The raw state object to store
|
|
112
|
+
*/
|
|
74
113
|
setRawState(id: string, state: ioBroker.SettableState): Promise<string>;
|
|
114
|
+
/**
|
|
115
|
+
* Get state from database
|
|
116
|
+
*
|
|
117
|
+
* @param id id of the state
|
|
118
|
+
*/
|
|
75
119
|
getState(id: string): ioBroker.GetStatePromise;
|
|
76
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Get state from database
|
|
122
|
+
*
|
|
123
|
+
* @param id id of the state
|
|
124
|
+
* @param callback optional callback, leave out and use promise return type
|
|
125
|
+
*/
|
|
126
|
+
getState(id: string, callback: (err: Error | null | undefined, state?: ioBroker.State | null) => void): void;
|
|
77
127
|
/**
|
|
78
128
|
* Promise-version of getState
|
|
79
129
|
*
|
|
80
|
-
* @param id
|
|
130
|
+
* @param id id of the state to get
|
|
81
131
|
*/
|
|
82
132
|
getStateAsync(id: string): Promise<ioBroker.CallbackReturnTypeOf<ioBroker.GetStateCallback> | void>;
|
|
133
|
+
/**
|
|
134
|
+
* Get the values of multiple states
|
|
135
|
+
*
|
|
136
|
+
* @param keys The ids of the states to read
|
|
137
|
+
* @param callback Optional callback, leave out and use the promise return type
|
|
138
|
+
* @param dontModify If true, the returned states are not cloned/modified
|
|
139
|
+
*/
|
|
83
140
|
getStates(keys: string[], callback?: undefined, dontModify?: boolean): Promise<(ioBroker.State | null)[]>;
|
|
84
|
-
|
|
85
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Get the values of multiple states
|
|
143
|
+
*
|
|
144
|
+
* @param keys The ids of the states to read
|
|
145
|
+
* @param callback Callback called with the read states
|
|
146
|
+
* @param dontModify If true, the returned states are not cloned/modified
|
|
147
|
+
*/
|
|
148
|
+
getStates(keys: string[], callback: (err: Error | undefined | null, states?: (ioBroker.State | null)[]) => void, dontModify?: boolean): void;
|
|
86
149
|
/**
|
|
87
150
|
* @param keys - array of keys which will be deleted from db
|
|
88
151
|
* @param callback function to be executed after keys have been deleted
|
|
89
152
|
*/
|
|
90
153
|
_destroyDBHelper(keys: string[], callback?: ioBroker.ErrorCallback): Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Destroy (delete) all states in the database
|
|
156
|
+
*/
|
|
157
|
+
destroyDB(): Promise<void>;
|
|
91
158
|
/**
|
|
92
159
|
* @param callback cb function to be executed after DB has been destroyed
|
|
93
160
|
*/
|
|
94
|
-
destroyDB(callback
|
|
161
|
+
destroyDB(callback: ioBroker.ErrorCallback): void;
|
|
162
|
+
/**
|
|
163
|
+
* Destructor of the class. Called when shutting down to close the redis connections.
|
|
164
|
+
*/
|
|
95
165
|
destroy(): Promise<void>;
|
|
96
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Delete a state and publish the deletion
|
|
168
|
+
*
|
|
169
|
+
* @param id The id of the state to delete
|
|
170
|
+
*/
|
|
171
|
+
delState(id: string): Promise<ioBroker.CallbackReturnTypeOf<ioBroker.DeleteStateCallback>>;
|
|
172
|
+
/**
|
|
173
|
+
* Delete a state and publish the deletion
|
|
174
|
+
*
|
|
175
|
+
* @param id The id of the state to delete
|
|
176
|
+
* @param callback Callback called with the deleted id
|
|
177
|
+
*/
|
|
178
|
+
delState(id: string, callback: ioBroker.DeleteStateCallback): void;
|
|
179
|
+
/**
|
|
180
|
+
* Get all state ids matching the given pattern
|
|
181
|
+
*
|
|
182
|
+
* @param pattern The pattern to match state ids against
|
|
183
|
+
* @param callback Optional callback, leave out and use the promise return type
|
|
184
|
+
* @param dontModify If true, the returned keys are not stripped of the namespace
|
|
185
|
+
*/
|
|
97
186
|
getKeys(pattern: string, callback?: undefined, dontModify?: boolean): Promise<ioBroker.CallbackReturnTypeOf<ioBroker.GetKeysCallback>>;
|
|
98
|
-
getKeys(pattern: string, callback: ioBroker.GetKeysCallback, dontModify?: boolean): Promise<void>;
|
|
99
|
-
subscribe(pattern: string, callback?: ioBroker.ErrorCallback): Promise<void>;
|
|
100
|
-
subscribe(pattern: string, asUser: boolean, callback?: ioBroker.ErrorCallback): Promise<void>;
|
|
101
187
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
188
|
+
* Get all state ids matching the given pattern
|
|
189
|
+
*
|
|
190
|
+
* @param pattern The pattern to match state ids against
|
|
191
|
+
* @param callback Callback called with the matching keys
|
|
192
|
+
* @param dontModify If true, the returned keys are not stripped of the namespace
|
|
193
|
+
*/
|
|
194
|
+
getKeys(pattern: string, callback: ioBroker.GetKeysCallback, dontModify?: boolean): void;
|
|
195
|
+
/**
|
|
196
|
+
* Subscribe to state changes matching the given pattern
|
|
197
|
+
*
|
|
198
|
+
* @param pattern The pattern to subscribe to
|
|
199
|
+
*/
|
|
200
|
+
subscribe(pattern: string): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Subscribe to state changes matching the given pattern
|
|
203
|
+
*
|
|
204
|
+
* @param pattern The pattern to subscribe to
|
|
205
|
+
* @param callback callback function
|
|
104
206
|
*/
|
|
105
|
-
|
|
106
|
-
unsubscribe(pattern: string, asUser: boolean, callback?: ioBroker.ErrorCallback): Promise<void>;
|
|
107
|
-
unsubscribe(pattern: string, callback?: ioBroker.ErrorCallback): Promise<void>;
|
|
207
|
+
subscribe(pattern: string, callback: ioBroker.ErrorCallback): void;
|
|
108
208
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
209
|
+
* Subscribe to state changes matching the given pattern
|
|
210
|
+
*
|
|
211
|
+
* @param pattern The pattern to subscribe to
|
|
212
|
+
* @param asUser - if true it will be subscribed as user
|
|
213
|
+
*/
|
|
214
|
+
subscribe(pattern: string, asUser: boolean): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* Subscribe to state changes matching the given pattern
|
|
217
|
+
*
|
|
218
|
+
* @param pattern The pattern to subscribe to
|
|
219
|
+
* @param asUser - if true it will be subscribed as user
|
|
220
|
+
* @param callback callback function
|
|
221
|
+
*/
|
|
222
|
+
subscribe(pattern: string, asUser: boolean, callback: ioBroker.ErrorCallback): void;
|
|
223
|
+
/**
|
|
224
|
+
* Subscribe to state changes matching the given pattern as a user
|
|
225
|
+
*
|
|
226
|
+
* @param pattern The pattern to subscribe to
|
|
227
|
+
*/
|
|
228
|
+
subscribeUser(pattern: string): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Subscribe to state changes matching the given pattern as a user
|
|
231
|
+
*
|
|
232
|
+
* @param pattern The pattern to subscribe to
|
|
233
|
+
* @param callback callback function
|
|
234
|
+
*/
|
|
235
|
+
subscribeUser(pattern: string, callback: ioBroker.ErrorCallback): void;
|
|
236
|
+
/**
|
|
237
|
+
* Unsubscribe from state changes matching the given pattern
|
|
238
|
+
*
|
|
239
|
+
* @param pattern The pattern to unsubscribe from
|
|
240
|
+
*/
|
|
241
|
+
unsubscribe(pattern: string): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Unsubscribe from state changes matching the given pattern
|
|
244
|
+
*
|
|
245
|
+
* @param pattern The pattern to unsubscribe from
|
|
246
|
+
* @param callback callback function
|
|
247
|
+
*/
|
|
248
|
+
unsubscribe(pattern: string, callback: ioBroker.ErrorCallback): void;
|
|
249
|
+
/**
|
|
250
|
+
* Unsubscribe from state changes matching the given pattern
|
|
251
|
+
*
|
|
252
|
+
* @param pattern The pattern to unsubscribe from
|
|
253
|
+
* @param asUser - if true it will be unsubscribed as user
|
|
254
|
+
*/
|
|
255
|
+
unsubscribe(pattern: string, asUser: boolean): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* Unsubscribe from state changes matching the given pattern
|
|
258
|
+
*
|
|
259
|
+
* @param pattern The pattern to unsubscribe from
|
|
260
|
+
* @param asUser - if true it will be unsubscribed as user
|
|
261
|
+
* @param callback callback function
|
|
262
|
+
*/
|
|
263
|
+
unsubscribe(pattern: string, asUser: boolean, callback: ioBroker.ErrorCallback): void;
|
|
264
|
+
/**
|
|
265
|
+
* Unsubscribe from state changes matching the given pattern as a user
|
|
266
|
+
*
|
|
267
|
+
* @param pattern The pattern to unsubscribe from
|
|
268
|
+
*/
|
|
269
|
+
unsubscribeUser(pattern: string): Promise<void>;
|
|
270
|
+
/**
|
|
271
|
+
* Unsubscribe from state changes matching the given pattern as a user
|
|
272
|
+
*
|
|
273
|
+
* @param pattern The pattern to unsubscribe from
|
|
274
|
+
* @param callback callback function
|
|
275
|
+
*/
|
|
276
|
+
unsubscribeUser(pattern: string, callback: ioBroker.ErrorCallback): void;
|
|
277
|
+
/**
|
|
278
|
+
* Push a message into the message box of the given id
|
|
279
|
+
*
|
|
280
|
+
* @param id The id of the message box owner
|
|
281
|
+
* @param message The message to push
|
|
111
282
|
*/
|
|
112
|
-
unsubscribeUser(pattern: string, callback?: ioBroker.ErrorCallback): Promise<void>;
|
|
113
283
|
pushMessage(id: string, message: ioBroker.SendableMessage): Promise<void>;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Subscribe to messages sent to the given id
|
|
286
|
+
*
|
|
287
|
+
* @param id The id of the message box to subscribe to
|
|
288
|
+
*/
|
|
289
|
+
subscribeMessage(id: string): Promise<void>;
|
|
290
|
+
/**
|
|
291
|
+
* Subscribe to messages sent to the given id
|
|
292
|
+
*
|
|
293
|
+
* @param id The id of the message box to subscribe to
|
|
294
|
+
* @param callback callback function
|
|
295
|
+
*/
|
|
296
|
+
subscribeMessage(id: string, callback: ioBroker.ErrorCallback): void;
|
|
297
|
+
/**
|
|
298
|
+
* Unsubscribe from messages sent to the given id
|
|
299
|
+
*
|
|
300
|
+
* @param id The id of the message box to unsubscribe from
|
|
301
|
+
*/
|
|
302
|
+
unsubscribeMessage(id: string): Promise<void>;
|
|
303
|
+
/**
|
|
304
|
+
* Unsubscribe from messages sent to the given id
|
|
305
|
+
*
|
|
306
|
+
* @param id The id of the message box to unsubscribe from
|
|
307
|
+
* @param callback callback function
|
|
308
|
+
*/
|
|
309
|
+
unsubscribeMessage(id: string, callback: ioBroker.ErrorCallback): void;
|
|
310
|
+
/**
|
|
311
|
+
* Push a log message to the given log target
|
|
312
|
+
*
|
|
313
|
+
* @param id The id of the log target
|
|
314
|
+
* @param log The log message to push
|
|
315
|
+
* @param callback Optional callback called with the generated log id
|
|
316
|
+
*/
|
|
317
|
+
pushLog(id: string, log: LogMessageInternal): Promise<string>;
|
|
318
|
+
/**
|
|
319
|
+
* Push a log message to the given log target
|
|
320
|
+
*
|
|
321
|
+
* @param id The id of the log target
|
|
322
|
+
* @param log The log message to push
|
|
323
|
+
* @param callback Callback called with the generated log id
|
|
324
|
+
*/
|
|
325
|
+
pushLog(id: string, log: LogMessageInternal, callback: (err: Error | undefined | null, id?: string) => void): void;
|
|
326
|
+
/**
|
|
327
|
+
* Subscribe to log messages of the given id
|
|
328
|
+
*
|
|
329
|
+
* @param id The id of the log target to subscribe to
|
|
330
|
+
*/
|
|
331
|
+
subscribeLog(id: string): Promise<void>;
|
|
332
|
+
/**
|
|
333
|
+
* Subscribe to log messages of the given id
|
|
334
|
+
*
|
|
335
|
+
* @param id The id of the log target to subscribe to
|
|
336
|
+
* @param callback callback function
|
|
337
|
+
*/
|
|
338
|
+
subscribeLog(id: string, callback: ioBroker.ErrorCallback): void;
|
|
339
|
+
/**
|
|
340
|
+
* Unsubscribe from log messages of the given id
|
|
341
|
+
*
|
|
342
|
+
* @param id The id of the log target to unsubscribe from
|
|
343
|
+
*/
|
|
344
|
+
unsubscribeLog(id: string): Promise<void>;
|
|
345
|
+
/**
|
|
346
|
+
* Unsubscribe from log messages of the given id
|
|
347
|
+
*
|
|
348
|
+
* @param id The id of the log target to unsubscribe from
|
|
349
|
+
* @param callback callback function
|
|
350
|
+
*/
|
|
351
|
+
unsubscribeLog(id: string, callback: ioBroker.ErrorCallback): void;
|
|
352
|
+
/**
|
|
353
|
+
* Get a stored session by its id
|
|
354
|
+
*
|
|
355
|
+
* @param id The id of the session to read
|
|
356
|
+
*/
|
|
357
|
+
getSession(id: string): Promise<ioBroker.Session | null>;
|
|
358
|
+
/**
|
|
359
|
+
* Get a stored session by its id
|
|
360
|
+
*
|
|
361
|
+
* @param id The id of the session to read
|
|
362
|
+
* @param callback Called with the session object, or null if not found
|
|
363
|
+
*/
|
|
364
|
+
getSession(id: string, callback: (err: Error | undefined | null, session?: ioBroker.Session | null) => void): void;
|
|
365
|
+
/**
|
|
366
|
+
* Create or update a session and set its expiration
|
|
367
|
+
*
|
|
368
|
+
* @param id The id of the session
|
|
369
|
+
* @param expireS Expiration time in seconds from now
|
|
370
|
+
* @param obj The session data to store
|
|
371
|
+
*/
|
|
372
|
+
setSession(id: string, expireS: number, obj: ioBroker.Session): Promise<void>;
|
|
373
|
+
/**
|
|
374
|
+
* Create or update a session and set its expiration
|
|
375
|
+
*
|
|
376
|
+
* @param id The id of the session
|
|
377
|
+
* @param expireS Expiration time in seconds from now
|
|
378
|
+
* @param obj The session data to store
|
|
379
|
+
* @param callback callback function
|
|
380
|
+
*/
|
|
381
|
+
setSession(id: string, expireS: number, obj: ioBroker.Session, callback: ioBroker.ErrorCallback): void;
|
|
382
|
+
/**
|
|
383
|
+
* Destroy (delete) a session by its id
|
|
384
|
+
*
|
|
385
|
+
* @param id The id of the session to destroy
|
|
386
|
+
*/
|
|
387
|
+
destroySession(id: string): Promise<void>;
|
|
388
|
+
/**
|
|
389
|
+
* Destroy (delete) a session by its id
|
|
390
|
+
*
|
|
391
|
+
* @param id The id of the session to destroy
|
|
392
|
+
* @param callback callback function
|
|
393
|
+
*/
|
|
394
|
+
destroySession(id: string, callback: ioBroker.ErrorCallback): void;
|
|
122
395
|
/**
|
|
123
396
|
* Returns the protocol version from DB
|
|
124
397
|
*
|