nestjs-web-console 1.0.1 → 1.0.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 (47) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +66 -66
  3. package/dist/console.types.d.ts +75 -75
  4. package/dist/console.types.js +15 -15
  5. package/dist/controllers/web.console.controller.d.ts +1 -1
  6. package/dist/controllers/web.console.controller.js +690 -675
  7. package/dist/filters/http-exception.filter.d.ts +4 -4
  8. package/dist/filters/http-exception.filter.js +50 -50
  9. package/dist/index.d.ts +8 -8
  10. package/dist/index.js +24 -24
  11. package/dist/services/all.commands.d.ts +3 -3
  12. package/dist/services/all.commands.js +13 -13
  13. package/dist/services/processors/base/console.command.d.ts +8 -8
  14. package/dist/services/processors/base/console.command.js +27 -27
  15. package/dist/services/processors/base/invalid.command.d.ts +5 -5
  16. package/dist/services/processors/base/invalid.command.js +14 -14
  17. package/dist/services/processors/base/not-logged.command.d.ts +5 -5
  18. package/dist/services/processors/base/not-logged.command.js +10 -10
  19. package/dist/services/processors/bash.command.d.ts +7 -7
  20. package/dist/services/processors/bash.command.js +102 -102
  21. package/dist/services/processors/clear-screen.command.d.ts +6 -6
  22. package/dist/services/processors/clear-screen.command.js +30 -30
  23. package/dist/services/processors/cmd.command.d.ts +7 -7
  24. package/dist/services/processors/cmd.command.js +99 -99
  25. package/dist/services/processors/help.command.d.ts +7 -7
  26. package/dist/services/processors/help.command.js +41 -41
  27. package/dist/services/processors/index.d.ts +8 -8
  28. package/dist/services/processors/index.js +24 -24
  29. package/dist/services/processors/invite.command.d.ts +9 -9
  30. package/dist/services/processors/invite.command.js +76 -76
  31. package/dist/services/processors/join.command.d.ts +8 -8
  32. package/dist/services/processors/join.command.js +108 -108
  33. package/dist/services/processors/login.command.d.ts +14 -14
  34. package/dist/services/processors/login.command.js +69 -69
  35. package/dist/services/processors/logout.command.d.ts +6 -6
  36. package/dist/services/processors/logout.command.js +30 -30
  37. package/dist/services/remote.console.service.d.ts +30 -30
  38. package/dist/services/remote.console.service.js +107 -107
  39. package/dist/services/temp.file.service.d.ts +25 -23
  40. package/dist/services/temp.file.service.js +102 -90
  41. package/dist/services/web.console.service.d.ts +57 -57
  42. package/dist/services/web.console.service.js +437 -437
  43. package/dist/web.console.module.d.ts +6 -6
  44. package/dist/web.console.module.js +87 -87
  45. package/dist.zip +0 -0
  46. package/package.json +5 -5
  47. package/tsconfig.json +18 -18
@@ -1,30 +1,30 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ClearScreenCommand = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const console_command_1 = require("./base/console.command");
15
- let ClearScreenCommand = class ClearScreenCommand extends console_command_1.ConsoleCommand {
16
- constructor() {
17
- super();
18
- this.command = 'clr';
19
- this.description = 'Clears screen';
20
- this.requiresAuth = false;
21
- }
22
- async process({ session }) {
23
- session.logs = '';
24
- }
25
- };
26
- ClearScreenCommand = __decorate([
27
- (0, common_1.Injectable)(),
28
- __metadata("design:paramtypes", [])
29
- ], ClearScreenCommand);
30
- exports.ClearScreenCommand = ClearScreenCommand;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ClearScreenCommand = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const console_command_1 = require("./base/console.command");
15
+ let ClearScreenCommand = class ClearScreenCommand extends console_command_1.ConsoleCommand {
16
+ constructor() {
17
+ super();
18
+ this.command = 'clr';
19
+ this.description = 'Clears screen';
20
+ this.requiresAuth = false;
21
+ }
22
+ async process({ session }) {
23
+ session.logs = '';
24
+ }
25
+ };
26
+ ClearScreenCommand = __decorate([
27
+ (0, common_1.Injectable)(),
28
+ __metadata("design:paramtypes", [])
29
+ ], ClearScreenCommand);
30
+ exports.ClearScreenCommand = ClearScreenCommand;
@@ -1,7 +1,7 @@
1
- import { CommandProcessParameters, WebConsoleService } from "../web.console.service";
2
- import { ConsoleCommand } from "./base/console.command";
3
- export declare class CmdCommand extends ConsoleCommand {
4
- readonly webConsoleService: WebConsoleService;
5
- constructor(webConsoleService: WebConsoleService);
6
- process({ logRaw, parseArgs, readLine, session }: CommandProcessParameters): Promise<void>;
7
- }
1
+ import { CommandProcessParameters, WebConsoleService } from "../web.console.service";
2
+ import { ConsoleCommand } from "./base/console.command";
3
+ export declare class CmdCommand extends ConsoleCommand {
4
+ readonly webConsoleService: WebConsoleService;
5
+ constructor(webConsoleService: WebConsoleService);
6
+ process({ logRaw, parseArgs, readLine, session }: CommandProcessParameters): Promise<void>;
7
+ }
@@ -1,99 +1,99 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.CmdCommand = void 0;
16
- const common_1 = require("@nestjs/common");
17
- const child_process_1 = require("child_process");
18
- const lodash_1 = __importDefault(require("lodash"));
19
- const web_console_service_1 = require("../web.console.service");
20
- const console_command_1 = require("./base/console.command");
21
- let CmdCommand = class CmdCommand extends console_command_1.ConsoleCommand {
22
- constructor(webConsoleService) {
23
- super();
24
- Object.defineProperty(this, "webConsoleService", {
25
- enumerable: true,
26
- configurable: true,
27
- writable: true,
28
- value: webConsoleService
29
- });
30
- this.command = 'cmd';
31
- this.description = 'Creates a cmd process';
32
- }
33
- async process({ logRaw, parseArgs, readLine, session }) {
34
- await new Promise((res, rej) => {
35
- const process = (0, child_process_1.spawn)('cmd', parseArgs());
36
- session.onCancelSignal = () => {
37
- process.kill("SIGINT");
38
- };
39
- session.onCancel = () => {
40
- process.kill();
41
- };
42
- let firstResponse = true;
43
- let lastInput;
44
- const handleOutput = chunk => {
45
- let out = new Buffer(chunk, 'utf-8').toString();
46
- const waitingInput = out.charCodeAt(out.length - 1) == 62;
47
- out = escapeHtml(out).replace(/\n/g, '<br/>').replace(/\r/g, '').replace(/\s\s/g, ' &nbsp;');
48
- if (out && out.match && firstResponse) {
49
- firstResponse = false;
50
- const [, first, rest] = out.match(/^(.*?)<br\/>(.*)/);
51
- if (first.trim() == lastInput)
52
- out = rest;
53
- }
54
- if (waitingInput) {
55
- const [, ...captures] = out.match(/(.*<br\/>)?(.*)/m);
56
- lodash_1.default.dropRight(captures, 1).forEach(capture => capture && logRaw(capture));
57
- readLine(lodash_1.default.last(captures) || '').then(input => {
58
- lastInput = input;
59
- firstResponse = true;
60
- process.stdin.write(input + '\r\n');
61
- });
62
- }
63
- else {
64
- out && logRaw(out);
65
- }
66
- };
67
- process.stdout.on('data', handleOutput);
68
- process.stderr.on('data', handleOutput);
69
- process.on('error', e => {
70
- rej(e);
71
- });
72
- function exitHandler(options, exitCode) {
73
- if (options.cleanup)
74
- console.log('clean');
75
- if (exitCode || exitCode === 0)
76
- console.log(exitCode);
77
- res(null);
78
- }
79
- process.on('exit', exitHandler.bind(null, { cleanup: true }));
80
- process.on('SIGINT', exitHandler.bind(null, { exit: true }));
81
- process.on('SIGUSR1', exitHandler.bind(null, { exit: true }));
82
- process.on('SIGUSR2', exitHandler.bind(null, { exit: true }));
83
- process.on('uncaughtException', exitHandler.bind(null, { exit: true }));
84
- });
85
- }
86
- };
87
- CmdCommand = __decorate([
88
- (0, common_1.Injectable)(),
89
- __metadata("design:paramtypes", [web_console_service_1.WebConsoleService])
90
- ], CmdCommand);
91
- exports.CmdCommand = CmdCommand;
92
- function escapeHtml(unsafe) {
93
- return unsafe
94
- .replace(/&/g, "&amp;")
95
- .replace(/</g, "&lt;")
96
- .replace(/>/g, "&gt;")
97
- .replace(/"/g, "&quot;")
98
- .replace(/'/g, "&#039;");
99
- }
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.CmdCommand = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const child_process_1 = require("child_process");
18
+ const lodash_1 = __importDefault(require("lodash"));
19
+ const web_console_service_1 = require("../web.console.service");
20
+ const console_command_1 = require("./base/console.command");
21
+ let CmdCommand = class CmdCommand extends console_command_1.ConsoleCommand {
22
+ constructor(webConsoleService) {
23
+ super();
24
+ Object.defineProperty(this, "webConsoleService", {
25
+ enumerable: true,
26
+ configurable: true,
27
+ writable: true,
28
+ value: webConsoleService
29
+ });
30
+ this.command = 'cmd';
31
+ this.description = 'Creates a cmd process';
32
+ }
33
+ async process({ logRaw, parseArgs, readLine, session }) {
34
+ await new Promise((res, rej) => {
35
+ const process = (0, child_process_1.spawn)('cmd', parseArgs());
36
+ session.onCancelSignal = () => {
37
+ process.kill("SIGINT");
38
+ };
39
+ session.onCancel = () => {
40
+ process.kill();
41
+ };
42
+ let firstResponse = true;
43
+ let lastInput;
44
+ const handleOutput = chunk => {
45
+ let out = new Buffer(chunk, 'utf-8').toString();
46
+ const waitingInput = out.charCodeAt(out.length - 1) == 62;
47
+ out = escapeHtml(out).replace(/\n/g, '<br/>').replace(/\r/g, '').replace(/\s\s/g, ' &nbsp;');
48
+ if (out && out.match && firstResponse) {
49
+ firstResponse = false;
50
+ const [, first, rest] = out.match(/^(.*?)<br\/>(.*)/);
51
+ if (first.trim() == lastInput)
52
+ out = rest;
53
+ }
54
+ if (waitingInput) {
55
+ const [, ...captures] = out.match(/(.*<br\/>)?(.*)/m);
56
+ lodash_1.default.dropRight(captures, 1).forEach(capture => capture && logRaw(capture));
57
+ readLine(lodash_1.default.last(captures) || '').then(input => {
58
+ lastInput = input;
59
+ firstResponse = true;
60
+ process.stdin.write(input + '\r\n');
61
+ });
62
+ }
63
+ else {
64
+ out && logRaw(out);
65
+ }
66
+ };
67
+ process.stdout.on('data', handleOutput);
68
+ process.stderr.on('data', handleOutput);
69
+ process.on('error', e => {
70
+ rej(e);
71
+ });
72
+ function exitHandler(options, exitCode) {
73
+ if (options.cleanup)
74
+ console.log('clean');
75
+ if (exitCode || exitCode === 0)
76
+ console.log(exitCode);
77
+ res(null);
78
+ }
79
+ process.on('exit', exitHandler.bind(null, { cleanup: true }));
80
+ process.on('SIGINT', exitHandler.bind(null, { exit: true }));
81
+ process.on('SIGUSR1', exitHandler.bind(null, { exit: true }));
82
+ process.on('SIGUSR2', exitHandler.bind(null, { exit: true }));
83
+ process.on('uncaughtException', exitHandler.bind(null, { exit: true }));
84
+ });
85
+ }
86
+ };
87
+ CmdCommand = __decorate([
88
+ (0, common_1.Injectable)(),
89
+ __metadata("design:paramtypes", [web_console_service_1.WebConsoleService])
90
+ ], CmdCommand);
91
+ exports.CmdCommand = CmdCommand;
92
+ function escapeHtml(unsafe) {
93
+ return unsafe
94
+ .replace(/&/g, "&amp;")
95
+ .replace(/</g, "&lt;")
96
+ .replace(/>/g, "&gt;")
97
+ .replace(/"/g, "&quot;")
98
+ .replace(/'/g, "&#039;");
99
+ }
@@ -1,7 +1,7 @@
1
- import { CommandProcessParameters, WebConsoleService } from "../web.console.service";
2
- import { ConsoleCommand } from "./base/console.command";
3
- export declare class HelpCommand extends ConsoleCommand {
4
- readonly webConsoleService: WebConsoleService;
5
- constructor(webConsoleService: WebConsoleService);
6
- process({ logTable }: CommandProcessParameters): Promise<void>;
7
- }
1
+ import { CommandProcessParameters, WebConsoleService } from "../web.console.service";
2
+ import { ConsoleCommand } from "./base/console.command";
3
+ export declare class HelpCommand extends ConsoleCommand {
4
+ readonly webConsoleService: WebConsoleService;
5
+ constructor(webConsoleService: WebConsoleService);
6
+ process({ logTable }: CommandProcessParameters): Promise<void>;
7
+ }
@@ -1,41 +1,41 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.HelpCommand = void 0;
13
- const common_1 = require("@nestjs/common");
14
- const web_console_service_1 = require("../web.console.service");
15
- const console_command_1 = require("./base/console.command");
16
- let HelpCommand = class HelpCommand extends console_command_1.ConsoleCommand {
17
- constructor(webConsoleService) {
18
- super();
19
- Object.defineProperty(this, "webConsoleService", {
20
- enumerable: true,
21
- configurable: true,
22
- writable: true,
23
- value: webConsoleService
24
- });
25
- this.command = 'help';
26
- this.description = 'Lists all commands';
27
- this.requiresAuth = false;
28
- }
29
- async process({ logTable }) {
30
- const entities = this.webConsoleService.allCommands.map(x => ({
31
- Command: x.command,
32
- Description: x.description
33
- }));
34
- logTable(entities);
35
- }
36
- };
37
- HelpCommand = __decorate([
38
- (0, common_1.Injectable)(),
39
- __metadata("design:paramtypes", [web_console_service_1.WebConsoleService])
40
- ], HelpCommand);
41
- exports.HelpCommand = HelpCommand;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HelpCommand = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const web_console_service_1 = require("../web.console.service");
15
+ const console_command_1 = require("./base/console.command");
16
+ let HelpCommand = class HelpCommand extends console_command_1.ConsoleCommand {
17
+ constructor(webConsoleService) {
18
+ super();
19
+ Object.defineProperty(this, "webConsoleService", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: webConsoleService
24
+ });
25
+ this.command = 'help';
26
+ this.description = 'Lists all commands';
27
+ this.requiresAuth = false;
28
+ }
29
+ async process({ logTable }) {
30
+ const entities = this.webConsoleService.allCommands.map(x => ({
31
+ Command: x.command,
32
+ Description: x.description
33
+ }));
34
+ logTable(entities);
35
+ }
36
+ };
37
+ HelpCommand = __decorate([
38
+ (0, common_1.Injectable)(),
39
+ __metadata("design:paramtypes", [web_console_service_1.WebConsoleService])
40
+ ], HelpCommand);
41
+ exports.HelpCommand = HelpCommand;
@@ -1,8 +1,8 @@
1
- export * from './bash.command';
2
- export * from './clear-screen.command';
3
- export * from './cmd.command';
4
- export * from './help.command';
5
- export * from './login.command';
6
- export * from './logout.command';
7
- export * from './invite.command';
8
- export * from './join.command';
1
+ export * from './bash.command';
2
+ export * from './clear-screen.command';
3
+ export * from './cmd.command';
4
+ export * from './help.command';
5
+ export * from './login.command';
6
+ export * from './logout.command';
7
+ export * from './invite.command';
8
+ export * from './join.command';
@@ -1,24 +1,24 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./bash.command"), exports);
18
- __exportStar(require("./clear-screen.command"), exports);
19
- __exportStar(require("./cmd.command"), exports);
20
- __exportStar(require("./help.command"), exports);
21
- __exportStar(require("./login.command"), exports);
22
- __exportStar(require("./logout.command"), exports);
23
- __exportStar(require("./invite.command"), exports);
24
- __exportStar(require("./join.command"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./bash.command"), exports);
18
+ __exportStar(require("./clear-screen.command"), exports);
19
+ __exportStar(require("./cmd.command"), exports);
20
+ __exportStar(require("./help.command"), exports);
21
+ __exportStar(require("./login.command"), exports);
22
+ __exportStar(require("./logout.command"), exports);
23
+ __exportStar(require("./invite.command"), exports);
24
+ __exportStar(require("./join.command"), exports);
@@ -1,9 +1,9 @@
1
- import { HttpService } from "@nestjs/axios";
2
- import { CommandProcessParameters, WebConsoleService } from "../web.console.service";
3
- import { ConsoleCommand } from "./base/console.command";
4
- export declare class InviteCommand extends ConsoleCommand {
5
- readonly httpService: HttpService;
6
- readonly webConsoleService: WebConsoleService;
7
- constructor(httpService: HttpService, webConsoleService: WebConsoleService);
8
- process({ log, session, readLine, readArgs, parseArgs }: CommandProcessParameters): Promise<any>;
9
- }
1
+ import { CommandProcessParameters, WebConsoleService } from "../web.console.service";
2
+ import { ConsoleCommand } from "./base/console.command";
3
+ import { HttpService } from '@nestjs/axios';
4
+ export declare class InviteCommand extends ConsoleCommand {
5
+ readonly httpService: HttpService;
6
+ readonly webConsoleService: WebConsoleService;
7
+ constructor(httpService: HttpService, webConsoleService: WebConsoleService);
8
+ process({ log, session, readLine, readArgs, parseArgs }: CommandProcessParameters): Promise<any>;
9
+ }
@@ -1,76 +1,76 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.InviteCommand = void 0;
13
- const axios_1 = require("@nestjs/axios");
14
- const common_1 = require("@nestjs/common");
15
- const web_console_service_1 = require("../web.console.service");
16
- const console_command_1 = require("./base/console.command");
17
- let InviteCommand = class InviteCommand extends console_command_1.ConsoleCommand {
18
- constructor(httpService, webConsoleService) {
19
- super();
20
- Object.defineProperty(this, "httpService", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: httpService
25
- });
26
- Object.defineProperty(this, "webConsoleService", {
27
- enumerable: true,
28
- configurable: true,
29
- writable: true,
30
- value: webConsoleService
31
- });
32
- this.command = 'invite';
33
- this.description = 'Invite a remote console.';
34
- this.requiresAuth = false;
35
- }
36
- async process({ log, session, readLine, readArgs, parseArgs }) {
37
- const [urlOrAction, value] = await readArgs([{
38
- title: 'Url',
39
- }]);
40
- // if (urlOrAction && !urlOrAction.startsWith('http')){
41
- // switch (urlOrAction) {
42
- // case 'startup':
43
- // Async
44
- // break;
45
- // default:
46
- // log('invalid parameters');
47
- // }
48
- // }
49
- //waiting connection
50
- if (!urlOrAction)
51
- return log('Url is required');
52
- const defaultId = this.webConsoleService.makeId(8);
53
- const name = await readLine(`Your connection name [${defaultId}]:`) || defaultId;
54
- log('Waiting for remote end to join...');
55
- let url = urlOrAction;
56
- if (!url.endsWith('/'))
57
- url += '/';
58
- while (!session.cancel) {
59
- console.log('inviting pre result');
60
- const result = await this.httpService.get(url + 'invite?v=1&name=' + encodeURIComponent(name)).toPromise().then(x => x.data);
61
- console.log('inviting result', result);
62
- if (result.joined)
63
- break;
64
- await new Promise(r => setTimeout(r, 2000));
65
- }
66
- if (session.cancel)
67
- return;
68
- log('Remote end is now connected to this console.');
69
- }
70
- };
71
- InviteCommand = __decorate([
72
- (0, common_1.Injectable)(),
73
- __metadata("design:paramtypes", [axios_1.HttpService, web_console_service_1.WebConsoleService])
74
- ], InviteCommand);
75
- exports.InviteCommand = InviteCommand;
76
- const serviceName = process.env.SERVICE || 'home';
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.InviteCommand = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const web_console_service_1 = require("../web.console.service");
15
+ const console_command_1 = require("./base/console.command");
16
+ const axios_1 = require("@nestjs/axios");
17
+ let InviteCommand = class InviteCommand extends console_command_1.ConsoleCommand {
18
+ constructor(httpService, webConsoleService) {
19
+ super();
20
+ Object.defineProperty(this, "httpService", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: httpService
25
+ });
26
+ Object.defineProperty(this, "webConsoleService", {
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true,
30
+ value: webConsoleService
31
+ });
32
+ this.command = 'invite';
33
+ this.description = 'Invite a remote console.';
34
+ this.requiresAuth = false;
35
+ }
36
+ async process({ log, session, readLine, readArgs, parseArgs }) {
37
+ const [urlOrAction, value] = await readArgs([{
38
+ title: 'Url',
39
+ }]);
40
+ // if (urlOrAction && !urlOrAction.startsWith('http')){
41
+ // switch (urlOrAction) {
42
+ // case 'startup':
43
+ // Async
44
+ // break;
45
+ // default:
46
+ // log('invalid parameters');
47
+ // }
48
+ // }
49
+ //waiting connection
50
+ if (!urlOrAction)
51
+ return log('Url is required');
52
+ const defaultId = this.webConsoleService.makeId(8);
53
+ const name = await readLine(`Your connection name [${defaultId}]:`) || defaultId;
54
+ log('Waiting for remote end to join...');
55
+ let url = urlOrAction;
56
+ if (!url.endsWith('/'))
57
+ url += '/';
58
+ while (!session.cancel) {
59
+ console.log('inviting pre result');
60
+ const result = await this.httpService.get(url + 'invite?v=1&name=' + encodeURIComponent(name)).toPromise().then(x => x.data);
61
+ console.log('inviting result', result);
62
+ if (result.joined)
63
+ break;
64
+ await new Promise(r => setTimeout(r, 2000));
65
+ }
66
+ if (session.cancel)
67
+ return;
68
+ log('Remote end is now connected to this console.');
69
+ }
70
+ };
71
+ InviteCommand = __decorate([
72
+ (0, common_1.Injectable)(),
73
+ __metadata("design:paramtypes", [axios_1.HttpService, web_console_service_1.WebConsoleService])
74
+ ], InviteCommand);
75
+ exports.InviteCommand = InviteCommand;
76
+ const serviceName = process.env.SERVICE || 'home';
@@ -1,8 +1,8 @@
1
- import { RemoteConsoleService } from "../remote.console.service";
2
- import { CommandProcessParameters } from "../web.console.service";
3
- import { ConsoleCommand } from "./base/console.command";
4
- export declare class JoinCommand extends ConsoleCommand {
5
- readonly remoteConsoleService: RemoteConsoleService;
6
- constructor(remoteConsoleService: RemoteConsoleService);
7
- process({ log, readArgs, session, readLine }: CommandProcessParameters): Promise<any>;
8
- }
1
+ import { RemoteConsoleService } from "../remote.console.service";
2
+ import { CommandProcessParameters } from "../web.console.service";
3
+ import { ConsoleCommand } from "./base/console.command";
4
+ export declare class JoinCommand extends ConsoleCommand {
5
+ readonly remoteConsoleService: RemoteConsoleService;
6
+ constructor(remoteConsoleService: RemoteConsoleService);
7
+ process({ log, readArgs, session, readLine }: CommandProcessParameters): Promise<any>;
8
+ }