@dolittle/sdk.aggregates
Version:
Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.
29 lines • 1.45 kB
TypeScript
import { Constructor } from '@dolittle/types';
import { Abstract } from '@dolittle/sdk.dependencyinversion';
import { EventSourceIdLike } from '@dolittle/sdk.events';
import { AggregateRoot } from './AggregateRoot';
import { IAggregateRootOperations } from './IAggregateRootOperations';
/**
* Defines a way to work with an {@link AggregateRoot}.
* @template TAggregate
*/
export declare abstract class IAggregateOf<TAggregate extends AggregateRoot> {
/**
* Create a new {@link AggregateRoot} with a random {@link EventSourceId}.
* @returns {IAggregateRootOperations<TAggregate>}
*/
abstract create(): IAggregateRootOperations<TAggregate>;
/**
* Gets an {@link AggregateRoot} with a given {@link EventSourceId}.
* @param {EventSourceIdLike} eventSourceId - {@link EventSourceId} Of the {@link AggregateRoot}.
* @returns {IAggregateRootOperations<TAggregate>}
*/
abstract get(eventSourceId: EventSourceIdLike): IAggregateRootOperations<TAggregate>;
/**
* Gets a {@link ServiceIdentifier} for an {@link AggregateRoot} type to inject an {@link IAggragateOf} from the service provider.
* @param {Constructor} type - The type of the aggregate root.
* @returns {Abstract} The service identifier to use for injection.
*/
static for<TAggregate extends AggregateRoot>(type: Constructor<TAggregate>): Abstract<IAggregateOf<TAggregate>>;
}
//# sourceMappingURL=IAggregateOf.d.ts.map