hoffmation-base 3.2.1-alpha.7 → 3.2.1-alpha.9
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/lib/command/baseCommand.d.ts +3 -2
- package/lib/command/baseCommand.js +13 -8
- package/lib/interfaces/iJsonCustomPrepend.d.ts +9 -0
- package/lib/interfaces/iJsonCustomPrepend.js +2 -0
- package/lib/interfaces/index.d.ts +1 -0
- package/lib/interfaces/index.js +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/utils.js +7 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandSource, CommandType } from '../enums';
|
|
2
2
|
import { iBaseCommand } from './iBaseCommand';
|
|
3
|
-
import { iJsonOmitKeys } from '../interfaces';
|
|
4
|
-
export declare abstract class BaseCommand implements iBaseCommand, iJsonOmitKeys {
|
|
3
|
+
import { iJsonCustomPrepend, iJsonOmitKeys } from '../interfaces';
|
|
4
|
+
export declare abstract class BaseCommand implements iBaseCommand, iJsonOmitKeys, iJsonCustomPrepend {
|
|
5
5
|
readonly source: CommandSource | iBaseCommand;
|
|
6
6
|
readonly reason: string;
|
|
7
7
|
/**
|
|
@@ -40,5 +40,6 @@ export declare abstract class BaseCommand implements iBaseCommand, iJsonOmitKeys
|
|
|
40
40
|
get reasonTrace(): string;
|
|
41
41
|
containsType(type: CommandType): boolean;
|
|
42
42
|
get logMessage(): string;
|
|
43
|
+
customPrepend(): Partial<unknown>;
|
|
43
44
|
toJSON(): Partial<BaseCommand>;
|
|
44
45
|
}
|
|
@@ -25,7 +25,7 @@ class BaseCommand {
|
|
|
25
25
|
if (this.overrideCommandSource !== undefined) {
|
|
26
26
|
return this.overrideCommandSource === enums_1.CommandSource.Automatic;
|
|
27
27
|
}
|
|
28
|
-
if (this.source
|
|
28
|
+
if (typeof this.source === 'object') {
|
|
29
29
|
return this.source.isAutomaticAction;
|
|
30
30
|
}
|
|
31
31
|
return this.source === enums_1.CommandSource.Automatic;
|
|
@@ -36,7 +36,7 @@ class BaseCommand {
|
|
|
36
36
|
this.overrideCommandSource === enums_1.CommandSource.API ||
|
|
37
37
|
this.overrideCommandSource === enums_1.CommandSource.Force);
|
|
38
38
|
}
|
|
39
|
-
if (this.source
|
|
39
|
+
if (typeof this.source === 'object') {
|
|
40
40
|
return this.source.isForceAction;
|
|
41
41
|
}
|
|
42
42
|
return (this.source === enums_1.CommandSource.Manual || this.source === enums_1.CommandSource.API || this.source === enums_1.CommandSource.Force);
|
|
@@ -45,7 +45,7 @@ class BaseCommand {
|
|
|
45
45
|
if (this.overrideCommandSource !== undefined) {
|
|
46
46
|
return this.overrideCommandSource === enums_1.CommandSource.Manual || this.overrideCommandSource === enums_1.CommandSource.API;
|
|
47
47
|
}
|
|
48
|
-
if (this.source
|
|
48
|
+
if (typeof this.source === 'object') {
|
|
49
49
|
return this.source.isManual;
|
|
50
50
|
}
|
|
51
51
|
return this.source === enums_1.CommandSource.Manual || this.source === enums_1.CommandSource.API;
|
|
@@ -54,7 +54,7 @@ class BaseCommand {
|
|
|
54
54
|
if (this.overrideCommandSource !== undefined) {
|
|
55
55
|
return this.overrideCommandSource === enums_1.CommandSource.Initial;
|
|
56
56
|
}
|
|
57
|
-
if (this.source
|
|
57
|
+
if (typeof this.source === 'object') {
|
|
58
58
|
return this.source.isInitial;
|
|
59
59
|
}
|
|
60
60
|
return this.source === enums_1.CommandSource.Initial;
|
|
@@ -67,16 +67,16 @@ class BaseCommand {
|
|
|
67
67
|
if (this.ignoreReason !== undefined) {
|
|
68
68
|
ownPart += ` ignored due to: "${this.ignoreReason}"`;
|
|
69
69
|
}
|
|
70
|
-
if (this.source
|
|
70
|
+
if (typeof this.source === 'object') {
|
|
71
71
|
return `${this.source.reasonTrace} -> ${ownPart}`;
|
|
72
72
|
}
|
|
73
|
-
return `
|
|
73
|
+
return `CommandSource("${enums_1.CommandSource[this.source]}") stack => ${ownPart}`;
|
|
74
74
|
}
|
|
75
75
|
containsType(type) {
|
|
76
76
|
if (this.type === type) {
|
|
77
77
|
return true;
|
|
78
78
|
}
|
|
79
|
-
if (this.source
|
|
79
|
+
if (typeof this.source === 'object') {
|
|
80
80
|
return this.source.containsType(type);
|
|
81
81
|
}
|
|
82
82
|
return false;
|
|
@@ -84,8 +84,13 @@ class BaseCommand {
|
|
|
84
84
|
get logMessage() {
|
|
85
85
|
return this.reasonTrace;
|
|
86
86
|
}
|
|
87
|
+
customPrepend() {
|
|
88
|
+
return {
|
|
89
|
+
logMessage: this.logMessage,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
87
92
|
toJSON() {
|
|
88
|
-
// eslint-disable-next-line
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
94
|
const result = lodash_1.default.omit(this, ['source']);
|
|
90
95
|
result['logMessage'] = this.logMessage;
|
|
91
96
|
return result;
|
|
@@ -16,6 +16,7 @@ export * from './iButtonCallback';
|
|
|
16
16
|
export * from './iButtonCapabilities';
|
|
17
17
|
export * from './iDeviceInfo';
|
|
18
18
|
export * from './iIdHolder';
|
|
19
|
+
export * from './iJsonCustomPrepend';
|
|
19
20
|
export * from './iJsonOmitKeys';
|
|
20
21
|
export * from './iLogSettings';
|
|
21
22
|
export * from './iAsusConfig';
|
package/lib/interfaces/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __exportStar(require("./iButtonCallback"), exports);
|
|
|
32
32
|
__exportStar(require("./iButtonCapabilities"), exports);
|
|
33
33
|
__exportStar(require("./iDeviceInfo"), exports);
|
|
34
34
|
__exportStar(require("./iIdHolder"), exports);
|
|
35
|
+
__exportStar(require("./iJsonCustomPrepend"), exports);
|
|
35
36
|
__exportStar(require("./iJsonOmitKeys"), exports);
|
|
36
37
|
__exportStar(require("./iLogSettings"), exports);
|
|
37
38
|
__exportStar(require("./iAsusConfig"), exports);
|