Skip to content

Latest commit

 

History

History
288 lines (163 loc) · 7.54 KB

File metadata and controls

288 lines (163 loc) · 7.54 KB

Home > @aws/durable-execution-sdk-js > DurableContext

DurableContext interface

Signature:

export interface DurableContext<TLogger extends DurableLogger = DurableLogger>

Properties

Property

Modifiers

Type

Description

lambdaContext

Context

The underlying AWS Lambda context

logger

DurableContextLogger<TLogger>

Logger instance for this context, optionally enriched with durable execution metadata if the logger supports it. By default the default logger will emit logs following this structure:

{
  "timestamp": "2025-11-21T18:39:24.743Z",
  "executionArn": "arn:aws:lambda:...",
  "level": "INFO",
  "operationId": "abc123",
  "message": { "userId": "123", "action": "login" }
  "requestId": "72171fff-70c9-4066-b819-11d3eb549de0",
}

promise

{ all<TOutput>(name: string | undefined, promises: DurablePromise<TOutput>[]): DurablePromise<TOutput[]>; all<TOutput>(promises: DurablePromise<TOutput>[]): DurablePromise<TOutput[]>; allSettled<TOutput>(name: string | undefined, promises: DurablePromise<TOutput>[]): DurablePromise<PromiseSettledResult<TOutput>[]>; allSettled<TOutput>(promises: DurablePromise<TOutput>[]): DurablePromise<PromiseSettledResult<TOutput>[]>; any<TOutput>(name: string | undefined, promises: DurablePromise<TOutput>[]): DurablePromise<TOutput>; any<TOutput>(promises: DurablePromise<TOutput>[]): DurablePromise<TOutput>; race<TOutput>(name: string | undefined, promises: DurablePromise<TOutput>[]): DurablePromise<TOutput>; race<TOutput>(promises: DurablePromise<TOutput>[]): DurablePromise<TOutput>; }

Methods

Method

Description

configureLogger(config)

Configures logger behavior for this context

createCallback(name, config)

Creates a callback that external systems can complete

createCallback(config)

Creates a callback that external systems can complete

invoke(name, funcId, input, config)

Invokes another durable function with the specified input

invoke(funcId, input, config)

Invokes another durable function with the specified input

map(name, items, mapFunc, config)

Processes an array of items, applying durable operations to each with optional concurrency control

map(items, mapFunc, config)

Processes an array of items, applying durable operations to each with optional concurrency control

parallel(name, branches, config)

Executes multiple branches with durable operations in parallel with optional concurrency control

parallel(branches, config)

Executes multiple branches with durable operations in parallel with optional concurrency control

parallel(name, branches, config)

Executes multiple branches with durable operations in parallel with optional concurrency control

parallel(branches, config)

Executes multiple branches with durable operations in parallel with optional concurrency control

runInChildContext(name, fn, config)

Runs a function in a child context with isolated state and execution tracking

runInChildContext(fn, config)

Runs a function in a child context with isolated state and execution tracking

step(name, fn, config)

Executes a function as a durable step with automatic retry and state persistence

step(fn, config)

Executes a function as a durable step with automatic retry and state persistence

wait(name, duration)

Pauses execution for the specified duration

wait(duration)

Pauses execution for the specified duration

waitForCallback(name, submitter, config)

Wait for an external system to complete a callback with the SendDurableExecutionCallbackSuccess or SendDurableExecutionCallbackFailure APIs.

waitForCallback(submitter, config)

Wait for an external system to complete a callback with the SendDurableExecutionCallbackSuccess or SendDurableExecutionCallbackFailure APIs.

waitForCondition(name, checkFunc, config)

Waits for a condition to be met by periodically checking state

waitForCondition(checkFunc, config)

Waits for a condition to be met by periodically checking state