@iobroker/socket-classes 0.1.9 → 0.2.1

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
@@ -69,6 +69,15 @@ io.close();
69
69
  -->
70
70
 
71
71
  ## Changelog
72
+ ### 0.2.1 (2022-05-12)
73
+ * (bluefox) fixed `getObjects` command
74
+
75
+ ### 0.2.0 (2022-05-09)
76
+ * (bluefox) fixed `delObjects` command
77
+
78
+ ### 0.1.10 (2022-05-09)
79
+ * (bluefox) Added support for fileChanges
80
+
72
81
  ### 0.1.9 (2022-05-07)
73
82
  * (bluefox) Corrected readLogs command and implement file subscriptions
74
83
 
@@ -1,6 +1,7 @@
1
1
  const SocketCommands = require('./socketCommands');
2
2
  const axios = require('axios');
3
3
  const path = require('path');
4
+ const fs = require('fs');
4
5
 
5
6
  class SocketCommandsAdmin extends SocketCommands {
6
7
  static ALLOW_CACHE = [
@@ -1070,7 +1071,19 @@ class SocketCommandsAdmin extends SocketCommands {
1070
1071
  options = {};
1071
1072
  }
1072
1073
  options.user = socket._acl.user;
1073
- options.recursive = true;
1074
+ // options.recursive = true; // the only difference between delObject and delObjects is this line
1075
+ this.adapter.delForeignObject(id, options, (err, ...args) =>
1076
+ SocketCommands._fixCallback(callback, err, ...args));
1077
+ }
1078
+ };
1079
+
1080
+ this.commands['delObjects'] = (socket, id, options, callback) => {
1081
+ if (this._checkPermissions(socket, 'delObject', callback, id)) {
1082
+ if (!options || typeof options !== 'object') {
1083
+ options = {};
1084
+ }
1085
+ options.user = socket._acl.user;
1086
+ options.recursive = true; // the only difference between delObject and delObjects is this line
1074
1087
  this.adapter.delForeignObject(id, options, (err, ...args) =>
1075
1088
  SocketCommands._fixCallback(callback, err, ...args));
1076
1089
  }
@@ -1098,9 +1111,10 @@ class SocketCommandsAdmin extends SocketCommands {
1098
1111
  __initCommandsObjects() {
1099
1112
  super.__initCommandsObjects();
1100
1113
 
1101
- this.commands['getAllObjects'] = (socket, callback) => {
1102
- return this._getAllObjects(socket, callback);
1103
- };
1114
+ this.commands['getAllObjects'] = (socket, callback) => this._getAllObjects(socket, callback);
1115
+
1116
+ // Identical to getAllObjects
1117
+ this.commands['getObjects'] = (socket, callback) => this._getAllObjects(socket, callback);
1104
1118
 
1105
1119
  this.commands['extendObject'] = (socket, id, obj, callback) => {
1106
1120
  if (this._checkPermissions(socket, 'extendObject', callback, id)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/socket-classes",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "ioBroker server-side web sockets",
5
5
  "author": {
6
6
  "name": "bluefox",