@schemeless/event-store-types 6.0.0-rc.1 → 6.0.0-rc.5
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/Errors.d.ts +12 -0
- package/dist/Errors.js +29 -1
- package/dist/Repo.types.d.ts +9 -3
- package/package.json +2 -2
package/dist/Errors.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare class EventStoreError extends Error {
|
|
2
2
|
constructor(message: string);
|
|
3
3
|
}
|
|
4
|
+
export declare class AdapterCapabilityError extends EventStoreError {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
4
7
|
export declare class StreamConcurrencyError extends EventStoreError {
|
|
5
8
|
readonly domain: string;
|
|
6
9
|
readonly identifier: string;
|
|
@@ -11,3 +14,12 @@ export declare class StreamConcurrencyError extends EventStoreError {
|
|
|
11
14
|
export declare class SnapshotError extends EventStoreError {
|
|
12
15
|
constructor(message: string);
|
|
13
16
|
}
|
|
17
|
+
export declare class InvalidIdentifierError extends EventStoreError {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class InvalidStreamBatchError extends EventStoreError {
|
|
21
|
+
constructor(message: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class EventCursorNotFoundError extends EventStoreError {
|
|
24
|
+
constructor(cursorId: string);
|
|
25
|
+
}
|
package/dist/Errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SnapshotError = exports.StreamConcurrencyError = exports.EventStoreError = void 0;
|
|
3
|
+
exports.EventCursorNotFoundError = exports.InvalidStreamBatchError = exports.InvalidIdentifierError = exports.SnapshotError = exports.StreamConcurrencyError = exports.AdapterCapabilityError = exports.EventStoreError = void 0;
|
|
4
4
|
class EventStoreError extends Error {
|
|
5
5
|
constructor(message) {
|
|
6
6
|
super(message);
|
|
@@ -8,6 +8,13 @@ class EventStoreError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.EventStoreError = EventStoreError;
|
|
11
|
+
class AdapterCapabilityError extends EventStoreError {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'AdapterCapabilityError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.AdapterCapabilityError = AdapterCapabilityError;
|
|
11
18
|
class StreamConcurrencyError extends EventStoreError {
|
|
12
19
|
constructor(domain, identifier, expectedVersion, actualVersion) {
|
|
13
20
|
super(`Concurrency conflict on stream "${domain}/${identifier}": expected version ${expectedVersion}, but found ${actualVersion}`);
|
|
@@ -26,3 +33,24 @@ class SnapshotError extends EventStoreError {
|
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
35
|
exports.SnapshotError = SnapshotError;
|
|
36
|
+
class InvalidIdentifierError extends EventStoreError {
|
|
37
|
+
constructor(message) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = 'InvalidIdentifierError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.InvalidIdentifierError = InvalidIdentifierError;
|
|
43
|
+
class InvalidStreamBatchError extends EventStoreError {
|
|
44
|
+
constructor(message) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.name = 'InvalidStreamBatchError';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.InvalidStreamBatchError = InvalidStreamBatchError;
|
|
50
|
+
class EventCursorNotFoundError extends EventStoreError {
|
|
51
|
+
constructor(cursorId) {
|
|
52
|
+
super(`Event cursor not found: "${cursorId}"`);
|
|
53
|
+
this.name = 'EventCursorNotFoundError';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.EventCursorNotFoundError = EventCursorNotFoundError;
|
package/dist/Repo.types.d.ts
CHANGED
|
@@ -2,6 +2,12 @@ import type { CreatedEvent, EventMeta } from './EventStore.types';
|
|
|
2
2
|
export interface PersistedEvent<Payload = any, META extends EventMeta = EventMeta> extends CreatedEvent<Payload, META> {
|
|
3
3
|
sequence?: number;
|
|
4
4
|
}
|
|
5
|
+
export type AppendableEvent<Payload = any, META extends EventMeta = EventMeta> = Omit<PersistedEvent<Payload, META>, 'id'> & {
|
|
6
|
+
id?: string;
|
|
7
|
+
};
|
|
8
|
+
export type StreamAppendableEvent<Payload = any, META extends EventMeta = EventMeta> = AppendableEvent<Payload, META> & {
|
|
9
|
+
identifier: string;
|
|
10
|
+
};
|
|
5
11
|
export interface Snapshot<State = any> {
|
|
6
12
|
domain: string;
|
|
7
13
|
identifier: string;
|
|
@@ -12,13 +18,13 @@ export interface Snapshot<State = any> {
|
|
|
12
18
|
export interface EventStoreAdapter {
|
|
13
19
|
init(): Promise<void>;
|
|
14
20
|
close?(): Promise<void>;
|
|
15
|
-
append(events:
|
|
21
|
+
append(events: AppendableEvent[]): Promise<void>;
|
|
16
22
|
getAllEvents(pageSize?: number, startFromId?: string): Promise<AsyncIterableIterator<Array<PersistedEvent>>>;
|
|
17
23
|
reset?(): Promise<void>;
|
|
18
24
|
}
|
|
19
25
|
export interface StreamEventStoreAdapter extends EventStoreAdapter {
|
|
20
26
|
getStreamEvents(domain: string, identifier: string, fromSequence?: number): Promise<PersistedEvent[]>;
|
|
21
|
-
appendToStream(events:
|
|
27
|
+
appendToStream(events: StreamAppendableEvent[], expectedVersion: number): Promise<{
|
|
22
28
|
nextVersion: number;
|
|
23
29
|
}>;
|
|
24
30
|
getSnapshot?<State>(domain: string, identifier: string): Promise<Snapshot<State> | null>;
|
|
@@ -32,5 +38,5 @@ export interface StreamEventStoreAdapter extends EventStoreAdapter {
|
|
|
32
38
|
export interface RevertableEventStoreAdapter {
|
|
33
39
|
getEventById(id: string): Promise<PersistedEvent | null>;
|
|
34
40
|
findByCausationId(causationId: string): Promise<PersistedEvent[]>;
|
|
35
|
-
append(events:
|
|
41
|
+
append(events: AppendableEvent[]): Promise<void>;
|
|
36
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schemeless/event-store-types",
|
|
3
|
-
"version": "6.0.0-rc.
|
|
3
|
+
"version": "6.0.0-rc.5",
|
|
4
4
|
"typescript:main": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "5071fdf7169e9a75f56f6795374a9124edd7c85f"
|
|
38
38
|
}
|