@delta-base/core 1.2.5 → 1.2.7
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 +42 -73
- package/dist/index.js +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
|
3
3
|
import * as hono_types from 'hono/types';
|
|
4
4
|
import { z, OpenAPIHono } from '@hono/zod-openapi';
|
|
5
5
|
import { DurableObject } from 'cloudflare:workers';
|
|
6
|
+
import * as _delta_base_toolkit from '@delta-base/toolkit';
|
|
7
|
+
import { Event, AppendToStreamOptions, ReadStreamOptions, ReadEvent } from '@delta-base/toolkit';
|
|
6
8
|
|
|
7
9
|
declare namespace ManagementAPI {
|
|
8
10
|
const EventStoreSchema: z.ZodObject<{
|
|
@@ -272,25 +274,25 @@ declare namespace EventStoreAPI {
|
|
|
272
274
|
createdAt: z.ZodString;
|
|
273
275
|
}, "strip", z.ZodTypeAny, {
|
|
274
276
|
type: string;
|
|
275
|
-
data: Record<string, unknown>;
|
|
276
277
|
createdAt: string;
|
|
278
|
+
data: Record<string, unknown>;
|
|
277
279
|
globalPosition: number;
|
|
278
280
|
streamPosition: number;
|
|
279
281
|
streamId: string;
|
|
282
|
+
eventId: string;
|
|
280
283
|
schemaVersion: string;
|
|
281
284
|
transactionId: string;
|
|
282
|
-
eventId: string;
|
|
283
285
|
metadata?: Record<string, unknown> | undefined;
|
|
284
286
|
}, {
|
|
285
287
|
type: string;
|
|
286
|
-
data: Record<string, unknown>;
|
|
287
288
|
createdAt: string;
|
|
289
|
+
data: Record<string, unknown>;
|
|
288
290
|
globalPosition: number;
|
|
289
291
|
streamPosition: number;
|
|
290
292
|
streamId: string;
|
|
293
|
+
eventId: string;
|
|
291
294
|
schemaVersion: string;
|
|
292
295
|
transactionId: string;
|
|
293
|
-
eventId: string;
|
|
294
296
|
metadata?: Record<string, unknown> | undefined;
|
|
295
297
|
}>;
|
|
296
298
|
export const AppendEventsRequestSchema: z.ZodObject<{
|
|
@@ -458,53 +460,53 @@ declare namespace EventStoreAPI {
|
|
|
458
460
|
createdAt: z.ZodString;
|
|
459
461
|
}, "strip", z.ZodTypeAny, {
|
|
460
462
|
type: string;
|
|
461
|
-
data: Record<string, unknown>;
|
|
462
463
|
createdAt: string;
|
|
464
|
+
data: Record<string, unknown>;
|
|
463
465
|
globalPosition: number;
|
|
464
466
|
streamPosition: number;
|
|
465
467
|
streamId: string;
|
|
468
|
+
eventId: string;
|
|
466
469
|
schemaVersion: string;
|
|
467
470
|
transactionId: string;
|
|
468
|
-
eventId: string;
|
|
469
471
|
metadata?: Record<string, unknown> | undefined;
|
|
470
472
|
}, {
|
|
471
473
|
type: string;
|
|
472
|
-
data: Record<string, unknown>;
|
|
473
474
|
createdAt: string;
|
|
475
|
+
data: Record<string, unknown>;
|
|
474
476
|
globalPosition: number;
|
|
475
477
|
streamPosition: number;
|
|
476
478
|
streamId: string;
|
|
479
|
+
eventId: string;
|
|
477
480
|
schemaVersion: string;
|
|
478
481
|
transactionId: string;
|
|
479
|
-
eventId: string;
|
|
480
482
|
metadata?: Record<string, unknown> | undefined;
|
|
481
483
|
}>, "many">;
|
|
482
484
|
currentStreamVersion: z.ZodNumber;
|
|
483
485
|
}, "strip", z.ZodTypeAny, {
|
|
484
486
|
events: {
|
|
485
487
|
type: string;
|
|
486
|
-
data: Record<string, unknown>;
|
|
487
488
|
createdAt: string;
|
|
489
|
+
data: Record<string, unknown>;
|
|
488
490
|
globalPosition: number;
|
|
489
491
|
streamPosition: number;
|
|
490
492
|
streamId: string;
|
|
493
|
+
eventId: string;
|
|
491
494
|
schemaVersion: string;
|
|
492
495
|
transactionId: string;
|
|
493
|
-
eventId: string;
|
|
494
496
|
metadata?: Record<string, unknown> | undefined;
|
|
495
497
|
}[];
|
|
496
498
|
currentStreamVersion: number;
|
|
497
499
|
}, {
|
|
498
500
|
events: {
|
|
499
501
|
type: string;
|
|
500
|
-
data: Record<string, unknown>;
|
|
501
502
|
createdAt: string;
|
|
503
|
+
data: Record<string, unknown>;
|
|
502
504
|
globalPosition: number;
|
|
503
505
|
streamPosition: number;
|
|
504
506
|
streamId: string;
|
|
507
|
+
eventId: string;
|
|
505
508
|
schemaVersion: string;
|
|
506
509
|
transactionId: string;
|
|
507
|
-
eventId: string;
|
|
508
510
|
metadata?: Record<string, unknown> | undefined;
|
|
509
511
|
}[];
|
|
510
512
|
currentStreamVersion: number;
|
|
@@ -530,9 +532,9 @@ declare namespace EventStoreAPI {
|
|
|
530
532
|
limit?: number | undefined;
|
|
531
533
|
offset?: number | undefined;
|
|
532
534
|
streamId?: string | undefined;
|
|
533
|
-
transactionId?: string | undefined;
|
|
534
535
|
phase?: number | undefined;
|
|
535
536
|
eventId?: string | undefined;
|
|
537
|
+
transactionId?: string | undefined;
|
|
536
538
|
fromPosition?: number | undefined;
|
|
537
539
|
toPosition?: number | undefined;
|
|
538
540
|
fromDate?: string | undefined;
|
|
@@ -546,9 +548,9 @@ declare namespace EventStoreAPI {
|
|
|
546
548
|
limit?: string | undefined;
|
|
547
549
|
offset?: string | undefined;
|
|
548
550
|
streamId?: string | undefined;
|
|
549
|
-
transactionId?: string | undefined;
|
|
550
551
|
phase?: string | undefined;
|
|
551
552
|
eventId?: string | undefined;
|
|
553
|
+
transactionId?: string | undefined;
|
|
552
554
|
fromPosition?: string | undefined;
|
|
553
555
|
toPosition?: string | undefined;
|
|
554
556
|
fromDate?: string | undefined;
|
|
@@ -634,25 +636,25 @@ declare namespace EventStoreAPI {
|
|
|
634
636
|
createdAt: z.ZodString;
|
|
635
637
|
}, "strip", z.ZodTypeAny, {
|
|
636
638
|
type: string;
|
|
637
|
-
data: Record<string, unknown>;
|
|
638
639
|
createdAt: string;
|
|
640
|
+
data: Record<string, unknown>;
|
|
639
641
|
globalPosition: number;
|
|
640
642
|
streamPosition: number;
|
|
641
643
|
streamId: string;
|
|
644
|
+
eventId: string;
|
|
642
645
|
schemaVersion: string;
|
|
643
646
|
transactionId: string;
|
|
644
|
-
eventId: string;
|
|
645
647
|
metadata?: Record<string, unknown> | undefined;
|
|
646
648
|
}, {
|
|
647
649
|
type: string;
|
|
648
|
-
data: Record<string, unknown>;
|
|
649
650
|
createdAt: string;
|
|
651
|
+
data: Record<string, unknown>;
|
|
650
652
|
globalPosition: number;
|
|
651
653
|
streamPosition: number;
|
|
652
654
|
streamId: string;
|
|
655
|
+
eventId: string;
|
|
653
656
|
schemaVersion: string;
|
|
654
657
|
transactionId: string;
|
|
655
|
-
eventId: string;
|
|
656
658
|
metadata?: Record<string, unknown> | undefined;
|
|
657
659
|
}>, "many">;
|
|
658
660
|
pagination: z.ZodObject<{
|
|
@@ -674,14 +676,14 @@ declare namespace EventStoreAPI {
|
|
|
674
676
|
}, "strip", z.ZodTypeAny, {
|
|
675
677
|
events: {
|
|
676
678
|
type: string;
|
|
677
|
-
data: Record<string, unknown>;
|
|
678
679
|
createdAt: string;
|
|
680
|
+
data: Record<string, unknown>;
|
|
679
681
|
globalPosition: number;
|
|
680
682
|
streamPosition: number;
|
|
681
683
|
streamId: string;
|
|
684
|
+
eventId: string;
|
|
682
685
|
schemaVersion: string;
|
|
683
686
|
transactionId: string;
|
|
684
|
-
eventId: string;
|
|
685
687
|
metadata?: Record<string, unknown> | undefined;
|
|
686
688
|
}[];
|
|
687
689
|
pagination: {
|
|
@@ -693,14 +695,14 @@ declare namespace EventStoreAPI {
|
|
|
693
695
|
}, {
|
|
694
696
|
events: {
|
|
695
697
|
type: string;
|
|
696
|
-
data: Record<string, unknown>;
|
|
697
698
|
createdAt: string;
|
|
699
|
+
data: Record<string, unknown>;
|
|
698
700
|
globalPosition: number;
|
|
699
701
|
streamPosition: number;
|
|
700
702
|
streamId: string;
|
|
703
|
+
eventId: string;
|
|
701
704
|
schemaVersion: string;
|
|
702
705
|
transactionId: string;
|
|
703
|
-
eventId: string;
|
|
704
706
|
metadata?: Record<string, unknown> | undefined;
|
|
705
707
|
}[];
|
|
706
708
|
pagination: {
|
|
@@ -859,15 +861,15 @@ declare namespace EventBusAPI {
|
|
|
859
861
|
namespace: z.ZodString;
|
|
860
862
|
id: z.ZodString;
|
|
861
863
|
}, "strip", z.ZodTypeAny, {
|
|
862
|
-
id: string;
|
|
863
864
|
namespace: string;
|
|
865
|
+
id: string;
|
|
864
866
|
retryPolicy?: {
|
|
865
867
|
maxAttempts: number;
|
|
866
868
|
backoffMinutes: number;
|
|
867
869
|
} | undefined;
|
|
868
870
|
}, {
|
|
869
|
-
id: string;
|
|
870
871
|
namespace: string;
|
|
872
|
+
id: string;
|
|
871
873
|
retryPolicy?: {
|
|
872
874
|
maxAttempts: number;
|
|
873
875
|
backoffMinutes: number;
|
|
@@ -876,8 +878,8 @@ declare namespace EventBusAPI {
|
|
|
876
878
|
}, "strip", z.ZodTypeAny, {
|
|
877
879
|
type: "durable_object";
|
|
878
880
|
config: {
|
|
879
|
-
id: string;
|
|
880
881
|
namespace: string;
|
|
882
|
+
id: string;
|
|
881
883
|
retryPolicy?: {
|
|
882
884
|
maxAttempts: number;
|
|
883
885
|
backoffMinutes: number;
|
|
@@ -886,8 +888,8 @@ declare namespace EventBusAPI {
|
|
|
886
888
|
}, {
|
|
887
889
|
type: "durable_object";
|
|
888
890
|
config: {
|
|
889
|
-
id: string;
|
|
890
891
|
namespace: string;
|
|
892
|
+
id: string;
|
|
891
893
|
retryPolicy?: {
|
|
892
894
|
maxAttempts: number;
|
|
893
895
|
backoffMinutes: number;
|
|
@@ -1104,8 +1106,8 @@ declare namespace EventBusAPI {
|
|
|
1104
1106
|
subscriber: {
|
|
1105
1107
|
type: "durable_object";
|
|
1106
1108
|
config: {
|
|
1107
|
-
id: string;
|
|
1108
1109
|
namespace: string;
|
|
1110
|
+
id: string;
|
|
1109
1111
|
retryPolicy?: {
|
|
1110
1112
|
maxAttempts: number;
|
|
1111
1113
|
backoffMinutes: number;
|
|
@@ -1159,8 +1161,8 @@ declare namespace EventBusAPI {
|
|
|
1159
1161
|
subscriber: {
|
|
1160
1162
|
type: "durable_object";
|
|
1161
1163
|
config: {
|
|
1162
|
-
id: string;
|
|
1163
1164
|
namespace: string;
|
|
1165
|
+
id: string;
|
|
1164
1166
|
retryPolicy?: {
|
|
1165
1167
|
maxAttempts: number;
|
|
1166
1168
|
backoffMinutes: number;
|
|
@@ -1618,50 +1620,6 @@ declare class EventBusDurableObject extends DurableObject<Env$1> {
|
|
|
1618
1620
|
private validateEventFilter;
|
|
1619
1621
|
}
|
|
1620
1622
|
|
|
1621
|
-
type Flavour<K, T> = K & {
|
|
1622
|
-
readonly __brand?: T;
|
|
1623
|
-
};
|
|
1624
|
-
type DefaultRecord = Record<string, unknown>;
|
|
1625
|
-
type Event<EventType extends string = string, EventData extends DefaultRecord = DefaultRecord, EventMetaData extends DefaultRecord = DefaultRecord> = Flavour<Readonly<{
|
|
1626
|
-
type: EventType;
|
|
1627
|
-
data: EventData;
|
|
1628
|
-
metadata?: EventMetaData;
|
|
1629
|
-
}>, 'Event'>;
|
|
1630
|
-
type EventTypeOf<T extends Event> = T['type'];
|
|
1631
|
-
type EventDataOf<T extends Event> = T['data'];
|
|
1632
|
-
type EventMetaDataOf<T extends Event> = T['metadata'];
|
|
1633
|
-
type ReadEvent<EventType extends Event = Event> = {
|
|
1634
|
-
type: EventTypeOf<EventType>;
|
|
1635
|
-
data: EventDataOf<EventType>;
|
|
1636
|
-
streamId: string;
|
|
1637
|
-
streamPosition: number;
|
|
1638
|
-
globalPosition: number;
|
|
1639
|
-
eventId: string;
|
|
1640
|
-
schemaVersion: string;
|
|
1641
|
-
transactionId: string;
|
|
1642
|
-
createdAt: string;
|
|
1643
|
-
metadata?: EventMetaDataOf<EventType>;
|
|
1644
|
-
};
|
|
1645
|
-
type ExpectedStreamVersion<VersionType = DefaultStreamVersionType> = ExpectedStreamVersionWithValue<VersionType> | ExpectedStreamVersionGeneral;
|
|
1646
|
-
type ExpectedStreamVersionWithValue<VersionType = DefaultStreamVersionType> = Flavour<VersionType, 'StreamVersion'>;
|
|
1647
|
-
type ExpectedStreamVersionGeneral = Flavour<'stream_exists' | 'no_stream' | 'any', 'StreamVersion'>;
|
|
1648
|
-
type DefaultStreamVersionType = number;
|
|
1649
|
-
type ReadStreamOptions<StreamVersion = DefaultStreamVersionType> = ({
|
|
1650
|
-
from: StreamVersion;
|
|
1651
|
-
} | {
|
|
1652
|
-
to: StreamVersion;
|
|
1653
|
-
} | {
|
|
1654
|
-
from: StreamVersion;
|
|
1655
|
-
maxCount?: DefaultStreamVersionType;
|
|
1656
|
-
} | {
|
|
1657
|
-
expectedStreamVersion: ExpectedStreamVersion<StreamVersion>;
|
|
1658
|
-
}) & {
|
|
1659
|
-
expectedStreamVersion?: ExpectedStreamVersion<StreamVersion>;
|
|
1660
|
-
};
|
|
1661
|
-
type AppendToStreamOptions<StreamVersion = DefaultStreamVersionType> = {
|
|
1662
|
-
expectedStreamVersion?: ExpectedStreamVersion<StreamVersion>;
|
|
1663
|
-
};
|
|
1664
|
-
|
|
1665
1623
|
/**
|
|
1666
1624
|
* Query parameters for filtering events
|
|
1667
1625
|
*/
|
|
@@ -1789,7 +1747,18 @@ declare class EventStoreDurableObject extends DurableObject<Env> {
|
|
|
1789
1747
|
*/
|
|
1790
1748
|
readStream(streamId: string, options?: ReadStreamOptions): Promise<{
|
|
1791
1749
|
currentStreamVersion: number;
|
|
1792
|
-
events:
|
|
1750
|
+
events: {
|
|
1751
|
+
type: string;
|
|
1752
|
+
data: _delta_base_toolkit.DefaultRecord;
|
|
1753
|
+
streamId: _delta_base_toolkit.StreamId;
|
|
1754
|
+
streamPosition: _delta_base_toolkit.StreamPosition;
|
|
1755
|
+
globalPosition: _delta_base_toolkit.GlobalPosition;
|
|
1756
|
+
eventId: string;
|
|
1757
|
+
schemaVersion: string;
|
|
1758
|
+
transactionId: string;
|
|
1759
|
+
createdAt: string;
|
|
1760
|
+
metadata?: undefined;
|
|
1761
|
+
}[];
|
|
1793
1762
|
streamExists: boolean;
|
|
1794
1763
|
}>;
|
|
1795
1764
|
/**
|