@getvision/server 0.4.1-ff0c7ec-develop → 0.4.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/CHANGELOG.md +11 -0
- package/README.md +5 -20
- package/package.json +1 -1
- package/src/event-bus.ts +2 -18
- package/src/vision-app.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @getvision/server
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5b7cb0a: feat(web): add query parameters support, custom query params, and polished UI
|
|
8
|
+
|
|
9
|
+
Introduced support for API query parameters in the API Explorer, including the ability to add and manage custom query parameters. Refactored UI components to use a new `Checkbox` component and replaced `Card` with `SectionCard` for better consistency. Enhanced request body handling with JSON5 parsing.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [5b7cb0a]
|
|
12
|
+
- @getvision/core@0.1.1
|
|
13
|
+
|
|
3
14
|
## 0.4.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ async (data, c) => {
|
|
|
87
87
|
Zod validation for inputs and outputs:
|
|
88
88
|
|
|
89
89
|
```typescript
|
|
90
|
-
|
|
90
|
+
.endpoint('POST', '/users', {
|
|
91
91
|
input: z.object({
|
|
92
92
|
name: z.string().min(1),
|
|
93
93
|
email: z.string().email()
|
|
@@ -107,10 +107,11 @@ BullMQ event bus is built-in:
|
|
|
107
107
|
|
|
108
108
|
```typescript
|
|
109
109
|
// Subscribe to events
|
|
110
|
-
|
|
110
|
+
.on('user/created', async (event) => {
|
|
111
111
|
await sendWelcomeEmail(event.data.email)
|
|
112
112
|
})
|
|
113
|
-
|
|
113
|
+
|
|
114
|
+
// Schedule cron jobs
|
|
114
115
|
.cron('0 0 * * *', async () => {
|
|
115
116
|
await cleanupInactiveUsers()
|
|
116
117
|
})
|
|
@@ -204,23 +205,7 @@ const app = new Vision({
|
|
|
204
205
|
logging: true // Console logging
|
|
205
206
|
},
|
|
206
207
|
pubsub: {
|
|
207
|
-
devMode: true
|
|
208
|
-
// BullMQ options
|
|
209
|
-
queue: {
|
|
210
|
-
defaultJobOptions: {
|
|
211
|
-
lockDuration: 300000, // 5 minutes
|
|
212
|
-
stalledInterval: 300000,
|
|
213
|
-
maxStalledCount: 1,
|
|
214
|
-
removeOnComplete: 1000,
|
|
215
|
-
removeOnFail: 1000,
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
worker: {
|
|
219
|
-
lockDuration: 300000,
|
|
220
|
-
},
|
|
221
|
-
queueEvents: {
|
|
222
|
-
stalledInterval: 300000,
|
|
223
|
-
}
|
|
208
|
+
devMode: true // In-memory BullMQ for local dev
|
|
224
209
|
}
|
|
225
210
|
})
|
|
226
211
|
```
|
package/package.json
CHANGED
package/src/event-bus.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Queue, Worker, QueueEvents } from 'bullmq'
|
|
2
|
-
import type {
|
|
2
|
+
import type { z, ZodError } from 'zod'
|
|
3
3
|
import { eventRegistry } from './event-registry'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -11,9 +11,6 @@ export interface EventBusConfig {
|
|
|
11
11
|
port?: number
|
|
12
12
|
password?: string
|
|
13
13
|
}
|
|
14
|
-
queue?: Omit<QueueOptions, 'connection'>
|
|
15
|
-
worker?: Omit<WorkerOptions, 'connection'>
|
|
16
|
-
queueEvents?: Omit<QueueEventsOptions, 'connection'>
|
|
17
14
|
/**
|
|
18
15
|
* Default BullMQ worker concurrency (per event). Per-handler options override this.
|
|
19
16
|
*/
|
|
@@ -80,9 +77,6 @@ export class EventBus {
|
|
|
80
77
|
devMode: resolvedDevMode,
|
|
81
78
|
redis: mergedRedis,
|
|
82
79
|
workerConcurrency: config.workerConcurrency,
|
|
83
|
-
queue: config.queue,
|
|
84
|
-
worker: config.worker,
|
|
85
|
-
queueEvents: config.queueEvents,
|
|
86
80
|
}
|
|
87
81
|
}
|
|
88
82
|
|
|
@@ -102,7 +96,6 @@ export class EventBus {
|
|
|
102
96
|
port: 6379,
|
|
103
97
|
}
|
|
104
98
|
queue = new Queue(eventName, {
|
|
105
|
-
...(this.config.queue || {}),
|
|
106
99
|
connection,
|
|
107
100
|
})
|
|
108
101
|
this.queues.set(eventName, queue)
|
|
@@ -230,13 +223,8 @@ export class EventBus {
|
|
|
230
223
|
}
|
|
231
224
|
},
|
|
232
225
|
{
|
|
233
|
-
...(this.config.worker || {}),
|
|
234
226
|
connection,
|
|
235
|
-
concurrency:
|
|
236
|
-
options?.concurrency ??
|
|
237
|
-
this.config.workerConcurrency ??
|
|
238
|
-
this.config.worker?.concurrency ??
|
|
239
|
-
1,
|
|
227
|
+
concurrency: options?.concurrency ?? this.config.workerConcurrency ?? 1,
|
|
240
228
|
}
|
|
241
229
|
)
|
|
242
230
|
|
|
@@ -249,7 +237,6 @@ export class EventBus {
|
|
|
249
237
|
port: 6379,
|
|
250
238
|
}
|
|
251
239
|
const queueEvents = new QueueEvents(eventName, {
|
|
252
|
-
...(this.config.queueEvents || {}),
|
|
253
240
|
connection,
|
|
254
241
|
})
|
|
255
242
|
|
|
@@ -314,9 +301,7 @@ export class EventBus {
|
|
|
314
301
|
}
|
|
315
302
|
},
|
|
316
303
|
{
|
|
317
|
-
...(this.config.worker || {}),
|
|
318
304
|
connection,
|
|
319
|
-
concurrency: this.config.worker?.concurrency ?? 1,
|
|
320
305
|
}
|
|
321
306
|
)
|
|
322
307
|
|
|
@@ -325,7 +310,6 @@ export class EventBus {
|
|
|
325
310
|
// Listen to cron job events
|
|
326
311
|
if (!this.queueEvents.has(cronName)) {
|
|
327
312
|
const queueEvents = new QueueEvents(cronName, {
|
|
328
|
-
...(this.config.queueEvents || {}),
|
|
329
313
|
connection,
|
|
330
314
|
})
|
|
331
315
|
|
package/src/vision-app.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { ServiceBuilder } from './service'
|
|
|
9
9
|
import { EventBus } from './event-bus'
|
|
10
10
|
import { eventRegistry } from './event-registry'
|
|
11
11
|
import type { serve as honoServe } from '@hono/node-server'
|
|
12
|
-
import type { QueueEventsOptions, QueueOptions, WorkerOptions } from "bullmq";
|
|
13
12
|
|
|
14
13
|
export interface VisionALSContext {
|
|
15
14
|
vision: VisionCore
|
|
@@ -131,9 +130,6 @@ export interface VisionConfig {
|
|
|
131
130
|
* Default BullMQ worker concurrency for all handlers (overridable per handler)
|
|
132
131
|
*/
|
|
133
132
|
workerConcurrency?: number
|
|
134
|
-
queue?: Omit<QueueOptions, 'connection'>
|
|
135
|
-
worker?: Omit<WorkerOptions, 'connection'>
|
|
136
|
-
queueEvents?: Omit<QueueEventsOptions, 'connection'>
|
|
137
133
|
}
|
|
138
134
|
}
|
|
139
135
|
|
|
@@ -262,9 +258,6 @@ export class Vision<
|
|
|
262
258
|
redis: this.config.pubsub?.redis,
|
|
263
259
|
devMode: this.config.pubsub?.devMode,
|
|
264
260
|
workerConcurrency: this.config.pubsub?.workerConcurrency,
|
|
265
|
-
queue: this.config.pubsub?.queue,
|
|
266
|
-
worker: this.config.pubsub?.worker,
|
|
267
|
-
queueEvents: this.config.pubsub?.queueEvents,
|
|
268
261
|
})
|
|
269
262
|
|
|
270
263
|
// Register JSON-RPC methods for events/cron
|