feat: update aggregate implementation

This commit is contained in:
2025-08-11 13:34:28 +02:00
parent 9dddc4e79f
commit cc8c558db6
37 changed files with 361 additions and 511 deletions

View File

@@ -1,3 +1,42 @@
/*
|--------------------------------------------------------------------------------
| Aggregate Errors
|--------------------------------------------------------------------------------
*/
/**
* Error thrown when stream assignment on the aggregate has already been set.
*
* @property name - Name of the aggregate throwing the error.
*/
export class AggregateStreamViolation extends Error {
readonly type = "AggregateStreamAlreadySet";
constructor(name: string) {
super(`EventStore Error: Aggregate '${name}' already has a stream assigned, overriding not supported.`);
}
}
/**
* Error thrown when attempting to snapshot an aggregate without a resolved
* stream.
*
* @property name - Name of the aggregate throwing the error.
*/
export class AggregateSnapshotViolation extends Error {
readonly type = "AggregateSnapshotViolation";
constructor(name: string) {
super(`EventStore Error: Aggregate '${name}' has no stream assigned, snapshot generation cannot be executed.`);
}
}
/*
|--------------------------------------------------------------------------------
| Event Errors
|--------------------------------------------------------------------------------
*/
/**
* Error thrown when an expected event is missing from the event store.
*
@@ -14,12 +53,6 @@ export class EventMissingError extends Error {
}
}
/*
|--------------------------------------------------------------------------------
| Event Errors
|--------------------------------------------------------------------------------
*/
/**
* Error thrown when an event fails validation checks.
*