iobroker.webui 1.25.1 → 1.26.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.
Files changed (41) hide show
  1. package/README.md +9 -0
  2. package/io-package.json +27 -27
  3. package/package.json +14 -14
  4. package/www/dist/frontend/common/Common.globals.d.ts +1 -1
  5. package/www/dist/frontend/common/IobrokerHandler.js +11 -9
  6. package/www/dist/frontend/common/Runtime.d.ts +2 -2
  7. package/www/dist/frontend/config/IobrokerWebuiSolutionExplorer.js +4 -4
  8. package/www/dist/frontend/generated/ScriptCommands.json +8 -3
  9. package/www/dist/frontend/helper/DialogHelper.js +7 -4
  10. package/www/dist/frontend/runtime/ScreenViewer.js +13 -16
  11. package/www/dist/frontend/scripting/IobrokerWebuiScriptSystem.js +2 -1
  12. package/www/index.html +1 -1
  13. package/www/node_modules/@adobe/css-tools/dist/index.mjs +1 -1
  14. package/www/node_modules/@iobroker/socket-client/dist/esm/AdminConnection.js +7 -4
  15. package/www/node_modules/@iobroker/socket-client/dist/esm/Connection.d.ts +82 -2
  16. package/www/node_modules/@iobroker/socket-client/dist/esm/Connection.js +266 -2
  17. package/www/node_modules/@node-projects/base-custom-webcomponent/dist/BaseCustomWebComponent.d.ts +2 -1
  18. package/www/node_modules/@node-projects/base-custom-webcomponent/dist/BaseCustomWebComponent.js +63 -53
  19. package/www/node_modules/@node-projects/base-custom-webcomponent/dist/Effect.js +2 -0
  20. package/www/node_modules/@node-projects/base-custom-webcomponent/dist/SignalDecorator.js +16 -0
  21. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/BaseCustomWebComponent.js +795 -0
  22. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/Debounce.js +19 -0
  23. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/DeclaritiveBaseCustomWebcomponent.js +176 -0
  24. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/DomHelper.js +96 -0
  25. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/HotModuleReplacement.js +125 -0
  26. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/LazyLoader.js +52 -0
  27. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/TouchContextMenu.js +20 -0
  28. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/TypedEvent.js +48 -0
  29. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/WeakArray.js +27 -0
  30. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/dist/index.js +9 -0
  31. package/www/node_modules/@node-projects/propertygrid.webcomponent/node_modules/@node-projects/base-custom-webcomponent/jsr.json +5 -0
  32. package/www/node_modules/@node-projects/web-component-designer/dist/elements/helper/getBoxQuads.js +14 -15
  33. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/ServiceContainer.js +1 -0
  34. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js +37 -0
  35. package/www/node_modules/@node-projects/web-component-designer/dist/elements/widgets/designerView/designerCanvas.js +2 -0
  36. package/www/node_modules/@node-projects/web-component-designer/dist/elements/widgets/designerView/extensions/buttons/OptionsContextMenuButton.js +29 -4
  37. package/www/node_modules/es-module-shims/dist/es-module-shims.js +754 -628
  38. package/www/node_modules/long/index.js +360 -246
  39. package/www/node_modules/long/umd/index.js +1585 -1395
  40. package/www/node_modules/wunderbaum/dist/wunderbaum.css +1 -1
  41. package/www/node_modules/wunderbaum/dist/wunderbaum.esm.min.js +35 -35
package/README.md CHANGED
@@ -133,6 +133,15 @@ runtime.html?screenName=screen2
133
133
  Placeholder for next versions:
134
134
  ### __WORK IN PROGRESS__
135
135
  -->
136
+ ### 1.26.0 (2025-03-04)
137
+ - fix error in screenviewer
138
+ - update npms
139
+ - rename global styles
140
+ - allow styling of dialog
141
+
142
+ ### 1.25.2 (2025-02-05)
143
+ - fix null error on props
144
+
136
145
  ### 1.25.1 (2025-01-24)
137
146
  - escape xml
138
147
  - switch to official selector package
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "webui",
4
- "version": "1.25.1",
4
+ "version": "1.26.0",
5
5
  "titleLang": {
6
6
  "en": "webui",
7
7
  "de": "webui",
@@ -29,6 +29,32 @@
29
29
  "zh-cn": "使用万维网传送器的高锰用户接口"
30
30
  },
31
31
  "news": {
32
+ "1.26.0": {
33
+ "en": "fix error in screenviewer\nupdate npms\nrename global styles\nallow styling of dialog",
34
+ "de": "fehler in screenviewer beheben\naktualisierung von npms\numbenennen global styles\ndie gestaltung des dialogs ermöglichen",
35
+ "ru": "исправить ошибку screenviewer\nобновление npms\nпереименовать глобальные стили\nразрешить стилизацию диалога",
36
+ "pt": "corrigir erro no screenviewer\natualização npms\nrenomear estilos globais\npermitir o estilo de diálogo",
37
+ "nl": "fix error in screenviewer\nnpms bijwerken\nglobale stijlen hernoemen\nstyling van dialoogvenster toestaan",
38
+ "fr": "correction d'erreur dans screenviewer\nmettre à jour npms\nrenommer les styles globaux\npermettre le style de dialogue",
39
+ "it": "errore di correzione in screenviewer\naggiornamento npm\nrinominare gli stili globali\nconsentire lo styling di dialogo",
40
+ "es": "corregir error en screenviewer\nactualización npms\nrenombrar estilos globales\npermitir el estilo de diálogo",
41
+ "pl": "naprawić błąd w przeglądarce\nupdate npms\nzmienić nazwę stylów globalnych\numożliwić stylizację okna dialogowego",
42
+ "uk": "виправлено помилку в екрані\nоновлення npms\nперейменувати глобальні стилі\nдозволяє укладати діалогове вікно",
43
+ "zh-cn": "在屏幕查看器中修正错误\n更新 npms\n重命名全局样式\n允许对话框的样式"
44
+ },
45
+ "1.25.2": {
46
+ "en": "fix null error on props",
47
+ "de": "nullfehler auf requisiten beheben",
48
+ "ru": "исправить ошибку null на реквизитов",
49
+ "pt": "corrigir erro nulo em adereços",
50
+ "nl": "fix null-fout op rekwisieten",
51
+ "fr": "correction de l'erreur null sur les accessoires",
52
+ "it": "correzione di errore null su oggetti",
53
+ "es": "solucionar error null en props",
54
+ "pl": "naprawić błąd null na rekwizytach",
55
+ "uk": "виправити помилку null на пропсах",
56
+ "zh-cn": "修复道具上的无效错误"
57
+ },
32
58
  "1.25.1": {
33
59
  "en": "escape xml\nswitch to official selector package",
34
60
  "de": "entkommen xml\nwechsel zum offiziellen auswahlpaket",
@@ -93,32 +119,6 @@
93
119
  "pl": "revert es module shims, prowadzi do błędów",
94
120
  "uk": "перевернути назад es модуль шімів, призводить до помилок",
95
121
  "zh-cn": "返回 es 模块 shims, 导致错误"
96
- },
97
- "1.24.1": {
98
- "en": "hopefully fix package upload by changed name",
99
- "de": "hoffentlich paket-upload mit geändertem namen beheben",
100
- "ru": "надеюсь исправить загрузку пакета измененным именем",
101
- "pt": "esperançosamente corrigir o upload do pacote por nome alterado",
102
- "nl": "hopelijk pakket uploaden op gewijzigde naam repareren",
103
- "fr": "j'espère corriger le téléchargement du paquet par changement de nom",
104
- "it": "si spera di risolvere il pacchetto upload con il nome cambiato",
105
- "es": "esperemos fijar la carga del paquete por nombre cambiado",
106
- "pl": "miejmy nadzieję, że uda się naprawić przesyłkę po zmianie nazwy",
107
- "uk": "сподіваємось на те, що завантаження пакету змінено",
108
- "zh-cn": "希望用更改的名称修正软件包上传"
109
- },
110
- "1.24.0": {
111
- "en": "cleanup www dir",
112
- "de": "reinigung www dr",
113
- "ru": "очистка www dir",
114
- "pt": "limpeza www dir",
115
- "nl": "opruimen www dir",
116
- "fr": "nettoyage www dir",
117
- "it": "pulizia www dir",
118
- "es": "cleanup www dir",
119
- "pl": "czyszczenie dir www",
120
- "uk": "очищувач www dir",
121
- "zh-cn": "清理 www dir"
122
122
  }
123
123
  },
124
124
  "icon": "logo.png",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.webui",
3
- "version": "1.25.1",
3
+ "version": "1.26.0",
4
4
  "description": "ioBroker webui",
5
5
  "type": "module",
6
6
  "main": "dist/backend/main.js",
@@ -44,23 +44,23 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@iobroker/adapter-core": "^3.2.3",
47
- "@types/node": "^22.10.7"
47
+ "@types/node": "^22.13.9"
48
48
  },
49
49
  "devDependencies": {
50
- "@adobe/css-tools": "4.4.1",
50
+ "@adobe/css-tools": "4.4.2",
51
51
  "@alcalzone/release-script": "^3.8.0",
52
52
  "@alcalzone/release-script-plugin-iobroker": "^3.7.2",
53
53
  "@alcalzone/release-script-plugin-license": "^3.7.0",
54
54
  "@blockly/zoom-to-fit": "^6.0.12",
55
- "@iobroker/socket-client": "^4.0.0",
56
- "@iobroker/testing": "^5.0.0",
55
+ "@iobroker/socket-client": "^4.0.21",
56
+ "@iobroker/testing": "^5.0.3",
57
57
  "@iobroker/webcomponent-selectid-dialog": "^1.0.3",
58
- "@node-projects/base-custom-webcomponent": "0.27.8",
58
+ "@node-projects/base-custom-webcomponent": "0.29.0",
59
59
  "@node-projects/lean-he-esm": "^3.3.0",
60
60
  "@node-projects/node-html-parser-esm": "^6.2.0",
61
61
  "@node-projects/propertygrid.webcomponent": "^1.3.0",
62
62
  "@node-projects/splitview.webcomponent": "^1.0.1",
63
- "@node-projects/web-component-designer": "^0.1.240",
63
+ "@node-projects/web-component-designer": "^0.1.245",
64
64
  "@node-projects/web-component-designer-codeview-monaco": "^0.1.33",
65
65
  "@node-projects/web-component-designer-htmlparserservice-nodehtmlparser": "^0.1.11",
66
66
  "@node-projects/web-component-designer-stylesheetservice-css-tools": "^0.1.10",
@@ -69,31 +69,31 @@
69
69
  "@types/json-schema": "^7.0.15",
70
70
  "@web/dev-server": "^0.4.6",
71
71
  "blockly": "^11.2.1",
72
- "chai": "^5.1.2",
72
+ "chai": "^5.2.0",
73
73
  "chai-as-promised": "^8.0.1",
74
74
  "construct-style-sheets-polyfill": "^3.1.0",
75
75
  "cross-env": "^7.0.3",
76
76
  "dayjs": "^1.11.13",
77
77
  "del": "^8.0.0",
78
78
  "dock-spawn-ts": "^3.2.1",
79
- "es-module-shims": "1.10.1",
80
- "eslint": "^9.18.0",
79
+ "es-module-shims": "2.0.10",
80
+ "eslint": "^9.21.0",
81
81
  "esprima-next": "^6.0.3",
82
82
  "glob-stream": "^8.0.2",
83
83
  "gulp": "^5.0.0",
84
84
  "gulp-git": "^2.11.0",
85
85
  "gulp-replace": "^1.1.4",
86
- "long": "^5.2.4",
86
+ "long": "^5.3.1",
87
87
  "mobile-drag-drop": "^3.0.0-rc.0",
88
- "mocha": "^11.0.1",
88
+ "mocha": "^11.1.0",
89
89
  "monaco-editor": "^0.50.0",
90
90
  "nyc": "^17.1.0",
91
91
  "sinon-chai": "^4.0.0",
92
92
  "toastify-js": "^1.12.0",
93
93
  "ts-node": "^10.9.2",
94
94
  "tslib": "^2.8.1",
95
- "typescript": "^5.7.3",
95
+ "typescript": "^5.8.2",
96
96
  "typescript-json-schema": "^0.65.1",
97
- "wunderbaum": "0.12.0"
97
+ "wunderbaum": "0.12.1"
98
98
  }
99
99
  }
@@ -52,7 +52,7 @@ declare var RUNTIME: {
52
52
  left?: string;
53
53
  top?: string;
54
54
  }): Promise<void>;
55
- runSimpleScriptCommand<T extends import('@node-projects/web-component-designer-visualization-addons').ScriptCommands>(scriptCommand: T): Promise<void>;
55
+ runSimpleScriptCommand<T extends import('../scripting/IobrokerWebuiScriptCommands.js').WebuiScriptCommands>(scriptCommand: T): Promise<void>;
56
56
  getParentScreen(screen: BaseScreenViewerAndControl, parentlevel?: number): BaseScreenViewerAndControl;
57
57
  findParent<T>(element: Element, type: new (...args: any[]) => T, predicate?: (element: Element) => boolean): T;
58
58
  };
@@ -268,15 +268,17 @@ export class IobrokerHandler {
268
268
  try {
269
269
  control = await this._getObjectFromFile(this.configPath + "controls/" + name + '.control');
270
270
  //TODO: remove in a later version, fixes old props
271
- let k = Object.keys(control.properties);
272
- if (k.length && typeof control.properties[k[0]] == 'string') {
273
- for (let p in control.properties) {
274
- let prp = control.properties[p];
275
- if (prp.startsWith("[")) {
276
- control.properties[p] = { type: 'enum', values: JSON.parse(prp) };
277
- }
278
- else {
279
- control.properties[p] = { type: prp };
271
+ if (control.properties) {
272
+ let k = Object.keys(control.properties);
273
+ if (k.length && typeof control.properties[k[0]] == 'string') {
274
+ for (let p in control.properties) {
275
+ let prp = control.properties[p];
276
+ if (prp.startsWith("[")) {
277
+ control.properties[p] = { type: 'enum', values: JSON.parse(prp) };
278
+ }
279
+ else {
280
+ control.properties[p] = { type: prp };
281
+ }
280
282
  }
281
283
  }
282
284
  }
@@ -1,8 +1,8 @@
1
- import type { OpenDialog, OpenScreen, ScriptCommands } from "@node-projects/web-component-designer-visualization-addons";
1
+ import type { OpenDialog, OpenScreen, WebuiScriptCommands } from "../scripting/IobrokerWebuiScriptCommands.js";
2
2
  export declare class Runtime {
3
3
  static openScreen(config: Omit<OpenScreen, 'type'>): Promise<void>;
4
4
  static openDialog(config: Omit<OpenDialog, 'type'>): Promise<void>;
5
- static runSimpleScriptCommand<T extends ScriptCommands>(scriptCommand: T): Promise<void>;
5
+ static runSimpleScriptCommand<T extends WebuiScriptCommands>(scriptCommand: T): Promise<void>;
6
6
  static getParentScreen(screen: BaseScreenViewerAndControl, parentLevel?: number): BaseScreenViewerAndControl;
7
7
  static findParent<T>(element: Element, type: new (...args: any[]) => T, predicate?: (element: Element) => boolean): T;
8
8
  }
@@ -295,20 +295,20 @@ export class IobrokerWebuiSolutionExplorer extends BaseCustomWebComponentConstru
295
295
  }], event);
296
296
  };
297
297
  return {
298
- title: 'Style',
298
+ title: 'Screens Style',
299
299
  folder: false,
300
300
  contextMenu: (e, data) => ctxMenu(e),
301
301
  dblclick: (e, data) => {
302
- window.appShell.openGlobalStyleEditor(iobrokerHandler.config.globalStyle ?? '', 'global style', 'globalStyle');
302
+ window.appShell.openGlobalStyleEditor(iobrokerHandler.config.globalStyle ?? '', 'screens style', 'globalStyle');
303
303
  }
304
304
  };
305
305
  }
306
306
  _createFontDeclarationsNode() {
307
307
  return {
308
- title: 'Font Declaration Style',
308
+ title: 'Global Style',
309
309
  folder: false,
310
310
  dblclick: (e, data) => {
311
- window.appShell.openGlobalStyleEditor(iobrokerHandler.config.fontDeclarations ?? '', 'font declarations style', 'fontDeclarations');
311
+ window.appShell.openGlobalStyleEditor(iobrokerHandler.config.fontDeclarations ?? '', 'global style', 'fontDeclarations');
312
312
  }
313
313
  };
314
314
  }
@@ -489,6 +489,10 @@
489
489
  "closeable": {
490
490
  "type": "boolean"
491
491
  },
492
+ "cssClass": {
493
+ "description": "css class to apply to dialog",
494
+ "type": "string"
495
+ },
492
496
  "height": {
493
497
  "type": "string"
494
498
  },
@@ -522,6 +526,7 @@
522
526
  }
523
527
  },
524
528
  "propertyOrder": [
529
+ "cssClass",
525
530
  "type",
526
531
  "screen",
527
532
  "title",
@@ -973,9 +978,6 @@
973
978
  {
974
979
  "$ref": "#/definitions/OpenUrl"
975
980
  },
976
- {
977
- "$ref": "#/definitions/OpenDialog"
978
- },
979
981
  {
980
982
  "$ref": "#/definitions/CloseDialog"
981
983
  },
@@ -1069,6 +1071,9 @@
1069
1071
  {
1070
1072
  "$ref": "#/definitions/OpenScreen"
1071
1073
  },
1074
+ {
1075
+ "$ref": "#/definitions/OpenDialog"
1076
+ },
1072
1077
  {
1073
1078
  "$ref": "#/definitions/OpenScreenInScreenViewer"
1074
1079
  }
@@ -3,10 +3,10 @@ export class IoBrokerWebuiDialog extends BaseCustomWebComponentConstructorAppend
3
3
  container;
4
4
  uniqueId;
5
5
  static template = html `
6
- <div id="root" class="dialog-box">
7
- <h3 id="head" class="dialog-title">&nbsp;</h3>
8
- <a id="close" href="javascript:;" class="dialog-close" title="Close">&times;</a>
9
- <div id="content" class="dialog-content"></div>
6
+ <div id="root" part="box" class="dialog-box">
7
+ <h3 id="head" part="head" class="dialog-title">&nbsp;</h3>
8
+ <a id="close" part="close" href="javascript:;" class="dialog-close" title="Close">&times;</a>
9
+ <div id="content" part="content" class="dialog-content"></div>
10
10
  </div>`;
11
11
  static style = css `
12
12
  #root {
@@ -146,6 +146,9 @@ export class IoBrokerWebuiDialog extends BaseCustomWebComponentConstructorAppend
146
146
  if (options.closeable === false || options.closeable === true) {
147
147
  dlg.closeable = options.closeable;
148
148
  }
149
+ if (options.cssClass) {
150
+ dlg.className = options.cssClass;
151
+ }
149
152
  document.getElementById('overlayLayer').appendChild(dlg);
150
153
  return uniqueId;
151
154
  }
@@ -14,6 +14,18 @@ let ScreenViewer = class ScreenViewer extends BaseCustomWebComponentConstructorA
14
14
  display: block;
15
15
  }
16
16
 
17
+ *[node-projects-hide-at-run-time] {
18
+ display: none !important;
19
+ }`;
20
+ static styleIfFromScreen = css `
21
+ :host {
22
+ background: transparent;
23
+ border: none;
24
+ transform: none;
25
+ padding: 0;
26
+ margin: 0;
27
+ }
28
+
17
29
  *[node-projects-hide-at-run-time] {
18
30
  display: none !important;
19
31
  }`;
@@ -179,22 +191,7 @@ let ScreenViewer = class ScreenViewer extends BaseCustomWebComponentConstructorA
179
191
  else
180
192
  this._rootShadow.adoptedStyleSheets = [ScreenViewer_1.style];
181
193
  if (this._useStyleFromScreenForViewer) {
182
- this.shadowRoot.adoptedStyleSheets = this._rootShadow.adoptedStyleSheets;
183
- this._root.style.setProperty('background', 'transparent', 'important');
184
- this._root.style.setProperty('border', 'none', 'important');
185
- this._root.style.setProperty('transform', 'none', 'important');
186
- this._root.style.setProperty('padding', '0', 'important');
187
- this._root.style.setProperty('margin', '0', 'important');
188
- this.style.setProperty('display', 'block', 'important');
189
- }
190
- else {
191
- this.shadowRoot.adoptedStyleSheets = [];
192
- this._root.style.removeProperty('background');
193
- this._root.style.removeProperty('border');
194
- this._root.style.removeProperty('transform');
195
- this._root.style.removeProperty('padding');
196
- this._root.style.removeProperty('margin');
197
- this.style.removeProperty('display');
194
+ this.shadowRoot.adoptedStyleSheets = [ScreenViewer_1.styleIfFromScreen, ...this._rootShadow.adoptedStyleSheets];
198
195
  }
199
196
  let myDocument;
200
197
  //@ts-ignore
@@ -36,6 +36,7 @@ export class IobrokerWebuiScriptSystem extends ScriptSystem {
36
36
  const title = await this.getValue(command.title, context);
37
37
  const moveable = await this.getValue(command.moveable, context);
38
38
  const closeable = await this.getValue(command.closeable, context);
39
+ const cssClass = await this.getValue(command.cssClass, context);
39
40
  let width = await this.getValue(command.width, context);
40
41
  let height = await this.getValue(command.height, context);
41
42
  const left = await this.getValue(command.left, context);
@@ -47,7 +48,7 @@ export class IobrokerWebuiScriptSystem extends ScriptSystem {
47
48
  width = await (await iobrokerHandler.getWebuiObject('screen', screen)).settings.width;
48
49
  if (!height)
49
50
  height = await (await iobrokerHandler.getWebuiObject('screen', screen)).settings.height;
50
- IoBrokerWebuiDialog.openDialog({ title, content: sv, moveable, closeable, width, height, top, left });
51
+ IoBrokerWebuiDialog.openDialog({ title, content: sv, moveable, closeable, width, height, top, left, cssClass });
51
52
  break;
52
53
  }
53
54
  default: {
package/www/index.html CHANGED
@@ -218,7 +218,7 @@
218
218
  </button>
219
219
  <button data-command="save" title="save" disabled><img src="./node_modules/@node-projects/web-component-designer/assets/icons/save.svg"></button>
220
220
  <div style="margin-left: 30px;">
221
- webui - 1.25.1 - b3caac3
221
+ webui - 1.26.0 - 9c446b2
222
222
  </div>
223
223
  <button style="margin-left: 30px;" data-command="paste" title="paste" disabled><img
224
224
  src="./node_modules/@node-projects/web-component-designer/assets/icons/paste.svg"></button>
@@ -252,7 +252,7 @@ const $d708735ed1303b43$export$98e6a39c04603d36 = (css, options)=>{
252
252
  // :
253
253
  if (!match(/^:\s*/)) return error("property missing ':'");
254
254
  // val
255
- const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/);
255
+ const val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|[^)])*?\)|[^};])+)/);
256
256
  const ret = pos({
257
257
  type: (0, $b2e137848b48cf4f$export$9be5dd6e61d5d73a).declaration,
258
258
  property: propValue.replace($d708735ed1303b43$var$commentre, ''),
@@ -854,12 +854,12 @@ export class AdminConnection extends Connection {
854
854
  clearNotifications(host, category) {
855
855
  return this.request({
856
856
  executor: (resolve, reject, timeout) => {
857
- this._socket.emit('sendToHost', host, 'clearNotifications', { category }, notifications => {
857
+ this._socket.emit('sendToHost', host, 'clearNotifications', { category }, result => {
858
858
  if (timeout.elapsed) {
859
859
  return;
860
860
  }
861
861
  timeout.clearTimeout();
862
- resolve(notifications);
862
+ resolve(result);
863
863
  });
864
864
  },
865
865
  });
@@ -941,7 +941,8 @@ export class AdminConnection extends Connection {
941
941
  return;
942
942
  }
943
943
  timeout.clearTimeout();
944
- resolve(res.json());
944
+ const result = await res.json();
945
+ resolve(result);
945
946
  }
946
947
  catch (e) {
947
948
  reject(`getCurrentSession: ${e}`);
@@ -964,7 +965,9 @@ export class AdminConnection extends Connection {
964
965
  if (err) {
965
966
  reject(err);
966
967
  }
967
- resolve(namespace);
968
+ else {
969
+ resolve(namespace);
970
+ }
968
971
  });
969
972
  },
970
973
  });
@@ -1,5 +1,59 @@
1
1
  import type { ConnectionProps, LogMessage } from './ConnectionProps.js';
2
2
  import type { EmitEventHandler, ListenEventHandler, SocketClient } from './SocketClient.js';
3
+ export interface OAuth2Response {
4
+ /** The access token */
5
+ access_token: string;
6
+ /** The time in seconds when the access token expires, e.g., 3600 for 1 hour */
7
+ expires_in: number;
8
+ /** The type of the token */
9
+ token_type: 'Bearer' | 'JWT';
10
+ /** The refresh token */
11
+ refresh_token: string;
12
+ /** The time in seconds when the refresh token expires, e.g., 600 for 10 minutes */
13
+ refresh_token_expires_in: number;
14
+ }
15
+ export interface StoredTokens {
16
+ refresh_token: string;
17
+ access_token: string;
18
+ expires_in: Date;
19
+ refresh_token_expires_in: Date;
20
+ stayLoggedIn: boolean;
21
+ owner: string | undefined;
22
+ }
23
+ export interface SocketACL {
24
+ user: `system.user.${string}` | '';
25
+ groups: `system.group.${string}`[];
26
+ object?: {
27
+ read: boolean;
28
+ list: boolean;
29
+ write: boolean;
30
+ delete: boolean;
31
+ };
32
+ state?: {
33
+ list: boolean;
34
+ read: boolean;
35
+ write: boolean;
36
+ delete: boolean;
37
+ create: boolean;
38
+ };
39
+ users?: {
40
+ create: boolean;
41
+ delete: boolean;
42
+ write: boolean;
43
+ };
44
+ other?: {
45
+ http: boolean;
46
+ execute: boolean;
47
+ sendto: boolean;
48
+ };
49
+ file?: {
50
+ list: boolean;
51
+ create: boolean;
52
+ write: boolean;
53
+ read: boolean;
54
+ delete: boolean;
55
+ };
56
+ }
3
57
  /** Possible progress states. */
4
58
  export declare enum PROGRESS {
5
59
  /** The socket is connecting. */
@@ -67,6 +121,8 @@ export declare class Connection<CustomListenEvents extends Record<keyof CustomLi
67
121
  constructor(props: Partial<ConnectionProps>);
68
122
  private applyDefaultProps;
69
123
  private readonly props;
124
+ readonly connId: string;
125
+ private lastAccessToken;
70
126
  private ignoreState;
71
127
  private connected;
72
128
  private subscribed;
@@ -79,7 +135,7 @@ export declare class Connection<CustomListenEvents extends Record<keyof CustomLi
79
135
  private readonly objectsSubscribes;
80
136
  private objects;
81
137
  private states;
82
- acl: any;
138
+ acl: SocketACL | null;
83
139
  isSecure: boolean;
84
140
  onReadyDone: boolean;
85
141
  private readonly onConnectionHandlers;
@@ -96,7 +152,8 @@ export declare class Connection<CustomListenEvents extends Record<keyof CustomLi
96
152
  private _instanceSubscriptions;
97
153
  /** Cache for server requests */
98
154
  private readonly _promises;
99
- protected _authTimer: any;
155
+ protected _authTimer: ReturnType<typeof setTimeout> | null;
156
+ protected _refreshTimer: ReturnType<typeof setTimeout> | null;
100
157
  protected _systemConfig?: ioBroker.SystemConfigObject;
101
158
  /** The "system.config" object */
102
159
  get systemConfig(): Readonly<ioBroker.SystemConfigObject> | undefined;
@@ -117,6 +174,29 @@ export declare class Connection<CustomListenEvents extends Record<keyof CustomLi
117
174
  * Called internally.
118
175
  */
119
176
  private onPreConnect;
177
+ static readTokens(): StoredTokens | null;
178
+ static saveTokensStatic(data: OAuth2Response, stayLoggedIn: boolean, owner?: string): void;
179
+ saveTokens(data: OAuth2Response, stayLoggedIn: boolean): void;
180
+ static deleteTokensStatic(): void;
181
+ /**
182
+ * Destroy tokens if they were created by this connection if they expired or invalid
183
+ *
184
+ * @param stayLoggedIn if stored in localStorage or in sessionStorage
185
+ * @param logout if logout is requested
186
+ */
187
+ deleteTokens(stayLoggedIn: boolean, logout?: boolean): void;
188
+ private onAccessTokenUpdated;
189
+ private updateTokenExpiration;
190
+ private refreshTokens;
191
+ /**
192
+ * Attempts to acquire the semaphore lock.
193
+ *
194
+ * @returns True if the lock was acquired successfully; otherwise, false.
195
+ */
196
+ acquireTokenLock(): boolean;
197
+ /** Releases the semaphore lock if it's owned by the given connection ID. */
198
+ releaseTokenLock(): void;
199
+ private checkAccessTokenExpire;
120
200
  /**
121
201
  * Checks if running in ioBroker cloud
122
202
  */