@kronos-ts/axon-server 0.4.0 → 0.6.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.
Files changed (106) hide show
  1. package/dist/axon-server-event-store.d.ts +0 -16
  2. package/dist/axon-server-event-store.d.ts.map +1 -1
  3. package/dist/axon-server-event-store.js +73 -45
  4. package/dist/axon-server-event-store.js.map +1 -1
  5. package/dist/axon-server-snapshotting-event-store.d.ts +30 -0
  6. package/dist/axon-server-snapshotting-event-store.d.ts.map +1 -0
  7. package/dist/axon-server-snapshotting-event-store.js +154 -0
  8. package/dist/axon-server-snapshotting-event-store.js.map +1 -0
  9. package/dist/axon-server.d.ts +46 -65
  10. package/dist/axon-server.d.ts.map +1 -1
  11. package/dist/axon-server.js +490 -317
  12. package/dist/axon-server.js.map +1 -1
  13. package/dist/bounded-read.d.ts +19 -0
  14. package/dist/bounded-read.d.ts.map +1 -0
  15. package/dist/bounded-read.js +39 -0
  16. package/dist/bounded-read.js.map +1 -0
  17. package/dist/connection-manager.d.ts +2 -2
  18. package/dist/connection-manager.d.ts.map +1 -1
  19. package/dist/connection.d.ts +36 -21
  20. package/dist/connection.d.ts.map +1 -1
  21. package/dist/connection.js +84 -45
  22. package/dist/connection.js.map +1 -1
  23. package/dist/context-view.d.ts +2 -2
  24. package/dist/context-view.d.ts.map +1 -1
  25. package/dist/control-plane.d.ts +14 -24
  26. package/dist/control-plane.d.ts.map +1 -1
  27. package/dist/control-plane.js +6 -37
  28. package/dist/control-plane.js.map +1 -1
  29. package/dist/event-processor-info.d.ts +7 -25
  30. package/dist/event-processor-info.d.ts.map +1 -1
  31. package/dist/event-processor-info.js +16 -20
  32. package/dist/event-processor-info.js.map +1 -1
  33. package/dist/flow-controlled-sender.d.ts +2 -2
  34. package/dist/flow-controlled-sender.d.ts.map +1 -1
  35. package/dist/flow-controlled-sender.js +37 -17
  36. package/dist/flow-controlled-sender.js.map +1 -1
  37. package/dist/generated/command.d.ts +20 -20
  38. package/dist/generated/command.d.ts.map +1 -1
  39. package/dist/generated/common.d.ts +20 -20
  40. package/dist/generated/common.d.ts.map +1 -1
  41. package/dist/generated/control.d.ts +36 -40
  42. package/dist/generated/control.d.ts.map +1 -1
  43. package/dist/generated/dcb.d.ts +88 -94
  44. package/dist/generated/dcb.d.ts.map +1 -1
  45. package/dist/generated/event.d.ts +81 -84
  46. package/dist/generated/event.d.ts.map +1 -1
  47. package/dist/generated/google/protobuf/empty.d.ts +3 -4
  48. package/dist/generated/google/protobuf/empty.d.ts.map +1 -1
  49. package/dist/generated/query.d.ts +40 -40
  50. package/dist/generated/query.d.ts.map +1 -1
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/index.js.map +1 -1
  55. package/dist/message-size.d.ts +2 -2
  56. package/dist/message-size.d.ts.map +1 -1
  57. package/dist/outbound-stream.d.ts +7 -11
  58. package/dist/outbound-stream.d.ts.map +1 -1
  59. package/dist/outbound-stream.js +65 -16
  60. package/dist/outbound-stream.js.map +1 -1
  61. package/dist/platform-service.d.ts +14 -5
  62. package/dist/platform-service.d.ts.map +1 -1
  63. package/dist/platform-service.js +70 -10
  64. package/dist/platform-service.js.map +1 -1
  65. package/dist/resilience.d.ts +62 -0
  66. package/dist/resilience.d.ts.map +1 -0
  67. package/dist/resilience.js +103 -0
  68. package/dist/resilience.js.map +1 -0
  69. package/dist/shutdown-latch.d.ts +5 -4
  70. package/dist/shutdown-latch.d.ts.map +1 -1
  71. package/dist/shutdown-latch.js +20 -1
  72. package/dist/shutdown-latch.js.map +1 -1
  73. package/dist/stream-recovery.d.ts +9 -0
  74. package/dist/stream-recovery.d.ts.map +1 -0
  75. package/dist/stream-recovery.js +70 -0
  76. package/dist/stream-recovery.js.map +1 -0
  77. package/package.json +3 -3
  78. package/src/axon-server-event-store.ts +77 -47
  79. package/src/axon-server-snapshotting-event-store.ts +194 -0
  80. package/src/axon-server.ts +472 -374
  81. package/src/bounded-read.ts +43 -0
  82. package/src/connection-manager.ts +1 -1
  83. package/src/connection.ts +93 -59
  84. package/src/context-view.ts +1 -1
  85. package/src/control-plane.ts +22 -66
  86. package/src/event-processor-info.ts +23 -44
  87. package/src/flow-controlled-sender.ts +34 -15
  88. package/src/generated/command.ts +10 -10
  89. package/src/generated/common.ts +10 -10
  90. package/src/generated/control.ts +20 -20
  91. package/src/generated/dcb.ts +47 -47
  92. package/src/generated/event.ts +42 -42
  93. package/src/generated/google/protobuf/empty.ts +2 -2
  94. package/src/generated/query.ts +20 -20
  95. package/src/index.ts +1 -2
  96. package/src/message-size.ts +1 -1
  97. package/src/outbound-stream.ts +58 -28
  98. package/src/platform-service.ts +77 -13
  99. package/src/resilience.ts +149 -0
  100. package/src/shutdown-latch.ts +16 -3
  101. package/src/stream-recovery.ts +72 -0
  102. package/dist/axon-server-snapshot-store.d.ts +0 -12
  103. package/dist/axon-server-snapshot-store.d.ts.map +0 -1
  104. package/dist/axon-server-snapshot-store.js +0 -82
  105. package/dist/axon-server-snapshot-store.js.map +0 -1
  106. package/src/axon-server-snapshot-store.ts +0 -110
@@ -12,7 +12,7 @@ import { InstructionAck } from "./common.js";
12
12
  export const protobufPackage = "io.axoniq.axonserver.grpc.event.dcb";
13
13
 
14
14
  /** Request message to schedule an event */
15
- export interface ScheduleEventRequest {
15
+ export type ScheduleEventRequest = {
16
16
  /** timestamp when to publish the event */
17
17
  instant: bigint;
18
18
  /** the event to publish */
@@ -20,7 +20,7 @@ export interface ScheduleEventRequest {
20
20
  }
21
21
 
22
22
  /** Request message to reschedule an event */
23
- export interface RescheduleEventRequest {
23
+ export type RescheduleEventRequest = {
24
24
  /** schedule token of the event to reschedule */
25
25
  token: string;
26
26
  /** timestamp when to publish the event */
@@ -30,19 +30,19 @@ export interface RescheduleEventRequest {
30
30
  }
31
31
 
32
32
  /** Request message to cancel an event */
33
- export interface CancelScheduledEventRequest {
33
+ export type CancelScheduledEventRequest = {
34
34
  /** token of scheduled event to cancel */
35
35
  token: string;
36
36
  }
37
37
 
38
38
  /** Token to manage a scheduled event */
39
- export interface ScheduleToken {
39
+ export type ScheduleToken = {
40
40
  /** Field defining the token identifier */
41
41
  token: string;
42
42
  }
43
43
 
44
44
  /** The event message. */
45
- export interface Event {
45
+ export type Event = {
46
46
  /** The unique identifier of the event. */
47
47
  identifier: string;
48
48
  /** The timestamp of the event. */
@@ -57,13 +57,13 @@ export interface Event {
57
57
  metadata: { [key: string]: string };
58
58
  }
59
59
 
60
- export interface Event_MetadataEntry {
60
+ export type Event_MetadataEntry = {
61
61
  key: string;
62
62
  value: string;
63
63
  }
64
64
 
65
65
  /** The tag. Describes an event with more details. Usually using concepts from the Domain. */
66
- export interface Tag {
66
+ export type Tag = {
67
67
  /** The key of the tag. */
68
68
  key: Uint8Array;
69
69
  /** The value of the tag. */
@@ -71,7 +71,7 @@ export interface Tag {
71
71
  }
72
72
 
73
73
  /** The event described in more details by a list of tags. */
74
- export interface TaggedEvent {
74
+ export type TaggedEvent = {
75
75
  /** The event. */
76
76
  event:
77
77
  | Event
@@ -81,7 +81,7 @@ export interface TaggedEvent {
81
81
  }
82
82
 
83
83
  /** The event retrieved from the event store with its corresponding sequence. */
84
- export interface SequencedEvent {
84
+ export type SequencedEvent = {
85
85
  /** The sequence of the event. */
86
86
  sequence: bigint;
87
87
  /** The event. */
@@ -89,7 +89,7 @@ export interface SequencedEvent {
89
89
  }
90
90
 
91
91
  /** The message representing the request to append events to the event store. */
92
- export interface AppendEventsRequest {
92
+ export type AppendEventsRequest = {
93
93
  /** The condition used to check the validity of this request. If omitted, events will be appended unconditionally. */
94
94
  condition:
95
95
  | ConsistencyCondition
@@ -106,7 +106,7 @@ export interface AppendEventsRequest {
106
106
  * The response of a successful append events request. If there was an issue with the append events request,
107
107
  * the stream will complete with an error.
108
108
  */
109
- export interface AppendEventsResponse {
109
+ export type AppendEventsResponse = {
110
110
  /**
111
111
  * The sequence of the first event stored in the event store.
112
112
  * Corresponding to the list of events (a transaction) passed in the AppendEventsRequest.
@@ -128,7 +128,7 @@ export interface AppendEventsResponse {
128
128
  * the event store. It may also be cancelled by the client. Only events matching the given criteria
129
129
  * (a provided list of criterions) will be present in the stream. The stream is capped by the HEAD of the event store.
130
130
  */
131
- export interface SourceEventsRequest {
131
+ export type SourceEventsRequest = {
132
132
  /** An inclusive sequence of the first event to be included in the resulting stream. */
133
133
  fromSequence: bigint;
134
134
  /**
@@ -142,7 +142,7 @@ export interface SourceEventsRequest {
142
142
  * The response to the SourceEventsRequest. It consists either of an event (with its corresponding sequence) or a
143
143
  * consistency marker. The consistency marker should be used in a following AppendEventsRequest related to the criteria used in the SourceEventsRequest this response originates from.
144
144
  */
145
- export interface SourceEventsResponse {
145
+ export type SourceEventsResponse = {
146
146
  /** The event matching the criteria with its corresponding sequence. */
147
147
  event?:
148
148
  | SequencedEvent
@@ -155,7 +155,7 @@ export interface SourceEventsResponse {
155
155
  * The condition for an AppendEventsRequest. Consists of the consistency marker and the criteria
156
156
  * (a list of criterions).
157
157
  */
158
- export interface ConsistencyCondition {
158
+ export type ConsistencyCondition = {
159
159
  /**
160
160
  * The sequence used to start checking for the consistency of an append. If there are events with a sequence greater
161
161
  * or equal than the consistency marker and those are matching the given criteria, the condition is not met and the transaction
@@ -167,7 +167,7 @@ export interface ConsistencyCondition {
167
167
  }
168
168
 
169
169
  /** The integral part of the criteria. */
170
- export interface Criterion {
170
+ export type Criterion = {
171
171
  /** The criterion based on event tags and event names. */
172
172
  tagsAndNames: TagsAndNamesCriterion | undefined;
173
173
  }
@@ -176,7 +176,7 @@ export interface Criterion {
176
176
  * The criterion based on event tags and event names. The event meets this criterion if ALL tags from this criterion
177
177
  * are present in the tags of the event AND if the event name is present in one of the names of the this criterion.
178
178
  */
179
- export interface TagsAndNamesCriterion {
179
+ export type TagsAndNamesCriterion = {
180
180
  /** A list of event names. The event meets this criterion if its name is in one of the names in this list. */
181
181
  name: string[];
182
182
  /**
@@ -190,7 +190,7 @@ export interface TagsAndNamesCriterion {
190
190
  * The request to provide an infinite stream of events from the event store. The client may cancel the stream at any
191
191
  * time.
192
192
  */
193
- export interface StreamEventsRequest {
193
+ export type StreamEventsRequest = {
194
194
  /** The inclusive sequence to start streaming from. */
195
195
  fromSequence: bigint;
196
196
  /**
@@ -201,17 +201,17 @@ export interface StreamEventsRequest {
201
201
  }
202
202
 
203
203
  /** The response to the StreamEventsRequest. */
204
- export interface StreamEventsResponse {
204
+ export type StreamEventsResponse = {
205
205
  /** The event with its corresponding sequence. */
206
206
  event: SequencedEvent | undefined;
207
207
  }
208
208
 
209
209
  /** The request to retrieve the current HEAD of the event store. */
210
- export interface GetHeadRequest {
210
+ export type GetHeadRequest = {
211
211
  }
212
212
 
213
213
  /** The current HEAD of the event store. */
214
- export interface GetHeadResponse {
214
+ export type GetHeadResponse = {
215
215
  /**
216
216
  * The sequence of the current head. Points to the position of the first event to be appended. The HEAD of an empty
217
217
  * event store is 0.
@@ -220,11 +220,11 @@ export interface GetHeadResponse {
220
220
  }
221
221
 
222
222
  /** The request to retrieve the current TAIL of the event store. */
223
- export interface GetTailRequest {
223
+ export type GetTailRequest = {
224
224
  }
225
225
 
226
226
  /** The current TAIL of the event store. */
227
- export interface GetTailResponse {
227
+ export type GetTailResponse = {
228
228
  /**
229
229
  * The sequence of the first event in the event store. 0 for an empty event store. 0 for a non-truncated event store.
230
230
  * Non-zero for a truncated event store.
@@ -238,19 +238,19 @@ export interface GetTailResponse {
238
238
  * returned. If the provided timestamp is greater that the sequence of the last event in the event store,
239
239
  * the HEAD is returned.
240
240
  */
241
- export interface GetSequenceAtRequest {
241
+ export type GetSequenceAtRequest = {
242
242
  /** The timestamp. */
243
243
  timestamp: bigint;
244
244
  }
245
245
 
246
246
  /** The sequence of the event approximately close to the provided timestamp. */
247
- export interface GetSequenceAtResponse {
247
+ export type GetSequenceAtResponse = {
248
248
  /** The sequence of the event. */
249
249
  sequence: bigint;
250
250
  }
251
251
 
252
252
  /** The request to add tags to the event. */
253
- export interface AddTagsRequest {
253
+ export type AddTagsRequest = {
254
254
  /** The sequence of the event whose tags list will be expanded with the tags from the request. */
255
255
  sequence: bigint;
256
256
  /**
@@ -261,11 +261,11 @@ export interface AddTagsRequest {
261
261
  }
262
262
 
263
263
  /** The response indicating a successful addition of tags to the event. */
264
- export interface AddTagsResponse {
264
+ export type AddTagsResponse = {
265
265
  }
266
266
 
267
267
  /** The request to remove tags from the event. */
268
- export interface RemoveTagsRequest {
268
+ export type RemoveTagsRequest = {
269
269
  /** The sequence of the event whose tags should be removed. */
270
270
  sequence: bigint;
271
271
  /** Tags to be removed. If the event is not tagged with listed tags, they are skipped. */
@@ -273,23 +273,23 @@ export interface RemoveTagsRequest {
273
273
  }
274
274
 
275
275
  /** The response indicating a successful removal of tags for the event. */
276
- export interface RemoveTagsResponse {
276
+ export type RemoveTagsResponse = {
277
277
  }
278
278
 
279
279
  /** The request to retrieve tags of the event. */
280
- export interface GetTagsRequest {
280
+ export type GetTagsRequest = {
281
281
  /** The sequence of the event whose tags should be retrieved. */
282
282
  sequence: bigint;
283
283
  }
284
284
 
285
285
  /** The response containing tags of an event. */
286
- export interface GetTagsResponse {
286
+ export type GetTagsResponse = {
287
287
  /** The tags associated to the event. */
288
288
  tag: Tag[];
289
289
  }
290
290
 
291
291
  /** The snapshot. */
292
- export interface Snapshot {
292
+ export type Snapshot = {
293
293
  /** The name of the snapshot. */
294
294
  name: string;
295
295
  /** The version of the snapshot. */
@@ -302,13 +302,13 @@ export interface Snapshot {
302
302
  metadata: { [key: string]: string };
303
303
  }
304
304
 
305
- export interface Snapshot_MetadataEntry {
305
+ export type Snapshot_MetadataEntry = {
306
306
  key: string;
307
307
  value: string;
308
308
  }
309
309
 
310
310
  /** The request to add the snapshot to the snapshot store. */
311
- export interface AddSnapshotRequest {
311
+ export type AddSnapshotRequest = {
312
312
  /** The key this snapshot is added to. */
313
313
  key: Uint8Array;
314
314
  /**
@@ -323,14 +323,14 @@ export interface AddSnapshotRequest {
323
323
  }
324
324
 
325
325
  /** The response indicating the successful addition of the snapshot. */
326
- export interface AddSnapshotResponse {
326
+ export type AddSnapshotResponse = {
327
327
  }
328
328
 
329
329
  /**
330
330
  * The request to delete the snapshot from the snapshot store.
331
331
  * Deletes from a sequence of `0` to the specified `to_sequence`
332
332
  */
333
- export interface DeleteSnapshotsRequest {
333
+ export type DeleteSnapshotsRequest = {
334
334
  /** The key the snapshot is identified by. */
335
335
  key: Uint8Array;
336
336
  /** The exclusive upper bound sequence of the snapshot to end the deletion. */
@@ -338,11 +338,11 @@ export interface DeleteSnapshotsRequest {
338
338
  }
339
339
 
340
340
  /** The response indicating the successful deletion of the snapshot. */
341
- export interface DeleteSnapshotsResponse {
341
+ export type DeleteSnapshotsResponse = {
342
342
  }
343
343
 
344
344
  /** The request to retrieve all snapshots from the snapshot store based on the key and sequence bounds. */
345
- export interface ListSnapshotsRequest {
345
+ export type ListSnapshotsRequest = {
346
346
  /** The key of the snapshot. */
347
347
  key: Uint8Array;
348
348
  /** The inclusive bottom bound sequence used to filter out snapshots. */
@@ -352,7 +352,7 @@ export interface ListSnapshotsRequest {
352
352
  }
353
353
 
354
354
  /** The response to the ListSnapshotRequest. */
355
- export interface ListSnapshotsResponse {
355
+ export type ListSnapshotsResponse = {
356
356
  /** The key of the snapshot. */
357
357
  key: Uint8Array;
358
358
  /** The sequence of the snapshot. */
@@ -362,13 +362,13 @@ export interface ListSnapshotsResponse {
362
362
  }
363
363
 
364
364
  /** The request to retrieve the snapshot with the highest sequence from the snapshot store. */
365
- export interface GetLastSnapshotRequest {
365
+ export type GetLastSnapshotRequest = {
366
366
  /** The key of the snapshot. */
367
367
  key: Uint8Array;
368
368
  }
369
369
 
370
370
  /** The response to GetLatestSnapshotRequest. */
371
- export interface GetLastSnapshotResponse {
371
+ export type GetLastSnapshotResponse = {
372
372
  /** The key of the snapshot. */
373
373
  key: Uint8Array;
374
374
  /** The sequence of the snapshot. */
@@ -3530,7 +3530,7 @@ export const DcbEventStoreDefinition = {
3530
3530
  },
3531
3531
  } as const;
3532
3532
 
3533
- export interface DcbEventStoreServiceImplementation<CallContextExt = {}> {
3533
+ export type DcbEventStoreServiceImplementation<CallContextExt = {}> = {
3534
3534
  /** Appends new events to the store. */
3535
3535
  append(
3536
3536
  request: AsyncIterable<AppendEventsRequest>,
@@ -3573,7 +3573,7 @@ export interface DcbEventStoreServiceImplementation<CallContextExt = {}> {
3573
3573
  getTags(request: GetTagsRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetTagsResponse>>;
3574
3574
  }
3575
3575
 
3576
- export interface DcbEventStoreClient<CallOptionsExt = {}> {
3576
+ export type DcbEventStoreClient<CallOptionsExt = {}> = {
3577
3577
  /** Appends new events to the store. */
3578
3578
  append(
3579
3579
  request: AsyncIterable<DeepPartial<AppendEventsRequest>>,
@@ -3661,7 +3661,7 @@ export const DcbSnapshotStoreDefinition = {
3661
3661
  },
3662
3662
  } as const;
3663
3663
 
3664
- export interface DcbSnapshotStoreServiceImplementation<CallContextExt = {}> {
3664
+ export type DcbSnapshotStoreServiceImplementation<CallContextExt = {}> = {
3665
3665
  /** Adds a snapshot to the snapshot store. */
3666
3666
  add(request: AddSnapshotRequest, context: CallContext & CallContextExt): Promise<DeepPartial<AddSnapshotResponse>>;
3667
3667
  /** Deletes a snapshot from the snapshot store. */
@@ -3681,7 +3681,7 @@ export interface DcbSnapshotStoreServiceImplementation<CallContextExt = {}> {
3681
3681
  ): Promise<DeepPartial<GetLastSnapshotResponse>>;
3682
3682
  }
3683
3683
 
3684
- export interface DcbSnapshotStoreClient<CallOptionsExt = {}> {
3684
+ export type DcbSnapshotStoreClient<CallOptionsExt = {}> = {
3685
3685
  /** Adds a snapshot to the snapshot store. */
3686
3686
  add(request: DeepPartial<AddSnapshotRequest>, options?: CallOptions & CallOptionsExt): Promise<AddSnapshotResponse>;
3687
3687
  /** Deletes a snapshot from the snapshot store. */
@@ -3737,7 +3737,7 @@ export const DcbEventSchedulerDefinition = {
3737
3737
  },
3738
3738
  } as const;
3739
3739
 
3740
- export interface DcbEventSchedulerServiceImplementation<CallContextExt = {}> {
3740
+ export type DcbEventSchedulerServiceImplementation<CallContextExt = {}> = {
3741
3741
  /** Schedule the given event for publication at the given time}. The returned ScheduleToken can be used to reschedule or cancel the planned publication. */
3742
3742
  scheduleEvent(
3743
3743
  request: ScheduleEventRequest,
@@ -3755,7 +3755,7 @@ export interface DcbEventSchedulerServiceImplementation<CallContextExt = {}> {
3755
3755
  ): Promise<DeepPartial<InstructionAck>>;
3756
3756
  }
3757
3757
 
3758
- export interface DcbEventSchedulerClient<CallOptionsExt = {}> {
3758
+ export type DcbEventSchedulerClient<CallOptionsExt = {}> = {
3759
3759
  /** Schedule the given event for publication at the given time}. The returned ScheduleToken can be used to reschedule or cancel the planned publication. */
3760
3760
  scheduleEvent(
3761
3761
  request: DeepPartial<ScheduleEventRequest>,
@@ -3816,7 +3816,7 @@ function isSet(value: any): boolean {
3816
3816
 
3817
3817
  export type ServerStreamingMethodResult<Response> = { [Symbol.asyncIterator](): AsyncIterator<Response, void> };
3818
3818
 
3819
- export interface MessageFns<T> {
3819
+ export type MessageFns<T> = {
3820
3820
  encode(message: T, writer?: BinaryWriter): BinaryWriter;
3821
3821
  decode(input: BinaryReader | Uint8Array, length?: number): T;
3822
3822
  fromJSON(object: any): T;