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>
  readonly interruptRetryPolicy?: Schedule.Schedule<any, Cause.Cause<unknown>> | undefined
}) => Activity<Success, Error, Exclude<R, WorkflowInstance | WorkflowEngine | Scope>>

Source

Since v1.0.0

Error handling

retry

Signature

declare const retry: {
  <E, O extends Types.NoExcessProperties<Omit<Effect.Retry.Options<E>, "schedule">, O>>(
    options: O
  ): <A, R>(self: Effect.Effect<A, E, R>) => Effect.Retry.Return<R, E, A, O>
  <A, E, R, O extends Types.NoExcessProperties<Omit<Effect.Retry.Options<E>, "schedule">, O>>(
    self: Effect.Effect<A, E, R>,
    options: O
  ): Effect.Retry.Return<R, E, A, O>
}

Source

Since v1.0.0

Idempotency

idempotencyKey

Signature

declare const idempotencyKey: (
  name: string,
  options?: { readonly includeAttempt?: boolean | undefined } | undefined
) => 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 execute: Effect.Effect<any, any, any>
  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