///
import { EffectMethod } from './effect';
import { GrpcStatus } from './grpc-status';
import { Metadata } from './metadata';
import { Reply } from './reply';
/**
* A message object.
*
* @public
*/
export declare type Message = {
[key: string]: any;
};
/**
* Context for an entity.
*
* @public
*/
export interface EntityContext {
/**
* The id of the entity that the command is for.
*/
entityId: string;
/**
* The id of the command.
*/
commandId: Long;
/**
* The metadata to send with a reply.
*/
replyMetadata: Metadata;
}
/**
* Effect context.
*
* @public
*/
export interface EffectContext {
/**
* The metadata associated with the command.
*/
readonly metadata: Metadata;
/**
* DEPRECATED. Emit an effect after processing this command.
*
* @deprecated Use {@link Reply.addEffect} instead.
*
* @param method - The entity service method to invoke
* @param message - The message to send to that service
* @param synchronous - Whether the effect should be execute synchronously or not
* @param metadata - Metadata to send with the effect
* @param internalCall - For internal calls to this deprecated function
*/
effect(method: EffectMethod, message: Message, synchronous?: boolean, metadata?: Metadata, internalCall?: boolean): void;
/**
* Fail handling this command.
*
* @remarks
*
* An alternative to using this is to return a failed Reply created with {@link replies.failure}.
*
* @param msg - The failure message
* @param grpcStatus - The grpcStatus
* @throws An error that captures the failure message. Note that even if you
* catch the error thrown by this method, the command will still be
* failed with the given message.
*/
fail(msg: string, grpcStatus?: GrpcStatus): void;
}
/**
* Context for a command.
*
* @public
*/
export interface CommandContext extends EffectContext {
/**
* DEPRECATED. Forward this command to another service component call.
*
* @deprecated Use {@link replies.forward} instead.
*
* @param method - The service component method to invoke
* @param message - The message to send to that service component
* @param metadata - Metadata to send with the forward
*/
thenForward(method: EffectMethod, message: Message, metadata?: Metadata): void;
/**
* DEPRECATED. Forward this command to another service component call.
*
* @deprecated Use {@link replies.forward} instead.
*
* @param method - The service component method to invoke
* @param message - The message to send to that service component
* @param metadata - Metadata to send with the forward
* @param internalCall - For internal calls to this deprecated function
*/
forward(method: EffectMethod, message: Message, metadata?: Metadata, internalCall?: boolean): void;
}
/**
* Context for an entity command.
*
* @public
*/
export declare type EntityCommandContext = EntityContext & CommandContext;
/**
* Command reply types.
*
* @public
*/
export declare type CommandReply = Reply | Message | undefined | void;