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

Activity.ts overview

Since v1.0.0


Exports Grouped by Category


Attempts

CurrentAttempt (class)

Signature

declare class CurrentAttempt

Source

Since v1.0.0

Constructors

make

Signature

declare const make: <
  R,
  Success extends Schema.Schema.Any = typeof Schema.Void,
  Error extends Schema.Schema.All = typeof Schema.Never
>(options: {
  readonly name: string
  readonly success?: Success | undefined
  readonly error?: Error | undefined
  readonly execute: Effect.Effect<Success["Type"], Error["Type"], R>
}) => Activity<Success, Error, Exclude<R, WorkflowInstance | WorkflowEngine | Scope>>

Source

Since v1.0.0

Error handling

retry

Signature

declare const retry: {
  <E, O extends NoExcessProperties<Effect.Retry.Options<E>, O>>(
    options: O
  ): <A, R>(self: Effect.Effect<A, E, R>) => Effect.Retry.Return<R, E, A, O>
  <B, E, R1>(policy: Schedule<B, NoInfer<E>, R1>): <A, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R1 | R>
  <A, E, R, O extends NoExcessProperties<Effect.Retry.Options<E>, O>>(
    self: Effect.Effect<A, E, R>,
    options: O
  ): Effect.Retry.Return<R, E, A, O>
  <A, E, R, B, R1>(self: Effect.Effect<A, E, R>, policy: Schedule<B, NoInfer<E>, R1>): Effect.Effect<A, E, R1 | R>
}

Source

Since v1.0.0

Execution ID

executionIdWithAttempt

Signature

declare const executionIdWithAttempt: Effect.Effect<string, never, WorkflowInstance>

Source

Since v1.0.0

Models

Activity (interface)

Signature

export interface Activity<
  Success extends Schema.Schema.Any = typeof Schema.Void,
  Error extends Schema.Schema.All = typeof Schema.Never,
  R = never
> extends Effect.Effect<
    Success["Type"],
    Error["Type"],
    Success["Context"] | Error["Context"] | R | WorkflowEngine | WorkflowInstance
  > {
  readonly [TypeId]: TypeId
  readonly name: string
  readonly successSchema: Success
  readonly errorSchema: Error
  readonly exitSchema: Schema.Schema<
    Exit.Exit<Success["Type"], Error["Type"]>,
    Exit.Exit<Success["Encoded"], Error["Encoded"]>,
    Success["Context"] | Error["Context"]
  >
  readonly execute: Effect.Effect<
    Success["Type"],
    Error["Type"],
    Success["Context"] | Error["Context"] | R | Scope | WorkflowEngine | WorkflowInstance
  >
  readonly executeEncoded: Effect.Effect<
    Success["Encoded"],
    Error["Encoded"],
    Success["Context"] | Error["Context"] | R | Scope | WorkflowEngine | WorkflowInstance
  >
}

Source

Since v1.0.0

Any (interface)

Signature

export interface Any {
  readonly [TypeId]: TypeId
  readonly name: string
  readonly successSchema: Schema.Schema.Any
  readonly errorSchema: Schema.Schema.All
  readonly executeEncoded: Effect.Effect<any, any, any>
}

Source

Since v1.0.0

Racing

raceAll

Signature

declare const raceAll: <const Activities extends NonEmptyReadonlyArray<Any>>(
  name: string,
  activities: Activities
) => Effect.Effect<
  Activities[number] extends Activity<infer _A, infer _E, infer _R> ? _A["Type"] : never,
  Activities[number] extends Activity<infer _A, infer _E, infer _R> ? _E["Type"] : never,
  | (Activities[number] extends Activity<infer Success, infer Error, infer R>
      ? Success["Context"] | Error["Context"] | R
      : never)
  | WorkflowEngine
  | WorkflowInstance
>

Source

Since v1.0.0

Symbols

TypeId

Signature

declare const TypeId: unique symbol

Source

Since v1.0.0

TypeId (type alias)

Signature

type TypeId = typeof TypeId

Source

Since v1.0.0