@acuris/eventstore-api
Advanced tools
Comparing version 2.3.4 to 3.0.0
@@ -27,2 +27,3 @@ "use strict"; | ||
emptyStorePosition: POSITION, | ||
maxStorePosition: POSITION, | ||
positionCodec: CODEC, | ||
@@ -32,2 +33,5 @@ readAllForwards(_positionExclusive) { | ||
}, | ||
readAllBackwards(_positionExclusive) { | ||
return rxjs_1.EMPTY; | ||
}, | ||
readAllHeadersForwards(_positionExclusive) { | ||
@@ -50,2 +54,5 @@ return rxjs_1.EMPTY; | ||
}, | ||
readStreamBackwards(_streamId, _before) { | ||
return rxjs_1.EMPTY; | ||
}, | ||
readStreamHeadersForwards(_streamId, _after) { | ||
@@ -52,0 +59,0 @@ return rxjs_1.EMPTY; |
@@ -12,2 +12,5 @@ "use strict"; | ||
} | ||
get maxStorePosition() { | ||
return this.storeReader.maxStorePosition; | ||
} | ||
get positionCodec() { | ||
@@ -17,4 +20,11 @@ return this.storeReader.positionCodec; | ||
readAllForwards(positionExclusive = this.storeReader.emptyStorePosition) { | ||
return this.storeReader.readAllForwards(positionExclusive).pipe((0, rxjs_1.filter)((re) => this.categories.has(re.event.streamId.category))); | ||
return this.storeReader | ||
.readAllForwards(positionExclusive) | ||
.pipe((0, rxjs_1.filter)((re) => this.categories.has(re.event.streamId.category))); | ||
} | ||
readAllBackwards(positionExclusive = this.storeReader.maxStorePosition) { | ||
return this.storeReader | ||
.readAllBackwards(positionExclusive) | ||
.pipe((0, rxjs_1.filter)((re) => this.categories.has(re.event.streamId.category))); | ||
} | ||
readAllHeadersForwards(positionExclusive = this.storeReader.emptyStorePosition) { | ||
@@ -21,0 +31,0 @@ return this.storeReader |
@@ -28,2 +28,3 @@ "use strict"; | ||
const EMPTY_POSITION = new LocalPosition(-1); | ||
const MAX_POSITION = new LocalPosition(Number.MAX_SAFE_INTEGER); | ||
function sameStream(left, right) { | ||
@@ -75,2 +76,5 @@ return left.category === right.category && left.id === right.id; | ||
} | ||
get maxStorePosition() { | ||
return MAX_POSITION; | ||
} | ||
get positionCodec() { | ||
@@ -82,2 +86,6 @@ return CODEC; | ||
} | ||
readAllBackwards(positionExclusive = MAX_POSITION) { | ||
return (0, rxjs_1.from)(this.storage.reverse()).pipe((0, rxjs_1.subscribeOn)(rxjs_1.asapScheduler)) | ||
.pipe((0, rxjs_1.filter)((it) => comparePositions(it.position, positionExclusive) <= 0)); | ||
} | ||
readAllHeadersForwards(positionExclusive) { | ||
@@ -95,2 +103,6 @@ return this.readAllForwards(positionExclusive); | ||
} | ||
readStreamBackwards(streamId, before = Number.MAX_SAFE_INTEGER) { | ||
return (0, rxjs_1.from)(this.storage.reverse()).pipe((0, rxjs_1.subscribeOn)(rxjs_1.asapScheduler)) | ||
.pipe((0, rxjs_1.filter)((it) => sameStream(it.event.streamId, streamId) && it.event.eventNumber < before)); | ||
} | ||
readStreamHeadersForwards(streamId, after) { | ||
@@ -97,0 +109,0 @@ return this.readStreamForwards(streamId, after); |
@@ -25,2 +25,3 @@ import { EMPTY } from 'rxjs'; | ||
emptyStorePosition: POSITION, | ||
maxStorePosition: POSITION, | ||
positionCodec: CODEC, | ||
@@ -30,2 +31,5 @@ readAllForwards(_positionExclusive) { | ||
}, | ||
readAllBackwards(_positionExclusive) { | ||
return EMPTY; | ||
}, | ||
readAllHeadersForwards(_positionExclusive) { | ||
@@ -48,2 +52,5 @@ return EMPTY; | ||
}, | ||
readStreamBackwards(_streamId, _before) { | ||
return EMPTY; | ||
}, | ||
readStreamHeadersForwards(_streamId, _after) { | ||
@@ -50,0 +57,0 @@ return EMPTY; |
@@ -10,2 +10,5 @@ import { filter } from 'rxjs'; | ||
} | ||
get maxStorePosition() { | ||
return this.storeReader.maxStorePosition; | ||
} | ||
get positionCodec() { | ||
@@ -15,4 +18,11 @@ return this.storeReader.positionCodec; | ||
readAllForwards(positionExclusive = this.storeReader.emptyStorePosition) { | ||
return this.storeReader.readAllForwards(positionExclusive).pipe(filter((re) => this.categories.has(re.event.streamId.category))); | ||
return this.storeReader | ||
.readAllForwards(positionExclusive) | ||
.pipe(filter((re) => this.categories.has(re.event.streamId.category))); | ||
} | ||
readAllBackwards(positionExclusive = this.storeReader.maxStorePosition) { | ||
return this.storeReader | ||
.readAllBackwards(positionExclusive) | ||
.pipe(filter((re) => this.categories.has(re.event.streamId.category))); | ||
} | ||
readAllHeadersForwards(positionExclusive = this.storeReader.emptyStorePosition) { | ||
@@ -19,0 +29,0 @@ return this.storeReader |
@@ -25,2 +25,3 @@ import { asapScheduler, filter, from, Observable, subscribeOn } from 'rxjs'; | ||
const EMPTY_POSITION = new LocalPosition(-1); | ||
const MAX_POSITION = new LocalPosition(Number.MAX_SAFE_INTEGER); | ||
function sameStream(left, right) { | ||
@@ -72,2 +73,5 @@ return left.category === right.category && left.id === right.id; | ||
} | ||
get maxStorePosition() { | ||
return MAX_POSITION; | ||
} | ||
get positionCodec() { | ||
@@ -79,2 +83,6 @@ return CODEC; | ||
} | ||
readAllBackwards(positionExclusive = MAX_POSITION) { | ||
return from(this.storage.reverse()).pipe(subscribeOn(asapScheduler)) | ||
.pipe(filter((it) => comparePositions(it.position, positionExclusive) <= 0)); | ||
} | ||
readAllHeadersForwards(positionExclusive) { | ||
@@ -92,2 +100,6 @@ return this.readAllForwards(positionExclusive); | ||
} | ||
readStreamBackwards(streamId, before = Number.MAX_SAFE_INTEGER) { | ||
return from(this.storage.reverse()).pipe(subscribeOn(asapScheduler)) | ||
.pipe(filter((it) => sameStream(it.event.streamId, streamId) && it.event.eventNumber < before)); | ||
} | ||
readStreamHeadersForwards(streamId, after) { | ||
@@ -94,0 +106,0 @@ return this.readStreamForwards(streamId, after); |
@@ -12,5 +12,7 @@ import { Observable } from 'rxjs'; | ||
readAllForwards(positionExclusive?: Position): Observable<ResolvedEvent>; | ||
readAllBackwards(positionExclusive?: Position): Observable<ResolvedEvent>; | ||
readAllHeadersForwards(positionExclusive?: Position): Observable<ResolvedEventHeader>; | ||
readLatestStreamEvents(): Observable<ResolvedEvent>; | ||
readonly emptyStorePosition: Position; | ||
readonly maxStorePosition: Position; | ||
readonly positionCodec: PositionCodec; | ||
@@ -23,2 +25,3 @@ } | ||
readStreamForwards(streamId: StreamId, after?: number): Observable<ResolvedEvent>; | ||
readStreamBackwards(streamId: StreamId, before?: number): Observable<ResolvedEvent>; | ||
readStreamHeadersForwards(streamId: StreamId, after?: number): Observable<ResolvedEventHeader>; | ||
@@ -25,0 +28,0 @@ readLatestEvent(streamId: StreamId): Observable<ResolvedEvent>; |
@@ -8,6 +8,8 @@ import { EventReader, Position, PositionCodec, ResolvedEvent, ResolvedEventHeader } from './EventSource'; | ||
get emptyStorePosition(): Position; | ||
get maxStorePosition(): Position; | ||
get positionCodec(): PositionCodec; | ||
readAllForwards(positionExclusive?: Position): Observable<ResolvedEvent>; | ||
readAllBackwards(positionExclusive?: Position): Observable<ResolvedEvent>; | ||
readAllHeadersForwards(positionExclusive?: Position): Observable<ResolvedEventHeader>; | ||
readLatestStreamEvents(): Observable<ResolvedEvent>; | ||
} |
@@ -31,4 +31,6 @@ import { EventBatchWriter, EventCategoryReaders, EventHeader, EventReader, EventRecord, EventSource, EventStreamReader, EventStreamWriter, NewEvent, Position, PositionCodec, ResolvedEvent, ResolvedEventHeader, StreamId } from './EventSource'; | ||
get emptyStorePosition(): Position; | ||
get maxStorePosition(): Position; | ||
get positionCodec(): PositionCodec; | ||
readAllForwards(positionExclusive?: Position): Observable<LocalEvent>; | ||
readAllBackwards(positionExclusive?: Position): Observable<LocalEvent>; | ||
readAllHeadersForwards(positionExclusive?: Position): Observable<LocalEvent>; | ||
@@ -38,2 +40,3 @@ readCategories(...categories: string[]): EventReader; | ||
readStreamForwards(streamId: StreamId, after?: number): Observable<LocalEvent>; | ||
readStreamBackwards(streamId: StreamId, before?: number): Observable<LocalEvent>; | ||
readStreamHeadersForwards(streamId: StreamId, after?: number): Observable<LocalEvent>; | ||
@@ -40,0 +43,0 @@ readLatestEvent(streamId: StreamId): Observable<ResolvedEvent>; |
{ | ||
"name": "@acuris/eventstore-api", | ||
"private": false, | ||
"version": "2.3.4", | ||
"version": "3.0.0", | ||
"description": "API for accessing event stores", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
34556
839