@iobroker/dm-utils 0.2.1 → 0.3.0

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/README.md CHANGED
@@ -6,7 +6,8 @@ Utility classes for ioBroker adapters to support [ioBroker.device-manager](https
6
6
 
7
7
  Add in your `io-package.json` the property `deviceManager: true` to `common.supportedMessages`.
8
8
  Note: If you don't have a `common.supportedMessages` property yet, you have to add it.
9
- Also, if you don't have a `common.messagebox: true` property yet, you have to add it.
9
+ Also, if you don't have a `common.supportedMessages.messagebox: true` property yet, you have to add it. If common.messagebox exists, you can remove it. (see
10
+ https://github.com/ioBroker/ioBroker.js-controller/blob/274f9e8f84dbdaaba9830a6cc00ddf083e989090/schemas/io-package.json#L754C104-L754C178)
10
11
 
11
12
  In your ioBroker adapter, add a subclass of `DeviceManagement` and override the methods you need (see next chapters):
12
13
 
@@ -294,7 +295,11 @@ This method returns a promise that resolves to a `ProgressDialog` object.
294
295
  ### **WORK IN PROGRESS**
295
296
  -->
296
297
  ## Changelog
297
- ### 0.2.1 (2024-06-26)
298
+ ### 0.3.0 (2024-07-17)
299
+ * (bluefox) packages updated
300
+ * (bluefox) Updated JSON config types
301
+
302
+ ### 0.2.2 (2024-06-26)
298
303
  * (bluefox) packages updated
299
304
 
300
305
  ### 0.2.0 (2024-05-29)
@@ -8,15 +8,15 @@ export interface ActionBase<T extends ActionType> {
8
8
  /**
9
9
  * This can either be base64 or the URL to an icon.
10
10
  */
11
- icon?: string;
11
+ icon?: "edit" | "rename" | "delete" | "refresh" | "newDevice" | "new" | "add" | "discover" | "search" | "unpairDevice" | "pairDevice" | "identify" | "play" | "stop" | "pause" | "forward" | "next" | "rewind" | "previous" | "lamp" | "light" | "backlight" | "dimmer" | "socket" | "settings" | "users" | "group" | "user" | string;
12
12
  description?: ioBroker.StringOrTranslated;
13
13
  disabled?: T extends "api" ? boolean : never;
14
14
  color?: Color;
15
15
  backgroundColor?: Color;
16
16
  /** If true, the user will be asked for confirmation before executing the action */
17
- confirmation: boolean | ioBroker.StringOrTranslated;
17
+ confirmation?: boolean | ioBroker.StringOrTranslated;
18
18
  /** If defined, before the action is triggered, the non-empty text or number or checkbox will be asked */
19
- inputBefore: {
19
+ inputBefore?: {
20
20
  /** This label will be shown for the text input */
21
21
  label: ioBroker.StringOrTranslated;
22
22
  /** This type of input will be shown. Default is type */
@@ -20,7 +20,18 @@ export type ErrorResponse = {
20
20
  };
21
21
  };
22
22
  export type RetVal<T> = T | Promise<T>;
23
- export type ConfigItemType = 'tabs' | 'panel' | 'text' | 'number' | 'color' | 'checkbox' | 'slider' | 'ip' | 'user' | 'room' | 'func' | 'select' | 'autocomplete' | 'image' | 'objectId' | 'password' | 'instance' | 'chips' | 'alive' | 'pattern' | 'sendto' | 'setState' | 'staticText' | 'staticLink' | 'staticImage' | 'table' | 'accordion' | 'jsonEditor' | 'language' | 'certificate' | 'certificates' | 'certCollection' | 'custom' | 'datePicker' | 'timePicker' | 'divider' | 'header' | 'cron' | 'fileSelector' | 'file' | 'imageSendTo' | 'selectSendTo' | 'autocompleteSendTo' | 'textSendTo' | 'coordinates' | 'interface' | 'license' | 'checkLicense' | 'uuid' | 'port' | 'deviceManager';
23
+ type CustomCSSProperties = Record<string, any>;
24
+ interface ObjectBrowserCustomFilter {
25
+ type?: ioBroker.ObjectType | ioBroker.ObjectType[];
26
+ common?: {
27
+ type?: ioBroker.CommonType | ioBroker.CommonType[];
28
+ role?: string | string[];
29
+ custom?: '_' | '_dataSources' | true | string | string[];
30
+ };
31
+ }
32
+ export type ObjectBrowserType = 'state' | 'instance' | 'channel' | 'device' | 'chart';
33
+ export type ConfigItemType = 'tabs' | 'panel' | 'text' | 'number' | 'color' | 'checkbox' | 'slider' | 'ip' | 'user' | 'room' | 'func' | 'select' | 'autocomplete' | 'image' | 'objectId' | 'password' | 'instance' | 'chips' | 'alive' | 'pattern' | 'sendto' | 'setState' | 'staticText' | 'staticLink' | 'staticImage' | 'table' | 'accordion' | 'jsonEditor' | 'language' | 'certificate' | 'certificates' | 'certCollection' | 'custom' | 'datePicker' | 'timePicker' | 'divider' | 'header' | 'cron' | 'fileSelector' | 'file' | 'imageSendTo' | 'selectSendTo' | 'autocompleteSendTo' | 'textSendTo' | 'coordinates' | 'interface' | 'license' | 'checkLicense' | 'uuid' | 'port' | 'deviceManager' | 'topic';
34
+ type ConfigIconType = 'auth' | 'send' | 'web' | 'warning' | 'error' | 'info' | 'search' | 'book' | 'help' | 'upload' | 'user' | 'group' | string;
24
35
  export interface ConfigItemConfirmData {
25
36
  condition: string;
26
37
  text?: ioBroker.StringOrTranslated;
@@ -30,7 +41,6 @@ export interface ConfigItemConfirmData {
30
41
  type?: 'info' | 'warning' | 'error' | 'none';
31
42
  alsoDependsOn?: string[];
32
43
  }
33
- type CustomCSSProperties = Record<string, any>;
34
44
  export interface ConfigItem {
35
45
  type: ConfigItemType;
36
46
  sm?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
@@ -70,7 +80,7 @@ export interface ConfigItem {
70
80
  doNotSave?: boolean;
71
81
  noMultiEdit?: boolean;
72
82
  confirm?: ConfigItemConfirmData;
73
- icon?: 'auth' | 'send' | 'web' | 'warning' | 'error' | 'info' | 'search' | 'book' | 'help' | 'upload' | string;
83
+ icon?: ConfigIconType;
74
84
  width?: string | number;
75
85
  confirmDependsOn?: ConfigItemIndexed[];
76
86
  onChangeDependsOn?: ConfigItemIndexed[];
@@ -81,15 +91,520 @@ export interface ConfigItem {
81
91
  interface ConfigItemIndexed extends ConfigItem {
82
92
  attr?: string;
83
93
  }
94
+ interface ConfigItemTableIndexed extends ConfigItem {
95
+ attr?: string;
96
+ /** show filter options in the header of table */
97
+ filter?: boolean;
98
+ /** show sorting options in the header of table */
99
+ sort?: boolean;
100
+ /** tooltip in the header of table */
101
+ title?: string;
102
+ }
103
+ export interface ConfigItemAlive extends ConfigItem {
104
+ type: 'alive';
105
+ instance?: string;
106
+ textAlive?: string;
107
+ textNotAlive?: string;
108
+ }
109
+ export interface ConfigItemSelectOption {
110
+ label: ioBroker.StringOrTranslated;
111
+ value: number | string;
112
+ hidden?: string | boolean;
113
+ }
84
114
  export interface ConfigItemPanel extends ConfigItem {
85
115
  type: 'panel' | never;
86
116
  label?: ioBroker.StringOrTranslated;
87
- items: Record<string, ConfigItem>;
117
+ items: Record<string, ConfigItemAny>;
88
118
  collapsable?: boolean;
89
119
  color?: 'primary' | 'secondary';
90
120
  innerStyle?: CustomCSSProperties;
91
121
  i18n?: boolean | string | Record<string, Record<ioBroker.Languages, string>>;
92
122
  }
123
+ export interface ConfigItemPattern extends ConfigItem {
124
+ type: 'pattern';
125
+ copyToClipboard?: boolean;
126
+ pattern: string;
127
+ }
128
+ export interface ConfigItemChip extends ConfigItem {
129
+ type: 'chips';
130
+ delimiter?: string;
131
+ pattern: string;
132
+ }
133
+ export interface ConfigItemTabs extends ConfigItem {
134
+ type: 'tabs';
135
+ items: Record<string, ConfigItemPanel>;
136
+ iconPosition?: 'bottom' | 'end' | 'start' | 'top';
137
+ tabsStyle?: CustomCSSProperties;
138
+ i18n?: boolean | string | Record<string, Record<ioBroker.Languages, string>>;
139
+ }
140
+ export interface ConfigItemText extends ConfigItem {
141
+ type: 'text';
142
+ maxLength?: number;
143
+ /** @deprecated use maxLength */
144
+ max?: number;
145
+ readOnly?: boolean;
146
+ trim?: boolean;
147
+ minRows?: number;
148
+ maxRows?: number;
149
+ noClearButton?: boolean;
150
+ }
151
+ export interface ConfigItemColor extends ConfigItem {
152
+ type: 'color';
153
+ noClearButton?: boolean;
154
+ }
155
+ export interface ConfigItemCheckbox extends ConfigItem {
156
+ type: 'checkbox';
157
+ }
158
+ export interface ConfigItemNumber extends ConfigItem {
159
+ type: 'number';
160
+ min?: number;
161
+ max?: number;
162
+ step?: number;
163
+ readOnly?: boolean;
164
+ }
165
+ export interface ConfigItemPassword extends ConfigItem {
166
+ type: 'password';
167
+ /** repeat password must be compared with password */
168
+ repeat?: boolean;
169
+ /** true if allow viewing the password by toggling the view button (only for a new password while entering) */
170
+ visible?: boolean;
171
+ /** max length of the text in field */
172
+ maxLength?: number;
173
+ /** @deprecated use maxLength */
174
+ max?: number;
175
+ }
176
+ export interface ConfigItemObjectId extends ConfigItem {
177
+ type: 'objectId';
178
+ /** Desired type: `channel`, `device`, ... (has only `state` by default). It is plural, because `type` is already occupied. */
179
+ types?: ObjectBrowserType | ObjectBrowserType[];
180
+ /** Show only this root object and its children */
181
+ root?: string;
182
+ /** Cannot be used together with `type` settings. It is an object and not a JSON string. Examples
183
+ * - `{common: {custom: true}}` - show only objects with some custom settings
184
+ * - `{common: {custom: 'sql.0'}}` - show only objects with sql.0 custom settings (only of the specific instance)
185
+ * - `{common: {custom: '_dataSources'}}` - show only objects of adapters `influxdb` or `sql` or `history`
186
+ * - `{common: {custom: 'adapterName.'}}` - show only objects of custom settings of specific adapter (all instances)
187
+ * - `{type: 'channel'}` - show only channels
188
+ * - `{type: ['channel', 'device']}` - show only channels and devices
189
+ * - `{common: {type: 'number'}` - show only states of type 'number
190
+ * - `{common: {type: ['number', 'string']}` - show only states of type 'number and string
191
+ * - `{common: {role: 'switch'}` - show only states with roles starting from switch
192
+ * - `{common: {role: ['switch', 'button']}` - show only states with roles starting from `switch` and `button`
193
+ */
194
+ customFilter?: ObjectBrowserCustomFilter;
195
+ /** some predefined search filters */
196
+ filters?: {
197
+ id?: string;
198
+ name?: string;
199
+ room?: string;
200
+ func?: string;
201
+ role?: string;
202
+ type?: string;
203
+ custom?: string;
204
+ };
205
+ /** Cannot be used together with `type` settings. It is a function that will be called for every object and must return true or false. Example: `obj.common.type === 'number'` */
206
+ filterFunc?: (obj: ioBroker.Object) => boolean;
207
+ }
208
+ export interface ConfigItemSlider extends ConfigItem {
209
+ type: 'slider';
210
+ min?: number;
211
+ max?: number;
212
+ step?: number;
213
+ /** Unit of slider */
214
+ unit?: string;
215
+ }
216
+ export interface ConfigItemTopic extends ConfigItem {
217
+ type: 'topic';
218
+ maxLength?: number;
219
+ /** @deprecated use maxLength */
220
+ max?: number;
221
+ }
222
+ export interface ConfigItemIP extends ConfigItem {
223
+ type: 'ip';
224
+ listenOnAllPorts?: boolean;
225
+ onlyIp4?: boolean;
226
+ onlyIp6?: boolean;
227
+ noInternal?: boolean;
228
+ }
229
+ export interface ConfigItemUser extends ConfigItem {
230
+ type: 'user';
231
+ /** without "system.user." */
232
+ short?: boolean;
233
+ }
234
+ export interface ConfigItemStaticDivider extends ConfigItem {
235
+ type: 'divider';
236
+ color?: 'primary' | 'secondary' | string;
237
+ height?: string | number;
238
+ }
239
+ export interface ConfigItemStaticHeader extends ConfigItem {
240
+ type: 'header';
241
+ size?: 1 | 2 | 3 | 4 | 5;
242
+ text: ioBroker.StringOrTranslated;
243
+ noTranslation?: boolean;
244
+ }
245
+ export interface ConfigItemStaticImage extends ConfigItem {
246
+ type: 'staticImage';
247
+ /** name of picture (from admin directory) */
248
+ src: string;
249
+ /** optional HTTP link */
250
+ href?: string;
251
+ }
252
+ export interface ConfigItemStaticText extends Omit<ConfigItem, 'button'> {
253
+ type: 'staticText';
254
+ /** multi-language text */
255
+ text: string;
256
+ /** @deprecated use text */
257
+ label?: ioBroker.StringOrTranslated;
258
+ /** link. Link could be dynamic like `#tab-objects/customs/${data.parentId} */
259
+ href?: string;
260
+ /** show a link as button */
261
+ button?: boolean;
262
+ /** type of button (`outlined`, `contained`, `text`) */
263
+ variant?: 'contained' | 'outlined' | 'text';
264
+ /** color of button (e.g. `primary`) */
265
+ color?: 'primary' | 'secondary' | 'grey';
266
+ /** if icon should be shown: `auth`, `send`, `web`, `warning`, `error`, `info`, `search`, `book`, `help`, `upload`. You can use `base64` icons (it starts with `data:image/svg+xml;base64,...`) or `jpg/png` images (ends with `.png`) . (Request via issue if you need more icons) */
267
+ icon?: ConfigIconType;
268
+ }
269
+ export interface ConfigItemRoom extends ConfigItem {
270
+ type: 'room';
271
+ short?: boolean;
272
+ allowDeactivate?: boolean;
273
+ }
274
+ export interface ConfigItemFunc extends ConfigItem {
275
+ type: 'func';
276
+ short?: boolean;
277
+ allowDeactivate?: boolean;
278
+ }
279
+ export interface ConfigItemSelect extends ConfigItem {
280
+ type: 'select';
281
+ /** `[{label: {en: "option 1"}, value: 1}, ...]` or
282
+ `[{"items": [{"label": "Val1", "value": 1}, {"label": "Val2", value: "2}], "name": "group1"}, {"items": [{"label": "Val3", "value": 3}, {"label": "Val4", value: "4}], "name": "group2"}, {"label": "Val5", "value": 5}]`
283
+ */
284
+ options: (ConfigItemSelectOption | {
285
+ items: ConfigItemSelectOption[];
286
+ label: ioBroker.StringOrTranslated;
287
+ value?: number | string;
288
+ hidden?: string | boolean;
289
+ })[];
290
+ attr?: string;
291
+ }
292
+ export interface ConfigItemAutocomplete extends ConfigItem {
293
+ type: 'autocomplete';
294
+ options: (string | ConfigItemSelectOption)[];
295
+ freeSolo?: boolean;
296
+ }
297
+ export interface ConfigItemSetState extends ConfigItem {
298
+ type: 'setState';
299
+ /** `system.adapter.myAdapter.%INSTANCE%.test`, you can use the placeholder `%INSTANCE%` to replace it with the current instance name */
300
+ id: string;
301
+ /** false (default false) */
302
+ ack?: boolean;
303
+ /** '${data.myText}_test' or number. Type will be detected automatically from the state type and converting done too */
304
+ val: ioBroker.StateValue;
305
+ /** Alert which will be shown by pressing the button */
306
+ okText?: ioBroker.StringOrTranslated;
307
+ variant?: 'contained' | 'outlined';
308
+ color?: 'primary' | 'secondary' | 'grey';
309
+ /** Error translations */
310
+ error?: {
311
+ [error: string]: ioBroker.StringOrTranslated;
312
+ };
313
+ }
314
+ export interface ConfigItemAutocompleteSendTo extends Omit<ConfigItem, 'data'> {
315
+ type: 'autocompleteSendTo';
316
+ command?: string;
317
+ jsonData?: string;
318
+ options?: (string | ConfigItemSelectOption)[];
319
+ data?: Record<string, any>;
320
+ freeSolo?: boolean;
321
+ maxLength?: number;
322
+ /** @deprecated use maxLength */
323
+ max?: string;
324
+ alsoDependsOn?: string[];
325
+ }
326
+ export interface ConfigItemAccordion extends ConfigItem {
327
+ type: 'accordion';
328
+ titleAttr?: string;
329
+ noDelete?: boolean;
330
+ clone?: boolean | string;
331
+ items: ConfigItemIndexed[];
332
+ }
333
+ export interface ConfigItemDivider extends ConfigItem {
334
+ type: 'divider';
335
+ color?: 'primary' | 'secondary' | string;
336
+ height?: string | number;
337
+ }
338
+ export interface ConfigItemHeader extends ConfigItem {
339
+ type: 'header';
340
+ text?: ioBroker.StringOrTranslated;
341
+ size?: 1 | 2 | 3 | 4 | 5 | 6;
342
+ }
343
+ export interface ConfigItemCoordinates extends ConfigItem {
344
+ type: 'coordinates';
345
+ divider?: string;
346
+ autoInit?: boolean;
347
+ longitudeName?: string;
348
+ latitudeName?: string;
349
+ useSystemName?: string;
350
+ maxLength?: number;
351
+ max?: number;
352
+ }
353
+ export interface ConfigItemCustom extends ConfigItem {
354
+ type: 'custom';
355
+ /** location of Widget, like "custom/customComponents.js" */
356
+ url: string;
357
+ /** Component name, like "ConfigCustomBackItUpSet/Components/AdapterExist" */
358
+ name: string;
359
+ /** i18n */
360
+ i18n: boolean | Record<string, string>;
361
+ /** custom properties */
362
+ [prop: string]: any;
363
+ }
364
+ export interface ConfigItemDatePicker extends ConfigItem {
365
+ type: 'datePicker';
366
+ maxLength?: number;
367
+ /** @deprecated use maxLength */
368
+ max?: number;
369
+ }
370
+ export interface ConfigItemDeviceManager extends ConfigItem {
371
+ type: 'deviceManager';
372
+ }
373
+ export interface ConfigItemLanguage extends ConfigItem {
374
+ type: 'language';
375
+ system?: boolean;
376
+ changeGuiLanguage?: boolean;
377
+ }
378
+ export interface ConfigItemPort extends ConfigItem {
379
+ type: 'port';
380
+ min?: number;
381
+ max?: number;
382
+ readOnly?: boolean;
383
+ }
384
+ export interface ConfigItemImageSendTo extends Omit<ConfigItem, 'data'> {
385
+ type: 'imageSendTo';
386
+ command?: string;
387
+ alsoDependsOn?: string[];
388
+ height?: number | string;
389
+ data?: Record<string, any>;
390
+ }
391
+ export interface ConfigItemSendTo extends Omit<ConfigItem, 'data'> {
392
+ type: 'sendto';
393
+ command?: string;
394
+ jsonData?: string;
395
+ data?: Record<string, any>;
396
+ result?: string;
397
+ error?: string;
398
+ variant?: 'contained' | 'outlined';
399
+ openUrl?: boolean;
400
+ reloadBrowser?: boolean;
401
+ window?: string;
402
+ icon?: ConfigIconType;
403
+ useNative?: boolean;
404
+ showProcess?: boolean;
405
+ timeout?: number;
406
+ onLoaded?: boolean;
407
+ color?: 'primary' | 'secondary';
408
+ /** button tooltip */
409
+ title?: ioBroker.StringOrTranslated;
410
+ alsoDependsOn?: string[];
411
+ container?: 'text' | 'div';
412
+ copyToClipboard?: boolean;
413
+ }
414
+ export interface ConfigItemTextSendTo extends Omit<ConfigItem, 'data'> {
415
+ type: 'textSendTo';
416
+ container?: 'text' | 'div';
417
+ copyToClipboard?: boolean;
418
+ alsoDependsOn?: string[];
419
+ command?: string;
420
+ jsonData?: string;
421
+ data?: Record<string, any>;
422
+ }
423
+ export interface ConfigItemSelectSendTo extends Omit<ConfigItem, 'data'> {
424
+ type: 'selectSendTo';
425
+ manual?: boolean;
426
+ multiple?: boolean;
427
+ showAllValues?: boolean;
428
+ noClearButton?: boolean;
429
+ command?: string;
430
+ jsonData?: string;
431
+ data?: Record<string, any>;
432
+ alsoDependsOn?: string[];
433
+ }
434
+ export interface ConfigItemTable extends ConfigItem {
435
+ type: 'table';
436
+ items?: ConfigItemTableIndexed[];
437
+ noDelete?: boolean;
438
+ /** @deprecated don't use */
439
+ objKeyName?: string;
440
+ /** @deprecated don't use */
441
+ objValueName?: string;
442
+ allowAddByFilter?: boolean;
443
+ showSecondAddAt?: number;
444
+ showFirstAddOnTop?: boolean;
445
+ clone?: boolean | string;
446
+ export?: boolean;
447
+ import?: boolean;
448
+ uniqueColumns?: string[];
449
+ encryptedAttributes?: string[];
450
+ }
451
+ export interface ConfigItemTimePicker extends ConfigItem {
452
+ type: 'timePicker';
453
+ /** format passed to the date picker defaults to `HH:mm:ss` */
454
+ format?: string;
455
+ views?: ('hours' | 'minutes' | 'seconds')[];
456
+ /** Represent the available time steps for each view. Defaults to `{ hours: 1, minutes: 5, seconds: 5 }` */
457
+ timeSteps?: {
458
+ hours?: number;
459
+ minutes?: number;
460
+ seconds?: number;
461
+ };
462
+ /** @deprecated use timeSteps */
463
+ timesteps?: {
464
+ hours?: number;
465
+ minutes?: number;
466
+ seconds?: number;
467
+ };
468
+ /** `fullDate` or `HH:mm:ss`. Defaults to full date for backward compatibility reasons */
469
+ returnFormat?: string;
470
+ }
471
+ export interface ConfigItemCertCollection extends ConfigItem {
472
+ type: 'certCollection';
473
+ leCollectionName?: string;
474
+ }
475
+ export interface ConfigItemCRON extends ConfigItem {
476
+ type: 'cron';
477
+ /** show CRON with "minutes", "seconds" and so on */
478
+ complex?: boolean;
479
+ /** show simple CRON settings */
480
+ simple?: boolean;
481
+ }
482
+ export interface ConfigItemCertificateSelect extends ConfigItem {
483
+ type: 'certificate';
484
+ }
485
+ export interface ConfigItemLicense extends ConfigItem {
486
+ type: 'license';
487
+ /** array of paragraphs with texts, which will be shown each as a separate paragraph */
488
+ texts?: string[];
489
+ /** URL to the license file (e.g. https://raw.githubusercontent.com/ioBroker/ioBroker.docs/master/LICENSE) */
490
+ licenseUrl?: string;
491
+ /** Title of the license dialog */
492
+ title?: string;
493
+ /** Text of the agreed button */
494
+ agreeText?: string;
495
+ /** If defined, the checkbox with the given name will be shown. If checked, the agreed button will be enabled. */
496
+ checkBox?: string;
497
+ }
498
+ export interface ConfigItemCertificates extends ConfigItem {
499
+ type: 'certificates';
500
+ leCollectionName?: string;
501
+ certPublicName?: string;
502
+ certPrivateName?: string;
503
+ certChainedName?: string;
504
+ }
505
+ export interface ConfigItemCheckLicense extends ConfigItem {
506
+ type: 'checkLicense';
507
+ /** Check UUID */
508
+ uuid?: boolean;
509
+ /** Check version */
510
+ version?: boolean;
511
+ variant?: 'text' | 'outlined' | 'contained';
512
+ color?: 'primary' | 'secondary';
513
+ }
514
+ export interface ConfigItemUUID extends ConfigItem {
515
+ type: 'uuid';
516
+ }
517
+ export interface ConfigItemJsonEditor extends ConfigItem {
518
+ type: 'jsonEditor';
519
+ }
520
+ export interface ConfigItemInterface extends ConfigItem {
521
+ type: 'interface';
522
+ /** do not show loopback interface (127.0.0.1) */
523
+ ignoreLoopback?: boolean;
524
+ /** do not show internal interfaces (normally it is 127.0.0.1 too) */
525
+ ignoreInternal?: boolean;
526
+ }
527
+ export interface ConfigItemImageUpload extends ConfigItem {
528
+ type: 'image';
529
+ /** name of file is structure name. In the below example `login-bg.png` is file name for `writeFile("myAdapter.INSTANCE", "login-bg.png")` */
530
+ filename?: string;
531
+ /** html accept attribute, like `{ 'image/**': [], 'application/pdf': ['.pdf'] }`, default `{ 'image/*': [] }` */
532
+ accept?: Record<string, string[]>;
533
+ /** maximal size of file to upload */
534
+ maxSize?: number;
535
+ /** if true, the image will be saved as data-url in attribute, elsewise as binary in file storage */
536
+ base64?: boolean;
537
+ /** if true, allow user to crop the image */
538
+ crop?: boolean;
539
+ }
540
+ export interface ConfigItemInstanceSelect extends ConfigItem {
541
+ type: 'instance';
542
+ /** name of adapter. With special name `_dataSources` you can get all adapters with flag `common.getHistory`. */
543
+ adapter?: string;
544
+ /** optional list of adapters, that should be shown. If not defined, all adapters will be shown. Only active if `adapter` attribute is not defined. */
545
+ adapters?: string[];
546
+ /** if true. Additional option "deactivate" is shown */
547
+ allowDeactivate?: boolean;
548
+ /** if true. Only enabled instances will be shown */
549
+ onlyEnabled?: boolean;
550
+ /** value will look like `system.adapter.ADAPTER.0` and not `ADAPTER.0` */
551
+ long?: boolean;
552
+ /** value will look like `0` and not `ADAPTER.0` */
553
+ short?: boolean;
554
+ /** Add to the options "all" option with value `*` */
555
+ all?: boolean;
556
+ }
557
+ export interface ConfigItemFile extends ConfigItem {
558
+ type: 'file';
559
+ /** if a user can manually enter the file name and not only through select dialog */
560
+ disableEdit?: boolean;
561
+ /** limit selection to one specific object of type `meta` and the following path (not mandatory) */
562
+ limitPath?: string;
563
+ /** like `['png', 'svg', 'bmp', 'jpg', 'jpeg', 'gif']` */
564
+ filterFiles?: string[];
565
+ /** allowed upload of files */
566
+ allowUpload?: boolean;
567
+ /** allowed download of files (default true) */
568
+ allowDownload?: boolean;
569
+ /** allowed creation of folders */
570
+ allowCreateFolder?: boolean;
571
+ /** allowed tile view (default true) */
572
+ allowView?: boolean;
573
+ /** show toolbar (default true) */
574
+ showToolbar?: boolean;
575
+ /** user can select only folders (e.g., for uploading path) */
576
+ selectOnlyFolders?: boolean;
577
+ /** trim the filename */
578
+ trim?: boolean;
579
+ /** max length of the file name */
580
+ maxLength?: number;
581
+ /** @deprecated use maxLength */
582
+ max?: number;
583
+ }
584
+ export interface ConfigItemFileSelector extends ConfigItem {
585
+ type: 'fileSelector';
586
+ /** File extension pattern. Allowed `**\/*.ext` to show all files from subfolders too, `*.ext` to show from root folder or `folderName\/*.ext` to show all files in sub-folder `folderName`. Default `**\/*.*`. */
587
+ pattern: string;
588
+ /** type of files: `audio`, `image`, `text` */
589
+ fileTypes?: 'audio' | 'image' | 'text';
590
+ /** Object ID of type `meta`. You can use special placeholder `%INSTANCE%`: like `myAdapter.%INSTANCE%.files` */
591
+ objectID?: string;
592
+ /** path, where the uploaded files will be stored. Like `folderName`. If not defined, no upload field will be shown. To upload in the root, set this field to `/`. */
593
+ upload?: string;
594
+ /** Show refresh button near the select. */
595
+ refresh?: boolean;
596
+ /** max file size (default 2MB) */
597
+ maxSize?: number;
598
+ /** show folder name even if all files in the same folder */
599
+ withFolder?: boolean;
600
+ /** Allow deletion of files */
601
+ delete?: boolean;
602
+ /** Do not show `none` option */
603
+ noNone?: boolean;
604
+ /** Do not show the size of files */
605
+ noSize?: boolean;
606
+ }
607
+ export type ConfigItemAny = ConfigItemAlive | ConfigItemAutocomplete | ConfigItemAutocompleteSendTo | ConfigItemPanel | ConfigItemTabs | ConfigItemText | ConfigItemNumber | ConfigItemColor | ConfigItemCheckbox | ConfigItemSlider | ConfigItemIP | ConfigItemUser | ConfigItemRoom | ConfigItemFunc | ConfigItemSelect | ConfigItemAccordion | ConfigItemCoordinates | ConfigItemDivider | ConfigItemHeader | ConfigItemCustom | ConfigItemDatePicker | ConfigItemDeviceManager | ConfigItemLanguage | ConfigItemPort | ConfigItemSendTo | ConfigItemTable | ConfigItemTimePicker | ConfigItemTextSendTo | ConfigItemSelectSendTo | ConfigItemCertCollection | ConfigItemCertificateSelect | ConfigItemCertificates | ConfigItemUUID | ConfigItemCheckLicense | ConfigItemPattern | ConfigItemChip | ConfigItemCRON | ConfigItemFile | ConfigItemFileSelector | ConfigItemImageSendTo | ConfigItemInstanceSelect | ConfigItemImageUpload | ConfigItemInterface | ConfigItemJsonEditor | ConfigItemLicense | ConfigItemPassword | ConfigItemSetState | ConfigItemStaticDivider | ConfigItemStaticHeader | ConfigItemStaticImage | ConfigItemStaticText | ConfigItemTopic | ConfigItemObjectId;
93
608
  export type JsonFormSchema = ConfigItemPanel;
94
609
  export type JsonFormData = Record<string, any>;
95
610
  export interface DeviceDetails {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-utils",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {
@@ -24,15 +24,15 @@
24
24
  "@iobroker/adapter-core": "^3.1.6"
25
25
  },
26
26
  "devDependencies": {
27
- "@alcalzone/release-script": "^3.7.0",
27
+ "@alcalzone/release-script": "^3.7.3",
28
28
  "@alcalzone/release-script-plugin-license": "^3.7.0",
29
- "@types/node": "^20.14.9",
30
- "@typescript-eslint/eslint-plugin": "^7.14.1",
31
- "@typescript-eslint/parser": "^7.14.1",
29
+ "@types/node": "^20.14.11",
30
+ "@typescript-eslint/eslint-plugin": "^7.16.1",
31
+ "@typescript-eslint/parser": "^7.16.1",
32
32
  "eslint": "^8.57.0",
33
33
  "eslint-config-prettier": "^9.1.0",
34
- "prettier": "^3.3.2",
35
- "typescript": "^5.5.2"
34
+ "prettier": "^3.3.3",
35
+ "typescript": "^5.5.3"
36
36
  },
37
37
  "files": [
38
38
  "LICENSE",