@iobroker/dm-utils 1.0.16 → 3.0.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 +226 -105
- package/build/ActionContext.d.ts +2 -6
- package/build/DeviceManagement.d.ts +27 -28
- package/build/DeviceManagement.js +229 -106
- package/build/ProgressDialog.d.ts +2 -6
- package/build/types/adapter.d.ts +4 -3
- package/build/types/api.d.ts +58 -0
- package/build/types/base.d.ts +74 -30
- package/build/types/common.d.ts +117 -102
- package/build/types/index.d.ts +1 -1
- package/build/types/index.js +1 -1
- package/package.json +10 -6
package/build/types/common.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
export type ApiVersion = '
|
|
1
|
+
export type ApiVersion = 'v3';
|
|
2
2
|
export type ConfigConnectionType = 'lan' | 'wifi' | 'bluetooth' | 'thread' | 'z-wave' | 'zigbee' | 'other';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export interface ComplexDeviceId {
|
|
4
|
+
[key: string | number]: string | number | ComplexDeviceId;
|
|
5
|
+
}
|
|
6
|
+
export type DeviceId = string | number | ComplexDeviceId;
|
|
7
|
+
export type ValueOrObject<T> = T | {
|
|
8
|
+
objectId: string;
|
|
9
|
+
property: string;
|
|
8
10
|
};
|
|
9
|
-
export type
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
export type ValueOrState<T> = T | {
|
|
12
|
+
stateId: string;
|
|
13
|
+
mapping?: Record<string | number, T>;
|
|
14
|
+
};
|
|
15
|
+
export type ValueOrStateOrObject<T> = T | ValueOrObject<T> | ValueOrState<T>;
|
|
16
|
+
export type DeviceStatus = 'connected' | 'disconnected' | {
|
|
17
|
+
battery?: ValueOrState<number | boolean | 'charging' | (string & {})>;
|
|
18
|
+
connection?: ValueOrState<'connected' | 'disconnected'>;
|
|
19
|
+
rssi?: ValueOrState<number>;
|
|
20
|
+
warning?: ValueOrState<ioBroker.StringOrTranslated | boolean>;
|
|
12
21
|
};
|
|
13
22
|
export type ErrorResponse = {
|
|
14
23
|
error: {
|
|
@@ -17,18 +26,26 @@ export type ErrorResponse = {
|
|
|
17
26
|
};
|
|
18
27
|
};
|
|
19
28
|
export type RetVal<T> = T | Promise<T>;
|
|
29
|
+
export interface ProgressOptions {
|
|
30
|
+
indeterminate?: boolean;
|
|
31
|
+
value?: number;
|
|
32
|
+
label?: ioBroker.StringOrTranslated;
|
|
33
|
+
}
|
|
34
|
+
export interface ProgressUpdate extends ProgressOptions {
|
|
35
|
+
title?: ioBroker.StringOrTranslated;
|
|
36
|
+
}
|
|
20
37
|
type CustomCSSProperties = Record<string, any>;
|
|
21
38
|
interface ObjectBrowserCustomFilter {
|
|
22
39
|
type?: ioBroker.ObjectType | ioBroker.ObjectType[];
|
|
23
40
|
common?: {
|
|
24
41
|
type?: ioBroker.CommonType | ioBroker.CommonType[];
|
|
25
42
|
role?: string | string[];
|
|
26
|
-
custom?: '_' | '_dataSources' | true | string | string[];
|
|
43
|
+
custom?: '_' | '_dataSources' | true | (string & {}) | string[];
|
|
27
44
|
};
|
|
28
45
|
}
|
|
29
46
|
export type ObjectBrowserType = 'state' | 'instance' | 'channel' | 'device' | 'chart';
|
|
30
|
-
export type ConfigItemType = 'accordion' | 'alive' | 'autocomplete' | 'autocompleteSendTo' | 'certCollection' | 'certificate' | 'certificates' | 'checkDocker' | 'checkLicense' | 'checkbox' | 'chips' | 'color' | 'coordinates' | 'cron' | 'custom' | 'datePicker' | 'deviceManager' | 'divider' | 'file' | 'fileSelector' | 'func' | 'header' | 'image' | 'imageSendTo' | 'infoBox' | 'instance' | 'interface' | 'ip' | 'jsonEditor' | 'language' | 'license' | 'number' | 'oauth2' | 'objectId' | 'panel' | 'password' | 'pattern' | 'port' | 'qrCode' | 'room' | 'select' | 'selectSendTo' | 'sendto' | 'setState' | 'slider' | 'state' | 'staticImage' | 'staticInfo' | 'staticLink' | 'staticText' | 'table' | 'tabs' | 'text' | 'textSendTo' | 'timePicker' | 'topic' | 'user' | 'uuid';
|
|
31
|
-
export type ConfigIconType = 'add' | 'backlight' | 'book' | 'delete' | 'dimmer' | 'edit' | 'error' | 'group' | 'help' | 'identify' | 'info' | 'light' | 'lines' | 'next' | 'pair' | 'pause' | 'play' | 'previous' | 'qrcode' | 'refresh' | 'search' | 'send' | 'settings' | 'socket' | 'stop' | 'unpair' | '
|
|
47
|
+
export type ConfigItemType = 'accordion' | 'alive' | 'autocomplete' | 'autocompleteSendTo' | 'certCollection' | 'certificate' | 'certificates' | 'checkDocker' | 'checkLicense' | 'checkbox' | 'chips' | 'color' | 'coordinates' | 'cron' | 'custom' | 'datePicker' | 'deviceManager' | 'divider' | 'file' | 'fileSelector' | 'func' | 'header' | 'iframe' | 'iframeSendTo' | 'image' | 'imageSendTo' | 'infoBox' | 'instance' | 'interface' | 'ip' | 'jsonEditor' | 'language' | 'license' | 'number' | 'oauth2' | 'objectId' | 'panel' | 'password' | 'pattern' | 'port' | 'qrCode' | 'room' | 'select' | 'selectSendTo' | 'sendto' | 'setState' | 'slider' | 'state' | 'staticImage' | 'staticInfo' | 'staticLink' | 'staticText' | 'table' | 'tabs' | 'text' | 'textSendTo' | 'timePicker' | 'topic' | 'user' | 'uuid' | 'yamlEditor';
|
|
48
|
+
export type ConfigIconType = 'add' | 'backlight' | 'book' | 'delete' | 'dimmer' | 'edit' | 'error' | 'group' | 'help' | 'identify' | 'info' | 'light' | 'lines' | 'next' | 'pair' | 'pause' | 'play' | 'previous' | 'qrcode' | 'refresh' | 'search' | 'send' | 'settings' | 'socket' | 'stop' | 'unpair' | 'upload' | 'user' | 'warning' | 'web' | string;
|
|
32
49
|
export interface ConfigItemConfirmData {
|
|
33
50
|
condition: string;
|
|
34
51
|
text?: ioBroker.StringOrTranslated;
|
|
@@ -76,7 +93,7 @@ export interface ConfigItem {
|
|
|
76
93
|
default?: boolean | number | string;
|
|
77
94
|
defaultFunc?: string;
|
|
78
95
|
defaultSendTo?: string;
|
|
79
|
-
/** Allow saving of configuration even with error */
|
|
96
|
+
/** Allow saving of configuration even with an error */
|
|
80
97
|
allowSaveWithError?: boolean;
|
|
81
98
|
data?: string | number | boolean;
|
|
82
99
|
jsonData?: string;
|
|
@@ -108,20 +125,20 @@ interface ConfigItemIndexed extends ConfigItem {
|
|
|
108
125
|
}
|
|
109
126
|
interface ConfigItemTableIndexed extends ConfigItem {
|
|
110
127
|
attr?: string;
|
|
111
|
-
/** show filter options in the header of table */
|
|
128
|
+
/** show filter options in the header of the table */
|
|
112
129
|
filter?: boolean;
|
|
113
|
-
/** show sorting options in the header of table */
|
|
130
|
+
/** show sorting options in the header of the table */
|
|
114
131
|
sort?: boolean;
|
|
115
|
-
/** tooltip in the header of table */
|
|
132
|
+
/** tooltip in the header of the table */
|
|
116
133
|
title?: string;
|
|
117
134
|
}
|
|
118
135
|
export interface ConfigItemAlive extends ConfigItem {
|
|
119
136
|
type: 'alive';
|
|
120
|
-
/** check if the instance is alive. If not defined, it will be used current instance. You can use
|
|
137
|
+
/** check if the instance is alive. If not defined, it will be used current instance. You can use the ` $ {data.number} ` pattern in the text. */
|
|
121
138
|
instance?: string;
|
|
122
|
-
/** default text is `Instance %s is alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files. */
|
|
139
|
+
/** the default text is `Instance %s is alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files. */
|
|
123
140
|
textAlive?: string;
|
|
124
|
-
/** default text is `Instance %s is not alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files. */
|
|
141
|
+
/** the default text is `Instance %s is not alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files. */
|
|
125
142
|
textNotAlive?: string;
|
|
126
143
|
}
|
|
127
144
|
export interface ConfigItemSelectOption {
|
|
@@ -175,17 +192,17 @@ export interface ConfigItemTabs extends ConfigItem {
|
|
|
175
192
|
}
|
|
176
193
|
export interface ConfigItemText extends ConfigItem {
|
|
177
194
|
type: 'text';
|
|
178
|
-
/** max length of the text in field */
|
|
195
|
+
/** max length of the text in the field */
|
|
179
196
|
maxLength?: number;
|
|
180
197
|
/** @deprecated use maxLength */
|
|
181
198
|
max?: number;
|
|
182
199
|
/** read-only field */
|
|
183
200
|
readOnly?: boolean;
|
|
184
|
-
/** show copy
|
|
201
|
+
/** show copy-to-clipboard button, but only if disabled or read-only */
|
|
185
202
|
copyToClipboard?: boolean;
|
|
186
203
|
/** default is true. Set this attribute to `false` if trim is not desired. */
|
|
187
204
|
trim?: boolean;
|
|
188
|
-
/** default is 1. Set this attribute to `2` or more if you want to have a textarea with more than one row. */
|
|
205
|
+
/** the default is 1. Set this attribute to `2` or more if you want to have a textarea with more than one row. */
|
|
189
206
|
minRows?: number;
|
|
190
207
|
/** max rows of textarea. Used only if `minRows` > 1. */
|
|
191
208
|
maxRows?: number;
|
|
@@ -245,7 +262,7 @@ export interface ConfigItemPassword extends ConfigItem {
|
|
|
245
262
|
visible?: boolean;
|
|
246
263
|
/** The read-only flag. Visible is automatically true if readOnly is true */
|
|
247
264
|
readOnly?: boolean;
|
|
248
|
-
/** max length of the text in field */
|
|
265
|
+
/** max length of the text in the field */
|
|
249
266
|
maxLength?: number;
|
|
250
267
|
/** @deprecated use maxLength */
|
|
251
268
|
max?: number;
|
|
@@ -293,7 +310,7 @@ export interface ConfigItemSlider extends ConfigItem {
|
|
|
293
310
|
}
|
|
294
311
|
export interface ConfigItemTopic extends ConfigItem {
|
|
295
312
|
type: 'topic';
|
|
296
|
-
/** max length of the text in field */
|
|
313
|
+
/** max length of the text in the field */
|
|
297
314
|
maxLength?: number;
|
|
298
315
|
/** @deprecated use maxLength */
|
|
299
316
|
max?: number;
|
|
@@ -336,11 +353,11 @@ export interface ConfigItemStaticText extends Omit<ConfigItem, 'button'> {
|
|
|
336
353
|
label?: ioBroker.StringOrTranslated;
|
|
337
354
|
/** link. Link could be dynamic like `#tab-objects/customs/${data.parentId} */
|
|
338
355
|
href?: string;
|
|
339
|
-
/** target of the link: _self, _blank or window name. For relative links default is _self and for absolute - _blank */
|
|
356
|
+
/** target of the link: _self, _blank or window name. For relative links the default is _self and for absolute - _blank */
|
|
340
357
|
target?: string;
|
|
341
358
|
/** If the GUI should be closed after a link was opened (only if the target is equal to '_self') */
|
|
342
359
|
close?: boolean;
|
|
343
|
-
/** show a link as button */
|
|
360
|
+
/** show a link as a button */
|
|
344
361
|
button?: boolean;
|
|
345
362
|
/** type of button (`outlined`, `contained`, `text`) */
|
|
346
363
|
variant?: 'contained' | 'outlined' | 'text';
|
|
@@ -361,13 +378,13 @@ export interface ConfigItemStaticInfo extends Omit<ConfigItem, 'data'> {
|
|
|
361
378
|
unit?: ioBroker.StringOrTranslated;
|
|
362
379
|
/** Normally, the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
|
|
363
380
|
narrow?: boolean;
|
|
364
|
-
/** Add to label the colon at the end if not exist in label */
|
|
381
|
+
/** Add to the label the colon at the end if not exist in the label */
|
|
365
382
|
addColon?: boolean;
|
|
366
383
|
/** Value should blink when updated (true or color) */
|
|
367
384
|
blinkOnUpdate?: boolean | string;
|
|
368
385
|
/** Value should blink continuously (true or color) */
|
|
369
386
|
blink?: boolean | string;
|
|
370
|
-
/** Show copy
|
|
387
|
+
/** Show a copy-to-clipboard button for value */
|
|
371
388
|
copyToClipboard?: boolean;
|
|
372
389
|
/** Label style */
|
|
373
390
|
styleLabel?: CustomCSSProperties;
|
|
@@ -379,7 +396,7 @@ export interface ConfigItemStaticInfo extends Omit<ConfigItem, 'data'> {
|
|
|
379
396
|
size?: number | 'small' | 'normal' | 'large';
|
|
380
397
|
/** Highlight line on mouse over */
|
|
381
398
|
highlight?: boolean;
|
|
382
|
-
/** Show boolean values as checkbox */
|
|
399
|
+
/** Show boolean values as a checkbox */
|
|
383
400
|
booleanAsCheckbox?: boolean;
|
|
384
401
|
/** Show string values as HTML */
|
|
385
402
|
html?: boolean;
|
|
@@ -425,7 +442,7 @@ export interface ConfigItemSelect extends ConfigItem {
|
|
|
425
442
|
attr?: string;
|
|
426
443
|
/** If multiple selection is possible. In this case, the value will be an array */
|
|
427
444
|
multiple?: boolean;
|
|
428
|
-
/** show item even if no label was found for it (by multiple), default=`true` */
|
|
445
|
+
/** show an item even if no label was found for it (by multiple), default=`true` */
|
|
429
446
|
showAllValues?: boolean;
|
|
430
447
|
}
|
|
431
448
|
export interface ConfigItemAutocomplete extends ConfigItem {
|
|
@@ -441,7 +458,7 @@ export interface ConfigItemSetState extends ConfigItem {
|
|
|
441
458
|
ack?: boolean;
|
|
442
459
|
/** '${data.myText}_test' or number. Type will be detected automatically from the state type and converting done too */
|
|
443
460
|
val: ioBroker.StateValue;
|
|
444
|
-
/** Alert which will be shown by pressing the button */
|
|
461
|
+
/** Alert, which will be shown by pressing the button */
|
|
445
462
|
okText?: ioBroker.StringOrTranslated;
|
|
446
463
|
variant?: 'contained' | 'outlined';
|
|
447
464
|
color?: 'primary' | 'secondary' | 'grey';
|
|
@@ -457,7 +474,7 @@ export interface ConfigItemAutocompleteSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
457
474
|
options?: (string | ConfigItemSelectOption)[];
|
|
458
475
|
data?: Record<string, any>;
|
|
459
476
|
freeSolo?: boolean;
|
|
460
|
-
/** max length of the text in field */
|
|
477
|
+
/** max length of the text in the field */
|
|
461
478
|
maxLength?: number;
|
|
462
479
|
/** @deprecated use maxLength */
|
|
463
480
|
max?: string;
|
|
@@ -469,7 +486,7 @@ export interface ConfigItemAccordion extends ConfigItem {
|
|
|
469
486
|
titleAttr?: string;
|
|
470
487
|
/** If delete or add disabled, If noDelete is false, add, delete and move up/down should work */
|
|
471
488
|
noDelete?: boolean;
|
|
472
|
-
/** If clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. */
|
|
489
|
+
/** If the clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. */
|
|
473
490
|
clone?: boolean | string;
|
|
474
491
|
/** Items of accordion */
|
|
475
492
|
items: ConfigItemIndexed[];
|
|
@@ -496,7 +513,7 @@ export interface ConfigItemCoordinates extends ConfigItem {
|
|
|
496
513
|
latitudeName?: string;
|
|
497
514
|
/** if defined, the checkbox with "Use system settings" will be shown and latitude, longitude will be read from system.config, a boolean will be saved to the given name */
|
|
498
515
|
useSystemName?: string;
|
|
499
|
-
/** max length of the text in field */
|
|
516
|
+
/** max length of the text in the field */
|
|
500
517
|
maxLength?: number;
|
|
501
518
|
/** @deprecated use maxLength */
|
|
502
519
|
max?: number;
|
|
@@ -518,7 +535,7 @@ export interface ConfigItemCustom extends ConfigItem {
|
|
|
518
535
|
}
|
|
519
536
|
export interface ConfigItemDatePicker extends ConfigItem {
|
|
520
537
|
type: 'datePicker';
|
|
521
|
-
/** max length of the text in field */
|
|
538
|
+
/** max length of the text in the field */
|
|
522
539
|
maxLength?: number;
|
|
523
540
|
/** @deprecated use maxLength */
|
|
524
541
|
max?: number;
|
|
@@ -537,6 +554,25 @@ export interface ConfigItemPort extends ConfigItem {
|
|
|
537
554
|
max?: number;
|
|
538
555
|
readOnly?: boolean;
|
|
539
556
|
}
|
|
557
|
+
export interface ConfigItemIFrame extends ConfigItem {
|
|
558
|
+
type: 'iframe';
|
|
559
|
+
url?: string;
|
|
560
|
+
sandbox?: string;
|
|
561
|
+
allowFullscreen?: boolean;
|
|
562
|
+
frameBorder?: number | string;
|
|
563
|
+
/** if true, the iframe will be loaded only when it becomes visible */
|
|
564
|
+
lazyLoad?: 'lazy' | 'eager';
|
|
565
|
+
/** if true, the iframe will be reloaded every time it becomes visible */
|
|
566
|
+
reloadOnShow?: boolean;
|
|
567
|
+
/** CSS Styles in React format (`marginLeft` and not `margin-left`) for the IFrame component */
|
|
568
|
+
innerStyle?: CustomCSSProperties;
|
|
569
|
+
}
|
|
570
|
+
export interface ConfigItemIFrameSendTo extends Omit<ConfigItemIFrame, 'data' | 'url' | 'type'> {
|
|
571
|
+
type: 'iframeSendTo';
|
|
572
|
+
command?: string;
|
|
573
|
+
alsoDependsOn?: string[];
|
|
574
|
+
data?: Record<string, any>;
|
|
575
|
+
}
|
|
540
576
|
export interface ConfigItemImageSendTo extends Omit<ConfigItem, 'data'> {
|
|
541
577
|
type: 'imageSendTo';
|
|
542
578
|
command?: string;
|
|
@@ -549,8 +585,10 @@ export interface ConfigItemSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
549
585
|
command?: string;
|
|
550
586
|
jsonData?: string;
|
|
551
587
|
data?: Record<string, any>;
|
|
552
|
-
result
|
|
553
|
-
|
|
588
|
+
/** Translations for possible result codes. E.g. `{"RESULT_OK": "Operation successful"}`. The translation must exist in i18n files. */
|
|
589
|
+
result?: Record<string, ioBroker.StringOrTranslated>;
|
|
590
|
+
/** Translations for possible error codes. E.g. `{"ERR_NO_OBJECT": "Object not found"}`. The translation must exist in i18n files. */
|
|
591
|
+
error?: Record<string, ioBroker.StringOrTranslated>;
|
|
554
592
|
variant?: 'contained' | 'outlined';
|
|
555
593
|
openUrl?: boolean;
|
|
556
594
|
reloadBrowser?: boolean;
|
|
@@ -566,12 +604,12 @@ export interface ConfigItemSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
566
604
|
alsoDependsOn?: string[];
|
|
567
605
|
container?: 'text' | 'div' | 'html';
|
|
568
606
|
copyToClipboard?: boolean;
|
|
569
|
-
/** Styles for button itself */
|
|
607
|
+
/** Styles for the button itself */
|
|
570
608
|
controlStyle?: CustomCSSProperties;
|
|
571
609
|
}
|
|
572
610
|
export interface ConfigItemState extends ConfigItem {
|
|
573
611
|
type: 'state';
|
|
574
|
-
/** Describes
|
|
612
|
+
/** Describes which object ID should be taken for the controlling. The ID is without `ADAPTER.I.` prefix */
|
|
575
613
|
oid: string;
|
|
576
614
|
/** The `oid` is absolute and no need to add `ADAPTER.I` or `system.adapter.ADAPTER.I.` to oid */
|
|
577
615
|
foreign?: boolean;
|
|
@@ -581,7 +619,7 @@ export interface ConfigItemState extends ConfigItem {
|
|
|
581
619
|
control?: 'text' | 'html' | 'input' | 'slider' | 'select' | 'button' | 'switch' | 'number';
|
|
582
620
|
/** If true, the state will be shown as switch, select, button, slider or text input. Used only if no control property is defined */
|
|
583
621
|
controlled?: boolean;
|
|
584
|
-
/** Add unit to the value */
|
|
622
|
+
/** Add a unit to the value */
|
|
585
623
|
unit?: string;
|
|
586
624
|
/** this text will be shown if the value is true */
|
|
587
625
|
trueText?: string;
|
|
@@ -611,15 +649,15 @@ export interface ConfigItemState extends ConfigItem {
|
|
|
611
649
|
labelIcon?: string;
|
|
612
650
|
/** Normally, the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
|
|
613
651
|
narrow?: boolean;
|
|
614
|
-
/** Add to label the colon at the end if not exist in label */
|
|
652
|
+
/** Add to the label the colon at the end if not exist in the label */
|
|
615
653
|
addColon?: boolean;
|
|
616
654
|
/** Value should blink when updated (true or color) */
|
|
617
655
|
blinkOnUpdate?: boolean | string;
|
|
618
656
|
/** Font size */
|
|
619
657
|
size?: number | 'small' | 'normal' | 'large';
|
|
620
|
-
/** Optional value
|
|
658
|
+
/** Optional value that will be sent for the button */
|
|
621
659
|
buttonValue?: ioBroker.StateValue;
|
|
622
|
-
/** Show SET button. The value in this case will be sent only when the button is pressed. You can define the text of the button.
|
|
660
|
+
/** Show the SET button. The value in this case will be sent only when the button is pressed. You can define the text of the button. The default text is "Set" */
|
|
623
661
|
showEnterButton?: boolean | ioBroker.StringOrTranslated;
|
|
624
662
|
/** The value in this case will be sent only when the "Enter" button is pressed. It can be combined with `showEnterButton` */
|
|
625
663
|
setOnEnterKey?: boolean;
|
|
@@ -629,7 +667,7 @@ export interface ConfigItemState extends ConfigItem {
|
|
|
629
667
|
export interface ConfigItemTextSendTo extends Omit<ConfigItem, 'data'> {
|
|
630
668
|
type: 'textSendTo';
|
|
631
669
|
container?: 'text' | 'div';
|
|
632
|
-
/** if true - show copy
|
|
670
|
+
/** if true - show copy-to-clipboard button */
|
|
633
671
|
copyToClipboard?: boolean;
|
|
634
672
|
/** by change of which attributes, the command must be resent */
|
|
635
673
|
alsoDependsOn?: string[];
|
|
@@ -642,11 +680,11 @@ export interface ConfigItemTextSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
642
680
|
}
|
|
643
681
|
export interface ConfigItemSelectSendTo extends Omit<ConfigItem, 'data'> {
|
|
644
682
|
type: 'selectSendTo';
|
|
645
|
-
/** allow manual editing. Without drop-down menu (if instance is offline). Default `true`. */
|
|
683
|
+
/** allow manual editing. Without a drop-down menu (if the instance is offline). Default `true`. */
|
|
646
684
|
manual?: boolean;
|
|
647
685
|
/** Multiple choice select */
|
|
648
686
|
multiple?: boolean;
|
|
649
|
-
/** show item even if no label was found for it (by multiple), default=`true` */
|
|
687
|
+
/** show an item even if no label was found for it (by multiple), default=`true` */
|
|
650
688
|
showAllValues?: boolean;
|
|
651
689
|
/** if true, the clear button will not be shown */
|
|
652
690
|
noClearButton?: boolean;
|
|
@@ -662,21 +700,23 @@ export interface ConfigItemSelectSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
662
700
|
export interface ConfigItemTable extends ConfigItem {
|
|
663
701
|
type: 'table';
|
|
664
702
|
items?: ConfigItemTableIndexed[];
|
|
703
|
+
/** Define the name of the attribute of the item which should be shown as a title of the item in cards mode. */
|
|
704
|
+
titleAttribute?: string;
|
|
665
705
|
/** If delete or add disabled, If noDelete is false, add, delete and move up/down should work */
|
|
666
706
|
noDelete?: boolean;
|
|
667
707
|
/** @deprecated don't use */
|
|
668
708
|
objKeyName?: string;
|
|
669
709
|
/** @deprecated don't use */
|
|
670
710
|
objValueName?: string;
|
|
671
|
-
/** If add allowed even if filter is set */
|
|
711
|
+
/** If add allowed even if a filter is set */
|
|
672
712
|
allowAddByFilter?: boolean;
|
|
673
|
-
/** The number of lines from which the second
|
|
713
|
+
/** The number of lines from which the second adding button at the bottom of the table will be shown. Default 5 */
|
|
674
714
|
showSecondAddAt?: number;
|
|
675
|
-
/** Show first plus button on top of the first column and not on the left. */
|
|
715
|
+
/** Show the first plus button on top of the first column and not on the left. */
|
|
676
716
|
showFirstAddOnTop?: boolean;
|
|
677
|
-
/** If clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. */
|
|
717
|
+
/** If the clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. */
|
|
678
718
|
clone?: boolean | string;
|
|
679
|
-
/** If export button should be shown. Export as csv file. */
|
|
719
|
+
/** If export button should be shown. Export as a csv file. */
|
|
680
720
|
export?: boolean;
|
|
681
721
|
/** If import button should be shown. Import from csv file. */
|
|
682
722
|
import?: boolean;
|
|
@@ -684,7 +724,7 @@ export interface ConfigItemTable extends ConfigItem {
|
|
|
684
724
|
compact?: boolean;
|
|
685
725
|
/** Specify the 'attr' name of columns which need to be unique */
|
|
686
726
|
uniqueColumns?: string[];
|
|
687
|
-
/** These items will be encrypted before saving with simple (not SHA) encryption method */
|
|
727
|
+
/** These items will be encrypted before saving with a simple (not SHA) encryption method */
|
|
688
728
|
encryptedAttributes?: string[];
|
|
689
729
|
/** Breakpoint that will be rendered as cards */
|
|
690
730
|
useCardFor?: ('xs' | 'sm' | 'md' | 'lg' | 'xl')[];
|
|
@@ -768,7 +808,18 @@ export interface ConfigItemJsonEditor extends ConfigItem {
|
|
|
768
808
|
allowEmpty?: boolean;
|
|
769
809
|
/** Allow JSON5 format. Default is disabled */
|
|
770
810
|
json5?: boolean;
|
|
771
|
-
/** Do not allow
|
|
811
|
+
/** Do not allow saving the value if error in JSON or JSON5 */
|
|
812
|
+
doNotApplyWithError?: boolean;
|
|
813
|
+
/** Open the editor in read-only mode - editor can be opened but content cannot be modified */
|
|
814
|
+
readOnly?: boolean;
|
|
815
|
+
}
|
|
816
|
+
export interface ConfigItemYamlEditor extends ConfigItem {
|
|
817
|
+
type: 'yamlEditor';
|
|
818
|
+
/** if false, the text will be not validated as YAML */
|
|
819
|
+
validateYaml?: boolean;
|
|
820
|
+
/** if true, the YAML will be validated only if the value is not empty */
|
|
821
|
+
allowEmpty?: boolean;
|
|
822
|
+
/** Do not allow saving the value if error in YAML */
|
|
772
823
|
doNotApplyWithError?: boolean;
|
|
773
824
|
/** Open the editor in read-only mode - editor can be opened but content cannot be modified */
|
|
774
825
|
readOnly?: boolean;
|
|
@@ -782,7 +833,7 @@ export interface ConfigItemInterface extends ConfigItem {
|
|
|
782
833
|
}
|
|
783
834
|
export interface ConfigItemImageUpload extends ConfigItem {
|
|
784
835
|
type: 'image';
|
|
785
|
-
/** name of a file is structure name. In the below example `login-bg.png` is file name for `writeFile("myAdapter.INSTANCE", "login-bg.png")` */
|
|
836
|
+
/** the name of a file is the structure name. In the below example `login-bg.png` is the file name for `writeFile("myAdapter.INSTANCE", "login-bg.png")` */
|
|
786
837
|
filename?: string;
|
|
787
838
|
/** HTML accept attribute, like `{ 'image/**': [], 'application/pdf': ['.pdf'] }`, default `{ 'image/*': [] }` */
|
|
788
839
|
accept?: Record<string, string[]>;
|
|
@@ -790,16 +841,16 @@ export interface ConfigItemImageUpload extends ConfigItem {
|
|
|
790
841
|
maxSize?: number;
|
|
791
842
|
/** if true, the image will be saved as data-url in attribute, elsewise as binary in file storage */
|
|
792
843
|
base64?: boolean;
|
|
793
|
-
/** if true, allow user to crop the image */
|
|
844
|
+
/** if true, allow the user to crop the image */
|
|
794
845
|
crop?: boolean;
|
|
795
846
|
}
|
|
796
847
|
export interface ConfigItemInstanceSelect extends ConfigItem {
|
|
797
848
|
type: 'instance';
|
|
798
|
-
/** name of adapter. With special name `_dataSources` you can get all adapters with flag `common.getHistory`. */
|
|
849
|
+
/** name of adapter. With the special name `_dataSources` you can get all adapters with the flag `common.getHistory`. */
|
|
799
850
|
adapter?: string;
|
|
800
|
-
/** optional list of adapters
|
|
851
|
+
/** optional list of adapters that should be shown. If not defined, all adapters will be shown. Only active if the ` adapter ` attribute is not defined. */
|
|
801
852
|
adapters?: string[];
|
|
802
|
-
/** if true.
|
|
853
|
+
/** if true. The additional option "deactivate" is shown */
|
|
803
854
|
allowDeactivate?: boolean;
|
|
804
855
|
/** if true. Only enabled instances will be shown */
|
|
805
856
|
onlyEnabled?: boolean;
|
|
@@ -812,7 +863,7 @@ export interface ConfigItemInstanceSelect extends ConfigItem {
|
|
|
812
863
|
}
|
|
813
864
|
export interface ConfigItemFile extends ConfigItem {
|
|
814
865
|
type: 'file';
|
|
815
|
-
/** if a user can manually enter the file name and not only through select dialog */
|
|
866
|
+
/** if a user can manually enter the file name and not only through a select dialog */
|
|
816
867
|
disableEdit?: boolean;
|
|
817
868
|
/** limit selection to one specific object of type `meta` and the following path (not mandatory) */
|
|
818
869
|
limitPath?: string;
|
|
@@ -828,7 +879,7 @@ export interface ConfigItemFile extends ConfigItem {
|
|
|
828
879
|
allowView?: boolean;
|
|
829
880
|
/** show toolbar (default true) */
|
|
830
881
|
showToolbar?: boolean;
|
|
831
|
-
/** user can select only folders (e.g., for uploading path) */
|
|
882
|
+
/** user can select only folders (e.g., for the uploading path) */
|
|
832
883
|
selectOnlyFolders?: boolean;
|
|
833
884
|
/** trim the filename */
|
|
834
885
|
trim?: boolean;
|
|
@@ -839,15 +890,15 @@ export interface ConfigItemFile extends ConfigItem {
|
|
|
839
890
|
}
|
|
840
891
|
export interface ConfigItemFileSelector extends ConfigItem {
|
|
841
892
|
type: 'fileSelector';
|
|
842
|
-
/** 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
|
|
893
|
+
/** File extension pattern. Allowed `**\/*.ext` to show all files from subfolders too, `*.ext` to show from the root folder or `folderName\/*.ext` to show all files in subfolder `folderName`. Default `**\/*.*`. */
|
|
843
894
|
pattern: string;
|
|
844
895
|
/** type of files: `audio`, `image`, `text` */
|
|
845
896
|
fileTypes?: 'audio' | 'image' | 'text';
|
|
846
|
-
/** Object ID of type `meta`. You can use special placeholder `%INSTANCE%`: like `myAdapter.%INSTANCE%.files` */
|
|
897
|
+
/** Object ID of the type `meta`. You can use special placeholder `%INSTANCE%`: like `myAdapter.%INSTANCE%.files` */
|
|
847
898
|
objectID?: string;
|
|
848
899
|
/** 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 `/`. */
|
|
849
900
|
upload?: string;
|
|
850
|
-
/** Show refresh button near the select. */
|
|
901
|
+
/** Show the refresh button near the select. */
|
|
851
902
|
refresh?: boolean;
|
|
852
903
|
/** max file size (default 2MB) */
|
|
853
904
|
maxSize?: number;
|
|
@@ -860,43 +911,7 @@ export interface ConfigItemFileSelector extends ConfigItem {
|
|
|
860
911
|
/** Do not show the size of files */
|
|
861
912
|
noSize?: boolean;
|
|
862
913
|
}
|
|
863
|
-
export type ConfigItemAny = ConfigItemAlive | ConfigItemAutocomplete | ConfigItemAutocompleteSendTo | ConfigItemPanel | ConfigItemTabs | ConfigItemText | ConfigItemNumber | ConfigItemOAuth2 | ConfigItemColor | ConfigItemCheckbox | ConfigItemSlider | ConfigItemIP | ConfigItemInfoBox | ConfigItemUser | ConfigItemRoom | ConfigItemFunc | ConfigItemSelect | ConfigItemAccordion | ConfigItemCoordinates | ConfigItemDivider | ConfigItemHeader | ConfigItemCustom | ConfigItemDatePicker | ConfigItemDeviceManager | ConfigItemLanguage | ConfigItemPort | ConfigItemSendTo | ConfigItemState | ConfigItemTable | ConfigItemTimePicker | ConfigItemTextSendTo | ConfigItemSelectSendTo | ConfigItemCertCollection | ConfigItemCertificateSelect | ConfigItemCertificates | ConfigItemUUID | ConfigItemCheckDocker | ConfigItemCheckLicense | ConfigItemPattern | ConfigItemChip | ConfigItemCRON | ConfigItemFile | ConfigItemFileSelector | ConfigItemImageSendTo | ConfigItemInstanceSelect | ConfigItemImageUpload | ConfigItemInterface | ConfigItemJsonEditor | ConfigItemLicense | ConfigItemPassword | ConfigItemSetState | ConfigItemStaticDivider | ConfigItemStaticHeader | ConfigItemStaticInfo | ConfigItemStaticImage | ConfigItemStaticText | ConfigItemTopic | ConfigItemObjectId | ConfigItemQrCode;
|
|
864
|
-
export type BackEndCommandType = 'nop' | 'refresh' | 'link' | 'message';
|
|
865
|
-
export interface BackEndCommandGeneric {
|
|
866
|
-
command: BackEndCommandType;
|
|
867
|
-
/** New GUI schema */
|
|
868
|
-
schema?: ConfigItemPanel | ConfigItemTabs;
|
|
869
|
-
/** New GUI data */
|
|
870
|
-
data?: Record<string, any>;
|
|
871
|
-
refresh?: boolean;
|
|
872
|
-
}
|
|
873
|
-
export interface BackEndCommandNoOperation extends BackEndCommandGeneric {
|
|
874
|
-
command: 'nop';
|
|
875
|
-
}
|
|
876
|
-
export interface BackEndCommandRefresh extends BackEndCommandGeneric {
|
|
877
|
-
command: 'refresh';
|
|
878
|
-
/** If refresh the GUI */
|
|
879
|
-
fullRefresh?: boolean;
|
|
880
|
-
}
|
|
881
|
-
export interface BackEndCommandOpenLink extends BackEndCommandGeneric {
|
|
882
|
-
command: 'link';
|
|
883
|
-
/** Link url. Could be relative ('#blabla') or absolute ('https://blabla') */
|
|
884
|
-
url: string;
|
|
885
|
-
/** Target of the link. Default is `_self` for relative and '_blank' for absolute links */
|
|
886
|
-
target?: '_self' | '_blank' | string;
|
|
887
|
-
/** If GUI should be closed after the link was opened (Only for target='_self') */
|
|
888
|
-
close?: boolean;
|
|
889
|
-
}
|
|
890
|
-
export interface BackEndCommandMessage extends BackEndCommandGeneric {
|
|
891
|
-
command: 'message';
|
|
892
|
-
/** Message text */
|
|
893
|
-
message: ioBroker.StringOrTranslated;
|
|
894
|
-
/** If GUI should be closed after the message shown */
|
|
895
|
-
close?: boolean;
|
|
896
|
-
/** Type of message. Default is 'popup' */
|
|
897
|
-
variant: 'popup' | 'dialog';
|
|
898
|
-
}
|
|
899
|
-
export type BackEndCommand = BackEndCommandMessage | BackEndCommandOpenLink | BackEndCommandRefresh;
|
|
914
|
+
export type ConfigItemAny = ConfigItemAlive | ConfigItemAutocomplete | ConfigItemAutocompleteSendTo | ConfigItemPanel | ConfigItemTabs | ConfigItemText | ConfigItemNumber | ConfigItemOAuth2 | ConfigItemColor | ConfigItemCheckbox | ConfigItemSlider | ConfigItemIP | ConfigItemInfoBox | ConfigItemUser | ConfigItemRoom | ConfigItemFunc | ConfigItemSelect | ConfigItemAccordion | ConfigItemCoordinates | ConfigItemDivider | ConfigItemHeader | ConfigItemCustom | ConfigItemDatePicker | ConfigItemDeviceManager | ConfigItemLanguage | ConfigItemPort | ConfigItemSendTo | ConfigItemState | ConfigItemTable | ConfigItemTimePicker | ConfigItemTextSendTo | ConfigItemSelectSendTo | ConfigItemCertCollection | ConfigItemCertificateSelect | ConfigItemCertificates | ConfigItemUUID | ConfigItemCheckDocker | ConfigItemCheckLicense | ConfigItemPattern | ConfigItemChip | ConfigItemCRON | ConfigItemFile | ConfigItemFileSelector | ConfigItemIFrame | ConfigItemIFrameSendTo | ConfigItemImageSendTo | ConfigItemInstanceSelect | ConfigItemImageUpload | ConfigItemInterface | ConfigItemJsonEditor | ConfigItemYamlEditor | ConfigItemLicense | ConfigItemPassword | ConfigItemSetState | ConfigItemStaticDivider | ConfigItemStaticHeader | ConfigItemStaticInfo | ConfigItemStaticImage | ConfigItemStaticText | ConfigItemTopic | ConfigItemObjectId | ConfigItemQrCode;
|
|
900
915
|
export type ActionButton = {
|
|
901
916
|
label: ioBroker.StringOrTranslated;
|
|
902
917
|
type: 'apply' | 'cancel' | 'copyToClipboard';
|
|
@@ -928,8 +943,8 @@ export type BackEndCommandJsonFormOptions = {
|
|
|
928
943
|
};
|
|
929
944
|
export type JsonFormSchema = ConfigItemPanel | ConfigItemTabs;
|
|
930
945
|
export type JsonFormData = Record<string, any>;
|
|
931
|
-
export interface DeviceDetails {
|
|
932
|
-
id:
|
|
946
|
+
export interface DeviceDetails<TId extends DeviceId = DeviceId> {
|
|
947
|
+
id: TId;
|
|
933
948
|
schema: JsonFormSchema;
|
|
934
949
|
data?: JsonFormData;
|
|
935
950
|
}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type * from './adapter';
|
|
2
|
+
export { ACTIONS, type ChannelInfo, type Color, type ControlBase, type ControlState, type BackendToGuiCommand, type BackendToGuiCommandAllUpdate, type BackendToGuiCommandDeviceDelete, type BackendToGuiCommandDeviceStatusUpdate, type BackendToGuiCommandDeviceInfoUpdate, } from './base';
|
|
2
3
|
export type * from './common';
|
|
3
4
|
export * from './errorCodes';
|
|
4
|
-
export { type ChannelInfo, type Color, type ControlState, type ControlBase, ACTIONS } from './base';
|
package/build/types/index.js
CHANGED
|
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.ACTIONS = void 0;
|
|
18
|
-
__exportStar(require("./errorCodes"), exports);
|
|
19
18
|
var base_1 = require("./base");
|
|
20
19
|
Object.defineProperty(exports, "ACTIONS", { enumerable: true, get: function () { return base_1.ACTIONS; } });
|
|
20
|
+
__exportStar(require("./errorCodes"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/dm-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "ioBroker Device Manager utilities for backend",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"build": "tsc -p tsconfig.json",
|
|
16
16
|
"test:package": "node -e \"process.exit(0)\"",
|
|
17
17
|
"lint": "eslint -c eslint.config.mjs src",
|
|
18
|
-
"updateCommonTs": "
|
|
18
|
+
"updateCommonTs": "npx -y tsx tasks.ts",
|
|
19
19
|
"prettier": "prettier -u -w examples src",
|
|
20
20
|
"release": "release-script",
|
|
21
21
|
"release-patch": "release-script patch --yes",
|
|
@@ -30,13 +30,17 @@
|
|
|
30
30
|
"@iobroker/adapter-core": "^3.3.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@alcalzone/release-script
|
|
33
|
+
"@iobroker/types": "^7.1.1-alpha.0-20260127-997e40b73",
|
|
34
|
+
"@alcalzone/release-script": "^5.1.1",
|
|
35
|
+
"@alcalzone/release-script-plugin-license": "^5.1.1",
|
|
35
36
|
"@iobroker/eslint-config": "^2.2.0",
|
|
36
|
-
"@types/node": "^25.
|
|
37
|
-
"axios": "^1.13.
|
|
37
|
+
"@types/node": "^25.3.3",
|
|
38
|
+
"axios": "^1.13.6",
|
|
38
39
|
"typescript": "~5.9.3"
|
|
39
40
|
},
|
|
41
|
+
"overrides": {
|
|
42
|
+
"@iobroker/types": "$@iobroker/types"
|
|
43
|
+
},
|
|
40
44
|
"files": [
|
|
41
45
|
"LICENSE",
|
|
42
46
|
"README.md",
|