iobroker.js-controller 4.0.21 → 4.1.0-alpha.12-20220314-28d0dece

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.
@@ -75,7 +75,7 @@
75
75
  "meta": "https://raw.githubusercontent.com/dan1-de/ioBroker.anelhut/master/io-package.json",
76
76
  "icon": "https://raw.githubusercontent.com/dan1-de/ioBroker.anelhut/master/admin/anelhut.png",
77
77
  "type": "iot-systems",
78
- "version": "1.0.8"
78
+ "version": "1.0.10"
79
79
  },
80
80
  "apcups": {
81
81
  "meta": "https://raw.githubusercontent.com/xhunter74/ioBroker.apcups/master/io-package.json",
@@ -699,7 +699,7 @@
699
699
  "meta": "https://raw.githubusercontent.com/ioBroker/ioBroker.hm-rpc/master/io-package.json",
700
700
  "icon": "https://raw.githubusercontent.com/ioBroker/ioBroker.hm-rpc/master/admin/homematic.png",
701
701
  "type": "iot-systems",
702
- "version": "1.15.0"
702
+ "version": "1.15.8"
703
703
  },
704
704
  "hmip": {
705
705
  "meta": "https://raw.githubusercontent.com/iobroker-community-adapters/ioBroker.hmip/master/io-package.json",
@@ -890,7 +890,7 @@
890
890
  "js-controller": {
891
891
  "meta": "https://raw.githubusercontent.com/ioBroker/ioBroker.js-controller/master/packages/controller/io-package.json",
892
892
  "type": "general",
893
- "version": "4.0.19"
893
+ "version": "4.0.21"
894
894
  },
895
895
  "kecontact": {
896
896
  "meta": "https://raw.githubusercontent.com/iobroker-community-adapters/ioBroker.kecontact/master/io-package.json",
@@ -2398,4 +2398,4 @@
2398
2398
  "type": "hardware",
2399
2399
  "version": "2.4.3"
2400
2400
  }
2401
- }
2401
+ }
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "js-controller",
4
- "version": "4.0.21",
4
+ "version": "4.1.0",
5
5
  "platform": "Javascript/Node.js",
6
6
  "controller": true,
7
7
  "mode": "daemon",
@@ -20,30 +20,6 @@
20
20
  },
21
21
  "news": {
22
22
  "4.0.21": {
23
- "en": "Fix Backup Restore crash case",
24
- "de": "Beheben Sie den Absturzfall der Sicherungswiederherstellung",
25
- "ru": "Исправить случай сбоя восстановления резервной копии",
26
- "pt": "Corrigir caso de falha de restauração de backup",
27
- "nl": "Fix Backup Herstel crashgeval",
28
- "fr": "Correction du cas de plantage de restauration de sauvegarde",
29
- "it": "Risolto il caso di arresto anomalo del ripristino del backup",
30
- "es": "Solucionar caso de bloqueo de restauración de copia de seguridad",
31
- "pl": "Napraw przypadek awarii przywracania kopii zapasowej",
32
- "zh-cn": "修复备份还原崩溃案例"
33
- },
34
- "4.0.20": {
35
- "en": "Add missing axios dependency\nOnly log an error if an error is happening when activating/deactivating adapter via .alive states\nFix edge case in redis simulator MULTI/EXEC logic\nPrevent some crash cases reported by Sentry",
36
- "de": "Fehlende Axios-Abhängigkeit hinzugefügt\nProtokollieren Sie nur dann einen Fehler, wenn beim Aktivieren/Deaktivieren des Adapters über .alive-Zustände ein Fehler auftritt\nGrenzfall in der MULTI/EXEC-Logik des Redis-Simulators behoben\nVerhindern Sie einige von Sentry gemeldete Absturzfälle",
37
- "ru": "Добавить отсутствующую зависимость axios\nРегистрировать ошибку только в том случае, если ошибка возникает при активации/деактивации адаптера через состояния .alive.\nИсправить пограничный случай в логике MULTI/EXEC симулятора Redis.\nПредотвращение некоторых случаев сбоев, о которых сообщает Sentry.",
38
- "pt": "Adicionar dependência de axios ausente\nApenas registre um erro se ocorrer um erro ao ativar/desativar o adaptador por meio de estados .alive\nCorrigir caso de borda na lógica MULTI/EXEC do simulador redis\nPrevenir alguns casos de travamento relatados pelo Sentinela",
39
- "nl": "Ontbrekende axios-afhankelijkheid toevoegen\nLog alleen een fout in als er een fout optreedt bij het activeren/deactiveren van de adapter via .alive states\nRandgeval repareren in redis-simulator MULTI/EXEC-logica\nVoorkom enkele door Sentry gemelde crashgevallen",
40
- "fr": "Ajouter la dépendance axios manquante\nEnregistrez une erreur uniquement si une erreur se produit lors de l'activation/de la désactivation de l'adaptateur via les états .alive\nCorrection du cas limite dans la logique MULTI/EXEC du simulateur redis\nEmpêcher certains cas de plantage signalés par Sentry",
41
- "it": "Aggiungi la dipendenza assio mancante\nRegistra un errore solo se si verifica un errore durante l'attivazione/disattivazione dell'adattatore tramite stati .alive\nRisolto il problema con il caso limite nella logica MULTI/EXEC del simulatore Redis\nPrevenire alcuni casi di crash segnalati da Sentry",
42
- "es": "Agregar la dependencia de axios faltante\nSolo registre un error si ocurre un error al activar/desactivar el adaptador a través de estados .alive\nArreglar el caso de borde en la lógica MULTI / EXEC del simulador redis\nEvitar algunos casos de bloqueo informados por Sentry",
43
- "pl": "Dodaj brakującą zależność axios\nZapisuj błąd tylko wtedy, gdy wystąpi błąd podczas aktywacji/dezaktywacji adaptera przez stany .alive\nNapraw obudowę krawędziową w symulatorze redis, logika MULTI/EXEC\nZapobiegaj niektórym przypadkom awarii zgłaszanych przez Sentry",
44
- "zh-cn": "添加缺少的 axios 依赖项\n只有在通过 .alive 状态激活/停用适配器时发生错误时才记录错误\n修复 redis 模拟器 MULTI/EXEC 逻辑中的边缘情况\n防止 Sentry 报告的一些崩溃案例"
45
- },
46
- "4.0.19": {
47
23
  "en": "see CHANGELOG.md",
48
24
  "de": "siehe CHANGELOG.md",
49
25
  "ru": "см. CHANGELOG.md",
@@ -960,4 +936,4 @@
960
936
  ]
961
937
  }
962
938
  ]
963
- }
939
+ }
@@ -1059,7 +1059,7 @@ require('${path.normalize(__dirname + '/..')}/setup').execute();`;
1059
1059
  // only change config if non existing - else setup custom has to be used
1060
1060
  if (!fs.existsSync(configFileName)) {
1061
1061
  isCreated = true;
1062
- if (fs.existsSync(__dirname + '/../../conf/' + tools.appName + '-dist.json')) {
1062
+ if (fs.existsSync(`${__dirname}/../../conf/${tools.appName}-dist.json`)) {
1063
1063
  config = require(`../../conf/${tools.appName}-dist.json`);
1064
1064
  } else {
1065
1065
  config = require(`../../conf/${tools.appName.toLowerCase()}-dist.json`);
@@ -1077,16 +1077,16 @@ require('${path.normalize(__dirname + '/..')}/setup').execute();`;
1077
1077
  // this path is relative to js-controller
1078
1078
  config.dataDir = tools.getDefaultDataDir();
1079
1079
  const _path = path
1080
- .normalize(__dirname + '/../../../node_modules/' + tools.appName + '.js-controller')
1080
+ .normalize(`${__dirname}/../../../node_modules/${tools.appName}.js-controller`)
1081
1081
  .replace(/\\/g, '/');
1082
1082
  if (fs.existsSync(_path)) {
1083
1083
  if (_path.indexOf('/node_modules/') !== -1) {
1084
- mkpathSync(__dirname + '/../../', config.dataDir);
1084
+ mkpathSync(`${__dirname}/../../`, config.dataDir);
1085
1085
  } else {
1086
- mkpathSync(__dirname + '../../', config.dataDir);
1086
+ mkpathSync(`${__dirname}../../`, config.dataDir);
1087
1087
  }
1088
1088
  } else {
1089
- mkpathSync(__dirname + '/../', '../' + config.dataDir);
1089
+ mkpathSync(`${__dirname}/../`, `../${config.dataDir}`);
1090
1090
  }
1091
1091
 
1092
1092
  const dirName = path.dirname(configFileName);
package/lib/setup.js CHANGED
@@ -250,7 +250,37 @@ function initYargs() {
250
250
  .command('getDBVersion', 'Get the protocol version of the states database');
251
251
  })
252
252
  .command('message <adapter>[.instance] <command> [<message>]', 'Send message to adapter instance/s', {})
253
- .command('list <type> [<filter>]', 'List all entries, like objects', {})
253
+ .command('list <type> [<filter>]', 'List all entries, like objects', yargs => {
254
+ yargs.positional('type', {
255
+ describe: 'Type of the objects which should be listed',
256
+ type: 'string',
257
+ choices: [
258
+ 'objects',
259
+ 'o',
260
+ 'states',
261
+ 's',
262
+ 'instances',
263
+ 'i',
264
+ 'adapters',
265
+ 'a',
266
+ 'users',
267
+ 'u',
268
+ 'groups',
269
+ 'g',
270
+ 'enums',
271
+ 'e',
272
+ 'files',
273
+ 'f',
274
+ 'hosts',
275
+ 'h'
276
+ ]
277
+ });
278
+
279
+ yargs.positional('filter', {
280
+ describe: 'Filter for matching pattern e.g. "admin*"',
281
+ type: 'string'
282
+ });
283
+ })
254
284
  .command('chmod <mode> <file>', 'Change file rights', {})
255
285
  .command('chown <user> <group> <file>', 'Change file ownership', {})
256
286
  .command('touch <file>', 'Touch file', {})
package/main.js CHANGED
@@ -2268,9 +2268,13 @@ async function startAdapterUpload() {
2268
2268
  setImmediate(startAdapterUpload);
2269
2269
  }
2270
2270
 
2271
- // Process message to controller, like execute some script
2271
+ /**
2272
+ * Process message to controller, like execute some script
2273
+ *
2274
+ * @param {ioBroker.Message} msg
2275
+ * @return {Promise<null>}
2276
+ */
2272
2277
  async function processMessage(msg) {
2273
- let ioPack;
2274
2278
  // important: Do not forget to update the list of protected commands in iobroker.admin/lib/socket.js for "socket.on('sendToHost'"
2275
2279
  // and iobroker.socketio/lib/socket.js
2276
2280
 
@@ -2489,26 +2493,16 @@ async function processMessage(msg) {
2489
2493
  result.hosts = {};
2490
2494
  if (doc && doc.rows.length) {
2491
2495
  // Read installed versions of all hosts
2492
- for (let i = 0; i < doc.rows.length; i++) {
2496
+ for (const row of doc.rows) {
2493
2497
  // If desired local version, do not ask it, just answer
2494
- if (doc.rows[i].id === hostObjectPrefix) {
2495
- let _ioPack;
2496
- try {
2497
- _ioPack = fs.readJSONSync(`${__dirname}/io-package.json`);
2498
- } catch {
2499
- logger.error(
2500
- `${hostLogPrefix} cannot read and parse "${__dirname}/io-package.json"`
2501
- );
2502
- }
2503
- if (_ioPack) {
2504
- _ioPack.common.host = hostname;
2505
- _ioPack.common.runningVersion = version;
2506
- result.hosts[hostname] = _ioPack.common;
2507
- } else {
2508
- result.hosts[hostname] = {};
2509
- }
2498
+ if (row.id === hostObjectPrefix) {
2499
+ const ioPackCommon = deepClone(ioPackage.common);
2500
+
2501
+ ioPackCommon.host = hostname;
2502
+ ioPackCommon.runningVersion = version;
2503
+ result.hosts[hostname] = ioPackCommon;
2510
2504
  } else {
2511
- const ioPack = await getVersionFromHost(doc.rows[i].id);
2505
+ const ioPack = await getVersionFromHost(row.id);
2512
2506
  if (ioPack) {
2513
2507
  result.hosts[ioPack.host] = ioPack;
2514
2508
  result.hosts[ioPack.host].controller = true;
@@ -2545,19 +2539,10 @@ async function processMessage(msg) {
2545
2539
 
2546
2540
  case 'getVersion':
2547
2541
  if (msg.callback && msg.from) {
2548
- ioPack = null;
2549
- try {
2550
- ioPack = fs.readJSONSync(__dirname + '/io-package.json');
2551
- } catch {
2552
- logger.error(`${hostLogPrefix} cannot read and parse "${__dirname}/io-package.json"`);
2553
- }
2554
- if (ioPack) {
2555
- ioPack.common.host = hostname;
2556
- ioPack.common.runningVersion = version;
2557
- sendTo(msg.from, msg.command, ioPack.common, msg.callback);
2558
- } else {
2559
- sendTo(msg.from, msg.command, null, msg.callback);
2560
- }
2542
+ const ioPackCommon = deepClone(ioPackage.common);
2543
+ ioPackCommon.host = hostname;
2544
+ ioPackCommon.runningVersion = version;
2545
+ sendTo(msg.from, msg.command, ioPackCommon, msg.callback);
2561
2546
  } else {
2562
2547
  logger.error(`${hostLogPrefix} Invalid request ${msg.command}. "callback" or "from" is null`);
2563
2548
  }
@@ -2590,8 +2575,6 @@ async function processMessage(msg) {
2590
2575
 
2591
2576
  case 'getDevList':
2592
2577
  if (msg.callback && msg.from) {
2593
- ioPack = null;
2594
-
2595
2578
  if (os.platform() === 'linux') {
2596
2579
  const _args = ['/dev'];
2597
2580
  logger.info(hostLogPrefix + ' ls /dev');
@@ -2628,8 +2611,6 @@ async function processMessage(msg) {
2628
2611
 
2629
2612
  case 'getLogs':
2630
2613
  if (msg.callback && msg.from) {
2631
- ioPack = null;
2632
-
2633
2614
  const lines = msg.message || 200;
2634
2615
  let text = '';
2635
2616
  let logFile_ = logger.getFileName(); //__dirname + '/log/' + tools.appName + '.log';
@@ -3514,8 +3495,8 @@ function checkVersion(name, version, instances) {
3514
3495
  * Chceks if alle dependencies of an adapter are satisfied
3515
3496
  *
3516
3497
  * @param {string} id - instance id of the requiring instance (only used for logging)
3517
- * @param {string[]|object[]|string} deps - same host dependencies as defined in io-pack
3518
- * @param {string[]|object[]|string} globalDeps - global dependencies, as defined in io-pack
3498
+ * @param {string[] | Record<string, string>[] | string | Record<string, string>} deps - same host dependencies as defined in io-pack
3499
+ * @param {string[] | Record<string, string>[] | string | Record<string, string>} globalDeps - global dependencies, as defined in io-pack
3519
3500
  * @returns {Promise<void>}
3520
3501
  */
3521
3502
  async function checkVersions(id, deps, globalDeps) {
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "iobroker.js-controller",
3
- "version": "4.0.21",
3
+ "version": "4.1.0-alpha.12-20220314-28d0dece",
4
4
  "engines": {
5
5
  "node": ">=12.0.0"
6
6
  },
7
7
  "optionalDependencies": {
8
- "diskusage": "^1.1.3",
9
8
  "greenlock": "^4.0.4",
10
9
  "greenlock-express": "^4.0.3",
11
10
  "le-acme-core": "^2.1.4",
@@ -17,24 +16,24 @@
17
16
  },
18
17
  "dependencies": {
19
18
  "@alcalzone/esbuild-register": "^2.5.1-1",
20
- "@iobroker/db-objects-file": "4.0.21",
21
- "@iobroker/db-objects-jsonl": "4.0.21",
22
- "@iobroker/db-objects-redis": "4.0.21",
23
- "@iobroker/db-states-file": "4.0.21",
24
- "@iobroker/db-states-jsonl": "4.0.21",
25
- "@iobroker/db-states-redis": "4.0.21",
26
- "@iobroker/js-controller-adapter": "4.0.21",
27
- "@iobroker/js-controller-cli": "4.0.21",
28
- "@iobroker/js-controller-common": "4.0.21",
29
- "@iobroker/js-controller-common-db": "4.0.21",
19
+ "@iobroker/db-objects-file": "4.1.0-alpha.12-20220314-28d0dece",
20
+ "@iobroker/db-objects-jsonl": "4.1.0-alpha.12-20220314-28d0dece",
21
+ "@iobroker/db-objects-redis": "4.1.0-alpha.12-20220314-28d0dece",
22
+ "@iobroker/db-states-file": "4.1.0-alpha.12-20220314-28d0dece",
23
+ "@iobroker/db-states-jsonl": "4.1.0-alpha.12-20220314-28d0dece",
24
+ "@iobroker/db-states-redis": "4.1.0-alpha.12-20220314-28d0dece",
25
+ "@iobroker/js-controller-adapter": "4.1.0-alpha.12-20220314-28d0dece",
26
+ "@iobroker/js-controller-cli": "4.1.0-alpha.12-20220314-28d0dece",
27
+ "@iobroker/js-controller-common": "4.1.0-alpha.12-20220314-28d0dece",
28
+ "@iobroker/js-controller-common-db": "4.1.0-alpha.12-20220314-28d0dece",
30
29
  "@iobroker/plugin-base": "~1.2.1",
31
30
  "@iobroker/plugin-sentry": "~1.2.0",
32
- "axios": "^0.24.0",
31
+ "axios": "^0.26.0",
33
32
  "daemonize2": "^0.4.2",
34
33
  "debug": "^4.3.3",
35
34
  "decache": "^4.6.1",
36
35
  "deep-clone": "^3.0.3",
37
- "fs-extra": "^10.0.0",
36
+ "fs-extra": "^10.0.1",
38
37
  "jsonwebtoken": "^8.5.1",
39
38
  "jszip": "^3.7.0",
40
39
  "loadavg-windows": "^1.1.1",
@@ -42,9 +41,8 @@
42
41
  "node-schedule": "^2.1.0",
43
42
  "pidusage": "^3.0.0",
44
43
  "promisify-child-process": "^4.1.1",
45
- "prompt": "^1.2.1",
44
+ "prompt": "^1.2.2",
46
45
  "readline-sync": "^1.4.10",
47
- "request": "^2.88.2",
48
46
  "semver": "^7.3.5",
49
47
  "tar": "^6.1.11",
50
48
  "yargs": "^17.3.0"
@@ -112,5 +110,5 @@
112
110
  "iobroker.js",
113
111
  "main.js"
114
112
  ],
115
- "gitHead": "4749d256d312623ae7621e7ae47d44580b3aa8c1"
113
+ "gitHead": "d6952b80259a70b67b989004fe13f1fb57a76276"
116
114
  }