@iobroker/js-controller-cli 4.0.21 → 4.1.0-alpha.0-20220819-74ceeddc

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 (76) hide show
  1. package/build/index.d.ts +89 -0
  2. package/{index.js → build/index.js} +7 -1
  3. package/build/lib/cli/cliCert.d.ts +16 -0
  4. package/build/lib/cli/cliCert.d.ts.map +1 -0
  5. package/{lib → build/lib}/cli/cliCert.js +5 -9
  6. package/build/lib/cli/cliCert.js.map +1 -0
  7. package/build/lib/cli/cliCommand.d.ts +24 -0
  8. package/build/lib/cli/cliCommand.d.ts.map +1 -0
  9. package/{lib → build/lib}/cli/cliCommand.js +2 -5
  10. package/build/lib/cli/cliCommand.js.map +1 -0
  11. package/build/lib/cli/cliCompact.d.ts +26 -0
  12. package/build/lib/cli/cliCompact.d.ts.map +1 -0
  13. package/{lib → build/lib}/cli/cliCompact.js +23 -43
  14. package/build/lib/cli/cliCompact.js.map +1 -0
  15. package/build/lib/cli/cliDebug.d.ts +19 -0
  16. package/build/lib/cli/cliDebug.d.ts.map +1 -0
  17. package/{lib → build/lib}/cli/cliDebug.js +6 -13
  18. package/build/lib/cli/cliDebug.js.map +1 -0
  19. package/build/lib/cli/cliHost.d.ts +36 -0
  20. package/build/lib/cli/cliHost.d.ts.map +1 -0
  21. package/{lib → build/lib}/cli/cliHost.js +22 -47
  22. package/build/lib/cli/cliHost.js.map +1 -0
  23. package/build/lib/cli/cliLogs.d.ts +58 -0
  24. package/build/lib/cli/cliLogs.d.ts.map +1 -0
  25. package/{lib → build/lib}/cli/cliLogs.js +16 -19
  26. package/build/lib/cli/cliLogs.js.map +1 -0
  27. package/build/lib/cli/cliMessage.d.ts +10 -0
  28. package/build/lib/cli/cliMessage.d.ts.map +1 -0
  29. package/{lib → build/lib}/cli/cliMessage.js +5 -7
  30. package/build/lib/cli/cliMessage.js.map +1 -0
  31. package/build/lib/cli/cliObjects.d.ts +105 -0
  32. package/build/lib/cli/cliObjects.d.ts.map +1 -0
  33. package/{lib → build/lib}/cli/cliObjects.js +69 -110
  34. package/build/lib/cli/cliObjects.js.map +1 -0
  35. package/build/lib/cli/cliPlugin.d.ts +23 -0
  36. package/build/lib/cli/cliPlugin.d.ts.map +1 -0
  37. package/{lib → build/lib}/cli/cliPlugin.js +24 -50
  38. package/build/lib/cli/cliPlugin.js.map +1 -0
  39. package/build/lib/cli/cliProcess.d.ts +50 -0
  40. package/build/lib/cli/cliProcess.d.ts.map +1 -0
  41. package/{lib → build/lib}/cli/cliProcess.js +50 -62
  42. package/build/lib/cli/cliProcess.js.map +1 -0
  43. package/build/lib/cli/cliStates.d.ts +51 -0
  44. package/build/lib/cli/cliStates.d.ts.map +1 -0
  45. package/{lib → build/lib}/cli/cliStates.js +64 -86
  46. package/build/lib/cli/cliStates.js.map +1 -0
  47. package/build/lib/cli/cliTools.d.ts +64 -0
  48. package/build/lib/cli/cliTools.d.ts.map +1 -0
  49. package/{lib → build/lib}/cli/cliTools.js +1 -12
  50. package/build/lib/cli/cliTools.js.map +1 -0
  51. package/build/lib/cli/messages.d.ts +53 -0
  52. package/build/lib/cli/messages.d.ts.map +1 -0
  53. package/{lib → build/lib}/cli/messages.js +27 -66
  54. package/build/lib/cli/messages.js.map +1 -0
  55. package/build/lib/setup/setupBackup.d.ts +126 -0
  56. package/build/lib/setup/setupBackup.d.ts.map +1 -0
  57. package/build/lib/setup/setupBackup.js +1031 -0
  58. package/build/lib/setup/setupBackup.js.map +1 -0
  59. package/build/lib/setup/setupInstall.d.ts +23 -0
  60. package/build/lib/setup/setupInstall.d.ts.map +1 -0
  61. package/build/lib/setup/setupInstall.js +1620 -0
  62. package/build/lib/setup/setupInstall.js.map +1 -0
  63. package/build/lib/setup/setupList.d.ts +49 -0
  64. package/build/lib/setup/setupList.d.ts.map +1 -0
  65. package/build/lib/setup/setupList.js +722 -0
  66. package/build/lib/setup/setupList.js.map +1 -0
  67. package/build/lib/setup/setupPacketManager.d.ts +65 -0
  68. package/build/lib/setup/setupPacketManager.d.ts.map +1 -0
  69. package/build/lib/setup/setupPacketManager.js +216 -0
  70. package/build/lib/setup/setupPacketManager.js.map +1 -0
  71. package/build/lib/setup/setupUpload.d.ts +72 -0
  72. package/build/lib/setup/setupUpload.d.ts.map +1 -0
  73. package/build/lib/setup/setupUpload.js +784 -0
  74. package/build/lib/setup/setupUpload.js.map +1 -0
  75. package/package.json +18 -11
  76. package/lib/setup/setupList.js +0 -840
@@ -0,0 +1,53 @@
1
+ export const success: Readonly<{
2
+ objectUpdated: (objectID: any) => string;
3
+ objectDeleted: (objectID: any) => string;
4
+ stateUpdated: (stateID: string, value: any, ack: boolean | undefined) => string;
5
+ stateDeleted: (stateID: any) => string;
6
+ adapterStarted: (adapter: any) => string;
7
+ adapterStopped: (adapter: any) => string;
8
+ adapterRestarted: (adapter: any) => string;
9
+ systemStatus: (isRunning: any) => string;
10
+ controllerStatus: (isRunning: any) => string;
11
+ messageSent: (adapter: string, command: string, message: any) => string;
12
+ hostRenamed: (from: string, to: string) => string;
13
+ instanceHostChanged: (instance: string, from: string, to: string) => string;
14
+ hostDeleted: (hostname: any) => string;
15
+ pluginEnabledOrDisabled: (pluginName: any, host: any, instance: any, status: any) => string;
16
+ pluginStatus: (pluginName: any, host: any, instance: any, status: any) => string;
17
+ }>;
18
+ export const warn: Readonly<{
19
+ noInstancesFoundOnHost: (hostname: any) => string;
20
+ }>;
21
+ export const error: Readonly<{
22
+ stateNotFound: (stateID: string, error: string | null) => string;
23
+ stateNotBinary: (stateId: string) => string;
24
+ stateBinaryGetUnsupported: (stateId: string) => string;
25
+ stateBinarySetUnsupported: (stateId: string) => string;
26
+ objectNotFound: (objectID: string, error: string | null) => string;
27
+ cannotUpdateObject: (objectID: string, error: string | null) => string;
28
+ cannotDeleteObject: (objectID: string, error: string | null) => string;
29
+ cannotDeleteObjectFromEnums: (objectID: string, error: string | null) => string;
30
+ cannotChangeObject: (objectID: string, error: string | null) => string;
31
+ objectPropertyNotFound: (objectID: string, propPath: string) => string;
32
+ invalidPropertyOrValue: () => "The property path or value is not valid. Please make sure the value is valid JSON.";
33
+ invalidJSONValue: () => "The given value is not valid JSON.";
34
+ unknownCommand: (prefix: string, command: string) => string;
35
+ requiredArgumentMissing: (argName: string, exampleCommand: string | null) => string;
36
+ noInstancesFound: (adapter: any) => string;
37
+ invalidInstance: (instance: any) => string;
38
+ specifyInstance: (adapter: string, adapterInstances: Array<string> | null) => string;
39
+ adapterDirNotFound: (adapter: any) => string;
40
+ mainFileNotFound: (adapter: any) => string;
41
+ cannotLoadIoPackage: (adapter: any) => string;
42
+ wrongCommandPrefix: (wrongPrefix: string, command: string, correctPrefix: string | null) => string;
43
+ unknown: (err: any) => string;
44
+ cannotChangeRunningSystem: () => string;
45
+ noHostThisInMultihost: () => "Cannot use this command in multihost!";
46
+ hostAlreadyExists: (hostname: any) => string;
47
+ hostDoesNotExist: (hostname: any) => string;
48
+ dontRemoveCurrentHost: (hostname: any) => string;
49
+ pluginNotDefined: (pluginName: any, host: any, instance: any) => string;
50
+ cert: (certName: any) => string;
51
+ instanceAlreadyRunning: (instance: any) => string;
52
+ }>;
53
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/lib/cli/messages.js"],"names":[],"mappings":";;;4BAmE8B,MAAM,SAAyB,GAAG,OAAuB,OAAO,GAAG,SAAS;;;;;;;2BAS7E,MAAM,WAAyB,MAAM,WAAyB,GAAG;wBAEjE,MAAM,MAAsB,MAAM;oCAE1B,MAAM,QAA0B,MAAM,MAAsB,MAAM;;;;;;;;;6BA5ExE,MAAM,SAAyB,MAAM;8BAEpC,MAAM;yCACK,MAAM;yCAEN,MAAM;+BAEjB,MAAM,SAA0B,MAAM;mCAElC,MAAM,SAA0B,MAAM;mCAEtC,MAAM,SAA0B,MAAM;4CAE7B,MAAM,SAA0B,MAAM;mCAE/C,MAAM,SAA0B,MAAM;uCAElC,MAAM,YAA0B,MAAM;;;6BAK9C,MAAM,WAAwB,MAAM;uCAE3B,MAAM,kBAAyB,MAAM;;;+BAK7C,MAAM,oBAAyB,MAAM,MAAM,CAAC;;;;sCAS1D,MAAM,WACN,MAAM,iBACN,MAAM"}
@@ -1,102 +1,62 @@
1
1
  'use strict';
2
2
  const { tools } = require('@iobroker/js-controller-common');
3
-
4
3
  const errorMessages = Object.freeze({
5
- stateNotFound: (/** @type {string} */ stateID, /** @type {string?} */ error) =>
6
- `The state ${stateID} was not found!` + (error ? ` Reason: ${error}` : ''),
4
+ stateNotFound: (/** @type {string} */ stateID, /** @type {string?} */ error) => `The state ${stateID} was not found!` + (error ? ` Reason: ${error}` : ''),
7
5
  stateNotBinary: (/** @type {string} */ stateId) => `State "${stateId}" is not binary.`,
8
- stateBinaryGetUnsupported: (/** @type {string} */ stateId) =>
9
- `State "${stateId}" is a binary state, please use getBinary.`,
10
- stateBinarySetUnsupported: (/** @type {string} */ stateId) =>
11
- `State "${stateId}" is a binary state and cannot be set via cli.`,
12
- objectNotFound: (/** @type {string} */ objectID, /** @type {string?} */ error) =>
13
- `The object ${objectID} was not found!` + (error ? ` Reason: ${error}` : ''),
14
- cannotUpdateObject: (/** @type {string} */ objectID, /** @type {string?} */ error) =>
15
- `The object ${objectID} could not be updated!` + (error ? ` Reason: ${error}` : ''),
16
- cannotDeleteObject: (/** @type {string} */ objectID, /** @type {string?} */ error) =>
17
- `The object ${objectID} cannot be deleted!` + (error ? ` Reason: ${error}` : ''),
18
- cannotDeleteObjectFromEnums: (/** @type {string} */ objectID, /** @type {string?} */ error) =>
19
- `The object ${objectID} could not be deleted from enums!` + (error ? ` Reason: ${error}` : ''),
20
- cannotChangeObject: (/** @type {string} */ objectID, /** @type {string?} */ error) =>
21
- `The object ${objectID} cannot be changed!` + (error ? ` Reason: ${error}` : ''),
22
- objectPropertyNotFound: (/** @type {string} */ objectID, /** @type {string} */ propPath) =>
23
- `The requested property "${propPath}" or one of its parents was not found in the object "${objectID}"!`,
6
+ stateBinaryGetUnsupported: (/** @type {string} */ stateId) => `State "${stateId}" is a binary state, please use getBinary.`,
7
+ stateBinarySetUnsupported: (/** @type {string} */ stateId) => `State "${stateId}" is a binary state and cannot be set via cli.`,
8
+ objectNotFound: (/** @type {string} */ objectID, /** @type {string?} */ error) => `The object ${objectID} was not found!` + (error ? ` Reason: ${error}` : ''),
9
+ cannotUpdateObject: (/** @type {string} */ objectID, /** @type {string?} */ error) => `The object ${objectID} could not be updated!` + (error ? ` Reason: ${error}` : ''),
10
+ cannotDeleteObject: (/** @type {string} */ objectID, /** @type {string?} */ error) => `The object ${objectID} cannot be deleted!` + (error ? ` Reason: ${error}` : ''),
11
+ cannotDeleteObjectFromEnums: (/** @type {string} */ objectID, /** @type {string?} */ error) => `The object ${objectID} could not be deleted from enums!` + (error ? ` Reason: ${error}` : ''),
12
+ cannotChangeObject: (/** @type {string} */ objectID, /** @type {string?} */ error) => `The object ${objectID} cannot be changed!` + (error ? ` Reason: ${error}` : ''),
13
+ objectPropertyNotFound: (/** @type {string} */ objectID, /** @type {string} */ propPath) => `The requested property "${propPath}" or one of its parents was not found in the object "${objectID}"!`,
24
14
  invalidPropertyOrValue: () => `The property path or value is not valid. Please make sure the value is valid JSON.`,
25
15
  invalidJSONValue: () => `The given value is not valid JSON.`,
26
-
27
- unknownCommand: (/** @type {string} */ prefix, /** @type {string} */ command) =>
28
- `Unknown command "${prefix} ${command}"!`,
29
- requiredArgumentMissing: (/** @type {string} */ argName, /** @type {string?} */ exampleCommand) =>
30
- `The required argument "${argName}" is missing!` + (exampleCommand ? ` Example: "${exampleCommand}"` : ''),
31
-
16
+ unknownCommand: (/** @type {string} */ prefix, /** @type {string} */ command) => `Unknown command "${prefix} ${command}"!`,
17
+ requiredArgumentMissing: (/** @type {string} */ argName, /** @type {string?} */ exampleCommand) => `The required argument "${argName}" is missing!` + (exampleCommand ? ` Example: "${exampleCommand}"` : ''),
32
18
  noInstancesFound: adapter => `Cannot find any instances of "${adapter}"!`,
33
19
  invalidInstance: instance => `The instance "${instance}" does not exist!`,
34
- specifyInstance: (/** @type {string} */ adapter, /** @type {Array<string>?} */ adapterInstances) =>
35
- `The adapter "${adapter}" has multiple instances! Please specify which one should be started: "${adapterInstances.join(
36
- '", "'
37
- )}".`,
20
+ specifyInstance: (/** @type {string} */ adapter, /** @type {Array<string>?} */ adapterInstances) => `The adapter "${adapter}" has multiple instances! Please specify which one should be started: "${adapterInstances.join('", "')}".`,
38
21
  adapterDirNotFound: adapter => `Cannot find the installation dir for adapter "${adapter}"!`,
39
22
  mainFileNotFound: adapter => `Cannot find the main file for adapter "${adapter}"!`,
40
23
  cannotLoadIoPackage: adapter => `Cannot load the io-package.json file for adapter "${adapter}"!`,
41
-
42
24
  wrongCommandPrefix: (
43
- /** @type {string} */ wrongPrefix,
44
- /** @type {string} */ command,
45
- /** @type {string?} */ correctPrefix
46
- ) =>
47
- `The command ${command} is not intended to be used with ${wrongPrefix}!` + correctPrefix
48
- ? `Please use "${correctPrefix} ${command}" instead.`
49
- : '',
25
+ /** @type {string} */ wrongPrefix,
26
+ /** @type {string} */ command,
27
+ /** @type {string?} */ correctPrefix) => `The command ${command} is not intended to be used with ${wrongPrefix}!` + correctPrefix
28
+ ? `Please use "${correctPrefix} ${command}" instead.`
29
+ : '',
50
30
  unknown: err => `An unknown error occurred: ${err}`,
51
-
52
31
  cannotChangeRunningSystem: () => `Cannot execute changes on running system. Stop ${tools.appName} first.`,
53
32
  noHostThisInMultihost: () => `Cannot use this command in multihost!`,
54
33
  hostAlreadyExists: hostname => `A host with the name "${hostname}" already exists!`,
55
34
  hostDoesNotExist: hostname => `The host "${hostname}" does not exist!`,
56
35
  dontRemoveCurrentHost: hostname => `Cannot remove host "${hostname}" from itself!`,
57
-
58
- pluginNotDefined: (pluginName, host, instance) =>
59
- `The plugin "${pluginName}" does not exist for ${host ? `host "${host}"` : `instance "${instance}"`}!`,
60
-
36
+ pluginNotDefined: (pluginName, host, instance) => `The plugin "${pluginName}" does not exist for ${host ? `host "${host}"` : `instance "${instance}"`}!`,
61
37
  cert: certName => `Certificate "${certName}" not found or error parsing certificate information.`,
62
38
  instanceAlreadyRunning: instance => `The instance "${instance}" is already running, please stop instance first.`
63
39
  });
64
-
65
40
  const successMessages = Object.freeze({
66
41
  objectUpdated: objectID => `The object "${objectID}" was updated successfully.`,
67
42
  objectDeleted: objectID => `The object "${objectID}" was deleted.`,
68
- stateUpdated: (/** @type {string} */ stateID, /** @type {any} */ value, /** @type {boolean | undefined} */ ack) =>
69
- `The state "${stateID}" was set to "${value}"${ack === undefined ? '' : ` with flag ack=${ack}`}`,
43
+ stateUpdated: (/** @type {string} */ stateID, /** @type {any} */ value, /** @type {boolean | undefined} */ ack) => `The state "${stateID}" was set to "${value}"${ack === undefined ? '' : ` with flag ack=${ack}`}`,
70
44
  stateDeleted: stateID => `The state "${stateID}" was deleted.`,
71
45
  adapterStarted: adapter => `The adapter "${adapter}" was started.`,
72
46
  adapterStopped: adapter => `The adapter "${adapter}" was stopped.`,
73
47
  adapterRestarted: adapter => `The adapter "${adapter}" was restarted.`,
74
- systemStatus: isRunning =>
75
- isRunning ? `At least one ${tools.appName} host is running.` : `No ${tools.appName} host is running.`,
48
+ systemStatus: isRunning => isRunning ? `At least one ${tools.appName} host is running.` : `No ${tools.appName} host is running.`,
76
49
  controllerStatus: isRunning => `${tools.appName} is ${isRunning ? '' : 'not '}running on this host.`,
77
- messageSent: (/** @type {string} */ adapter, /** @type {string} */ command, /** @type {any} */ message) =>
78
- `The command "${command}" was sent to "${adapter}" with the message "${message}".`,
79
- hostRenamed: (/** @type {string} */ from, /** @type {string} */ to) =>
80
- `Host "${from}" successfully renamed to "${to}".`,
81
- instanceHostChanged: (/** @type {string} */ instance, /** @type {string} */ from, /** @type {string} */ to) =>
82
- `The host for instance "${instance}" was changed from "${from}" to "${to}".`,
50
+ messageSent: (/** @type {string} */ adapter, /** @type {string} */ command, /** @type {any} */ message) => `The command "${command}" was sent to "${adapter}" with the message "${message}".`,
51
+ hostRenamed: (/** @type {string} */ from, /** @type {string} */ to) => `Host "${from}" successfully renamed to "${to}".`,
52
+ instanceHostChanged: (/** @type {string} */ instance, /** @type {string} */ from, /** @type {string} */ to) => `The host for instance "${instance}" was changed from "${from}" to "${to}".`,
83
53
  hostDeleted: hostname => `The host "${hostname}" was deleted.`,
84
-
85
- pluginEnabledOrDisabled: (pluginName, host, instance, status) =>
86
- `The plugin "${pluginName}" was successfully ${status ? 'enabled' : 'disabled'} for ${
87
- host ? `host "${host}"` : `instance "${instance}"`
88
- }.`,
89
- pluginStatus: (pluginName, host, instance, status) =>
90
- `The plugin "${pluginName}" is ${status ? 'enabled' : 'disabled'} for ${
91
- host ? `host "${host}"` : `instance "${instance}"`
92
- }.`
54
+ pluginEnabledOrDisabled: (pluginName, host, instance, status) => `The plugin "${pluginName}" was successfully ${status ? 'enabled' : 'disabled'} for ${host ? `host "${host}"` : `instance "${instance}"`}.`,
55
+ pluginStatus: (pluginName, host, instance, status) => `The plugin "${pluginName}" is ${status ? 'enabled' : 'disabled'} for ${host ? `host "${host}"` : `instance "${instance}"`}.`
93
56
  });
94
-
95
57
  const warnings = Object.freeze({
96
- noInstancesFoundOnHost: hostname =>
97
- hostname ? `No instances found for host "${hostname}"!` : `No instances found!`
58
+ noInstancesFoundOnHost: hostname => hostname ? `No instances found for host "${hostname}"!` : `No instances found!`
98
59
  });
99
-
100
60
  // Capsule success messages in console.log
101
61
  /** Prints predefined success messages on the CLI */
102
62
  module.exports.success = /** @type {typeof successMessages} */ ({});
@@ -114,3 +74,4 @@ module.exports.error = /** @type {typeof errorMessages} */ ({});
114
74
  for (const method of Object.keys(errorMessages)) {
115
75
  module.exports.error[method] = (...args) => console.error(errorMessages[method](...args));
116
76
  }
77
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/lib/cli/messages.js"],"names":[],"mappings":"AAAA,YAAY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M,CAAC,OAAO,CAAC,IAAI,GAAG,8BAA8B,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1D,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;IACxC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;CACrF;AACD,kCAAkC;AAClC,kDAAkD;AAClD,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,mCAAmC,CAAC,CAAC,EAAE,CAAC,CAAC;AAChE,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE;IAC7C,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;CAC7F"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Backup
3
+ *
4
+ * Copyright 2013-2022 bluefox <dogafox@gmail.com>
5
+ *
6
+ * MIT License
7
+ *
8
+ */
9
+ import type { Client as StatesRedisClient } from '@iobroker/db-states-redis';
10
+ import type { Client as ObjectsRedisClient } from '@iobroker/db-objects-redis';
11
+ export interface CLIBackupRestoreOptions {
12
+ dbMigration?: boolean;
13
+ states: StatesRedisClient;
14
+ objects: ObjectsRedisClient;
15
+ processExit: (exitCode?: number) => void;
16
+ cleanDatabase: (isDeleteDb: boolean) => any;
17
+ restartController: () => void;
18
+ }
19
+ export declare class BackupRestore {
20
+ private readonly objects;
21
+ private readonly states;
22
+ private readonly processExit;
23
+ private readonly restartController;
24
+ private readonly cleanDatabase;
25
+ private readonly dbMigration;
26
+ /** these adapters will be reinstalled during restore, while others will be installed after next controller start */
27
+ private readonly PRESERVE_ADAPTERS;
28
+ private readonly upload;
29
+ private configParts;
30
+ private readonly configDir;
31
+ constructor(options: CLIBackupRestoreOptions);
32
+ private _copyFile;
33
+ copyDir(id: string, srcPath: string, destPath: string): Promise<void>;
34
+ static getBackupDir(): string;
35
+ copyFileSync(source: string, target: string): void;
36
+ copyFolderRecursiveSync(source: string, target: string): void;
37
+ /**
38
+ * Pack and compress the backup
39
+ *
40
+ * @param name - backup name
41
+ */
42
+ private _packBackup;
43
+ /**
44
+ * Creates backup and stores with given name
45
+ *
46
+ * @param name - name of the backup
47
+ * @param noConfig - do not store configs
48
+ */
49
+ createBackup(name: string, noConfig?: boolean): Promise<string | void>;
50
+ /**
51
+ * Helper to restore raw states
52
+ *
53
+ * @param statesList - list of state ids
54
+ * @param stateObjects - list of state objects
55
+ */
56
+ private _setStateHelper;
57
+ /**
58
+ * Sets all objects to the db and disables all adapters
59
+ *
60
+ * @param _objects - array of all objects to be set
61
+ */
62
+ private _setObjHelper;
63
+ /**
64
+ * Creates all provided object if non existing
65
+ *
66
+ * @param objectList - list of objects to be created
67
+ */
68
+ private _reloadAdapterObject;
69
+ private _reloadAdaptersObjects;
70
+ private _uploadUserFiles;
71
+ private _copyBackupedFiles;
72
+ /**
73
+ * Restore after controller has been stopped
74
+ *
75
+ * @param restartOnFinish - restart controller after restore
76
+ * @param force - skip the controller version check
77
+ * @param dontDeleteAdapters - skip adapter deletion, e.g. for setup custom db migration
78
+ */
79
+ private _restoreAfterStop;
80
+ /**
81
+ * Removes all adapters
82
+ */
83
+ private _removeAllAdapters;
84
+ /**
85
+ * Ensure that installed controller version matches version in backup
86
+ *
87
+ * @param controllerDir - directory of js-controller
88
+ * @param backupHostname - hostname in backup file
89
+ * @param backupObjects - the objects contained in the backup
90
+ * @param force - if force is true, only log
91
+ */
92
+ private _ensureCompatibility;
93
+ /**
94
+ * Returns all backups as array
95
+ */
96
+ listBackups(): string[];
97
+ /**
98
+ * Validates the backup.json and all json files inside the backup after (in temporary directory), here we only abort if backup.json is corrupted
99
+ */
100
+ private _validateBackupAfterCreation;
101
+ /**
102
+ * Validates the given backup.json and all json files in the backup, calls processExit afterwards
103
+ * @param _name - index or name of the backup
104
+ */
105
+ validateBackup(_name: string | number): Promise<void> | undefined;
106
+ /**
107
+ * Checks a directory for json files and validates them, steps down recursive in subdirectories
108
+ * @param path - path to the directory
109
+ * @param verbose - if logging should be verbose
110
+ */
111
+ private _checkDirectory;
112
+ /**
113
+ * Restores a backup
114
+ *
115
+ * @param _name - backup name or index
116
+ * @param force - if force, js-controller is allowed to have a different version
117
+ * @param dontDeleteAdapters - skip adapter deletion, e.g. for setup custom db migration
118
+ * @param callback
119
+ */
120
+ restoreBackup(_name: string | number, force: boolean, dontDeleteAdapters: boolean, callback: (exitCode: number) => void): void;
121
+ /**
122
+ * This method checks if adapter of PRESERVE_ADAPTERS exist, and reinstalls them if this is the case
123
+ */
124
+ private _restorePreservedAdapters;
125
+ }
126
+ //# sourceMappingURL=setupBackup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupBackup.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/setupBackup.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,KAAK,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAQ/E,MAAM,WAAW,uBAAuB;IACpC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,aAAa,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,GAAG,CAAC;IAC5C,iBAAiB,EAAE,MAAM,IAAI,CAAC;CACjC;AAQD,qBAAa,aAAa;IACtB,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