redis-smq-web-server 9.0.0-next.1 → 9.0.0-next.10
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/CHANGELOG.md +78 -0
- package/README.md +99 -69
- package/dist/cjs/bin/cli.d.ts +1 -0
- package/dist/cjs/bin/cli.js +42 -7
- package/dist/cjs/bin/cli.js.map +1 -1
- package/dist/cjs/src/config/parse-config.d.ts.map +1 -1
- package/dist/cjs/src/config/parse-config.js +16 -29
- package/dist/cjs/src/config/parse-config.js.map +1 -1
- package/dist/cjs/src/config/types/index.d.ts +16 -5
- package/dist/cjs/src/config/types/index.d.ts.map +1 -1
- package/dist/cjs/src/index.d.ts +4 -1
- package/dist/cjs/src/index.d.ts.map +1 -1
- package/dist/cjs/src/index.js +54 -25
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/tests/common/config.d.ts +3 -0
- package/dist/cjs/tests/common/config.d.ts.map +1 -0
- package/dist/cjs/tests/common/config.js +24 -0
- package/dist/cjs/tests/common/config.js.map +1 -0
- package/dist/cjs/tests/common/redis-client.d.ts +94 -0
- package/dist/cjs/tests/common/redis-client.d.ts.map +1 -0
- package/dist/cjs/tests/common/redis-client.js +40 -0
- package/dist/cjs/tests/common/redis-client.js.map +1 -0
- package/dist/cjs/tests/common/start-redis-server.d.ts +3 -0
- package/dist/cjs/tests/common/start-redis-server.d.ts.map +1 -0
- package/dist/cjs/tests/common/start-redis-server.js +37 -0
- package/dist/cjs/tests/common/start-redis-server.js.map +1 -0
- package/dist/cjs/tests/common/start-web-server.d.ts +3 -0
- package/dist/cjs/tests/common/start-web-server.d.ts.map +1 -0
- package/dist/cjs/tests/common/start-web-server.js +33 -0
- package/dist/cjs/tests/common/start-web-server.js.map +1 -0
- package/dist/cjs/tests/setup.d.ts +2 -0
- package/dist/cjs/tests/setup.d.ts.map +1 -0
- package/dist/cjs/tests/setup.js +27 -0
- package/dist/cjs/tests/setup.js.map +1 -0
- package/dist/cjs/tests/tests/test00001.test.d.ts +2 -0
- package/dist/cjs/tests/tests/test00001.test.d.ts.map +1 -0
- package/dist/cjs/tests/tests/test00001.test.js +118 -0
- package/dist/cjs/tests/tests/test00001.test.js.map +1 -0
- package/dist/esm/bin/cli.d.ts +1 -0
- package/dist/esm/bin/cli.js +41 -7
- package/dist/esm/bin/cli.js.map +1 -1
- package/dist/esm/src/config/parse-config.d.ts.map +1 -1
- package/dist/esm/src/config/parse-config.js +18 -28
- package/dist/esm/src/config/parse-config.js.map +1 -1
- package/dist/esm/src/config/types/index.d.ts +16 -5
- package/dist/esm/src/config/types/index.d.ts.map +1 -1
- package/dist/esm/src/index.d.ts +4 -1
- package/dist/esm/src/index.d.ts.map +1 -1
- package/dist/esm/src/index.js +55 -25
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/tests/common/config.d.ts +3 -0
- package/dist/esm/tests/common/config.d.ts.map +1 -0
- package/dist/esm/tests/common/config.js +21 -0
- package/dist/esm/tests/common/config.js.map +1 -0
- package/dist/esm/tests/common/redis-client.d.ts +94 -0
- package/dist/esm/tests/common/redis-client.d.ts.map +1 -0
- package/dist/esm/tests/common/redis-client.js +20 -0
- package/dist/esm/tests/common/redis-client.js.map +1 -0
- package/dist/esm/tests/common/start-redis-server.d.ts +3 -0
- package/dist/esm/tests/common/start-redis-server.d.ts.map +1 -0
- package/dist/esm/tests/common/start-redis-server.js +22 -0
- package/dist/esm/tests/common/start-redis-server.js.map +1 -0
- package/dist/esm/tests/common/start-web-server.d.ts +3 -0
- package/dist/esm/tests/common/start-web-server.d.ts.map +1 -0
- package/dist/esm/tests/common/start-web-server.js +16 -0
- package/dist/esm/tests/common/start-web-server.js.map +1 -0
- package/dist/esm/tests/setup.d.ts +2 -0
- package/dist/esm/tests/setup.d.ts.map +1 -0
- package/dist/esm/tests/setup.js +16 -0
- package/dist/esm/tests/setup.js.map +1 -0
- package/dist/esm/tests/tests/test00001.test.d.ts +2 -0
- package/dist/esm/tests/tests/test00001.test.d.ts.map +1 -0
- package/dist/esm/tests/tests/test00001.test.js +103 -0
- package/dist/esm/tests/tests/test00001.test.js.map +1 -0
- package/package.json +19 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,84 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.0.0-next.10](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.9...v9.0.0-next.10) (2025-10-26)
|
|
7
|
+
|
|
8
|
+
### 🐛 Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **redis-smq-web-server:** add rate limiting middleware to prevent DoS attacks ([5c144fd](https://github.com/weyoss/redis-smq/commit/5c144fdc67007aa686bdceddc36e3d93635bcff9))
|
|
11
|
+
- **redis-smq-web-server:** improve base path handling and routing logic ([5e7ff4c](https://github.com/weyoss/redis-smq/commit/5e7ff4c46b07b29bd1328bbf9732efbd07cb60b1))
|
|
12
|
+
|
|
13
|
+
### 📝 Documentation
|
|
14
|
+
|
|
15
|
+
- **redis-smq-web-server:** add npm version/code coverage badges ([c4c76c2](https://github.com/weyoss/redis-smq/commit/c4c76c2a781ad414ae1117f9b47cdb0c4eb04fac))
|
|
16
|
+
|
|
17
|
+
### ✅ Tests
|
|
18
|
+
|
|
19
|
+
- **redis-smq-web-server:** add comprehensive E2E test suite ([d67e5c6](https://github.com/weyoss/redis-smq/commit/d67e5c6d4cfb62d6736698d5fdb158a2bebf41df))
|
|
20
|
+
|
|
21
|
+
## [9.0.0-next.9](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.8...v9.0.0-next.9) (2025-10-21)
|
|
22
|
+
|
|
23
|
+
**Note:** Version bump only for package redis-smq-web-server
|
|
24
|
+
|
|
25
|
+
## [9.0.0-next.8](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.7...v9.0.0-next.8) (2025-10-18)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package redis-smq-web-server
|
|
28
|
+
|
|
29
|
+
## [9.0.0-next.7](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.6...v9.0.0-next.7) (2025-10-13)
|
|
30
|
+
|
|
31
|
+
**Note:** Version bump only for package redis-smq-web-server
|
|
32
|
+
|
|
33
|
+
## [9.0.0-next.6](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.5...v9.0.0-next.6) (2025-10-13)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package redis-smq-web-server
|
|
36
|
+
|
|
37
|
+
## [9.0.0-next.5](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.4...v9.0.0-next.5) (2025-10-12)
|
|
38
|
+
|
|
39
|
+
### 🚀 Chore
|
|
40
|
+
|
|
41
|
+
- **redis-smq-web-server:** update dependencies to latest versions ([34676ff](https://github.com/weyoss/redis-smq/commit/34676ff071c0d1f99b8b3d8efa8b1980b3e2eee6))
|
|
42
|
+
|
|
43
|
+
### 📝 Documentation
|
|
44
|
+
|
|
45
|
+
- add GitHub note callouts in README files ([86e855a](https://github.com/weyoss/redis-smq/commit/86e855ae7aea91e3295301671b8da3249164ea40))
|
|
46
|
+
- standardize "next" branch reference ([15f3e4f](https://github.com/weyoss/redis-smq/commit/15f3e4f4347fd4f76f9dc167dd72f174f178ab8e))
|
|
47
|
+
- update README files for next branch with pre-release badges and doc links ([463250b](https://github.com/weyoss/redis-smq/commit/463250bbd754d44ae6741abcf4e2d62995aef620))
|
|
48
|
+
|
|
49
|
+
## [9.0.0-next.4](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.3...v9.0.0-next.4) (2025-10-09)
|
|
50
|
+
|
|
51
|
+
### ♻️ Code Refactoring
|
|
52
|
+
|
|
53
|
+
- **redis-smq-web-server:** replace console logging with app logger ([d8b3210](https://github.com/weyoss/redis-smq/commit/d8b32109929c54316630029ac8f7d9ed7fa094eb))
|
|
54
|
+
- **redis-smq-web-server:** use createLogger function ([436e2ea](https://github.com/weyoss/redis-smq/commit/436e2ea044d9e02e0916b96c1213e92e25787e8a))
|
|
55
|
+
|
|
56
|
+
## [9.0.0-next.3](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.2...v9.0.0-next.3) (2025-09-09)
|
|
57
|
+
|
|
58
|
+
### 🐛 Bug Fixes
|
|
59
|
+
|
|
60
|
+
- **redis-smq-web-server:** set default Redis database to 0 ([3b4e200](https://github.com/weyoss/redis-smq/commit/3b4e200681a5e1eec2446fa6ffa27878cb790b29))
|
|
61
|
+
- **redis-smq-web-server:** update peer dependencies ([2be664e](https://github.com/weyoss/redis-smq/commit/2be664ea4bacffd5b0a780e05355e356028b6321))
|
|
62
|
+
|
|
63
|
+
### 📝 Documentation
|
|
64
|
+
|
|
65
|
+
- **redis-smq-rest-api:** add Redis client installation instructions ([40d9d54](https://github.com/weyoss/redis-smq/commit/40d9d541274701b6b701505e70d9f5ee8add0912))
|
|
66
|
+
- **redis-smq-web-server:** update configuration API and CLI options ([873bedf](https://github.com/weyoss/redis-smq/commit/873bedf848bf7098010cf67b3a886e50864021c4))
|
|
67
|
+
|
|
68
|
+
### ♻️ Code Refactoring
|
|
69
|
+
|
|
70
|
+
- **redis-smq-web-server:** improve CLI configuration and config parsing ([8ec1d84](https://github.com/weyoss/redis-smq/commit/8ec1d840678eb360a7854453cd6e20976d872c5c))
|
|
71
|
+
|
|
72
|
+
## [9.0.0-next.2](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.1...v9.0.0-next.2) (2025-09-07)
|
|
73
|
+
|
|
74
|
+
### 🐛 Bug Fixes
|
|
75
|
+
|
|
76
|
+
- **redis-smq-web-server:** add shebang to CLI script for proper execution ([0c213c5](https://github.com/weyoss/redis-smq/commit/0c213c5a39a86c1d752cfbf6e5e9595b678e7208))
|
|
77
|
+
|
|
78
|
+
### 📝 Documentation
|
|
79
|
+
|
|
80
|
+
- **redis-smq-web-server:** fix installation/quick start commands ([9832d33](https://github.com/weyoss/redis-smq/commit/9832d33d8beafc31f989e6477a2d83be86392966))
|
|
81
|
+
- **redis-smq-web-server:** fix npm install command ([db7f4e3](https://github.com/weyoss/redis-smq/commit/db7f4e3bd4f0778c2dad2eb9d779afd9515628ea))
|
|
82
|
+
- update installation instructions to include required deps ([107c2a5](https://github.com/weyoss/redis-smq/commit/107c2a5b2eda5b540f5f033808be94923e8688fa))
|
|
83
|
+
|
|
6
84
|
## [9.0.0-next.1](https://github.com/weyoss/redis-smq/compare/v9.0.0-next.0...v9.0.0-next.1) (2025-09-06)
|
|
7
85
|
|
|
8
86
|
**Note:** Version bump only for package redis-smq-web-server
|
package/README.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# RedisSMQ Web Server
|
|
2
2
|
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> You are viewing the documentation for the "next" branch. These docs describe unreleased changes published under the npm "next" dist-tag.
|
|
5
|
+
> For the latest stable documentation, see:
|
|
6
|
+
>
|
|
7
|
+
> - Master (stable) README: https://github.com/weyoss/redis-smq/tree/master/packages/redis-smq-web-server
|
|
8
|
+
> - Latest release notes/tags: https://github.com/weyoss/redis-smq/releases/latest
|
|
9
|
+
> - Install stable packages with @latest; pre-release with @next.
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/redis-smq-web-server?activeTab=versions)
|
|
12
|
+
[](https://app.codecov.io/github/weyoss/redis-smq/tree/next/packages/redis-smq-web-server)
|
|
13
|
+
|
|
3
14
|
A lightweight, configurable HTTP server that hosts the RedisSMQ Web UI and exposes the RedisSMQ HTTP API in the same process — or proxies it to an external API service.
|
|
4
15
|
|
|
5
16
|
- Serves the SPA (Single Page Application) for monitoring and managing RedisSMQ.
|
|
@@ -18,7 +29,16 @@ A lightweight, configurable HTTP server that hosts the RedisSMQ Web UI and expos
|
|
|
18
29
|
## Installation
|
|
19
30
|
|
|
20
31
|
```bash
|
|
21
|
-
|
|
32
|
+
# Using npm
|
|
33
|
+
npm install redis-smq@next redis-smq-common@next redis-smq-rest-api@next redis-smq-web-ui@next redis-smq-web-server@next --save
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Don't forget to install a Redis client. Choose either node-redis or ioredis:
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
npm install @redis/client --save
|
|
40
|
+
# or
|
|
41
|
+
npm install ioredis --save
|
|
22
42
|
```
|
|
23
43
|
|
|
24
44
|
## Quick Start
|
|
@@ -60,58 +80,55 @@ npx redis-smq-web-server \
|
|
|
60
80
|
--api-proxy-target http://127.0.0.1:7210
|
|
61
81
|
```
|
|
62
82
|
|
|
63
|
-
When `--api-proxy-target` is provided, requests to `<basePath>/api`, `<basePath>/docs`, and `<basePath>/assets` are forwarded
|
|
83
|
+
When `--api-proxy-target` is provided, requests to `<basePath>/api`, `<basePath>/docs`, and `<basePath>/assets` are forwarded
|
|
64
84
|
to the upstream. In this mode, Redis connection options on the web server are not used; the upstream API service manages Redis.
|
|
65
85
|
|
|
66
86
|
### Programmatically (optional)
|
|
67
87
|
|
|
68
88
|
If you prefer embedding the server in your app, you can pass the same configuration programmatically.
|
|
69
89
|
|
|
70
|
-
#### ESM / TypeScript
|
|
71
|
-
|
|
72
90
|
```typescript
|
|
73
91
|
import { RedisSMQWebServer } from 'redis-smq-web-server';
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
import { EConsoleLoggerLevel, ERedisConfigClient } from 'redis-smq-common';
|
|
93
|
+
|
|
94
|
+
// Run with the embedded REST API (in-process)
|
|
95
|
+
const server = new RedisSMQWebServer({
|
|
96
|
+
webServer: {
|
|
97
|
+
port: 8080,
|
|
98
|
+
basePath: '/', // UI at '/', API at '/api', docs at '/docs'
|
|
99
|
+
},
|
|
100
|
+
// The following options are used only when apiProxyTarget is NOT set
|
|
101
|
+
redis: {
|
|
102
|
+
client: ERedisConfigClient.IOREDIS,
|
|
103
|
+
options: {
|
|
104
|
+
host: '127.0.0.1',
|
|
105
|
+
port: 6379,
|
|
106
|
+
db: 1,
|
|
107
|
+
showFriendlyErrorStack: true,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
logger: {
|
|
111
|
+
enabled: true,
|
|
112
|
+
options: {
|
|
113
|
+
level: EConsoleLoggerLevel.INFO,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
89
116
|
});
|
|
90
117
|
|
|
91
|
-
|
|
92
|
-
// await
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### CommonJS
|
|
118
|
+
await server.run();
|
|
119
|
+
// await server.shutdown();
|
|
96
120
|
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
redisHost: '127.0.0.1',
|
|
106
|
-
redisPort: 6379,
|
|
107
|
-
redisDB: '1',
|
|
121
|
+
// Or proxy API/docs/assets to an external service
|
|
122
|
+
const srv = new RedisSMQWebServer({
|
|
123
|
+
webServer: {
|
|
124
|
+
port: 8080,
|
|
125
|
+
basePath: '/', // or '/redis-smq'
|
|
126
|
+
apiProxyTarget: 'http://127.0.0.1:7210',
|
|
127
|
+
},
|
|
128
|
+
// No redis/logger config required in proxy mode
|
|
108
129
|
});
|
|
109
130
|
|
|
110
|
-
|
|
111
|
-
redisSMQWebServer.run({
|
|
112
|
-
port: 8080,
|
|
113
|
-
apiProxyTarget: 'http://127.0.0.1:7210',
|
|
114
|
-
});
|
|
131
|
+
await srv.run();
|
|
115
132
|
```
|
|
116
133
|
|
|
117
134
|
## Routes
|
|
@@ -119,7 +136,6 @@ redisSMQWebServer.run({
|
|
|
119
136
|
- UI: served from the configured base path
|
|
120
137
|
- Example: basePath = / → UI at /
|
|
121
138
|
- Example: basePath = /redis-smq → UI at /redis-smq
|
|
122
|
-
|
|
123
139
|
- HTTP API: mounted under <basePath>/api
|
|
124
140
|
- Example: basePath = / → API at /api
|
|
125
141
|
- Example: basePath = /redis-smq → API at /redis-smq/api
|
|
@@ -141,39 +157,54 @@ Proxying behavior:
|
|
|
141
157
|
Configuration can be provided programmatically or via CLI arguments. The core interface is:
|
|
142
158
|
|
|
143
159
|
```typescript
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
160
|
+
import type { IRedisSMQRestApiConfig } from 'redis-smq-rest-api';
|
|
161
|
+
|
|
162
|
+
interface IRedisSMQWebServerConfig extends IRedisSMQRestApiConfig {
|
|
163
|
+
webServer?: {
|
|
164
|
+
/**
|
|
165
|
+
* HTTP port to run the web server on.
|
|
166
|
+
* Default: 8080
|
|
167
|
+
*/
|
|
168
|
+
port?: number;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Base public path for the RedisSMQ Web UI and the local API/docs when embedded.
|
|
172
|
+
* Default: '/'
|
|
173
|
+
*/
|
|
174
|
+
basePath?: string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Optional target for proxying (/api, /docs, /assets).
|
|
178
|
+
* If provided, the embedded REST API is not mounted and requests are forwarded to the target.
|
|
179
|
+
* Example: 'http://127.0.0.1:7210'
|
|
180
|
+
*/
|
|
181
|
+
apiProxyTarget?: string;
|
|
182
|
+
};
|
|
155
183
|
}
|
|
156
184
|
```
|
|
157
185
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
- apiProxyTarget
|
|
186
|
+
Notes:
|
|
187
|
+
|
|
188
|
+
- When `webServer.apiProxyTarget` is set, the server proxies `<basePath>/api`, `<basePath>/docs`, and
|
|
189
|
+
`<basePath>/assets` to the target. In this mode, redis and logger options are not used by the web server (they are
|
|
190
|
+
handled by the upstream API service).
|
|
191
|
+
|
|
192
|
+
- When `webServer.apiProxyTarget` is not set, the web server mounts the embedded `redis-smq-rest-api` using the provided
|
|
193
|
+
`IRedisSMQRestApiConfig` (redis, logger, etc.).
|
|
165
194
|
|
|
166
195
|
### ClI flags
|
|
167
196
|
|
|
168
197
|
```shell
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
198
|
+
-p, --port <number> Port to run the server on (default: "8080")
|
|
199
|
+
-b, --base-path <string> Base public path for the RedisSMQ Web UI SPA (default: "/")
|
|
200
|
+
-t, --api-proxy-target <string> Proxy target for API (/api, /docs, /assets). Example: http://127.0.0.1:6000
|
|
201
|
+
-c, --redis-client <ioredis|redis> Redis client. Valid options are: ioredis, redis. (default: "ioredis")
|
|
202
|
+
-r, --redis-host <string> Redis server host (default: "127.0.0.1")
|
|
203
|
+
-o, --redis-port <number> Redis server port (default: "6379")
|
|
204
|
+
-d, --redis-db <number> Redis database number (default: "0")
|
|
205
|
+
-e, --enable-log <0|1> Enable console logging. Valid options are: 0, 1 (default: "0")
|
|
206
|
+
-v, --log-level <0|1|2|3> Log level. Numbers: 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default: "1")
|
|
207
|
+
-h, --help display help for command
|
|
177
208
|
```
|
|
178
209
|
|
|
179
210
|
## Deploying behind a reverse proxy
|
|
@@ -188,5 +219,4 @@ interface IRedisSMQWebServerConfig {
|
|
|
188
219
|
|
|
189
220
|
## License
|
|
190
221
|
|
|
191
|
-
RedisSMQ Web Server is licensed under is released under the [MIT License](
|
|
192
|
-
|
|
222
|
+
RedisSMQ Web Server is licensed under is released under the [MIT License](/LICENSE).
|
package/dist/cjs/bin/cli.d.ts
CHANGED
package/dist/cjs/bin/cli.js
CHANGED
|
@@ -1,21 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";
|
|
3
|
+
var _a, _b, _c;
|
|
2
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
5
|
const commander_1 = require("commander");
|
|
4
6
|
const index_js_1 = require("../src/index.js");
|
|
5
7
|
const parse_config_js_1 = require("../src/config/parse-config.js");
|
|
8
|
+
const redis_smq_common_1 = require("redis-smq-common");
|
|
9
|
+
const redis_smq_1 = require("redis-smq");
|
|
10
|
+
const defaultLogLevel = typeof redis_smq_1.defaultConfig.logger.options.logLevel === 'number'
|
|
11
|
+
? redis_smq_1.defaultConfig.logger.options.logLevel
|
|
12
|
+
: redis_smq_common_1.EConsoleLoggerLevel[redis_smq_1.defaultConfig.logger.options.logLevel];
|
|
6
13
|
const program = new commander_1.Command();
|
|
7
14
|
program
|
|
8
15
|
.name('redis-smq-web-server')
|
|
9
16
|
.description('Web server for RedisSMQ Web UI');
|
|
10
17
|
program
|
|
11
|
-
.option('-p, --port <
|
|
12
|
-
.option('-
|
|
13
|
-
.option('-
|
|
14
|
-
.option('-
|
|
15
|
-
.option('-
|
|
16
|
-
.option('-
|
|
18
|
+
.option('-p, --port <number>', 'Port to run the server on', String((_a = parse_config_js_1.defaultConfig.webServer) === null || _a === void 0 ? void 0 : _a.port))
|
|
19
|
+
.option('-b, --base-path <string>', 'Base public path for the RedisSMQ Web UI SPA', (_b = parse_config_js_1.defaultConfig.webServer) === null || _b === void 0 ? void 0 : _b.basePath)
|
|
20
|
+
.option('-t, --api-proxy-target <string>', 'Proxy target for API (/api, /docs, /assets). Example: http://127.0.0.1:6000', (_c = parse_config_js_1.defaultConfig.webServer) === null || _c === void 0 ? void 0 : _c.apiProxyTarget)
|
|
21
|
+
.option('-c, --redis-client <ioredis|redis>', 'Redis client. Valid options are: ioredis, redis.', redis_smq_1.defaultConfig.redis.client)
|
|
22
|
+
.option('-r, --redis-host <string>', 'Redis server host', redis_smq_1.defaultConfig.redis.options.host)
|
|
23
|
+
.option('-o, --redis-port <number>', 'Redis server port', String(redis_smq_1.defaultConfig.redis.options.port))
|
|
24
|
+
.option('-d, --redis-db <number>', 'Redis database number', String(redis_smq_1.defaultConfig.redis.options.db))
|
|
25
|
+
.option('-e, --enable-log <0|1>', 'Enable console logging. Valid options are: 0, 1', String(Number(redis_smq_1.defaultConfig.logger.enabled)))
|
|
26
|
+
.option('-v, --log-level <0|1|2|3>', `Log level. Numbers: ${redis_smq_common_1.EConsoleLoggerLevel.DEBUG}=DEBUG, ${redis_smq_common_1.EConsoleLoggerLevel.INFO}=INFO, ${redis_smq_common_1.EConsoleLoggerLevel.WARN}=WARN, ${redis_smq_common_1.EConsoleLoggerLevel.ERROR}=ERROR`, String(defaultLogLevel));
|
|
17
27
|
program.parse();
|
|
18
28
|
const options = program.opts();
|
|
19
|
-
const
|
|
29
|
+
const config = {
|
|
30
|
+
webServer: {
|
|
31
|
+
port: Number(options.port),
|
|
32
|
+
basePath: options.basePath,
|
|
33
|
+
apiProxyTarget: options.apiProxyTarget,
|
|
34
|
+
},
|
|
35
|
+
apiServer: {
|
|
36
|
+
port: Number(options.port),
|
|
37
|
+
basePath: options.basePath,
|
|
38
|
+
},
|
|
39
|
+
redis: {
|
|
40
|
+
client: options.redisClient,
|
|
41
|
+
options: {
|
|
42
|
+
host: options.redisHost,
|
|
43
|
+
port: Number(options.redisPort),
|
|
44
|
+
db: Number(options.redisDb),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
logger: {
|
|
48
|
+
enabled: Boolean(Number(options.enableLog)),
|
|
49
|
+
options: {
|
|
50
|
+
logLevel: Number(options.logLevel),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
const server = new index_js_1.RedisSMQWebServer(config);
|
|
20
55
|
server.run();
|
|
21
56
|
//# sourceMappingURL=cli.js.map
|
package/dist/cjs/bin/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../bin/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../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-config.d.ts","sourceRoot":"","sources":["../../../../src/config/parse-config.ts"],"names":[],"mappings":"AASA,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC/B,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"parse-config.d.ts","sourceRoot":"","sources":["../../../../src/config/parse-config.ts"],"names":[],"mappings":"AASA,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC/B,MAAM,kBAAkB,CAAC;AAG1B,eAAO,MAAM,aAAa,EAAE,wBAM3B,CAAC;AAMF,wBAAgB,WAAW,CACzB,MAAM,GAAE,OAAO,CAAC,wBAAwB,CAAM,GAC7C,8BAA8B,CAkBhC"}
|
|
@@ -2,37 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultConfig = void 0;
|
|
4
4
|
exports.parseConfig = parseConfig;
|
|
5
|
-
const
|
|
5
|
+
const redis_smq_rest_api_1 = require("redis-smq-rest-api");
|
|
6
6
|
exports.defaultConfig = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
apiProxyTarget: undefined,
|
|
7
|
+
webServer: {
|
|
8
|
+
port: 8080,
|
|
9
|
+
basePath: '/',
|
|
10
|
+
apiProxyTarget: undefined,
|
|
11
|
+
},
|
|
13
12
|
};
|
|
14
13
|
function parseConfig(config = {}) {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
port: cfg.redisPort,
|
|
26
|
-
host: cfg.redisHost,
|
|
27
|
-
db: cfg.redisDB,
|
|
28
|
-
showFriendlyErrorStack: true,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
webServer: webServerCfg,
|
|
32
|
-
apiServer: {
|
|
33
|
-
port: cfg.port,
|
|
34
|
-
basePath: cfg.basePath,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
14
|
+
const restApiParsedConfig = (0, redis_smq_rest_api_1.parseConfig)(config);
|
|
15
|
+
const webServer = Object.assign(Object.assign({}, exports.defaultConfig.webServer), config.webServer);
|
|
16
|
+
const basePath = String(webServer.basePath).replace(/\/+$/, '') || '/';
|
|
17
|
+
return Object.assign(Object.assign({}, restApiParsedConfig), { webServer: {
|
|
18
|
+
port: Number(webServer.port),
|
|
19
|
+
basePath,
|
|
20
|
+
apiProxyTarget: webServer.apiProxyTarget
|
|
21
|
+
? String(webServer.apiProxyTarget)
|
|
22
|
+
: undefined,
|
|
23
|
+
} });
|
|
37
24
|
}
|
|
38
25
|
//# sourceMappingURL=parse-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-config.js","sourceRoot":"","sources":["../../../../src/config/parse-config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"parse-config.js","sourceRoot":"","sources":["../../../../src/config/parse-config.ts"],"names":[],"mappings":";;;AA2BA,kCAoBC;AAlCD,2DAAuE;AAE1D,QAAA,aAAa,GAA6B;IACrD,SAAS,EAAE;QACT,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,GAAG;QACb,cAAc,EAAE,SAAS;KAC1B;CACF,CAAC;AAMF,SAAgB,WAAW,CACzB,SAA4C,EAAE;IAE9C,MAAM,mBAAmB,GAAG,IAAA,gCAAkB,EAAC,MAAM,CAAC,CAAC;IACvD,MAAM,SAAS,mCACV,qBAAa,CAAC,SAAS,GACvB,MAAM,CAAC,SAAS,CACpB,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;IACvE,uCACK,mBAAmB,KACtB,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;YAC5B,QAAQ;YACR,cAAc,EAAE,SAAS,CAAC,cAAc;gBACtC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;gBAClC,CAAC,CAAC,SAAS;SACd,IACD;AACJ,CAAC"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import { IRedisSMQRestApiParsedConfig } from 'redis-smq-rest-api';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IRedisSMQRestApiConfig, IRedisSMQRestApiParsedConfig } from 'redis-smq-rest-api';
|
|
2
|
+
import { EConsoleLoggerLevel, ERedisConfigClient } from 'redis-smq-common';
|
|
3
|
+
export interface IRedisSMQWebServerCliOptions {
|
|
4
|
+
port: string;
|
|
4
5
|
basePath: string;
|
|
5
|
-
|
|
6
|
+
redisClient: ERedisConfigClient;
|
|
7
|
+
redisPort: string;
|
|
6
8
|
redisHost: string;
|
|
7
|
-
|
|
9
|
+
redisDb: string;
|
|
10
|
+
enableLog: string;
|
|
11
|
+
logLevel: EConsoleLoggerLevel;
|
|
8
12
|
apiProxyTarget?: string;
|
|
9
13
|
}
|
|
14
|
+
export interface IRedisSMQWebServerConfig extends IRedisSMQRestApiConfig {
|
|
15
|
+
webServer?: {
|
|
16
|
+
port?: number;
|
|
17
|
+
basePath?: string;
|
|
18
|
+
apiProxyTarget?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
10
21
|
export interface IRedisSMQWebServerParsedConfig extends IRedisSMQRestApiParsedConfig {
|
|
11
22
|
webServer: {
|
|
12
23
|
port: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/config/types/index.ts"],"names":[],"mappings":"AASA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/config/types/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,kBAAkB,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;IACtE,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,CAAC,EAAE,MAAM,CAAC;QAKlB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED,MAAM,WAAW,8BACf,SAAQ,4BAA4B;IACpC,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QAKjB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;CACH"}
|
package/dist/cjs/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IRedisSMQWebServerConfig } from './config/types/index.js';
|
|
2
|
+
import { ILogger } from 'redis-smq-common';
|
|
2
3
|
export declare class RedisSMQWebServer {
|
|
3
4
|
private readonly app;
|
|
4
5
|
private readonly config;
|
|
@@ -8,9 +9,11 @@ export declare class RedisSMQWebServer {
|
|
|
8
9
|
private restApi;
|
|
9
10
|
private bootstrapped;
|
|
10
11
|
private httpServer;
|
|
11
|
-
|
|
12
|
+
protected logger: ILogger;
|
|
13
|
+
constructor(config?: IRedisSMQWebServerConfig);
|
|
12
14
|
private setupMiddleware;
|
|
13
15
|
private setupApi;
|
|
16
|
+
private sendIndexHtml;
|
|
14
17
|
private setupRoutes;
|
|
15
18
|
private bootstrap;
|
|
16
19
|
run(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAgB,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAOzD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiC;IACxD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IACnD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAuB;IACtD,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,UAAU,CAA4B;IAC9C,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;gBAEd,MAAM,GAAE,wBAA6B;YAYnC,eAAe;YA4Bf,QAAQ;IAyCtB,OAAO,CAAC,aAAa;YAeP,WAAW;YA8BX,SAAS;IAWV,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAepB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAmBvC"}
|