@qodalis/cli-server-node 1.0.0-beta.1
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/LICENSE +21 -0
- package/README.md +146 -0
- package/dist/abstractions/cli-command-author.d.ts +11 -0
- package/dist/abstractions/cli-command-author.d.ts.map +1 -0
- package/dist/abstractions/cli-command-author.js +14 -0
- package/dist/abstractions/cli-command-author.js.map +1 -0
- package/dist/abstractions/cli-command-parameter-descriptor.d.ts +18 -0
- package/dist/abstractions/cli-command-parameter-descriptor.d.ts.map +1 -0
- package/dist/abstractions/cli-command-parameter-descriptor.js +21 -0
- package/dist/abstractions/cli-command-parameter-descriptor.js.map +1 -0
- package/dist/abstractions/cli-command-processor.d.ts +26 -0
- package/dist/abstractions/cli-command-processor.d.ts.map +1 -0
- package/dist/abstractions/cli-command-processor.js +14 -0
- package/dist/abstractions/cli-command-processor.js.map +1 -0
- package/dist/abstractions/cli-process-command.d.ts +9 -0
- package/dist/abstractions/cli-process-command.d.ts.map +1 -0
- package/dist/abstractions/cli-process-command.js +3 -0
- package/dist/abstractions/cli-process-command.js.map +1 -0
- package/dist/abstractions/index.d.ts +5 -0
- package/dist/abstractions/index.d.ts.map +1 -0
- package/dist/abstractions/index.js +11 -0
- package/dist/abstractions/index.js.map +1 -0
- package/dist/controllers/cli-controller.d.ts +4 -0
- package/dist/controllers/cli-controller.d.ts.map +1 -0
- package/dist/controllers/cli-controller.js +42 -0
- package/dist/controllers/cli-controller.js.map +1 -0
- package/dist/create-cli-server.d.ts +25 -0
- package/dist/create-cli-server.d.ts.map +1 -0
- package/dist/create-cli-server.js +35 -0
- package/dist/create-cli-server.js.map +1 -0
- package/dist/extensions/cli-builder.d.ts +9 -0
- package/dist/extensions/cli-builder.d.ts.map +1 -0
- package/dist/extensions/cli-builder.js +18 -0
- package/dist/extensions/cli-builder.js.map +1 -0
- package/dist/extensions/index.d.ts +2 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +6 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/models/cli-server-command-descriptor.d.ts +16 -0
- package/dist/models/cli-server-command-descriptor.d.ts.map +1 -0
- package/dist/models/cli-server-command-descriptor.js +3 -0
- package/dist/models/cli-server-command-descriptor.js.map +1 -0
- package/dist/models/cli-server-output.d.ts +23 -0
- package/dist/models/cli-server-output.d.ts.map +1 -0
- package/dist/models/cli-server-output.js +3 -0
- package/dist/models/cli-server-output.js.map +1 -0
- package/dist/models/cli-server-response.d.ts +6 -0
- package/dist/models/cli-server-response.d.ts.map +1 -0
- package/dist/models/cli-server-response.js +3 -0
- package/dist/models/cli-server-response.js.map +1 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +3 -0
- package/dist/models/index.js.map +1 -0
- package/dist/processors/cli-base64-command-processor.d.ts +11 -0
- package/dist/processors/cli-base64-command-processor.d.ts.map +1 -0
- package/dist/processors/cli-base64-command-processor.js +40 -0
- package/dist/processors/cli-base64-command-processor.js.map +1 -0
- package/dist/processors/cli-echo-command-processor.d.ts +8 -0
- package/dist/processors/cli-echo-command-processor.d.ts.map +1 -0
- package/dist/processors/cli-echo-command-processor.js +14 -0
- package/dist/processors/cli-echo-command-processor.js.map +1 -0
- package/dist/processors/cli-hash-command-processor.d.ts +10 -0
- package/dist/processors/cli-hash-command-processor.d.ts.map +1 -0
- package/dist/processors/cli-hash-command-processor.js +30 -0
- package/dist/processors/cli-hash-command-processor.js.map +1 -0
- package/dist/processors/cli-http-command-processor.d.ts +11 -0
- package/dist/processors/cli-http-command-processor.d.ts.map +1 -0
- package/dist/processors/cli-http-command-processor.js +79 -0
- package/dist/processors/cli-http-command-processor.js.map +1 -0
- package/dist/processors/cli-status-command-processor.d.ts +7 -0
- package/dist/processors/cli-status-command-processor.d.ts.map +1 -0
- package/dist/processors/cli-status-command-processor.js +18 -0
- package/dist/processors/cli-status-command-processor.js.map +1 -0
- package/dist/processors/cli-system-command-processor.d.ts +8 -0
- package/dist/processors/cli-system-command-processor.d.ts.map +1 -0
- package/dist/processors/cli-system-command-processor.js +33 -0
- package/dist/processors/cli-system-command-processor.js.map +1 -0
- package/dist/processors/cli-uuid-command-processor.d.ts +10 -0
- package/dist/processors/cli-uuid-command-processor.d.ts.map +1 -0
- package/dist/processors/cli-uuid-command-processor.js +27 -0
- package/dist/processors/cli-uuid-command-processor.js.map +1 -0
- package/dist/processors/index.d.ts +8 -0
- package/dist/processors/index.d.ts.map +1 -0
- package/dist/processors/index.js +18 -0
- package/dist/processors/index.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +43 -0
- package/dist/server.js.map +1 -0
- package/dist/services/cli-command-executor-service.d.ts +12 -0
- package/dist/services/cli-command-executor-service.d.ts.map +1 -0
- package/dist/services/cli-command-executor-service.js +45 -0
- package/dist/services/cli-command-executor-service.js.map +1 -0
- package/dist/services/cli-command-registry.d.ts +14 -0
- package/dist/services/cli-command-registry.d.ts.map +1 -0
- package/dist/services/cli-command-registry.js +32 -0
- package/dist/services/cli-command-registry.js.map +1 -0
- package/dist/services/cli-event-socket-manager.d.ts +15 -0
- package/dist/services/cli-event-socket-manager.d.ts.map +1 -0
- package/dist/services/cli-event-socket-manager.js +60 -0
- package/dist/services/cli-event-socket-manager.js.map +1 -0
- package/dist/services/cli-response-builder.d.ts +22 -0
- package/dist/services/cli-response-builder.d.ts.map +1 -0
- package/dist/services/cli-response-builder.js +36 -0
- package/dist/services/cli-response-builder.js.map +1 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +12 -0
- package/dist/services/index.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Qodalis Solutions
|
|
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
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Qodalis CLI Server (Node.js)
|
|
2
|
+
|
|
3
|
+
A Node.js CLI server framework for the [Qodalis CLI](https://github.com/qodalis-solutions/angular-web-cli) ecosystem. Built with Express.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @qodalis/cli-server-node
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### As a Library
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createCliServer, CliCommandProcessor, CliProcessCommand } from '@qodalis/cli-server-node';
|
|
17
|
+
|
|
18
|
+
class MyCommandProcessor extends CliCommandProcessor {
|
|
19
|
+
command = 'greet';
|
|
20
|
+
description = 'Says hello';
|
|
21
|
+
|
|
22
|
+
async handleAsync(command: CliProcessCommand): Promise<string> {
|
|
23
|
+
return 'Hello from my server!';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { app, eventSocketManager } = createCliServer({
|
|
28
|
+
configure: (builder) => {
|
|
29
|
+
builder.addProcessor(new MyCommandProcessor());
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const server = app.listen(8047, () => {
|
|
34
|
+
console.log('CLI server listening on http://localhost:8047');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
eventSocketManager.attach(server);
|
|
38
|
+
|
|
39
|
+
process.on('SIGINT', async () => {
|
|
40
|
+
await eventSocketManager.broadcastDisconnect();
|
|
41
|
+
server.close();
|
|
42
|
+
process.exit(0);
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### As a Standalone Server
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx qodalis-cli-server
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or with environment variables:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
PORT=9000 npx qodalis-cli-server
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## API Endpoints
|
|
59
|
+
|
|
60
|
+
| Method | Path | Description |
|
|
61
|
+
|--------|------|-------------|
|
|
62
|
+
| GET | `/api/cli/version` | Server version |
|
|
63
|
+
| GET | `/api/cli/commands` | List available commands |
|
|
64
|
+
| POST | `/api/cli/execute` | Execute a command |
|
|
65
|
+
| WS | `/ws/cli/events` | WebSocket event channel |
|
|
66
|
+
|
|
67
|
+
## Creating Command Processors
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import {
|
|
71
|
+
CliCommandProcessor,
|
|
72
|
+
CliCommandParameterDescriptor,
|
|
73
|
+
CliProcessCommand,
|
|
74
|
+
} from '@qodalis/cli-server-node';
|
|
75
|
+
|
|
76
|
+
class TimeCommandProcessor extends CliCommandProcessor {
|
|
77
|
+
command = 'time';
|
|
78
|
+
description = 'Shows the current server time';
|
|
79
|
+
|
|
80
|
+
parameters = [
|
|
81
|
+
new CliCommandParameterDescriptor('utc', 'Show time in UTC', false, 'boolean'),
|
|
82
|
+
new CliCommandParameterDescriptor('format', 'Date/time format string', false, 'string', ['-f'], 'yyyy-MM-dd HH:mm:ss'),
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
async handleAsync(command: CliProcessCommand): Promise<string> {
|
|
86
|
+
const useUtc = 'utc' in (command.args ?? {});
|
|
87
|
+
const now = new Date();
|
|
88
|
+
return useUtc ? `UTC: ${now.toISOString()}` : `Local: ${now.toLocaleString()}`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Sub-commands
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
class MathCommandProcessor extends CliCommandProcessor {
|
|
97
|
+
command = 'math';
|
|
98
|
+
description = 'Performs basic math operations';
|
|
99
|
+
allowUnlistedCommands = false;
|
|
100
|
+
|
|
101
|
+
processors = [
|
|
102
|
+
new MathAddProcessor(),
|
|
103
|
+
new MathMultiplyProcessor(),
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
async handleAsync(command: CliProcessCommand): Promise<string> {
|
|
107
|
+
return 'Usage: math add|multiply --a <number> --b <number>';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Docker
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
docker run -p 8047:8047 ghcr.io/qodalis-solutions/cli-server-node
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The Docker image runs a demo server with sample processors (echo, status, time, hello, math).
|
|
119
|
+
|
|
120
|
+
## Demo
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cd demo
|
|
124
|
+
npm install
|
|
125
|
+
npm start
|
|
126
|
+
# Server starts on http://localhost:8047
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Project Structure
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
src/
|
|
133
|
+
abstractions/ # ICliCommandProcessor, CliProcessCommand, parameter descriptors
|
|
134
|
+
models/ # CliServerOutput, CliServerResponse, command descriptors
|
|
135
|
+
services/ # Registry, executor, response builder, WebSocket manager
|
|
136
|
+
controllers/ # Express router for /api/cli routes
|
|
137
|
+
extensions/ # CliBuilder fluent API
|
|
138
|
+
processors/ # Built-in echo and status processors
|
|
139
|
+
create-cli-server.ts # Factory function for standalone/library use
|
|
140
|
+
server.ts # Standalone entry point
|
|
141
|
+
demo/ # Demo app with 5 sample processors
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
MIT
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ICliCommandAuthor {
|
|
2
|
+
name: string;
|
|
3
|
+
email: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class CliCommandAuthor implements ICliCommandAuthor {
|
|
6
|
+
name: string;
|
|
7
|
+
email: string;
|
|
8
|
+
constructor(name: string, email: string);
|
|
9
|
+
}
|
|
10
|
+
export declare const DefaultLibraryAuthor: ICliCommandAuthor;
|
|
11
|
+
//# sourceMappingURL=cli-command-author.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-command-author.d.ts","sourceRoot":"","sources":["../../src/abstractions/cli-command-author.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,gBAAiB,YAAW,iBAAiB;IAE3C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,MAAM;gBADb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM;CAE3B;AAED,eAAO,MAAM,oBAAoB,EAAE,iBAGlC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultLibraryAuthor = exports.CliCommandAuthor = void 0;
|
|
4
|
+
class CliCommandAuthor {
|
|
5
|
+
name;
|
|
6
|
+
email;
|
|
7
|
+
constructor(name, email) {
|
|
8
|
+
this.name = name;
|
|
9
|
+
this.email = email;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CliCommandAuthor = CliCommandAuthor;
|
|
13
|
+
exports.DefaultLibraryAuthor = new CliCommandAuthor('Nicolae Lupei', 'nicolae.lupei@qodalis.com');
|
|
14
|
+
//# sourceMappingURL=cli-command-author.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-command-author.js","sourceRoot":"","sources":["../../src/abstractions/cli-command-author.ts"],"names":[],"mappings":";;;AAKA,MAAa,gBAAgB;IAEd;IACA;IAFX,YACW,IAAY,EACZ,KAAa;QADb,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAQ;IACrB,CAAC;CACP;AALD,4CAKC;AAEY,QAAA,oBAAoB,GAAsB,IAAI,gBAAgB,CACvE,eAAe,EACf,2BAA2B,CAC9B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ICliCommandParameterDescriptor {
|
|
2
|
+
name: string;
|
|
3
|
+
aliases?: string[];
|
|
4
|
+
description: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
type: string;
|
|
7
|
+
defaultValue?: any;
|
|
8
|
+
}
|
|
9
|
+
export declare class CliCommandParameterDescriptor implements ICliCommandParameterDescriptor {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
type: string;
|
|
14
|
+
aliases?: string[] | undefined;
|
|
15
|
+
defaultValue?: any | undefined;
|
|
16
|
+
constructor(name: string, description: string, required?: boolean, type?: string, aliases?: string[] | undefined, defaultValue?: any | undefined);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=cli-command-parameter-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-command-parameter-descriptor.d.ts","sourceRoot":"","sources":["../../src/abstractions/cli-command-parameter-descriptor.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,8BAA8B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,GAAG,CAAC;CACtB;AAED,qBAAa,6BAA8B,YAAW,8BAA8B;IAErE,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,MAAM;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE;IAClB,YAAY,CAAC,EAAE,GAAG;gBALlB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,QAAQ,GAAE,OAAe,EACzB,IAAI,GAAE,MAAiB,EACvB,OAAO,CAAC,EAAE,MAAM,EAAE,YAAA,EAClB,YAAY,CAAC,EAAE,GAAG,YAAA;CAEhC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CliCommandParameterDescriptor = void 0;
|
|
4
|
+
class CliCommandParameterDescriptor {
|
|
5
|
+
name;
|
|
6
|
+
description;
|
|
7
|
+
required;
|
|
8
|
+
type;
|
|
9
|
+
aliases;
|
|
10
|
+
defaultValue;
|
|
11
|
+
constructor(name, description, required = false, type = 'string', aliases, defaultValue) {
|
|
12
|
+
this.name = name;
|
|
13
|
+
this.description = description;
|
|
14
|
+
this.required = required;
|
|
15
|
+
this.type = type;
|
|
16
|
+
this.aliases = aliases;
|
|
17
|
+
this.defaultValue = defaultValue;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.CliCommandParameterDescriptor = CliCommandParameterDescriptor;
|
|
21
|
+
//# sourceMappingURL=cli-command-parameter-descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-command-parameter-descriptor.js","sourceRoot":"","sources":["../../src/abstractions/cli-command-parameter-descriptor.ts"],"names":[],"mappings":";;;AASA,MAAa,6BAA6B;IAE3B;IACA;IACA;IACA;IACA;IACA;IANX,YACW,IAAY,EACZ,WAAmB,EACnB,WAAoB,KAAK,EACzB,OAAe,QAAQ,EACvB,OAAkB,EAClB,YAAkB;QALlB,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,aAAQ,GAAR,QAAQ,CAAiB;QACzB,SAAI,GAAJ,IAAI,CAAmB;QACvB,YAAO,GAAP,OAAO,CAAW;QAClB,iBAAY,GAAZ,YAAY,CAAM;IAC1B,CAAC;CACP;AATD,sEASC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ICliCommandAuthor } from './cli-command-author';
|
|
2
|
+
import { ICliCommandParameterDescriptor } from './cli-command-parameter-descriptor';
|
|
3
|
+
import { CliProcessCommand } from './cli-process-command';
|
|
4
|
+
export interface ICliCommandProcessor {
|
|
5
|
+
command: string;
|
|
6
|
+
description: string;
|
|
7
|
+
author: ICliCommandAuthor;
|
|
8
|
+
allowUnlistedCommands?: boolean;
|
|
9
|
+
valueRequired?: boolean;
|
|
10
|
+
version: string;
|
|
11
|
+
processors?: ICliCommandProcessor[];
|
|
12
|
+
parameters?: ICliCommandParameterDescriptor[];
|
|
13
|
+
handleAsync(command: CliProcessCommand): Promise<string>;
|
|
14
|
+
}
|
|
15
|
+
export declare abstract class CliCommandProcessor implements ICliCommandProcessor {
|
|
16
|
+
abstract command: string;
|
|
17
|
+
abstract description: string;
|
|
18
|
+
author: ICliCommandAuthor;
|
|
19
|
+
allowUnlistedCommands?: boolean;
|
|
20
|
+
valueRequired?: boolean;
|
|
21
|
+
version: string;
|
|
22
|
+
processors?: ICliCommandProcessor[];
|
|
23
|
+
parameters?: ICliCommandParameterDescriptor[];
|
|
24
|
+
abstract handleAsync(command: CliProcessCommand): Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=cli-command-processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-command-processor.d.ts","sourceRoot":"","sources":["../../src/abstractions/cli-command-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAwB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACpC,UAAU,CAAC,EAAE,8BAA8B,EAAE,CAAC;IAC9C,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5D;AAED,8BAAsB,mBAAoB,YAAW,oBAAoB;IACrE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,MAAM,EAAE,iBAAiB,CAAwB;IACjD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAW;IAC1B,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACpC,UAAU,CAAC,EAAE,8BAA8B,EAAE,CAAC;IAE9C,QAAQ,CAAC,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;CACpE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CliCommandProcessor = void 0;
|
|
4
|
+
const cli_command_author_1 = require("./cli-command-author");
|
|
5
|
+
class CliCommandProcessor {
|
|
6
|
+
author = cli_command_author_1.DefaultLibraryAuthor;
|
|
7
|
+
allowUnlistedCommands;
|
|
8
|
+
valueRequired;
|
|
9
|
+
version = '1.0.0';
|
|
10
|
+
processors;
|
|
11
|
+
parameters;
|
|
12
|
+
}
|
|
13
|
+
exports.CliCommandProcessor = CliCommandProcessor;
|
|
14
|
+
//# sourceMappingURL=cli-command-processor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-command-processor.js","sourceRoot":"","sources":["../../src/abstractions/cli-command-processor.ts"],"names":[],"mappings":";;;AAAA,6DAA+E;AAgB/E,MAAsB,mBAAmB;IAGrC,MAAM,GAAsB,yCAAoB,CAAC;IACjD,qBAAqB,CAAW;IAChC,aAAa,CAAW;IACxB,OAAO,GAAW,OAAO,CAAC;IAC1B,UAAU,CAA0B;IACpC,UAAU,CAAoC;CAGjD;AAXD,kDAWC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-process-command.d.ts","sourceRoot":"","sources":["../../src/abstractions/cli-process-command.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-process-command.js","sourceRoot":"","sources":["../../src/abstractions/cli-process-command.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ICliCommandAuthor, CliCommandAuthor, DefaultLibraryAuthor } from './cli-command-author';
|
|
2
|
+
export { CliProcessCommand } from './cli-process-command';
|
|
3
|
+
export { ICliCommandParameterDescriptor, CliCommandParameterDescriptor } from './cli-command-parameter-descriptor';
|
|
4
|
+
export { ICliCommandProcessor, CliCommandProcessor } from './cli-command-processor';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/abstractions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnH,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CliCommandProcessor = exports.CliCommandParameterDescriptor = exports.DefaultLibraryAuthor = exports.CliCommandAuthor = void 0;
|
|
4
|
+
var cli_command_author_1 = require("./cli-command-author");
|
|
5
|
+
Object.defineProperty(exports, "CliCommandAuthor", { enumerable: true, get: function () { return cli_command_author_1.CliCommandAuthor; } });
|
|
6
|
+
Object.defineProperty(exports, "DefaultLibraryAuthor", { enumerable: true, get: function () { return cli_command_author_1.DefaultLibraryAuthor; } });
|
|
7
|
+
var cli_command_parameter_descriptor_1 = require("./cli-command-parameter-descriptor");
|
|
8
|
+
Object.defineProperty(exports, "CliCommandParameterDescriptor", { enumerable: true, get: function () { return cli_command_parameter_descriptor_1.CliCommandParameterDescriptor; } });
|
|
9
|
+
var cli_command_processor_1 = require("./cli-command-processor");
|
|
10
|
+
Object.defineProperty(exports, "CliCommandProcessor", { enumerable: true, get: function () { return cli_command_processor_1.CliCommandProcessor; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/abstractions/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiG;AAArE,sHAAA,gBAAgB,OAAA;AAAE,0HAAA,oBAAoB,OAAA;AAElE,uFAAmH;AAA1E,iJAAA,6BAA6B,OAAA;AACtE,iEAAoF;AAArD,4HAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { ICliCommandRegistry, ICliCommandExecutorService } from '../services';
|
|
3
|
+
export declare function createCliController(registry: ICliCommandRegistry, executor: ICliCommandExecutorService): Router;
|
|
4
|
+
//# sourceMappingURL=cli-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-controller.d.ts","sourceRoot":"","sources":["../../src/controllers/cli-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE9E,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,mBAAmB,EAC7B,QAAQ,EAAE,0BAA0B,GACrC,MAAM,CAmBR"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCliController = createCliController;
|
|
4
|
+
const express_1 = require("express");
|
|
5
|
+
function createCliController(registry, executor) {
|
|
6
|
+
const router = (0, express_1.Router)();
|
|
7
|
+
router.get('/version', (_req, res) => {
|
|
8
|
+
res.json({ version: '1.0.0' });
|
|
9
|
+
});
|
|
10
|
+
router.get('/commands', (_req, res) => {
|
|
11
|
+
const descriptors = registry.processors.map(mapToDescriptor);
|
|
12
|
+
res.json(descriptors);
|
|
13
|
+
});
|
|
14
|
+
router.post('/execute', async (req, res) => {
|
|
15
|
+
const command = req.body;
|
|
16
|
+
const response = await executor.executeAsync(command);
|
|
17
|
+
res.json(response);
|
|
18
|
+
});
|
|
19
|
+
return router;
|
|
20
|
+
}
|
|
21
|
+
function mapToDescriptor(processor) {
|
|
22
|
+
const descriptor = {
|
|
23
|
+
command: processor.command,
|
|
24
|
+
description: processor.description,
|
|
25
|
+
version: processor.version,
|
|
26
|
+
};
|
|
27
|
+
if (processor.parameters?.length) {
|
|
28
|
+
descriptor.parameters = processor.parameters.map((p) => ({
|
|
29
|
+
name: p.name,
|
|
30
|
+
aliases: p.aliases,
|
|
31
|
+
description: p.description,
|
|
32
|
+
required: p.required,
|
|
33
|
+
type: p.type,
|
|
34
|
+
defaultValue: p.defaultValue,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
if (processor.processors?.length) {
|
|
38
|
+
descriptor.processors = processor.processors.map(mapToDescriptor);
|
|
39
|
+
}
|
|
40
|
+
return descriptor;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=cli-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-controller.js","sourceRoot":"","sources":["../../src/controllers/cli-controller.ts"],"names":[],"mappings":";;AAKA,kDAsBC;AA3BD,qCAAiC;AAKjC,SAAgB,mBAAmB,CAC/B,QAA6B,EAC7B,QAAoC;IAEpC,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IAExB,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QACjC,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAClC,MAAM,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAC7D,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QACvC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC;QACzB,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,SAA+B;IACpD,MAAM,UAAU,GAA+B;QAC3C,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,OAAO,EAAE,SAAS,CAAC,OAAO;KAC7B,CAAC;IAEF,IAAI,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;QAC/B,UAAU,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAC5C,CAAC,CAAC,EAA0C,EAAE,CAAC,CAAC;YAC5C,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,YAAY,EAAE,CAAC,CAAC,YAAY;SAC/B,CAAC,CACL,CAAC;IACN,CAAC;IAED,IAAI,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;QAC/B,UAAU,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Express } from 'express';
|
|
2
|
+
import cors from 'cors';
|
|
3
|
+
import { CliCommandRegistry, CliEventSocketManager } from './services';
|
|
4
|
+
import { CliBuilder } from './extensions';
|
|
5
|
+
export interface CliServerOptions {
|
|
6
|
+
/** Base path for CLI routes. Defaults to '/api/cli'. */
|
|
7
|
+
basePath?: string;
|
|
8
|
+
/** CORS configuration. Pass `true` for permissive, `false` to disable, or a cors options object. */
|
|
9
|
+
cors?: boolean | cors.CorsOptions;
|
|
10
|
+
/** Configure processors via the builder. */
|
|
11
|
+
configure?: (builder: CliBuilder) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates a fully configured Express app with CLI routes mounted.
|
|
15
|
+
*
|
|
16
|
+
* Use this for standalone server mode. For integration into an existing
|
|
17
|
+
* Express app, use `createCliController` directly instead.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createCliServer(options?: CliServerOptions): {
|
|
20
|
+
app: Express;
|
|
21
|
+
registry: CliCommandRegistry;
|
|
22
|
+
builder: CliBuilder;
|
|
23
|
+
eventSocketManager: CliEventSocketManager;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=create-cli-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-cli-server.d.ts","sourceRoot":"","sources":["../src/create-cli-server.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAA6B,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,WAAW,gBAAgB;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC;IAClC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,CAAC;CAC7C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG;IAC7D,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC;IACpB,kBAAkB,EAAE,qBAAqB,CAAC;CAC7C,CAwBA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createCliServer = createCliServer;
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
8
|
+
const cors_1 = __importDefault(require("cors"));
|
|
9
|
+
const services_1 = require("./services");
|
|
10
|
+
const extensions_1 = require("./extensions");
|
|
11
|
+
const cli_controller_1 = require("./controllers/cli-controller");
|
|
12
|
+
/**
|
|
13
|
+
* Creates a fully configured Express app with CLI routes mounted.
|
|
14
|
+
*
|
|
15
|
+
* Use this for standalone server mode. For integration into an existing
|
|
16
|
+
* Express app, use `createCliController` directly instead.
|
|
17
|
+
*/
|
|
18
|
+
function createCliServer(options = {}) {
|
|
19
|
+
const { basePath = '/api/cli', cors: corsOption = true, configure } = options;
|
|
20
|
+
const app = (0, express_1.default)();
|
|
21
|
+
if (corsOption !== false) {
|
|
22
|
+
app.use((0, cors_1.default)(corsOption === true ? undefined : corsOption));
|
|
23
|
+
}
|
|
24
|
+
app.use(express_1.default.json());
|
|
25
|
+
const registry = new services_1.CliCommandRegistry();
|
|
26
|
+
const builder = new extensions_1.CliBuilder(registry);
|
|
27
|
+
if (configure) {
|
|
28
|
+
configure(builder);
|
|
29
|
+
}
|
|
30
|
+
const executor = new services_1.CliCommandExecutorService(registry);
|
|
31
|
+
app.use(basePath, (0, cli_controller_1.createCliController)(registry, executor));
|
|
32
|
+
const eventSocketManager = new services_1.CliEventSocketManager();
|
|
33
|
+
return { app, registry, builder, eventSocketManager };
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=create-cli-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-cli-server.js","sourceRoot":"","sources":["../src/create-cli-server.ts"],"names":[],"mappings":";;;;;AAqBA,0CA6BC;AAlDD,sDAA2C;AAC3C,gDAAwB;AACxB,yCAAkG;AAClG,6CAA0C;AAC1C,iEAAmE;AAWnE;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,UAA4B,EAAE;IAM1D,MAAM,EAAE,QAAQ,GAAG,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAE9E,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;IAEtB,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;QACvB,GAAG,CAAC,GAAG,CAAC,IAAA,cAAI,EAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAExB,MAAM,QAAQ,GAAG,IAAI,6BAAkB,EAAE,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,uBAAU,CAAC,QAAQ,CAAC,CAAC;IAEzC,IAAI,SAAS,EAAE,CAAC;QACZ,SAAS,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,oCAAyB,CAAC,QAAQ,CAAC,CAAC;IACzD,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAA,oCAAmB,EAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE3D,MAAM,kBAAkB,GAAG,IAAI,gCAAqB,EAAE,CAAC;IAEvD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICliCommandProcessor } from '../abstractions';
|
|
2
|
+
import { CliCommandRegistry } from '../services';
|
|
3
|
+
export declare class CliBuilder {
|
|
4
|
+
private readonly _registry;
|
|
5
|
+
constructor(registry: CliCommandRegistry);
|
|
6
|
+
addProcessor(processor: ICliCommandProcessor): CliBuilder;
|
|
7
|
+
get registry(): CliCommandRegistry;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=cli-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-builder.d.ts","sourceRoot":"","sources":["../../src/extensions/cli-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;gBAEnC,QAAQ,EAAE,kBAAkB;IAIxC,YAAY,CAAC,SAAS,EAAE,oBAAoB,GAAG,UAAU;IAKzD,IAAI,QAAQ,IAAI,kBAAkB,CAEjC;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CliBuilder = void 0;
|
|
4
|
+
class CliBuilder {
|
|
5
|
+
_registry;
|
|
6
|
+
constructor(registry) {
|
|
7
|
+
this._registry = registry;
|
|
8
|
+
}
|
|
9
|
+
addProcessor(processor) {
|
|
10
|
+
this._registry.register(processor);
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
get registry() {
|
|
14
|
+
return this._registry;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.CliBuilder = CliBuilder;
|
|
18
|
+
//# sourceMappingURL=cli-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-builder.js","sourceRoot":"","sources":["../../src/extensions/cli-builder.ts"],"names":[],"mappings":";;;AAGA,MAAa,UAAU;IACF,SAAS,CAAqB;IAE/C,YAAY,QAA4B;QACpC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED,YAAY,CAAC,SAA+B;QACxC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;CACJ;AAfD,gCAeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CliBuilder = void 0;
|
|
4
|
+
var cli_builder_1 = require("./cli-builder");
|
|
5
|
+
Object.defineProperty(exports, "CliBuilder", { enumerable: true, get: function () { return cli_builder_1.CliBuilder; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { ICliCommandAuthor, CliCommandAuthor, DefaultLibraryAuthor, CliProcessCommand, ICliCommandParameterDescriptor, CliCommandParameterDescriptor, ICliCommandProcessor, CliCommandProcessor, } from './abstractions';
|
|
2
|
+
export { CliServerOutput, CliServerResponse, CliServerCommandDescriptor, CliServerCommandParameterDescriptorDto, } from './models';
|
|
3
|
+
export { ICliCommandRegistry, CliCommandRegistry, ICliResponseBuilder, CliResponseBuilder, ICliCommandExecutorService, CliCommandExecutorService, CliEventSocketManager, } from './services';
|
|
4
|
+
export { createCliController } from './controllers/cli-controller';
|
|
5
|
+
export { CliBuilder } from './extensions';
|
|
6
|
+
export { CliEchoCommandProcessor } from './processors/cli-echo-command-processor';
|
|
7
|
+
export { CliStatusCommandProcessor } from './processors/cli-status-command-processor';
|
|
8
|
+
export { CliSystemCommandProcessor } from './processors/cli-system-command-processor';
|
|
9
|
+
export { CliHttpCommandProcessor } from './processors/cli-http-command-processor';
|
|
10
|
+
export { CliHashCommandProcessor } from './processors/cli-hash-command-processor';
|
|
11
|
+
export { CliBase64CommandProcessor } from './processors/cli-base64-command-processor';
|
|
12
|
+
export { CliUuidCommandProcessor } from './processors/cli-uuid-command-processor';
|
|
13
|
+
export { createCliServer, CliServerOptions } from './create-cli-server';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,8BAA8B,EAC9B,6BAA6B,EAC7B,oBAAoB,EACpB,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACH,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC1B,sCAAsC,GACzC,MAAM,UAAU,CAAC;AAGlB,OAAO,EACH,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,GACxB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAGlF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCliServer = exports.CliUuidCommandProcessor = exports.CliBase64CommandProcessor = exports.CliHashCommandProcessor = exports.CliHttpCommandProcessor = exports.CliSystemCommandProcessor = exports.CliStatusCommandProcessor = exports.CliEchoCommandProcessor = exports.CliBuilder = exports.createCliController = exports.CliEventSocketManager = exports.CliCommandExecutorService = exports.CliResponseBuilder = exports.CliCommandRegistry = exports.CliCommandProcessor = exports.CliCommandParameterDescriptor = exports.DefaultLibraryAuthor = exports.CliCommandAuthor = void 0;
|
|
4
|
+
// Abstractions
|
|
5
|
+
var abstractions_1 = require("./abstractions");
|
|
6
|
+
Object.defineProperty(exports, "CliCommandAuthor", { enumerable: true, get: function () { return abstractions_1.CliCommandAuthor; } });
|
|
7
|
+
Object.defineProperty(exports, "DefaultLibraryAuthor", { enumerable: true, get: function () { return abstractions_1.DefaultLibraryAuthor; } });
|
|
8
|
+
Object.defineProperty(exports, "CliCommandParameterDescriptor", { enumerable: true, get: function () { return abstractions_1.CliCommandParameterDescriptor; } });
|
|
9
|
+
Object.defineProperty(exports, "CliCommandProcessor", { enumerable: true, get: function () { return abstractions_1.CliCommandProcessor; } });
|
|
10
|
+
// Services
|
|
11
|
+
var services_1 = require("./services");
|
|
12
|
+
Object.defineProperty(exports, "CliCommandRegistry", { enumerable: true, get: function () { return services_1.CliCommandRegistry; } });
|
|
13
|
+
Object.defineProperty(exports, "CliResponseBuilder", { enumerable: true, get: function () { return services_1.CliResponseBuilder; } });
|
|
14
|
+
Object.defineProperty(exports, "CliCommandExecutorService", { enumerable: true, get: function () { return services_1.CliCommandExecutorService; } });
|
|
15
|
+
Object.defineProperty(exports, "CliEventSocketManager", { enumerable: true, get: function () { return services_1.CliEventSocketManager; } });
|
|
16
|
+
// Controller
|
|
17
|
+
var cli_controller_1 = require("./controllers/cli-controller");
|
|
18
|
+
Object.defineProperty(exports, "createCliController", { enumerable: true, get: function () { return cli_controller_1.createCliController; } });
|
|
19
|
+
// Extensions
|
|
20
|
+
var extensions_1 = require("./extensions");
|
|
21
|
+
Object.defineProperty(exports, "CliBuilder", { enumerable: true, get: function () { return extensions_1.CliBuilder; } });
|
|
22
|
+
// Processors
|
|
23
|
+
var cli_echo_command_processor_1 = require("./processors/cli-echo-command-processor");
|
|
24
|
+
Object.defineProperty(exports, "CliEchoCommandProcessor", { enumerable: true, get: function () { return cli_echo_command_processor_1.CliEchoCommandProcessor; } });
|
|
25
|
+
var cli_status_command_processor_1 = require("./processors/cli-status-command-processor");
|
|
26
|
+
Object.defineProperty(exports, "CliStatusCommandProcessor", { enumerable: true, get: function () { return cli_status_command_processor_1.CliStatusCommandProcessor; } });
|
|
27
|
+
var cli_system_command_processor_1 = require("./processors/cli-system-command-processor");
|
|
28
|
+
Object.defineProperty(exports, "CliSystemCommandProcessor", { enumerable: true, get: function () { return cli_system_command_processor_1.CliSystemCommandProcessor; } });
|
|
29
|
+
var cli_http_command_processor_1 = require("./processors/cli-http-command-processor");
|
|
30
|
+
Object.defineProperty(exports, "CliHttpCommandProcessor", { enumerable: true, get: function () { return cli_http_command_processor_1.CliHttpCommandProcessor; } });
|
|
31
|
+
var cli_hash_command_processor_1 = require("./processors/cli-hash-command-processor");
|
|
32
|
+
Object.defineProperty(exports, "CliHashCommandProcessor", { enumerable: true, get: function () { return cli_hash_command_processor_1.CliHashCommandProcessor; } });
|
|
33
|
+
var cli_base64_command_processor_1 = require("./processors/cli-base64-command-processor");
|
|
34
|
+
Object.defineProperty(exports, "CliBase64CommandProcessor", { enumerable: true, get: function () { return cli_base64_command_processor_1.CliBase64CommandProcessor; } });
|
|
35
|
+
var cli_uuid_command_processor_1 = require("./processors/cli-uuid-command-processor");
|
|
36
|
+
Object.defineProperty(exports, "CliUuidCommandProcessor", { enumerable: true, get: function () { return cli_uuid_command_processor_1.CliUuidCommandProcessor; } });
|
|
37
|
+
// Server factory
|
|
38
|
+
var create_cli_server_1 = require("./create-cli-server");
|
|
39
|
+
Object.defineProperty(exports, "createCliServer", { enumerable: true, get: function () { return create_cli_server_1.createCliServer; } });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,eAAe;AACf,+CASwB;AAPpB,gHAAA,gBAAgB,OAAA;AAChB,oHAAA,oBAAoB,OAAA;AAGpB,6HAAA,6BAA6B,OAAA;AAE7B,mHAAA,mBAAmB,OAAA;AAWvB,WAAW;AACX,uCAQoB;AANhB,8GAAA,kBAAkB,OAAA;AAElB,8GAAA,kBAAkB,OAAA;AAElB,qHAAA,yBAAyB,OAAA;AACzB,iHAAA,qBAAqB,OAAA;AAGzB,aAAa;AACb,+DAAmE;AAA1D,qHAAA,mBAAmB,OAAA;AAE5B,aAAa;AACb,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAEnB,aAAa;AACb,sFAAkF;AAAzE,qIAAA,uBAAuB,OAAA;AAChC,0FAAsF;AAA7E,yIAAA,yBAAyB,OAAA;AAClC,0FAAsF;AAA7E,yIAAA,yBAAyB,OAAA;AAClC,sFAAkF;AAAzE,qIAAA,uBAAuB,OAAA;AAChC,sFAAkF;AAAzE,qIAAA,uBAAuB,OAAA;AAChC,0FAAsF;AAA7E,yIAAA,yBAAyB,OAAA;AAClC,sFAAkF;AAAzE,qIAAA,uBAAuB,OAAA;AAEhC,iBAAiB;AACjB,yDAAwE;AAA/D,oHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface CliServerCommandParameterDescriptorDto {
|
|
2
|
+
name: string;
|
|
3
|
+
aliases?: string[];
|
|
4
|
+
description: string;
|
|
5
|
+
required: boolean;
|
|
6
|
+
type: string;
|
|
7
|
+
defaultValue?: any;
|
|
8
|
+
}
|
|
9
|
+
export interface CliServerCommandDescriptor {
|
|
10
|
+
command: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
version?: string;
|
|
13
|
+
parameters?: CliServerCommandParameterDescriptorDto[];
|
|
14
|
+
processors?: CliServerCommandDescriptor[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=cli-server-command-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-server-command-descriptor.d.ts","sourceRoot":"","sources":["../../src/models/cli-server-command-descriptor.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sCAAsC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,GAAG,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,sCAAsC,EAAE,CAAC;IACtD,UAAU,CAAC,EAAE,0BAA0B,EAAE,CAAC;CAC7C"}
|