@ocoda/event-sourcing-mariadb 3.0.2 → 4.0.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/index.d.ts +4 -77
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -888
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +5 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +2 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/mariadb-event-entity.d.ts +13 -0
- package/dist/interfaces/mariadb-event-entity.d.ts.map +1 -0
- package/dist/interfaces/mariadb-event-entity.js +2 -0
- package/dist/interfaces/mariadb-event-entity.js.map +1 -0
- package/dist/interfaces/mariadb-event-store-config.d.ts +8 -0
- package/dist/interfaces/mariadb-event-store-config.d.ts.map +1 -0
- package/dist/interfaces/mariadb-event-store-config.js +2 -0
- package/dist/interfaces/mariadb-event-store-config.js.map +1 -0
- package/dist/interfaces/mariadb-snapshot-entity.d.ts +12 -0
- package/dist/interfaces/mariadb-snapshot-entity.d.ts.map +1 -0
- package/dist/interfaces/mariadb-snapshot-entity.js +2 -0
- package/dist/interfaces/mariadb-snapshot-entity.js.map +1 -0
- package/dist/interfaces/mariadb-snapshot-store-config.d.ts +8 -0
- package/dist/interfaces/mariadb-snapshot-store-config.d.ts.map +1 -0
- package/dist/interfaces/mariadb-snapshot-store-config.js +2 -0
- package/dist/interfaces/mariadb-snapshot-store-config.js.map +1 -0
- package/dist/mariadb.event-store.d.ts +20 -0
- package/dist/mariadb.event-store.d.ts.map +1 -0
- package/dist/mariadb.event-store.js +243 -0
- package/dist/mariadb.event-store.js.map +1 -0
- package/dist/mariadb.snapshot-store.d.ts +26 -0
- package/dist/mariadb.snapshot-store.d.ts.map +1 -0
- package/dist/mariadb.snapshot-store.js +287 -0
- package/dist/mariadb.snapshot-store.js.map +1 -0
- package/dist/mariadb.utils.d.ts +16 -0
- package/dist/mariadb.utils.d.ts.map +1 -0
- package/dist/mariadb.utils.js +39 -0
- package/dist/mariadb.utils.js.map +1 -0
- package/package.json +60 -39
- package/CHANGELOG.md +0 -236
- package/index.d.ts +0 -1
- package/index.js +0 -17
package/README.md
CHANGED
|
@@ -25,6 +25,14 @@ This is a complementing module for `@ocoda/event-sourcing`, a powerful library d
|
|
|
25
25
|
|
|
26
26
|
This store-driver library uses [MariaDB](https://mariadb.com/) as an underlying driver for event- and snapshot-stores, and needs to be installed together with the core module `@ocoda/event-sourcing` in order to get started.
|
|
27
27
|
|
|
28
|
+
## Installation
|
|
29
|
+
The `mariadb` driver is a peer dependency, so install it next to the core module:
|
|
30
|
+
```bash
|
|
31
|
+
npm install @ocoda/event-sourcing @ocoda/event-sourcing-mariadb mariadb
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Requires Node.js 22.12 or later and NestJS 12. The package is ESM-only; CommonJS applications load it through `require()`, which Node.js supports for ES modules since 22.12.
|
|
35
|
+
|
|
28
36
|
## Documentation 📗
|
|
29
37
|
Ready to dive right in? Visit [the documentation](https://ocoda.github.io/event-sourcing) to find out how to get started.
|
|
30
38
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,77 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type MariaDBEventEntity = {
|
|
6
|
-
stream_id: string;
|
|
7
|
-
version: number;
|
|
8
|
-
event: string;
|
|
9
|
-
payload: IEventPayload<IEvent>;
|
|
10
|
-
event_id: string;
|
|
11
|
-
aggregate_id: string;
|
|
12
|
-
occurred_on: Date;
|
|
13
|
-
correlation_id: string | null;
|
|
14
|
-
causation_id: string | null;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
declare class MariaDBEventStore extends EventStore<MariaDBEventStoreConfig> {
|
|
18
|
-
private pool;
|
|
19
|
-
connect(): Promise<void>;
|
|
20
|
-
disconnect(): Promise<void>;
|
|
21
|
-
ensureCollection(pool?: IEventPool): Promise<IEventCollection>;
|
|
22
|
-
listCollections(filter?: IEventCollectionFilter): AsyncGenerator<IEventCollection[]>;
|
|
23
|
-
getEvents({ streamId }: EventStream, filter?: IEventFilter): AsyncGenerator<IEvent[]>;
|
|
24
|
-
getEvent({ streamId }: EventStream, version: number, pool?: IEventPool): Promise<IEvent>;
|
|
25
|
-
appendEvents(stream: EventStream, aggregateVersion: number, events: IEvent[] | EventEnvelope[], pool?: IEventPool): Promise<EventEnvelope[]>;
|
|
26
|
-
getEnvelope({ streamId }: EventStream, version: number, pool?: IEventPool): Promise<EventEnvelope>;
|
|
27
|
-
getEnvelopes({ streamId }: EventStream, filter?: IEventFilter): AsyncGenerator<EventEnvelope[]>;
|
|
28
|
-
getAllEnvelopes(filter: IAllEventsFilter): AsyncGenerator<EventEnvelope[]>;
|
|
29
|
-
/**
|
|
30
|
-
* Best effort lookup of the latest version of a stream, used to report a conflict.
|
|
31
|
-
*/
|
|
32
|
-
private getLatestVersion;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface MariaDBEventStoreConfig extends EventStoreConfig, PoolConfig {
|
|
36
|
-
driver: Type<MariaDBEventStore>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
type MariaDBSnapshotEntity<A extends AggregateRoot> = {
|
|
40
|
-
stream_id: string;
|
|
41
|
-
version: number;
|
|
42
|
-
payload: ISnapshot<A>;
|
|
43
|
-
snapshot_id: string;
|
|
44
|
-
aggregate_id: string;
|
|
45
|
-
registered_on: Date;
|
|
46
|
-
aggregate_name: string;
|
|
47
|
-
latest?: string;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
declare class MariaDBSnapshotStore extends SnapshotStore<MariaDBSnapshotStoreConfig> {
|
|
51
|
-
private pool;
|
|
52
|
-
connect(): Promise<void>;
|
|
53
|
-
disconnect(): Promise<void>;
|
|
54
|
-
ensureCollection(pool?: ISnapshotPool): Promise<ISnapshotCollection>;
|
|
55
|
-
listCollections(filter?: ISnapshotCollectionFilter): AsyncGenerator<ISnapshotCollection[]>;
|
|
56
|
-
getSnapshots<A extends AggregateRoot>({ streamId }: SnapshotStream, filter?: ISnapshotFilter): AsyncGenerator<ISnapshot<A>[]>;
|
|
57
|
-
getSnapshot<A extends AggregateRoot>({ streamId }: SnapshotStream, version: number, pool?: ISnapshotPool): Promise<ISnapshot<A>>;
|
|
58
|
-
appendSnapshot<A extends AggregateRoot>(stream: SnapshotStream, aggregateVersion: number, snapshot: ISnapshot<A>, pool?: ISnapshotPool): Promise<SnapshotEnvelope<A>>;
|
|
59
|
-
getLastSnapshot<A extends AggregateRoot>(stream: SnapshotStream, pool?: ISnapshotPool): Promise<ISnapshot<A> | void>;
|
|
60
|
-
getLastSnapshots<A extends AggregateRoot>(streams: SnapshotStream[], pool?: ISnapshotPool): Promise<Map<SnapshotStream, ISnapshot<A>>>;
|
|
61
|
-
getLastEnvelope<A extends AggregateRoot>(stream: SnapshotStream, pool?: ISnapshotPool): Promise<SnapshotEnvelope<A> | void>;
|
|
62
|
-
getEnvelopes<A extends AggregateRoot>({ streamId }: SnapshotStream, filter?: ISnapshotFilter): AsyncGenerator<SnapshotEnvelope<A>[]>;
|
|
63
|
-
getEnvelope<A extends AggregateRoot>({ streamId }: SnapshotStream, version: number, pool?: ISnapshotPool): Promise<SnapshotEnvelope<A>>;
|
|
64
|
-
getLastEnvelopesForAggregate<A extends AggregateRoot>(aggregate: Type<A>, filter?: ILatestSnapshotFilter): AsyncGenerator<SnapshotEnvelope<A>[]>;
|
|
65
|
-
getManyLastSnapshotEnvelopes<A extends AggregateRoot>(streams: SnapshotStream[], pool?: ISnapshotPool): Promise<Map<SnapshotStream, SnapshotEnvelope<A>>>;
|
|
66
|
-
private getLastStreamEntities;
|
|
67
|
-
/**
|
|
68
|
-
* Best effort lookup of the latest snapshot version of a stream, used to report a conflict.
|
|
69
|
-
*/
|
|
70
|
-
private getLatestVersion;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
interface MariaDBSnapshotStoreConfig extends SnapshotStoreConfig, PoolConfig {
|
|
74
|
-
driver: Type<MariaDBSnapshotStore>;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export { type MariaDBEventEntity, MariaDBEventStore, type MariaDBEventStoreConfig, type MariaDBSnapshotEntity, MariaDBSnapshotStore, type MariaDBSnapshotStoreConfig };
|
|
1
|
+
export type * from './interfaces/index.js';
|
|
2
|
+
export * from './mariadb.event-store.js';
|
|
3
|
+
export * from './mariadb.snapshot-store.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,uBAAuB,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC"}
|