@delta-base/core 1.3.5 → 1.4.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/dist/index.d.ts CHANGED
@@ -81,8 +81,28 @@ declare namespace EventBusAPI {
81
81
  earliest: "earliest";
82
82
  }>>>;
83
83
  }, z.core.$strip>;
84
+ const UpdateSubscriptionRequestSchema: z.ZodObject<{
85
+ eventFilter: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodString, z.ZodString, z.ZodString]>, z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodString, z.ZodString, z.ZodString]>>]>>;
86
+ subscriberConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
87
+ retryPolicy: z.ZodOptional<z.ZodObject<{
88
+ strategy: z.ZodEnum<{
89
+ fixed: "fixed";
90
+ exponential: "exponential";
91
+ linear: "linear";
92
+ }>;
93
+ maxAttempts: z.ZodNumber;
94
+ initialDelayMs: z.ZodNumber;
95
+ maxDelayMs: z.ZodNumber;
96
+ multiplier: z.ZodOptional<z.ZodNumber>;
97
+ jitterPercent: z.ZodOptional<z.ZodNumber>;
98
+ }, z.core.$strip>>;
99
+ status: z.ZodOptional<z.ZodEnum<{
100
+ ACTIVE: "ACTIVE";
101
+ SUSPENDED: "SUSPENDED";
102
+ }>>;
103
+ }, z.core.$strip>;
84
104
  const SubscriptionResponseSchema: z.ZodObject<{
85
- subscriptionId: z.ZodString;
105
+ subscriberId: z.ZodString;
86
106
  status: z.ZodEnum<{
87
107
  ACTIVE: "ACTIVE";
88
108
  SUSPENDED: "SUSPENDED";
@@ -98,7 +118,6 @@ declare namespace EventBusAPI {
98
118
  }, z.core.$strip>>;
99
119
  eventStoreName: z.ZodString;
100
120
  eventFilter: z.ZodString;
101
- subscriberId: z.ZodString;
102
121
  subscriberType: z.ZodEnum<{
103
122
  durable_object: "durable_object";
104
123
  webhook: "webhook";
@@ -106,6 +125,7 @@ declare namespace EventBusAPI {
106
125
  cloudflare_workflow: "cloudflare_workflow";
107
126
  websocket: "websocket";
108
127
  }>;
128
+ subscriberConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
109
129
  createdAt: z.ZodString;
110
130
  updatedAt: z.ZodString;
111
131
  lastProcessedEventGlobalPosition: z.ZodOptional<z.ZodNumber>;
@@ -114,7 +134,7 @@ declare namespace EventBusAPI {
114
134
  }, z.core.$strip>;
115
135
  const SubscriptionListResponseSchema: z.ZodObject<{
116
136
  subscriptions: z.ZodArray<z.ZodObject<{
117
- subscriptionId: z.ZodString;
137
+ subscriberId: z.ZodString;
118
138
  status: z.ZodEnum<{
119
139
  ACTIVE: "ACTIVE";
120
140
  SUSPENDED: "SUSPENDED";
@@ -130,7 +150,6 @@ declare namespace EventBusAPI {
130
150
  }, z.core.$strip>>;
131
151
  eventStoreName: z.ZodString;
132
152
  eventFilter: z.ZodString;
133
- subscriberId: z.ZodString;
134
153
  subscriberType: z.ZodEnum<{
135
154
  durable_object: "durable_object";
136
155
  webhook: "webhook";
@@ -138,6 +157,7 @@ declare namespace EventBusAPI {
138
157
  cloudflare_workflow: "cloudflare_workflow";
139
158
  websocket: "websocket";
140
159
  }>;
160
+ subscriberConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
141
161
  createdAt: z.ZodString;
142
162
  updatedAt: z.ZodString;
143
163
  lastProcessedEventGlobalPosition: z.ZodOptional<z.ZodNumber>;
@@ -222,11 +242,10 @@ declare namespace EventBusAPI {
222
242
  };
223
243
  };
224
244
  output: {
225
- subscriptionId: string;
245
+ subscriberId: string;
226
246
  status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
227
247
  eventStoreName: string;
228
248
  eventFilter: string;
229
- subscriberId: string;
230
249
  subscriberType: "durable_object" | "webhook" | "queue" | "cloudflare_workflow" | "websocket";
231
250
  createdAt: string;
232
251
  updatedAt: string;
@@ -236,6 +255,9 @@ declare namespace EventBusAPI {
236
255
  retryCount?: number | undefined;
237
256
  nextRetryAt?: string | undefined;
238
257
  } | undefined;
258
+ subscriberConfig?: {
259
+ [x: string]: any;
260
+ } | undefined;
239
261
  lastProcessedEventGlobalPosition?: number | undefined;
240
262
  isExistingSubscription?: boolean | undefined;
241
263
  message?: string | undefined;
@@ -533,12 +555,12 @@ declare namespace EventBusAPI {
533
555
  };
534
556
  };
535
557
  } & {
536
- "/event-stores/:eventStoreName/subscriptions/:subscriptionId": {
558
+ "/event-stores/:eventStoreName/subscriptions/:subscriberId": {
537
559
  $delete: {
538
560
  input: {
539
561
  param: {
540
562
  eventStoreName: string;
541
- subscriptionId: string;
563
+ subscriberId: string;
542
564
  };
543
565
  };
544
566
  output: {
@@ -554,7 +576,7 @@ declare namespace EventBusAPI {
554
576
  input: {
555
577
  param: {
556
578
  eventStoreName: string;
557
- subscriptionId: string;
579
+ subscriberId: string;
558
580
  };
559
581
  };
560
582
  output: {
@@ -570,7 +592,7 @@ declare namespace EventBusAPI {
570
592
  input: {
571
593
  param: {
572
594
  eventStoreName: string;
573
- subscriptionId: string;
595
+ subscriberId: string;
574
596
  };
575
597
  };
576
598
  output: {
@@ -586,7 +608,7 @@ declare namespace EventBusAPI {
586
608
  input: {
587
609
  param: {
588
610
  eventStoreName: string;
589
- subscriptionId: string;
611
+ subscriberId: string;
590
612
  };
591
613
  };
592
614
  output: {
@@ -680,11 +702,10 @@ declare namespace EventBusAPI {
680
702
  };
681
703
  output: {
682
704
  subscriptions: {
683
- subscriptionId: string;
705
+ subscriberId: string;
684
706
  status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
685
707
  eventStoreName: string;
686
708
  eventFilter: string;
687
- subscriberId: string;
688
709
  subscriberType: "durable_object" | "webhook" | "queue" | "cloudflare_workflow" | "websocket";
689
710
  createdAt: string;
690
711
  updatedAt: string;
@@ -694,6 +715,9 @@ declare namespace EventBusAPI {
694
715
  retryCount?: number | undefined;
695
716
  nextRetryAt?: string | undefined;
696
717
  } | undefined;
718
+ subscriberConfig?: {
719
+ [x: string]: any;
720
+ } | undefined;
697
721
  lastProcessedEventGlobalPosition?: number | undefined;
698
722
  isExistingSubscription?: boolean | undefined;
699
723
  message?: string | undefined;
@@ -705,20 +729,115 @@ declare namespace EventBusAPI {
705
729
  };
706
730
  };
707
731
  } & {
708
- "/event-stores/:eventStoreName/subscriptions/:subscriptionId": {
732
+ "/event-stores/:eventStoreName/subscriptions/:subscriberId": {
709
733
  $get: {
710
734
  input: {
711
735
  param: {
712
736
  eventStoreName: string;
713
- subscriptionId: string;
737
+ subscriberId: string;
714
738
  };
715
739
  };
716
740
  output: {
717
- subscriptionId: string;
741
+ subscriberId: string;
718
742
  status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
719
743
  eventStoreName: string;
720
744
  eventFilter: string;
745
+ subscriberType: "durable_object" | "webhook" | "queue" | "cloudflare_workflow" | "websocket";
746
+ createdAt: string;
747
+ updatedAt: string;
748
+ statusDetails?: {
749
+ lastError?: string | undefined;
750
+ lastErrorAt?: string | undefined;
751
+ retryCount?: number | undefined;
752
+ nextRetryAt?: string | undefined;
753
+ } | undefined;
754
+ subscriberConfig?: {
755
+ [x: string]: any;
756
+ } | undefined;
757
+ lastProcessedEventGlobalPosition?: number | undefined;
758
+ isExistingSubscription?: boolean | undefined;
759
+ message?: string | undefined;
760
+ };
761
+ outputFormat: "json";
762
+ status: 200;
763
+ } | {
764
+ input: {
765
+ param: {
766
+ eventStoreName: string;
767
+ subscriberId: string;
768
+ };
769
+ };
770
+ output: {
771
+ error: string;
772
+ message: string;
773
+ details?: {
774
+ [x: string]: any;
775
+ } | undefined;
776
+ };
777
+ outputFormat: "json";
778
+ status: 401;
779
+ } | {
780
+ input: {
781
+ param: {
782
+ eventStoreName: string;
783
+ subscriberId: string;
784
+ };
785
+ };
786
+ output: {
787
+ error: string;
788
+ message: string;
789
+ details?: {
790
+ [x: string]: any;
791
+ } | undefined;
792
+ };
793
+ outputFormat: "json";
794
+ status: 404;
795
+ } | {
796
+ input: {
797
+ param: {
798
+ eventStoreName: string;
799
+ subscriberId: string;
800
+ };
801
+ };
802
+ output: {
803
+ error: string;
804
+ message: string;
805
+ details?: {
806
+ [x: string]: any;
807
+ } | undefined;
808
+ };
809
+ outputFormat: "json";
810
+ status: 500;
811
+ };
812
+ };
813
+ } & {
814
+ "/event-stores/:eventStoreName/subscriptions/:subscriberId": {
815
+ $patch: {
816
+ input: {
817
+ param: {
818
+ eventStoreName: string;
819
+ subscriberId: string;
820
+ };
821
+ } & {
822
+ json: {
823
+ eventFilter?: string | string[] | undefined;
824
+ subscriberConfig?: Record<string, unknown> | undefined;
825
+ retryPolicy?: {
826
+ strategy: "fixed" | "exponential" | "linear";
827
+ maxAttempts: number;
828
+ initialDelayMs: number;
829
+ maxDelayMs: number;
830
+ multiplier?: number | undefined;
831
+ jitterPercent?: number | undefined;
832
+ } | undefined;
833
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
834
+ };
835
+ };
836
+ output: {
721
837
  subscriberId: string;
838
+ status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
839
+ eventStoreName: string;
840
+ eventFilter: string;
722
841
  subscriberType: "durable_object" | "webhook" | "queue" | "cloudflare_workflow" | "websocket";
723
842
  createdAt: string;
724
843
  updatedAt: string;
@@ -728,6 +847,9 @@ declare namespace EventBusAPI {
728
847
  retryCount?: number | undefined;
729
848
  nextRetryAt?: string | undefined;
730
849
  } | undefined;
850
+ subscriberConfig?: {
851
+ [x: string]: any;
852
+ } | undefined;
731
853
  lastProcessedEventGlobalPosition?: number | undefined;
732
854
  isExistingSubscription?: boolean | undefined;
733
855
  message?: string | undefined;
@@ -738,7 +860,51 @@ declare namespace EventBusAPI {
738
860
  input: {
739
861
  param: {
740
862
  eventStoreName: string;
741
- subscriptionId: string;
863
+ subscriberId: string;
864
+ };
865
+ } & {
866
+ json: {
867
+ eventFilter?: string | string[] | undefined;
868
+ subscriberConfig?: Record<string, unknown> | undefined;
869
+ retryPolicy?: {
870
+ strategy: "fixed" | "exponential" | "linear";
871
+ maxAttempts: number;
872
+ initialDelayMs: number;
873
+ maxDelayMs: number;
874
+ multiplier?: number | undefined;
875
+ jitterPercent?: number | undefined;
876
+ } | undefined;
877
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
878
+ };
879
+ };
880
+ output: {
881
+ error: string;
882
+ message: string;
883
+ details?: {
884
+ [x: string]: any;
885
+ } | undefined;
886
+ };
887
+ outputFormat: "json";
888
+ status: 400;
889
+ } | {
890
+ input: {
891
+ param: {
892
+ eventStoreName: string;
893
+ subscriberId: string;
894
+ };
895
+ } & {
896
+ json: {
897
+ eventFilter?: string | string[] | undefined;
898
+ subscriberConfig?: Record<string, unknown> | undefined;
899
+ retryPolicy?: {
900
+ strategy: "fixed" | "exponential" | "linear";
901
+ maxAttempts: number;
902
+ initialDelayMs: number;
903
+ maxDelayMs: number;
904
+ multiplier?: number | undefined;
905
+ jitterPercent?: number | undefined;
906
+ } | undefined;
907
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
742
908
  };
743
909
  };
744
910
  output: {
@@ -754,7 +920,21 @@ declare namespace EventBusAPI {
754
920
  input: {
755
921
  param: {
756
922
  eventStoreName: string;
757
- subscriptionId: string;
923
+ subscriberId: string;
924
+ };
925
+ } & {
926
+ json: {
927
+ eventFilter?: string | string[] | undefined;
928
+ subscriberConfig?: Record<string, unknown> | undefined;
929
+ retryPolicy?: {
930
+ strategy: "fixed" | "exponential" | "linear";
931
+ maxAttempts: number;
932
+ initialDelayMs: number;
933
+ maxDelayMs: number;
934
+ multiplier?: number | undefined;
935
+ jitterPercent?: number | undefined;
936
+ } | undefined;
937
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
758
938
  };
759
939
  };
760
940
  output: {
@@ -770,7 +950,21 @@ declare namespace EventBusAPI {
770
950
  input: {
771
951
  param: {
772
952
  eventStoreName: string;
773
- subscriptionId: string;
953
+ subscriberId: string;
954
+ };
955
+ } & {
956
+ json: {
957
+ eventFilter?: string | string[] | undefined;
958
+ subscriberConfig?: Record<string, unknown> | undefined;
959
+ retryPolicy?: {
960
+ strategy: "fixed" | "exponential" | "linear";
961
+ maxAttempts: number;
962
+ initialDelayMs: number;
963
+ maxDelayMs: number;
964
+ multiplier?: number | undefined;
965
+ jitterPercent?: number | undefined;
966
+ } | undefined;
967
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
774
968
  };
775
969
  };
776
970
  output: {
@@ -782,6 +976,36 @@ declare namespace EventBusAPI {
782
976
  };
783
977
  outputFormat: "json";
784
978
  status: 500;
979
+ } | {
980
+ input: {
981
+ param: {
982
+ eventStoreName: string;
983
+ subscriberId: string;
984
+ };
985
+ } & {
986
+ json: {
987
+ eventFilter?: string | string[] | undefined;
988
+ subscriberConfig?: Record<string, unknown> | undefined;
989
+ retryPolicy?: {
990
+ strategy: "fixed" | "exponential" | "linear";
991
+ maxAttempts: number;
992
+ initialDelayMs: number;
993
+ maxDelayMs: number;
994
+ multiplier?: number | undefined;
995
+ jitterPercent?: number | undefined;
996
+ } | undefined;
997
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
998
+ };
999
+ };
1000
+ output: {
1001
+ error: string;
1002
+ message: string;
1003
+ details?: {
1004
+ [x: string]: any;
1005
+ } | undefined;
1006
+ };
1007
+ outputFormat: "json";
1008
+ status: 409;
785
1009
  };
786
1010
  };
787
1011
  }, "/">;
@@ -871,7 +1095,7 @@ declare namespace EventStoreAPI {
871
1095
  transactionId: z.ZodOptional<z.ZodString>;
872
1096
  fromPosition: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
873
1097
  toPosition: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
874
- fromDate: z.ZodOptional<z.ZodString>;
1098
+ fromDate: z.ZodOptional<z.ZodISODateTime>;
875
1099
  toDate: z.ZodOptional<z.ZodString>;
876
1100
  phase: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
877
1101
  includeArchived: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<boolean, string>>, z.ZodBoolean>>;
@@ -894,8 +1118,8 @@ declare namespace EventStoreAPI {
894
1118
  streamIdPattern: z.ZodOptional<z.ZodString>;
895
1119
  minPosition: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
896
1120
  maxPosition: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
897
- fromDate: z.ZodOptional<z.ZodString>;
898
- toDate: z.ZodOptional<z.ZodString>;
1121
+ fromDate: z.ZodOptional<z.ZodISODateTime>;
1122
+ toDate: z.ZodOptional<z.ZodISODateTime>;
899
1123
  includeArchived: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<boolean, string>>, z.ZodBoolean>>;
900
1124
  includeMetadata: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<boolean, string>>, z.ZodBoolean>>;
901
1125
  limit: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>;
@@ -966,6 +1190,58 @@ declare namespace EventStoreAPI {
966
1190
  hasMore: z.ZodBoolean;
967
1191
  }, z.core.$strip>;
968
1192
  }, z.core.$strip>;
1193
+ export const OutboxDlqEntrySchema: z.ZodObject<{
1194
+ id: z.ZodNumber;
1195
+ streamId: z.ZodString;
1196
+ streamPosition: z.ZodNumber;
1197
+ globalPosition: z.ZodNumber;
1198
+ messageId: z.ZodString;
1199
+ messageType: z.ZodString;
1200
+ messageData: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1201
+ messageMetadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1202
+ messageSchemaVersion: z.ZodString;
1203
+ transactionId: z.ZodString;
1204
+ totalAttempts: z.ZodNumber;
1205
+ lastError: z.ZodNullable<z.ZodString>;
1206
+ dlqReason: z.ZodEnum<{
1207
+ max_publish_retries: "max_publish_retries";
1208
+ eventbus_unreachable: "eventbus_unreachable";
1209
+ manual: "manual";
1210
+ subscriber_deleted: "subscriber_deleted";
1211
+ }>;
1212
+ originalCreatedAt: z.ZodString;
1213
+ movedToDlqAt: z.ZodString;
1214
+ }, z.core.$strip>;
1215
+ export const OutboxDlqListResponseSchema: z.ZodObject<{
1216
+ entries: z.ZodArray<z.ZodObject<{
1217
+ id: z.ZodNumber;
1218
+ streamId: z.ZodString;
1219
+ streamPosition: z.ZodNumber;
1220
+ globalPosition: z.ZodNumber;
1221
+ messageId: z.ZodString;
1222
+ messageType: z.ZodString;
1223
+ messageData: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1224
+ messageMetadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1225
+ messageSchemaVersion: z.ZodString;
1226
+ transactionId: z.ZodString;
1227
+ totalAttempts: z.ZodNumber;
1228
+ lastError: z.ZodNullable<z.ZodString>;
1229
+ dlqReason: z.ZodEnum<{
1230
+ max_publish_retries: "max_publish_retries";
1231
+ eventbus_unreachable: "eventbus_unreachable";
1232
+ manual: "manual";
1233
+ subscriber_deleted: "subscriber_deleted";
1234
+ }>;
1235
+ originalCreatedAt: z.ZodString;
1236
+ movedToDlqAt: z.ZodString;
1237
+ }, z.core.$strip>>;
1238
+ pagination: z.ZodObject<{
1239
+ limit: z.ZodNumber;
1240
+ offset: z.ZodNumber;
1241
+ total: z.ZodOptional<z.ZodNumber>;
1242
+ hasMore: z.ZodBoolean;
1243
+ }, z.core.$strip>;
1244
+ }, z.core.$strip>;
969
1245
  export type QueryEventsParams = z.infer<typeof QueryEventsParamsSchema>;
970
1246
  export type QueryStreamsParams = z.infer<typeof QueryStreamsParamsSchema>;
971
1247
  export type QueryEventsResponse = {
@@ -975,6 +1251,7 @@ declare namespace EventStoreAPI {
975
1251
  export type QueryStreamsResponse = z.infer<typeof QueryStreamsResponseSchema>;
976
1252
  export type Stream = z.infer<typeof StreamSchema>;
977
1253
  export type ReadEvent = z.infer<typeof EventSchema>;
1254
+ export type OutboxDlqListResponse = z.infer<typeof OutboxDlqListResponseSchema>;
978
1255
  export const routes: OpenAPIHono<{
979
1256
  Bindings: Env;
980
1257
  Variables: {
@@ -1617,79 +1894,251 @@ declare namespace EventStoreAPI {
1617
1894
  status: 200;
1618
1895
  };
1619
1896
  };
1620
- }, "/">;
1621
- export { };
1622
- }
1623
-
1624
- declare namespace ManagementAPI {
1625
- const EventStoreSchema: z.ZodObject<{
1626
- eventStoreId: z.ZodString;
1627
- eventStoreName: z.ZodString;
1628
- eventStoreDurableObjectId: z.ZodString;
1629
- eventBusDurableObjectId: z.ZodString;
1630
- description: z.ZodOptional<z.ZodString>;
1631
- settings: z.ZodOptional<z.ZodObject<{
1632
- retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
1633
- maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
1634
- }, z.core.$strip>>;
1635
- created: z.ZodString;
1636
- }, z.core.$strip>;
1637
- const CreateEventStoreRequestSchema: z.ZodObject<{
1638
- name: z.ZodString;
1639
- description: z.ZodOptional<z.ZodString>;
1640
- settings: z.ZodOptional<z.ZodObject<{
1641
- retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
1642
- maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
1643
- }, z.core.$strip>>;
1644
- }, z.core.$strip>;
1645
- const EventStoreListResponseSchema: z.ZodObject<{
1646
- eventStores: z.ZodArray<z.ZodObject<{
1647
- eventStoreId: z.ZodString;
1648
- eventStoreName: z.ZodString;
1649
- eventStoreDurableObjectId: z.ZodString;
1650
- eventBusDurableObjectId: z.ZodString;
1651
- description: z.ZodOptional<z.ZodString>;
1652
- settings: z.ZodOptional<z.ZodObject<{
1653
- retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
1654
- maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
1655
- }, z.core.$strip>>;
1656
- created: z.ZodString;
1657
- }, z.core.$strip>>;
1658
- totalCount: z.ZodNumber;
1659
- }, z.core.$strip>;
1660
- const EventStoreDatabaseSizesSchema: z.ZodObject<{
1661
- eventStoreDatabaseSize: z.ZodNumber;
1662
- eventBusDatabaseSize: z.ZodNumber;
1663
- totalSize: z.ZodNumber;
1664
- }, z.core.$strip>;
1665
- const EventStoreDetailsResponseSchema: z.ZodObject<{
1666
- eventStoreId: z.ZodString;
1667
- eventStoreName: z.ZodString;
1668
- eventStoreDurableObjectId: z.ZodString;
1669
- eventBusDurableObjectId: z.ZodString;
1670
- description: z.ZodOptional<z.ZodString>;
1671
- settings: z.ZodOptional<z.ZodObject<{
1672
- retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
1673
- maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
1674
- }, z.core.$strip>>;
1675
- created: z.ZodString;
1676
- streams: z.ZodOptional<z.ZodObject<{
1677
- count: z.ZodNumber;
1678
- totalEvents: z.ZodNumber;
1679
- }, z.core.$strip>>;
1680
- databaseSizes: z.ZodOptional<z.ZodObject<{
1681
- eventStoreDatabaseSize: z.ZodNumber;
1682
- eventBusDatabaseSize: z.ZodNumber;
1683
- totalSize: z.ZodNumber;
1684
- }, z.core.$strip>>;
1685
- }, z.core.$strip>;
1686
- const ErrorResponseSchema: z.ZodObject<{
1687
- error: z.ZodString;
1688
- message: z.ZodString;
1689
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
1690
- }, z.core.$strip>;
1691
- const routes: OpenAPIHono<{
1692
- Bindings: Env;
1897
+ } & {
1898
+ "/event-stores/:eventStoreName/outbox-dlq": {
1899
+ $get: {
1900
+ input: {
1901
+ param: {
1902
+ eventStoreName: string;
1903
+ };
1904
+ } & {
1905
+ query: {
1906
+ limit?: string | undefined;
1907
+ offset?: string | undefined;
1908
+ };
1909
+ };
1910
+ output: {
1911
+ error: "UNAUTHORIZED";
1912
+ message: "Unauthorized: Organization ID not found in authentication context";
1913
+ };
1914
+ outputFormat: "json";
1915
+ status: 401;
1916
+ } | {
1917
+ input: {
1918
+ param: {
1919
+ eventStoreName: string;
1920
+ };
1921
+ } & {
1922
+ query: {
1923
+ limit?: string | undefined;
1924
+ offset?: string | undefined;
1925
+ };
1926
+ };
1927
+ output: {
1928
+ entries: {
1929
+ id: number;
1930
+ streamId: string;
1931
+ streamPosition: number;
1932
+ globalPosition: number;
1933
+ messageId: string;
1934
+ messageType: string;
1935
+ messageData: {
1936
+ [x: string]: hono_utils_types.JSONValue;
1937
+ };
1938
+ messageMetadata: {
1939
+ [x: string]: hono_utils_types.JSONValue;
1940
+ };
1941
+ messageSchemaVersion: string;
1942
+ transactionId: string;
1943
+ totalAttempts: number;
1944
+ lastError: string | null;
1945
+ dlqReason: "max_publish_retries" | "eventbus_unreachable" | "manual" | "subscriber_deleted";
1946
+ originalCreatedAt: string;
1947
+ movedToDlqAt: string;
1948
+ }[];
1949
+ pagination: {
1950
+ limit: number;
1951
+ offset: number;
1952
+ hasMore: boolean;
1953
+ total?: number | undefined;
1954
+ };
1955
+ };
1956
+ outputFormat: "json";
1957
+ status: 200;
1958
+ };
1959
+ };
1960
+ } & {
1961
+ "/event-stores/:eventStoreName/outbox-dlq/:entryId/retry": {
1962
+ $post: {
1963
+ input: {
1964
+ param: {
1965
+ eventStoreName: string;
1966
+ entryId: string;
1967
+ };
1968
+ };
1969
+ output: {
1970
+ error: "UNAUTHORIZED";
1971
+ message: "Unauthorized: Organization ID not found in authentication context";
1972
+ };
1973
+ outputFormat: "json";
1974
+ status: 401;
1975
+ } | {
1976
+ input: {
1977
+ param: {
1978
+ eventStoreName: string;
1979
+ entryId: string;
1980
+ };
1981
+ };
1982
+ output: {
1983
+ success: boolean;
1984
+ entryId: number;
1985
+ };
1986
+ outputFormat: "json";
1987
+ status: 200;
1988
+ } | {
1989
+ input: {
1990
+ param: {
1991
+ eventStoreName: string;
1992
+ entryId: string;
1993
+ };
1994
+ };
1995
+ output: {
1996
+ error: "Not found";
1997
+ };
1998
+ outputFormat: "json";
1999
+ status: 404;
2000
+ };
2001
+ };
2002
+ } & {
2003
+ "/event-stores/:eventStoreName/outbox-dlq/retry-all": {
2004
+ $post: {
2005
+ input: {
2006
+ param: {
2007
+ eventStoreName: string;
2008
+ };
2009
+ };
2010
+ output: {
2011
+ error: "UNAUTHORIZED";
2012
+ message: "Unauthorized: Organization ID not found in authentication context";
2013
+ };
2014
+ outputFormat: "json";
2015
+ status: 401;
2016
+ } | {
2017
+ input: {
2018
+ param: {
2019
+ eventStoreName: string;
2020
+ };
2021
+ };
2022
+ output: {
2023
+ success: boolean;
2024
+ count: number;
2025
+ };
2026
+ outputFormat: "json";
2027
+ status: 200;
2028
+ };
2029
+ };
2030
+ } & {
2031
+ "/event-stores/:eventStoreName/outbox-dlq/:entryId": {
2032
+ $delete: {
2033
+ input: {
2034
+ param: {
2035
+ eventStoreName: string;
2036
+ entryId: string;
2037
+ };
2038
+ };
2039
+ output: {};
2040
+ outputFormat: string;
2041
+ status: 204;
2042
+ } | {
2043
+ input: {
2044
+ param: {
2045
+ eventStoreName: string;
2046
+ entryId: string;
2047
+ };
2048
+ };
2049
+ output: {
2050
+ error: "UNAUTHORIZED";
2051
+ message: "Unauthorized: Organization ID not found in authentication context";
2052
+ };
2053
+ outputFormat: "json";
2054
+ status: 401;
2055
+ } | {
2056
+ input: {
2057
+ param: {
2058
+ eventStoreName: string;
2059
+ entryId: string;
2060
+ };
2061
+ };
2062
+ output: {
2063
+ error: "Not found";
2064
+ };
2065
+ outputFormat: "json";
2066
+ status: 404;
2067
+ };
2068
+ };
2069
+ }, "/">;
2070
+ export { };
2071
+ }
2072
+
2073
+ declare namespace ManagementAPI {
2074
+ const EventStoreSchema: z.ZodObject<{
2075
+ eventStoreId: z.ZodString;
2076
+ eventStoreName: z.ZodString;
2077
+ eventStoreDurableObjectId: z.ZodString;
2078
+ eventBusDurableObjectId: z.ZodString;
2079
+ description: z.ZodOptional<z.ZodString>;
2080
+ settings: z.ZodOptional<z.ZodObject<{
2081
+ retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
2082
+ maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
2083
+ }, z.core.$strip>>;
2084
+ created: z.ZodString;
2085
+ }, z.core.$strip>;
2086
+ const CreateEventStoreRequestSchema: z.ZodObject<{
2087
+ name: z.ZodString;
2088
+ description: z.ZodOptional<z.ZodString>;
2089
+ settings: z.ZodOptional<z.ZodObject<{
2090
+ retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
2091
+ maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
2092
+ }, z.core.$strip>>;
2093
+ }, z.core.$strip>;
2094
+ const EventStoreListResponseSchema: z.ZodObject<{
2095
+ eventStores: z.ZodArray<z.ZodObject<{
2096
+ eventStoreId: z.ZodString;
2097
+ eventStoreName: z.ZodString;
2098
+ eventStoreDurableObjectId: z.ZodString;
2099
+ eventBusDurableObjectId: z.ZodString;
2100
+ description: z.ZodOptional<z.ZodString>;
2101
+ settings: z.ZodOptional<z.ZodObject<{
2102
+ retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
2103
+ maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
2104
+ }, z.core.$strip>>;
2105
+ created: z.ZodString;
2106
+ }, z.core.$strip>>;
2107
+ totalCount: z.ZodNumber;
2108
+ }, z.core.$strip>;
2109
+ const EventStoreDatabaseSizesSchema: z.ZodObject<{
2110
+ eventStoreDatabaseSize: z.ZodNumber;
2111
+ eventBusDatabaseSize: z.ZodNumber;
2112
+ totalSize: z.ZodNumber;
2113
+ }, z.core.$strip>;
2114
+ const EventStoreDetailsResponseSchema: z.ZodObject<{
2115
+ eventStoreId: z.ZodString;
2116
+ eventStoreName: z.ZodString;
2117
+ eventStoreDurableObjectId: z.ZodString;
2118
+ eventBusDurableObjectId: z.ZodString;
2119
+ description: z.ZodOptional<z.ZodString>;
2120
+ settings: z.ZodOptional<z.ZodObject<{
2121
+ retentionPeriodDays: z.ZodOptional<z.ZodNumber>;
2122
+ maxStreamSizeBytes: z.ZodOptional<z.ZodNumber>;
2123
+ }, z.core.$strip>>;
2124
+ created: z.ZodString;
2125
+ streams: z.ZodOptional<z.ZodObject<{
2126
+ count: z.ZodNumber;
2127
+ totalEvents: z.ZodNumber;
2128
+ }, z.core.$strip>>;
2129
+ databaseSizes: z.ZodOptional<z.ZodObject<{
2130
+ eventStoreDatabaseSize: z.ZodNumber;
2131
+ eventBusDatabaseSize: z.ZodNumber;
2132
+ totalSize: z.ZodNumber;
2133
+ }, z.core.$strip>>;
2134
+ }, z.core.$strip>;
2135
+ const ErrorResponseSchema: z.ZodObject<{
2136
+ error: z.ZodString;
2137
+ message: z.ZodString;
2138
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
2139
+ }, z.core.$strip>;
2140
+ const routes: OpenAPIHono<{
2141
+ Bindings: Env;
1693
2142
  Variables: {
1694
2143
  orgId: string;
1695
2144
  };
@@ -2340,6 +2789,16 @@ declare namespace WebSocketsAPI {
2340
2789
  }, "/">;
2341
2790
  }
2342
2791
 
2792
+ type RetryStrategy = 'exponential' | 'linear' | 'fixed';
2793
+ interface RetryPolicy {
2794
+ strategy: RetryStrategy;
2795
+ maxAttempts: number;
2796
+ initialDelayMs: number;
2797
+ maxDelayMs: number;
2798
+ multiplier?: number;
2799
+ jitterPercent?: number;
2800
+ }
2801
+
2343
2802
  type WildcardPattern = '*' | `${string}.*` | `*.${string}` | `${string}.*${string}`;
2344
2803
  type EventType = string;
2345
2804
  type EventFilter = EventType | EventType[] | WildcardPattern;
@@ -2396,9 +2855,6 @@ type SubscriberTypeConfig = {
2396
2855
  type: SubscriberType.WebSocket;
2397
2856
  config: WebSocketConfig;
2398
2857
  };
2399
- interface Env$1 {
2400
- [key: string]: DurableObjectNamespace | Workflow;
2401
- }
2402
2858
  interface EventMessage {
2403
2859
  event_id: string;
2404
2860
  event_type: string;
@@ -2416,6 +2872,8 @@ interface SubscriptionListOptions {
2416
2872
  eventFilter?: string;
2417
2873
  limit?: number;
2418
2874
  offset?: number;
2875
+ /** When true (default), hides platform-internal subscriptions (e.g. ws-manager). */
2876
+ hideInternal?: boolean;
2419
2877
  }
2420
2878
  declare enum SubscriptionStatus {
2421
2879
  ACTIVE = "ACTIVE",
@@ -2440,11 +2898,11 @@ interface StatusDetails {
2440
2898
  };
2441
2899
  }
2442
2900
  interface Subscription {
2443
- id: string;
2444
- eventFilter: string;
2445
2901
  subscriberId: string;
2902
+ eventFilter: string;
2446
2903
  subscriberType: SubscriberType;
2447
2904
  subscriberConfig: string;
2905
+ subscriberDoId?: string | null;
2448
2906
  status: SubscriptionStatus;
2449
2907
  statusDetails?: StatusDetails;
2450
2908
  lastProcessedEventGlobalPosition: number;
@@ -2456,7 +2914,7 @@ interface SubscriptionResult {
2456
2914
  isExistingSubscription: boolean;
2457
2915
  message: string;
2458
2916
  }
2459
- declare class EventBusDurableObject extends DurableObject<Env$1> {
2917
+ declare class EventBusDurableObject extends DurableObject<Env> {
2460
2918
  private readonly BATCH_SIZE;
2461
2919
  private readonly RETRY_DELAY_HOURS;
2462
2920
  /** Maximum messages to process per subscriber per batch (for round-robin fairness) */
@@ -2477,9 +2935,26 @@ declare class EventBusDurableObject extends DurableObject<Env$1> {
2477
2935
  * @private
2478
2936
  */
2479
2937
  private formatDateToISO;
2480
- constructor(state: DurableObjectState, env: Env$1);
2938
+ constructor(state: DurableObjectState, env: Env);
2481
2939
  private initializeTables;
2940
+ private ensureSubscriberDoColumn;
2941
+ /**
2942
+ * Migrates old subscriptions table schema (id INTEGER PK + UNIQUE(event_filter, subscriber_id))
2943
+ * to new schema (subscriber_id TEXT PK). This is needed because ON CONFLICT(subscriber_id)
2944
+ * requires subscriber_id to be a PK or have a UNIQUE constraint on its own.
2945
+ *
2946
+ * Old DOs created before this migration have the old schema due to CREATE TABLE IF NOT EXISTS
2947
+ * being a no-op when the table already exists.
2948
+ */
2949
+ private migrateSubscriptionsPrimaryKey;
2482
2950
  initialize(eventStoreID: string): void;
2951
+ /**
2952
+ * Ensures the event bus has been initialized
2953
+ * @throws NotFoundError if not initialized
2954
+ * @private
2955
+ */
2956
+ private ensureInitialized;
2957
+ private getEventStoreId;
2483
2958
  /**
2484
2959
  * Check if a webhook subscription with the same configuration already exists
2485
2960
  * @param eventFilter - The event filter pattern to match
@@ -2499,10 +2974,17 @@ declare class EventBusDurableObject extends DurableObject<Env$1> {
2499
2974
  subscribe(eventFilter: EventFilter, subscriberId: string, subscription: SubscriberTypeConfig, initialPosition?: InitialPosition): Promise<SubscriptionResult>;
2500
2975
  private validateSubscriberConfig;
2501
2976
  private updateSubscriptionStatus;
2977
+ private initializeSubscriberDurableObject;
2502
2978
  unsubscribe(subscriberId: string): Promise<void>;
2979
+ updateSubscription(subscriberId: string, updates: {
2980
+ eventFilter?: string;
2981
+ subscriberConfig?: Record<string, unknown>;
2982
+ retryPolicy?: RetryPolicy;
2983
+ status?: 'ACTIVE' | 'SUSPENDED';
2984
+ }): Promise<Subscription>;
2503
2985
  getSubscriptions(options?: SubscriptionListOptions): Promise<Subscription[]>;
2504
2986
  getSubscriptionsCount(options?: Omit<SubscriptionListOptions, 'limit' | 'offset'>): Promise<number>;
2505
- getSubscription(id: string): Promise<Subscription | null>;
2987
+ getSubscription(subscriberId: string): Promise<Subscription | null>;
2506
2988
  publish(events: {
2507
2989
  event_id: string;
2508
2990
  event_type: string;
@@ -2564,6 +3046,48 @@ declare class EventBusDurableObject extends DurableObject<Env$1> {
2564
3046
  pending_messages: number;
2565
3047
  };
2566
3048
  private validateEventFilter;
3049
+ /**
3050
+ * Validates the subscriber ID format.
3051
+ * Must be 1-128 characters, alphanumeric with hyphens and underscores only.
3052
+ * This is compatible with nanoid() default output (A-Za-z0-9_-) and
3053
+ * is URL-safe (no percent-encoding needed in path segments).
3054
+ * @param subscriberId - The subscriber ID to validate
3055
+ * @throws ValidationError if the subscriber ID is invalid
3056
+ * @private
3057
+ */
3058
+ private validateSubscriberId;
3059
+ /**
3060
+ * Checks that the subscriber ID is not already in use with a different event filter.
3061
+ * Enforces subscriber ID uniqueness within an event bus — each subscriber ID
3062
+ * maps to exactly one subscription. Re-subscribing with the same (subscriberId, eventFilter)
3063
+ * pair is allowed (idempotent upsert).
3064
+ * @param subscriberId - The subscriber ID to check
3065
+ * @param eventFilter - The event filter for the new subscription
3066
+ * @throws ValidationError if the subscriber ID is already in use with a different event filter
3067
+ * @private
3068
+ */
3069
+ private ensureSubscriberIdUnique;
3070
+ /**
3071
+ * Migrates all unmigrated subscriptions to SubscriberDOs.
3072
+ * This method is idempotent - running it multiple times is safe.
3073
+ */
3074
+ migrateAllSubscriptions(): Promise<{
3075
+ subscriptionsMigrated: number;
3076
+ outboxEntriesMoved: number;
3077
+ }>;
3078
+ /**
3079
+ * Gets migration status for this EventBusDO
3080
+ */
3081
+ getMigrationStatus(): Promise<{
3082
+ totalSubscriptions: number;
3083
+ migratedCount: number;
3084
+ legacyCount: number;
3085
+ legacyOutboxCount: number;
3086
+ }>;
3087
+ /**
3088
+ * Reconstructs an EventMessage from a subscriptions_outbox row
3089
+ */
3090
+ private reconstructEventFromOutbox;
2567
3091
  }
2568
3092
 
2569
3093
  /**
@@ -2638,6 +3162,32 @@ type QueryStreamsResult = {
2638
3162
  hasMore: boolean;
2639
3163
  };
2640
3164
  };
3165
+ type OutboxDlqEntry = {
3166
+ id: number;
3167
+ streamId: string;
3168
+ streamPosition: number;
3169
+ globalPosition: number;
3170
+ messageId: string;
3171
+ messageType: string;
3172
+ messageData: Record<string, unknown>;
3173
+ messageMetadata: Record<string, unknown>;
3174
+ messageSchemaVersion: string;
3175
+ transactionId: string;
3176
+ totalAttempts: number;
3177
+ lastError: string | null;
3178
+ dlqReason: 'max_publish_retries' | 'eventbus_unreachable' | 'manual' | 'subscriber_deleted';
3179
+ originalCreatedAt: string;
3180
+ movedToDlqAt: string;
3181
+ };
3182
+ type OutboxDlqResult = {
3183
+ entries: OutboxDlqEntry[];
3184
+ pagination: {
3185
+ limit: number;
3186
+ offset: number;
3187
+ total: number;
3188
+ hasMore: boolean;
3189
+ };
3190
+ };
2641
3191
  /**
2642
3192
  * A durable object implementation of an event store.
2643
3193
  * Handles event persistence, archiving, and event bus integration.
@@ -2652,10 +3202,6 @@ declare class EventStoreDurableObject extends DurableObject<Env> {
2652
3202
  private readonly SIZE_EMERGENCY_MB;
2653
3203
  /** Conversion factor from MB to bytes */
2654
3204
  private readonly MB_TO_BYTES;
2655
- /** Number of events to store in each archive chunk */
2656
- private readonly EVENTS_PER_ARCHIVE_CHUNK;
2657
- /** Maximum batch size for emergency operations */
2658
- private readonly MAX_EMERGENCY_BATCH_SIZE;
2659
3205
  /** Tracks if alarm handler is currently active to prevent concurrency violations */
2660
3206
  private isAlarmActive;
2661
3207
  /** Tracks if we're in the process of scheduling an alarm to prevent race conditions */
@@ -2678,6 +3224,12 @@ declare class EventStoreDurableObject extends DurableObject<Env> {
2678
3224
  * @param eventStoreID - The ID to assign to this event store
2679
3225
  */
2680
3226
  initialize(eventStoreID: string): void;
3227
+ /**
3228
+ * Ensures the event store has been initialized
3229
+ * @throws NotFoundError if not initialized
3230
+ * @private
3231
+ */
3232
+ private ensureInitialized;
2681
3233
  /**
2682
3234
  * Appends events to a stream with optimistic concurrency control
2683
3235
  * @param streamId - The unique identifier for the stream
@@ -2745,12 +3297,21 @@ declare class EventStoreDurableObject extends DurableObject<Env> {
2745
3297
  */
2746
3298
  private formatDateToISO;
2747
3299
  /**
2748
- * Maps a database row to an event object
3300
+ * Converts ISO 8601 date string to SQLite DATETIME format for query comparisons
3301
+ * This ensures backward compatibility with existing data stored in SQLite format
3302
+ * @param isoDate - ISO 8601 date string like "2025-12-02T05:00:00.000Z"
3303
+ * @returns SQLite DATETIME format string like "2025-12-02 05:00:00"
3304
+ * @private
3305
+ */
3306
+ private formatDateToSQLite;
3307
+ /**
3308
+ * Maps a database row to an event object
2749
3309
  * @param row - The database row containing event data
2750
3310
  * @returns A properly formatted event object
2751
3311
  * @private
2752
3312
  */
2753
3313
  private mapRowToEvent;
3314
+ private mapRowToOutboxDlqEntry;
2754
3315
  /**
2755
3316
  * Gets the current version of a stream
2756
3317
  * @param streamId - The stream to get the version for
@@ -2812,6 +3373,13 @@ declare class EventStoreDurableObject extends DurableObject<Env> {
2812
3373
  * @private
2813
3374
  */
2814
3375
  private processPendingEventBusMessages;
3376
+ listOutboxDlq(options?: {
3377
+ limit?: number;
3378
+ offset?: number;
3379
+ }): Promise<OutboxDlqResult>;
3380
+ retryOutboxDlqEntry(entryId: number): Promise<boolean>;
3381
+ retryAllOutboxDlq(): Promise<number>;
3382
+ deleteOutboxDlqEntry(entryId: number): Promise<boolean>;
2815
3383
  /**
2816
3384
  * Gets the current database size in bytes (consistent with EventBusDO)
2817
3385
  * @returns Database size in bytes
@@ -3064,6 +3632,42 @@ declare class EventStoreManagerDurableObject extends DurableObject<Env> {
3064
3632
  }>;
3065
3633
  }
3066
3634
 
3635
+ interface SubscriberInitConfig {
3636
+ subscriberId: string;
3637
+ subscriberType: SubscriberType;
3638
+ subscriberConfig: SubscriberTypeConfig['config'];
3639
+ eventFilter: string;
3640
+ retryPolicy: RetryPolicy;
3641
+ }
3642
+ type SubscriberStatus = 'ACTIVE' | 'PAUSED' | 'ERROR';
3643
+ declare class SubscriberDurableObject extends DurableObject<Env> {
3644
+ private readonly BATCH_SIZE;
3645
+ private readonly MAX_BATCHES_PER_ALARM;
3646
+ private isAlarmActive;
3647
+ private isSchedulingAlarm;
3648
+ sql: SqlStorage;
3649
+ constructor(state: DurableObjectState, env: Env);
3650
+ private initializeTables;
3651
+ initialize(config: SubscriberInitConfig): void;
3652
+ setCursor(position: number): void;
3653
+ enqueue(events: EventMessage[]): Promise<void>;
3654
+ private requestAlarm;
3655
+ private getConfigRow;
3656
+ private getSubscriberStatus;
3657
+ private getRetryPolicy;
3658
+ private getSubscriberConfig;
3659
+ updateStatus(status: SubscriberStatus, _error?: string): void;
3660
+ private getReadyOutboxBatch;
3661
+ private getNextAlarmTime;
3662
+ private scheduleNextAlarm;
3663
+ private reconstructEvent;
3664
+ private markEventDelivered;
3665
+ private moveToDlq;
3666
+ private updateRetryState;
3667
+ private deliverEvent;
3668
+ alarm(): Promise<void>;
3669
+ }
3670
+
3067
3671
  interface ConnectionListOptions {
3068
3672
  limit?: number;
3069
3673
  offset?: number;
@@ -4180,6 +4784,178 @@ declare const routes: hono_hono_base.HonoBase<{
4180
4784
  status: 200;
4181
4785
  };
4182
4786
  };
4787
+ } & {
4788
+ "/event-stores/:eventStoreName/outbox-dlq": {
4789
+ $get: {
4790
+ input: {
4791
+ param: {
4792
+ eventStoreName: string;
4793
+ };
4794
+ } & {
4795
+ query: {
4796
+ limit?: string | undefined;
4797
+ offset?: string | undefined;
4798
+ };
4799
+ };
4800
+ output: {
4801
+ error: "UNAUTHORIZED";
4802
+ message: "Unauthorized: Organization ID not found in authentication context";
4803
+ };
4804
+ outputFormat: "json";
4805
+ status: 401;
4806
+ } | {
4807
+ input: {
4808
+ param: {
4809
+ eventStoreName: string;
4810
+ };
4811
+ } & {
4812
+ query: {
4813
+ limit?: string | undefined;
4814
+ offset?: string | undefined;
4815
+ };
4816
+ };
4817
+ output: {
4818
+ entries: {
4819
+ id: number;
4820
+ streamId: string;
4821
+ streamPosition: number;
4822
+ globalPosition: number;
4823
+ messageId: string;
4824
+ messageType: string;
4825
+ messageData: {
4826
+ [x: string]: hono_utils_types.JSONValue;
4827
+ };
4828
+ messageMetadata: {
4829
+ [x: string]: hono_utils_types.JSONValue;
4830
+ };
4831
+ messageSchemaVersion: string;
4832
+ transactionId: string;
4833
+ totalAttempts: number;
4834
+ lastError: string | null;
4835
+ dlqReason: "max_publish_retries" | "eventbus_unreachable" | "manual" | "subscriber_deleted";
4836
+ originalCreatedAt: string;
4837
+ movedToDlqAt: string;
4838
+ }[];
4839
+ pagination: {
4840
+ limit: number;
4841
+ offset: number;
4842
+ hasMore: boolean;
4843
+ total?: number | undefined;
4844
+ };
4845
+ };
4846
+ outputFormat: "json";
4847
+ status: 200;
4848
+ };
4849
+ };
4850
+ } & {
4851
+ "/event-stores/:eventStoreName/outbox-dlq/:entryId/retry": {
4852
+ $post: {
4853
+ input: {
4854
+ param: {
4855
+ eventStoreName: string;
4856
+ entryId: string;
4857
+ };
4858
+ };
4859
+ output: {
4860
+ error: "UNAUTHORIZED";
4861
+ message: "Unauthorized: Organization ID not found in authentication context";
4862
+ };
4863
+ outputFormat: "json";
4864
+ status: 401;
4865
+ } | {
4866
+ input: {
4867
+ param: {
4868
+ eventStoreName: string;
4869
+ entryId: string;
4870
+ };
4871
+ };
4872
+ output: {
4873
+ success: boolean;
4874
+ entryId: number;
4875
+ };
4876
+ outputFormat: "json";
4877
+ status: 200;
4878
+ } | {
4879
+ input: {
4880
+ param: {
4881
+ eventStoreName: string;
4882
+ entryId: string;
4883
+ };
4884
+ };
4885
+ output: {
4886
+ error: "Not found";
4887
+ };
4888
+ outputFormat: "json";
4889
+ status: 404;
4890
+ };
4891
+ };
4892
+ } & {
4893
+ "/event-stores/:eventStoreName/outbox-dlq/retry-all": {
4894
+ $post: {
4895
+ input: {
4896
+ param: {
4897
+ eventStoreName: string;
4898
+ };
4899
+ };
4900
+ output: {
4901
+ error: "UNAUTHORIZED";
4902
+ message: "Unauthorized: Organization ID not found in authentication context";
4903
+ };
4904
+ outputFormat: "json";
4905
+ status: 401;
4906
+ } | {
4907
+ input: {
4908
+ param: {
4909
+ eventStoreName: string;
4910
+ };
4911
+ };
4912
+ output: {
4913
+ success: boolean;
4914
+ count: number;
4915
+ };
4916
+ outputFormat: "json";
4917
+ status: 200;
4918
+ };
4919
+ };
4920
+ } & {
4921
+ "/event-stores/:eventStoreName/outbox-dlq/:entryId": {
4922
+ $delete: {
4923
+ input: {
4924
+ param: {
4925
+ eventStoreName: string;
4926
+ entryId: string;
4927
+ };
4928
+ };
4929
+ output: {};
4930
+ outputFormat: string;
4931
+ status: 204;
4932
+ } | {
4933
+ input: {
4934
+ param: {
4935
+ eventStoreName: string;
4936
+ entryId: string;
4937
+ };
4938
+ };
4939
+ output: {
4940
+ error: "UNAUTHORIZED";
4941
+ message: "Unauthorized: Organization ID not found in authentication context";
4942
+ };
4943
+ outputFormat: "json";
4944
+ status: 401;
4945
+ } | {
4946
+ input: {
4947
+ param: {
4948
+ eventStoreName: string;
4949
+ entryId: string;
4950
+ };
4951
+ };
4952
+ output: {
4953
+ error: "Not found";
4954
+ };
4955
+ outputFormat: "json";
4956
+ status: 404;
4957
+ };
4958
+ };
4183
4959
  }, "/api"> | hono_types.MergeSchemaPath<{
4184
4960
  "/event-stores/:eventStoreName/subscribe": {
4185
4961
  $post: {
@@ -4246,11 +5022,10 @@ declare const routes: hono_hono_base.HonoBase<{
4246
5022
  };
4247
5023
  };
4248
5024
  output: {
4249
- subscriptionId: string;
5025
+ subscriberId: string;
4250
5026
  status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
4251
5027
  eventStoreName: string;
4252
5028
  eventFilter: string;
4253
- subscriberId: string;
4254
5029
  subscriberType: "durable_object" | "webhook" | "queue" | "cloudflare_workflow" | "websocket";
4255
5030
  createdAt: string;
4256
5031
  updatedAt: string;
@@ -4260,6 +5035,9 @@ declare const routes: hono_hono_base.HonoBase<{
4260
5035
  retryCount?: number | undefined;
4261
5036
  nextRetryAt?: string | undefined;
4262
5037
  } | undefined;
5038
+ subscriberConfig?: {
5039
+ [x: string]: any;
5040
+ } | undefined;
4263
5041
  lastProcessedEventGlobalPosition?: number | undefined;
4264
5042
  isExistingSubscription?: boolean | undefined;
4265
5043
  message?: string | undefined;
@@ -4557,12 +5335,12 @@ declare const routes: hono_hono_base.HonoBase<{
4557
5335
  };
4558
5336
  };
4559
5337
  } & {
4560
- "/event-stores/:eventStoreName/subscriptions/:subscriptionId": {
5338
+ "/event-stores/:eventStoreName/subscriptions/:subscriberId": {
4561
5339
  $delete: {
4562
5340
  input: {
4563
5341
  param: {
4564
5342
  eventStoreName: string;
4565
- subscriptionId: string;
5343
+ subscriberId: string;
4566
5344
  };
4567
5345
  };
4568
5346
  output: {
@@ -4578,7 +5356,7 @@ declare const routes: hono_hono_base.HonoBase<{
4578
5356
  input: {
4579
5357
  param: {
4580
5358
  eventStoreName: string;
4581
- subscriptionId: string;
5359
+ subscriberId: string;
4582
5360
  };
4583
5361
  };
4584
5362
  output: {
@@ -4594,7 +5372,7 @@ declare const routes: hono_hono_base.HonoBase<{
4594
5372
  input: {
4595
5373
  param: {
4596
5374
  eventStoreName: string;
4597
- subscriptionId: string;
5375
+ subscriberId: string;
4598
5376
  };
4599
5377
  };
4600
5378
  output: {
@@ -4610,7 +5388,7 @@ declare const routes: hono_hono_base.HonoBase<{
4610
5388
  input: {
4611
5389
  param: {
4612
5390
  eventStoreName: string;
4613
- subscriptionId: string;
5391
+ subscriberId: string;
4614
5392
  };
4615
5393
  };
4616
5394
  output: {
@@ -4704,11 +5482,10 @@ declare const routes: hono_hono_base.HonoBase<{
4704
5482
  };
4705
5483
  output: {
4706
5484
  subscriptions: {
4707
- subscriptionId: string;
5485
+ subscriberId: string;
4708
5486
  status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
4709
5487
  eventStoreName: string;
4710
5488
  eventFilter: string;
4711
- subscriberId: string;
4712
5489
  subscriberType: "durable_object" | "webhook" | "queue" | "cloudflare_workflow" | "websocket";
4713
5490
  createdAt: string;
4714
5491
  updatedAt: string;
@@ -4718,6 +5495,9 @@ declare const routes: hono_hono_base.HonoBase<{
4718
5495
  retryCount?: number | undefined;
4719
5496
  nextRetryAt?: string | undefined;
4720
5497
  } | undefined;
5498
+ subscriberConfig?: {
5499
+ [x: string]: any;
5500
+ } | undefined;
4721
5501
  lastProcessedEventGlobalPosition?: number | undefined;
4722
5502
  isExistingSubscription?: boolean | undefined;
4723
5503
  message?: string | undefined;
@@ -4729,20 +5509,115 @@ declare const routes: hono_hono_base.HonoBase<{
4729
5509
  };
4730
5510
  };
4731
5511
  } & {
4732
- "/event-stores/:eventStoreName/subscriptions/:subscriptionId": {
5512
+ "/event-stores/:eventStoreName/subscriptions/:subscriberId": {
4733
5513
  $get: {
4734
5514
  input: {
4735
5515
  param: {
4736
5516
  eventStoreName: string;
4737
- subscriptionId: string;
5517
+ subscriberId: string;
4738
5518
  };
4739
5519
  };
4740
5520
  output: {
4741
- subscriptionId: string;
5521
+ subscriberId: string;
4742
5522
  status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
4743
5523
  eventStoreName: string;
4744
5524
  eventFilter: string;
5525
+ subscriberType: "durable_object" | "webhook" | "queue" | "cloudflare_workflow" | "websocket";
5526
+ createdAt: string;
5527
+ updatedAt: string;
5528
+ statusDetails?: {
5529
+ lastError?: string | undefined;
5530
+ lastErrorAt?: string | undefined;
5531
+ retryCount?: number | undefined;
5532
+ nextRetryAt?: string | undefined;
5533
+ } | undefined;
5534
+ subscriberConfig?: {
5535
+ [x: string]: any;
5536
+ } | undefined;
5537
+ lastProcessedEventGlobalPosition?: number | undefined;
5538
+ isExistingSubscription?: boolean | undefined;
5539
+ message?: string | undefined;
5540
+ };
5541
+ outputFormat: "json";
5542
+ status: 200;
5543
+ } | {
5544
+ input: {
5545
+ param: {
5546
+ eventStoreName: string;
5547
+ subscriberId: string;
5548
+ };
5549
+ };
5550
+ output: {
5551
+ error: string;
5552
+ message: string;
5553
+ details?: {
5554
+ [x: string]: any;
5555
+ } | undefined;
5556
+ };
5557
+ outputFormat: "json";
5558
+ status: 401;
5559
+ } | {
5560
+ input: {
5561
+ param: {
5562
+ eventStoreName: string;
5563
+ subscriberId: string;
5564
+ };
5565
+ };
5566
+ output: {
5567
+ error: string;
5568
+ message: string;
5569
+ details?: {
5570
+ [x: string]: any;
5571
+ } | undefined;
5572
+ };
5573
+ outputFormat: "json";
5574
+ status: 404;
5575
+ } | {
5576
+ input: {
5577
+ param: {
5578
+ eventStoreName: string;
5579
+ subscriberId: string;
5580
+ };
5581
+ };
5582
+ output: {
5583
+ error: string;
5584
+ message: string;
5585
+ details?: {
5586
+ [x: string]: any;
5587
+ } | undefined;
5588
+ };
5589
+ outputFormat: "json";
5590
+ status: 500;
5591
+ };
5592
+ };
5593
+ } & {
5594
+ "/event-stores/:eventStoreName/subscriptions/:subscriberId": {
5595
+ $patch: {
5596
+ input: {
5597
+ param: {
5598
+ eventStoreName: string;
5599
+ subscriberId: string;
5600
+ };
5601
+ } & {
5602
+ json: {
5603
+ eventFilter?: string | string[] | undefined;
5604
+ subscriberConfig?: Record<string, unknown> | undefined;
5605
+ retryPolicy?: {
5606
+ strategy: "fixed" | "exponential" | "linear";
5607
+ maxAttempts: number;
5608
+ initialDelayMs: number;
5609
+ maxDelayMs: number;
5610
+ multiplier?: number | undefined;
5611
+ jitterPercent?: number | undefined;
5612
+ } | undefined;
5613
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
5614
+ };
5615
+ };
5616
+ output: {
4745
5617
  subscriberId: string;
5618
+ status: "ACTIVE" | "SUSPENDED" | "ERROR" | "INITIALIZING" | "DELETED";
5619
+ eventStoreName: string;
5620
+ eventFilter: string;
4746
5621
  subscriberType: "durable_object" | "webhook" | "queue" | "cloudflare_workflow" | "websocket";
4747
5622
  createdAt: string;
4748
5623
  updatedAt: string;
@@ -4752,6 +5627,9 @@ declare const routes: hono_hono_base.HonoBase<{
4752
5627
  retryCount?: number | undefined;
4753
5628
  nextRetryAt?: string | undefined;
4754
5629
  } | undefined;
5630
+ subscriberConfig?: {
5631
+ [x: string]: any;
5632
+ } | undefined;
4755
5633
  lastProcessedEventGlobalPosition?: number | undefined;
4756
5634
  isExistingSubscription?: boolean | undefined;
4757
5635
  message?: string | undefined;
@@ -4762,7 +5640,51 @@ declare const routes: hono_hono_base.HonoBase<{
4762
5640
  input: {
4763
5641
  param: {
4764
5642
  eventStoreName: string;
4765
- subscriptionId: string;
5643
+ subscriberId: string;
5644
+ };
5645
+ } & {
5646
+ json: {
5647
+ eventFilter?: string | string[] | undefined;
5648
+ subscriberConfig?: Record<string, unknown> | undefined;
5649
+ retryPolicy?: {
5650
+ strategy: "fixed" | "exponential" | "linear";
5651
+ maxAttempts: number;
5652
+ initialDelayMs: number;
5653
+ maxDelayMs: number;
5654
+ multiplier?: number | undefined;
5655
+ jitterPercent?: number | undefined;
5656
+ } | undefined;
5657
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
5658
+ };
5659
+ };
5660
+ output: {
5661
+ error: string;
5662
+ message: string;
5663
+ details?: {
5664
+ [x: string]: any;
5665
+ } | undefined;
5666
+ };
5667
+ outputFormat: "json";
5668
+ status: 400;
5669
+ } | {
5670
+ input: {
5671
+ param: {
5672
+ eventStoreName: string;
5673
+ subscriberId: string;
5674
+ };
5675
+ } & {
5676
+ json: {
5677
+ eventFilter?: string | string[] | undefined;
5678
+ subscriberConfig?: Record<string, unknown> | undefined;
5679
+ retryPolicy?: {
5680
+ strategy: "fixed" | "exponential" | "linear";
5681
+ maxAttempts: number;
5682
+ initialDelayMs: number;
5683
+ maxDelayMs: number;
5684
+ multiplier?: number | undefined;
5685
+ jitterPercent?: number | undefined;
5686
+ } | undefined;
5687
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
4766
5688
  };
4767
5689
  };
4768
5690
  output: {
@@ -4778,7 +5700,21 @@ declare const routes: hono_hono_base.HonoBase<{
4778
5700
  input: {
4779
5701
  param: {
4780
5702
  eventStoreName: string;
4781
- subscriptionId: string;
5703
+ subscriberId: string;
5704
+ };
5705
+ } & {
5706
+ json: {
5707
+ eventFilter?: string | string[] | undefined;
5708
+ subscriberConfig?: Record<string, unknown> | undefined;
5709
+ retryPolicy?: {
5710
+ strategy: "fixed" | "exponential" | "linear";
5711
+ maxAttempts: number;
5712
+ initialDelayMs: number;
5713
+ maxDelayMs: number;
5714
+ multiplier?: number | undefined;
5715
+ jitterPercent?: number | undefined;
5716
+ } | undefined;
5717
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
4782
5718
  };
4783
5719
  };
4784
5720
  output: {
@@ -4794,7 +5730,21 @@ declare const routes: hono_hono_base.HonoBase<{
4794
5730
  input: {
4795
5731
  param: {
4796
5732
  eventStoreName: string;
4797
- subscriptionId: string;
5733
+ subscriberId: string;
5734
+ };
5735
+ } & {
5736
+ json: {
5737
+ eventFilter?: string | string[] | undefined;
5738
+ subscriberConfig?: Record<string, unknown> | undefined;
5739
+ retryPolicy?: {
5740
+ strategy: "fixed" | "exponential" | "linear";
5741
+ maxAttempts: number;
5742
+ initialDelayMs: number;
5743
+ maxDelayMs: number;
5744
+ multiplier?: number | undefined;
5745
+ jitterPercent?: number | undefined;
5746
+ } | undefined;
5747
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
4798
5748
  };
4799
5749
  };
4800
5750
  output: {
@@ -4806,6 +5756,36 @@ declare const routes: hono_hono_base.HonoBase<{
4806
5756
  };
4807
5757
  outputFormat: "json";
4808
5758
  status: 500;
5759
+ } | {
5760
+ input: {
5761
+ param: {
5762
+ eventStoreName: string;
5763
+ subscriberId: string;
5764
+ };
5765
+ } & {
5766
+ json: {
5767
+ eventFilter?: string | string[] | undefined;
5768
+ subscriberConfig?: Record<string, unknown> | undefined;
5769
+ retryPolicy?: {
5770
+ strategy: "fixed" | "exponential" | "linear";
5771
+ maxAttempts: number;
5772
+ initialDelayMs: number;
5773
+ maxDelayMs: number;
5774
+ multiplier?: number | undefined;
5775
+ jitterPercent?: number | undefined;
5776
+ } | undefined;
5777
+ status?: "ACTIVE" | "SUSPENDED" | undefined;
5778
+ };
5779
+ };
5780
+ output: {
5781
+ error: string;
5782
+ message: string;
5783
+ details?: {
5784
+ [x: string]: any;
5785
+ } | undefined;
5786
+ };
5787
+ outputFormat: "json";
5788
+ status: 409;
4809
5789
  };
4810
5790
  };
4811
5791
  }, "/api"> | hono_types.MergeSchemaPath<{
@@ -4987,7 +5967,7 @@ declare const routes: hono_hono_base.HonoBase<{
4987
5967
  status: 200;
4988
5968
  };
4989
5969
  };
4990
- }, "/api">) & {
5970
+ }, "/api"> | hono_types.MergeSchemaPath<{}, "/">) & {
4991
5971
  "/api/reference": {
4992
5972
  $get: {
4993
5973
  input: {};
@@ -4997,7 +5977,13 @@ declare const routes: hono_hono_base.HonoBase<{
4997
5977
  };
4998
5978
  };
4999
5979
  }, "/">;
5980
+ /**
5981
+ * Get the OpenAPI specification for the platform API.
5982
+ * This is used by documentation generators to extract the API schema at build time.
5983
+ * @returns The OpenAPI 3.0 specification object
5984
+ */
5985
+ declare function getOpenAPISpec(): Record<string, unknown>;
5000
5986
 
5001
5987
  type AppType = typeof routes;
5002
5988
 
5003
- export { type AppType, type BaseSubscriberConfig, type CloudflareWorkflowConfig, type DurableObjectConfig, EventBusAPI, EventBusDurableObject, type EventFilter, EventStoreAPI, EventStoreDurableObject, EventStoreManagerDurableObject, type EventType, ManagementAPI, type QueueConfig, SubscriberType, WebSocketManagerDurableObject, WebSocketsAPI, type WebhookConfig, type WildcardPattern, routes as default };
5989
+ export { type AppType, type BaseSubscriberConfig, type CloudflareWorkflowConfig, type DurableObjectConfig, EventBusAPI, EventBusDurableObject, type EventFilter, EventStoreAPI, EventStoreDurableObject, EventStoreManagerDurableObject, type EventType, ManagementAPI, type QueueConfig, SubscriberDurableObject, SubscriberType, WebSocketManagerDurableObject, WebSocketsAPI, type WebhookConfig, type WildcardPattern, routes as default, getOpenAPISpec };