@iobroker/types 5.0.12-alpha.0-20230812-0eb416fc → 5.0.12
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/types.d.ts +85 -2
- package/package.json +2 -2
package/build/types.d.ts
CHANGED
|
@@ -12,6 +12,16 @@ export declare const Adapter: typeof AdapterClass;
|
|
|
12
12
|
* Here we define dynamically created methods
|
|
13
13
|
*/
|
|
14
14
|
export declare interface AdapterClass {
|
|
15
|
+
on(event: 'stateChange', listener: ioBroker.StateChangeHandler): this;
|
|
16
|
+
on(event: 'objectChange', listener: ioBroker.ObjectChangeHandler): this;
|
|
17
|
+
on(event: 'fileChange', listener: ioBroker.FileChangeHandler): this;
|
|
18
|
+
on(event: 'ready', listener: ioBroker.ReadyHandler): this;
|
|
19
|
+
on(event: 'install', listener: ioBroker.ReadyHandler): this;
|
|
20
|
+
on(event: 'unload', listener: ioBroker.UnloadHandler): this;
|
|
21
|
+
on(event: 'message', listener: ioBroker.MessageHandler): this;
|
|
22
|
+
/** Only emitted for compact instances */
|
|
23
|
+
on(event: 'exit', listener: (exitCode: number, reason: string) => Promise<void> | void): this;
|
|
24
|
+
on(event: 'log', listener: (info: any) => Promise<void> | void): this;
|
|
15
25
|
/** Extend an object and create it if it might not exist */
|
|
16
26
|
extendObjectAsync(id: string, objPart: ioBroker.PartialObject, options?: ioBroker.ExtendObjectOptions): ioBroker.SetObjectPromise;
|
|
17
27
|
/** Set capabilities of the given executable. Only works on Linux systems. */
|
|
@@ -392,6 +402,8 @@ export declare class AdapterClass extends EventEmitter {
|
|
|
392
402
|
};
|
|
393
403
|
/** Features supported by the running instance */
|
|
394
404
|
private readonly SUPPORTED_FEATURES;
|
|
405
|
+
/** Controller for messaging related functionality */
|
|
406
|
+
private readonly uiMessagingController;
|
|
395
407
|
constructor(options: AdapterOptions | string);
|
|
396
408
|
decrypt(secretVal: string, value?: string): string;
|
|
397
409
|
decrypt(value: string): string;
|
|
@@ -451,6 +463,10 @@ export declare class AdapterClass extends EventEmitter {
|
|
|
451
463
|
disable(): ioBroker.SetObjectPromise;
|
|
452
464
|
getEncryptedConfig(attribute: string, callback?: GetEncryptedConfigCallback): Promise<string | void>;
|
|
453
465
|
private _getEncryptedConfig;
|
|
466
|
+
/**
|
|
467
|
+
* Get the system secret, after retrived once it will be read from cache
|
|
468
|
+
*/
|
|
469
|
+
private getSystemSecret;
|
|
454
470
|
setTimeout(cb: TimeoutCallback, timeout: number, ...args: any[]): ioBroker.Timeout | undefined;
|
|
455
471
|
clearTimeout(timer: ioBroker.Timeout | undefined): void;
|
|
456
472
|
delay(timeout: number): Promise<void>;
|
|
@@ -615,6 +631,7 @@ export declare class AdapterClass extends EventEmitter {
|
|
|
615
631
|
sendToHost(hostName: string | null, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo): void;
|
|
616
632
|
sendToHost(hostName: string | null, command: string, message: any, callback?: ioBroker.MessageCallback | ioBroker.MessageCallbackInfo): void;
|
|
617
633
|
private _sendToHost;
|
|
634
|
+
sendToUI(options: SendToUserInterfaceClientOptions): Promise<void>;
|
|
618
635
|
registerNotification<Scope extends keyof ioBroker.NotificationScopes>(scope: Scope, category: ioBroker.NotificationScopes[Scope] | null, message: string): Promise<void>;
|
|
619
636
|
setState<T extends ioBroker.SetStateCallback | undefined>(id: string | ioBroker.IdObject, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, callback?: T): T extends ioBroker.SetStateCallback ? void : ioBroker.SetStatePromise;
|
|
620
637
|
setState<T extends ioBroker.SetStateCallback>(id: string | ioBroker.IdObject, state: ioBroker.State | ioBroker.StateValue | ioBroker.SettableState, ack: boolean, callback?: T): T extends ioBroker.SetStateCallback ? void : ioBroker.SetStatePromise;
|
|
@@ -716,7 +733,6 @@ export declare class AdapterClass extends EventEmitter {
|
|
|
716
733
|
private _initAdapter;
|
|
717
734
|
/**
|
|
718
735
|
* Calls the ready handler, if it is an install run it calls the install handler instead
|
|
719
|
-
* @private
|
|
720
736
|
*/
|
|
721
737
|
private _callReadyHandler;
|
|
722
738
|
private _exceptionHandler;
|
|
@@ -733,7 +749,7 @@ export declare interface AdapterOptions {
|
|
|
733
749
|
logTransporter?: boolean;
|
|
734
750
|
/** if true, the date format from system.config */
|
|
735
751
|
useFormatDate?: boolean;
|
|
736
|
-
/** if it is possible for other instances to
|
|
752
|
+
/** if it is possible for other instances to retrieve states of this adapter automatically */
|
|
737
753
|
subscribable?: boolean;
|
|
738
754
|
/** compact group instance if running in compact mode */
|
|
739
755
|
compactInstance?: number;
|
|
@@ -761,6 +777,10 @@ export declare interface AdapterOptions {
|
|
|
761
777
|
stateChange?: ioBroker.StateChangeHandler;
|
|
762
778
|
/** callback function (id, file) that will be called if file changed */
|
|
763
779
|
fileChange?: ioBroker.FileChangeHandler;
|
|
780
|
+
/** callback function that will be called when a new UI client subscribes */
|
|
781
|
+
uiClientSubscribe?: UserInterfaceClientSubscribeHandler;
|
|
782
|
+
/** callback function that will be called when a new UI client unsubscribes */
|
|
783
|
+
uiClientUnsubscribe?: UserInterfaceClientUnsubscribeHandler;
|
|
764
784
|
/** callback to inform about new message the adapter */
|
|
765
785
|
message?: ioBroker.MessageHandler;
|
|
766
786
|
/** callback to stop the adapter */
|
|
@@ -803,6 +823,10 @@ export declare interface AliasTargetEntry {
|
|
|
803
823
|
unit?: string;
|
|
804
824
|
}
|
|
805
825
|
|
|
826
|
+
export declare type AllPropsUnknown<T> = {
|
|
827
|
+
[K in keyof T]: unknown;
|
|
828
|
+
};
|
|
829
|
+
|
|
806
830
|
export declare type CalculatePermissionsCallback = (result: ioBroker.PermissionSet) => void;
|
|
807
831
|
|
|
808
832
|
declare type Callback = (...args: any[]) => void | Promise<void>;
|
|
@@ -818,6 +842,8 @@ export declare interface CheckStatesResult {
|
|
|
818
842
|
ids: string[];
|
|
819
843
|
}
|
|
820
844
|
|
|
845
|
+
export declare type ClientUnsubscribeReason = MessageUnsubscribeReason | 'clientSubscribeError';
|
|
846
|
+
|
|
821
847
|
export declare type CommandsPermissions = CommandsPermissionsObject | CommandsPermissionsEntry[];
|
|
822
848
|
|
|
823
849
|
export declare type CommandsPermissionsEntry = {
|
|
@@ -1176,6 +1202,8 @@ export declare interface MessageCallbackObject {
|
|
|
1176
1202
|
timer?: NodeJS.Timeout;
|
|
1177
1203
|
}
|
|
1178
1204
|
|
|
1205
|
+
declare type MessageUnsubscribeReason = 'client' | 'disconnect';
|
|
1206
|
+
|
|
1179
1207
|
declare type OptionalCallback = undefined | Callback;
|
|
1180
1208
|
|
|
1181
1209
|
export declare type Pattern = string | string[];
|
|
@@ -1187,6 +1215,13 @@ export declare interface SendToOptions {
|
|
|
1187
1215
|
timeout?: number;
|
|
1188
1216
|
}
|
|
1189
1217
|
|
|
1218
|
+
export declare interface SendToUserInterfaceClientOptions {
|
|
1219
|
+
/** id of the UI client, if not given send to all active clients */
|
|
1220
|
+
clientId?: string;
|
|
1221
|
+
/** data to send to the client */
|
|
1222
|
+
data: unknown;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1190
1225
|
export declare interface SetStateChangedResult {
|
|
1191
1226
|
notChanged: boolean;
|
|
1192
1227
|
id: string;
|
|
@@ -1232,6 +1267,54 @@ declare type SupportedFeature = (typeof SUPPORTED_FEATURES)[number];
|
|
|
1232
1267
|
|
|
1233
1268
|
export declare type TimeoutCallback = (args?: any[]) => void;
|
|
1234
1269
|
|
|
1270
|
+
export declare type UserInterfaceClientRemoveMessage = (ioBroker.Message & {
|
|
1271
|
+
command: 'clientUnsubscribe';
|
|
1272
|
+
message: {
|
|
1273
|
+
reason: MessageUnsubscribeReason;
|
|
1274
|
+
};
|
|
1275
|
+
}) | (ioBroker.Message & {
|
|
1276
|
+
command: 'clientSubscribeError';
|
|
1277
|
+
message: {
|
|
1278
|
+
reason: undefined;
|
|
1279
|
+
};
|
|
1280
|
+
});
|
|
1281
|
+
|
|
1282
|
+
export declare type UserInterfaceClientSubscribeHandler = (subscribeInfo: UserInterfaceSubscribeInfo) => UserInterfaceClientSubscribeReturnType | Promise<UserInterfaceClientSubscribeReturnType>;
|
|
1283
|
+
|
|
1284
|
+
export declare interface UserInterfaceClientSubscribeReturnType {
|
|
1285
|
+
/** If the adapter has accepted the client subscription */
|
|
1286
|
+
accepted: boolean;
|
|
1287
|
+
/** Optional heartbeat, if set, the client needs to re-subscribe every heartbeat interval */
|
|
1288
|
+
heartbeat?: number;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
export declare type UserInterfaceClientUnsubscribeHandler = (unsubscribeInfo: UserInterfaceUnsubscribeInfo) => void | Promise<void>;
|
|
1292
|
+
|
|
1293
|
+
declare type UserInterfaceClientUnsubscribeReason = ClientUnsubscribeReason | 'timeout';
|
|
1294
|
+
|
|
1295
|
+
export declare interface UserInterfaceSubscribeInfo {
|
|
1296
|
+
/** The client id, which can be used to send information to clients */
|
|
1297
|
+
clientId: string;
|
|
1298
|
+
/** The message used for subscription */
|
|
1299
|
+
message: ioBroker.Message;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
export declare type UserInterfaceUnsubscribeInfo = UserInterfaceUnsubscribeInfoBaseObject & ({
|
|
1303
|
+
/** Reason for unsubscribe */
|
|
1304
|
+
reason: Exclude<UserInterfaceClientUnsubscribeReason, ClientUnsubscribeReason>;
|
|
1305
|
+
message?: undefined;
|
|
1306
|
+
} | {
|
|
1307
|
+
/** Reason for unsubscribe */
|
|
1308
|
+
reason: ClientUnsubscribeReason;
|
|
1309
|
+
/** Message used for unsubscribe */
|
|
1310
|
+
message: ioBroker.Message;
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1313
|
+
declare type UserInterfaceUnsubscribeInfoBaseObject = {
|
|
1314
|
+
/** The handler id, which can be used to send information to clients */
|
|
1315
|
+
clientId: string;
|
|
1316
|
+
};
|
|
1317
|
+
|
|
1235
1318
|
declare interface ValidateIdOptions {
|
|
1236
1319
|
/** in maintenance mode we can access ivnalid ids to delete them, only works with the admin user */
|
|
1237
1320
|
maintenance?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/types",
|
|
3
|
-
"version": "5.0.12
|
|
3
|
+
"version": "5.0.12",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=12.0.0"
|
|
6
6
|
},
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
]
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "72526869156e91335caa1e1e0f0e86a6d827b423"
|
|
45
45
|
}
|