@iobroker/js-controller-cli 7.2.3-alpha.8-20260709-8d8c9c5ed → 7.2.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.
Files changed (214) hide show
  1. package/build/cjs/index.js +3 -3
  2. package/build/cjs/lib/_Types.d.ts +1 -8
  3. package/build/cjs/lib/cli/cliCert.d.ts +4 -7
  4. package/build/cjs/lib/cli/cliCert.js +6 -10
  5. package/build/cjs/lib/cli/cliCert.js.map +2 -2
  6. package/build/cjs/lib/cli/cliCommand.d.ts +14 -45
  7. package/build/cjs/lib/cli/cliCommand.js +1 -8
  8. package/build/cjs/lib/cli/cliCommand.js.map +2 -2
  9. package/build/cjs/lib/cli/cliCompact.d.ts +2 -5
  10. package/build/cjs/lib/cli/cliCompact.js +2 -9
  11. package/build/cjs/lib/cli/cliCompact.js.map +2 -2
  12. package/build/cjs/lib/cli/cliDebug.d.ts +2 -5
  13. package/build/cjs/lib/cli/cliDebug.js +1 -8
  14. package/build/cjs/lib/cli/cliDebug.js.map +2 -2
  15. package/build/cjs/lib/cli/cliHost.d.ts +10 -13
  16. package/build/cjs/lib/cli/cliHost.js +5 -13
  17. package/build/cjs/lib/cli/cliHost.js.map +2 -2
  18. package/build/cjs/lib/cli/cliLogs.d.ts +3 -9
  19. package/build/cjs/lib/cli/cliLogs.js +1 -12
  20. package/build/cjs/lib/cli/cliLogs.js.map +2 -2
  21. package/build/cjs/lib/cli/cliMessage.d.ts +1 -2
  22. package/build/cjs/lib/cli/cliMessage.js +0 -5
  23. package/build/cjs/lib/cli/cliMessage.js.map +2 -2
  24. package/build/cjs/lib/cli/cliObjects.d.ts +18 -21
  25. package/build/cjs/lib/cli/cliObjects.js +33 -51
  26. package/build/cjs/lib/cli/cliObjects.js.map +2 -2
  27. package/build/cjs/lib/cli/cliPlugin.d.ts +3 -3
  28. package/build/cjs/lib/cli/cliPlugin.js +0 -6
  29. package/build/cjs/lib/cli/cliPlugin.js.map +2 -2
  30. package/build/cjs/lib/cli/cliProcess.d.ts +4 -8
  31. package/build/cjs/lib/cli/cliProcess.js +16 -27
  32. package/build/cjs/lib/cli/cliProcess.js.map +3 -3
  33. package/build/cjs/lib/cli/cliStates.d.ts +4 -7
  34. package/build/cjs/lib/cli/cliStates.js +6 -14
  35. package/build/cjs/lib/cli/cliStates.js.map +2 -2
  36. package/build/cjs/lib/cli/cliTools.js +0 -11
  37. package/build/cjs/lib/cli/cliTools.js.map +1 -1
  38. package/build/cjs/lib/cli/messages.js +46 -47
  39. package/build/cjs/lib/cli/messages.js.map +1 -1
  40. package/build/cjs/lib/setup/customError.d.ts +0 -4
  41. package/build/cjs/lib/setup/customError.js +0 -7
  42. package/build/cjs/lib/setup/customError.js.map +2 -2
  43. package/build/cjs/lib/setup/dbConnection.js +64 -69
  44. package/build/cjs/lib/setup/dbConnection.js.map +3 -3
  45. package/build/cjs/lib/setup/formatters.d.ts +4 -4
  46. package/build/cjs/lib/setup/formatters.js +0 -5
  47. package/build/cjs/lib/setup/formatters.js.map +2 -2
  48. package/build/cjs/lib/setup/multihostClient.js +2 -6
  49. package/build/cjs/lib/setup/multihostClient.js.map +1 -1
  50. package/build/cjs/lib/setup/pluginInfos.d.ts +0 -5
  51. package/build/cjs/lib/setup/pluginInfos.js +0 -2
  52. package/build/cjs/lib/setup/pluginInfos.js.map +2 -2
  53. package/build/cjs/lib/setup/setupBackup.d.ts +0 -34
  54. package/build/cjs/lib/setup/setupBackup.js +12 -46
  55. package/build/cjs/lib/setup/setupBackup.js.map +3 -3
  56. package/build/cjs/lib/setup/setupInstall.d.ts +15 -38
  57. package/build/cjs/lib/setup/setupInstall.js +24 -42
  58. package/build/cjs/lib/setup/setupInstall.js.map +2 -2
  59. package/build/cjs/lib/setup/setupLicense.d.ts +0 -8
  60. package/build/cjs/lib/setup/setupLicense.js +0 -7
  61. package/build/cjs/lib/setup/setupLicense.js.map +2 -2
  62. package/build/cjs/lib/setup/setupList.d.ts +1 -55
  63. package/build/cjs/lib/setup/setupList.js +24 -78
  64. package/build/cjs/lib/setup/setupList.js.map +3 -3
  65. package/build/cjs/lib/setup/setupMultihost.js +9 -12
  66. package/build/cjs/lib/setup/setupMultihost.js.map +3 -3
  67. package/build/cjs/lib/setup/setupPacketManager.d.ts +0 -10
  68. package/build/cjs/lib/setup/setupPacketManager.js +6 -16
  69. package/build/cjs/lib/setup/setupPacketManager.js.map +2 -2
  70. package/build/cjs/lib/setup/setupRepo.d.ts +0 -6
  71. package/build/cjs/lib/setup/setupRepo.js +11 -28
  72. package/build/cjs/lib/setup/setupRepo.js.map +2 -2
  73. package/build/cjs/lib/setup/setupSetup.d.ts +0 -27
  74. package/build/cjs/lib/setup/setupSetup.js +33 -52
  75. package/build/cjs/lib/setup/setupSetup.js.map +3 -3
  76. package/build/cjs/lib/setup/setupUpgrade.d.ts +2 -8
  77. package/build/cjs/lib/setup/setupUpgrade.js +10 -19
  78. package/build/cjs/lib/setup/setupUpgrade.js.map +2 -2
  79. package/build/cjs/lib/setup/setupUpload.d.ts +1 -72
  80. package/build/cjs/lib/setup/setupUpload.js +6 -74
  81. package/build/cjs/lib/setup/setupUpload.js.map +2 -2
  82. package/build/cjs/lib/setup/setupUsers.d.ts +14 -23
  83. package/build/cjs/lib/setup/setupUsers.js +15 -58
  84. package/build/cjs/lib/setup/setupUsers.js.map +2 -2
  85. package/build/cjs/lib/setup/setupVendor.d.ts +1 -9
  86. package/build/cjs/lib/setup/setupVendor.js +6 -13
  87. package/build/cjs/lib/setup/setupVendor.js.map +2 -2
  88. package/build/cjs/lib/setup/setupVisDebug.d.ts +2 -11
  89. package/build/cjs/lib/setup/setupVisDebug.js +15 -21
  90. package/build/cjs/lib/setup/setupVisDebug.js.map +3 -3
  91. package/build/cjs/lib/setup/utils.d.ts +1 -1
  92. package/build/cjs/lib/setup/utils.js +9 -13
  93. package/build/cjs/lib/setup/utils.js.map +3 -3
  94. package/build/cjs/lib/setup.js +330 -269
  95. package/build/cjs/lib/setup.js.map +3 -3
  96. package/build/esm/lib/_Types.d.ts +1 -8
  97. package/build/esm/lib/_Types.d.ts.map +1 -1
  98. package/build/esm/lib/cli/cliCert.d.ts +4 -7
  99. package/build/esm/lib/cli/cliCert.d.ts.map +1 -1
  100. package/build/esm/lib/cli/cliCert.js +6 -6
  101. package/build/esm/lib/cli/cliCert.js.map +1 -1
  102. package/build/esm/lib/cli/cliCommand.d.ts +14 -45
  103. package/build/esm/lib/cli/cliCommand.d.ts.map +1 -1
  104. package/build/esm/lib/cli/cliCommand.js +1 -4
  105. package/build/esm/lib/cli/cliCommand.js.map +1 -1
  106. package/build/esm/lib/cli/cliCompact.d.ts +2 -5
  107. package/build/esm/lib/cli/cliCompact.d.ts.map +1 -1
  108. package/build/esm/lib/cli/cliCompact.js +2 -5
  109. package/build/esm/lib/cli/cliCompact.js.map +1 -1
  110. package/build/esm/lib/cli/cliDebug.d.ts +2 -5
  111. package/build/esm/lib/cli/cliDebug.d.ts.map +1 -1
  112. package/build/esm/lib/cli/cliDebug.js +1 -4
  113. package/build/esm/lib/cli/cliDebug.js.map +1 -1
  114. package/build/esm/lib/cli/cliHost.d.ts +10 -13
  115. package/build/esm/lib/cli/cliHost.d.ts.map +1 -1
  116. package/build/esm/lib/cli/cliHost.js +5 -8
  117. package/build/esm/lib/cli/cliHost.js.map +1 -1
  118. package/build/esm/lib/cli/cliLogs.d.ts +3 -9
  119. package/build/esm/lib/cli/cliLogs.d.ts.map +1 -1
  120. package/build/esm/lib/cli/cliLogs.js +1 -8
  121. package/build/esm/lib/cli/cliLogs.js.map +1 -1
  122. package/build/esm/lib/cli/cliMessage.d.ts +1 -2
  123. package/build/esm/lib/cli/cliMessage.d.ts.map +1 -1
  124. package/build/esm/lib/cli/cliMessage.js +0 -1
  125. package/build/esm/lib/cli/cliMessage.js.map +1 -1
  126. package/build/esm/lib/cli/cliObjects.d.ts +18 -21
  127. package/build/esm/lib/cli/cliObjects.d.ts.map +1 -1
  128. package/build/esm/lib/cli/cliObjects.js +38 -44
  129. package/build/esm/lib/cli/cliObjects.js.map +1 -1
  130. package/build/esm/lib/cli/cliPlugin.d.ts +3 -3
  131. package/build/esm/lib/cli/cliPlugin.d.ts.map +1 -1
  132. package/build/esm/lib/cli/cliPlugin.js +1 -1
  133. package/build/esm/lib/cli/cliPlugin.js.map +1 -1
  134. package/build/esm/lib/cli/cliProcess.d.ts +4 -8
  135. package/build/esm/lib/cli/cliProcess.d.ts.map +1 -1
  136. package/build/esm/lib/cli/cliProcess.js +4 -7
  137. package/build/esm/lib/cli/cliProcess.js.map +1 -1
  138. package/build/esm/lib/cli/cliStates.d.ts +4 -7
  139. package/build/esm/lib/cli/cliStates.d.ts.map +1 -1
  140. package/build/esm/lib/cli/cliStates.js +2 -6
  141. package/build/esm/lib/cli/cliStates.js.map +1 -1
  142. package/build/esm/lib/setup/customError.d.ts +0 -4
  143. package/build/esm/lib/setup/customError.d.ts.map +1 -1
  144. package/build/esm/lib/setup/customError.js +0 -3
  145. package/build/esm/lib/setup/customError.js.map +1 -1
  146. package/build/esm/lib/setup/dbConnection.d.ts.map +1 -1
  147. package/build/esm/lib/setup/dbConnection.js +13 -10
  148. package/build/esm/lib/setup/dbConnection.js.map +1 -1
  149. package/build/esm/lib/setup/formatters.d.ts +4 -4
  150. package/build/esm/lib/setup/formatters.js +4 -4
  151. package/build/esm/lib/setup/pluginInfos.d.ts +0 -5
  152. package/build/esm/lib/setup/pluginInfos.d.ts.map +1 -1
  153. package/build/esm/lib/setup/pluginInfos.js +0 -5
  154. package/build/esm/lib/setup/pluginInfos.js.map +1 -1
  155. package/build/esm/lib/setup/setupBackup.d.ts +0 -34
  156. package/build/esm/lib/setup/setupBackup.d.ts.map +1 -1
  157. package/build/esm/lib/setup/setupBackup.js +12 -46
  158. package/build/esm/lib/setup/setupBackup.js.map +1 -1
  159. package/build/esm/lib/setup/setupInstall.d.ts +15 -38
  160. package/build/esm/lib/setup/setupInstall.d.ts.map +1 -1
  161. package/build/esm/lib/setup/setupInstall.js +21 -38
  162. package/build/esm/lib/setup/setupInstall.js.map +1 -1
  163. package/build/esm/lib/setup/setupLicense.d.ts +0 -8
  164. package/build/esm/lib/setup/setupLicense.d.ts.map +1 -1
  165. package/build/esm/lib/setup/setupLicense.js +0 -6
  166. package/build/esm/lib/setup/setupLicense.js.map +1 -1
  167. package/build/esm/lib/setup/setupList.d.ts +1 -55
  168. package/build/esm/lib/setup/setupList.d.ts.map +1 -1
  169. package/build/esm/lib/setup/setupList.js +8 -61
  170. package/build/esm/lib/setup/setupList.js.map +1 -1
  171. package/build/esm/lib/setup/setupMultihost.d.ts.map +1 -1
  172. package/build/esm/lib/setup/setupMultihost.js +6 -5
  173. package/build/esm/lib/setup/setupMultihost.js.map +1 -1
  174. package/build/esm/lib/setup/setupPacketManager.d.ts +0 -10
  175. package/build/esm/lib/setup/setupPacketManager.d.ts.map +1 -1
  176. package/build/esm/lib/setup/setupPacketManager.js +0 -9
  177. package/build/esm/lib/setup/setupPacketManager.js.map +1 -1
  178. package/build/esm/lib/setup/setupRepo.d.ts +0 -6
  179. package/build/esm/lib/setup/setupRepo.d.ts.map +1 -1
  180. package/build/esm/lib/setup/setupRepo.js +14 -30
  181. package/build/esm/lib/setup/setupRepo.js.map +1 -1
  182. package/build/esm/lib/setup/setupSetup.d.ts +0 -27
  183. package/build/esm/lib/setup/setupSetup.d.ts.map +1 -1
  184. package/build/esm/lib/setup/setupSetup.js +21 -36
  185. package/build/esm/lib/setup/setupSetup.js.map +1 -1
  186. package/build/esm/lib/setup/setupUpgrade.d.ts +2 -8
  187. package/build/esm/lib/setup/setupUpgrade.d.ts.map +1 -1
  188. package/build/esm/lib/setup/setupUpgrade.js +6 -14
  189. package/build/esm/lib/setup/setupUpgrade.js.map +1 -1
  190. package/build/esm/lib/setup/setupUpload.d.ts +1 -72
  191. package/build/esm/lib/setup/setupUpload.d.ts.map +1 -1
  192. package/build/esm/lib/setup/setupUpload.js +5 -72
  193. package/build/esm/lib/setup/setupUpload.js.map +1 -1
  194. package/build/esm/lib/setup/setupUsers.d.ts +14 -23
  195. package/build/esm/lib/setup/setupUsers.d.ts.map +1 -1
  196. package/build/esm/lib/setup/setupUsers.js +14 -56
  197. package/build/esm/lib/setup/setupUsers.js.map +1 -1
  198. package/build/esm/lib/setup/setupVendor.d.ts +1 -9
  199. package/build/esm/lib/setup/setupVendor.d.ts.map +1 -1
  200. package/build/esm/lib/setup/setupVendor.js +1 -7
  201. package/build/esm/lib/setup/setupVendor.js.map +1 -1
  202. package/build/esm/lib/setup/setupVisDebug.d.ts +2 -11
  203. package/build/esm/lib/setup/setupVisDebug.d.ts.map +1 -1
  204. package/build/esm/lib/setup/setupVisDebug.js +14 -21
  205. package/build/esm/lib/setup/setupVisDebug.js.map +1 -1
  206. package/build/esm/lib/setup/utils.d.ts +1 -1
  207. package/build/esm/lib/setup/utils.d.ts.map +1 -1
  208. package/build/esm/lib/setup/utils.js +4 -2
  209. package/build/esm/lib/setup/utils.js.map +1 -1
  210. package/build/esm/lib/setup.d.ts.map +1 -1
  211. package/build/esm/lib/setup.js +211 -162
  212. package/build/esm/lib/setup.js.map +1 -1
  213. package/build/tsconfig.build.tsbuildinfo +1 -1
  214. package/package.json +14 -14
@@ -16,8 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var index_exports = {};
20
- __export(index_exports, {
19
+ var esm_exports = {};
20
+ __export(esm_exports, {
21
21
  BackupRestore: () => import_setupBackup.BackupRestore,
22
22
  PacketManager: () => import_setupPacketManager.PacketManager,
23
23
  Upgrade: () => import_setupUpgrade.Upgrade,
@@ -26,7 +26,7 @@ __export(index_exports, {
26
26
  dbConnectAsync: () => import_dbConnection.dbConnectAsync,
27
27
  execute: () => import_setup.execute
28
28
  });
29
- module.exports = __toCommonJS(index_exports);
29
+ module.exports = __toCommonJS(esm_exports);
30
30
  var import_setup = require("./lib/setup.js");
31
31
  var import_dbConnection = require("./lib/setup/dbConnection.js");
32
32
  var import_setupVendor = require("./lib/setup/setupVendor.js");
@@ -1,18 +1,13 @@
1
1
  import type { Client as StatesRedisClient } from '@iobroker/db-states-redis';
2
2
  import type { Client as ObjectsRedisClient } from '@iobroker/db-objects-redis';
3
3
  export type ProcessExitCallback = (exitCode: number) => void;
4
- export type CleanDatabaseHandler = (isDeleteDb: boolean) => Promise<number>;
4
+ export type CleanDatabaseHandler = (isDeleteDb: boolean) => any;
5
5
  export type DbConnectCallback = (params: DbConnectAsyncReturn) => void;
6
6
  export type DbConnect = (onlyCheckOrParams?: boolean | Record<string, any>, paramsOrCb?: Record<string, any> | DbConnectCallback, callback?: DbConnectCallback) => void;
7
- /** Result returned once the database connection has been established */
8
7
  export interface DbConnectAsyncReturn {
9
- /** The connected objects database client */
10
8
  objects: ObjectsRedisClient;
11
- /** The connected states database client */
12
9
  states: StatesRedisClient;
13
- /** Whether the controller is offline (no running host) */
14
10
  isOffline?: boolean;
15
- /** Type of the objects database backend */
16
11
  objectsDBType: string;
17
12
  /** The iobroker.json config file */
18
13
  config: ioBroker.IoBrokerJson;
@@ -27,9 +22,7 @@ interface IoPackageCommon extends ioBroker.AdapterCommon {
27
22
  };
28
23
  };
29
24
  }
30
- /** An adapter object as stored in io-package.json */
31
25
  export interface IoPackage extends ioBroker.AdapterObject {
32
- /** The common section including the plugins configuration */
33
26
  common: IoPackageCommon;
34
27
  }
35
28
  export {};
@@ -1,16 +1,13 @@
1
1
  import { CLICommand, type CLICommandOptions } from './cliCommand.js';
2
2
  /** Command ioBroker cert ... */
3
3
  export declare class CLICert extends CLICommand {
4
- /**
5
- * @param options The command options including context and parameters
6
- */
7
4
  constructor(options: CLICommandOptions);
8
5
  /**
9
6
  * Executes a command
10
7
  *
11
- * @param args The command arguments (the first is the sub-command)
8
+ * @param args
12
9
  */
13
- execute(args: string[]): void | Promise<void>;
10
+ execute(args: any[]): void | Promise<void>;
14
11
  /**
15
12
  * Create new private certificate
16
13
  */
@@ -18,8 +15,8 @@ export declare class CLICert extends CLICommand {
18
15
  /**
19
16
  * View the certificates on CLI
20
17
  *
21
- * @param _args The command arguments (the second is the certificate name)
18
+ * @param _args
22
19
  */
23
- view(_args: string[]): void;
20
+ view(_args: any[]): void;
24
21
  }
25
22
  //# sourceMappingURL=cliCert.d.ts.map
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
8
  var __export = (target, all) => {
10
9
  for (var name in all)
11
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -37,19 +36,13 @@ var import_cliObjects = require("./cliObjects.js");
37
36
  var messages = __toESM(require("./messages.js"), 1);
38
37
  var import_js_controller_common = require("@iobroker/js-controller-common");
39
38
  class CLICert extends import_cliCommand.CLICommand {
40
- static {
41
- __name(this, "CLICert");
42
- }
43
- /**
44
- * @param options The command options including context and parameters
45
- */
46
39
  constructor(options) {
47
40
  super(options);
48
41
  }
49
42
  /**
50
43
  * Executes a command
51
44
  *
52
- * @param args The command arguments (the first is the sub-command)
45
+ * @param args
53
46
  */
54
47
  execute(args) {
55
48
  const { callback, showHelp } = this.options;
@@ -89,10 +82,13 @@ class CLICert extends import_cliCommand.CLICommand {
89
82
  /**
90
83
  * View the certificates on CLI
91
84
  *
92
- * @param _args The command arguments (the second is the certificate name)
85
+ * @param _args
93
86
  */
94
87
  view(_args) {
95
- const certName = _args[1] ?? "defaultPublic";
88
+ let certName = _args[1];
89
+ if (certName === void 0) {
90
+ certName = "defaultPublic";
91
+ }
96
92
  const { callback, dbConnect } = this.options;
97
93
  dbConnect((params) => {
98
94
  const { objects } = params;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/cli/cliCert.ts"],
4
- "sourcesContent": ["import { CLICommand, type CLICommandOptions } from './cliCommand.js';\nimport { CLIObjects } from './cliObjects.js';\nimport * as messages from './messages.js';\nimport { tools, EXIT_CODES } from '@iobroker/js-controller-common';\n\n/** Command ioBroker cert ... */\nexport class CLICert extends CLICommand {\n /**\n * @param options The command options including context and parameters\n */\n constructor(options: CLICommandOptions) {\n super(options);\n }\n\n /**\n * Executes a command\n *\n * @param args The command arguments (the first is the sub-command)\n */\n execute(args: string[]): void | Promise<void> {\n const { callback, showHelp } = this.options;\n const command = args[0];\n\n switch (command) {\n case 'renew':\n case 'create':\n return this.create();\n case 'view':\n return this.view(args);\n default:\n messages.error.unknownCommand('cert', command);\n showHelp();\n return void callback(3);\n }\n }\n\n /**\n * Create new private certificate\n */\n async create(): Promise<void> {\n const id = 'system.certificates';\n const certPropPath = 'native.certificates';\n\n const certificates = tools.generateDefaultCertificates();\n if (certificates) {\n console.log(JSON.stringify(certificates, null, 2));\n for (const [certName, cert] of Object.entries(certificates)) {\n // use the command `iobroker object set ...` to update the certificate\n console.log(`Update certificate ${certName}`);\n\n const objectsCommandArgs = ['set', id, `${certPropPath}.${certName}=${cert as string}`];\n await new Promise(resolve => {\n const objectsCommand = new CLIObjects({ ...this.options, callback: resolve });\n objectsCommand.execute(objectsCommandArgs);\n });\n }\n }\n\n this.options.callback(EXIT_CODES.NO_ERROR);\n }\n\n /**\n * View the certificates on CLI\n *\n * @param _args The command arguments (the second is the certificate name)\n */\n view(_args: string[]): void {\n const certName = _args[1] ?? 'defaultPublic';\n const { callback, dbConnect } = this.options;\n dbConnect(params => {\n const { objects } = params;\n\n objects.getObject('system.certificates', (err, certs) => {\n if (!err && certs?.native?.certificates?.[certName]) {\n const certInfo = tools.getCertificateInfo(certs.native.certificates[certName]);\n if (certInfo) {\n console.log(JSON.stringify(certInfo, null, 2));\n return void callback(EXIT_CODES.NO_ERROR);\n }\n messages.error.cert(certName);\n return void callback(3);\n }\n messages.error.cert(certName);\n return void callback(3);\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AO,IAAK;AAEpB,cAAQ,UAAU,uBAAuB,CAAC,KAAK,UAAS;AACpD,YAAI,CAAC,OAAO,OAAO,QAAQ,eAAe,QAAQ,GAAG;AACjD,gBAAM,WAAW,kCAAM,mBAAmB,MAAM,OAAO,aAAa,QAAQ,CAAC;AAC7E,cAAI,UAAU;AACV,oBAAQ,IAAI,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAC7C,mBAAO,KAAK,SAAS,uCAAW,QAAQ;UAC5C;AACA,mBAAS,MAAM,KAAK,QAAQ;AAC5B,iBAAO,KAAK,SAAS,CAAC;QAC1B;AACA,iBAAS,MAAM,KAAK,QAAQ;AAC5B,eAAO,KAAK,SAAS,CAAC;MAC1B,CAAC;IACL,CAAC;EACL;;",
4
+ "sourcesContent": ["import { CLICommand, type CLICommandOptions } from './cliCommand.js';\nimport { CLIObjects } from './cliObjects.js';\nimport * as messages from './messages.js';\nimport { tools, EXIT_CODES } from '@iobroker/js-controller-common';\n\n/** Command ioBroker cert ... */\nexport class CLICert extends CLICommand {\n constructor(options: CLICommandOptions) {\n super(options);\n }\n\n /**\n * Executes a command\n *\n * @param args\n */\n execute(args: any[]): void | Promise<void> {\n const { callback, showHelp } = this.options;\n const command = args[0];\n\n switch (command) {\n case 'renew':\n case 'create':\n return this.create();\n case 'view':\n return this.view(args);\n default:\n messages.error.unknownCommand('cert', command);\n showHelp();\n return void callback(3);\n }\n }\n\n /**\n * Create new private certificate\n */\n async create(): Promise<void> {\n const id = 'system.certificates';\n const certPropPath = 'native.certificates';\n\n const certificates = tools.generateDefaultCertificates();\n if (certificates) {\n console.log(JSON.stringify(certificates, null, 2));\n for (const [certName, cert] of Object.entries(certificates)) {\n // use the command `iobroker object set ...` to update the certificate\n console.log(`Update certificate ${certName}`);\n\n const objectsCommandArgs = ['set', id, `${certPropPath}.${certName}=${cert as string}`];\n await new Promise(resolve => {\n const objectsCommand = new CLIObjects({ ...this.options, callback: resolve });\n objectsCommand.execute(objectsCommandArgs);\n });\n }\n }\n\n this.options.callback(EXIT_CODES.NO_ERROR);\n }\n\n /**\n * View the certificates on CLI\n *\n * @param _args\n */\n view(_args: any[]): void {\n let certName = _args[1];\n if (certName === undefined) {\n certName = 'defaultPublic';\n }\n const { callback, dbConnect } = this.options;\n dbConnect(params => {\n const { objects } = params;\n\n objects.getObject('system.certificates', (err, certs) => {\n if (!err && certs?.native?.certificates?.[certName]) {\n const certInfo = tools.getCertificateInfo(certs.native.certificates[certName]);\n if (certInfo) {\n console.log(JSON.stringify(certInfo, null, 2));\n return void callback(EXIT_CODES.NO_ERROR);\n }\n messages.error.cert(certName);\n return void callback(3);\n }\n messages.error.cert(certName);\n return void callback(3);\n });\n });\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,wBAAmD;AACnD,wBAA2B;AAC3B,eAA0B;AAC1B,kCAAkC;AAG5B,MAAO,gBAAgB,6BAAU;EACnC,YAAY,SAA0B;AAClC,UAAM,OAAO;EACjB;;;;;;EAOA,QAAQ,MAAW;AACf,UAAM,EAAE,UAAU,SAAQ,IAAK,KAAK;AACpC,UAAM,UAAU,KAAK,CAAC;AAEtB,YAAQ,SAAS;MACb,KAAK;MACL,KAAK;AACD,eAAO,KAAK,OAAM;MACtB,KAAK;AACD,eAAO,KAAK,KAAK,IAAI;MACzB;AACI,iBAAS,MAAM,eAAe,QAAQ,OAAO;AAC7C,iBAAQ;AACR,eAAO,KAAK,SAAS,CAAC;IAC9B;EACJ;;;;EAKA,MAAM,SAAM;AACR,UAAM,KAAK;AACX,UAAM,eAAe;AAErB,UAAM,eAAe,kCAAM,4BAA2B;AACtD,QAAI,cAAc;AACd,cAAQ,IAAI,KAAK,UAAU,cAAc,MAAM,CAAC,CAAC;AACjD,iBAAW,CAAC,UAAU,IAAI,KAAK,OAAO,QAAQ,YAAY,GAAG;AAEzD,gBAAQ,IAAI,sBAAsB,QAAQ,EAAE;AAE5C,cAAM,qBAAqB,CAAC,OAAO,IAAI,GAAG,YAAY,IAAI,QAAQ,IAAI,IAAc,EAAE;AACtF,cAAM,IAAI,QAAQ,aAAU;AACxB,gBAAM,iBAAiB,IAAI,6BAAW,EAAE,GAAG,KAAK,SAAS,UAAU,QAAO,CAAE;AAC5E,yBAAe,QAAQ,kBAAkB;QAC7C,CAAC;MACL;IACJ;AAEA,SAAK,QAAQ,SAAS,uCAAW,QAAQ;EAC7C;;;;;;EAOA,KAAK,OAAY;AACb,QAAI,WAAW,MAAM,CAAC;AACtB,QAAI,aAAa,QAAW;AACxB,iBAAW;IACf;AACA,UAAM,EAAE,UAAU,UAAS,IAAK,KAAK;AACrC,cAAU,YAAS;AACf,YAAM,EAAE,QAAO,IAAK;AAEpB,cAAQ,UAAU,uBAAuB,CAAC,KAAK,UAAS;AACpD,YAAI,CAAC,OAAO,OAAO,QAAQ,eAAe,QAAQ,GAAG;AACjD,gBAAM,WAAW,kCAAM,mBAAmB,MAAM,OAAO,aAAa,QAAQ,CAAC;AAC7E,cAAI,UAAU;AACV,oBAAQ,IAAI,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAC7C,mBAAO,KAAK,SAAS,uCAAW,QAAQ;UAC5C;AACA,mBAAS,MAAM,KAAK,QAAQ;AAC5B,iBAAO,KAAK,SAAS,CAAC;QAC1B;AACA,iBAAS,MAAM,KAAK,QAAQ;AAC5B,eAAO,KAAK,SAAS,CAAC;MAC1B,CAAC;IACL,CAAC;EACL;;",
6
6
  "names": []
7
7
  }
@@ -1,77 +1,46 @@
1
1
  import type { DbConnectCallback } from '../_Types.js';
2
- /** Context provided to every CLI command */
3
2
  export interface CLICommandContext {
4
3
  /** Invoke this before doing anything in the database */
5
4
  dbConnect: (callback: DbConnectCallback) => void;
6
- /** Finish the command with the given exit code */
7
5
  callback: (code?: number) => void;
8
- /** Show the command help */
9
6
  showHelp: (yargs?: any) => void;
10
7
  }
11
- /** Parameters (CLI flags) that may be passed to a command */
12
8
  export interface CLICommandParams {
13
- /** Text encoding to use for output */
14
9
  encoding?: BufferEncoding;
15
- /** Pretty-print the output */
16
10
  pretty?: boolean;
17
- /** Force the operation even if it would normally be refused */
18
11
  force?: boolean;
19
- /** Password to use */
20
- password?: string;
21
- /** Restrict the operation to the given group */
22
- ingroup?: string;
23
- /** Short alias for the version flag */
24
- v?: string;
25
- /** Show the version */
26
- version?: string | number;
27
- /** Timeout in milliseconds */
28
- timeout?: number;
29
- /** Only include enabled instances */
30
- enabled?: boolean;
31
- /** Only include disabled instances */
32
- disabled?: boolean;
33
- /** Port to use */
34
- port?: number;
35
- /** Use SSL */
36
- ssl?: boolean;
37
- /** IP address to bind to */
38
- ip?: string;
39
- /** Only include updatable adapters */
40
- updatable?: boolean;
41
- /** Host to operate on */
42
- host?: string;
43
- /** Certificate to use */
44
- cert?: string;
45
- /** Working directory */
12
+ password?: any;
13
+ ingroup?: any;
14
+ v?: any;
15
+ version?: any;
16
+ timeout?: any;
17
+ enabled?: any;
18
+ disabled?: any;
19
+ port?: any;
20
+ ssl?: any;
21
+ ip?: any;
22
+ updatable?: any;
23
+ host?: any;
24
+ cert?: any;
46
25
  cwd?: string;
47
- /** File system path */
48
26
  path?: string;
49
- /** Module name */
50
27
  module?: string;
51
- /** Wait for the operation to complete */
52
28
  wait?: boolean;
53
- /** Automatically answer yes to confirmation prompts */
54
29
  yes?: boolean;
55
- /** Short alias for force */
56
30
  f?: boolean;
57
- /** Short alias for yes */
58
31
  y?: boolean;
59
- /** Apply the operation to all matching items */
60
32
  all?: boolean;
61
33
  }
62
34
  export type CLICommandOptions = CLICommandContext & CLICommandParams;
63
35
  /** The base class for any CLI command */
64
36
  export declare class CLICommand<TCommandOptions extends CLICommandOptions = CLICommandOptions> {
65
37
  protected readonly options: TCommandOptions;
66
- /**
67
- * @param options The command options including the context (callback, dbConnect) and parameters
68
- */
69
38
  constructor(options: TCommandOptions);
70
39
  /**
71
40
  * Ensures that an argument was passed in the options.
72
41
  * Throws otherwise
73
42
  *
74
- * @param arg The name of the option that is required
43
+ * @param arg
75
44
  */
76
45
  requireOption(arg: keyof CLICommandOptions): void;
77
46
  }
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
6
  var __export = (target, all) => {
8
7
  for (var name in all)
9
8
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -23,13 +22,7 @@ __export(cliCommand_exports, {
23
22
  });
24
23
  module.exports = __toCommonJS(cliCommand_exports);
25
24
  class CLICommand {
26
- static {
27
- __name(this, "CLICommand");
28
- }
29
25
  options;
30
- /**
31
- * @param options The command options including the context (callback, dbConnect) and parameters
32
- */
33
26
  constructor(options) {
34
27
  if (options === null || options === void 0) {
35
28
  throw new Error(`No options given`);
@@ -42,7 +35,7 @@ class CLICommand {
42
35
  * Ensures that an argument was passed in the options.
43
36
  * Throws otherwise
44
37
  *
45
- * @param arg The name of the option that is required
38
+ * @param arg
46
39
  */
47
40
  requireOption(arg) {
48
41
  if (this.options[arg] === void 0) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/cli/cliCommand.ts"],
4
- "sourcesContent": ["import type { DbConnectCallback } from '../_Types.js';\n\n/** Context provided to every CLI command */\nexport interface CLICommandContext {\n /** Invoke this before doing anything in the database */\n dbConnect: (callback: DbConnectCallback) => void;\n /** Finish the command with the given exit code */\n callback: (code?: number) => void;\n /** Show the command help */\n showHelp: (yargs?: any) => void;\n}\n\n/** Parameters (CLI flags) that may be passed to a command */\nexport interface CLICommandParams {\n /** Text encoding to use for output */\n encoding?: BufferEncoding;\n /** Pretty-print the output */\n pretty?: boolean;\n /** Force the operation even if it would normally be refused */\n force?: boolean;\n /** Password to use */\n password?: string;\n /** Restrict the operation to the given group */\n ingroup?: string;\n /** Short alias for the version flag */\n v?: string;\n /** Show the version */\n version?: string | number;\n /** Timeout in milliseconds */\n timeout?: number;\n /** Only include enabled instances */\n enabled?: boolean;\n /** Only include disabled instances */\n disabled?: boolean;\n /** Port to use */\n port?: number;\n /** Use SSL */\n ssl?: boolean;\n /** IP address to bind to */\n ip?: string;\n /** Only include updatable adapters */\n updatable?: boolean;\n /** Host to operate on */\n host?: string;\n /** Certificate to use */\n cert?: string;\n /** Working directory */\n cwd?: string;\n /** File system path */\n path?: string;\n /** Module name */\n module?: string;\n /** Wait for the operation to complete */\n wait?: boolean;\n /** Automatically answer yes to confirmation prompts */\n yes?: boolean;\n /** Short alias for force */\n f?: boolean;\n /** Short alias for yes */\n y?: boolean;\n /** Apply the operation to all matching items */\n all?: boolean;\n}\n\nexport type CLICommandOptions = CLICommandContext & CLICommandParams;\n\n/** The base class for any CLI command */\nexport class CLICommand<TCommandOptions extends CLICommandOptions = CLICommandOptions> {\n protected readonly options: TCommandOptions;\n\n /**\n * @param options The command options including the context (callback, dbConnect) and parameters\n */\n constructor(options: TCommandOptions) {\n if (options === null || options === undefined) {\n throw new Error(`No options given`);\n }\n\n this.options = options;\n // Always require the callback and a wrapper for DB actions\n this.requireOption('callback');\n this.requireOption('dbConnect');\n }\n\n /**\n * Ensures that an argument was passed in the options.\n * Throws otherwise\n *\n * @param arg The name of the option that is required\n */\n requireOption(arg: keyof CLICommandOptions): void {\n if (this.options[arg] === undefined) {\n throw new Error(`Invalid arguments: ${arg} is missing`);\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAkEA;;;;;AACM,MAAO,WAAU;EADvB,OACuB;;;EACA;;;;EAKnB,YAAY,SAAwB;AAChC,QAAI,YAAY,QAAQ,YAAY,QAAW;AAC3C,YAAM,IAAI,MAAM,kBAAkB;IACtC;AAEA,SAAK,UAAU;AAEf,SAAK,cAAc,UAAU;AAC7B,SAAK,cAAc,WAAW;EAClC;;;;;;;EAQA,cAAc,KAA4B;AACtC,QAAI,KAAK,QAAQ,GAAG,MAAM,QAAW;AACjC,YAAM,IAAI,MAAM,sBAAsB,GAAG,aAAa;IAC1D;EACJ;;",
4
+ "sourcesContent": ["import type { DbConnectCallback } from '../_Types.js';\n\nexport interface CLICommandContext {\n /** Invoke this before doing anything in the database */\n dbConnect: (callback: DbConnectCallback) => void;\n callback: (code?: number) => void;\n showHelp: (yargs?: any) => void;\n}\n\nexport interface CLICommandParams {\n encoding?: BufferEncoding;\n pretty?: boolean;\n force?: boolean;\n password?: any;\n ingroup?: any;\n v?: any;\n version?: any;\n timeout?: any;\n enabled?: any;\n disabled?: any;\n port?: any;\n ssl?: any;\n ip?: any;\n updatable?: any;\n host?: any;\n cert?: any;\n cwd?: string;\n path?: string;\n module?: string;\n wait?: boolean;\n yes?: boolean;\n f?: boolean;\n y?: boolean;\n all?: boolean;\n}\n\nexport type CLICommandOptions = CLICommandContext & CLICommandParams;\n\n/** The base class for any CLI command */\nexport class CLICommand<TCommandOptions extends CLICommandOptions = CLICommandOptions> {\n protected readonly options: TCommandOptions;\n\n constructor(options: TCommandOptions) {\n if (options === null || options === undefined) {\n throw new Error(`No options given`);\n }\n\n this.options = options;\n // Always require the callback and a wrapper for DB actions\n this.requireOption('callback');\n this.requireOption('dbConnect');\n }\n\n /**\n * Ensures that an argument was passed in the options.\n * Throws otherwise\n *\n * @param arg\n */\n requireOption(arg: keyof CLICommandOptions): void {\n if (this.options[arg] === undefined) {\n throw new Error(`Invalid arguments: ${arg} is missing`);\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAsCA;;;;;AACM,MAAO,WAAU;EACA;EAEnB,YAAY,SAAwB;AAChC,QAAI,YAAY,QAAQ,YAAY,QAAW;AAC3C,YAAM,IAAI,MAAM,kBAAkB;IACtC;AAEA,SAAK,UAAU;AAEf,SAAK,cAAc,UAAU;AAC7B,SAAK,cAAc,WAAW;EAClC;;;;;;;EAQA,cAAc,KAA4B;AACtC,QAAI,KAAK,QAAQ,GAAG,MAAM,QAAW;AACjC,YAAM,IAAI,MAAM,sBAAsB,GAAG,aAAa;IAC1D;EACJ;;",
6
6
  "names": []
7
7
  }
@@ -2,16 +2,13 @@ import { CLICommand, type CLICommandOptions } from './cliCommand.js';
2
2
  /** Command ioBroker compact ... */
3
3
  export declare class CLICompact extends CLICommand {
4
4
  private readonly config;
5
- /**
6
- * @param options The command options including context and parameters
7
- */
8
5
  constructor(options: CLICommandOptions);
9
6
  /**
10
7
  * Executes a command
11
8
  *
12
- * @param args The command arguments (the first is the sub-command)
9
+ * @param args
13
10
  */
14
- execute(args: string[]): void;
11
+ execute(args: any[]): void;
15
12
  /**
16
13
  * Output status of compact mode for host
17
14
  */
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
8
  var __export = (target, all) => {
10
9
  for (var name in all)
11
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -37,20 +36,14 @@ var import_cliCommand = require("./cliCommand.js");
37
36
  var import_js_controller_common = require("@iobroker/js-controller-common");
38
37
  var import_fs_extra = __toESM(require("fs-extra"), 1);
39
38
  class CLICompact extends import_cliCommand.CLICommand {
40
- static {
41
- __name(this, "CLICompact");
42
- }
43
39
  config = import_fs_extra.default.readJSONSync(import_js_controller_common.tools.getConfigFileName());
44
- /**
45
- * @param options The command options including context and parameters
46
- */
47
40
  constructor(options) {
48
41
  super(options);
49
42
  }
50
43
  /**
51
44
  * Executes a command
52
45
  *
53
- * @param args The command arguments (the first is the sub-command)
46
+ * @param args
54
47
  */
55
48
  execute(args) {
56
49
  const { callback, showHelp } = this.options;
@@ -65,7 +58,7 @@ class CLICompact extends import_cliCommand.CLICommand {
65
58
  case "off":
66
59
  return this.setCompactModeHost(false);
67
60
  default:
68
- if (command?.includes(".")) {
61
+ if (command && command.includes(".")) {
69
62
  if (args[1]) {
70
63
  switch (args[1]) {
71
64
  case "status":
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/cli/cliCompact.ts"],
4
- "sourcesContent": ["import * as CLI from './messages.js';\nimport { CLICommand, type CLICommandOptions } from './cliCommand.js';\nimport { tools } from '@iobroker/js-controller-common';\nimport fs from 'fs-extra';\n\n/** Command ioBroker compact ... */\nexport class CLICompact extends CLICommand {\n private readonly config: ioBroker.IoBrokerJson = fs.readJSONSync(tools.getConfigFileName());\n\n /**\n * @param options The command options including context and parameters\n */\n constructor(options: CLICommandOptions) {\n super(options);\n }\n /**\n * Executes a command\n *\n * @param args The command arguments (the first is the sub-command)\n */\n execute(args: string[]): void {\n const { callback, showHelp } = this.options;\n const command = args[0];\n switch (command) {\n case 'status':\n return this.statusCompactModeHost();\n case 'enable':\n case 'on':\n return this.setCompactModeHost(true);\n case 'disable':\n case 'off':\n return this.setCompactModeHost(false);\n default:\n if (command?.includes('.')) {\n if (args[1]) {\n switch (args[1]) {\n case 'status':\n return this.statusCompactModeInstance(command as `${string}.${number}`);\n case 'enable':\n case 'on':\n return this.setCompactModeInstance(command as `${string}.${number}`, true, args[2]);\n case 'disable':\n case 'off':\n return this.setCompactModeInstance(command as `${string}.${number}`, false);\n case 'group':\n return this.setCompactModeInstance(\n command as `${string}.${number}`,\n undefined,\n args[2],\n );\n }\n }\n }\n\n CLI.error.unknownCommand('compact', command);\n showHelp();\n return void callback(3);\n }\n }\n\n /**\n * Output status of compact mode for host\n */\n statusCompactModeHost(): void {\n const { callback } = this.options;\n\n const compactMode = !!this.config?.system?.compact;\n console.log(`Compact mode for this host is currently ${compactMode ? 'enabled' : 'disabled'}`);\n\n return void callback();\n }\n\n /**\n * Set compact mode for this host\n *\n * @param targetState enable or disable compact mode for host\n */\n setCompactModeHost(targetState: boolean): void {\n const { callback, dbConnect } = this.options;\n\n dbConnect(params => {\n const { isOffline } = params;\n\n const currentState = !!this.config?.system?.compact;\n\n if (targetState === currentState) {\n console.log(`Compact mode for this host is already ${currentState ? 'enabled' : 'disabled'}`);\n return void callback();\n }\n\n this.config.system = this.config.system || {};\n this.config.system.compact = targetState;\n const configFileName = tools.getConfigFileName();\n fs.writeFileSync(configFileName, JSON.stringify(this.config, null, 4), 'utf8');\n\n console.log();\n console.log(`Compact mode for this host is now ${targetState ? 'enabled' : 'disabled'}`);\n\n if (!isOffline) {\n console.log();\n console.log('Please restart ioBroker for this change to take effect!');\n }\n return void callback();\n });\n }\n\n /**\n * Output the compact mode status for a defined adapter instance\n *\n * @param instance instance to output status for\n */\n statusCompactModeInstance(instance: `${string}.${number}`): void {\n const { callback, dbConnect } = this.options;\n\n dbConnect(params => {\n const { objects } = params;\n\n if (!this.config.system?.compact) {\n console.log('Compact mode is disabled for this host. All compact mode settings will have no effect!');\n console.log();\n }\n objects.getObject(`system.adapter.${instance}`, (err, obj) => {\n if (!err && obj) {\n if (!obj.common.compact) {\n console.log(\n 'This adapter does not support compact mode. The below settings will have no effect!',\n );\n console.log();\n } else {\n console.log(`Adapter supports compact mode: ${!!obj.common.compact}`);\n }\n console.log(`Compact mode enabled for instance: ${!!obj.common.runAsCompactMode}`);\n console.log(\n `Compact group: ${\n obj.common.compactGroup !== undefined ? obj.common.compactGroup : 1\n }`,\n );\n return void callback();\n }\n CLI.error.invalidInstance(instance);\n return void callback(24);\n });\n });\n }\n\n /**\n * Put given instance in compact mode group\n *\n * @param instance instance to put in group\n * @param targetState if compact mode should be enabled for instance, if undefined `instance.common.runAsCompact` will not be updated\n * @param groupId the compact group id, if not given, it will be put in controller group\n */\n setCompactModeInstance(instance: `${string}.${number}`, targetState?: boolean, groupId?: string | number): void {\n const { callback, dbConnect } = this.options;\n\n dbConnect(async params => {\n const { objects } = params;\n\n if (!this.config.system?.compact) {\n console.log('Compact mode is disabled on this host. This setting will have no effect!');\n console.log();\n }\n\n let obj: ioBroker.InstanceObject | undefined | null;\n try {\n obj = await objects.getObject(`system.adapter.${instance}`);\n } catch {\n // ignore\n }\n\n if (!obj) {\n CLI.error.invalidInstance(instance);\n return void callback(24);\n }\n\n if (!obj.common.compact) {\n console.log('This adapter does not support compact mode. The below settings will have no effect!');\n console.log();\n } else {\n console.log(`Adapter supports compact mode : ${!!obj.common.compact}`);\n }\n let newRunAsCompactMode;\n if (targetState !== undefined && targetState !== !!obj.common.runAsCompactMode) {\n newRunAsCompactMode = targetState;\n }\n let newCompactGroup;\n if (obj.common.compactGroup === undefined) {\n obj.common.compactGroup = 1;\n newCompactGroup = obj.common.compactGroup;\n }\n if (groupId !== undefined) {\n groupId = typeof groupId === 'string' ? parseInt(groupId, 10) : groupId;\n if (groupId !== obj.common.compactGroup) {\n newCompactGroup = groupId;\n }\n }\n console.log(\n `Compact mode enabled for instance: ${\n newRunAsCompactMode !== undefined ? `--> ${newRunAsCompactMode}` : !!obj.common.runAsCompactMode\n }`,\n );\n console.log(\n `Compact group: ${\n newCompactGroup !== undefined && obj.common.compactGroup !== newCompactGroup\n ? `--> ${newCompactGroup}`\n : obj.common.compactGroup\n }`,\n );\n if (newRunAsCompactMode !== undefined || newCompactGroup !== undefined) {\n if (newCompactGroup !== undefined) {\n obj.common.compactGroup = newCompactGroup;\n }\n if (newRunAsCompactMode !== undefined) {\n obj.common.runAsCompactMode = newRunAsCompactMode;\n }\n\n obj.from = `system.host.${tools.getHostName()}.cli`;\n obj.ts = new Date().getTime();\n objects.setObject(`system.adapter.${instance}`, obj, err => {\n if (err) {\n console.log(err);\n }\n console.log(`Instance settings for \"${instance}\" are changed.`);\n callback();\n });\n } else {\n console.log('No settings changed.');\n return void callback();\n }\n });\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,UAAqB;AACrB,wBAAmD;AACnD,kCAAsB;AACtB,sBAAe;AAGT,MAAO,mBAAmB,6BAAU;EAN1C,OAM0C;;;EACrB,SAAgC,gB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AAwB,QAAW;AACnC,cAAI,OAAO,mBAAmB;QAClC;AAEA,YAAI,OAAO,eAAe,kCAAM,YAAW,CAAE;AAC7C,YAAI,MAAK,oBAAI,KAAI,GAAG,QAAO;AAC3B,gBAAQ,UAAU,kBAAkB,QAAQ,IAAI,KAAK,SAAM;AACvD,cAAI,KAAK;AACL,oBAAQ,IAAI,GAAG;UACnB;AACA,kBAAQ,IAAI,0BAA0B,QAAQ,gBAAgB;AAC9D,mBAAQ;QACZ,CAAC;MACL,OAAO;AACH,gBAAQ,IAAI,sBAAsB;AAClC,eAAO,KAAK,SAAQ;MACxB;IACJ,CAAC;EACL;;",
4
+ "sourcesContent": ["import * as CLI from './messages.js';\nimport { CLICommand, type CLICommandOptions } from './cliCommand.js';\nimport { tools } from '@iobroker/js-controller-common';\nimport fs from 'fs-extra';\n\n/** Command ioBroker compact ... */\nexport class CLICompact extends CLICommand {\n private readonly config: ioBroker.IoBrokerJson = fs.readJSONSync(tools.getConfigFileName());\n\n constructor(options: CLICommandOptions) {\n super(options);\n }\n /**\n * Executes a command\n *\n * @param args\n */\n execute(args: any[]): void {\n const { callback, showHelp } = this.options;\n const command = args[0];\n switch (command) {\n case 'status':\n return this.statusCompactModeHost();\n case 'enable':\n case 'on':\n return this.setCompactModeHost(true);\n case 'disable':\n case 'off':\n return this.setCompactModeHost(false);\n default:\n if (command && command.includes('.')) {\n if (args[1]) {\n switch (args[1]) {\n case 'status':\n return this.statusCompactModeInstance(command);\n case 'enable':\n case 'on':\n return this.setCompactModeInstance(command, true, args[2]);\n case 'disable':\n case 'off':\n return this.setCompactModeInstance(command, false);\n case 'group':\n return this.setCompactModeInstance(command, undefined, args[2]);\n }\n }\n }\n\n CLI.error.unknownCommand('compact', command);\n showHelp();\n return void callback(3);\n }\n }\n\n /**\n * Output status of compact mode for host\n */\n statusCompactModeHost(): void {\n const { callback } = this.options;\n\n const compactMode = !!this.config?.system?.compact;\n console.log(`Compact mode for this host is currently ${compactMode ? 'enabled' : 'disabled'}`);\n\n return void callback();\n }\n\n /**\n * Set compact mode for this host\n *\n * @param targetState enable or disable compact mode for host\n */\n setCompactModeHost(targetState: boolean): void {\n const { callback, dbConnect } = this.options;\n\n dbConnect(params => {\n const { isOffline } = params;\n\n const currentState = !!this.config?.system?.compact;\n\n if (targetState === currentState) {\n console.log(`Compact mode for this host is already ${currentState ? 'enabled' : 'disabled'}`);\n return void callback();\n }\n\n this.config.system = this.config.system || {};\n this.config.system.compact = targetState;\n const configFileName = tools.getConfigFileName();\n fs.writeFileSync(configFileName, JSON.stringify(this.config, null, 4), 'utf8');\n\n console.log();\n console.log(`Compact mode for this host is now ${targetState ? 'enabled' : 'disabled'}`);\n\n if (!isOffline) {\n console.log();\n console.log('Please restart ioBroker for this change to take effect!');\n }\n return void callback();\n });\n }\n\n /**\n * Output the compact mode status for a defined adapter instance\n *\n * @param instance instance to output status for\n */\n statusCompactModeInstance(instance: `${string}.${number}`): void {\n const { callback, dbConnect } = this.options;\n\n dbConnect(params => {\n const { objects } = params;\n\n if (!this.config.system?.compact) {\n console.log('Compact mode is disabled for this host. All compact mode settings will have no effect!');\n console.log();\n }\n objects.getObject(`system.adapter.${instance}`, (err, obj) => {\n if (!err && obj) {\n if (!obj.common.compact) {\n console.log(\n 'This adapter does not support compact mode. The below settings will have no effect!',\n );\n console.log();\n } else {\n console.log(`Adapter supports compact mode: ${!!obj.common.compact}`);\n }\n console.log(`Compact mode enabled for instance: ${!!obj.common.runAsCompactMode}`);\n console.log(\n `Compact group: ${\n obj.common.compactGroup !== undefined ? obj.common.compactGroup : 1\n }`,\n );\n return void callback();\n }\n CLI.error.invalidInstance(instance);\n return void callback(24);\n });\n });\n }\n\n /**\n * Put given instance in compact mode group\n *\n * @param instance instance to put in group\n * @param targetState if compact mode should be enabled for instance, if undefined `instance.common.runAsCompact` will not be updated\n * @param groupId the compact group id, if not given, it will be put in controller group\n */\n setCompactModeInstance(instance: `${string}.${number}`, targetState?: boolean, groupId?: string | number): void {\n const { callback, dbConnect } = this.options;\n\n dbConnect(async params => {\n const { objects } = params;\n\n if (!this.config.system?.compact) {\n console.log('Compact mode is disabled on this host. This setting will have no effect!');\n console.log();\n }\n\n let obj: ioBroker.InstanceObject | undefined | null;\n try {\n obj = await objects.getObject(`system.adapter.${instance}`);\n } catch {\n // ignore\n }\n\n if (!obj) {\n CLI.error.invalidInstance(instance);\n return void callback(24);\n }\n\n if (!obj.common.compact) {\n console.log('This adapter does not support compact mode. The below settings will have no effect!');\n console.log();\n } else {\n console.log(`Adapter supports compact mode : ${!!obj.common.compact}`);\n }\n let newRunAsCompactMode;\n if (targetState !== undefined && targetState !== !!obj.common.runAsCompactMode) {\n newRunAsCompactMode = targetState;\n }\n let newCompactGroup;\n if (obj.common.compactGroup === undefined) {\n obj.common.compactGroup = 1;\n newCompactGroup = obj.common.compactGroup;\n }\n if (groupId !== undefined) {\n groupId = typeof groupId === 'string' ? parseInt(groupId, 10) : groupId;\n if (groupId !== obj.common.compactGroup) {\n newCompactGroup = groupId;\n }\n }\n console.log(\n `Compact mode enabled for instance: ${\n newRunAsCompactMode !== undefined ? `--> ${newRunAsCompactMode}` : !!obj.common.runAsCompactMode\n }`,\n );\n console.log(\n `Compact group: ${\n newCompactGroup !== undefined && obj.common.compactGroup !== newCompactGroup\n ? `--> ${newCompactGroup}`\n : obj.common.compactGroup\n }`,\n );\n if (newRunAsCompactMode !== undefined || newCompactGroup !== undefined) {\n if (newCompactGroup !== undefined) {\n obj.common.compactGroup = newCompactGroup;\n }\n if (newRunAsCompactMode !== undefined) {\n obj.common.runAsCompactMode = newRunAsCompactMode;\n }\n\n obj.from = `system.host.${tools.getHostName()}.cli`;\n obj.ts = new Date().getTime();\n objects.setObject(`system.adapter.${instance}`, obj, err => {\n if (err) {\n console.log(err);\n }\n console.log(`Instance settings for \"${instance}\" are changed.`);\n callback();\n });\n } else {\n console.log('No settings changed.');\n return void callback();\n }\n });\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;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AAE;AAEN,UAAI,wBAAwB,UAAa,oBAAoB,QAAW;AACpE,YAAI,oBAAoB,QAAW;AAC/B,cAAI,OAAO,eAAe;QAC9B;AACA,YAAI,wBAAwB,QAAW;AACnC,cAAI,OAAO,mBAAmB;QAClC;AAEA,YAAI,OAAO,eAAe,kCAAM,YAAW,CAAE;AAC7C,YAAI,MAAK,oBAAI,KAAI,GAAG,QAAO;AAC3B,gBAAQ,UAAU,kBAAkB,QAAQ,IAAI,KAAK,SAAM;AACvD,cAAI,KAAK;AACL,oBAAQ,IAAI,GAAG;UACnB;AACA,kBAAQ,IAAI,0BAA0B,QAAQ,gBAAgB;AAC9D,mBAAQ;QACZ,CAAC;MACL,OAAO;AACH,gBAAQ,IAAI,sBAAsB;AAClC,eAAO,KAAK,SAAQ;MACxB;IACJ,CAAC;EACL;;",
6
6
  "names": ["fs"]
7
7
  }
@@ -1,9 +1,6 @@
1
1
  import { CLICommand, type CLICommandOptions } from './cliCommand.js';
2
2
  /** Command ioBroker debug ... */
3
3
  export declare class CLIDebug extends CLICommand {
4
- /**
5
- * @param options The command options including context and parameters
6
- */
7
4
  constructor(options: CLICommandOptions);
8
5
  /**
9
6
  * Checks if the adapter instance is running
@@ -15,8 +12,8 @@ export declare class CLIDebug extends CLICommand {
15
12
  /**
16
13
  * Executes a command
17
14
  *
18
- * @param args The command arguments (the first is the adapter name)
15
+ * @param args
19
16
  */
20
- execute(args: string[]): Promise<void>;
17
+ execute(args: any[]): Promise<void>;
21
18
  }
22
19
  //# sourceMappingURL=cliDebug.d.ts.map
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
8
  var __export = (target, all) => {
10
9
  for (var name in all)
11
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -38,12 +37,6 @@ var CLITools = __toESM(require("./cliTools.js"), 1);
38
37
  var import_js_controller_common = require("@iobroker/js-controller-common");
39
38
  var import_node_child_process = require("node:child_process");
40
39
  class CLIDebug extends import_cliCommand.CLICommand {
41
- static {
42
- __name(this, "CLIDebug");
43
- }
44
- /**
45
- * @param options The command options including context and parameters
46
- */
47
40
  constructor(options) {
48
41
  super(options);
49
42
  }
@@ -72,7 +65,7 @@ class CLIDebug extends import_cliCommand.CLICommand {
72
65
  /**
73
66
  * Executes a command
74
67
  *
75
- * @param args The command arguments (the first is the adapter name)
68
+ * @param args
76
69
  */
77
70
  async execute(args) {
78
71
  const { callback, ...params } = this.options;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/cli/cliDebug.ts"],
4
- "sourcesContent": ["import * as CLI from './messages.js';\nimport { CLICommand, type CLICommandOptions } from './cliCommand.js';\nimport * as CLITools from './cliTools.js';\nimport { tools, EXIT_CODES } from '@iobroker/js-controller-common';\nimport { fork } from 'node:child_process';\n\n/** Command ioBroker debug ... */\nexport class CLIDebug extends CLICommand {\n /**\n * @param options The command options including context and parameters\n */\n constructor(options: CLICommandOptions) {\n super(options);\n }\n\n /**\n * Checks if the adapter instance is running\n *\n * @param adapter adapter name\n * @param instance instance id\n */\n private _isInstanceRunning(adapter: string, instance: string): Promise<boolean> {\n const { dbConnect } = this.options;\n return new Promise(resolve => {\n dbConnect(async ({ states }) => {\n try {\n const state = await states.getStateAsync(`system.adapter.${adapter}.${instance}.alive`);\n if (state?.val) {\n resolve(true);\n return;\n }\n } catch {\n // ignore\n }\n resolve(false);\n });\n });\n }\n\n /**\n * Executes a command\n *\n * @param args The command arguments (the first is the adapter name)\n */\n async execute(args: string[]): Promise<void> {\n const { callback, ...params } = this.options;\n const adapter = args[0];\n if (!adapter) {\n CLI.error.requiredArgumentMissing('adaptername', 'debug <adaptername>');\n return void callback(34);\n }\n\n const { name, instance } = CLITools.splitAdapterOrInstanceIdentifierWithVersion(adapter)!;\n\n if (await this._isInstanceRunning(name, instance || '0')) {\n CLI.error.instanceAlreadyRunning(`${name}.${instance || '0'}`);\n return void callback(EXIT_CODES.ADAPTER_ALREADY_RUNNING);\n }\n\n const adapterDir = tools.getAdapterDir(adapter);\n if (!adapterDir) {\n CLI.error.adapterDirNotFound(adapter);\n return void callback(34);\n }\n\n let mainFile;\n try {\n mainFile = await tools.resolveAdapterMainFile(adapter);\n } catch {\n CLI.error.mainFileNotFound(adapter);\n return callback(1);\n }\n\n // Start the adapter with force and console logs\n const adapterArgs = [instance || '0', '--debug'];\n // Tell node to attach a debugger\n const nodeArgs = [\n ...tools.getDefaultNodeArgs(mainFile),\n // --inspect[-brk][=[ip]:[port]]\n `--inspect${params.wait ? '-brk' : ''}${!!params.ip || !!params.port ? '=' : ''}${params.ip || ''}${\n !!params.ip && !!params.port ? ':' : ''\n }${params.port || ''}`,\n ];\n // And wait until the sub process has finished\n const cp = fork(mainFile, adapterArgs, {\n cwd: adapterDir,\n execArgv: nodeArgs,\n });\n cp.on('exit', code => callback(code || 0));\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,UAAqB;AACrB,wBAAmD;AACnD,eAA0B;AAC1B,kCAAkC;AAClC,gCAAqB;AAGf,MAAO,iBAAiB,6BAAU;EAPxC,OAOwC;;;;;;EAIpC,YAAY,SAA0B;AAClC,UAAM,OAAO;EACjB;;;;;;;EAQQ,mBAAmB,SAAiB,UAAgB;AACxD,UAAM,EAAE,UAAS,IAAK,KAAK;AAC3B,WAAO,IAAI,QAAQ,aAAU;AACzB,gBAAU,OAAO,EAAE,OAAM,MAAM;AAC3B,YAAI;AACA,gBAAM,QAAQ,MAAM,OAAO,cAAc,kBAAkB,OAAO,IAAI,QAAQ,QAAQ;AACtF,cAAI,OAAO,KAAK;AACZ,oBAAQ,IAAI;AACZ;UACJ;QACJ,QAAQ;QAER;AACA,gBAAQ,K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ICommand, type CLICommandOptions } from './cliCommand.js';\nimport * as CLITools from './cliTools.js';\nimport { tools, EXIT_CODES } from '@iobroker/js-controller-common';\nimport { fork } from 'node:child_process';\n\n/** Command ioBroker debug ... */\nexport class CLIDebug extends CLICommand {\n constructor(options: CLICommandOptions) {\n super(options);\n }\n\n /**\n * Checks if the adapter instance is running\n *\n * @param adapter adapter name\n * @param instance instance id\n */\n private _isInstanceRunning(adapter: string, instance: string): Promise<boolean> {\n const { dbConnect } = this.options;\n return new Promise(resolve => {\n dbConnect(async ({ states }) => {\n try {\n const state = await states.getStateAsync(`system.adapter.${adapter}.${instance}.alive`);\n if (state?.val) {\n resolve(true);\n return;\n }\n } catch {\n // ignore\n }\n resolve(false);\n });\n });\n }\n\n /**\n * Executes a command\n *\n * @param args\n */\n async execute(args: any[]): Promise<void> {\n const { callback, ...params } = this.options;\n const adapter = args[0];\n if (!adapter) {\n CLI.error.requiredArgumentMissing('adaptername', 'debug <adaptername>');\n return void callback(34);\n }\n\n const { name, instance } = CLITools.splitAdapterOrInstanceIdentifierWithVersion(adapter)!;\n\n if (await this._isInstanceRunning(name, instance || '0')) {\n CLI.error.instanceAlreadyRunning(`${name}.${instance || '0'}`);\n return void callback(EXIT_CODES.ADAPTER_ALREADY_RUNNING);\n }\n\n const adapterDir = tools.getAdapterDir(adapter);\n if (!adapterDir) {\n CLI.error.adapterDirNotFound(adapter);\n return void callback(34);\n }\n\n let mainFile;\n try {\n mainFile = await tools.resolveAdapterMainFile(adapter);\n } catch {\n CLI.error.mainFileNotFound(adapter);\n return callback(1);\n }\n\n // Start the adapter with force and console logs\n const adapterArgs = [instance || '0', '--debug'];\n // Tell node to attach a debugger\n const nodeArgs = [\n ...tools.getDefaultNodeArgs(mainFile),\n // --inspect[-brk][=[ip]:[port]]\n `--inspect${params.wait ? '-brk' : ''}${!!params.ip || !!params.port ? '=' : ''}${params.ip || ''}${\n !!params.ip && !!params.port ? ':' : ''\n }${params.port || ''}`,\n ];\n // And wait until the sub process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ACJ,QAAI;AACA,iBAAW,MAAM,kCAAM,uBAAuB,OAAO;IACzD,QAAQ;AACJ,UAAI,MAAM,iBAAiB,OAAO;AAClC,aAAO,SAAS,CAAC;IACrB;AAGA,UAAM,cAAc,CAAC,YAAY,KAAK,SAAS;AAE/C,UAAM,WAAW;MACb,GAAG,kCAAM,mBAAmB,QAAQ;;MAEpC,YAAY,OAAO,OAAO,SAAS,EAAE,GAAG,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,OAAO,OAAO,MAAM,EAAE,GAAG,OAAO,MAAM,EAAE,GAC7F,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,OAAO,OAAO,MAAM,EACzC,GAAG,OAAO,QAAQ,EAAE;;AAGxB,UAAM,SAAK,gCAAK,UAAU,aAAa;MACnC,KAAK;MACL,UAAU;KACb;AACD,OAAG,GAAG,QAAQ,UAAQ,SAAS,QAAQ,CAAC,CAAC;EAC7C;;",
6
6
  "names": []
7
7
  }
@@ -1,40 +1,37 @@
1
1
  import { CLICommand, type CLICommandOptions } from './cliCommand.js';
2
2
  /** Command iobroker host ... */
3
3
  export declare class CLIHost extends CLICommand {
4
- /**
5
- * @param options The command options including context and parameters
6
- */
7
4
  constructor(options: CLICommandOptions);
8
5
  /**
9
6
  * Executes a command
10
7
  *
11
- * @param args The command arguments (the first is the sub-command)
8
+ * @param args
12
9
  */
13
- execute(args: string[]): void;
10
+ execute(args: any[]): void;
14
11
  /**
15
12
  * When in single-host mode, changes the hostname of the host and all instances to the current one
16
13
  *
17
- * @param _args The command arguments (unused)
14
+ * @param _args
18
15
  */
19
- self(_args: string[]): void;
16
+ self(_args: any[]): void;
20
17
  /**
21
18
  * Changes the current host's hostname to the given one
22
19
  *
23
- * @param args The command arguments (the second is the new hostname)
20
+ * @param args
24
21
  */
25
- set(args: string[]): void;
22
+ set(args: any[]): void;
26
23
  /**
27
24
  * Removes the host with the given name
28
25
  *
29
- * @param args The command arguments (the second is the hostname to remove)
26
+ * @param args
30
27
  */
31
- remove(args: string[]): void;
28
+ remove(args: any[]): void;
32
29
  /**
33
30
  * Renames the host with the given name to the current one (opposite of `set()`)
34
31
  *
35
- * @param args The command arguments (the second is the old hostname)
32
+ * @param args
36
33
  */
37
- rename(args: string[]): void;
34
+ rename(args: any[]): void;
38
35
  /**
39
36
  * Renames the host with the hostname `oldHostname` to the hostname `newHostname`
40
37
  *
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
8
  var __export = (target, all) => {
10
9
  for (var name in all)
11
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -39,19 +38,13 @@ var import_js_controller_common = require("@iobroker/js-controller-common");
39
38
  var import_node_os = __toESM(require("node:os"), 1);
40
39
  var import_fs_extra = __toESM(require("fs-extra"), 1);
41
40
  class CLIHost extends import_cliCommand.CLICommand {
42
- static {
43
- __name(this, "CLIHost");
44
- }
45
- /**
46
- * @param options The command options including context and parameters
47
- */
48
41
  constructor(options) {
49
42
  super(options);
50
43
  }
51
44
  /**
52
45
  * Executes a command
53
46
  *
54
- * @param args The command arguments (the first is the sub-command)
47
+ * @param args
55
48
  */
56
49
  execute(args) {
57
50
  const command = args[0];
@@ -70,7 +63,7 @@ class CLIHost extends import_cliCommand.CLICommand {
70
63
  /**
71
64
  * When in single-host mode, changes the hostname of the host and all instances to the current one
72
65
  *
73
- * @param _args The command arguments (unused)
66
+ * @param _args
74
67
  */
75
68
  self(_args) {
76
69
  this.renameHost(void 0, import_node_os.default.hostname());
@@ -78,7 +71,7 @@ class CLIHost extends import_cliCommand.CLICommand {
78
71
  /**
79
72
  * Changes the current host's hostname to the given one
80
73
  *
81
- * @param args The command arguments (the second is the new hostname)
74
+ * @param args
82
75
  */
83
76
  set(args) {
84
77
  const { callback } = this.options;
@@ -92,7 +85,7 @@ class CLIHost extends import_cliCommand.CLICommand {
92
85
  /**
93
86
  * Removes the host with the given name
94
87
  *
95
- * @param args The command arguments (the second is the hostname to remove)
88
+ * @param args
96
89
  */
97
90
  remove(args) {
98
91
  const { callback, dbConnect } = this.options;
@@ -150,7 +143,7 @@ class CLIHost extends import_cliCommand.CLICommand {
150
143
  /**
151
144
  * Renames the host with the given name to the current one (opposite of `set()`)
152
145
  *
153
- * @param args The command arguments (the second is the old hostname)
146
+ * @param args
154
147
  */
155
148
  rename(args) {
156
149
  const { callback } = this.options;
@@ -277,7 +270,6 @@ async function changeInstanceHost(objects, instance, newHostname) {
277
270
  CLI.error.cannotChangeObject(instance._id, e.message);
278
271
  }
279
272
  }
280
- __name(changeInstanceHost, "changeInstanceHost");
281
273
  // Annotate the CommonJS export names for ESM import in node:
282
274
  0 && (module.exports = {
283
275
  CLIHost