nestjs-web-console 0.2.14 → 0.2.18
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.
|
@@ -4,7 +4,6 @@ import { ConsoleOptions, ReadArgMap, ReadArgOptions, ReadLineOptions, SessionObj
|
|
|
4
4
|
import { ConsoleCommand } from "./processors/base/console.command";
|
|
5
5
|
import { InvalidCommand } from "./processors/base/invalid.command";
|
|
6
6
|
import { NotLoggedCommand } from "./processors/base/not-logged.command";
|
|
7
|
-
import 'moment-duration-format';
|
|
8
7
|
export declare class WebConsoleService {
|
|
9
8
|
private moduleRef;
|
|
10
9
|
allCommands: ConsoleCommand[];
|
|
@@ -35,10 +35,11 @@ exports.WebConsoleService = void 0;
|
|
|
35
35
|
const common_1 = require("@nestjs/common");
|
|
36
36
|
const core_1 = require("@nestjs/core");
|
|
37
37
|
const moment_1 = __importDefault(require("moment"));
|
|
38
|
+
const moment_duration_format_1 = __importDefault(require("moment-duration-format"));
|
|
38
39
|
const node_eta_1 = __importDefault(require("node-eta"));
|
|
39
40
|
const invalid_command_1 = require("./processors/base/invalid.command");
|
|
40
41
|
const not_logged_command_1 = require("./processors/base/not-logged.command");
|
|
41
|
-
|
|
42
|
+
moment_duration_format_1.default(moment_1.default);
|
|
42
43
|
let WebConsoleService = class WebConsoleService {
|
|
43
44
|
constructor(moduleRef) {
|
|
44
45
|
Object.defineProperty(this, "moduleRef", {
|
|
@@ -91,8 +92,10 @@ let WebConsoleService = class WebConsoleService {
|
|
|
91
92
|
if (lastPercent == -1 || percent - lastPercent >= 10) {
|
|
92
93
|
//get estimates
|
|
93
94
|
if (pgCurrent < pgMax) {
|
|
95
|
+
this.log(session, `${percent}% (${pgCurrent}/${pgMax}) ${lastPercent == -1 ? '' : 'ETA: ' + moment_1.default.duration(+eta.format('{{eta}}'), 'seconds').format('hh:mm:ss', { trim: false })}`);
|
|
94
96
|
lastPercent = percent;
|
|
95
|
-
|
|
97
|
+
while (lastPercent % 10)
|
|
98
|
+
lastPercent--;
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
}
|