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
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 Murat
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Murat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,66 +1,66 @@
1
- # STILL IN DEVELOPMENT
2
-
3
- # Web Console for NestJS
4
- *Command from anywhere.*
5
-
6
- The goal is to create a simple web interface to run commands on the server.
7
-
8
- ## Installation
9
- ```sh
10
- npm install nestjs-web-console --save
11
- yarn add nestjs-web-console
12
- ```
13
-
14
- This library is a NestJs module with express dependency so make sure following libs are also installed.
15
- ```sh
16
- npm install @nestjs/common @nestjs/core express rxjs --save
17
- yarn add @nestjs/common @nestjs/core express rxjs
18
- ```
19
- ## Usage
20
- #### Simple usage
21
- ```javascript
22
- import {Module} from '@nestjs/common';
23
- import {WebConsoleModule} from "nestjs-web-console";
24
-
25
- @Module({
26
- imports: [WebConsoleModule.forRoot({
27
- endpoint: 'console',
28
- options: {
29
- name: 'My App',
30
- masterPin: 'very-secure-pin'
31
- }
32
- })]
33
- })
34
- export class AppModule {}
35
- ```
36
- #### Async usage
37
- ```javascript
38
- import {Module} from '@nestjs/common';
39
- import {WebConsoleModule} from "nestjs-web-console";
40
-
41
- @Module({
42
- imports: [WebConsoleModule.forRootAsync({
43
- endpoint: 'console',
44
- useFactory: (configService: ConfigService) => ({
45
- name: configService.get('SERVICE_NAME'),
46
- masterPin: configService.get('MASTER_PIN')
47
- }),
48
- inject: [ConfigService]
49
- })]
50
- })
51
- export class AppModule {}
52
- ```
53
-
54
- To use csv temp files run
55
- ```sh
56
- npm install csv-express --save
57
- ```
58
- and in main.ts file
59
- ```javascript
60
- import 'csv-express';
61
- ```
62
-
63
- ## Test
64
- ```sh
65
- npm run test
66
- ```
1
+ # STILL IN DEVELOPMENT
2
+
3
+ # Web Console for NestJS
4
+ *Command from anywhere.*
5
+
6
+ The goal is to create a simple web interface to run commands on the server.
7
+
8
+ ## Installation
9
+ ```sh
10
+ npm install nestjs-web-console --save
11
+ yarn add nestjs-web-console
12
+ ```
13
+
14
+ This library is a NestJs module with express dependency so make sure following libs are also installed.
15
+ ```sh
16
+ npm install @nestjs/common @nestjs/core express rxjs --save
17
+ yarn add @nestjs/common @nestjs/core express rxjs
18
+ ```
19
+ ## Usage
20
+ #### Simple usage
21
+ ```javascript
22
+ import {Module} from '@nestjs/common';
23
+ import {WebConsoleModule} from "nestjs-web-console";
24
+
25
+ @Module({
26
+ imports: [WebConsoleModule.forRoot({
27
+ endpoint: 'console',
28
+ options: {
29
+ name: 'My App',
30
+ masterPin: 'very-secure-pin'
31
+ }
32
+ })]
33
+ })
34
+ export class AppModule {}
35
+ ```
36
+ #### Async usage
37
+ ```javascript
38
+ import {Module} from '@nestjs/common';
39
+ import {WebConsoleModule} from "nestjs-web-console";
40
+
41
+ @Module({
42
+ imports: [WebConsoleModule.forRootAsync({
43
+ endpoint: 'console',
44
+ useFactory: (configService: ConfigService) => ({
45
+ name: configService.get('SERVICE_NAME'),
46
+ masterPin: configService.get('MASTER_PIN')
47
+ }),
48
+ inject: [ConfigService]
49
+ })]
50
+ })
51
+ export class AppModule {}
52
+ ```
53
+
54
+ To use csv temp files run
55
+ ```sh
56
+ npm install csv-express --save
57
+ ```
58
+ and in main.ts file
59
+ ```javascript
60
+ import 'csv-express';
61
+ ```
62
+
63
+ ## Test
64
+ ```sh
65
+ npm run test
66
+ ```
@@ -1,75 +1,75 @@
1
- import { Type } from "@nestjs/common";
2
- import { ConsoleCommand } from "./services/processors/base/console.command";
3
- export interface SessionObject {
4
- logs: string;
5
- isLogged: boolean;
6
- expires: number;
7
- running: boolean;
8
- readLineCallback?: (input: string) => any;
9
- readLineOpts?: ReadLineOptions;
10
- cancel?: boolean;
11
- onCancel?: () => any;
12
- onCancelSignal?: () => any;
13
- joinedConnection?: {
14
- name: string;
15
- version: string;
16
- path: string;
17
- result: string;
18
- running: boolean;
19
- readLine: boolean;
20
- readLineOpts: ReadLineOptions;
21
- onStream: () => any;
22
- command: string;
23
- };
24
- }
25
- export interface ReadLineOptions {
26
- secure?: boolean;
27
- select?: string[] | string[][];
28
- boolean?: boolean | {
29
- positive?: string;
30
- negative?: string;
31
- reverse?: boolean;
32
- };
33
- }
34
- export interface ReadArgMap {
35
- title: string;
36
- expect?: RegExp | 'email';
37
- expectDesc?: string;
38
- opts?: ReadLineOptions;
39
- then?: (input: any) => ReadArgMap[] | Promise<ReadArgMap[]>;
40
- default?: string;
41
- }
42
- export interface ReadArgOptions {
43
- confirm: boolean | {
44
- skipTable?: boolean;
45
- title?: string;
46
- };
47
- }
48
- export interface ConsoleOptions {
49
- name?: string;
50
- masterPin: string;
51
- guard?: GuardOptions;
52
- session?: SessionOptions;
53
- }
54
- export interface GuardOptions {
55
- enabled?: boolean;
56
- maxTries?: number;
57
- cooldown?: number;
58
- }
59
- export interface SessionOptions {
60
- timeout?: number;
61
- }
62
- export interface ConsoleModuleAsyncOptions {
63
- endpoint?: string;
64
- imports?: any;
65
- commands?: (Type<ConsoleCommand>)[];
66
- inject?: any;
67
- useFactory: (...args: any[]) => Promise<ConsoleOptions> | ConsoleOptions;
68
- }
69
- export interface ConsoleModuleOptions {
70
- endpoint?: string;
71
- imports?: any;
72
- commands?: (Type<ConsoleCommand>)[];
73
- options: ConsoleOptions;
74
- }
75
- export declare const DEFAULT_OPTIONS: ConsoleOptions;
1
+ import { Type } from "@nestjs/common";
2
+ import { ConsoleCommand } from "./services/processors/base/console.command";
3
+ export interface SessionObject {
4
+ logs: string;
5
+ isLogged: boolean;
6
+ expires: number;
7
+ running: boolean;
8
+ readLineCallback?: (input: string) => any;
9
+ readLineOpts?: ReadLineOptions;
10
+ cancel?: boolean;
11
+ onCancel?: () => any;
12
+ onCancelSignal?: () => any;
13
+ joinedConnection?: {
14
+ name: string;
15
+ version: string;
16
+ path: string;
17
+ result: string;
18
+ running: boolean;
19
+ readLine: boolean;
20
+ readLineOpts: ReadLineOptions;
21
+ onStream: () => any;
22
+ command: string;
23
+ };
24
+ }
25
+ export interface ReadLineOptions {
26
+ secure?: boolean;
27
+ select?: string[] | string[][];
28
+ boolean?: boolean | {
29
+ positive?: string;
30
+ negative?: string;
31
+ reverse?: boolean;
32
+ };
33
+ }
34
+ export interface ReadArgMap {
35
+ title: string;
36
+ expect?: RegExp | 'email';
37
+ expectDesc?: string;
38
+ opts?: ReadLineOptions;
39
+ then?: (input: any) => ReadArgMap[] | Promise<ReadArgMap[]>;
40
+ default?: string;
41
+ }
42
+ export interface ReadArgOptions {
43
+ confirm: boolean | {
44
+ skipTable?: boolean;
45
+ title?: string;
46
+ };
47
+ }
48
+ export interface ConsoleOptions {
49
+ name?: string;
50
+ masterPin: string;
51
+ guard?: GuardOptions;
52
+ session?: SessionOptions;
53
+ }
54
+ export interface GuardOptions {
55
+ enabled?: boolean;
56
+ maxTries?: number;
57
+ cooldown?: number;
58
+ }
59
+ export interface SessionOptions {
60
+ timeout?: number;
61
+ }
62
+ export interface ConsoleModuleAsyncOptions {
63
+ endpoint?: string;
64
+ imports?: any;
65
+ commands?: (Type<ConsoleCommand>)[];
66
+ inject?: any;
67
+ useFactory: (...args: any[]) => Promise<ConsoleOptions> | ConsoleOptions;
68
+ }
69
+ export interface ConsoleModuleOptions {
70
+ endpoint?: string;
71
+ imports?: any;
72
+ commands?: (Type<ConsoleCommand>)[];
73
+ options: ConsoleOptions;
74
+ }
75
+ export declare const DEFAULT_OPTIONS: ConsoleOptions;
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_OPTIONS = void 0;
4
- exports.DEFAULT_OPTIONS = {
5
- masterPin: 'must-set',
6
- name: 'NestJs App',
7
- guard: {
8
- enabled: true,
9
- cooldown: 60000 * 5,
10
- maxTries: 3
11
- },
12
- session: {
13
- timeout: 24 * 60 * 60000
14
- }
15
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_OPTIONS = void 0;
4
+ exports.DEFAULT_OPTIONS = {
5
+ masterPin: 'must-set',
6
+ name: 'NestJs App',
7
+ guard: {
8
+ enabled: true,
9
+ cooldown: 60000 * 5,
10
+ maxTries: 3
11
+ },
12
+ session: {
13
+ timeout: 24 * 60 * 60000
14
+ }
15
+ };
@@ -1 +1 @@
1
- export declare function WebConsoleControllerFactory(endpoint: any): any;
1
+ export declare function WebConsoleControllerFactory(endpoint: any): any;