Skip to main content Link Search Menu Expand Document (external link)

Procedure overview

Added in v1.0.0


Table of contents


constructors

make

Signature

export declare const make: <Requests extends TaggedRequest.Any, State>() => <Req extends TaggedRequest.Any>() => <R>(
  tag: Req["_tag"],
  handler: Handler<Req, State, Requests, R>
) => Procedure<Req, State, R>

Added in v1.0.0

makeSerializable

Signature

export declare const makeSerializable: <Requests extends TaggedRequest.Any, State>() => <
  Req extends Schema.TaggedRequest.All,
  IS,
  R,
  RS
>(
  schema: Schema.Schema<Req, IS, RS> & { readonly _tag: Req["_tag"] },
  handler: Handler<Req, State, Requests, R>
) => SerializableProcedure<Req, State, R | Schema.SerializableWithResult.Context<Req>>

Added in v1.0.0

models

Handler (type alias)

Signature

export type Handler<Request extends TaggedRequest.Any, State, Requests extends TaggedRequest.Any, R> = (
  context: Procedure.Context<Requests | Request, Request, State>
) => Effect.Effect<readonly [response: Request.Success<Request> | NoReply, state: State], Request.Error<Request>, R>

Added in v1.0.0

Procedure (interface)

Signature

export interface Procedure<Request extends TaggedRequest.Any, State, R> extends Pipeable {
  readonly [TypeId]: TypeId
  readonly tag: Request["_tag"]
  readonly handler: Handler<Request, State, any, R>
}

Added in v1.0.0

Procedure (namespace)

Added in v1.0.0

BaseContext (interface)

Signature

export interface BaseContext {
  readonly fork: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<void, never, R>
  readonly forkOne: {
    (id: string): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<void, never, R>
    <A, E, R>(effect: Effect.Effect<A, E, R>, id: string): Effect.Effect<void, never, R>
  }
  readonly forkReplace: {
    (id: string): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<void, never, R>
    <A, E, R>(effect: Effect.Effect<A, E, R>, id: string): Effect.Effect<void, never, R>
  }
  readonly unsafeSend: <Req extends TaggedRequest.Any>(request: Req) => Effect.Effect<void>
  readonly unsafeSendAwait: <Req extends TaggedRequest.Any>(
    request: Req
  ) => Effect.Effect<Request.Success<Req>, Request.Error<Req>>
}

Added in v1.0.0

Context (interface)

Signature

export interface Context<Requests extends TaggedRequest.Any, Request extends TaggedRequest.Any, State>
  extends ContextProto<Requests, State> {
  readonly request: Request
  readonly state: State
  readonly deferred: Deferred.Deferred<Request.Success<Request>, Request.Error<Request>>
}

Added in v1.0.0

ContextProto (interface)

Signature

export interface ContextProto<Requests extends TaggedRequest.Any, State> extends BaseContext {
  readonly send: <Req extends Requests>(request: Req) => Effect.Effect<void>
  readonly sendAwait: <Req extends Requests>(request: Req) => Effect.Effect<Request.Success<Req>, Request.Error<Req>>
  readonly forkWith: {
    (state: State): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<readonly [void, State], never, R>
    <A, E, R>(effect: Effect.Effect<A, E, R>, state: State): Effect.Effect<readonly [void, State], never, R>
  }
  readonly forkOneWith: {
    (
      id: string,
      state: State
    ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<readonly [void, State], never, R>
    <A, E, R>(effect: Effect.Effect<A, E, R>, id: string, state: State): Effect.Effect<readonly [void, State], never, R>
  }
  readonly forkReplaceWith: {
    (
      id: string,
      state: State
    ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<readonly [void, State], never, R>
    <A, E, R>(effect: Effect.Effect<A, E, R>, id: string, state: State): Effect.Effect<readonly [void, State], never, R>
  }
}

Added in v1.0.0

InferContext (type alias)

Signature

export type InferContext<P> = P extends Procedure<infer _, infer _, infer R> ? R : never

Added in v1.0.0

InferRequest (type alias)

Signature

export type InferRequest<P> = P extends Procedure<infer Req, infer _, infer _> ? Req : never

Added in v1.0.0

SerializableProcedure (interface)

Signature

export interface SerializableProcedure<Request extends Schema.TaggedRequest.All, State, R>
  extends Procedure<Request, State, R> {
  readonly [SerializableTypeId]: SerializableTypeId
  readonly schema: Schema.Schema<Request, unknown>
}

Added in v1.0.0

TaggedRequest (interface)

Signature

export interface TaggedRequest<Tag extends string, A, E> extends Request<A, E> {
  readonly _tag: Tag
}

Added in v1.0.0

TaggedRequest (namespace)

Added in v1.0.0

Any (type alias)

Signature

export type Any = TaggedRequest<string, any, any> | TaggedRequest<string, any, never>

Added in v1.0.0

refinements

isSerializable

Signature

export declare const isSerializable: (u: unknown) => u is SerializableProcedure<any, any, any>

Added in v1.0.0

symbols

NoReply

Signature

export declare const NoReply: typeof NoReply

Added in v1.0.0

NoReply (type alias)

Signature

export type NoReply = typeof NoReply

Added in v1.0.0

type ids

SerializableTypeId

Signature

export declare const SerializableTypeId: typeof SerializableTypeId

Added in v1.0.0

SerializableTypeId (type alias)

Signature

export type SerializableTypeId = typeof SerializableTypeId

Added in v1.0.0

TypeId

Signature

export declare const TypeId: typeof TypeId

Added in v1.0.0

TypeId (type alias)

Signature

export type TypeId = typeof TypeId

Added in v1.0.0