@iobroker/adapter-react-v5 4.0.21 → 4.0.23

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.
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports["default"] = exports.PROGRESS = exports.ERRORS = void 0;
8
8
  exports.pattern2RegEx = pattern2RegEx;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
10
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
13
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -140,6 +141,8 @@ var Connection = /*#__PURE__*/function () {
140
141
 
141
142
  /** @type {Record<string, Promise<any>>} */
142
143
  this._promises = {};
144
+ this.ignoreState = '';
145
+ this.simStates = {};
143
146
  this.log.error = function (text) {
144
147
  return _this.log(text, 'error');
145
148
  };
@@ -242,10 +245,11 @@ var Connection = /*#__PURE__*/function () {
242
245
  }
243
246
  var url = port ? "".concat(protocol, "://").concat(host, ":").concat(port).concat(path) : "".concat(protocol, "://").concat(host).concat(path);
244
247
  this._socket = window.io.connect(url, {
245
- path: path.endsWith('/') ? path + 'socket.io' : path + '/socket.io',
248
+ path: path.endsWith('/') ? "".concat(path, "socket.io") : "".concat(path, "/socket.io"),
246
249
  query: 'ws=true',
247
250
  name: this.props.name,
248
- timeout: this.props.ioTimeout
251
+ timeout: this.props.ioTimeout,
252
+ uuid: this.props.uuid
249
253
  });
250
254
  this._socket.on('connect', function (noTimeout) {
251
255
  // If the user is not admin it takes some time to install the handlers, because all rights must be checked
@@ -444,7 +448,7 @@ var Connection = /*#__PURE__*/function () {
444
448
  var _this4 = this;
445
449
  this._getUserPermissions(function (err, acl) {
446
450
  if (err) {
447
- return _this4.onError('Cannot read user permissions: ' + err);
451
+ return _this4.onError("Cannot read user permissions: ".concat(err));
448
452
  } else if (!_this4.doNotLoadACL) {
449
453
  if (_this4.loaded) {
450
454
  return;
@@ -474,8 +478,9 @@ var Connection = /*#__PURE__*/function () {
474
478
  _this4.systemLang = _this4.systemConfig.common.language;
475
479
  } else {
476
480
  _this4.systemLang = window.navigator.userLanguage || window.navigator.language;
477
- if (_this4.systemLang !== 'en' && _this4.systemLang !== 'de' && _this4.systemLang !== 'ru') {
478
- _this4.systemConfig.common.language = 'en';
481
+ if (/^(en|de|ru|pt|nl|fr|it|es|pl|uk)-?/.test(_this4._systemLang)) {
482
+ _this4.systemLang = _this4._systemLang.substr(0, 2);
483
+ } else if (!/^(en|de|ru|pt|nl|fr|it|es|pl|uk|zh-cn)$/.test(_this4._systemLang)) {
479
484
  _this4.systemLang = 'en';
480
485
  }
481
486
  }
@@ -494,7 +499,7 @@ var Connection = /*#__PURE__*/function () {
494
499
  }
495
500
  return undefined;
496
501
  })["catch"](function (e) {
497
- return _this4.onError('Cannot read system config: ' + e);
502
+ return _this4.onError("Cannot read system config: ".concat(e));
498
503
  });
499
504
  });
500
505
  }
@@ -542,7 +547,9 @@ var Connection = /*#__PURE__*/function () {
542
547
  };
543
548
  this.statesSubscribes[id].cbs.push(cb);
544
549
  if (this.connected) {
545
- this._socket.emit('subscribe', id);
550
+ if (this.connected && id !== this.ignoreState) {
551
+ this._socket.emit('subscribe', id);
552
+ }
546
553
  }
547
554
  } else {
548
555
  !this.statesSubscribes[id].cbs.includes(cb) && this.statesSubscribes[id].cbs.push(cb);
@@ -595,7 +602,9 @@ var Connection = /*#__PURE__*/function () {
595
602
  }
596
603
  if (!this.statesSubscribes[id].cbs || !this.statesSubscribes[id].cbs.length) {
597
604
  delete this.statesSubscribes[id];
598
- this.connected && this._socket.emit('unsubscribe', id);
605
+ if (this.connected && id !== this.ignoreState) {
606
+ this._socket.emit('unsubscribe', id);
607
+ }
599
608
  }
600
609
  }
601
610
  }
@@ -672,7 +681,11 @@ var Connection = /*#__PURE__*/function () {
672
681
  try {
673
682
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
674
683
  var cb = _step.value;
675
- cb(id, fileName, size);
684
+ try {
685
+ cb(id, fileName, size);
686
+ } catch (e) {
687
+ console.error("Error by callback of fileChange: ".concat(e));
688
+ }
676
689
  }
677
690
  } catch (err) {
678
691
  _iterator.e(err);
@@ -794,7 +807,11 @@ var Connection = /*#__PURE__*/function () {
794
807
  if (_id === id || _this5.objectsSubscribes[_id].reg.test(id)) {
795
808
  //@ts-ignore
796
809
  _this5.objectsSubscribes[_id].cbs.forEach(function (cb) {
797
- return cb(id, obj, oldObj);
810
+ try {
811
+ cb(id, obj, oldObj);
812
+ } catch (e) {
813
+ console.error("Error by callback of objectChange: ".concat(e));
814
+ }
798
815
  });
799
816
  }
800
817
  });
@@ -815,7 +832,11 @@ var Connection = /*#__PURE__*/function () {
815
832
  for (var task in this.statesSubscribes) {
816
833
  if (this.statesSubscribes.hasOwnProperty(task) && this.statesSubscribes[task].reg.test(id)) {
817
834
  this.statesSubscribes[task].cbs.forEach(function (cb) {
818
- return cb(id, state);
835
+ try {
836
+ cb(id, state);
837
+ } catch (e) {
838
+ console.error("Error by callback of stateChange: ".concat(e));
839
+ }
819
840
  });
820
841
  }
821
842
  }
@@ -855,6 +876,12 @@ var Connection = /*#__PURE__*/function () {
855
876
  if (!this.connected) {
856
877
  return Promise.reject(NOT_CONNECTED);
857
878
  }
879
+ if (id && id === this.ignoreState) {
880
+ return Promise.resolve(this.simStates[id] || {
881
+ val: null,
882
+ ack: true
883
+ });
884
+ }
858
885
  return new Promise(function (resolve, reject) {
859
886
  return _this7._socket.emit('getState', id, function (err, state) {
860
887
  return err ? reject(err) : resolve(state);
@@ -863,6 +890,7 @@ var Connection = /*#__PURE__*/function () {
863
890
  }
864
891
 
865
892
  /**
893
+ * @deprecated since js-controller 5.0. Use files instead.
866
894
  * Gets the given binary state.
867
895
  * @param {string} id The state ID.
868
896
  * @returns {Promise<Buffer | undefined>}
@@ -884,6 +912,7 @@ var Connection = /*#__PURE__*/function () {
884
912
  }
885
913
 
886
914
  /**
915
+ * @deprecated since js-controller 5.0. Use files instead.
887
916
  * Sets the given binary state.
888
917
  * @param {string} id The state ID.
889
918
  * @param {string} base64 The Base64 encoded binary data.
@@ -925,6 +954,46 @@ var Connection = /*#__PURE__*/function () {
925
954
  ack: ack
926
955
  };
927
956
  }
957
+
958
+ // extra handling for "nothing_selected" state for vis
959
+ if (id && id === this.ignoreState) {
960
+ var state;
961
+ if (typeof ack === 'boolean') {
962
+ state = val;
963
+ } else if ((0, _typeof2["default"])(val) === 'object' && val.val !== undefined) {
964
+ state = val;
965
+ } else {
966
+ state = {
967
+ val: val,
968
+ ack: false,
969
+ ts: Date.now(),
970
+ lc: Date.now(),
971
+ from: 'system.adapter.vis.0'
972
+ };
973
+ }
974
+ this.simStates[id] = state;
975
+
976
+ // inform subscribers about changes
977
+ if (this.statesSubscribes[id]) {
978
+ var _iterator2 = _createForOfIteratorHelper(this.statesSubscribes[id].cbs),
979
+ _step2;
980
+ try {
981
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
982
+ var cb = _step2.value;
983
+ try {
984
+ cb(id, state);
985
+ } catch (e) {
986
+ console.error("Error by callback of stateChanged: ".concat(e));
987
+ }
988
+ }
989
+ } catch (err) {
990
+ _iterator2.e(err);
991
+ } finally {
992
+ _iterator2.f();
993
+ }
994
+ }
995
+ return Promise.resolve();
996
+ }
928
997
  return new Promise(function (resolve, reject) {
929
998
  return _this10._socket.emit('setState', id, val, function (err) {
930
999
  return err ? reject(err) : resolve();
@@ -1114,6 +1183,16 @@ var Connection = /*#__PURE__*/function () {
1114
1183
  if (!this.connected) {
1115
1184
  return Promise.reject(NOT_CONNECTED);
1116
1185
  }
1186
+ if (id && id === this.ignoreState) {
1187
+ return Promise.resolve({
1188
+ _id: this.ignoreState,
1189
+ type: 'state',
1190
+ common: {
1191
+ name: 'ignored state',
1192
+ type: 'mixed'
1193
+ }
1194
+ });
1195
+ }
1117
1196
  return new Promise(function (resolve, reject) {
1118
1197
  return _this17._socket.emit('getObject', id, function (err, obj) {
1119
1198
  return err ? reject(err) : resolve(obj);
@@ -1141,16 +1220,16 @@ var Connection = /*#__PURE__*/function () {
1141
1220
  adapter = '';
1142
1221
  }
1143
1222
  adapter = adapter || '';
1144
- if (!update && this._promises['instances_' + adapter]) {
1145
- return this._promises['instances_' + adapter];
1223
+ if (!update && this._promises["instances_".concat(adapter)]) {
1224
+ return this._promises["instances_".concat(adapter)];
1146
1225
  }
1147
1226
  if (!this.connected) {
1148
1227
  return Promise.reject(NOT_CONNECTED);
1149
1228
  }
1150
- this._promises['instances_' + adapter] = new Promise(function (resolve, reject) {
1229
+ this._promises["instances_".concat(adapter)] = new Promise(function (resolve, reject) {
1151
1230
  var timeout = setTimeout(function () {
1152
1231
  timeout = null;
1153
- _this18.getObjectView("system.adapter.".concat(adapter ? adapter + '.' : ''), "system.adapter.".concat(adapter ? adapter + '.' : '', "\u9999"), 'instance').then(function (items) {
1232
+ _this18.getObjectView("system.adapter.".concat(adapter ? "".concat(adapter, ".") : ''), "system.adapter.".concat(adapter ? "".concat(adapter, ".") : '', "\u9999"), 'instance').then(function (items) {
1154
1233
  return resolve(Object.keys(items).map(function (id) {
1155
1234
  return fixAdminUI(items[id]);
1156
1235
  }));
@@ -1192,13 +1271,13 @@ var Connection = /*#__PURE__*/function () {
1192
1271
  adapter = '';
1193
1272
  }
1194
1273
  adapter = adapter || '';
1195
- if (!update && this._promises['adapter_' + adapter]) {
1196
- return this._promises['adapter_' + adapter];
1274
+ if (!update && this._promises["adapter_".concat(adapter)]) {
1275
+ return this._promises["adapter_".concat(adapter)];
1197
1276
  }
1198
1277
  if (!this.connected) {
1199
1278
  return Promise.reject(NOT_CONNECTED);
1200
1279
  }
1201
- this._promises['adapter_' + adapter] = new Promise(function (resolve, reject) {
1280
+ this._promises["adapter_".concat(adapter)] = new Promise(function (resolve, reject) {
1202
1281
  var timeout = setTimeout(function () {
1203
1282
  timeout = null;
1204
1283
  _this19.getObjectView("system.adapter.".concat(adapter, "."), "system.adapter.".concat(adapter, ".\u9999"), 'adapter').then(function (items) {
@@ -1217,7 +1296,7 @@ var Connection = /*#__PURE__*/function () {
1217
1296
  }
1218
1297
  });
1219
1298
  });
1220
- return this._promises['adapter_' + adapter];
1299
+ return this._promises["adapter_".concat(adapter)];
1221
1300
  }
1222
1301
 
1223
1302
  /**
@@ -1456,21 +1535,21 @@ var Connection = /*#__PURE__*/function () {
1456
1535
  key: "getEnums",
1457
1536
  value: function getEnums(_enum, update) {
1458
1537
  var _this24 = this;
1459
- if (!update && this._promises['enums_' + (_enum || 'all')]) {
1460
- return this._promises['enums_' + (_enum || 'all')];
1538
+ if (!update && this._promises["enums_".concat(_enum || 'all')]) {
1539
+ return this._promises["enums_".concat(_enum || 'all')];
1461
1540
  }
1462
1541
  if (!this.connected) {
1463
1542
  return Promise.reject(NOT_CONNECTED);
1464
1543
  }
1465
- this._promises['enums_' + (_enum || 'all')] = new Promise(function (resolve, reject) {
1544
+ this._promises["enums_".concat(_enum || 'all')] = new Promise(function (resolve, reject) {
1466
1545
  _this24._socket.emit('getObjectView', 'system', 'enum', {
1467
- startkey: 'enum.' + (_enum || ''),
1468
- endkey: 'enum.' + (_enum ? _enum + '.' : '') + "\u9999"
1546
+ startkey: "enum.".concat(_enum || ''),
1547
+ endkey: "enum.".concat(_enum ? _enum + '.' : '', "\u9999")
1469
1548
  }, function (err, res) {
1470
1549
  if (!err && res) {
1471
1550
  var _res = {};
1472
1551
  for (var i = 0; i < res.rows.length; i++) {
1473
- if (_enum && res.rows[i].id === 'enum.' + _enum) {
1552
+ if (_enum && res.rows[i].id === "enum.".concat(_enum)) {
1474
1553
  continue;
1475
1554
  }
1476
1555
  _res[res.rows[i].id] = res.rows[i].value;
@@ -1481,27 +1560,22 @@ var Connection = /*#__PURE__*/function () {
1481
1560
  }
1482
1561
  });
1483
1562
  });
1484
- return this._promises['enums_' + (_enum || 'all')];
1563
+ return this._promises["enums_".concat(_enum || 'all')];
1485
1564
  }
1486
1565
 
1487
1566
  /**
1488
1567
  * Query a predefined object view.
1489
- * @param {string} start The start ID.
1490
- * @param {string} end The end ID.
1491
- * @param {string} type The type of object.
1492
- * @returns {Promise<Record<string, ioBroker.Object>>}
1568
+ * @param design design - 'system' or other designs like `custom`.
1569
+ * @param type The type of object.
1570
+ * @param start The start ID.
1571
+ * @param [end] The end ID.
1493
1572
  */
1494
1573
  }, {
1495
- key: "getObjectView",
1496
- value: function getObjectView(start, end, type) {
1574
+ key: "getObjectViewCustom",
1575
+ value: function getObjectViewCustom(design, type, start, end) {
1497
1576
  var _this25 = this;
1498
- if (!this.connected) {
1499
- return Promise.reject(NOT_CONNECTED);
1500
- }
1501
- start = start || '';
1502
- end = end || "\u9999";
1503
1577
  return new Promise(function (resolve, reject) {
1504
- _this25._socket.emit('getObjectView', 'system', type, {
1578
+ _this25._socket.emit('getObjectView', design, type, {
1505
1579
  startkey: start,
1506
1580
  endkey: end
1507
1581
  }, function (err, res) {
@@ -1519,6 +1593,36 @@ var Connection = /*#__PURE__*/function () {
1519
1593
  });
1520
1594
  });
1521
1595
  }
1596
+ /**
1597
+ * Query a predefined object view.
1598
+ * @param type The type of object.
1599
+ * @param start The start ID.
1600
+ * @param [end] The end ID.
1601
+ */
1602
+ }, {
1603
+ key: "getObjectViewSystem",
1604
+ value: function getObjectViewSystem(type, start, end) {
1605
+ return this.getObjectViewCustom('system', type, start, end);
1606
+ }
1607
+
1608
+ /**
1609
+ * @deprecated since version 1.1.15, cause parameter order does not match backend
1610
+ * Query a predefined object view.
1611
+ * @param {string} start The start ID.
1612
+ * @param {string} end The end ID.
1613
+ * @param {string} type The type of object.
1614
+ * @returns {Promise<Record<string, ioBroker.Object>>}
1615
+ */
1616
+ }, {
1617
+ key: "getObjectView",
1618
+ value: function getObjectView(start, end, type) {
1619
+ if (!this.connected) {
1620
+ return Promise.reject(NOT_CONNECTED);
1621
+ }
1622
+ start = start || '';
1623
+ end = end || "\u9999";
1624
+ return this.getObjectViewCustom('system', type, start, end);
1625
+ }
1522
1626
 
1523
1627
  /**
1524
1628
  * Get the stored certificates.
@@ -1750,29 +1854,6 @@ var Connection = /*#__PURE__*/function () {
1750
1854
  });
1751
1855
  }
1752
1856
 
1753
- /**
1754
- * Rename a file or folder of an adapter.
1755
- *
1756
- * All files in folder will be renamed too.
1757
- * @param {string} adapter The adapter name.
1758
- * @param {string} oldName The file name of the file to be renamed.
1759
- * @param {string} newName The new file name.
1760
- * @returns {Promise<void>}
1761
- */
1762
- }, {
1763
- key: "rename",
1764
- value: function rename(adapter, oldName, newName) {
1765
- var _this33 = this;
1766
- if (!this.connected) {
1767
- return Promise.reject(NOT_CONNECTED);
1768
- }
1769
- return new Promise(function (resolve, reject) {
1770
- return _this33._socket.emit('rename', adapter, oldName, newName, function (err) {
1771
- return err ? reject(err) : resolve();
1772
- });
1773
- });
1774
- }
1775
-
1776
1857
  /**
1777
1858
  * Delete a file of an adapter.
1778
1859
  * @param {string} adapter The adapter name.
@@ -1782,12 +1863,12 @@ var Connection = /*#__PURE__*/function () {
1782
1863
  }, {
1783
1864
  key: "deleteFile",
1784
1865
  value: function deleteFile(adapter, fileName) {
1785
- var _this34 = this;
1866
+ var _this33 = this;
1786
1867
  if (!this.connected) {
1787
1868
  return Promise.reject(NOT_CONNECTED);
1788
1869
  }
1789
1870
  return new Promise(function (resolve, reject) {
1790
- return _this34._socket.emit('unlink', adapter, fileName, function (err) {
1871
+ return _this33._socket.emit('unlink', adapter, fileName, function (err) {
1791
1872
  return err ? reject(err) : resolve();
1792
1873
  });
1793
1874
  });
@@ -1803,12 +1884,12 @@ var Connection = /*#__PURE__*/function () {
1803
1884
  }, {
1804
1885
  key: "deleteFolder",
1805
1886
  value: function deleteFolder(adapter, folderName) {
1806
- var _this35 = this;
1887
+ var _this34 = this;
1807
1888
  if (!this.connected) {
1808
1889
  return Promise.reject(NOT_CONNECTED);
1809
1890
  }
1810
1891
  return new Promise(function (resolve, reject) {
1811
- return _this35._socket.emit('deleteFolder', adapter, folderName, function (err) {
1892
+ return _this34._socket.emit('deleteFolder', adapter, folderName, function (err) {
1812
1893
  return err ? reject(err) : resolve();
1813
1894
  });
1814
1895
  });
@@ -1822,7 +1903,7 @@ var Connection = /*#__PURE__*/function () {
1822
1903
  }, {
1823
1904
  key: "getHosts",
1824
1905
  value: function getHosts(update) {
1825
- var _this36 = this;
1906
+ var _this35 = this;
1826
1907
  if (Connection.isWeb()) {
1827
1908
  return Promise.reject('Allowed only in admin');
1828
1909
  }
@@ -1833,7 +1914,7 @@ var Connection = /*#__PURE__*/function () {
1833
1914
  return Promise.reject(NOT_CONNECTED);
1834
1915
  }
1835
1916
  this._promises.hosts = new Promise(function (resolve, reject) {
1836
- return _this36._socket.emit('getObjectView', 'system', 'host', {
1917
+ return _this35._socket.emit('getObjectView', 'system', 'host', {
1837
1918
  startkey: 'system.host.',
1838
1919
  endkey: "system.host.\u9999"
1839
1920
  }, function (err, doc) {
@@ -1857,7 +1938,7 @@ var Connection = /*#__PURE__*/function () {
1857
1938
  }, {
1858
1939
  key: "getUsers",
1859
1940
  value: function getUsers(update) {
1860
- var _this37 = this;
1941
+ var _this36 = this;
1861
1942
  if (Connection.isWeb()) {
1862
1943
  return Promise.reject('Allowed only in admin');
1863
1944
  }
@@ -1868,7 +1949,7 @@ var Connection = /*#__PURE__*/function () {
1868
1949
  return Promise.reject(NOT_CONNECTED);
1869
1950
  }
1870
1951
  this._promises.users = new Promise(function (resolve, reject) {
1871
- return _this37._socket.emit('getObjectView', 'system', 'user', {
1952
+ return _this36._socket.emit('getObjectView', 'system', 'user', {
1872
1953
  startkey: 'system.user.',
1873
1954
  endkey: "system.user.\u9999"
1874
1955
  }, function (err, doc) {
@@ -1892,7 +1973,7 @@ var Connection = /*#__PURE__*/function () {
1892
1973
  }, {
1893
1974
  key: "getGroups",
1894
1975
  value: function getGroups(update) {
1895
- var _this38 = this;
1976
+ var _this37 = this;
1896
1977
  if (!update && this._promises.groups) {
1897
1978
  return this._promises.groups;
1898
1979
  }
@@ -1900,7 +1981,7 @@ var Connection = /*#__PURE__*/function () {
1900
1981
  return Promise.reject(NOT_CONNECTED);
1901
1982
  }
1902
1983
  this._promises.groups = new Promise(function (resolve, reject) {
1903
- return _this38._socket.emit('getObjectView', 'system', 'group', {
1984
+ return _this37._socket.emit('getObjectView', 'system', 'group', {
1904
1985
  startkey: 'system.group.',
1905
1986
  endkey: "system.group.\u9999"
1906
1987
  }, function (err, doc) {
@@ -1926,27 +2007,28 @@ var Connection = /*#__PURE__*/function () {
1926
2007
  }, {
1927
2008
  key: "getHostInfo",
1928
2009
  value: function getHostInfo(host, update, timeoutMs) {
1929
- var _this39 = this;
2010
+ var _this38 = this;
1930
2011
  if (Connection.isWeb()) {
1931
2012
  return Promise.reject('Allowed only in admin');
1932
2013
  }
1933
2014
  if (!host.startsWith('system.host.')) {
1934
- host += 'system.host.' + host;
2015
+ host += "system.host.".concat(host);
1935
2016
  }
1936
- if (!update && this._promises['hostInfo' + host]) {
1937
- return this._promises['hostInfo' + host];
2017
+ var cache = "hostInfo".concat(host);
2018
+ if (!update && this._promises[cache]) {
2019
+ return this._promises[cache];
1938
2020
  }
1939
2021
  if (!this.connected) {
1940
2022
  return Promise.reject(NOT_CONNECTED);
1941
2023
  }
1942
- this._promises['hostInfo' + host] = new Promise(function (resolve, reject) {
2024
+ this._promises[cache] = new Promise(function (resolve, reject) {
1943
2025
  var timeout = setTimeout(function () {
1944
2026
  if (timeout) {
1945
2027
  timeout = null;
1946
2028
  reject('getHostInfo timeout');
1947
2029
  }
1948
- }, timeoutMs || _this39.props.cmdTimeout);
1949
- _this39._socket.emit('sendToHost', host, 'getHostInfo', null, function (data) {
2030
+ }, timeoutMs || _this38.props.cmdTimeout);
2031
+ _this38._socket.emit('sendToHost', host, 'getHostInfo', null, function (data) {
1950
2032
  if (timeout) {
1951
2033
  clearTimeout(timeout);
1952
2034
  timeout = null;
@@ -1960,7 +2042,7 @@ var Connection = /*#__PURE__*/function () {
1960
2042
  }
1961
2043
  });
1962
2044
  });
1963
- return this._promises['hostInfo' + host];
2045
+ return this._promises[cache];
1964
2046
  }
1965
2047
 
1966
2048
  /**
@@ -1973,27 +2055,28 @@ var Connection = /*#__PURE__*/function () {
1973
2055
  }, {
1974
2056
  key: "getHostInfoShort",
1975
2057
  value: function getHostInfoShort(host, update, timeoutMs) {
1976
- var _this40 = this;
2058
+ var _this39 = this;
1977
2059
  if (Connection.isWeb()) {
1978
2060
  return Promise.reject('Allowed only in admin');
1979
2061
  }
1980
2062
  if (!host.startsWith('system.host.')) {
1981
- host += 'system.host.' + host;
2063
+ host += "system.host.".concat(host);
1982
2064
  }
1983
- if (!update && this._promises['hostInfoShort' + host]) {
1984
- return this._promises['hostInfoShort' + host];
2065
+ var cache = "hostInfoShort".concat(host);
2066
+ if (!update && this._promises[cache]) {
2067
+ return this._promises[cache];
1985
2068
  }
1986
2069
  if (!this.connected) {
1987
2070
  return Promise.reject(NOT_CONNECTED);
1988
2071
  }
1989
- this._promises['hostInfoShort' + host] = new Promise(function (resolve, reject) {
2072
+ this._promises[cache] = new Promise(function (resolve, reject) {
1990
2073
  var timeout = setTimeout(function () {
1991
2074
  if (timeout) {
1992
2075
  timeout = null;
1993
2076
  reject('hostInfoShort timeout');
1994
2077
  }
1995
- }, timeoutMs || _this40.props.cmdTimeout);
1996
- _this40._socket.emit('sendToHost', host, 'getHostInfoShort', null, function (data) {
2078
+ }, timeoutMs || _this39.props.cmdTimeout);
2079
+ _this39._socket.emit('sendToHost', host, 'getHostInfoShort', null, function (data) {
1997
2080
  if (timeout) {
1998
2081
  clearTimeout(timeout);
1999
2082
  timeout = null;
@@ -2007,7 +2090,7 @@ var Connection = /*#__PURE__*/function () {
2007
2090
  }
2008
2091
  });
2009
2092
  });
2010
- return this._promises['hostInfoShort' + host];
2093
+ return this._promises[cache];
2011
2094
  }
2012
2095
 
2013
2096
  /**
@@ -2021,7 +2104,7 @@ var Connection = /*#__PURE__*/function () {
2021
2104
  }, {
2022
2105
  key: "getRepository",
2023
2106
  value: function getRepository(host, args, update, timeoutMs) {
2024
- var _this41 = this;
2107
+ var _this40 = this;
2025
2108
  if (Connection.isWeb()) {
2026
2109
  return Promise.reject('Allowed only in admin');
2027
2110
  }
@@ -2040,8 +2123,8 @@ var Connection = /*#__PURE__*/function () {
2040
2123
  timeout = null;
2041
2124
  reject('getRepository timeout');
2042
2125
  }
2043
- }, timeoutMs || _this41.props.cmdTimeout);
2044
- _this41._socket.emit('sendToHost', host, 'getRepository', args, function (data) {
2126
+ }, timeoutMs || _this40.props.cmdTimeout);
2127
+ _this40._socket.emit('sendToHost', host, 'getRepository', args, function (data) {
2045
2128
  if (timeout) {
2046
2129
  clearTimeout(timeout);
2047
2130
  timeout = null;
@@ -2068,7 +2151,7 @@ var Connection = /*#__PURE__*/function () {
2068
2151
  }, {
2069
2152
  key: "getInstalled",
2070
2153
  value: function getInstalled(host, update, cmdTimeout) {
2071
- var _this42 = this;
2154
+ var _this41 = this;
2072
2155
  if (Connection.isWeb()) {
2073
2156
  return Promise.reject('Allowed only in admin');
2074
2157
  }
@@ -2080,7 +2163,7 @@ var Connection = /*#__PURE__*/function () {
2080
2163
  return Promise.reject(NOT_CONNECTED);
2081
2164
  }
2082
2165
  if (!host.startsWith('system.host.')) {
2083
- host += 'system.host.' + host;
2166
+ host += "system.host.".concat(host);
2084
2167
  }
2085
2168
  this._promises.installed[host] = new Promise(function (resolve, reject) {
2086
2169
  var timeout = setTimeout(function () {
@@ -2088,8 +2171,8 @@ var Connection = /*#__PURE__*/function () {
2088
2171
  timeout = null;
2089
2172
  reject('getInstalled timeout');
2090
2173
  }
2091
- }, cmdTimeout || _this42.props.cmdTimeout);
2092
- _this42._socket.emit('sendToHost', host, 'getInstalled', null, function (data) {
2174
+ }, cmdTimeout || _this41.props.cmdTimeout);
2175
+ _this41._socket.emit('sendToHost', host, 'getInstalled', null, function (data) {
2093
2176
  if (timeout) {
2094
2177
  clearTimeout(timeout);
2095
2178
  timeout = null;
@@ -2106,6 +2189,46 @@ var Connection = /*#__PURE__*/function () {
2106
2189
  return this._promises.installed[host];
2107
2190
  }
2108
2191
 
2192
+ /**
2193
+ * Rename file or folder in ioBroker DB
2194
+ * @param adapter instance name
2195
+ * @param oldName current file name, e.g main/vis-views.json
2196
+ * @param newName new file name, e.g main/vis-views-new.json
2197
+ */
2198
+ }, {
2199
+ key: "rename",
2200
+ value: function rename(adapter, oldName, newName) {
2201
+ var _this42 = this;
2202
+ if (!this.connected) {
2203
+ return Promise.reject(NOT_CONNECTED);
2204
+ }
2205
+ return new Promise(function (resolve, reject) {
2206
+ return _this42._socket.emit('rename', adapter, oldName, newName, function (err) {
2207
+ return err ? reject(err) : resolve();
2208
+ });
2209
+ });
2210
+ }
2211
+
2212
+ /**
2213
+ * Rename file in ioBroker DB
2214
+ * @param adapter instance name
2215
+ * @param oldName current file name, e.g main/vis-views.json
2216
+ * @param newName new file name, e.g main/vis-views-new.json
2217
+ */
2218
+ }, {
2219
+ key: "renameFile",
2220
+ value: function renameFile(adapter, oldName, newName) {
2221
+ var _this43 = this;
2222
+ if (!this.connected) {
2223
+ return Promise.reject(NOT_CONNECTED);
2224
+ }
2225
+ return new Promise(function (resolve, reject) {
2226
+ return _this43._socket.emit('renameFile', adapter, oldName, newName, function (err) {
2227
+ return err ? reject(err) : resolve();
2228
+ });
2229
+ });
2230
+ }
2231
+
2109
2232
  /**
2110
2233
  * Execute a command on a host.
2111
2234
  * @param {string} host The host name.
@@ -2117,7 +2240,7 @@ var Connection = /*#__PURE__*/function () {
2117
2240
  }, {
2118
2241
  key: "cmdExec",
2119
2242
  value: function cmdExec(host, cmd, cmdId, cmdTimeout) {
2120
- var _this43 = this;
2243
+ var _this44 = this;
2121
2244
  if (Connection.isWeb()) {
2122
2245
  return Promise.reject('Allowed only in admin');
2123
2246
  }
@@ -2125,7 +2248,7 @@ var Connection = /*#__PURE__*/function () {
2125
2248
  return Promise.reject(NOT_CONNECTED);
2126
2249
  }
2127
2250
  if (!host.startsWith(host)) {
2128
- host += 'system.host.' + host;
2251
+ host += "system.host.".concat(host);
2129
2252
  }
2130
2253
  return new Promise(function (resolve, reject) {
2131
2254
  var timeout = cmdTimeout && setTimeout(function () {
@@ -2134,7 +2257,7 @@ var Connection = /*#__PURE__*/function () {
2134
2257
  reject('cmdExec timeout');
2135
2258
  }
2136
2259
  }, cmdTimeout);
2137
- _this43._socket.emit('cmdExec', host, cmdId, cmd, null, function (err) {
2260
+ _this44._socket.emit('cmdExec', host, cmdId, cmd, null, function (err) {
2138
2261
  if (!cmdTimeout || timeout) {
2139
2262
  timeout && clearTimeout(timeout);
2140
2263
  timeout = null;
@@ -2157,19 +2280,20 @@ var Connection = /*#__PURE__*/function () {
2157
2280
  }, {
2158
2281
  key: "checkFeatureSupported",
2159
2282
  value: function checkFeatureSupported(feature, update) {
2160
- var _this44 = this;
2161
- if (!update && this._promises['supportedFeatures_' + feature]) {
2162
- return this._promises['supportedFeatures_' + feature];
2283
+ var _this45 = this;
2284
+ var cache = "supportedFeatures_".concat(feature);
2285
+ if (!update && this._promises[cache]) {
2286
+ return this._promises[cache];
2163
2287
  }
2164
2288
  if (!this.connected) {
2165
2289
  return Promise.reject(NOT_CONNECTED);
2166
2290
  }
2167
- this._promises['supportedFeatures_' + feature] = new Promise(function (resolve, reject) {
2168
- return _this44._socket.emit('checkFeatureSupported', feature, function (err, features) {
2291
+ this._promises[cache] = new Promise(function (resolve, reject) {
2292
+ return _this45._socket.emit('checkFeatureSupported', feature, function (err, features) {
2169
2293
  err ? reject(err) : resolve(features);
2170
2294
  });
2171
2295
  });
2172
- return this._promises['supportedFeatures_' + feature];
2296
+ return this._promises[cache];
2173
2297
  }
2174
2298
 
2175
2299
  /**
@@ -2180,13 +2304,13 @@ var Connection = /*#__PURE__*/function () {
2180
2304
  }, {
2181
2305
  key: "readBaseSettings",
2182
2306
  value: function readBaseSettings(host) {
2183
- var _this45 = this;
2307
+ var _this46 = this;
2184
2308
  if (Connection.isWeb()) {
2185
2309
  return Promise.reject('Allowed only in admin');
2186
2310
  }
2187
2311
  return this.checkFeatureSupported('CONTROLLER_READWRITE_BASE_SETTINGS').then(function (result) {
2188
2312
  if (result) {
2189
- if (!_this45.connected) {
2313
+ if (!_this46.connected) {
2190
2314
  return Promise.reject(NOT_CONNECTED);
2191
2315
  }
2192
2316
  return new Promise(function (resolve, reject) {
@@ -2195,11 +2319,11 @@ var Connection = /*#__PURE__*/function () {
2195
2319
  timeout = null;
2196
2320
  reject('readBaseSettings timeout');
2197
2321
  }
2198
- }, _this45.props.cmdTimeout);
2322
+ }, _this46.props.cmdTimeout);
2199
2323
  if (host.startsWith('system.host.')) {
2200
2324
  host = host.replace(/^system\.host\./, '');
2201
2325
  }
2202
- _this45._socket.emit('sendToHost', host, 'readBaseSettings', null, function (data) {
2326
+ _this46._socket.emit('sendToHost', host, 'readBaseSettings', null, function (data) {
2203
2327
  if (timeout) {
2204
2328
  clearTimeout(timeout);
2205
2329
  timeout = null;
@@ -2228,13 +2352,13 @@ var Connection = /*#__PURE__*/function () {
2228
2352
  }, {
2229
2353
  key: "writeBaseSettings",
2230
2354
  value: function writeBaseSettings(host, config) {
2231
- var _this46 = this;
2355
+ var _this47 = this;
2232
2356
  if (Connection.isWeb()) {
2233
2357
  return Promise.reject('Allowed only in admin');
2234
2358
  }
2235
2359
  return this.checkFeatureSupported('CONTROLLER_READWRITE_BASE_SETTINGS').then(function (result) {
2236
2360
  if (result) {
2237
- if (!_this46.connected) {
2361
+ if (!_this47.connected) {
2238
2362
  return Promise.reject(NOT_CONNECTED);
2239
2363
  }
2240
2364
  return new Promise(function (resolve, reject) {
@@ -2243,8 +2367,8 @@ var Connection = /*#__PURE__*/function () {
2243
2367
  timeout = null;
2244
2368
  reject('writeBaseSettings timeout');
2245
2369
  }
2246
- }, _this46.props.cmdTimeout);
2247
- _this46._socket.emit('sendToHost', host, 'writeBaseSettings', config, function (data) {
2370
+ }, _this47.props.cmdTimeout);
2371
+ _this47._socket.emit('sendToHost', host, 'writeBaseSettings', config, function (data) {
2248
2372
  if (timeout) {
2249
2373
  clearTimeout(timeout);
2250
2374
  timeout = null;
@@ -2272,12 +2396,12 @@ var Connection = /*#__PURE__*/function () {
2272
2396
  }, {
2273
2397
  key: "restartController",
2274
2398
  value: function restartController(host) {
2275
- var _this47 = this;
2399
+ var _this48 = this;
2276
2400
  if (Connection.isWeb()) {
2277
2401
  return Promise.reject('Allowed only in admin');
2278
2402
  }
2279
2403
  return new Promise(function (resolve, reject) {
2280
- _this47._socket.emit('sendToHost', host, 'restartController', null, function (error) {
2404
+ _this48._socket.emit('sendToHost', host, 'restartController', null, function (error) {
2281
2405
  error ? reject(error) : resolve(true);
2282
2406
  });
2283
2407
  });
@@ -2292,12 +2416,12 @@ var Connection = /*#__PURE__*/function () {
2292
2416
  }, {
2293
2417
  key: "getDiagData",
2294
2418
  value: function getDiagData(host, typeOfDiag) {
2295
- var _this48 = this;
2419
+ var _this49 = this;
2296
2420
  if (Connection.isWeb()) {
2297
2421
  return Promise.reject('Allowed only in admin');
2298
2422
  }
2299
2423
  return new Promise(function (resolve) {
2300
- _this48._socket.emit('sendToHost', host, 'getDiagData', typeOfDiag, function (result) {
2424
+ _this49._socket.emit('sendToHost', host, 'getDiagData', typeOfDiag, function (result) {
2301
2425
  return resolve(result);
2302
2426
  });
2303
2427
  });
@@ -2311,19 +2435,19 @@ var Connection = /*#__PURE__*/function () {
2311
2435
  }, {
2312
2436
  key: "getForeignStates",
2313
2437
  value: function getForeignStates(pattern) {
2314
- var _this49 = this;
2438
+ var _this50 = this;
2315
2439
  if (!this.connected) {
2316
2440
  return Promise.reject(NOT_CONNECTED);
2317
2441
  }
2318
2442
  if (Connection.isWeb()) {
2319
2443
  return new Promise(function (resolve, reject) {
2320
- return _this49._socket.emit('getStates', pattern || '*', function (err, states) {
2444
+ return _this50._socket.emit('getStates', pattern || '*', function (err, states) {
2321
2445
  return err ? reject(err) : resolve(states);
2322
2446
  });
2323
2447
  });
2324
2448
  } else {
2325
2449
  return new Promise(function (resolve, reject) {
2326
- return _this49._socket.emit('getForeignStates', pattern || '*', function (err, states) {
2450
+ return _this50._socket.emit('getForeignStates', pattern || '*', function (err, states) {
2327
2451
  return err ? reject(err) : resolve(states);
2328
2452
  });
2329
2453
  });
@@ -2339,12 +2463,12 @@ var Connection = /*#__PURE__*/function () {
2339
2463
  }, {
2340
2464
  key: "getForeignObjects",
2341
2465
  value: function getForeignObjects(pattern, type) {
2342
- var _this50 = this;
2466
+ var _this51 = this;
2343
2467
  if (!this.connected) {
2344
2468
  return Promise.reject(NOT_CONNECTED);
2345
2469
  }
2346
2470
  return new Promise(function (resolve, reject) {
2347
- return _this50._socket.emit('getForeignObjects', pattern || '*', type, function (err, states) {
2471
+ return _this51._socket.emit('getForeignObjects', pattern || '*', type, function (err, states) {
2348
2472
  return err ? reject(err) : resolve(states);
2349
2473
  });
2350
2474
  });
@@ -2384,9 +2508,9 @@ var Connection = /*#__PURE__*/function () {
2384
2508
  }, {
2385
2509
  key: "setSystemConfig",
2386
2510
  value: function setSystemConfig(obj) {
2387
- var _this51 = this;
2511
+ var _this52 = this;
2388
2512
  return this.setObject('system.config', obj).then(function () {
2389
- return _this51._promises.systemConfig = Promise.resolve(obj);
2513
+ return _this52._promises.systemConfig = Promise.resolve(obj);
2390
2514
  });
2391
2515
  }
2392
2516
 
@@ -2409,12 +2533,12 @@ var Connection = /*#__PURE__*/function () {
2409
2533
  }, {
2410
2534
  key: "getHistory",
2411
2535
  value: function getHistory(id, options) {
2412
- var _this52 = this;
2536
+ var _this53 = this;
2413
2537
  if (!this.connected) {
2414
2538
  return Promise.reject(NOT_CONNECTED);
2415
2539
  }
2416
2540
  return new Promise(function (resolve, reject) {
2417
- return _this52._socket.emit('getHistory', id, options, function (err, values) {
2541
+ return _this53._socket.emit('getHistory', id, options, function (err, values) {
2418
2542
  return err ? reject(err) : resolve(values);
2419
2543
  });
2420
2544
  });
@@ -2429,12 +2553,12 @@ var Connection = /*#__PURE__*/function () {
2429
2553
  }, {
2430
2554
  key: "getHistoryEx",
2431
2555
  value: function getHistoryEx(id, options) {
2432
- var _this53 = this;
2556
+ var _this54 = this;
2433
2557
  if (!this.connected) {
2434
2558
  return Promise.reject(NOT_CONNECTED);
2435
2559
  }
2436
2560
  return new Promise(function (resolve, reject) {
2437
- return _this53._socket.emit('getHistory', id, options, function (err, values, stepIgnore, sessionId) {
2561
+ return _this54._socket.emit('getHistory', id, options, function (err, values, stepIgnore, sessionId) {
2438
2562
  return err ? reject(err) : resolve({
2439
2563
  values: values,
2440
2564
  sessionId: sessionId,
@@ -2453,12 +2577,12 @@ var Connection = /*#__PURE__*/function () {
2453
2577
  }, {
2454
2578
  key: "changePassword",
2455
2579
  value: function changePassword(user, password) {
2456
- var _this54 = this;
2580
+ var _this55 = this;
2457
2581
  if (Connection.isWeb()) {
2458
2582
  return Promise.reject('Allowed only in admin');
2459
2583
  }
2460
2584
  return new Promise(function (resolve, reject) {
2461
- return _this54._socket.emit('changePassword', user, password, function (err) {
2585
+ return _this55._socket.emit('changePassword', user, password, function (err) {
2462
2586
  return err ? reject(err) : resolve();
2463
2587
  });
2464
2588
  });
@@ -2477,15 +2601,15 @@ var Connection = /*#__PURE__*/function () {
2477
2601
  return Promise.reject('Allowed only in admin');
2478
2602
  }
2479
2603
  if (!host.startsWith('system.host.')) {
2480
- host = 'system.host.' + host;
2604
+ host = "system.host.".concat(host);
2481
2605
  }
2482
- if (!update && this._promises['IPs_' + host]) {
2483
- return this._promises['IPs_' + host];
2606
+ if (!update && this._promises["IPs_".concat(host)]) {
2607
+ return this._promises["IPs_".concat(host)];
2484
2608
  }
2485
- this._promises['IPs_' + host] = this.getObject(host).then(function (obj) {
2609
+ this._promises["IPs_".concat(host)] = this.getObject(host).then(function (obj) {
2486
2610
  return obj && obj.common ? obj.common.address || [] : [];
2487
2611
  });
2488
- return this._promises['IPs_' + host];
2612
+ return this._promises["IPs_".concat(host)];
2489
2613
  }
2490
2614
 
2491
2615
  /**
@@ -2497,18 +2621,19 @@ var Connection = /*#__PURE__*/function () {
2497
2621
  }, {
2498
2622
  key: "getHostByIp",
2499
2623
  value: function getHostByIp(ipOrHostName, update) {
2500
- var _this55 = this;
2624
+ var _this56 = this;
2501
2625
  if (Connection.isWeb()) {
2502
2626
  return Promise.reject('Allowed only in admin');
2503
2627
  }
2504
2628
  if (ipOrHostName.startsWith('system.host.')) {
2505
2629
  ipOrHostName = ipOrHostName.replace(/^system\.host\./, '');
2506
2630
  }
2507
- if (!update && this._promises['rIPs_' + ipOrHostName]) {
2508
- return this._promises['rIPs_' + ipOrHostName];
2631
+ var cache = "rIPs_".concat(ipOrHostName);
2632
+ if (!update && this._promises[cache]) {
2633
+ return this._promises[cache];
2509
2634
  }
2510
- this._promises['rIPs_' + ipOrHostName] = new Promise(function (resolve) {
2511
- return _this55._socket.emit('getHostByIp', ipOrHostName, function (ip, host) {
2635
+ this._promises[cache] = new Promise(function (resolve) {
2636
+ return _this56._socket.emit('getHostByIp', ipOrHostName, function (ip, host) {
2512
2637
  var _host$native, _host$native$hardware;
2513
2638
  var IPs4 = [{
2514
2639
  name: '[IPv4] 0.0.0.0 - Listen on all IPs',
@@ -2548,7 +2673,7 @@ var Connection = /*#__PURE__*/function () {
2548
2673
  resolve(IPs4);
2549
2674
  });
2550
2675
  });
2551
- return this._promises['rIPs_' + ipOrHostName];
2676
+ return this._promises[cache];
2552
2677
  }
2553
2678
 
2554
2679
  /**
@@ -2559,12 +2684,12 @@ var Connection = /*#__PURE__*/function () {
2559
2684
  }, {
2560
2685
  key: "encrypt",
2561
2686
  value: function encrypt(text) {
2562
- var _this56 = this;
2687
+ var _this57 = this;
2563
2688
  if (Connection.isWeb()) {
2564
2689
  return Promise.reject('Allowed only in admin');
2565
2690
  }
2566
2691
  return new Promise(function (resolve, reject) {
2567
- return _this56._socket.emit('encrypt', text, function (err, text) {
2692
+ return _this57._socket.emit('encrypt', text, function (err, text) {
2568
2693
  return err ? reject(err) : resolve(text);
2569
2694
  });
2570
2695
  });
@@ -2578,12 +2703,12 @@ var Connection = /*#__PURE__*/function () {
2578
2703
  }, {
2579
2704
  key: "decrypt",
2580
2705
  value: function decrypt(encryptedText) {
2581
- var _this57 = this;
2706
+ var _this58 = this;
2582
2707
  if (Connection.isWeb()) {
2583
2708
  return Promise.reject('Allowed only in admin');
2584
2709
  }
2585
2710
  return new Promise(function (resolve, reject) {
2586
- return _this57._socket.emit('decrypt', encryptedText, function (err, text) {
2711
+ return _this58._socket.emit('decrypt', encryptedText, function (err, text) {
2587
2712
  return err ? reject(err) : resolve(text);
2588
2713
  });
2589
2714
  });
@@ -2596,12 +2721,12 @@ var Connection = /*#__PURE__*/function () {
2596
2721
  }, {
2597
2722
  key: "getVersion",
2598
2723
  value: function getVersion(update) {
2599
- var _this58 = this;
2724
+ var _this59 = this;
2600
2725
  if (update && this._promises.version) {
2601
2726
  this._promises.version = null;
2602
2727
  }
2603
2728
  this._promises.version = this._promises.version || new Promise(function (resolve, reject) {
2604
- return _this58._socket.emit('getVersion', function (err, version, serverName) {
2729
+ return _this59._socket.emit('getVersion', function (err, version, serverName) {
2605
2730
  // support of old socket.io
2606
2731
  if (err && !version && typeof err === 'string' && err.match(/\d+\.\d+\.\d+/)) {
2607
2732
  resolve({
@@ -2626,9 +2751,9 @@ var Connection = /*#__PURE__*/function () {
2626
2751
  }, {
2627
2752
  key: "getWebServerName",
2628
2753
  value: function getWebServerName() {
2629
- var _this59 = this;
2754
+ var _this60 = this;
2630
2755
  this._promises.webName = this._promises.webName || new Promise(function (resolve, reject) {
2631
- return _this59._socket.emit('getAdapterName', function (err, name) {
2756
+ return _this60._socket.emit('getAdapterName', function (err, name) {
2632
2757
  return err ? reject(err) : resolve(name);
2633
2758
  });
2634
2759
  });
@@ -2657,7 +2782,7 @@ var Connection = /*#__PURE__*/function () {
2657
2782
  }, {
2658
2783
  key: "chmodFile",
2659
2784
  value: function chmodFile(adapter, filename, options) {
2660
- var _this60 = this;
2785
+ var _this61 = this;
2661
2786
  if (Connection.isWeb()) {
2662
2787
  return Promise.reject('Allowed only in admin');
2663
2788
  }
@@ -2665,7 +2790,7 @@ var Connection = /*#__PURE__*/function () {
2665
2790
  return Promise.reject(NOT_CONNECTED);
2666
2791
  }
2667
2792
  return new Promise(function (resolve, reject) {
2668
- return _this60._socket.emit('chmodFile', adapter, filename, options, function (err, entries, id) {
2793
+ return _this61._socket.emit('chmodFile', adapter, filename, options, function (err, entries, id) {
2669
2794
  return err ? reject(err) : resolve({
2670
2795
  entries: entries,
2671
2796
  id: id
@@ -2684,7 +2809,7 @@ var Connection = /*#__PURE__*/function () {
2684
2809
  }, {
2685
2810
  key: "chownFile",
2686
2811
  value: function chownFile(adapter, filename, options) {
2687
- var _this61 = this;
2812
+ var _this62 = this;
2688
2813
  if (Connection.isWeb()) {
2689
2814
  return Promise.reject('Allowed only in admin');
2690
2815
  }
@@ -2692,7 +2817,7 @@ var Connection = /*#__PURE__*/function () {
2692
2817
  return Promise.reject(NOT_CONNECTED);
2693
2818
  }
2694
2819
  return new Promise(function (resolve, reject) {
2695
- return _this61._socket.emit('chownFile', adapter, filename, options, function (err, entries, id) {
2820
+ return _this62._socket.emit('chownFile', adapter, filename, options, function (err, entries, id) {
2696
2821
  return err ? reject(err) : resolve({
2697
2822
  entries: entries,
2698
2823
  id: id
@@ -2710,12 +2835,12 @@ var Connection = /*#__PURE__*/function () {
2710
2835
  }, {
2711
2836
  key: "fileExists",
2712
2837
  value: function fileExists(adapter, filename) {
2713
- var _this62 = this;
2838
+ var _this63 = this;
2714
2839
  if (!this.connected) {
2715
2840
  return Promise.reject(NOT_CONNECTED);
2716
2841
  }
2717
2842
  return new Promise(function (resolve, reject) {
2718
- return _this62._socket.emit('fileExists', adapter, filename, function (err, exists) {
2843
+ return _this63._socket.emit('fileExists', adapter, filename, function (err, exists) {
2719
2844
  return err ? reject(err) : resolve(exists);
2720
2845
  });
2721
2846
  });
@@ -2730,7 +2855,7 @@ var Connection = /*#__PURE__*/function () {
2730
2855
  }, {
2731
2856
  key: "getNotifications",
2732
2857
  value: function getNotifications(host, category) {
2733
- var _this63 = this;
2858
+ var _this64 = this;
2734
2859
  if (Connection.isWeb()) {
2735
2860
  return Promise.reject('Allowed only in admin');
2736
2861
  }
@@ -2738,7 +2863,7 @@ var Connection = /*#__PURE__*/function () {
2738
2863
  return Promise.reject(NOT_CONNECTED);
2739
2864
  }
2740
2865
  return new Promise(function (resolve) {
2741
- return _this63._socket.emit('sendToHost', host, 'getNotifications', {
2866
+ return _this64._socket.emit('sendToHost', host, 'getNotifications', {
2742
2867
  category: category
2743
2868
  }, function (notifications) {
2744
2869
  return resolve(notifications);
@@ -2755,7 +2880,7 @@ var Connection = /*#__PURE__*/function () {
2755
2880
  }, {
2756
2881
  key: "clearNotifications",
2757
2882
  value: function clearNotifications(host, category) {
2758
- var _this64 = this;
2883
+ var _this65 = this;
2759
2884
  if (Connection.isWeb()) {
2760
2885
  return Promise.reject('Allowed only in admin');
2761
2886
  }
@@ -2763,7 +2888,7 @@ var Connection = /*#__PURE__*/function () {
2763
2888
  return Promise.reject(NOT_CONNECTED);
2764
2889
  }
2765
2890
  return new Promise(function (resolve) {
2766
- return _this64._socket.emit('sendToHost', host, 'clearNotifications', {
2891
+ return _this65._socket.emit('sendToHost', host, 'clearNotifications', {
2767
2892
  category: category
2768
2893
  }, function (notifications) {
2769
2894
  return resolve(notifications);
@@ -2778,7 +2903,7 @@ var Connection = /*#__PURE__*/function () {
2778
2903
  }, {
2779
2904
  key: "getIsEasyModeStrict",
2780
2905
  value: function getIsEasyModeStrict() {
2781
- var _this65 = this;
2906
+ var _this66 = this;
2782
2907
  if (Connection.isWeb()) {
2783
2908
  return Promise.reject('Allowed only in admin');
2784
2909
  }
@@ -2786,7 +2911,7 @@ var Connection = /*#__PURE__*/function () {
2786
2911
  return Promise.reject(NOT_CONNECTED);
2787
2912
  }
2788
2913
  return new Promise(function (resolve, reject) {
2789
- return _this65._socket.emit('getIsEasyModeStrict', function (error, isStrict) {
2914
+ return _this66._socket.emit('getIsEasyModeStrict', function (error, isStrict) {
2790
2915
  return error ? reject(error) : resolve(isStrict);
2791
2916
  });
2792
2917
  });
@@ -2799,7 +2924,7 @@ var Connection = /*#__PURE__*/function () {
2799
2924
  }, {
2800
2925
  key: "getEasyMode",
2801
2926
  value: function getEasyMode() {
2802
- var _this66 = this;
2927
+ var _this67 = this;
2803
2928
  if (Connection.isWeb()) {
2804
2929
  return Promise.reject('Allowed only in admin');
2805
2930
  }
@@ -2807,7 +2932,7 @@ var Connection = /*#__PURE__*/function () {
2807
2932
  return Promise.reject(NOT_CONNECTED);
2808
2933
  }
2809
2934
  return new Promise(function (resolve, reject) {
2810
- return _this66._socket.emit('getEasyMode', function (error, config) {
2935
+ return _this67._socket.emit('getEasyMode', function (error, config) {
2811
2936
  return error ? reject(error) : resolve(config);
2812
2937
  });
2813
2938
  });
@@ -2820,12 +2945,12 @@ var Connection = /*#__PURE__*/function () {
2820
2945
  }, {
2821
2946
  key: "getCurrentUser",
2822
2947
  value: function getCurrentUser() {
2823
- var _this67 = this;
2948
+ var _this68 = this;
2824
2949
  if (!this.connected) {
2825
2950
  return Promise.reject(NOT_CONNECTED);
2826
2951
  }
2827
2952
  return new Promise(function (resolve) {
2828
- return _this67._socket.emit('authEnabled', function (isSecure, user) {
2953
+ return _this68._socket.emit('authEnabled', function (isSecure, user) {
2829
2954
  return resolve(user);
2830
2955
  });
2831
2956
  });
@@ -2868,7 +2993,7 @@ var Connection = /*#__PURE__*/function () {
2868
2993
  }, {
2869
2994
  key: "getRatings",
2870
2995
  value: function getRatings(update) {
2871
- var _this68 = this;
2996
+ var _this69 = this;
2872
2997
  if (Connection.isWeb()) {
2873
2998
  return Promise.reject('Allowed only in admin');
2874
2999
  }
@@ -2876,7 +3001,7 @@ var Connection = /*#__PURE__*/function () {
2876
3001
  return Promise.reject(NOT_CONNECTED);
2877
3002
  }
2878
3003
  return new Promise(function (resolve, reject) {
2879
- return _this68._socket.emit('getRatings', update, function (err, ratings) {
3004
+ return _this69._socket.emit('getRatings', update, function (err, ratings) {
2880
3005
  return err ? reject(err) : resolve(ratings);
2881
3006
  });
2882
3007
  });
@@ -2889,12 +3014,12 @@ var Connection = /*#__PURE__*/function () {
2889
3014
  }, {
2890
3015
  key: "getCurrentInstance",
2891
3016
  value: function getCurrentInstance() {
2892
- var _this69 = this;
3017
+ var _this70 = this;
2893
3018
  if (!this.connected) {
2894
3019
  return Promise.reject(NOT_CONNECTED);
2895
3020
  }
2896
3021
  this._promises.currentInstance = this._promises.currentInstance || new Promise(function (resolve, reject) {
2897
- return _this69._socket.emit('getCurrentInstance', function (err, namespace) {
3022
+ return _this70._socket.emit('getCurrentInstance', function (err, namespace) {
2898
3023
  return err ? reject(err) : resolve(namespace);
2899
3024
  });
2900
3025
  });
@@ -2905,7 +3030,7 @@ var Connection = /*#__PURE__*/function () {
2905
3030
  }, {
2906
3031
  key: "getCompactAdapters",
2907
3032
  value: function getCompactAdapters(update) {
2908
- var _this70 = this;
3033
+ var _this71 = this;
2909
3034
  if (Connection.isWeb()) {
2910
3035
  return Promise.reject('Allowed only in admin');
2911
3036
  }
@@ -2916,7 +3041,7 @@ var Connection = /*#__PURE__*/function () {
2916
3041
  return Promise.reject(NOT_CONNECTED);
2917
3042
  }
2918
3043
  this._promises.compactAdapters = new Promise(function (resolve, reject) {
2919
- return _this70._socket.emit('getCompactAdapters', function (err, adapters) {
3044
+ return _this71._socket.emit('getCompactAdapters', function (err, adapters) {
2920
3045
  return err ? reject(err) : resolve(adapters);
2921
3046
  });
2922
3047
  });
@@ -2934,7 +3059,7 @@ var Connection = /*#__PURE__*/function () {
2934
3059
  }, {
2935
3060
  key: "getCompactInstances",
2936
3061
  value: function getCompactInstances(update) {
2937
- var _this71 = this;
3062
+ var _this72 = this;
2938
3063
  if (Connection.isWeb()) {
2939
3064
  return Promise.reject('Allowed only in admin');
2940
3065
  }
@@ -2945,7 +3070,7 @@ var Connection = /*#__PURE__*/function () {
2945
3070
  return Promise.reject(NOT_CONNECTED);
2946
3071
  }
2947
3072
  this._promises.compactInstances = new Promise(function (resolve, reject) {
2948
- return _this71._socket.emit('getCompactInstances', function (err, instances) {
3073
+ return _this72._socket.emit('getCompactInstances', function (err, instances) {
2949
3074
  return err ? reject(err) : resolve(instances);
2950
3075
  });
2951
3076
  });
@@ -2964,7 +3089,7 @@ var Connection = /*#__PURE__*/function () {
2964
3089
  }, {
2965
3090
  key: "getCompactInstalled",
2966
3091
  value: function getCompactInstalled(host, update, cmdTimeout) {
2967
- var _this72 = this;
3092
+ var _this73 = this;
2968
3093
  if (Connection.isWeb()) {
2969
3094
  return Promise.reject('Allowed only in admin');
2970
3095
  }
@@ -2984,8 +3109,8 @@ var Connection = /*#__PURE__*/function () {
2984
3109
  timeout = null;
2985
3110
  reject('getCompactInstalled timeout');
2986
3111
  }
2987
- }, cmdTimeout || _this72.props.cmdTimeout);
2988
- _this72._socket.emit('getCompactInstalled', host, function (data) {
3112
+ }, cmdTimeout || _this73.props.cmdTimeout);
3113
+ _this73._socket.emit('getCompactInstalled', host, function (data) {
2989
3114
  if (timeout) {
2990
3115
  clearTimeout(timeout);
2991
3116
  timeout = null;
@@ -3007,7 +3132,7 @@ var Connection = /*#__PURE__*/function () {
3007
3132
  }, {
3008
3133
  key: "getCompactSystemRepositories",
3009
3134
  value: function getCompactSystemRepositories(update, cmdTimeout) {
3010
- var _this73 = this;
3135
+ var _this74 = this;
3011
3136
  if (Connection.isWeb()) {
3012
3137
  return Promise.reject('Allowed only in admin');
3013
3138
  }
@@ -3021,8 +3146,8 @@ var Connection = /*#__PURE__*/function () {
3021
3146
  timeout = null;
3022
3147
  reject('getCompactSystemRepositories timeout');
3023
3148
  }
3024
- }, cmdTimeout || _this73.props.cmdTimeout);
3025
- _this73._socket.emit('getCompactSystemRepositories', function (data) {
3149
+ }, cmdTimeout || _this74.props.cmdTimeout);
3150
+ _this74._socket.emit('getCompactSystemRepositories', function (data) {
3026
3151
  if (timeout) {
3027
3152
  clearTimeout(timeout);
3028
3153
  timeout = null;
@@ -3055,7 +3180,7 @@ var Connection = /*#__PURE__*/function () {
3055
3180
  value:
3056
3181
  // returns very optimized information for adapters to minimize connection load
3057
3182
  function getCompactSystemConfig(update) {
3058
- var _this74 = this;
3183
+ var _this75 = this;
3059
3184
  if (!update && this._promises.systemConfigCommon) {
3060
3185
  return this._promises.systemConfigCommon;
3061
3186
  }
@@ -3063,7 +3188,7 @@ var Connection = /*#__PURE__*/function () {
3063
3188
  return Promise.reject(NOT_CONNECTED);
3064
3189
  }
3065
3190
  this._promises.systemConfigCommon = new Promise(function (resolve, reject) {
3066
- return _this74._socket.emit('getCompactSystemConfig', function (err, systemConfig) {
3191
+ return _this75._socket.emit('getCompactSystemConfig', function (err, systemConfig) {
3067
3192
  return err ? reject(err) : resolve(systemConfig);
3068
3193
  });
3069
3194
  });
@@ -3080,7 +3205,7 @@ var Connection = /*#__PURE__*/function () {
3080
3205
  }, {
3081
3206
  key: "getCompactRepository",
3082
3207
  value: function getCompactRepository(host, update, timeoutMs) {
3083
- var _this75 = this;
3208
+ var _this76 = this;
3084
3209
  if (Connection.isWeb()) {
3085
3210
  return Promise.reject('Allowed only in admin');
3086
3211
  }
@@ -3099,8 +3224,8 @@ var Connection = /*#__PURE__*/function () {
3099
3224
  timeout = null;
3100
3225
  reject('getCompactRepository timeout');
3101
3226
  }
3102
- }, timeoutMs || _this75.props.cmdTimeout);
3103
- _this75._socket.emit('getCompactRepository', host, function (data) {
3227
+ }, timeoutMs || _this76.props.cmdTimeout);
3228
+ _this76._socket.emit('getCompactRepository', host, function (data) {
3104
3229
  if (timeout) {
3105
3230
  clearTimeout(timeout);
3106
3231
  timeout = null;
@@ -3119,7 +3244,7 @@ var Connection = /*#__PURE__*/function () {
3119
3244
  }, {
3120
3245
  key: "getCompactHosts",
3121
3246
  value: function getCompactHosts(update) {
3122
- var _this76 = this;
3247
+ var _this77 = this;
3123
3248
  if (Connection.isWeb()) {
3124
3249
  return Promise.reject('Allowed only in admin');
3125
3250
  }
@@ -3130,7 +3255,7 @@ var Connection = /*#__PURE__*/function () {
3130
3255
  return Promise.reject(NOT_CONNECTED);
3131
3256
  }
3132
3257
  this._promises.hostsCompact = new Promise(function (resolve, reject) {
3133
- return _this76._socket.emit('getCompactHosts', function (err, hosts) {
3258
+ return _this77._socket.emit('getCompactHosts', function (err, hosts) {
3134
3259
  return err ? reject(err) : resolve(hosts);
3135
3260
  });
3136
3261
  });
@@ -3178,16 +3303,26 @@ var Connection = /*#__PURE__*/function () {
3178
3303
  }, {
3179
3304
  key: "logout",
3180
3305
  value: function logout() {
3181
- var _this77 = this;
3306
+ var _this78 = this;
3182
3307
  if (!this.connected) {
3183
3308
  return Promise.reject(NOT_CONNECTED);
3184
3309
  }
3185
3310
  return new Promise(function (resolve, reject) {
3186
- return _this77._socket.emit('logout', function (err) {
3311
+ return _this78._socket.emit('logout', function (err) {
3187
3312
  return err ? reject(err) : resolve(null);
3188
3313
  });
3189
3314
  });
3190
3315
  }
3316
+ /**
3317
+ * This is special method for vis.
3318
+ * It is used to not send to server the changes about "nothing_selected" state
3319
+ * @param id The state that has to be ignored by communication
3320
+ */
3321
+ }, {
3322
+ key: "setStateToIgnore",
3323
+ value: function setStateToIgnore(id) {
3324
+ this.ignoreState = id;
3325
+ }
3191
3326
  }], [{
3192
3327
  key: "isWeb",
3193
3328
  value: function isWeb() {
@@ -3203,4 +3338,4 @@ Connection.Connection = {
3203
3338
  };
3204
3339
  var _default = Connection;
3205
3340
  exports["default"] = _default;
3206
- //# sourceMappingURL=_Connection.js.map
3341
+ //# sourceMappingURL=LegacyConnection.js.map