@dolittle/sdk.aggregates
Version:
Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.
38 lines • 3.02 kB
JavaScript
;
// Copyright (c) Dolittle. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Aggregates = void 0;
const sdk_events_1 = require("@dolittle/sdk.events");
const AggregateOf_1 = require("../AggregateOf");
const AggregateRootOperations_1 = require("../AggregateRootOperations");
const IAggregates_1 = require("./IAggregates");
/**
* Represents an implementation of {@link IAggregates}.
*/
class Aggregates extends IAggregates_1.IAggregates {
/**
* Initialises a new instance of the {@link Aggregates} class.
* @param {IAggregateRootTypes} _aggregateRootTypes - For aggregate root types resolution.
* @param {IEventTypes} _eventTypes - For event types resolution.
* @param {IEventStore} _eventStore - The event store to use to fetch committed aggregate events.
* @param {Logger} _logger - For logging.
*/
constructor(_aggregateRootTypes, _eventTypes, _eventStore, _logger) {
super();
this._aggregateRootTypes = _aggregateRootTypes;
this._eventTypes = _eventTypes;
this._eventStore = _eventStore;
this._logger = _logger;
}
/** @inheritdoc */
get(type, eventSourceId) {
return new AggregateRootOperations_1.AggregateRootOperations(type, this._aggregateRootTypes.getFor(type), sdk_events_1.EventSourceId.from(eventSourceId), this._eventStore, this._eventTypes, this._logger);
}
/** @inheritdoc */
of(type) {
return new AggregateOf_1.AggregateOf(type, this._aggregateRootTypes.getFor(type), this._eventStore, this._eventTypes, this._logger);
}
}
exports.Aggregates = Aggregates;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQWdncmVnYXRlcy5qcyIsInNvdXJjZVJvb3QiOiIuLi8iLCJzb3VyY2VzIjpbIkJ1aWxkZXJzL0FnZ3JlZ2F0ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtDQUErQztBQUMvQyxxR0FBcUc7OztBQUtyRyxxREFBa0c7QUFFbEcsZ0RBQTZDO0FBRTdDLHdFQUFxR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