@qodalis/cli-server-plugin-admin 1.0.0-beta.1 → 1.0.0-beta.6

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 (52) hide show
  1. package/README.md +110 -0
  2. package/dashboard/assets/index-B5szolha.js +200 -0
  3. package/dashboard/assets/index-Co1BkfeM.css +32 -0
  4. package/dashboard/assets/wasm/qodalis_cli_wasm_bg.wasm +0 -0
  5. package/dashboard/index.html +14 -0
  6. package/dist/auth/auth-controller.d.ts +5 -1
  7. package/dist/auth/auth-controller.d.ts.map +1 -1
  8. package/dist/auth/auth-controller.js +35 -5
  9. package/dist/auth/auth-controller.js.map +1 -1
  10. package/dist/auth/auth-middleware.d.ts +2 -1
  11. package/dist/auth/auth-middleware.d.ts.map +1 -1
  12. package/dist/auth/auth-middleware.js +35 -1
  13. package/dist/auth/auth-middleware.js.map +1 -1
  14. package/dist/auth/auth-provider.d.ts +33 -0
  15. package/dist/auth/auth-provider.d.ts.map +1 -0
  16. package/dist/auth/auth-provider.js +16 -0
  17. package/dist/auth/auth-provider.js.map +1 -0
  18. package/dist/auth/jwt-service.d.ts +12 -2
  19. package/dist/auth/jwt-service.d.ts.map +1 -1
  20. package/dist/auth/jwt-service.js +11 -2
  21. package/dist/auth/jwt-service.js.map +1 -1
  22. package/dist/cli-admin-builder.d.ts +24 -2
  23. package/dist/cli-admin-builder.d.ts.map +1 -1
  24. package/dist/cli-admin-builder.js +41 -12
  25. package/dist/cli-admin-builder.js.map +1 -1
  26. package/dist/controllers/plugins-controller.d.ts.map +1 -1
  27. package/dist/controllers/plugins-controller.js +1 -2
  28. package/dist/controllers/plugins-controller.js.map +1 -1
  29. package/dist/controllers/status-controller.d.ts +1 -0
  30. package/dist/controllers/status-controller.d.ts.map +1 -1
  31. package/dist/controllers/status-controller.js.map +1 -1
  32. package/dist/controllers/ws-clients-controller.d.ts +1 -0
  33. package/dist/controllers/ws-clients-controller.d.ts.map +1 -1
  34. package/dist/controllers/ws-clients-controller.js.map +1 -1
  35. package/dist/index.d.ts +2 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +3 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/services/admin-config.d.ts +15 -3
  40. package/dist/services/admin-config.d.ts.map +1 -1
  41. package/dist/services/admin-config.js +15 -3
  42. package/dist/services/admin-config.js.map +1 -1
  43. package/dist/services/log-ring-buffer.d.ts +4 -0
  44. package/dist/services/log-ring-buffer.d.ts.map +1 -1
  45. package/dist/services/log-ring-buffer.js +1 -0
  46. package/dist/services/log-ring-buffer.js.map +1 -1
  47. package/dist/services/module-registry.d.ts +12 -7
  48. package/dist/services/module-registry.d.ts.map +1 -1
  49. package/dist/services/module-registry.js +22 -10
  50. package/dist/services/module-registry.js.map +1 -1
  51. package/dist/tsconfig.tsbuildinfo +1 -1
  52. package/package.json +2 -1
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # @qodalis/cli-server-plugin-admin
2
+
3
+ Admin dashboard plugin for [Qodalis CLI Server (Node.js)](https://github.com/qodalis-solutions/cli-server-node). Provides JWT authentication, server status, plugin management, configuration, log viewing, and WebSocket client monitoring via a REST API and bundled SPA dashboard.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @qodalis/cli-server-plugin-admin
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { createCliServer } from '@qodalis/cli-server-node';
15
+ import { CliAdminBuilder } from '@qodalis/cli-server-plugin-admin';
16
+
17
+ const { app, registry, builder, eventSocketManager } = createCliServer({
18
+ configure: (builder) => {
19
+ // register your modules...
20
+ },
21
+ });
22
+
23
+ const adminPlugin = new CliAdminBuilder()
24
+ .setCredentials('admin', 'my-secret-password')
25
+ .setJwtSecret('my-jwt-secret')
26
+ .build({ registry, eventSocketManager, builder });
27
+
28
+ // Using createCliServer:
29
+ mountPlugin(adminPlugin);
30
+
31
+ // Or on an existing Express app:
32
+ app.use(adminPlugin.prefix, adminPlugin.router);
33
+ app.use(adminPlugin.dashboardPrefix, adminPlugin.dashboardRouter);
34
+ ```
35
+
36
+ ## Configuration
37
+
38
+ When the users plugin is installed, pass `setAuthProvider(usersPlugin.serverAuth)`: the dashboard then logs in with users credentials, its token is a users session token, and every admin route requires `admin:access`. The static credentials below are only used when the users plugin is absent.
39
+
40
+ Credentials and JWT secret can be set via the builder or environment variables:
41
+
42
+ | Environment Variable | Default | Description |
43
+ |---|---|---|
44
+ | `QCLI_ADMIN_USERNAME` | `admin` | Admin login username |
45
+ | `QCLI_ADMIN_PASSWORD` | `admin` | Admin login password |
46
+ | `QCLI_ADMIN_JWT_SECRET` | Random | JWT signing secret |
47
+
48
+ ## Builder Options
49
+
50
+ | Method | Description |
51
+ |---|---|
52
+ | `setCredentials(username, password)` | Set admin login credentials (only used without the users plugin) |
53
+ | `setAuthProvider(usersPlugin.serverAuth)` | Log in through the users plugin; requires the `admin:access` permission (`admin` has it via `*`) |
54
+ | `setJwtSecret(secret)` | Set JWT signing secret |
55
+ | `setRegisteredJobs(count)` | Report job count in the status endpoint |
56
+ | `setEnabledFeatures(features)` | Add custom feature flags to the status endpoint |
57
+ | `setDashboardDir(dir)` | Override the path to the dashboard SPA dist directory |
58
+
59
+ ## REST API
60
+
61
+ All endpoints are mounted at the plugin's built-in prefix (`/api/v1/qcli`). Routes below `/auth/login` require a valid JWT in the `Authorization: Bearer <token>` header.
62
+
63
+ ### Authentication
64
+
65
+ | Method | Endpoint | Description |
66
+ |---|---|---|
67
+ | POST | `/auth/login` | Authenticate with username/password, receive JWT |
68
+ | GET | `/auth/me` | Get current user info from token |
69
+
70
+ ### Status
71
+
72
+ | Method | Endpoint | Description |
73
+ |---|---|---|
74
+ | GET | `/status` | Server uptime, memory, platform, connections, registered commands, enabled features |
75
+
76
+ ### Plugins
77
+
78
+ | Method | Endpoint | Description |
79
+ |---|---|---|
80
+ | GET | `/plugins` | List all registered modules |
81
+ | POST | `/plugins/:id/toggle` | Enable or disable a module |
82
+
83
+ ### Configuration
84
+
85
+ When the users plugin is installed, pass `setAuthProvider(usersPlugin.serverAuth)`: the dashboard then logs in with users credentials, its token is a users session token, and every admin route requires `admin:access`. The static credentials below are only used when the users plugin is absent.
86
+
87
+ | Method | Endpoint | Description |
88
+ |---|---|---|
89
+ | GET | `/config` | Return structured config sections (server, auth, custom) |
90
+ | PUT | `/config` | Update mutable (custom) settings |
91
+
92
+ ### Logs
93
+
94
+ | Method | Endpoint | Description |
95
+ |---|---|---|
96
+ | GET | `/logs` | Query log entries with optional `level`, `search`, `limit`, `offset` params |
97
+
98
+ ### WebSocket Clients
99
+
100
+ | Method | Endpoint | Description |
101
+ |---|---|---|
102
+ | GET | `/ws/clients` | List connected WebSocket clients |
103
+
104
+ ## Dashboard
105
+
106
+ The plugin includes a bundled SPA dashboard served at the built-in prefix (`/qcli/admin`). The dashboard auto-resolves from the package's `dashboard/` directory, or from the `@qodalis/cli-server-dashboard` package if installed separately.
107
+
108
+ ## License
109
+
110
+ MIT