@iobroker/dm-utils 3.0.0 → 3.0.3

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
@@ -131,7 +131,7 @@ Every item is an object of type `DeviceInfo` which has the following properties:
131
131
  - `identifier` (optional): a human-readable identifier of the device
132
132
  - `name` (string or translations): the human-readable name of this device
133
133
  - `status` (optional): the current status of the device, which has to be an object containing:
134
- - `connection` (string): alowed values are: `"connected"` / `"disconnected"`
134
+ - `connection` (string): allowed values are: `"connected"` / `"disconnected"`
135
135
  - `rssi` (number): rssi value of the connection
136
136
  - `battery` (boolean / number): if boolean: false - the battery is empty. If number: the battery level of the device (shows also a battery symbol on the card)
137
137
  - `warning` (boolean / string): if boolean: true indicates a warning. If a string: shows also the warning with mouseover
@@ -214,6 +214,9 @@ The returned object must contain:
214
214
  - `"device"`: if you want the device details to be reloaded after this action
215
215
  - `"instance"`: if you want the entire device list to be reloaded after this action
216
216
  - `false`: if you don't want anything to be refreshed (important: this is a boolean, not a string!)
217
+ or
218
+ - `url` (string) This URL must be opened
219
+ - `target` (string) Target window for url (`_blank` is default)
217
220
 
218
221
  This method can be implemented asynchronously and can take a lot of time to complete.
219
222
 
@@ -361,14 +364,14 @@ class MyAdapterDeviceManagement extends DeviceManagement<MyAdapter> {
361
364
  }
362
365
  ```
363
366
 
364
- ## Migration from 1.x to 2.x
367
+ ## Migration from 2.x to 3.x
365
368
 
366
- Between versions 1.x and 2.x, there are some breaking changes. Please also have a look at the changelog below for more information.
369
+ Between versions 2.x and 3.x, there are some breaking changes. Please also have a look at the changelog below for more information.
367
370
 
368
371
  ### Incremental loading of devices
369
372
 
370
- In version 1.x, the `listDevices()` method had to return the full list of devices.
371
- In version 2.x, this method was replaced by `loadDevices(context: DeviceLoadContext)` that allows incremental loading of devices.
373
+ In versions 1.x and 2.x, the `listDevices()` method had to return the full list of devices.
374
+ In version 3.x, this method was replaced by `loadDevices(context: DeviceLoadContext)` that allows incremental loading of devices.
372
375
 
373
376
  Instead of creating and returning an array of `DeviceInfo` objects, you have to call `context.addDevice(deviceInfo)` for each device you want to add to the list.
374
377
 
@@ -376,14 +379,14 @@ You may also call `context.setTotalDevices(count: number)` as soon as possible t
376
379
 
377
380
  ### Refresh response of device actions
378
381
 
379
- In version 2.x, the refresh response of device actions has changed.
382
+ In version 3.x, the refresh response of device actions has changed.
380
383
 
381
- | Version 1.x | Version 2.x | Description |
382
- | ------------ | ------------ | --------------------------------------------------------------------------- |
383
- | `true` | `'all'` | the instance information as well as the entire device list will be reloaded |
384
- | `false` | `'none'` | nothing will be reloaded |
385
- | `'device'` | `'devices'` | the entire device list will be reloaded |
386
- | `'instance'` | `'instance'` | (unchanged) only the instance information will be reloaded |
384
+ | Version 1.x/2.x | Version 3.x | Description |
385
+ |-----------------|--------------|-----------------------------------------------------------------------------|
386
+ | `true` | `'all'` | the instance information as well as the entire device list will be reloaded |
387
+ | `false` | `'none'` | nothing will be reloaded |
388
+ | `'device'` | `'devices'` | the entire device list will be reloaded |
389
+ | `'instance'` | `'instance'` | (unchanged) only the instance information will be reloaded |
387
390
 
388
391
  ## Changelog
389
392
 
@@ -391,7 +394,7 @@ In version 2.x, the refresh response of device actions has changed.
391
394
  Placeholder for the next version (at the beginning of the line):
392
395
  ### **WORK IN PROGRESS**
393
396
  -->
394
- ### 3.0.0 (2026-03-01)
397
+ ### 3.0.3 (2026-03-26)
395
398
 
396
399
  - (@UncleSamSwiss) Enabled incremental loading of devices
397
400
  - (@UncleSamSwiss) Removed direct access to `DeviceManagement.handleXxx()` methods (use `handler` and similar properties instead)
@@ -520,7 +520,7 @@ function convertActions(actions) {
520
520
  }
521
521
  ids.add(a.id);
522
522
  });
523
- // remove handler function to send it as JSON
523
+ // remove a handler function to send it as JSON
524
524
  return actions.map((a) => (Object.assign(Object.assign({}, a), { handler: undefined, disabled: !a.handler && !a.url })));
525
525
  }
526
526
  function convertControls(controls) {
package/build/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export type * from './ActionContext';
2
2
  export * from './DeviceManagement';
3
- export * from './types';
3
+ export type * from './types';
package/build/index.js CHANGED
@@ -15,5 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./DeviceManagement"), exports);
18
- // don't export * from "./MessageContext" as it is private
19
- __exportStar(require("./types"), exports);
@@ -49,7 +49,7 @@ export interface CommunicationForm {
49
49
  maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
50
50
  /** Minimal width of the dialog */
51
51
  minWidth?: number;
52
- /** Always allow the apply button. Even when nothing was changed */
52
+ /** Always allow the Apply button. Even when nothing was changed */
53
53
  ignoreApplyDisabled?: boolean;
54
54
  }
55
55
  export type DmActionFormResponse = DmResponseBase & {
@@ -5,9 +5,9 @@ export type Color = 'primary' | 'secondary' | (string & {});
5
5
  export type ControlState = string | number | boolean | null;
6
6
  /** Reserved action names */
7
7
  export declare const ACTIONS: {
8
- /** This action will be called when user clicks on connection icon */
8
+ /** This action will be called when the user clicks on the connection icon */
9
9
  STATUS: string;
10
- /** This action will be called when the user clicks on enabled/disabled icon. The enabled/disabled icon will be shown only if the node status has "enabled" flag set to false or true */
10
+ /** This action will be called when the user clicks on the enabled / disabled icon. The enabled/disabled icon will be shown only if the node status has the "enabled" flag set to false or true */
11
11
  ENABLE_DISABLE: string;
12
12
  };
13
13
  export interface ActionBase<T extends ActionType> {
@@ -117,7 +117,7 @@ export interface InstanceDetails<T extends ActionType = 'api'> {
117
117
  identifierLabel?: ioBroker.StringOrTranslated;
118
118
  }
119
119
  export interface DeviceInfo<T extends ActionType = 'api', TId extends DeviceId = DeviceId> {
120
- /** ID of the device. Must be unique only in one adapter. Other adapters could have same IDs */
120
+ /** ID of the device. Must be unique only in one adapter. Other adapters could have the same IDs */
121
121
  id: TId;
122
122
  /** Human-readable identifier of the device */
123
123
  identifier?: ValueOrObject<string>;
@@ -134,7 +134,7 @@ export interface DeviceInfo<T extends ActionType = 'api', TId extends DeviceId =
134
134
  status?: DeviceStatus | DeviceStatus[];
135
135
  /** Connection type, how the device is connected */
136
136
  connectionType?: ValueOrStateOrObject<ConfigConnectionType>;
137
- /** If this flag is true or false, the according indication will be shown. Additionally, if ACTIONS.ENABLE_DISABLE is implemented, this action will be sent to backend by clicking on this indication */
137
+ /** If this flag is true or false, the according indication will be shown. Additionally, if ACTIONS.ENABLE_DISABLE is implemented, this action will be sent to the backend by clicking on this indication */
138
138
  enabled?: ValueOrState<boolean>;
139
139
  /** List of actions on the card */
140
140
  actions?: DeviceAction<T, TId>[];
@@ -150,19 +150,19 @@ export interface DeviceInfo<T extends ActionType = 'api', TId extends DeviceId =
150
150
  };
151
151
  }
152
152
  export interface BackendToGuiCommandDeviceInfoUpdate<TId extends DeviceId = DeviceId> {
153
- /** Used for updating and for adding new device */
153
+ /** Used for updating and for adding a new device */
154
154
  command: 'infoUpdate';
155
155
  /** Device ID */
156
156
  deviceId: TId;
157
- /** Backend can send directly new information about device to avoid extra request from GUI */
157
+ /** Backend can directly send new information about a device to avoid extra request from GUI */
158
158
  info?: DeviceInfo;
159
159
  }
160
160
  export interface BackendToGuiCommandDeviceStatusUpdate<TId extends DeviceId = DeviceId> {
161
- /** Status of device was updated */
161
+ /** Status of a device was updated */
162
162
  command: 'statusUpdate';
163
163
  /** Device ID */
164
164
  deviceId: TId;
165
- /** Backend can send directly new status to avoid extra request from GUI */
165
+ /** Backend can directly send new status to avoid extra request from GUI */
166
166
  status?: DeviceStatus;
167
167
  }
168
168
  export interface BackendToGuiCommandDeviceDelete<TId extends DeviceId = DeviceId> {
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ACTIONS = void 0;
4
4
  /** Reserved action names */
5
5
  exports.ACTIONS = {
6
- /** This action will be called when user clicks on connection icon */
6
+ /** This action will be called when the user clicks on the connection icon */
7
7
  STATUS: 'status',
8
- /** This action will be called when the user clicks on enabled/disabled icon. The enabled/disabled icon will be shown only if the node status has "enabled" flag set to false or true */
8
+ /** This action will be called when the user clicks on the enabled / disabled icon. The enabled/disabled icon will be shown only if the node status has the "enabled" flag set to false or true */
9
9
  ENABLE_DISABLE: 'enable/disable',
10
10
  };
@@ -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
+ export { ACTIONS, type ChannelInfo, type Color, type ControlBase, type ControlState, type BackendToGuiCommand, type BackendToGuiCommandAllUpdate, type BackendToGuiCommandDeviceDelete, type BackendToGuiCommandDeviceStatusUpdate, type BackendToGuiCommandDeviceInfoUpdate, type DeviceRefresh, } from './base';
3
3
  export type * from './common';
4
4
  export * from './errorCodes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-utils",
3
- "version": "3.0.0",
3
+ "version": "3.0.3",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {
@@ -34,7 +34,7 @@
34
34
  "@alcalzone/release-script": "^5.1.1",
35
35
  "@alcalzone/release-script-plugin-license": "^5.1.1",
36
36
  "@iobroker/eslint-config": "^2.2.0",
37
- "@types/node": "^25.3.3",
37
+ "@types/node": "^25.5.0",
38
38
  "axios": "^1.13.6",
39
39
  "typescript": "~5.9.3"
40
40
  },