@arque/core
Advanced tools
Comparing version 0.1.0-alpha.14 to 0.1.0-alpha.16
@@ -6,6 +6,2 @@ /// <reference types="node" /> | ||
} | ||
type Transaction = { | ||
commit(): Promise<void>; | ||
abort(): Promise<void>; | ||
}; | ||
export interface EventStoreStreamAdapter { | ||
@@ -15,3 +11,3 @@ sendEvents(data: { | ||
event: Event; | ||
}[]): Promise<Transaction>; | ||
}[]): Promise<void>; | ||
receiveEvents(stream: string, handler: (event: Event) => Promise<void>): Promise<EventStoreStreamReceiver>; | ||
@@ -27,3 +23,3 @@ } | ||
events: Pick<Event, 'id' | 'type' | 'body' | 'meta'>[]; | ||
}): Promise<Transaction>; | ||
}): Promise<void>; | ||
listEvents<TEvent = Event>(params: { | ||
@@ -79,2 +75,1 @@ aggregate: { | ||
} | ||
export {}; |
@@ -28,19 +28,4 @@ "use strict"; | ||
})); | ||
let storageAdapterSaveEventsTransaction; | ||
let streamAdapterSendEventsTransaction; | ||
try { | ||
storageAdapterSaveEventsTransaction = await this.storageAdapter.saveEvents(params); | ||
streamAdapterSendEventsTransaction = await this.streamAdapter.sendEvents(streamAdapterSendEventsData); | ||
await Promise.all([ | ||
storageAdapterSaveEventsTransaction.commit(), | ||
streamAdapterSendEventsTransaction.commit(), | ||
]); | ||
} | ||
catch (err) { | ||
await Promise.all([ | ||
storageAdapterSaveEventsTransaction === null || storageAdapterSaveEventsTransaction === void 0 ? void 0 : storageAdapterSaveEventsTransaction.abort(), | ||
streamAdapterSendEventsTransaction === null || streamAdapterSendEventsTransaction === void 0 ? void 0 : streamAdapterSendEventsTransaction.abort(), | ||
]); | ||
throw err; | ||
} | ||
await this.storageAdapter.saveEvents(params); | ||
await this.streamAdapter.sendEvents(streamAdapterSendEventsData); | ||
} | ||
@@ -47,0 +32,0 @@ } |
{ | ||
"name": "@arque/core", | ||
"version": "0.1.0-alpha.14", | ||
"version": "0.1.0-alpha.16", | ||
"description": "The Event Sourcing library.", | ||
@@ -33,3 +33,3 @@ "author": "ScaleForge", | ||
}, | ||
"gitHead": "c3ebe93245e992c4c557d66802a65a3fc345832f" | ||
"gitHead": "2091af6df277b13c5599bfc01cc064430d1be911" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32396
532