@iobroker/types 7.2.3 → 8.0.0-alpha.2-20260923-99da17fcc

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?:
@@ -832,6 +842,19 @@ declare global {
832
842
  | 'weather';
833
843
  /** If `true`, the `npm` package must be installed with the `--unsafe-perm` flag */
834
844
  unsafePerm?: true;
845
+ /**
846
+ * If `true`, the adapter declares the exclusive resources it occupies (serial ports, TCP/UDP ports, ...)
847
+ * itself via `adapter.registerUsedResource(...)`. Set this when the occupied resources are not simply
848
+ * the configured `native.port`.
849
+ *
850
+ * If not set, js-controller maintains the registry for this adapter and derives the entries from the
851
+ * instance's `native.port` / `native.bind`.
852
+ *
853
+ * If `false`, the adapter does not declare any resources and js-controller does not derive any either,
854
+ * so its instances have no entries in the registry. Use this when `native.port` is not a port the
855
+ * adapter listens on, e.g. the port of the device it connects to.
856
+ */
857
+ declareUsedResources?: boolean;
835
858
  /** The available version in the ioBroker repo. */
836
859
  version: string;
837
860
  /** Definition of the vis-2 widgets */
@@ -842,7 +865,7 @@ declare global {
842
865
  webByVersion?: boolean;
843
866
  /** Whether the web server in this adapter can be extended with plugin/extensions */
844
867
  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 */
868
+ /** 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
869
  webExtension?: string;
847
870
  /** 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
871
  webPreSettings?: Record<string, any>;
@@ -951,6 +974,8 @@ declare global {
951
974
  }[];
952
975
  /** Global saved expert mode for admin */
953
976
  expertMode?: boolean;
977
+ /** The "Did you know ...?" tips of the admin are not shown when it is opened */
978
+ tipsDisabled?: boolean;
954
979
 
955
980
  // Make it possible to narrow the object type using the custom property
956
981
  custom?: undefined;
@@ -994,7 +1019,7 @@ declare global {
994
1019
  acl?: ObjectACL;
995
1020
  from?: string;
996
1021
  /** The user who created or updated this object */
997
- user?: string;
1022
+ user?: ioBroker.ObjectIDs.User;
998
1023
  ts?: number;
999
1024
  /** These properties can only be edited if the correct password is provided */
1000
1025
  nonEdit?: NonEditable;
@@ -1088,7 +1113,25 @@ declare global {
1088
1113
  unsafePerm?: boolean;
1089
1114
  /** If given, the packet name differs from the adapter name, e.g. because it is a scoped package */
1090
1115
  packetName?: string;
1091
-
1116
+ /** Link to package */
1117
+ meta: string;
1118
+ /** List of licenses */
1119
+ licenses?: { type: string; url: string }[];
1120
+ /** Normally by admin is a ISO string with published date */
1121
+ published?: string;
1122
+
1123
+ /** Link to adapter repo */
1124
+ url?: string;
1125
+ /** Adapter icon */
1126
+ icon?: string;
1127
+ /** Internally used flag */
1128
+ processed?: boolean;
1129
+ /** History */
1130
+ news: { [version: string]: ioBroker.Translated };
1131
+ /** A record of ioBroker adapters (including "js-controller") and version ranges which are required for this adapter on the same host. */
1132
+ dependencies: Dependencies;
1133
+ /** A record of ioBroker adapters (including "js-controller") and version ranges which are required for this adapter in the whole system. */
1134
+ globalDependencies: Dependencies;
1092
1135
  /** Other Adapter related properties, not important for this implementation */
1093
1136
  [other: string]: unknown;
1094
1137
  }
@@ -1420,12 +1463,11 @@ declare global {
1420
1463
  : View extends 'schedule'
1421
1464
  ? ScheduleObject
1422
1465
  : View extends 'config'
1423
- ?
1424
- | RepositoryObject
1425
- | SystemConfigObject
1426
- | (OtherObject & {
1427
- type: 'config';
1428
- })
1466
+ ? | RepositoryObject
1467
+ | SystemConfigObject
1468
+ | (OtherObject & {
1469
+ type: 'config';
1470
+ })
1429
1471
  : View extends 'custom'
1430
1472
  ? NonNullable<StateObject['common']['custom']>
1431
1473
  : ioBroker.Object
package/build/shared.d.ts CHANGED
@@ -79,7 +79,133 @@ declare global {
79
79
  | 'CONTROLLER_UI_UPGRADE'
80
80
  | 'ADAPTER_WEBSERVER_UPGRADE'
81
81
  | 'CONTROLLER_CMD_EXEC_FILES'
82
- | 'CONTROLLER_FEATURE_REQUEST';
82
+ | 'CONTROLLER_FEATURE_REQUEST'
83
+ | 'CONTROLLER_USED_RESOURCES';
84
+
85
+ // #region Used resources
86
+ // ---------------------------------------------------------------------------------------------------
87
+ // Exclusive resources occupied by adapter instances (serial ports, TCP/UDP ports, USB devices, ...).
88
+ // These are the resources that cannot be used by more than one instance at the same time.
89
+ // Each resource type has its own strictly typed payload; extend `UsedResourceDataMap` to add a new one.
90
+ // ---------------------------------------------------------------------------------------------------
91
+
92
+ /** A serial port occupied by an instance */
93
+ interface SerialPortResourceData {
94
+ /**
95
+ * System path or name of the serial port as the adapter opens it, e.g. "/dev/ttyUSB0", a stable
96
+ * "/dev/serial/by-id/..." link or "COM3"
97
+ */
98
+ port: string;
99
+ /** Baud rate the port is opened with, if known */
100
+ baudRate?: number;
101
+ /**
102
+ * The device `port` resolves to, e.g. "/dev/ttyUSB0" for a "/dev/serial/by-id/..." link or "COM3" for
103
+ * "\\\\.\\com3". Set by the host on registration and used to recognize the same port under different
104
+ * names; an adapter does not set it.
105
+ */
106
+ device?: string;
107
+ }
108
+
109
+ /** A TCP port occupied by an instance */
110
+ interface TcpPortResourceData {
111
+ /** TCP port number */
112
+ port: number;
113
+ /** Address the socket is bound to. Default "0.0.0.0" (all interfaces) */
114
+ bind?: string;
115
+ /** address family */
116
+ family?: 4 | 6;
117
+ }
118
+
119
+ /** A UDP port occupied by an instance */
120
+ interface UdpPortResourceData {
121
+ /** UDP port number */
122
+ port: number;
123
+ /** Address the socket is bound to. Default "0.0.0.0" (all interfaces) */
124
+ bind?: string;
125
+ /** address family */
126
+ family?: 4 | 6;
127
+ }
128
+
129
+ /** A USB device occupied by an instance */
130
+ interface UsbResourceData {
131
+ /** System path of the USB device, e.g. "/dev/bus/usb/001/004" or "\\\\.\\COM3" */
132
+ path: string;
133
+ /** USB vendor id (hex string), e.g. "10c4" */
134
+ vendorId?: string;
135
+ /** USB product id (hex string), e.g. "ea60" */
136
+ productId?: string;
137
+ }
138
+
139
+ /** A Bluetooth / HCI adapter occupied by an instance */
140
+ interface BluetoothResourceData {
141
+ /** HCI device name or index, e.g. "hci0" */
142
+ hci: string;
143
+ }
144
+
145
+ /** A GPIO pin occupied by an instance */
146
+ interface GpioResourceData {
147
+ /**
148
+ * Line offset of the pin on its GPIO chip. On the main chip of a Raspberry Pi that is the BCM number, so
149
+ * GPIO 17 is header pin 11. Convert physical header pins, wiringPi numbers or sysfs numbers (which start
150
+ * at 512 on newer kernels) before registering, otherwise the same pin is not recognized.
151
+ */
152
+ pin: number;
153
+ /**
154
+ * GPIO chip the pin belongs to, e.g. "gpiochip2" for an I²C port expander. Leave it out for the main chip
155
+ * of the board; an entry without a chip counts as overlapping with the same pin on any chip, because the
156
+ * host cannot tell which one was meant.
157
+ */
158
+ chip?: string;
159
+ }
160
+
161
+ /**
162
+ * Maps every known resource type to its strictly typed payload.
163
+ * To introduce a new resource type, add its `RESOURCE_TYPE: RESOURCE_TYPE_Data` entry here
164
+ * (this map is intentionally open for module augmentation by adapters that own custom resources).
165
+ */
166
+ interface UsedResourceDataMap {
167
+ serialPort: SerialPortResourceData;
168
+ tcpPort: TcpPortResourceData;
169
+ udpPort: UdpPortResourceData;
170
+ usb: UsbResourceData;
171
+ bluetooth: BluetoothResourceData;
172
+ gpio: GpioResourceData;
173
+ }
174
+
175
+ /** Kind of an exclusive resource that can be occupied by only one instance at a time */
176
+ type UsedResourceType = keyof UsedResourceDataMap;
177
+
178
+ /** The type-specific payload for a given resource type (without bookkeeping fields) */
179
+ type UsedResourceData<T extends UsedResourceType = UsedResourceType> = UsedResourceDataMap[T];
180
+
181
+ /**
182
+ * A registered resource as stored on the host: the discriminating `type`, the type-specific payload
183
+ * in `data` and the ownership/bookkeeping fields (`instance`, `ts`, `isBlocked`).
184
+ *
185
+ * The payload is nested on purpose. If it were merged into this object, a payload key could shadow a
186
+ * bookkeeping field - an entry could then claim a foreign `instance` or a `type` that does not match
187
+ * the bucket it is stored in, and would be unreachable for all by-instance operations. Nesting makes
188
+ * that impossible for every current and future payload type.
189
+ */
190
+ type RegisteredResource<T extends UsedResourceType = UsedResourceType> = {
191
+ [K in T]: {
192
+ /** Kind of the occupied resource, e.g. "serialPort" */
193
+ type: K;
194
+ /** The type-specific payload describing the resource, e.g. `{ port: '/dev/ttyUSB0' }` */
195
+ data: UsedResourceDataMap[K];
196
+ /** Instance that occupies the resource, e.g. "mqtt.0" */
197
+ instance: string;
198
+ /** Timestamp (ms) when the resource was registered */
199
+ ts: number;
200
+ /**
201
+ * If true, the instance is running and uses this resource. If false, the instance is not
202
+ * running and would maybe occupy this resource when started - "maybe", because its
203
+ * configuration can still change before the next start.
204
+ */
205
+ isBlocked: boolean;
206
+ };
207
+ }[T];
208
+ // #endregion
83
209
 
84
210
  type StateValue = string | number | boolean | null;
85
211
 
@@ -120,7 +246,13 @@ declare global {
120
246
  state?: string;
121
247
  }
122
248
 
123
- type Session = any; // TODO: implement
249
+ type Session = {
250
+ cookie?: {
251
+ originalMaxAge?: number;
252
+ maxAge?: number;
253
+ };
254
+ [key: string]: any;
255
+ };
124
256
 
125
257
  /** Defines access rights for a single object type */
126
258
  interface ObjectOperationPermissions {
@@ -150,9 +282,9 @@ declare global {
150
282
  /** Defined the complete set of access rights a user has */
151
283
  interface PermissionSet extends ObjectPermissions {
152
284
  /** The name of the user this ACL is for */
153
- user: string;
285
+ user: ioBroker.ObjectIDs.User;
154
286
  /** The name of the groups this ACL was merged from */
155
- groups: string[];
287
+ groups: ioBroker.ObjectIDs.Group[];
156
288
  /** The access rights for certain commands */
157
289
  other: {
158
290
  execute: boolean;
@@ -230,7 +362,7 @@ declare global {
230
362
  }
231
363
 
232
364
  /** Parameters for adapter.getObjectList */
233
- type GetObjectListParams = GetObjectViewParams;
365
+ type GetObjectListParams = GetObjectViewParams | undefined;
234
366
 
235
367
  type LogLevel = 'silly' | 'debug' | 'info' | 'warn' | 'error';
236
368
  interface Logger {
@@ -371,14 +503,13 @@ declare global {
371
503
  /** when using aggregate method `integral` defines the interpolation method (defaults to `none`). */
372
504
  integralInterpolation?: 'none' | 'linear';
373
505
  /** If user is set, it will be checked if this user may read the variable */
374
- user?: `system.user.${string}`;
506
+ user?: ioBroker.ObjectIDs.User;
375
507
  }
376
508
 
377
509
  interface DelObjectOptions {
378
510
  /** Whether all child objects should be deleted as well */
379
511
  recursive?: boolean;
380
- // Allow non-documented properties
381
- [other: string]: unknown;
512
+ user?: ioBroker.ObjectIDs.User;
382
513
  }
383
514
 
384
515
  interface ExtendObjectOptionsPreserve {
@@ -388,8 +519,9 @@ declare global {
388
519
  interface ExtendObjectOptions {
389
520
  /** Which properties of the original object should be preserved */
390
521
  preserve?: ExtendObjectOptionsPreserve;
391
- // Allow non-documented properties
392
- [other: string]: unknown;
522
+ user?: ioBroker.ObjectIDs.User;
523
+ owner?: ioBroker.ObjectIDs.User;
524
+ ownerGroup?: ioBroker.ObjectIDs.Group;
393
525
  }
394
526
 
395
527
  /** Predefined notification scopes and their categories */
@@ -442,7 +574,7 @@ declare global {
442
574
  type GenericCallback<T> = (err?: Error | null, result?: T) => void;
443
575
 
444
576
  /** Due to backward compatibility first param can be result or error */
445
- type MessageCallback = (response?: Message | Error) => void;
577
+ type MessageCallback = (response?: MessagePayload) => void;
446
578
 
447
579
  type SetObjectCallback = (err?: Error | null, obj?: { id: string }) => void;
448
580
  type SetObjectPromise = Promise<NonNullCallbackReturnTypeOf<SetObjectCallback>>;
@@ -462,7 +594,7 @@ declare global {
462
594
  ) => void;
463
595
  type GetEnumsPromise = Promise<NonNullCallbackReturnTypeOf<GetEnumsCallback>>;
464
596
 
465
- type GetObjectsCallback = (err?: Error | null, objects?: Record<string, ioBroker.Object>) => void;
597
+ type GetObjectsCallback = (err?: Error | null, objects?: Record<string, ioBroker.AnyObject | null>) => void;
466
598
  type GetObjectsPromise = Promise<NonNullCallbackReturnTypeOf<GetObjectsCallback>>;
467
599
 
468
600
  type GetObjectsCallbackTyped<T extends ObjectType> = (
@@ -516,7 +648,7 @@ declare global {
516
648
 
517
649
  type GetHistoryResult = Array<State & { id?: string }>;
518
650
  type GetHistoryCallback = (
519
- err: Error | null,
651
+ err: Error | null | undefined,
520
652
  result?: GetHistoryResult,
521
653
  step?: number,
522
654
  sessionId?: number,
@@ -527,7 +659,9 @@ declare global {
527
659
  /** Name of the file or directory */
528
660
  file: string;
529
661
  /** File system stats */
530
- stats: Partial<fs.Stats>;
662
+ stats?: {
663
+ size?: number;
664
+ };
531
665
  /** Whether this is a directory or a file */
532
666
  isDir: boolean;
533
667
  /** Access rights */
@@ -540,8 +674,12 @@ declare global {
540
674
  type ReadDirCallback = (err?: NodeJS.ErrnoException | null, entries?: ReadDirResult[]) => void;
541
675
  type ReadDirPromise = Promise<ReadDirResult[]>;
542
676
 
543
- type ReadFileCallback = (err?: NodeJS.ErrnoException | null, data?: Buffer | string, mimeType?: string) => void;
544
- type ReadFilePromise = Promise<{ file: string | Buffer; mimeType?: string }>;
677
+ type ReadFileCallback = (
678
+ err?: NodeJS.ErrnoException | null,
679
+ data?: Buffer | string | null,
680
+ mimeType?: string,
681
+ ) => void;
682
+ type ReadFilePromise = Promise<{ file: string | Buffer | null; mimeType?: string }>;
545
683
 
546
684
  /** Contains the return values of chownFile */
547
685
  interface ChownFileResult {
@@ -550,15 +688,17 @@ declare global {
550
688
  /** Name of the file or directory */
551
689
  file: string;
552
690
  /** File system stats */
553
- stats: fs.Stats;
691
+ stats?: {
692
+ size?: number;
693
+ };
554
694
  /** Whether this is a directory or a file */
555
695
  isDir: boolean;
556
696
  /** Access rights */
557
- acl: FileACL;
697
+ acl: EvaluatedFileACL;
558
698
  /** Date of last modification */
559
- modifiedAt: number;
699
+ modifiedAt?: number;
560
700
  /** Date of creation */
561
- createdAt: number;
701
+ createdAt?: number;
562
702
  }
563
703
  type ChownFileCallback = (err?: NodeJS.ErrnoException | null, processed?: ChownFileResult[]) => void;
564
704
 
@@ -590,7 +730,7 @@ declare global {
590
730
  interface GetObjectListItem<T extends ioBroker.Object> extends GetObjectViewItem<T> {
591
731
  /** A copy of the object */
592
732
  value: T;
593
- /** The same as @link{value} */
733
+ /** The same as {@link value} */
594
734
  doc: T;
595
735
  }
596
736
  type GetObjectListCallback<T extends ioBroker.Object> = (
@@ -605,7 +745,7 @@ declare global {
605
745
  id?: string,
606
746
  ) => void;
607
747
 
608
- type GetSessionCallback = (session: Session) => void;
748
+ type GetSessionCallback = (session: Session | null) => void;
609
749
 
610
750
  type Timeout = Branded<number, 'Timeout'> | null; // or null to not allow native clearTimeout
611
751
  type Interval = Branded<number, 'Interval'> | null; // or null to not allow native clearInterval