@iobroker/types 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/config.d.ts CHANGED
@@ -6,7 +6,7 @@ interface DatabaseBackupOptions {
6
6
  /** All backups older than configured hours will be deleted. But only if the number of files is greater than of backupNumber */
7
7
  hours: number;
8
8
  '// hours': string;
9
- /** By default backup every 2 hours. Time is in minutes. To disable backup set the value to 0 */
9
+ /** By default, backup every 2 hours. Time is in minutes. To disable backup set the value to 0 */
10
10
  period: number;
11
11
  '// period': string;
12
12
  /** Absolute path to back-up directory or empty to back-up in data directory */
@@ -46,41 +46,100 @@ interface JsonlOptions {
46
46
  };
47
47
  }
48
48
 
49
+ interface DatabaseConnectionOptions {
50
+ /** Password used to authenticate against the database */
51
+ auth_pass: string;
52
+ /** Maximum delay in milliseconds between reconnection attempts */
53
+ retry_max_delay?: number;
54
+ /** Maximum number of reconnection attempts */
55
+ retry_max_count: number;
56
+ /** As soon as the tls property is defined, redis will try to connect via tls (currently only for redis) */
57
+ tls?: {
58
+ /** Needs to be false with self-signed certs */
59
+ rejectUnauthorized?: boolean;
60
+ /** The certificate content */
61
+ ca?: string;
62
+ /** The key file content */
63
+ key?: string;
64
+ /** The cert file content */
65
+ cert?: string;
66
+ };
67
+
68
+ // Redis options
69
+ port?: number | number[];
70
+ host?: string | string[];
71
+ /**
72
+ * 4 (IPv4) or 6 (IPv6), Defaults to 4.
73
+ */
74
+ family?: number;
75
+ /**
76
+ * Local domain socket path. If set the port, host and family will be ignored.
77
+ */
78
+ path?: string;
79
+ connectionName?: string;
80
+ /**
81
+ * If set, client will send AUTH command with the value of this option when connected.
82
+ */
83
+ password?: string;
84
+ /**
85
+ * Database index to use.
86
+ */
87
+ db?: number;
88
+ /**
89
+ * When a connection is established to the Redis server, the server might still be loading
90
+ * the database from disk. While loading, the server not respond to any commands.
91
+ * To work around this, when this option is true, ioredis will check the status of the Redis server,
92
+ * and when the Redis server is able to process commands, a ready event will be emitted.
93
+ */
94
+ enableReadyCheck?: boolean;
95
+ /**
96
+ * When the return value isn't a number, ioredis will stop trying to reconnect.
97
+ * Fixed in: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/15858
98
+ */
99
+ retryStrategy?(times: number): number | Error;
100
+ /**
101
+ * After reconnected, if the previous connection was in the subscriber mode, client will auto re-subscribe these channels.
102
+ * default: true.
103
+ */
104
+ autoResubscribe?: boolean;
105
+ /**
106
+ * default: null.
107
+ */
108
+ name?: string;
109
+ sentinels?: Array<{ host: string; port: number }>;
110
+ }
111
+
112
+ /** Configuration of a database connection (objects or states) */
49
113
  export interface DatabaseOptions {
50
114
  /** Possible values: 'file' - [port 9001], 'jsonl' - [port 9001], 'redis' - [port 6379 or 26379 for sentinel]. */
51
115
  type: 'jsonl' | 'file' | 'redis';
116
+ /** Name of the sentinel master to connect to */
52
117
  sentinelName?: string;
118
+ /** Host name(s) or IP address(es) of the database server */
53
119
  host: string | string[];
120
+ /** Port(s) of the database server */
54
121
  port: number | number[];
122
+ /** Maximum time in milliseconds to wait for a connection to be established */
55
123
  connectTimeout: number;
124
+ /** Interval in milliseconds between flushing the in-memory database to file */
56
125
  writeFileInterval: number;
126
+ /** Directory where the database files are stored, relative to the controller dir */
57
127
  dataDir?: string;
58
- options: {
59
- auth_pass: string;
60
- retry_max_delay: number;
61
- retry_max_count: number;
62
- db: number;
63
- family: number;
64
- /** As soon as the tls property is defined, redis will try to connect via tls (currently only for redis) */
65
- tls?: {
66
- /** Needs to be false with self-signed certs */
67
- rejectUnauthorized?: boolean;
68
- /** The certificate content */
69
- ca?: string;
70
- /** The key file content */
71
- key?: string;
72
- /** The cert file content */
73
- cert?: string;
74
- };
75
- };
128
+ /** Low-level connection options passed to the database driver */
129
+ options: DatabaseConnectionOptions;
130
+ /** Backup configuration for the database */
76
131
  backup: DatabaseBackupOptions;
132
+ /** Options specific to the JSONL database backend */
77
133
  jsonlOptions: JsonlOptions;
78
134
  }
79
135
 
136
+ /** Configuration of the objects database connection */
80
137
  export interface ObjectsDatabaseOptions extends DatabaseOptions {
138
+ /** Disable the in-memory file cache for objects */
81
139
  noFileCache: boolean;
82
140
  }
83
141
 
142
+ /** Configuration of the states database connection */
84
143
  export interface StatesDatabaseOptions extends DatabaseOptions {
85
144
  /** Limit maximum number of log entries in the list (only read by adapter.ts from the config file) */
86
145
  maxQueue: number;
@@ -90,6 +149,7 @@ export interface StatesDatabaseOptions extends DatabaseOptions {
90
149
  * The ioBroker global config
91
150
  */
92
151
  export interface IoBJson {
152
+ /** System-wide controller settings */
93
153
  system: {
94
154
  /** Do not use more than memory limit mb by ioB process (0 to deactivate) */
95
155
  memoryLimitMB: number;
@@ -116,14 +176,18 @@ export interface IoBJson {
116
176
  memLimitError: number;
117
177
  '// memLimitError': string;
118
178
  };
179
+ /** Configuration of the multihost service used to connect several ioBroker hosts */
119
180
  multihostService: {
120
181
  enabled: boolean;
121
182
  secure: boolean;
122
183
  password: string;
123
184
  persist: boolean;
124
185
  };
186
+ /** Configuration of the objects database */
125
187
  objects: ObjectsDatabaseOptions;
188
+ /** Configuration of the states database */
126
189
  states: StatesDatabaseOptions;
190
+ /** Logging configuration */
127
191
  log: {
128
192
  level: ioBroker.LogLevel;
129
193
  maxDays: number;
@@ -132,13 +196,16 @@ export interface IoBJson {
132
196
  };
133
197
  /** Always relative to iobroker.js-controller/ */
134
198
  dataDir: string;
199
+ /** Comment/hint shown next to the dataDir setting in the JSON config */
135
200
  '// dataDir': string;
201
+ /** Controller plugins configuration keyed by plugin name */
136
202
  plugins: {
137
203
  [pluginName: string]: {
138
204
  enabled: boolean;
139
205
  [other: string]: unknown;
140
206
  };
141
207
  };
208
+ /** Comment/hint shown next to the dnsResolution setting in the JSON config */
142
209
  '// dnsResolution': string;
143
210
  /** Use 'verbatim' for ipv6 first, else use 'ipv4first' */
144
211
  dnsResolution: 'verbatim' | 'ipv4first';
@@ -6,9 +6,9 @@ declare global {
6
6
  /** Defines access rights for a single file */
7
7
  interface FileACL {
8
8
  /** Full name of the user who owns this file, e.g. "system.user.admin" */
9
- owner: string;
9
+ owner: ioBroker.ObjectIDs.User;
10
10
  /** Full name of the group who owns this file, e.g. "system.group.administrator" */
11
- ownerGroup: string;
11
+ ownerGroup: ioBroker.ObjectIDs.Group;
12
12
  /** Linux-type permissions defining access to this file */
13
13
  permissions: number;
14
14
  }
@@ -24,9 +24,9 @@ declare global {
24
24
  /** Defines access rights for a single object */
25
25
  interface ObjectACL {
26
26
  /** Full name of the user who owns this object, e.g. "system.user.admin" */
27
- owner: string;
27
+ owner: ioBroker.ObjectIDs.User;
28
28
  /** Full name of the group who owns this object, e.g. "system.group.administrator" */
29
- ownerGroup: string;
29
+ ownerGroup: ioBroker.ObjectIDs.Group;
30
30
  /** Linux-type permissions defining access to this object */
31
31
  object: number;
32
32
  }
@@ -536,6 +536,16 @@ declare global {
536
536
  export interface DevicesWidgets {
537
537
  /** Link to the file with components relatively to `admin/dm-widgets` in admin or `${adapterName}` in web. Default is customDevices.js */
538
538
  url?: string;
539
+ /**
540
+ * Link to the file (icons.json) with specific icons in form
541
+ * ```ts
542
+ * type IconDescription = {
543
+ * name: ioBroker.Translated,
544
+ * icons: [{id: string, label: ioBroker.Translated, category: string, icon: 'data:image/svg+xml;base64,...'}]
545
+ * };
546
+ * ```
547
+ */
548
+ iconsManifest?: string;
539
549
  /** Description of the components (widgets). It could be multiple widgets in one adapter */
540
550
  components: {
541
551
  /** Name of the class */
@@ -650,7 +660,7 @@ declare global {
650
660
  /** Settings for custom Admin Tabs */
651
661
  adminTab?: {
652
662
  name?: StringOrTranslated;
653
- /** Base 64 icon for the tab */
663
+ /** Icon for the tab: a file name relative to the "admin" folder, a URL or a base64 data URL. If not set, the adapter icon is shown */
654
664
  icon?: string;
655
665
  /** If true, the Tab is not reloaded when the configuration changes */
656
666
  ignoreConfigUpdate?: boolean;
@@ -658,7 +668,7 @@ declare global {
658
668
  link?: string;
659
669
  /** If true, only one instance of this tab will be created for all instances */
660
670
  singleton?: boolean;
661
- /** Order number in admin tabs */
671
+ /** Position in the admin menu: the built-in tabs use 1 to 120, a tab without order gets 200. 0 counts as not set. Once the user has sorted the menu, the stored order wins */
662
672
  order?: number;
663
673
  /**
664
674
  * If the page sends an 'iobLoaded' event:
@@ -686,13 +696,13 @@ declare global {
686
696
  blockedVersions?: string[];
687
697
  /** Whether this adapter includes custom blocks for Blockly. If true, `admin/blockly.js` must exist. */
688
698
  blockly?: boolean;
689
- /** Where the adapter will get its data from. Set this together with @see dataSource */
699
+ /** Where the adapter will get its data from. Set this together with {@link dataSource} */
690
700
  connectionType?: ConnectionType;
691
701
  /** If true, this adapter can be started in compact mode (in the same process as other adapters) */
692
702
  compact?: boolean;
693
703
  /** The directory relative to iobroker-data where the adapter stores the data. Supports the placeholder `%INSTANCE%`. This folder will be backed up and restored automatically. */
694
704
  dataFolder?: string;
695
- /** How the adapter will mainly receive its data. Set this together with @see connectionType */
705
+ /** How the adapter will mainly receive its data. Set this together with {@link connectionType} */
696
706
  dataSource?: 'poll' | 'push' | 'assumption';
697
707
  /** A record of ioBroker adapters (including "js-controller") and version ranges which are required for this adapter on the same host. */
698
708
  dependencies?: Dependencies;
@@ -724,7 +734,7 @@ declare global {
724
734
  keywords?: string[];
725
735
  /** A dictionary of links to web services this adapter provides */
726
736
  localLinks?: Record<string, string | LocalLink>;
727
- /** @deprecated Use @see localLinks */
737
+ /** @deprecated Use {@link localLinks} */
728
738
  localLink?: string;
729
739
  /** Default log level for this adapter. It can be changed for every instance separately */
730
740
  loglevel?: LogLevel;
@@ -735,9 +745,9 @@ declare global {
735
745
  /** Whether the admin tab is written in a materialized style. Required for Admin 3+ */
736
746
  materializeTab?: boolean;
737
747
  /** Whether the admin configuration dialog is written in a materialized style. Required for Admin 3+ */
738
- /** @deprectaed Use adminUI with config = "materialize". But better use jsonConfig.json */
748
+ /** @deprecated Use adminUI with config = "materialize". But better use jsonConfig.json */
739
749
  materialize: boolean;
740
- /** @deprecated Use @see supportedMessages up from controller v5 */
750
+ /** @deprecated Use {@link supportedMessages} up from controller v5 */
741
751
  messagebox?: true;
742
752
  /** Messages which are supported by the adapter, supportedMessages.custom: true is the equivalent to messagebox: true */
743
753
  supportedMessages?: SupportedMessages;
@@ -794,11 +804,11 @@ declare global {
794
804
  subscribable?: boolean;
795
805
  /** If `true`, this adapter provides custom per-state settings. Requires a `custom_m.html` file in the `admin` directory. */
796
806
  supportCustoms?: boolean;
797
- /** @deprecated Use @see supportedMessages up from controller v5 */
807
+ /** @deprecated Use {@link supportedMessages} up from controller v5 */
798
808
  supportStopInstance?: boolean;
799
809
  /** The translated names of this adapter to be shown in the admin UI */
800
810
  titleLang?: StringOrTranslated;
801
- /** @deprecated The name of this adapter to be shown in the admin UI. Use @see titleLang instead. */
811
+ /** @deprecated The name of this adapter to be shown in the admin UI. Use {@link titleLang} instead. */
802
812
  title?: string;
803
813
  /** The type of this adapter */
804
814
  type?:
@@ -842,7 +852,7 @@ declare global {
842
852
  webByVersion?: boolean;
843
853
  /** Whether the web server in this adapter can be extended with plugin/extensions */
844
854
  webExtendable?: boolean;
845
- /** Relative path to a module that contains an extension for the web adapter. Use together with @see native.webInstance to configure which instances this affects */
855
+ /** Relative path to a module that contains an extension for the web adapter. Use together with {@link native.webInstance} to configure which instances this affects */
846
856
  webExtension?: string;
847
857
  /** List of parameters that must be included in info.js by webServer adapter. (Example material: `"webPreSettings": { "materialBackground": "native.loadingBackground" }`). Web adapter uses this setting to create a customized info.js file to provide some essential settings for the index.html file before the socket connection is established to provide e.g., background color of the loading screen. */
848
858
  webPreSettings?: Record<string, any>;
@@ -951,6 +961,8 @@ declare global {
951
961
  }[];
952
962
  /** Global saved expert mode for admin */
953
963
  expertMode?: boolean;
964
+ /** The "Did you know ...?" tips of the admin are not shown when it is opened */
965
+ tipsDisabled?: boolean;
954
966
 
955
967
  // Make it possible to narrow the object type using the custom property
956
968
  custom?: undefined;
@@ -994,7 +1006,7 @@ declare global {
994
1006
  acl?: ObjectACL;
995
1007
  from?: string;
996
1008
  /** The user who created or updated this object */
997
- user?: string;
1009
+ user?: ioBroker.ObjectIDs.User;
998
1010
  ts?: number;
999
1011
  /** These properties can only be edited if the correct password is provided */
1000
1012
  nonEdit?: NonEditable;
@@ -1088,7 +1100,25 @@ declare global {
1088
1100
  unsafePerm?: boolean;
1089
1101
  /** If given, the packet name differs from the adapter name, e.g. because it is a scoped package */
1090
1102
  packetName?: string;
1091
-
1103
+ /** Link to package */
1104
+ meta: string;
1105
+ /** List of licenses */
1106
+ licenses?: { type: string; url: string }[];
1107
+ /** Normally by admin is a ISO string with published date */
1108
+ published?: string;
1109
+
1110
+ /** Link to adapter repo */
1111
+ url?: string;
1112
+ /** Adapter icon */
1113
+ icon?: string;
1114
+ /** Internally used flag */
1115
+ processed?: boolean;
1116
+ /** History */
1117
+ news: { [version: string]: ioBroker.Translated };
1118
+ /** A record of ioBroker adapters (including "js-controller") and version ranges which are required for this adapter on the same host. */
1119
+ dependencies: Dependencies;
1120
+ /** A record of ioBroker adapters (including "js-controller") and version ranges which are required for this adapter in the whole system. */
1121
+ globalDependencies: Dependencies;
1092
1122
  /** Other Adapter related properties, not important for this implementation */
1093
1123
  [other: string]: unknown;
1094
1124
  }
@@ -1420,12 +1450,11 @@ declare global {
1420
1450
  : View extends 'schedule'
1421
1451
  ? ScheduleObject
1422
1452
  : View extends 'config'
1423
- ?
1424
- | RepositoryObject
1425
- | SystemConfigObject
1426
- | (OtherObject & {
1427
- type: 'config';
1428
- })
1453
+ ? | RepositoryObject
1454
+ | SystemConfigObject
1455
+ | (OtherObject & {
1456
+ type: 'config';
1457
+ })
1429
1458
  : View extends 'custom'
1430
1459
  ? NonNullable<StateObject['common']['custom']>
1431
1460
  : ioBroker.Object
package/build/shared.d.ts CHANGED
@@ -120,7 +120,13 @@ declare global {
120
120
  state?: string;
121
121
  }
122
122
 
123
- type Session = any; // TODO: implement
123
+ type Session = {
124
+ cookie?: {
125
+ originalMaxAge?: number;
126
+ maxAge?: number;
127
+ };
128
+ [key: string]: any;
129
+ };
124
130
 
125
131
  /** Defines access rights for a single object type */
126
132
  interface ObjectOperationPermissions {
@@ -150,9 +156,9 @@ declare global {
150
156
  /** Defined the complete set of access rights a user has */
151
157
  interface PermissionSet extends ObjectPermissions {
152
158
  /** The name of the user this ACL is for */
153
- user: string;
159
+ user: ioBroker.ObjectIDs.User;
154
160
  /** The name of the groups this ACL was merged from */
155
- groups: string[];
161
+ groups: ioBroker.ObjectIDs.Group[];
156
162
  /** The access rights for certain commands */
157
163
  other: {
158
164
  execute: boolean;
@@ -230,7 +236,7 @@ declare global {
230
236
  }
231
237
 
232
238
  /** Parameters for adapter.getObjectList */
233
- type GetObjectListParams = GetObjectViewParams;
239
+ type GetObjectListParams = GetObjectViewParams | undefined;
234
240
 
235
241
  type LogLevel = 'silly' | 'debug' | 'info' | 'warn' | 'error';
236
242
  interface Logger {
@@ -371,14 +377,13 @@ declare global {
371
377
  /** when using aggregate method `integral` defines the interpolation method (defaults to `none`). */
372
378
  integralInterpolation?: 'none' | 'linear';
373
379
  /** If user is set, it will be checked if this user may read the variable */
374
- user?: `system.user.${string}`;
380
+ user?: ioBroker.ObjectIDs.User;
375
381
  }
376
382
 
377
383
  interface DelObjectOptions {
378
384
  /** Whether all child objects should be deleted as well */
379
385
  recursive?: boolean;
380
- // Allow non-documented properties
381
- [other: string]: unknown;
386
+ user?: ioBroker.ObjectIDs.User;
382
387
  }
383
388
 
384
389
  interface ExtendObjectOptionsPreserve {
@@ -388,8 +393,9 @@ declare global {
388
393
  interface ExtendObjectOptions {
389
394
  /** Which properties of the original object should be preserved */
390
395
  preserve?: ExtendObjectOptionsPreserve;
391
- // Allow non-documented properties
392
- [other: string]: unknown;
396
+ user?: ioBroker.ObjectIDs.User;
397
+ owner?: ioBroker.ObjectIDs.User;
398
+ ownerGroup?: ioBroker.ObjectIDs.Group;
393
399
  }
394
400
 
395
401
  /** Predefined notification scopes and their categories */
@@ -442,7 +448,7 @@ declare global {
442
448
  type GenericCallback<T> = (err?: Error | null, result?: T) => void;
443
449
 
444
450
  /** Due to backward compatibility first param can be result or error */
445
- type MessageCallback = (response?: Message | Error) => void;
451
+ type MessageCallback = (response?: MessagePayload) => void;
446
452
 
447
453
  type SetObjectCallback = (err?: Error | null, obj?: { id: string }) => void;
448
454
  type SetObjectPromise = Promise<NonNullCallbackReturnTypeOf<SetObjectCallback>>;
@@ -462,7 +468,7 @@ declare global {
462
468
  ) => void;
463
469
  type GetEnumsPromise = Promise<NonNullCallbackReturnTypeOf<GetEnumsCallback>>;
464
470
 
465
- type GetObjectsCallback = (err?: Error | null, objects?: Record<string, ioBroker.Object>) => void;
471
+ type GetObjectsCallback = (err?: Error | null, objects?: Record<string, ioBroker.AnyObject | null>) => void;
466
472
  type GetObjectsPromise = Promise<NonNullCallbackReturnTypeOf<GetObjectsCallback>>;
467
473
 
468
474
  type GetObjectsCallbackTyped<T extends ObjectType> = (
@@ -516,7 +522,7 @@ declare global {
516
522
 
517
523
  type GetHistoryResult = Array<State & { id?: string }>;
518
524
  type GetHistoryCallback = (
519
- err: Error | null,
525
+ err: Error | null | undefined,
520
526
  result?: GetHistoryResult,
521
527
  step?: number,
522
528
  sessionId?: number,
@@ -527,7 +533,9 @@ declare global {
527
533
  /** Name of the file or directory */
528
534
  file: string;
529
535
  /** File system stats */
530
- stats: Partial<fs.Stats>;
536
+ stats?: {
537
+ size?: number;
538
+ };
531
539
  /** Whether this is a directory or a file */
532
540
  isDir: boolean;
533
541
  /** Access rights */
@@ -540,8 +548,12 @@ declare global {
540
548
  type ReadDirCallback = (err?: NodeJS.ErrnoException | null, entries?: ReadDirResult[]) => void;
541
549
  type ReadDirPromise = Promise<ReadDirResult[]>;
542
550
 
543
- type ReadFileCallback = (err?: NodeJS.ErrnoException | null, data?: Buffer | string, mimeType?: string) => void;
544
- type ReadFilePromise = Promise<{ file: string | Buffer; mimeType?: string }>;
551
+ type ReadFileCallback = (
552
+ err?: NodeJS.ErrnoException | null,
553
+ data?: Buffer | string | null,
554
+ mimeType?: string,
555
+ ) => void;
556
+ type ReadFilePromise = Promise<{ file: string | Buffer | null; mimeType?: string }>;
545
557
 
546
558
  /** Contains the return values of chownFile */
547
559
  interface ChownFileResult {
@@ -550,15 +562,17 @@ declare global {
550
562
  /** Name of the file or directory */
551
563
  file: string;
552
564
  /** File system stats */
553
- stats: fs.Stats;
565
+ stats?: {
566
+ size?: number;
567
+ };
554
568
  /** Whether this is a directory or a file */
555
569
  isDir: boolean;
556
570
  /** Access rights */
557
- acl: FileACL;
571
+ acl: EvaluatedFileACL;
558
572
  /** Date of last modification */
559
- modifiedAt: number;
573
+ modifiedAt?: number;
560
574
  /** Date of creation */
561
- createdAt: number;
575
+ createdAt?: number;
562
576
  }
563
577
  type ChownFileCallback = (err?: NodeJS.ErrnoException | null, processed?: ChownFileResult[]) => void;
564
578
 
@@ -590,7 +604,7 @@ declare global {
590
604
  interface GetObjectListItem<T extends ioBroker.Object> extends GetObjectViewItem<T> {
591
605
  /** A copy of the object */
592
606
  value: T;
593
- /** The same as @link{value} */
607
+ /** The same as {@link value} */
594
608
  doc: T;
595
609
  }
596
610
  type GetObjectListCallback<T extends ioBroker.Object> = (
@@ -605,7 +619,7 @@ declare global {
605
619
  id?: string,
606
620
  ) => void;
607
621
 
608
- type GetSessionCallback = (session: Session) => void;
622
+ type GetSessionCallback = (session: Session | null) => void;
609
623
 
610
624
  type Timeout = Branded<number, 'Timeout'> | null; // or null to not allow native clearTimeout
611
625
  type Interval = Branded<number, 'Interval'> | null; // or null to not allow native clearInterval