@ahoo-wang/fetcher-wow
Version:
Support for Wow(https://github.com/Ahoo-Wang/Wow) in Fetcher
140 lines • 4.42 kB
TypeScript
import { ErrorInfo, FunctionInfoCapable, Identifier } from '../types';
import { PartialBy } from '@ahoo-wang/fetcher';
/**
* Command identifier interface
*
* Represents the unique identifier for a command.
*/
export interface CommandId {
commandId: string;
}
/**
* Wait command identifier capable interface
*
* Represents the identifier of the command being waited for.
*/
export interface WaitCommandIdCapable {
waitCommandId: string;
}
/**
* Request identifier interface
*
* Represents the unique identifier for a request, used for idempotency control.
*/
export interface RequestId {
requestId: string;
}
/**
* Command execution stage enum
*
* Represents the different stages of command execution lifecycle.
*/
export declare enum CommandStage {
/**
* When the command is published to the command bus/queue, a completion signal is generated.
*/
SENT = "SENT",
/**
* When the command is processed by the aggregate root, a completion signal is generated.
*/
PROCESSED = "PROCESSED",
/**
* When the snapshot is generated, a completion signal is generated.
*/
SNAPSHOT = "SNAPSHOT",
/**
* When the events generated by the command are *projected*, a completion signal is generated.
*/
PROJECTED = "PROJECTED",
/**
* When the events generated by the command are processed by *event handlers*, a completion signal is generated.
*/
EVENT_HANDLED = "EVENT_HANDLED",
/**
* When the events generated by the command are processed by *Saga*, a completion signal is generated.
*/
SAGA_HANDLED = "SAGA_HANDLED"
}
/**
* Command stage capable interface
*
* Represents an object that has a command execution stage.
*/
export interface CommandStageCapable {
stage: CommandStage;
}
/**
* Command result capable interface
*
* Represents an object that contains command execution results.
*/
export interface CommandResultCapable {
result: Record<string, any>;
}
/**
* Signal time capable interface
*
* Represents an object that has a signal time (timestamp).
*/
export interface SignalTimeCapable {
signalTime: number;
}
/**
* Nullable aggregate version capable interface
*
* Represents an object that may have an aggregate version for optimistic concurrency control.
*/
export interface NullableAggregateVersionCapable {
/**
* Aggregate root version number
* - When command processing succeeds, this is the version number after the aggregate root has completed command processing
* - When command validation fails at the command gateway, this is null
* - When command execution fails in the command handler, this is the current version number of the aggregate root
*/
aggregateVersion?: number;
}
/**
* Represents a target for compensation operations.
*
* This interface extends Identifier (with optional id) and FunctionInfoCapable to define
* the structure for objects that can be targeted for compensation operations. Compensation
* targets typically represent entities that can have operations reversed or corrected.
*/
export interface CompensationTarget extends PartialBy<Identifier, 'id'>, FunctionInfoCapable {
}
/**
* Represents a command to delete an aggregate.
*
* This interface defines the structure for commands that request the deletion of an aggregate.
* It is typically used in conjunction with other command interfaces to provide a complete
* command processing workflow.
*/
export interface DeleteAggregate {
}
/**
* Represents a command to recover an aggregate.
*
* This interface defines the structure for commands that request the recovery of an aggregate,
* typically used in scenarios where an aggregate needs to be restored to a previous state
* or recovered from an error condition.
*/
export interface RecoverAggregate {
}
/**
* Represents the result of a batch operation, containing information about
* the pagination and error status of the operation.
*
* Extends ErrorInfo to include error details if the batch operation failed.
*/
export interface BatchResult extends ErrorInfo {
/**
* The cursor or identifier for the next item after the current batch.
* Used for pagination to continue fetching the next batch of items.
*/
after: string;
/**
* The number of items in the current batch.
*/
size: number;
}
//# sourceMappingURL=types.d.ts.map