@iobroker/socket-classes 1.0.1 → 1.0.2

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
@@ -882,6 +882,9 @@ Read all instances of the given adapter, or all instances of all adapters if ada
882
882
  -->
883
883
 
884
884
  ## Changelog
885
+ ### 1.0.2 (2022-11-08)
886
+ * (bluefox) Function `getObjects`for web was extended by devices, channels and enums
887
+
885
888
  ### 1.0.1 (2022-10-10)
886
889
  * (bluefox) Fixed error with delObject
887
890
 
@@ -1372,18 +1372,28 @@ class SocketCommands {
1372
1372
  // @param {function} callback - `function (error, obj)`
1373
1373
  if (this._checkPermissions(socket, 'getObjects', callback)) {
1374
1374
  try {
1375
- this.adapter.getForeignObjects('*', 'state', 'rooms', {user: socket._acl.user}, (error, objs) => {
1376
- if (typeof callback === 'function') {
1375
+ if (typeof callback === 'function') {
1376
+ this.adapter.getForeignObjects('*', 'state', 'rooms', {user: socket._acl.user}, async (error, objs) => {
1377
+ try {
1378
+ const channels = await this.adapter.getForeignObjectsAsync('*', 'channel', null, {user: socket._acl.user});
1379
+ const devices = await this.adapter.getForeignObjectsAsync('*', 'device', null, {user: socket._acl.user});
1380
+ const enums = await this.adapter.getForeignObjectsAsync('*', 'enum', null, {user: socket._acl.user});
1381
+ const config = await this.adapter.getForeignObjectAsync('system.config', {user: socket._acl.user});
1382
+ Object.assign(objs, channels, devices, enums);
1383
+ objs['system.config'] = config;
1384
+ } catch (e) {
1385
+ this.adapter.log.error('[getObjects] ERROR: ' + e.toString());
1386
+ }
1377
1387
  // overload language
1378
1388
  if (this.adapter._language && objs['system.config'] && objs['system.config'].common) {
1379
1389
  objs['system.config'].common.language = this.adapter._language;
1380
1390
  }
1381
1391
 
1382
1392
  SocketCommands._fixCallback(callback, error, objs);
1383
- } else {
1384
- this.adapter.log.warn('[getObjects] Invalid callback');
1385
- }
1386
- });
1393
+ });
1394
+ } else {
1395
+ this.adapter.log.warn('[getObjects] Invalid callback');
1396
+ }
1387
1397
  } catch (error) {
1388
1398
  this.adapter.log.error('[getObjects] ERROR: ' + error.toString());
1389
1399
  SocketCommands._fixCallback(callback, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/socket-classes",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "ioBroker server-side web sockets",
5
5
  "author": {
6
6
  "name": "bluefox",
@@ -31,8 +31,8 @@
31
31
  "@alcalzone/release-script-plugin-license": "^3.5.9",
32
32
  "iobroker.js-controller": "dev",
33
33
  "gulp": "^4.0.2",
34
- "chai": "^4.3.6",
35
- "mocha": "^10.0.0"
34
+ "chai": "^4.3.7",
35
+ "mocha": "^10.1.0"
36
36
  },
37
37
  "bugs": {
38
38
  "url": "https://github.com/ioBroker/ioBroker.web/issues"