Skip to content

Commit 5b00a3e

Browse files
committed
Change to CommitEventsResult
1 parent 9ba45a3 commit 5b00a3e

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { Failure } from '@dolittle/sdk.protobuf';
55
import { CommittedEvents } from './CommittedEvents';
66

77
/**
8-
* Represents the response from a commit of events
8+
* Represents the result from a commit of events
99
*/
10-
export class CommitEventsResponse {
10+
export class CommitEventsResult {
1111

1212
/**
13-
* Initializes a new instance of {@link CommitEventsResponse}
13+
* Initializes a new instance of {@link CommitEventsResult}
1414
* @param {CommittedEvents} events Events committed.
1515
* @param {Failure} failure Failure from the response.
1616
*/

Source/events/EventStore.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { IEventStore } from './IEventStore';
1818
import { EventSourceId } from './EventSourceId';
1919
import { UncommittedEvent } from './UncommittedEvent';
2020
import { EventConverters } from './EventConverters';
21-
import { CommitEventsResponse } from './CommitEventsResponse';
21+
import {CommitEventsResult } from './CommitEventsResult';
2222
import { Guid } from '@dolittle/rudiments';
2323

2424
/**
@@ -41,9 +41,9 @@ export class EventStore implements IEventStore {
4141
}
4242

4343
/** @inheritdoc */
44-
commit(event: any, eventSourceId: Guid | string, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResponse>;
45-
commit(events: UncommittedEvent[], cancellation?: Cancellation): Promise<CommitEventsResponse>;
46-
commit(eventOrEvents: any, eventSourceIdOrCancellation?: Guid | string | Cancellation, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResponse> {
44+
commit(event: any, eventSourceId: Guid | string, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResult>;
45+
commit(events: UncommittedEvent[], cancellation?: Cancellation): Promise<CommitEventsResult>;
46+
commit(eventOrEvents: any, eventSourceIdOrCancellation?: Guid | string | Cancellation, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResult> {
4747
if (this.isArrayOfUncommittedEvents(eventOrEvents)) {
4848
return this.commitInternal(eventOrEvents, eventSourceIdOrCancellation as Cancellation);
4949
}
@@ -52,7 +52,7 @@ export class EventStore implements IEventStore {
5252
}
5353

5454
/** @inheritdoc */
55-
commitPublic(event: any, eventSourceId: Guid | string, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResponse> {
55+
commitPublic(event: any, eventSourceId: Guid | string, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResult> {
5656
const events: UncommittedEvent[] = [this.toUncommittedEvent(event, eventSourceId, eventType, true)];
5757
return this.commitInternal(events, cancellation);
5858
}
@@ -61,7 +61,7 @@ export class EventStore implements IEventStore {
6161
return Array.isArray(eventOrEvents) && eventOrEvents.length > 0 && eventOrEvents[0].eventSourceId && eventOrEvents[0].content;
6262
}
6363

64-
private async commitInternal(events: UncommittedEvent[], cancellation = Cancellation.default): Promise<CommitEventsResponse> {
64+
private async commitInternal(events: UncommittedEvent[], cancellation = Cancellation.default): Promise<CommitEventsResult> {
6565
const uncommittedEvents = events.map(event =>
6666
EventConverters.getUncommittedEventFrom(
6767
event.content,
@@ -76,7 +76,7 @@ export class EventStore implements IEventStore {
7676
return reactiveUnary(this._eventStoreClient, this._eventStoreClient.commit, request, cancellation)
7777
.pipe(map(response => {
7878
const committedEvents = new CommittedEvents(...response.getEventsList().map(event => EventConverters.toSDK(event)));
79-
return new CommitEventsResponse(committedEvents, failures.toSDK(response.getFailure()));
79+
return new CommitEventsResult(committedEvents, failures.toSDK(response.getFailure()));
8080
})).toPromise();
8181
}
8282

Source/events/IEventStore.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Guid } from '@dolittle/rudiments';
55
import { EventType } from '@dolittle/sdk.artifacts';
66
import { Cancellation } from '@dolittle/sdk.resilience';
77

8-
import { CommitEventsResponse } from './CommitEventsResponse';
8+
import { CommitEventsResult } from './CommitEventsResult';
99
import { UncommittedEvent } from './UncommittedEvent';
1010
;
1111

@@ -20,31 +20,31 @@ export interface IEventStore {
2020
* @param eventSourceId The source of the event - a unique identifier that is associated with the event.
2121
* @param {EventType|Guid|string} [eventType] An event type or an identifier representing the event type.
2222
* @param {Cancellation} cancellation The cancellation signal.
23-
* @returns Promise<CommitEventsResponse>
23+
* @returns Promise<CommitEventsResult>
2424
* @summary If no event type identifier or event type is supplied, it will look for associated event types based
2525
* on the actual type of the event.
2626
*/
27-
commit(event: any, eventSourceId: Guid | string, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResponse>;
27+
commit(event: any, eventSourceId: Guid | string, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResult>;
2828

2929
/**
3030
* Commit a collection of events.
3131
* @param {UncommittedEvent[]} events Collection of events.
3232
* @param {Cancellation} cancellation The cancellation signal.
33-
* @returns Promise<CommitEventsResponse>
33+
* @returns Promise<CommitEventsResult>
3434
* @summary If no event type identifier or event type is supplied, it will look for associated event types based
3535
* @summary on the actual type of the event.
3636
*/
37-
commit(events: UncommittedEvent[], cancellation?: Cancellation): Promise<CommitEventsResponse>;
37+
commit(events: UncommittedEvent[], cancellation?: Cancellation): Promise<CommitEventsResult>;
3838

3939
/**
4040
* Commit a single public event.
4141
* @param {*} event The content of the event.
4242
* @param eventSourceId The source of the event - a unique identifier that is associated with the event.
4343
* @param {EventType|Guid|string} [eventType] An event type or an identifier representing the event type.
4444
* @param {Cancellation} cancellation The cancellation signal.
45-
* @returns Promise<CommitEventsResponse>
45+
* @returns Promise<CommitEventsResult>
4646
* @summary If no event type identifier or event type is supplied, it will look for associated event types based
4747
* on the actual type of the event.
4848
*/
49-
commitPublic(event: any, eventSourceId: Guid | string, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResponse>;
49+
commitPublic(event: any, eventSourceId: Guid | string, eventType?: EventType | Guid | string, cancellation?: Cancellation): Promise<CommitEventsResult>;
5050
}

Source/events/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export { EventContext } from './EventContext';
1313
export { EventStore } from './EventStore';
1414
export { CommittedEvent } from './CommittedEvent';
1515
export { CommittedEvents } from './CommittedEvents';
16-
export { CommitEventsResponse } from './CommitEventsResponse';
16+
export { CommitEventsResult } from './CommitEventsResult';
1717
export { EventConverters } from './EventConverters';
1818
export { IEventStore } from './IEventStore';
1919
export { UncommittedEvent } from './UncommittedEvent';

0 commit comments

Comments
 (0)