@delta-base/core 1.2.9 → 1.2.11

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/dist/index.d.ts CHANGED
@@ -1,247 +1,564 @@
1
1
  import * as hono_hono_base from 'hono/hono-base';
2
2
  import * as hono_utils_http_status from 'hono/utils/http-status';
3
3
  import * as hono_types from 'hono/types';
4
- import { z, OpenAPIHono } from '@hono/zod-openapi';
4
+ import { OpenAPIHono, z } from '@hono/zod-openapi';
5
5
  import { DurableObject } from 'cloudflare:workers';
6
6
  import * as _delta_base_toolkit from '@delta-base/toolkit';
7
7
  import { Event, AppendToStreamOptions, ReadStreamOptions, ReadEvent } from '@delta-base/toolkit';
8
8
 
9
- declare namespace ManagementAPI {
10
- const EventStoreSchema: z.ZodObject<{
11
- eventStoreId: z.ZodString;
12
- eventStoreName: z.ZodString;
13
- eventStoreDurableObjectId: z.ZodString;
14
- eventBusDurableObjectId: z.ZodString;
15
- description: z.ZodOptional<z.ZodString>;
16
- settings: z.ZodOptional<z.ZodObject<{
17
- retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
18
- maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
9
+ declare namespace EventBusAPI {
10
+ const routes: OpenAPIHono<{
11
+ Bindings: Env;
12
+ }, {}, "/">;
13
+ const SubscriberTypeEnum: z.ZodEnum<["durable_object", "webhook", "queue", "cloudflare_workflow", "websocket"]>;
14
+ const SubscriptionStatusEnum: z.ZodEnum<["ACTIVE", "SUSPENDED", "ERROR", "INITIALIZING", "DELETED"]>;
15
+ const SubscriptionRequestSchema: z.ZodObject<{
16
+ eventFilter: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"*">, z.ZodString, z.ZodString, z.ZodString]>, z.ZodArray<z.ZodUnion<[z.ZodLiteral<"*">, z.ZodString, z.ZodString, z.ZodString]>, "many">]>;
17
+ subscriberId: z.ZodOptional<z.ZodString>;
18
+ subscriber: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
19
+ type: z.ZodLiteral<"durable_object">;
20
+ config: z.ZodObject<{
21
+ retryPolicy: z.ZodOptional<z.ZodObject<{
22
+ maxAttempts: z.ZodNumber;
23
+ backoffMinutes: z.ZodNumber;
24
+ }, "strip", z.ZodTypeAny, {
25
+ maxAttempts: number;
26
+ backoffMinutes: number;
27
+ }, {
28
+ maxAttempts: number;
29
+ backoffMinutes: number;
30
+ }>>;
31
+ } & {
32
+ namespace: z.ZodString;
33
+ id: z.ZodString;
34
+ }, "strip", z.ZodTypeAny, {
35
+ namespace: string;
36
+ id: string;
37
+ retryPolicy?: {
38
+ maxAttempts: number;
39
+ backoffMinutes: number;
40
+ } | undefined;
41
+ }, {
42
+ namespace: string;
43
+ id: string;
44
+ retryPolicy?: {
45
+ maxAttempts: number;
46
+ backoffMinutes: number;
47
+ } | undefined;
48
+ }>;
19
49
  }, "strip", z.ZodTypeAny, {
20
- retentionPeriodDays?: number | undefined;
21
- maxStreamSizeBytes?: number | undefined;
50
+ type: "durable_object";
51
+ config: {
52
+ namespace: string;
53
+ id: string;
54
+ retryPolicy?: {
55
+ maxAttempts: number;
56
+ backoffMinutes: number;
57
+ } | undefined;
58
+ };
22
59
  }, {
23
- retentionPeriodDays?: number | undefined;
24
- maxStreamSizeBytes?: number | undefined;
25
- }>>;
26
- created: z.ZodString;
27
- }, "strip", z.ZodTypeAny, {
28
- eventStoreId: string;
29
- created: string;
30
- eventStoreName: string;
31
- eventStoreDurableObjectId: string;
32
- eventBusDurableObjectId: string;
33
- description?: string | undefined;
34
- settings?: {
35
- retentionPeriodDays?: number | undefined;
36
- maxStreamSizeBytes?: number | undefined;
37
- } | undefined;
38
- }, {
39
- eventStoreId: string;
40
- created: string;
41
- eventStoreName: string;
42
- eventStoreDurableObjectId: string;
43
- eventBusDurableObjectId: string;
44
- description?: string | undefined;
45
- settings?: {
46
- retentionPeriodDays?: number | undefined;
47
- maxStreamSizeBytes?: number | undefined;
48
- } | undefined;
49
- }>;
50
- const CreateEventStoreRequestSchema: z.ZodObject<{
51
- name: z.ZodString;
52
- description: z.ZodOptional<z.ZodString>;
53
- settings: z.ZodOptional<z.ZodObject<{
54
- retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
55
- maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
60
+ type: "durable_object";
61
+ config: {
62
+ namespace: string;
63
+ id: string;
64
+ retryPolicy?: {
65
+ maxAttempts: number;
66
+ backoffMinutes: number;
67
+ } | undefined;
68
+ };
69
+ }>, z.ZodObject<{
70
+ type: z.ZodLiteral<"webhook">;
71
+ config: z.ZodObject<{
72
+ retryPolicy: z.ZodOptional<z.ZodObject<{
73
+ maxAttempts: z.ZodNumber;
74
+ backoffMinutes: z.ZodNumber;
75
+ }, "strip", z.ZodTypeAny, {
76
+ maxAttempts: number;
77
+ backoffMinutes: number;
78
+ }, {
79
+ maxAttempts: number;
80
+ backoffMinutes: number;
81
+ }>>;
82
+ } & {
83
+ url: z.ZodString;
84
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
85
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
86
+ }, "strip", z.ZodTypeAny, {
87
+ url: string;
88
+ headers?: Record<string, string> | undefined;
89
+ retryPolicy?: {
90
+ maxAttempts: number;
91
+ backoffMinutes: number;
92
+ } | undefined;
93
+ timeoutMs?: number | undefined;
94
+ }, {
95
+ url: string;
96
+ headers?: Record<string, string> | undefined;
97
+ retryPolicy?: {
98
+ maxAttempts: number;
99
+ backoffMinutes: number;
100
+ } | undefined;
101
+ timeoutMs?: number | undefined;
102
+ }>;
56
103
  }, "strip", z.ZodTypeAny, {
57
- retentionPeriodDays?: number | undefined;
58
- maxStreamSizeBytes?: number | undefined;
104
+ type: "webhook";
105
+ config: {
106
+ url: string;
107
+ headers?: Record<string, string> | undefined;
108
+ retryPolicy?: {
109
+ maxAttempts: number;
110
+ backoffMinutes: number;
111
+ } | undefined;
112
+ timeoutMs?: number | undefined;
113
+ };
59
114
  }, {
60
- retentionPeriodDays?: number | undefined;
61
- maxStreamSizeBytes?: number | undefined;
62
- }>>;
63
- }, "strip", z.ZodTypeAny, {
64
- name: string;
65
- description?: string | undefined;
66
- settings?: {
67
- retentionPeriodDays?: number | undefined;
68
- maxStreamSizeBytes?: number | undefined;
69
- } | undefined;
70
- }, {
71
- name: string;
72
- description?: string | undefined;
73
- settings?: {
74
- retentionPeriodDays?: number | undefined;
75
- maxStreamSizeBytes?: number | undefined;
76
- } | undefined;
77
- }>;
78
- const EventStoreListResponseSchema: z.ZodObject<{
79
- eventStores: z.ZodArray<z.ZodObject<{
80
- eventStoreId: z.ZodString;
81
- eventStoreName: z.ZodString;
82
- eventStoreDurableObjectId: z.ZodString;
83
- eventBusDurableObjectId: z.ZodString;
84
- description: z.ZodOptional<z.ZodString>;
85
- settings: z.ZodOptional<z.ZodObject<{
86
- retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
87
- maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
115
+ type: "webhook";
116
+ config: {
117
+ url: string;
118
+ headers?: Record<string, string> | undefined;
119
+ retryPolicy?: {
120
+ maxAttempts: number;
121
+ backoffMinutes: number;
122
+ } | undefined;
123
+ timeoutMs?: number | undefined;
124
+ };
125
+ }>, z.ZodObject<{
126
+ type: z.ZodLiteral<"queue">;
127
+ config: z.ZodObject<{
128
+ retryPolicy: z.ZodOptional<z.ZodObject<{
129
+ maxAttempts: z.ZodNumber;
130
+ backoffMinutes: z.ZodNumber;
131
+ }, "strip", z.ZodTypeAny, {
132
+ maxAttempts: number;
133
+ backoffMinutes: number;
134
+ }, {
135
+ maxAttempts: number;
136
+ backoffMinutes: number;
137
+ }>>;
138
+ } & {
139
+ queueName: z.ZodString;
140
+ region: z.ZodOptional<z.ZodString>;
141
+ batchSize: z.ZodOptional<z.ZodNumber>;
88
142
  }, "strip", z.ZodTypeAny, {
89
- retentionPeriodDays?: number | undefined;
90
- maxStreamSizeBytes?: number | undefined;
143
+ queueName: string;
144
+ retryPolicy?: {
145
+ maxAttempts: number;
146
+ backoffMinutes: number;
147
+ } | undefined;
148
+ region?: string | undefined;
149
+ batchSize?: number | undefined;
91
150
  }, {
92
- retentionPeriodDays?: number | undefined;
93
- maxStreamSizeBytes?: number | undefined;
94
- }>>;
95
- created: z.ZodString;
151
+ queueName: string;
152
+ retryPolicy?: {
153
+ maxAttempts: number;
154
+ backoffMinutes: number;
155
+ } | undefined;
156
+ region?: string | undefined;
157
+ batchSize?: number | undefined;
158
+ }>;
96
159
  }, "strip", z.ZodTypeAny, {
97
- eventStoreId: string;
98
- created: string;
99
- eventStoreName: string;
100
- eventStoreDurableObjectId: string;
101
- eventBusDurableObjectId: string;
102
- description?: string | undefined;
103
- settings?: {
104
- retentionPeriodDays?: number | undefined;
105
- maxStreamSizeBytes?: number | undefined;
106
- } | undefined;
160
+ type: "queue";
161
+ config: {
162
+ queueName: string;
163
+ retryPolicy?: {
164
+ maxAttempts: number;
165
+ backoffMinutes: number;
166
+ } | undefined;
167
+ region?: string | undefined;
168
+ batchSize?: number | undefined;
169
+ };
107
170
  }, {
108
- eventStoreId: string;
109
- created: string;
110
- eventStoreName: string;
111
- eventStoreDurableObjectId: string;
112
- eventBusDurableObjectId: string;
113
- description?: string | undefined;
114
- settings?: {
115
- retentionPeriodDays?: number | undefined;
116
- maxStreamSizeBytes?: number | undefined;
117
- } | undefined;
118
- }>, "many">;
119
- totalCount: z.ZodNumber;
120
- }, "strip", z.ZodTypeAny, {
121
- totalCount: number;
122
- eventStores: {
123
- eventStoreId: string;
124
- created: string;
125
- eventStoreName: string;
126
- eventStoreDurableObjectId: string;
127
- eventBusDurableObjectId: string;
128
- description?: string | undefined;
129
- settings?: {
130
- retentionPeriodDays?: number | undefined;
131
- maxStreamSizeBytes?: number | undefined;
132
- } | undefined;
133
- }[];
134
- }, {
135
- totalCount: number;
136
- eventStores: {
137
- eventStoreId: string;
138
- created: string;
139
- eventStoreName: string;
140
- eventStoreDurableObjectId: string;
141
- eventBusDurableObjectId: string;
142
- description?: string | undefined;
143
- settings?: {
144
- retentionPeriodDays?: number | undefined;
145
- maxStreamSizeBytes?: number | undefined;
146
- } | undefined;
147
- }[];
148
- }>;
149
- const EventStoreDatabaseSizesSchema: z.ZodObject<{
150
- eventStoreDatabaseSize: z.ZodNumber;
151
- eventBusDatabaseSize: z.ZodNumber;
152
- totalSize: z.ZodNumber;
153
- }, "strip", z.ZodTypeAny, {
154
- eventStoreDatabaseSize: number;
155
- eventBusDatabaseSize: number;
156
- totalSize: number;
157
- }, {
158
- eventStoreDatabaseSize: number;
159
- eventBusDatabaseSize: number;
160
- totalSize: number;
161
- }>;
162
- const EventStoreDetailsResponseSchema: z.ZodObject<{
163
- eventStoreId: z.ZodString;
164
- eventStoreName: z.ZodString;
165
- eventStoreDurableObjectId: z.ZodString;
166
- eventBusDurableObjectId: z.ZodString;
167
- description: z.ZodOptional<z.ZodString>;
168
- settings: z.ZodOptional<z.ZodObject<{
169
- retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
170
- maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
171
- }, "strip", z.ZodTypeAny, {
172
- retentionPeriodDays?: number | undefined;
173
- maxStreamSizeBytes?: number | undefined;
174
- }, {
175
- retentionPeriodDays?: number | undefined;
176
- maxStreamSizeBytes?: number | undefined;
177
- }>>;
178
- created: z.ZodString;
179
- } & {
180
- streams: z.ZodOptional<z.ZodObject<{
181
- count: z.ZodNumber;
182
- totalEvents: z.ZodNumber;
171
+ type: "queue";
172
+ config: {
173
+ queueName: string;
174
+ retryPolicy?: {
175
+ maxAttempts: number;
176
+ backoffMinutes: number;
177
+ } | undefined;
178
+ region?: string | undefined;
179
+ batchSize?: number | undefined;
180
+ };
181
+ }>, z.ZodObject<{
182
+ type: z.ZodLiteral<"cloudflare_workflow">;
183
+ config: z.ZodObject<{
184
+ retryPolicy: z.ZodOptional<z.ZodObject<{
185
+ maxAttempts: z.ZodNumber;
186
+ backoffMinutes: z.ZodNumber;
187
+ }, "strip", z.ZodTypeAny, {
188
+ maxAttempts: number;
189
+ backoffMinutes: number;
190
+ }, {
191
+ maxAttempts: number;
192
+ backoffMinutes: number;
193
+ }>>;
194
+ } & {
195
+ bindingName: z.ZodString;
196
+ }, "strip", z.ZodTypeAny, {
197
+ bindingName: string;
198
+ retryPolicy?: {
199
+ maxAttempts: number;
200
+ backoffMinutes: number;
201
+ } | undefined;
202
+ }, {
203
+ bindingName: string;
204
+ retryPolicy?: {
205
+ maxAttempts: number;
206
+ backoffMinutes: number;
207
+ } | undefined;
208
+ }>;
183
209
  }, "strip", z.ZodTypeAny, {
184
- count: number;
185
- totalEvents: number;
210
+ type: "cloudflare_workflow";
211
+ config: {
212
+ bindingName: string;
213
+ retryPolicy?: {
214
+ maxAttempts: number;
215
+ backoffMinutes: number;
216
+ } | undefined;
217
+ };
186
218
  }, {
187
- count: number;
188
- totalEvents: number;
189
- }>>;
190
- databaseSizes: z.ZodOptional<z.ZodObject<{
191
- eventStoreDatabaseSize: z.ZodNumber;
192
- eventBusDatabaseSize: z.ZodNumber;
193
- totalSize: z.ZodNumber;
219
+ type: "cloudflare_workflow";
220
+ config: {
221
+ bindingName: string;
222
+ retryPolicy?: {
223
+ maxAttempts: number;
224
+ backoffMinutes: number;
225
+ } | undefined;
226
+ };
227
+ }>, z.ZodObject<{
228
+ type: z.ZodLiteral<"websocket">;
229
+ config: z.ZodObject<{
230
+ retryPolicy: z.ZodOptional<z.ZodObject<{
231
+ maxAttempts: z.ZodNumber;
232
+ backoffMinutes: z.ZodNumber;
233
+ }, "strip", z.ZodTypeAny, {
234
+ maxAttempts: number;
235
+ backoffMinutes: number;
236
+ }, {
237
+ maxAttempts: number;
238
+ backoffMinutes: number;
239
+ }>>;
240
+ } & {
241
+ managerId: z.ZodString;
242
+ }, "strip", z.ZodTypeAny, {
243
+ managerId: string;
244
+ retryPolicy?: {
245
+ maxAttempts: number;
246
+ backoffMinutes: number;
247
+ } | undefined;
248
+ }, {
249
+ managerId: string;
250
+ retryPolicy?: {
251
+ maxAttempts: number;
252
+ backoffMinutes: number;
253
+ } | undefined;
254
+ }>;
194
255
  }, "strip", z.ZodTypeAny, {
195
- eventStoreDatabaseSize: number;
196
- eventBusDatabaseSize: number;
197
- totalSize: number;
256
+ type: "websocket";
257
+ config: {
258
+ managerId: string;
259
+ retryPolicy?: {
260
+ maxAttempts: number;
261
+ backoffMinutes: number;
262
+ } | undefined;
263
+ };
198
264
  }, {
199
- eventStoreDatabaseSize: number;
200
- eventBusDatabaseSize: number;
201
- totalSize: number;
202
- }>>;
265
+ type: "websocket";
266
+ config: {
267
+ managerId: string;
268
+ retryPolicy?: {
269
+ maxAttempts: number;
270
+ backoffMinutes: number;
271
+ } | undefined;
272
+ };
273
+ }>]>;
274
+ initialPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<["latest", "earliest"]>>>;
203
275
  }, "strip", z.ZodTypeAny, {
204
- eventStoreId: string;
205
- created: string;
206
- eventStoreName: string;
207
- eventStoreDurableObjectId: string;
208
- eventBusDurableObjectId: string;
209
- description?: string | undefined;
210
- streams?: {
211
- count: number;
212
- totalEvents: number;
213
- } | undefined;
214
- settings?: {
215
- retentionPeriodDays?: number | undefined;
216
- maxStreamSizeBytes?: number | undefined;
217
- } | undefined;
218
- databaseSizes?: {
219
- eventStoreDatabaseSize: number;
220
- eventBusDatabaseSize: number;
221
- totalSize: number;
222
- } | undefined;
276
+ eventFilter: string | string[];
277
+ subscriber: {
278
+ type: "durable_object";
279
+ config: {
280
+ namespace: string;
281
+ id: string;
282
+ retryPolicy?: {
283
+ maxAttempts: number;
284
+ backoffMinutes: number;
285
+ } | undefined;
286
+ };
287
+ } | {
288
+ type: "webhook";
289
+ config: {
290
+ url: string;
291
+ headers?: Record<string, string> | undefined;
292
+ retryPolicy?: {
293
+ maxAttempts: number;
294
+ backoffMinutes: number;
295
+ } | undefined;
296
+ timeoutMs?: number | undefined;
297
+ };
298
+ } | {
299
+ type: "queue";
300
+ config: {
301
+ queueName: string;
302
+ retryPolicy?: {
303
+ maxAttempts: number;
304
+ backoffMinutes: number;
305
+ } | undefined;
306
+ region?: string | undefined;
307
+ batchSize?: number | undefined;
308
+ };
309
+ } | {
310
+ type: "cloudflare_workflow";
311
+ config: {
312
+ bindingName: string;
313
+ retryPolicy?: {
314
+ maxAttempts: number;
315
+ backoffMinutes: number;
316
+ } | undefined;
317
+ };
318
+ } | {
319
+ type: "websocket";
320
+ config: {
321
+ managerId: string;
322
+ retryPolicy?: {
323
+ maxAttempts: number;
324
+ backoffMinutes: number;
325
+ } | undefined;
326
+ };
327
+ };
328
+ initialPosition: "latest" | "earliest";
329
+ subscriberId?: string | undefined;
223
330
  }, {
224
- eventStoreId: string;
225
- created: string;
226
- eventStoreName: string;
227
- eventStoreDurableObjectId: string;
228
- eventBusDurableObjectId: string;
229
- description?: string | undefined;
230
- streams?: {
231
- count: number;
232
- totalEvents: number;
233
- } | undefined;
234
- settings?: {
235
- retentionPeriodDays?: number | undefined;
236
- maxStreamSizeBytes?: number | undefined;
331
+ eventFilter: string | string[];
332
+ subscriber: {
333
+ type: "durable_object";
334
+ config: {
335
+ namespace: string;
336
+ id: string;
337
+ retryPolicy?: {
338
+ maxAttempts: number;
339
+ backoffMinutes: number;
340
+ } | undefined;
341
+ };
342
+ } | {
343
+ type: "webhook";
344
+ config: {
345
+ url: string;
346
+ headers?: Record<string, string> | undefined;
347
+ retryPolicy?: {
348
+ maxAttempts: number;
349
+ backoffMinutes: number;
350
+ } | undefined;
351
+ timeoutMs?: number | undefined;
352
+ };
353
+ } | {
354
+ type: "queue";
355
+ config: {
356
+ queueName: string;
357
+ retryPolicy?: {
358
+ maxAttempts: number;
359
+ backoffMinutes: number;
360
+ } | undefined;
361
+ region?: string | undefined;
362
+ batchSize?: number | undefined;
363
+ };
364
+ } | {
365
+ type: "cloudflare_workflow";
366
+ config: {
367
+ bindingName: string;
368
+ retryPolicy?: {
369
+ maxAttempts: number;
370
+ backoffMinutes: number;
371
+ } | undefined;
372
+ };
373
+ } | {
374
+ type: "websocket";
375
+ config: {
376
+ managerId: string;
377
+ retryPolicy?: {
378
+ maxAttempts: number;
379
+ backoffMinutes: number;
380
+ } | undefined;
381
+ };
382
+ };
383
+ subscriberId?: string | undefined;
384
+ initialPosition?: "latest" | "earliest" | undefined;
385
+ }>;
386
+ const SubscriptionResponseSchema: z.ZodObject<{
387
+ subscriptionId: z.ZodString;
388
+ status: z.ZodEnum<["ACTIVE", "SUSPENDED", "ERROR", "INITIALIZING", "DELETED"]>;
389
+ statusDetails: z.ZodOptional<z.ZodObject<{
390
+ lastError: z.ZodOptional<z.ZodString>;
391
+ lastErrorAt: z.ZodOptional<z.ZodString>;
392
+ retryCount: z.ZodOptional<z.ZodNumber>;
393
+ nextRetryAt: z.ZodOptional<z.ZodString>;
394
+ }, "strip", z.ZodTypeAny, {
395
+ lastError?: string | undefined;
396
+ lastErrorAt?: string | undefined;
397
+ retryCount?: number | undefined;
398
+ nextRetryAt?: string | undefined;
399
+ }, {
400
+ lastError?: string | undefined;
401
+ lastErrorAt?: string | undefined;
402
+ retryCount?: number | undefined;
403
+ nextRetryAt?: string | undefined;
404
+ }>>;
405
+ eventStoreId: z.ZodString;
406
+ eventFilter: z.ZodString;
407
+ subscriberId: z.ZodString;
408
+ subscriberType: z.ZodEnum<["durable_object", "webhook", "queue", "cloudflare_workflow", "websocket"]>;
409
+ createdAt: z.ZodString;
410
+ updatedAt: z.ZodString;
411
+ lastProcessedEventGlobalPosition: z.ZodOptional<z.ZodNumber>;
412
+ isExistingSubscription: z.ZodOptional<z.ZodBoolean>;
413
+ message: z.ZodOptional<z.ZodString>;
414
+ }, "strip", z.ZodTypeAny, {
415
+ status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
416
+ eventFilter: string;
417
+ subscriberId: string;
418
+ subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
419
+ createdAt: string;
420
+ updatedAt: string;
421
+ eventStoreId: string;
422
+ subscriptionId: string;
423
+ isExistingSubscription?: boolean | undefined;
424
+ message?: string | undefined;
425
+ statusDetails?: {
426
+ lastError?: string | undefined;
427
+ lastErrorAt?: string | undefined;
428
+ retryCount?: number | undefined;
429
+ nextRetryAt?: string | undefined;
237
430
  } | undefined;
238
- databaseSizes?: {
239
- eventStoreDatabaseSize: number;
240
- eventBusDatabaseSize: number;
241
- totalSize: number;
431
+ lastProcessedEventGlobalPosition?: number | undefined;
432
+ }, {
433
+ status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
434
+ eventFilter: string;
435
+ subscriberId: string;
436
+ subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
437
+ createdAt: string;
438
+ updatedAt: string;
439
+ eventStoreId: string;
440
+ subscriptionId: string;
441
+ isExistingSubscription?: boolean | undefined;
442
+ message?: string | undefined;
443
+ statusDetails?: {
444
+ lastError?: string | undefined;
445
+ lastErrorAt?: string | undefined;
446
+ retryCount?: number | undefined;
447
+ nextRetryAt?: string | undefined;
242
448
  } | undefined;
449
+ lastProcessedEventGlobalPosition?: number | undefined;
243
450
  }>;
244
- const ErrorResponseSchema: z.ZodObject<{
451
+ const SubscriptionListResponseSchema: z.ZodObject<{
452
+ subscriptions: z.ZodArray<z.ZodObject<{
453
+ subscriptionId: z.ZodString;
454
+ status: z.ZodEnum<["ACTIVE", "SUSPENDED", "ERROR", "INITIALIZING", "DELETED"]>;
455
+ statusDetails: z.ZodOptional<z.ZodObject<{
456
+ lastError: z.ZodOptional<z.ZodString>;
457
+ lastErrorAt: z.ZodOptional<z.ZodString>;
458
+ retryCount: z.ZodOptional<z.ZodNumber>;
459
+ nextRetryAt: z.ZodOptional<z.ZodString>;
460
+ }, "strip", z.ZodTypeAny, {
461
+ lastError?: string | undefined;
462
+ lastErrorAt?: string | undefined;
463
+ retryCount?: number | undefined;
464
+ nextRetryAt?: string | undefined;
465
+ }, {
466
+ lastError?: string | undefined;
467
+ lastErrorAt?: string | undefined;
468
+ retryCount?: number | undefined;
469
+ nextRetryAt?: string | undefined;
470
+ }>>;
471
+ eventStoreId: z.ZodString;
472
+ eventFilter: z.ZodString;
473
+ subscriberId: z.ZodString;
474
+ subscriberType: z.ZodEnum<["durable_object", "webhook", "queue", "cloudflare_workflow", "websocket"]>;
475
+ createdAt: z.ZodString;
476
+ updatedAt: z.ZodString;
477
+ lastProcessedEventGlobalPosition: z.ZodOptional<z.ZodNumber>;
478
+ isExistingSubscription: z.ZodOptional<z.ZodBoolean>;
479
+ message: z.ZodOptional<z.ZodString>;
480
+ }, "strip", z.ZodTypeAny, {
481
+ status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
482
+ eventFilter: string;
483
+ subscriberId: string;
484
+ subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
485
+ createdAt: string;
486
+ updatedAt: string;
487
+ eventStoreId: string;
488
+ subscriptionId: string;
489
+ isExistingSubscription?: boolean | undefined;
490
+ message?: string | undefined;
491
+ statusDetails?: {
492
+ lastError?: string | undefined;
493
+ lastErrorAt?: string | undefined;
494
+ retryCount?: number | undefined;
495
+ nextRetryAt?: string | undefined;
496
+ } | undefined;
497
+ lastProcessedEventGlobalPosition?: number | undefined;
498
+ }, {
499
+ status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
500
+ eventFilter: string;
501
+ subscriberId: string;
502
+ subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
503
+ createdAt: string;
504
+ updatedAt: string;
505
+ eventStoreId: string;
506
+ subscriptionId: string;
507
+ isExistingSubscription?: boolean | undefined;
508
+ message?: string | undefined;
509
+ statusDetails?: {
510
+ lastError?: string | undefined;
511
+ lastErrorAt?: string | undefined;
512
+ retryCount?: number | undefined;
513
+ nextRetryAt?: string | undefined;
514
+ } | undefined;
515
+ lastProcessedEventGlobalPosition?: number | undefined;
516
+ }>, "many">;
517
+ totalCount: z.ZodNumber;
518
+ }, "strip", z.ZodTypeAny, {
519
+ totalCount: number;
520
+ subscriptions: {
521
+ status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
522
+ eventFilter: string;
523
+ subscriberId: string;
524
+ subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
525
+ createdAt: string;
526
+ updatedAt: string;
527
+ eventStoreId: string;
528
+ subscriptionId: string;
529
+ isExistingSubscription?: boolean | undefined;
530
+ message?: string | undefined;
531
+ statusDetails?: {
532
+ lastError?: string | undefined;
533
+ lastErrorAt?: string | undefined;
534
+ retryCount?: number | undefined;
535
+ nextRetryAt?: string | undefined;
536
+ } | undefined;
537
+ lastProcessedEventGlobalPosition?: number | undefined;
538
+ }[];
539
+ }, {
540
+ totalCount: number;
541
+ subscriptions: {
542
+ status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
543
+ eventFilter: string;
544
+ subscriberId: string;
545
+ subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
546
+ createdAt: string;
547
+ updatedAt: string;
548
+ eventStoreId: string;
549
+ subscriptionId: string;
550
+ isExistingSubscription?: boolean | undefined;
551
+ message?: string | undefined;
552
+ statusDetails?: {
553
+ lastError?: string | undefined;
554
+ lastErrorAt?: string | undefined;
555
+ retryCount?: number | undefined;
556
+ nextRetryAt?: string | undefined;
557
+ } | undefined;
558
+ lastProcessedEventGlobalPosition?: number | undefined;
559
+ }[];
560
+ }>;
561
+ const SubscriptionErrorSchema: z.ZodObject<{
245
562
  error: z.ZodString;
246
563
  message: z.ZodString;
247
564
  details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -254,10 +571,6 @@ declare namespace ManagementAPI {
254
571
  message: string;
255
572
  details?: Record<string, any> | undefined;
256
573
  }>;
257
- const routes: OpenAPIHono<{
258
- Bindings: Env;
259
- }, {}, "/">;
260
- type ManagementAPIType = typeof routes;
261
574
  }
262
575
 
263
576
  declare namespace EventStoreAPI {
@@ -780,598 +1093,297 @@ declare namespace EventStoreAPI {
780
1093
  hasMore: boolean;
781
1094
  total?: number | undefined;
782
1095
  }, {
783
- limit: number;
784
- offset: number;
785
- hasMore: boolean;
786
- total?: number | undefined;
787
- }>;
788
- }, "strip", z.ZodTypeAny, {
789
- pagination: {
790
- limit: number;
791
- offset: number;
792
- hasMore: boolean;
793
- total?: number | undefined;
794
- };
795
- streams: {
796
- createdAt: string;
797
- updatedAt: string;
798
- streamPosition: number;
799
- streamId: string;
800
- streamType: string;
801
- isArchived: boolean;
802
- lastArchivedPosition: number;
803
- streamMetadata?: Record<string, unknown> | undefined;
804
- }[];
805
- }, {
806
- pagination: {
807
- limit: number;
808
- offset: number;
809
- hasMore: boolean;
810
- total?: number | undefined;
811
- };
812
- streams: {
813
- createdAt: string;
814
- updatedAt: string;
815
- streamPosition: number;
816
- streamId: string;
817
- streamType: string;
818
- isArchived: boolean;
819
- lastArchivedPosition: number;
820
- streamMetadata?: Record<string, unknown> | undefined;
821
- }[];
822
- }>;
823
- export type QueryEventsParams = z.infer<typeof QueryEventsParamsSchema>;
824
- export type QueryStreamsParams = z.infer<typeof QueryStreamsParamsSchema>;
825
- export type QueryEventsResponse = {
826
- events: z.infer<typeof EventSchema>[];
827
- pagination: z.infer<typeof PaginationSchema>;
828
- };
829
- export type QueryStreamsResponse = z.infer<typeof QueryStreamsResponseSchema>;
830
- export type Stream = z.infer<typeof StreamSchema>;
831
- export type ReadEvent = z.infer<typeof EventSchema>;
832
- export const routes: OpenAPIHono<{
833
- Bindings: Env;
834
- }, {}, "/">;
835
- export { };
836
- }
837
-
838
- declare namespace EventBusAPI {
839
- const routes: OpenAPIHono<{
840
- Bindings: Env;
841
- }, {}, "/">;
842
- const SubscriberTypeEnum: z.ZodEnum<["durable_object", "webhook", "queue", "cloudflare_workflow", "websocket"]>;
843
- const SubscriptionStatusEnum: z.ZodEnum<["ACTIVE", "SUSPENDED", "ERROR", "INITIALIZING", "DELETED"]>;
844
- const SubscriptionRequestSchema: z.ZodObject<{
845
- eventFilter: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"*">, z.ZodString, z.ZodString, z.ZodString]>, z.ZodArray<z.ZodUnion<[z.ZodLiteral<"*">, z.ZodString, z.ZodString, z.ZodString]>, "many">]>;
846
- subscriberId: z.ZodOptional<z.ZodString>;
847
- subscriber: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
848
- type: z.ZodLiteral<"durable_object">;
849
- config: z.ZodObject<{
850
- retryPolicy: z.ZodOptional<z.ZodObject<{
851
- maxAttempts: z.ZodNumber;
852
- backoffMinutes: z.ZodNumber;
853
- }, "strip", z.ZodTypeAny, {
854
- maxAttempts: number;
855
- backoffMinutes: number;
856
- }, {
857
- maxAttempts: number;
858
- backoffMinutes: number;
859
- }>>;
860
- } & {
861
- namespace: z.ZodString;
862
- id: z.ZodString;
863
- }, "strip", z.ZodTypeAny, {
864
- namespace: string;
865
- id: string;
866
- retryPolicy?: {
867
- maxAttempts: number;
868
- backoffMinutes: number;
869
- } | undefined;
870
- }, {
871
- namespace: string;
872
- id: string;
873
- retryPolicy?: {
874
- maxAttempts: number;
875
- backoffMinutes: number;
876
- } | undefined;
877
- }>;
878
- }, "strip", z.ZodTypeAny, {
879
- type: "durable_object";
880
- config: {
881
- namespace: string;
882
- id: string;
883
- retryPolicy?: {
884
- maxAttempts: number;
885
- backoffMinutes: number;
886
- } | undefined;
887
- };
888
- }, {
889
- type: "durable_object";
890
- config: {
891
- namespace: string;
892
- id: string;
893
- retryPolicy?: {
894
- maxAttempts: number;
895
- backoffMinutes: number;
896
- } | undefined;
897
- };
898
- }>, z.ZodObject<{
899
- type: z.ZodLiteral<"webhook">;
900
- config: z.ZodObject<{
901
- retryPolicy: z.ZodOptional<z.ZodObject<{
902
- maxAttempts: z.ZodNumber;
903
- backoffMinutes: z.ZodNumber;
904
- }, "strip", z.ZodTypeAny, {
905
- maxAttempts: number;
906
- backoffMinutes: number;
907
- }, {
908
- maxAttempts: number;
909
- backoffMinutes: number;
910
- }>>;
911
- } & {
912
- url: z.ZodString;
913
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
914
- timeoutMs: z.ZodOptional<z.ZodNumber>;
915
- }, "strip", z.ZodTypeAny, {
916
- url: string;
917
- headers?: Record<string, string> | undefined;
918
- retryPolicy?: {
919
- maxAttempts: number;
920
- backoffMinutes: number;
921
- } | undefined;
922
- timeoutMs?: number | undefined;
923
- }, {
924
- url: string;
925
- headers?: Record<string, string> | undefined;
926
- retryPolicy?: {
927
- maxAttempts: number;
928
- backoffMinutes: number;
929
- } | undefined;
930
- timeoutMs?: number | undefined;
931
- }>;
932
- }, "strip", z.ZodTypeAny, {
933
- type: "webhook";
934
- config: {
935
- url: string;
936
- headers?: Record<string, string> | undefined;
937
- retryPolicy?: {
938
- maxAttempts: number;
939
- backoffMinutes: number;
940
- } | undefined;
941
- timeoutMs?: number | undefined;
942
- };
943
- }, {
944
- type: "webhook";
945
- config: {
946
- url: string;
947
- headers?: Record<string, string> | undefined;
948
- retryPolicy?: {
949
- maxAttempts: number;
950
- backoffMinutes: number;
951
- } | undefined;
952
- timeoutMs?: number | undefined;
953
- };
954
- }>, z.ZodObject<{
955
- type: z.ZodLiteral<"queue">;
956
- config: z.ZodObject<{
957
- retryPolicy: z.ZodOptional<z.ZodObject<{
958
- maxAttempts: z.ZodNumber;
959
- backoffMinutes: z.ZodNumber;
960
- }, "strip", z.ZodTypeAny, {
961
- maxAttempts: number;
962
- backoffMinutes: number;
963
- }, {
964
- maxAttempts: number;
965
- backoffMinutes: number;
966
- }>>;
967
- } & {
968
- queueName: z.ZodString;
969
- region: z.ZodOptional<z.ZodString>;
970
- batchSize: z.ZodOptional<z.ZodNumber>;
971
- }, "strip", z.ZodTypeAny, {
972
- queueName: string;
973
- retryPolicy?: {
974
- maxAttempts: number;
975
- backoffMinutes: number;
976
- } | undefined;
977
- region?: string | undefined;
978
- batchSize?: number | undefined;
979
- }, {
980
- queueName: string;
981
- retryPolicy?: {
982
- maxAttempts: number;
983
- backoffMinutes: number;
984
- } | undefined;
985
- region?: string | undefined;
986
- batchSize?: number | undefined;
987
- }>;
988
- }, "strip", z.ZodTypeAny, {
989
- type: "queue";
990
- config: {
991
- queueName: string;
992
- retryPolicy?: {
993
- maxAttempts: number;
994
- backoffMinutes: number;
995
- } | undefined;
996
- region?: string | undefined;
997
- batchSize?: number | undefined;
998
- };
999
- }, {
1000
- type: "queue";
1001
- config: {
1002
- queueName: string;
1003
- retryPolicy?: {
1004
- maxAttempts: number;
1005
- backoffMinutes: number;
1006
- } | undefined;
1007
- region?: string | undefined;
1008
- batchSize?: number | undefined;
1009
- };
1010
- }>, z.ZodObject<{
1011
- type: z.ZodLiteral<"cloudflare_workflow">;
1012
- config: z.ZodObject<{
1013
- retryPolicy: z.ZodOptional<z.ZodObject<{
1014
- maxAttempts: z.ZodNumber;
1015
- backoffMinutes: z.ZodNumber;
1016
- }, "strip", z.ZodTypeAny, {
1017
- maxAttempts: number;
1018
- backoffMinutes: number;
1019
- }, {
1020
- maxAttempts: number;
1021
- backoffMinutes: number;
1022
- }>>;
1023
- } & {
1024
- bindingName: z.ZodString;
1025
- }, "strip", z.ZodTypeAny, {
1026
- bindingName: string;
1027
- retryPolicy?: {
1028
- maxAttempts: number;
1029
- backoffMinutes: number;
1030
- } | undefined;
1031
- }, {
1032
- bindingName: string;
1033
- retryPolicy?: {
1034
- maxAttempts: number;
1035
- backoffMinutes: number;
1036
- } | undefined;
1037
- }>;
1038
- }, "strip", z.ZodTypeAny, {
1039
- type: "cloudflare_workflow";
1040
- config: {
1041
- bindingName: string;
1042
- retryPolicy?: {
1043
- maxAttempts: number;
1044
- backoffMinutes: number;
1045
- } | undefined;
1046
- };
1047
- }, {
1048
- type: "cloudflare_workflow";
1049
- config: {
1050
- bindingName: string;
1051
- retryPolicy?: {
1052
- maxAttempts: number;
1053
- backoffMinutes: number;
1054
- } | undefined;
1055
- };
1056
- }>, z.ZodObject<{
1057
- type: z.ZodLiteral<"websocket">;
1058
- config: z.ZodObject<{
1059
- retryPolicy: z.ZodOptional<z.ZodObject<{
1060
- maxAttempts: z.ZodNumber;
1061
- backoffMinutes: z.ZodNumber;
1062
- }, "strip", z.ZodTypeAny, {
1063
- maxAttempts: number;
1064
- backoffMinutes: number;
1065
- }, {
1066
- maxAttempts: number;
1067
- backoffMinutes: number;
1068
- }>>;
1069
- } & {
1070
- managerId: z.ZodString;
1071
- }, "strip", z.ZodTypeAny, {
1072
- managerId: string;
1073
- retryPolicy?: {
1074
- maxAttempts: number;
1075
- backoffMinutes: number;
1076
- } | undefined;
1077
- }, {
1078
- managerId: string;
1079
- retryPolicy?: {
1080
- maxAttempts: number;
1081
- backoffMinutes: number;
1082
- } | undefined;
1083
- }>;
1084
- }, "strip", z.ZodTypeAny, {
1085
- type: "websocket";
1086
- config: {
1087
- managerId: string;
1088
- retryPolicy?: {
1089
- maxAttempts: number;
1090
- backoffMinutes: number;
1091
- } | undefined;
1092
- };
1093
- }, {
1094
- type: "websocket";
1095
- config: {
1096
- managerId: string;
1097
- retryPolicy?: {
1098
- maxAttempts: number;
1099
- backoffMinutes: number;
1100
- } | undefined;
1101
- };
1102
- }>]>;
1103
- initialPosition: z.ZodDefault<z.ZodOptional<z.ZodEnum<["latest", "earliest"]>>>;
1096
+ limit: number;
1097
+ offset: number;
1098
+ hasMore: boolean;
1099
+ total?: number | undefined;
1100
+ }>;
1104
1101
  }, "strip", z.ZodTypeAny, {
1105
- eventFilter: string | string[];
1106
- subscriber: {
1107
- type: "durable_object";
1108
- config: {
1109
- namespace: string;
1110
- id: string;
1111
- retryPolicy?: {
1112
- maxAttempts: number;
1113
- backoffMinutes: number;
1114
- } | undefined;
1115
- };
1116
- } | {
1117
- type: "webhook";
1118
- config: {
1119
- url: string;
1120
- headers?: Record<string, string> | undefined;
1121
- retryPolicy?: {
1122
- maxAttempts: number;
1123
- backoffMinutes: number;
1124
- } | undefined;
1125
- timeoutMs?: number | undefined;
1126
- };
1127
- } | {
1128
- type: "queue";
1129
- config: {
1130
- queueName: string;
1131
- retryPolicy?: {
1132
- maxAttempts: number;
1133
- backoffMinutes: number;
1134
- } | undefined;
1135
- region?: string | undefined;
1136
- batchSize?: number | undefined;
1137
- };
1138
- } | {
1139
- type: "cloudflare_workflow";
1140
- config: {
1141
- bindingName: string;
1142
- retryPolicy?: {
1143
- maxAttempts: number;
1144
- backoffMinutes: number;
1145
- } | undefined;
1146
- };
1147
- } | {
1148
- type: "websocket";
1149
- config: {
1150
- managerId: string;
1151
- retryPolicy?: {
1152
- maxAttempts: number;
1153
- backoffMinutes: number;
1154
- } | undefined;
1155
- };
1102
+ pagination: {
1103
+ limit: number;
1104
+ offset: number;
1105
+ hasMore: boolean;
1106
+ total?: number | undefined;
1156
1107
  };
1157
- initialPosition: "latest" | "earliest";
1158
- subscriberId?: string | undefined;
1108
+ streams: {
1109
+ createdAt: string;
1110
+ updatedAt: string;
1111
+ streamPosition: number;
1112
+ streamId: string;
1113
+ streamType: string;
1114
+ isArchived: boolean;
1115
+ lastArchivedPosition: number;
1116
+ streamMetadata?: Record<string, unknown> | undefined;
1117
+ }[];
1159
1118
  }, {
1160
- eventFilter: string | string[];
1161
- subscriber: {
1162
- type: "durable_object";
1163
- config: {
1164
- namespace: string;
1165
- id: string;
1166
- retryPolicy?: {
1167
- maxAttempts: number;
1168
- backoffMinutes: number;
1169
- } | undefined;
1170
- };
1171
- } | {
1172
- type: "webhook";
1173
- config: {
1174
- url: string;
1175
- headers?: Record<string, string> | undefined;
1176
- retryPolicy?: {
1177
- maxAttempts: number;
1178
- backoffMinutes: number;
1179
- } | undefined;
1180
- timeoutMs?: number | undefined;
1181
- };
1182
- } | {
1183
- type: "queue";
1184
- config: {
1185
- queueName: string;
1186
- retryPolicy?: {
1187
- maxAttempts: number;
1188
- backoffMinutes: number;
1189
- } | undefined;
1190
- region?: string | undefined;
1191
- batchSize?: number | undefined;
1192
- };
1193
- } | {
1194
- type: "cloudflare_workflow";
1195
- config: {
1196
- bindingName: string;
1197
- retryPolicy?: {
1198
- maxAttempts: number;
1199
- backoffMinutes: number;
1200
- } | undefined;
1201
- };
1202
- } | {
1203
- type: "websocket";
1204
- config: {
1205
- managerId: string;
1206
- retryPolicy?: {
1207
- maxAttempts: number;
1208
- backoffMinutes: number;
1209
- } | undefined;
1210
- };
1119
+ pagination: {
1120
+ limit: number;
1121
+ offset: number;
1122
+ hasMore: boolean;
1123
+ total?: number | undefined;
1211
1124
  };
1212
- subscriberId?: string | undefined;
1213
- initialPosition?: "latest" | "earliest" | undefined;
1125
+ streams: {
1126
+ createdAt: string;
1127
+ updatedAt: string;
1128
+ streamPosition: number;
1129
+ streamId: string;
1130
+ streamType: string;
1131
+ isArchived: boolean;
1132
+ lastArchivedPosition: number;
1133
+ streamMetadata?: Record<string, unknown> | undefined;
1134
+ }[];
1214
1135
  }>;
1215
- const SubscriptionResponseSchema: z.ZodObject<{
1216
- subscriptionId: z.ZodString;
1217
- status: z.ZodEnum<["ACTIVE", "SUSPENDED", "ERROR", "INITIALIZING", "DELETED"]>;
1218
- statusDetails: z.ZodOptional<z.ZodObject<{
1219
- lastError: z.ZodOptional<z.ZodString>;
1220
- lastErrorAt: z.ZodOptional<z.ZodString>;
1221
- retryCount: z.ZodOptional<z.ZodNumber>;
1222
- nextRetryAt: z.ZodOptional<z.ZodString>;
1136
+ export type QueryEventsParams = z.infer<typeof QueryEventsParamsSchema>;
1137
+ export type QueryStreamsParams = z.infer<typeof QueryStreamsParamsSchema>;
1138
+ export type QueryEventsResponse = {
1139
+ events: z.infer<typeof EventSchema>[];
1140
+ pagination: z.infer<typeof PaginationSchema>;
1141
+ };
1142
+ export type QueryStreamsResponse = z.infer<typeof QueryStreamsResponseSchema>;
1143
+ export type Stream = z.infer<typeof StreamSchema>;
1144
+ export type ReadEvent = z.infer<typeof EventSchema>;
1145
+ export const routes: OpenAPIHono<{
1146
+ Bindings: Env;
1147
+ }, {}, "/">;
1148
+ export { };
1149
+ }
1150
+
1151
+ declare namespace ManagementAPI {
1152
+ const EventStoreSchema: z.ZodObject<{
1153
+ eventStoreId: z.ZodString;
1154
+ eventStoreName: z.ZodString;
1155
+ eventStoreDurableObjectId: z.ZodString;
1156
+ eventBusDurableObjectId: z.ZodString;
1157
+ description: z.ZodOptional<z.ZodString>;
1158
+ settings: z.ZodOptional<z.ZodObject<{
1159
+ retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
1160
+ maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
1223
1161
  }, "strip", z.ZodTypeAny, {
1224
- lastError?: string | undefined;
1225
- retryCount?: number | undefined;
1226
- lastErrorAt?: string | undefined;
1227
- nextRetryAt?: string | undefined;
1162
+ retentionPeriodDays?: number | undefined;
1163
+ maxStreamSizeBytes?: number | undefined;
1228
1164
  }, {
1229
- lastError?: string | undefined;
1230
- retryCount?: number | undefined;
1231
- lastErrorAt?: string | undefined;
1232
- nextRetryAt?: string | undefined;
1165
+ retentionPeriodDays?: number | undefined;
1166
+ maxStreamSizeBytes?: number | undefined;
1233
1167
  }>>;
1234
- eventStoreId: z.ZodString;
1235
- eventFilter: z.ZodString;
1236
- subscriberId: z.ZodString;
1237
- subscriberType: z.ZodEnum<["durable_object", "webhook", "queue", "cloudflare_workflow", "websocket"]>;
1238
- createdAt: z.ZodString;
1239
- updatedAt: z.ZodString;
1240
- lastProcessedEventGlobalPosition: z.ZodOptional<z.ZodNumber>;
1168
+ created: z.ZodString;
1241
1169
  }, "strip", z.ZodTypeAny, {
1242
- status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
1243
1170
  eventStoreId: string;
1244
- subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
1245
- eventFilter: string;
1246
- subscriberId: string;
1247
- createdAt: string;
1248
- updatedAt: string;
1249
- subscriptionId: string;
1250
- statusDetails?: {
1251
- lastError?: string | undefined;
1252
- retryCount?: number | undefined;
1253
- lastErrorAt?: string | undefined;
1254
- nextRetryAt?: string | undefined;
1171
+ created: string;
1172
+ eventStoreName: string;
1173
+ eventStoreDurableObjectId: string;
1174
+ eventBusDurableObjectId: string;
1175
+ description?: string | undefined;
1176
+ settings?: {
1177
+ retentionPeriodDays?: number | undefined;
1178
+ maxStreamSizeBytes?: number | undefined;
1255
1179
  } | undefined;
1256
- lastProcessedEventGlobalPosition?: number | undefined;
1257
1180
  }, {
1258
- status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
1259
1181
  eventStoreId: string;
1260
- subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
1261
- eventFilter: string;
1262
- subscriberId: string;
1263
- createdAt: string;
1264
- updatedAt: string;
1265
- subscriptionId: string;
1266
- statusDetails?: {
1267
- lastError?: string | undefined;
1268
- retryCount?: number | undefined;
1269
- lastErrorAt?: string | undefined;
1270
- nextRetryAt?: string | undefined;
1182
+ created: string;
1183
+ eventStoreName: string;
1184
+ eventStoreDurableObjectId: string;
1185
+ eventBusDurableObjectId: string;
1186
+ description?: string | undefined;
1187
+ settings?: {
1188
+ retentionPeriodDays?: number | undefined;
1189
+ maxStreamSizeBytes?: number | undefined;
1190
+ } | undefined;
1191
+ }>;
1192
+ const CreateEventStoreRequestSchema: z.ZodObject<{
1193
+ name: z.ZodString;
1194
+ description: z.ZodOptional<z.ZodString>;
1195
+ settings: z.ZodOptional<z.ZodObject<{
1196
+ retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
1197
+ maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
1198
+ }, "strip", z.ZodTypeAny, {
1199
+ retentionPeriodDays?: number | undefined;
1200
+ maxStreamSizeBytes?: number | undefined;
1201
+ }, {
1202
+ retentionPeriodDays?: number | undefined;
1203
+ maxStreamSizeBytes?: number | undefined;
1204
+ }>>;
1205
+ }, "strip", z.ZodTypeAny, {
1206
+ name: string;
1207
+ description?: string | undefined;
1208
+ settings?: {
1209
+ retentionPeriodDays?: number | undefined;
1210
+ maxStreamSizeBytes?: number | undefined;
1211
+ } | undefined;
1212
+ }, {
1213
+ name: string;
1214
+ description?: string | undefined;
1215
+ settings?: {
1216
+ retentionPeriodDays?: number | undefined;
1217
+ maxStreamSizeBytes?: number | undefined;
1271
1218
  } | undefined;
1272
- lastProcessedEventGlobalPosition?: number | undefined;
1273
1219
  }>;
1274
- const SubscriptionListResponseSchema: z.ZodObject<{
1275
- subscriptions: z.ZodArray<z.ZodObject<{
1276
- subscriptionId: z.ZodString;
1277
- status: z.ZodEnum<["ACTIVE", "SUSPENDED", "ERROR", "INITIALIZING", "DELETED"]>;
1278
- statusDetails: z.ZodOptional<z.ZodObject<{
1279
- lastError: z.ZodOptional<z.ZodString>;
1280
- lastErrorAt: z.ZodOptional<z.ZodString>;
1281
- retryCount: z.ZodOptional<z.ZodNumber>;
1282
- nextRetryAt: z.ZodOptional<z.ZodString>;
1220
+ const EventStoreListResponseSchema: z.ZodObject<{
1221
+ eventStores: z.ZodArray<z.ZodObject<{
1222
+ eventStoreId: z.ZodString;
1223
+ eventStoreName: z.ZodString;
1224
+ eventStoreDurableObjectId: z.ZodString;
1225
+ eventBusDurableObjectId: z.ZodString;
1226
+ description: z.ZodOptional<z.ZodString>;
1227
+ settings: z.ZodOptional<z.ZodObject<{
1228
+ retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
1229
+ maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
1283
1230
  }, "strip", z.ZodTypeAny, {
1284
- lastError?: string | undefined;
1285
- retryCount?: number | undefined;
1286
- lastErrorAt?: string | undefined;
1287
- nextRetryAt?: string | undefined;
1231
+ retentionPeriodDays?: number | undefined;
1232
+ maxStreamSizeBytes?: number | undefined;
1288
1233
  }, {
1289
- lastError?: string | undefined;
1290
- retryCount?: number | undefined;
1291
- lastErrorAt?: string | undefined;
1292
- nextRetryAt?: string | undefined;
1234
+ retentionPeriodDays?: number | undefined;
1235
+ maxStreamSizeBytes?: number | undefined;
1293
1236
  }>>;
1294
- eventStoreId: z.ZodString;
1295
- eventFilter: z.ZodString;
1296
- subscriberId: z.ZodString;
1297
- subscriberType: z.ZodEnum<["durable_object", "webhook", "queue", "cloudflare_workflow", "websocket"]>;
1298
- createdAt: z.ZodString;
1299
- updatedAt: z.ZodString;
1300
- lastProcessedEventGlobalPosition: z.ZodOptional<z.ZodNumber>;
1237
+ created: z.ZodString;
1301
1238
  }, "strip", z.ZodTypeAny, {
1302
- status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
1303
1239
  eventStoreId: string;
1304
- subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
1305
- eventFilter: string;
1306
- subscriberId: string;
1307
- createdAt: string;
1308
- updatedAt: string;
1309
- subscriptionId: string;
1310
- statusDetails?: {
1311
- lastError?: string | undefined;
1312
- retryCount?: number | undefined;
1313
- lastErrorAt?: string | undefined;
1314
- nextRetryAt?: string | undefined;
1240
+ created: string;
1241
+ eventStoreName: string;
1242
+ eventStoreDurableObjectId: string;
1243
+ eventBusDurableObjectId: string;
1244
+ description?: string | undefined;
1245
+ settings?: {
1246
+ retentionPeriodDays?: number | undefined;
1247
+ maxStreamSizeBytes?: number | undefined;
1315
1248
  } | undefined;
1316
- lastProcessedEventGlobalPosition?: number | undefined;
1317
1249
  }, {
1318
- status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
1319
1250
  eventStoreId: string;
1320
- subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
1321
- eventFilter: string;
1322
- subscriberId: string;
1323
- createdAt: string;
1324
- updatedAt: string;
1325
- subscriptionId: string;
1326
- statusDetails?: {
1327
- lastError?: string | undefined;
1328
- retryCount?: number | undefined;
1329
- lastErrorAt?: string | undefined;
1330
- nextRetryAt?: string | undefined;
1251
+ created: string;
1252
+ eventStoreName: string;
1253
+ eventStoreDurableObjectId: string;
1254
+ eventBusDurableObjectId: string;
1255
+ description?: string | undefined;
1256
+ settings?: {
1257
+ retentionPeriodDays?: number | undefined;
1258
+ maxStreamSizeBytes?: number | undefined;
1331
1259
  } | undefined;
1332
- lastProcessedEventGlobalPosition?: number | undefined;
1333
1260
  }>, "many">;
1334
1261
  totalCount: z.ZodNumber;
1335
1262
  }, "strip", z.ZodTypeAny, {
1336
1263
  totalCount: number;
1337
- subscriptions: {
1338
- status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
1264
+ eventStores: {
1339
1265
  eventStoreId: string;
1340
- subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
1341
- eventFilter: string;
1342
- subscriberId: string;
1343
- createdAt: string;
1344
- updatedAt: string;
1345
- subscriptionId: string;
1346
- statusDetails?: {
1347
- lastError?: string | undefined;
1348
- retryCount?: number | undefined;
1349
- lastErrorAt?: string | undefined;
1350
- nextRetryAt?: string | undefined;
1266
+ created: string;
1267
+ eventStoreName: string;
1268
+ eventStoreDurableObjectId: string;
1269
+ eventBusDurableObjectId: string;
1270
+ description?: string | undefined;
1271
+ settings?: {
1272
+ retentionPeriodDays?: number | undefined;
1273
+ maxStreamSizeBytes?: number | undefined;
1351
1274
  } | undefined;
1352
- lastProcessedEventGlobalPosition?: number | undefined;
1353
1275
  }[];
1354
1276
  }, {
1355
1277
  totalCount: number;
1356
- subscriptions: {
1357
- status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
1278
+ eventStores: {
1358
1279
  eventStoreId: string;
1359
- subscriberType: "websocket" | "durable_object" | "webhook" | "queue" | "cloudflare_workflow";
1360
- eventFilter: string;
1361
- subscriberId: string;
1362
- createdAt: string;
1363
- updatedAt: string;
1364
- subscriptionId: string;
1365
- statusDetails?: {
1366
- lastError?: string | undefined;
1367
- retryCount?: number | undefined;
1368
- lastErrorAt?: string | undefined;
1369
- nextRetryAt?: string | undefined;
1280
+ created: string;
1281
+ eventStoreName: string;
1282
+ eventStoreDurableObjectId: string;
1283
+ eventBusDurableObjectId: string;
1284
+ description?: string | undefined;
1285
+ settings?: {
1286
+ retentionPeriodDays?: number | undefined;
1287
+ maxStreamSizeBytes?: number | undefined;
1370
1288
  } | undefined;
1371
- lastProcessedEventGlobalPosition?: number | undefined;
1372
1289
  }[];
1373
1290
  }>;
1374
- const SubscriptionErrorSchema: z.ZodObject<{
1291
+ const EventStoreDatabaseSizesSchema: z.ZodObject<{
1292
+ eventStoreDatabaseSize: z.ZodNumber;
1293
+ eventBusDatabaseSize: z.ZodNumber;
1294
+ totalSize: z.ZodNumber;
1295
+ }, "strip", z.ZodTypeAny, {
1296
+ eventStoreDatabaseSize: number;
1297
+ eventBusDatabaseSize: number;
1298
+ totalSize: number;
1299
+ }, {
1300
+ eventStoreDatabaseSize: number;
1301
+ eventBusDatabaseSize: number;
1302
+ totalSize: number;
1303
+ }>;
1304
+ const EventStoreDetailsResponseSchema: z.ZodObject<{
1305
+ eventStoreId: z.ZodString;
1306
+ eventStoreName: z.ZodString;
1307
+ eventStoreDurableObjectId: z.ZodString;
1308
+ eventBusDurableObjectId: z.ZodString;
1309
+ description: z.ZodOptional<z.ZodString>;
1310
+ settings: z.ZodOptional<z.ZodObject<{
1311
+ retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
1312
+ maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
1313
+ }, "strip", z.ZodTypeAny, {
1314
+ retentionPeriodDays?: number | undefined;
1315
+ maxStreamSizeBytes?: number | undefined;
1316
+ }, {
1317
+ retentionPeriodDays?: number | undefined;
1318
+ maxStreamSizeBytes?: number | undefined;
1319
+ }>>;
1320
+ created: z.ZodString;
1321
+ } & {
1322
+ streams: z.ZodOptional<z.ZodObject<{
1323
+ count: z.ZodNumber;
1324
+ totalEvents: z.ZodNumber;
1325
+ }, "strip", z.ZodTypeAny, {
1326
+ count: number;
1327
+ totalEvents: number;
1328
+ }, {
1329
+ count: number;
1330
+ totalEvents: number;
1331
+ }>>;
1332
+ databaseSizes: z.ZodOptional<z.ZodObject<{
1333
+ eventStoreDatabaseSize: z.ZodNumber;
1334
+ eventBusDatabaseSize: z.ZodNumber;
1335
+ totalSize: z.ZodNumber;
1336
+ }, "strip", z.ZodTypeAny, {
1337
+ eventStoreDatabaseSize: number;
1338
+ eventBusDatabaseSize: number;
1339
+ totalSize: number;
1340
+ }, {
1341
+ eventStoreDatabaseSize: number;
1342
+ eventBusDatabaseSize: number;
1343
+ totalSize: number;
1344
+ }>>;
1345
+ }, "strip", z.ZodTypeAny, {
1346
+ eventStoreId: string;
1347
+ created: string;
1348
+ eventStoreName: string;
1349
+ eventStoreDurableObjectId: string;
1350
+ eventBusDurableObjectId: string;
1351
+ description?: string | undefined;
1352
+ streams?: {
1353
+ count: number;
1354
+ totalEvents: number;
1355
+ } | undefined;
1356
+ settings?: {
1357
+ retentionPeriodDays?: number | undefined;
1358
+ maxStreamSizeBytes?: number | undefined;
1359
+ } | undefined;
1360
+ databaseSizes?: {
1361
+ eventStoreDatabaseSize: number;
1362
+ eventBusDatabaseSize: number;
1363
+ totalSize: number;
1364
+ } | undefined;
1365
+ }, {
1366
+ eventStoreId: string;
1367
+ created: string;
1368
+ eventStoreName: string;
1369
+ eventStoreDurableObjectId: string;
1370
+ eventBusDurableObjectId: string;
1371
+ description?: string | undefined;
1372
+ streams?: {
1373
+ count: number;
1374
+ totalEvents: number;
1375
+ } | undefined;
1376
+ settings?: {
1377
+ retentionPeriodDays?: number | undefined;
1378
+ maxStreamSizeBytes?: number | undefined;
1379
+ } | undefined;
1380
+ databaseSizes?: {
1381
+ eventStoreDatabaseSize: number;
1382
+ eventBusDatabaseSize: number;
1383
+ totalSize: number;
1384
+ } | undefined;
1385
+ }>;
1386
+ const ErrorResponseSchema: z.ZodObject<{
1375
1387
  error: z.ZodString;
1376
1388
  message: z.ZodString;
1377
1389
  details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -1384,6 +1396,10 @@ declare namespace EventBusAPI {
1384
1396
  message: string;
1385
1397
  details?: Record<string, any> | undefined;
1386
1398
  }>;
1399
+ const routes: OpenAPIHono<{
1400
+ Bindings: Env;
1401
+ }, {}, "/">;
1402
+ type ManagementAPIType = typeof routes;
1387
1403
  }
1388
1404
 
1389
1405
  declare namespace WebSocketsAPI {
@@ -1578,6 +1594,11 @@ interface Subscription {
1578
1594
  createdAt: string;
1579
1595
  updatedAt: string;
1580
1596
  }
1597
+ interface SubscriptionResult {
1598
+ subscription: Subscription;
1599
+ isExistingSubscription: boolean;
1600
+ message: string;
1601
+ }
1581
1602
  declare class EventBusDurableObject extends DurableObject<Env$1> {
1582
1603
  private readonly BATCH_SIZE;
1583
1604
  private readonly RETRY_DELAY_HOURS;
@@ -1592,7 +1613,23 @@ declare class EventBusDurableObject extends DurableObject<Env$1> {
1592
1613
  constructor(state: DurableObjectState, env: Env$1);
1593
1614
  private initializeTables;
1594
1615
  initialize(eventStoreID: string): void;
1595
- subscribe(eventFilter: EventFilter, subscriberId: string, subscription: SubscriberTypeConfig, initialPosition?: InitialPosition): Promise<void>;
1616
+ /**
1617
+ * Check if a webhook subscription with the same configuration already exists
1618
+ * @param eventFilter - The event filter pattern to match
1619
+ * @param webhookConfig - The webhook configuration to compare
1620
+ * @returns Existing subscription if found, null otherwise
1621
+ * @private
1622
+ */
1623
+ private findExistingWebhookSubscription;
1624
+ /**
1625
+ * Compare two webhook configurations for equality
1626
+ * @param config1 - First webhook configuration
1627
+ * @param config2 - Second webhook configuration
1628
+ * @returns True if configurations are equivalent
1629
+ * @private
1630
+ */
1631
+ private areWebhookConfigsEqual;
1632
+ subscribe(eventFilter: EventFilter, subscriberId: string, subscription: SubscriberTypeConfig, initialPosition?: InitialPosition): Promise<SubscriptionResult>;
1596
1633
  private validateSubscriberConfig;
1597
1634
  private updateSubscriptionStatus;
1598
1635
  unsubscribe(subscriberId: string): Promise<void>;
@@ -1622,6 +1659,11 @@ declare class EventBusDurableObject extends DurableObject<Env$1> {
1622
1659
  private markDeliveryAttempt;
1623
1660
  private deliverEvent;
1624
1661
  private logProcessingMetrics;
1662
+ /**
1663
+ * Clean up orphaned outbox entries that don't have corresponding active subscriptions
1664
+ * This prevents infinite loops from phantom messages that can't be processed
1665
+ */
1666
+ private cleanupOrphanedOutboxEntries;
1625
1667
  alarm(alarmInfo: AlarmInvocationInfo): Promise<void>;
1626
1668
  /**
1627
1669
  * Gets the current database size in bytes (consistent with EventStoreDO)