UNPKG

woltage

Version:

A CQRS and Event-Sourcing Framework

37 lines (36 loc) 2.22 kB
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _a, _EventStore_eventStore; class EventStore { static async init(eventStore) { __classPrivateFieldSet(this, _a, eventStore, "f", _EventStore_eventStore); await __classPrivateFieldGet(this, _a, "f", _EventStore_eventStore).connect(); } static async close(force = false) { await __classPrivateFieldGet(this, _a, "f", _EventStore_eventStore).close(force); } static read(aggregateName, aggregateId) { return __classPrivateFieldGet(this, _a, "f", _EventStore_eventStore).read(aggregateName, aggregateId); } static async append(aggregateName, aggregateId, events, revision) { await __classPrivateFieldGet(this, _a, "f", _EventStore_eventStore).append(aggregateName, aggregateId, events, revision); } static getLatestPosition(filter) { return __classPrivateFieldGet(this, _a, "f", _EventStore_eventStore).getLatestPosition(filter); } static subscribe(options) { return __classPrivateFieldGet(this, _a, "f", _EventStore_eventStore).subscribe(options); } } _a = EventStore; _EventStore_eventStore = { value: void 0 }; export default EventStore;