@iobroker/js-controller-cli 4.1.0-alpha.8-20220307-e82d97a2 → 5.0.0-alpha.0-20221217-d87d529d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +89 -0
- package/{index.js → build/index.js} +10 -2
- package/build/lib/_Types.d.ts +40 -0
- package/build/lib/_Types.d.ts.map +1 -0
- package/build/lib/_Types.js +3 -0
- package/build/lib/_Types.js.map +1 -0
- package/build/lib/cli/cliCert.d.ts +16 -0
- package/build/lib/cli/cliCert.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliCert.js +6 -10
- package/build/lib/cli/cliCert.js.map +1 -0
- package/build/lib/cli/cliCommand.d.ts +41 -0
- package/build/lib/cli/cliCommand.d.ts.map +1 -0
- package/build/lib/cli/cliCommand.js +27 -0
- package/build/lib/cli/cliCommand.js.map +1 -0
- package/build/lib/cli/cliCompact.d.ts +26 -0
- package/build/lib/cli/cliCompact.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliCompact.js +24 -44
- package/build/lib/cli/cliCompact.js.map +1 -0
- package/build/lib/cli/cliDebug.d.ts +19 -0
- package/build/lib/cli/cliDebug.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliDebug.js +7 -14
- package/build/lib/cli/cliDebug.js.map +1 -0
- package/build/lib/cli/cliHost.d.ts +36 -0
- package/build/lib/cli/cliHost.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliHost.js +23 -48
- package/build/lib/cli/cliHost.js.map +1 -0
- package/build/lib/cli/cliLogs.d.ts +58 -0
- package/build/lib/cli/cliLogs.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliLogs.js +17 -21
- package/build/lib/cli/cliLogs.js.map +1 -0
- package/build/lib/cli/cliMessage.d.ts +10 -0
- package/build/lib/cli/cliMessage.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliMessage.js +6 -9
- package/build/lib/cli/cliMessage.js.map +1 -0
- package/build/lib/cli/cliObjects.d.ts +105 -0
- package/build/lib/cli/cliObjects.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliObjects.js +70 -111
- package/build/lib/cli/cliObjects.js.map +1 -0
- package/build/lib/cli/cliPlugin.d.ts +23 -0
- package/build/lib/cli/cliPlugin.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliPlugin.js +25 -51
- package/build/lib/cli/cliPlugin.js.map +1 -0
- package/build/lib/cli/cliProcess.d.ts +50 -0
- package/build/lib/cli/cliProcess.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliProcess.js +51 -63
- package/build/lib/cli/cliProcess.js.map +1 -0
- package/build/lib/cli/cliStates.d.ts +49 -0
- package/build/lib/cli/cliStates.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliStates.js +128 -122
- package/build/lib/cli/cliStates.js.map +1 -0
- package/build/lib/cli/cliTools.d.ts +64 -0
- package/build/lib/cli/cliTools.d.ts.map +1 -0
- package/{lib → build/lib}/cli/cliTools.js +36 -49
- package/build/lib/cli/cliTools.js.map +1 -0
- package/build/lib/cli/messages.d.ts +53 -0
- package/build/lib/cli/messages.d.ts.map +1 -0
- package/{lib → build/lib}/cli/messages.js +27 -66
- package/build/lib/cli/messages.js.map +1 -0
- package/build/lib/setup/pluginInfos.d.ts +30 -0
- package/build/lib/setup/pluginInfos.d.ts.map +1 -0
- package/build/lib/setup/pluginInfos.js +37 -0
- package/build/lib/setup/pluginInfos.js.map +1 -0
- package/build/lib/setup/setupBackup.d.ts +127 -0
- package/build/lib/setup/setupBackup.d.ts.map +1 -0
- package/build/lib/setup/setupBackup.js +1037 -0
- package/build/lib/setup/setupBackup.js.map +1 -0
- package/build/lib/setup/setupInstall.d.ts +185 -0
- package/build/lib/setup/setupInstall.d.ts.map +1 -0
- package/build/lib/setup/setupInstall.js +1604 -0
- package/build/lib/setup/setupInstall.js.map +1 -0
- package/build/lib/setup/setupList.d.ts +49 -0
- package/build/lib/setup/setupList.d.ts.map +1 -0
- package/build/lib/setup/setupList.js +719 -0
- package/build/lib/setup/setupList.js.map +1 -0
- package/build/lib/setup/setupPacketManager.d.ts +69 -0
- package/build/lib/setup/setupPacketManager.d.ts.map +1 -0
- package/build/lib/setup/setupPacketManager.js +238 -0
- package/build/lib/setup/setupPacketManager.js.map +1 -0
- package/build/lib/setup/setupSetup.d.ts +69 -0
- package/build/lib/setup/setupSetup.d.ts.map +1 -0
- package/build/lib/setup/setupSetup.js +1036 -0
- package/build/lib/setup/setupSetup.js.map +1 -0
- package/build/lib/setup/setupUpgrade.d.ts +54 -0
- package/build/lib/setup/setupUpgrade.d.ts.map +1 -0
- package/build/lib/setup/setupUpgrade.js +612 -0
- package/build/lib/setup/setupUpgrade.js.map +1 -0
- package/build/lib/setup/setupUpload.d.ts +72 -0
- package/build/lib/setup/setupUpload.d.ts.map +1 -0
- package/build/lib/setup/setupUpload.js +786 -0
- package/build/lib/setup/setupUpload.js.map +1 -0
- package/package.json +47 -40
- package/lib/cli/cliCommand.js +0 -58
- package/lib/setup/setupList.js +0 -829
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
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: 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
|
+
export const tools: typeof import("./lib/cli/cliTools");
|
|
54
|
+
export namespace command {
|
|
55
|
+
const object: typeof import("./lib/cli/cliObjects.js");
|
|
56
|
+
const state: typeof import("./lib/cli/cliStates.js").CLIStates;
|
|
57
|
+
const process: {
|
|
58
|
+
new (options: import("./lib/cli/cliCommand").CLICommandOptions): import("./lib/cli/cliProcess.js");
|
|
59
|
+
};
|
|
60
|
+
const message: {
|
|
61
|
+
new (options: import("./lib/cli/cliCommand").CLICommandOptions): import("./lib/cli/cliMessage.js");
|
|
62
|
+
};
|
|
63
|
+
const logs: {
|
|
64
|
+
new (options: CLICommandOptions): import("./lib/cli/cliLogs.js");
|
|
65
|
+
};
|
|
66
|
+
const host: {
|
|
67
|
+
new (options: import("./lib/cli/cliCommand").CLICommandOptions): import("./lib/cli/cliHost.js");
|
|
68
|
+
};
|
|
69
|
+
const cert: {
|
|
70
|
+
new (options: import("./lib/cli/cliCommand").CLICommandOptions): import("./lib/cli/cliCert.js");
|
|
71
|
+
};
|
|
72
|
+
const compact: {
|
|
73
|
+
new (options: import("./lib/cli/cliCommand").CLICommandOptions): import("./lib/cli/cliCompact.js");
|
|
74
|
+
};
|
|
75
|
+
const debug: {
|
|
76
|
+
new (options: import("./lib/cli/cliCommand").CLICommandOptions): import("./lib/cli/cliDebug.js");
|
|
77
|
+
};
|
|
78
|
+
const plugin: {
|
|
79
|
+
new (options: CLICommandOptions): import("./lib/cli/cliPlugin.js");
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export const setupList: typeof import("./lib/setup/setupList").List;
|
|
83
|
+
export const setupPacketManager: typeof import("./lib/setup/setupPacketManager").PacketManager;
|
|
84
|
+
export const setupUpload: typeof import("./lib/setup/setupUpload").Upload;
|
|
85
|
+
export const setupInstall: typeof import("./lib/setup/setupInstall").Install;
|
|
86
|
+
export const setupBackup: typeof import("./lib/setup/setupBackup").BackupRestore;
|
|
87
|
+
export const setupUpgrade: typeof import("./lib/setup/setupUpgrade").Upgrade;
|
|
88
|
+
export const setupSetup: typeof import("./lib/setup/setupSetup").Setup;
|
|
89
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
module.exports = {
|
|
2
3
|
success: require('./lib/cli/messages').success,
|
|
3
4
|
warn: require('./lib/cli/messages').warn,
|
|
@@ -5,7 +6,7 @@ module.exports = {
|
|
|
5
6
|
tools: require('./lib/cli/cliTools'),
|
|
6
7
|
command: {
|
|
7
8
|
object: require('./lib/cli/cliObjects.js'),
|
|
8
|
-
state: require('./lib/cli/cliStates.js'),
|
|
9
|
+
state: require('./lib/cli/cliStates.js').CLIStates,
|
|
9
10
|
process: require('./lib/cli/cliProcess.js'),
|
|
10
11
|
message: require('./lib/cli/cliMessage.js'),
|
|
11
12
|
logs: require('./lib/cli/cliLogs.js'),
|
|
@@ -15,5 +16,12 @@ module.exports = {
|
|
|
15
16
|
debug: require('./lib/cli/cliDebug.js'),
|
|
16
17
|
plugin: require('./lib/cli/cliPlugin.js')
|
|
17
18
|
},
|
|
18
|
-
setupList: require('./lib/setup/setupList')
|
|
19
|
+
setupList: require('./lib/setup/setupList').List,
|
|
20
|
+
setupPacketManager: require('./lib/setup/setupPacketManager').PacketManager,
|
|
21
|
+
setupUpload: require('./lib/setup/setupUpload').Upload,
|
|
22
|
+
setupInstall: require('./lib/setup/setupInstall').Install,
|
|
23
|
+
setupBackup: require('./lib/setup/setupBackup').BackupRestore,
|
|
24
|
+
setupUpgrade: require('./lib/setup/setupUpgrade').Upgrade,
|
|
25
|
+
setupSetup: require('./lib/setup/setupSetup').Setup
|
|
19
26
|
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="@iobroker/types" />
|
|
2
|
+
import type { Client as StatesRedisClient } from '@iobroker/db-states-redis';
|
|
3
|
+
import type { Client as ObjectsRedisClient } from '@iobroker/db-objects-redis';
|
|
4
|
+
export declare type ProcessExitCallback = (exitCode: number) => void;
|
|
5
|
+
export declare type GetRepositoryHandler = (repoName: string | undefined, params: Record<string, any>) => Promise<Record<string, any>>;
|
|
6
|
+
export declare type CleanDatabaseHandler = (isDeleteDb: boolean) => any;
|
|
7
|
+
declare type DbConnectCallback = (objects: ObjectsRedisClient, states: StatesRedisClient, isOffline?: boolean, objectsDBType?: string) => void;
|
|
8
|
+
export declare type DbConnect = (onlyCheckOrParams?: boolean | Record<string, any>, paramsOrCb?: Record<string, any> | DbConnectCallback, callback?: DbConnectCallback) => void;
|
|
9
|
+
interface DbConnectAsyncReturn {
|
|
10
|
+
objects: ObjectsRedisClient;
|
|
11
|
+
states: StatesRedisClient;
|
|
12
|
+
isOffline?: boolean;
|
|
13
|
+
objectsDBType?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare type DbConnectAsync = (onlyCheck: boolean, params?: Record<string, any>) => Promise<DbConnectAsyncReturn>;
|
|
16
|
+
export declare type RestartController = () => void;
|
|
17
|
+
export declare type ResetDbConnect = () => Promise<void>;
|
|
18
|
+
interface IoPackageCommon extends ioBroker.AdapterCommon {
|
|
19
|
+
plugins: {
|
|
20
|
+
[pluginName: string]: {
|
|
21
|
+
[configKey: string]: any;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export interface IoPackage extends ioBroker.AdapterObject {
|
|
26
|
+
objects: ioBroker.Object[];
|
|
27
|
+
instanceObjects: ioBroker.Object[];
|
|
28
|
+
common: IoPackageCommon;
|
|
29
|
+
}
|
|
30
|
+
export interface IoBrokerJSON {
|
|
31
|
+
plugins: {
|
|
32
|
+
[pluginName: string]: {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
[other: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
[other: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=_Types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_Types.d.ts","sourceRoot":"","sources":["../../src/lib/_Types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAE/E,oBAAY,mBAAmB,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;AAC7D,oBAAY,oBAAoB,GAAG,CAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;AAClC,oBAAY,oBAAoB,GAAG,CAAC,UAAU,EAAE,OAAO,KAAK,GAAG,CAAC;AAChE,aAAK,iBAAiB,GAAG,CACrB,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,iBAAiB,EACzB,SAAS,CAAC,EAAE,OAAO,EACnB,aAAa,CAAC,EAAE,MAAM,KACrB,IAAI,CAAC;AACV,oBAAY,SAAS,GAAG,CACpB,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,iBAAiB,EACpD,QAAQ,CAAC,EAAE,iBAAiB,KAC3B,IAAI,CAAC;AAEV,UAAU,oBAAoB;IAC1B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,oBAAY,cAAc,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACjH,oBAAY,iBAAiB,GAAG,MAAM,IAAI,CAAC;AAC3C,oBAAY,cAAc,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAEjD,UAAU,eAAgB,SAAQ,QAAQ,CAAC,aAAa;IACpD,OAAO,EAAE;QACL,CAAC,UAAU,EAAE,MAAM,GAAG;YAClB,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC;SAC5B,CAAC;KACL,CAAC;CACL;AACD,MAAM,WAAW,SAAU,SAAQ,QAAQ,CAAC,aAAa;IACrD,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC3B,eAAe,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACnC,MAAM,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,EAAE;QACL,CAAC,UAAU,EAAE,MAAM,GAAG;YAClB,OAAO,EAAE,OAAO,CAAC;YACjB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;SAC5B,CAAC;KACL,CAAC;IACF,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_Types.js","sourceRoot":"","sources":["../../src/lib/_Types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export = CLICert;
|
|
2
|
+
declare class CLICert extends CLICommand {
|
|
3
|
+
/**
|
|
4
|
+
* Executes a command
|
|
5
|
+
* @param {any[]} args
|
|
6
|
+
*/
|
|
7
|
+
execute(args: any[]): void | Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* create new private certificate
|
|
10
|
+
* @param {any[]} [_args]
|
|
11
|
+
*/
|
|
12
|
+
create(_args?: any[] | undefined): Promise<void>;
|
|
13
|
+
view(_args: any): void;
|
|
14
|
+
}
|
|
15
|
+
import { CLICommand } from "./cliCommand.js";
|
|
16
|
+
//# sourceMappingURL=cliCert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCert.d.ts","sourceRoot":"","sources":["../../../src/lib/cli/cliCert.js"],"names":[],"mappings":";AAOiB;IAMb;;;OAGG;IACH,cAFW,GAAG,EAAE,wBAiBf;IAED;;;OAGG;IACH,iDAmBC;IAID,uBAuBC;CACJ"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
const CLICommand = require('./cliCommand.js');
|
|
2
|
+
const { CLICommand } = require('./cliCommand.js');
|
|
3
3
|
const CLIObjects = require('./cliObjects.js');
|
|
4
4
|
const messages = require('./messages.js');
|
|
5
5
|
const { tools } = require('@iobroker/js-controller-common');
|
|
6
|
-
|
|
7
6
|
/** Command ioBroker cert ... */
|
|
8
7
|
module.exports = class CLICert extends CLICommand {
|
|
9
8
|
/** @param {import('./cliCommand.js').CLICommandOptions} options */
|
|
10
9
|
constructor(options) {
|
|
11
10
|
super(options);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
/**
|
|
15
13
|
* Executes a command
|
|
16
14
|
* @param {any[]} args
|
|
@@ -18,7 +16,6 @@ module.exports = class CLICert extends CLICommand {
|
|
|
18
16
|
execute(args) {
|
|
19
17
|
const { callback, showHelp } = this.options;
|
|
20
18
|
const command = args[0];
|
|
21
|
-
|
|
22
19
|
switch (command) {
|
|
23
20
|
case 'renew':
|
|
24
21
|
case 'create':
|
|
@@ -31,7 +28,6 @@ module.exports = class CLICert extends CLICommand {
|
|
|
31
28
|
return void callback(3);
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
/**
|
|
36
32
|
* create new private certificate
|
|
37
33
|
* @param {any[]} [_args]
|
|
@@ -39,7 +35,6 @@ module.exports = class CLICert extends CLICommand {
|
|
|
39
35
|
async create(_args) {
|
|
40
36
|
const id = 'system.certificates';
|
|
41
37
|
const certPropPath = 'native.certificates';
|
|
42
|
-
|
|
43
38
|
const certificates = tools.generateDefaultCertificates();
|
|
44
39
|
if (certificates) {
|
|
45
40
|
console.log(JSON.stringify(certificates, null, 2));
|
|
@@ -53,10 +48,8 @@ module.exports = class CLICert extends CLICommand {
|
|
|
53
48
|
});
|
|
54
49
|
}
|
|
55
50
|
}
|
|
56
|
-
|
|
57
51
|
this.options.callback();
|
|
58
52
|
}
|
|
59
|
-
|
|
60
53
|
// view-command
|
|
61
54
|
// usage: view [<certificate name>]
|
|
62
55
|
view(_args) {
|
|
@@ -72,11 +65,13 @@ module.exports = class CLICert extends CLICommand {
|
|
|
72
65
|
if (certInfo) {
|
|
73
66
|
console.log(JSON.stringify(certInfo, null, 2));
|
|
74
67
|
return void callback();
|
|
75
|
-
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
76
70
|
messages.error.cert(certName);
|
|
77
71
|
return void callback(3);
|
|
78
72
|
}
|
|
79
|
-
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
80
75
|
messages.error.cert(certName);
|
|
81
76
|
return void callback(3);
|
|
82
77
|
}
|
|
@@ -84,3 +79,4 @@ module.exports = class CLICert extends CLICommand {
|
|
|
84
79
|
});
|
|
85
80
|
}
|
|
86
81
|
};
|
|
82
|
+
//# sourceMappingURL=cliCert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCert.js","sourceRoot":"","sources":["../../../src/lib/cli/cliCert.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAClD,MAAM,UAAU,GAAG,OAAO,CAAC,i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;wBACV,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;wBAC/C,OAAO,KAAK,QAAQ,EAAE,CAAC;qBAC1B;yBAAM;wBACH,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBAC9B,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC;qBAC3B;iBACJ;qBAAM;oBACH,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC9B,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC;iBAC3B;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { Client as ObjectsClient } from '@iobroker/db-objects-redis';
|
|
3
|
+
import type { Client as StatesClient } from '@iobroker/db-states-redis';
|
|
4
|
+
export declare type DBConnectCallback = (objects: ObjectsClient, states: StatesClient, isOffline?: boolean, objectsDBType?: string) => void;
|
|
5
|
+
export interface CLICommandContext {
|
|
6
|
+
/** Invoke this before doing anything in the database */
|
|
7
|
+
dbConnect: (callback: DBConnectCallback) => void;
|
|
8
|
+
callback: (code: number) => void;
|
|
9
|
+
showHelp: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface CLICommandParams {
|
|
12
|
+
encoding?: BufferEncoding;
|
|
13
|
+
pretty?: boolean;
|
|
14
|
+
force?: boolean;
|
|
15
|
+
password?: any;
|
|
16
|
+
ingroup?: any;
|
|
17
|
+
v?: any;
|
|
18
|
+
version?: any;
|
|
19
|
+
timeout?: any;
|
|
20
|
+
enabled?: any;
|
|
21
|
+
disabled?: any;
|
|
22
|
+
port?: any;
|
|
23
|
+
ssl?: any;
|
|
24
|
+
ip?: any;
|
|
25
|
+
updatable?: any;
|
|
26
|
+
host?: any;
|
|
27
|
+
cert?: any;
|
|
28
|
+
}
|
|
29
|
+
export declare type CLICommandOptions = CLICommandContext & CLICommandParams;
|
|
30
|
+
/** The base class for any CLI command */
|
|
31
|
+
export declare class CLICommand {
|
|
32
|
+
protected readonly options: CLICommandOptions;
|
|
33
|
+
constructor(options: CLICommandOptions);
|
|
34
|
+
/**
|
|
35
|
+
* Ensures that an argument was passed in the options.
|
|
36
|
+
* Throws otherwise
|
|
37
|
+
* @param arg
|
|
38
|
+
*/
|
|
39
|
+
requireOption(arg: keyof CLICommandOptions): void;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=cliCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCommand.d.ts","sourceRoot":"","sources":["../../../src/lib/cli/cliCommand.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAExE,oBAAY,iBAAiB,GAAG,CAC5B,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,YAAY,EACpB,SAAS,CAAC,EAAE,OAAO,EACnB,aAAa,CAAC,EAAE,MAAM,KACrB,IAAI,CAAC;AAEV,MAAM,WAAW,iBAAiB;IAC9B,wDAAwD;IACxD,SAAS,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACjD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,CAAC,CAAC,EAAE,GAAG,CAAC;IACR,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,GAAG,CAAC;CACd;AAED,oBAAY,iBAAiB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAErE,yCAAyC;AACzC,qBAAa,UAAU;IACnB,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;gBAClC,OAAO,EAAE,iBAAiB;IAWtC;;;;OAIG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,iBAAiB,GAAG,IAAI;CAKpD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLICommand = void 0;
|
|
4
|
+
/** The base class for any CLI command */
|
|
5
|
+
class CLICommand {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
if (options === null || options === undefined) {
|
|
8
|
+
throw new Error(`No options given`);
|
|
9
|
+
}
|
|
10
|
+
this.options = options;
|
|
11
|
+
// Always require the callback and a wrapper for DB actions
|
|
12
|
+
this.requireOption('callback');
|
|
13
|
+
this.requireOption('dbConnect');
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Ensures that an argument was passed in the options.
|
|
17
|
+
* Throws otherwise
|
|
18
|
+
* @param arg
|
|
19
|
+
*/
|
|
20
|
+
requireOption(arg) {
|
|
21
|
+
if (this.options[arg] === undefined) {
|
|
22
|
+
throw new Error(`Invalid arguments: ${arg} is missing`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.CLICommand = CLICommand;
|
|
27
|
+
//# sourceMappingURL=cliCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCommand.js","sourceRoot":"","sources":["../../../src/lib/cli/cliCommand.ts"],"names":[],"mappings":";;;AAsCA,yCAAyC;AACzC,MAAa,UAAU;IAEnB,YAAY,OAA0B;QAClC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACvC;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,2DAA2D;QAC3D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC/B,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,GAA4B;QACtC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,sBAAsB,GAAG,aAAa,CAAC,CAAC;SAC3D;IACL,CAAC;CACJ;AAvBD,gCAuBC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export = CLICompact;
|
|
2
|
+
declare class CLICompact extends CLICommand {
|
|
3
|
+
config: any;
|
|
4
|
+
/**
|
|
5
|
+
* Executes a command
|
|
6
|
+
* @param {any[]} args
|
|
7
|
+
*/
|
|
8
|
+
execute(args: any[]): void;
|
|
9
|
+
/**
|
|
10
|
+
* Output status of compact mode for host
|
|
11
|
+
*/
|
|
12
|
+
statusCompactModeHost(): undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Set compact mode for this host
|
|
15
|
+
* @param targetState target state to set for host
|
|
16
|
+
*/
|
|
17
|
+
setCompactModeHost(targetState: any): void;
|
|
18
|
+
/**
|
|
19
|
+
* Output the compact mode status for a defined adapter instance
|
|
20
|
+
* @param instance instance to output status for
|
|
21
|
+
*/
|
|
22
|
+
statusCompactModeInstance(instance: any): void;
|
|
23
|
+
setCompactModeInstance(instance: any, targetState: any, groupId: any): void;
|
|
24
|
+
}
|
|
25
|
+
import { CLICommand } from "./cliCommand.js";
|
|
26
|
+
//# sourceMappingURL=cliCompact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCompact.d.ts","sourceRoot":"","sources":["../../../src/lib/cli/cliCompact.js"],"names":[],"mappings":";AAOiB;IAIT,YAAwD;IAE5D;;;OAGG;IACH,cAFW,GAAG,EAAE,QAoCf;IAED;;OAEG;IACH,mCAOC;IAED;;;OAGG;IACH,2CAyBC;IAED;;;OAGG;IACH,+CA8BC;IAED,4EAwEC;CACJ"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const CLI = require('./messages.js');
|
|
3
|
-
const CLICommand = require('./cliCommand.js');
|
|
3
|
+
const { CLICommand } = require('./cliCommand.js');
|
|
4
4
|
const { tools } = require('@iobroker/js-controller-common');
|
|
5
5
|
const fs = require('fs-extra');
|
|
6
|
-
|
|
7
6
|
/** Command ioBroker compact ... */
|
|
8
7
|
module.exports = class CLICompact extends CLICommand {
|
|
9
8
|
/** @param {import('./cliCommand.js').CLICommandOptions} options */
|
|
@@ -44,48 +43,38 @@ module.exports = class CLICompact extends CLICommand {
|
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
|
-
|
|
48
46
|
CLI.error.unknownCommand('compact', command);
|
|
49
47
|
showHelp();
|
|
50
48
|
return void callback(3);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
|
-
|
|
54
51
|
/**
|
|
55
52
|
* Output status of compact mode for host
|
|
56
53
|
*/
|
|
57
54
|
statusCompactModeHost() {
|
|
58
55
|
const { callback } = this.options;
|
|
59
|
-
|
|
60
56
|
const compactMode = !!(this.config && this.config.system && this.config.system.compact);
|
|
61
57
|
console.log('Compact mode for this host is currently ' + (compactMode ? 'enabled' : 'disabled'));
|
|
62
|
-
|
|
63
58
|
return void callback();
|
|
64
59
|
}
|
|
65
|
-
|
|
66
60
|
/**
|
|
67
61
|
* Set compact mode for this host
|
|
68
62
|
* @param targetState target state to set for host
|
|
69
63
|
*/
|
|
70
64
|
setCompactModeHost(targetState) {
|
|
71
65
|
const { callback, dbConnect } = this.options;
|
|
72
|
-
|
|
73
66
|
dbConnect((_objects, _states, isOffline) => {
|
|
74
67
|
const currentState = !!(this.config && this.config.system && this.config.system.compact);
|
|
75
|
-
|
|
76
68
|
if (targetState === currentState) {
|
|
77
69
|
console.log('Compact mode for this host is already ' + (currentState ? 'enabled' : 'disabled'));
|
|
78
70
|
return void callback();
|
|
79
71
|
}
|
|
80
|
-
|
|
81
72
|
this.config.system = this.config.system || {};
|
|
82
73
|
this.config.system.compact = targetState;
|
|
83
74
|
const configFileName = tools.getConfigFileName();
|
|
84
75
|
fs.writeFileSync(configFileName, JSON.stringify(this.config, null, 4), 'utf8');
|
|
85
|
-
|
|
86
76
|
console.log();
|
|
87
77
|
console.log('Compact mode for this host is now ' + (targetState ? 'enabled' : 'disabled'));
|
|
88
|
-
|
|
89
78
|
if (!isOffline) {
|
|
90
79
|
console.log();
|
|
91
80
|
console.log('Please restart ioBroker for this change to take effect!');
|
|
@@ -93,14 +82,12 @@ module.exports = class CLICompact extends CLICommand {
|
|
|
93
82
|
return void callback();
|
|
94
83
|
});
|
|
95
84
|
}
|
|
96
|
-
|
|
97
85
|
/**
|
|
98
86
|
* Output the compact mode status for a defined adapter instance
|
|
99
87
|
* @param instance instance to output status for
|
|
100
88
|
*/
|
|
101
89
|
statusCompactModeInstance(instance) {
|
|
102
90
|
const { callback, dbConnect } = this.options;
|
|
103
|
-
|
|
104
91
|
dbConnect((objects, _states, _isOffline, _objectDbType, _config) => {
|
|
105
92
|
if (!this.config.system || !this.config.system.compact) {
|
|
106
93
|
console.log('Compact mode is disabled for this host. All compact mode settings will have no effect!');
|
|
@@ -109,30 +96,26 @@ module.exports = class CLICompact extends CLICommand {
|
|
|
109
96
|
objects.getObject('system.adapter.' + instance, (err, obj) => {
|
|
110
97
|
if (!err && obj) {
|
|
111
98
|
if (!obj.common.compact) {
|
|
112
|
-
console.log(
|
|
113
|
-
'This adapter does not support compact mode. The below settings will have no effect!'
|
|
114
|
-
);
|
|
99
|
+
console.log('This adapter does not support compact mode. The below settings will have no effect!');
|
|
115
100
|
console.log();
|
|
116
|
-
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
117
103
|
console.log('Adapter supports compact mode: ' + !!obj.common.compact);
|
|
118
104
|
}
|
|
119
105
|
console.log('Compact mode enabled for instance: ' + !!obj.common.runAsCompactMode);
|
|
120
|
-
console.log(
|
|
121
|
-
|
|
122
|
-
(obj.common.compactGroup !== undefined ? obj.common.compactGroup : 1)
|
|
123
|
-
);
|
|
106
|
+
console.log('Compact group: ' +
|
|
107
|
+
(obj.common.compactGroup !== undefined ? obj.common.compactGroup : 1));
|
|
124
108
|
return void callback();
|
|
125
|
-
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
126
111
|
CLI.error.invalidInstance(instance);
|
|
127
112
|
return void callback(24);
|
|
128
113
|
}
|
|
129
114
|
});
|
|
130
115
|
});
|
|
131
116
|
}
|
|
132
|
-
|
|
133
117
|
setCompactModeInstance(instance, targetState, groupId) {
|
|
134
118
|
const { callback, dbConnect } = this.options;
|
|
135
|
-
|
|
136
119
|
dbConnect((objects, _states, _isOffline, _objectDbType, _config) => {
|
|
137
120
|
if (!this.config.system || !this.config.system.compact) {
|
|
138
121
|
console.log('Compact mode is disabled on this host. This setting will have no effect!');
|
|
@@ -141,11 +124,10 @@ module.exports = class CLICompact extends CLICommand {
|
|
|
141
124
|
objects.getObject('system.adapter.' + instance, (err, obj) => {
|
|
142
125
|
if (!err && obj) {
|
|
143
126
|
if (!obj.common.compact) {
|
|
144
|
-
console.log(
|
|
145
|
-
'This adapter does not support compact mode. The below settings will have no effect!'
|
|
146
|
-
);
|
|
127
|
+
console.log('This adapter does not support compact mode. The below settings will have no effect!');
|
|
147
128
|
console.log();
|
|
148
|
-
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
149
131
|
console.log('Adapter supports compact mode : ' + !!obj.common.compact);
|
|
150
132
|
}
|
|
151
133
|
let newRunAsCompactMode;
|
|
@@ -163,18 +145,14 @@ module.exports = class CLICompact extends CLICommand {
|
|
|
163
145
|
newCompactGroup = groupId;
|
|
164
146
|
}
|
|
165
147
|
}
|
|
166
|
-
console.log(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
(newCompactGroup !== undefined && obj.common.compactGroup !== newCompactGroup
|
|
175
|
-
? '--> ' + newCompactGroup
|
|
176
|
-
: obj.common.compactGroup)
|
|
177
|
-
);
|
|
148
|
+
console.log('Compact mode enabled for instance: ' +
|
|
149
|
+
(newRunAsCompactMode !== undefined
|
|
150
|
+
? '--> ' + newRunAsCompactMode
|
|
151
|
+
: !!obj.common.runAsCompactMode));
|
|
152
|
+
console.log('Compact group: ' +
|
|
153
|
+
(newCompactGroup !== undefined && obj.common.compactGroup !== newCompactGroup
|
|
154
|
+
? '--> ' + newCompactGroup
|
|
155
|
+
: obj.common.compactGroup));
|
|
178
156
|
if (newRunAsCompactMode !== undefined || newCompactGroup !== undefined) {
|
|
179
157
|
if (newCompactGroup !== undefined) {
|
|
180
158
|
obj.common.compactGroup = newCompactGroup;
|
|
@@ -182,7 +160,6 @@ module.exports = class CLICompact extends CLICommand {
|
|
|
182
160
|
if (newRunAsCompactMode !== undefined) {
|
|
183
161
|
obj.common.runAsCompactMode = newRunAsCompactMode;
|
|
184
162
|
}
|
|
185
|
-
|
|
186
163
|
obj.from = 'system.host.' + tools.getHostName() + '.cli';
|
|
187
164
|
obj.ts = new Date().getTime();
|
|
188
165
|
objects.setObject('system.adapter.' + instance, obj, err => {
|
|
@@ -192,11 +169,13 @@ module.exports = class CLICompact extends CLICommand {
|
|
|
192
169
|
console.log('Instance settings for "' + instance + '" are changed.');
|
|
193
170
|
callback();
|
|
194
171
|
});
|
|
195
|
-
}
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
196
174
|
console.log('No settings changed.');
|
|
197
175
|
return void callback();
|
|
198
176
|
}
|
|
199
|
-
}
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
200
179
|
CLI.error.invalidInstance(instance);
|
|
201
180
|
return void callback(24);
|
|
202
181
|
}
|
|
@@ -204,3 +183,4 @@ module.exports = class CLICompact extends CLICommand {
|
|
|
204
183
|
});
|
|
205
184
|
}
|
|
206
185
|
};
|
|
186
|
+
//# sourceMappingURL=cliCompact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliCompact.js","sourceRoot":"","sources":["../../../src/lib/cli/cliCompact.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,MAAM,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AACrC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAClD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC5D,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAE/B,mCAAmC;AACnC,MAAM,CAAC,OAAO,GAAG,MAAM,UAAW,SAAQ,UAAU;IAChD,mEAAmE;IACnE,YAAY,OAAO;QACf,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD;;;OAGG;IACH,OAAO,CAAC,IAAI;QACR,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,CA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,GAAG,CAAC,MAAM,CAAC,gBAAgB,GAAG,mBAAmB,CAAC;yBACrD;wBAED,GAAG,CAAC,IAAI,GAAG,cAAc,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC;wBACzD,GAAG,CAAC,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;wBAC9B,OAAO,CAAC,SAAS,CAAC,iBAAiB,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;4BACvD,IAAI,GAAG,EAAE;gCACL,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;6BACpB;4BACD,OAAO,CAAC,GAAG,CAAC,yBAAyB,GAAG,QAAQ,GAAG,gBAAgB,CAAC,CAAC;4BACrE,QAAQ,EAAE,CAAC;wBACf,CAAC,CAAC,CAAC;qBACN;yBAAM;wBACH,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;wBACpC,OAAO,KAAK,QAAQ,EAAE,CAAC;qBAC1B;iBACJ;qBAAM;oBACH,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;oBACpC,OAAO,KAAK,QAAQ,CAAC,EAAE,CAAC,CAAC;iBAC5B;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export = CLICompact;
|
|
2
|
+
declare class CLICompact extends CLICommand {
|
|
3
|
+
/**
|
|
4
|
+
* Cehcks if the adpter instance is running
|
|
5
|
+
*
|
|
6
|
+
* @param {string} adapter
|
|
7
|
+
* @param {string} instance
|
|
8
|
+
* @return {Promise<boolean>}
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
private _isInstanceRunning;
|
|
12
|
+
/**
|
|
13
|
+
* Executes a command
|
|
14
|
+
* @param {any[]} args
|
|
15
|
+
*/
|
|
16
|
+
execute(args: any[]): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
import { CLICommand } from "./cliCommand.js";
|
|
19
|
+
//# sourceMappingURL=cliDebug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliDebug.d.ts","sourceRoot":"","sources":["../../../src/lib/cli/cliDebug.js"],"names":[],"mappings":";AAQiB;IAMb;;;;;;;OAOG;IACH,2BAgBC;IAED;;;OAGG;IACH,cAFW,GAAG,EAAE,iBA+Cf;CACJ"}
|