@pg-boss/proxy 0.1.0
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/README.md +419 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +14 -0
- package/dist/contracts.d.ts +288 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +424 -0
- package/dist/home.d.ts +13 -0
- package/dist/home.d.ts.map +1 -0
- package/dist/home.js +145 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +270 -0
- package/dist/node.d.ts +31 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +78 -0
- package/dist/routes.d.ts +22 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +128 -0
- package/dist/shutdown.d.ts +12 -0
- package/dist/shutdown.d.ts.map +1 -0
- package/dist/shutdown.js +37 -0
- package/dist/types.d.ts +234 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/package.json +63 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// ============== Base Types ==============
|
|
3
|
+
export const jsonRecordSchema = z.record(z.string(), z.unknown());
|
|
4
|
+
export const nullableJsonRecordSchema = jsonRecordSchema.nullable();
|
|
5
|
+
export const dateInputSchema = z.union([z.string(), z.number()]);
|
|
6
|
+
export const queueNameSchema = z.string().min(1);
|
|
7
|
+
export const eventNameSchema = z.string().min(1);
|
|
8
|
+
export const errorResultSchema = z.object({
|
|
9
|
+
ok: z.literal(false),
|
|
10
|
+
error: z.object({
|
|
11
|
+
message: z.string()
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
export const htmlResponseSchema = z.string();
|
|
15
|
+
// ============== pg-boss Types ==============
|
|
16
|
+
export const groupOptionsSchema = z.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
tier: z.string().optional()
|
|
19
|
+
});
|
|
20
|
+
export const groupConcurrencyConfigSchema = z.object({
|
|
21
|
+
default: z.number(),
|
|
22
|
+
tiers: z.record(z.string(), z.number()).optional()
|
|
23
|
+
});
|
|
24
|
+
const sendOptionsSchemaBase = z.object({
|
|
25
|
+
id: z.string().optional(),
|
|
26
|
+
priority: z.number().optional(),
|
|
27
|
+
startAfter: dateInputSchema.optional(),
|
|
28
|
+
singletonKey: z.string().optional(),
|
|
29
|
+
singletonSeconds: z.number().optional(),
|
|
30
|
+
singletonNextSlot: z.boolean().optional(),
|
|
31
|
+
keepUntil: dateInputSchema.optional(),
|
|
32
|
+
group: groupOptionsSchema.optional(),
|
|
33
|
+
deadLetter: z.string().optional(),
|
|
34
|
+
expireInSeconds: z.number().optional(),
|
|
35
|
+
retentionSeconds: z.number().optional(),
|
|
36
|
+
deleteAfterSeconds: z.number().optional(),
|
|
37
|
+
retryLimit: z.number().optional(),
|
|
38
|
+
retryDelay: z.number().optional(),
|
|
39
|
+
retryBackoff: z.boolean().optional(),
|
|
40
|
+
retryDelayMax: z.number().optional(),
|
|
41
|
+
heartbeatSeconds: z.number().optional(),
|
|
42
|
+
});
|
|
43
|
+
export const sendOptionsSchema = sendOptionsSchemaBase;
|
|
44
|
+
export const queueOptionsSchema = z.object({
|
|
45
|
+
expireInSeconds: z.number().optional(),
|
|
46
|
+
retentionSeconds: z.number().optional(),
|
|
47
|
+
deleteAfterSeconds: z.number().optional(),
|
|
48
|
+
retryLimit: z.number().optional(),
|
|
49
|
+
retryDelay: z.number().optional(),
|
|
50
|
+
retryBackoff: z.boolean().optional(),
|
|
51
|
+
retryDelayMax: z.number().optional(),
|
|
52
|
+
heartbeatSeconds: z.number().optional(),
|
|
53
|
+
});
|
|
54
|
+
export const scheduleOptionsSchema = sendOptionsSchemaBase.extend({
|
|
55
|
+
tz: z.string().optional(),
|
|
56
|
+
key: z.string().optional(),
|
|
57
|
+
});
|
|
58
|
+
export const fetchOptionsSchema = z.object({
|
|
59
|
+
includeMetadata: z.boolean().optional(),
|
|
60
|
+
priority: z.boolean().optional(),
|
|
61
|
+
orderByCreatedOn: z.boolean().optional(),
|
|
62
|
+
batchSize: z.number().optional(),
|
|
63
|
+
ignoreStartAfter: z.boolean().optional(),
|
|
64
|
+
groupConcurrency: z.union([z.number(), groupConcurrencyConfigSchema]).optional(),
|
|
65
|
+
ignoreGroups: z.array(z.string()).nullable().optional(),
|
|
66
|
+
});
|
|
67
|
+
export const findJobsOptionsSchema = z.object({
|
|
68
|
+
id: z.string().optional(),
|
|
69
|
+
key: z.string().optional(),
|
|
70
|
+
data: jsonRecordSchema.optional(),
|
|
71
|
+
queued: z.boolean().optional(),
|
|
72
|
+
});
|
|
73
|
+
export const insertOptionsSchema = z.object({
|
|
74
|
+
returnId: z.boolean().optional(),
|
|
75
|
+
});
|
|
76
|
+
export const completeOptionsSchema = z.object({
|
|
77
|
+
includeQueued: z.boolean().optional(),
|
|
78
|
+
});
|
|
79
|
+
export const jobInsertSchema = z.object({
|
|
80
|
+
id: z.string().optional(),
|
|
81
|
+
data: jsonRecordSchema.optional(),
|
|
82
|
+
priority: z.number().optional(),
|
|
83
|
+
retryLimit: z.number().optional(),
|
|
84
|
+
retryDelay: z.number().optional(),
|
|
85
|
+
retryBackoff: z.boolean().optional(),
|
|
86
|
+
retryDelayMax: z.number().optional(),
|
|
87
|
+
startAfter: dateInputSchema.optional(),
|
|
88
|
+
singletonKey: z.string().optional(),
|
|
89
|
+
singletonSeconds: z.number().optional(),
|
|
90
|
+
expireInSeconds: z.number().optional(),
|
|
91
|
+
deleteAfterSeconds: z.number().optional(),
|
|
92
|
+
retentionSeconds: z.number().optional(),
|
|
93
|
+
heartbeatSeconds: z.number().optional(),
|
|
94
|
+
group: groupOptionsSchema.optional(),
|
|
95
|
+
deadLetter: z.string().optional(),
|
|
96
|
+
});
|
|
97
|
+
const jobSchemaBase = z.object({
|
|
98
|
+
id: z.string(),
|
|
99
|
+
name: z.string(),
|
|
100
|
+
data: jsonRecordSchema,
|
|
101
|
+
expireInSeconds: z.number(),
|
|
102
|
+
heartbeatSeconds: z.number().nullable(),
|
|
103
|
+
groupId: z.string().optional().nullable(),
|
|
104
|
+
groupTier: z.string().optional().nullable(),
|
|
105
|
+
});
|
|
106
|
+
export const jobSchema = jobSchemaBase;
|
|
107
|
+
export const jobWithMetadataSchema = jobSchemaBase.extend({
|
|
108
|
+
priority: z.number(),
|
|
109
|
+
state: z.enum(['created', 'retry', 'active', 'completed', 'cancelled', 'failed']),
|
|
110
|
+
retryLimit: z.number(),
|
|
111
|
+
retryCount: z.number(),
|
|
112
|
+
retryDelay: z.number(),
|
|
113
|
+
retryBackoff: z.boolean(),
|
|
114
|
+
retryDelayMax: z.number().optional(),
|
|
115
|
+
startAfter: z.iso.datetime().transform((val) => new Date(val)),
|
|
116
|
+
startedOn: z.iso.datetime().transform((val) => new Date(val)),
|
|
117
|
+
singletonKey: z.string().nullable(),
|
|
118
|
+
singletonOn: z.string().nullable(),
|
|
119
|
+
deleteAfterSeconds: z.number(),
|
|
120
|
+
createdOn: z.iso.datetime().transform((val) => new Date(val)),
|
|
121
|
+
completedOn: z.iso.datetime().nullable().transform((val) => val ? new Date(val) : null),
|
|
122
|
+
keepUntil: z.iso.datetime().transform((val) => new Date(val)),
|
|
123
|
+
policy: z.string(),
|
|
124
|
+
deadLetter: z.string(),
|
|
125
|
+
output: jsonRecordSchema,
|
|
126
|
+
});
|
|
127
|
+
export const commandResponseSchema = z.object({
|
|
128
|
+
jobs: z.array(z.string()),
|
|
129
|
+
requested: z.number(),
|
|
130
|
+
affected: z.number(),
|
|
131
|
+
});
|
|
132
|
+
export const queueResultSchema = z.object({
|
|
133
|
+
name: z.string(),
|
|
134
|
+
expireInSeconds: z.number().optional(),
|
|
135
|
+
retentionSeconds: z.number().optional(),
|
|
136
|
+
deleteAfterSeconds: z.number().optional(),
|
|
137
|
+
retryLimit: z.number().optional(),
|
|
138
|
+
retryDelay: z.number().optional(),
|
|
139
|
+
retryBackoff: z.boolean().optional(),
|
|
140
|
+
retryDelayMax: z.number().optional(),
|
|
141
|
+
policy: z.string().optional(),
|
|
142
|
+
partition: z.boolean().optional(),
|
|
143
|
+
deadLetter: z.string().optional(),
|
|
144
|
+
warningQueueSize: z.number().optional(),
|
|
145
|
+
heartbeatSeconds: z.number().optional(),
|
|
146
|
+
deferredCount: z.number(),
|
|
147
|
+
queuedCount: z.number(),
|
|
148
|
+
activeCount: z.number(),
|
|
149
|
+
totalCount: z.number(),
|
|
150
|
+
table: z.string(),
|
|
151
|
+
createdOn: z.iso.datetime().transform((val) => new Date(val)),
|
|
152
|
+
updatedOn: z.iso.datetime().transform((val) => new Date(val)),
|
|
153
|
+
singletonsActive: z.array(z.string()).nullable(),
|
|
154
|
+
});
|
|
155
|
+
export const scheduleSchema = z.object({
|
|
156
|
+
name: z.string(),
|
|
157
|
+
key: z.string(),
|
|
158
|
+
cron: z.string(),
|
|
159
|
+
timezone: z.string(),
|
|
160
|
+
data: jsonRecordSchema.optional(),
|
|
161
|
+
options: sendOptionsSchema.optional(),
|
|
162
|
+
});
|
|
163
|
+
export const bamStatusSummarySchema = z.object({
|
|
164
|
+
status: z.enum(['pending', 'in_progress', 'completed', 'failed']),
|
|
165
|
+
count: z.number(),
|
|
166
|
+
lastCreatedOn: z.iso.datetime().transform((val) => new Date(val)),
|
|
167
|
+
});
|
|
168
|
+
// ============== Request/Response Types ==============
|
|
169
|
+
export const metaResultSchema = z.object({
|
|
170
|
+
states: z.record(z.string(), z.string()),
|
|
171
|
+
policies: z.record(z.string(), z.string()),
|
|
172
|
+
events: z.record(z.string(), z.string())
|
|
173
|
+
});
|
|
174
|
+
export const metaResponseSchema = z.object({
|
|
175
|
+
ok: z.literal(true),
|
|
176
|
+
result: metaResultSchema
|
|
177
|
+
});
|
|
178
|
+
export const sendRequestSchema = z.object({
|
|
179
|
+
name: queueNameSchema,
|
|
180
|
+
data: nullableJsonRecordSchema.optional(),
|
|
181
|
+
options: sendOptionsSchema.optional()
|
|
182
|
+
});
|
|
183
|
+
export const sendResponseSchema = z.object({
|
|
184
|
+
ok: z.literal(true),
|
|
185
|
+
result: z.string().nullable()
|
|
186
|
+
});
|
|
187
|
+
export const sendAfterRequestSchema = z.object({
|
|
188
|
+
name: queueNameSchema,
|
|
189
|
+
data: nullableJsonRecordSchema.optional(),
|
|
190
|
+
options: sendOptionsSchema.optional().nullable(),
|
|
191
|
+
after: dateInputSchema
|
|
192
|
+
});
|
|
193
|
+
export const sendAfterResponseSchema = z.object({
|
|
194
|
+
ok: z.literal(true),
|
|
195
|
+
result: z.string().nullable()
|
|
196
|
+
});
|
|
197
|
+
export const sendThrottledRequestSchema = z.object({
|
|
198
|
+
name: queueNameSchema,
|
|
199
|
+
data: nullableJsonRecordSchema.optional(),
|
|
200
|
+
options: sendOptionsSchema.optional().nullable(),
|
|
201
|
+
seconds: z.number(),
|
|
202
|
+
key: z.string().optional()
|
|
203
|
+
});
|
|
204
|
+
export const sendThrottledResponseSchema = z.object({
|
|
205
|
+
ok: z.literal(true),
|
|
206
|
+
result: z.string().nullable()
|
|
207
|
+
});
|
|
208
|
+
export const sendDebouncedRequestSchema = z.object({
|
|
209
|
+
name: queueNameSchema,
|
|
210
|
+
data: nullableJsonRecordSchema.optional(),
|
|
211
|
+
options: sendOptionsSchema.optional().nullable(),
|
|
212
|
+
seconds: z.number(),
|
|
213
|
+
key: z.string().optional()
|
|
214
|
+
});
|
|
215
|
+
export const sendDebouncedResponseSchema = z.object({
|
|
216
|
+
ok: z.literal(true),
|
|
217
|
+
result: z.string().nullable()
|
|
218
|
+
});
|
|
219
|
+
export const insertRequestSchema = z.object({
|
|
220
|
+
name: queueNameSchema,
|
|
221
|
+
jobs: z.array(jobInsertSchema),
|
|
222
|
+
options: insertOptionsSchema.optional()
|
|
223
|
+
});
|
|
224
|
+
export const insertResponseSchema = z.object({
|
|
225
|
+
ok: z.literal(true),
|
|
226
|
+
result: z.array(z.string()).nullable()
|
|
227
|
+
});
|
|
228
|
+
export const fetchRequestSchema = z.object({
|
|
229
|
+
name: queueNameSchema,
|
|
230
|
+
options: fetchOptionsSchema.optional()
|
|
231
|
+
});
|
|
232
|
+
export const fetchResponseSchema = z.object({
|
|
233
|
+
ok: z.literal(true),
|
|
234
|
+
result: z.union([z.array(jobWithMetadataSchema), z.array(jobSchema)])
|
|
235
|
+
});
|
|
236
|
+
export const subscribeRequestSchema = z.object({
|
|
237
|
+
event: eventNameSchema,
|
|
238
|
+
name: queueNameSchema
|
|
239
|
+
});
|
|
240
|
+
export const subscribeResponseSchema = z.object({
|
|
241
|
+
ok: z.literal(true),
|
|
242
|
+
result: z.null()
|
|
243
|
+
});
|
|
244
|
+
export const unsubscribeRequestSchema = z.object({
|
|
245
|
+
event: eventNameSchema,
|
|
246
|
+
name: queueNameSchema
|
|
247
|
+
});
|
|
248
|
+
export const unsubscribeResponseSchema = z.object({
|
|
249
|
+
ok: z.literal(true),
|
|
250
|
+
result: z.null()
|
|
251
|
+
});
|
|
252
|
+
export const publishRequestSchema = z.object({
|
|
253
|
+
event: eventNameSchema,
|
|
254
|
+
data: nullableJsonRecordSchema.optional(),
|
|
255
|
+
options: sendOptionsSchema.optional()
|
|
256
|
+
});
|
|
257
|
+
export const publishResponseSchema = z.object({
|
|
258
|
+
ok: z.literal(true),
|
|
259
|
+
result: z.null()
|
|
260
|
+
});
|
|
261
|
+
export const cancelRequestSchema = z.object({
|
|
262
|
+
name: queueNameSchema,
|
|
263
|
+
id: z.union([z.string(), z.array(z.string())])
|
|
264
|
+
});
|
|
265
|
+
export const cancelResponseSchema = z.object({
|
|
266
|
+
ok: z.literal(true),
|
|
267
|
+
result: commandResponseSchema
|
|
268
|
+
});
|
|
269
|
+
export const resumeRequestSchema = z.object({
|
|
270
|
+
name: queueNameSchema,
|
|
271
|
+
id: z.union([z.string(), z.array(z.string())])
|
|
272
|
+
});
|
|
273
|
+
export const resumeResponseSchema = z.object({
|
|
274
|
+
ok: z.literal(true),
|
|
275
|
+
result: commandResponseSchema
|
|
276
|
+
});
|
|
277
|
+
export const retryRequestSchema = z.object({
|
|
278
|
+
name: queueNameSchema,
|
|
279
|
+
id: z.union([z.string(), z.array(z.string())])
|
|
280
|
+
});
|
|
281
|
+
export const retryResponseSchema = z.object({
|
|
282
|
+
ok: z.literal(true),
|
|
283
|
+
result: commandResponseSchema
|
|
284
|
+
});
|
|
285
|
+
export const deleteJobRequestSchema = z.object({
|
|
286
|
+
name: queueNameSchema,
|
|
287
|
+
id: z.union([z.string(), z.array(z.string())])
|
|
288
|
+
});
|
|
289
|
+
export const deleteJobResponseSchema = z.object({
|
|
290
|
+
ok: z.literal(true),
|
|
291
|
+
result: commandResponseSchema
|
|
292
|
+
});
|
|
293
|
+
export const deleteQueuedJobsRequestSchema = z.object({
|
|
294
|
+
name: queueNameSchema
|
|
295
|
+
});
|
|
296
|
+
export const deleteQueuedJobsResponseSchema = z.object({
|
|
297
|
+
ok: z.literal(true),
|
|
298
|
+
result: z.null()
|
|
299
|
+
});
|
|
300
|
+
export const deleteStoredJobsRequestSchema = z.object({
|
|
301
|
+
name: queueNameSchema
|
|
302
|
+
});
|
|
303
|
+
export const deleteStoredJobsResponseSchema = z.object({
|
|
304
|
+
ok: z.literal(true),
|
|
305
|
+
result: z.null()
|
|
306
|
+
});
|
|
307
|
+
export const deleteAllJobsRequestSchema = z.object({
|
|
308
|
+
name: queueNameSchema.optional()
|
|
309
|
+
});
|
|
310
|
+
export const deleteAllJobsResponseSchema = z.object({
|
|
311
|
+
ok: z.literal(true),
|
|
312
|
+
result: z.null()
|
|
313
|
+
});
|
|
314
|
+
export const completeRequestSchema = z.object({
|
|
315
|
+
name: queueNameSchema,
|
|
316
|
+
id: z.union([z.string(), z.array(z.string())]),
|
|
317
|
+
data: nullableJsonRecordSchema.optional(),
|
|
318
|
+
options: completeOptionsSchema.optional()
|
|
319
|
+
});
|
|
320
|
+
export const completeResponseSchema = z.object({
|
|
321
|
+
ok: z.literal(true),
|
|
322
|
+
result: commandResponseSchema
|
|
323
|
+
});
|
|
324
|
+
export const failRequestSchema = z.object({
|
|
325
|
+
name: queueNameSchema,
|
|
326
|
+
id: z.union([z.string(), z.array(z.string())]),
|
|
327
|
+
data: nullableJsonRecordSchema.optional()
|
|
328
|
+
});
|
|
329
|
+
export const failResponseSchema = z.object({
|
|
330
|
+
ok: z.literal(true),
|
|
331
|
+
result: commandResponseSchema
|
|
332
|
+
});
|
|
333
|
+
export const findJobsResponseSchema = z.object({
|
|
334
|
+
ok: z.literal(true),
|
|
335
|
+
result: z.array(jobWithMetadataSchema)
|
|
336
|
+
});
|
|
337
|
+
export const createQueueRequestSchema = z.object({
|
|
338
|
+
name: queueNameSchema,
|
|
339
|
+
options: queueOptionsSchema.and(z.object({
|
|
340
|
+
policy: z.string().optional(),
|
|
341
|
+
partition: z.boolean().optional(),
|
|
342
|
+
deadLetter: z.string().optional(),
|
|
343
|
+
warningQueueSize: z.number().optional()
|
|
344
|
+
})).optional()
|
|
345
|
+
});
|
|
346
|
+
export const createQueueResponseSchema = z.object({
|
|
347
|
+
ok: z.literal(true),
|
|
348
|
+
result: z.null()
|
|
349
|
+
});
|
|
350
|
+
export const getBlockedKeysResponseSchema = z.object({
|
|
351
|
+
ok: z.literal(true),
|
|
352
|
+
result: z.array(z.string())
|
|
353
|
+
});
|
|
354
|
+
export const updateQueueRequestSchema = z.object({
|
|
355
|
+
name: queueNameSchema,
|
|
356
|
+
options: queueOptionsSchema.and(z.object({
|
|
357
|
+
deadLetter: z.string().optional(),
|
|
358
|
+
warningQueueSize: z.number().optional()
|
|
359
|
+
})).optional()
|
|
360
|
+
});
|
|
361
|
+
export const updateQueueResponseSchema = z.object({
|
|
362
|
+
ok: z.literal(true),
|
|
363
|
+
result: z.null()
|
|
364
|
+
});
|
|
365
|
+
export const deleteQueueRequestSchema = z.object({
|
|
366
|
+
name: queueNameSchema
|
|
367
|
+
});
|
|
368
|
+
export const deleteQueueResponseSchema = z.object({
|
|
369
|
+
ok: z.literal(true),
|
|
370
|
+
result: z.null()
|
|
371
|
+
});
|
|
372
|
+
export const getQueuesResponseSchema = z.object({
|
|
373
|
+
ok: z.literal(true),
|
|
374
|
+
result: z.array(queueResultSchema)
|
|
375
|
+
});
|
|
376
|
+
export const getQueueResponseSchema = z.object({
|
|
377
|
+
ok: z.literal(true),
|
|
378
|
+
result: queueResultSchema.nullable()
|
|
379
|
+
});
|
|
380
|
+
export const getQueueStatsResponseSchema = z.object({
|
|
381
|
+
ok: z.literal(true),
|
|
382
|
+
result: queueResultSchema
|
|
383
|
+
});
|
|
384
|
+
export const superviseRequestSchema = z.object({
|
|
385
|
+
name: queueNameSchema.optional()
|
|
386
|
+
});
|
|
387
|
+
export const superviseResponseSchema = z.object({
|
|
388
|
+
ok: z.literal(true),
|
|
389
|
+
result: z.null()
|
|
390
|
+
});
|
|
391
|
+
export const isInstalledResponseSchema = z.object({
|
|
392
|
+
ok: z.literal(true),
|
|
393
|
+
result: z.boolean()
|
|
394
|
+
});
|
|
395
|
+
export const schemaVersionResponseSchema = z.object({
|
|
396
|
+
ok: z.literal(true),
|
|
397
|
+
result: z.number().nullable()
|
|
398
|
+
});
|
|
399
|
+
export const scheduleRequestSchema = z.object({
|
|
400
|
+
name: queueNameSchema,
|
|
401
|
+
cron: z.string(),
|
|
402
|
+
data: nullableJsonRecordSchema.optional(),
|
|
403
|
+
options: scheduleOptionsSchema.optional()
|
|
404
|
+
});
|
|
405
|
+
export const scheduleResponseSchema = z.object({
|
|
406
|
+
ok: z.literal(true),
|
|
407
|
+
result: z.null()
|
|
408
|
+
});
|
|
409
|
+
export const unscheduleRequestSchema = z.object({
|
|
410
|
+
name: queueNameSchema,
|
|
411
|
+
key: z.string().optional()
|
|
412
|
+
});
|
|
413
|
+
export const unscheduleResponseSchema = z.object({
|
|
414
|
+
ok: z.literal(true),
|
|
415
|
+
result: z.null()
|
|
416
|
+
});
|
|
417
|
+
export const getSchedulesResponseSchema = z.object({
|
|
418
|
+
ok: z.literal(true),
|
|
419
|
+
result: z.array(scheduleSchema)
|
|
420
|
+
});
|
|
421
|
+
export const getBamStatusResponseSchema = z.object({
|
|
422
|
+
ok: z.literal(true),
|
|
423
|
+
result: z.array(bamStatusSummarySchema)
|
|
424
|
+
});
|
package/dist/home.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type MethodInfo = {
|
|
2
|
+
method: string;
|
|
3
|
+
httpMethod: 'get' | 'post';
|
|
4
|
+
};
|
|
5
|
+
type HomeParams = {
|
|
6
|
+
base: string;
|
|
7
|
+
openapiPath: string;
|
|
8
|
+
docsPath: string;
|
|
9
|
+
methods: MethodInfo[];
|
|
10
|
+
};
|
|
11
|
+
export declare const renderHome: ({ base, openapiPath, docsPath, methods }: HomeParams) => import("hono/utils/html").HtmlEscapedString | Promise<import("hono/utils/html").HtmlEscapedString>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=home.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../src/home.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,KAAK,GAAG,MAAM,CAAA;CAC3B,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,UAAU,EAAE,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,0CAA0C,UAAU,uGAkJ9E,CAAA"}
|
package/dist/home.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { html, raw } from 'hono/html';
|
|
2
|
+
export const renderHome = ({ base, openapiPath, docsPath, methods }) => {
|
|
3
|
+
const methodList = raw(methods.map((m) => `<li><code><span class="http-method ${m.httpMethod}">${m.httpMethod.toUpperCase()}</span> ${base}/${m.method}</code></li>`).join(''));
|
|
4
|
+
return html `<!doctype html>
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<title>pg-boss proxy</title>
|
|
10
|
+
<style>
|
|
11
|
+
:root {
|
|
12
|
+
color-scheme: light;
|
|
13
|
+
--bg: #f3f0e7;
|
|
14
|
+
--panel: #ffffff;
|
|
15
|
+
--ink: #1a1a1a;
|
|
16
|
+
--muted: #5f5f5f;
|
|
17
|
+
--accent: #b63b2e;
|
|
18
|
+
--accent-2: #0e5966;
|
|
19
|
+
}
|
|
20
|
+
body {
|
|
21
|
+
margin: 0;
|
|
22
|
+
font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
|
|
23
|
+
color: var(--ink);
|
|
24
|
+
background: radial-gradient(circle at top left, #fdf7e9 0%, var(--bg) 55%, #efe6d1 100%);
|
|
25
|
+
}
|
|
26
|
+
main {
|
|
27
|
+
max-width: 980px;
|
|
28
|
+
margin: 0 auto;
|
|
29
|
+
padding: 56px 24px 80px;
|
|
30
|
+
}
|
|
31
|
+
header {
|
|
32
|
+
display: grid;
|
|
33
|
+
grid-template-columns: minmax(0, 1fr);
|
|
34
|
+
gap: 20px;
|
|
35
|
+
margin-bottom: 32px;
|
|
36
|
+
}
|
|
37
|
+
h1 {
|
|
38
|
+
font-family: "Space Grotesk", "Segoe UI", sans-serif;
|
|
39
|
+
font-size: clamp(2.4rem, 3vw, 3.4rem);
|
|
40
|
+
letter-spacing: -0.02em;
|
|
41
|
+
margin: 0;
|
|
42
|
+
}
|
|
43
|
+
p {
|
|
44
|
+
margin: 0;
|
|
45
|
+
color: var(--muted);
|
|
46
|
+
font-size: 1.05rem;
|
|
47
|
+
line-height: 1.6;
|
|
48
|
+
}
|
|
49
|
+
.cards {
|
|
50
|
+
display: grid;
|
|
51
|
+
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
|
52
|
+
gap: 16px;
|
|
53
|
+
margin: 32px 0 40px;
|
|
54
|
+
}
|
|
55
|
+
.card {
|
|
56
|
+
background: var(--panel);
|
|
57
|
+
border-radius: 16px;
|
|
58
|
+
padding: 18px;
|
|
59
|
+
border: 1px solid #e2d8c5;
|
|
60
|
+
box-shadow: 0 10px 30px rgba(28, 26, 23, 0.08);
|
|
61
|
+
}
|
|
62
|
+
.card h3 {
|
|
63
|
+
margin: 0 0 8px;
|
|
64
|
+
font-family: "Space Grotesk", "Segoe UI", sans-serif;
|
|
65
|
+
font-size: 1.1rem;
|
|
66
|
+
}
|
|
67
|
+
.card a {
|
|
68
|
+
color: var(--accent-2);
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
text-decoration: none;
|
|
71
|
+
}
|
|
72
|
+
.card a:hover {
|
|
73
|
+
text-decoration: underline;
|
|
74
|
+
}
|
|
75
|
+
.panel {
|
|
76
|
+
background: linear-gradient(135deg, rgba(182, 59, 46, 0.1), rgba(14, 89, 102, 0.08));
|
|
77
|
+
border-radius: 20px;
|
|
78
|
+
padding: 24px;
|
|
79
|
+
border: 1px solid #eadfce;
|
|
80
|
+
}
|
|
81
|
+
code {
|
|
82
|
+
background: rgba(26, 26, 26, 0.08);
|
|
83
|
+
padding: 2px 6px;
|
|
84
|
+
border-radius: 4px;
|
|
85
|
+
font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
|
|
86
|
+
}
|
|
87
|
+
.http-method {
|
|
88
|
+
font-weight: 700;
|
|
89
|
+
font-size: 0.85em;
|
|
90
|
+
margin-right: 4px;
|
|
91
|
+
}
|
|
92
|
+
.http-method.get { color: #0e5966; }
|
|
93
|
+
.http-method.post { color: #b63b2e; }
|
|
94
|
+
ul {
|
|
95
|
+
padding-left: 18px;
|
|
96
|
+
columns: 2;
|
|
97
|
+
column-gap: 32px;
|
|
98
|
+
margin: 12px 0 0;
|
|
99
|
+
}
|
|
100
|
+
li {
|
|
101
|
+
margin-bottom: 6px;
|
|
102
|
+
}
|
|
103
|
+
pre {
|
|
104
|
+
margin: 12px 0 0;
|
|
105
|
+
background: rgba(255, 255, 255, 0.8);
|
|
106
|
+
padding: 12px 14px;
|
|
107
|
+
border-radius: 12px;
|
|
108
|
+
border: 1px solid #efe4d2;
|
|
109
|
+
overflow-x: auto;
|
|
110
|
+
}
|
|
111
|
+
@media (max-width: 720px) {
|
|
112
|
+
ul { columns: 1; }
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
115
|
+
</head>
|
|
116
|
+
<body>
|
|
117
|
+
<main>
|
|
118
|
+
<header>
|
|
119
|
+
<h1>pg-boss proxy</h1>
|
|
120
|
+
<p>HTTP proxy for pg-boss methods, with a generated OpenAPI contract.</p>
|
|
121
|
+
</header>
|
|
122
|
+
|
|
123
|
+
<section class="cards">
|
|
124
|
+
<div class="card">
|
|
125
|
+
<h3>OpenAPI JSON</h3>
|
|
126
|
+
<a href="${openapiPath}">${openapiPath}</a>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="card">
|
|
129
|
+
<h3>Interactive docs</h3>
|
|
130
|
+
<a href="${docsPath}">${docsPath}</a>
|
|
131
|
+
</div>
|
|
132
|
+
<div class="card">
|
|
133
|
+
<h3>Meta payload</h3>
|
|
134
|
+
<a href="${base}/meta">${base}/meta</a>
|
|
135
|
+
</div>
|
|
136
|
+
</section>
|
|
137
|
+
|
|
138
|
+
<section>
|
|
139
|
+
<h2>Methods</h2>
|
|
140
|
+
<ul>${methodList}</ul>
|
|
141
|
+
</section>
|
|
142
|
+
</main>
|
|
143
|
+
</body>
|
|
144
|
+
</html>`;
|
|
145
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
2
|
+
import { PgBoss, type ConstructorOptions } from 'pg-boss';
|
|
3
|
+
import type { MiddlewareHandler } from 'hono';
|
|
4
|
+
type ProxyEnv = Record<string, string | undefined>;
|
|
5
|
+
type ProxyOptions = {
|
|
6
|
+
options?: ConstructorOptions;
|
|
7
|
+
bossFactory?: (options: ConstructorOptions) => PgBoss;
|
|
8
|
+
prefix?: string;
|
|
9
|
+
env?: ProxyEnv;
|
|
10
|
+
middleware?: MiddlewareHandler | MiddlewareHandler[];
|
|
11
|
+
exposeErrors?: boolean;
|
|
12
|
+
bodyLimit?: number;
|
|
13
|
+
routes?: {
|
|
14
|
+
allow?: string[];
|
|
15
|
+
deny?: string[];
|
|
16
|
+
};
|
|
17
|
+
pages?: {
|
|
18
|
+
root?: boolean;
|
|
19
|
+
docs?: boolean;
|
|
20
|
+
openapi?: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type ProxyApp = {
|
|
24
|
+
app: OpenAPIHono;
|
|
25
|
+
boss: PgBoss;
|
|
26
|
+
prefix: string;
|
|
27
|
+
};
|
|
28
|
+
type ProxyService = ProxyApp & {
|
|
29
|
+
start: () => Promise<void>;
|
|
30
|
+
stop: () => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
export declare const createProxyApp: (options: ProxyOptions) => ProxyApp;
|
|
33
|
+
export declare const createProxyService: (options: ProxyOptions) => ProxyService;
|
|
34
|
+
export { bossMethodNames, bossMethodInfos } from './routes.js';
|
|
35
|
+
export { configureAuth } from './auth.js';
|
|
36
|
+
export { attachShutdownListeners, nodeShutdownAdapter, bunShutdownAdapter, createDenoShutdownAdapter } from './shutdown.js';
|
|
37
|
+
export type { ProxyApp, ProxyOptions, ProxyService };
|
|
38
|
+
export type { ShutdownHandler, ShutdownAdapter } from './shutdown.js';
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAA;AAG5D,OAAO,EACL,MAAM,EAIN,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAW,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAWtD,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;AAElD,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,kBAAkB,CAAA;IAC5B,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,MAAM,CAAA;IACrD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,QAAQ,CAAA;IACd,UAAU,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,EAAE,CAAA;IACpD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;QAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;IACD,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;CACF,CAAA;AAED,KAAK,QAAQ,GAAG;IACd,GAAG,EAAE,WAAW,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,KAAK,YAAY,GAAG,QAAQ,GAAG;IAC7B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1B,CAAA;AAuBD,eAAO,MAAM,cAAc,GAAI,SAAS,YAAY,KAAG,QAmQtD,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,SAAS,YAAY,KAAG,YAW1D,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,eAAe,CAAA;AAEtB,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA;AACpD,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA"}
|