Entity
Constructors
fromRpcGroup
Added in v1.0.0
Source
Creates a new Entity of the specified type which will accept messages
that adhere to the provided RpcGroup.
Signature
declare function fromRpcGroup<Type extends string, Rpcs extends Any>(type: Type, protocol: RpcGroup<Rpcs>): Entity<Type, Rpcs>Creates a new Entity of the specified type which will accept messages
that adhere to the provided schemas.
Signature
declare function make<Type extends string, Rpcs extends readonly Array<Any>>(type: Type, protocol: Rpcs): Entity<Type, Rpcs[number]>Context
CurrentAddress
Added in v1.0.0
Source
A Context.Tag to access the current entity address.
Signature
declare class CurrentAddress extends any { constructor();}CurrentRunnerAddress
Added in v1.0.0
Source
A Context.Tag to access the current Runner address.
Signature
declare class CurrentRunnerAddress extends any { constructor();}Keep Alive
Signature
declare const keepAlive: (enabled: boolean) => Effect.Effect<void, never, Sharding | CurrentAddress>KeepAliveLatch
Added in v1.0.0
Source
Signature
declare class KeepAliveLatch extends any { constructor();}KeepAliveRpc
Added in v1.0.0
Source
Signature
declare const KeepAliveRpc: anyModels
Signature
type Any = Entity<string, Rpc.Any>Signature
interface Entity<in out Type extends string, in out Rpcs extends Rpc.Any> extends Equal { readonly [TypeId]: typeof TypeId; readonly client: Effect<(entityId: string) => From<Rpcs, PersistenceError | MailboxFull | AlreadyProcessingMessage>, never, Sharding>; readonly protocol: RpcGroup<Rpcs>; readonly type: Type & Brand<"EntityType">; annotate<I, S>(tag: Tag<I, S>, value: S): Entity<Type, Rpcs>; annotateContext<S>(context: Context<S>): Entity<Type, Rpcs>; annotateRpcs<I, S>(tag: Tag<I, S>, value: S): Entity<Type, Rpcs>; annotateRpcsContext<S>(context: Context<S>): Entity<Type, Rpcs>; getShardGroup(entityId: any): string; getShardId(entityId: any): Effect<ShardId, never, Sharding>; of<Handlers extends HandlersFrom<Rpcs>>(handlers: Handlers): Handlers; toLayer<Handlers extends HandlersFrom<Rpcs>, RX = never>(build: Handlers | Effect<Handlers, never, RX>, options?: { readonly concurrency?: number | "unbounded"; readonly defectRetryPolicy?: Schedule<any, unknown, never, never>; readonly disableFatalDefects?: boolean; readonly mailboxCapacity?: number | "unbounded"; readonly maxIdleTime?: any; readonly spanAttributes?: Record<string, string>; }): Layer<never, never, any>; toLayerMailbox<R, RX = never>(build: (mailbox: ReadonlyMailbox<Request<Rpcs>>, replier: Replier<Rpcs>) => Effect<never, never, R> | Effect<(mailbox: ReadonlyMailbox<Request<Rpcs>>, replier: Replier<Rpcs>) => Effect<never, never, R>, never, RX>, options?: { readonly defectRetryPolicy?: Schedule<any, unknown, never, never>; readonly disableFatalDefects?: boolean; readonly mailboxCapacity?: number | "unbounded"; readonly maxIdleTime?: any; readonly spanAttributes?: Record<string, string>; }): Layer<never, never, any>;}HandlersFrom type
Added in v1.0.0
Source
Signature
type HandlersFrom<Rpc extends Rpc.Any> = { [Current in Rpc]: (envelope: Request<Current>) => Rpc.ResultFrom<Current, any> | Rpc.Wrapper<Rpc.ResultFrom<Current, any>> }Refinements
Replier
Signature
interface Replier<Rpcs extends Rpc.Any> { readonly complete: <R extends Any>(request: Request<R>, exit: Exit<any, Error<R>>) => Effect<void>; readonly fail: <R extends Any>(request: Request<R>, error: Error<R>) => Effect<void>; readonly failCause: <R extends Any>(request: Request<R>, cause: Cause<Error<R>>) => Effect<void>; readonly succeed: <R extends Any>(request: Request<R>, value: any) => Effect<void>;}Request
Signature
declare class Request<Rpc extends Rpc.Any> extends Class<Envelope.Request<Rpc> & { readonly lastSentChunk: Option.Option<Reply.Chunk<Rpc>>;}> { constructor<Rpc extends Any>(args: { readonly _tag: "Request"; readonly [TypeId]: typeof TypeId; readonly address: EntityAddress; readonly headers: Headers; readonly lastSentChunk: Option<Chunk<Rpc>>; readonly payload: Payload<Rpc>; readonly requestId: Snowflake; readonly sampled?: boolean; readonly spanId?: string; readonly tag: Tag<Rpc>; readonly traceId?: string; }); lastSentChunkValue: Option<SuccessChunk<Rpc>>; nextSequence: number;}Testing
makeTestClient
Added in v1.0.0
Source
Signature
declare const makeTestClient: <Type extends string, Rpcs extends Rpc.Any, LA, LE, LR>(entity: Entity<Type, Rpcs>, layer: Layer.Layer<LA, LE, LR>) => Effect.Effect<(entityId: string) => Effect.Effect<RpcClient.RpcClient<Rpcs>>, LE, Scope | ShardingConfig | Exclude<LR, Sharding> | Rpc.MiddlewareClient<Rpcs>>